Please join me at my new location bryankyle.com

Monday, November 12, 2012

I've Moved

A few months ago I decided to move my blog over to Tumblr. The choice was made based on the fact that I could easily make link posts as I tend to come across interesting articles during my Internet wanderlust.

In the future, please join me over at my new Internet home: bryankyle.com

Tuesday, August 21, 2012

Universal Command

I used to love emacs. It was a great text editor and while it had a reputation for being somewhat difficult to use when first learning, the amount of stuff you could do with it was jaw dropping. With a piece of software as big and complex as emacs there needs to be some way for users to not only quickly do what they want to do, but also discover things that they didn’t know they could do. Emacs has such a feature. It’s called the minibuffer.

The minibuffer is a small area at the bottom of your editor window that allows you to quickly type in a command to execute. Emacs is essentially a framework built out of small functions that when combined together make an editor. There’s a function for moving forward one letter at a time. There’s a function for moving backwards one word at a time. There’s a function to insert the letter being pressed into the buffer[1]. There’s a function for basically everything you can do with it. Many, but not all of these functions are interactive, meaning they can be executed directly by the user. And these commands can be executed by typing their name into the minibuffer.

For example, to move forward a word you can type M-x forward-char <RET>. That is: press the meta key[2] and the ‘x’ key at the same time. This focuses you on the minibuffer. Type in ‘forward-char’, and hit the return key. This will move the cursor to the next cursor. Trivial example, I know. Obviously moving forward one letter has been bound to the right arrow key so you don’t need to do this, but you get the idea.

One thing I always missed when using other programs was the ability to just tell the program what I wanted to do with the keyboard instead of having to use the mouse. I wanted to be able to tell Pixelmator to duplicate a layer; something that Pixelmator doesn’t have a keyboard shortcut for. Well, OS X actually lets you do this. It’s not exactly the same thing as the minibufer in emacs, but it gets pretty close.

So what exactly is this feature? Well, under the Help menu in every program on OS X there’s a search box. If you type in the name of a menu command into that search box you’re able to arrow down to it and not only will OS X show you where the command is for future reference, but it will also allow you to invoke it by pressing the enter key. Just having the menu isn’t enough though. It needs to be accessible via the keyboard. Good news, it is. Pressing Command-Shift-? will open the Help menu with the Search box highlighted.

This is something I use on a daily basis to get my job done. It’s great for those times when you need to invoke some feature of an application that doesn’t have a keyboard shortcut assigned to it.


  1. In emacs parlance, a buffer is an editor window.  ↩

  2. More emacs parlance here. The meta key means either the escape key, or the left alt or left command key if you’re on a Mac. This is just left overs from the era in which emacs was created.  ↩

Tuesday, July 31, 2012

Locking Your Mac with a Keyboard Shortcut

I like to leave my MacBook Air on most of the time so that I can access it from where ever I go. But with 2 kids running around the house sometimes the keyboard will get stolen or have random keys mashed, the trackpad or mouse will get moved or buttons clicked. With all this entropy and Murphy’s law, the odds are not in my favor. So whenever I get up to leave the machine for extended periods of time I like to lock my screen.

Locking the screen basically just ensures that no one will accidentally delete a bunch of files. In a less secure environment it helps to protect the data that you have on the machine as well.

There are various ways to lock the screen on your Mac. The few ways that most people are familiar with are setting the screen saver timeout to be really low and installing the Keychain Access menubar extra. I’ve found that neither of these approaches really works well for me.

I tend to do a lot of thinking and not a lot of mindless clicking or moving the mouse. Having the screen saver turn on just because I haven’t touched the computer in a while doesn’t work for me. Installing the Keychain Access menubar extra is an option, but locking the screen from it is a hassle since it can’t be done with a keyboard shortcut.

To work around this, I decided to write my own custom OS X Service to start the screen saver. I then assigned a global keyboard shortcut to it, and Behold! A screen saver that turns on whenever I hit a certain key combination. Not a big deal, I know. But it’s the little things that count.

If you’re interested it doing something similar, follow the steps below.

Create a Service

  1. Start Automator.
  2. Create a new Service.
  3. Set the Service to not receive any input and be available in any application.
  4. Add a Run AppleScript Action.
  5. Set the script to be
    on run {input, parameters}
     tell application “System Events”
     start current screen saver
     end tell
     return input
    end run
  6. Save the service as “Lock Screen”.

Assign a Keyboard Shortcut

  1. Open System Preferences.
  2. Open Keyboard.
  3. Select Keyboard Shortcuts.
  4. Select Services from the list on the left.
  5. Scroll to the General section.
  6. Click on the Lock Screen service.
  7. Click on add shortcut.
  8. Assign the shortcut you want, I use Cmd+Opt+Shift+L.

