skip main content

Hey, I’ve got a new job

posted by Duncan at 7:19 pm on October 8th, 2012

I guess I should have wrote this a while ago but I’ve been busy. The headlines are:

  1. I’ve now left the BBC
  2. I’ve been in my new job a week

But never the less it’s worth noting down. If for no other reason that I don’t get time to write stuff on this blog anymore, as well as the fact it’s quite a big deal for me and I’d like to record it. I’d been at the BBC coming close to 10 years, which in this day and age seems like a really long time in one job. Certainly in the web industry. It was by far the longest time I’d spent in one company.

So where have I gone? and why did I leave.

I’m now working as a developer for kyan.com. They’re an agency in Guildford, Surrey and do some really cool work (why not give them a call). This work is all done in Ruby on Rails.

There’s your reasons, simple really. My commute to London is now reduced by nearly 3 hours a day, and I get to build cool websites in the technologies I love.

TrainMode now supports AppleScripts and therefore Alfred

posted by Duncan at 10:04 am on January 5th, 2012

I’ve just pushed an update to my Mac Utility TrainMode. It allows you to be able to control the application via AppleScript. There are two reason for this feature. One is that I recently update the application, and when re-publishing through the App Store, it got refused due to functionality that had deemed fine the first time round! What it essentially meant was that you could no longer just click the icon in the status bar to activate TrainMode anymore.

Now I use the productivity application Alfred a lot. In fact I struggle to think how I would cope without it now. This application lets you do almost anything on your machine via a series of short keystrokes. It’s free, but the real cool stuff comes when you buy the PowerPack. With the PowerPack you can write your own scripts that can be activated by simple keystrokes.

So I’ve written a simple Alfred extension that can now talk to TrainMode via AppleScript. It means you can now activate and de-activate TrainMode with a simple key combination:

tmo a - activate
tmo d - de-activate

TrainMode Alfred Extension

Any application that supports running AppleScripts could also work. Oh and in Alfred you can change the command completely. In fact I wanted it to be tm, but my mac by default seems to auto convert that into ™.

Update on BBC QRCode work

posted by Duncan at 8:47 am on September 16th, 2011

I have posted before about work I’ve done around QRCodes, specifically work around the BBC and QRCodes. Recently though due to the fact they are starting to appear everywhere and conversation I had with a guy from Bang goes the Theory, I thought I’d revisit that work.

The news is that I have created an application that let’s people create their own BBC QRCodes. This could be BBC people who need them for marketing etc or anyone else who’d like a neat BBC QRCode like the one below, that happens to represent the app itself.

BBC QRCode App

You can read more about it over on the BBC R&D Blog.

Nike+ GPS Sports Watch Review

posted by Duncan at 7:24 pm on June 8th, 2011

I’ve had my Nike+ GPS Sports Watch a few weeks now, so I thought it was about time I shared my experiences.

Nike+ GPS watchMy Nike+ profile: http://my.nike.com/whomwah

I owned quite a few sports watches. Polar’s, Garmin’s, Suunto’s. Some GPS, some not. I have a bit of a fascination with them. When Nike announced they were building one in collaboration with TomTom, I was suitably excited.

Buying the watch was a little strange. I got mine from NikeTown on Oxford Street. I initially thought they didn’t stock them as there is only one on display in a little cabinet in this giant store. When asking one of the assistants, he proceeded to shuffle off into the back room and fetch the special keys to where the watches were hidden. He had a smile on his face, and told me that the first 500 batch had sold in 2 days, and that they had only just got the new batch. Clearly they don’t need to stick these things in big glass cabinets. The marketing and hype is enough.

The packaging is very “Apple” and the build quality is really nice. The setup was also very simple (although not perfect). Install a little desktop client, plug the watch into your computer via the nifty built in USB adapter and follow the instructions on screen. This gives you feedback about what the watch is doing. You log into the Nike+ website from this client too, but strangely also configure the watch options, like setting the time, 12 or 24h, km or miles, sounds on or off. When starting out I had a problem where my watch had a firmware update available, and whilst installing it the software crashed! Simply starting the procedure again and ignoring all the opaque error messages seem to do the trick and I was up and running.

Starting up for a run is just a matter of clicking and holding the yellow button. This gets the watch in linking mode, where it will try and locate satellites and your foot pod if available. I’ve found the watch to be quicker to link than other watches I’ve had, especially in Central London, but it’s not super quick. Probably 20-30 seconds. Once linked, you are greeted with “Ready” and just need to press the yellow button to start.

