Category Archives: dotBen Interactive Systems

MySQL database caching in PHP

I’ve been searching around for some mechanisms to perform database caching within a PHP/MySQL solution I am building.

There are a number of solutions around (in addition to the official one).

Most seem to store the cache as an XML file, but that seems to be a really inefficient way of doing things (you have to write the XML and then parse it back in each time — almost as lengthy has making the original SQL request instead).

But then I managed to find class_db.php.

Its light – just a single class.php file to include, and it fits into your code effortlessly. It also (seems to) store your data in a format similar that of a raw SQL dump, making it really quick to parse out into an array.

The sum total of the integration of the cache into my php script was as follows:

$result = mysql_query($sql);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){


$d = new db(0);//define the db the cache should use.
$d->dir = "/path/to/dbcache/"; //cache location.
$rows = $d->fetch($sql, 1800);//1800 = 5 mins (in secs) for caching
foreach ($rows as $row){

For more information check out class_db.php by Troy Wolf.

“How Women and Men Use the Internet”

Pew Internet have published a study looking at the similarities & differences of how men and women use the Internet.

The report can be downloaded in PDF format (free).

BBC News has a useful précis of the document – but at the very basic level the report indicates that men value the internet for the freedom it gives them to try new things, and women enjoy using the Internet to establish and maintain human communication.

As a man, I think finding out how women use the Internet is particularly important. The projects I work on today and in the future will be used by women – and it’s always important to understand your audience.

Check out the full report.

Catch up post

Like many bloggers, I’ve been rather sparse with my postings over the past couple of days. Spending time with my family over Christmas was really important to me – it’s the first Christmas since my father beat his Hepatitis C infection.

I also spent some quality time with my brother. We don’t normally get along, and this was probably the longest time we have gone without having an argument in our entire life – I was there 3 nights and we didn’t argue once!

But here are some things I’ve been getting up to over the Christmas break:

Hepatitis C Portal
My father has been running a Hepatitis C support group forum for sometime. It’s been a real honour to work on something that has been of such benefit to people, and to also give something back to my father (who has supported my interest in computers since I was eight).

We’re now in the process of building a portal that aggregates the forum along with the various resources available on the Internet. In essence this site will aggregate:

  • Forum posts
  • Blog posts written by those living with the disease
  • HepC related news articles (via Yahoo! News)
  • Links to fixed resources, etc

From a technical perspective, it’s nothing Earth shatteringly new. However I think it will be of real benefit and support to those who are currently undergoing treatment and those who are living with the disease. It’s also something which could easily be implemented for other diseases such as HIV and cancer. We’ll see what happens on that front.

It’s been really rewarding to be working on this project, particularly because no one is really doing this kind of thing to aid group-therapy for those who are overcoming (or just living with) long-term illness’s, like Hepatitis C.

When it’s all finished, I’ll post a link.

Latest dotBen project
I’ve also been working on the public beta of my latest dotBen project. It’s all a bit hush-hush at the moment, as it will no doubt be somewhat controversial when it launches.

Some of you may know of the project I’m referring too, as I’ve invited a few people to access a private beta version of it – yes it’s that one! 🙂

I’ve decided I’m going to release it and suffer the consequences of whatever fallout may occur. It’s a useful service and I think it’s a waste not to make it available to the general public. But if you do know what it is, please keep it to yourself for the time being!

I am pleased to say that the public beta is being built around an API upon which I’m then building a (one of many possible) user front-end.

Life after the BBC… perhaps on the otherside of the pond
I don’t want to make a big thing of it, so I’ve tucked it in at the end of this post… But I’m beginning to think about life after the BBC. In May 2006 I will have been at the BBC for 6 years – so it’s really time to begin to think about moving on.

I’m extremely fortunate to be running one of the most exciting and interesting projects at the BBC at the moment. The BBC is a wonderful place to work, and I’m extremely happy and proud to be working there. In fact I’m happier now than I have ever been at the BBC.

But I need a new horizon and also some commercial experience… So it is for this reason I am beginning to think about what I might do next. I am also looking into the feasibility of spending some time working in San Francisco under my Canadian citizenship (yeah I’m not sure what I might be letting myself in for on that front… I certainly can’t see me working for SixApart, for example!).

I’m not getting ready to leave the BBC immediately or anything like that… there are no imminent announcements. But I’m beginning to have talks with people, and there are certainly a few interesting options around. Moving the USA would take a bit of time to organise anyway, and is only feasible with some careful visa planning for both myself and Sofia.

My CV is here, if you are interested in finding out more about me – or drop me a line.

The all-new Talking Shop Podcast

For ages Kevin Anderson, Paul Sissons and myself have been kicking around this idea of producing a podcast to talk about our views on online media.

And so for the last couple of months we’ve been beavering away at Talking-Shop – the latest dotBen Interactive Systems project (WTF, etc?).

It just to happens we recorded our second beta podcast after Day 1 of the Les Blogs conference (the day before THE incident) – and we’ve decided this will be our first public release.

Sadly Paul couldn’t be with us at Les Blogs, but I know he’ll be joining us on future podcasts.

I’m really excited about Talking Shop, and what we might be able to do with it – we’ve already got some great guests lined up from various backgrounds and professional disciplines. And that’s in additon to us:

Kevin’s a brilliant online journalist (he’s American by the way, so anyone who still thinks I’m anti-American should really take our collaboration as another example of why that’s a really unfounded view).

Paul is a highly talented graphic and user experience designer.

I’m some dumb f*ck with a dirty mouth (although it’s Ben Hammersley who does all the swearing in this podcast), so check it out.

This really is just a beta, so please take it as that – although there’s some great interviews with Tara Hunt from Riya, Chris Missina from Flock and Suw Charman from the Open Rights Group.

We’ll be publishing some slightly more “on topic” Talking-Shop podcasts very soon now that we are back on home soil, so why not subscribe to the RSS podcast feed?

London Perl Workshop

I attended the London Perl Workshop today (well, the second half to be exact). Although I’m not really a Perl basher myself, the talks I attended were all fascinating.

James Gilbert from the Sanger Institute talked about how these use Perl to help compute genomes (bioinformatics). This is an area of computing I would love to know a lot more about, as my academic background is actually in Biology and Biotechnology.

They use a number of CPAN modules and other Perl stuff to produce their genome parsers and utility software. It also runs the public-facing genome browser Ensemble.

Dave Cross gave an interesting talk on best practice when connecting to databases with Perl (in other words, using DBD and not writing your own connection code!

Finally, and the main event for me, was Leo Lapworth and Leon Brocard (winners of TV-Anytime competition) talking about their backstage-winning website, These two did a superb double act and their presentation was just crisp.

I’ve been demo’ing around the BBC for sometime, but they showed off some fantastic functionality of the site, including the ability to hook it up to Apple TV-capture equipment EyeTV, which I hadn’t seen before!

The event was fantastic, and I hope the organisers put one on again next year.

(off topic) New .htaccess on my blog

I’ve just added a new .htaccess file to the site to prevent a lot of referrer spam hitting the server. It also denies access from a number of proxies that are popular with spammers. I reckon I’m getting several times more “spamming” traffic then “genuine” traffic and it’s costing me in server load (I should know, I’m the webhost!).

So, if you have trouble accessing the blog please let me know via the comments form on this post. (Of course, if you couldn’t access the site, you’d be unable to read this post… hmmm)

Guardian’s “lobby an American swing voter” hacked and deemed a failure?

For those who haven?t been following it, the Guardian have been running an experiment that enabled non-Americans to lobby American voters in swing-state Clark County, Ohio.

I have to hand it to the Guardian for coming up, and executing, such a bold idea. I’m sure we’re not the only ones to have been eagerly awaiting the outcome of this experiment.

From what I can gather, these emails were unsolicited (ie, voters just started receiving lobby emails from foreigners). Clearly, this pissed a lot of voters off – I think I’d be pretty peeved if people started writing to me on how to vote (even thought I don’t – eek, I probably shouldn’t be admitting that).

Anyway, Guardian have now pulled the experiment due to the amount of criticism from those on the receiving end of the emails. There are also reports that their entire database of voter email addresses was hacked into, but I haven?t seen enough credible sources corroborate it yet.

There’s an interesting post-mortem article on it, but the key paragraph is as follows…

In a poll I conducted among Guardian staff who had been following the story, of 71 respondents, 13 thought it a legitimate and worthwhile exercise, 14 were undecided and 44 were against it. Among the reasons given by the latter, reflecting complaints coming from the US, were that intervention in the democratic processes of another country was not “legitimate newspaper behaviour”; and that it was arrogant and self-aggrandising.

Whilst it’s easy to smirk a little, I do genuinely have a lot of respect for Guardian doing something a bit “edgy” like this. I hope that the outcome of this experiment isn’t used an excuse for not trying something equally daring in the future.

BBC News & BBC Sport Printable Digest

Another script I’ve been working on: the BBC News and BBC Sport Printable Digest.

Basically, you select the news sections you want to look at from the BBC News and BBC Sport sites, along with the number of stories you want to view from each of these section…

It returns a single printable page with the top stories from each index you asked for – all ready to be printed off and read on the train/bus/etc.

As ever, let me know what you think

Google launches search for your PC

Looks like a great product to me. One of google’s main revenue streams is google search on company networks (knowledge management, etc).

It’s interesting their giving away this similar application, albeit domestic level rather than enterprise level, for free.

Not quite sure whether I like the web-based interface though, as it requires access on a particular port (mine’s 4664, I assume this is a constant, and the same on all installs?). Could be a security nightmare, allowing people to search for files on your computer if the port is accessible from locations other than localhost.

Further improvements to my BBC News Audio Video RSS output

UPDATE 17 Jan 2007: BBC News has now changed it’s AV offering and as such the source material for these feeds is no longer being updated. However these feeds have been deprecated for sometime, and you should check out the official BBC News AV RSS Feeds (click on the link, see the list of feeds on the right-hand-side column).

** UPDATE: I have re-instated the Broadband streams now that the BBC has fixed the problem of them “leaking” internationally. The BBC does not stream broadband media outside of the UK due to the cost of serving, and this is something which I respect. **

Following on from suggestions from my esteemed colleagues Ben W and Joel C (names obfuscated to protect the innocent) I’m now outputing a four RSS feeds per BBC News section – one feed per format/bandwidth combination available.

Previously I had four <link> nodes in each <item> node, to reflect the four media options per news story. Multiple <link> tags were causing havoc in many news-readers.

So, here are the new links you need (there’s an HTML flavour at the bottom too):

Broadband, Windows Media: (UK IP’s only)

Broadband, Real Media: (UK IP’s only)

Narrowband, Windows Media:

Narrowband, Real Media:

HTML Version – all media/bandwidth combos
Use this if you want to play BBC News clips in your preferred player (rather than in the embedded console)

I’ve also ensured I’m escaping safely all the characters I need to keep the XML valid.

Please do let me know if you are using these feeds, and any improvements you would like to see.