Ben Dodson

Freelance iOS, macOS, Apple Watch, and Apple TV Developer

Kampyle - An easy way to get web user feedback

Kampyle is an easy to set-up javascript widget that gives users the opportunity to comment on your site either for the purposes of a bug report or simply to say "you have a nice site". On clicking the feedback icon, a new window opens that gives the user various different options on how to comment on the site. The default options are Bug, Site Content, Suggestion, Compliment, and Other. Each of these has several sub-options such as "browser issues" or "feature request" which are all completely customisable by the website owner. The user can then fill in a bit of text to describe the problem or suggestion, etc, and can choose from 5 different emoticons to say how they feel about the website in general. All of this information is then logged in your account at the Kampyle website for you to look over at your leisure - they can also email daily reports to you so that you can stay on top of all your adoring fans or pissed off IE6 users.

I've installed Kampyle on my site (using a custom icon as their default choices are pretty bad - animated gif anyone?) and I've already had quite a few pieces of feedback. The great thing is that I've been able to fix a few bugs people have alerted me to and then have Kampyle email them back to let them know that the issue has been resolved.

Kampyle is pretty good as it is, but the thing that is putting Kampyle on the map is their recent integration with Google Analytics which means you can see all of your feedback stats within your Google Analytics account. The way they have done this is particularly clever - You need to download the Grease Monkey Firefox Extension and install the Kampyle Grease Monkey script, but then when you go to your Google Analytics account you'll see the Kampyle stats showing up in their own dashboard widgets. Pretty clever really. This was a major incentive for me as it means I can now see all of my stats in one place rather than having multiple accounts across the internet.

So, if you'd like to leave any feedback on the site just click on the "Leave Feedback" banner in the bottom right hand corner!

Stop! Bug found in "Stop! Hammertime!" Firefox Extension on Windows XP / Vista

I've had a few reports from people saying that the latest version of the Stop! Hammertime! firefox extension hasn't been working properly on Windows XP and Windows Vista. A new version will be coming soon but here is a fix for the time being.

The problem that people are reporting is that when you go to the preferences section for the extension and try to change the stop button to the custom hammertime button, it won't let you press the "ok" button to proceed with the change. It is currently only affecting Firefox 3 on Windows XP and Windows Vista but I'll be making a patch to fix it shortly. For the time being, if you can't live without a hammertime button (despite the fact the stop button still works and plays the sound), then you can follow the steps below to get it working.

First of all, you need to type "about:config" in the address bar of the browser. This allows you access some of the internal preferences and config settings of firefox and all of your installed extensions. You will most likely get a "here be dragons" warning but you can skip this - you do know what you're doing right?

You will then need to use the filter option to locate the Stop! Hammertime! preferences. You can do this by typing "hammertime" in the filter box - this should give you one result which by default is set to "false". You need to double click to change it to "true".

Once you've done this, simply restart firefox and the new hammertime button will be there for you to enjoy! To change it back to the stop button, simply follow the steps above but make sure the hammertime config entry is set to "false".

An update will hopefully be available in the next fews days so that you won't have to perform the above to switch between the two, but this should do for the time being. Alternatively you can buy an Apple Mac or install Linux!

In other Stop! Hammertime! news, it seems that the copyright holders for the song "U Can't Touch This" have noticed it's popularity and are attempting to cash in on it. I recently had an email from the Integrated Copyright Group (ICG) informing me that I'd need to purchase a license in order to play the 2 second sound clip in the firefox extension otherwise I would be in breach of copyright. After a few back and forths we came to the conclusion that they could send a "cease and desist" letter from their lawyers but that the extension wasn't being removed (and I wasn't paying for a license). So, we'll see what happens - expect updates on this shortly!!

iPhone 3G, Apps, MobileMe, and iPhone specific sites

So, you've probably heard of the iPhone (unless you've been living under a rock in Redmond) - Apple's debut outing into the mobile phone arena, and what a debut it has been! The interface is easy to use, the build quality is good, and it has a number of interesting features (e.g. visual voicemail) which make up for it's huge lacking of the most basic features (e.g. MMS). I've been using one for the past 3 months but have just recently upgraded to the iPhone 3G after queueing for a couple of hours outside the Fleet Street branch of O2 on launch day. But what are the new features and have they really improved the "jesus phone"?

