Tech Talk: Learning New Tricks, My Mac Experience (Developer Edition)

Developers at The Nerdery have a lot of choices to make when they start their new job. Although having a dozen different types of cereal in the cafeteria to choose from seems like a big decision to make, it rarely impacts their work performance. Each employee has a decision to make over their choice of workstation and development tools.

Scott Carpenter shares his experience when he joined the ranks of code-ninjas here at The Nerdery and how he made a very adventurous choice to “try something new”.

Learning New Tricks, My Mac Experience
by Scott Carpenter

An email from The Nerdery after I accepted the job:

“Let us know what you want to use, Mac or PC, and what software you’ll need so we can have everything ready when you start.”

Not entirely unexpected, and this is as it should be, but, what a refreshing statement! It told me, you’ll have some freedom of choice here. (Unlike the scenario where you’re not even allowed to set your browser’s home page, which has happened to me and was less than empowering.)

Well, what did I want to use? I’ve used Windows since slightly before Win 95 launched, and at home, exlusively GNU/Linux since 2008. I’m comfortable and productive with both, and was aware that Ubuntu might even have been a valid choice, but I thought: maybe it’s time to see what this Mac business is all about. Macs have good hardware and are pretty. And they have Unix under the hood, right? Okay then.

I had some doubts on my first day when I realized, I don’t know how to use this computer. This is a building full of smart people, and I’m new, and I don’t even know how to use my machine. But a computer is a computer. You know what you should be able to do; you just have to find out how to do it on this weird fruity machine. Luckily there is this thing called The Google, and there were my fellow Mac-using newbs to help me with things like finding the power button.

So what happens when you start using a Mac? I’m going to focus on a couple of keyboard-related problems you’ll run into immediately, especially if you’re a developer that uses the keyboard a lot, and you spend a lot of time in various editing windows. I’ll give you a couple of sanity-saving and life-improving tips.

But first we should talk about balance. In particular, when configuring a machine, whether hardware or software. I’ve learned there’s something to be said for accepting the defaults when possible. It simplifies your life and saves time by reducing the endless customization you’ll tend to do.

But then again, tinkering is fun. And we’re all different. It’s not just about how Steve wanted you to use a computer. It’s also about your needs, and your feelings. Instead of saying, “You shouldn’t want to do that,” or asking, “If you want it to work like Windows, why don’t you use windows?”, let’s fix the glitch.

The first thing is fairly simple, having to do with this strange “command” key. There is a control key on the outside left and right positions on a Mac keyboard, as is proper, but it’s not like the control key you know. Instead, the peculiar “command” button has usurped most of its power.

This turns out to be okay. Many of the key combos you’re used to work just fine with command. But. It’s in the wrong place. So the first thing you’ll want to do is swap the command and control buttons in “System Preferences… > Keyboard > Modifier Keys…”

It may be helpful at first to re-label the keys to remind you of the change:

mac keyboard with labels on alt and cntrl keys
This developer’s properly configured and labeled Mac keyboard.

(We’ll pause for a moment to allow for weeping from native Mac users.)

The next thing we’ll fix is the atrocious behavior of the “home” and “end” keys.

By default, the home key will scroll to the top of your document, but leave the cursor wherever it’s at. End will likewise scroll to the end. This is completely unacceptable. Here is what our fingers have been trained to use:

Home Move cursor to beginning of current line.
End Move cursor to end of current line.
Shift + Home Select text from cursor to beginning of line.
Shift + End Select text from cursor to end of line.
Ctrl + Home Move cursor to beginning of document.
Ctrl + End Move cursor to end of document.
Shift + Ctrl + Home Select text from cursor to beginning of document.
Shift + Ctrl + End Select text from cursor to end of document.

I found a nice solution, which I’ve extended after a bit more research. I like this method because it doesn’t require a third-party program, and it can be set per user.

You’ll need to edit the default key bindings file:

~/Library/KeyBindings/DefaultKeyBinding.dict

On my machine, the KeyBindings dir and the DefaultKeyBinding.dict didn’t exist, so I just created them. Add the entries below:

