Sunday, July 5, 2009

Quote of the Day

"what makes me such a lousy programmer is that i can excuse anything by saying this isn’t so bad— i myself am a much bigger hack than this."

-_why

Wednesday, April 1, 2009

Binding an NSTableView Column to NSUserDefaults

I did this a year ago, and didn't need to do it again until now. For some reason even though I had the example of my previous project, it still took me several hours to figure out how to do it again. There don't seem to be any straight forward explanations of how to do this (presumably) extremely common task so here's what I did:

  1. Drag an NSTableView onto an NSWindow.
  2. Go to the bindings tab in Inspector for the NSTableView.
  3. Under the "Content" heading, check the "Bind to" box. The following drop down should already be set to "Shared User Defaults Controller."
  4. Enter the key name of the user defaults setting you wish to map the table column to. For example, "people."
  5. Go to the bindings for the column.
  6. Under the value heading, check the 'Bind to' box. Again, the following drop down should already be set to "Shared User Defaults Controller."
  7. Enter the same key name you entered for the NSTableView ("people").
Now to test this out, you can register some defaults during your app's initialization. Here's some example code:

NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
[dictionary setObject:[NSArray arrayWithObjects:@"alice", @"bob", @"jimmy", nil] forKey:@"people"];
[defaults registerDefaults:dictionary];
If you run into any issues with this example, please let me know and I will revise it to make sure it is more clear.

Wednesday, February 25, 2009

Quote of the Day

"The key to performance is elegance, not battalions of special cases."

-McIlroy and Bentley

Saturday, January 31, 2009

One day...

you will wake up and write a DSL.

Saturday, January 3, 2009

Mesonychid--ancestor to modern sea mammals.


Sent via Wikipanion
http://en.wikipedia.org/wiki/Mesonychid
 
Hooved predator.
 
Sent from my iPhone

Posted via email from awt's posterous

Tuesday, December 9, 2008

Quote of the Day


"Question the Heroic."

-Brian Eno

Friday, December 5, 2008

Quote of the Day

With XP, constant refactoring (i.e. constant tinkering and redesigning of your code) is supposedly possible because the automated tests will catch out any problems. That is, the tests will catch out all the bugs that have been thought of in advance, but no others. Last time I checked, most bugs are due to things that the programmer had not thought of.