Mark's Stuff

My Foray Into Weblogging. Using this to store interesting items for later review.

Thursday, December 03, 2009

"Three screens and the cloud"

Interesting blog article from Keith Elder about information from PDC 2009:

.Net 4.0 - Start Reading Between the Lines ? Learn Silverlight and Entity Framework



Here's a quote: "Three screens and the cloud"

We heard this over and over at PDC. Let's read between the lines a bit shall we?

I have three screens: Windows Desktop, Web, Mobile. Ok, if I want to write an app that will run on all three what do I as a developer have to do today? Let?s see, well, we could write a ClickOnce deployed Smart Client for the Desktop that uses WPF. For the web, well, we would have to switch gears completely and rewrite our app in Asp.Net or Asp.Net MVC to get that screen. For mobile, even tougher, we have to rewrite the app again to get the mobile version. Let?s think about this differently again. Think about it, how many technologies would a developer have to know in order to an application for these three different screens; WPF, JavaScript, HTML, and CSS will be used just to name a few.

Now, let's switch gears. What if I used Silverlight 4 to write my app? Well, it could work in the browser no doubt. Hmmm, it could also work on the Desktop using the out of browser experience with elevated permissions. What about mobile?

"Wait, didn?t you just say Keith that at Mix we?ll get to see Windows Mobile 7?"

Yes!

"And hasn't there already been talk of using Silverlight for mobile?"

Yes!

"Aha! Three screens with Silverlight, I get it!"

That's right my friendly .Net developers the writing is on the wall. The vision of WPF/e (WPF Everywhere) is about to come true. We've waited for years but it is just around the corner as I predicted would happen years ago.

Labels: , , , ,

Tuesday, August 18, 2009

IE6 Retirement Schedule Is OK by me

