node-webkit

C3D Buddy 2.0 in action — built in an evening using node-webkit
C3D Buddy 2.0 in action — built in an evening using node-webkit

I don’t do very much desktop software development these days, and I’ve become increasingly frustrated with Realbasic (now Xojo), so the prospect of forking out $500 for an upgrade that may or may not be usable did not fill me with glee. Furthermore, as the years roll on, there’s more and more functionality tied to the web that desktop-centric development tools struggle to work with.

I was dimly interested in a thread on Hacker News this morning concerning a workflow for developing desktop applications with node. Turns out that the workflow was mostly to do with things like angular and jade, which I’m not especially keen on, and not so much with the actual desktop stuff — the heavy lifting for which is all done by node-webkit. So I started looking into node-webkit.

I like a tool which has you up-and-running in about three paragraphs.

It goes something like this:

Download an appropriate node-webkit binary. (Disappointingly, the Mac version is restricted to 32-bit.)

  • Write an index.html file. (The sample “hello world” app calls node inline.)
  • Write a package.json file. (The documentation suggests it’s like a “manifest” file, but really it’s more like a configuration file.)
  • Zip this stuff into a file into an archive whose name ends in .nw.
  • Double-click the archive.
  • Voila, your app works.

After working on this for about fifteen minutes, I knocked up a bash script (which I turned into a .command file, allowing me to double-click it in Finder) which does the archiving and then launches the file in one step. (It does leave dead terminal windows lying around, and it doesn’t quit the app if it’s still running. I think I may build an app for building apps if I do much more of this.)

And to build a distributable application you can simply put the archive in the application bundle (on the Mac) renaming it “app.nw” or name the file package.nw and put it in the same directory as the application (for those benighted platforms that don’t have bundles). One minor annoyance is that it’s not clear exactly what needs to be changed in the Info.plist file to fully customize your application.

So what is node-webkit? It’s essentially a version of Chromium that puts node.js alongside the DOM in your web pages, along with a few custom HTML and DOM extensions that let you do things like handle platform-native file requesters).

I should note that it’s a potential security nightmare as it stands. There’s no sandboxing (that’s kind of the point), so deploying an app that loads your banking website and then watches you press keys is totally doable. That said, it’s a desktop app so it can also delete all your files or encrypt them and hold them hostage.

Anyway, I had a lot of fun this evening rewriting a utility application I originally wrote in Realbasic a few years ago. It probably took me about twice as long to write it as it took me to do it in Realbasic. Part of that is I know (or knew) Realbasic very well, and I don’t know node very well. Another part of it is that Realbasic is almost always synchronous while node is almost always asynchronous. Writing code that spelunks a directory tree asynchronously is a lot more complex both conceptually and in practice than doing so in linear fashion, but the payoff is quite impressive — despite running an “interpreted” language, a task that took significant time in Realbasic (loading and displaying hundreds of thumbnails) happens in the blink of an eye.

One of the things that’s especially intriguing about node-webkit is that it gives you control over the browser you normally don’t have (e.g. window placement, file system access) — these are a constant usability sore-point in the project I am currently working on (which is a web app that is replacing a suite of desktop apps). It would be so much easier to get a lot of the things we want to do working smoothly using a hybrid desktop application built on top of something like node-webkit — it’s kind of a lemma of Alan Kay’s observation that anyone who wants to write really good software needs to build hardware — anyone who wants to write really good web apps really needs to build the browser.

The github repo for my project is here. It’s not a very general-purpose application; if you don’t use Cheetah 3D it’s completely useless.

Unbricking the Nexus 7

Bricked Nexus 7
Bricked Nexus 7

My Nexus 7 took its second dirt nap yesterday. Note that it’s been software problems both times. Apparently it automatically patched itself into an unbootable state.

The top search results dealing with this issue were useless, and the ones I eventually found involved downloading crap from dubious sources and/or had serious omissions in the instructions (here’s a link to the instructions I used but note that my instructions here actually work), so as a service to Google’s other Mac-using victims customers, here’s how I fixed my problem.

