After updating WordPress to 2.8.4 I get the XMLRPC 500 Internal Server Error, when posting with Microsoft Windows LiveWriter

The solution is to change the type of the column post_parent:

cd "C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\"

mysql.exe –u root -p
Enter password: ***********************

mysql> use MyWordpressDatabase
Database changed
mysql> ALTER TABLE wp_posts CHANGE post_parent post_parent BIGINT;


Microsoft Visual Studio 2008 keyboard shortcuts


Keyboard Shortcut Description
F12 Go to definition
Ctrl+Shift+8 Go back to place you invoked “Got to definition (F12)”
Shift+F12 Go to references, if you used F12 you could use Shift+F12 to go back to the place you invoked the “Go to definition”, but you will have to no the location, to choose from.
Ctrl+M+O Collapse all sections of code in a file
Ctrl+M+P Expand all sections of code in a file

The standard windows keyboard shortcuts for expanding and collapsing treeviews are:
Numeric Keypad *: Expands everything under the current selection
Numeric Keypad +: Expands the current selection
Numeric Keypad -: Collapses the current selection.
RIGHT ARROW: Expands the current selection if it is not expanded, otherwise goes to the first child
LEFT ARROW: Collapses the current selection if it is expanded, otherwise goes to the parent
All keyboard shortcuts work in the Microsoft Visual Studio 2008 explorer except for the collapse on the solution.

If you want all files in a solution to be collapsed use the tool: PowerCommands for Microsoft Visual Studio 2008:
It adds a command: Collapse Projects:
This command collapses a project or projects in the Solution Explorer starting from the root selected node. Collapsing a project can increase the readability of the solution. This command can be executed from three different places: solution, solution folders and project nodes respectively.

Most keyboard shortcuts for Microsoft Visual Studio 2008 can be found at:

Microsoft Windows 7 RTM 64bit and Internet Explorer 8 new tab hang after Vault Client v3.1.9 installation

After installing SourceGear Vault client v3.1.9 on a Microsoft Windows 7 RTM 64bit machine, opening a new tab in Microsoft Internet Explorer 8 (32 bit), by pressing ctrl + click on a link, the new tab will hang, showing a white screen. This is caused by the installation of the SourceGear Vault client v3.1.9. (The Microsoft Internet Explorer 8 (64 bit) does not have this problem).

An error will also occur when you open the Microsoft SQL Server Management Studio and connect to a SQL Server instance:

Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Microsoft.VisualStudio.OLE.Interop.IServiceProvider’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{6D5140C1-7436-11CE-8034-00AA006009FA}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). (Microsoft.VisualStudio.OLE.Interop)

> Install the SourceGear Vault client v3.1.9 in "C:\Program Files (x86)\SourceGear\Vault Client"
> Backup all files and folders from the folder "C:\Program Files (x86)\SourceGear\Vault Client" to a backup folder "C:\Program Files (x86)\SourceGear\Vault Client Backup"
> Uninstall the SourceGear Vault client v3.1.9
> Restore all files and folders from the "C:\Program Files (x86)\SourceGear\Vault Client Backup" to the "C:\Program Files (x86)\SourceGear\Vault Client"
> Create a FixSourceControlProviderOnWin7x64.reg file and paste the following values:

Windows Registry Editor Version 5.00

"ProviderRegKey"="Software\\SourceGear\\Vault Client"

"SourceGear Vault Client"="Software\\SourceGear\\Vault Client"

Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SourceGear\Vault Client]
"SCCServerName"="SourceGear Vault Client"
"SCCServerPath"="C:\\Program Files (x86)\\SourceGear\\Vault Client\\VaultIDE.dll"

> Run the FixSourceControlProviderOnWin7x64.reg file.

Microsoft Windows 7 and the things I noticed

I just installed Microsoft Windows 7 and the things I noticed where:
(these are not necessarily new features)
> During the installation you can simply set Language: English, Regional Settings: Dutch and Keyboard layout: Us international
> Overall Windows 7 feels snappier and more responsive
>  Windows wants to download and install 426,5 MB of updates?!
> Downloading a file from the internet, the explorer icon shows the progress:
image image

> You can shutdown you’re pc directly from the inlog screen
> Windows 7 recognizes drivers for ESATA pci express cards out of the box
> The first thing you should do after installing drivers is determining the Windows Experience Index by running the > Start > Control Panel > All Control Panel Items > Performance Information and Tools, this will enable Areo if you’re hardware supports it.
> You can maximize and switch windows to other monitors by pressing the Windows key and the arrow keys

