Very pleased to see an article on 13/05/09 online at the Daily Telegraph that features Nethouseprices.
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.
- Right click the Class Library project and select Add Service Reference…
- Add the URL of the Web Service and click Go
- 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.
I 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’.
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.
Unsigned integers are a useful column type in MySQL if you want to make your tables as small as possible. Making tables small is a good idea because at the end of the day, database access is limited by hard drive access speed and if there is less data to read, you will access it faster.
A signed MEDIUMINT has the range -8388608 to 8388607, whereas an UNSIGNED MEDIUMINT goes from 0 to 16777215. If you are sure your number is NEVER going to be negative, then you can save 1 Byte per row by using an UNSIGNED MEDIUMINT instead of an INT.
However – do make sure that any calculations you do in your SQL never involve negative numbers.
Lets set up a simple example, a table with signed and unsigned columns:
CREATE TABLE `temp` (
`id` int(10) unsigned NOT NULL auto_increment,
`myUnsigned` mediumint(9) NOT NULL,
`mySigned` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `temp` (myUnsigned,mySigned) VALUES (1,1);
Now here’s a simple calculation:
SELECT myUnsigned – 10, mySigned – 10 FROM `temp`;
And the results:
myUnsigned – 10 = -9
mySigned – 10 = 18446744073709551607
I would prefer it if MySQL could issue some kind of error and fail, but instead it produces this stupidly high number. Watch Out!