Random thoughts of wisdom - the personal blog of Michael Holm Andersen

Free SQL Server 2008 book

Sign up to dowload a free copy of the Introducing SQL Server 2008 book when it's published:


Commenting Code Blocks (Ctrl-K, Ctrl-C)

Most of the time I'm using fullscreen in Visual Studio, however when VS is in fullscreen the standard toolbar buttons are also hidden, which is fine. The only problem is that  the comment/uncomment buttons are also hidden. After a bit of searching through the documentation of VS 2008, I found what I was looking for: The short-cut keys for comment / uncomment - and here they are: 

Press Ctrl-K, Ctrl-C = comment code block.

Press Ctrl-K, Ctrl-U = uncomment code block. 

Having access to the comment/uncomment feature of VS 2008 in fullscreen using the above keyboard shortcut is really nice! - Enjoy! :-)

Windows Vista - Free Screen Capture Tool

Did you know that Windows Vista has a free screen capture tool? Its called the Snipping Tool.

Well .. if you're tired of pressing Alt+PrintScrn, take a look at this!


Global.asax file - events

I've been using many of the events in the global.asax file quite a bit lately, but had a hard time finding a complete list of all the events available. So I decided to make one, and here it is:

Fired when an application initializes or is first called. It's invoked for all HttpApplication object instances.

Fired just before an application is destroyed. This is the ideal location for cleaning up previously used resources.

Fired when an unhandled exception is encountered within the application.

Fired when the first instance of the HttpApplication class is created. It allows you to create objects that are accessible by all HttpApplication instances.

Fired when the last instance of an HttpApplication class is destroyed. It's fired only once during an application's lifetime.

Fired when an application request is received. It's the first event fired for a request, which is often a page request (URL) that a user enters.

The last event fired for an application request.

Fired before the ASP.NET page framework begins executing an event handler like a page or Web service.

Fired when the ASP.NET page framework is finished executing an event handler.

Fired before the ASP.NET page framework sends HTTP headers to a requesting client (browser).

Fired before the ASP.NET page framework sends content to a requesting client (browser).

Fired when the ASP.NET page framework gets the current state (Session state) related to the current request.

Fired when the ASP.NET page framework completes execution of all event handlers. This results in all state modules to save their current state data.

Fired when the ASP.NET page framework completes an authorization request. It allows caching modules to serve the request from the cache, thus bypassing handler execution.

Fired when the ASP.NET page framework completes handler execution to allow caching modules to store responses to be used to handle subsequent requests.

Fired when the security module has established the current user's identity as valid. At this point, the user's credentials have been validated.

Fired when the security module has verified that a user can access resources.

Fired when a new user visits the application Web site.

Fired when a user's session times out, ends, or they leave the application Web site.

LINQPad - Learning LINQ the easy way!

If you're using LINQ, be sure to download LINQPad. With LINQPad you can query SQL databases using LINQ. It's really cool and supports:

  • LINQ to SQL
  • LINQ to Objects
  • LINQ to XML


Best of all .. it's free! - Download from

Free LINQ book from MS Press

Microsoft has decided to release a free PDF version of the book "Introducing Microsoft LINQ", by Paolo Pialorsi and Marco Russo, to public domain. The complete book, and sample chapters from "Introducing ASP.NET AJAX" and "Introducing Silverlight 1.0", can be downloaded right here:

Virtual PC 2007 Hardware Virtualization

I've got a new PC, and it's really really fast!! :-) .. so - of course - I'm running Vista Business, 64 bit and installed Virtual PC 2007 on it a couple of days ago and was blown away by how extremely fast my virtual machine was running - in fact I could'nt tell the different between 'the real one' (host machine) and the virtual one!

So .. I set out to measure the difference. Using SuperPI mod v1.5 - download: (60.44 kb) - Here are the results: 

As stated above - this is the "real" machine, which in short is a Intel Core 2 Quad Q6600 with 8GB Memory running Vista Business, 64 bit edition. 


The above result is my IBM ThinkPad T60 laptop at work with a Intel Core 2 Duo, 2GB memory running Windows XP SP2, 32 bit edition.


And now .. the cool thing!!

The above is a Virtual PC 2007 (64 bit edition) machine running Windows XP SP2 with 1GB of memory - again running on the Intel Core 2 Quad Q6600 with 8GB Memory running Vista Business, 64 bit edition.

Note the performance!!! - It's much much faster than my high-end T60 laptop!! - Why is this?! - Well it's due to the fact that my new PC supports Hardware Virtualization, which is then enabled in the Virtual PC 2007:

So.. if you're planning to use Virtualization on your workstation / desktop pc, make sure you get a motherboard / CPU which supports hardware virtualization.


In order to make the test complete, I also ran the 1M test on my VMware image, running on my T60 notebook:

The VMware machine is 6.42x times slower than Windows XP running in Virtual PC using Hardware Virtualization.