My Place

Simple thoughts

RPath and Dylibs a Fustrating Tale

This is the true story of how Dylibs caused me pain, here is the totally unhappy error I got.

dyld: Library not loaded: /usr/local/lib/libct.4.dylib
   Referenced from: Blah blah blah
Reason: image not found

I chased this down for the better part of the hour until coming across some information on install_name_tool, you can find more details about the tool here. To find out the basic command I used with @rpath I used.

install_name_tool -id "@rpath/../Frameworks/libsybdb.5.dylib" libsybdb.5.dylib

Then in my application I had to add the @rpath to the Runtime Search Paths


After I setup all my dylibs like this my application runs once again. Oddly enough my application ran smoothly for a while during development but I did a brew update and I can only guess it wiped out the libraries I was using. I was surprised. Seems somewhat archaic to my day job of Java and .NET. So if for some reason a google search turns up this error and saves someone my pain then it is all worth its.

Smart Alec Bag

Tom Bihn Smart Alec is my current bag of choice. Before that I went with a Saddleback Leather bag that I loved. The Saddleback had so much character, it felts indesctructible but alas it weighed somewhere around 1000 pounds. I finally decided to look for something different, I quickly went to an STM Scout has a in betweener bag for my air. It worked and I still have it for some purposes but it didn’t feel how I wanted it. So I started the search and found rave reviews of Tom Bihn items. So I took the plunge and ordered the Smart Alec along with a brain cell, plus a few odds and ends.

Let me tell you what I carry in my bag

  • 15” Macbook Retina Pro (Horrible name)
  • 320GB Western Digital USB 3.0 Drive
  • Charger with plugbug attachment
  • Micro USB
  • Lightening Cable
  • Apple 30 pin connector
  • 2-3 Notebooks
  • Collection of G2 pens
  • Kindle e-ink reader

Everything fits easily and if I travel I add my iPad, some other connectors and assorted other handy bits. So that if all I have is my backpack I can manage. Everything is easy to get to, I like the fact it does not have 200 spots to put things. Instead it has 6 major parts, two large pockets on each side. On the top is a pair of zippered pockets. The brain cell for the laptop. Finally the main pocket for all the odds and ends. After several months I found a place for everything and now its pretty straight forward.

The zippers are extremely easy to slide, everything feels secure and high quality. I have no major downsides to this bag, its simple well built and effective. It is a bit pricey but then again it protects a 2200 computer.

Final thought. The logo is pretty awesome!

Thoughts on the Mac - Several Years In

I will state this upfront. The Macbook Air 13” is the best computer I have ever owned.

The tech specs and benchmarks and reviews have all been through posted. This is simply for me to write my thoughts and how I use the air. Plus how it has changed some of my habits. I use my air has my primary home computer and for work along with a standard desktop connected by synergy. Beforehand I had an iPad, with a 27” iMac. I used the iMac for any OSX development along with general usage at home. The iMac was excellent but was enormous and I wanted something portable.

Work and Home

To facilitate home and work, I use two different accounts that use Dropbox for sharing. Anything important goes into Dropbox and I use it for quick sharing between them, it is actually quicker and easier to use this than standard samba folders. Most of my time at work is spent in Apple Mail, Office Lync and emacs. It is unknown if the SSD or Apple Mail is to credit, but it is 10x faster than Outlook at searching. Even faster than my previous love alpine, I would still be using alpine if it handled html and images. At home I have an app that is a few thousand lines of code, that compiles in under 30 seconds. Suffice to say it performs well.

Storage & Weight

I was worried about storage and in hindsight wish I had opted for the 256GB option. I am just shy of 40GB free with most of my photos and virtual machines on an external hard drive. It is workable but I would suggest if this will be your primary laptop get the most storage you can afford. Weight…is amazing! I was using a wonderful Saddleback Leather Messenger, the downside was my cheap STM messenger bag, external hard drive, charger, cables and air weighed less than the Saddleback Bag alone. It also is built sturdy so I can throw the bag around a bit and have no problem. I do not like babying my hardware, nor do I abuse it but I run my laptop, ipad and iphone naked.

Long Term Problems

For the love of all that is holy Apple, radius all the edges. I wish the lines were a bit softer. The keyboard is alright but I am a keyboard junkie and it is simply usable. Thought to be fair it is better than almost any other laptop out there. Unknown on the SSD lifespan, I am pretty religious about backups since I don’t trust SSDs. Lack of good reasonably priced thunderbolt peripherals, I really want to use thunderbolt more but nothing is out that seems reasonable. Support for two external monitors, I really want to use two monitors but other than hacky solutions this is impossible.

Behold the Macbook Air

Review One Week In

I have had the Air for a little less than a week. To sum it up in one quick statement, The best computer I have ever used. Now for a longer explanation. I bought the lowest end 13.3” Macbook Air. I debated over a 256gb i7 version but wanted to limit myself some. Sounds odd, but I wanted to limit myself somewhat.

I had been drooling over an Air for a year now but couldn’t pull the trigger with a Core 2 Duo, that all changed when the Sandy Bridge came out. But your not here to listen to my wants for buying something.

Buy it, it’s fast. Feels faster than my iMac 27” at least in normal use. Applications open with a flick of the keys and the computer is light and makes an excellent road warrior. Would I use it to rip videos, no, the iMac handles that much better, if I needed to I would have no problem in using it to do so.