Use it

  1. Invoke the service from the services menu; or
  2. Use the keyboard shortcut

Like a boss.

Monday, July 23, 2012

Matte Screen Protector

As much as I love my iPad, one of the few things I really dislike about it has always been the glossy screen. It looks great but it’s highly susceptible to both finger prints and glare. It was a poor choice for usability, and here’s why.

Touch screen devices are meant to be touched with fingers. Bodies naturally produce oils, so the natural state of your finger is to be slightly oily. Obviously this means that the screen is going to be exposed to lots of oils through normal use. This isn’t so much an issue on devices you put in your pocket like the iPhone or iPod because typically these devices are put into a pocket between uses. The device moving around in your pocket will naturally buff off any oily residue on the screen. This isn’t the case with the larger screened devices though.

The iPad is too big for a pocket, and it’s designed to be used for longer sustained times. So what can be done about the oils that get on the screen for the iPad? Well, there’s the Smart Cover, which buffs some of the oil off of most of the screen and leaves giant lines running down other parts of it.

Another option is to just keep a cleaning rag with you where ever you go. I wear glasses so I tend to have one handy with me anyway. This approach works pretty well. Aside from the fact that you look like a maniac trying to clean your device before using it.

Lastly, you could just learn to get used to it and ignore the prints all over your screen. This appeals to my inner nihilist. It certainly requires less effort than the other options, but if you have any respect for your gadgets you’ll likely steer clear of this one.

The other design concern is that the iPad is designed to be used laying more or less flat on a surface. Guess what’s usually directly above most surfaces that you would put your iPad on? Sources of glare: overhead lights, tall lamps, the sun, etc.

Having such a large reflective surface and pointing it towards source of glare results in poor usability.

Glossy screens do look much more vibrant though. They tend to produce an image that’s much more saturated, than glossy screens. This in turn makes people believe that they’re getting a better product. I know for the longest time I wanted a laptop with a glossy screen. And I do love the glossy screen on my MacBook Air. But a laptop has a totally different usage pattern from iPads.

So, for these reasons I decided to try out a matte iPad screen protector. Now, I’m not the kind of person that likes to put screen protectors on his devices. For the most part I find that screen protectors make the device less usable, come off easily[1], wreak havoc on accessories[2], and in general tend to be a kind of snake oil. I suppose they do protect the screen, but how often do you put items that are likely to scratch your devices right next to them? My guess is: if you care about your device, never. So, this is a screen protector only insofar as its a providing a matte finish on the screen.

In the few days that I’ve had it on I’ve really enjoyed it. Glare is totally gone. Fingerprints and smudges show up. I haven’t tried it outside, but since I never really used the iPad outside in the first place I don’t see it as a big use case for me. Bu the really interesting thing is that it makes the iPad feel new again. I don’t know why this is. I could be just that it looks so much different that it feels new and exciting, or it could be that this is what I always wanted. Time will tell.

If you’ve had issues with glare and oils on your iPad I highly recommend trying out a matte screen protector. I bought a cheap one at Walmart for $12, so it’s not exactly expensive to try it out. Putting the screen protector on can be pretty tricky. I takes lots of time and patience to get it right. Even after an hour or so of applying and re-applying the film I have a few bubbles around the bezel. I’m living with these for the time being. If I find that the matte screen protector is something I want to stick with longer term I’ll fiddle around with it some more.

For those of you looking at applying a screen protector, here are a few tips:

  • Wash your hands really well before working with the film. This will remove dust and excess oil from your hands during applicaton?
  • Clean the screen thoroughly using a screen cleaner and lint-free cloth.
  • Apply the film in an area that has little or no dust in the air. Applying the film in the bathroom after running a hot shower for a few minutes will cause dust in the air to become heavy and fall.
  • Use a pencil with some scotch tape, sticky side out, on it as a “dabber” to remove dust and hair from the screen and film that works its way in during application.
  • Use a credit card to push air bubbles to the sides.
  • Take the time to line up the cut outs before laying down the entire film.
  • Apply the film slowly, no need to rush.
  • Don’t feel as though you need to buy another screen protector if you get lots of dust underneath. Potentially remove the dust particles using the dabber. You only need to replace the film if it gets creased or loses its stickiness.

  1. In the past, I’ve found that screen protectors tend to come off fairly easily if you expose them to an environment that’s constantly rubbing the edges of the protector, pockets for example. If you put a screen protector on, then cover the edges of the screen protector with a case you won’t run into this issue. But you’ll have an abomination of a device.  ↩

  2. Try putting a Glif on an iPhone that has a screen protector on it to see what I mean. The screen protector needs to come off for the Glif to fit.  ↩

Tuesday, April 3, 2012

