Follow Me On Twitter Facebook LinkedIn Flickr
Greetings thru Firefox on a Fedora 12 virtual machine on vmware on a Windows XP box. Next, building LFS under a VM! Back in a week or two... 4 days ago
A software development and computer technology blog.
IT Crowd title sequence, register dump during Fedora Core 4 installation (Anaconda)

Finally had a few seconds knocking about to see what the screen near the end of the IT Crowd title credits is all about. Which is weird as I’ve been wondering whether to update my FC9 machines to FC12, hmmm.

But I’m still not changing my RH9 server, for sentimental reasons…

Fixed it!

Finally took a couple of minutes to look at why the ngg-gallery slideshow widget wasn’t working since I moved my sites and upgraded Wordpress. Initially I just wanted to reinsert my code to add my CAPTCHA code back in to stop people spamming comments, then I thought I might as well go one step further towards getting the site back to normal.

Turns out it was just a case of setting up the location of the JW ImageRotator file.

Almost Back To Normal

What a week! After having my websites hacked, my hosting company (*cough* EUKHost) not telling me they had suspended my account, them refusing to re-enable it or allow me to access emails, and suggesting I either pay for a far more expensive hosting package which I don’t need or find another hosting company. I have managed to get this site back up and running somewhere temporary for now.

Unfortunately the pretty ngg-gallery slideshow widget isn’t working since I upgraded, which just adds insult to injury.

Fleshing out the beast

I’m starting to put the AJAX game framework to the test, and applying it to some game rules. Although currently I’m starting from a higher level not covered by the rules at the moment, which is where individual game instances are created. Whoever is running a particular game instance can set the parameters of the game; starting conditions and victory conditions for instance. Then once the players have joined, the game can begin.

As this system is turn based I intend to allow a turn period to be set as part of the starting parameters. But also provide the option to have this as a maximum turn duration, and process turns as soon as all players have submitted their turn. Since turn processing will take a matter of seconds and the next turn will start once processing has completed, it would actually be possible for all players to be logged in at the same time and submit turn after turn.

Trigger Happy with MySQL

I have to say I am a rather big fan of db triggers, in an effort to bring some discipline to my databases. Since audit tables have become quite a habit of mine, this is probably my main use for triggers. Although MySQL has a little way to go yet before we have the kind of experience that SQL Server has brought to us in the past, but it’s getting there.

I was surprised to see how little documentation there is on the ‘BEFORE’ and ‘AFTER’ keywords. I was looking for something that would explain to me when I should use each of these, and wherever I found *something* on it, it wasn’t enough.

Through a little bit of testing however, I have found that using ‘AFTER’ delivers desirable results for Inserts, Updates and Deletes. Is it important? Well, considering that after performing the tasks of a ‘BEFORE’ trigger the actual Insert, Update or Delete might fail, but this doesn’t undo the effects of the trigger. Using ‘AFTER’ triggers ensures that the task has completed before we create the audit record.

An example of auditing triggers, for Insert, Update and Delete:


CREATE TRIGGER mytable_audit_trigger_insert
AFTER INSERT ON mytable
FOR EACH ROW BEGIN
    INSERT INTO mytable_audit (
        id, date, name
    )
    VALUES(
        NEW.id, NOW(), NEW.name
    );
END;


CREATE TRIGGER mytable_audit_trigger_update
AFTER UPDATE ON mytable
FOR EACH ROW BEGIN
    INSERT INTO mytable_audit (
        id, date, name
    )
    VALUES(
        NEW.id, NOW(), NEW.name
    );
END;


CREATE TRIGGER mytable_audit_trigger_delete
AFTER DELETE ON mytable
FOR EACH ROW BEGIN
    INSERT INTO mytable_audit (
        id, date, name
    )
    VALUES(
        OLD.id, NOW(), OLD.name
    );
END;

It would be nice to be able to query/edit triggers, but unfortunately you can only CREATE and DROP them, certainly within the MySQL Query Browser. I’ve not tried any 3rd party tools as I’m happy to keep .sql files, with the details of the CREATE TRIGGER statements so I know what’s in them.