Monthly Archives: February 2011

Script Wrappers in PHP

I’m guessing that most web developers with a few years of experience have at least one nightmare client. I’m currently struggling with a total arse of a project. This one in particular was originally built some years ago by a predecessor of mine who, to be fair, was fairly lazy in a lot of respects.

Part of the work I’m currently doing on the site involves moving the whole she-bang over to one of our newer, faster, better severs. The initial move went surprisingly well, (I LOVE WHM’s account transfer features), but I soon hit upon a large stumbling block.

Continue reading

Share Button

Client Quote of the Day

During a meeting with one of my clients, she noticed that the mouse and keyboard we were using were wireless. I guess she’d never seen a wireless mouse before:

“Oooh, this mouse has no ropes!”

I honestly have no idea how I kept a straight face.

Share Button

The Importance of Indexes

One of my clients has a rather large shop, with in excess of 40,000 products over a couple of thousand multi-tiered categories. Recently the company’s website started to run slowly, seemingly at random times of the day. The reason was surprising.

After some frustrating investigation, the client realised that after each period of high server load he’d often immediately receive an email confirmation of an order being placed on the website.

The order confirmation script, (in this case a HSBC ePDQ callback), queries the database for an order matching a UID passed from HSBC. The query also checks that the order is still marked as un-paid, as added protection against duplicate orders.

SELECT *
FROM `orders`
WHERE `uid` = '$orderIdFromHSBC'
AND `paid` = 0
LIMIT 1

There was no index on `uid` or on `paid` and there were heaps of orders in the table… this customer in particular doesn’t like to archive his old orders.

The addition of a single index on both columns, in order of reference, (it’s more efficient, don’chaknow), fixed the problem immediately.

Share Button