Indeed

Things that seemed important enough at the time

Friday, December 30, 2005

Searching in NetNewsWire

Wow. I should really look harder for these things - there's a search field in NNW!! I don't know why it wasn't in my default toolbar, because it's in the one from the configuration sheet. Sooooo useful…

I need to get back to my old practice of writing down bugs and features, in hopes that I get a chance to follow up on some of them sooner. I'm getting too accustomed to just accepting shortcomings (sometimes just perceived by me) in software.

Wednesday, December 21, 2005

Soundtrack Pro 1.0.2

We released Soundtrack Pro 1.0.2 today (well, yesterday by now).

If you have Soundtrack Pro, you should go grab the update. If you aren't running Soundtrack Pro, then go buy it and then grab the update :)

Tip for today: cmd-B will add a file you have selected in the media manager to the 'Bin'. It's a great way to keep track of files you want to use later. (This isn't new - it has been in the application since 1.0, but the command key is only listed in the manual) Enjoy!

Also on the web:
Buzz's photo
Apple - Download Updates

Saturday, December 17, 2005

Using and Debugging Cocoa Bindings

I've got a couple of projects where I have been able to start using bindings recently, and I thought it would be worthwhile to document some of the things I've run across.

To start off with, make sure you read everything you can about bindings before you get in too deep. Since there isn't as much content out there as for other Cocoa topics (because it's pretty new), reading everything shouldn't be all that hard :)

Apple - KeyValueCoding
Apple - KeyValueObserving
Apple - Cocoa Bindings Reference

CocoaDev (searching for 'binding' - which has lots of related topics)
mmalc's page
Borkware - Quickies for Bindings

The easiest bindings to get started with are from the NSUserDefaultsController. I've been using them for quite a while, and they can be added to existing projects with very little change.

For VDLMidi I use an NSArrayController to populate the table. It's pretty close to the standard examples for tables that you can find on the web. After getting that working I wanted to add a search field, to mimic what you get from all of the CoreData examples (where dragging an entity into InterfaceBuilder hooks up a table and search UI for you). Most places on the web talk about doing this by subclassing NSArrayController - but there's a much easier way! You simply bind the search field's 'predicate' binding to the arrayController's 'filterPredicate' controller key (Note - I tried doing this the other way for quite a while - from the arrayController to the searchField - but I never got it to work). This only works on 10.4 and later, since the binding is new to Tiger. Since I wanted VDLMidi to work on Panther, I had to do more tricks to make it work - but that's a different post…

On another project last week I was trying to remove a bunch of UI updating code for an inspector. I setup things in the nib, but with lots of bindings and complex keypaths, there were quite a few things that weren't working. While I tried to figure them out, I searched through the headers to see if there was anything useful. The first thing I found was that it's still good to have an IBOutlet for your UI objects (and your NSControllers) so you can call various methods on them. Once you have your objects, here are some useful methods, starting from the top down:

NSKeyValueBinding -infoForBinding:
With a given UI object, this method will give you the keyPath and other information that is useful for working your way down to the model objects. I was spending most of my time with the @"value" binding, but you can use the '-exposedBindings' method to find what is available. I mainly used it as a sanity check on the values set in the nib, but then I would start tracking things down with the keyPath…

NSKeyValueCoding -valueForKeyPath:
You can call this method on your NSController to get to your model objects. When I bound a UI element to the keyPath "foo.bar", I would call down the chain to inspect each of the objects:

po controller
po [controller valueForKeyPath:@"foo"]
po [controller valueForKeyPath:@"foo.bar"];
etc.

I'm not entirely sure what's going on for some of this, but Cocoa seems to change some of the object classes for these to make KeyValueObserving work (that's my guess from the class name). Whatever they are doing seems to work though, so I've stopped worrying about it :)

NSKeyValueObserving -observationInfo
The method description makes it sound like this method and its companion setter are intended for greater things when overridden, but I haven't found a need for that. However, printing the result of this method gives an array that seems to list the observers for things that are bound to or through the object.



Between these and lots of time checking and rechecking my classes for KVC and KVO-compliance, I've fixed all of the problems I've found so far. Let me know if you know of other good techniques...

Wednesday, December 14, 2005

Katamari t-shirts from Panic

Since I can't post to del.icio.us right now, I feel like I need to spread this information in another way - Panic is selling Katamari Damacy t-shirts. Check out Steven's post, or just go to the Panic store...

So cool.

Sunday, December 04, 2005

Office Depot - 150 DVD-Rs for $37

Just in time for me to worry about running out of room on my machines, I found cheap DVD-Rs at Office Depot. It's a buy 1, get 2 free sale - and you end up with 150 for $37 plus tax. Pretty cool.

Now to backup stuff from iPhoto (Aperture here I come!), my mp3's, etc. I just wish it didn't take so long to burn a DVD.

Does anyone use DVD+Rs? They have a similar deal for those, but I haven't really used them, so I just got the good old minuses... :)

 
Google