This is as days pass by, by Stuart Langridge

Introducing HTML5: a book review

There are two types of technical books. Reference manuals are useful; you always have them to hand, and you can jump in and find a particular page which gives you the stuff you need to know. They're an indispensable reference tool, unless, say, you have access to the internet. Then, well, maybe they're not as handy. On the other hand, there's the other sort of technical book; the sort that's a pleasure to read in itself, and you only realised you've learned things afterwards. Such a book is Introducing HTML 5, by Bruce Lawson and Remy Sharp. As they say at the beginning of the introduction: welcome to the Remy and Bruce show. The book manages to be both a thorough introduction to the swathe of modern and new web technologies masquerading under the name of "HTML5", and a personal voice which comments on the state of web development today and in the near future. The tl;dr summary for people who don't want to read the rest: good web book is good. Get it.

The book successfully and intelligently covers the new markup in HTML5 (nav/header/section/article, new input types in forms, and WAI-ARIA accessibility) as well as the vast proliferation of new APIs available to modern web applications (canvas, multimedia, offline storage, workers, and geolocation, among others), drawing on the authors' experience of user questions and articles at their html5doctor site. Fortunately, it's not a hagiography, and they don't hesitate to stick the boot in where it's warranted; the current mess that is native drag-and-drop support in browsers and the ridiculous codec war inherent in online video both come in line for a justified kicking. Each chapter covers its material in decent detail, without devolving into a mere list of APIs; the book is full of both worked examples and links to relevant extra resources. Unusually for a book of this type, the examples are fairly real-world; instead of a contrived writeup to show off a feature, they show how to mark up the home page of the Guardian newspaper with HTML5 elements.

Conspicuously missing from the book are the major changes to CSS currently being implemented in browsers. A chapter covering the transform and similar CSS3 declarations (-webkit-transform, -moz-transform, and the like) would have fit nicely, and it's a shame that this wasn't covered -- yes, it's a book about HTML5, not CSS3, but the authors themselves admit that by "HTML5" they actually mean "HTML5 and related specifications that came from the WHATWG", and they throw in geolocation just because "it's really cool". Advances in CSS which give dynamic effects not only would fit well with the other subject matter but would also make a few of the examples perhaps easier.

The canvas chapter doesn't bring much more than innumerable web pages covering the basics of the canvas API for drawing, but it covers those basics well and in a readable way. Importantly, there's also a discussion of the difference between using the canvas element for drawing and using SVG, and when you'd choose one rather than the other. It's been difficult to find that sort of summary; it's equally difficult to decide yourself which to use for some new project, and the chapter's sidebar (or <aside>?) discussion of "when to use which" clarified the distinction well, especially when going beyond reimplementations of Super Mario Bros inside the browser.

All is not sweetness and light, mind. The data storage chapter, explaining how to use HTML5's new in-the-browser storage objects, breathlessly explains that this means an end to cookies (which are "rubbish" according to the authors). However, this is where their client-side bias seems to be coming through. Cookies are shared with the server, too; snazzy HTML5 storage is not. Any even reasonably detailed web application will have a substantial server component, and abandoning cookies will make it jolly hard to have the server and the front-end share data. This does seem rather like excitement over the new tech without thinking about how it can actually be used in real-world situations, and is disappointing from a book which goes out of its way to give suggestions that are actually useful to people.

