Re: Setting a frame on a CALayer increments its retain count!?

2009-12-14 Thread Kyle Sluder
On Mon, Dec 14, 2009 at 10:39 PM, Tino Rachui wrote: > Why does setting a frame on the layer increments its retain count? > What am I missing? Stop caring about retain count. Follow the memory management rules and be done with it. --Kyle Sluder ___ C

Setting a frame on a CALayer increments its retain count!?

2009-12-14 Thread Tino Rachui
This puzzles me a bit: ... NSUInteger rc; CALayer *layer = [CALayer layer]; rc = [layer retainCount]; // rc == 1 as expected layer.frame = CGRectMake(...); rc = [layer retainCount]; // now rc == 2, it's not clear to me why ... Why does setting a frame on the layer increments its retain count? Wha

Re: memcpy with 64 bit

2009-12-14 Thread Greg Guerin
gMail.com wrote: Thanks, in the meantime I realized that I had to change imagePtr from int into an NSInteger. Now it works. Do you think it is ok? The standardized size_t typedef would be a better choice than NSInteger. The latter is signed. Handle imagesH = NewHandleClear(t

Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Ken Thomases
On Dec 14, 2009, at 9:59 PM, PCWiz wrote: > What if I used NSInvocationOperation like this: > > NSInvocationOperation *myOperation = [[NSInvocationOperation alloc] > initWithTarget:self >selector:@selector(doResourceHungryTask) object:nil]; > [operationQueue addOperation:myOperation]; > > "

Re: memcpy with 64 bit

2009-12-14 Thread Andrew Farmer
On 14 Dec 2009, at 11:06, gMail.com wrote: > Handle imagesH = NewHandleClear(totImages * oneImageSize); Wait, Handle? NewHandleClear? Your use of these functions suggests that you may be working from a dangerously old textbook. There's really no reason to use them in new code._

Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread PCWiz
Ah I understand, that makes sense. Thanks. On 2009-12-14, at 9:09 PM, Nick Zitzmann wrote: > > On Dec 14, 2009, at 9:07 PM, PCWiz wrote: > >> So to make it clear, I invoke the method as an NSInvocationOperation then in >> the method I do this whenever I need to access the mutable dictionary: >

Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Nick Zitzmann
On Dec 14, 2009, at 9:07 PM, PCWiz wrote: > So to make it clear, I invoke the method as an NSInvocationOperation then in > the method I do this whenever I need to access the mutable dictionary: > > - (void)doResourceHungryTask { > ... > @synchronized (myDictionary) { >

Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread PCWiz
Ok, I think I understand this after reading this document: http://developer.apple.com/mac/articles/cocoa/managingconcurrency.html So to make it clear, I invoke the method as an NSInvocationOperation then in the method I do this whenever I need to access the mutable dictionary: - (void)doResourc

[moderator] Re: Don't Report Documentation Bugs to Apple Bug Reporter

2009-12-14 Thread Scott Anguish
Putting my “Moderator/Dev Publications Engineer/Writer hat on” I’ve asked Jerry off-list for the radar number to follow up on the developer documentation issue. If it isn’t a technical issue, it could be redirected there I suppose, but that’s the only reason I can think of. I’ve asked my manag

Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Nick Zitzmann
On Dec 14, 2009, at 8:59 PM, PCWiz wrote: > "doResourceHungryTask" would be a method in my delegate class. Would I still > need to lock/unlock (I'm modifying the class's properties from itself, not > another class)? I'm not sure on the exact workings of NSInvocationOperation, > I just found ou

Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread PCWiz
What if I used NSInvocationOperation like this: NSInvocationOperation *myOperation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(doResourceHungryTask) object:nil]; [operationQueue addOperation:myOperation]; "doResourceHungryTask" would be a method in my delegate cla

pls explain rotated iPhone coordinates to me

2009-12-14 Thread Matt Neuburg
I am not grasping how coordinates work in a rotated iPhone app, and I'm hoping someone will explain them. My goal is a scroll view consisting of two equal "pages" side by side with the iPhone sideways (landscape). I have accomplished this, but I don't understand how I did it; I used pure trial and

Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Ken Thomases
On Dec 14, 2009, at 6:54 PM, PCWiz wrote: > On 2009-12-14, at 5:51 PM, Nick Zitzmann wrote: > >> On Dec 14, 2009, at 5:19 PM, PCWiz wrote: >> >>> I need to modify an NSMutableDictionary in my delegate class from within an >>> NSOperation subclass. What's the best way to do this? I could just us

Don't Report Documentation Bugs to Apple Bug Reporter

2009-12-14 Thread Jerry Krinock
Some time ago we had a discussion as to whether documentation bugs should be reported to the "Did this document help you?" link at the bottom, or by filing a Bug Report. The conclusion at the time was that, although both were acceptable, the formal Bug Report was better. Apparently, no more.

Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Nick Zitzmann
On Dec 14, 2009, at 5:54 PM, PCWiz wrote: > Its being loaded into an NSOperationQueue, and I'm using methods like > setObject:forKey: on the dictionary, not replacing the whole thing. Then you need to lock and unlock everything that reads from or writes to the dictionary. Properties are no sub

Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread PCWiz
Its being loaded into an NSOperationQueue, and I'm using methods like setObject:forKey: on the dictionary, not replacing the whole thing. Thanks On 2009-12-14, at 5:51 PM, Nick Zitzmann wrote: > > On Dec 14, 2009, at 5:19 PM, PCWiz wrote: > >> I need to modify an NSMutableDictionary in my dele

Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Nick Zitzmann
On Dec 14, 2009, at 5:19 PM, PCWiz wrote: > I need to modify an NSMutableDictionary in my delegate class from within an > NSOperation subclass. What's the best way to do this? I could just use the > property setter method, but is this even acceptable? More details, please. Is your operation en

NSSpellChecker language guessing doesn't work

2009-12-14 Thread Chris Idou
I'm trying to use guessesForWordRange:inString:language:inSpellDocumentWithTag: and have it use automatic language guessing, but it doesn't seem to work. At first I was just passing a word, and despite it being in Russian letters, I figured it didn't have enough context to guess. So I passed

Modifying outside properties from NSOperation subclass

2009-12-14 Thread PCWiz
I need to modify an NSMutableDictionary in my delegate class from within an NSOperation subclass. What's the best way to do this? I could just use the property setter method, but is this even acceptable? Thanks___ Cocoa-dev mailing list (Cocoa-dev@lis

Re: Problem with properties and setters; also:Surprising behavior of NSMutableArray - makes spontaneous copy

2009-12-14 Thread Mike Abdullah
On 14 Dec 2009, at 23:01, David Hirsch wrote: > (After drafting the first version of this email, I found a sort-of solution, > but I do not understand why it works. I thought that simple properties > (e.g., object.foo) essentially just called the foo:/setFoo: methods, > particularly if you us

Re: Problem with properties and setters; also:Surprising behavior of NSMutableArray - makes spontaneous copy

2009-12-14 Thread David Hirsch
Sorry - found the primary problem. Should have been this line: Instance *instanceToAlter = [newConfig.instances objectAtIndex:randInstance]; instead of: Instance *instanceToAlter = [self.instances objectAtIndex:randInstance]; However, I'm still mystified by the manifestation of the erro

Problem with properties and setters; also:Surprising behavior of NSMutableArray - makes spontaneous copy

2009-12-14 Thread David Hirsch
(After drafting the first version of this email, I found a sort-of solution, but I do not understand why it works. I thought that simple properties (e.g., object.foo) essentially just called the foo:/setFoo: methods, particularly if you used @property (assign). That is apparently not the

Re: Smooth Scrolling for NSScrollView

2009-12-14 Thread Jeff Johnson
On Dec 14, 2009, at 3:04 PM, Scott Ribe wrote: Smooth scrolling is an abomination anyway, by way of Microsoft, a feature that looked cool to some developer but has awful usability. With line-by-line scrolling you can actually read the top or bottom lines as they go by, and determine your pl

Re: NSString and Regular Expressions

2009-12-14 Thread Dave DeLong
RegexKit is the best (read: simplest) way to get regular expression support into your Cocoa apps. http://regexkit.sourceforge.net It's also possible to use NSPredicate for simple matching. You can find a couple of other options listed on this page: http://cocoaheads.byu.edu/resources/regex

NSString and Regular Expressions

2009-12-14 Thread Phil Hystad
I was sort of suspecting that regular expression matches would be supported by NSString yet I find no message interface for supporting regular expressions. So, is the only capability for handling regular expressions in Objective-C the Posix Regex library? phil phys...@mac.com

Re: NSTextView Bad Behavior

2009-12-14 Thread Gordon Apple
Thanks. Those are relatively new. I had forgotten about them. I think that did solve a few problems. However, I found that it doesn't set the container or frame length. Unfortunately, that API is private, so I had to find another way. I'm flipping text both H and/or V, scaling, and slow scroll

Re: Crash when 'open POSIX file /..' from AppleScript

2009-12-14 Thread Jerry Krinock
Sorry ... I had cloned from an sdef file that I had lying around. In its app suite was an override of the 'open' AppleScript command which was not applicable to the current app.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post

Re: Crash when 'open POSIX file /..' from AppleScript

2009-12-14 Thread Jerry Krinock
Thank you for the thoughts, guys. Sean, I just verified that Apple's DepartmentAndEmployees responds OK. But today, after making some other changes, my app is behaving differently. With AEDebugReceives=1, I see that it receives the SSys/odoc Apple Event with the file url in the data. What's s

Re: Smooth Scrolling for NSScrollView

2009-12-14 Thread Scott Ribe
Smooth scrolling is an abomination anyway, by way of Microsoft, a feature that looked cool to some developer but has awful usability. With line-by-line scrolling you can actually read the top or bottom lines as they go by, and determine your place in the document as it scrolls. With smooth scrolli

Re: double free error

2009-12-14 Thread Eric E. Dolecki
Many thanks and very good to know. On Mon, Dec 14, 2009 at 3:55 PM, Henry McGilton (Boulevardier) < appledevelo...@trilithon.com> wrote: > > On Dec 14, 2009, at 12:45 PM, Eric E. Dolecki wrote: > > I was receiving malloc double free errors when a view removed itself, so > all > of the releases I

Re: double free error

2009-12-14 Thread Henry McGilton (Boulevardier)
On Dec 14, 2009, at 12:45 PM, Eric E. Dolecki wrote: > I was receiving malloc double free errors when a view removed itself, so all > of the releases I was doing in the view I commented out, the view killing > itself after it animates from visual view: > > - (void) killMe:(NSString *)animationID

Re: Wierd Crash Report

2009-12-14 Thread David Blanton
Thanks to all ... I was unaware of the "Open With Rosetta" option in Get Info. I just had the user uncheck it and my code is running fine. So, how did it get checked in the first place ... hmm mystery as the user says she did not do it She did have a dealer tech rep out a few days ago, I

double free error

2009-12-14 Thread Eric E. Dolecki
I was receiving malloc double free errors when a view removed itself, so all of the releases I was doing in the view I commented out, the view killing itself after it animates from visual view: - (void) killMe:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { [self.v

Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Joe The Programmer
On Dec 14, 2009, at 12:16 PM, Matthew Lindfield Seager wrote: > That belongs to the preceding LSTypeIsPackage key. Yea, I was still sleeping when I responded to that last post. ;) Turned out that resource CFBundleDisplayName/CFBundleDocumentTypes should not have even been in the plist file

Re: Wierd Crash Report

2009-12-14 Thread Nick Zitzmann
On Dec 14, 2009, at 1:21 PM, Rippit the Ogg Frog wrote: > It can happen that there are Rosetta bugs that don't occur on native PowerPC > hardware. While that shouldn't ever be the case, we all know that > programmers are only human. Well, for starters, the garbage collector doesn't work under

Re: Wierd Crash Report

2009-12-14 Thread Rippit the Ogg Frog
From your crash log: Code Type: PPC (Translated) "Translated" - does that mean it's running under Rosetta on Intel? It can happen that there are Rosetta bugs that don't occur on native PowerPC hardware. While that shouldn't ever be the case, we all know that programmers are only huma

Re: Wierd Crash Report

2009-12-14 Thread Mike Abdullah
On 14 Dec 2009, at 19:40, David Blanton wrote: > > > I ask this here as I have seen questions on Crash Reports. > > This is is Universal Binary ... why is there any PPC involved as it is > running on Intel > > This is an iMac Code type says it all. "PPC (Translated)". i.e. the user has forc

Re: Wierd Crash Report

2009-12-14 Thread Jonathan del Strother
That looks an awful lot like it's running via rosetta. Perhaps the user has done Get Info on your app and ticked the 'Open using Rosetta' box? 2009/12/14 David Blanton : > > > I ask this here as I have seen questions on Crash Reports. > > This is is Universal Binary ... why is there any PPC invo

Wierd Crash Report

2009-12-14 Thread David Blanton
I ask this here as I have seen questions on Crash Reports. This is is Universal Binary ... why is there any PPC involved as it is running on Intel This is an iMac Can anyone shed some light for me ? Or tell me where to go with this type of issue .. Thanks db Process: Conve

Re: memcpy with 64 bit

2009-12-14 Thread Scott Ribe
> Thanks, in the meantime I realized that I had to change imagePtr from int > into an NSInteger. Now it works. Do you think it is ok? Well you found the crash, and the code now looks like it is "ok" in terms of allocating the right amount of memory. But it's still a confusing mess that is difficul

Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Matthew Lindfield Seager
Not directly related to your problem but just for your info... On Tuesday, December 15, 2009, Joe The Programmer wrote: >Regardless, there seems to be an erroneous in there. That belongs to the preceding LSTypeIsPackage key. ___ Cocoa-dev mailing li

Re: NSMutableAttributedString & Links color

2009-12-14 Thread PCWiz
Thanks, looks like what I need :-) On 2009-12-14, at 11:42 AM, Ross Carter wrote: > On Dec 13, 2009, at 8:55 PM, PCWiz wrote: > >> Hi, >> >> I am, for lack of a better word, "enabling" links in my >> NSMutableAttributedString by applying the NSLinkAttributeName attribute to >> them, and I'm c

Re: memcpy with 64 bit

2009-12-14 Thread gMail.com
Thanks, in the meantime I realized that I had to change imagePtr from int into an NSInteger. Now it works. Do you think it is ok? #define kDepth 32 NSInteger oneImageSize = width * height * (kDepth >> 3); Handle imagesH = NewHandleClear(totImages * oneImageSize); NSInteger

Re: NSTextView Bad Behavior

2009-12-14 Thread Douglas Davidson
On Dec 14, 2009, at 10:50 AM, Gordon Apple wrote: Any ideas on how to force a full layout and then prevent NSTextView from further mucking with it? One of NSLayoutManager's -ensureLayout... methods would be a good bet here. Douglas Davidson _

NSTextView Bad Behavior

2009-12-14 Thread Gordon Apple
Apparently, I'm not the only one who has experienced this. NSTextView (or NSLayoutManager) is lazy. It does stuff in the background that is driving me nuts. I need to do a full layout, not just what's visible, so I can get a reliably accurate measure of the total physical text layout length. I'

Re: memcpy with 64 bit

2009-12-14 Thread Quincey Morris
On Dec 14, 2009, at 10:27, gMail.com wrote: > if I compile this code against "32-bits Universal", it works. > If I compile this code against "64-bit Intel", it doesn't work. > I get a bad access error just on memcpy. What do I miss? I use: > >Base SDK 10.6 >i386 ppc ppc64 ppc7400 ppc970 x

Re: NSMutableAttributedString & Links color

2009-12-14 Thread Ross Carter
On Dec 13, 2009, at 8:55 PM, PCWiz wrote: > Hi, > > I am, for lack of a better word, "enabling" links in my > NSMutableAttributedString by applying the NSLinkAttributeName attribute to > them, and I'm changing their color from the default blue to a different color > using NSForegroundColorAttr

Re: memcpy with 64 bit

2009-12-14 Thread Mike Abdullah
Have you read the 64 bit transition guide? http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/Cocoa64BitGuide/Introduction/Introduction.html Your question (use of int) suggests not. On 14 Dec 2009, at 18:27, gMail.com wrote: > Hi, > if I compile this code against "32-bits Univ

Re: memcpy with 64 bit

2009-12-14 Thread Hank Heijink (Mailinglists)
On Dec 14, 2009, at 1:27 PM, gMail.com wrote: > Hi, > if I compile this code against "32-bits Universal", it works. > If I compile this code against "64-bit Intel", it doesn't work. > I get a bad access error just on memcpy. What do I miss? I use: > >Base SDK 10.6 >i386 ppc ppc64 ppc7400

Re: water effect on iPhone with touch methods

2009-12-14 Thread David Duncan
On Dec 11, 2009, at 6:45 PM, Chunk 1978 wrote: > i haven't yet started to study OpenGL, but i just came across a java > sample online that creates a water effect, and the sample code was > surprisingly quite small. > > here is the java example: http://www.neilwallis.com/java/water.html > > esse

Re: Crash when 'open POSIX file /..' from AppleScript

2009-12-14 Thread Jean-Daniel Dupas
Le 14 déc. 2009 à 19:13, Sean McBride a écrit : > On 12/12/09 11:12 PM, Jerry Krinock said: > >> Working on a Core Data document-based app. Executing the following >> AppleScript: >> >> tell application "MyApp" >> open POSIX file "/path/to/SomeDocument" >> end tell >> >> results in progr

memcpy with 64 bit

2009-12-14 Thread gMail.com
Hi, if I compile this code against "32-bits Universal", it works. If I compile this code against "64-bit Intel", it doesn't work. I get a bad access error just on memcpy. What do I miss? I use: Base SDK 10.6 i386 ppc ppc64 ppc7400 ppc970 x86_64 GCC 4.2 or 4.0 Target Mac OS X 10.6

Re: Crash when 'open POSIX file /..' from AppleScript

2009-12-14 Thread Sean McBride
On 12/12/09 11:12 PM, Jerry Krinock said: >Working on a Core Data document-based app. Executing the following >AppleScript: > >tell application "MyApp" > open POSIX file "/path/to/SomeDocument" >end tell > >results in program receiving signal EXC_BAD_ACCESS here This works in my NSPersiste

Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Julien Jalon
And indeed, your plist is broken. CFBundleDisplayName should be a string not an array. It seems that what is "CFBundleDisplayName" should be "CFBundleDocumentTypes". -- Julien On Mon, Dec 14, 2009 at 3:29 PM, Joe The Programmer < joetheappleprogram...@gmail.com> wrote: > > On Dec 14, 2009, at 4

Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Joar Wingfors
On 13 dec 2009, at 23.06, Joar Wingfors wrote: >> Two occurrences of the following massage are appearing in the console: >> -[NSCFArray _getCString:maxLength:encoding:]: unrecognized selector sent to >> instance 0x4016e0 > > That's almost certainly an indication of a memory management error in

Re: Problem with mouse events in a custom NSControl subclass

2009-12-14 Thread Stephen Blinkhorn
On 11 Dec 2009, at 17:57, Stephen Blinkhorn wrote: I'm writing the Cocoa GUI for an audio unit plugin and I've run into a problem. In one host app I'm not receiving mouse events in my custom sliders/buttons etc. My drop down menus work fine but they are subclasses of NSPopUpMenu and NSPop

Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Joe The Programmer
On Dec 14, 2009, at 4:28 AM, Julien Jalon wrote: > It's not necessarily a memory management problem. As this happens very early > in the application launch, when Launch Services uses your Info.plist to > register the application, your problem might also be that an entry supposed > to be a stri

Re: Core Data Save As Binary Error

2009-12-14 Thread Richard Somers
On Dec 14, 2009, at 5:48 AM, Kiran Kumar S wrote: Have you changed the storetype to binary in info.plist file The info.plist file (used for development) currently has four document types, default, binary, sqlite, and xml. I started with the apple template which has the three document type

Re: Core Data Save As Binary Error

2009-12-14 Thread Kiran Kumar S
Have you changed the storetype to binary in info.plist file Regards SKiran On 14-Dec-09, at 6:11 PM, Richard Somers wrote: I have a Core Data document based application. Saving the file as XML or SQLite works fine. Saving as binary results in an error: *** -[NSKeyedArchiver encodeValue

Re: Sorted Table Column

2009-12-14 Thread Gerriet M. Denkmann
On 14 Dec 2009, at 18:09, Graham Cox wrote: > > On 14/12/2009, at 10:00 PM, Graham Cox wrote: > >> >> On 14/12/2009, at 9:56 PM, Gerriet M. Denkmann wrote: >> >>> I have an NSTableView with just one column, filled by some >>> NSArrayController. >>> >>> Initially the items are not in any rec

Core Data Save As Binary Error

2009-12-14 Thread Richard Somers
I have a Core Data document based application. Saving the file as XML or SQLite works fine. Saving as binary results in an error: *** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs. The struct in question is a transformable attribute using a custom value

Diacritics in Thai

2009-12-14 Thread Gerriet M. Denkmann
When I use rangeOfString: options with NSDiacriticInsensitiveSearch not only the tone marks are ignored, but also some vowels. Same problem with NSPredicate "someKey =[d] someValue". It is true that in unicode-speak both the tone marks and the ignored vowels are categorized as Nonspacing_Ma

Practicality of memory debugging idea?

2009-12-14 Thread Graham Cox
Hi all, just throwing this one out there, see if it's worth anything. I'm having a problem tracking down a very elusive memory management bug. It's a simple over-release, somewhere, but extremely rarely. The problem is that the only reports I've had of it so far are field reports indicating a cr

Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Julien Jalon
It's not necessarily a memory management problem. As this happens very early in the application launch, when Launch Services uses your Info.plist to register the application, your problem might also be that an entry supposed to be a string is in fact an array. On Mon, Dec 14, 2009 at 9:09 AM, Joe

Re: Sorted Table Column

2009-12-14 Thread Graham Cox
On 14/12/2009, at 10:00 PM, Graham Cox wrote: > > On 14/12/2009, at 9:56 PM, Gerriet M. Denkmann wrote: > >> I have an NSTableView with just one column, filled by some NSArrayController. >> >> Initially the items are not in any recognizable order. >> When I click on the NSTableHeaderView a tri

Re: Sorted Table Column

2009-12-14 Thread Graham Cox
On 14/12/2009, at 9:56 PM, Gerriet M. Denkmann wrote: > I have an NSTableView with just one column, filled by some NSArrayController. > > Initially the items are not in any recognizable order. > When I click on the NSTableHeaderView a triangle appears and now the items > are nicely sorted. > >

Sorted Table Column

2009-12-14 Thread Gerriet M. Denkmann
I have an NSTableView with just one column, filled by some NSArrayController. Initially the items are not in any recognizable order. When I click on the NSTableHeaderView a triangle appears and now the items are nicely sorted. Is it possible (either in InterfaceBuilder or programmatically) to ma

Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Joe The Programmer
On Dec 14, 2009, at 12:52 AM, Kyle Sluder wrote: > Turning on GC is not the solution to your problem. Fixing your memory > management bugs is the solution. On Dec 14, 2009, at 12:54 AM, Joar Wingfors wrote: > For a trivial app it might be. For anything else, it would not be. GC and RC > are fu