{
    /* Remap Home / End to Appropriate Behavior */
    /* Home */
    "\UF729"   = "moveToBeginningOfLine:";
    /* End  */
    "\UF72B"   = "moveToEndOfLine:";
    /* Shift + Home */
    "$\UF729"  = "moveToBeginningOfLineAndModifySelection:";
    /* Shift + End  */
    "$\UF72B"  = "moveToEndOfLineAndModifySelection:";
    /* Cmd + Home */
    "@\UF729"  = "moveToBeginningOfDocument:";
    /* Cmd + End  */
    "@\UF72B"  = "moveToEndOfDocument:";
    /* Shift + Cmd + Home */
    "@$\UF729" = "moveToBeginningOfDocumentAndModifySelection:";
    /* Shift + Cmd + End  */
    "@$\UF72B" = "moveToEndOfDocumentAndModifySelection:";
}

(Note that we’re using the command key in place of control, since we moved it to the correct position on the outside.)

You’ll need to restart an open application to use the new bindings in that app, and it doesn’t work in all applications. For example, it doesn’t work in the built-in Terminal program, but in there, you can go to “Preferences > Settings > Keyboard” and set home = \\033OH and end = \\033OF. (Make action = “send string to shell:”)

Side note: In Terminal, the command key doesn’t assume the control key’s duties. Your fingers will often forget this, pressing Command (AKA pseudo-Control) + C or D, and you’ll wonder why your program doesn’t stop.

Bonus tip: Your fingers also may want to use Ctrl + arrow keys to move left and right one word at a time, and also to use “shift” to select the words. For that:

    /* Cmd + Left */
    "@\UF702"  = "moveWordBackward:";
    /* Cmd + Right */
    "@\UF703"  = "moveWordForward:";
    /* Shift + Cmd + Left */
    "@$\UF702" = "moveWordBackwardAndModifySelection:";
    /* Shift + Cmd + Right */
    "@$\UF703" = "moveWordForwardAndModifySelection:";

(Again with Cmd because we’ve moved it into the Ctrl spot.)

More useful info here.

I also spent time learning new habits and adjusting to “what is,” but these changes to “what should be” helped me feel much more comfortable in the new environment, along with getting a proper ergonomic keyboard and trackball:

Complete computer setup with dual monitor
Now we're iComputing!

It’s been a lot of fun. OS X is built on Unix, and you can be happy “doing it wrong” by hanging out in the ugly and gross command line underworld. I found myself wanting to keep learning and playing with my new toy at home over the weekend. I missed it. It’s a beautiful machine, and I love to learn and explore new things. I suddenly realized I was looking at the price of new iMacs. I kinda want one for home, too.

Steve’s revenge!

Scott Carpenter was first introduced to programming in 1981 when Scott’s dad, an electrical engineer, gave him his first computer to encourage his interest in programming. It worked – in 1998 Scott graduated from St. Cloud State University with his Bachelor of Science in business computer information systems. Scott went on to work for Cargill for 15 years as a software developer where he focused on application integration, integration design and development. In 2013, Scott’s journey brought him to The Nerdery where he puts his technical expertise to use as a PHP, WordPress and Java developer.

What Apple’s win over Samsung means

The Atlantic has a nice, succinct round-up of reactions to the Apple v. Samsung verdict that came out last week.

In the post they distill all the reactions and supply the pertinent quotes about what the verdict means to you, design, technology, Android, Microsoft, and a few others. With hundreds of thousands of pixels spilled about this case, The Atlantic’s piece might be the only one you need to read.

How a Wired Reporter was hacked using his Apple & Amazon accounts

We all have our weaknesses. Some people can’t resist the pull of bad reality television. Some are weak in the face of a Lifetime TV movie. Me? I am incapable of skipping past a devastating account of hacking. The kind of hacking that strikes fear in the hearts of people and involves losing precious, sentimental digital ephemera — photos, notes, etc.

This is exactly what happened to Wired writer, Mat Honan, who was hacked and lost everything. Honan recounts how the hackers got into all his accounts using his Apple ID, Gmail, and information from Amazon. It’s a great, horrifying read that will either put fear in your heart or make you feel super smug for being so savvy with all your accounts.

“I’m angry that Amazon makes it so remarkably easy to allow someone into your account, which has obvious financial consequences. And then there’s Apple. I bought into the Apple account system originally to buy songs at 99 cents a pop, and over the years that same ID has evolved into a single point of entry that controls my phones, tablets, computers and data-driven life. With this AppleID, someone can make thousands of dollars of purchases in an instant, or do damage at a cost that you can’t put a price on.”

Primer Notes: WWDC ’12 Recap

The inside scoop on ‘Think Different’

