MySQL Transactions will automatically rollback if not committed

Just a quick note on this one, because although it seems obvious, I couldn’t find this explicitly mentioned anywhere in the MySQL manual entry for transaction syntax.

However if you issue an SQL ‘START TRANSACTION’ statement, anything you do after that will not affect the tables unless the ‘COMMIT’ statement is issued (assuming they are InnoDB tables). This is great because if your server crashed or you lost your connection to it, your data is protected.

Here’s an article from weberdev.com with more information: Using transactions in MySQL

Finding top level directory sizes with Linux

If you need to find out where the hard drive space on your Linux server has been taken up, here is a suggestion.

From the root directory if you use:

sudo du -h

You get an unmanageably long list of all the subdirectories on your system.
If you direct the output to a file however, you can use egrep to provide a useful summary, just showing the totals for the top level directories:

sudo du -h > ~/dirsize.txt
egrep ‘^[0-9.MKG]+[[:space:]]+./[a-z]+$’ dirsize.txt

Consuming a web reference in a class library with C# and .NET 3.5

Since .NET 3.5 you can’t add a web reference to a class library project, so how can you access web services?

Actually it is much easier.

  1. Right click the Class Library project and select Add Service Reference…
  2. Add the URL of the Web Service and click Go
  3. Give it a meaningful Namespace then click OK

Visual Studio will add a Service References folder and a system.serviceModel to the app.config file.

To invoke methods of the web service, first you create an instance of the SoapClient class then just use that object:

MyService.WebService1SoapClient myClient = new MyService.WebService1SoapClient();

In my example above MyService is the Namespace I used in the Add Service Reference dialog.

That is all there is to it.

VirtualBox 64-bit guest support using an Intel Core 2 Duo processor

2d_62I was hoping that I would be able to use 64 bit Ubuntu and Centos as virtual machines in Sun’s free VirtualBox software on my desktop PC that has an Intel Core 2 Duo processor – after all it is 64 bit. But I’m only running 32 bit Vista.

This shouldn’t have been a problem with VirtualBox.

However, it turns out that a small selection of Core 2 Duo processors aren’t able to do this. The processor needs to have hardware virtualization support, which Intel has termed VT-x or ‘Intel Virtualization Technology’.

List of Core 2 Duo processors and support for VT-x

Anyway, I’m unlucky as the E4300 is one of the very few that don’t support this feature, so I can’t run the 64 bit versions.