Barcode reading on the iPhone

I’ve played with this a bit, and a friend asked me about it this morning so I thought it might be useful to write something up for others.

The more recent iPhones, those with autofocus cameras, can focus close enough to get good images of barcodes and there are several utilities which will recognise them. Some concentrate on 1D ‘traditional’ barcodes, others on the more interesting and capable 2D codes, the most common format being the QR code (shown here).

QR codes have long been popular in Japan, especially on business cards, so Japanese phones have tended to be able to focus at closer ranges than the typical western smartphone, which is only used for photos of friends doing embarrassing things in the pub. Now, though, the rest of the world is gradually catching on and the iPhone is rare in not coming with QR-code reading software included. Fortunately, that’s easy to fix. Here are some of my favourites of the apps I’ve tried:

Optiscan is, in my opinion, the best scanner if you just want to do QR codes. It’s fast and reliable and, when I first got it, was the only one I could easily configure to fill my particular need – I wanted a really low-friction way to scan a QR code containing a URL and view the associated page. Optiscan did that brilliantly – one tap on the screen to scan, and you could set it to open a URL immediately when it recognised it. Nice, simple, well-documented and only £1.19. And that’s the most expensive of these.

RedLaser is the kind of app that high-street stores probably hate. This is designed for traditional 1D product barcodes, scans them well, and then looks up other places you can buy them and tells you the price online. Now, it doesn’t look in very many places, so I wouldn’t suggest it’ll find you the best bargain, but it is a useful reality check before you make that impulse purchase. To be fair to high-street traders, too, it has more than once told me that the difference between their price and Amazon’s was small enough that I was happy to buy the item in-store.

I think the latest version of QuickMark is now my favourite of the apps I’ve tried. (Note that there’s a different version for the iPhone 4). Its big failing is that bits of the UI are rather counter-intuitive and the developer’s website is a mess and hard to navigate. But once you get over that it has several very nice features. Firstly, it will scan a range of different 2D formats including QR Code, Quick Code and Data Matrix. It will also scan 1D barcodes, but, and this is important, you need to configure it for the type of 1D code you’re scanning or it will just sit there failing to recognise anything. If you’re generally scanning standard product codes, go into Settings and make sure you select the EAN/UPC option.

It gets better. There’s now an option for 1D codes to redirect you to a URL based on the code, and you can choose the URL. I configured mine with
http://www.amazon.co.uk/s/?field-keywords=
and sure enough, when I scanned a book it stuck the ISBN number on the end and took me straight to the right place.

And better. There’s a free utility called QuickMark Spot which you can run on your Mac and which will receive barcodes from the phone over wifi, and insert them wherever your cursor happens to be. So you can open a text editor, wander round the house scanning your books and CDs, and come back to find all the barcodes in your file. Very cute, and a better range than, say a dedicated bluetooth scanner.

There are many, many more apps out there, and many more functions to these ones – I haven’t touched, for example, on how some of them can automatically call phone numbers embedded in QR codes, or display barcodes to be scanned by other phones… but this should get you started if you want to explore.

A 1000-year old skyscraper? What larks, eh, Pip?

Forgive me Father, for I have sinned. I have harboured unkind thoughts about a town, after visiting only its industrial areas, and given no consideration to the fact that it may have a good heart…

Yesterday we went to Rochester, in Kent, to see the castle and cathedral. And it’s a cracker of a castle!

Rochester Castle, By Quentin Stafford-Fraser

OK, so it’s not quite a millennium old – closer to 900 years – but what’s great about it is that you can still get up to the top, and it’s several stories high. I’ve seldom been on something so old and so tall.

Rochester Castle, By Quentin Stafford-Fraser

The main floors have long-since disappeared, but the galleries and stairways built into the walls mean it can still be climbed.

Rochester Castle, By Quentin Stafford-Fraser

Rochester Castle, By Quentin Stafford-Fraser

And when you reach the top, you feel as if… well… as if you’re on top of a real castle.

The town has plenty more to offer, too. The Cathedral is just over the road, and rather pleasing.

Rochester Cathedral

Rochester Cathedral

Rochester Cathedral

There are nice spots for a cream tea:

The Precinct Pantry, Rochester

And just behind the cathedral is Restoration House, famous, amongst other things, for being Dickens’ model for Miss Havisham’s house in Great Expectations.

Restoration House

All in all, a good day out.

Rochester Cathedral

You can see some more Rochester pictures here.

The writing’s on the wall for architects

On Friday I was invited to give a talk to the Cambridge Association of Architects – the local branch of the RIBA.

It was rather a fun format: each speaker was allowed 10 slides which would auto-advance every 20 secs, making each talk three minutes and twenty seconds long.

What would you say if given three minutes to talk to architects about the future?

This was my attempt…

I’m on a horse

The real interest of the Superbowl is not, for me, the sport, but the creativity that goes into the phenomenally expensive commercial breaks. The most famous example is Apple’s 1984 ad that introduced the Macintosh, but there have been many others.

This year’s most talked-about ad was from Old Spice, and I think it’s brilliant.

These days one immediately assumes that it’s all green-screen and CGI, but in fact there is almost no ‘trickery’. Isaiah Mustafa maintains this running commentary while bits of scenery move around him, and it’s a trolley, on which he sits part-way through, that transports him and deposits him on the horse. And he maintains this focus even though they eventually used something like the 57th take…

Leo Laporte interviewed the guys behind it, if you’d like to find out more….

The Making Of…

What do you think of those ‘special features’ sections of DVDs – the director’s commentaries, deleted scenes etc?