Well the most talked about features that have been added are 3G support (which allows for faster data transfer) and GPS (pin-point location service). The difference in speed between 3G and Edge is not that noticeable on most websites I've found, but when using applications like maps or mail it is an absolute godsend. Having said that, although pages take about the same amount of time to load, they seem to render a lot quicker (e.g. the screen stays white for a long period of time before suddenly filling up with content incredibly quickly). GPS was the main thing I was looking forward to and it seems to be a bit hit and miss. Sometimes I can enable it and it will have my exact location within about 4 seconds whereas other times it just never gets a lock. What makes this so annoying is that it doesn't seem to use cell tower triangulation or wireless networks to get a rough approximation of my location as the old iPhone did. It just keeps hoping it will see a GPS satellite. I had been hoping that there would be an app that would automatically send my current location to a service such as Fire Eagle at regular intervals so that I could make some cool location mashups but with the current support it seems unlikely that it would work. Oh, and these 2 features drain the battery like you would not believe! Fortunately I don't move too far outdoors so I'm always near a healthy electric supply!

The other differences between the iPhone and the iPhone 3G are very small but have actually meant more to me so far than 3G or GPS. The first is that the back is no longer metal but plastic. At first I thought this would be absolutely terrible but it actually makes the phone feel a lot more comfortable. Also, all of the buttons (such as the silent switch and power button) are all brushed metal so they feel a lot more reliable and well built. The other big improvement is that the sound quality is much improved on both the internal and external speaker. I can actually use the loudspeaker now whereas before it just sounded like a normal phone with the volume turned up a bit (very muffled).

