Re: Cocoa-dev Digest, Vol 5, Issue 604
Re: Cocoa-dev Digest, Vol 5, Issue 604
- Subject: Re: Cocoa-dev Digest, Vol 5, Issue 604
- From: Julian James <email@hidden>
- Date: Mon, 14 Apr 2008 02:24:08 -0700
Hi,
Sounds good to me if it means I save money! How does it work when I go on holiday, as I will in May for 2 weeks or when I'm between contracts and have no income?
Julian
On Monday, April 14, 2008, at 10:01AM, <email@hidden> wrote:
>Send Cocoa-dev mailing list submissions to
> email@hidden
>
>To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.apple.com/mailman/listinfo/cocoa-dev
>or, via email, send a message with subject or body 'help' to
> email@hidden
>
>You can reach the person managing the list at
> email@hidden
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of Cocoa-dev digest..."
>
>
>Today's Topics:
>
> 1. NSMatrix Content Binding (Seth Willits)
> 2. Re: Window moved when dock appears. (Seth Willits)
> 3. Re: Core Data -- "[NSCFArray member:]: unrecognized selector"
> -- solved my own problem (Dan Knapp)
> 4. Running a "Choose Template" Sheet (Kip Nicol)
> 5. Re: Why should we set ivars to nil in dealloc? (Bill Bumgarner)
> 6. Re: A question about Tabviews and tabview items (Sean Murphy)
> 7. Re: Running a "Choose Template" Sheet (Sean Murphy)
> 8. Using Properties at Outlets (Steve Sheets)
> 9. Re: Using Properties at Outlets (Seth Willits)
> 10. NSDateFormatter giving different results in different
> programs (Derrick Bass)
> 11. Plugin Information (Rick Langschultz)
> 12. Re: Accessing Directory.app shared contacts (Kyle Sluder)
> 13. Re: Plugin Information (Kyle Sluder)
> 14. Re: Plugin Information (Uli Kusterer)
> 15. RE: A question about Tabviews and tabview items
> (Francisco Tolmasky)
> 16. Re: Window moved when dock appears. (Kyle Sluder)
> 17. Re: Window moved when dock appears. (Uli Kusterer)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Sun, 13 Apr 2008 19:57:54 -0700
>From: Seth Willits <email@hidden>
>Subject: NSMatrix Content Binding
>To: cocoa dev <email@hidden>
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>Howdy,
>
>
>I have a matrix of radio buttons that I'm trying to bind-ify. The two
>options in the matrix should shown with the titles:
>
> Mac OS Extended
> Mac OS Extended Journaled
>
>The *values* of these two items should be:
>
> HFS+
> Journaled HFS+
>
>Then what I'd like to do is bind the selectedValue of the matrix
>(which would be either "HFS+" or "Journaled HFS+") to a string
>property in my model.
>
>
>
>I can bind the content of the matrix to my model's "diskImageFormats"
>key path which would be:
>
>- (NSArray *)diskImageFormats;
>{
> return [NSArray arrayWithObjects:@"Mac OS Extended", @"Mac OS
>Extended (Journaled)", nil];
>}
>
>
>...and that properly sets the titles of the two buttons, but the
>values are still the titles. So I *thought* could simply bind
>contentValues to another key path such as:
>
>- (NSArray *)diskImageFormatValues;
>{
> return [NSArray arrayWithObjects:@"HFS+", @"Journaled HFS+", nil];
>}
>
>...but this doesn't work, because apparently the key path of
>contentValues must have the content key path as a prefix, such as
>"diskImageFormat.value" which entails a certain organization that
>seems to be too far off from what I need.
>
>
>
>Is there a way to do what I want to do?
>
>
>
>--
>Seth Willits
>
>
>
>
>
>
>------------------------------
>
>Message: 2
>Date: Sun, 13 Apr 2008 20:00:51 -0700
>From: Seth Willits <email@hidden>
>Subject: Re: Window moved when dock appears.
>To: cocoa dev <email@hidden>
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>On Apr 13, 2008, at 10:56 AM, Mohsan Khan wrote:
>
>> I have a window (NSBorderlessWindowMask), this window gets pushed
>> away when my Dock appears from being hidden.
>
>Huh. I wouldn't expect it to do that given that it's borderless.
>
>
>
>> How can I bypass this behaviour for my window?
>>
>> Should I use applicationDidChangeScreenParameters and reposition the
>> window, or is there an option to make my window not care about the
>> Dock appearing?
>
>It'd probably be easier to just override setFrame in a window subclass
>and make sure it's always what it should be. Just a thought.
>
>
>
>--
>Seth Willits
>
>
>
>
>
>
>------------------------------
>
>Message: 3
>Date: Sun, 13 Apr 2008 23:02:33 -0400
>From: "Dan Knapp" <email@hidden>
>Subject: Re: Core Data -- "[NSCFArray member:]: unrecognized selector"
> -- solved my own problem
>To: email@hidden
>Message-ID:
> <email@hidden>
>Content-Type: text/plain; charset=UTF-8
>
>Naturally, right after I gave up on solving it for the night, I guessed the
>solution.
>I figured I'd reply to myself and say that, to save others the trouble of
>trying.
>It was indeed something embarrassingly simple: I had accidentally created a
>method with the same name as an accessor which otherwise would have been
>autogenerated, overriding it. Changing the name of that method made it all
>work.
>
>Oh well - thanks to anyone who took the time to read this!
>
>--
>Dan Knapp
>"An infallible method of conciliating a tiger is to allow oneself to be
>devoured." (Konrad Adenauer)
>
>
>------------------------------
>
>Message: 4
>Date: Sun, 13 Apr 2008 20:10:48 -0700
>From: Kip Nicol <email@hidden>
>Subject: Running a "Choose Template" Sheet
>To: Cocoa mailing list <email@hidden>
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>Hello everyone,
>
>I'm trying to implement a "Choose Template" sheet that pops down with
>the creation of a new document, one very similar to the "Choose
>Template" sheet that pops down for each new Keynote document.
>
>I've researched it a bit and found an app that subclasses
>NSDocumentController and overrides
>openUntitledDocumentAndDisplay:error: method and runs the sheet there.
>Is this the correct place to be running the sheet? Thanks!
>
>Kip Nicol
>
>
>------------------------------
>
>Message: 5
>Date: Sun, 13 Apr 2008 22:39:11 -0500
>From: Bill Bumgarner <email@hidden>
>Subject: Re: Why should we set ivars to nil in dealloc?
>To: Ben Trumbull <email@hidden>
>Cc: cocoa-dev <email@hidden>
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>On Apr 13, 2008, at 6:35 PM, Ben Trumbull wrote:
>> Seriously, we're arguing about this ?
>>
>>> If you want a total hack, just assign (id) 0x1 to any variable that
>>
>> ... please step away from the tequila.
>
>Heh. No amount of testing (see below for framing of this statement)
>will catch every fault. I like my software to fail catastrophically
>throughout the beta period (or pre-submission period, in many cases)
>if anything I didn't catch in testing falls through the cracks. Nor
>can you expect to have all the full-on testing goop enabled outside of
>your development environment.
>
>For example, how long does the typical app run for with libgmalloc
>hanging out and chewing up pages?
>
>....
>> Running unit tests through debugging tools (zombies, leaks, etc)
>> nightly has been the single highest return on effort debugging
>> decisions I've ever seen.
>>
>> Ever. Seen.
>>
>> The second highest was actually writing the unit tests in the first
>> place, a necessary prerequisite, but more effort.
>>
>> Just imagine what you could do mixing this stuff with dtrace ...
>
>But, really, what Ben said. Seriously. Unit tests, automated tests,
>and doing them continuously goes a really really long way to
>minimizing defect analysis pain.
>
>Applying the system provided analysis tools during testing runs is
>relatively easy and extremely useful, too. The tools are there, might
>as well use 'em.
>
>b.bum
>
>
>
>
>------------------------------
>
>Message: 6
>Date: Mon, 14 Apr 2008 00:26:33 -0400
>From: Sean Murphy <email@hidden>
>Subject: Re: A question about Tabviews and tabview items
>To: Development <email@hidden>
>Cc: email@hidden
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>On Apr 13, 2008, at 6:24 PM, Development wrote:
>
>> Is it possible to create a tabview who's tabviewitems have a custom
>> look, For instance, the label is horizontal when the tabs are on the
>> side, or can have icons? If so could I get a pointer to some info as
>> I cant seem to find any.
>
>Rather than subclassing NSTabView (since it does not really expose any
>mechanism to override tab drawing), custom tabs can be implemented by
>hiding the NSTabView's tab buttons and utilizing a completely separate
>custom "tab bar" view containing your buttons. The custom view would
>then oversee the actual NSTabView's selection, set as its delegate to
>monitor outside selection changes, and would itself switch to the
>proper NSTabViewItems when clicked.
>
>For some examples of this approach, take a look at what we do in
>Camino: <http://mxr.mozilla.org/seamonkey/source/camino/src/browser/BrowserTabBarView.mm
> >
>
>And see the excellent PSMTabBarControl:
><http://code.google.com/p/maccode/source/browse/trunk/Utilities/PSMTabBarControl/source/
> >
>
>-Murph
>
>
>------------------------------
>
>Message: 7
>Date: Mon, 14 Apr 2008 00:33:59 -0400
>From: Sean Murphy <email@hidden>
>Subject: Re: Running a "Choose Template" Sheet
>To: Kip Nicol <email@hidden>
>Cc: Cocoa mailing list <email@hidden>
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>
>On Apr 13, 2008, at 11:10 PM, Kip Nicol wrote:
>
>> I'm trying to implement a "Choose Template" sheet that pops down
>> with the creation of a new document, one very similar to the "Choose
>> Template" sheet that pops down for each new Keynote document.
>
>Kip,
>
>Erik Buck wrote an article about such an implementation over at
>stepwise:
><http://www.stepwise.com/Articles/2006/eb1/index.html>. Looking at it
>quickly, he performs the "show template sheet" method in -
>windowControllerDidLoadNib:.
>
>Hope that helps,
>-Murph
>
>
>------------------------------
>
>Message: 8
>Date: Mon, 14 Apr 2008 00:46:54 -0400
>From: Steve Sheets <email@hidden>
>Subject: Using Properties at Outlets
>To: email@hidden
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>Has anyone had any problems with creating Properties with Objective-C
>2.0 that are also Outlets?
>
>I been using this inside my code, and I want to be sure there is no
>problems with this. I create fairly standard (readonly) and
>(readwrite, copy) properties using ivars, @property and @synthesize. I
>place IBOutlet in front of the ivar like thus:
>
>
>
>IBOutlet NSView* myView;
>IBOutlet NSWindow* myWindow;
>
>...
>
>@property (readwrite, retain) NSView* myView;
>@property (readonly) NSWindow* myWindow;
>
>...
>
>@synthesize myView;
>@synthesize myWindow;
>
>Sometimes the view or window are used as Outlets by the nib file, and
>other times the code creates them on the fly.
>
>The documentation does not explicitly say you can do this. I just want
>to know if anyone has seen an issue?
>
>Thanks,
>
>Steve Sheets
>
>------------------------------
>
>Message: 9
>Date: Sun, 13 Apr 2008 22:04:35 -0700
>From: Seth Willits <email@hidden>
>Subject: Re: Using Properties at Outlets
>To: cocoa dev <email@hidden>
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>On Apr 13, 2008, at 9:46 PM, Steve Sheets wrote:
>
>> The documentation does not explicitly say you can do this. I just
>> want to know if anyone has seen an issue?
>
>I would fully expect it work just fine. Not an authoritative answer,
>but it must be reassuring to know I don't think you're crazy. :)
>
>
>--
>Seth Willits
>
>
>
>
>
>
>------------------------------
>
>Message: 10
>Date: Sun, 13 Apr 2008 22:21:05 -0700
>From: Derrick Bass <email@hidden>
>Subject: NSDateFormatter giving different results in different
> programs
>To: Cocoa List <email@hidden>
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>I have a framework with a method that uses NSDateFormatter to convert
>an NSString to an NSDate:
> NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init]
>autorelease];
> NSDate *date = [dateFormatter dateFromString:creationDateString];
>
>creationDateString is set to @"Sun Mar 18 22:17:02 2007"
>
>In one program that links to this framework, the date is getting
>parsed correctly. But in another, the very same string is coming back
>as "1969-12-31 16:00:00 -0800"! Using -
>[getObjectValue:forString:range:error:] gives the same results.... no
>error.
>
>What could be causing the different behaviors and how do I get the
>string to parse no matter what?
>
>Thanks!
>
>Derrick
>
>
>
>------------------------------
>
>Message: 11
>Date: Mon, 14 Apr 2008 01:30:20 -0500
>From: Rick Langschultz <email@hidden>
>Subject: Plugin Information
>To: CocoaDev Developer <email@hidden>
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>Hello everyone,
>
>My application uses plugins from a support folder in /Library/
>Application Support/AppName/Plugins/. The application searches this
>folder for all the plugins and loads them. But here is my dilemma: i
>want to put the plugin class name as the bundle identifier so that i
>can call methods from those classes when something in the main
>application is triggered.
>
>For instance, I have a plugin called A.plugin, B.plugin, and C.plugin
>with Principal Classes named APluginClass, BPluginClass, and
>CPluginClass respectively. They conform to AppNameProtocol which has
>an installation, allocation/init, dealloc, and other class names.
>
>My code uses NSString *bundlePath, and NSBundle *bundle. I want to
>have something like *bundlePathA, *bundlePathB, etc; and *bundleA,
>*bundleB, *bundleC. Is there a simple way that I can do this?
>
>I have researched NSBundle on the Developer docs, and on apple.com,
>along with some code on google.com/codesearch .
>
>Can anyone give me a pointer or two?
>
>Thanks,
>
>Rick L.
>
>
>------------------------------
>
>Message: 12
>Date: Mon, 14 Apr 2008 03:45:33 -0400
>From: "Kyle Sluder" <email@hidden>
>Subject: Re: Accessing Directory.app shared contacts
>To: "Tito Ciuro" <email@hidden>
>Cc: Cocoa-Dev Apple <email@hidden>
>Message-ID:
> <email@hidden>
>Content-Type: text/plain; charset=ISO-8859-1
>
>On Sat, Apr 12, 2008 at 11:02 AM, Tito Ciuro <email@hidden> wrote:
>> The data is stored in the OpenDirectory respository. Shared Contacts are
>> stored under 'People'. You'll probably need to use the Directory Services
>> API to manipulate the data.
>
>That's what I feared. Unfortunately the schema used for these
>contacts is non-standard, and while trivial to deduce it's as always
>preferable to use a standardized approach to getting a task done. I
>sure hope there are plans for Address Book to see this information
>(and eventually merge/be supplanted by Directory.app).
>
>--Kyle Sluder
>
>
>------------------------------
>
>Message: 13
>Date: Mon, 14 Apr 2008 03:50:17 -0400
>From: "Kyle Sluder" <email@hidden>
>Subject: Re: Plugin Information
>To: "Rick Langschultz" <email@hidden>
>Cc: CocoaDev Developer <email@hidden>
>Message-ID:
> <email@hidden>
>Content-Type: text/plain; charset=ISO-8859-1
>
>On Mon, Apr 14, 2008 at 2:30 AM, Rick Langschultz <email@hidden> wrote:
>> My code uses NSString *bundlePath, and NSBundle *bundle. I want to have
>> something like *bundlePathA, *bundlePathB, etc; and *bundleA, *bundleB,
>> *bundleC. Is there a simple way that I can do this?
>
>What exactly are you trying to do? Use variable names that are
>defined at runtime? You should already know that this is nonsensical
>in C.
>
>I think you're really looking for a mapping from bundle identifier to
>class instance. That already exists. Once you've loaded the bundle,
>you can use +[NSBundle bundleWithIdentifier:] to get it again
>elsewhere, then use -[NSBundle principalClass] to get its principal
>class. Then +alloc/-init as normal.
>
>--Kyle Sluder
>
>
>------------------------------
>
>Message: 14
>Date: Mon, 14 Apr 2008 10:45:45 +0200
>From: Uli Kusterer <email@hidden>
>Subject: Re: Plugin Information
>To: Rick Langschultz <email@hidden>
>Cc: CocoaDev Developer <email@hidden>
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>Am 14.04.2008 um 08:30 schrieb Rick Langschultz:
>> My application uses plugins from a support folder in /Library/
>> Application Support/AppName/Plugins/. The application searches this
>> folder for all the plugins and loads them. But here is my dilemma: i
>> want to put the plugin class name as the bundle identifier so that i
>> can call methods from those classes when something in the main
>> application is triggered.
>
> You're not really making sense here: You can set the bundle
>identifier in the "Properties" tab of the Target Info window in Xcode.
>There's also a field for the principal class name. You really do not
>want to force the bundle identifier and class name to be the same.
>That's not the purpose of these two fields. The bundle ID is for
>uniquely identifying a plugin, not just across all plugins for your
>app, and not just across all developers who might write plugins for
>your app (so that e.g. Microsoft's 'Load WMF file' plugin can be
>distinguished from your own), but also across all plugins on a
>particular Mac, no matter what app they're for. Using a class name as
>a bundle ID is asking for collisions, and someone is bound to look up
>the wrong bundle and try to load the wrong kind of file. Don't abuse
>the bundle ID.
>
>> For instance, I have a plugin called A.plugin, B.plugin, and
>> C.plugin with Principal Classes named APluginClass, BPluginClass,
>> and CPluginClass respectively. They conform to AppNameProtocol which
>> has an installation, allocation/init, dealloc, and other class names.
>>
>> My code uses NSString *bundlePath, and NSBundle *bundle. I want to
>> have something like *bundlePathA, *bundlePathB, etc; and *bundleA,
>> *bundleB, *bundleC. Is there a simple way that I can do this?
>
> Do what? If you mean, look up a bundle based on its class name, then
>you can use an NSDictionary to associate class name with NSBundle
>objects. This also works for the other way round, but in that case you
>could just use the principalClass method of a particular NSBundle
>object.
>
> Does that help? If not, it may help to illustrate what you're having
>trouble with by giving us more information, in particular giving us a
>concrete example of what you're trying to do, plus maybe even code
>that illustrates the problem.
>
>Cheers,
>-- Uli Kusterer
>"The Witnesses of TeachText are everywhere..."
>http://www.zathras.de
>
>
>
>
>
>
>
>------------------------------
>
>Message: 15
>Date: Mon, 14 Apr 2008 01:49:01 -0700
>From: Francisco Tolmasky <email@hidden>
>Subject: RE: A question about Tabviews and tabview items
>To: email@hidden
>Cc: email@hidden
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>Take a look at drawLabel:inRect and sizeOfLabel: in NSTabViewItem
>
>If however, you want do something more complex, consider putting the
>tabview in borderless mode, making your own UI around it, and just
>calling selectTabViewItem: appropriately.
>
>
>Francisco
>
>
>
>------------------------------
>
>Message: 16
>Date: Mon, 14 Apr 2008 04:55:55 -0400
>From: "Kyle Sluder" <email@hidden>
>Subject: Re: Window moved when dock appears.
>To: "Mohsan Khan" <email@hidden>
>Cc: email@hidden
>Message-ID:
> <email@hidden>
>Content-Type: text/plain; charset=ISO-8859-1
>
>On Sun, Apr 13, 2008 at 1:56 PM, Mohsan Khan <email@hidden> wrote:
>> How can I bypass this behaviour for my window?
>
>First, unless your window does not need to be clickable or visible at
>all, don't do this. Pro Tools doesn't move when the dock pref is
>changed, and it annoys the hell out of me, especially when its resize
>widget is behind the dock.
>
>If you do have a good reason (which I can't think of), then try
>setting your window's level to be below that of a normal window, like
>0, and see if that does the trick.
>
>--Kyle Sluder
>
>
>------------------------------
>
>Message: 17
>Date: Mon, 14 Apr 2008 10:52:38 +0200
>From: Uli Kusterer <email@hidden>
>Subject: Re: Window moved when dock appears.
>To: Mohsan Khan <email@hidden>
>Cc: email@hidden
>Message-ID: <email@hidden>
>Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
>
>Am 13.04.2008 um 19:56 schrieb Mohsan Khan:
>> I have a window (NSBorderlessWindowMask), this window gets pushed
>> away when my Dock appears from being hidden.
>>
>> How can I bypass this behaviour for my window?
>
>
>I think you should override:
>
> - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen
>*)screen;
>
>to just return the frameRect it is given, unchanged.
>
>I thought there was a flag to get this behaviour automagically, but I
>can't find it right now. Maybe I just wrote a custom subclass that has
>this feature and forgot about it.
>
> Others have already warned you about not covering up the dock
>because users get annoyed when that happens. But I guess if you're
>trying to do some graphical overlay or full-screen app it may be OK.
>Though in the case of a full-screen app, you may want to check out
>hiding the menu bar, that usually also hides the dock, IIRC, and fixes
>the issue in a much more elegant way. There's also a special "kiosk
>mode" for full screen apps that may be used to implement behaviour
>many full screen apps need.
>
>Cheers,
>-- Uli Kusterer
>"The Witnesses of TeachText are everywhere..."
>http://www.zathras.de
>
>
>
>
>
>
>
>------------------------------
>
>_______________________________________________
>
>Cocoa-dev mailing list (email@hidden)
>
>Do not post admin requests or moderator comments to the list.
>Contact the moderators at cocoa-dev-admins (at) lists.apple.com
>
>http://lists.apple.com/mailman/listinfo/cocoa-dev
>
>
>End of Cocoa-dev Digest, Vol 5, Issue 604
>*****************************************
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden