Monthly Archives: January 2009

Yet another happy WordPress user…

Since I am currently in the buying fase for a self-owned serverĀ on a colocation, I thought it to be the perfect time to move over to a self-hosted blog. Since one of my friends and colleagues, Wouter Goedvriend, is a very happy WordPress user, I too gave it a try :)

Hope to meet you a lot on my new blog! Keep up your good work!

Logging duration with System.Diagnostics.StopWatch instead of using DateTime.Now

Still using two DateTime.Now calls to determine the duration of a certain call execution, like beneath?

DateTime start = DateTime.Now;
DoSomeCall();
double secondsToLog = (DateTime.Now - start).TotalSeconds;

This is not at all necessary: using the StopWatch class. The StopWatch class is more efficient than any other solution provided or created in .NET since it uses low-level API calls and supports a high-resolution performance counter (when there is hardware and software support).

Stopwatch watch = new Stopwatch();
watch.Start();
DoSomeCall();
watch.Stop();
double secondsToLog = watch.Elapsed.TotalSeconds;

Windows Explorer from Visual Studio

Windows Explorer is one of my favorites, especially when coding (in Visual Studio). I often navigate to the file, folder, or project I’m currently working on. Clicking “Windows Explorer” in the Tools menu would be helpful if we could manage to get it there… and ‘yes we can!’.

How?
Go to Tools -> External Tools… -> Add.

In the screen you are presented with, enter:

Title: Windows Explorer
Command: explorer.exe
Arguments: /select,”$(ItemPath)”
Leave Initial directoy blank

Click OK. When you click Tools -> Windows Explorer, the explorer will open with the selection on the current file you are editing in Visual Studio.