The watches UI is really simple. I initially thought to simple after the feature fest of other sports watches, but after a few weeks use, I think it’s perfect. They have stripped it down to exactly what you need on a run, and no more. The display is clear and easy to read whilst running, with it’s large display and smaller display above it, and the button chunky enough to not accidentally press the wrong one.

There are three buttons on the watch, two to toggle back and forth and the final one to select things. It’s really simple to pause the watch during a run, or switch the views. If you choose to have the watch add autolaps, the watch beeps at the lap marker and then waits for a second to let you glance down, showing you split times.

Battery life is epic. Maybe I’m not using it enough, but the built in battery seems to be always full. My old Garmin used to be practically flat after a run.

Finally, after a run, it just a matter of popping the watch into your computer USB slot and the syncing begins. Once synced the app takes you to the Nike+ website. Currently this is where it all goes wrong. The Nike+ site is a dog. A Flash only dog. It’s old, slow and clunky. There is hope though. There is a new part of the site called Maps beta, which is only for the GPS devices. This is an HTML pages and is much snapper. I’m guessing the while site is going this way … please.

So to summarise. I think the watch is fantastic, and worth every penny. Once Nike sort our there website, it will be an awesome combination.

PROS Looks, simple, battery, functionality CONS Syncing, Nike+ website

Logging/Debug setup in Xcode 4

posted by Duncan at 9:10 am on May 31st, 2011

Here’s a little snippet of how I manage logging in my applications with Xcode 4. I’m sure it works just fine in 3 too, but this is more of a reminder for me as it’s something I always forget how to do when starting a new project.

Firstly I update the *_Prefix.pch file that lives in the Other Resources directory so it also contains the snippet below. I use the Prefix code posted by Marcus Zarra which seems to work just fine for me:

#ifdef DEBUG
  #define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
  #define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
#else
  #define DLog(...) do { } while (0)
  #ifndef NS_BLOCK_ASSERTIONS
    #define NS_BLOCK_ASSERTIONS
  #endif
  #define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#endif
 
#define ZAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0)

Next I update my project by adding the DEBUG=1 flag to the preprocessor settings. Click on your application target, and select the Build Settings tab is selected along with All and Combined. I then do a search for ”- preprocessing” which should leave you with the Preprocessor Macros remaining. Now just DEBUG-1 to the correct one, as the photo below shows.

DEBUG flag

Hope that saves someone some time. Oh, and if anyone has any improvements I can make to this, I’d love to here them.

Setting up your own hosted private Git repository

posted by Duncan at 1:12 pm on May 6th, 2011

Now I’m a fully paid up user of Github. It’s a wonderful service, site and community of developers. But for the account plan I can afford, I only get 5 private repositories. I’m happy to make my work public, but there are some bits of software I want to keep private right now and yet still have remote copies of, and this comes to more that 5. I still want to use Git, and maybe one day make them public on Github. Here’s my solution using my own hosting as a private Git repository and just using Git and SSH to do the job.

Before we start, I’m assuming that you have SSH access to your hosting, and you have Git installed both on your machine and on the host.

First create a folder on your remote machine to hold the repos

$ ssh myserver.com
$ mkdir git
$ exit

If you have the correct permission or sudo access you could do the same as me and create the dir at /opt/git. You’ll need to replace all other mentions of git with this new path if you go this route.

Navigate to the local git repos on your machine that you want to have a remote copy of. Running the command below will give you a bare copy of the repos in your tmp dir.

$ git clone --bare /path/to/myrepo/.git /tmp/myrepo.git

Now you need to get this copy onto your remote machine. There are various ways but the simplest is scp with the recursive flag set:

$ scp -r /tmp/myrepo.git myserver.com:git/myrepo.git

You have a couple of choices now. You can either just navigate in into your local git repos and add your remote git as a remote to your config like this:

$ git remote add myserver myserver.com:git/myrepo.git

or you can delete your old repos and check out the remote one. Make sure you backup the old one until you’re sure it works ok though.

$ git clone myserver.com:git/myrepo.git

You can now make changes and push them to your new remote repos when ever you want.

Hope this helps someone. It doesn’t solve everything, but is a simple way to have a private alternate copy of your Git repositories.

Always adding http_proxy support when using Ruby’s Net:HTTP

posted by Duncan at 8:57 am on April 12th, 2011

Recently there have been a number of times I’ve needed to use Ruby’s Net:HTTP library. Because I develop inside a company firewall, all HTTP traffic has to go through a proxy. This means our libraries always need the Proxy support that Net:HTTP has. This means we now have a common idiom, and here it is:

require 'ostruct'
 
url = URI.parse("http://destination.com")
proxy = ENV['http_proxy'] ? URI.parse(ENV['http_proxy']) : OpenStruct.new
 
conn = Net::HTTP::Proxy(proxy.host, proxy.port).new(url.host, url.port)

Simple! You can use this every time, and your lib will have proxy support based on the http_proxy environment variable being set. If it’s not set, then it will just carry on as expected.

Fixing the 400 Bad Request problem with Solr 3.1.0 and Ruby-Solr

posted by Duncan at 6:44 pm on April 5th, 2011

After seeing a tweet by Matt Biddulph the other day, mentioning that a Solr had a new 3.1 release, I thought I’d take a look. I decided to replace the 1.4 version we have at work, even though we are currently scratching the surface of what Solr can bring to a project.

Anyway, the install seem to go smoothly, and the admin screen was up and navigable. I went to one the application we have running against it though, and saw nothing but “Bad Request 400″ errors. Strange. Initially I thought the problem was down to the ruby-solr gem I was using, but with further investicgation it proved to be a Solr problem. Going to the admin area, and in the “Make a Query” section clicking “full interface“, I would make a query and get the same error! If I removed ‘standard’ from the query type things worked ok.

Checking the solrconfig.xml config file and you will see there is a line:

<requestHandler name="search" class="solr.SearchHandler">

I changed this to

<requestHandler name="standard" class="solr.SearchHandler">

and everything was fixed for me. It looks like someone changed the Handler name? anyway it was expecting a requestHandler with a name standard by default. This is also why ruby-solr was bailing.

Now I’m no Solr expert here, so if anyone has a clearer explanation I love to here it. Further searching has since found this is a bug which appears to have been fixed, but you’ll have to wait for the next release to see it.

Introducing TrainMode 1.0, now in the Mac App Store

posted by Duncan at 8:47 am on March 31st, 2011

After the relative success in the iPhone App Store of Hydrate and Keycell, I fancied getting something into the Mac App Store too. I had tried to submit RadioAunty, but had it rejected because it contained Flash! (yeah thanks). I needed other ideas.

Whist getting onto the train to work one morning, getting out my MacBook, and going through the same procedure of, turning off the Wifi, muting the volume, and turning down the screen brightness, it occurred to me that I could streamline this into a simple application that lives in your status bar. One click to turn everything off, one click to turn it back on again. TrainMode was born.

TrainMode #2

The application actually allows you to adjust a few things. Like which things you would like switched off, and how quiet you want the volume muted or how dim you want the screen to go. You can even set it to automatically de-activate after a period of time.

I have been using it every day for about a month now, and whilst it’s hardly life changing, it is proving convenient. I’d love to hear what you think? Get it from the App Store using the link below. I have also provided a few promo codes below. First come first serve.

Download TrainMode from the App Store

# TrainMode promo codes
T7XXEW4A3JPL
HPAHFM9XH9MA
3N6XP9J9FM37
EM4PRKAFR64L
3LKYM3NH6HF9
AMLLARNMY94N
4J4P3HA39XJ7
EHTK36FFN3FH
7AP3RXETWLWA
4NPEPHLYN4NK
4T3LF9R9AT3X
KE9PN7HMK6N4
AXX49PMYP3KX
L6XPLN3HY47L
P7PXAKXTRLAY
3M6EWTAXFAJ7
W3LH66P33J9N
HA37PW9L3WYP
74NJK69XYNTM
HEAJR6TNL99L
7X93HRF9LFYJ
WRPTNMF7MYP4
FJ3HH4K9E7LJ

If you could let me know in the comments if you used one, so I can strike it out.

Hydrate 1.4 : with added Reminders

posted by Duncan at 1:53 pm on March 10th, 2011

After about 12 months, I finally git round to updating Hydrate. Loads of people had asked for reminders to be added to the app, and I had tried a few implementations, but it always seemed really complicated. I also hadn’t realised that the app was really buggy for iPhones with the ability to handle background tasks (which is not most of them). So anyway, I have fixed the bugs, and add a simple implementation of reminders, so hopefully everyones happy again.

reminders

You can get Hydrate 1.4 from the App Store today:

Download from iTunes

[NOTE] Oh, and one more thing. I have removed multi language support. I realise this is going to piss people off, but it’s a really difficult things to manage. I’m not multilingual, and I don’t have the funds to keep the translations up to date which even initially proved harder than writing the app. If anyone out there who speaks French, Italian, German or Spanish would like to translate the text for the app, then I’ll happily re-add it.


back to the top