VMs, Veg Plots, and a distinct lack of alcohol..
by Andy on Jul.04, 2009, under Uncategorized
Today, after a tragic day at work (my development VM died amazingly, had to create a new VM and, being centos, had problems mounting the other VM’s hard disk due to conflicting LVM names. Long story short, managed to rename it, and after 45 mins of inode errors started copying it all across to a new VM.
Anyway, today, I am dead chuffed since my veg plot has started to take form. I now have Strawberries, Tomatoes, and Cauliflower all planted up. The strawberries seem to be fruiting already, as are the tomatoes. Tomorrow, I should hopefully expand on this further, and grow even more vegetables.
After a rather stressful afternoon with the kids, I am left on my own with the drone of the aircon kicking out non-muggy air, sober and with a bastard of a backache. Think I dinged my back doing something. Nontheless, the baby monitor is on and I can hear the ocasional coughing of my youngest.
I tarted up my blog a bit too. Gave it a slightly fancier header. Brief but fun.
The malvern gazette – Hard hitting news
by Andy on Jul.03, 2009, under Uncategorized
This made me laugh. The last time I properly read the Malvern Gazette, they were running a story about a pensioner burning toast in a toaster, and interviewed some ‘fire chief’ about it. A few days ago, I went for a walk into Malvern from work for lunch, and saw their latest gripping headliner. ‘The worst footpath in the county!’. Forget the Iranians, forget Afghanistan, this is where the real headlines are found.
I’m just waiting for the headline ‘Plant pot stolen!’ or ‘Church has dead flower on display’.

Stepping things up a bit
by Andy on Jul.03, 2009, under Uncategorized
So far, my experiment in blogging is not going very well. I havent updated for a while, and here I am writing a draft on my Blackberry whilst feeding my youngest son.
I have spent most of my time a somewhat ‘hacky’ coder – everything from obscure variable names, to no comments and no formatting. Over the last few months, I have been straightening things up, comments, formatting, logical thoughtprocesses, and now, I am going one step further, and taking onboard server-side debugging with phpEd to write nice rugged code.
My development VM at home now has the debugger module running, so I am excited about giving it a go, but being on my own for a weekend with two ‘little angels’ may mean I’ll be spending my time playing Bloons 3 instead.
Until later, need to provide yoghurt to the little one now.
Punchcards
by Andy on Jun.27, 2009, under Uncategorized
Safely stored in a Tesco carrierbag are a set of punchcards I rescued from a bin.. The majority of them are FORTRAN Statements. I wonder how old they are… Click for extra girth..
Tamiflu
by Andy on Jun.27, 2009, under Uncategorized
After the episode with students and teachers on campus contracting Swine Flu, everyone got given free Tamiflu. From what I have been told, they are about £7.50 a tablet.
I feel guilty now because I stopped taking my Tamiflu 4 days in because it was making me feel ill, which in turn made me probably one of the least tolerant people to live with. I stuck the rest of the course on my dumping ground to sort pile, and there it has been for a few weeks.
So I have six tablets of Tamiflu, which I am not going to be using (hopefully). If I were a naughty person, they’d be on eBay as I write this…
Geeky: Get your last tweet in PHP
by Andy on Jun.27, 2009, under Geeky
As you can see on the right hand side, I have a god awful picture of me with a cheesy speech bubble with my last tweet in. This little nugget of code will pull the last tweet for you (or whoever you want) for your evil deeds:
$ch = curl_init();
$url='http://twitter.com/statuses/user_timeline/';
$url.=$twitee.'.json?count=1';
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec($ch);
curl_close($ch);
$tweet=json_decode($data);
$date=strtotime($tweet['created_at']);
$text=$tweet['text'];
This will give you the text in the $text variable, and a unix timestamp of when the message was posted. You can do a print_r($tweet); to see what other nuggets of wonder you can get about a tweet.
I had a problem where I did not have a json_encode function, so below is a substitute:
function json_decode($json)
{
$comment = false;
$out = '$x=';
for ($i=0; $i<strlen($json); $i++)
{
if (!$comment)
{
if ($json[$i] == '{') $out .= ' array(';
else if ($json[$i] == '}') $out .= ')';
else if ($json[$i] == ':') $out .= '=>';
else $out .= $json[$i];
}
else $out .= $json[$i];
if ($json[$i] == '"') $comment = !$comment;
}
eval(str_replace('[','',str_replace(']','',$out)) . ';');
return $x;
}
and this function gives you something along the lines of ‘30 minutes ago’:
function relativeTime($timestamp){
$difference = time() - $timestamp;
$periods = array("sec", "min", "hour", "day", "week", "month", "years", "decade");
$lengths = array("60","60","24","7","4.35","12","10");
if ($difference > 0) { // this was in the past
$ending = "ago";
} else { // this was in the future
$difference = -$difference;
$ending = "to go";
}
for($j = 0; $difference >= $lengths[$j]; $j++) $difference /= $lengths[$j];
$difference = round($difference);
if($difference != 1) $periods[$j].= "s";
$text = "$difference $periods[$j] $ending";
return $text;
}
So, a small bit of code such as:
echo $text.' ('.relativeTime($date).')';
Will show something like this:
This is the last tweet by @ajdixon! (32 minutes ago)
Oh the fun you can have with twitter is endless….
A heart clogging cheese explosion
by Andy on Jun.27, 2009, under Uncategorized

I made a cheese and onion toastie, one of my favourite snack/breakfast/lunch foodstuffs. However, unbeknown to me, I added slightly too much cheese and onion, suffice to say, things got a little messy.
Suffice to say, I did eat it, and after I got over how nice it was, I felt bad for eating probably a months worth of calories in a mad three minutes.
Hiding from my neighbour..
by Andy on Jun.26, 2009, under Uncategorized
I’m hiding from my elderly neighbour at the moment. Our (badly designed) sewer system is blocked. It always blocks up in her garden, and I end up having to get my landlord to come out to unblock it, even though its in her garden.
Things you do for an easy life always come around and bite you in the arse.
On a plus note, I psychotically attacked the tree stump in my garden. Its root was in the way of my veg patch. That came up after some persuasion, so, under the influence of mood-altering drugs, in the pouring rain, singing a song about a little green frog (bum-bum went the little green frog one day, bum-bum went the little green frog..) hacking the merry hell out of the poor treestump. I gave up when the axe slipped from my hands and shot across the garden, bouncing off the kid’s playhouse.
Unfortunately, I am working both this Saturday morning and next Saturday morning, so tomorrow when I get home, I am going to try my best to start running – well, running for about 15 seconds, stopping for five minutes to catch my breath, then going home. Then, I am going to attack the treestump again, whether it knackers up my wrists or not.
Lastly, today I found out that Michael Jackson died. Its very strange how there was no other news. Considering how many people die each day, including from terrorism, or the tension in Iran, that one man dominated the news. Personally, I hated his music, I hated what he had become.
