Keyboard-only searching with Safari 6’s unified URL bar

A couple of months ago, I adapted a user script called knogs (“keyboard navigation on Google Search”) into a Safari extension. knogs restores Google’s search page keyboard navigation shortcuts (background here), so you can navigate between search results with j (down) and k (up), and get to the search field with /.

Unfortunately, Safari 6’s new unified “URL + search” bar behaviour retains focus after a search. As a result, you have to click in the search page to use any keyboard shortcuts, rendering the extension fairly useless unless you like searching for JJ Abrams by mistake.

So I’ve updated the extension to remove focus from the unified search bar. (It’s an ugly hack, though–I did it by prepending an input field on the page, calling focus on it to remove focus from the search bar, and then removing focus with blur. Let me know if you have any better ideas.)

Download the Safari extension here, and the source (userscript version) is available here. If you were using the previous extension, it should have auto-updated, if I set it up right. Test it out by searching in Safari’s URL bar, waiting a few milliseconds, and entering j, k, or / to navigate.

A couple of notes on usage:

  • You have to be searching with google.com for this to work, and not any country-specific domains. This is due to the way Safari handles extension whitelisting–I can’t get it to whitelist google.com.* URLs.
  • Disable Google Instant search in your account settings, otherwise typing j will just append that letter to your search terms. Thanks to Nick Farina for helping me find this issue.

CodeRunner

CodeRunner is a Mac app that lets you:

Edit and run code in AppleScript, C, C++, Java, JavaScript (Node.js), Objective-C, Perl, PHP, Python, Ruby, Shell or any other language you might have installed on your system.

This could be really useful for programming teachers — one of the big headaches we always have in the first lesson was making sure things were set up properly. There was a time we tried teaching C++, and found out that the computers’ permission settings disallowed running of any shell programs, so we sang songs and dreamed of correcting missing semi-colons. Ah, fun times.

How to self-update Mail.app plugin compatibility

The new MacBook Pros ship with a new version of Mail.app (4.4/1082.1, vs 4.4/1082 previously). Nothing much seems to have changed except the version number, but an annoying side effect manifested when I first started the program: all my mail plugins* were deemed “incompatible” and promptly disabled.

As this wasn’t a major version update, not all my plugins had been updated for compatibility, but I figured there wouldn’t be any real compatibility issues (not ones that required re-compilation, anyway). As such, I performed some minor plumbing and restored their functionality. Your mileage may vary, but here’s how I did it:

  • In Finder, navigate to ~/Library/Mail/Bundles (Disabled).
  • Ctrl-click on a bundle, and select “Show Package Contents”.
  • Navigate to Contents, then open Info.plist with a text editor (e.g. TextEdit).
  • Near the end, look for a <key> called SupportedPluginCompatibilityUUIDs, where you’ll see a bunch of <string>s denoting compatible Mail versions.
  • For this version of Mail, just add this line right before the closing </array> tag: <string>36555EB0-53A7-4B29-9B84-6C0C6BACFC23</string>
  • (For future versions of Mail, if you’d like to try this hack, start by looking at plugins that are already compatible. In their Info.plist files, try to identify the compatibility string to paste in.)
  • Save the file, move the bundle back to ~/Library/Mail/Bundles, and start Mail.
  • WOOHOO, YOU’VE CHEATED THE SYSTEM! YOU LEET HAX0R!!! (Does anyone still say that?)

* DockStar, Mail ActOn, Letterbox and MailFollowUp.

Don’t Panic

I’ve had an iPad for about three weeks now (thanks to two Kevins for bringing back the iPad and case).

photo 1.PNG

I’ve noticed that, despite the 69 million reviews already out there, anyone who gets hold of one feels the need to write about his initial thoughts on the device. Ick! Such self-absorbed twats!

Anyway, my initial thoughts on the device:

  • It’s been great for reading a variety of things on. I’ve been plowing through articles on Instapaper, PDFs on GoodReader, and books on iBooks.
  • Other apps – NewsRack for RSS, Twitterrific for Twitter, SimpleNote for note-taking, ArtStudio for finger-painting, NYT and BBC for news, PenUltimate for quick sketches. So far so good. All these apps are very distracting when I want to settle down and read, though. (Multitasking in OS 4 will probably destroy my attention span for good.)
  • GoodReader could do with an icon that doesn’t remind me of the eye of Sauron.
  • Hasn’t replaced my laptop yet. However, doesn’t burn my lap when watching videos in bed. (To convert, erm, non-iTunes TV and movie content, I bought iFlicks, which converts videos into iTunes-compatible formats, downloads cover art and fills in episode info.)
  • One complaint, I guess – the iPad’s screen could do with greater pixel density. I keep noticing jaggies while reading text.

Summary: love it. As Stephen Fry wrote in his giddy TIME review, the iPad is truly the closest thing to the Hitchhikers’ Guide to the Galaxy humankind has devised. Douglas Adams would have been proud.

(Wallpaper from talented Apple designer Louie Mantia.)

Wall of (mostly) Apple

The boarding apartment I’m staying in has a curious design at the front door — a 5 x 4 grid of rack space, apparently for people with a shitload of shoes. I decided to put up a little shrine to my favourite company there.

From left: Windows Vista (oops), iPod nano, Mac OS X Leopard, iBottle, iPod dock, iPod power connector, iPod touch, iPhone, Nike+ iPod kit, iPod classic. Some boxes stolen.

Missing: PowerBook and MacBook Pro boxes (too large, rather silly to bring them over from home), Mac OS X Tiger (also at home).

iPhone

Guess I won’t be needing both of these now, will I?

DSC00366.JPG

16 gig for USD499 + 8% taxes + $30 shipping, and a horrifically long wait for shipping by the US Postal Service (damn you for your slowness! And your catchy tunes!). Pretty reasonable price, especially with the hilariously weak USD (the dwindling value of my USD investments mean nothing compared to having an iPhone). Also surprisingly easy to unlock — one click, four minutes, bliss! See here.

Reviewers have said plenty about the phone proper, but I figure there’s no harm adding a bit to the great online blogovoid-of-crap about using an iPhone in Singapore from a heavy data user’s* point of view. Data settings for M1 were reasonably easy to find on Google — Settings, General, Network, EDGE; APN sunsurf, username 65, password user123. Pretty standard.

First slight annoyance after syncing with my Mac address book — the phone either didn’t recognise callers or SMS senders, depending on whether they had the +65 country code prefix in front. Callers were recognised if they didn’t have +65 in front; SMS senders were recognised only if they did. My Nokia used to deal with both fine. I toyed with the idea of adding both versions to my contact list, but was alerted to the presence of Installer application AppSupport, which fixed the problem. I also had to make some changes to the country list to reduce lag — there’s some pretty good documentation at iClarified.

The mobile web experience on GPRS is, needless to say, two giant bucketloads slower than on my Nokia 3G phone. However, the Nokia used to take nearly half a minute just to start up (start Opera Mini, wait 10 seconds; enter address, wait for phone to “scan available networks”, wait 5 seconds; choose the same bloody connection I always use why do you even bother asking and wait for it to connect, wait 5-10 seconds for “Connecting…” dialog; wait for data), so I’m glad to have the iPhone’s seamless experience for getting online (start Safari, wait 1 second; enter address, wait an admittedly long amount of time for data).

Having it able to check my mail every 30 minutes, regardless of Wi-Fi availability, is also nice, and the battery lasts decently long with this setup. The Nokia could do that with the Gmail Java app, but would lose half its battery life within 4 hours of being online. The iPhone does eat data like nobody’s business (1 meg a day if I leave it alone, obviously plenty more if I surf the web), but at least it’s making good use of my M1 1 gig data plan ($22).

After five days of use, I’m satisfied. How could I not be? I’m one of those raving Apple apologists, after all. Hopefully SingTel comes up with something better in September.

* Nearly 100 megs a month, or one-tenth of a ton, depending on how you read that.