Category Archives: server

MySQL stored procedure variables

A few months ago we wrote a mammoth we application which had an SQL Express DB. We used stored procedures, and after writing 170 of them(I didn’t write all of them of course), I was quite used to the way that variables and so on worked in SQL Server.

We’ve started a new project where the DB is MySQL 5. Again we are using stored procedures, but variables work differently.

Setting a variable in SQL Server

DECLARE @oldPageGUID uniqueidentifier;
SET @oldPageGUID = (SELECT mPage.id FROM mPage WHERE mPage.title = @passedtitle);

Setting a variable in MySQL Server

DECLARE dateAdded TIMESTAMP;
SELECT lusers.dateadded INTO dateAdded FROM lusers WHERE lusers.id= id;

You can see that setting the value of the variable is done completely differently (MySQL Docs for SELECT … INTO Statement). Two other things that confused me for a while was that there is no character prefixed to the variables in MySQL as in SQL server (@) and that there is no uniqueidentifier data-type for GUIDs

W3C Log File format on IIS- UTC timestamp

We were trying to check the log files for a site of ours to make sure a rewrite rule was working. Due to lack of rotation, the log file was 3GB and would not open in textpad (understandably). What a I really needed was a win32 version of tail. Voila – tailforwin32.sourceforge.net. It’s a GUI to view the last few lines of a file. It changes as lines are added to the file so you can view error or server logs in real time. Great we can check if the rewrite rules are working now. But is the last entry in the log file always exactly one hour ago.

2006-09-18 13:47:04 GET /Default.aspx – – 84.92.72.226 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1;+SV1;+.NET+CLR+1.1.4322) – 200 8307

After some research on W3C Log file formats (microsoft article), it turns out that it is the UTC time that is logged, not the LocalTime of the server. And since we are currently using daylight saving time (from March to October), which is UTC+1, which means that the UTC time of an entry in the log file looks like it’s an hour behind (from March to October anyway).

Mystery solved

And yes we have rotated the log files now.

Server tears

Well, I received my server today. Quite surprisingly the packaging was a bit poor, with only bubble wrap wrapped around it. The RAID controller and PCI adaptor were loose inside. After some fretting I eventually got it running and booting into the installed Mandriva. I then started to install Ubuntu which would but install due to an apic problem.

4294669.209000] ..MP-BIOS bug: 8254 timer not connected to IO-APIC

I managed to disable this on boot (with help) to install which all went fine, then on reboot, after disabling apic again, there was a new error.

isapnp: No Plug & Play device found

And after disabling PnP (Plug and Play) in the Bios and rebooting I get yet another error –
BUG: soft lockup detected on CPU#0!

Which I cannot get around but a thread on Launchpad suggests trying Edgy Eft Knot-3 which is downloading at the moment, so I’ll give it a try in the morning.

Update

Edgy Eft was superb and installed first time (after I removed the faulty RAID controller). All is good, loud but good.

Investing in a server

1u serverI’m not big into hardware and only really know what I need to. I’m not a gamer and have no need for any fancy graphics cards. I do however spend hours trawling ebay for servers. I am dying to buy one and I think the time has come. I had been looking at the Sun Cobalt RAQs as they are slick but it ties me to RAQ software or installing Strongbolt or similar. I have therefore changed my mind and have decided to go for a decent spec 1u server that has vga out and I can install Ubuntu Server. I reckon for under £300 I can get a dual PIII with over a gig of RAM and a couple of SCSI drives (RAID).

RAQ serverI can justify the cost of this as I already pay about $150 a year to dreamhost so after a couple of years it will have paid for itself. Karova will be getting some major server space soon and I hope to sneak the 1u server in there. If that doesn’t work out, I’ll have a awesome dev server I can screw into the bottom of my desk.

I’m aiming to have one by the end of the month so if you have any tips or pointers for purchasing a server, let me know in the comments.