A Fine Coffee Bug (Random Coding Note). And jsConsole.

This is a bug that took so long to track down, I had to write it somewhere.

The wrong code was:

radio('new-page').subscribe = -> # handle new pages

It should have been

radio('new-page').subscribe -> # handle new pages

The first call was actually over-writing the radio subscribe() function, so no further handlers were actually getting registered.

This does happen quite a bit with CoffeeScript. By wiping out all the parentheses and other junk, it leaves just a few symbols which sometimes are necessary and sometimes not. e.g. with jQuery onclick registration ($('button').on 'click', -> ....), one has to stop and think if there’s a comma or not. Everything else is natural it flows staight from the lizard brain and onto the screen, but not the damn comma. Hopefully there will be some nicer syntax highlighters and run-time diagnostics to catch this kind of thing in the future.

What phased me about this was it was working on desktop, but not Android. Thought it might be some Android quirk. But it’s because I’ve customised the basic player for android, so this code was only actually executed for Android.

Anyway, if there’s one useful thing I can say about this: Remy’s jsConsole tool rocks! Seriously. It helped me get Player FM working on Windows Phone IE the other day and it got me out of this fine Android pickle today. With Android Browser, you can get a basic console with about:debug, but it’s rubbish. Silently fails a lot of the time, only shows the first console log argument, no command-line history or completion so you’re typing like it’s a 2003 SMS. jsConsole makes it real easy. Just put something like this in your HTML layout (for Rails/Haml):

 -if Rails.env.development?
<script src="http://jsconsole.com/remote.js?myawesomeapp"></script>

Then visit jsConsole and type :listen myawesomeapp. Now you have a grown-up’s console.

The Boot2Gecko Developer Experience: An Interview with Mozilla’s Jonathan Nightingale

A surprise bonus of last week’s MWC trip was the coincidental launch of Boot2Gecko, Mozilla’s operating system based on Firefox (Gecko being Firefox’s underlying layout engine and B2G being the unofficial brand name for now). They made a joint announcement with Spain’s Telefonica (O2 and GiffGaff’s parent company) with the expectation to release a commercial offering this year (no commitments yet though).

Continuing my “a conference is worth more than 140 characters” resolution, I had a chance to sit down with Mozilla’s Senior Director of Firefox Engineering, Jonathan Nightingale and understand some of the technical issues around the new OS.

Key points from the video, as well as speaking to some of the other Mozillians:

  • The device could be very cheap, $60 for a SIM-free device is a figure I heard. Needless to say, if they can achieve a price point like that, it will be music to carriers’ ears and simultaneously light up the HTML5 developer community. At 10:00, Jonathan mentions that Telefonica sees the opportunity to produce a smartphone that’s “interactive, smooth, high quality, with a good app selection, that is one-tenth the cost of an iPhone”. From what I’ve heard, this is because of two factors: the target hardware is open and patent-free, and the HTML5 runtime is built over a thin Linux core, so various layers are eliminated.
  • It boots fast, about 14 seconds (I thickly say 4 seconds in the video but I was counting from the splash screen…my argument is invalid). Bearing in mind this is a very early concept, the final version will hopefully be even faster, though it’s possible extra services may make it slower too.
  • Everything is HTML5. The launcher, dialler, camera, gallery, et al. And what’s more …
  • … On the dev build, as Jonathan demos, View Source is available everywhere! On all the apps, and that includes those “system” apps above (launcher, dialler, etc).
  • The Mozilla Marketplace is not exclusive to B2G. It will run on other devices where Firefox runs, like Android. (It turns out that Android apps can be permissioned to add multiple URL shortcuts to the Android launcher, so once a user installs the market, they can install apps directly on the launcher.) This is a little like the Chrome Web Store, which is the app distribution mechanism for ChromeOS, but also works on regular Chrome across the different OSs it runs on.
  • Mozilla’s keen to cultivate an ecosystem of multiple marketplaces with different verticals and business models. They offer their own marketplace, but will happily embrace others.
  • No immediate plans for extensions or a NodeJS service layer like WebOS runs, but Moz is very open to feedback via the standard channels.

PPK argued in last week’s Web Ahead we may well see a shift away from Android in the next year as carriers come to terms with Google’s Motorola acquisition. It’s not for certain, but I did hear people echo this view at MWC. Boot2Gecko will be a key part of the current movement among the smaller OSs to embrace HTML5 developers. And if the price point means developers can easily get their hands on these devices, as opposed to the usual suspects who are awarded freebies by marketing departments, it stands a real chance in this market.

HTML5 developers should also check out Christian’s Boot2Gecko write-up for more info, as well as the official Boot2Gecko Wiki.

Upcoming: UXCampEurope and SWDC

Google I/O is over and I’ll post a bit about the HTML5 hack session I ran later, but here I want to highlight a couple of upcoming sessions in Europe:

UXCampEurope. If this is anything like the Bay Area and London UX camps I’ve been fortunate to attend, it will be huge, and being Europe-wide and in Berlin, this expectation might just be met. I was sitting on the browser along with @mattlucht hitting refresh 10 times a second when the tickets were released at the start of the year! I’ll set up a slot called “What did HTML5 ever do for users, anyway?”. I’m planning to overview some of the features of HTML5 and its evolution from Ajax, and ask how it might be used to improve UX. It’s a camp, so I’ll also be hoping to collect contributions and writing them up somewhere.

SWDC. The first Scandinavian Web Developer Conference and Peter Svensson is organising, so I know it will be an awesome event, and the sessions speak for themselves. I’ve bumped into the guy twice in the past month – he travelled from Stockholm to DC for JSConf, and again to SF for I/O. My session is on the mobile day, called “HTML5 Gives You Wings”, focusing on HTML5 techniques for performance and app-like behaviour. Here’s the summary:

Welcome to the dynamic world of mobile development, where new browsers stay close to the edge and HTML5 is already a reality. Despite the impressive advances, many mobile apps are still bottlenecked by the network and compact processors continue to lag behind their desktop counterparts. So how can HTML5 help? This talk will focus on those features of HTML5 that are interesting for performance optimisation and the techniques for emulating native apps, such as offline data storage.

Tablets this Time Round are Different, Really

Convincing argument that it really is different this time round, compared to the days of “pen computing” and windows tablet edition at the start of the decade.

Microsoft always loved the stylus, but most people hate it. Apple and others understood that actually touching the screen is far more appealing than using some funky pen. And touch requires an entirely different user interface, which Microsoft was unwilling or unable to build into Windows until Windows 7. The casual observer might believe that the usability difference between pen and touch is small. But using a pen is an unnatural act, one that until very recently only a tiny minority of people ever engaged in. The psychological payoffs for using a pen on paper are the tactile feel of the paper, the instant feedback of the trail of ink and the physicality of stacks and files and binders of paper notes. Pen-based computer systems don’t offer any of those payoffs.

Touch is one of seven reasons cited. Others include the rise of e-readers, HD video on demand, app stores, and mobile-specific operating systems like Android.

A further reason would be improvements in soft keyboard technologies. That a soft keyboard could work, as on the iPhone, was a surprise to many; we probably won’t see those funky projected keyboards taking off any time soon. While some will say the tablets aren’t for performing serious work, everyone needs to type occasionally, at least to perform a web search.

Another reason is battery improvements, though we’re still a long way off from being able to play HD video, surf the web, and chat on skype, simultaneously and all day long.

Great, now we have all the reasons in the world. Unfortunately, we don’t have the CrunchPad anymore and the Apple rumour is just that. Will tablets really take off? For all the arguments, there remain some unanswered questions.

Most important, the form factor; although lighter and thinner than ever, they are still awkward to hold, maybe awkward enough for only geeks to love and certain professionals to tolerate. This is an area where Apple surprise us just as they did with the MagSafe power adaptor. It was innovative, unexpected, useful, intuitive, and a product of the physical world rather than the digital world. They’ll do well to repeat that feat with some kind of stand for the rumoured tablet.

The other thing is connectivity. I can’t see these taking off in a big way unless they ship with a 3G sim card, like the Kindle. We’re finally entering an era of more SIM cards than people and it makes a whole lot of sense – at least among retail consumers – to treat bandwidth like oxygen, instead of having to bash wifi into working for us. It’s true that wifi itself works well these days – the client detects the type of encryption and asks for a password. The problem comes when it’s restricted, i.e. a hotel has to give you a special password or you have to pay for it via a website. That’s where the friction comes, and it gets even worse with these systems that proxy everything and kill the session when you leave the browser (say, to send a tweet from a twitter app). Many of us will still need wifi as bandwidth isn’t ready for high-end uses like HD video – and also while data roaming charges remain stiflingly high – but a built-in sim card is the only way forward as the default mode of connectivity. I’m currently paying £7.50 per month (~ $12) for 3GB/month download, and came with a new USB modem. At a rate like that, it’s a no-brainer for tablets.

The New Ubiquities

Email and the web have traditionally been the two ubiquitous services on the internet (prior to the web, it was email and usenet). Podcasting (and vidcasting/vodcasting) is now becoming another ubiquitous service. The reason I mention this was an interesting quote on BBC news today in a story about the web’s birthday. Despite the story having nothing to do with podcasting, it’s intro’d as follows (@ 25:00):

The world wide web is 15 years old. While podcasting is relatively new, it’s difficult for many of us to remember a time before email and websites.

For a long time, I tried to use games as an example of the difference between the net and the web, to point out to non-techies that the net is more than just surfing. No longer.

There’s another service becoming ubiquitous as well: telephony (IM alone never got past early adopter stage).

In the aforementioned story, the BBC’s futurologist points to mobile as the next big thing. I tend to agree, and this is a case where the “leapfrogging” buzzword will come into full play. So much depends on mobile telephony regulation and the degree of innovation within the telco industry. Right now, mobile internet rates are laughable in most countries, and development platforms remain as fragmented and obscure as ever.

Google’s Microcontent Engine

Google’s apparently releasing base.google.com. While some see it as a Craigslist play, it’s a lot more than that: Google has seen the future, and the future is one big mashup of microcontent. “A” microcontent is a small chunk of information, typically with its own URL, but not actually a web page. It’s not a web page because it’s raw content, without being wrapped in navigation, disclaimers, etc. As some of the Ajax portals show, there’s a confluence here: Ajax allows for easy manipulation of microcontent. Tiddlywiki is based around the idea of microcontent, and allows you to conjure up some microcontent by clicking on a Microlink.

Classified advertising is the most obvious path to revenue, so the screenshot emphasises commercial applications. But a classified ads is just one special case of Microcontent. As they say: “Google Base is Google’s database into which you can add all types of content”. Sounds a lot like a repository of general-purpose microcontent.

Ladies and Gentlemen, get your mashup on! I’m betting on a Maps-Base mashup about 90 seconds after Base goes live. Google probably won’t bother integrating Maps themselves – they may as well sit back and see what works before buying one or developing their own solution.

In other Google-Ajax news, Jonathan Boutelle points out that Google’s foray into mobile is full-on motivated by Ajax: being offline is a big objection to migrating desktop apps, so Google wants to render that a non-issue.