At a recent conference I went to, I entered a drawing to win a prize from one of the sponsors.  Other prizes being given out by other vendors (and the conference host) were things like UMPCs, Xbox 360 consoles, Xbox 360 games, and so forth.  Pretty cool stuff.

A month later I got this email from the sponsor that told me I had won something and said, quote (emphasis theirs), “If you’d like to claim your fabulous prize, please respond to this email with your mailing address.”

I was stoked.  Stoked!  I don’t really ever win anything, so to win something on this level - especially if they have to confirm my mailing address after the form of entry was to drop my business card, complete with my mailing address, into a basket for the drawing - was pretty exciting.

I psyched myself up, wondering what it could be.  A UMPC would be cool, but - no, don’t get your hopes up that high.  Maybe an Xbox 360 game.  I sure hope I don’t have it already.  I suppose I could trade it in if I do.  Maybe a gift card somewhere neat.  Even if it’s something like Amazon, hey, bonus.  What could it be?

The prize arrived today.  I saw it in my mailbox at work and walked over to it, wondering.  It was in a manila envelope, so it wasn’t anything as big or bulky as a UMPC… but it could still be an Xbox game or a gift card.  I walked over and picked it up, slightly unnerved by the… soft… feel to the envelope.  But it could be packaging!  It could just be the packaging!

I took the envelope back to my desk and tore into it, no longer able to contain the anticipation, firmly ready to blog about how freaking awesome I am with this bitchin’ prize.  I pulled it out and…

What the hell kind of happy horseshit is all this?

What is that? Golf club? Thumbs up? Speech
bubble?My “fabulous prize” is a t-shirt of dubious manufacture.  No brand I’ve ever heard of.  Far too thin to wear without - you guessed it - another t-shirt underneath.  (Hey, not even my wife wants to see my man-boobs showing through, and I certainly don’t blame her.  I wouldn’t want to see that, either.)  Oh, and it’s got this ad on the front for careers at the company that, frankly, I don’t get.  There’s this weird shape that is a cross between an upside-down speech bubble and the head of a golf club that I think is supposed to be a hand giving a “thumb’s up” sign, but I can’t be sure.  This weird image thing is intermingled with the phrase “[Vendor Name] Makes Work FUN.”  Ummmm, okay.

I feel a little like Ralphie in A Christmas Story when he decoded Little Orphan Annie’s secret message: “Drink Your Ovaltine.”  Ovaltine?!

Message to vendors at all future conferences I go to:  Rather than give out crappy prizes, just… don’t.  Don’t give this junk away.  You’re ruining the environment by consuming resources, and I don’t need any more rags to wax my car with.  Instead, give away one good prize that you won’t award to me because I’m a loser and save me the effort of another blog entry.

downloads, aspnet, net comments edit

I posted before about an ASP.NET 1.1 way to deploy in a close-to-binary-only format, embedding ASPX files as resources in your assemblies.  That way doesn’t work in .NET 2.0… but it turns out they added something better in .NET 2.0 that lets you create a more complete solution - System.Web.Hosting.VirtualPathProvider.

The basic idea is that rather than talk directly to the filesystem, ASP.NET provides a “hosting environment” and asks for files from there.  VirtualPathProviders can register and respond to these requests.  By default, ASP.NET has a file system based provider registered, so everything works out like it always did.  While you can’t virtualize everything (web.config, App_Code, and so forth all actually have to exist in the filesystem), other ASP.NET files (*.aspx, *.ascx) can exist in a virtual file store.

There’s a great article on MSDN about how to serve your site from a ZIP file, but I wanted to take it one step further and serve from embedded resources.  Enter Paraesthesia.Web.Hosting.EmbeddedResourcePathProvider.

This VirtualPathProvider implementation allows you to register assemblies that are allowed to serve embedded files and specify on those assemblies which embedded resources are allowed to be served.  After you register the provider (programmatically at app startup), when ASP.NET asks for a specific page it will ask the provider.  If the provider finds that file in embedded resources, it’s served from there; if not, it falls back to the filesystem as usual.

Detailed usage is included in the API documentation and an implementation can be seen in the included demo site.  On a high level, you need to:

  1. Set each page, control, or file in your web project that you wish to serve embedded as embedded resource.  (Normally these are “Content” files - switch to “Embedded Resource” in your project to embed them.)
  2. Add a Paraesthesia.Web.Hosting.EmbeddedResourceFileAttribute to your web project assembly for each embedded page.  This lets the VirtualPathProvider know which resources are allowed to be served (and allows you to differentiate files that get served from resources that are used for other purposes).
  3. In your Global.asax, at application startup, add a registration for the EmbeddedResourcePathProvider: HostingEnvironment.RegisterVirtualPathProvider(new EmbeddedResourcePathProvider());
  4. In your web.config, add a configSection called embeddedFileAssemblies that gets parsed by Paraesthesia.Configuration.StringCollectionSectionHandler. This section will contain the list of assemblies that the VirtualPathProvider should query for EmbeddedResourceFileAttributes.
  5. Optionally specify the ability to override embedded files with files in the filesystem by adding an appSettings key called Paraesthesia.Web.Hosting.EmbeddedResourcePathProvider.AllowOverrides and setting it to “true”.

A demo web site with an installer is included to show the provider in action.  It will also help you see what the code/config/attribute declarations are so you can follow that pattern in your own usage.

This sort of thing, in combination with things like the WebResourceAttribute and WebResource.axd can get you ever closer to serving an entirely binary web site.


  • This won’t work for sites that rely on file system security. I primarily work with forms authentication, so this isn’t a problem for me. It may be for you.
  • Cache dependencies on embedded resource files are actually set on the assemblies that contain the files.
  • It doesn’t support “directories” so if you use the HostingEnvironment to go directory browsing, you won’t see the embedded files.
  • There’s some weirdness with IIS where you can’t set the “default page” for a directory to be an embedded file.  IIS detects it’s not there and pre-emptively returns a 404.
  • Your site has to run in High trust mode for this to work. This is a requirement of the VirtualPathProvider framework.
  • This is going to be a one-shot deal. I’m not going to be posting updates or actively supporting it or anything. Take it at your own risk, your mileage may vary, etc.
  • The source bundle includes the source for the VirtualPathProvider, related attributes, support classes, a readme, and a demo web site illustrating the project in action. The compiled bundle is the compiled assembly, the XML API doc, the installer for the demo site, and a readme.
  • It’s totally free and open-source. Do whatcha like.

Download EmbeddedResourcePathProvider Compiled Package

Download EmbeddedResourcePathProvider Source

Found this nifty little thing via Penny Arcade.  It’s a site where you draw a 2D character and they make it dance around in 3D using Flash.  I threw together this stick figure one to see how it works.  Sorta neat, and free.  But, damn, the music is annoying.

Note that I don’t think they thought about scalability on the thing and it’s become reasonably popular, so it seems to be hit or miss on whether the thing actually plays.

media, tv comments edit

Saw a preview for a new CBS show called Kid Nation last night.  The idea is that they set 40 kids up in an old west town with no adults around and see how they fare.

Anyone else think this sounds like Lord of the Flies, western style?  I’m waiting for the part where Piggy gets killed on national television.

Yeah, they’ll probably edit that out.

Greg posted some great video that one of the crewmembers, Cassie, took during the fireworks show we did this year.  It’s pretty cool.  About 1:15 into the video, it zooms down and you can see the line of mortar racks and four people standing a few yards back from where it’s all going off.  I’m standing in that group with a road flare on the end of a stick (not lit), waiting to ensure that everything goes off.  (If one of the shells doesn’t go off electronically, I get to light up the flare and run out and light it by hand.  Fortunately that didn’t happen.)