Re: NSMomentaryLightButton vs. NSMomentaryPushInButton and NSPushOnPushOffButton vs. NSOnOffButton

2010-10-28 Thread Quincey Morris
On Oct 27, 2010, at 22:53, Ken Ferry wrote:

> Anyway, NSMomentaryLightButton sets highlightsBy to 
> NSChangeGrayCellMask|NSChangeBackgroundCellMask and showsStateBy to 0.
> 
> NSMomentaryPushInButton sets highlightsBy to NSPushInCellMask and 
> showsStateBy to 0.

Well, the thorough explanation is much appreciated, it's not clear that there 
are (currently) any buttons that draw differently with these two types, or are 
there?

Also, your explanation tends to suggest the documentation is wrong -- whatever 
"lit" means, surely both types can't be that, and why is a 
NSMomentaryPushInButton a correction of pre-Leopard terminology (correctly?) 
indicating that the type is *not* "pushed in"?


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Custom setter for atomic property

2010-10-28 Thread Jonny Taylor
I currently have a property declared as follows:
@property(atomic, readwrite, retain) MyFrame* latestFrame;

When the value is set, I would like to broadcast a notification on the main 
thread, and one way of doing that would be to write my own custom setter that 
sets the value and then broadcasts the notification. What I am not sure about 
is how much I need to do to ensure this is threadsafe. I have only been able to 
find limited, rather contradictory information on this.

When I write my own setter function, does the "atomic" qualifier have any 
meaning? What I am trying to work out is whether the runtime will bracket my 
function with appropriate locking code, or whether I need to do that myself - 
and so crucially, do I ALSO need to write a custom getter function that is 
subject to the same manual locking?

[I have since wondered whether actually the "right" way of achieving what I 
want is to implement a didChangeValueForKey method from which I do the 
broadcasting. Any comments on that approach would also be welcome!]

Thanks in advance
Jonny___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Custom setter for atomic property

2010-10-28 Thread Bill Bumgarner

On Oct 28, 2010, at 7:01 AM, Jonny Taylor wrote:

> I currently have a property declared as follows:
> @property(atomic, readwrite, retain) MyFrame* latestFrame;
> 
> When the value is set, I would like to broadcast a notification on the main 
> thread, and one way of doing that would be to write my own custom setter that 
> sets the value and then broadcasts the notification. What I am not sure about 
> is how much I need to do to ensure this is threadsafe. I have only been able 
> to find limited, rather contradictory information on this.
> 
> When I write my own setter function, does the "atomic" qualifier have any 
> meaning? What I am trying to work out is whether the runtime will bracket my 
> function with appropriate locking code, or whether I need to do that myself - 
> and so crucially, do I ALSO need to write a custom getter function that is 
> subject to the same manual locking?
> 
> [I have since wondered whether actually the "right" way of achieving what I 
> want is to implement a didChangeValueForKey method from which I do the 
> broadcasting. Any comments on that approach would also be welcome!]

In the manual case, 'atomic' only has meaning if you make it meaningful.  I'd 
be interested in knowing why you need an atomic property in this case as 
atomicity at the property level rarely contributes to thread safety.

If you do go this route, you need to write both the getter and setter with 
relative atomicity between the two.  You can't write just one as there is no 
way for your custom getter or setter to interact with the atomicity mechanism 
of the other.

There is no way for the runtime to bracket your code with an atomicity ensuring 
mechanism as there is no complete way to figure out what locking you might be 
doing in your code.

Note that sending notifications to other threads while holding locks in the 
current thread (or queue) is rife with danger & fragility.  It is great way to 
create deadlocks and, if not, to end up with a solution that has all the 
maintenance costs of multi-threaded code combined with all the performance wins 
of single threaded execution

b.bum
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSMomentaryLightButton vs. NSMomentaryPushInButton and NSPushOnPushOffButton vs. NSOnOffButton

2010-10-28 Thread Jeff Johnson
Hi Ken.

Thank you very much for the explanation.

I agree that using showsStateBy and highlightsBy directly seems to make more 
sense. These settings are not available in Interface Builder, unfortunately, 
only the button type.

By using setHighlightsBy: directly, I was able to see a difference between 
NSChangeGrayCellMask and NSChangeBackgroundCellMask. The documentation seems to 
be a bit lacking:

"NSChangeGrayCellMask: The button cell swaps the “control color” (the 
controlColor method of NSColor) and white pixels on its background and icon.
NSChangeBackgroundCellMask: Same as NSChangeGrayCellMask, but only background 
pixels are changed."

In my testing NSChangeBackgroundCellMask doesn't do anything to the background, 
it only changes the pixels of the icon. Maybe it's referring to the background 
of the icon? Also, the documentation for setHighlightsBy: seems wrong:

"If both NSChangeGrayCellMask and NSChangeBackgroundCellMask are specified, 
both are recorded, but which behavior is used depends on the button cell’s 
image. If the button has no image, or if the image has no alpha (transparency) 
data, NSChangeGrayCellMask is used. If the image does have alpha data, 
NSChangeBackgroundCellMask is used"

In my testing, I can't get NSChangeBackgroundCellMask to be used, it always 
behaves as NSChangeGrayCellMask. I'm near certain that some of my test images 
had alpha data.

As for NSChangeGrayCellMask vs. NSPushInCellMask, I can't see any difference, 
at least not with the configurations I tested.

Would you recommend that we use NSPushInCellMask / NSMomentaryPushInButton and 
simply ignore NSChangeGrayCellMask / NSChangeBackgroundCellMask / 
NSMomentaryLightButton as historical artifacts? It might be nice if the latter 
were re-deprecated, to clear up confusion. On the other hand, 
NSChangeBackgroundCellMask does seem genuinely useful.

-Jeff


On Oct 28, 2010, at 12:53 AM, Ken Ferry wrote:

> Hi Quincey, Jeff,
> 
> -[NSButtonCell setButtonType:] is (mostly) a cover for certain combinations
> of -[NSButtonCell setHighlightsBy:] and -[NSButtonCell setShowsStateBy:].
> 
> For a button, highlighted is synonymous with "pressed".  setHighlightsBy:
> controls how a button draws to communicate that it is pressed.  It takes an
> NSCellMask describing the look.
> 
> showsStateBy: describes how a button should draw to show that it's "on".
> _All_ buttons change from on to off and back when clicked, it's just that
> many do not show it.  This is also described with an NSCellMask.
> 
> NSCellMask is a combination of NSContentsCellMask, NSPushInCellMask,
> NSChangeGrayCellMask, and NSChangeBackgroundCellMask.  0 is also a
> possibility, which would mean "do not draw differently".
> 
> NSContentsCellMask means "use alternate contents", i.e. -[NSButtonCell
> alternateImage] and -[NSButtonCell alternateTitle].
> 
> NSPushInCellMask means "look pushed in".
> 
> NSChangeGrayCellMask and NSChangeBackgroundCellMask are rather historical
> names (the first comes from the NeXT's four color display - it refers to
> swapping one of the two gray colors with the other one!).  They basically
> mean, uh, draw the bezel differently in some fashion.
> 
> Anyway, NSMomentaryLightButton sets highlightsBy to
> NSChangeGrayCellMask|NSChangeBackgroundCellMask
> and showsStateBy to 0.
> 
> NSMomentaryPushInButton sets highlightsBy to NSPushInCellMask and
> showsStateBy to 0.
> 
> NSPushOnPushOffButton sets highlightsBy to NSPushInCellMask |
> NSChangeGrayCellMask|NSChangeBackgroundCellMask and showsStateBy to
> NSChangeGrayCellMask|NSChangeBackgroundCellMask.
> 
> NSOnOffButton sets highlightsBy to
> NSChangeGrayCellMask|NSChangeBackgroundCellMask
> and showsStateBy to NSChangeGrayCellMask|NSChangeBackgroundCellMask.
> 
> I find direct use of showsStateBy and highlightsBy to mostly make more sense
> than setButtonType.
> 
> -Ken
> 
> On Wed, Oct 27, 2010 at 9:13 PM, Quincey Morris > wrote:
> 
>> On Oct 27, 2010, at 20:04, Jeff Johnson wrote:
>> 
>>> I was aware of the documentation, and you appear to have it backwards:
>>> 
>>> NSMomentaryLightButton
>>> While the button is held down it’s shown as “lit,” and also “pushed in”
>> to the screen if the button is bordered.
>>> 
>>> NSMomentaryPushInButton
>>> While the button is held down it’s shown as “lit.”
>>> 
>>> Nonetheless, one would expect that NSMomentaryPushInButton would also be
>> pushed in, given its name. And as I said, there seems to be no difference in
>> behavior.
>> 
>> You're right, I read it according my expectation, not according to the
>> actual words. :)
>> 
>> This is very strange, though. According to this document,
>> NSMomentaryPushInButton is the behavior of a normal push-button, and we know
>> it *is* shown as pushed-in (for at least some of the bordered button types).
>> Also, here's what the Leopard release notes had to say about it:
>> 
>>> The constants NSMomentaryPushButton and NSMomentaryLight where reversed.
>> If you called [NSButtonCell setButtonType:]

Re: Custom setter for atomic property

2010-10-28 Thread Jonny Taylor
Thanks for your answers Bill, that has cleared up some of my confusion.

> In the manual case, 'atomic' only has meaning if you make it meaningful.  I'd 
> be interested in knowing why you need an atomic property in this case as 
> atomicity at the property level rarely contributes to thread safety.
I have subsequently discovered this myself! The problem I encountered (which 
probably should have been obvious) was that I was reading the property, but 
then by the time I was actually doing something with it it had been released by 
another thread.

> If you do go this route, you need to write both the getter and setter with 
> relative atomicity between the two.  You can't write just one as there is no 
> way for your custom getter or setter to interact with the atomicity mechanism 
> of the other.
I have ended up writing a function setCurrentFrame, and a function 
getAutoreleasedCurrentFrame which ends with [[currentFrame retain] 
autorelease]. Both are bracketed with the same mutex. Does that sound like a 
sensible approach, or am I still going about this the wrong way?

Incidentally, I suspect that approach would be KVO compliant if I was to rename 
getAutoreleasedCurrentFrame to just currentFrame, but I'm inclined to leave it 
as-is for the moment to remind myself I am doing something a bit strange.

> There is no way for the runtime to bracket your code with an atomicity 
> ensuring mechanism as there is no complete way to figure out what locking you 
> might be doing in your code.
OK

> Note that sending notifications to other threads while holding locks in the 
> current thread (or queue) is rife with danger & fragility.  It is great way 
> to create deadlocks and, if not, to end up with a solution that has all the 
> maintenance costs of multi-threaded code combined with all the performance 
> wins of single threaded execution
My situation is that I am receiving camera frames on a background thread, and 
need a way of informing various windows that their displays should be updated 
to reflect the fact that a new frame has been received. This GUI work needs to 
be done on the main thread (I believe...). In addition, I take advantage of the 
coalescing features of notifications to avoid unnecessary updates. Thus I am 
keeping the currentFrame variable up to date in a threadsafe manner, and then 
after updating it (and releasing the lock) I post a notification to the main 
queue, with coalescing. Does that sound like a reasonable approach?

I definitely need to access currentFrame in a threadsafe manner, but hopefully 
my description shows that the multithreaded relationship for the notifications 
and variable updates is not there for performance reasons, if that makes sense. 
I am more than aware of the trouble multithreading brings, but the nature of 
the code makes it pretty unavoidable.

Jonny___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and drop between two table views.

2010-10-28 Thread mmalc Crawford

On Oct 27, 2010, at 8:38 pm, Paul Johnson wrote:

> I took your suggestion to archive the array to a NSData object. I needed to
> implement encodeWithCoder for the object that defines the data for a row
> (containing 3 columns with an NSString in each column). I used the Data
> Modeler to define the row objects and then created the initial declaration
> and implementation files. Now I needed to added encodeWithCoder and
> initWithCoder methods.
> 
> Now I'm getting the message "*Failed to call designated initializer on
> NSManagedObject class 'Market'"*
> *when I try to unarchive. I'm really unclear on how to work with Core Data
> in this situation.*
> 
Are you trying to use archiving with Core Data? You shouldn't.
When you create a managed object, precisely as the error message states, you 
need to use its designated initialiser.

What you do to support drag and drop depends on the functionality you want. If 
you want to copy the objects, then you need to create representations that are 
not managed objects -- for example a dictionary -- as shown in 
.
 If you want to move the objects or otherwise simply create different 
references to the originals, then you pass the managed object IDs.

mmalc

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSMomentaryLightButton vs. NSMomentaryPushInButton and NSPushOnPushOffButton vs. NSOnOffButton

2010-10-28 Thread Kyle Sluder
On Oct 28, 2010, at 9:09 AM, Jeff Johnson  
wrote:

> By using setHighlightsBy: directly, I was able to see a difference between 
> NSChangeGrayCellMask and NSChangeBackgroundCellMask. The documentation seems 
> to be a bit lacking:

Much of the NSButton and NS*Cell documentation hasn't been updated since 
OpenStep. If you help file bugs at http://bugreport.apple.com, maybe we can 
convince the documentation team to update this documentation.

--Kyle Sluder___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CoreDataGeneratedAccessors

2010-10-28 Thread Jerry Krinock

On 2010 Oct 27, at 12:36, Ayers, Joseph wrote:

> Do I have to provide the CoreDataGeneratedAccessors, or does core data 
> generate them as the name implies?

Kind of.  Read in Core Data Programming Guide ▸ Managed Object Accessor Methods 
▸ Dynamically-Generated Accessor Methods ▸ Implementation.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Custom setter for atomic property

2010-10-28 Thread Bill Bumgarner

On Oct 28, 2010, at 9:16 AM, Jonny Taylor wrote:
>> Note that sending notifications to other threads while holding locks in the 
>> current thread (or queue) is rife with danger & fragility.  It is great way 
>> to create deadlocks and, if not, to end up with a solution that has all the 
>> maintenance costs of multi-threaded code combined with all the performance 
>> wins of single threaded execution
> My situation is that I am receiving camera frames on a background thread, and 
> need a way of informing various windows that their displays should be updated 
> to reflect the fact that a new frame has been received. This GUI work needs 
> to be done on the main thread (I believe...). In addition, I take advantage 
> of the coalescing features of notifications to avoid unnecessary updates. 
> Thus I am keeping the currentFrame variable up to date in a threadsafe 
> manner, and then after updating it (and releasing the lock) I post a 
> notification to the main queue, with coalescing. Does that sound like a 
> reasonable approach?
> 
> I definitely need to access currentFrame in a threadsafe manner, but 
> hopefully my description shows that the multithreaded relationship for the 
> notifications and variable updates is not there for performance reasons, if 
> that makes sense. I am more than aware of the trouble multithreading brings, 
> but the nature of the code makes it pretty unavoidable.

The best way to access something in a threadsafe manner is to only access it 
from one thread at a time without locking.

And the best way to do that is to perpetuate the notion of thread ownership.   
When thread A is accessing the object, thread B not only does not access the 
object, thread B doesn't even have a reference to the object in its scope of 
execution.  Not ever.