> The Clock finally displays the date and time 
> By pressing the windows key you can directly find and start all you’re programs en documents

> You can pin programs to the taskbar
> You can pin notification icons by dragging them on the taskbar

> You can still use the Windows Snipping Tool to capture a screen shot, or snip, of any object on your screen, including menu’s
if you want to create a screen grab of a menu like the start menu: After you open Snipping Tool, press ESC, and then open the menu that you want to capture. Press CTRL+PRINT SCREEN. Click the arrow next to the New button, select a snip type from the menu, and then use your mouse or tablet pen to capture the menu.

> To manage you’re computer you can right click the Computer in the start menu and press “Manage”
> You can create sticky notes  on you’re desktop
> The Windows calculator is pimped:
You can now convert and calculate date differences
Convert values
DWORD, Hex values and fuel consumption
Show the history of you’re calculations

> Burn ISO image out of the box
> Create a New folder in Windows Explorer with one click:
> After installing I had to configure the correct cpu speed for VMWare: C:\Users\All Users\VMware\VMware Workstation\config.ini
   changed settgins:
   host.cpukHz = "2330000"
   host.noTSC = "TRUE"
   ptsc.noTSC = "TRUE"
and change the Additional memory setting to “Fit all virtual machine memory into reserved host RAM”

> Using VMWare 6.5.2 and NAT does not work out of the box, using the steps on solved the problem.
> Recently opened files can be opened directly from start menu
> Switching to multiple monitors or projector can be done with the Windows key + P shortcut

Best Practices C#

This article will be updated every time I run into a best practice.

Checklist Microsoft Visual Studio 2008 Solution and Projects
– Solution name should be Customer.Product.sln, like MyCustomer.MyProduct.sln
– Project name should be Customer.Product.Subsystem.csproj, like MyCustomer.MyProduct.MySubsystem.csproj
– Setup project name should be Customer.Product.Subsystem.Setup.csproj, like MyCustomer.MyProduct.MySubsystem.Setup.csproj
– Test project name should be Customer.Product.Test.csproj, like MyCustomer.MyProduct.Test.csproj
– Create 1 C# project per subsystem and 1 folder per layer, like BC, BE, Dac, Common etc.
– Create 1 Setup project per subsystem
– Create 1 Test C# project per solution and 1 folder per subsystem in the test C# project
– For each project check the .NET version you want to build against (Target Platform)
– Enable “Check for arithmetic overflow/underflow” on debug build
– Disable “Check for arithmetic overflow/underflow” on release build

Checklist C# Projects
– Use String.Format to concatenate strings < 5
– Use StringBuilder to concatenate strings >=5
– Never use relative paths, because if an executable is called by an other executable or batch file located in an other folder the working directory is not the location of the executable.
  Always use

        public string AssemblyDirectory
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(path);

Or as property

        private static string _assemblyDirectory = null;
public static string AssemblyDirectory
if(_assemblyDirectory == null)
var codeBase = Assembly.GetExecutingAssembly().CodeBase;
var uri = new UriBuilder(codeBase);
var path = Uri.UnescapeDataString(uri.Path);
_assemblyDirectory = Path.GetDirectoryName(path);
return _assemblyDirectory;

For difference Assembly.CodeBase en Assembly.Location, see msdn

Checklist Setup Projects

– Before editing anything on a setup project, check out the setup project by hand

– Change Author

– Change Description

– Change DetectNewerInstalledVersion to True

– Change InstallAllUsers to True

– Change Manufacturer

– Change ManufacturerUrl

– Change ProductName

– Change RemovePreviousVersions to True

– Change Subject

– Change SupportPhone

– Change SupportUrl

– Change Title

– Change Version

– Change Application Folder to “[ProgramFilesFolder][Manufacturer]\ProductName\[ProductName]”

– If you want to change the for “AddRemoveProgramsIcon” icon of the setup project:

           > Add a icon file to the primary output C# project

           > Open the C# project properties “Application” page

           > Select the icon file in the “Icon and manifest” dropdownbox

           > In the setup property grid select browse… > click on browse in icon dialog > select “All Files (*.*)” on the “Files of type” dropdownbox primairy > select primary output from “you’re C# project” as source for “AddRemoveProgramsIcon”

