Archive for the ‘Uncategorized’ Category

GPG Key Transition Statement 2010

So, to make the Debian keyring maintainers happier people, I’ve created a new 4096 bit key. Below you’ll find a transition statement signed with both the new and my previous key. Incidentally, I’ve also revoked my first (1024 bit) key which I had transitioned away from a year ago. —–BEGIN PGP SIGNED MESSAGE—– Hash: SHA256 [...]

Triggers in MySQL

DELIMITER $$ CREATE TRIGGER messages_ins_recipientuser BEFORE INSERT ON messages FOR EACH ROW BEGIN SET NEW.recipient_user_id := (SELECT users.id FROM users WHERE users.mobile=NEW.recipient_mobile ORDER BY id ASC LIMIT 1); END; $$ delimiter ; Run this in the MySQL prompt; MySQL Administrator (MySQL Query Browser) won’t take it. To see all the database’s triggers: SHOW TRIGGERS; Other [...]

CakePHP: Using a model inside a component

Apparently this is discouraged for some mysterious reason, but if like me you want to have nice code where models are used from within components (so you don’t have to clutter up your controllers or shell classes), here’s how: $this->ModelName = ClassRegistry::init(‘ModelName’); Source For example, you can place it like this at the start of [...]

Command-line script to edit PDF file meta-data

I’ve just written a little wrapper around pdftk to simplify the modification of PDF file meta-data. It extracts the existing meta-data, opens it in your favourite editor, writes it back to the original PDF and finally removes the temporary files it generated. #! /bin/sh if [ ! -f "$1" ] then echo “Usage: $0″ exit [...]

Book Review: The Heart Mender

Some time ago I found out about Book Sneeze, a service by Thomas Nelson offering free books in exchange for reviewing them on your blog (the reviews aren’t required to be positive). I decided to give it a try, and a couple days after signing up my account got approved. The website shows a changing selection of [...]

 
web development