Untitled 1
Some helpful macros for object creation
I was building “one to throw away” recently; specifically to play around with NSOutlineView like the easily chokable, lead paint coated Chinese toy it is. I needed to generate a quick and dirty static model so I’d have some data to display. I got really tired of typing [NSDictionary dictionaryWithBlahDeBlahBlahBlah... So I wrote these three macros:
#define NSDICT(...) [NSDictionary dictionaryWithObjectsAndKeys: __VA_ARGS__, nil]
#define NSARRAY(...) [NSArray arrayWithObjects: __VA_ARGS__, nil]
#define NSBOOL(_X_) ((_X_) ? (id)kCFBooleanTrue : (id)kCFBooleanFalse)
Two of them use GCC C99 macro extensions [Thanks to Peter H for the correction -Ed.] to allow variadic arguments in macros, but otherwise they should be kosher. Thanks to Jason H for a better NSBOOL (now with zero object allocations!). Here’s an example of usage:
NSArray *items = NSARRAY(NSDICT(@"Hello World!", @"title",
[NSImage imageNamed:@"worldHello"], @"icon",
NSBOOL(YES), @"isAwesome"),
NSDICT(@"Good Bye, World!", @"title",
[NSImage imageNamed:@"winkyfrownyface"], @"icon",
NSBOOL(NO), @"isAwesome"));
Enjoy!
p.s. I’m making what looks like progress on recovering my old domain name. WATCH THIS SPACE. Omgz.
Starting over?
So my blog over at iamthewalr.us has been hijacked by a domain squatter. It’s a long story involving a vindictive and inattentive registrar 1and1.com and is really beside the point.
I’m attempting to recover the domain but it’s looking unlikely that that will happen. I’ve registered another domain and it’s possible I’ll start over using tumblr, or maybe move my old blog over to the new domain, or maybe…
As you can see, there are myriad choices sitting right at my feet. Something like this is in really uprooting for anyone, especially me, and is a lot to take in right away. This is a partial explanation for why I’ve been so silent about this. The other part is laziness.
There is good news though, cool things in the works, consulting companies being formed, you know, every day stuff, how’s the weather? Things are finally starting to come together on that front, it’s very exciting I assure you.
What the fuck.
curl —basic —user “username:password” —data-ascii “status=`echo $@|tr ’ ’ ‘+’`” “http://twitter.com/statuses/update.json”
I’m pretty excited.
Except about Linux. blah blah penguins blah blah freedom.

