About   |   Projects   |   Elsewhere   |   Work   |   Feeds   |   Contact

Archive for the ‘Technical’ Category

Getting an iPhone’s UUID number for ad-hoc app deployment

Deploying iPhone applications to testers involves creating an ad-hoc distribution package that they can install through iTunes, rather than the App Store.  To do this, you need to get each iPhone’s identifier or UUID code.

There are two steps to this – the first is to get your guinea pig to connect their iPhone and fire up iTunes.   Then on the iPhone Summary page, they’ll see their phone’s serial number, like this:

The serial number isn’t the one you’re after – clicking on the Serial Number will flip the display so that it shows the eleventy-billion digit UUID, like this:

Thankfully, you can copy the number even though it looks as if you can’t select it on the screen – just hover the mouse pointer over the number, and Cmd-C / Crtl-C to copy the number onto the clipboard.

13 March 2010

Technical

No comments yet

Vodafone, apps, and dumb pipes in the sky

Vodafone have got a problem. On the one hand, they’re one of the world’s largest mobile networks, with however many billions of subscribers. On the other, they’re just another network as far as many of their customers are concerned.

One of their responses is Vodafone360:

Vodafone 360 is a new internet service for your mobile, PC and Mac. It brings your phone, email, chat and social network contacts together in one place. Communicate with your friends, see their status updates, share your photos and favourite places – from your phone, PC or Mac.

As part of the launch, Voda are running roadshows aimed at their nascent development community and brought the latest one to Sheffield yesterday in partnership with Screen Yorkshire. (No, I can’t work out the connection between Screen Yorkshire and mobile apps either, but it was good of SY to cough up for the coffee and biscuits.)

I went along to have a look, and I *might* have been a bit rude in the backchannel. It’s not that I think Vodafone are doing a *bad* job – it’s just that I think it’s impossible for them to do a good one.

Voda’s first problem is that Apple have pretty much eaten their lunch as far as mobile application mindshare is concerned. There’s a reason why you don’t hear Tesco shouting about their new app for the Samsung H1 – it’s because they’re busy building apps for the iPhone. That might change, it might not – but there’s a hell of a mountain to climb right now.

The other problem that Voda have got is that the core 360 offering is simply a mashup of access to largely existing services. It’s a single consolidated address book, a single view of various social networks, maps, basic photo sharing, a music store, a web portal and an app store.

The fundamental issue for the networks is that the richer the devices and online experiences become, the more commoditised the network services get. If all I’m interested in accessing while I’m mobile is Facebook and Twitter, then I really don’t care about the network so long as it’s fast and reliable.

I’m a classic case in point – I use an iPhone, and switched from O2 to Orange because of the flakiness of the O2 network. I have no loyalty to Orange whatsoever – all my content is on the device, which can be ported from network to network as I see fit. If and when Orange start to piss me off through cost or reliability, I’ll move – and there’s really not an awful lot they can do about short of lock me in with contracts.

What Voda are attempting to do is interpose themself between me and the services I want to interact with. What 360 doesn’t seem to be about is “hey, come and use this cool new social network brought to you by Vodafone”. The only network in town is Facebook – there’s really no point in even trying to complete with it – so all Voda can do is try to graft on a funky access layer.

This all looks and smells something like the “walled gardens” that the network operators built of old. Rather than allowing unfettered access to all that the web could offer, chosen bits were carefully selected and presented to customers in a bounded environment. And rather than allowing access to “open” services like Twitter and Facebook and email, interaction had to take place within the confines of the operator’s webmail service.

The obvious problem with this is that the web moves far, far faster than any network product manager can, and customers vote with their feet when they find that they can’t go where they want. Once the first network caved and allowed access to the whole of the web, the others had to fall into line. And any value that *might* have existed in the walled garden was instantly lost. Back to being a dumb pipe again.

Ultimately, I can’t see a way that Vodafone – or any other network – can stem this tide. They’re doomed to become ISPs in the sky. For all that the likes of Talk Talk and BT and Virgin would like to *think* that they’ve got customer loyalty for their ISP services, they really know deep down that internet connectivity is commoditised and it’s the other services, such as bundled phone lines, that create the loyalty.