If you have a little time (and tolerance for clunky writing) go read Forbes’ The real story behind Apple’s ‘Think Different campaign. The piece is written by Rob Siltanen who was the creative director & managing partner at TBWA/Chiat/Day. He not only pitched ‘Think Different,” but also wrote the rough draft of the script that became the iconic commercial.

“When the ‘Think Different’ campaign launched, Apple immediately felt the boost despite having no significant new products. Within 12 months, Apple’s stock price tripled.”

Wednesday Links: Because it’s a holiday week

Remembering Steve

Apple is sharing some of the more than one million memories, condolences and thoughts emailed to rememberingsteve@apple.com. It’s a sweet and moving tribute to the Apple founder.

Mac fanboy/girl or not, the story of the fake Apple store is funny

Sure, sure, I the big news about Apple today is about OS X Lion. You can skip right on over to Ars Technica for a ridiculously exhaustive and (incredibly long) review of the new OS. Or maybe it’s the minor hubbub about MacBooks being discontinued. While not the biggest Apple new today, the story about the fake Apple store in China is definitely the best. The sham is pretty good and the pictures are astounding.

Lions, iClouds, and new notifications, Oh My!

Did you miss the Keynote from WWDC 2011? Don’t worry, you can watch it on Apple’s website If you just want to get to the good stuff without all the hand-clapping and hooha, Engadet has all the details on iOS 5 including: new notifications, the volume up button now works as a camera shutter button, and cable-less synching and Gizmodo has the lowdown on what’s new in OSX Lion including: Airdrop (which is already dubbed the ‘dropbox killer’), Mission Control, and Launchpad (which has absolutely nothing to do with Launchpad McQuack).

This whole iCloud business looks pretty slick though I had my fingers-crossed for a new iTunes. What are you looking forward to? Or did this keynote just put you to sleep?

Rapid Reaction: iPad 2 announcement

If you haven’t been glued to your tech twitter feed, blog feed, live stream from engadget or Macworld, Apple released details of the iPad 2 starting at noon CST. While the next 9 days until the March 11 release date will be covering all the great new tech specs, a couple things stood out to us.

The numbers
Apple usually starts these presentations with a hearty pat on the back for themselves where they state numbers, tell you how magical the products are, and occasionally diss the competition (there was more than one dig at Android tablets). A couple telling stats were that 100 million iPhones have been sold and 15 million iPads have been sold. Add that to the fall 2010 estimate that 45 million iPod touches have been sold and you have over 160 million iOS devices in the hands of consumers. Regardless of your opinion Flash, an audience of 160 million is too big to ignore. You don’t have to abandon Flash – it adds a lot of great value to websites – but it’d be wise to start having alternative content for those without it.

Android phone sales have been no slouch either, and Google is doing great things. This begs the question, “Does your website work on these mobile devices?” Here at The Nerdery we are well equipped to do HTML5 targeted websites and mobile targeted websites, and we want to help.

The iPad 2
The iPad 2 is 33% thinner, has a dual core processor that is twice as fast, 9x faster graphics performance, and has video cameras. You can read up on all the tech specs at http://www.apple.com/iPad. One of the things that really stood out is the HDMI out and video mirroring. We’ve done presentation apps here at The Nerdery which allowed sales representatives to give very interactive presentations at conference booths or even in smaller settings. Getting video out has always been difficult to say the least. Now, with the iPad 2, you can have a monitor mirroring everything for you so potential customers can ooo and ahhhh at your next great app that is displayed on a projector or HDTV.

In terms of utilizing the full, unbridled power of the iPad 2, we’ve  got your back. When The Nerdery went to WWDC in 2010 and the Apple engineers said, “You should really adopt these certain programming practices. We can’t say why, but just do it.” We listened. We always follow the best and recommended practices in programming, and we’re ready to hit the ground running. Apps we’ve built in the past should run faster, and apps going forwards will be faster as well.

iOS 4.3
Apple also rolled out a peek of iOS 4.3. We’ve had several devices running iOS 4.3 here for what seems like ages. We’re ready for the new iOS and are comfortable with all the new changes and fixes in this build. One thing to note is Airplay. Take the scenario where, on your new, important, client site, you have a HTML5 video embedded. A user comes along, sees the video, and wants to AirPlay it to their HDTV to show off your cool important client site video to their friends and family. We have the know-how to make this happen.

While the iPad 2 is cool, and lots of new things are coming, it doesn’t flap us unflappable, unstumpable Nerds. We’re always on the cutting edge and we’re ready to help you out.