« July 2007 | Main | October 2007 »
PSIG 106 | NSToolbar
Monday, August 6, 2007
(What is PSIG? | PSIG 106 announcement)
Items of Interest
- My Startup Life: What a (Very) Young CEO Learned on His Journey Through Silicon Valley -- We're informed the teen author manages to make himself sound like a 40-year-old what with the dry writing and needless mention of shoehorns :)
- Getting Things Done: The Art of Stress-Free Productivity -- I claim I am henceforth living David Allen's principles. We'll see how it goes!
- Sickert: the painter and his circle -- The story of Walter Sickert, an English Impressionist painter with some newly revealed connections to Jack the Ripper
- Nothing Sacred -- Autobiography of comedian Lewis Black
- Collapse: How Societies Choose to Fail or Succeed -- By the same guy who wrote Guns, Germs, and Steel
- iFuntastic -- Make yer own iPhone ringtones
- Paul on the Xserve, Mini, iMac: "But aren't we so pregnant for a bunch of upgrades?"
- Steve entertains us with crazy stories from his awesome IT job at O'Hare. He also gets me curious about wxPython and the way you can use XML to define GUI with XRC. Most intriguing -- he predicts that the problem of computer viruses will grow hugely in the future, saying that crackers are most certainly in info-collection mode at the moment.
- The meeting ends with the sharing of nasty-food/bug/pyromanic stories!
NSToolbar
Great presentation by Dave and El Wolfo involving a cowboy hat, a gaucho hat, methods named "spanishize" that define anything starting with "El " as Spanish, and oh -- we got to see some live debugging ;). Summary:
Currently, Interface Builder doesn't help you create toolbars, so you either have to do it in code or use Belkadan's GenericToolbar palette.
Doing it in code: After allocating your toolbar, initialize it with a unique identifier (initWithIdentifier) so that Cocoa can automatically remember user customizations to the toolbar. You'll also have to set setAutosavesConfiguration: and setAllowsUserCustomization: to YES. Once you've created and set the delegate, tell your window to setToolbar:toolbar.
There are four basic methods you need to manage your toolbar:
- -toolbarDefaultItemIdentifiers: Specify default toolbar items. Remember to avoid name collision with Apple's standard items
- -toolbarAllowedItemIdentifiers: Choose which of Apple's standard items to allow. By default none of them are allowed
- -toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: Returns toolbar items as specified by the identifier
- -validateToolbarItem: Called on every toolbar item. The target and action must be set and responsive for this to work
GenericToolbar is the non-code alternative: It has a nice drag/drop interface for adding and removing items as well as hooking up items to your controllers. It doesn't work very well with bindings, so it's better to do those in code.

Thanks to Gruber for the great wwdc photo upon which this is based
C4[1] this weekend!
Ok, I think this is the most excited I've ever been about a tech event. I can't wait for the sessions and I'm hugely looking forward to meeting everybody. I'm actually going to be manning the registration booth so I'll at least get to greet everyone :)
Hay -- anybody out there have an idea for Iron Coder that could use my help? I'm pretty psyched about the announced "API" because it would seem I could easily make use of my art/design/webcode-fu, but I'm not coming up with any ideas...

PSIG 105 | Dissasembling on OS X
Thursday, August 2, 2007
(What is PSIG? | PSIG 105 announcement)
Items of Interest
- AJAX Design Patterns
- Mind Performance Hacks
- The Four-Minute Mile
- Million and one nights
- Endless universe
- Pangea Software's Ultimate Game Programming Guide for Mac OS X
- Mac OS X Internals
- Four members showed up with iPhones. There was a large amount of quality iPhone discussion during which I seem to have zoned out. hehe
- We took a brief critical look at Leopard, particularly at how wrong the dock looks when it's on the side, and how the icons unfortunately bounce with their shadows attached.
- WWDC 2007: It seems that this year's was essentially a repeat of last year's.
- HOPL III: "We're still so primitive."
Dissasembling on OS X
Why disassemble?
- To work around bugs
- To learn more about areas where the docs are out-of-date, incomplete, or intentionally missing
- To find ways to interoperate with other software, such as when implementing file format compatibility/interchange or breaking into proprietary tool-chains
Static tools: Hex editors
- OS X ships with three utilities for hex dumping: hexdump, od, and xxd
- HexEdit is one of the oldest mac open source apps, originally created for system 7
- HexFiend is a newer open source Cocoa hex editor with more features
Static tools: General level
- file tells you what kind of file something is, including all the architecture versions
- strings looks in binaries to see if anything's human-readable. Use with standard input, or it'll only look into the version of the file with the same architecture as your system
Static tools: Code
- Otool understands the Mach-O binary format and can tell you an app's dependencies. Apps linking to private frameworks involve Apple's undocumented stuff. Wolf: "It used to be that all the cool stuff was in the private frameworks. The last of the cool stuff pretty much went public by 10.4. So the hunt isn't there anymore."
- otx does enhancements on Otool's output. It intermixes the raw outcodes into the disassembly in case you want to inject your own instructions. You can follow along and see what strings are being referenced. The tool also detects and works around some obfuscation techniques.
- classdump is another tool for dumping Mach-O code. Trivia: AppKit appears to contain a class called NSEvilHacks.
- MagicHat, a recently open-sourced tool, is like classdump except with a hyper-linked interface. You can specify which frameworks you care about. Wolf uses key-value coding to pull out undocumented methods.
- Interface Builder can open up nibs and let you see names in the targets and actions. Make a copy of the app first because IB may leave some stuff in even if you don't save
Runtime Tools
"What's cool about software is you can put your hand up them like a puppet."
- gdb debugger for obj-c.
- BSInspectors, an Xcode plugin that lets you inspect objects
- F-Script scripting for cocoa. F-Script Anywhere allows you to dynamically inject it into any Cocoa app. You can also dynamically look stuff up in the pop-up completer menu. The Object Browser shows you what methods are supported for the selected object. "Select view" button will inspect anything you click on and allow you to directly call the methods.
The rest of the evening was spent doing evil things to the iPhone. Also! I watched in awe as Dave/Wolf worked some fabulous Quartz Composer action into a little Cocoa toy app that I'd been working on ;D

