Wednesday, 10 December 2008

iTunes RSS Feed Unrecognised Characters (with PHP)

So, I recently wrote a quick PHP script that parses the iTunes store RSS and turns it into some webpages that are easily renderable on a mobile device (see last blog post).

I've written quite a number of RSS parsers in PHP before, it's fairly simple and you just make use of the SimpleXML features built into PHP.

However, this time whenever I opened the feed it returned a whole load of rubbish characters. The feed was read fine in Firefox, Safari etc, but when I opened it with my XML editor (Oxygen) or PHP it was just trash! The root of the problem was in this method:


(or fopen if that was used instead).

combined with the fact that gzip compression (found by looking at the HTTP headers in Firebug). The solution is to replace either of these methods which can't handle the gzip compression with:


and use the gzread method to get the data!

Then you can carry on with the parsing as you wish...

Monday, 8 December 2008

iPhone Applications Directory

I'm currently building a bridge to give a different form of access to the AppStore. This site will basically be a really big directory. I hope to be able to add comments, ratings, etc to it when it's more stable.

For now it is here:

Wickoo - iPhone & iPod Touch Apps / Applications

Monday, 24 November 2008

MGMT - Time to Pretend

This is the latest track which I think is awesome!!! I heard it on some advert on TV, then heard it in a friend's car and hence managed to find out who it is. The synths are amazing! Check it out here:

MGMT - Time To Pretend

Wednesday, 19 November 2008

iPhone Application - Google Adsense

So, it appears that Google Adsense is now being using in iPhone applications to generate revenue. I've just submitted an app which will be using ads supplied from, however it would be very interested to see how successful the Adsense mobile is. Have a look at this app called AroundMe (it's free to download) at the following link:


Monday, 17 November 2008

Apple Mail HTML Signatures

OK, so apparently you can't have an HTML sig with Apple Mail. This however sucks, cause you need to have links to your stuff in your sig! If you just type the HTML code in, then this code is not rendered and you just end up emailing people code!

What you need to do, is make a HTML page of how you want your sig to be (ensuring that all images etc are online on a server, not on your local machine... only your html can be there). Then open this up in Safari, and save it as a webarchive. Then, copy this archive to ~/Library/Mail/Signatures where you will find all the archives of your sigs.

Goto Apple Mail and make a new sig, call it something useful. Go back to finder and sort the list (which will have names which mean nothing!) by date so that you have the last modified at the top. Don't delete the plist file... you need that! Instead copy the name of the last modified webarchive then move that off to somewhere else on your hard disk. Make the webarchive that you created from Safari to be the name that you just copied. Restart Apple Mail and you should have your lovely HTML file as your sig!


Monday, 10 November 2008

Cheap & Reliable Linux Hosting

I often get asked who I recommend for web hosting. Now, I've never had Windows hosting so I'm afraid I can't answer your question in that case, but for Linux hosting I've always used HostGator. I currently have about 5 sites all running off one of their cheap Linux shared hosting accounts and have no problems with them. I register all my domains with Daily and then simply change the nameservers to point to the hostgator hosting.

Anyways, check out hostgator at the link here:

And Daily here:

Tuesday, 4 November 2008

Iglu & Harlty - In This City

OK.. a slightly less informative blog posting now.. but I appear to be addicted to this song! It's quite comical, but definitely worth a listen.... pay attention to how they sing "liiiiife". Makes me chuckle each time!

Find a preview of it here:

Iglu & Hartly - In This City - Single - In This City

Monday, 3 November 2008

iPhone development - Creating an Email with valid text!

When writing your iPhone application you may wish to send an email using the iPhone's built in mail client. This simple piece of code will do this:

NSURL* mailURL = [NSURL URLWithString: @""];
[[UIApplication sharedApplication] openURL: mailURL];

However, remember that the string must be correctly URL encoded. This is simple with a small string such as that in the example, but when creating a fairly long email, or constructing one from data in a loop for example.. this isn't so easy! If you replace mailURL in the final line with:

[mailURL stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]

then you can leave all the original space characters and slash n characters in with no problems!

iPhone Development - Application Verification Failed

So, you've made your iPhone application and it runs pretty well in the simulator, so now you need to deploy it. Apple's documentation on this is somewhat less than perfect! I thought I did everything perfectly, but I kept on getting an Application Verification Failederror message. After some snooping around the web it appeared that problem was because my Bundle Identifier was not set correctly. One simple change and that was it.. I has even been ready to reset the device!

For an excellent guide to deploying on the iPhone check out this blog post:

Wednesday, 15 October 2008

IPhone Development - Tab Bar View Controller

So, I've been learning to play with the Cocoa Touch framework... in all it's wonderful complexities. The first issue that I came along was with a Tab Bar View (Controller). My trouble was once I had created a new tab bar item, I couldn't get it to link to an external Nib file. Here is the solution (I'll point out the bit that I was missing). Let's pretend the new view and controller are called FunnyView and FunnyViewController.

Once you have created your external Nib for Funny View, you need to set the File's Owner to be FunnyViewController (it's in the Class box on the inspector pane). This is where I stopped, and hence nothing worked! This also however needs to be done for the TabBar View Controller. Click on the tab you want, then set the class of that to be FunnyViewController also. Now you should have a working tab... you can go ahead and set outlets and actions as you so wish now...

Tuesday, 14 October 2008

The podcast

So, I got pointed to the podcast the other day, and I can't recommend it enough! Very often you hear some nice mixes from local DJs.. and they're good... but nothing amazing; this is different... especially Colin Moore's session. The first half an hour is a foot tapping frenzy of funk & hip hop layered in with familiar samples that make you wanna get up and dance (even when you're on the tube a rush hour...ahem). The second takes you through breaks and all the way up to some drum & bass!

