Chris Worfolk's Blog


Driving while talking on a mobile

October 6th, 2012 | Religion & Politics, Science

phone-in-car

About ten years ago, everyone started to panic about the increased use of mobile phones while driving, because they seemed to be causing lots of accidents. The response was to ban the practice, which became illegal in 2003, unless you were using a handsfree set.

This was widely supported by the mobile phone industry who happily charged us lots of money to provide a variety of handsfree solutions, from simple holders to elaborate integrated in-car systems.

The problem is however, they don’t work. Driving while talking on a handsfree kit is just as dangerous as driving while holding the handset. Multiple studies have all supported the same conclusion.

It’s easy to see how this situation happened. You assume it is the act of holding the phone, so without testing it, you suggest it as an idea and phone manufacturers jump on it as an easy way to make more money from us. To further their own profits, they continue to push the idea that it is safer to drive using handsfree, even though it isn’t.

In fact, it turns out that it is the act of holding a conversation, which takes some of your attention away from the road, that reduces the safety. So it is irrelevant whether you’re holding the handset or not.

Worth thinking about, next time you take a call on your handsfree set.

Installing Postgres PDO driver on cPanel

October 5th, 2012 | Life, Tech

cPanel offers two options for installing PDO – using EasyApache which can enable PDO and MySQL’s PDO driver or installing everything via PECL. Unfortunately, under PHP 5.3, the PECL installers don’t work, so if you need any other PDO drivers, you’re in a hole.

Luckily, you can install it manually.

Download the PDO driver from the PECL website. Extract the archive and CD into the directory.

wget http://pecl.php.net/get/PDO_PGSQL
tar -xzf PDO-PGSQL-1.0.2.tgz
cd PDO-PSQL-1.0.2/

Once this is done, run the standard commands for building a PHP extension.

phpize
./configure
make
make install

Once this is done, you can add the extension to php.ini.

cd /usr/local/lib/
vim php.ini
extension=pdo_pgsql.so

Finally, restart Apache and the Postgres driver should show up in your phpinfo() output.

Rainy Leeds

October 5th, 2012 | Photos

The rain swelled the River Aire, so I decided to go out with my camera. It’s quite difficult, but strangely satisfying, to manage to take a photo while holding an umbrella up with your knees.

Miah’s Kitchen

October 4th, 2012 | Thoughts

Last Friday, myself and Elina went to Miah’s Kitchen for lunch.

You can see my Miah’s Kitchen review over on Know Leeds for a full low down on the food, but the short answer is that I recommend it! But that isn’t what I want to talk about here.

When we arrived, we were the only people there. They had at least three waiters working, but no customers. It didn’t look like they would be getting any either – they only open 12-2, and this was at nearly 1pm.

Yet, as we walked in and I asked for a table for two, the waiter replied “do you have a reservation?” 😀

I almost wondered if he was taking the piss at first. It wasn’t a small place – they probably had about fifty covers, all of which were laid out but empty, why ask if we had a reservation? But I just said “no”.

Then, even funnier, they asked us to take a seat in the waiting area while they found us a table :D. We obliged and soon enough they had found one for us.

They were all very nice, though it did seem a rather formal procedure for a restaurant without any other customers.

Photobox

October 3rd, 2012 | Reviews

I needed to get some prints done for my photography course, but this being 2012 and all, obviously I have a digital camera and store all my photos digitally. So I headed onto the internet to find someone who would print them for me.

I ended up going with Photobox, who tempted me in with their free prints offer and then insisted I was an existing customer and so I wasn’t entitled to it. Apparently, I had already signed up with them, so I guess that is fair enough.

It was a bit of an ordeal to upload my photos as their Java applet kept crashing, but I eventually uploaded them by FTP (they do at least have a great array of upload methods) and sent them to print – except for one, that they insisted was too small to print.

It was around £5 for 26 photos, including delivery I think and the print quality is as you would expect. They also came in a very nice plastic wallet. They also arrived in around 36 hours – I ordered them on Tuesday night, and they arrived Thursday morning.