OmniFocus Mail Rule Now Works with Attachments

OmniFocus comes with a rule that can take a specially formatted email message and transform it into an action. I use this feature running on a Mac Mini to allow me to add actions to OmniFocus from my Windows PC at work.

One things that has always bothered me about it is that it doesn’t do anything with attachments. If you create one of these specially formatted messages and attach a file, you would expect that the attachment would be added to the newly minted action. It doesn’t. I’m sure there are good reasons for it. I can’t claim to know them but suffice it to say I want this functionality , dammit. So I did what any self-respecting geek would do: I rolled up my sleeves and started hacking.

In the end I managed to modify the mail rule that comes bundled with OmniFocus to attach all mail attachments to newly created actions. You can download the modified MailAction.applescript and try it out for yourself.

With this script installed, any mail messages that OmniFocus would normally pick up will also have their attachments added to the OmniFocus action that is created.

Installation

Installing this modified mail rule requires a little bit of hacking on your part.

  1. Locate the OmniFocus.app bundle in your /Applications folder.
  2. Right click on the OmniFocus.app bundle and select Show Package Contents
  3. Navigate from the root of the bundle into Contents/Resources
  4. Locate the file called MailAction.applescript and rename it to OldMailAction.applscript1
  5. Copy the modified MailAction.applescript into the Contents/Resources folder.

If you already have the mail rule set up through OmniFocus the next time the rule gets run the new script will be used.

Thanks

I’d like to thank The OmniGroup for creating such an awesome product, for creating something that’s even remotely hackable, and lastly, for giving me permission to share this with you.


  1. The actual name doesn’t matter here. What’s important is that a backup copy of the file MailAction.applescript is created. In the event that something goes wrong you can just restore this file by renaming it and you’ll be back up and running. ↩

Sunday, April 1, 2012

Byword Review

I’ve been a big fan of Byword for OS X for quite some time. I like how it strives to be simple but still allows you to make your own choices about a few things. When Byword came out for iOS a few weeks ago with iCloud support I thought it would be great. Below are some of the things I’ve found.

Occasional Crashes

In my limited use of Byword for iOS I’ve noticed a few crashes. Nowhere near an Instacast[1] level of crashy-ness, but crashes nonetheless. Crashes aren’t the end of the world, but for an app that feels[2] as simple as Byword it makes me wonder.

Limited Document Management

Overall I’ve found the document management options in Byword for iOS to be lacking. You get to chose up front whether you want to use iCloud or Dropbox syncing. But you can’t have it both ways and simply storing documents on the device is a no go. You can’t swap documents between iCloud and Dropbox on the fly.

On the positive side, conflict resolution is done quite elegantly. Instead of saving both copies to Dropbox and having you sort out the differences a little icon appears next to the file in the list. When you open the file you’re asked if you want to use the local or remote copy. It’s not perfect, and it’s certainly not magic. But it doesn’t leave a mess for the user to clean up, and it doesn’t force you to make a decision until you need to.

Cumbersome Interface

The developers behind Byword have spent a great deal of time stylizing the UI of the application. For the most part it looks really good, but I have a few issues with it. For starters, all of the buttons are custom to suit the color theme of the application. In what I believe is an attempt to make the UI chrome blend away the contrast has been turned way down making the buttons difficult to see and read. Don’t get me wrong, it looks great, but maybe the contrast could get turned up a bit for the next release.

Another issue I have is when attempting to use the application on the iPad with an external keyboard. Opening and selecting a document are pretty easy, but once a document has been selected and you begin editing all of the chrome disappears. There is no visually discernable way of getting to the document selector or showing the title bar to rename the document or preview what you’ve written.

As pointed out by Shawn Blanc in his review, the way around this is to swipe the document from left to right which will bring up the document selector. From there you can either select another document or tap on the title bar which will hide the document selector bringing the document back into focus, but with the title bar visible – until you tap on the text area that is.

Lastly, I tend to do a lot of writing either early in the morning or late at night. In both cases I find that editors with light color schemes to be distracting. Byword for the Mac has both a light and a dark color them which allows me to switch between as needed. The iOS version of Byword only has the light scheme.

Conclusion

Byword is definitely a 1.0 release. There’s certainly room for improvement, but the bones are solid. Despite the problems I’ve noted I keep coming back to Byword over both iA Writer and Writing Kit. In the case of the former I prefer the font selection under Byword even though iA Writer’s document management runs circles around Byword’s. In the case of the latter, I really like how Byword doesn’t spew conflict files all over Dropbox and leave a mess for me to clean up.

