Thursday, 27 November 2014

The Rise Of "Versing"

My children frequently use the word "verse" as a verb --- not in the technically correct sense of "to compose verses", but as a transitive verb form of the preposition "versus". For example they might say "I'll verse you at Monopoly." For a long time I'd never heard this usage other than from my children (though I assume they picked it up at school), but recently I saw it in a New Zealand online forum. I wonder if this originated locally and whether it will stick. I think it's actually a useful word; the closest equivalent I can think of is "play", but in my mind "I'll play you at Monopoly" doesn't carry the same emphasis on competition.

Saturday, 22 November 2014

Mount Te Aroha

Today we drove to the town of Te Aroha and walked to the summit of Mount Te Aroha. It's about a 1 hour and 40 minute drive from Auckland to the town, which is at the foothills of the Kaimai Range south of the Coromandel Peninsula. It's a beautiful small town surrounded by the green fields of the Hauraki Plains and backed by the magnificent forested Kaimai mountains.

It takes us about two hours to walk from the town to the summit of Mount Te Aroha --- a steep (900m elevation change) but very pleasant walk through forest with periodic views over the countryside. The summit is quite exposed, and has been windy and cold both times I've been there, but the views (when not enveloped in cloud cover) are magnificent. To the north you can see the Firth of Thames and the Hunua Ranges (beyond which lies Auckland; the other side of the Hunuas is visible from my desk in the Mozilla office). To the west are the verdant Hauraki Plains and the green hills of the Waikato. To the south the Kaimai Range stretches into the distance in an impressive line. I've read that on a clear day you can see Mount Ruapehu to the southwest, but I haven't yet. To the east you can see the eastern side of the Kaimais and the Coromandel Peninsula, and the Pacific Ocean beyond --- with Mayor Island and Matakana Island (near Tauranga). It's wonderful, and well worth the trip.

Friday, 14 November 2014

Relax, Scaling User Interfaces By Non-Integer Scale Factors Is Okay

About seven years ago we implemented "full zoom" in Firefox 3. An old blog post gives some technical background to the architectural changes enabling that feature. When we first implemented it, I expected non-integer scale factors would never work as well as scaling by integer multiples. Apple apparently thinks the same, since (I have been told) on Mac and iOS, application rendering is always to a buffer whose size is an integer multiple of the "logical window size". GNOME developers apparently also agree since their org.gnome.desktop.interface scaling-factor setting only accepts integers. Note that here I'm conflating user-initiated "full zoom" with application-initiated "high-DPI rendering"; technically, they're the same problem.

Several years of experience shows I was wrong, at least for the Web. Non-integer scale factors work just as well as integer scale factors. For implementation reasons we restrict scale factors to 60/N for positive integers N, but in practice this gives you a good range of useful values. There are some subtleties to implementing scaling well, some of which are Web/CSS specific.

For example, normally we snap absolute scaled logical coordinates to screen pixels at rendering time, to ensure rounding error does not accumulate; if the distance between two logical points is N logical units, then the distance between the rendered points stays within one screen pixel of the ideal distance S*N (where S is the scale factor). The downside is that a visual distance of N logical units may be rendered in some places as ceil(S*N) screen pixels and elsewhere as floor(S*N) pixels. Such inconsistency usually doesn't matter much but for CSS borders (and usually not other CSS drawing!), such inconsistent widths are jarring. So for CSS borders (and only CSS borders!) we round each border width to screen pixels at layout time, ensuring borders with the same logical width always get the same screen pixel width.

I'm willing to declare victory in this area. Bug reports about unsatisfactory scaling of Web page layouts are very rare and aren't specific to non-integral scale factors. Image scaling remains hard; the performance vs quality tradeoffs are difficult --- but integral scale factors are no easier to handle than non-integral.

It may be that non-Web contexts are somehow more inimical to non-integral scaling, though I can't think why that would be.

Thursday, 13 November 2014


I saw Interstellar today. I enjoyed it --- it was beautiful and thought-provoking --- but about an hour in, it just stops making sense. I don't just mean the physics is bad, though it is, but the narrative fails to hold together on its own terms. Even so I think it's worth seeing on the big screen.

Apparently Jonathan Nolan wants to make one or more movies based on the Foundation series. That doesn't seem like a good idea to me; Foundation is an excellent series (at least the original trilogy; Asimov's later additions are embarrassing) but it's big ideas connected by threadbare narrative and could only make the barest bones of a watchable movie.

I can think of many science fiction stories more amenable to movie treatment. I've recently re-read (or more accurately re-skimmed) Marooned In Realtime by Vernor Vinge, and I think it's actually better than his more famous Hugo winners. It's packed full of big ideas but is genuinely moving in a way I don't get from his other books. Better still, from a movie point of view, there's a coherent narrative in the framework of a police procedural that makes it an easy story to tell. Plus exotic creatures and locations, robots, and space combat. What more could you want?

Tuesday, 4 November 2014

HTML5 Video Correctness Across Browsers

A paper presents some results of cross-browser testing of HTML5 video. This sort of work is very helpful since it draws attention away from browser vendor PR efforts and towards the sort of issues that really impact Web developers, with actionable data.

Having said that, it's also very interesting to compare how browsers fare on correctness benchmarks designed without a browser-vendor axe to grind. Gecko usually does very well on such benchmarks and this one is no exception. If you read through the paper, we get almost everything right except a few event-firing issues (that I don't understand yet), more so than the other browsers.

Of course no test suite is perfect, and this one misses the massive Chrome canplaythrough bug: Chrome doesn't really implement canplaythrough at all. It simply fires canplaythrough immediately after canplay in all circumstances. That's still causing problems for other browsers which implement canplaythrough properly, since some Web sites have been written to depend on canplaythrough always firing immediately.

Still, this is good work and I'd like to see more like it.

Sunday, 2 November 2014

Auckland Half Marathon --- Barefoot

I ran the Auckland half-marathon today, barefoot all the way. It went well; I slightly improved my time compared to last year when I wore Vibram foot-gloves. I didn't see any other barefoot runners last year or this year, and maybe there will never be any others, but here are some tips just in case:

  • Nothing in the rules says you have to wear shoes and I didn't have any trouble from any officials.
  • The race has detailed instructions for tying the timing chip into your shoelaces and dire warnings should those instructions not be followed. Before the race I experimented with a few different ways to attach the chip to my foot, but they all failed. Today I just put the chip in my pocket and at the chip-readers (at the start line, the top of the Auckland Harbour Bridge, and the finish line) I held the chip in my hand as low to the ground as I could as I ran over the chip-reading system. I wasn't sure if that would work, but it did.
  • The road surface was reasonably smooth most of the way along the route. The section from Smale's Farm along the motorway until getting off the Harbour Bridge --- several kilometres --- is rougher than the rest but tolerable. There are sections around Halsey Street near the end which are very rough, but they're quite short. Overall the surface was better than I usually get running on footpaths.
  • My feet hurt less at the end than they did when I wore the Vibrams last year. Last year my feet got really sweat-soaked so that may have had something to do with it.
  • I got a lot of good-natured comments from runners and bystanders. Some people probably thought I was a nutter, but to be fair, they're not clearly wrong.
  • Aid stations were surrounded by discarded cups of Powerade, making the road sticky with Powerade underfoot. Icky, but it quickly rubs off :-).

To the question of how you get into shape to run a half-marathon barefoot in the first place, I have little to say. I always run barefoot and I run home from work most days.

Overall it was a great experience and I expect I'll do it again next year.