Don’t use a icon selected directly from filesystem, because you can get sourcecontrol binding problems for you’re setup project, unless it is added to the project it self in the same directory as de setup project file.


Every switch statement should have it’s own function.


In most cases a method should be on the object whose data it uses.


Every class should have it’s own unittest class.

Every method should have at least one unittest (happy path)


using System;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
namespace Customer1.Product1.Test.Subsystem1.Bc
{ [TestFixture] public class DateTimeTester { [TestFixtureSetUp] public void FixtureSetUp() { Console.WriteLine("This code is executed before the first test in this class is executed"); } [TestFixtureTearDown] public void FixtureTeardown() { Console.WriteLine("This code is executed after the last test in this class is executed"); } [SetUp] public void Setup() { Console.WriteLine("This code is executed before the start of every test in this class"); } [TearDown] public void Teardown() { Console.WriteLine("This code is executed after the end of every test in this class"); } [Test] public void AddDays_HappyPath_AddedOneDayToDateTime() { // Arrange DateTime currentDateTime = new DateTime(2009,7,1); DateTime expectedDateTime = new DateTime(2009, 7, 2); // Act DateTime addedDateTime = currentDateTime.AddDays(1); // Assert Assert.That(addedDateTime, Is.EqualTo(expectedDateTime)); } } }

100% Coverage, even with read-only properties

If you have to write a unit test for properties that are read-only, like the  System.Configuration.ConfigurationManager.ConnectionStrings["Database1"
you can create a method with the read-only property as parameter. By doing that, you can have 100% coverage.

// Get connectionstring from App.config
string connectionString = GetConnectionString(ConfigurationManager.ConnectionStrings["Database1"])

public static string GetConnectionString(ConnectionStringSettings section)
if (section == null)
throw new NullReferenceException(@"No xmlnode <configuration>...<connectionStrings><add name=""Database1""... in App.config");
if (string.IsNullOrEmpty(section.ConnectionString))
throw new NullReferenceException(@"Xmlnode attribute <configuration>...<connectionStrings><add name=""Database1"" connectionString=""... was empty");
return ConfigurationManager.ConnectionStrings["Database1"].ConnectionString;


If you want to log all the items in an string array, you can use the string.Join function:

string[] args = {"item1", "item2", "item3"};


Global Exception Handling in ASP .NET

As a good programmer, you normally want to catch all exceptions at the highest tier in code so that your program has the chance to display the error message to the user or log it to the appropriate location. Under ASP.NET, you can do so easily by overriding the Application_Error event in Global.asax file.

protected void Application_Error(object sender, EventArgs e)
Exception ex = Server.GetLastError();
// Perform error logging here...
// Clear the error and maybe redirect to some other page...

Global Exception Handling in a .NET console application or Windows Service

Unfortunately, there is no concept of Global.asax in a winform or console application in .NET. In a windows form application, the equivalent global catch all is available by listening to the ThreadException and AppDomain UnhandledException events.

class Program
static void Main()
// Catch all unhandled exceptions in all threads.
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs args)
// Log error here or prompt user...
catch { }

Global Exception Handling in a .NET windows application

class Program
static void Main()
// Catch all unhandled exceptions
System.Windows.Forms.Application.ThreadException += ThreadExceptionHandler;
// Catch all unhandled exceptions in all threads.
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
System.Windows.Forms.Application.Run(new MainForm());
private static void ThreadExceptionHandler(object sender, System.Threading.ThreadExceptionEventArgs args)
// Log error here or prompt user...
catch { }
private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs args)
// Log error here or prompt user...
catch { }

Information found at


If you need to get the metadata of a type, use the typeof C# operator:


Chaining Constructors

Using chaining constructors if you define multiple constructors that use the (partial) same logic.

Constant and Read-Only fields

Use constant fields for fields that contain constant data that is know at compile time. Use read-only fields for fields that contain constant data that is not know at compile time and can be set in the constructor

The Is keyword

Use the Is keyword to check for correct type

Use thow; to rethrow an exception

This will preserve the original context of the exceptioin


Use the default keyword to get the default value for a type even generic types:

var result = default(T);

Garbage Collection

Don’t call the garbage collection from code, but if you have to (because you are managing a very large array or something), call garbage collection as follow:



Never use destructors or finalize methods, unless you have to, because you are using unmanaged code, because declaring destructors or finalize methods marks the object as finalizable and stores a pointer on the finalization que and then there is a whole story to tell,  but the point is, it is slower.