You will need to:

  1. Forget about the stuff on your Nexus 7. It’s gone. (Note that your Apps will reinstall, and if you’ve been automatically backing your device up to your Google account or whatever, everything will come back eventually — it’s actually quite impressive, although it doesn’t make up for the whole self-bricking thing, or how difficult the process you’re about to undertake is.)
  2. If you don’t have Java installed, you’ll probably need to install it. If your copy of Java is out-of-date you may need to patch it.
  3. Download the Android SDK (you’ll need one tool from it called fastboot). Get it here (download the Use an existing IDE link to get the least amount of crap. Expand the resulting archive, rename the folder android-sdk and move it to your home directory.
  4. Download the appropriate factory image from here. (I downloaded “Nakasi for Nexus 7 WiFi”.) Drag the resulting 275MB archive to your desktop, expand it, and rename it Nexus 7 Factory Image.
  5. Now connect your Nexus 7 to your Mac using the USB cable that you charge it with. Hold down the power button until the Google logo disappears then immediately press and hold the volume down switch until you see the Nexus 7’s “FASTBOOT MODE” screen (it’s in tiny nigh-unreadable red text accompanying picture of an Android having open-heart surgery). (At any point you can get back to “the fastboot screen” using this process.)

    Fastboot Mode — helpfully rendered in illegibly small type
    Fastboot Mode — helpfully rendered in illegibly small type
  6. Now (assuming your Android SDK is where you I told you to put it), launch terminal and enter ~/android-sdk/tools/android. This will launch a butt-ugly Java application. Check the box next to Android SDK Platform Tools and click the Install packages… button. When that’s done, quit the app.
  7. Next, in terminal enter cd ~/Desktop/Nex and hit TAB (it should autocomplete the name of the factory image directory).
  8. Now, enter ~/android-sdk/platform-tools/fastboot devices and press enter. It should list attached Android devices, in particular your Nexus 7 (along with some funky number).
  9. Now, press up arrow and then replace devices with erase boot and hit enter. Repeat with cache, recovery, system, and userdata. You may get some funky messages such as “are you sure you don’t want to partition”. Unless you get an actual failure or error message you should successfully have deleted all your precious data.
  10. Now, and this is the step missing from the instructions I eventually followed, you may need to unlock your bootloader. Hit up arrow and replace erase userdata with oem unlock. (Don’t worry, you can undo this later if you want to go back in the walled garden.)
  11. Next, hit up arrow again -w update imag and then hit TAB (to autocomplete the name of the image file you’re going to flash onto the device).
  12. At this point I think my device booted itself, but if not you may need to continue:
  13. Now, hit up arrow again and …fastboot reboot bootloader followed by …fastboot reboot
  14. You may want to return to the fastboot screen and use …/fastboot oem lock to return to the walled garden.

That’s it. I hope this saves someone the problems I had.

iOS6

This is what iOS Maps selects as my destination when I search for USPTO
This is what iOS Maps selects as my destination when I search for USPTO

I neither lined up for nor pre-ordered an iPhone 5 (lining up for the iPhone 4 on launch day persuaded me that there is no gadget I want that badly), and just placed my order (estimated delivery 3-4 weeks) after debating whether I really want a phone at all for several weeks. It follows that my impressions of iOS6 are based on using it on my iPhone 4.

Flirting with Android

In case you’re wondering: yes, I did consider switching to Android. Indeed, I have bought two tablets — one a Nexus 7, and one a Kindle Fire, since I last bought an iOS device (that would be my iPad first generation 64GB, which I still use daily). The Nexus 7 has done a good deal to persuade me that Android is still essentially an exercise in frustration. E.g. I tried to order my iPhone 5 on my Nexus 7, but its various quirks combined to prevent me from completing the transaction. These quirks are:

  • The keyboard can (and frequently does) become so unresponsive that it loses tap events altogether.
  • Sometimes I simply can’t tap on targets in the browser (Chrome is my favorite browser)
  • I’ve progressed from “quite liking” the user interface to loathing it with a deep and abiding passion

It’s a shame. There’s a lot to like about Android, especially as a developer. Being able to build an Android game directly from Unity without launching Eclipse is wonderful, and I was able to port Manta to Android and post a (somewhat wonky) version in the Google Play store in a couple of lunch breaks. The iOS development experience is certainly a lot less unpleasant today than it was in 2008, but Android is completely frictionless. Of course the net result is that there’s a lot of half-assed crap, like my quick and dirty Manta port, in Google Play.

iOS6 First Impressions

Probably the first thing I noticed with iOS6 is that my iPhone seemed to run a little faster (and it was just fine before), and battery life seems slightly better (maybe 30-50% battery for a day of typical use for me). Not bad for a two-and-a-half-year-old phone. It reminds me of Mac OS X upgrades up until Tiger.

iOS6 Maps App
Directions are much more readable in the new Maps app, and you can flick from stage to stage easily, and get back to your current stage by tapping the arrow button.

The Maps app has gotten the most attention. On my iPhone there’s no 3d flyover frippery, and as far as I can tell there’s no turn-by-turn directions. But the way the Maps app works is insanely better than the old map application (although goodness knows it could easily be further improved):

  • The big green directions are much easier to read at a distance, e.g. wedged on my dashboard
  • You can flick back-and-forth through a series of directions easily (and get back to your current leg with a tap of the “center on me” button)
  • If you tap the “center on me” (or “arrow”) button when using directions, turning it subtly purple, it keeps you centered and automatically steps from instruction to instruction. This is a killer feature and makes the device, in my opinion, superior to a dedicated GPS navigator (or my wife…)
  • You can also pop back to an overview of your route without interrupting anything.

As for the things that could be improved:

  • I assume turn-by-turn navigation will automatically recalculate routes, but I’d like a shortcut for recalculating routes in the direction mode.  Right now, just as in the old Maps app, you need to tap your destination (again), and search for directions (again), and then click the Route button (again) and start navigation (again). Ick.
  • I think that the “purple triangle” mode (follow me and update current stage automatically) should be the default, and not require an extra tap to activate.
  • The way Waze lets you add small detours (e.g. for gas) to a route would, if Waze weren’t a bit of a usability-free-zone, be genius. Steal the idea and do it properly.

I haven’t found the actual directions to be bad (I live and work inside the DC “beltway” so your mileage may vary), or even discernibly different, from the old app’s (or Waze’s). The big difference (and this also applies to Waze to a slightly lesser extent) is that the new app simply sucks at searching for destinations by anything other than exact address. It doesn’t alway fail — e.g. it can find “Smithsonian National Zoo” without a problem — but it fails more often than not. It seems to me that a quick fix would be to pick some search service and attempt to resolve a search that isn’t producing satisfactory results. Even Duckduckgo, which I believe assiduously avoids basing its searches on any information it may have about the user gets a good result searching for the USPTO’s street address. So, it seems to me that Apple could easily fix this problem without going cap-in-hand to Google.

Do Not Disturb is wonderful, but falls in the category of “stuff I was amazed wasn’t implemented in version 1.0”. It lets you tell your phone not to ring or make noises between certain times (and can be toggled manually, e.g. during a meeting). As far as I can tell it doesn’t automatically figure out you’re in a meeting if there’s a meeting scheduled in your calendar. iOS11 perhaps. But, unlike the VIP feature in Mail, it allows you to automatically allow favorite contacts to penetrate the Cone of Silence.

Speaking of General Settings, Personal Hotspot is back at the “root level” of settings — where it belongs — having disappeared into the hierarchy at some point.

Facebook integration is interesting. You can install Facebook from the settings panel. So you can integrate to Facebook without having the app installed, but you can also install the app from the settings panel. Neat. And yes, Twitter integration works the same way and intrinsically supports multiple accounts.

Passbook. I can only parrot the comments others have made suggesting that Apple might have kicked this sucker off a bit more effectively. How about a bunch of discount coupons and some gift certificates ($10 off any iPhone 5 case at your friendly local Apple Store). As it is, I have no clue what this is for right now.

A number of other apps, notably the Phone app, have had significant cosmetic changes for no readily apparent reason. And there’s a few new apps — iTunes U, Find Friends (potentially useful, but I haven’t set it up), and Podcasts — that at least have the virtue of not being folders in disguise (so you can tuck them into folders to hide them if you want).

There’s a new VIP feature in Mail, but I’d rather see support for Gmail’s Priority Inbox (or automagic functionality rivalling it) which seems to work almost flawlessly and required no setup on my part. I thought it might automatically include everyone on my favorites list in contacts, but that might involve not dividing communication into silos (snarl).

Overall, Maps is great but needs work (it seems fine once you give it a street address), everything else is fine, and it seems to run leaner and meaner than iOS5. What’s not to like?

Ustö is quite hard to find using Google Maps
Ironically. Ustö is quite hard to find using Google Maps. I had to specify “Ustö, Sweden” to get any result, and this looks wrong to me.

Natural Justice and Patents

In Minority Report, Tom Cruise uses a multitouch interface that requires special gloves to operate, removable media to transfer data, and an elaborate two-handed gesture to zoom an image.

It’s pretty hard to find any vaguely balanced commentary on the outcome of the Apple v. Samsung trial that concluded yesterday. I agree with the verdict, so let’s get that out of the way. So don’t expect any vaguely balanced commentary here.

The general arguments I see in favor of Samsung / Android / Google are:

  • Apple’s patents are all trivial and shouldn’t be patents at all OR someone else invented them first (go check out the DiamondTouch video)
  • Apple is being anti-competitive and people will pay more for smartphones because of the decision
  • It’s bad for innovation because Apple will sue little guys who innovate

When Fingerworks patented a whole bunch of “trivial” multitouch technology Apple didn’t think it was too trivial to patent. It didn’t simply steal and imitate the ideas. It bought the company, hired its key people, and acquired its patents.

I remember back in the early days of the web when Amazon got the “one click purchase” patent. A lot of people (myself included) thought this was pretty ridiculous. By the time Amazon was awarded the patent, it seemed “obvious” — but bear in mind that Amazon had made it obvious with many smaller and less obvious innovations (e.g. when it asked you to provide credit card details there was a link with “click here to find out why this is safe” next to the field).

Apple’s reaction to the patent: it licensed it.

I have worked with touchscreens and stylus devices, on and off, for nearly twenty years before the iPhone came out. I can’t say that pinch-to-zoom was “obvious” to me. For that matter, Apple had been developing touch and multi-touch devices for, by all accounts, even longer and it didn’t occur to them until 2005. The fact it seems so obvious in retrospect just goes to show how valuable an idea it is. Of course you can’t patent “ideas”, but you can patent embodiments, and Apple did.

Similarly, Apple patented the rubbery spring-back effect. Not only is this not obvious (does anyone do it with their mousewheel drivers? Anyone? No) but there are perfectly satisfactory alternatives (the Nexus 7, by which I assume vanilla Android 4.1, has a page-curl and glow effect that communicates the same idea just as effectively; the Kindle Fire does something cruder along the same lines). Indeed, it looks like Samsung took an OS from Google that had a perfectly satisfactory and original mechanism for visually representing over scrolling and replaced it with a deliberate imitation of Apple’s mechanism.

Apple is being anticompetitive. It has invented a bunch of stuff and patented it. The patent system is designed to give inventors a temporary, unfair advantage in selling goods based on original inventions. This is not bad for innovation — without it there would be little incentive to innovate, and no incentive to publish innovations.

What the Apple-is-a-big-bully-I-love-Android (I think the acronym is NAMBLA) folk want is a free OS that has all the good things that Apple has invented in it, ideally in a device that looks a lot like an Apple device. They want these things but they don’t think they (or Google or Samsung) should have to pay for or license them or wait for the patents to expire because these inventions and designs are “obvious” and unworthy of patent protection. We can tell that Apple’s IP isn’t worthy of patent protection because the Android vendor which has gone the furthest in shamelessly copying it has done so poorly in the marketplace. Oh, wait.

Anyway, I think Apple should take its winnings (if it ever gets them) and donate them to a cause that solves real problems, like MSF. It might even help recover some of the goodwill it has burned through its lawsuits. (Heck, it’s how Bill Gates atoned for his behavior.)

Nexus 7

Nexus 7, iPhone 4, and Kindle Fire
Nexus 7, iPhone 4, and Kindle Fire

My Nexus 7 (16GB) showed up yesterday — two business days after I ordered it. Shortly after activation I received my $25 of Google Play credit which kind of nullified the non-free shipping (insofar as $25 Google Play credit can be considered to be worth $25).

Cutting to the chase: I like it. Overall, I like it better than the (nearly one year old) Kindle Fire. (I like the Kindle Fire a lot more now than when I got it because of significant improvements to the OS, including password protection for purchases.)

My wife and I recently changed jobs, as a result of which we both had to give up employer-provided iPad 2s, and we’re now using our old iPads when the girls let us. So the contrast in performance between the iPads and the newer Android (ish) devices couldn’t be made more stark, and by-and-large it’s not terribly stark. In flat out performance (e.g. loading complex web pages) the newer devices are noticeably faster, but in general use the iPads are more fluid and pleasant, which seems to indicate to me that there are fundamental architectural issues in Android which are never going to be fully addressed (much as Flash sucked in ways Adobe simply couldn’t fix).

Seven Inches

I find both the Kindle Fire and the Nexus 7 to be totally usable for reading, web surfing, and watching video. If anything, I would suggest they are — overall — slightly superior devices to the iPad for those purposes for the simple reason that smaller size, lower weight, and better performance trump display size.

As soon as it comes to use as a computer substitute, the iPad simply wins. I have bought Sketchbook for all three devices (I have the cheaper phone-centric version on the Kindle Fire). I am a huge sketchbook pro user and I find the 7″ version to be frustrating at best (at least the Kindle OS has been improved such that it’s not horribly jerky any more).

Android v. iOS

As alluded to before, based on the jerkiness of Android 4.1.1 (insert dessert name) on the Nexus 7, Android’s UI/graphics subsystem is significantly behind iOS and it’s not going to catch up. But aside from the niceties of UX animation, I’m not sure that matters. If UX mattered that much, Microsoft wouldn’t have been worth more in 1999 — in inflation-adjusted terms — than Apple is today. Yes, these are different times, but give most people a 30% discount and make their UX clunkier and less tasteful and they’ll say “why yes, I will buy a new PC”. (As Don Norman mentions in the Design of Everyday Things, even his family is not immune — opting for price or features over aesthetics and usability when purchasing things like stovetops.)

Icons: one area where the Nexus 7 is seriously (but trivially) handicapped is aesthetics. While the system as a whole looks quite nice, there are some truly horrible icons. For example, the “Applications” icon — a white circle with six small white squares in it — which manages to be unintuitive, ugly, impossible to remove or replace (as far as I can tell — I’m sure it can be replaced) and locked to the center of the “dock”. There are plenty of butt-ugly icons — the music app is a pair of orange headphones that look like an escapee from Program Manager circa 1994, and the book reader is a blue book cracked open to face away from the user.

System: I find the basic Android “launchpad”, at least for the Nexus 7, to be pretty confusing. The Kindle Fire was pretty bad, but I’ve gotten used to it, and find it quite pleasant now. That said, once I figured my way around there are some ways in which the Nexus 7’s UI is markedly superior to both iOS and (as I understand it not having used it for more than a few seconds) Windows Phone 7. In essence, “widgets” (which are provided by apps) allows you to allocate a subgrid of icons in the launcher screens to be a small panel owned by an app. E.g. a mail widget might display a small inbox.

If there were one feature of the Nexus 7 / Android which I would like to see Apple copy into iOS it would be widgets. On the screen of my Nexus 7 in the photo you can make out the Gmail widget, an analog clock widget (sigh), a calendar widget, and a Flipboard widget.

Applications: iOS is ahead but the gap is definitely closing. Angry Birds — yes. Sketchbook Pro — yes. Tiny Wings — no. Grand Theft Auto Chinatown Wars — no. And, notably, when you try to search for games like Infinity Blade the name autocompletes (it’s a common search) but you get nothing but crapware. Perhaps more importantly, Pages — no. iMovie — no. Apple itself makes nicer software than Google and this has follow-on effects on the ecology that don’t change (just look at how Microsoft’s poor and inconsistent application design degrades the entire Windows ecosystem, or how Apple’s worst missteps — metal! — have been imitated slavishly).

One area where Android excels compared to iOS is its openness. I’ve got Firefox and could easily install one of a number of programming environments that don’t have any of Apple’s restrictions (e.g. Codea on the iPad won’t let you share your code with anyone else, short of email and copy-and-paste). The fact that there are no compelling development tools on Android (that I can see) is pretty telling.

Installing Apps: when I first tried to install an app I got mysterious errors which turned out to be quite common (the solution was to turn Gmail syncing off and on). Once I got it working I found installing new apps markedly quicker and more painless than achieving the same thing in iOS (and I appreciate having automatic update as an option, although I’d prefer it to be on a per-app basis). (Also — hint to Apple — I’d like to be able to delete an app instead of update it.)

Silos: why is there a Message app and a Talk app? Why is there a Gmail app and an Email app? And why a navigation app and a Maps app? If Apple’s insistence on dividing communication into silos based on the medium is annoying, Google’s rises to mystifying. At least on my iPhone I can see email from Gmail, Exchange, and vanilla POP and IMAP in one place.

3D Game Performance: I know that the Nexus 7 should be running rings around the iPad (and iPhone 4) but from my brief experiments with 3d games (I tried Pocket Legends and Space Legends, both from the same vendor, which may be telling) I found games to run more choppily on the Nexus 7. In any event the difference wasn’t marked, so I call it a wash.

Notifications: Android fans make a lot hay over the superiority of Android notifications. Thus far, I’d call it a wash (perhaps Android’s the weird little icons in the sometimes-visible “menubar” will prove to be helpful).

Content Offerings: Google’s Play store is ubiquitous but a tad confusing. On the one hand they offer you the option to get everything from magazines to apps to movies in one place, on the other hand there are a ton of different storefronts that are all slightly different. One thing I found pretty annoying is that it’s not made clear whether the “price” of a movie is purchase or rent (or what resolution is being sold to you). And, in the end, it just seems to be the same stuff sliced up differently (insert joke about Taco Bell’s menu options). In the end, Kindle, Netflix, and Hulu+ all run dandy on the Nexus 7 (I noticed Super 8 was available via Netflix streaming and watched it last night).

Conclusions

None really. I like the Nexus 7, and I think it’s a worthy competitor to the iPad in a Windows vs. Mac kind of way (i.e. it’s not as good, but has some nice things I wish the iPad had, and the price is right). Unlike the Windows vs. Mac comparison, the ecosystem is squarely on Apple’s side (for the time being, at least) — the iPad has a significantly better game selection. Notably, in key areas Android still hasn’t caught up with the original iPad. My Kindle Fire languished largely unused for about six months (I’ve been using it quite a bit since having to return my iPad 2) — I might have more definite conclusions after the rumored iPad mini ships or doesn’t ship.