Another area the book falls down is in its editing: there are typos scattered throughout the text (including in a heading in the introduction, for goodness' sake!) and these should have been caught by an editor; noticing them distracts the reader from the material, and it's a schoolboy error which damages the impact of the book.

I know both the authors, and they're both well-known and respected in the web development community; Introducing HTML5 does them credit, and it's worth your time. Go forth, get Introducing HTML5, and make great web stuff.

On annoyance and free software

Today I was given a beating on identi.ca about no longer being a supporter of free software.

Well, perhaps not. @fabsh, who I'd have considered a friend, said "Although @sil used to be quite pro-Free Software", with the obvious implication that today, I am not.

Today, on Twitter, a non-free web service where most of my friends hang out, I mentioned that my dad had been to see the Queen today; I asked for advice on where I should take my daughter on holiday and how I could find a decent website for that; I complained about Doubletwist deciding that it was the most important media player on my Android phone; and I mentioned that my house sale was going ahead. Now, all my twitter messages also appear on identica.

On Twitter, I was offered a number of helpful suggestions about where to find cheap holidays; I was asked why my dad went to see the Queen; the Doubletwist forums people let me know that my annoyance was a bug which was about to be fixed, and I was asked a few questions about Shot of Jaq, a podcast I do with Jono Bacon.

On Identica, I was given a bollocking because I don't believe in free software.

A long time ago, Larry Wall gave a "State of the Onion" speech. Larry is the guy behind Perl, the programming language, and every year he gave a talk about what he believes Perl is all about and where it'll be going over the following twelve months. Larry's not really a programmer; he's a linguist who does a lot of programming. So his view on what a computer language should be is uniquely interesting, and should be read. Anyway, he spoke of freedom, and characterised the ends of the spectrum on the subject as "Bill" and "Richard", those two being Bill Gates (at the time head of Microsoft) and Richard Stallman (head of the Free Software Foundation): the idea here was that those two represented the ultimate expressions of their philosophies. Richard Stallman was at the far extreme of belief in free software; Bill Gates was at the other far end, decrying the very concept of freedom. It was a throwaway joke, at the time; a caricature for the purpose of a laugh in a presentation.

Now, free software is a subject close to my heart. I work for Canonical, a company that builds an operating system composed of free software. Within that company, I work on Ubuntu One, a cloud service. We use CouchDB on your computer (free software) which replicates to CouchDB on our servers (free software); Tomboy, the note-taking software, on your computer (free software), which syncs using the Snowy API (an open API definition, defined by the very clever Tomboy team with a few suggestions from us) and saves its data in CouchDB (free software); bookmark syncing from Firefox using an extension named Bindwood (free software) to CouchDB (free software) on your machine; mobile contacts syncing through Funambol (free software) and storing the data in CouchDB (free software); and the Ubuntu One syncdaemon (free software) which syncs your files to our file sync server (closed source).

In the identica thread mentioned above, I'm characterised as someone who helps "Canonical produce proprietary net services".

A long time ago (longer than the Larry Wall thing, above), there was the "one drop rule" in the United States. It basically classified you as "black" if you had any black ancestry at all. This was a rule back in the days when having "black blood" was somehow a bad thing. Fortunately, these days, it seems that such outdated and racist rules are no longer a part of the American psyche. Unfortunately, the principle seems to have been picked up by a subset of the free software movement: if your software has any part which is not available to the public, the whole suite is tainted. By working on it or with it or around it, you are not a supporter of free software. The smallest part of your software which is not available for scrutiny is enough to tarnish everything else you do, and quite possibly everything else you've ever done, as beyond the pale: unacceptable to the audeience, because it's non-free. The parts that are free, even if they comprise the majority, are unrecognised.

I'm pretty sad about this. I'd consider myself a supporter of free software. I evangelise Ubuntu, my chosen GNU/Linux distribution, to as wide an audience as I can manage; I help to build a software service which is composed of free software except for a couple of parts; I'm half of a podcast which talks about Linux software twice a week. And yet I am vilified for being insufficiently dedicated to freedom.

Jo Shields (@directhex), an immensely talented hacker and someone else I'd consider a friend, who hacks on Banshee and has spent some time educating me about Mono, has been involved in an argument recently on reddit with someone who hates him because he likes Mono. That argument has incuded his opposer declaring that GPL-non-compatible licences cannot be free software. Again, I'm pretty sad about this. The actual definition of freedom seems to have been lost. Instead, a developer has to prove their dedication. That's not what I got into free software for, and it's not what I think free software's about.

Now, OK, maybe that's the approach that the freedom-loving community think is best; the "one drop rule" applies to free software just as much as it used to apply to black ancestry. Someone who builds a Linux distribution which includes a non-free wireless driver is just as steeped in blood and guilt as someone who ships an operating system which is mostly non-free, or someone who ships an operating system which is entirely non-free. That's a perfectly legitimate point of view to take. I just don't agree with it. I don't want to spend my time finding reasons why people are against me. I don't want to spend my time dividing everyone into those who are prepared to take a loyalty oath and those who have more important things to do. And when someone asks me why I'm no longer "quite pro-Free Software", my response is always the same: I'm still just as pro-Free Software. I just don't want to be associated with the other people who are.

LugRadio documentary gets a permanent home

Cool. Tony Whitmore's documentary about LugRadio now has a permanent home at dontlistenalone.org. Nice. It's weird looking back on it all...

OFCOM consultation on BBC "Broadcast Flag"

The BBC are proposing to stop you watching HD television unless you go out and buy all new equipment where the manufacturers have signed a secret deal to implement restrictions. You can read more about this in the Guardian. I, personally, don't like this. OFCOM have opened this up to public consultation, but you only have until 5pm tomorrow (Friday 2nd April) to get your opinions heard. My answers are below.

Question 1: Do you agree that copy management would broaden the range of HD content available on DTT and help secure its long term viability as a platform?
I do not agree that copy management would broaden the range of HD content available on DTT. Look at the outpouring of creativity engendered by YouTube for an obvious counter-example. There is simply no way that explicitly excluding part of the audience can lead to a larger audience.
Question 2: Do you agree that the BBC’s proposed multiplex licence amendment represents the most appropriate means for securing an effective content management system on HD DTT?
I do not agree that the BBC's proposed licence amendment, or indeed any licence amendment, represents any appropriate means for an "effective content management system". The BBC has operated since 1927 and become the most successful and most loved broadcaster in the world by being open with its work. To step back away from this now would be a drastic failure in the BBC's remit and standing.
Question 3: Do you agree with the proposed change to Condition 6 in the Multiplex B Licence?
I do not agree with the proposed change. Restricting access to EPG data is, frankly, legalised arm-twisting; it's transparently a way to bring in restrictions "by the back door", and it's disappointing to see the BBC, an organisation that has always prided itself on openness, make this suggestion. Calling oneself "BBC Free to View Ltd" and then ensuring that "free to view" content is effectively not free by restricting access to the EPG is a touch hypocritical.
Question 4: Do you agree that Multiplexes C and D should be granted a similar amendment to their Licences as Multiplex B?.
Unknown.
Question 5: Do you agree that the BBC’s proposed approach for implementing content management would safeguard citizens and consumers legitimate use of HD content, and if not, what additional guarantees would be appropriate?
I do not agree that the BBC's proposed approach would safeguard legitimate use of HD content; on the contrary, it will explicitly disallow legitimate use of HD content by citizens and consumers using open-source technologies such as MythTV, citizens who wish to make their technology choices based on price without having to pay the inevitable price increase levied by firms who have struck a secret agreement and then passed the resultant cost onto the consumer, and frankly any British resident who enjoys consuming BBC content and does not want to have their existing working equipment rendered obsolete without having done anything wrong.
Question 6: Do you agree that the BBC’s proposed choice of content management technologies will have only a negligible impact on the cost of HD DTT receivers and their interoperability with other HD consumer equipment? .
I do not agree that the content maangement technology choices proposed by the BBC will have a negligible impact on cost and interoperability. Requiring consumers to buy new equipment is a cost in itself, especially when that new equipment is deliberately incompatible with existing equipment, such as HD TVs, which currently work but did not anticipate an industry-led imposition of a Broadcast Flag.
Question 7: Do stakeholders agree that the BBC’s proposed Huffman Code licensing arrangements would have a negligible effect on the market for HD DTT receivers?
Unknown.
Question 8: Do the BBC’s proposed content management states and their permitted use for different categories of HD content meet the requirements of other HD broadcasters on DTT?
Unknown.

Go and leave your thoughts.

Labour's New Ad

The Labour Party have a new scheme: they'll crowdsource their new advert. According to http://www.labour.org.uk/create-labours-next-campaign, "for those who want to extend their creative skills we are offering you the chance to produce a poster which we will release on digital adboards over the Easter weekend."

So, here's my poster.

The text reads as follows:

Labour cares. (Picture of Gordon Brown)
About record companies. (Picture of gold-plated Porsche)
Not you. (Picture of a chap behind bars.) Worried about being disconnected from the internet without trial? Worried about the government rushing through a Bill without debate?
Worried that Britain's government rejects Britain's desire for fairness? Labour and the Tories are just as bad as one another.
Write to your MP. http://writetothem.org Support the Open Rights Group http://openrightsgroup.org

Get involved. Stand up for yourselves.

On the nature of planets

In the latest Shot of Jaq we're talking about planets (the HTML website type, not the big orbiting ball-of-rock type). What with this blog being on various planets, people may have some thoughts on the subject: are planets are a good idea? Should they have a "just the technology, ma'am" approach, or do you like reading about the personalities involved in your favourite projects? Come and join the conversation and let us know what you think at http://shotofjaq.org/2010/03/planetary-madness/.

Making phone apps

This is more a memo to myself than anything else.

I want an app on my phone that displays my Ubuntu One stuff; notes, files, contacts, that sort of thing.

I do not want to have to write it in Java. Nor do I want to have to port it to Objective-C so iPhone people can have it. I want to write an HTML5 app, because then it works everywhere, there's only one codebase, and (critically) I can do it.

Data in Ubuntu One is stored in CouchDB (well, files aren't, but let's leave files out of this for now; they'll work a similar way). CouchDB is all HTTP. So it should be possible to write an HTML5 app that retrieves my data from CouchDB.

Problem 1: an HTML5 app can't access CouchDB on another server, because JavaScript can't request data from another server.

Solution 1: Cross Origin Request Sharing, a W3C spec. Implemented by Firefox 3.5 and by the WebKit in my Nexus One, at least.

I want my app to work offline, of course. I shouldn't have to be online to read my notes.

Problem 2: web apps don't work offline, they're web apps.

Solution 2: use a manifest. Checklist, an HTML5 app, does this beautifully.

But how does the phone store data offline? That's not even worthy of a "problem" statement; offline HTML5 storage has been available for ages.

How does one authenticate to Ubuntu One to get the right data? Well, we use OAuth, deliberately because it enables this sort of thing. So that's all doable, too.

It feels rather like all these different puzzle pieces are slotting together. And that I have another project to write. Game on.

War on complexity

leftyfb asks: "How long till Gnome has a single button as its only feature?"

I replied in 2006.

Not a lawyer any more

So according to Naked Law, the technology blog for the law firm I used to work for, Centrica contracted Accenture to write some software, and that software turned out not to work like they wanted. The court found Accenture liable for around £29 million. The lawyer response?

[This] demonstrates how widely the Courts are willing to interpret 'direct loss'. This will comfort the customer, but IT suppliers may want to consider strengthening their liability clauses.

Or, y'know, writing software that doesn't suck.

This is why I no longer work for lawyers.

Writing a Rhythmbox plugin

Yesterday, as part of Ubuntu Opportunistic Developer Week, I did an IRC talk about writing a (basic) Rhythmbox plugin in Python.

You can see the talk, the slides, and the plugin at http://www.kryogenix.org/code/RBMicroBlog/.

More desktopcouch tips and tricks

Manuel is at it again, with a second round of desktopcouch tips and tricks. He's building up quite a library of stuff over there. Now hopefully I can persuade him to link them from the desktopcouch documentation...

Browsing my Android phone over wifi at home

Having to plug my Android phone into my computer via USB so that I can copy new files onto it is a pain. So I thought to myself: it's got wifi, right? Can't I just run an ftp server on it?

And, lo, I discovered On Air. Cool Android app; it's got One Massive Button and that's it. The One Massive Button just turns on a file server and exports it over the network.

(Actually, I lied. There's also one tiny button which toggles the type of server between FTP, WebDav, and AppleTalk. So I set it to FTP, since that's easy to connect to from Nautilus -- Places > Connect to Server > FTP (with login). On Air displays the IP address of the phone, and a randomly generated 4-digit password.)

So, that's all I need; I can now browse my phone without plugging it into the computer.

Then I got to thinking. It'd be dead handy if that automatically got started up when I was (a) at home and (b) the phone was plugged into the mains (because I don't want it being a server while I'm wandering around my house, and the mains plug is near the computer). A bit more poking around led me to Locale, an Android app which lets you watch for certain conditions (like geographical location, charge state, and so on) and then take certain actions when the conditions are triggered. Seemed ideal. But Locale is $10, and the "am I in a certain place" trigger was another dollar, and "am I plugged in" was another dollar, and I thought: yeah, $12 isn't much, but I don't really need this, so maybe I'll do without.

And then @michaelwells pointedout on Twitter that the "Setting Profiles" app might help. So I took a look, and basically, it's Locale, but free. Nice.

So, install Setting Profiles, set up a "rule" with conditions "connected to my home wifi" and "charger is plugged in", and an "action" of "start On Air". Done.

I'm really quite pleased with tying those things together.

Minor complaints, because nothing is perfect (perfection is finality. finality is death. nothing is perfect. there are lumps in it)

  1. I wish On Air had a "start up the server automatically" setting, thus obviating the need to press the One Big Button.
  2. I wish On Air advertised its FTP server with Zeroconf. (Probably it doesn't need to for the author's Mac use case because AppleTalk servers already do that without Bonjour?)
  3. Settings Profiles doesn't show up in my apps list! That's really quite weird. To start it I have to go back into the Market, choose Downloads, and then start it from there. I'd file a bug, but there doesn't seem to be any useful way of doing that. How am I meant to do this? Leave a comment on the app in the Market?

Settings Profiles (website)

On Air

This website belongs to Stuart Langridge. Contact details are available. Don't eat yellow snow. Valid HTML5, at least in theory, except for the bits that aren't because I'm that futuristic that I'm ahead of the spec, oh yes. HTML5 help from Bruce Lawson, among others. Fonts from the superb FontSquirrel. End.