William Bartholomew

Musings on software engineering, technology and Aspergers Syndrome.

Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build

with one comment

I’m proud to say that after many months of work Sayed Ibrahim Hashimi and I have completed work on Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build (PRO-Developer). It is being published by Microsoft Press and is due out on 7th January 2009.

Written by wbarthol

December 1, 2008 at 10:29 pm

Documentation Is There For A Reason

leave a comment »

Michael Kaplan’s post “y? Because it’s documented that way!” raises a good point about undocumented behaviour. Basically, just because it works doesn’t mean you should, unless it’s documented that is. If you rely on undocumented behaviour you are exposing yourself to a higher level of risk when the API you use is revised.

Whether one looks at the Custom Date and Time Format Strings used by things like DateTime.ToString(string) or the strings in GetDateFormat or the strings in GetTimeFormat, it is clear that some characters (like H and M) have specific meaning attached to the cased variants.

In my book, since only the lowercase y is used here, the uppercase behavior is undefined — if it works then have fun but you really shouldn’t; if it fails then you kind of asked for that failure….

And more importantly, if the meaning changes in the future then that is also something requested in the improper use. and the nature of H vs. h and M vs. m kind of underscores this.

Written by wbarthol

November 25, 2008 at 10:28 pm

Posted in dotnet, programming

Freeing Up Space On C:

leave a comment »

Scott Hanselman has posted a fantastic guide on how to free up space on C: on your Vista machine:

http://www.hanselman.com/blog/GuideToFreeingUpDiskSpaceUnderWindowsVista.aspx

Written by wbarthol

October 21, 2008 at 4:14 pm

Posted in sysadmin

Could Not Start Message in Windows Scheduler When Running Batch File on Windows Server 2003

leave a comment »

I was getting the error “Could Not Start” in Windows Scheduler when trying to run a batch file as a non-administrator even though the user had permission to run as a batch job.

The issue was that the permissions on cmd.exe do not allow execution by batch jobs by default, this issue and the solutions are described in the following knowledgebase article:

http://support.microsoft.com/?kbid=867466

Written by wbarthol

October 21, 2008 at 10:23 am

Posted in sysadmin

Installing SQL Server 2005 On Windows Vista/IIS 7

with one comment

While doing a SQL Server 2005 installation on Windows Vista I received a warning during the System Configuration Check stating that IIS was required although I already had IIS installed.

image5 

After some searching I found the following knowledgebase article http://support.microsoft.com/kb/920201 which describes how to resolve the warning.

Written by wbarthol

October 17, 2008 at 12:46 pm

Only Catching Exceptions When Debugger Isn’t Attached

leave a comment »

When building applications that will run unattended (for example from a scheduled task or a Windows Service) you usually need to be quite aggressive when catching exceptions. This can be quite detrimental to the debugging experience and there are two common workarounds to this problem:

Configuring Visual Studio to Break When Exceptions Are Thrown

By default Visual Studio will break when exceptions are unhandled, but if you have aggressive exception handling then most exception will be handled and Visual Studio will never break. You can configure Visual Studio to break when an exception is thrown rather than only if it’s unhandled from the Debug | Exceptions menu. This shows the dialog below which allows you to choose for each exception type under which circumstances Visual Studio will break.

image3

Adding Breakpoints Manually

The alternative is to manually add breakpoints in the exception handlers you’re interested in debugging as shown here:

image4 

But Wait… There Is Another Option

Visual Basic allows you to add a filter to your exception handlers specifying a condition under which the exception handler will be in effect.

We can leverage this to make our handler only catch the exception if there isn’t a debugger attached which means if a debugger is attached the exception will be unhandled and the debugger will automatically break.

We use the shared IsAttached method of the Debugger class in the System.Diagnostics namespace to detect if a debugger has been attached as shown in this example:

Try
    teamFoundationServer.EnsureAuthenticated()

Catch ex As TeamFoundationServerException When Not Debugger.IsAttached
    My.Application.Log.WriteException(ex)
    Environment.Exit(ExitCode.TeamFoundationServerExceptionAuthenticating)

Catch ex As WebException When Not Debugger.IsAttached
    My.Application.Log.WriteException(ex)
    Environment.Exit(ExitCode.WebExceptionAuthenticating)

End Try

Written by wbarthol

October 6, 2008 at 10:13 am

Posted in dotnet, programming

Windows Live Writer Settings

leave a comment »

To be the most productive with Windows Live Writer I change the following settings in Tools | Options:

image 

image1 

image2

Written by wbarthol

October 5, 2008 at 12:54 pm

Posted in utility

Rapid Blogging Using Windows Live Writer and AutoHotkey

leave a comment »

While I’m talking about AutoHotkey here is the script I use for launching Windows Live Writer. It is executed by pressing Windows Key+B and it switches to Windows Live Writer (or launches it if it isn’t running), starts a new post by sending the Ctrl+N shortcut, and move the cursor into the title field by sending Shift+Tab.

; Open Windows Live Writer
#b::
  LiveWriterTitle = Windows Live Writer
LiveWriterPath = %ProgramFiles%\Windows Live\Writer\WindowsLiveWriter.exe
  SetTitleMatchMode, 2
  IfWinNotExist, %LiveWriterTitle%
  {
    Run %LiveWriterPath%
  }
  WinActivate, %LiveWriterTitle%
  WinWaitActive, %LiveWriterTitle%
  Send, ^n ;Start a new post
  Send, +{Tab} ;Move the cursor into the title field
  return

Written by wbarthol

October 5, 2008 at 12:49 pm

Posted in utility

Making Ubiquity Ubiquitous

with 7 comments

I recently read an post about Mozilla Ubiquity on Lifehacker and it’s an impressive add-in for Mozilla Firefox. One of the biggest limitations I see is that its keyboard shortcut is only available from within Firefox; I really want to be able to invoke it from whatever application I’m currently using.

With a few lines in an AutoHotkey script this was easily achieved. This script is executed whenever you press Windows Key+Space and switches to Firefox (or launches it if it isn’t running) and then sends the Ubiquity keyboard shortcut (Ctrl+Space) to that Firefox instance.

; Make ubiquity ubiquitous
#space::
  FirefoxTitle = Mozilla Firefox
  FirefoxPath = %programfiles%\Mozilla Firefox\firefox.exe
  SetTitleMatchMode, 2
  IfWinNotExist, %FirefoxTitle%
  {
    Run %FirefoxPath%
  }
  WinActivate, %FirefoxTitle%
  WinWaitActive, %FirefoxTitle%
  Send, ^{Space}
  return

Written by wbarthol

October 5, 2008 at 12:22 pm

Posted in utility

Awarded MVP Status for 2009

with 8 comments

Early this morning I received an email informing me that I’ve received a Microsoft Most Valuable Professional award to recognise the contributions I’ve made to the Team System community.

Written by wbarthol

October 2, 2008 at 9:09 am

Posted in Uncategorized