Will use them again next time I need some prints.

This is my jam

October 2nd, 2012 | Distractions

I don’t actually use This Is My Jam, but I’ve been listening to some cool albums recently, so I thought I would share them.

Jack’s Mannequin – People And Things
I’m sure, like me, you discovered Jack’s Mannequin while looking for different versions of Panamore’s Misery Business and stumbling on the compilation album It’s A Misery Business, of which contains their song The Mixed Tape.

They (and I’m being generous there, because it all seems to be Andrew McMahon and a bit of backing) have since released a new album, which I think is their best work yet. They’re a bit emo, so I imagine Si listens to them as well, but not so such that you well adjusted people wouldn’t like them either.

Bowling For Soup – Presents One Big Happy
Bowling For Soup have come out with a new album that features not just themselves, but also The Dollyrots, Jaret Reddick and Kelly Ogden & Patent Pending. Turns out, that combination works really well.

Particularly the album’s first song, “Lets go to the pub”. For some reason, that song really speaks to me.

Capturing the moment

October 1st, 2012 | Life

I’ve been meaning to do a photography course for a long time. But every time I look into it I realise I’ve just missed an intake or it’s at least some ridiculous amount of time until the next one starts.

However, being determined to get it done, I made an effort to hound Leeds City College – and I do mean hound because getting information out of them is like getting blood out of a stone. They simply don’t know when the courses are going to be running or provide you with any information on them.

Never the less, I managed to get myself and Elina booked on one, and we had our first session last Monday. The course costs about £150 I think, and for that you get ten sessions of two hour tuition, which seems reasonable.

The first session was general introductions, but was by no means non-informative. We discussed the problems we were having and what areas we wanted to focus on in the first part of the session and then dived straight in to the course material and practice exercises.

By the look of the schedule, it’s very focused around the kind of photography I want to do as well, so I’m very much looking forward to it!

Red’s True Barbecue

September 30th, 2012 | Photos

Last weekend, me and Elina went to Red’s True Barbecue for dinner. As you can see from my restaurant review, I wasn’t overly impressed. But, to their credit, they did literally provide a bucket of ribs.

Add a new path to your $PATH variable on OS X Lion

September 29th, 2012 | Life, Tech

Sometimes you need to add a new path to your $PATH variable. This is easy to do by adding a new line to your paths file.

cd /etc/
vim paths

Once you have added the path, you can execute any executables in Terminal, without having to specify the full path.

What variables do in private is their own business

September 29th, 2012 | Limited, Programming

This is another post about object oriented programming.

Ok, cool, you’re one of the 3% still reading. I just wanted to do a quick post about access modifiers on objects. It applies pretty much regardless of programming language, presuming you’re working with one that supports OO and has the standard public, private and protected for access by sub-classes only.

I think, what we need here is an attitude shift away from using private variables. Often, I see code that uses private variables and I have no idea why.

What I mean by this, is that almost every time I see a private variable, what it actually should be is a protected variable. Indeed, I think the default assumption when creating a variable, should be that you define it as protected.

Lets ignore public variables for the moment. I’ve previously argued you could simply do away with them altogether (that is what getters and setters are for), but in any case, I’m not concerned with them for this post. Lets just focus on private or protected.

The traditional teaching has always been that you should define a variable as private if you don’t want it to be publicly accessible, and giving child classes access to it later on is often an afterthought.

I don’t think this should be the case.

If we’re to adopt a true OO mindset (and it’s been around for sixty years, so given it was invented before most of us were born, you would hope we would have adopted it by now), surely you would work from a perspective that your class will be extended.

Protecting variables from external bodies makes sense, hence not making them public, but to by default place restrictions on what you can do with child classes in an OO world, doesn’t make sense to me. Why have the functionality at all? Why not make everything final if you need such protection?

That isn’t to say there aren’t plenty of instances where there is a reason to do this – but these aren’t the 90% most common use cases, so I think there is a good argument for making protected the default at least.