Re: Arg, lmao question - (int)getters/setters.

2008-12-22 Thread Roland King
it looks as if you your class variable someInt declared as (int*), why? If you want an int, someInt should be declared as an int. aaron smith wrote: Sorry for the total newb here. What's the right way to create getters/setters for int's? Without the compiler warning about them? I've been tryi

Arg, lmao question - (int)getters/setters.

2008-12-22 Thread aaron smith
Sorry for the total newb here. What's the right way to create getters/setters for int's? Without the compiler warning about them? I've been trying: -(void)setSomeInt:(int)theInt { someInt=theInt; } -(int)someInt { return someInt; } Then calling it.. [myObj setSomeInt:1]; Usually I get

Re: Saving the project

2008-12-22 Thread Mahaboob
Thanks for the help, Now it is working well with the menu item's action. I also need to perform the same thing when I'm clicking the close button of the window. I gone through the NSWindow documentation but, I'm unable to figure it out to perform close event of the window. How can I fire close eve

Re: iTunes Plug-in

2008-12-22 Thread Andrew Farmer
On 22 Dec 08, at 15:05, Neil wrote: Is there a way to make a plug-in for iTunes that adds another "tab" to the sidebar? (ie. where the Music, Movies, Podcasts, and all the playlists are...) If so, does anyone have some pointers to some documentation on it? I've spent the last 1.5 hours hunting

Re: observeValueForKeyPath and how to do it right

2008-12-22 Thread Ken Thomases
On Dec 22, 2008, at 10:19 PM, Chris Idou wrote: --- On Mon, 22/12/08, Ken Thomases wrote: On Dec 22, 2008, at 8:19 PM, Chris Idou wrote: I've got a NSTableView controlled by a NSArrayController using content set binding. One of the columns is a checkbox, and I need to take some action wh

Re: NSSpeechSynthesizer rate

2008-12-22 Thread Ron Fleckner
On 23/12/2008, at 5:26 AM, Reema Sardana wrote: Is there any range within which the values returned by the method rate() of the class NSSpeechSynthesizer lie? I see that the volume is always between 0.0 and 1.0. -- Reema http://www1.reemasardana.com/ Hmm... I see that the values for rate

Notification when NSPersistentDocument done loading model

2008-12-22 Thread PHILIP GRANDINETTI
I'm using a Core Data model and letting NSPersistentDocument manage the task of finding and loading the application's model.   My model contains data that I am displaying in a graph (SM2DGraphView)   A problem I'm having is that once the model data is done loading I want to send a refresh messag

iTunes Plug-in

2008-12-22 Thread Neil
Is there a way to make a plug-in for iTunes that adds another "tab" to the sidebar? (ie. where the Music, Movies, Podcasts, and all the playlists are...) If so, does anyone have some pointers to some documentation on it? I've spent the last 1.5 hours hunting around for something like that, and ha

NSSpeechSynthesizer rate

2008-12-22 Thread Reema Sardana
Is there any range within which the values returned by the method rate() of the class NSSpeechSynthesizer lie? I see that the volume is always between 0.0 and 1.0. -- Reema http://www1.reemasardana.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple

Exception on dealloc of NSConcreteProtocolChecker

