mha.dk

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:

http://csna01.libredigital.com/?urss1q2we6

 

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:

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

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

Application_Error:
Fired when an unhandled exception is encountered within the application.

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

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

Application_BeginRequest:
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.

Application_EndRequest:
The last event fired for an application request.

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

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

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

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

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

Application_ReleaseRequestState:
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.

Application_ResolveRequestCache:
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.

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

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

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

Session_Start:
Fired when a new user visits the application Web site.

Session_End:
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 http://www.linqpad.net/

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: http://csna01.libredigital.com
 

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: super_pi_mod-1.5.zip (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.


Update!!

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.