« Q&A: April 18, 2001
// Question One
Should I use resource forks, bundles or flat files?
So far, though, there has not been a very convincing argument against using resource forks for non-essential metadata about a file. Several people have pointed out scenarios where resource forks provide an undisputable benefit to the user. No other viable solution has been suggested, other than not to have the metadata. (User defaults would get bogged down, using some other database would reduce the user-experience to Windows/Unix-like levels where things depend on a file's path and break when it is moved.)
File formats that won't work without their resource forks (e.g., old-style DiskCopy 6.3 images) have been generally accepted to be a bad idea, and I don't think anybody is arguing for that kind of resource fork use.
But optional metadata in a resource fork doesn't impact cross-platform compatibility a bit. The preview icon, window position, etc. may be lost, but the TIFF image data (or whatever) survives perfectly fine and intact. So the drawbacks of resource forks become very minor, while the advantages remain significant..
The Mac user wants (and, after many years expects) programs to remember things like window position, selection, cursor location etc., on a per-file basis. She wants to be able to move a file around on her computer without losing that data. (Obviously, many parallel real-world scenarios exist.)
How better to do that than resource forks?
answer by: Mason Mark (paraphrased)
// Question Two
where / how I'm supposed to handle my initialization of the class if the object is handled by IB and frozen in the Nib.
There's two places, -awakeFromNib and -initWithCoder: that you can do the initialization depending on you want the code executed only when the object is unarchived from a .nib or everytime it is unarchived. Usually you want awakeFromNib.
Have a look at:
answer by: Ian P. Cardenas
// Question Three
In the target, the install path is set to $(USER)/Library/Frameworks/
The thing ends up in /tmp/ProjectName.dst/$(USER)/Library/Frameworks/
It would seem to me that the whole point of the install directory is to put the built item in the directory specified. So what am I doing wrong or is that the intended action?
pbxbuild install INSTALL_ROOT=/
answer by: Michael B. Johnson
It is a good idea if you do builds in a controlled environment for release control. You really want everything to be installed as it would be in a "real" filestructure but from a different root. Having built a build-and-release control system once this variable is a godsend.
note by: Annard Brouwer
// Question Four
When I try to send a mail via sendmail, I get the following message:
Apr 17 03:15:03 blue sendmail: NOQUEUE: SYSERR(root): /etc/mail/sendmail.cf: line 81: fileclass: cannot open /etc/mail/local-host-names: Group writable directory
/ is group-writable. That is why it is complaing. After you fix that reboot.
answer by: Andrew Pinski
// Question Five
I need to draw a string into an NSImage
[yourImageHere lockFocus]; [yourStringHere drawAtPoint: yourPointHere withAttributes: yourStringAttributesHere]; [yourImageHere unlockFocus];
answer by: Tom Waters