Going forward, I’m hoping to see improvements in the areas I’ve noted. Specifically I’d like to see the following issues addressed (in order of importance):

  • Add a dark mode color theme.
  • Fix the UI so that the app can be used efficiently with a bluetooth keyboard.
  • Improve file management to the point where it’s at least on par with iA Writer.
  • Reduce/eliminate crashes.[reduce-crashes-why]

  1. I don’t know if it’s just me, but Instacast crashes on me all the time when downloading new podcasts. It might have something to do with the crappy WiFi that I’m on during the days, or maybe its just an inherent problem with the app. Either way, it shouldn’t crash as much as it does.  ↩

  2. In my mind one of the hallmarks of good design is making something really complicated feel really simple. Hiding complexity means that users don’t have to worry about things. But this only works as long as the abstraction doesn’t leak.  ↩

Saturday, March 24, 2012

What Information Are You Sharing?

The Nest Learning Thermostat looks like a really cool device. I really like its overall design, and the technology behind it is pretty cool too. The amount of innovation in the less-than-sexy thermostat market has been pretty poor up until this point. Yes, yes. I really like the idea of the Nest. But there’s something that bothers me about it. Auto-Away.

The Nest has a feature called Auto-Away that automatically turns down the temperature in your house when it notices that no one is around. How does it do this you might ask?

Nest uses Nest Sense (an exclusive combination of sensors and algorithms) to notice when you’re away and when you come home.

Sounds pretty cool to me.

But consider too that the Nest also allows you to view the state of the thermostat and adjust its settings remotely via a website and mobile app. What would happen if their site was to be hacked? Or your phone stolen? Or your credentials compromised?

Someone without your knowledge would be able to tell if there’s anyone in the house right now. They’d also have access to your heating schedules which could be used to glean information about when you’re usually out of the house. As your house gets smarter, it needs to be extremely careful about to whom its giving details to.

If the information that Nest knows about your house was to fall into the hands of people with bad intent, they would know exactly when you’re not home. “When’s a good time to break into that house?” “I don’t know, check Nest.”

This problem isnt limited to just the Nest. Recently the power company has been installing Smart Meters – a new type of power meter that can wirelessly transmit information about power consumption. The data that it sends out includes how much power has been used, obviously, but also what times of day the power was used at, what sort of load, etc. These meters coupled with power line communications would enable your appliances to tell the power company that they’re in use, or allow the appliances to be shut off remotely.

I know I’m starting to sound like a crank, or one of those crazy people that march around outside of the power company’s offices. I don’t actually believe that we should stop progress because bad things could happen. The point I’m trying to make is that we, as a society, need to be diligent about what information we freely give out to others. So the question is: what information are you sharing?

Wednesday, March 21, 2012

Enough

I recently has the chance to read Patrick Rhone's latest book: Enough. I'm generally not much of a reader these days but I've been following Patrick and his message for quite some time now and when I opportunity came up to review his latest book I jumped at it. I wasn't disappointed.

Enough is very approachable. It's a short book of essays. You could easily get through the entire book in an afternoon, but you'd be missing the point. Enough isn't instructive. Enough isn't prescriptive. Enough is about slowing down and teaching you to be more mindful. Mindful about what you have. Mindful about what you use. Mindful about what you do.

Enough is best enjoyed slowly. It contains a vast amount of wisdom. But in order to unlock that wisdom, it needs to be consumed slowly. Each essay needs to be treated as its own. Savor each one for what it is. And reflect upon it to understand what it means, and how it applies to you.

After reading Enough I find myself trying to slow down; appreciating the things that I would have normally taken for granted. I find myself more critical of the things that attempt to enter my life. I find myself more mindful of how I spend my time, and what I spend my time on. I find myself feeling more in control.

Patrick has done an excellent job taking his message and distilling it into Enough. It's an excellent book. You won't find a book that's more dense with wisdom, thoughfulness, and mindfulness. I cannot recommend this book highly Enough.

Thursday, March 15, 2012

ZAGGfolio Review

When I first saw keyboard docks for tablets I always thought it seemed like a stupid idea. The first one I saw was the iPad Keyboard Dock. It seemed pretty clumsy and riddled with design problems. It was oddly shaped making it hard to pack around; it only supported portrait mode; it was a wired dock making it only useful for the iPad; it was expensive at about $100.

The idea of using a physical keyboard always made a lot of sense to me. Using a physical keyboard was certainly more productive than using the on-screen one. I could touch type just like I was used to. Plus, the physical keyboard doesn’t take up any screen real estate. But it also meant having the cart around 2 devices: the iPad and a keyboard. And if you didn’t have a smart cover you would need a stand of some kind. In the end, for all the sense it made to have a physical keyboard it just seemed like a big hassle to effectively reproduce the laptop experience with a tablet. By the time you add up the cost of all of the accessories you may as well have just bought the laptop.