There has been some uproar about an article that Microsoft will still support IE6 until 2014 (ref: http://twitter.com/JimHolmes/statuses/3388282884, and RT dozens of times.)

I'm sorry, but I cannot get upset about this news article.  Back in the 90's, we whined and complained that Microsoft (and other vendors) were coming out too fast with software releases, and not supporting releases long enough. Remember that VB 2.0 was only out 6 months before VB 3.0 came out.  And MS Word 98 was replaced by Office 2000 only 8 months after its release.  Microsoft heard and understood, and came out with their Lifecycle Support policy so that we could have some semblance of scheduled lifetime for software releases.

And now we want to whine that Microsoft is following that policy?  I'm sorry, but I'm not going to follow that.  We cannot complain because there wasn't a planned policy, then complain that we don't like the standard policy.  No, Microsoft is OK on this one.

Now, I fully agree that we should not be using IE6.  We need to get users to safer and better platforms, and get them on IE8 whenever possible.  And the sooner the better, especially for relieving our web site development headaches.  The faster the market share for IE6 approaches zero will be good for all of us. 

But as long as there are users using IE6, for whatever reason, I want Microsoft to support it.  I want critical security patches and fixes dealt with and deployed as quickly as possible, and any performance enhancements or rendering fixes continued to be developed. 

And as long there are significant share of our users still using IE6 (20% of total IE population, that I last heard of), we as developers still need to account for those users and make sure our sites don't leave them out.  We develop software for our businesses, and for our business's customers, not for our standards of elegance.  We need to continue to support or users and customers, not ridicule or demean them.

Labels: , ,

Monday, June 15, 2009

Interesting problem: IIS file download = 0 bytes

I ran into an interesting problem at a client site the other day.  Another developer group had written and installed a ASP.Net application (Visual Studio 2008, .Net Framework 3.5 SP1, Windows Server 2003 R2, SQL Server 2005).  Without divulging too many details, let's just say the application had a public site where users could upload a file, and an internal admin site where the internal user could download the file.  The file is being stored in the database in a varbinary(max) column.

After the sites were installed, the internal user had a problem downloading the file; it always came back as 0 bytes.  It did not matter the file type (pdfs and word docs were used), browser type (same for IE6 (standard for company), IE7, IE8, Firefox 3.x, Chrome, Opera , Safari on Windows).  The file was definitely in the database, and the original developer wrote a Windows desktop app to download the file as a temporary workaround.  The original developer swore the file download it worked just fine on their servers, and brought in a more experienced consultant to try to help diagnose the problem.  I was at this client site on another project, and was asked to take a look to see if I could spot anything.

After a few false starts doing some troubleshooting (the original developer said the VS project was a web site project, and had the code-behind files in the web directory, so we would modify the .cs file to try to track the problem, but had no results; turns out it was a web application project, and we were not recompiling the project), we did confirm the byte array from the database field was being populated.  The code was using Response.BinaryWrite, and seemed to be setting the proper headers and sending the data.  We look at the IIS web site settings over and over, trying to find some clue. 

The server the web application was installed on did have other live applications running, so our debugging the production server was limited so as to not affect the other apps. Our next attempt was to setup another Windows IIS server (virtual, on MS Virtual Server) and install the web site app on there.  The file download worked just fine there.  So it appears that the application is OK, it must be an IIS setting causing the problem.  Now that we had a server we knew it worked on, I took the metabase.xml files from both servers and worked to compare them.

That was when I saw the problem: HTTP Compression was turned on the first server.  We had missed it on the IIS Settings because that (the "Service" tab) is only on the property dialog for the Web Sites folder, not on the web sites themselves, and not on the server settings.  Here is the dialog window:

clip_image002

Turning that off did solve the download file problem, but the client was uneasy about turning it off (understandably) since it was likely turned as part of the other applications that was running on that server, and they did not want to risk that apps.

Although I knew it would not affect the other apps to turn off HTTP compression, I looked further into it and saw that HTTP compression can be turned on or off for the entire server, by web site, by directory, by file type, or by individual page, all by using adsutil commands.  I also found a .cmd file in the AdminScript directory of the server turning on HTTP compression, so I modified it to turn off compression for the web site:

CSCRIPT.EXE ADSUTIL.VBS SET W3SVC/Filters/Compression/GZIP/HcScriptFileExtensions "asp" "dll" "exe" "pdf" "aspx" "svc"
CSCRIPT.EXE ADSUTIL.VBS SET W3SVC/Filters/Compression/DEFLATE/HcScriptFileExtensions "asp" "dll" "exe" "pdf" "aspx" "svc"
CSCRIPT.EXE ADSUTIL.VBS SET W3SVC/Filters/Compression/GZIP/HcDynamicCompressionLevel 9
CSCRIPT.EXE ADSUTIL.VBS SET W3SVC/Filters/Compression/DEFLATE/HcDynamicCompressionLevel 9
CSCRIPT.EXE ADSUTIL.VBS SET W3SVC/Filters/Compression/GZIP/HcStaticCompressionLevel 9
CSCRIPT.EXE ADSUTIL.VBS SET W3SVC/Filters/Compression/DEFLATE/HcStaticCompressionLevel 9
CSCRIPT.EXE ADSUTIL.VBS SET w3SVC/Filters/Compression/Parameters/HcDoDynamicCompression true 
CSCRIPT.EXE ADSUTIL.VBS SET w3SVC/Filters/Compression/Parameters/HcDoStaticCompression true 
REM Added exclusion for careeradmin site; mark harr; 6/3/2009
CSCRIPT.EXE ADSUTIL.VBS SET W3SVC/2129524648/root/DoDynamicCompression false

That solved the issue.  But there were a couple other interesting things:



  • I first looked to turn off compression for just the file types (pdf, etc), but it turns out that IIS determines if compression will be done based on the requested file suffix, not the response headers. So since the file was downloaded from a postback to index.aspx, turning off compression on pdf did not have any affect.

  • Then I looked to turn off just for the page doing the download. But since the site was built with a single page (index.aspx) and loading different custom controls (ascx), I could not differentiate the page for IIS.

  • So I just turned off http compression for the admin site.  Figure that was not bad, since the site will only be accessed internally, and not likely over the internet, the lack of http compression will not be an issue.

  • After I finished this, I came up with the thought that perhaps adding a "Response-encoding: gzip" header with the file download may have also solved the problem.  IIS may have already setup that header when it determined it was doing http compression, and the code may have been clearing that header when it did the Response.Clear command before setting up its BinaryWrite.  But the code putting that header would need to ensure that compression was happening and only add the encoding header when desired.  Sometime when I have a few hours to look at that, I will see if that technique will work.

Labels: , ,

Friday, June 05, 2009

SEO on Dynamic Pages

 

SEO on Dynamic Pages - URL rewrites, 301 Redirects, and more SEO on Dynamic Pages

Good article on enhancing SEO on catalog and other dynamic pages.

Labels: