Cam McVey: Web, Electronics, Music, Stuff

My plot of online goodness.

Tag: gotcha

On Mac keyboards and frustration

[Caveat: the following is an opinionated piece that you may or may not agree with. Also, my context is as a web developer: some of the following offenders are, of course, useful in other professions.]

Credit: berrytokyo

Credit: berrytokyo

I got a MacBook Pro recently, primarily because all the cool kids are creating the latest, greatest web tools on Mac systems and, frankly, the Windows guys are lagging behind. I found myself increasingly finding awesome tips/tricks/tools that came with the mac-only caveat which finishes with “I don’t know how you do this on a Windows machine, sorry.” I also got it because they’re so brilliantly designed to be both beautiful and powerful, and I dig that.

However, nobody mentioned the gaping hole of productivity that the non-standard (?) weird (UK) keyboard mapping! Argh!

  • The @ and ” symbols are swapped. Ever write an email? Yeah, me too. So I’ve had to re-learn where the @ symbols is. Annoying!
  • Page Up and Page Down are missing. This is really important to me as I use those keys A LOT to move around documents I’m editing.
  • The # symbol is completely missing! Any time you want to add colo(u)r to a webpage, you need that bad boy. Now it’s gone. This the worst change because, as an added annoyance, it’s been replaced with the never-ever-used-in-my-entire-life § (Section) symbol. What? Not to mention the equally useless ± as its shift+ partner.

Suffice to say, my first few weeks of Mac-ownership were filled with never-ending Google searches starting, “mac os x keyboard shortcut for …”. Now, I do know that all of these things can be overcome with judicious use of modifiers (e.g., Page Up is ?+? [cmd + up-arrow]), but even so, it’s a pain.

Then I stumbled on a superb bit of software called KeyRemap4MacBook. It is free and it is brilliant. I have now re-mapped several keys on this laptop to be more useful to me and I am very grateful to the genius Takayama Fumihiko for it. Though I haven’t gone as far a re-mapping the @ and ” symbols, I’ve made the this machine work better for me, and that’s pretty cool.

Right now, here’s how I have it set up:

  • When I hit the ‘§’, I get a lovely ‘#’.
  • Along with PCKeyboardHack, I’ve remapped the Caps Lock key to be “forward delete”
  • The Eject key now shows the desktop
  • The right-hand ? key is now Home (“Go to start of line”)
  • The right-hand ? key is now End (“Go to end of line”)
  • Also really handy: “Press ?+Q twice to Quit Application”

So, I’ve tamed the beast, somewhat. And I’ve forced myself to use the @ key in the wrong place. And I’m now pretty much up-to-speed with my Mac, and am enjoying playing with all the clever toys the cool kids are creating.

jQuery and JSONP Shenanigans

If you ever catch yourself messing around with jQuery and are trying to make JSONP calls using .getJSON(), just remember that since you’re (probably) making a cross-domain request, the .error() handler is not thrown. Which means, if you have any control over the uri that is being called, DON’T name the response “Error” when there’s a problem as you’ll never see it.

I was making this call:
$.getJSON('//remotedomain.com/api/?x=' + someInput + '&callback=?', function(data){…}

and the execution was skipping right over the code in that block, given a response from the server of:
'[{"Error": "Some problem happened"}]'

In the end, the solution was to change the error message from the server from saying “Error” to something else, e.g.:
'[{"Problem": "Some problem happened"}]'

Hope that helps someone out and saves them the 2 hours I just lost. Though I guess I did learn something new!

[Note: this refers to jQuery 1.7.2]