[As a sidenote, I'm an exception to this - I'm a Zen customer because they're a) reasonably priced; b) technically knowledgeable and c) sensible about things like Phorm and deep packet inspection. But I'm a geek, and I'm one of an incredibly small market. And even I've got my limits - if Virgin ever get around to running fibre past my front door, I'd be sorely tempted.]

One possible way of reacting would be to do a reverse Apple – offer some compelling devices that are exclusive to Vodafone only. The difficulty there is that Voda don’t have a device business, so they’re dependent on the OEM market. OEM manufacturers are unlikely to be interested in serving a single network only because it’s not a big enough market – unless they’re Apple, in which case they have the networks’ collective cojones in a vice and can extract revenues for the privilege of supplying the hardware.

And in any case, building those compelling devices is really, really, really hard – as Nokia are finding as their market share dwindles.

Overall, I can’t fault Vodafone for *trying* to do something about this. It’s just that I’m not sure that there’s anything they *can* do – mobile bandwidth is destined to become a commodity like fixed bandwidth has regardless of how hard they try to stem the tide. And it’s going to take them and their brand with it.

4 March 2010

Change Technical

No comments yet

Server moves

If you can see this post, it means that the server move is completed and the DNS change has propagated.

Move along, nothing to see.

1 March 2010

Technical

No comments yet

Fixing explosions caused by UITableView scrolling

I came across a weird (well, weird to me) problem with a UITableView this evening.   Basically, the situation is this:

I’ve got a Tab Bar controller in my app’s main window; with three tabs:

Screen shot 2010-02-11 at 20.31.52

The view in the first tab loads from another nib file (MeView.xib), which contains a navigation controller.  The file’s owner has a class identify of ‘MeViewController’.  The navigation controller contains a table view, with the delegate and data source set to ‘MeTableViewController’.  It’s easier to visualise within Interface Builder:

Interface Builder

The problem was that although the table view loaded fine, as soon as you tried to scroll it around the app blew up with an EXC_BAD_ACCESS (SIGBUS) error.

This had me stumped for a good half hour, until I stumbled across a cause thanks to Mr Google and a bit of poking around with the Leaks Instrument.

Basically, the problem was that as soon as the table was loaded, the delegate was being released – so as soon as I scrolled off the page, there was no cellForRowAtIndexPath method left to serve the table.  Hence the explosion.

The solution is actually quite simple – making sure that the delegate *doesn’t* get released.  The trick for this seems to be to add an IBOutlet declaration to the navigation controller’s class .h file, i.e MeViewController.h, and synthesize that in the corresponding .m

Then open MeView.xib in Interface Builder, and ctrl-drag from File’s Owner to the ‘Me View Table Controller’ object and set the meViewTableController outlet:

Screen shot 2010-02-11 at 20.25.30

The resulting MeTableViewController connections:

Screen shot 2010-02-11 at 20.25.44

This causes it to be retained, and prevents the explosion that happens if the table tries to access a delegate that isn’t there any more.  There’s also the added benefit that I stop scaring the cats by sweating at Xcode…

11 February 2010

Technical

No comments yet

Nested IF statements with Movable TYpe

One of the – ahem – undocumented features of Movable Type is a certain estotericness about the way it interprets Boolean logic within template tags. That’s a polite way of saying it’s more-or-less completely unpredictable, which can lead to much wailing and gnashing of teeth during template development.

Fortunately, there’s a workaround, an example of which is below. It comes at a computational cost, because you’re using PHP to fill in for MT’s deficiencies – but if you’re using static templates, then that cost is only really incurred as the templates are rebuild

This code assumes that you’re checking for two conditions – the presence of a custom field called “magazine_issue” that contains “Issue 19″, and a second custom field called “entrydatasource” which should contain the value “DVD”.

There’s a PHP loop inside an MT loop here – lines 1 and 2 set up the MT part, and iterates across the entries in the blog looking for those which have the field “magazine_issue” set to “Issue 19″.  (The MT:Entries tag is split across two lines for readability here, rather than any other reason.) Then those entries are passed one by one to the inner PHP code.

Line 5 places whatever’s in <mt:entrydatasource> into $source, relying on the fact that MT tags are parsed first, so by the time the PHP code gets executed that tag has been replaced by the value inside it.

Then lines 7 to 11 run a PHP if statement to check that the content contains “DVD”, and executes the <mt:include> tag if that’s the case.  The positioning of the ?> and <?php braces allow you to place MT code within the PHP loop, but not to have the PHP parser attempt to interpret it.

If the if statement doesn’t evaluate to true, then the contents won’t be executed and the include statement won’t be executed.   Obviously the include could be replaced by pretty much any MT tags that are valid within the context of an <MT:Entries> loop, or whatever arbitrary PHP you wanted.

It’s slightly hacky, and does come with a processing overhead – but sometimes a hack is the only way to get out of the problem.

22 September 2009

Technical

3 comments

Narcoleptic Macbooks

picture-2One of the best features of the Apple OS is the ability to sleep virtually instantaneously.   It’s one of the Macbook owner’s party tricks – shut the lid, and the Macbook will be asleep, packed and in the bag while your average Vista laptop is still chugging away.  The reverse is true at start-up, too – the wake is virtually instant.

Unless you’ve got the same problem as I’ve been having – putting the MBP to sleep only to have it start back up again almost immediately afterwards.   Eventually it *will* sleep – I can either keep trying to sleep it until it works, or just close the lid and forget about it.  That solves the problem eventually, but there have been a couple of occaisions where it’s been awake in the bag and getting steadily hotter until I realised that my bag was a lot warmer than it should have been.

The problem seems to be caused by state transitions of the Airport card, which the firmware interprets as a “wake up!” signal.  You *can* get around it by disabling the Airport then sleeping, but that’s more work than it should be, particularly if you forget.   The absolute cure is Tao Effect’s Wireless Sleeper, which automates the process – it intercepts a sleep request and turns off the Airport automatically, then reverses the process on wake.   So far it’s worked flawlessly, and it’s also free-as-in-beer.

17 February 2009

Technical

No comments yet

Code swarms

To someone who’s not familiar with the concept of open-source development, it can be a difficult one to get their head around. “You mean people do this for *free*? And give their code *away*?” “Well, yes, they do.” If your default frame of reference is copyright and closed-source, this can be something of a head-spinner.

This video visualises the “many hands make light work” paradigm at the heart of open source. It’s a visual representation of contributions to the Ruby on Rails project, from the inception back in 2004 through to the end of last year. It doesn’t seem too significant until about 5 minutes in, when the activity explodes as Rails really takes off. As individuals contribute more code, they gravitate towards the centre of the mesh, so you can track the magnitude of people’s involvement as they fly in and out.


Ruby on Rails from Ilya Grigorik on Vimeo.

The underlying point is that Rails – like many, many other open-source projects – isn’t a commercial undertaking, yet it has a community of active developers which would be almost impossible to replicate in a commercially-oriented environment. And sometimes you need a picture or two to bring the point home.

27 January 2009

Technical

No comments yet

Learning to think like a programmer geek

cablesCharles Arthur (the Grauniad journalist) recently put up a blog post passing on some advice to would-be journalists to “learn to code”.

Not suprisingly, that kicked off a bit of a discussion around various other blogs: Chris Applegate, who describes himself as a “wannabe polymath” chipped in with recommendations to get involved with regular expressions, comma-separated variables and Yahoo Pipes. And Tom Armitage – who *IS* a programmer, even if he hotly denies it – suggested thinking like a programmer rather than concentrating too much on the specifics.

It struck me that here’s one debate where I am actually qualified to take part – I’m not a programmer or developer as such, but I do need to herd them on a daily basis. And I also need to sit between them – who generally prefer specific, down-to-earth codeable specifications – and clients, who instead prefer to talk about their requirements in terms of “we want it do, you know, STUFF“.

That’s partly because I originally trained as an electronics engineer, which is right at the crossover point between hardware and software, and also partly because I’ve got a bad case of ADD when it comes to all things technical and geeky. I was the kind of irritating child who liked nothing better than taking clocks to bits to see what made them work, and that’s something that’s stuck.

On reflection, this also makes me something of a pain in the ass to work FOR, because although I don’t know enough to necessarily do the development job myself, I do know enough to know when someone is trying to bullshit me on a technical level. Fortunately I work with a bunch of the finest geeks available who don’t do this kind of thing, but it’s happened plenty of times in the past.

Both Tom and Chris have got it right – you do need some specific skills, and you do need some conceptual ones. I’ve got a list of things that I think are pretty much indispensible if you want to make yourself into the kind of person who can do lots of things for lots of people – they might not be the best grounding for a pure programming career, but they’re a good starting point if you’re at that meeting ground where things just need to Get Done.

The first skill – and I’m surprised this didn’t get mentioned explicitly – is HTML and CSS.

What I emphatically DON’T mean is the kind of CSS wrangling that produces beautifully fluid works of semantically-correct markup art – that’s expert territory. But if you work from the assumption that you’re no-one unless you’re on the web, then that means having some kind of web presence.

While you can get a long way with “canned” services like Typepad and Wordpress.com, sooner or later you’re going to bump up against the limitations – and knowing enough HTML and CSS to be dangerous will be a big help in these moments. The purists may turn pale at the thought of HTML tables, but if it’s that or looking like a MySpace refugee, then go for it. And it’s easy to pick up, because the web is the ultimate open-source guide – “View Source” on a page, and you’ll be able to figure it out eventually.

The second skill – which was mentioned by everyone – is the ability to understand, and ideally manipulate, data and databases.

Pretty much every interactive site has a database of some sort behind it, and if you need to manipulate large quantities of data for any reason then a simple database will generally get you a lot further than munging it in Excel or whatever. Understanding one-to-many relationships also prepares you to ask questions about the underlying nature of the data as well, which can often be as important as the data itself.

While knowing enough SQL to be a database administrator might be overkill, at least understanding a simple “select * from table where…” statement can be the key to unlocking some real insight from otherwise overwhelming quantities of text and numbers.

And then finally – and personally, I think most importantly – is something that’s actually far less concrete than anything Charles or Chris suggested, and more along Tom’s lines. It’s the ability to have some diagramming techniques in your personal toolbox.

Words are incredibly bad at explaining complex concepts unambiguously, something that this blog is a case study for. Words are even worse at explaining relationships between concepts or stakeholders or actors – once you get beyond a simple “he knows her and she knows them”, it breaks down completely – whereas a simple diagram is something even a six year old can pick up.

There’s any number of techniques out there, from flowcharting to process flows to mindmaps to entity relationship diagrams. Some are more complex than others, and not every technique is applicable to every situation. But once you’ve started trying to reduce a situation to a diagram, you’re applying analysis to it – which means that you’re guarding against problems like doublethink and reductio ad absurdum.

It frustrates me enormously that in 10 years of full-time education, no teacher has ever taught my kids how to draw a simple mindmap, which has to be one of the most powerful techniques for controlling complex concepts that’s out there. That’s been left to me to do, with the (mixed) results you’d expect from an amateur.

I’m not pretending that this is advice from anything other than my own personal experience and perspective, and the people that know me may disagree about how well I manage to cope with complex situations and hack around with HTML and so on. But it does strike me that Charles, Chris and Tom are all onto something – that there ARE skills that would previously have been regarded as the preserve of the professional geek which are actually incredibly useful to the rest of us, if only we took the time to pick them up.

25 January 2009

Technical

No comments yet

Twittering the Shipping Forecast

TwitterOne of the aspects of Twitter I like the most is the fact that it has an API. That makes it hackable in a way that appeals to my inner geek, so something I’ve been playing with for a while is creating Twitter bots. One of the first I made was @shippingcast, which takes the UK Shipping Forecast and squirts it out onto the web in a Twitter stream.

Unless you’re British, the Shipping Forecast probably doesn’t mean a lot. It’s one of those curiously English anachronisms – four times a day, the BBC broadcasts weather forecasts for offshore shipping areas [RealAudio link] on Radio 4 (the BBC’s main “highbrow” speech station). The waters around the British Isles are divided into areas, and the whole thing follows a strangely poetic format. There’s an entire generation of Brits who have never left dry land, but can recite “Dover, Wight, Portland, Plymouth” as if they know what it means.

Slightly eccentric, syntactically-regular? Must be ripe for a Twitter bot. Here’s how I did it.

First, a quick digression/rant about the source of the data. The Shipping Forecast is published twice a day by the Met Office and then reposted on the BBC’s website. This causes no end of hassle for the aspiring Twitterer, the reason for which usually comes as something of a shock for non-Brits. Despite the fact that it’s the US that is meant to be the land of capitalism and free enterprise, the Americans enjoy a strangely socialist attitude to data and information that the taxpayer has funded and provide it free for all-comers. We Brits, on the other hand, have been lumbered with what are known as “trading funds” – quasi-public organisations like the Met Office instructed by government to behave like private enterprises. They tend to guard their data and information as if it were a scarce, rivalrous monopoly good, and will seek every opportunity to charge for it. Never mind that there are far greater benefits to society and the economy as a whole if the data were available for reuse; and never mind that I as a taxpayer have already funded the production of it. No, these organisations have all the safety and security of being public sector, but like to play (and pay) as if they were shareholder-funded. The upshot of this is that – technically – I’m breaking the law by Twittering the Shipping Forecast.

So, back to the “how”. The Met Office have made it fairly difficult to grab the data from their site, although I’m in two minds as to whether that’s because of their aforementioned grasping nature, or the fact that they’re yet another public sector Microsoft monoculture who knows little and cares less about web standards and playing nicely online. This means I have to grab the data from the BBC site, and they format it for viewing rather than parsing. Every six hours, a cron job kicks off which runs a Ruby script to grab the HTML page. This then gets squirted through Hpricot, a Ruby-based XML parser that discards the extraneous stuff and extracts the data that I’m after. The BBC use tables to display the forecast, which makes it relatively easy to grab the “meat” and drop the “sugar”.

Once I’ve got the data itself, it needs formatting. This involves iterating across the table to grab the forecast data for each area (or group of areas), and then stripping out extraneous content to squeeze it into 140 characters. Then finally it gets Tweeted using the Twitter4R library to talk directly to the Twitter API.

So, how well does it work, and what’s worth learning from all of this? Firstly, as a proof of concept for publishing microcontent, I think it works quite well. The process is quite simple, and the information pops up into a Twitter feed on a nicely regular basis. There’s a useful side effect of the cron job, as well, which is to act as a “heartbeat” for the server that it’s running on.

As far as the information being useful, though, it’s less successful. The Shipping Forecast is optimised for broadcast – it’s written to be read aloud rather than read from the page. This means that although there’s a standardised syntax, the format is less standardised – if several sea areas are going to experience the same weather, then they’ll be lumped together. Which is incidentally why phrases like “Dover, Wight, Portland, Plymouth” have such resonance to a Brit of a certain age. While it’s undeniably poetic, it’s a bugger to squeeze into 140 characters.

By contrast, aviation forecasts are very much more standardised, particularly automated services like METAR. “EGLL 130750Z 21006KT 7000 FEW011 BKN014 07/06 Q1009″ manages to convey “13th January at 0750 UTC – wind speed 6 knots at a direction of 210 degrees, 7km visibility, a few clouds at 11,000 feet and broken cloud at 14,000 feed, air pressure at ground level 1009mb, temperature 7 degrees Celsius, dewpoint 6 degrees Celcius” in 50 characters. And once you know what it means, it’s actually no less readable. And writing Twitter bots like @EGLL_METAR is comparatively simple.

Then there’s the sheer quantity of information to convey. Each area forecast covers wind, sea state, weather and visibility information – and uses descriptive terms rather than wholly-numeric values. While this makes it a lot more readable – “squally showers” is somewhat more descriptive than having to look up “#437″ or something in a table – it doesn’t make the Twitter bot’s life any easier. So in order to compress it all in, I’ve had to convert the forecasts into something rather less verbose than txt-speak – which somewhat defeats the object.

The key for decoding the content is here.

Another limitation is that the bot squirts out the whole forecast for all areas, rather than individual ones. This does tend to flood your timeline, particularly if you’re using a mobile device that will only display a limited number of Tweets per page. It’s mainly my fault, because I set up the @shippingcast account rather than a number of smaller areas. But then @dogger or @germanbight don’t have quite the same ring to them as @shippingcast. What I should do, if I ever get around to it, is to set up the bot so that you can “subscribe” to specific areas and then be DM’d with the relevant area forecasts.

Of course, this was mainly done for my own entertainment and education, so I’m not too bothered by the limitations. What’s more interesting is the way that an online service with an API can get exploited for purposes that would never have been envisaged at the outset – I’m pretty sure that the creators of Twitter wouldn’t have thought of the Shipping Forecast as a use case. It’s also been the starting point for some more “successful” bots (for a given definition of success) – my favourite is @riverthames, which tweets high and low tides to keep @towerbridge company. And there are many more “things” waiting to be animated – @thepips and @bigbenclock for a few.

13 January 2009

Technical

1 comment

iPlaying offline

Tom Taylor linked to a fascinating BBC Radio 4 In Business programme about why it still matters where we live and work. It’s available for a couple of days still via iPlayer, but if like me you don’t want to be tied to a broadband connection in order to listen to it, you’re a bit stuck because In Business doesn’t have an associated podcast.

Stuck, that is, unless you’ve downloaded Paul Battley’s iPlayer Downloader. It’s a set of Ruby scripts that pretend to be an iPhone, and allows you to download the MP3 (for audio) and MP4 (for video) files which can then be shifted to an iPod for offline listening pleasure.

At first the Beeb seemed to want to get into an arms race to try and stop this, but lately they seemed to have given up. Which is excellent news, because it’s a great way of grabbing content for use on the move. Of course, it’s also a great way of grabbing content.

[UPDATED] As Jem says in the comments, there is a podcast feed for In Business (or more accurately, anything that Peter Day has been involved in.

And if you don’t fancy munging the command line and have a Mac, there’s a marvellous GUI client called iPlayer Grabber which allows you to download iPlayer content with a single click from the links on the BBC site itself. The only way it could be any better would be if the downloads could be dropped straight into iTunes for syncing with my iPhone, but that should get taken care of with an Applescript or two…

8 January 2009

Technical

1 comment