May 2005 - Posts - Jon Galloway

May 2005 - Posts

[tip] Using IE when it's not your default browser

Firefox has been my default browser for nearly a year, but there are a few sites that I have to use that use IE specific HTML. A usual offender is corporate intranets, since they've got a captive audiance.

One solution is the Firefox IE View plugin, which added an "Always view in IE" feature in v0.87 (April 05). It pretty much works (be sure to use this release or later), but it's a little bit clunky. It starts to browse to the page, detects the domain is in the IE list, and pops up the page in IE.

A slightly quicker solution for commonly used pages is cheesy, but it works. I create a shortcut to iexplore.exe with the url as a command line argument, like so:

"C:\Program Files\Internet Explorer\iexplore.exe" ""

Make sure to include the quotation marks and the full path, like the example above.

I name the shortcut something short and descriptive - say "TT" for a time tracking system - and drop a copy of it into a folder that's in the environment path, like c:\windows\

Then I can bring up the page in IE with a few keystrokes: Windows-R, TT, Enter

powered by IMHO 1.2

Monoppix 1.0.6 Release

Monoppix is a bootable Linux CD that runs .NET applications on the Mono framework. It makes it easy to see your .NET code running on Linux without installing a thing.

Release Information

This is mostly a stack upgrade release. Here's what's included in Monoppix 1.0.6:

  • Monodoc, mcs, Mono, libgdiplus, gtk-sharp 1.06
  • Xsp 1.0.8
  • Monodevelop 0.51
  • Cairo 0.2
  • (continued support of MySQL 4.1.7)
  • Included .Net in Samples book (HTML format)
  • Improved desktop links
  • Monodevelop bug fixes
    • Application execution directly from monodevelop is now fixed
    • The project type images are now properly displayed

New Team Members

We've added some new team members - Perica Zivkovic and Mark Neustadt:

Perica brings us some Open Source development experience from his previous work with the iPodder project. He's made himself busy:

We asked Mark to join our team due to his great training contributions to the Monoppix community. He graciously accepted and moved all his content onto the site.

  • He's authored 7 beginner and 5 advanced Monoppix tutorials, ranging from an introduction to the environment all the way to desktop development (GtK#), MySQL, and XSP
  • Tutorials include video, source code, and developer manuals
  • We're seeing 20+ video downloads per day
  • Downloading a Live CD preconfigured with Mono on Linux is a pretty big shortcut to getting a look at Mono development, but Mark's video tutorials make it a 5 minute exercise. You just gotta see these things - they're really well done!


  • Monoppix was featured in the May Polish PC World Magazine cover DVD - 65K copies
  • Approximately 1500 ftp and BT downloads since March (probably many more that we can't track)


  • As always, please help seeding the torrent. We've pre-seeded pretty well this time, so downloads should be pretty quick
  • If you can provide an appropriate torrent tracker which is dedicated to legal software releases, let us know (current tracker is running off our site)
  • We'd like some input on roadmap. What would you like to see in future versions? We're hard at work on a 1.1.7 release, and it's looking like it's going to be really cool.
  • Give Monoppix a spin!

As always, you can contact the Monoppix team via the Monoppix bulletin board or via the contact link on my weblog.

Posted by Jon Galloway | 3 comment(s)
Filed under:

Supersize my Windows Media Library

Steve's got a great idea here:

 I'm freaking tired of applications creating their own media libraries. How many photo, music and video libraries do we need? (speaking of that, how many 'import my photo' tools do we need?)

Personally, I would really like to see a central storage facility for media in Windows. Perhaps it's already in Longhorn, I have no idea, but I want a single place (that I specify - why does it have to be on the local box?) that is a repository for all my photos, videos, music, contacts, etc that's easily accessible via a consistent API and common dialogs.

The Windows Logo program should mandate this, IMHO. An application should not be able to get the 'Designed for Windows' seal of approval if they create their own media store.

One reason that Apple does a better job of this is that most applications (not only media) has programmatic access to not only their storage location, but also their functionality (and, yes I am already well aware that apps such as Windows Media Player has this too, but tell me how many music apps use it).

[Source:  The Furrygoat Experience]

This makes a lot of sense. Part of the reason that we need photo management programs is that, as far as Windows is concerned, they're pretty much just a bunch files. Sure, you can jam them in My Photos, but they're still just a bunch of files - plus, you just know Mom's going to drop them on her desktop, right? How about this idea: we make the Windows Media Library that One Library.

  • Expand out the searching / tagging / syncing / viewing to include a nice photo viewer[1]. 
  • Expand the tagging support we've got for our music files so we can tag our photos, and allow multiple category tags for pictures like Picassa.
  • Enhance the database engine from whatever random MS ISAM format they're running on to something on the level of Sql Server Express, or get some of that Lookout indexing goodness in there. Set it up to migrate to WinFS when the time comes, but don't wait for that.
  • Open up the library a lot better than the current COM / C++  API's do now. We need a carrot to balance the stick of the Designed for Windows seal - make it a no-brainer to put media in there and get it out. Make it easy and exciting for developers to do cool things with the library, like you have with Media Center development. Let me build my own photo browser on the library, and let me use SQL to do it. Make your end users choose one digital camera over another one because it works with the Windows Media Library.
  • Make the library internet saavy - let me subscribe to a photo RSS feed (like Flickr) that goes right to my library, and make it easy for me to post my pictures to a blog or photo sharing site. Make sure the RSS feeds work for all media, I don't need a Podcasting application.
  • Let us extend the Media Library with a provider model, and use a provider model to fill the library so it's easy to feed new things into my library (like in the RSS feed above).

More and more, personal computers are becoming media management and viewing appliances, and they really need common media library. How about it, Scoble?

[1] Do not mention the Windows Picture and Fax Viewer or I will slap you. Hey, why does that thing take 30 seconds to open a 30KB JPG on my Athlon 64 3000+ with 1GB RAM? Browsers don't.

Posted by Jon Galloway | with no comments
Filed under:

Avalon and Indigo Beta SDK Now Available

From the main download page for the Betas, you will find a link to the updated SDK (iso format). Looks like Friday's announcement kinda jumped the gun, but it's all available now.

Oh and for those who were asking, yes, this build is 100% compatible with Whidbey Beta 2.


This is the official release of WinFX SDK Beta 1 RC - it runs on .NET Framework 2.0 beta 2 on Windows XP and Windows Server 2003. It's not clear if this is a different binary from the version that snuck out on Friday - people have reported some problems with that one.

Posted by Jon Galloway | with no comments
Filed under:

.Math Expression Compiler

Welcome to .Math, the OpenSource expression compiler for the .NET platform written entirely in C#. Offering speed through compilation of expressions, the library allows for variable handling, an entire function library and the ability to add your own functions.

[via Green Dragon's Lair ┬╗ Blog Archive ┬╗ .Math expression compiler]

Info here, GotDotNet Workspace (with 1.0 Release) here. Play with the demo web page here - a random sample formula to get you started is 1/sin(exp(x)) + cosh(x).

Posted by Jon Galloway | with no comments
Filed under:

Issue with Firefox v1.0.3 upgrade - blank screens

Hmm... this is a bit circular. Don and I both had problems with our Firefox extensions when we upgraded to 1.0.3 - every page we browsed to was blank. I figured out the solution, Don blogged it, so I'm just going to quote him:

I recently upgraded my Firefox install to v1.0.3, only to encounter sporadic blank pages when launching.  One of my coworkers also experienced the same issue and identified a fix.

If you recently upgraded only to find Firefox sometimes displays a blank page at launch, perform the following steps to fix.

  1. After a successful launch, select Bookmarks/Manage Bookmarks from the menu.  A reboot of your computer, or even a reinstall of Firefox v1.0.3 is required to get a successful launch.
  2. In the Manage Bookmarks application select File/Export from the menu to export your bookmarks to a HTML file.
  3. Close Firefox.
  4. Using Windows Explorer browse to "C:\Documents and Settings\[YOUR_USERNAME]\Application Data\Mozilla\Firefox" and delete the "Profile" folder. (may want to just rename the folder so you can find old settings)   NOTE: This will delete all of your profiles and installed extensions/themes.
  5. Relaunch Firefox.  This will create a new default profile.
  6. Open up the Bookmark Manager and select File/Import from the menu.  Select "Import from File" when asked and browse to the file saved in Step 2 above.
  7. Reinstall all extensions and themes.

While I am a huge fan of Firefox, it is reasons like this blank screen issue that Open Source is destined to fail when a commercially supported option is available.  We will see if I am still a "huge fan" when IE 7 comes out later this year.

The Firefox extension model is one of my favorite features, but extensions seem to be the most frequent cause of upgrade problems. I went a step further than Don - I renamed the profile folder, then browsed through the user.js file in my old profile after a successful install and copied some of the settings (like the Session Saver history) into the new profile.

Source: Don Good


Posted by Jon Galloway | with no comments

[link] Rewriting the URL using IHttpHandlerFactory

Don Good told me about Jeff Putz's cool article on Rewriting the URL using IHttpHandlerFactory. I don't know how I missed that one. It's a great technique that gets around all the grimy hacks you need if you're doing this the standard way, using HttpContext.Current.RewritePath(someFile). This one instead maps a custom handler for ASPX files to your class which implements IHttpHandlerFactory. Then in the code logic, you just load the code from the physical ASPX file instead of redirecting to it and screwing with your context:

using System;
using System.IO;
using System.Web;
using System.Web.UI;

public class MyPageFactory : IHttpHandlerFactory
public IHttpHandler GetHandler(HttpContext context, string requestType, 
string url, string pathTranslated)
      context.Items["fileName"] = Path.GetFileNameWithoutExtension(url).ToLower();
return PageParser.GetCompiledPageInstance(url, 
         context.Server.MapPath("~/Content.aspx"), context);

public void ReleaseHandler(IHttpHandler handler)

Read the article - it's short and well written. Don showed me a prototype that was using this, and it worked perfectly. Great idea!

Posted by Jon Galloway | with no comments
Filed under:

An overview of the Enterprise Library


We've been looking for some standard components in my group at work. The main issues were logging, data access, and centralized configuration. We'd kicked the tires on the Enterprise Library a bit, but our reaction was the standard "Gee, it looks complicated. Probably more trouble than it's worth." Then within one week, we got a barrage of EntLib information: a presentation by Scott Mitchell at the local San Diego .NET user group, presentations by Tom Hollander and Blake Dong (Avenade) at the Microsoft San Diego Architect Council, and an onsite Q & A with Tom Hollander. It all made sense: this is exactly what we were looking for, and it might be worth a second look if you'd decided to pass on it, too.

Enterprise Library is for enterprise development

Steve Smith summed that up pretty well here. A lot of people have complained that it's too complex, and it probably is overkill for smaller or standalone applications. The source code (included) has over 1300 files. The previous application blocks were geared towards simplifying and standardizing small discrete application aspects (e.g. data access block was basically a helper class, hence the name SqlHelper), and were pretty simple to use. The Enterprise Library has traded some of that simplicity for the benefits of a configuration driven plugin system that makes the .NET Framework feel like a business development framework.

It's a tradeoff: You put up with a few things:

  • A nominal learning curve (assisted by the quickstart code samples) 
  • A minor performance penalty (designed to be under 5% in most cases, and your application may actually run faster if you take advantage of things like caching and async logging).

In exchange you get a few things that matter to bigger development shops:

  • Simplified configuration
  • Application consistency
  • Futureproofing through plugin architecture
  • A head start on many of the components of robust applications ("streamlining of common use cases" is the official term)

The Enterprise Library is a collection of seven blocks, six of which are optional. All of them require the Configuration block, which controls how they all work and work together. You can replace any of them with a plugin that implements the correct interfaces and is associated in the config file. Here's a quick runthrough on the highlights of each of the blocks. The config tool is big enough that I gave it its own list.

The Seven Blocks and the Config Tool


  • XML driven application configuration, similar to .NET configuration, but adds a lot of features targeted at enterprise development
  • Read / Write - Can update config file settings from code
  • Security built in - supports encryption. Supporting encryption at this level helps with the chicken and egg issues of wanting to secure your configuration information, but needing to configure the security somewhere.
  • Extensibility / flexibility - Provider model controlled in configuration allows you to customize EntLib with plugins, simplifying and reducing the risk of customizing EntLib to work the way your company works.
  • Configuration Tool is included to simplify setup and maintenance. Config is XML and can be manually edited, but Config Tool makes this a lot easier.
  • Updates trigger events in client applications. Configuration updates are different form web.config, which just kills the app domain. Entlib Config changes notify the application via an event. Application decides if it wants to reload configuration.
  • Due to caching of configuration, you should always retrieve config values from block rather than holding onto them separately - can get out of sync.
  • Can set in code or in machine.config if file based config doesn't fit your requirements

Configuration Tool

  • Don't have to use Config Tool if you prefer hacking the XML
  • Design classes map EntLib runtime classes to display, add wizards, etc.
  • Design time classes depend on runtime classes, but never the reverse (don't need to deploy the design classes or Config Tool).
  • Provider Model - Uses intermediate DLL's so there is no binary dependency between a class and the providers that feed it. Mapping of plugins is done in metaconfiguration.
  • Design class pattern allows you to add support your own custom blocks or extensions to existing blocks to the Config Tool


  • Symmetric encryption only (asymmetric key management is more difficult, processing is generally slower)
  • Hashing and salting supported
  • Very simple to use - only 4 methods (CreateHash, CompareHash, EncryptSymmetric, DecryptSymmetric).
  • DPAPI support. DPAPI, the Data Protection API, provides operating system level support for symmetric encryption of secure information. DPAPI key can be associated with machine or user.
  • Abstracts encryption specifics from usage - developer doesn't specify key or algorithm. One reason this is good - crypto is hard, and it's good to let a developer use it without guessing on crypto algorithm usage.

Database Access

  • Abstracts database technology (SQL Server, Oracle, etc. - can use providers to support other data sources)
    • May simplify database portability, but since databases support different technologies, this is not simple and isn't really the goal here.
    • Real goal is to simplify developer portability - makes it easier for developers to move between applications and teams using different databases. Since I work at a company that runs just about all of the major database technologies (SQL Server, Oracle, DB2, Sybase, Informix, probably several I'm forgetting), this sounds nice.
  • Helps ensure effective connection management
  • Uses factory pattern. This is a change from the previous Data Access Application Block, and it trades simplicity for flexibility. One major benefit of this type of pattern is that it integrates smoothly with the Config block, so the connection string and other specifics of data access configuration are transparent to each specific usage
  • This is a Data Access Layer, not a Business Logic / Object Relational Mapper kind of thing. It doesn't generate any classes and doesn't know anything about the tables it's talking to. This is a conceptual issue I've had to explain several times, so I figured it's worth spelling out. You build your Business Logic Layer (BLL) on top of this layer, and it handles communications with your data sources.


  • Handles Authentication, Authorization, Roles, and Profiles
  • Can use Facades to call into legacy security systems


  • Configuration driven, so logging is routed at runtime
  • Distribution strategy
  • MSMQ supported as a sink and / or a distribution strategy
  • MSMQ distributor processor - separate Windows service which processes logging messages in MSMQ, can run on another computer
  • Logging by default requires WMI and Event Log permissions. Can recompile with a compiler define that removes instrumentation; next version will alow disabling the EIF in configuration
  • Contextual trace - see Mitch's great explanation of contextual logging in the EIF. Context flows through the call stack, making the information much more valuable.
  • V2 may allow one log entry to have a collection of categories which adds a lot more flexibility

Exception Handling

  • Facilitates consistent exception handling through an application or enterprise
  • Prevents exposing sensitive data (such as database connection specifics returned in an exception message)
  • Configuration driven exception policies allow changing exception handling policy for different user defined exception categories at runtime via configuration changes
  • Available actions: Swallow, Bubble, Rethrow


  • Support for "Backing Store" in either database or isolated storage (file) - allows for occasionally connected use
  • Differs from ASP.NET cache in that it doesn't require web DLL's, is designed for thread safety in all application types, and supports backing store
  • Doesn't support distributed Read / Write (webfarm, for instance)

Some other random tidbits

  • There have been 100,000 downloads of the EntLib since January.
  • Some overlap with ASP.NET (profile, cache), but simplifies library code. Can use Facade providers in ASP.NET to leverage base functionality if desired.
  • Main patterns - Factory, Provider, Strategy
  • History - Avenade Connected Architecture (ACA.NET) - Avenade was formed by Microsoft and Accenture. They were developing their own system for use in their projects which paralleled work in progress by the Microsoft Patterns and Practices Group, so they merged these together. Enterprise Library is pretty much a version 3.0 product due to its roots as the ACA.NET. Avenade continues to extend the ACA.
  • Can copy Updater Block design DLL's to EntLib bin, and Updater Block will show up in Config Tool
  • Heavily cached, so slow start but <5% performance penalty

Extending EntLib (see Blake Dong's PPT)

  • Gray box - write custom providers
  • Don't inherit from internal abstract classes if possible, stick with interfaces so upgrades don't cause you trouble
  • Minimize coupling between brovider and blocks
  • Use Enum to wrap categories (log categories, for instance) - allows strong typing, compile time typo check
  • Since some of the logic has been moved into configuration file, can be a little tougher to debug. For instance, a log category of "DEGUB" wouldn't cause a config or compile time error, but log entry would never be written since no "DEGUB" category exists.
  • Can use Facade Pattern (wrapper) to future proof
    • Company.Name.Caching wrapps Caching block, for instance
    • Can add Logging, AOP type stuff to wrappers
    • Upgrade t new version of EntLib by updating the version number reference to the wrapper instead of EntLib config files everywhere
  • ACA includes a pretty cool Attribute based Aspece Oriented Programming (AOP) system. Post-build step drives codegen which configures EntLib services.


Microsoft San Diego Architect Council
EntLib Overview- Tom Hollander, Microsoft - PPT -
Adopting Entlib - Blake Dong, Avenade - PPT - 
Extending EntLib- Tom Hollander, Microsoft - PPT -

San Diego .NET User Group
Examining the Microsoft Enterprise Library - Scott Mitchell - Zip -

Webcasts -
Tom Hollander's blog
Hirshambaz's blog
Scott Densmore's blog
Some other Tom Hollander

Installation tips / tricks

Install build 1473 and Memory Leak patch from the GotDotNet site.

Post-Installation step
Immediately after installing Enterprise Library, you MUST install the instrumentation and performance counters.

start\All Programs\Microsoft p&p\Enterprise Library\Install Services

This will execute installutil on each of the assemblies and register the performance counters.  I would hope that in the next version of the installer, this option will be automatically executed after the solution is compiled. (via

Posted by Jon Galloway | 2 comment(s)
Filed under:

[VPC] Compressing VHD files

As mentioned some time ago, we're shuttling VHD files around the office to share preconfigured developer environments. Even precompacted, VHD files are still pretty huge - 5 to 10 GB. They can compress down quite a bit, though - as much as 70% or so.

The built in "compressed file" support in Windows can choke on files this size. I've been using 7-zip, a free compression program, to shrink mine. It includes support for ZIP, but self-extracting SFX's can cut a few hundred more MB's off the file size. That can save several minutes on a network file copy, or make the difference between whether the file will fit on a DVD. For example:

VHD - 5.4GB
Zipped VHD - 2.1GB (38%)
SFX VHD - 1.7GB (31%)

Here are some batch files which I'm using to compress the images. They use the command line version of 7-Zip.  I'm sure these batch files can be improved, or I could add a right click option to VHD files or something - I'm open to suggestions. The main thing I wanted to share, though, is the command line settings for max compression SFX and ZIP compression:

SFX (Self Extracting EXE):

cd "d:\virtual machines\VS2005\"
c:\Utils\File\7zip\7za.exe a -sfx -mx=9 VS2005Beta2.exe VS2005Beta2.vhd


cd "d:\virtual machines\VS2005\"
c:\Utils\File\7zip\7za.exe a -tzip VS2005.vhd -mx=9

Posted by Jon Galloway | 1 comment(s)
Filed under:

[VPC] Using Virtual PC for developer portability

I've been using VPC quite a bit lately. At work, we've got a few applications which can take days to get set up for development - one app is ASP.NET mixed with VB DCOM on DB2, another is even more confusing. Both take a few days to configure, and that's if you follow the directions and ask the guys who built it. That kills developer portability - a 30 minute bug fix becomes a 30 hour bug fix if the developer hasn't gone through the installation initiatiation on that system yet.

So when our groups officially merged recently and cross-training was looking unavoidable, I worked with the leads on each of these systems to configure a VPC development image. The nice thing with this is that the system is correctly configured by someone that knows what they're doing. The image is fully patched and includes Visual Studio, configured websites, appropriate database client tools, virus scanning software, and source control client software.

Now, moving a new developer onto a project is as simple as installing VPC (about 5 minutes), copying the image (DVD / network share / USB2 external hard drive), and starting it up. Of course, the developer needs to check out the latest code from source control, but they just need to pull down the deltas since the image was built.

I know this is old news and elementary VPC usage for some developers. At Microsoft, for instance, QA tests on VPC's so they can give an image in the error state to the developer to debug. However, it's saved our group so much time lately that I wanted to share our success story. More VPC goodies and links to follow.

Posted by Jon Galloway | 3 comment(s)
Filed under:
More Posts Next page »