Scott Hanselman

Caching in ASP.NET - VaryByParam may need VaryByHeader

November 5, '05 Comments [5] Posted in ASP.NET | DasBlog | HttpModule
Sponsored By

I was tidying up the blog this evening and adding a Reviews category when I visited one of my own pages and noticed that chunks of content were in German. I literally did a double take.

Then I realized that one of my performance optimizations since the site's been getting slammed was to add this to Permalink.aspx (the page that ultimately services DasBlog's single-post pages, no matter what you see in the URL.)

<%@ OutputCache Duration="1800" VaryByParam="*"%>

What could be wrong with that you ask? The idea was to handle different combinations of input and cache page output as appropriate. However, what input would cause my site to serve me, an anglophone, German?

Well, if a German fellow browsing with his browser's Accept-Language header set to anything like "de-DE" and he happened to be the FIRST guy to visit a specific page before it was cached, given the directive above, the page would be cached as it was shown to him. DasBlog will generate most non-content text in the requested language.

Ah! So I needed to:

<%@ OutputCache Duration="1800" VaryByParam="*" VaryByHeader="Accept-Language" %>

Problem solved.

NOTE: I do use HttpCompression and some folks add Accept-Encoding to the VaryByHeader, but the HttpModule I use adds that programatically so everyone gets what they expect. All this caching DOES add up to memory. If someone visted every page in my site at least once with every possible language value, along with HttpCompression on in their browers, then again with HttpCompression off, my Web Server would have to hold a least numOfPages*2*numOfLanguages cached versions of pages.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

View Internet Explorer in a Firefox Tab

November 5, '05 Comments [7] Posted in Musings
Sponsored By

IetabI'm a fan of IEView and FirefoxView, two Firefox extensions that let me Right-click in Firefox and View in IE or Right-click in IE and click View in Firefox. They are very complimentary and have served me well.

Today both MikeG and Lifehacker pointed me to this stunning gem: Internet Explorer in a Firefox tab! I feel dirty already. What kind of world do we live in that creates such mutant children? What price my soul?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Listening FASTER and more effectively

November 5, '05 Comments [9] Posted in ASP.NET | PDC | Speaking
Sponsored By

One of the coolest things about Cingular's Voicemail system is it's ability to speed up playback of audio by pressing "6." Each press makes the audio playback faster...2x, 3x, 4x. It's great. I HATE voicemail, make no mistake, but at least it's bearable in double speed.

I noticed that when listening to audiobooks (m4b) files like those from Audible on my iPod Nano, I can also up the speed. It looks like about 1.5x normal speed. Not too bad, but it really makes a different. Now I'm addicted to it. The new iPod's implementation is nice because it speeds up the audio without changing the pitch of the voice. I speculate they are cutting out slices of sound, rather than true speed up.

I read pretty fast, but I've stopped watching most presentations and many podcasts because I just can't stand the pacing. However, while watching the PDC videos (http://microsoft.sitestream.com/PDC05/) I noticed (as did Steve Maine) that you can right-click on the video and select Play Speed->Fast and watch the presentations in 2x speed! (I'd prefer 3x or 4x). As a bonus, the demos (since they are WMVs) are also faster.

Now I feel like I can really get through the PDC sessions at my speed. I feel as if a whole wealth of information has been opened to me. Audiobooks will flow by at the same speed regular books do.

Now if only ABC would play "Grey's Anatomy" in 2x speed...

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Building .NET 1.1 Projects using Visual Studio 2005

November 5, '05 Comments [1] Posted in ASP.NET | Coding4Fun | Nant | Tools
Sponsored By

UPDATE: The MSBuild Everett Environment (MSBEE) has just been announced! Soon this will be a (reasonably) supported scenario and we'll all be able to build both 1.1 and 2.0 versions of .NET code on Visual Studio 2005. Shiny.

I'm definitely digging the information on Jomo Fisher's MSBUILD blog. I've long been critical of MSBUILD calling it a "NAnt wanna-be" (usually in bitterness) because I'm SUCH a NAnt fan. However, while writing the book and working with VS.NET 2005 on the Coding4Fun articles I've grown to respect MSBUILD as an entity in its own right. More and more, I've been consistently impressed with it's flexibility and power.

Here's some gems from Jomo's site:

  • Programmatically Converting older Projects to MSBuild - This kicks ass:
    using System;
    using System.Text;
    using Microsoft.Build.Conversion;
    class ConvertProject
    {
         static void Main(string[] args)
         {
              ProjectFileConverter c = 
    new ProjectFileConverter();
              c.OldProjectFile = args[0];
              c.NewProjectFile = args[1];
     
             c.Convert();
         }
    }
  • Using VS.NET to target .NET 1.1 - A great and very visceral example of how the .targets system works. Additional info at Jon Galloway's blog who linked to Armand's blog. I ended up using Armand's "Everett Target" installer and it worked great with RTM. Armand's installer is a roll-up of Jomo's sample.
    • Disclaimer: This target doesn't support COM references, Web references and a few other cases. But it sure proves the concept!
  • ACTION REQUIRED (That means you blog reader!): Clichten is looking for feedback on this very issue. Should Microsoft offer rich target support for ISVs and vendors to target 1.1 with VS.NET 2005? Damn right they should.

Other MSBUILD loveliness from elsewhere on the 'Net:

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

RFC - RSS Advertising

November 4, '05 Comments [27] Posted in Musings
Sponsored By

Request for comment: I do Google Adsense and no one has complained. What do you guys think if I inserted small ads in my RSS feeds? Every item? Every 3rd? This is to pay for gadgets to review and bandwidth; I'm not getting rich on this.

What do you think?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.