Anyways, go get it.. the site is and the podcast itself can be found here (this link only seems to work under Safari.. question the guys!)

Monday, 13 October 2008 Sample Widget

This is a crafty little widget that I built for

Thursday, 2 October 2008

Evidence for Environmental Issues

So, whilst having a discussion with someone with quite opposite views the other day I realised that I can't quote figure or evidence for global warming. I can repeat things that have been said in the media, but no hard evidence.

Let's start from a level playing field - let's go either way. I would like people to point me toward actual scientific papers (e.g. academic or new scientist style, not the broadsheets' propaganda!) which give evidence both for and against global warming.

Thank you kindly.... comments appreciated!

Monday, 23 June 2008

Anti-BNP Protest

So, on Saturday I went along to the protest against the BNP. This met at London Bridge (ish) and walked along to Trafalgar Square. This was the first protest that I've ever been to, so it was very interesting! I'm also trying to get up to speed on all of my 'isms... fascism, socialism, communism etc. I realise why I personally don't like the BNP's policies, but I'm not positive on how this fits into the 'isms.

Anyway, here are some pictures from the event:

And the rest can be found here:

Friday, 6 June 2008

Marks & Spencer - Plan A - What a joke!

So, the other day I wanted to buy some new jeans. I'm quite interested in where & how my clothes (and indeed, other products that I use) are produced; I try to purchase *ethically* produced clothing when I can. So, Marks & Spencer have this Plan A scheme which has five pillars: Climate Change, Waste, Sustainable Raw Materials, Fair Partner and Health. This sounds amazing, it is really amazing! In particular the Fair Partner section has the following information (taken from

As an own brand, with influence over a quarter of a million workers worldwide, we have a golden opportunity to set new standards in ethical trading. For example, by extending our commitment to Fairtrade cotton we can directly affect the welfare of over 100,000 small-scale farmers. The extra income raised by fair trading also enables communities to invest in wells for clean water or improve healthcare facilities. The stories in this section will help you learn more about our efforts to improve the livelihoods of our suppliers and their communities all over the globe.

I've bought a pair of jeans from the Marks & Spencer in Jersey which were part of the Plan A scheme, so here in London I went to the Covent Garden store. There are signs on most walls talking about Plan A, but I could find no clothes. I ask the lady at the counter where I could find some of the Plan A clothes. She replied with something along the lines of "Plan what?"... she had no idea what it was. I had to explain that it was their name for the scheme which include fair trade products. "Oh yes, the Fairtrade clothes...... we don't have any". None at all, in the whole store, in London!!! I then went to the bigger store on Oxford Street and attempted to find some Plan A clothes there too... none (either that or they were hiding from me).

So, it seems as if Plan A is just the corporate image that M&S wish to push (and they do very vigourously), without actually following up on it at all.

What a joke.

Wednesday, 14 May 2008

FireFox double page load

OK... to anyone who's implementing a page counter.... if you find that the counter is doubling up when a request from FireFox (under OSX/Linux/doze) it's because the browser is loading the page twice. It's also due to how the W3C spec is written... and the behavior is entirely correct (if not a bit annoying).

If a browser find an IMG with an empty SRC tag then it should reload the page once more to check. I had an empty IMG SRC which was then dynamically assigned to with JavaScript.

To resolve the problem I just put a temporary image in place... which will never be seen because the containing div is hidden until the Javascript makes it visible again... at which point the correct image will be assigned to it.


Work around for Internet Explorer when dynamically changing Select Option

OK, so quite a common thing to do is update the items in a multiple select box with options sent from the server through some javascript.

And it's very simple.. you just get your response and stick it into the select box with using innerHTML on the select box. Unless you're using IE that is!

IE has a bug where is will remove the first OPTION when using innerHTML. It's only been there since 1999, so I'm sure they'll fix it soon! :P In the mean time check out this blog entry:

Which has good info, or return XML from your server and parse it in the Javascript creating new Options as you go. This is how I did it, adapted slightly from 'Learning Javascript'.

var opsnodes = xmlhttp.responseXML.getElementsByTagName('op');
for(var i = 0; i < opsnodes.length; i++){
var name = value = null;
for(var j = 0; j < opsnodes[i].childNodes.length; j++){
var elem = opsnodes[i].childNodes[j].nodeName;
var val = opsnodes[i].childNodes[j].firstChild.nodeValue;
if (elem == 'value'){
value = val;
name = val;
}//end for j
sel.options[i] = new Option(name,value);
}//end for i
alert('Sorry there was an error');

where sel is the select box.

Interesting Sign

So, this was shown during the safety video on a bus near Oslo.... anyone wanna get in front of the bus to get the fire extinguisher? :-)

Tuesday, 13 May 2008

Bebo Application Development - Why no Javascript!!

So, I've built a Facebook application which uses the Facebook Javascript Sandbox. I mean, this is Web 2.0... of course it uses Javascript!

So, Bebo have (for a while now I guess) supposedly been code compatible with Facebook... however this seems to just be the FBML (or SNML as it now seems to be called). This is great.. but the lack of any form of JS support reduces the impact of being code compatible with Facebook.

I'll have to either we write the application to be rather static.. or rewrite it to not use any FBML and put it all in an iframe.


Wednesday, 7 May 2008

Snow in London

It's hard to believe it at the moment (given our stunning sunshine!), but this was the covering that London received not to long ago:

Neutral Density Photography

This image was shot in Cornwall using a Neutral Density 4 filter. Some slight dirt on the actual filter made it a bit messy, but I think this adds to the effect.