Re: looking for reference to a dictionary
On Oct 21, 2008, at 11:08 AM, Stefan Wolfrum wrote: I have an array. Each array entry is a dictionary. Each dictionary has two key/value pairs (all are strings). Now I get from somewhere else the value (a string) corresponding to one of the keys. It's exactly the same string, content-wise (not address-wise). What I need: a reference/pointer to THAT dictionary inside the array which contains this string as the value of the key (I know what key it is). How would I do that? You may be able to accomplish what you're looking for using -[NSArray filteredArrayUsingPredicate:]. You won't get the index of the dictionary which matches, but you will get a reference to it (or them, if more than one match). Cheers, Ken ___ 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 [EMAIL PROTECTED]
Re: Putting an image on a CALayer
On 22.10.2008, at 02:54, DKJ wrote: Me again. I've been using this code: NSURL *url = [NSURL fileURLWithPath:fname]; CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL); CGImageRef image = CGImageSourceCreateImageAtIndex(source, 0, NULL); CFRelease(source); theView.layer.contents = (id)image; It compiles without complaint, but I'm still not seeing the image. I can see the effects of changing other properties of the layer (e.g. borderWidth). I've checked that image is not NULL. What am I missing here? You are probably missing a '[theView.layer setNeedsDisplay];' BTW, I prefer drawing using the standard NS... classes by a delegate and this code: - (void) drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:NO]; [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:gc]; // Draw stuff [[NSColor redColor] setFill]; [NSBezierPath fillRect:NSMakeRect(8.0, 8.0, 48.0, 48.0)]; [NSGraphicsContext restoreGraphicsState]; } Regards, Patrick ___ 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 [EMAIL PROTECTED]
Get text width outside a view
I'm trying to calculate the width of a text and the same code I used in the past in a drawRect routine in a view to its UIGraphicsGetCurrentContext() isn't working. The main difference of course is the context, in this case I created a bitmap context and the code is basically this: CGFloat fontSize = 20.0; int cw = 500; int ch = 50; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); CGContextRef context = CGBitmapContextCreate(NULL, cw, ch, 8, cw, colorSpace, kCGRenderingIntentDefault); if(context == NULL){ NSLog(@Paragraph couldn't create context!); } CGColorSpaceRelease(colorSpace); CGContextSelectFont(context, Helvetica, fontSize, kCGEncodingMacRoman); CGContextSetTextDrawingMode(context, kCGTextFill); const char* textC = [str cStringUsingEncoding:NSMacOSRomanStringEncoding]; int len = strlen(textC); CGContextShowTextAtPoint(context, 0, 0, textC, len); CGPoint pt = CGContextGetTextPosition(context); CGContextRelease(context); pt.x is 0. I used a bitmap context because I didn't know how to create a different one, isn't possible to write text on a bitmap context or I am missing something else? Thanks a lot for any help, chr ___ 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 [EMAIL PROTECTED]
Re: When does Cocoa fall apart? (Run loops)
in the latter, are you in a secondary thread? This could explain your problem.Otherwise, I did not experience that lately. Best, Raphael On Wed, Oct 22, 2008 at 6:05 AM, Chris Idou [EMAIL PROTECTED] wrote: I noticed with the below discussed isEnabled bindings problem that if I do: [objectController performSelectorOnMainThread:@selector(setContent:) withObject:title waitUntilDone:NO]; instead of. [objectController setContent:title]; then it seems to start behaving better. I think I've noticed this once or twice in the past, that things that don't seem to work as they should, start working when you throw them on the run loop. In this case, the isEnabled bindings status of toolbar items seems to start working when I do certain things on the Run loop instead of immediately. Have people noticed these situations? What causes them, and when should I look out for it? Re: Toolbar buttons and isEnabled binding From: Chris Idou [EMAIL PROTECTED] Subject: Toolbar buttons and isEnabled binding To: cocoa-dev@lists.apple.com Date: Tuesday, October 21, 2008, 7:04 AM I seem to be getting erratic behaviour from toolbar button isEnabled bindings. In some scenarios they don't seem to work correctly. I've tried putting the exact same binding criteria on some regular buttons just to see what happens, and they seem to work correctly when the toolbar buttons don't. Has anyone else noticed this? ___ 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/raphael.sebbe%40gmail.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Rotating a QTMovie doesn't work the way it used to
Hi, I have a QTMovie in a QTMovieView that I'm trying to rotate (during display) via the following code: -- Movie theMovie = [myQTMovie quickTimeMovie]; long theAngle = 90; // using 90 degrees as an example -- rotating by 180 degrees doesn't work either MatrixRecord theMovieMatrix; GetMovieMatrix(theMovie, theMovieMatrix); NSLog(@get matrix error: %d, (int)GetMoviesError());// returns noErr Rect theMovieBox; GetMovieBox(theMovie, theMovieBox); NSLog(@get box error: %d, (int)GetMoviesError()); // returns noErr RotateMatrix(theMovieMatrix, Long2Fix(theAngle), Long2Fix((long) (theMovieBox.right - theMovieBox.left)) / 2, Long2Fix((long) (theMovieBox.bottom - theMovieBox.top)) / 2); NSLog(@rotate error: %d, (int)GetMoviesError());// returns noErr SetMovieMatrix(theMovie, theMovieMatrix); NSLog(@set matrix error: %d, (int)GetMoviesError());// returns noErr -- Here's my problem: This used to work just fine with earlier QuickTime versions, but I have recently noticed that it doesn't work with QuickTime 7.5.5, at least when targeting Mac OS X 10.5. The movie just keeps its same old original orientation. (I'm afraid I'm not sure at which QuickTime version exactly it stopped working. I hadn't checked in a while.) As you can see from my code snippet, I don't get any error when rotating. In addition to that, this doesn't seem to be a system-wide QuickTime bug, as I can rotate the very same movie with QuickTime Pro just fine. So does anyone know whether this is a problem that's specific for dealing with QuickTime movies from a cocoa app? Or is there a more elegant way of rotating movies? Thanks! Peter. ___ 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 [EMAIL PROTECTED]
Re: When does Cocoa fall apart? (Run loops)
2 methods to try when a programmatic binding isnt working. [self performSelector:@selector(finishInit:) withObject:self afterDelay:0.0]; [[NSRunLoop currentRunLoop] performSelector:@selector(finishAfterLooping:) target:self argument:(id)nil order:0 modes:[NSArray arrayWithObject:[NSRunLoop currentMode]]]; (Declared in NSRunLoop.h) Usually this is sorts of problems arises on awakeForNib / didFinishLoading, and / or binding thats initializing, perhaps bound to multiple object. Best way to avoid such problems usually make sure everythings all loaded-up / instantiated first. Clearly moving yer stuff out of the init methods and iterating over the run loop first is probably the best way to go... Well you could instead dig deeper into the implementation specifics of Cocoa bindings. (Sorry - i dont claim to know anything about toolbar buttons) But it sounds like you are pointing to a difference inbetween two types of buttons. In those cases it can help to compare the class hierachies and read between the lines the documentation, and (usually more helpful) the examples out on the web where other developers have used these button types in their project. Perhaps even the Debugger can give a hint to the way Apple has implemented them ? On 22 Oct 2008, at 10:42, Raphael Sebbe wrote: [objectController setContent:title]; I think I've noticed this once or twice in the past, that things that don't seem to work as they should, start working when you throw them on the run loop. In this case, the isEnabled bindings status of toolbar items seems to start working when I do certain things on the Run loop instead of immediately. Have people noticed these situations? What causes them, and when should I look out for it? Re: Toolbar buttons and isEnabled binding From: Chris Idou [EMAIL PROTECTED] Subject: Toolbar buttons and isEnabled binding To: cocoa-dev@lists.apple.com Date: Tuesday, October 21, 2008, 7:04 AM I seem to be getting erratic behaviour from toolbar button isEnabled bindings. In some scenarios they don't seem to work correctly. I've tried putting the exact same binding criteria on some regular buttons just to see what happens, and they seem to work correctly when the toolbar buttons don't. Has anyone else noticed this? ___ 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 [EMAIL PROTECTED]
Re: Cocoa-dev Digest, Vol 5, Issue 1813
Hello Mr Bumgarner, On 22/10/08, Bill Bumgarner [EMAIL PROTECTED] wrote: (I did a little demo app at one point long ago that used an in memory store to cache results from Amazon's web services API. The front end was all pure Cocoa / bindings / CD with a minimal amount of additional code to pull data from amazon and push it into the local store). I would find that very interesting. The attachment got mangled in my mail reader. Can you provide a URL? Thanks, Steve ___ 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 [EMAIL PROTECTED]
Memory Leaks in CocoaEcho Sample
Hello, I'm just building my own application based on the CocoaEcho sample from Apple. But the CocoaEcho Client is full of memory leaks. These leaks occur, when you select and deselect a CocoaEchoServer some times by clicking on them and again next to them Leaked Objects are: SCNetworkReachability GeneralBlocks NSCFDictionaries NSCFData NSCFInputStream NSCFOutputStream All points to the openstream: and closestream: methods but I am not so skilled to find the error with the help of instruments and the debugger. Does someone know if there is something wrong in the CocoaEchoClient code or if the error is in the Cocoa frameworks itself? Thanks Jens ___ 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 [EMAIL PROTECTED]
Re: When does Cocoa fall apart? (Run loops)
Nope, just one thread. I'm finding KVO and bindings to be extremely flakey. Maybe I'm pushing them harder than other folks, I don't know, because I'm starting to use them all over the place. I'll try the finishInit mentioned by dreamcat, and see if that helps. The problem I reported recently where NSObjectController screws up KVO has been confirmed by Apple as a real bug as well. I'm not too impressed with Cocoa at the moment. --- On Wed, 10/22/08, Raphael Sebbe [EMAIL PROTECTED] wrote: From: Raphael Sebbe [EMAIL PROTECTED] Subject: Re: When does Cocoa fall apart? (Run loops) To: [EMAIL PROTECTED] Cc: cocoa-dev@lists.apple.com Date: Wednesday, October 22, 2008, 2:42 AM in the latter, are you in a secondary thread? This could explain your problem.Otherwise, I did not experience that lately. Best, Raphael On Wed, Oct 22, 2008 at 6:05 AM, Chris Idou [EMAIL PROTECTED] wrote: I noticed with the below discussed isEnabled bindings problem that if I do: [objectController performSelectorOnMainThread:@selector(setContent:) withObject:title waitUntilDone:NO]; instead of. [objectController setContent:title]; then it seems to start behaving better. I think I've noticed this once or twice in the past, that things that don't seem to work as they should, start working when you throw them on the run loop. In this case, the isEnabled bindings status of toolbar items seems to start working when I do certain things on the Run loop instead of immediately. Have people noticed these situations? What causes them, and when should I look out for it? Re: Toolbar buttons and isEnabled binding From: Chris Idou [EMAIL PROTECTED] Subject: Toolbar buttons and isEnabled binding To: cocoa-dev@lists.apple.com Date: Tuesday, October 21, 2008, 7:04 AM I seem to be getting erratic behaviour from toolbar button isEnabled bindings. In some scenarios they don't seem to work correctly. I've tried putting the exact same binding criteria on some regular buttons just to see what happens, and they seem to work correctly when the toolbar buttons don't. Has anyone else noticed this? ___ 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/raphael.sebbe%40gmail.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Re: When does Cocoa fall apart? (Run loops)
On Wed, Oct 22, 2008 at 9:56 AM, Chris Idou [EMAIL PROTECTED] wrote: The problem I reported recently where NSObjectController screws up KVO has been confirmed by Apple as a real bug as well. I'm not too impressed with Cocoa at the moment. I can understand not too impressed with Bindings but Cocoa overall? You really must consider that Bindings isn't the only game in town (and in fact didn't even exist until recently in Cocoa's surprisingly long history). Your struggles, if I'm recalling correctly, seem to all stem from using Bindings. Perhaps you should consider not using the mechanism at all and concentrate on building your app without it? There are plenty of apps out there today that are both modern *and* don't use Bindings. I believe I also heard that Apple apps don't use Binding either, but that claim may have been wrong or is now outdated. I myself don't use Bindings for anything but the most basic scenarios for which it seems to have been meant (particularly, managing a list of things or master/detail setup). I have found the rest of Cocoa to be very solid. In six years, I can recall only running into (or discovering) four or five bugs with the API itself. That's a vastly different experience from the one I've had with other platforms. People often complain I thought it was supposed to save me from writing glue code. Sure, that's its intent, but it's unreasonable to expect it to eliminate all - or even most - glue code. This isn't meant to be confrontational, but rather comical: Suck it up, you're a programmer. :-) Try the tried-and-true target/action mechanism. Cocoa is a lot clearer and more direct when you don't consider Bindings (KVC/KVO/Object Controllers). Yes, you have to write glue code, but with proper design, you shouldn't have to write *that much* in most cases. Though it's just a suggestion, I think it's an important one to consider when designing a Cocoa application. How much work would it take to make Bindings work? In plenty of cases, the answer is more than it's worth in this particular app. -- I.S. (... who is now going off to a dark corner to lick his wounds - such horrible things he says about our precious!) ;-) ___ 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 [EMAIL PROTECTED]
Core Data: The file is not in the right format - sometimes!
Hi, this bug drives me crazy for a long time now. I hope someone has another hint what I could try out to fix it. My application writes and opens Core Data files in XML format. Sometimes I can't find any way to open an existing file. After spinning wheel for a minute (!), the app states: The document ... could not be opened. The file is not in the right format But: in a different situation the very same unchanged file opens flawlessly. The problem did not occur on Tiger AFAIK, only on Leopard. Thank you very much in advance, Robert P.S.: I must admit, my Core Data files are part of a file wrapper, which is not supported, but I doubt the problem lies in here. R. -- --- - .-. -- -- ---/ \ tin:b Software .-. / \ --- .-.__o .-.(i) / \ / \ / \ _`\,_/ \ Robert Fischer / \ / \ / \ (*)/ (*) / `--- / `---' `-' `---' ___ 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 [EMAIL PROTECTED]
Re: @property and HeaderDoc
Jerry Krinock wrote: If anyone has written any Xcode user scripts for inserting Doxygen templates, to replace those useless HeaderDoc Insert templates, let me know. You might want to look at this: http://brianray.chipy.org/doxygen/ (Although it does not appear to be working at the moment.) This page may also prove useful if you're looking for additional tools to use with Doxygen: http://www.stack.nl/~dimitri/doxygen/helpers.html Otherwise, if I have any further discussion on this topic I'll take it to the Xcode list since that's where the issues are. That's probably a good idea. :) Jason ___ 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 [EMAIL PROTECTED]
[Q] Hiding zoom minimize buttons
I found this old thread: http://lists.apple.com/archives/cocoa-dev/2006/Mar/msg01864.html and I would like to know the same thing. Unfortunately, the old thread did not conclude with an answer. While it is possible to obtain the button by doing: NSButton *miniaturizeButton = [myWindow standardWindowButton:NSWindowMiniaturizeButton]; [miniaturizeButton removeFromSuperview]; this results in a crash. Also, how can one create a window without a zoom button? I don't see an option in IB to remove this button. And, if I disable the minimize control in IB, the button still shows up, just grayed out. When programatically creating a window, the style masks are as follows: NSBorderlessWindowMask = 0, NSTitledWindowMask = 1 0, NSClosableWindowMask = 1 1, NSMiniaturizableWindowMask = 1 2, NSResizableWindowMask = 1 3, NSTexturedBackgroundWindowMask = 1 8 there is no zoom button mask constant that I see. Any thoughts, hints or suggestions? Thank you. ___ 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 [EMAIL PROTECTED]
Re: looking for reference to a dictionary
On Tue, Oct 21, 2008 at 12:08 PM, Stefan Wolfrum [EMAIL PROTECTED] wrote: Hi all, I have an array. Each array entry is a dictionary. Each dictionary has two key/value pairs (all are strings). Now I get from somewhere else the value (a string) corresponding to one of the keys. It's exactly the same string, content-wise (not address-wise). What I need: a reference/pointer to THAT dictionary inside the array which contains this string as the value of the key (I know what key it is). How would I do that? My knowledge is: to get an array's entry I just have the objectAtIndex: method. But then I'd need the index where the dictionary I'm looking for is. How would I get the index without, of course, iterating through all the array's entries and looking at every dictionary and comparing my given value with all the values inside the dictionaries? When you say the value of the key, do you mean that the string is literally the key in the dictionary, or that the string is equal to [dictionary objectForKey:@someKnownKey]? If the latter, then this code will do it: NSUInteger index = [[array valueForKey:@someKnownKey] indexOfObject:string]; id obj = index != NSNotFound ? [array objectAtIndex:index] : nil; Note that this does not avoid iterating the entire array, it just avoids making you write code that does. The speed hit is still there. Indeed, the speed hit *must* be there if you use an array, as others have discussed. But it makes the code nicer. If you're literally searching for a dictionary which contains a specific key (not a specific value for a specific key) then I don't think there is any way to do this short of writing your own for loop and searching manually. Mike ___ 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 [EMAIL PROTECTED]
CALayer graphics context
Is there a quick way to get a CGContextRef for a CALayer? I don't see anything obvious in the documentation for the CALayer class. dkj ___ 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 [EMAIL PROTECTED]
Re: [Q] Hiding zoom minimize buttons
On Wed, Oct 22, 2008 at 10:36 AM, Eric Gorr [EMAIL PROTECTED] wrote: I found this old thread: http://lists.apple.com/archives/cocoa-dev/2006/Mar/msg01864.html and I would like to know the same thing. Unfortunately, the old thread did not conclude with an answer. While it is possible to obtain the button by doing: NSButton *miniaturizeButton = [myWindow standardWindowButton:NSWindowMiniaturizeButton]; [miniaturizeButton removeFromSuperview]; this results in a crash. First, I highly recommend against doing this. If Cocoa keeps them present but disabled then you ought to stick with that Your crash is happening because the window is trying to manipulate the button, but you have caused it to be deallocated when you removed it from its superview. Retain the button before you remove it, and of course keep a reference to it so that you can release it at the appropriate time, and this should prevent the crash. You may be able to simply hide it using the -setHidden: method. Mike ___ 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 [EMAIL PROTECTED]
Re: NSInMemoryStoreType: Not really persistent, is it?
On Oct 21, 2008, at 6:53 PM, Bill Bumgarner wrote: The in memory store is actually extremely useful for caches and as a backing store for applications that read/write to/from some kind of server -- typically an XML RPC of some type -- that wants to take full advantage of CD's object graph management infrastructure. The various change hooks on the MOC and coordinator make it possible to easily mirror the changes out to the wire protocol or update the local cache -- the in memory persistent store -- with changes pulled from the other side. I've been using the in-memory persistent store for unit testing a lot lately. In setUp and tearDown, I create and destroy a full core data stack with an in-memory store. It's very fast, and you're guaranteed a clean slate for each unit test. -Dave ___ 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 [EMAIL PROTECTED]
Re: When does Cocoa fall apart? (Run loops)
On 22 Oct 2008, at 14:56, Chris Idou wrote: Nope, just one thread. I'm finding KVO and bindings to be extremely flakey. Maybe I'm pushing them harder than other folks, I don't know, because I'm starting to use them all over the place. I'll try the finishInit mentioned by dreamcat, and see if that helps. If you do, please be aware that there's no finishInit: method defined- you would have to write one youself and call it with performSelector: at the end of your object's regular init: method. Whats important here is that you should be connecting your bindings at a point in time after - windowControllerDidLoadNib: / equivalent has happened. If you are instantiating your objects' in NIB file or from DidLoadNib method then - can call performSelector directly from there either way, the selector method you specify will be run (after 1 full cycle of the thread) should be the method where you finally connect the bindings. This is to be sure that Apple's code had a chance to run before calling that ' ere direful bind: method which causes us so many bothersome and disobliging inconvenience. If you have set up your bindings in interface builder then it may be necessary to convert them to sourcecode as *programmatic bindings* in order to do it this way. (and of course uncheck those bindings' checkboxes in IB). ___ 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 [EMAIL PROTECTED]
Re: Core Data: The file is not in the right format - sometimes!
Robert: this bug drives me crazy for a long time now. I hope someone has another hint what I could try out to fix it. In the five days since you first posted this same message, nobody has responded. Rather than re-post the same message, you might try adding a bit more detail. For example: P.S.: I must admit, my Core Data files are part of a file wrapper, which is not supported, but I doubt the problem lies in here. R. Since you're not doing things in a standard way, it's silly to doubt the problem lies in here. That's in fact the *first* place you want to look. The best course of action is for you to post the code you use to save *and* open your files. Without this information, there's little anybody on this list can do to help you. -- I.S. ___ 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 [EMAIL PROTECTED]
Re: [Q] Hiding zoom minimize buttons
On Oct 22, 2008, at 10:53 AM, Michael Ash wrote: On Wed, Oct 22, 2008 at 10:36 AM, Eric Gorr [EMAIL PROTECTED] wrote: I found this old thread: http://lists.apple.com/archives/cocoa-dev/2006/Mar/msg01864.html and I would like to know the same thing. Unfortunately, the old thread did not conclude with an answer. While it is possible to obtain the button by doing: NSButton *miniaturizeButton = [myWindow standardWindowButton:NSWindowMiniaturizeButton]; [miniaturizeButton removeFromSuperview]; this results in a crash. First, I highly recommend against doing this. If Cocoa keeps them present but disabled then you ought to stick with that As was mentioned in the old thread, according to the HI Guildlines, it is perfectly acceptable to not have those buttons. Furthermore, it is quite common in several applications for a window to not have a miniaturize or zoom button...particularly NSPanels (they are Windows). But, in any case, minutes after I posted this, I found an answer: NSButton *miniaturizeButton = [myWindow standardWindowButton:NSWindowMiniaturizeButton]; [miniaturizeButton setHidden:YES]; while it doesn't appear that one can create a window without these buttons, it is trivial to hide them. If there is a better solution, I would be interested. ___ 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 [EMAIL PROTECTED]
Re: CALayer graphics context
Hi dkj A CALayer itself is not associated with a context. The NSView owns the graphics context. The context you are looking for is passed to the drawLayer:inContext message. Simply set a delegate of your layer and send 'setNeedsDisplay' once to setup your content. Here's an example: - (void) drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { NSString *imgName = [[NSBundle mainBundle] pathForImageResource:@Rocks]; NSImage *img = [[[NSImage alloc] initWithContentsOfFile:imgName] autorelease]; NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:NO]; [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:gc]; [img drawInRect:NSRectFromCGRect(layer.bounds) fromRect:NSMakeRect(0.0, 0.0, [img size].width, [img size].height) operation:NSCompositeCopy fraction:1.0]; [NSGraphicsContext restoreGraphicsState]; } Best Regards, Patrick On 22.10.2008, at 16:53, DKJ wrote: Is there a quick way to get a CGContextRef for a CALayer? I don't see anything obvious in the documentation for the CALayer class. dkj ___ 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/pmau%40me.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
What is _NSViewAuxiliary?
I've got a view registered as an observer for a certain notification, and very sporadically I see a message indicating that in the course of trying to post a notification an exception is raised because an instance of some class called _NSViewAuxiliary is being sent the message corresponding to my notification handler. ___ 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 [EMAIL PROTECTED]
Re: What is _NSViewAuxiliary?
On Wed, Oct 22, 2008 at 8:29 AM, Gregory Weston [EMAIL PROTECTED] wrote: I've got a view registered as an observer for a certain notification, and very sporadically I see a message indicating that in the course of trying to post a notification an exception is raised because an instance of some class called _NSViewAuxiliary is being sent the message corresponding to my notification handler. It's a private class used in the implementation of NSView. What this likely means is that your observer object was deallocated, and that location in memory was reused for an object that happened to be of class _NSViewAuxiliary. There are a couple of different possible causes. (1) The view was deallocated prematurely. (2) You didn't remove the view as an observer of the notification prior to the view's destruction. Search for NSZombieEnabled for some possible help debugging. -Ken ___ 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 [EMAIL PROTECTED]
Re: NSInMemoryStoreType: Not really persistent, is it?
(I did a little demo app at one point long ago that used an in memory store to cache results from Amazon's web services API. The front end was all pure Cocoa / bindings / CD with a minimal amount of additional code to pull data from amazon and push it into the local store). Is that demo available some place? Pierre ___ 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 [EMAIL PROTECTED]
Re: What is _NSViewAuxiliary?
On Oct 22, 2008, at 11:39 AM, Ken Ferry wrote: On Wed, Oct 22, 2008 at 8:29 AM, Gregory Weston [EMAIL PROTECTED] wrote: I've got a view registered as an observer for a certain notification, and very sporadically I see a message indicating that in the course of trying to post a notification an exception is raised because an instance of some class called _NSViewAuxiliary is being sent the message corresponding to my notification handler. It's a private class used in the implementation of NSView. What this likely means is that your observer object was deallocated, and that location in memory was reused for an object that happened to be of class _NSViewAuxiliary. There are a couple of different possible causes. (1) The view was deallocated prematurely. (2) You didn't remove the view as an observer of the notification prior to the view's destruction. Thanks. Turned about to be #2a: A mismatched between the object: arguments when my instance registered itself as an observer and when it removed itself. Greg ___ 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 [EMAIL PROTECTED]
Re: CALayer graphics context
On Oct 22, 2008, at 8:00 AM, Patrick Mau wrote: A CALayer itself is not associated with a context. The NSView owns the graphics context. Actually when your in layer backing mode, the CALayer owns the graphics context. The context you are looking for is passed to the drawLayer:inContext message. This is true, and covered well in the Core Animation Programming Guide http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Introduction/Introduction.html Specifically, the section on Providing Layer Content. -- David Duncan Apple DTS Animation and Printing ___ 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 [EMAIL PROTECTED]
Yet another CALayer puzzle
I've got myView and myController objects in my nib file. myView is an IBOutlet of myController. I put this in the initWithFrame: method of myView: CALayer *rootLayer = [CALayer layer]; [self setLayer:rootLayer]; [self setWantsLayer:YES]; But when I read myView's wantsLayer in the awakeFromNib method of myController, I find its value is 0. How did the value get changed? ___ 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 [EMAIL PROTECTED]
Re: Using Core Animation to animate view properties?
Hey Jim, I don't know much about NSAnimation as I haven't used it, however, I can try to answer your three questions from a Core Animation standpoint. 1. If you want to know whether an animation is still running, just check to see if it is still in the animations dictionary in the layer. A call like this would do it: if( [layer animationForKey:@mykey] != nil ) { // animation is still running, so do something } I'm assuming you've set the key for your animation for @mykey when you created the animation. The above call will not work if you have set your removedOnCompletion field in the animation to NO, but the default is YES. 2. To abort an animation, simply remove it from the animations dictionary. A call like this would work: [layer removeAnimationForKey:@mykey]; If you want to know after the fact whether the animation completed, you can implement this delegate method on the animation: - (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag If flag is set to false, then the animation was interrupted. 3. To fast forward to the target value after an abort, simply set the value by calling set on the parameter explicitly. If it's opacity, you are animating, for example. just call [layer setOpacity:1.0]; How you apply this to view properties, I'm not sure, but this is how you do these things with layers. Hope that helps. -Matt On Oct 20, 2008, at 7:36 PM, Jim Correia wrote: I have some view properties for which I'd like to use Core Animation to drive the animation. In my old code, I used a subclass of NSAnimation which interpolated the target value and set the property on the view via KVO. This seems like a perfect use for CABasicAnimation and the animator proxy. When using NSAnimation, if I needed to prematurely abort the animation, I could send -stopAnimation to my NSAnimation subclass. (I also had enough information at hand that it was trivial to fast forward the animated property to its target value if that was desirable.) What mechanism do I have to - know that a property animation is in progress - abort it, if necessary - fast forward it to the target value after abort, if desired - Jim ___ ___ 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 [EMAIL PROTECTED]
Re: Yet another CALayer puzzle
On Oct 22, 2008, at 9:48 AM, DKJ wrote: I've got myView and myController objects in my nib file. myView is an IBOutlet of myController. I put this in the initWithFrame: method of myView: CALayer *rootLayer = [CALayer layer]; [self setLayer:rootLayer]; [self setWantsLayer:YES]; But when I read myView's wantsLayer in the awakeFromNib method of myController, I find its value is 0. How did the value get changed? Your nib probably has setWantsLayer turned off. What ever is in your nib is what will be true by the time awakeFromNib is called. Simplest solution is to move this setup into -awakeFromNib. -- David Duncan Apple DTS Animation and Printing ___ 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 [EMAIL PROTECTED]
Re: Yet another CALayer puzzle
You need to override -initWithCoder: in addition to -initWithFrame:. NSView has two designated initializers. -Ken On Wed, Oct 22, 2008 at 9:48 AM, DKJ [EMAIL PROTECTED] wrote: I've got myView and myController objects in my nib file. myView is an IBOutlet of myController. I put this in the initWithFrame: method of myView: CALayer *rootLayer = [CALayer layer]; [self setLayer:rootLayer]; [self setWantsLayer:YES]; But when I read myView's wantsLayer in the awakeFromNib method of myController, I find its value is 0. How did the value get changed? ___ 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/kenferry%40gmail.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Single Bit editable Image Mask (and other strangeness)
Good day! I am working on pixel based drawing tool, and could use some hint on how to handle selection areas. In the program, each document has a couple different Bitmap context (24 bit RGP space CGBitmapContext ) at the same time. I draw into a scroll view using a Layer (CGLayer). Whenever one of the bitmap context changes, I copy the changes into the layer, but scrolling within the view is done only with the layer except for drawing the selection area. As always, I want to make sure there isn't a better way of doing what I am doing now. To handle the selection, I have been using a CGBitmapContext (created with method CGBitmapContextCreate with a bitsPerComponent of 8, a color space of GreySpace, and CGBitmap info of kCGImageAlphaNone). This gives me an editable context, so that I can create the selection graphic using Quartz draw rectangles and ovals. When I need to draw using the selection, I convert the selection into an image (CGBitmapContextCreateImage), clip the context to that image (CGContextClipToMask) and then do whatever drawing I want to do (ex. invert, special fill, you name it). First of all, it is possible to create a single bit bitmap context (only black and white)? I could only get 8 bit greyscale working correctly. Should I be using ImageMask for these operations? I did not create a bitmap mask (using CGImageMaskCreate) because I needed to be able to constantly modify the mask using rectangle and oval commands (and I could not get that call to work). Lastly, when when drawing between bitmap context (basically copying one section to another), is the best way to create an Image from the bitmap info (CGBitmapContextCreateImage) and then draw using the image. Apple documentation suggest that this is quick enough. If I create an image, and then modify the context, the image I created would have a copy of the data, not any changes. Thanks for any comments! Steve Sheets ___ 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 [EMAIL PROTECTED]
Re: Yet another CALayer puzzle
That did the trick! Thanks. ___ 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 [EMAIL PROTECTED]
Re: Putting an image on a CALayer
On Oct 22, 2008, at 12:09 AM, Patrick Mau wrote: On 22.10.2008, at 02:54, DKJ wrote: Me again. I've been using this code: NSURL *url = [NSURL fileURLWithPath:fname]; CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL); CGImageRef image = CGImageSourceCreateImageAtIndex(source, 0, NULL); CFRelease(source); theView.layer.contents = (id)image; It compiles without complaint, but I'm still not seeing the image. I can see the effects of changing other properties of the layer (e.g. borderWidth). I've checked that image is not NULL. What am I missing here? You are probably missing a '[theView.layer setNeedsDisplay];' By default this will obliterate the contents that you have just set. Calling -setNeedsDisplay or -display will cause the layer to generate content and set the contents property to the result of that operation. If you set the contents property manually, you should never call - setNeedsDisplay or -display on that layer or the content you set will be lost. You can avoid this by implementing some delegate methods or subclassing a CALayer, but it is generally easier to avoid the issue entirely by maintaining control over the CALayer when doing this. -- David Duncan Apple DTS Animation and Printing ___ 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 [EMAIL PROTECTED]
WebView: Open new windows in default browser
Hi all, I've been trying to get a WebView to open in the user's default browser. In fact, I've succeeded, but it's rather clunky, and I'm wondering if there's a better way. At the moment, this is what I do: My main WebView's method for opening windows is controlled via UIDelegate. These requests are passed on to a second WebView, which intercepts all requests via policyDelegate. It then passes them on to the default browser with the openURL: method in NSWorkspace. This works fine. If there is a better way you know of, please tell me, but if not, don't worry. ___ 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 [EMAIL PROTECTED]
Infinite scrolling with CALayer
Hi all, I'm trying to simulate an endless vertical scrolling using CALayer. In my first test I made a simple texture (it's a street asphalt) and I create a CALayer with this texture as content. I made also a socond layer with same content attached on top to the main layer, simply incrementing the position of the main layer I can made a scrolldown simulating a running steet see from top. My question is : how can I made an infinite scroll? It's possible to change the role of superlayer removing it when it's offscreen, adding a new layer and promoting the old layer to super? It's the way I'm using the right way? I've excluded CAScrollLayer because I need to fine control the speed of scrolling in function of many parameters. Many thanks Fabrizio ___ 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 [EMAIL PROTECTED]
How to use third-party library in cocoa program?
Hello guys: I have a program written by cocoa, I would like to use the mysql c client library, it's in /usr/local/mysql/include and /usr/local/mysql/lib. These are two questions: 1. How to use the library in my program? 2. How to link the library statically? because this program will be deployed in other machine no mysql library installed. Thanks Venture ___ 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 [EMAIL PROTECTED]
Re: [Q] Hiding zoom minimize buttons
On Oct 22, 2008, at 8:36 AM, Eric Gorr wrote: While it is possible to obtain the button by doing: NSButton *miniaturizeButton = [myWindow standardWindowButton:NSWindowMiniaturizeButton]; [miniaturizeButton removeFromSuperview]; this results in a crash. Also, how can one create a window without a zoom button? I don't see an option in IB to remove this button. And, if I disable the minimize control in IB, the button still shows up, just grayed out. That's how it's supposed to be. Consider a color-blind user. Since all three buttons are now round circles (yes, a step backwards from the OS9 UI, but there's naught we can do about that), the only way a color-blind user can tell which is which, before mousing over it, is by position. If you could remove one or two, he'd be mightily annoyed and the usability of your app would suffer. So, AFAIK, Apple doesn't allow you to do it. Best, - Joe ___ 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 [EMAIL PROTECTED]
Re: [Q] Hiding zoom minimize buttons
Here is what I do in the window controller or in the code that loads the window: - (void)windowDidLoad { //Hiding the disabled window buttons (removing them is deadly -- don't do it!) [[[self window] standardWindowButton:NSWindowMiniaturizeButton] setFrame:NSZeroRect]; [[[self window] standardWindowButton:NSWindowZoomButton] setFrame:NSZeroRect]; } On 10/22/08 12:36 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Message: 4 Date: Wed, 22 Oct 2008 11:13:32 -0400 From: Eric Gorr [EMAIL PROTECTED] Subject: Re: [Q] Hiding zoom minimize buttons To: Cocoa Developers cocoa-dev@lists.apple.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes On Oct 22, 2008, at 10:53 AM, Michael Ash wrote: On Wed, Oct 22, 2008 at 10:36 AM, Eric Gorr [EMAIL PROTECTED] wrote: I found this old thread: http://lists.apple.com/archives/cocoa-dev/2006/Mar/msg01864.html and I would like to know the same thing. Unfortunately, the old thread did not conclude with an answer. While it is possible to obtain the button by doing: NSButton *miniaturizeButton = [myWindow standardWindowButton:NSWindowMiniaturizeButton]; [miniaturizeButton removeFromSuperview]; this results in a crash. First, I highly recommend against doing this. If Cocoa keeps them present but disabled then you ought to stick with that As was mentioned in the old thread, according to the HI Guildlines, it is perfectly acceptable to not have those buttons. Furthermore, it is quite common in several applications for a window to not have a miniaturize or zoom button...particularly NSPanels (they are Windows). But, in any case, minutes after I posted this, I found an answer: NSButton *miniaturizeButton = [myWindow standardWindowButton:NSWindowMiniaturizeButton]; [miniaturizeButton setHidden:YES]; while it doesn't appear that one can create a window without these buttons, it is trivial to hide them. If there is a better solution, I would be interested. G. Apple ___ 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 [EMAIL PROTECTED]
Re: Using Core Animation to animate view properties?
On Oct 22, 2008, at 12:54 PM, Matt Long wrote: 1. If you want to know whether an animation is still running, just check to see if it is still in the animations dictionary in the layer. A call like this would do it: [...] How you apply this to view properties, I'm not sure, but this is how you do these things with layers. Hope that helps. I'm trying to animation a non-layer *view* property. My view isn't actually layer backed. I'm still curious how to detect an in-flight animation. The documentation suggests I can abort the in-flight animation by setting the target value inside of a zero duration animation context. This isn't working in my sample app. After I review the code, I'll post a link to it here. Jim ___ 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 [EMAIL PROTECTED]
Re: what do you use to make icons and similar?
Adobe Illustrator CS3 and up has a feature called live trace which is like the old Streamline program, to trace raster images into vector format. There is also an app called Vector Magic that can vectorize images, there is a demo online somewhere. As a professional graphic designer breaking into programming, I make most of my icons with Illustrator, as almost all vector objects, then bring into Photoshop for final tweaking, at 512x512 pixel or 128x128 pixels, and then use either IconFactory's IconBuilder, or just save the PSD file with transparent background and drop into Apple IconComposer. For UI items I use .tif format, as it supports alpha channels (transparent areas), so it's suitable for buttons or just UI background items. Here's a tip- Don't rely on a photo of something as your application icon. Consider that many people will view the icon at 16x16 (list view) or 32x32. Too much detail will destroy an (application) icon's visibility at small sizes. ___ 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 [EMAIL PROTECTED]
Re: NSInMemoryStoreType: Not really persistent, is it?
On 2008 Oct, 21, at 16:53, Bill Bumgarner wrote: Well, it is persistent. Just don't turn off your machine or shut down the app. In all seriousness, a persistent store the interface between the coordinator and the permanent state of your object graph -- both for reading and writing. When you push a change into a store, that change effectively becomes a permanent part of that objects state. That the actual storage is in memory vs. on disk is irrelevant. Well, I agree that it has persistent relationships, as long as the power is not turned off. But since power does get turned off, I think that instead of NSPersistentStore, and since managed objects have relationsips, I think Apple should have called it NSObjectStore or (longer - eek!) NSManagedObjectStore. It would have made more sense to base these things' name on what they store (managed objects), instead of on some attribute (their persistence) which is not always true. Look, I can store lots of different things in our refrigerator, and they will persist as long as the power does not go off. So, I could call it our NSPersistentStore. But calling it NSPerishableFoodStore would make it easier for the other cooks in the house to understand. The in memory store is actually extremely useful for caches and as a backing store for applications that read/write to/from some kind of server I'm just hoping that it will Undo/Redo tree-structured data correctly, always. Even though I've written a ton of code in my old non-Core- Data app to support Undo/Redo, I can still find pathological sequences of three or more edit operations for which Undo or Redo won't bring the data back to the original state. My choices were to either start almost from scratch and fix my data-structuring mistakes, or start almost from scratch and use 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 [EMAIL PROTECTED]
Re: Get text width outside a view
I'm trying to calculate the width of a text Cocoa: NSAttributedString(AppKitAdditions) implements a method named - size which gives you the size as if the string was drawn with the attributes set. Cocoa Touch: NSString(UIStringDrawing) has some methods starting with - sizeWithFont... which do just what you want. Marco ___ 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 [EMAIL PROTECTED]
Re: [Q] Hiding zoom minimize buttons
On Oct 22, 2008, at 10:13 AM, Eric Gorr wrote: On Oct 22, 2008, at 10:53 AM, Michael Ash wrote: On Wed, Oct 22, 2008 at 10:36 AM, Eric Gorr [EMAIL PROTECTED] wrote: I found this old thread: http://lists.apple.com/archives/cocoa-dev/2006/Mar/msg01864.html and I would like to know the same thing. Unfortunately, the old thread did not conclude with an answer. While it is possible to obtain the button by doing: NSButton *miniaturizeButton = [myWindow standardWindowButton:NSWindowMiniaturizeButton]; [miniaturizeButton removeFromSuperview]; this results in a crash. First, I highly recommend against doing this. If Cocoa keeps them present but disabled then you ought to stick with that As was mentioned in the old thread, according to the HI Guildlines, it is perfectly acceptable to not have those buttons. Furthermore, it is quite common in several applications for a window to not have a miniaturize or zoom button...particularly NSPanels (they are Windows). But, in any case, minutes after I posted this, I found an answer: NSButton *miniaturizeButton = [myWindow standardWindowButton:NSWindowMiniaturizeButton]; [miniaturizeButton setHidden:YES]; while it doesn't appear that one can create a window without these buttons, it is trivial to hide them. The last time I tried something like that (and this behavior may have changed since then), it left a hole in the tracking area of the title-bar where the button was, resulting in a dead area that looks like you should be able to move the window, but you can't, which turned out to be quite frustrating (this was one of those narrow windows that didn't need those controls so remove it so there would be more room for the title and window dragging cases). Glenn Andreas [EMAIL PROTECTED] http://www.gandreas.com/ wicked fun! quadrium2 | build, mutate, evolve, animate | images, textures, fractals, art ___ 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 [EMAIL PROTECTED]
LSUIElement application and coming to the front
I am working on an application which is a floating palette that only appears when another application is frontmost. I have set LSUIElement in the Info.plist but when the palette comes to the front my application becomes active keyboard shortcuts no longer work in the other application. In a way I am attempting to replicate the same kind of functionality as the Help Viewer application. If you bring up help in Safari the Help Viewer application launches and it is possible to 'Ask a Question' in it's window. However, if you press command-Q then Safari quits, not the Help Viewer. In my application even though it has no menus pressing command-Q quits my application. What I am missing? Thanks, Nick -- Nick Beadman [EMAIL PROTECTED] (sent from my mailing list account, [EMAIL PROTECTED]) ___ 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 [EMAIL PROTECTED]
Re: How to use third-party library in cocoa program?
On Oct 22, 2008, at 3:38 AM, Venture Lee wrote: 1. How to use the library in my program? Just link to it. Mind you, legally, you can only link to the MySQL libraries directly if your software is free/open source, or if you've bought a commercial license from the MySQL people. Otherwise, you should probably use ODBC instead. See MySQL's Web site for details. 2. How to link the library statically? because this program will be deployed in other machine no mysql library installed. You'll have to point the linker directly to the library's path in Xcode's other linker flags setting. Unfortunately this is necessary because the linker always prefers dynamic libraries over static ones, and there is no way to change this. Nick Zitzmann http://www.chronosnet.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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
I'm just building my own application based on the CocoaEcho sample from Apple. But the CocoaEcho Client is full of memory leaks. These leaks occur, when you select and deselect a CocoaEchoServer some times by clicking on them and again next to them Leaked Objects are: SCNetworkReachability GeneralBlocks NSCFDictionaries NSCFData NSCFInputStream NSCFOutputStream All points to the openstream: and closestream: methods but I am not so skilled to find the error with the help of instruments and the debugger. Does someone know if there is something wrong in the CocoaEchoClient code or if the error is in the Cocoa frameworks itself? I've built a networking framework some time ago and used the CocoaEcho example as a starting point. Some of the sample code is still present and I just realised that I'm using the exact same -openStreams method, just without the two -retain messages for the inputStream and outputStream. Additionally, I just verified that doing just that in the CocoaEcho example gets rid of the memory leaks. According to Cocoa conventions, methods starting with -get... return values by reference, but I can't find anything that talks about memory management when using such methods. Therefore, I would assume the normal rules apply and the values should be autoreleased (even though we are not really talking about return values per se). The streams you get by using -getInputStream:outputStream: have a retain count of 1 and are not autoreleased. I'd say it's either a bug in the framework or rather a weak spot in the documentation. Marco P.S.: I just tested NSGradient's -getColor:location:atIndex: method (the only one I could find that returns an object by reference) and here too, the first parameter (an NSColor **) has a retain count of 1 and is not autoreleased. I'd say there's something amiss in the docs and the CocoaEcho sample is 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/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
On Oct 22, 2008, at 1:05 PM, Marco Masser wrote: P.S.: I just tested NSGradient's -getColor:location:atIndex: method (the only one I could find that returns an object by reference) and here too, the first parameter (an NSColor **) has a retain count of 1 and is not autoreleased. How do you know that it isn't autoreleased? Nick Zitzmann http://www.chronosnet.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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
P.S.: I just tested NSGradient's -getColor:location:atIndex: method (the only one I could find that returns an object by reference) and here too, the first parameter (an NSColor **) has a retain count of 1 and is not autoreleased. How do you know that it isn't autoreleased? I don't know of any way to look into an autorelease pool, if you mean that : ) I just made an NSColor ivar and retained it after calling - getColor:location:atIndex: and took a look on its retain count in a second method that was called after the NSAutoreleasePool had been drained (i.e. I took a look at the retain count after pressing a button). That way, all -autorelease messages must have been dealt with. In the second method, the count was 2. After removing the - retain following the -getColor..., the retain count in the second method was 1. Marco ___ 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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
On Oct 22, 2008, at 12:54 PM, Marco Masser wrote: I don't know of any way to look into an autorelease pool, if you mean that : ) I just made an NSColor ivar and retained it after calling - getColor:location:atIndex: and took a look on its retain count in a second method that was called after the NSAutoreleasePool had been drained (i.e. I took a look at the retain count after pressing a button). That way, all -autorelease messages must have been dealt with. In the second method, the count was 2. After removing the - retain following the -getColor..., the retain count in the second method was 1. In general, the retain count is entirely meaningless. The retain count of any given object, especially objects that were created by or have passed through the Apple provided frameworks, may be seemingly random due to the internal implementation details of the class or of the frameworks. Caching, singletons, and any of a number of optimizations could impact the retain count. Frankly, -retainCount should be deprecated and eliminated. If you are trying to find a leak, then use one of the tools on the system designed for exactly that -- leaks, Object Graph in Instruments for GC, Object Alloc for non-GC, etc... Now... in this particular case... How can you look at the retain count of an object after the autorelease pool was drained without it being retained by something? Didn't you have to retain it to keep the NSColor iVar around? b.bum smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Increment object property
Newbie question, Is it possible to have an object property that increments everytime an object is instantiated? @interface foo : NSObject { NSString*name; } @property (copy,readwrite) NSString *name; @end #import foo.h @implementation foo - (id) init { self = [super init]; if (self != nil) { [self setName:@untitled1]; } return self; } @synthesize name; @end I have an NSTableColumn that is bound to foo.name. An NSArrayController looks after adding and removing the foo objects. How can I make the name property increment from untitled1, untitled2, untitled3... etc as the objects are added to the array? Any help would be appreciated Regards Rob Carruthers ___ 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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
On Oct 22, 2008, at 1:54 PM, Marco Masser wrote: I don't know of any way to look into an autorelease pool, if you mean that : ) I just made an NSColor ivar and retained it after calling - getColor:location:atIndex: and took a look on its retain count in a second method that was called after the NSAutoreleasePool had been drained (i.e. I took a look at the retain count after pressing a button). That way, all -autorelease messages must have been dealt with. In the second method, the count was 2. After removing the - retain following the -getColor..., the retain count in the second method was 1. Retain counts != memory leaks. If you make sure zombies are turned off (which they are, by default), and run the code in MallocDebug, and MallocDebug does not report a leak after the code is run, then the memory was not leaked. But if it does, and you're sure zombies are off, then you just might have found a leak in a system framework, and should probably report it. It's generally good advice to just ignore retain counts and follow the memory management rules as written. Also, memory leaks in system frameworks are quite rare. There were some real leaks in the past (e.g. the NSCalendar and NSDateFormatter classes were very leaky in Tiger), but they were fixed a while ago. Nick Zitzmann http://www.chronosnet.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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
On Wed, Oct 22, 2008 at 12:54 PM, Marco Masser [EMAIL PROTECTED] wrote: P.S.: I just tested NSGradient's -getColor:location:atIndex: method (the only one I could find that returns an object by reference) and here too, the first parameter (an NSColor **) has a retain count of 1 and is not autoreleased. How do you know that it isn't autoreleased? I don't know of any way to look into an autorelease pool, if you mean that : I just made an NSColor ivar and retained it after calling -getColor:location:atIndex: and took a look on its retain count in a second method that was called after the NSAutoreleasePool had been drained (i.e. I took a look at the retain count after pressing a button). That way, all -autorelease messages must have been dealt with. In the second method, the count was 2. After removing the -retain following the -getColor..., the retain count in the second method was 1. That still means nothing, you rarely get useful information from inspecting an object's retain count. You should just follow all of the normal memory management rules, and forget that the retainCount method even exists. In this case, you are not responsible for releasing the color that you get back from -getColor:location:atIndex:. -- Clark S. Cox III [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
another n00b question -- how to find a memory leak
Hello, all ... I've found a few leaks in my app using Instruments, and it works well, but i've this message that appears in the console window when I run the app under XCode, and i'm not sure how to find the cause: 2008-10-22 13:06:57.998 Magnatune[1956:dc23] *** _NSAutoreleaseNoPool(): Object 0x17d6f0 of class NSCFData autoreleased with no pool in place - just leaking Stack: (0x306d242b 0x3066f2c7 0x3066f293 0x3067d159 0x3067cfbf 0x3067cf9d 0x3e21 0x306abbd3 0x306714fd 0x306ea311 0x10a59 0x3486e530 0x347e6bac 0x34881920 0x30269cb9 0x30269367 0x3486c7d0 0x34870d38 0x34825880 0x3144a825) ... I think it might have something to do with my Core Audio code, as this only happens once I start playing audio, but again, i'm not sure how to use the information supplied in the message to determine where the leak is in the code. Can anyone illuminate me? Regards, John Falling You - exploring the beauty of voice and sound http://www.fallingyou.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 [EMAIL PROTECTED]
Re: Increment object property
On Oct 22, 2008, at 2:10 PM, [EMAIL PROTECTED] wrote: Newbie question, Is it possible to have an object property that increments everytime an object is instantiated? You can have a static variable defined in the implementation file, and it will be persistent across the class, but will be invisible to subclasses, which is a drawback. Or you could have a class method with a static stack var. You could have a global var. @interface foo : NSObject { NSString*name; } @property (copy,readwrite) NSString *name; @end #import foo.h @implementation foo - (id) init { self = [super init]; if (self != nil) { [self setName:@untitled1]; } return self; } @synthesize name; @end I have an NSTableColumn that is bound to foo.name. An NSArrayController looks after adding and removing the foo objects. How can I make the name property increment from untitled1, untitled2, untitled3... etc as the objects are added to the array? Perhaps also have an initWithName: method, and subclassing the nsarraycontroller so you have control over object creation, then you could use [NSString stringWithFormat:@untitled%i, [[self arrangedObjects] count]]. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ 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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
Hello, In general, the retain count is entirely meaningless. The retain count of any given object, especially objects that were created by or have passed through the Apple provided frameworks, may be seemingly random due to the internal implementation details of the class or of the frameworks. Caching, singletons, and any of a number of optimizations could impact the retain count. Frankly, -retainCount should be deprecated and eliminated. If you are trying to find a leak, then use one of the tools on the system designed for exactly that -- leaks, Object Graph in Instruments for GC, Object Alloc for non-GC, etc... In my special case (the memory leak in the CocoaEcho sample) I used Instruments with the leaks instrument and it shows up several memory leaks. They seem to come from the openstream: and closestream: methods. Is the retain in these methods right after I got the streams with - getInputStream:outputStream: or is it wrong? How can I test it to go sure? I'm not really sure about this. Thanks for your help Jens ___ 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 [EMAIL PROTECTED]
Re: another n00b question -- how to find a memory leak
On Oct 22, 2008, at 1:15 PM, John Zorko wrote: I've found a few leaks in my app using Instruments, and it works well, but i've this message that appears in the console window when I run the app under XCode, and i'm not sure how to find the cause: 2008-10-22 13:06:57.998 Magnatune[1956:dc23] *** _NSAutoreleaseNoPool(): Object 0x17d6f0 of class NSCFData autoreleased with no pool in place - just leaking Stack: (0x306d242b 0x3066f2c7 0x3066f293 0x3067d159 0x3067cfbf 0x3067cf9d 0x3e21 0x306abbd3 0x306714fd 0x306ea311 0x10a59 0x3486e530 0x347e6bac 0x34881920 0x30269cb9 0x30269367 0x3486c7d0 0x34870d38 0x34825880 0x3144a825) ... I think it might have something to do with my Core Audio code, as this only happens once I start playing audio, but again, i'm not sure how to use the information supplied in the message to determine where the leak is in the code. Can anyone illuminate me? One of two reasons, most likely: (1) You have done something in main() before passing control to the AppKit (NSApplicationMain()) and without creating an autorelease pool. (2) You are doing something in a thread that does not have a runloop and have not created an autorelease pool. I'm betting (2). In particular, if you have a Core Audio callback being triggered in a secondary thread and you are using Objective-C in that callback, there may not be a pool in place. Do this in your callback: { NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init]; ... do your callback thing here ... [p drain]; return ... whatever you need to return ...; b.bum smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Re: another n00b question -- how to find a memory leak
Bill, Alas, I found it 10 minutes after I posted the message *sigh* ... I forgot the autorelease pool in my override of - observeValueForKeyPath:ofObject:change:contet: ... the console message is gone now :-) Many thanks anyway, though! Do this in your callback: { NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init]; ... do your callback thing here ... [p drain]; return ... whatever you need to return ...; Regards, John Falling You - exploring the beauty of voice and sound http://www.fallingyou.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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
On Oct 22, 2008, at 1:35 PM, Jens Beuckenhauer wrote: Hello, In general, the retain count is entirely meaningless. The retain count of any given object, especially objects that were created by or have passed through the Apple provided frameworks, may be seemingly random due to the internal implementation details of the class or of the frameworks. Caching, singletons, and any of a number of optimizations could impact the retain count. Frankly, -retainCount should be deprecated and eliminated. If you are trying to find a leak, then use one of the tools on the system designed for exactly that -- leaks, Object Graph in Instruments for GC, Object Alloc for non-GC, etc... In my special case (the memory leak in the CocoaEcho sample) I used Instruments with the leaks instrument and it shows up several memory leaks. They seem to come from the openstream: and closestream: methods. Is the retain in these methods right after I got the streams with - getInputStream:outputStream: or is it wrong? How can I test it to go sure? The retains in -openStreams are balanced by the releases in - closeStreams. Similarly, the streams are retained/released in a balanced fashion within the server. So, unless the server is never shutting down, that isn't the source of your leak -- there must be an unbalanced -retain coming from somewhere. The Leaks instrument can tell you where all -retain/-releases were invoked from. You should see an unbalanced -retain. b.bum smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Core data one-to-many: how to set relationship for newly added 'many' objects?
A basic question: I have a Core Data model which has a one-to-many relationship, say one Department and several Employees. When an Employee is added using the 'add' button of the standard interface, how can I set the relationship to the (one) instance of Department? It means you need access to theDepartment from Employee - awakeFromInsert. But I'm not allowed to do a fetchRequest from here, right? What is a clean way to do this? At this moment I have the department pre-fetched somewhere (like in AppDelegate), but that's probably not the right approach. Thanks for your time, Arthur C. _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/___ 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 [EMAIL PROTECTED]
Re: another n00b question -- how to find a memory leak
On Wed, Oct 22, 2008 at 1:46 PM, John Zorko [EMAIL PROTECTED] wrote: Bill, Alas, I found it 10 minutes after I posted the message *sigh* ... I forgot the autorelease pool in my override of -observeValueForKeyPath:ofObject:change:contet: ... the console message is gone now :-) Humm that has me concerned... it usually isn't a good idea for KVO to be fired from a secondary thread (since often UI, etc. can be involved and often that isn't safe to be doing from a secondary thread). You likely should be bouncing KVO triggering operations to the main thread. -Shawn ___ 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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
Sorry about any confusion that I may have caused! The color I got from the NSGradient's -getColor:location:atIndex: actually was autoreleased, but the NSGradient was not. Therefore, the color always had an retain count of 1. Sorry about that. If you are trying to find a leak, then use one of the tools on the system designed for exactly that -- leaks, Object Graph in Instruments for GC, Object Alloc for non-GC, etc... I didn't try to find a leak with this NSGradient method, I tried to find a rule of thumb for the memory management for objects created and returned by reference. Apart from NSNetService's - getInputStream:outputStream: and NSGradient's - getColor:location:atIndex:, I couldn't find such a case (there are plenty of methods returning primitives or C-structs by reference, though). Now that I think of it, any method using an NSError** might be worth looking into: In this case, the basic memory management rules apply. The Error Handling Programming Guide is clear about this: [...] you should send autorelease to [the NSError object] before you return it to the caller. http://developer.apple.com/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/CreateCustomizeNSError/chapter_4_section_4.html Now... in this particular case... How can you look at the retain count of an object after the autorelease pool was drained without it being retained by something? Didn't you have to retain it to keep the NSColor iVar around? I just made an NSColor ivar and retained it after calling - getColor:location:atIndex: and took a look on its retain count in a second method that was called after the NSAutoreleasePool had been drained (i.e. I took a look at the retain count after pressing a button). That way, all -autorelease messages must have been dealt with and what remains are the real retains. ___ 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 [EMAIL PROTECTED]
Localized pdf (and other) documents/files
Hello, Way back in 2002, there was a short discussion about the idea of providing localized readme files as part of an improved software delivery experience (http://lists.apple.com/archives/cocoa-dev/2002/Mar/msg00301.html ). Later Apple has used the same idea to provide pdf files as bundles with localized content, in e.g. /Library/Documentation/Applications/ GarageBand/ where there is what looks like a pdf file, but formally is an application that returns the proper pdf file according to the user's language preferences. Now I wanted to replicate this behaviour in my own set of pdf readme files, but I'm unable to. The documentation mentioned above contains some actual executables, which I don't understand the function of. I have searched all possible documentation at dev.apple.com as well as mailing lists and Google, and found nothing. Still, this should not be too hard? I mean, folder names can easily be localised (that method is documented), and there are some working examples in Leopard. It is just that I can't figure out how... :| Any help or pointers would be appreciated. Best regards, Sjur ___ 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 [EMAIL PROTECTED]
Re: Get text width outside a view
Probably my method was working but sizeWithFont is definitely the one to be used. Thanks a lot! chr On Wed, Oct 22, 2008 at 7:27 PM, Marco Masser [EMAIL PROTECTED] wrote: I'm trying to calculate the width of a text Cocoa: NSAttributedString(AppKitAdditions) implements a method named -size which gives you the size as if the string was drawn with the attributes set. Cocoa Touch: NSString(UIStringDrawing) has some methods starting with -sizeWithFont... which do just what you want. Marco ___ 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/christian%40nuthinking.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Re: another n00b question -- how to find a memory leak
Shawn, I'm using KVO in this case as a means to only do certain processing when a thread really exits. I start my Core Audio thread like this: - (void)start { streamerThread = [[NSThread alloc] initWithTarget:self selector:@selector(startInternal) object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(threadStopped) name:NSThreadWillExitNotification object:streamerThread]; [streamerThread start]; MagnatuneAppDelegate *appDelegate = (MagnatuneAppDelegate *) [[UIApplication sharedApplication] delegate]; appDelegate.playbackThreadFinished = false; } ... so when the thread stops (or is as close to stopping as I can get -- I figure if it's about to call exit(), that's good enough), this happens: - (void)threadStopped { NSLog(@*** streamer thread has stopped ***); [[NSNotificationCenter defaultCenter] removeObserver:self]; MagnatuneAppDelegate *appDelegate = (MagnatuneAppDelegate *) [[UIApplication sharedApplication] delegate]; appDelegate.playbackThreadFinished = true; } ... and I have this KVO handler: - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog(@observeValueForKeyPath -- current thread ID: %x, keypath: %s, [NSThread currentThread], [keyPath UTF8String]); if ([keyPath isEqualToString:@isPlaying]) { . . . } else if ([keyPath isEqualToString:@playbackThreadFinished]) { if (playbackThreadFinished) { // do special stuff that should only happen once the core audio thread has finished // nothing UI-related goes on here [self do_something]; . . . } [pool release]; return; } else if ([keyPath isEqualToString:@donePlaying]) { . . . } else if ([keyPath isEqualToString:@nextSong]) { . . . } [pool release]; [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } So I know the KVO handler gets called on the thread that changed the value. Are you saying that do_something should happen on the main thread i.e. performSelectorOnMainThread:@selector(do_something)? Should I make sure _anything_ that happens in this KVO handler is dispatched to the main thread in that way? On Oct 22, 2008, at 2:00 PM, Shawn Erickson wrote: On Wed, Oct 22, 2008 at 1:46 PM, John Zorko [EMAIL PROTECTED] wrote: Bill, Alas, I found it 10 minutes after I posted the message *sigh* ... I forgot the autorelease pool in my override of -observeValueForKeyPath:ofObject:change:contet: ... the console message is gone now :-) Humm that has me concerned... it usually isn't a good idea for KVO to be fired from a secondary thread (since often UI, etc. can be involved and often that isn't safe to be doing from a secondary thread). You likely should be bouncing KVO triggering operations to the main thread. -Shawn Regards, John Falling You - exploring the beauty of voice and sound http://www.fallingyou.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 [EMAIL PROTECTED]
Adding QTMovie to directory wrapper
Folks, I have an application that saves several pieces of data, most of which are simple NSMutableArrays. To keep things tidy and flexible, I encode all of these into separate file wrappers within a directory file wrapper. This works fine. Now, I have a QTMovie that I would also like to save into the wrapper. I understand from a bit of research that trying to encode this in the same way as the arrays is very inefficient and slow, so I am looking for the proper way to go about it. I could just try and use writeToFile, but that would of course change the contents of the wrapper externally, and so cause warnings for the user every time they subsequently tried to save. Does anyone have an example of how this *should* be done? Many thanks Matt ___ 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 [EMAIL PROTECTED]
Re: another n00b question -- how to find a memory leak
On Wed, Oct 22, 2008 at 2:21 PM, John Zorko [EMAIL PROTECTED] wrote: appDelegate.playbackThreadFinished = false; appDelegate.playbackThreadFinished = true; ... ... and I have this KVO handler: - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([keyPath isEqualToString:@isPlaying]) ... else if ([keyPath isEqualToString:@playbackThreadFinished]) ... else if ([keyPath isEqualToString:@donePlaying]) ... else if ([keyPath isEqualToString:@nextSong]) ... } This looks like a misapplication of KVO to me (functional but not the best way IMHO). I think it would be better for your application delegate to provide methods for these state changes and then you can send messages from your secondary thread(s) to the delegate using performSelectorOnMainThread:... Then the delegate could set properties as needed (if still needed). On a side note... For this type of thing I have a HOM (higher order messaging) construct that I use to bounce messages from a secondary thread to the main thread. (you can search on HOM and find examples of this) For example if I wanted someObject to process the following message in the context of the main thread... [someObject doThis:this withThat:that]; ...I could write... [[someObject performOnMainThread] doThis:this withThat:that]; ...or maybe if I wanted to defer the message until the next event loop cycle... [[someObject performLater] doThis:this withThat:that]; Should I make sure _anything_ that happens in this KVO handler is dispatched to the main thread in that way? In general UI related objects (views) should be worked with only from the context of the main thread. In fact most of Cocoa should be dealt with only from the main thread unless documented otherwise. -Shawn ___ 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 [EMAIL PROTECTED]
Re: Rotating a QTMovie doesn't work the way it used to
So does anyone know whether this is a problem that's specific for dealing with QuickTime movies from a cocoa app? Or is there a more elegant way of rotating movies? I don't know anything about the old QuickTime APIs. But I would suggest the new way to do this is use Core Animation. You might be able to use NSView's setFrameCenterRotation (you may not need to enable layer backing to use this). Or you could use a QTMovieLayer instead of a QTMovieView which would get you a lot more direct control over the transform matrix and anchorPoint. -Eric ___ 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 [EMAIL PROTECTED]
Re: Increment object property
--- On Wed, 10/22/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Newbie question, Is it possible to have an object property that increments everytime an object is instantiated? Simplest solution: Just increment a static int and insert that into your string. Fancy it up as appropriate to your situation. @interface Foo : NSObject { NSString*name; } @property (copy,readwrite) NSString *name; @end #import foo.h @implementation Foo @synthesize name; - (id) init { static unsigned documentCount = 1; self = [super init]; if (self != nil) { self.name = [NSString stringWithFormat:@untitled%u, count++]; } return self; } @end Cheers, Chuck ___ 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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
To move beyond the memory leaks in an untouched version of EchoClient, the only thing you need to do is remove the retain calls in openStreams. The call to -[NSNetService getInputStream:outputStream:] calls CFStreamCreatePairWithSocketToNetService, which is a create function. To verify this, the memory leak will be exacerbated every time you select and deselect a service. Hello, The retains in -openStreams are balanced by the releases in - closeStreams. Similarly, the streams are retained/released in a balanced fashion within the server. So, unless the server is never shutting down, that isn't the source of your leak -- there must be an unbalanced -retain coming from somewhere. The Leaks instrument can tell you where all -retain/-releases were invoked from. You should see an unbalanced -retain. So I think now I got it, for example if there is a line 48 there should be another line -48, right? Then it's balanced, and it's not necessarily the last line? There are several leaks, and I think one unbalanced part should then be getinputstream:outputstream:, and -openstreams: Simply deleting the two retain lines in the openstreams: didn't work... Jens ___ 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 [EMAIL PROTECTED]
commitEditing
I'm calling commitEditing on a NSObjectController, and its returning NO, for no apparent or obvious reason. How am I supposed to debug these things? ___ 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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
Hello, To move beyond the memory leaks in an untouched version of EchoClient, the only thing you need to do is remove the retain calls in openStreams. The call to -[NSNetService getInputStream:outputStream:] calls CFStreamCreatePairWithSocketToNetService, which is a create function. To verify this, the memory leak will be exacerbated every time you select and deselect a service. I tried that, but the leaks are still there if I select and deselect the service several times. (Not the first time, but later on)... Jens ___ 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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
Then the bug is somewhere in your changes. The only thing you should do is remove the retain calls. If you also remove the release calls, you will still have the memory leaks. Here's what openStreams should look like: - (void)openStreams { [inputStream setDelegate:self]; [outputStream setDelegate:self]; [inputStream scheduleInRunLoop: [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outputStream scheduleInRunLoop: [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [inputStream open]; [outputStream open]; } Here's what closeStreams should look like: - (void)closeStreams { [inputStream close]; [outputStream close]; [inputStream removeFromRunLoop: [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outputStream removeFromRunLoop: [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [inputStream setDelegate:nil]; [outputStream setDelegate:nil]; [inputStream release]; [outputStream release]; inputStream = nil; outputStream = nil; } Hello, To move beyond the memory leaks in an untouched version of EchoClient, the only thing you need to do is remove the retain calls in openStreams. The call to -[NSNetService getInputStream:outputStream:] calls CFStreamCreatePairWithSocketToNetService, which is a create function. To verify this, the memory leak will be exacerbated every time you select and deselect a service. I tried that, but the leaks are still there if I select and deselect the service several times. (Not the first time, but later on)... Jens ___ 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 [EMAIL PROTECTED]
Drawing an image via 9 slices?
I'd have sworn in times past I've run across a Cocoa method that takes 9 slice of an image, and expands the middle piece while retaining the outer 8 pieces to create an expandable image. (Imagine a button image with a custom border, but a plain gray middle. using this alleged method, you could draw that image at any size, the border looks correct at all sizes, because only the middle slice (both horizontally and vertically) grows.) Can anyone refresh my memory of what this beast is? Or am I hallucinating (again)? randy ___ 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 [EMAIL PROTECTED]
Re: LSUIElement application and coming to the front
Following up on my own post. Off list some suggested that I implement - [NSWindow canBecomeKeyWindow] returning NO. Unfortunately, this stops any keyboard entry in the window which I need. I know this is possible as the Help Viewer application allows for keyboard entry but doesn't stop keyboard shortcuts going to the current application. How do I go about working out how it does that? Nick On Oct 22, 2008, at 11:47 am, Nick Beadman wrote: I am working on an application which is a floating palette that only appears when another application is frontmost. I have set LSUIElement in the Info.plist but when the palette comes to the front my application becomes active keyboard shortcuts no longer work in the other application. In a way I am attempting to replicate the same kind of functionality as the Help Viewer application. If you bring up help in Safari the Help Viewer application launches and it is possible to 'Ask a Question' in it's window. However, if you press command-Q then Safari quits, not the Help Viewer. In my application even though it has no menus pressing command-Q quits my application. What I am missing? Thanks, Nick -- Nick Beadman [EMAIL PROTECTED] (sent from my mailing list account, [EMAIL PROTECTED]) ___ 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 [EMAIL PROTECTED]
Re: Drawing an image via 9 slices?
On Oct 22, 2008, at 6:21 PM, Randall Meadows wrote: I'd have sworn in times past I've run across a Cocoa method that takes 9 slice of an image, and expands the middle piece while retaining the outer 8 pieces to create an expandable image. (Imagine a button image with a custom border, but a plain gray middle. using this alleged method, you could draw that image at any size, the border looks correct at all sizes, because only the middle slice (both horizontally and vertically) grows.) Can anyone refresh my memory of what this beast is? Or am I hallucinating (again)? It's new in Leopard and not documented well (or at all?) outside of the header file. Look in NSCell.h for NSDrawNinePartImage though. Ashley smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Unregistered weak referrer
What does this console message mean? malloc: auto malloc[542]: attempted to remove unregistered weak referrer 0x128538c ___ 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 [EMAIL PROTECTED]
Re: Drawing an image via 9 slices?
On Oct 22, 2008, at 5:26 PM, Ashley Clark wrote: On Oct 22, 2008, at 6:21 PM, Randall Meadows wrote: I'd have sworn in times past I've run across a Cocoa method that takes 9 slice of an image, and expands the middle piece while retaining the outer 8 pieces to create an expandable image. (Imagine a button image with a custom border, but a plain gray middle. using this alleged method, you could draw that image at any size, the border looks correct at all sizes, because only the middle slice (both horizontally and vertically) grows.) Can anyone refresh my memory of what this beast is? Or am I hallucinating (again)? It's new in Leopard and not documented well (or at all?) outside of the header file. Look in NSCell.h for NSDrawNinePartImage though. Yes, that's exactly it! Thank you for validating my sanity. (OK, yes, that's stretching things.) And yes, it appears to be completely UNdocumented, except for the header file. Thanks a bunch! randy ___ 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 [EMAIL PROTECTED]
Re: Unregistered weak referrer
Hi Ross, Do you have garbage collection enabled? Can you give us any hints as to why you'd be getting that message? Kiel On 23/10/2008, at 10:31 AM, Ross Carter wrote: What does this console message mean? malloc: auto malloc[542]: attempted to remove unregistered weak referrer 0x128538c ___ 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/kiel.gillard%40gmail.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Re: Drawing an image via 9 slices?
On Oct 22, 2008, at 4:33 PM, Randall Meadows wrote: And yes, it appears to be completely UNdocumented, except for the header file. Thanks for the heads up -- bug filed. 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 [EMAIL PROTECTED]
Re: Drawing an image via 9 slices?
On Oct 22, 2008, at 5:41 PM, mmalc crawford wrote: On Oct 22, 2008, at 4:33 PM, Randall Meadows wrote: And yes, it appears to be completely UNdocumented, except for the header file. Thanks for the heads up -- bug filed. No, thank *you*! Now I can scratch that off my list. ___ 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 [EMAIL PROTECTED]
Re: Unregistered weak referrer
Yes, GC is enabled. I get the message when I remove a subview from a NSScrollView's documentView. The removed subview contains 3 NSTextViews, 2 of which have their own layoutManager and textStorage. A lot of code fires at that time. Without knowing what unregistered weak referrer means, or how to find what the offending object is, it's hard to know where to start. On Oct 22, 2008, at 7:35 PM, Kiel Gillard wrote: Do you have garbage collection enabled? Can you give us any hints as to why you'd be getting that message? Kiel On 23/10/2008, at 10:31 AM, Ross Carter wrote: What does this console message mean? malloc: auto malloc[542]: attempted to remove unregistered weak referrer 0x128538c ___ 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 [EMAIL PROTECTED]
Re: WebView: Open new windows in default browser
I've been trying to get a WebView to open in the user's default browser. In fact, I've succeeded, but it's rather clunky, and I'm wondering if there's a better way. Why not simply add target=_'blank' to your URLs? No WebView hacking needed. a href=http://my.external.url; title=What the user sees target=_blank/a Philippe ___ 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 [EMAIL PROTECTED]
Re: Unregistered weak referrer
I don't have much experience with GC, so I'd suggest you check out http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcUsing.html#//apple_ref/doc/uid/TP40008006-SW3 or wait until someone with some experience in GC can help you out. GC keeps tabs on all your instances of classes, smells like it's object graph has been messed up somehow. Sorry I can't be more help. On 23/10/2008, at 10:48 AM, Ross Carter wrote: Yes, GC is enabled. I get the message when I remove a subview from a NSScrollView's documentView. The removed subview contains 3 NSTextViews, 2 of which have their own layoutManager and textStorage. A lot of code fires at that time. Without knowing what unregistered weak referrer means, or how to find what the offending object is, it's hard to know where to start. On Oct 22, 2008, at 7:35 PM, Kiel Gillard wrote: Do you have garbage collection enabled? Can you give us any hints as to why you'd be getting that message? Kiel On 23/10/2008, at 10:31 AM, Ross Carter wrote: What does this console message mean? malloc: auto malloc[542]: attempted to remove unregistered weak referrer 0x128538c ___ 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 [EMAIL PROTECTED]
Re: Core data one-to-many: how to set relationship for newly added 'many' objects?
On 2008 Oct, 22, at 13:55, Arthur C. wrote: A basic question: I have a Core Data model which has a one-to-many relationship, say one Department and several Employees. When an Employee is added using the 'add' button of the standard interface, how can I set the relationship to the (one) instance of Department? It means you need access to theDepartment from Employee - awakeFromInsert. I don't think so. Getting a reference to one of your objects should be trivial. Note that -[NSManagedObject insertNewObjectForEntityForName:inManagedObjectContext] returns the newly-inserted object. If you need to post a follow-up, please clarify: Are you working with Apple's DepartmentsAndEmployees Sample Code project? ___ 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 [EMAIL PROTECTED]
Creating Toolbar Items in IB
Hi all, I'm getting myself thoroughly confused about setting up toolbar items in IB. Previously I've never bothered - just handled the whole toolbar thing in code. But the new IB seems to support setting this up in the nib. I can place a toolbar in my window, and I can add items to it. I can set the delegate outlet of the toolbar to my document controller. What I can't do is to tie any outlets to the toolbar items or set any actions or targets for the items. IB's interface doesn't even let me select the items individually, and I cannot assign my own identifiers to them. At runtime, when the nib is loaded, the pre-installed items are there but they have been assigned identifiers which are UUID strings. My delegate gets called and I can add additional custom items just as I would if I were doing it all in code, but for the nib-supplied items, I get nothing. Since the identifiers are assigned UUIDs somewhere there's no way to know what identifier to use to retrieve an item from the bar and fix up its target/action. The whole ability to set up toolbars in IB appears to be useless to me. So before I ditch it all and go back to doing it the harder-but-saner way, can anyone point me in the direction of something that will help me make any sense of this? tia, Graham ___ 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 [EMAIL PROTECTED]
Re: Creating Toolbar Items in IB
On 23/10/2008, at 10:39 AM, Graham Cox wrote: I can place a toolbar in my window, and I can add items to it. I can set the delegate outlet of the toolbar to my document controller. What I can't do is to tie any outlets to the toolbar items or set any actions or targets for the items. IB's interface doesn't even let me select the items individually, and I cannot assign my own identifiers to them. In the Allowed Toolbar Items sheet that appears when you double- click the toolbar, select one of the toolbar items and then click it again. You can then access the bindings, target and action settings for the actual toolbar control rather than the toolbar item. You must set up the object in the Allowed Toolbar Items sheet, not in the toolbar itself. -- Rob Keniger ___ 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 [EMAIL PROTECTED]
Re: Creating Toolbar Items in IB
On Oct 22, 2008, at 17:39, Graham Cox wrote: I can place a toolbar in my window, and I can add items to it. I can set the delegate outlet of the toolbar to my document controller. What I can't do is to tie any outlets to the toolbar items or set any actions or targets for the items. IB's interface doesn't even let me select the items individually, and I cannot assign my own identifiers to them. At runtime, when the nib is loaded, the pre-installed items are there but they have been assigned identifiers which are UUID strings. My delegate gets called and I can add additional custom items just as I would if I were doing it all in code, but for the nib-supplied items, I get nothing. Since the identifiers are assigned UUIDs somewhere there's no way to know what identifier to use to retrieve an item from the bar and fix up its target/action. The whole ability to set up toolbars in IB appears to be useless to me. So before I ditch it all and go back to doing it the harder-but- saner way, can anyone point me in the direction of something that will help me make any sense of this? The identifier thing is annoying. There isn't any way to set your own. The best alternative seems to be to create an outlet for each toolbar item you need to refer to in code, and hook them up in IB. Then you can extract the identifier via the outlet if you need it. The toolbar that IB shows you in its owner window is actually the default set of items, and you can't select them individually there. To get the full set of items, you click on the toolbar once to select it, then again so that the allowed items sheet slides out, and you can select individual items in that sheet. Click once to select the toolbar item, click again to select the underlying control. There were some bugs in IB's toolbar handling, where it wouldn't save the toolbar after you changed it. I'm not sure if that bug is still in the shipping 3.1 version. (The only workaround I found was to put a separator item at the beginning and the end of the toolbar. Then it seemed to save OK.) HTH ___ 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 [EMAIL PROTECTED]
Re: Creating Toolbar Items in IB
On Oct 22, 2008, at 18:33, Quincey Morris wrote: There were some bugs in IB's toolbar handling, where it wouldn't save the toolbar after you changed it. I'm not sure if that bug is still in the shipping 3.1 version. Sorry, I meant ... in the shipping 3.1.1 version. ___ 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 [EMAIL PROTECTED]
CGPoint wrapper?
Is there some straightforward way of wrapping a CGPoint so I can put it in an NSArray? I don't want to use a C array because I want to have fast enumeration available. Or should I just write a simple NSPoint - CGPoint conversion method? dkj ___ 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 [EMAIL PROTECTED]
Re: Unregistered weak referrer
On Oct 22, 2008, at 4:48 PM, Ross Carter wrote: Yes, GC is enabled. I get the message when I remove a subview from a NSScrollView's documentView. The removed subview contains 3 NSTextViews, 2 of which have their own layoutManager and textStorage. A lot of code fires at that time. Without knowing what unregistered weak referrer means, or how to find what the offending object is, it's hard to know where to start. On 23/10/2008, at 10:31 AM, Ross Carter wrote: What does this console message mean? malloc: auto malloc[542]: attempted to remove unregistered weak referrer 0x128538c Mmm... fun. So far, the only time this log message has been barfed up is when something somewhere has clobbered memory. Might you be stomping memory somewhere? There is a chance this is a bug in the frameworks. Please file a bug. If you have a reproducible case, attaching the application (no source necessary) would be very much appreciated. b.bum smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Re: CGPoint wrapper?
I've just found NSPointFromCGPoint() etc,. On 22 Oct, 2008, at 18:49, DKJ wrote: Is there some straightforward way of wrapping a CGPoint so I can put it in an NSArray? I don't want to use a C array because I want to have fast enumeration available. Or should I just write a simple NSPoint - CGPoint conversion method? dkj ___ 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/hatzicware%40shaw.ca This email sent to [EMAIL PROTECTED] Hatzic Intellectual Software Victoria BC, Canada www.hatzicware.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 [EMAIL PROTECTED]
Re: Creating Toolbar Items in IB
On 23/10/2008, at 12:33 PM, Quincey Morris wrote: On Oct 22, 2008, at 17:39, Graham Cox wrote: I can place a toolbar in my window, and I can add items to it. I can set the delegate outlet of the toolbar to my document controller. What I can't do is to tie any outlets to the toolbar items or set any actions or targets for the items. IB's interface doesn't even let me select the items individually, and I cannot assign my own identifiers to them. At runtime, when the nib is loaded, the pre-installed items are there but they have been assigned identifiers which are UUID strings. My delegate gets called and I can add additional custom items just as I would if I were doing it all in code, but for the nib-supplied items, I get nothing. Since the identifiers are assigned UUIDs somewhere there's no way to know what identifier to use to retrieve an item from the bar and fix up its target/action. The whole ability to set up toolbars in IB appears to be useless to me. So before I ditch it all and go back to doing it the harder-but- saner way, can anyone point me in the direction of something that will help me make any sense of this? The identifier thing is annoying. There isn't any way to set your own. The best alternative seems to be to create an outlet for each toolbar item you need to refer to in code, and hook them up in IB. Then you can extract the identifier via the outlet if you need it. You could implement NSToolbar's toolbarWillAddItem: delegate method, for example, and build a collection of toolbar items. The toolbar that IB shows you in its owner window is actually the default set of items, and you can't select them individually there. To get the full set of items, you click on the toolbar once to select it, then again so that the allowed items sheet slides out, and you can select individual items in that sheet. Click once to select the toolbar item, click again to select the underlying control. There were some bugs in IB's toolbar handling, where it wouldn't save the toolbar after you changed it. I'm not sure if that bug is still in the shipping 3.1 version. (The only workaround I found was to put a separator item at the beginning and the end of the toolbar. Then it seemed to save OK.) HTH The bug seems to be there still. Kiel ___ 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 [EMAIL PROTECTED]
Re: CGPoint wrapper?
Use NSValue's valueWithPoint class method. Kiel On 23/10/2008, at 1:06 PM, DKJ wrote: I've just found NSPointFromCGPoint() etc,. On 22 Oct, 2008, at 18:49, DKJ wrote: Is there some straightforward way of wrapping a CGPoint so I can put it in an NSArray? I don't want to use a C array because I want to have fast enumeration available. Or should I just write a simple NSPoint - CGPoint conversion method? dkj ___ 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/hatzicware%40shaw.ca This email sent to [EMAIL PROTECTED] Hatzic Intellectual Software Victoria BC, Canada www.hatzicware.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/kiel.gillard%40gmail.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
problem with [NSImage drawAtPoint:fromRect:operation:fraction:]
Hi All. I just want to check with the populous to make sure I have not gone stupid or insane. The documentation for [NSImage drawAtPoint:fromRect:operation:fraction:] states: The image content is drawn at its current resolution and is not scaled unless the CTM of the current coordinate system itself contains a scaling factor. The image is otherwise positioned and oriented using the current coordinate system. From what I've seen, if you specify a fromRect: that is not the full extent of the image, the region specified by fromRect gets **scaled to the size of the entire image** and then drawn. Has anyone out there had experience with this? Thanks! -Kenny ___ 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 [EMAIL PROTECTED]
Re: Core data one-to-many: how to set relationship for newly added 'many' objects?
Jerry Krinock ([EMAIL PROTECTED]) on 2008-10-22 8:31 PM said: A basic question: I have a Core Data model which has a one-to-many relationship, say one Department and several Employees. When an Employee is added using the 'add' button of the standard interface, how can I set the relationship to the (one) instance of Department? It means you need access to theDepartment from Employee - awakeFromInsert. I don't think so. Getting a reference to one of your objects should be trivial. Note that -[NSManagedObject insertNewObjectForEntityForName:inManagedObjectContext] returns the newly-inserted object. True, but NSArrayController's add: method does not, which I think the OP was referring to. One option is to not use NSArrayController's add: and instead wire your 'add' button to your own action method. In that method, you can call insertNewObjectForEntityForName:inManagedObjectContext: and change the resulting object's relationships. A disadvantage of not using NSArrayController's add: is that the controller's selection will not change to select the newly added object (which is often desirable in your UI). So another option is to subclass NSArrayController and override the newObject method. There you can call super to create the new object and then modify and return the object. You can keep this subclass more generic by making newObject call super, then use a delegate to mutate the new object, then return it. hth, Sean -- Nothing will benefit human health and increase the chances for survival of life on earth as much as the evolution to a vegetarian diet - Albert Einstein ___ 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 [EMAIL PROTECTED]
Persistent Connection to Web Server in cocoa, emulating AJAX
What is the best way to emulate, with cocoa, an AJAX persistent connection to a web server. I've reviewed NSURLConnection, but am not sure if it what i need. Thank you! Jack ___ 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 [EMAIL PROTECTED]
Re: CGPoint wrapper?
On Oct 22, 2008, at 5:49 PM, DKJ wrote: Is there some straightforward way of wrapping a CGPoint so I can put it in an NSArray? I don't want to use a C array because I want to have fast enumeration available. Or should I just write a simple NSPoint - CGPoint conversion method? NSPoint and CGPoint are structs that are essentially the same. You can convert between them with a simple cast: NSPoint point = *(NSPoint *)myCGPoint; http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/QuartzOpenGL/chapter_10_section_2.html You can also use the function NSPointFromCGPoint() which does the exact same thing for you: NSPoint point = NSPointFromCGPoint(myCGPoint); (Declared in NSGeometry.h) - Graff ___ 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 [EMAIL PROTECTED]
Re: Memory Leaks in CocoaEcho Sample
Hello, Then the bug is somewhere in your changes. The only thing you should do is remove the retain calls. If you also remove the release calls, you will still have the memory leaks. Here's what openStreams should look like: - (void)openStreams { [inputStream setDelegate:self]; [outputStream setDelegate:self]; [inputStream scheduleInRunLoop: [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outputStream scheduleInRunLoop: [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [inputStream open]; [outputStream open]; } Here's what closeStreams should look like: - (void)closeStreams { [inputStream close]; [outputStream close]; [inputStream removeFromRunLoop: [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outputStream removeFromRunLoop: [NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [inputStream setDelegate:nil]; [outputStream setDelegate:nil]; [inputStream release]; [outputStream release]; inputStream = nil; outputStream = nil; } I have done exactly what you wrote above in a freshly dezipped CocoaEcho Project. Running it first with the retain and then without. It didn't work. This morning, I tried it again and it worked?!? I think I forgot to clean the build or something like that... Thanks for your help Jens ___ 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 [EMAIL PROTECTED]
Re: commitEditing
The only reason a controller would return NO for commitEditing is that one of *its* editors refused to commitEditing. Up the chain somewhere, there must be a textField bound to the controller or one of its detail controllers and a formatter or validation method is saying that the current value is unacceptable. commitEditing is just supposed to do it, or not. The caller shouldn't have to know why committing didn't work. The receiver should be communicating to the user that editing is ending – and in your case that editing can't be ended with the current value. I can't suggest more on how to debug this without know more about you app. On Oct 22, 2008, at 3:15 PM, Chris Idou wrote: I'm calling commitEditing on a NSObjectController, and its returning NO, for no apparent or obvious reason. How am I supposed to debug these things? -- RONZILLA ___ 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 [EMAIL PROTECTED]
/Library/Logs vs. user/Library/Logs
New to OS X development here... I see some things log to /Library/Logs and others to user/Library/Logs (user=an individual account). I'm thinking my app, which is a user-oriented app (not a system app) would log to the user-specific location. Unless it's bad form to log there and there is some other, more acceptable, best practice with respect to log file location. So... is there a best practice? Is is documented anywhere in Apple doc? Where should I go to read about accepted usage of the /Library and user/Library directories and the files therein? Thanks in advance. Chris ___ 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 [EMAIL PROTECTED]