Is 128gb useful? After installing all the basic software, iWork, emacs, Xcode, textmate, text expander and a few other items I have almost 80gb left which should be enough.

Quick and Dirty on Blocks in Objective-C

Update 2011-06-16 I noticed I have a memory leak with the callback, updated to fix that issue

I have been coding for a few months now and in the past few weeks found blocks, I found them extremely useful given the asynchronous nature of my code. Attached is a very simple Xcode project that shows how to use blocks. Some quick observations before we dive in.

  • Always use typedefs when defining the block definitions
  • When using blocks for callbacks, ensure you consider the tradeoffs between using a delegate instead A delegate allows you to get information from the ‘parent’, you could with a block but its a bit clunky A delegate is better when you have lots of communication going back and forth, when I use a callback I generally supply a done and an error callback.
  • If storing a callback you need to COPY from the original callback and then release your local copy of the callback, this is because generally callbacks are stored on the stack, when you copy they go on the heap like most other objective-c objects
  • I have only been using blocks for a few weeks so take anything I say with a grain of salt and be sure to read the original Apple documentation and other resources on the web

I fear the actual code is somewhat unimpressive, I typedef the callback and it takes one parameter, an int telling it how long it waited.

#import <Foundation/Foundation.h>
typedef void (^KORCallback)(int wait);
@interface KORBlocks : NSObject 
    KORCallback callback_;
-(id) initWithCallback:(KORCallback) callback;
-(void) startExecutingAsyncAction;

Here is the implementation, nothing fancy, notice the copy on the initWithCallback command, and then we just use GCD (dispatch_async) commands to execute the commands, using GCD and blocks gives programs a nice way to handle multithreaded programs, this keeps your UI responsive and makes the users happy.

@implementation KORBlocks

-(id) initWithCallback:(KORCallback) callback
    self = [super init];
    //This is important that you copy the callback, when it comes down to you it is most likely
    //  stack alloced and calling copy moves it to the heap, also note you need to release it in the dealloc
    callback_ = [callback copy];
    return self;

-(void) dealloc

    [callback_ release];
    [super dealloc];

-(void) startExecutingAsyncAction
    //Start sleeping on another Queue when that is done call the callback on the main gui thread
    dispatch_async(dispatch_get_global_queue(0,0), ^(void)
        int r = arc4random() % 10;
        //Sleep for r seconds then call the callback on the main thread
        [NSThread sleepForTimeInterval:r]; 
        dispatch_async(dispatch_get_main_queue(), ^(void)
               [callback_ release]
               callback_ = nil;


Images of the project in action


You can find the latest at this url Block Examples

Blocks Zip Download

Great Tools: Pandora

Ok, it is not a real productivity tool in the traditional sense

Other than having Alpine and emacs open 90% of the time Pandora is the app that is open 90% of the time. What is Pandora? Pandora is a streaming, learning music program. You initially feed it an artist or song or genre and it starts playing similar titles, you can like or not like a title and it will change what it plays based on all sorts of magic algorithms.

Why Pandora over local music?

All through HS and college I was mostly a heavy metal fan with a few outbursts but I find as I get older I am tending to a larger variety of music. Even though Cold is still my favorite band for historical reasons that don’t make sense! Plus I find myself cutting my MP3 collection to around 5-6 gigs, music that is core to me and not all the one off CDs I bought when OnCue was going out of business. I found I needed variety, and something beyond my normal tastes. For instance on my Raconteurs list it is playing a new track, “Say Yes” by Wax Tailor, never heard it but really digging it at the moment. My local music after a few weeks of a new album begins to feel stale, but Pandora always has something new and enticing.

It is always there for you!

When work was an hour away I had XM radio which was great, local radio for the most part sucks and XM back in the day had lots of good stuff. But now with my iPhone going everywhere and having decent cell connection I can carry music in my pocket for the road. Switching tracks sometimes takes a few seconds but its easy on long road tracks to hook up the iPhone to the car hit Pandora and have good music cross country. I don’t know how radio will live in the future with such services!

A issue I have

I have an issue with the desktop client though, firstly it is Adobe Air which means it pops up that it needs to update at least once a week and two it behaves in some non osx fashion. I wish they would come up with a native client for OSX and windows, would make my life happier.

Should you use it? Yes!

Why should you use it? First its free, I paid for it for no ads and to support something I love. Secondly it allows one to broaden ones music choices, plus its fun to experiment with, I have a Lady Gaga channel I started for the fun of it, after over a year of pruning it now plays anything from Regina Spektor to Ben Harper to Kayne West.

SQL Server Aliases

At work we have several hundred SQL server instances, about a month ago we moved from the reasonable DATACENTER+SERVERNUMBER\AGENCYNAME style to asdfhjasklsdfasdf, or some close approximation. After spending a few minutes dealing with this atrocity of having to type 31l1 and typing 311 about 5 times I decided there had to be a better way. I tried hosts and it worked BUT had problems with instances. So then I read about this little used program, cliconfg that lets you set a local alias.

So here is a start to setup such a thing on Win7 64 bit, I think 32 bit uses a different reg path, create a reg file and put this in that file putting as many aliases as you want one per line.

Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer\Client\SuperSocketNetLib cp]



After you do this you can just use DEV has an alias to point to a specific instance, I have shared it with coworkers and its been a big hit.