Double-Checked Locking and Objective-C

A common problem in software is to do something exactly once – e.g. create a singleton.  A corollary of that action is to do something exactly once in the life of an instance.  I have found myself using the corollary much more frequently as I move away from using singletons, which I’ve done to improve [...]

Continue Reading...

Rolling a Ruby gem back to a previous version

I ran into a problem with the Ruby gem for a tool I use recently when I installed the latest version and then found it was broken.  I wanted to roll back to the previous version, which turns out to be extremely simple.  Here is the command I used and the responses I received:

> sudo [...]

Continue Reading...

CocoaConf 2013 in San Jose

Last weekend I attended CocoaConf in San Jose.  CocoaConf is a technical conference for developers working iOS or Mac OS X.  Workshops and sessions are taught by form Apple developers and important developers in the industry, many of whom have written books.  It was a great conference, both for the content and for the opportunity [...]

Continue Reading...

Mac App: Ejector

Does this ever happen to you?  You download a DMG file to install an application, mount it, then install the app.  At that point you go on your way and forget about the mounted image.  Or how about you have connected an external drive or a flash drive and you can’t get to your desktop [...]

Continue Reading...

Sorting Objective C Import Directives

I know I’m a bit obsessive compulsive, but I’m rather fastidious about how I organize #import statements in alphabetical order at the top of my Objective C files.  If I’m creating and maintaining the file myself, it’s not so bad, but when I work on an existing file it’s a lot more work.  Wouldn’t it [...]

Continue Reading...

Hidden Menu Bar Apps

If you’ve used OS X for any length of time, at some point you’ll probably find yourself in the situation where you can’t get to the icon for an app on the menu bar, particularly if you are using a machine with a small screen (MacBook Air or Pro 13) or you use a projector [...]

Continue Reading...

ARC weak references on iOS 4

I’m finally exploring ARC (Automatic Reference Counting) for development on iOS 4 and above.  Mike Ash provides a terrific introduction to ARC along with some pitfalls.
One of the pitfalls of using ARC is that weak references (aka zeroing weak references) are not supported on iOS 4 or on Snow Leopard.  You could use Mike’s MKZeroingWeakRef [...]

Continue Reading...

Mac Mail and ReplyWithHeaders

I’ve been using Microsoft Outlook 2011 on Mac OS X for a couple years and I finally decided I needed to give Mac Mail and iCal a try.  In Lion (Mac OS X 10.7), Mac Mail has added some great features, but one thing it is missing is including the headers of the original message [...]

Continue Reading...

Folding code in Xcode

A colleague of mine has the practice of collapsing all the methods in an Objective C file when he loads it to simplify finding the right method to view. When I asked him how he did it, he couldn’t remember since it was an automatic action. I finally got around to figuring out [...]

Continue Reading...

Mac Utility: Save

I’ve been enjoying my switch from Windows to Mac.  However just like Windows, Mac OS X has its quirks and irritations.  There are some very nice changes in 10.7 (Lion) to window management, but one thing missing is to restore window positions and sizes when switching between a single monitor and multiple monitors.
The Stay utility [...]

Continue Reading...