2008-12-22 Thread yoni shalom
I have two applications communicating via NSConnection and a specific protocol defined between them. I'm getting the following exception in the server app randomally and I can't seem to place a finger why, since the only relation from the exception stack to my code is the RunLoop run message... (s

Setting Caps Lock state from the application

2008-12-22 Thread Girish Kolari
Hi All We have an application in which we post keyboard events using the API CGError CGPostKeyboardEvent (CGCharCode keyChar, CGKeyCode virtualKey, boolean_t keyDown); API works fine for all the events. However, we are facing an issue with Caps Lock key. When we post a synthetic event from

Re: os x gui scripting

2008-12-22 Thread Luca Cioria
If you say so.. but for example how would you click at specified coordinates in applescript? or get a pixel color? Of course, if an app is scriptable I use appscpt or automator, but in many case, even websites, I have to follow this path. thanks Luca On Mon, Dec 22, 2008 at 8:53 AM, Andrew Farmer

Re: Xcode Question

2008-12-22 Thread Marcelo Cicconet
Hi.These are those I use frequently: COMMAND+SHIFT+Y: view debugger COMMAND+0: view Xcode main window COMMAND+ENTER: build and go COMMAND+OPTION+A: add to project OPTION-[DOUBLE CLICK] over a word: find the word in xcode documentation COMMAND-[DOUBLE CLICK] over a word: find the word in header fil

Re: observeValueForKeyPath and how to do it right

2008-12-22 Thread Chris Idou
--- On Mon, 22/12/08, Ken Thomases wrote: > From: Ken Thomases > Subject: Re: observeValueForKeyPath and how to do it right > To: "Chris Idou" > Cc: cocoa-dev@lists.apple.com > Received: Monday, 22 December, 2008, 6:36 PM > On Dec 22, 2008, at 8:19 PM, Chris > Idou wrote: > > > I've got a NS

Re: Configuring NSNumberFormatter non-programmatically

2008-12-22 Thread Nathan Kinsinger
On Dec 22, 2008, at 9:11 AM, Avery Nickelby wrote: I've looked through the archives and the documentation; most of the information is related to using NSNumberFormatter programatically. I am looking for a good explanation for using 10.4 style data formatters in Interface Builder; when I confi

Re: NSString property: copy or retain?

2008-12-22 Thread Clark Cox
On Mon, Dec 22, 2008 at 5:41 PM, Ricky Sharp wrote: > > On Dec 22, 2008, at 4:04 PM, Debajit Adhikary wrote: > >> Let's say I have a class called SomeClass with a string property name: >> >> @interface SomeClass : NSObject{ >> NSString* name; >> } >> >> @property (nonatomic, retain) NSString* na

Re: Core DataTableView Column Sort at launch with bindings?

2008-12-22 Thread vince
I got this working: I placed the following in my windowControllerDidLoadNib method: NSSortDescriptor * sorter = [[NSSortDescriptor alloc] initWithKey:@"nameColumn" ascending:YES]; [myArrayController setSortDescriptors:[NSArray arrayWithObject:sorter]]; I set the table sorting properties to: As

Re: observeValueForKeyPath and how to do it right

2008-12-22 Thread Ken Thomases
On Dec 22, 2008, at 8:19 PM, Chris Idou wrote: I've got a NSTableView controlled by a NSArrayController using content set binding. One of the columns is a checkbox, and I need to take some action when the user changes the value, but I don't want to put the code in the actual object, because

observeValueForKeyPath and how to do it right

2008-12-22 Thread Chris Idou
I've got a NSTableView controlled by a NSArrayController using content set binding. One of the columns is a checkbox, and I need to take some action when the user changes the value, but I don't want to put the code in the actual object, because it would be beyond the concerns of this object to d

Re: Replacing objects

2008-12-22 Thread Ken Thomases
On Dec 22, 2008, at 6:55 PM, Mike Abdullah wrote: No, the whole point is that although the proxy descends from a different hierarchy, no-one outside the proxy need know this. All other code treats it as though it were a non-proxy object of the expected class. Whenever one of the class's met

Re: Replacing objects

2008-12-22 Thread WT
On Dec 23, 2008, at 1:55 AM, Mike Abdullah wrote: On 23 Dec 2008, at 00:30, WT wrote: On Dec 23, 2008, at 1:04 AM, Kyle Sluder wrote: On Mon, Dec 22, 2008 at 6:03 PM, WT wrote: Of course, the proxy object's class has to share the same interface as the class of the objects it represents s

Re: Replacing objects

2008-12-22 Thread Shawn Erickson
On Mon, Dec 22, 2008 at 4:30 PM, WT wrote: > One is not obligated to use NSProxy to implement the Proxy pattern. I must > admit not being all that familiar with NSProxy, but having the proxy and the > object it stands for share the same public API (by being instances of > subclasses of the same a

Re: Replacing objects

2008-12-22 Thread Mike Abdullah
On 23 Dec 2008, at 00:30, WT wrote: On Dec 23, 2008, at 1:04 AM, Kyle Sluder wrote: On Mon, Dec 22, 2008 at 6:03 PM, WT wrote: Of course, the proxy object's class has to share the same interface as the class of the objects it represents so that your code doesn't need to know whether it'

Re: C++ instance variables not destructed if NSZombieEnabled

2008-12-22 Thread Klaus Backert
On 22.12.2008, at 22:54, Greg Parker wrote: On Dec 22, 2008, at 6:49 AM, Klaus Backert wrote: In an application of mine I have some Objective-C classes with C++ instance variables (the Objective-C things own the C++ things). I build with the option GCC_OBJC_CALL_CXX_CDTORS = YES, i.e. run n

Re: Debugging memory smashers with GC

2008-12-22 Thread Rob Keniger
On 23/12/2008, at 10:24 AM, Bill Bumgarner wrote: Not necessarily. Any number of things can cause crashes like this: - trashing memory - thread mis-synchronization - something goes awry in the malloc zone That it never happens under Instruments indicates that it might be a threading issue

Re: Replacing objects

2008-12-22 Thread WT
On Dec 23, 2008, at 1:04 AM, Kyle Sluder wrote: On Mon, Dec 22, 2008 at 6:03 PM, WT wrote: Of course, the proxy object's class has to share the same interface as the class of the objects it represents so that your code doesn't need to know whether it's dealing with a proxy or with the rea

Re: Debugging memory smashers with GC

2008-12-22 Thread Bill Bumgarner
On Dec 22, 2008, at 4:19 PM, Rob Keniger wrote: My app is using garbage collection and I'm running into a memory smasher bug where the app will crash at seemingly random times, with an EXE_BAD_ACCESS. Obviously there is some reference to an object that is being released when I don't want i

Debugging memory smashers with GC

2008-12-22 Thread Rob Keniger
Hi, My app is using garbage collection and I'm running into a memory smasher bug where the app will crash at seemingly random times, with an EXE_BAD_ACCESS. Obviously there is some reference to an object that is being released when I don't want it to be but I'm having a lot of trouble tra

Re: Replacing objects

2008-12-22 Thread Kyle Sluder
On Mon, Dec 22, 2008 at 6:03 PM, WT wrote: > Of course, > the proxy object's class has to share the same interface as the class of the > objects it represents so that your code doesn't need to know whether it's > dealing with a proxy or with the real thing. This isn't true in Objective-C. Take a

Re: NSStream APIs

2008-12-22 Thread Alex Kac
I have - and there are still so many questions with things like the HTTP Post CF code I have and that's what I was hoping for something more in-depth. On Dec 22, 2008, at 4:32 PM, Jean-Daniel Dupas wrote: Le 22 déc. 08 à 19:48, Alex Kac a écrit : Does anyone have a good tutorial on how

Re: selectionShouldChangeInTableView called twice

2008-12-22 Thread Andre Masse
On Dec 22, 2008, at 12:12, Corbin Dunn wrote: Sorry for the late reply on this, but just to add what others have said, and to make more sense of what is going on: When the selection is changing, the tableview is in the middle of tracking the mouse. It sends out the - selectionShouldChan

Re: Replacing objects

2008-12-22 Thread WT
Hi Dimitri, you can make use of the so-called Proxy design pattern. Write all your code in terms of a proxy object that stands in for the real thing. Then your code doesn't have to know, or care, whether the object you're manipulating comes from the server or is local. It's the responsibi

Re: Replacing objects

2008-12-22 Thread Ken Thomases
On Dec 22, 2008, at 4:09 PM, DAS wrote: Is it possible to replace an object with another object so that all pointers to that object now point to the new object? No. There are techniques you can use to achieve something similar, but I think the real problem is with your design. If you're

Re: NSString property: copy or retain?

2008-12-22 Thread Ken Thomases
On Dec 22, 2008, at 4:04 PM, Debajit Adhikary wrote: Let's say I have a class called SomeClass with a string property name: @interface SomeClass : NSObject{ NSString* name; } @property (nonatomic, retain) NSString* name; @end I understand that name may be assigned a NSMutableString in whi

Re: NSString property: copy or retain?

2008-12-22 Thread Ricky Sharp
On Dec 22, 2008, at 4:04 PM, Debajit Adhikary wrote: Let's say I have a class called SomeClass with a string property name: @interface SomeClass : NSObject{ NSString* name; } @property (nonatomic, retain) NSString* name; @end I understand that name may be assigned a NSMutableString in wh

Re: NSString property: copy or retain?

2008-12-22 Thread Jean-Daniel Dupas
Le 22 déc. 08 à 23:04, Debajit Adhikary a écrit : Let's say I have a class called SomeClass with a string property name: @interface SomeClass : NSObject{ NSString* name; } @property (nonatomic, retain) NSString* name; @end I understand that name may be assigned a NSMutableString in which

Re: Thread crashing problem

2008-12-22 Thread Michael Ash
On Mon, Dec 22, 2008 at 10:22 AM, Ken Tozier wrote: > How would one share a lock? Should I make it a property of the class? And > then what? According to the NSLock documentation, multiple calls to tryLock > are a no no, so how does one determine the current state of a lock? I didn't > see any met

Re: NSStream APIs

2008-12-22 Thread Jean-Daniel Dupas
Le 22 déc. 08 à 19:48, Alex Kac a écrit : Does anyone have a good tutorial on how to use these? I have to admit to being stumped. I have some pre-written code written using NSData to send data using CFNetwork and ASyncSocket code and I just can't seem to figure out how to get the file st

Re: Drawing in a NSView out side of drawRect

2008-12-22 Thread Michael Ash
On Mon, Dec 22, 2008 at 4:22 PM, David Alter wrote: >> > CGContextRef myContext = >> > (CGContextRef)[[NSGraphicsContext currentContext]graphicsPort]; >> >> Right now you're getting the current graphics context, which is purely >> arbitrary. Nothing has set it yet, so you're getting whatever h

Replacing objects

2008-12-22 Thread DAS
Hey guys, I'm fairly new to cocoa development here, so please bear with me. Is it possible to replace an object with another object so that all pointers to that object now point to the new object? In other words: Ptr A -> object1 Ptr B -> object1 Ptr C -> object1 I want to replace object1 with ano

NSString property: copy or retain?

2008-12-22 Thread Debajit Adhikary
Let's say I have a class called SomeClass with a string property name: @interface SomeClass : NSObject{ NSString* name; } @property (nonatomic, retain) NSString* name; @end I understand that name may be assigned a NSMutableString in which case this will may to errant behavior. (1) For stri

Re: NSMutableArray sorting

2008-12-22 Thread Ben Trumbull
On Dec 22, 2008, at 8:13 AM, Adam R. Maxwell wrote: On Dec 22, 2008, at 1:09 AM, Ben Trumbull wrote: I've never seen it documented though perceived performance would indicate this is indeed the case Generally, implementation details about caching behaviors falls isn't something that gets

Re: C++ instance variables not destructed if NSZombieEnabled

2008-12-22 Thread Greg Parker
On Dec 22, 2008, at 6:49 AM, Klaus Backert wrote: In an application of mine I have some Objective-C classes with C++ instance variables (the Objective-C things own the C++ things). I build with the option GCC_OBJC_CALL_CXX_CDTORS = YES, i.e. run non- trivial default constructors and destructo

Re: NSCalendar/NSDate - generating all months/days in a year

2008-12-22 Thread Kenneth Bruno
On Mon, 22 Dec 2008 12:01:11 -0800, "mmalc Crawford" said: > > On Dec 22, 2008, at 11:48 AM, Kenneth Bruno wrote: > > > Basically, NSCalendarDate gets you pretty much what you need: > > > As in a recent message: > > "Important: Use of NSCalendarDate strongly discouraged. It is not > deprecat

Re: Drawing in a NSView out side of drawRect

2008-12-22 Thread David Alter
> > > CGContextRef myContext = > > (CGContextRef)[[NSGraphicsContext currentContext]graphicsPort]; > > Right now you're getting the current graphics context, which is purely > arbitrary. Nothing has set it yet, so you're getting whatever happened > to be hanging around. Is there a way to crea

Re: Optimizing NSRectFill

2008-12-22 Thread Peter Ammon
setNeedsDisplay: and setNeedsDisplayInRect: do not integrate with coalesced updates as well as they might. If you call setNeedsDisplay: faster than 60 times per second, then you will encounter the problem described in the technote. Did turning off coalesced updates in Quartz Debug help? I

Core DataTableView Column Sort at launch with bindings?

2008-12-22 Thread vince
Thanks for the help ... Is it possible to set up my Core Data doc application's Bindings so that upon launch my mainColumn header is selected and the column is pre-sorted (ascending) without implementing code? thanks again. vince. ___ Cocoa-dev mailing

Re: Cocoa-dev Digest, Vol 5, Issue 2191

2008-12-22 Thread mmalc Crawford
On Dec 22, 2008, at 11:48 AM, Kenneth Bruno wrote: Basically, NSCalendarDate gets you pretty much what you need: As in a recent message: "Important: Use of NSCalendarDate strongly discouraged. It is not deprecated yet, however it may be in the next major OS release after Mac OS X v10.5.

Re: Cocoa-dev Digest, Vol 5, Issue 2191

2008-12-22 Thread Kenneth Bruno
On Dec 22, 2008, at 2:53 AM, Keith Blount wrote: > All I want to do is this: I would like to generate the names of all the > months for a specified year. Then for each month in that year, I would > like to generate the names of every day. For instance: > > 2009 > - January > -- Thursday, 1st Janu

Re: CharacterAtIndex method?

2008-12-22 Thread Kevin Gessner
On Dec 22, 2008, at 2:22 PM, Richard S. French wrote: I am receiving a compiler warning: “NSString may not respond to –characterAtIndex” from the following code. This is from MathPaper – Chapter 12 of Building Cocoa Apps. Any help is appreciated. Thanks. - (void)appendString:(NSString *)stri

Re: NSCalendar/NSDate - generating all months/days in a year

2008-12-22 Thread Nathan Vander Wilt
On Dec 22, 2008, at 11:38 AM, mmalc Crawford wrote: On Dec 22, 2008, at 9:22 AM, Nathan Vander Wilt wrote: [Good advice, except:] NSCalendar can handle overflow, so you can have an NSDateComponent that says something like Year:2008 Month:1 Days:364 and you will get the right date from compon

CharacterAtIndex method?

2008-12-22 Thread Richard S. French
I am receiving a compiler warning: ³NSString may not respond to ­characterAtIndex² from the following code. This is from MathPaper ­ Chapter 12 of Building Cocoa Apps. Any help is appreciated. Thanks. - (void)appendString:(NSString *)string { int i; for (i=0;i<[string length];i++) {

Re: NSCalendar/NSDate - generating all months/days in a year

2008-12-22 Thread mmalc Crawford
On Dec 22, 2008, at 11:20 AM, Ken Tozier wrote: NSCalendarDate *date = [NSCalendarDate dateWithYear: ... No! This is precisely the direction in which not to go: "Important: Use of NSCalendarDate strongly discouraged. It is not deprecated yet, however it may be in the next major OS release a

Re: Color space for cmyk eps images converting to rgb

2008-12-22 Thread Ken Ferry
Hi Ken, The -colorSpaceName method on NSImageRep returns only a best-effort approximation. This method, like many of the methods of NSImageRep, is used by NSImage to decide which NSImageRep is the best choice for drawing to a given destination. The design is easiest to comprehend from that point

Re: NSCalendar/NSDate - generating all months/days in a year

2008-12-22 Thread Ken Tozier
Following everyone's advice, I came up with the following, more compact, solution - (NSDictionary *) dates:(int) inYear { NSMutableDictionary *result = [NSMutableDictionary dictionary]; NSMutableArray *days = [NSMu

NSStream APIs

2008-12-22 Thread Alex Kac
Does anyone have a good tutorial on how to use these? I have to admit to being stumped. I have some pre-written code written using NSData to send data using CFNetwork and ASyncSocket code and I just can't seem to figure out how to get the file stream stuff in there. What I would love is not

Re: NSCalendar/NSDate - generating all months/days in a year [SOLVED]

2008-12-22 Thread Keith Blount
Many thanks for your replies, and for the pointers to the samples and your own example - much appreciated. Before getting your second reply I'd just been through the code and done something pretty similar, using the suggestions you posted, to build up my hierarchical list for use in an NSOutline

drag'n'drop - stopping the image from being displayed.

2008-12-22 Thread John Clayton
Hi I'd like to stop any drag image from being displayed under or near the mouse cursor during a drag operation when something is being dragged into my application from the finder. The reason is that my app provides sufficient feedback to the user about the dragging operation already, and

Re: NSCalendar/NSDate - generating all months/days in a year

2008-12-22 Thread mmalc Crawford
On Dec 22, 2008, at 9:22 AM, Nathan Vander Wilt wrote: [Good advice, except:] NSCalendar can handle overflow, so you can have an NSDateComponent that says something like Year:2008 Month:1 Days:364 and you will get the right date from components. You should not rely on this behaviour. mma

Re: NSCalendar/NSDate - generating all months/days in a year [SOLVED]

2008-12-22 Thread mmalc Crawford
On Dec 22, 2008, at 8:47 AM, mmalc Crawford wrote: There shouldn't be any need, though, to "add a month" for each iteration, just start a new month with a date components object with a new month number. This could be made a little more efficient (and if you're not using garbage collectio

Re: warning: unused parameter '_value'

2008-12-22 Thread Nathan Vander Wilt
On Dec 22, 2008, at 4:42 AM, Gerriet M. Denkmann wrote: When I use [GCC_WARN_UNUSED_PARAMETER, -Wunused-parameter] I get (in Release build, not in Development) for every @synthesize statement a warning: warning: unused parameter '_value' There is no "value" nor "_value" in the source to be fo

Re: Managed Object won't dealloc even after Hit with Kitchen Sink

2008-12-22 Thread Jim Correia
On Dec 22, 2008, at 12:17 AM, Jerry Krinock wrote: REAL-LIFE PROBLEM In a managed memory application, I have a managed object which, besides its Core Data managed properties, has a single instance variable, a worker-kind of object which does some heavy lifting for it. So that this retain

Re: NSCalendar/NSDate - generating all months/days in a year

2008-12-22 Thread Nathan Vander Wilt
On Dec 22, 2008, at 4:53 AM, Keith Blount wrote: Hi, Apologies in advance for what I think must be a basic question. It's something I've never had cause to do before, assumed must be fairly straightforward, and then seemed a lot more complicated than it should be which leads me to think t

Re: selectionShouldChangeInTableView called twice

2008-12-22 Thread Corbin Dunn
On Dec 20, 2008, at 10:23 AM, Andre Masse wrote: Hi, I'm using a master/detail view in my application. If the user select another row in the master table and the detail has been modified, I want to present an alert to save, cancel or return to detail. I'm not using binding here, only dat

Re: Thread crashing problem

2008-12-22 Thread Jason Foreman
On Dec 22, 2008, at 9:42 AM, Ken Tozier wrote: Problem is, I'm a thread noob so have no idea which type of lock is right for my situation. As to @synchronized, Robert Marini seemed to suggest that that was a Leopard-pnly solution. This app has to work on Tiger as well. As a self professe

Re: NSCalendar/NSDate - generating all months/days in a year [SOLVED]

2008-12-22 Thread mmalc Crawford
On Dec 22, 2008, at 8:34 AM, Keith Blount wrote: Hi, Many thanks to both of you for your very helpful replies - much appreciated! I've gone with Ken's solution, which works perfectly for what I need. For the sake of the archives, I've attached the method I created based on Ken's code, wh

Re: Thread crashing problem

2008-12-22 Thread Scott Ribe
> Given that, could you give a really simple example of how to > coordinate access between the three methods? First, your lock is an instance variable of the class, so in init you alloc & init it, and in dealloc you release it... - (void) methodA { [myLock tryLockBeforeDate: [NSDate distantFu

Re: NSCalendar/NSDate - generating all months/days in a year [SOLVED]

2008-12-22 Thread Keith Blount
Hi, Many thanks to both of you for your very helpful replies - much appreciated! I've gone with Ken's solution, which works perfectly for what I need. For the sake of the archives, I've attached the method I created based on Ken's code, which just creates a hierarchical dictionary of objects wi

Re: NSMutableArray sorting

2008-12-22 Thread Adam R. Maxwell
On Dec 22, 2008, at 1:09 AM, Ben Trumbull wrote: I've never seen it documented though perceived performance would indicate this is indeed the case Generally, implementation details about caching behaviors falls isn't something that gets formally documented. It's not part of the API contr

Configuring NSNumberFormatter non-programmatically

2008-12-22 Thread Avery Nickelby
I've looked through the archives and the documentation; most of the information is related to using NSNumberFormatter programatically. I am looking for a good explanation for using 10.4 style data formatters in Interface Builder; when I configure a number data formatter I can only get one of two be

Re: Thread crashing problem

2008-12-22 Thread Kyle Sluder
On Mon, Dec 22, 2008 at 10:42 AM, Ken Tozier wrote: > "You should not use this class to implement a recursive lock. Calling the > lock method twice on the same thread will lock up your thread permanently. > Use the NSRecursiveLock class to implement recursive locks instead." It says "lock", not "

Re: Thread crashing problem

2008-12-22 Thread Ken Tozier
On Dec 22, 2008, at 10:30 AM, Kyle Sluder wrote: Nowhere does the documentation say this. You can't call -[NSLock lock] multiple times, because you'll block on a lock you already have (that's why we have recursive locks). Otherwise -[NSLock tryLock] would be quite useless, wouldn't it? Mayb

Re: Thread crashing problem

2008-12-22 Thread Kyle Sluder
On Mon, Dec 22, 2008 at 10:22 AM, Ken Tozier wrote: > How would one share a lock? Should I make it a property of the class? And > then what? According to the NSLock documentation, multiple calls to tryLock > are a no no, so how does one determine the current state of a lock? I didn't > see any met

Re: Thread crashing problem

2008-12-22 Thread Ken Tozier
How would one share a lock? Should I make it a property of the class? And then what? According to the NSLock documentation, multiple calls to tryLock are a no no, so how does one determine the current state of a lock? I didn't see any methods like "isLocked" On Dec 22, 2008, at 10:12 AM,

Re: Thread crashing problem

2008-12-22 Thread Robert Marini
If you can target Leopard and above, @synchronized is probably a better route to go though as scott said, the object to be synchronized around would need to be checked by all methods using it (in your case this would be the instance of the NSLock). -rob. On Dec 22, 2008, at 10:12 AM, Scott

Re: Thread crashing problem

2008-12-22 Thread Scott Ribe
Unless that busy flag is only used for UI display or debugging info, lose it. The lock is the way to coordinate access, you can't do that by checking a flag. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___

Re: Thread crashing problem

2008-12-22 Thread Scott Ribe
The lock (the same one) has to be used by all the methods to coordinate access. Taking a lock in updateDirectoriesInThread doesn't magically make addDirectory and removeDirectory wait for the lock. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___

Re: Thread crashing problem

2008-12-22 Thread Ken Tozier
Found a partial solution but it's ugly. If I copy the array before enumerating it, no more crashes, but I'd prefer to not add that overhead... On Dec 22, 2008, at 9:24 AM, Ken Tozier wrote: Hi I wrote a little app to do deep folder watching on Windows servers from a Mac and am getting c

Re: NSMutableArray sorting

2008-12-22 Thread Scott Ribe
> Generally, implementation details about caching behaviors falls isn't > something that gets formally documented. It's not part of the API > contract, and can change some from release to release. True, but significant performance behaviors should be documented. -- Scott Ribe scott_r...@killerb

C++ instance variables not destructed if NSZombieEnabled

2008-12-22 Thread Klaus Backert
In an application of mine I have some Objective-C classes with C++ instance variables (the Objective-C things own the C++ things). I build with the option GCC_OBJC_CALL_CXX_CDTORS = YES, i.e. run non- trivial default constructors and destructors on C++ instance variables of Objective-C class

Re: Reliable way to capitalize camel-case strings? [SOLVED]

2008-12-22 Thread Jean-Daniel Dupas
Le 22 déc. 08 à 14:48, Michael Ash a écrit : On Mon, Dec 22, 2008 at 8:25 AM, Graham Cox wrote: I ended up writing this category method. I guess it will be reliable, as it's making no assumptions about encoding. Actually it is! It assumes that the first character is the first "characte

Thread crashing problem

2008-12-22 Thread Ken Tozier
Hi I wrote a little app to do deep folder watching on Windows servers from a Mac and am getting crashes when directories are added or removed from the watch directory. The directory scanning takes place in a thread and I tried to isolate the array from outside changes by locking it, but i

Re: warning: unused parameter '_value'

2008-12-22 Thread Michael Ash
On Mon, Dec 22, 2008 at 5:42 AM, Gerriet M. Denkmann wrote: > When I use [GCC_WARN_UNUSED_PARAMETER, -Wunused-parameter] > > I get (in Release build, not in Development) for every @synthesize statement > a warning: > warning: unused parameter '_value' > There is no "value" nor "_value" in the sour

Re: Reliable way to capitalize camel-case strings? [SOLVED]

2008-12-22 Thread Michael Ash
On Mon, Dec 22, 2008 at 8:25 AM, Graham Cox wrote: > > I ended up writing this category method. I guess it will be reliable, as > it's making no assumptions about encoding. Actually it is! It assumes that the first character is the first "character". You'll want to stick in a call to -rangeOfComp

Re: Reliable way to capitalize camel-case strings?

2008-12-22 Thread Gregory Weston
Graham Cox wrote: In my app I need a way to generate the name of a method based on a property key. If the key is, e.g. -scaleFactor, and the generated method name needs to be -displayNameForScaleFactor, how can I reliably turn "scaleFactor" into "ScaleFactor"? I tried [NSString capitalizedString

Re: Reliable way to capitalize camel-case strings? [SOLVED]

2008-12-22 Thread Graham Cox
On 22 Dec 2008, at 11:22 pm, Rob Rix wrote: I’m interested to know if there’s a better way to do this than the ugly way I’ve been using, too: NSString *first = [string substringWithRange: NSMakeRange(0, 1)]; NSString *rest = [string substringFromIndex: 1]; NSString *result = [[first uppercas

Re: NSCalendar/NSDate - generating all months/days in a year

2008-12-22 Thread WT
Hi Keith, Ken's suggestion is much more elegant than mine, but here's mine anyway. I wrote a little Foundation Tool to test it and it works fine. Note that the year (2009), and the fact that 2009 is not a leap year, are hard-coded. You'll have to change that, of course. Hope this helps. W

Re: Reliable way to capitalize camel-case strings?

2008-12-22 Thread Rob Rix
I’m interested to know if there’s a better way to do this than the ugly way I’ve been using, too: NSString *first = [string substringWithRange: NSMakeRange(0, 1)]; NSString *rest = [string substringFromIndex: 1]; NSString *result = [[first uppercaseString] stringByAppendingString: rest]; Ro

Re: NSCalendar/NSDate - generating all months/days in a year

2008-12-22 Thread Ken Tozier
Fun problem Basically it's safe to assume 24 hours in a day for date calculation (check details at Wikipedia) so you just have to get January 1 of the target year, January 1 of the subsequent year and increment until the time interval between them equals zero. This makes no assumptions ab

Re: Saving the project

2008-12-22 Thread Mike Abdullah
Either NSWindow or NSWindowController have a -setDocumentEdited: method that will do what you want. On 22 Dec 2008, at 11:39, Mahaboob wrote: In my app I used NSTextView as editor and saves my project along with the contents of editor by using archiving and also I can open the saved projec

Saving the project

2008-12-22 Thread Mahaboob
In my app I used NSTextView as editor and saves my project along with the contents of editor by using archiving and also I can open the saved project. Now I need to show a bubble in the close button when I'm making any changes in the editor. How can I show the bubble? How can I notify when the edit

Re: Accepting iCal events dropped on my application's icon

2008-12-22 Thread Yang Meyer
Sean, So in essence my question is: How can I tell my application to accept iCal events dragged directly from the iCal GUI? When iCal events are dragged and exported to another application, iCal will provide a promised .ics file in ~/Library/Caches/ TemporaryItems. This file has an extens

Reliable way to capitalize camel-case strings?

2008-12-22 Thread Graham Cox
In my app I need a way to generate the name of a method based on a property key. If the key is, e.g. -scaleFactor, and the generated method name needs to be -displayNameForScaleFactor, how can I reliably turn "scaleFactor" into "ScaleFactor"? I tried [NSString capitalizedString] but I get "

NSCalendar/NSDate - generating all months/days in a year

2008-12-22 Thread Keith Blount
Hi, Apologies in advance for what I think must be a basic question. It's something I've never had cause to do before, assumed must be fairly straightforward, and then seemed a lot more complicated than it should be which leads me to think that I am using the wrong search terms... All I want to

warning: unused parameter '_value'

2008-12-22 Thread Gerriet M. Denkmann
When I use [GCC_WARN_UNUSED_PARAMETER, -Wunused-parameter] I get (in Release build, not in Development) for every @synthesize statement a warning: warning: unused parameter '_value' There is no "value" nor "_value" in the source to be found. What am I doing wrong? Xcode Version 3.1.1; gcc 4.

Re: Toll Free Garbage

2008-12-22 Thread Julien Jalon
Under GC, retain/release is not the same as CFRetain/CFRelease (retain/release does nothing but CFRetain/CFRelease ensures that the object is kept around even if the GC might want to finalize it). The general idea is then that you will have to "cast" the CFRetain at the same time you cast the CFTyp

Re: NSToolbarItem identifier?

2008-12-22 Thread Quincey Morris
On Dec 22, 2008, at 00:44, aaron smith wrote: I haven't been able to figure out how to set a custom identifier with NSToolbarItem's. Is it possible? I don't see it anywhere in IB, or anywhere in the class documentation? I can see the identifier at runtime, but it's a uuid, can't I set a custom i

re: Managed Object won't dealloc even after Hit with Kitchen Sink

2008-12-22 Thread Ben Trumbull
// Insert a Foo without telling the undo manager [undoManager disableUndoRegistration] ; Foo *foo = [[Foo alloc] initWithEntity:runEntity insertIntoManagedObjectContext:moc]; That's standard alloc/init. It's retained and needs a matching release from you. Whether or n

Re: NSMutableArray sorting

2008-12-22 Thread Ben Trumbull
I've never seen it documented though perceived performance would indicate this is indeed the case Generally, implementation details about caching behaviors falls isn't something that gets formally documented. It's not part of the API contract, and can change some from release to release.

NSToolbarItem identifier?

2008-12-22 Thread aaron smith
I haven't been able to figure out how to set a custom identifier with NSToolbarItem's. Is it possible? I don't see it anywhere in IB, or anywhere in the class documentation? I can see the identifier at runtime, but it's a uuid, can't I set a custom identifier? Thanks all. _

  1   2   >