The main enhancement has definitely been the introduction of iPhone 2.0, the much anticipated software upgrade available to both the old iPhone and the iPod Touch. With the software you can now have Exchange mail, contact searching, and run 3rd party applications on the device. It is this that seems to have become the main reason people want an iPhone 3G although to be honest I probably could have kept the old iPhone that I paid a ridiculous sum of money for only 3-4 months ago! I have several apps installed now including services for Twitter, Flickr, Last.fm, and Facebook, a VNC client, a lightsabre, a Guitar Hero style tapping game, Super Monkey Ball, and a mobile version of Things (which doesn't sync yet but they promised a free upgrade that will). I'll be posting some updates over the coming days about various exciting apps that have arrived or are hopefully coming soon. At the moment there is a real gap for an MSN Messenger client as I haven't found one yet but they seem to be adding 10-20 apps per day so there should be one in the near future.

Another interesting development which Apple have introduced is MobileMe which is supposedly "Exchange for the rest of us". It also has some of the best functioning "Web 2.0" apps that I have ever seen at me.com. The idea is that all of your email, contacts, and calendar entries are stored online in a "cloud" and are then automatically pushed to your phone and computers. Now this seemed great for me as I'm always updating things on the phone and then either having to plug it into my mac or update it on there manually. I have both a MacBook and an iMac so it becomes a hassle trying to sync them all so it seemed like a very good idea. Unfortunately the launch has been marred by huge problems over the launch weekend (e.g. it didn't work), some pissed off customers who didn't agree with Apple's marketing of the push system (e.g. showing a MacBook making a change that replicates instantly on the "cloud" but in reality it's a 15 minute automated sync rather than the push capability used by the phone), and also with a small error in which they took £121 off your credit card instead of $1 to authorise the payments. However, all of this aside, MobileMe is absolutely great! I add items to my calendar on my mac and they then show up on my iPhone. I take a picture of someone on my iPhone and add it to their section in my address book and sure enough the photo is displayed on my MacBook the next time they email me. It all works incredibly well but then it should do for £59 per year!

My final thoughts on the whole iPhone thing revolve around iPhone specific sites. That is to say taking a normal website (e.g. facebook) and then having it detect if you are using an iPhone or not and then displaying specific content or styling for that device. Now normally I would be against such practices (remember IE4?) but in this case I have to say "why not"? The iPhone has completely redefined mobile internet (in my opinion and doubtless many others) and has a unique interface and styling that are begging to be exploited. The Facebook site is probably the best example for the way in which it seamlessly detects the iPhone and then displays a site that has been completely optimised for it (and styled to make it look like a native app). Now that there is the opportunity to run apps natively on the iPhone I'm sure a number of these sites will disappear but for those of us that can't write objective-C (and I can't say I have a great desire to start learning it) then it is the closest way we can get to writing apps for the iPhone. I am going to be making some sites specifically for the iPhone as well as some of my own personal systems which I'll be able to now access remotely and do some cool stuff with. This debate is currently waging on the Web Standards Group Mailing List so I'd urge anyone with an opinion to sign up and discuss it there. Alternatively you can put your thoughts on this issue here by using the comment box below.

Does anybody really use RSS Feeds?

I've been using RSS feeds for several years now and find them incredibly useful for keeping up to date with blogs and news sites. However, today I was talking to another web developer who said that he hates RSS feeds and would much rather have email updates when a site gets updated rather than having to add an RSS feed to his email client.

Now I wouldn't find this strange coming from a lot of people as I can understand that a lot of people have no idea about RSS and would get confused trying to work out what an aggregator is. But from a web developer? Come on! If the people that develop websites with RSS can't even be bothered to use it then what chance is there of the general populous using it?

I use mac mail to manage all of my RSS feeds and find that it does a fairly good job - everything gets synced over to my iPhone as well so I can keep up to date when I'm on the train etc. I also have a few RSS feeds on my iGoogle homepage so I can see the latest xkcd or dilbert strip whilst I'm pretending to work. Now I'm fairly sure you can set Outlook up to receive RSS feeds - so why doesn't this developer do that? Apparently, if Windows were to crash (unlikely but stay with me on this) then he would lose all of the RSS feeds he was tracking and therefore have to add them again so it's not worth doing. "You could use Google Reader or any other number of online aggregators" say I. "Too much effort" says he. I give up.

So, in the next day or so there will be a "sign up" button on this site so that those of you who can't be bothered with RSS can get email alerts when a new message is posted. I've also set up a twitter account which will be syndicating the posts on this site as and when they happen - the account to follow is bendodson_com. Oh, and for those of you that have moved into the 21st century, here is the good old RSS feed.

Website upgrades finally completed

Some of the more regular visitors amongst you may have noticed that for the past month or so, bendodson.com/weblog has been in a mild state of flux - I'm happy to say that everything is now completed and working fully!

I hurried the uploading of the new design as I had some spare time at Mashed and thought it would be a good idea to get the new site up and running in any state. Then, the knowledge that my site might not be working would spur me on to fixing it. A good theory, but apparently not good in practice.

There were several bugs in IE6 (there always are), the site was taking too long to load, and the contact form didn't work at all.

But now, the site has been optimised to a grade A level (according to YSlow), the IE6 bugs have been fixed, and email now works from my server so the contact form is working again!

I'll be continuing to make little tweaks and upgrades here and there, but I'll also be returning to the blogging scene and keeping the site regularly updated with various development news. As a taster, I have recently been playing with a new iPhone 3G, fire eagle, a montage making script that uses flickr, and Google Optimizer (although not all at the same time) so stay tuned!

New website goes live!

I've finally got around to giving the site a visual refresh which can now be viewed here at bendodson.com/weblog - There are a few bugs (mainly IE6) to iron out but on the whole it should be working!

The site was redesigned by Liza Hayes who took her inspiration mainly from Doctor Who! I've been building it slowly over the past few months, but I'm currently at Mashed so decided whilst I had the time dedicated to coding I really should get on and finish it!

There will be various updates to the site over the next few days so keep posted!

RSS Feed of the London Underground Tube Status

Please note that this page is now outdated - for any updates to the London Underground, you should use my dedicated Tube Status API and RSS feeds

I've been spending some time making an RSS feed of the London Underground tube status as I've been working on a few projects that could use one. You would think that Transport for Londons nice web 2.0 style website would provide this basic requirement but alas they don't. There are a few developers out there who have written some scraping scripts to convert this information, but most of them no longer work as they haven't been updated to work with the new site.

Previously I have used the script at conor.net to power any projects requiring a tube RSS feed but this went down a few weeks ago when I was in the middle of some crucial testing. So, like any other crazy developer would, I decided to write my own PHP scraping script that would generate me a nice RSS feed to basically tell me TFL had messed up my journey home!

For those of you just looking for an RSS feed of the London Underground tube delays, you can find it at http://tubeupdates.com/rss/ - This is automatically updated every minute and will email me if anything goes wrong so I can fix it! If you are going to use it for any projects, please let me know so that I can monitor bandwidth, etc. If you are interested in how it works, then the code that powers this is below - feel free to use and modify it for your own projects:

<?php

// This file should be run on a CRON job every 5 minutes.

// The server will need to be able to write to this folder in order to create the XML file.


$array = array(
        'bakerloo',
        'central',
        'circle',
        'district',
        'east london',
        'hammersmith & city',
        'jubilee',
        'metropolitan',
        'northern',
        'piccadilly',
        'victoria',
        'waterloo & city'
        );

$i = 0;
foreach ($array as $ref) {
    $id = str_replace(' ','',$ref);
    $id = str_replace('&','and',$id);

    $lines[$i]['id'] = $id;
    $lines[$i]['name'] = ucwords($ref);
    $lines[$i]['url'] = 
        'http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/tube-' . $id . '-now.html';

    $i++;
}

$i = 0;
foreach ($lines as $line) {
    $file = file_get_contents($line['url']);
    $needle = strtoupper($line['ref']) . ' LINE:';
    $pos = strpos($file,$needle);
    if ($pos !== false) {
        $pos += strlen($needle);
        $end = strpos($file,'</div>',$pos);
         $status = strip_tags(substr($file,$pos,($end-$pos)));
    } else {
        $status = 'A good service is currently running.';
    }
    
    $lines[$i]['status'] = $status;
    $i++;
}

$now = date('r');

$xml = <<<XML

<rss version="2.0">
    <channel>
        <title>London Tube Updates</title>
        <link>http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/default.html</link>
        <description>The latest London Underground tube update information</description>
        <language>en</language>
        <pubDate>$now</pubDate>
        <lastBuildDate>$now</lastBuildDate>
        <docs>http://tube.bendodson.com/weblog/</docs>
        <webMaster>ben@bendodson.com (Ben Dodson)</webMaster>
        <generator>PHP script by Ben Dodson</generator>
        <ttl>5</ttl>
        <image>
            <title>Transport for London</title>
            <url>http://www.tfl.gov.uk/tfl-global/images/roundel.gif</url>
            <link>http://www.tfl.gov.uk/</link>
            <width>52</width>
            <height>44</height>
            <description>Transport for London Logo</description>
        </image>
XML;

foreach ($lines as $line) {
    $xml .= '<item>' . "\r\n";
    $xml .= '<title>' . htmlentities(ucwords($line['name'])) . '</title>' . "\r\n";
    $xml .= '<link>' . $line['url'] . '</link>' . "\r\n";
    $xml .= '<description>' . htmlentities($line['status']) . '</description>' . "\r\n";
    $xml .= '</item>' . "\r\n";
}
        
$xml .= '</channel>' . "\r\n";
$xml .= '</rss>';

file_put_contents('rss.xml',$xml);

?>

As I mentioned earlier, I am working on a few projects that utilise this script and I shall be making those available shortly. However, for a sneak peek, you can check out Tube Updates, an API for any developer that would like to make use of this data. There are still a few improvements to be made but you get the general idea!

Firefox extensions updated for Beta 3 compatibility

I've spent some time updating my firefox extensions so that all of them work with Firefox 3 Beta 3. At present they can only be downloaded from this site as it takes the Mozilla Addons team a few days to approve updates. My extensions page is now back up and running though and contains details on all 3 of my Firefox Extensions (Font Finder, Stop! Hammertime!, and STOP in the name of love) as well as download links for the new releases.

I won't be making any further updates to the stop buttons (apart from making them work with future version of Firefox) but I will be continuing development on Font Finder which could benefit from a visual overhaul as well as a clipboard function! I'll be updating on here when it happens so sign up to the RSS feed for the latest news!

Google extended encoding made easy!

I've been having a play around with Google Charts recently but came across a problem with the range of values that can be used. With simple encoding, you can only have values between 0 and 64, and with text encoding only values between 0 to 100. This is annoying when dealing with things such as tracking website hits or weight when values are typically much higher.

I played around with some functions to try and factorise the numbers so that they would be in the range of 0 to 100 but this didn't go so well so I decided to tackle Google's extended encoding.

This is a system of encoding that basically takes a pair of alphanumeric characters and translates them into a number between 0 and 4095 (much better!). So for example, B9 translates to 125 and .a would translate to 4058. However, although this has a much larger range, it's a bit harder to get your head around and so what is needed is a simple function (or two) to convert to and from the extended encoding. Predictably, I have said PHP functions here:

<?php

function array_to_extended_encoding($array)
{
    $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.';

    $encoding = '';
    foreach ($array as $value) {
        $first = floor($value / 64);
        $second = $value % 64;
        $encoding .= $characters[$first] . $characters[$second];
    }

    return $encoding;
}

?>
<?php

function extended_encoding_to_array($string)
{
    $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.';  

    for ($i=0;$i<strlen($characters);$i++) {
        $first[$characters[$i]] = $i * 64;
    }

    for ($i=0;$i<strlen($characters);$i++) {
        $second[$characters[$i]] = $i;
    }

    $pairs = str_split($string,2);
    foreach ($pairs as $pair) {
        $value = $first[$pair[0]];
        $value += $second[$pair[1]];
        $values[] = $value;
    }

    return $values;
}

?>

They work fairly simply by taking advantage of PHP's casting methods in that a string can be interpreted as an array.

In the first function, array_to_extended_encoding(), an array of numbers should be passed e.g. array(250,39,400,1904,2). The function first lists all of the extended encoding characters in order as one string named $characters. It then loops through our array of numbers, and creates two variables; $first and $second. In $first, we store the number from our array divided by 64 and rounded down using the floor() function. For $second, we use the modulus operator (%) to find the remainder once the number from the array is divided by 64. We then take both $first and $second and work out the encoding by looking up the numbers from within the $characters cast as an array. This gives us 2 characters which make up the extended encoding for the number. We keep extending the value of $encoding until we end up with a string representing the full extended encoding of the array passed to the function.

The second function, extended_encoding_to_array(), is slightly more advanced. It accepts a string as its only parameter which should be an extended encoding (e.g. $encoding = 'AA..B9aC'). We first list all of the characters in a string as we did for our previous function, but then we create two arrays which will contain all of the numbers we need to decode the extended encoding. In $first, we create an array of each character in the $characters string as a number multiplied by 64 (so the letter b would be 64 as it is signified by number 1 in the array multiplied by 64). Within $second we perform a similar operation but instead just assign the number of the character rather than multiplying it by 64. This gives us two arrays, with keys relating to each character that can be used as an encoding and values as the numerical equivalent. It is now a simple case of splitting the string that was passed to the function into chunks of 2 characters using str_split() and looping through the returned array setting the value of each character within the pair from the arrays we created. We then add the two returned numbers together to give us the decoded figure and add it to an array which will be returned by the function.

Simple? It has certainly made things a lot easier for the functions I'm writing for a PHP wrapper for Google Charts and hopefully it will help somebody else as well. If you have any questions or comments, please get in touch.

Firefox Extensions page will be right back!

As some of you may have noticed, the new site design has caused the Firefox Extensions page to go awry. This will return shortly (along with a few new extensions) but for the time being you are better to go the Mozilla Addons site to download the extensions.

Stop! Hammertime - https://addons.mozilla.org/en-US/firefox/addon/974
Font Finder - https://addons.mozilla.org/en-US/firefox/addon/4415
Stop in the Name of Love - https://addons.mozilla.org/en-US/firefox/addon/3771

Update: The extensions page is now up and running again and can be viewed at https://bendodson.com/weblog/extensions/

« Older Entries Newer Entries »