When B -- likely the main thread -- needs to access the object, then A passes 
ownership to B, typically via GCD, operations or -performSelectorOnMainThread:

b.bum

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


[iPhone] UIButton and Device Orientation problem in MainWindow.

2010-10-28 Thread Sandro Noël
Greetings.

I am trying to draw a UIButton in the application's main window so the 
button remains visible no matter what the user does in the sub view's.
(TabBar based with a bunch of NavBars.)...

This works great in the default device orientation.

But left, right and upside down, the orientation of the button remains as if it 
was upright.
I've tried adjusting the coordinates but the image drawn inside the button does 
not change orientation.
when the phone is upside down, the image is upside down but the rest of the 
interface is well positioned.

I'm sure the trick is simple but I can't seem to find it in google, or i'm not 
using the right therms.
can someone point me in the right direction ? please :)

Thank you all!!
Sandro.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [iPhone] UIButton and Device Orientation problem in MainWindow.

2010-10-28 Thread Matt Neuburg
On Thu, 28 Oct 2010 14:10:28 -0400, Sandro No?l  
said:
>Greetings.
>
>I am trying to draw a UIButton in the application's main window so the 
>button remains visible no matter what the user does in the sub view's.
>(TabBar based with a bunch of NavBars.)...
>
>This works great in the default device orientation.
>
>But left, right and upside down, the orientation of the button remains as if 
>it was upright.
>I've tried adjusting the coordinates but the image drawn inside the button 
>does not change orientation.
>when the phone is upside down, the image is upside down but the rest of the 
>interface is well positioned.
>
>I'm sure the trick is simple but I can't seem to find it in google, or i'm not 
>using the right therms.
>can someone point me in the right direction ? please :)
>

It's not a trick. You simply mustn't put the button in the window; it must go 
into the root view, the sole subview of the window, which is placed there and 
managed by a UIViewController. Start your app with the UIView-based App 
template and work from there, building your interface in the secondary nib. 
Read up on view controllers in the docs, which are excellent on this point. You 
may have to unwind the whole way your interface is constructed in order to do 
this, so start with just the button and add stuff back after you get that 
working. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [iPhone] UIButton and Device Orientation problem in MainWindow.

2010-10-28 Thread Sandro Noël
Matt that worked out perfectly!

instead of 
[self.window addSubview:pButton];

changed it to 
[self.tabBarController.view addSubview:pButton];

Coordinates and orientation are now right in the spot ... thank you !!!
Sandro.

On 2010-10-28, at 3:54 PM, Matt Neuburg wrote:

> On Thu, 28 Oct 2010 14:10:28 -0400, Sandro No?l  
> said:
> >Greetings.
> >
> >I am trying to draw a UIButton in the application's main window so the 
> >button remains visible no matter what the user does in the sub view's.
> >(TabBar based with a bunch of NavBars.)...
> >
> >This works great in the default device orientation.
> >
> >But left, right and upside down, the orientation of the button remains as if 
> >it was upright.
> >I've tried adjusting the coordinates but the image drawn inside the button 
> >does not change orientation.
> >when the phone is upside down, the image is upside down but the rest of the 
> >interface is well positioned.
> >
> >I'm sure the trick is simple but I can't seem to find it in google, or i'm 
> >not using the right therms.
> >can someone point me in the right direction ? please :)
> >
> 
> It's not a trick. You simply mustn't put the button in the window; it must go 
> into the root view, the sole subview of the window, which is placed there and 
> managed by a UIViewController. Start your app with the UIView-based App 
> template and work from there, building your interface in the secondary nib. 
> Read up on view controllers in the docs, which are excellent on this point. 
> You may have to unwind the whole way your interface is constructed in order 
> to do this, so start with just the button and add stuff back after you get 
> that working. m.
> 
> --
> matt neuburg, phd = m...@tidbits.com, 
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.apeth.net/matt/default.html#applescriptthings

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Heapshot Analysis to find Memory Accretion (Leaks)

2010-10-28 Thread Sean McBride
On Tue, 19 Oct 2010 10:33:39 +0700, Gerriet M. Denkmann said:

>So, what to do now?
>Conclude that AppKit is full of leaks?

AppKit is full of leaks, just like most all real world code.  Create a
new document-based Cocoa app from Xcode stationary, run it, open the
about box, open panel, save panel, page setup, etc.  Then run 'leaks'.
You'll see dozens.  Happily, they are small.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and drop between two table views.

2010-10-28 Thread Paul Johnson
Thanks, Graham. Let me restate the "drag and drop" problem I'm having and
maybe someone with Core Data experience can give me some further help:

I have been trying to get drag and drop working to copy from one tableview
to another in the same application. Each table view uses Core Data to obtain
its data.

I used the Data Modeler to create two models, one for the data in each
tableview.

The model for the data in the destination tableview is essentially the same
as for the source tableview. The only difference is that the data model for
the destination tableview has an additional entity and a relationship.

Both tableviews display 3 columns of data, which are NSStrings.

When I drag and drop and simply want to copy the selected rows (each
containing 3 strings).

Right now I'm getting an error message when I try to decode the pasteboard
data: "Failed to call designated initializer on NSManagedObject class
'Market'"

I guess I can write more code and just copy the strings to build an array
that doesn't depend on "NSManagedObject", but perhaps someone can help me
avoid doing this, but instead recommend a method makes drag and drop
compatible with Core Data.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTextField setBackgroundColor

2010-10-28 Thread koko

m_statusPane1 is a NSTextField

[m_statusPane1 setBackgroundColor:[NSColor redColor]];

The background color does not change after the above.

Do I need to do something else?

(I have done display but no change)

-koko

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and drop between 2 table views

2010-10-28 Thread Sean McBride
On Mon, 25 Oct 2010 12:55:32 -0500, Paul Johnson said:

>I have two table views and I want to drag and drop from one to the other.
>
>
>I'm using Core Data and Bindings, and the
>
>
>I'm able to select items in the source table and I'm copying an index set
>listing indexes of the selected items to the pasteboard.
>
>
>I haven't been able to drop the selected items on the destination table
>view.
>
>
>I have two array controllers, one for each table view.
>
>
>What is the correct way for the destination array controller to access an
>item in the source table view?

Have you worked through this example:?



--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and drop between two table views.

2010-10-28 Thread mmalc Crawford

On Oct 28, 2010, at 2:20 pm, Paul Johnson wrote:

> The model for the data in the destination tableview is essentially the same
> as for the source tableview. The only difference is that the data model for
> the destination tableview has an additional entity and a relationship.
> 
Then it's not the same model.
Per my previous reply, the approach you should take is illustrated in the 
NSPersistentDocument tutorial; general strategies are also discussed in the 
Core Data Programming Guide:



> Right now I'm getting an error message when I try to decode the pasteboard
> data: "Failed to call designated initializer on NSManagedObject class
> 'Market'"
> I guess I can write more code and just copy the strings to build an array
> that doesn't depend on "NSManagedObject", but perhaps someone can help me
> avoid doing this, but instead recommend a method makes drag and drop
> compatible with Core Data.


See previous reply.

mmalc

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTextField setBackgroundColor

2010-10-28 Thread koko

Disregard.

setDrawsBackground was not YES.

OK now!

-koko


On Oct 28, 2010, at 3:28 PM, k...@highrolls.net wrote:


m_statusPane1 is a NSTextField

[m_statusPane1 setBackgroundColor:[NSColor redColor]];

The background color does not change after the above.

Do I need to do something else?

(I have done display but no change)

-koko

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net

This email sent to k...@highrolls.net



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mapping APIs for use in Cocoa app

2010-10-28 Thread Darren Wheatley

Hi,

I have received some additional guidance from the Google Enterprise 
Sales team:


"...Unfortunately I have to reiterate, if there is any payment for any 
aspect of a service which involves maps, then this requires a license..."


However, this *appears* not to be the case for iOS applications.

Again, this is just my interpretation and should not be taken as legal 
advice.


I'm going to switch to a Cloud Made solution.

Regards

Darren.


On 26/10/2010 18:51, Darren Wheatley wrote:

Hi,

Since my original posting I have found (as you note) that there are 
two sets of Ts&Cs: one for (iPhone / Map Kit) and one for other apps. 
The restrictions appear different, and so I have emailed the Google 
Premier API team for guidance.


My interpretation of the terms for non-iphone apps is that if the use 
of mapping functionality is withheld from certain users (e.g. by the 
charging of a fee, or if one were to distribute internally within an 
organisation and not publically) then a Premier API licence is 
required. The terms don't appear to treat web apps and desktop apps 
differently (see http://code.google.com/apis/maps/faq.html - Can I use 
Google Maps in my non-Web application?).


This is only my interpretation and not legal advice.

For reference:

http://code.google.com/apis/maps/terms.html 
 
 vs
http://code.google.com/apis/maps/iphone/terms.html 



I'll post to the list if and when I get advice from the Google Premier 
API team.


Thanks for taking the time to post.

Regards

Darren.


On 26/10/2010 16:28, Conrad Shultz wrote:
Can you show where in the iOS API agreement this is stated? There 
would be many apps that violate it by using MapKit, I would think, if 
that is the case.


While certain activities (e.g. geocoding and route finding) have 
special restrictions, the controlling section would appear to be 10.4:


  "Except as explicitly permitted in Section 7, you must not (nor
  may you permit anyone else to)... charge users or any other
  third party any incremental fee solely for the use of the Maps
  API Implementation, the Service, or the Content, unless you have
  entered into a separate written agreement with Google or
  obtained Google's written permission
 to do so (but if you
  are a consultant who creates or hosts Maps API Implementations
  for third party customers, you may charge such customers a fee
  for your consulting or hosting services)"

That certainly doesn't sound like it forbids all commercial 
applications, but then again I am not a lawyer (and this is not legal 
advice). I also note that you are evidently based in the UK, so there 
may be rules of which I am unaware.


That said, there are significant wording changes in the non-iOS terms 
(http://code.google.com/apis/maps/terms.html) that may well restrict 
commercial use. However, I get the impression that these are designed 
for web apps/sites, not desktop apps, so you might want to ask Google 
(developer relations, not the search engine).


In particular, I'm curious how they handle something like a free 
application that displays a pin on a map to show a house you have 
purchased. Such would not charge for access, but use is contingent on 
having paid an unrelated fee.


But this is now quite far afield from cocoa-dev.

--
Conrad Shultz
www.synthetiqsolutions.com 

On Oct 26, 2010, at 3:10, Darren Wheatley 
> wrote:



Hi,

I'm building a Mac / iPad app that displays simple maps to the user 
(map with location pin, allowing the user to pan and zoom).


This is pretty easy to do with Google Maps, but AFAIK the API Ts&Cs 
prevent use in a commercial application unless a Google Premier API 
licence is purchased (£Ks).


The cost of this means I can't use Google Maps in my application.

Can anyone suggest an alternative mapping API for my app please (or 
correct my understanding of the Google Ts&Cs if I'm wrong)?


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/darren%40tenjinconsulting.co.uk 



This email sent to dar...@tenjinconsulting.co.uk



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-de

Re: Drag and drop between 2 table views

2010-10-28 Thread Paul Johnson
Sean, the sample code you refer to doesn't use Core Data. My issue is with
the use of Core Data along with drag and drop.

On Thu, Oct 28, 2010 at 4:34 PM, Sean McBride wrote:

> On Mon, 25 Oct 2010 12:55:32 -0500, Paul Johnson said:
>
> >I have two table views and I want to drag and drop from one to the other.
> >
> >
> >I'm using Core Data and Bindings, and the
> >
> >
> >I'm able to select items in the source table and I'm copying an index set
> >listing indexes of the selected items to the pasteboard.
> >
> >
> >I haven't been able to drop the selected items on the destination table
> >view.
> >
> >
> >I have two array controllers, one for each table view.
> >
> >
> >What is the correct way for the destination array controller to access an
> >item in the source table view?
>
> Have you worked through this example:?
>
>  Introduction/Intro.html>
>
> --
> 
> Sean McBride, B. Eng s...@rogue-research.com
> Rogue Researchwww.rogue-research.com
> Mac Software Developer  Montréal, Québec, Canada
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and drop between 2 table views

2010-10-28 Thread Kyle Sluder
On Thu, Oct 28, 2010 at 3:43 PM, Paul Johnson  wrote:
> Sean, the sample code you refer to doesn't use Core Data. My issue is with
> the use of Core Data along with drag and drop.

No, your issue is that you haven't learned how to implement drag and
drop. The fact that you're using Core Data is orthogonal.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and drop between two table views.

2010-10-28 Thread Paul Johnson
The link you included in your post is broken. And I will continue to study
the Core Data Programming Guide and other sources of info on Core Data. My
issue is with Drag and Drop in conjunction with Core Data.

On Thu, Oct 28, 2010 at 4:36 PM, mmalc Crawford  wrote:

>
> On Oct 28, 2010, at 2:20 pm, Paul Johnson wrote:
>
> > The model for the data in the destination tableview is essentially the
> same
> > as for the source tableview. The only difference is that the data model
> for
> > the destination tableview has an additional entity and a relationship.
> >
> Then it's not the same model.
> Per my previous reply, the approach you should take is illustrated in the
> NSPersistentDocument tutorial; general strategies are also discussed in the
> Core Data Programming Guide:
><
> http://pubsbuild.apple.com/Messier/Releases/BaroloDevLib/recipes/xcode_help-core_data_modeling_tool/index.html
> >
>
> > Right now I'm getting an error message when I try to decode the
> pasteboard
> > data: "Failed to call designated initializer on NSManagedObject class
> > 'Market'"
> > I guess I can write more code and just copy the strings to build an array
> > that doesn't depend on "NSManagedObject", but perhaps someone can help me
> > avoid doing this, but instead recommend a method makes drag and drop
> > compatible with Core Data.
>
>
> See previous reply.
>
> mmalc
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and drop between 2 table views

2010-10-28 Thread Paul Johnson
Although it may be "orthogonal" and I may not have learned everything about
drag and drop, I believe my code does follow the code samples suppled my
Apple. I've also found other code samples elsewhere that agree with Apple's
and with mine. I do have a case where there is a relationship between drag
and drop and Core Data.

I could build an array with the strings I want to drag and drop and that
appears to be the proper way to implement this. So far I've found that info
on Core Data is rather sparse, especially as it pertains to sample code.

On Thu, Oct 28, 2010 at 5:47 PM, Kyle Sluder  wrote:

> On Thu, Oct 28, 2010 at 3:43 PM, Paul Johnson  wrote:
> > Sean, the sample code you refer to doesn't use Core Data. My issue is
> with
> > the use of Core Data along with drag and drop.
>
> No, your issue is that you haven't learned how to implement drag and
> drop. The fact that you're using Core Data is orthogonal.
>
> --Kyle Sluder
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why would [NSArrayController setSelectionIndex] fail?

2010-10-28 Thread Mike Abdullah
It will fail and return NO if there's an editor registered with the controller 
that fails to commit editing. e.g. you're editing some text in a table bound to 
the controller, and that text fails validation.

On 27 Oct 2010, at 22:30, vincent habchi wrote:

> Hi there,
> sorry for being rather terse these days, I am conscious I tend to tap too 
> much and help too few.
> 
> Small question: I have a NSArrayController managing a Core data entity array. 
> I want to alter the selection via -setSelectionIndex, and it fails (the index 
> won't change). The documentation is (also) rather terse on the possible 
> causes for such a failure – I do no edition, I just want to pick up an entity 
> through a dialog. Does someone have a little experience with these cases? 
> Especially, how to dig up to the point responsible for the denial?
> 
> Thanks a lot,
> Vincent
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and drop between 2 table views

2010-10-28 Thread Paul Johnson
I believe I've found the answer to my drag and drop problem:

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html

Drag and Drop is just a glorified copy/paste and on that web page I found:
"If you just want to copy a managed object’s attributes, then in many cases
the best strategy may be in the copy operation to create a dictionary
(property list) representation of a managed object, then in the paste
operation to create a new managed object and populate it using the
dictionary."

Also:
"It is difficult to solve the problem of copying, or supporting copy and
paste, in a generic way for managed objects. You need to determine on a
case-by-case basis what properties of a managed object you actually want to
copy."
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and drop between 2 table views

2010-10-28 Thread mmalc Crawford

Paul Johnson wrote:

> I could build an array with the strings I want to drag and drop and that
> appears to be the proper way to implement this. So far I've found that info
> on Core Data is rather sparse, especially as it pertains to sample code.

The Core Data Programming Guide contains a section that specifically addresses 
Copy and Paste and Drag and Drop...


> I believe I've found the answer to my drag and drop problem:
> 
> http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html
> 
> Drag and Drop is just a glorified copy/paste and on that web page I found:
> "If you just want to copy a managed object’s attributes, then in many cases
> the best strategy may be in the copy operation to create a dictionary
> (property list) representation of a managed object, then in the paste
> operation to create a new managed object and populate it using the
> dictionary."
> 
Per previous reply:

On Oct 28, 2010, at 9:25 am, mmalc Crawford wrote:

> What you do to support drag and drop depends on the functionality you want. 
> If you want to copy the objects, then you need to create representations that 
> are not managed objects -- for example a dictionary -- as shown in 
> .
> 



mmalc

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


[MEET] CocoaHeads Mac Developer Meetings

2010-10-28 Thread Stephen Zyszkiewicz
Greetings,

CocoaHeads is an international Mac programmer's group. Meetings are free and 
open to the public. We specialize in Cocoa, but everything Mac programming 
related is welcome.

Australia
Sydney - Thursday, November 4, 2010 18:30

France
Bordeaux - Thursday, November 4, 2010 18:00

Germany
Hamburg - Thursday, November 4, 2010 19:00
Hannover - Monday, November 1, 2010 19:00

Sweden
Göteborg - Thursday, November 11, 2010 19:00
Stockholm - Monday, November 1, 2010 19:00

U.S.A.
Albany, New York - Thursday, November 18, 2010 18:45
Ann Arbor, Michigan - Thursday, November 11, 2010 19:00
Atlanta, Georgia - Thursday, November 11, 2010 19:00
Boston, Massachusetts - Thursday, November 11, 2010 19:00
Boulder, Colorado - Tuesday, November 9, 2010 19:00
Chattanooga, Tennessee - Saturday, November 20, 2010 09:00
Chicago, Illinois - Tuesday, November 9, 2010 19:00
Colorado Springs, Colorado - Thursday, November 11, 2010 19:00
Denver, Colorado - Tuesday, November 9, 2010 19:00
Fayetteville, Arkansas - Thursday, November 11, 2010 18:00
Portland, Oregon - Wednesday, November 17, 2010 19:00

Some chapters may have yet to post their meeting for next month. Meeting times 
may change. Locations and more information here:
http://cocoaheads.org

Also be sure to check for an NSCoder Night in your area:
http://nscodernight.com/


Steve
Silicon Valley CocoaHeads___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Writing an Uninstaller

2010-10-28 Thread eveningnick eveningnick
Thank you guys for answer, but the problem still remains for me

> HI ,
>   launch an applescript / shell script when uninstall button is clicked . 
> This should first quit  the App and wait for it to terminate and then delete 
> the bundle and plist
> Rajendran P

I'm sorry for asking such a primitive question but could you point me
how can that be done? How can i schedule a script to be executed after
my process is terminated? AppleScript call like

NSAppleScript alloc] initWithSource:@"tell finder to delete
something"] executeAndReturnError:nil];
[NSApp terminate];

can't do the job, because that -executeAndReturnError doesn't return
unless the launched script has returned. It looks like a deadlock -
the script should wait for my app to terminate, while my app is
waiting for script to terminate

Should i write an another *.plist to "program" launchd to execute a
script? What will it look like then? (by the way, is there a way to
make launchd execute some script without writing and saving a plist to
disk?)
Or what is the right way? What did you mean?

And, deleting my bundle requires Administrator privileges, which my
adhoc uninstaller doesn't have. Should i provide some kind of form to
ask for username and password then, like it is done in
PackageMaker/Installer? Or maybe the system provides some
interface/API for displaying that window? How can i escalate my
uninstaller privilege to be able to delete its own bundle, and its
stuff, that Installer has placed to ~/Library/Application
Support/MyApplication?

Angus, about
>Have you considered just killing the background process and then automatically 
>moving your app to the trash before quitting?

i do kill the daemon, and delete its plist, but how can i delete my
own bundle? the system just doesn't let me, i think because
Uninstaller is an Application from MyBundle.app/Contents/MacOS. Any
other launched binary (for example that background daemon) can be
deleted together with its bundle, but not an Application - it seems to
be protected by Finder or something

Thanks again!
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Drag and drop between 2 table views

2010-10-28 Thread Paul Johnson
Thanks to everyone who helped me out on this problem.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Adding and removing menu items causes memory usage to grow

2010-10-28 Thread George Nachman
Thanks for the response, Sherm. I added the code as you suggested but
the leak persists. I originally discovered this issue because my
program would grow slowly over several days; the code I originally
posted was being called once a second from the event loop, which I
guess would allow the autorelease pools to be freed.

In trying to figure this out, I downloaded the binary distribution of
my program that someone else built (before I took it over). That
version does not leak. But if I check out the code they used and build
my own deployment build, that does leak.

What could be different about my build environment that would cause this?

On Wed, Oct 27, 2010 at 9:00 PM, Sherm Pendley  wrote:
> On Wed, Oct 27, 2010 at 12:45 PM, George Nachman  wrote:
>>
>> I was tracking down memory growth in my application and isolated it to
>> the repeated adding and removing of menu items. Doing this causes a
>> growth of about 1MB:
>>
>>    for (int i = 0; i < 1000; ++i) {
>
>        NSAutoreleasePool *myPool = [[NSAutoreleasePool alloc] init];
>
>>        NSMenu *aMenu = [[NSMenu alloc] init];
>>        NSMenuItem* i = [[NSMenuItem alloc] initWithTitle: @"AAA"
>> action:nil keyEquivalent:@""];
>>        [aMenu addItem:i];
>>        [i release];
>>        [aMenu removeItemAtIndex:0];
>>        [aMenu release];
>
>        [myPool drain];
>
>>    }
>>
>> The Leaks instrument doesn't show any leaks. Allocations shows a whole
>> bunch of different objects growing, but CFBasicHash is the worst
>> offender, with lots of allocations in -[NSMenu insertItem:atIndex:]
>> and -[NSMenu removeItemAtIndex:].
>
> At a guess, I'd say that -[NSMenu removeItemAtIndex:] autoreleases the
> removed item, and since you're in a loop here that doesn't pump the
> run loop, the autorelease pool isn't being drained. Try allocating an
> AR pool at the top of your loop, and sending it a -drain at the
> bottom, like I've added above.
>
> sherm--
>
> --
> Cocoa programming in Perl:
> http://camelbones.sourceforge.net
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Adding and removing menu items causes memory usage to grow

2010-10-28 Thread Synthetiq Solutions
George Nachman wrote:
> In trying to figure this out, I downloaded the binary distribution of
> my program that someone else built (before I took it over). That
> version does not leak. But if I check out the code they used and build
> my own deployment build, that does leak.
> 
> What could be different about my build environment that would cause this?

Do you have zombies enabled by any chance?  That could explain why your
locally built version leaks.

-- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Writing an Uninstaller

2010-10-28 Thread Abhi Beckert

On 2010-10-29, at 12:14 PM, eveningnick eveningnick wrote:

> Thank you guys for answer, but the problem still remains for me
> 
>> HI ,
>>   launch an applescript / shell script when uninstall button is clicked . 
>> This should first quit  the App and wait for it to terminate and then delete 
>> the bundle and plist
>> Rajendran P
> 
> I'm sorry for asking such a primitive question but could you point me
> how can that be done? How can i schedule a script to be executed after
> my process is terminated? AppleScript call like
> 
> NSAppleScript alloc] initWithSource:@"tell finder to delete
> something"] executeAndReturnError:nil];
> [NSApp terminate];

I think he means create an applescript in Script Editor or Automator, and 
select "Application" in script editor's save-as dialogue. This way you just 
need to launch the applescript application, and then do [NSApp terminate].

I haven't done any AppleScript programming for about 10 years... but this 
seemed to work fine with some testing, regardless of whether or not my app was 
running:

> tell application "Finder"
>   set appAlias to item "Sequel Pro.app" of (path to applications folder)
>   move appAlias to trash
> end tell

Note that because the file is being moved to the trash by Finder, the dock icon 
is properly updated, the standard "moved to trash" sound is played, the user 
can use finder's "edit -> undo" feature to move it back to the applications 
folder, and if admin privileges are required — Finder will handle that for you.

- Abhi___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Subclass NSURLProtocol, and file /Developer/Examples/WebKit/PictureBrowser/

2010-10-28 Thread Wayne Shao
Hi,

I tried to find an example of subclassing NSURLProtocol.
Some web forums points to  /Developer/Examples/WebKit/PictureBrowser/, which
is not on my system. How do I install that?
Or is there another similar example?

-- 
W. Shao
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com