But this line of thinking is flawed. An iPad with all of these accessories is not the same as a laptop. For one thing the laptop is usually much larger. Full laptops have less battery life. They don’t have touch screens. They don’t have built in 3G connectivity12. They’re less versatile – you can’t leave the keyboard and mouse behind. They allow for more distractions with multiple windows and multi-tasking.

With the advances in OS X Lion a regular laptop can help with focus using full screen apps. But battery life is still a problem. And you have no choice but to cart around the keyboard and trackpad with you where ever you go. The difference between and touch screen and a mouse is huge. The touch screen feels much more intimate and tactile; like you’re interacting directly with the machine. Using a surrogate virtual finger just isn’t the same; it’s less accurate and fiddly.

So, after much pondering I decided to give the ZAGGfolio a try.

The Case

The case has a hard plastic exterior with a soft lining inside to protect the iPad from scratches. When opened and laying flat the keyboard takes up one side while the iPad slides into the other. The case is designed such that both the keyboard and iPad can be removed. During my tests I found it cumbersome to remove the keyboard. More often than not I would end up not having the keyboard properly aligned. In practice the removal of the keyboard is something I can’t imagine anyone doing with much frequency. The iPad on the other hand didn’t have this problem.

Inserting the iPad is very simple; so is removing it. The slide for the iPad is snug, but not so tight that it’s impossible to align it properly. If I had to complain about the snugness of the case I’d say that removing the iPad can be on the difficult side. I like to be very gentle with my iPad so the amount of force I had to use to grip the iPad while pulling it out was too much for me. I noticed that the LCD started showing some pressure effects which made me nervous. In order to remove the iPad I had to hold the iPad at the bezel and push the case off. This is in contrast to the feeling of pulling the iPad out of the case.

When the iPad is in the case all of the external ports and speaker are still available. The volume buttons and mute switch are along the top of the device when it’s open. The home button is halfway up the right side. The headphone jack is safely at the bottom on the left.

Speaking of the headphone jack: the case is has a notch, not a hole for the headphone jack. When I first saw this I didn’t understand what it was for. But after playing around with the case it became clear. Having a notch means that you can open and close the case with your headphones plugged in. If Zagg had chosen to just use a hole for the headphone jack you would have to remove your headphones any time you wanted to open or close the case. Smart.

The Keyboard

With the keyboard out the iPad can be put into it and used as an easel in any orientation: landscape or portrait, upside down or right side up, left or right. In addition to the keyboard’s ability to be used as an easel, the case can also act as a stand so that just the keyboard can be removed and used separately. I haven’t tried this configuration since I don’t see the utility, but it’s nice to know its there if I need it.

As you would expect, the keyboard contains the standard compliment of keys. In addition, there is a line of “function” keys along the top row of the keyboard. These keys give you quick access to all sorts of features. These keys are:

  • Home, to go to the home screen.
  • Spotlight, to go to the spotlight search.
  • Picture Frame, to lock the screen and show a slide show of the photos in your camera roll.
  • Keyboard, to toggle the on-screen keyboard.
  • Cut, Copy and Paste, to do what you’d expect.
  • Previous, Play/Pause, Next, to control media playback.
  • Mute, Volume Up and Volume Down, to control volume.
  • Lock, to turn off the screen and lock the iPad.

The keyboard is smaller than I’m used to. Even so, I found it to be perfectly be usable for anything I needed to type up. Using the external keyboard has been a really great experience. I like having the tactile feedback from a physical keyboard. Plus, having the physical keyboard means that I have more room on screen for the document I’m working on.

I did notice a few strange things with the keyboard layout though. For one, the screen lock key is directly above the backspace (or delete) key. If you mistype a word and need to correct it, you may end up inadvertently locking your screen. Many of the function keys really seemed like a stretch to me. Do I really need special keys dedicated to clipboard functions? If you’ve used a computer at all in the past 30 years you’ll probably be familiar with the standard key combinations for these commands. Do I need a key to turn on the on screen keyboard? Probably not. I bought an external keyboard so that I wouldn’t have to use the on screen one.

Perhaps I’m an outlier, but if I had to chose between having those function keys and having a larger inverted “T” for the arrow keys I would have picked the arrow keys.

Also, the caps lock key doesn’t have an indicator light. I never know if it’s on or off without first typing something. In practice I found this to be more of a nuisance than anything, but it still feels like an omission. My Apple Bluetooth keyboard has an indicator light and it runs on batteries, same as the ZAGG keyboard. Under normal usage, the indicator would only be on a tiny fraction of the amount of time the keyboard is in use.

Battery Life

When I got the ZAGGfolio home I opened the box, put my iPad in and started working with it. I never bothered to give the battery an initial charge; I just started using it with whatever juice came from the factory. In the month or so since I bought it I have yet to charge the keyboard battery. This is par for the course as far as Bluetooth keyboards go. I’m guessing I’ll need to charge the battery sometime in the next few months. But that brings up an interesting point.

The ZAGGfolio, and in fact all of the ZAGG Bluetooth keyboards for the iPad, have an internal, non user serviceable battery. This is a design trade off. On the positive side Zagg is free to design the keyboard however they want. Without any constraints around standard batteries and how the user will have to replace them Zagg was able to make the keyboard slimmer. But this also means that the user can’t replace the batteries when the run out. The user has to charge the device using the provided USB cable instead. The keyboard doesn’t come with a wall wart for charging, so you need to be near something that can charge a USB device.

Luckily, the charging light on the keyboard will flash when there’s about 20% battery remaining which should give enough time to find an outlet.

I thought the ZAGGfolio would be an interesting experiment. I knew it would make typing on the iPad a lot easier and make it more useable as a content creation device. What I didn’t know was how deeply it would affect me. When first using the Zaggfolio with the iPad I would constantly be trying to reach for a pointing device (mouse, trackpad, trackball) when I needed to move the cursor. After a while I got used to using the touch screen. But, after using the ZAGGfolio almost exclusively for a few days going back to the MacBook Air was a little jarring. I’d constantly be trying to reach up and touch the screen to tap on icons to drag things around. After using direct interaction for a short time, using a surrogate seemed crazy, slow, and abstract.

Keyboard Navigation

Unfortunately iOS isn’t designed from the ground up to use external keyboards and all of the interaction baggage they carry along. Specfically missing is the ability to tab between fields in data entry applications. I use OmniFocus to keep track of tasks that need to get done. But I can’t tab between fields when entering new tasks. I have to type, reach up, tap, repeat. It works alright, but it’s certainly not ideal.

Conclusion

I’m still sort of on the fence about the ZAGGfolio. I think it’s an interesting idea and very well executed. I’m just not sure it’s for me. At $100 it’s no small chunk of change. If you’re the kind of person that can get by without a laptop, need the extra versatility that it provides, or someone that travels a lot then you’d be hard pressed to find another accessory that offers what the ZAGGfolio offers.

If you don’t travel often, or are just as comfortable with a laptop then it’s a much harder sell.


  1. Although 3G connectivity isn’t built into every model it’s an option unlike a regular laptop. ↩

  2. It’s true you can get 3G connectivity on a laptop using a MiFi or a Rocket Stick but these are addons. One’s an extra device you need to carry, the other is a USB dongle you have to plug in. Either way these are poor substitutes for built in support. ↩

Monday, February 27, 2012

Converting Shell Scripts into Applications

OS X doesn’t allow shell scripts to run as Login Items. Adding a shell script as a login item causes the script to be opened in an editor; not exactly what I had in mind. Login items need to be applications, but how do you convert a shell script into an application? Easy: Platypus.

Platypus is an open source project that packages up scripts as Mac applications. It works with pretty much any scripting language you can think of. It’s a really simple concept and it works well.

To convert a simple shell script into an application using Platypus you’ll need to follow these steps:

  1. Enter the name of the application you want to generate. This will be the name of the file and what appears in the Finder, so be as descriptive as you need to be.
  2. Select the type of script being wrapped and configure any arguments to the interpreter. If you’re wrapping a shell script you won’t need to do this as the default will work just fine.
  3. Select the path to the script to wrap up as an application either by using the Select button or dragging and dropping the script into the field.
  4. If the script generates output you might want to configure the output format. If there is no output from the application, or you don’t care about the output you can safely select “None”.

There are a bunch of other options such as the icon to use for the generated application, additional files to bundle, etc. Since I wanted my application to be used as a Login Item I wanted it to be as unintrusive as possible. The configuration options for my application were:

  • Set “Output Type” to “None”.
  • Check the “Run with Administrator privileges” checkbox.
  • Check the “Run in background” checkbox.
  • Uncheck the “Remain running after initial execution” checkbox.

Thursday, February 23, 2012

Shell Command to Unmount Volumes

I recently decided that I wanted to have a 2nd installation of OS X laying around for testing purposes. Initially I thought of using VMWare Fusion or something similar. Being that my machine only has 4GB of RAM I didn’t think this would make for the best experience in the world so I discounted it.

The only other option was to either partition my hard drive or use an external drive. External drives are horrendously slow (when compared to the internal SSD of the MacBook Air) and aren’t portable. So partition the hard drive it was. For my own sanity I wanted to keep each of the installations as separate as possible. I really didn’t want each installation to see the other’s data. In a pinch I wrote up a quick shell script that takes care of this problem.

Here’s the script:

#!/usr/bin

mount | grep “/dev/” | grep -v “on / ” | awk ‘{ print $1}’ | xargs -n1 diskutil umount

It’s pretty simple when you break it down into its parts. This single command works because the Unix shell allows the output of one command to become the input for the next. Here’s a breakdown of what’s happening:

The mount command is executed which outputs a bunch of lines, one for each mounted volume. Each line looks similar to the following:

/dev/disk0s2 on / (hfs, local, journaled)

This is saying that the disk /dev/disk0s2 is mounted at the root of the file system, /, with the hfs, local, and journalled options. Of these pieces of information all I really care about is the name of the disk. I really just want to isolate the local disks from other disks and file systems. That’s where the first grep command comes in.

The listing of volume information is used as the input to grep, a program that filters out the lines that don’t match a regular expression. In this case we’re looking for lines that contain /dev/ somewhere on them. This initial processing with grep takes care of all of the non-local volumes. But there’s a problem. The system is booted from a local volume. If that volume isn’t filtered out then there will be problems later on. Likely one of the commands will fail. That’s what the 2nd invocation of grep is for.

The output of the grep command can be inverted so that it will only output lines that do not match a regular expression. Since I wanted the script to be generic, and the device name will be different for each installation I couldn’t filter based on the name. Luckily however, I could just filter out the line that contains the expression on /. The reason I can do that is because the volume that contains the system will always be mounted at the root of the file system. Note here that the expression contains a trailing space; this is important because without it all of the lines would match and therefore there would be no output.

With the output of the mount command successfully trimmed down to just the lines containing local volumes that aren’t the startup volume I can remove the pieces of information from the lines that I don’t care about. Or, to put it more precisely, just output the data I do care about: the device name. Say hello to awk.

The awk command is a handy tool that can perform all sorts of manipulations to its input. awk works well in situations where the data being processed is columnar. In the case of the output of mount the data could be considered as space-separated-values with the device name in the first column. In order to get awk to just print out the first column of each record we use the script { print $1}. If you were to just execute the command pipeline up to the end of the awk command you would see a listing of all of the device names that contain currently mounted volumes that are not the startup volume. The last thing we need to do is unmount them.

There are several ways to unmount volumes on a Mac. I’ve chosen to use the diskutil command but others I’m sure would work fine. One of the shortcomings of the diskutil command is that it will only allow you to pass a single device name to the umount subcommand. It also expects that the device name will be passed on the command line; it won’t read device names from standard input. That’s where the wonderful and magical xargs command comes in.

xargs takes as arguments a the first part of a command to execute. To that it appends the contents of each line that it reads from standard input. By default xargs tries to batch the data into as few commands as possible but since diskutil will only take a single device name at a time the -n1 switch needs to be used. -n1 tells xargs to execute the command for each line.

xargs is an amazing command. It took me a while to get my head wrapped around it but once I did it opened up a world of possibilities. It’s the most complicated piece of the pipeline but it’s also the one that makes it work as a single command. Without xargs I would have had to resort to some kind of a loop and variables. That may be easier to read but it’s certainly less concise.

But this script alone doesn’t solve the problem. It needs to run at login, and that requires a different solution.

Monday, January 23, 2012

Waking Up at 5am to Code: A Response

I recently read a post by Matt Greer titled Waking Up at 5am to code. I’ve been doing something similar for about a year now so I figured I’d post my 2 cents on the matter.

A little background

Quite some time ago I realized that the amount of time I spent working on personal projects had been greatly diminished. I wanted to spend time working on those projects, but during core waking hours my time was tied up with work and family commitments. I needed to spend time at work during the day on week days, I wanted to spend time during the evening and weekends with my family.

Since pretty much all of my waking hours were accounted for I thought I’d try getting up earlier. At first I started getting up at 6:00am. That gave me about an hour or so to get some work done. And it worked well for a while, but life changes and so does the family schedule. As a result I started having to get up even earlier: 5:30am.

Getting up at 5:30am is were I’m at these days. In theory, that gives me a solid 1 1/2 hours to get stuff done in the morning. Reality on the other hand isn’t as optimistic. It usually takes a good 10 minutes for the morning fog to clear. I also have a few small morning chores that need to be done no later than 6:00am. Since I don’t want to interrupt my flow I need to get those done early too; those take an additional 10 minutes. Lastly, in order to make sure everyone is able to get themselves ready and out of the house on time I need to be completely dressed and out of the bathroom (we only have one) by about 7:00am. Figure 15-20 minutes there for the morning routine.

By the time these taxes are paid my gross working time has gone from 1 1/2 hours down to 50-55 minutes. It can be really demotivating to realize that I don’t even have a full hour to get things done. But on the flip side it can also light a fire to make sure everything that needs to get done gets done.

