writeToFile for memory mapped NSData

2010-01-21 Thread Andy Klepack
I have an instance of NSData is created using dataWithContentsOfMappedFile: and then written to a different file using writeToFile:atomically:. In many cases there are no calls that would cause the file to be read in between those two operations. In those cases does the entire file get read int

Keeping constant width while changing label of NSToolbarItem

2009-09-15 Thread Andy Klepack
I'd like to create a toolbar item similar to the "Mount/Unmount" item in DiskUtility. Depending on the context the label will be set to a value describing the action. For DiskUtility it is "Mount" or "Unmount". This is easy enough, the problem is that the different label lengths cause the toolb

Bindings and nested preferences

2009-06-16 Thread Andy Klepack
I'm curious about what patterns exist for binding to nested sets of preferences such as a dictionary value at the top level of the user defaults. I've seen a couple of questions similar to this, but no one appears to have received the definitive answer. My scenario is that I have an application

RE: Subclassing with more restrictive initializers

2009-02-25 Thread Andy Klepack
Ah, it looks like I'm in good company :) Thanks for the references! -Andy -Original Message- From: Andy Lee [mailto:ag...@mac.com] Sent: Wednesday, February 25, 2009 9:16 AM To: Andy Klepack Cc: Cocoa-dev@lists.apple.com Subject: Re: Subclassing with more restrictive initializers

Subclassing with more restrictive initializers

2009-02-25 Thread Andy Klepack
I've run up against this situation more than once and I'd be interested in any opinions and best-practices out there. I have a class that has one or more initializers that accept parameters. The class also has behavior. I want to implement a second class that has the behavior of the first in a

RE: Dynamic Sdef support - anyone had any luck? (Andy Klepack)

2009-02-02 Thread Andy Klepack
lists.apple.com Subject: RE: Dynamic Sdef support - anyone had any luck? (Andy Klepack) > Has anyone had any luck implementing a dynamic sdef using a plugin model? > Nothing fancy, targeting 10.5+, I haven't > been able to locate any examples of this actually being done or documentation &g

Dynamic Sdef support - anyone had any luck?

2009-02-02 Thread Andy Klepack
Has anyone had any luck implementing a dynamic sdef using a plugin model? Nothing fancy, targeting 10.5+, I haven't been able to locate any examples of this actually being done or documentation on how to do it. The 10.5 scripting release notes (http://developer.apple.com/ReleaseNotes/Cocoa/Fou

RE: #define and #ifdef statements for different build configs

2008-07-11 Thread Andy Klepack
What I've always done is to have that block in code like #ifdef RELEASE { ... code ... } #endif and then, in the build configuration of either the project or target, I select the Release configuration and add the pre processor macro "RELEASE". I forget the setting name exactley, but it's along

Displaying live NSSlider value

2008-06-17 Thread Andy Klepack
I have an NSSlider and while the drag is in progress I would like to display the value in a text field. When the drag completes I would like the new value to get set in the user preferences and an action executed. As far as I can tell I'll have to set the slider to send its action continually i

RE: Main Thread UI and Detached Thread

2008-03-31 Thread Andy Klepack
Are you calling performSelectorOnMainThread:withObject:waitUntilDone:modes on every iteration of the tight loop? That seems like it could be terribly expensive. What if you throttle it back to every X (ten, hundred, thousand, etc) iterations? My speculation would be you're overwhelming your rece

RE: Providing synch/asynch API

2008-03-26 Thread Andy Klepack
d if I can come up with one mechanism under the hood and provide whichever variant I need. I am able to target Leopard and above. -Andy -Original Message- From: Kyle Sluder [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 4:44 PM To: Andy Klepack Cc: cocoa-dev@lists.apple.com S

Best practice for overridden initializers in subclasses

2008-03-25 Thread Andy Klepack
I have a subclass of NSObject that provides its own designated initializer that allows client code to configure an instance with initial values. Instances of the class itself are immutable. At the same time, instances where no initial values are supplied do not make conceptual sense. I'm wonder

Providing synch/asynch API

2008-03-25 Thread Andy Klepack
I have several methods for which I'd like to provide asynchronous and synchronous variants. These methods are not simple operations and have non-void return values. Is there a good model to follow in implementing this? I don't recall ever seeing a technique for this in any of the Cocoa documenta

RE: Apple Events and automatic AutoReleasePool managment

2008-03-17 Thread Andy Klepack
day, March 17, 2008 12:35 PM To: Andy Klepack Cc: cocoa-dev@lists.apple.com Subject: Re: Apple Events and automatic AutoReleasePool managment On 17 Mar '08, at 11:38 AM, Andy Klepack wrote: > Does an 'event cycle' then include anything dispatched from a run > loop source? For

Apple Events and automatic AutoReleasePool managment

2008-03-17 Thread Andy Klepack
The Memory Management Programming Guide (http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/AutoreleasePools.html#//apple_ref/doc/uid/2047) states "The Application Kit automatically creates a pool at the beginning of an event cycle (or event-loop iteration), such a