I’ve always rather enjoyed them, and they generally give a greater appreciation of a movie… why the writers chose not to follow the book here, what the stuntmen had to go through there, and so forth. It’s easy to sit back and enjoy a story without thinking of what’s behind it, though of course there’s a good argument that that’s exactly what you’re supposed to do, and that seeing backstage destroys the illusion they’ve so carefully woven for you. I’m not sure…

As some of you will know, my wife Rose Melikan is a novelist, and her books are set in the late eighteenth century. What few of her readers will appreciate, though, is the level of research that’s behind them: many of the characters are real people, for example, who were in the places described on that day in history. Often, the weather described in the books has been cross-checked against that day’s Times. And so forth.

In general, Rose says, she does this just to feel comfortable that she’s not making any glaring mistakes, but we thought that some of the factual background might be of interest to readers, so her website now has a section for each of the books with a little more background information on some of the topics.

Click on the page for The Blackstone Key, The Counterfeit Guest or The Mistaken Wife and follow the links in the box on the left. There’ll be more coming when time permits…

Baby on board

Not being a parent myself, I find them interesting as objects of psychological study. And one thing that has always puzzled me is this enthusiasm for sticking signs on your car telling people that you are transporting your offspring.

Why do people do this?

Is it just pride in your reproductive abilities? A badge of club membership to win you support from other parents? A warning that you may suddenly swerve because somebody has just pulled your hair or screamed in your ear?

Or is it, perhaps, something rather more sinister and insulting – an implication that other drivers – like me – may have no qualms about endangering your life, but will be inspired to take pity on your innocent sprog and so curb their otherwise naturally reckless driving?

Can anyone enlighten me?

The nightmare that is IE

If you ask any web designer what would constitute their dreams coming true, they will probably say something along the lines of “Internet Explorer vanishing from the face of the earth, never to be seen again”. Web development has for many years consisted of building your beautiful online creation and then polluting it with all kinds of hacks to get around the bugs and quirks in the various versions of IE.

We’ve just run into a nice issue with IE8, where a site running on our intranet will render completely differently from a deployed site running on a public server. The HTML and CSS is identical, it’s just that IE recognises that one is in the intranet zone and, for some completely unfathomable reason, decides that it should therefore be displayed differently.

For any sysadmins who haven’t yet replaced IE on their users’ desktops, this helpful page by Henri Sivonen gives a hint of the problems that you are helping to perpetuate. This is not a rant, it’s a useful guide to what designers have to think about, just to make their pages display properly, because you’re not using Safari, Firefox, Opera or Chrome.

An excerpt:

IE8 has four modes: IE 5.5 quirks mode, IE 7 standards mode, IE 8 almost standards mode and IE 8 standards mode. The choice of mode depends on data from various sources: doctype, a meta element, an HTTP header, periodically downloaded data from Microsoft, the intranet zone, settings made by the user, settings made by an intranet administrator, the mode of the frame parent if any and a UI button togglable by the user. (With other apps that embed the engine, the mode also depends on the embedding application.)

The lucky thing is that IE8 uses doctype sniffing roughly like other browsers if:

  • There is no X-UA-Compatible HTTP header set by the author.
  • There is no X-UA-Compatible meta tag set by the author.
  • Microsoft has not placed the domain name of the site on a blacklist.
  • An intranet admin has not placed the site on a blacklist.
  • The user has not pressed the Compatibility View button (or otherwise added the domain to a user-specific blacklist).
  • The site is not in the intranet zone.
  • The user has not chosen to display all sites as in IE7.
  • The page is not framed by a Compatibility Mode page.

For the points other than the two X-UA-Compatible cases, IE8 performs doctype sniffing like IE7. The IE7 emulation is called Compatibility View.

In the X-UA-Compatible cases, IE8 behaves radically differently from other browsers. Please see an appendix on this page or a flowchart available in PDF and PNG formats.

Unfortunately, without an X-UA-Compatible HTTP header or meta tag, IE8 lets the user accidentally drop you from the IE8 standards mode to the IE7 mode that emulates the standards mode of IE7 even if you used a proper doctype. Worse, an intranet admin may do this. Also, Microsoft may have blacklisted the entire domain you use (e.g. mit.edu!).

To counter these effects, a doctype isn’t enough and you need an X-UA-Compatible HTTP header or meta tag.

God help us.

‘iPad (and low keyboard)

On the London train recently I was using a bluetooth keyboard with my iPad, and it was a very good match for the limited space in the seat. The iPad sat on the little table-shelf thing and the keyboard on my lap, partly under the shelf.

It may not look it, but it was really comfortable, and the Vodafone 3G connection held up well. There is no way I could have done productive work in this space on my laptop, but I managed to fire off quite a few emails and Skype messages on the iPad, and, of course, it had enough battery for the journey there and back and quite a lot of use in-between…

Up periscope

As a small puppy, our English Cocker Spaniel, Tilly, used to like running through long grass, and occasionally through crops.

But the grasses grew faster than she did, which left her with a navigation problem…

Rollin’, rollin’, rollin’…

Those familiar with Cambridge will know the rollers which allow you to move the very heavy punts between the lower and upper river.

Last week some of us decided to ride the punt down the rollers, which I’ve done many times before, but they seemed to be rolling rather better than in the past, and you can’t steer the thing as you’re going…

DSC06789.JPG

Many thanks to Sarah McKeon for the photo…

Favourite movie quote of the day

    Are you one of these emancipated women we’re having so much trouble with at home?

-Kenneth More’s character to Lauren Bacall’s in North West Frontier

© Copyright Quentin Stafford-Fraser