I’ve had some success with my morning routine over the past year. It’s been a rocky road, but for the most part I think I’ve done alright. I haven’t produced much, as my desire to work on side projects comes and goes. Having the time set aside does really help though. I know that I’ll have guaranteed time to work on things that I’d like to. But typically that time is spent reading or relaxing; everyone needs down time, and I find that without that morning time I don’t get enough of it.

For those of you doing this or wanting to do this

Ultimately rearranging your schedule can be a fairly disruptive change in your life. The disruptions for myself have been quite minimal, but you need to make sure that those closest to you understand what you’re doing, why you want to do it, and are on board with it. If they aren’t you might start running into some problems. For those considering this kind of change, here are a few pointers:

  1. If you’re up early, people start assuming that you won’t mind doing things for them. This encroaches massively on personal time and can be a real problem. Saying “No” is vitally important to protecting your few precious hours. That being said you can’t always say no. There will always be times when you have to carve off a piece of those hours as needed; just keep those to a minimum.

  2. Don’t be militant about getting up early every day. Sometimes you need a break. I find myself sleeping in about 1 day a week. It’s a nice treat, just don’t get used to it.

  3. Getting up early also means going to bed earlier. This can be a social problem if you have friends and family that are night owls. Staying up late on their account will only serve to sap your energy for the next morning. Don’t stay up late unless you’re ok with sleeping in the next morning.

  4. Always have a plan for what to do the next morning. If you don’t wake up and know exactly what you need to work on or get accomplished you’ll either not want to get out of bed or get up and zone out. Neither of these is desireable; so make sure you have a plan for the next morning.

  5. Make sure your work area is comfortable. I’m sure this goes without saying, but having a comfortable, and in the winter warm, work place really helps to motivate you to get out of bed. If the bed is warm and comfortable, why would you want to sit in a cold office in an uncomfortable chair?

Saturday, January 21, 2012

Mute Switch Bike Sheds

A few days ago there was a big kerfuffle about the ring/silence switch on the iPhone. People have been coming out of the woodwork with their thoughts and opinions on the matter. Don’t worry. I’m not going to post my thoughts on the issue here. Yes, I have an opinion, but really what I want to highlight is the debate itself. More importantly, I want to discuss why this is such a polarizing issue.

But first, a little background

If you’re reading this post anywhere near the posting date you can safely skip this section.

During a performance of the New York Philharmonic a very distinctly iPhone ring started to play. It continued making noise for quite some time. Finally the conductor had had enough and stopped the performance to confront whomever had their phone ringing. Unbeknownst to the owner, his phone had an alarm that was set to go off during the performance. He didn’t know about the alarm as he was given the phone just prior to the performance and thought he had set the phone to mute.

Due to the design of the iPhone, alarms will sound even if the mute1 switch is turned to off. Pundits and non-pundits alike have been arguing the finer points of the switch and the design over the past few days.

Should the mute switch prevent the device from making any noise, or should it make noise for some select or important events? That’s what everyone seems to be focused on. What I’m interested in is: why does everyone have an opinion on this issue?

Why does everyone and their dog have an opinion?

The mute switch is a bike shed. No, it’s not literally a bike shed, but as a solution to a problem it is. What is a bike shed problem exactly? A bike shed is a problem that’s reasonably well understood by the common person. Since the problem is well understood everyone feels that they are entitled to an opinion on it. In fact, it’s been said that the amount of noise in the decision making process is inversely proportional to the complexity of the problem.

From the definition of a bike shed:

Parkinson shows how you can go in to the board of directors and get approval for building a multi-million or even billion dollar atomic power plant, but if you want to build a bike shed you will be tangled up in endless discussions.

Parkinson explains that this is because an atomic plant is so vast, so expensive and so complicated that people cannot grasp it, and rather than try, they fall back on the assumption that somebody else checked all the details before it got this far. Richard P. Feynmann gives a couple of interesting, and very much to the point, examples relating to Los Alamos in his books.

A bike shed on the other hand. Anyone can build one of those over a weekend, and still have time to watch the game on TV. So no matter how well prepared, no matter how reasonable you are with your proposal, somebody will seize the chance to show that he is doing his job, that he is paying attention, that he is here.

Since everyone has a stake in how the mute switch on the iPhone should work, and the complexity of the problem is low, everyone has an opinion. Those following the debate will point out that the complexity of this problem is anything but low.

It’s a difficult problem with no 100% correct solution. Regardless of the choice made by the designers there would be some class of user that the solution was wrong for. However, that won’t stop people from arguing over what colour this bike shed should be.


  1. I say mute switch because that’s the common term for it. In actuality it’s call the Ring/Silence switch. The difference between the terms is splitting hairs as far as customers are concerned.