Archive for August, 2007

Death to [NSBundle pathsForResources*]

Monday, August 27th, 2007
bug

Ugh, this bug was so nasty to track down… Apparently if you call this family of methods a couple of times it screws up whether NSBundle can find resources in the future. My specific situation is that I would call this method to find what bundles are in a directory. I would then run it one more time (because that is how the code is laid out). Then when kqueue tells me that something has changed in that directory (because I added a new bundle to the target directory) I call it one more time. It finds the new bundle just fine, but for some reason it completely ignores the stuff in Resources/ when trying to query the contents of said new bundle! I don’t know if this is the result of some errant caching or what but it is consistently reproducible. The old bundles work fine but there is nothing that can make Cocoa see the contents of this new bundle. This is a big problem because it means that [NSBundle loadNibNamed:owner:] now can’t find any nibs in the new bundle (which was what first tipped me off to the problem). In the current Developer Tools Documentation under the entry for [NSBundle pathsForResourcesOfType:inDirectory:] there is a statement:

Note: This method is best suited only for the occasional retrieval of resource files. In most cases where you need to retrieve bundle resources, it is preferable to use the NSBundle instance methods instead.

I hope that is not implying this weird (caching?) behavior. Also, after the damage has been done NSBundle instance methods no longer work either. The solution to this has been to instead use a UNIXy way like scandir() to find out what bundles are in a directory. Not nearly as graceful, but at least I don’t have weird peripheral behavior. So anyway…fair warning to all against using these routines.

Digital Quoteboard

Saturday, August 18th, 2007

So one idea that I have had knocking around in my head for a while has been a digital quoteboard. I remember how in college I would go over to somebody’s apartment and there would be this quoteboard full of funny one-liners which if taken of context or more often, taken in the context of who said them, were hilarious. Of course they are usually only funny if you knew the people that said them. I thought about how there are a lot of online communities of tight knit people who could have a little bit of fun with a digital equivalent and so I whipped up this little example. I will probably refine it here and there over time and will probably release the source soon (it is not that much code). Other things I have thought of were live javascript based editing and Wordpress permissions hook ins. It currently works by having a php page render a csv quote database into a jpg so you can have static links to the results, ensuring that it will work in every browser (the above image is the actual linked image and thus may change as the database changes). So far what I have found is that there is a great disparity in exact results or even basic functionality in using the same Truetype font on different operating systems and different versions of the graphics libraries that PHP hooks into. Also, it appears that some fonts do not fully define things like punctuation and formating such as tabs. Feel free to leave a quote by going here. Although I may decide to remove general access to it in the future ;)

Language Aid on the Mac People DVD

Saturday, August 4th, 2007
Mac People DVD

A while ago one of the editors at マックピープル (Mac People) magazine asked if they could feature Language Aid in their section on shareware/freeware. I happily accepted and greatly appreciated the free advertising. A while later they asked if they could include Language Aid on a DVD-ROM that they publish containing freeware/shareware called オンラインウェアDVD (Onlineware DVD). The DVD arrived in the mail yesterday (picture is at the right). I have not worked directly on Language Aid for a while but I do have a couple more plugin modules in mind that I want to implement and the next set of new features are all laid out. I have been working a project peripherally connected to Language Aid which has taken a lot of my time lately, but this has come to a good stopping point so that I can return to working on Language Aid more.