Re: Core Data Questions--Relationships, UUIDs, and Dirty States
On 28-Oct-08, at 2:01 AM, Keary Suska wrote: 1. Confirmation clarification: do I understand correctly, considering typical RDBMS data integrity rules, that for most to-one relationships, I would set the delete rule to no action, since deletion of the many item should not effect the one item? 2. How do I best implement custom UUIDs for relationships (as a property to an entity)? I thought I saw this come up some time ago but I can't seem to find the discussion. You can generate an UUID by: + (NSString *)generateUniqueID { CFUUIDRef uuid = CFUUIDCreate(NULL); NSString *identifier = (NSString *)CFUUIDCreateString(NULL, uuid); CFRelease(uuid); return identifier; } I guess what you wanna do is store this string as a property to an entity. 3. How can I, in a bindings-compliant manner, report the dirty state of an NSManagedObjectContext? I know I can be notified when the context has changed, and when the context has saved, but what about when the context has been rolled back or changes undo-ed? 4. Does anyone have recommendations on how I can maintain the dirty state of a single NSManagedObject? I don't figure there is anything built into CD for this. TIA, 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/chaitanya%40expersis.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: How to check the number of pending events in the application event queue?
Since you can postpone the task midstride, then you might just want to think of this in terms of breaking the task up into small pieces to be interspersed with event handling. - (void)doSomeMoreWork { [self doTheNextStep]; if([self isMoreWorkToDo]) [self performSelector:@selector(doSomeMoreWork) withObject:nil afterDelay:0.0]; } If your work units are small enough, you shouldn't really have to worry about idleness. On Oct 27, 2008, at 6:19 AM, Oleg Krupnov wrote: Yes, I'd really like to avoid multi-threading. There would be an intense data exchange between the threads and the effort for synchronization would be simply not justified for such a tiny feature. Actually I did try multi-threading before I arrived to this solution, and I have spent very long and painful day debugging some weird rare-happening synchronization bug. Besides, real multi-threaded task works slightly different than simply postponed-to-idleness task. The two threads may be running simultaneously even if the main thread has a higher priority, whereas I'd prefer strict suspension of the secondary task when the main thread wakes up. On Mon, Oct 27, 2008 at 3:05 PM, Jean-Daniel Dupas [EMAIL PROTECTED] wrote: Le 27 oct. 08 à 13:54, Oleg Krupnov a écrit : In my app I'd like to perform some background task without affecting the responsiveness of the UI. To avoid multi-threading, I just postpone the task to a moment when the user becomes and stays idle for a certain time. Have you a good reason to avoid multi-threading ? ___ 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/psagers %40ignorare.net 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: If the NIB instantiates everything how does the controller get a reference to the View and the Model?
I was missing the IBOutlet keyword in the class declaration. Thanks. -Michael On Oct 27, 2008, at 4:06 PM, Ken Thomases wrote: On Oct 27, 2008, at 8:48 PM, Michael A. Crawford wrote: If the NIB instantiates everything how does the controller get a reference to the View and the Model? There are a couple of possibilities: * The controller is in the nib. This is often the case with an application controller in MainMenu.nib, for example. In that case, you just connect the controller's outlets to the view(s). The application controller often creates the model in code and so has a reference to it that way. It's possible, although I don't particularly recommend it, to instantiate your model object in the nib, too. * The controller serves as File's Owner for the nib. Again, you connect outlets to views, but from File's Owner which at design time is a stand-in for the object that will own the nib at run time. You have to tell Interface Builder what the class of File's Owner will be so it knows about your outlets. In this case, the controller may have created the model or it might have been passed a reference to the model when it was created (by another, superior controller). Cheers, Ken 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]
KVO and array item observation
I have a bid revision object that holds a to-many NSSet reference to a group of items that constitute a tree. Some of those items are roots and have a nil parent. In my bid revision object I've set up a rootItems method that uses a predicate to return a filtered set of the items with nil parents and uses keyPathsForValuesAffectingRootItems to be aware of changes to the items set as a whole and generate appropriate KVO notifications. I have a problem though that when an item that's already in the set, but not a root, becomes a root by having its' parent set to nil. This does not cause KVO notifications to be sent out for the rootItems property because technically the items set as a whole has not changed. I naïvely tried to add @items.parent to the keyPathsForValues... method which of course didn't work since you can't observe groups of properties in a set or array. Right now, I'm sending a willChange/ didChange method pair after performing parent changes of subitems and after undo/redo events and it *seems* to be working fine. This seems grotesque though and sure to cause me problems later. Is there any way to force a KVO update of a property besides a willChange/didChange method pair? Is there a better way? Ashley___ 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: Problems when putting a window between desktop and desktop icons
On Mon, Oct 27, 2008 at 21:45, Karl Goiser [EMAIL PROTECTED] wrote: Dear Markus and others, This is a problem that I have had with an application of mine, iCalViewer, which displays a window on the desktop. What happens is that you can find a window level which draws the window under the desktop icons and over the desktop itself. However, at that level, that window captures the mouse events as if it was _over_ the desktop icons. My only solution was to disable mouse interaction with my window. I raised this as a bug with Apple, bug number 3521992 on 5 January, 2004 - coming up to 5 years ago! Regards, Karl Thanks for your reply, good to hear it's not just me, on the other hand not so good because it obviously can't be done :) Time to come up with an entirely different solution then. -- Markus Amalthea Magnuson http://konstochvanligasaker.se http://nattlek.se Life... is like a grapefruit. It's orange and squishy, and has a few pips in it, and some folks have half a one for breakfast. – Douglas Adams ___ 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]
Exceptions vs. pointers to error objects
I'm writing an API to communicate with a web service, and I was just wondering what the thinking is on exceptions vs. functions returning an NSError in some way. Basically I'm wondering what people's opinions are on a function throwing an exception on failure, vs returning an NSError object. Perhaps there is already a policy on when each is to be used. If so, please enlighten me. :) Thanks, Colin ___ 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: Problems when putting a window between desktop and desktop icons
On 28.10.2008, at 08:27, Markus Amalthea Magnuson wrote: On Mon, Oct 27, 2008 at 21:45, Karl Goiser [EMAIL PROTECTED] wrote: Dear Markus and others, This is a problem that I have had with an application of mine, iCalViewer, which displays a window on the desktop. What happens is that you can find a window level which draws the window under the desktop icons and over the desktop itself. However, at that level, that window captures the mouse events as if it was _over_ the desktop icons. My only solution was to disable mouse interaction with my window. I raised this as a bug with Apple, bug number 3521992 on 5 January, 2004 - coming up to 5 years ago! Regards, Karl Thanks for your reply, good to hear it's not just me, on the other hand not so good because it obviously can't be done :) Hm, you could try to detect mouse events for the icons yourself and if such an event is detected repost it to the Finder using some low level event posting in Core Graphics. I’m not sure though whether you can post events for a specific app or even for a specific window. Or (maybe easier) turn it around: set your window to ignore mouse events and use a low level event tap to catch those mouse events you are interested in. Best luck! Kai Time to come up with an entirely different solution then. -- Markus Amalthea Magnuson http://konstochvanligasaker.se http://nattlek.se Life... is like a grapefruit. It's orange and squishy, and has a few pips in it, and some folks have half a one for breakfast. – Douglas Adams ___ 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/kai%40granus.net 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: Can we ask iPhone questions yet?
IMO that does not really answer the question :) Frankly speaking I would also rather talk on a mailing list than this forum stuff. Unless I am mistaken it doesn't even have RSS feeds. (And sorry, I couldn't check that - it was down) cheers -- Torsten ___ 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: Exceptions vs. pointers to error objects
--- On Tue, 10/28/08, Colin Cornaby [EMAIL PROTECTED] wrote: I'm writing an API to communicate with a web service, and I was just wondering what the thinking is on exceptions vs. functions returning an NSError in some way. Basically I'm wondering what people's opinions are on a function throwing an exception on failure, vs returning an NSError object. Perhaps there is already a policy on when each is to be used. If so, please enlighten me. :) From the conceptual docs on Cocoa exceptions: IMPORTANT: You should reserve the use of exceptions for programming or unexpected runtime errors such as out-of-bounds collection access, attempts to mutate immutable objects, sending an invalid message, and losing the connection to the window server. You usually take care of these sorts of errors with exceptions when an application is being created rather than at runtime. ... Instead of exceptions, error objects (NSError) and the Cocoa error-delivery mechanism are the recommended way to communicate expected errors in Cocoa applications. My interpretation of this is that exceptions are meant to be a slightly nicer version of a crash -- something that should only come about through a bug in the program. If it's merely an error that might occur in the normal operation of the app (like reading a malformed file), it should be an NSError rather than an exception. This seems to be the policy that's generally employed in the Cocoa frameworks too. 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: Exceptions vs. pointers to error objects
On Tue, Oct 28, 2008 at 2:58 AM, Colin Cornaby [EMAIL PROTECTED] wrote: I'm writing an API to communicate with a web service, and I was just wondering what the thinking is on exceptions vs. functions returning an NSError in some way. Basically I'm wondering what people's opinions are on a function throwing an exception on failure, vs returning an NSError object. Perhaps there is already a policy on when each is to be used. If so, please enlighten me. :) For me there's two things to consider: 1) Without garbage collection, it's really hard to get exceptions to work properly with no memory leaks. 2) What paradigm does the language and API advocate? It's better, I think, to stick with one model rather than trying to mix. Imagine code that throws an exception, only to catch it and turn it into a returned error code, which then gets thrown later as an exception... drives me nuts. So with Obj-C I always use NSError. I like exceptions better, but the convention is to do it the other way. And that makes thrown exceptions more trouble than they're worth. ___ 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]
Code signing validation
Hello list Having implemented code signing for my app I wanted to be able to do a quick visual check that things were as they should be. I used the following to display a code signing validation message in the app About window for both the application bundle and a couple of auxiliary executables. Has anyone else done anything similar, or hopefully, better? It would probably be a good idea to also check the signing identity. #import Cocoa/Cocoa.h typedef enum { CodesignUnrecognised = -2, CodesignError = -1, CodesignOkay = 0, CodesignFail = 1, CodesignInvalidArgs = 2, CodesignFailedRequirement = 3, } CodesignResult; @interface MGSCodeSigning : NSObject { NSString *_resultString; } @property (copy) NSString *resultString; - (CodesignResult)validateExecutable; - (CodesignResult)validatePath:(NSString *)path; - (CodesignResult)validateApplication; @end #import MGSCodeSigning.h #include dlfcn.h @implementation MGSCodeSigning @synthesize resultString = _resultString; /* validate executable */ - (CodesignResult)validateExecutable { Dl_info info; int errDlAddr = dladdr( (const void *)__func__, info ); if(errDlAddr == 0) { return CodesignError; } char *exec_path = (char *)(info.dli_fname); NSString *path = [NSString stringWithCString:exec_path encoding:NSUTF8StringEncoding]; return [self validatePath:path]; } /* validate this application */ - (CodesignResult)validateApplication { return [self validatePath:[[NSBundle mainBundle] bundlePath]]; } /* validate path */ - (CodesignResult)validatePath:(NSString *)path { self.resultString = nil; int status = CodesignError; @try { NSArray *arguments = [NSArray arrayWithObjects: @--verify, path, nil]; NSTask *task = [[NSTask alloc] init]; [task setArguments:arguments]; [task setLaunchPath:@/usr/bin/codesign]; [task setStandardOutput:[NSFileHandle fileHandleWithNullDevice]]; [task setStandardError:[NSFileHandle fileHandleWithNullDevice]]; [task launch]; [task waitUntilExit]; status = [task terminationStatus]; switch (status) { case CodesignOkay: self.resultString = NSLocalizedString(@Valid, @Codesign okay.); break; case CodesignFail: self.resultString = NSLocalizedString(@Invalid, @Codesign failed.); break; case CodesignInvalidArgs: self.resultString = NSLocalizedString(@Invalid arguments, @Codesign invalid arguments); break; case CodesignFailedRequirement: self.resultString = NSLocalizedString(@Failed requirement, @Codesign failed requirement.); break; default: self.resultString = NSLocalizedString(@Unrecognised response, @Codesign unrecognised response.); status = CodesignUnrecognised; break; } if (status != CodesignOkay) { NSLog(@codesign failure: %@, self.resultString); } [EMAIL PROTECTED] (NSException *e) { NSLog(@Exception launching codesign: %@, [e reason]); return CodesignError; } return status; } @end ___ 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]
alpha value from NSBitmapImageRep
I want to compute the alpha value of each pixel of an image. What i am doing right now is i create a NSBitmapImageRep from the image and use colorAtX: y: to get the alpha value form the color at that pixel. So i need to do this for each and every pixel in the image. I was just going through the WWDC 2008's 916-Getting started with Instruments session where they worked on a sample image enhancement app. They had a similar case where they had to compute the color at every pixel. The author says the process can be optimized if we first gather the imageRep's data and then access the color values directly from that data So heres how i get the data: unsigned char *data = [mImageRep bitmapData] , *pixel; Now how do i access the pixel information from over here? any idea? I'd be glad if someone can help me optimize 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: alpha value from NSBitmapImageRep
Hi chaitanya, Actually, much better than accessing image data is getting the image drawing machinery to do the work for you. It will get the various image data formats right, and you're providing high level information (do the same thing to the entire image) that may enable optimizations. Accessing image data directly is quite error prone, as it turns out. It's easy to accidentally hardwire assumptions about bitmap format that do not hold when the OS changes. In this case, you want would want to make a CGBitmapContextRef with kCGImageAlphaOnly. This will let you produce a buffer full of your alpha values. Creating and drawing in the context looks something like this (typed in Mail): CGContextRef alphaBitmapCtx = CGBitmapContextCreate(myDestinationBuffer, width, height, 8/*bitsPerComponent*/, bytesPerRow, NULL/*colorSpace*/, kCGImageAlphaOnly); [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:alphaBitmapCtx flipped:NO]]; [image drawInRect:NSMakeRect(0,0,width,height) fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; [NSGraphicsContext restoreGraphicsState]; Following this code, myDestinationBuffer has all the alpha data from the image. -Ken Cocoa Frameworks On Tue, Oct 28, 2008 at 2:59 AM, chaitanya pandit [EMAIL PROTECTED] wrote: I want to compute the alpha value of each pixel of an image. What i am doing right now is i create a NSBitmapImageRep from the image and use colorAtX: y: to get the alpha value form the color at that pixel. So i need to do this for each and every pixel in the image. I was just going through the WWDC 2008's 916-Getting started with Instruments session where they worked on a sample image enhancement app. They had a similar case where they had to compute the color at every pixel. The author says the process can be optimized if we first gather the imageRep's data and then access the color values directly from that data So heres how i get the data: unsigned char *data = [mImageRep bitmapData] , *pixel; Now how do i access the pixel information from over here? any idea? I'd be glad if someone can help me optimize 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/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]
Re: alpha value from NSBitmapImageRep
On 28 Oct 2008, at 8:59 pm, chaitanya pandit wrote: unsigned char *data = [mImageRep bitmapData] , *pixel; Now how do i access the pixel information from over here? any idea? If your bitmap format is ARGB with 8 bits per component, say, then to get the value of A do: unsigned char alpha = *data;// get first alpha data += 4; // increment pointer to next pixel's alpha You have to carefully watch the buffer format though. If the bits are packed you'll have to mask off the relevant parts and shift them down to the right position. The raw pixel values have a value range depending on the number of bits per component and may or may not be premultiplied by the alpha value. Also watch the ends of each scanline - the lines are rowBytes long, not necessarily the width of the image. Basically if you understand how raw pixel buffers are laid out, then you can extract the data you want - you simply get a big chunk of memory laid out accordingly. Note that the format is completely predictable, because you specified it when you created the bitmap in the first place, or, you can ask it for all the various formatting parameters. hth, 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: Can we ask iPhone questions yet?
On Tue, Oct 28, 2008 at 1:27 AM, Torsten Curdt [EMAIL PROTECTED] wrote: IMO that does not really answer the question :) You are legally able to yes, assuming you have accepted the new NDA. However, as I understand it, your post would be off topic, as the correct place to post such questions is the developer forums. http://devforums.apple.com/ -Colin ___ 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: Exceptions vs. pointers to error objects
Perhaps there is already a policy on when each is to be used. If so, please enlighten me. :) There is a policy in Cocoa. I'm pretty sure it's documented, but I didn't find it laid out just now.. Exceptions are for things that just shouldn't happen, or that are essentially unrecoverable. Throw an exception if the programmer using your API made a mistake and passed parameters that it isn't in your contract to handle. People are not expected to be catching exceptions. NSApplication catches them up at the top of the event loop, and will log. NSError is for errors of the sort you'd want to tell the user about. They're supposed to be directly presentable via -[NSApplication presentError:] and friends. If the thing that went wrong is internal and you expect the programmer to handle it, NSError isn't appropriate. (A piece of calling code that has more user-centric information about what went wrong than the one that generated the NSError may and should replace the NSError with one that is more appropriate, though.) For APIs that programmers may expect to fail and handle without getting the user involved, Cocoa usually just returns a BOOL to say nope, didn't work, or returns nil or somesuch. I think there are a few APIs that that give a 'reason' why something happened. -Ken On Tue, Oct 28, 2008 at 12:58 AM, Colin Cornaby [EMAIL PROTECTED] wrote: I'm writing an API to communicate with a web service, and I was just wondering what the thinking is on exceptions vs. functions returning an NSError in some way. Basically I'm wondering what people's opinions are on a function throwing an exception on failure, vs returning an NSError object. Perhaps there is already a policy on when each is to be used. If so, please enlighten me. :) Thanks, Colin ___ 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]
Re: alpha value from NSBitmapImageRep
Thanks ken, This sounds more legal than manually accessing the image data with some hard coded values. I created a CGContextRef as you mentioned, now how can i access the alpha value at a given point in the ref? I am totally new to CG and imaging so pl. bare with me. On 28-Oct-08, at 4:08 PM, Ken Ferry wrote: Hi chaitanya, Actually, much better than accessing image data is getting the image drawing machinery to do the work for you. It will get the various image data formats right, and you're providing high level information (do the same thing to the entire image) that may enable optimizations. Accessing image data directly is quite error prone, as it turns out. It's easy to accidentally hardwire assumptions about bitmap format that do not hold when the OS changes. In this case, you want would want to make a CGBitmapContextRef with kCGImageAlphaOnly. This will let you produce a buffer full of your alpha values. Creating and drawing in the context looks something like this (typed in Mail): CGContextRef alphaBitmapCtx = CGBitmapContextCreate(myDestinationBuffer, width, height, 8/*bitsPerComponent*/, bytesPerRow, NULL/*colorSpace*/, kCGImageAlphaOnly); [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:alphaBitmapCtx flipped:NO]]; [image drawInRect:NSMakeRect(0,0,width,height) fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; [NSGraphicsContext restoreGraphicsState]; Following this code, myDestinationBuffer has all the alpha data from the image. -Ken Cocoa Frameworks On Tue, Oct 28, 2008 at 2:59 AM, chaitanya pandit [EMAIL PROTECTED] wrote: I want to compute the alpha value of each pixel of an image. What i am doing right now is i create a NSBitmapImageRep from the image and use colorAtX: y: to get the alpha value form the color at that pixel. So i need to do this for each and every pixel in the image. I was just going through the WWDC 2008's 916-Getting started with Instruments session where they worked on a sample image enhancement app. They had a similar case where they had to compute the color at every pixel. The author says the process can be optimized if we first gather the imageRep's data and then access the color values directly from that data So heres how i get the data: unsigned char *data = [mImageRep bitmapData] , *pixel; Now how do i access the pixel information from over here? any idea? I'd be glad if someone can help me optimize 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/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]
RE: Can we ask iPhone questions yet?
Like the subject says, can we ask iPhone questions yet? I'm stumped and I need help. Thanks, Cem Karan Thanks to everyone that replied. I put my question up at http://discussions.apple.com/thread.jspa?threadID=1769333stqc=true so if you want to reply to it, I'll keep an eye on it over there. Thanks, Cem Karan ___ 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: Not so long filenames
On 28 Oct 2008, at 01:39, Jeremy Pereira wrote: On 26 Oct 2008, at 09:55, Gerriet M. Denkmann wrote: On 26 Oct 2008, at 00:30, Postmaster wrote: On 14 Oct 2008, at 21:00, Gerriet M. Denkmann wrote: On 14 Oct 2008, at 18:07, Jason Coco wrote: On Oct 14, 2008, at 11:28 , Gerriet M. Denkmann wrote: HFS+ stores files in decomposed UTF-8. Checking the system headers, system headers is kind of vague: which file exactly do you have in mind? it can store files with a maximum file name length of 255 bytes. How do you get 256 bytes of UTF-8 into 255 bytes? Checking the system header hfs_format.h for HFSUniStr255 one sees that it can store file names with a maximum length of 255 u_int16_t. And there is no real problem of putting the 128 shorts of Utf-16 into 255 u_int16_t. It's actually the VFS layer I was thinking of. The OS X VFS uses UTF-8 (otherwise there would be no backward compatibility for calls like open(2) etc). I got the 255 byte limit by looking at struct dirent defined in /usr/include/sys/dirent.h which is the structure used in the readdir syscall. I have just tried getdirentries() which uses the dirent structure described in /usr/include/sys/dirent.h . The result was (for me) quite a surprise. What I did: 1. created a file in Desktop 2. renamed it in Finder to: Ѐ ЀЀ ЀЀ ЀЀЀ. (128 Utf-16 shorts, but 256 Utf-8 bytes). 3. ran getdirentries() and got: file (255) ЀЀ ЀЀ ЀЀ#185D41 4. used open() and read() with this (seemingly garbled) filename - and it just works! But open() and fopen() also work with the real filename. And: renaming a file in Finder with this (garbled) name does not work: Finder claims that this name is already in use. Which is not true: HFS+ has only the real filename stored. No idea who does the translation between real filename and garbled version. Very strange indeed. Kind regards, Gerriet. ___ 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]
Turning off Auto Complete feature for NSTextField
Hi, I am encountering a small problem. I am using a simple NSTextField in my application. This textfield is editable. When user starts entering some text, the auto complete is by default ON, so on pressing escape key a list of suggestions is displayed. I don't want this feature. How can i turn off the auto complete feature for NSTextField. I couldn't find any option in Interface Builder or the documentation of NSTextField. Thanx ___ 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: Not so long filenames
Le 28 oct. 08 à 12:50, Gerriet M. Denkmann a écrit : On 28 Oct 2008, at 01:39, Jeremy Pereira wrote: On 26 Oct 2008, at 09:55, Gerriet M. Denkmann wrote: On 26 Oct 2008, at 00:30, Postmaster wrote: On 14 Oct 2008, at 21:00, Gerriet M. Denkmann wrote: On 14 Oct 2008, at 18:07, Jason Coco wrote: On Oct 14, 2008, at 11:28 , Gerriet M. Denkmann wrote: HFS+ stores files in decomposed UTF-8. Checking the system headers, system headers is kind of vague: which file exactly do you have in mind? it can store files with a maximum file name length of 255 bytes. How do you get 256 bytes of UTF-8 into 255 bytes? Checking the system header hfs_format.h for HFSUniStr255 one sees that it can store file names with a maximum length of 255 u_int16_t. And there is no real problem of putting the 128 shorts of Utf-16 into 255 u_int16_t. It's actually the VFS layer I was thinking of. The OS X VFS uses UTF-8 (otherwise there would be no backward compatibility for calls like open(2) etc). I got the 255 byte limit by looking at struct dirent defined in /usr/include/sys/dirent.h which is the structure used in the readdir syscall. I have just tried getdirentries() which uses the dirent structure described in /usr/include/sys/dirent.h . The result was (for me) quite a surprise. What I did: 1. created a file in Desktop 2. renamed it in Finder to: . (128 Utf-16 shorts, but 256 Utf-8 bytes). 3. ran getdirentries() and got: file (255 )ЀЀ #185D41 4. used open() and read() with this (seemingly garbled) filename - and it just works! But open() and fopen() also work with the real filename. And: renaming a file in Finder with this (garbled) name does not work: Finder claims that this name is already in use. Which is not true: HFS+ has only the real filename stored. No idea who does the translation between real filename and garbled version. Very strange indeed. Kind regards, Gerriet. This kind of transformation was already done when using long file name on OS 9 (where long mean more than 32 characters). It was a mechanism used to workaround the limit imposed by the OS that was more strict that the HFS+ limit. Look like this feature is always here. ___ 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]
Subview display problem
I'm having no luck getting a subview to display. In the awakeFromNib of the controller I have this: helpView = [[MyView alloc] init]; [helpView setFrameOrigin:RectCentre( [theView frame] )]; [helpView setFrameSize:NSZeroSize]; [theView addSubview:helpView]; (RectCentre is a function that finds the centre of a rectangle.) In the help button action I have this: [[helpView animator] setFrameSize:[theView frame].size]; [helpView setNeedsDisplay:YES]; (I'm sure the button connection is set in IB.) Finally, in the drawRect: method of MyView I have this: [[NSColor colorWithCalibratedRed:1.0 green:1.0 blue:0.8 alpha:0.9] set]; [NSBezierPath fillRect:[self bounds]]; [NSBezierPath strokeRect:[self bounds]]; When I press my Help button, all I see is a small patch of colour appearing briefly in the main view. theView does have animation layers. Would this make a difference? 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: Finding out that a volume is going away before it does
On 28 Oct 2008, at 05:26, Chris Suter wrote: On Tue, Oct 28, 2008 at 1:50 AM, Francis Devereux [EMAIL PROTECTED] wrote: My code works on 10.4 8A428 PPC (after I changed mainRunLoop to currentRunLoop), but this probably isn't much help to you because DiskArbitration.framework is private on 10.3. You can use it fine on 10.3. As far as I know, there was no change to the interface between 10.3 and 10.4 (or none that will bother you). You just need to make sure you link to the framework in /System/Library/PrivateFrameworks rather than /System/Library/Frameworks. NSWorkspace will ultimately be using DiskArbitration; there's no other way for it to work. You're right, I updated my test project to use install_name_tool to change the reference to /System/Library/Frameworks/ DiskArbitration.framework to /System/Library/PrivateFrameworks/ DiskArbitration.framework and it works on 10.3.9. Updated version at http://www.devrx.org/software/osx/DiskArbitrationTest.zip in case anyone wants to have a look. Francis ___ 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: Subview display problem
On Tue, Oct 28, 2008 at 9:23 AM, DKJ [EMAIL PROTECTED] wrote: I'm having no luck getting a subview to display. In the awakeFromNib of the controller I have this: helpView = [[MyView alloc] init]; NSView's designated initializer is -initWithFrame: ... what happens if you use that instead? -- 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]
filtering a tableView from a pulldown
I have a pulldown button, and a tableview. They both seem to be displaying the correct data, but I'd like to filter the content of the tableview based on the selection in the pulldown button. I've tried all manner of binding combinations but it doesn't seem to work. I'm a real newbie so I apologise for being a bit dim. I did try google, and looking at the settings in the default search box that alt-dragging the core data entity created, but I just can't figure it out. My pulldown contains order references, and the table contains the items in all the orders, so when i select an order number at the top, I want to only display the items in that order? Many Thanks Amy ___ 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 and Printing (Advanced Q)
On 27 okt 2008, at 18.42, David Duncan wrote: On Oct 26, 2008, at 3:06 PM, Tommy Nordgren wrote: A specific printer can be used ONLY by a special app. Any printer that can be seen by Print Center can be used by all applications by default. If you are a printer vendor, then you can do additional things, but you will need to write to CUPS (the subsystem that eventually handles all printing on Mac OS X). Changing printer settings for an App affects that app only. Some printer settings are system wide, some are tied to print sessions. What settings do you need to change? -- David Duncan Apple DTS Animation and Printing I want to reserve a printer for economy software, (i fact a submodule of it) since the invoice function will print on particularly expensive invoice paper. -- The three things an undertaker should never say to a client: -Nice doing business with you. -Welcome back. -Have a nice day. (The King of ID) -- Tommy Nordgren [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: filtering a tableView from a pulldown
I have a pulldown button, and a tableview. They both seem to be displaying the correct data, but I'd like to filter the content of the tableview based on the selection in the pulldown button. I've tried all manner of binding combinations but it doesn't seem to work. This is difficult to answer because you left out all the critical details (controller names, key paths, etc.). All that is left is to point you to the documentation: Cocoa Bindings Programming Topics - Creating a Master-Detail Interface http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Tasks/masterdetail.html -- 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: Turning off Auto Complete feature for NSTextField
On Oct 28, 2008, at 8:42 AM, [EMAIL PROTECTED] wrote: Turning off Auto Complete feature for NSTextField To: cocoa-dev@lists.apple.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii Hi, I am encountering a small problem. I am using a simple NSTextField in my application. This textfield is editable. When user starts entering some text, the auto complete is by default ON, so on pressing escape key a list of suggestions is displayed. I don't want this feature. How can i turn off the auto complete feature for NSTextField. I couldn't find any option in Interface Builder or the documentation of NSTextField. Thanx Are you sure you're using NSTextField and not NSTextView? The behavior is part of NSTextView and the two are a bit different. You'll need to override some methods, so you'll want to subclass. You might be surprised how often the completion is available in apps. NSTextField does not appear to have the same methods. Oddly, both do have the Delegate method control:textView:completions:forPartialWordRange:indexOfSelectedItem: This is pretty simple to take over. You just hijack it by giving it nothing! An empty array. Of course this will still give you the system alert sound if esc is pressed to autocomplete. The normal set of completions will come from Dictionary.app so they will be locale-dependent. ___ 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: Can we ask iPhone questions yet?
On 28 Oct 2008, at 10:51, Colin Barrett wrote: On Tue, Oct 28, 2008 at 1:27 AM, Torsten Curdt [EMAIL PROTECTED] wrote: IMO that does not really answer the question :) You are legally able to yes, assuming you have accepted the new NDA. However, as I understand it, your post would be off topic, Really? This list is called cocoa-dev, not cocoa-but-only-non-touch- cocoa-dev. Seriously, the similarities between Cocoa and Cocoa Touch are much greater than the differences. While there are many components which behave differently in the UIxxx form to the equivalent NSxxx form, the underlying structure is essentially the same. Most discussions regarding the Foundation components are going to be relevant to both platforms, as are discussions of CoreAnimation. Many of the UIView subclasses look different on screen but there is substantial overlap of both their functionality and their methods and even if Cocoa Touch were specifically excluded from this list (which as far as I can tell it currently is not) discussion of the differences would surely be of relevance to this list. As such I don't see any reason whatsoever why people should not post questions about about Cocoa Touch on this list. That said, perhaps the moderators who were so quick to pounce on all who previously raised the topic could now just as swiftly give us some clear guidance. Nicko ___ 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: Subview display problem
On 28 Oct, 2008, at 06:54, I. Savant wrote: On Tue, Oct 28, 2008 at 9:23 AM, DKJ [EMAIL PROTECTED] wrote: I'm having no luck getting a subview to display. In the awakeFromNib of the controller I have this: helpView = [[MyView alloc] init]; NSView's designated initializer is -initWithFrame: ... what happens if you use that instead? Good point. I changed the line to this: helpView = [[MyView alloc] initWithFrame:[theView frame]]; But the result was the same: a brief flash of colour. I also tried passing NSZeroRect instead of [theView frame], and it made no difference. ___ 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: Subview display problem
On Tue, Oct 28, 2008 at 10:42 AM, DKJ [EMAIL PROTECTED] wrote: Good point. I changed the line to this: helpView = [[MyView alloc] initWithFrame:[theView frame]]; But the result was the same: a brief flash of colour. I also tried passing NSZeroRect instead of [theView frame], and it made no difference. Have you tried any of the standard debugging approaches? Perhaps the tried-and-true kludge of logging the view's frame each time it's drawn (ie, it's -frame from within -drawRect:)? -- 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: Subview display problem
On 28 Oct, 2008, at 07:49, I. Savant wrote: logging the view's frame each time it's drawn This produces a strange result. The width of the subview's frame increases by stages to that of the superview, but its height stays constant at 14.0. All with nothing happening on the screen. ___ 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: Can we ask iPhone questions yet?
On 28 Oct 2008, at 14:52, I. Savant wrote: On Tue, Oct 28, 2008 at 10:42 AM, Nicko van Someren [EMAIL PROTECTED] wrote: As such I don't see any reason whatsoever why people should not post questions about about Cocoa Touch on this list. That said, perhaps the moderators who were so quick to pounce on all who previously raised the topic could now just as swiftly give us some clear guidance. The moderator *has* given us clear guidance, many many times: 1 - Follow the new agreement. 2 - Use the provided forum, not cocoa-dev. 3 - Contact developer relations to lodge complaints and give suggestions. That's pretty clear to me. We may not all like it, but there it is. Complaining here is only adding more unresolved noise, as has also been made clear many, many times. I saw Scott's message about taking complaints to dev relations, and his comment about things being 'off topic' but my reading of those messages (linked below) is that they clearly referred to the people calling this list a joke because it was moderated by Apple; they say nothing about the relevance of this list to Cocoa Touch. In fact there are only 3 messages from the moderators since the new NDA terms were released and none of them addressed this issue directly. Nicko http://www.cocoabuilder.com/archive/message/cocoa/2008/10/25/220963 http://www.cocoabuilder.com/archive/message/cocoa/2008/10/25/220964 ___ 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: Subview display problem
On Tue, Oct 28, 2008 at 11:01 AM, DKJ [EMAIL PROTECTED] wrote: This produces a strange result. The width of the subview's frame increases by stages to that of the superview, but its height stays constant at 14.0. All with nothing happening on the screen. Maybe I'm missing something others can point out, but I have another suggestion: Do away with the animation logic for now. See if it behaves as expected by setting the frames directly (without calls to the view's -animator). -- 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: Can we ask iPhone questions yet?
On Tue, Oct 28, 2008 at 11:13 AM, Nicko van Someren [EMAIL PROTECTED] wrote: I saw Scott's message about taking complaints to dev relations, and his comment about things being 'off topic' but my reading of those messages (linked below) is that they clearly referred to the people calling this list a joke because it was moderated by Apple; they say nothing about the relevance of this list to Cocoa Touch. In fact there are only 3 messages from the moderators since the new NDA terms were released and none of them addressed this issue directly. A fair point. My last opinion (and they *are* opinions, nothing more - I am not a moderator and I'm not trying to be one): I think the intention was made pretty clear. My interpretation is that anything iPhone-specific goes to the afore-mentioned forum. Anything that is Cocoa-in-general is fine here, as usual. Cocoa Touch is Cocoa with some iPhone-specific additions. Again, it's those iPhone-specific things that Apple wants to keep on the inside. -- 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: Subview display problem
On 28 Oct, 2008, at 08:14, I. Savant wrote: Do away with the animation logic for now. See if it behaves as expected by setting the frames directly (without calls to the view's -animator). The subview appears for an instant, with its origin is in the centre of the superview, filling the upper-right quadrant. It's also showing behind the CALayer objects, which I don't want either. I thought of using a CATextLayer instead, and setting the zPosition accordingly. But then I don't have anything like the text formatting capabilities of an NSTextView. (MyView is a subclass of NSTextView.) I should have made clear in my first post that the animation layers of theView are CALayer objects. Maybe I'll try hiding those. ___ 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: Can we ask iPhone questions yet?
On 28 Oct 2008, at 15:18, I. Savant wrote: On Tue, Oct 28, 2008 at 11:13 AM, Nicko van Someren [EMAIL PROTECTED] wrote: I saw Scott's message about taking complaints to dev relations, and his comment about things being 'off topic' but my reading of those messages (linked below) is that they clearly referred to the people calling this list a joke because it was moderated by Apple; they say nothing about the relevance of this list to Cocoa Touch. In fact there are only 3 messages from the moderators since the new NDA terms were released and none of them addressed this issue directly. A fair point. My last opinion (and they *are* opinions, nothing more - I am not a moderator and I'm not trying to be one): I think the intention was made pretty clear. My interpretation is that anything iPhone-specific goes to the afore-mentioned forum. Anything that is Cocoa-in-general is fine here, as usual. Cocoa Touch is Cocoa with some iPhone-specific additions. Again, it's those iPhone-specific things that Apple wants to keep on the inside. Without wanting to stray into meta-discussions about discussions, many people have (with varying degrees of rudeness) already pointed out that (a) forums and mailing lists are very different and serve different audiences and (b) this mailing list already is on the inside since it is a moderated list. I think most readers would like to see this list as an all-inclusive Cocoa list, Touch or no Touch, and I don't see any reason why it should not be inclusive according to posted the rules, but I still think it would be useful to have a clear indication from our shadowy overlords. Cheers, Nicko ___ 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]
Message Forwarding Overhead / Performance
Although the documentation on message forwarding [1] explains that alot of stuff needs to happen, it does not say Warning: Don't do this in performance-critical applications. So I made a test tool which forwarded a simple message with one integer argument to a class which would add it to its 'sum', an instance variable. Sending this message 10,000 times and comparing the difference in elapsed time with a similar task that sends a similar message directly, I found that the average overhead for forwarding one message on my Intel Core 2 Duo Mac Mini was about 20 microseconds. That would be unacceptably slow for an iterated operation in a my application, and I decided to not use message forwarding in this particular case. Has anyone ever seen better performance for message forwarding? Jerry Krinock [1] http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_13_section_5.html ___ 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: Subview display problem
On Tue, Oct 28, 2008 at 11:27 AM, DKJ [EMAIL PROTECTED] wrote: I should have made clear in my first post that the animation layers of theView are CALayer objects. Maybe I'll try hiding those. Yes, that changes things a bit. :-) I'm not convinced, though, that you have the view geometry drawing basics quite right. I'd turn off all layers and make sure it's working normally without them. At least then you know in which of the two significantly-different areas the problem is hiding (view geometry/drawing or layers/animation). If it's the latter, I'm afraid I have to defer to others as I've still only tested the water temperature with a single toe, so to speak ... I haven't taken the plunge into this area. -- 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: Code signing validation
I just pass the -o kill flags to codesign. That way if the app has been tampered with it won't launch. Make sure you are using Xcode 3.1 or later so the codesigning is done after the stripping. 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]
Finding files before app loads
Hi there, I need to locate certain files and set the state of some objects in my nib accordingly before the app is visible to the user. I'm using fileExistsAtPath to look for the files when the awakeFromNib method is invoked. The files are definitely present, but fileExistsAtPath always returns false on each search - please could someone advise where I might be going wrong? Kind Regards Dave Promethean Limited is a company registered in England and Wales with company number 1308938 and VAT number GB 572 2599 18 __ Promethean Ltd and or associated and or subsidiary companies : The views expressed in this communication may not necessarily be the views held by Promethean Ltd and or associated and or subsidiary companies. This e-mail is for the exclusive use of the addressee(s). Unauthorised disclosure, copying or distribution is prohibited. This e-mail message has been swept for the presence of computer viruses. Promethean Ltd and or associated and or subsidiary companies accepts no liability for any loss resulting from this email transmission. Promethean, Promethean House, Lower Philips Road, Blackburn, Lancashire, BB1 5TH, UK. Please update your records accordingly. Thank you! * This email has been checked by the e-Sweeper Service * ___ 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: Finding files before app loads
Sorry, I've found a problem creating an NSFileManager instance, but this is resolved and the file checks are now working :o) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] om] On Behalf Of Glover,David Sent: 28 October 2008 15:34 To: Cocoa Development Subject: Finding files before app loads Hi there, I need to locate certain files and set the state of some objects in my nib accordingly before the app is visible to the user. I'm using fileExistsAtPath to look for the files when the awakeFromNib method is invoked. The files are definitely present, but fileExistsAtPath always returns false on each search - please could someone advise where I might be going wrong? Kind Regards Dave Promethean Limited is a company registered in England and Wales with company number 1308938 and VAT number GB 572 2599 18 __ Promethean Ltd and or associated and or subsidiary companies : The views expressed in this communication may not necessarily be the views held by Promethean Ltd and or associated and or subsidiary companies. This e-mail is for the exclusive use of the addressee(s). Unauthorised disclosure, copying or distribution is prohibited. This e-mail message has been swept for the presence of computer viruses. Promethean Ltd and or associated and or subsidiary companies accepts no liability for any loss resulting from this email transmission. Promethean, Promethean House, Lower Philips Road, Blackburn, Lancashire, BB1 5TH, UK. Please update your records accordingly. Thank you! * This email has been checked by the e-Sweeper Service * ___ 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/david.glover%40promethe anworld.com This email sent to [EMAIL PROTECTED] * This email has been checked by the e-Sweeper Service * ___ 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: Can we ask iPhone questions yet?
On Tue, Oct 28, 2008 at 11:30 AM, Nicko van Someren [EMAIL PROTECTED] wrote: ... I still think it would be useful to have a clear indication from our shadowy overlords. Agreed, though keep in mind that *our* shadowy overlords have their *own*, even *more* shadowy overlords called Apple Legal (or Denizens of Hell, whichever you prefer). As our favorite overlord (Scott) has alluded to before, he's only given information to pass along to the list. This is why it's not only useless to complain to the list (or fight the moderator), but actively detrimental because it amounts to a bunch of noise with no payoff. I think that is probably the biggest source of rudeness you've detected in most of the responses here ... it's simple frustration. The 'complaining-here-doesn't-help-so-knock-it-off-already' sentiment born of one-too-many threads about the same helpless subject. In any case, I'm now doing no better than adding noise, so that's the last I'll respond on-list. I'm happy to continue the debate off-list if you'd like. That invitation goes for anybody, but keep in mind that there is no animosity from my side, so the invitation is conditional upon civility. :-) -- 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: Finding files before app loads
On Tue, Oct 28, 2008 at 11:44 AM, Glover,David [EMAIL PROTECTED] wrote: Sorry, I've found a problem creating an NSFileManager instance, but this is resolved and the file checks are now working :o) Just as an aside, are you using +[NSFileManager defaultManager]? You shouldn't have to create an instance yourself. -- 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: Subview display problem
On 28 Oct, 2008, at 08:31, I. Savant wrote: I'd turn off all layers and make sure it's working normally without them. Alas, after having the Help button method hide theView's CALayer, there's still no sign of my NSTextView subclass. Maybe I should just make my help info into a PDF file, and display that on a CATextLayer. (I think PDF is one of the formats that can be used.) I do recall someone saying a few days ago that CALayers and NSViews shouldn't be mixed: one or the other should be used exclusively. Thanks very much for taking the time to look at 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: Turning off Auto Complete feature for NSTextField
On Oct 28, 2008, at 5:59 AM, Adil Saleem wrote: I am encountering a small problem. I am using a simple NSTextField in my application. This textfield is editable. When user starts entering some text, the auto complete is by default ON, so on pressing escape key a list of suggestions is displayed. I don't want this feature. How can i turn off the auto complete feature for NSTextField. I couldn't find any option in Interface Builder or the documentation of NSTextField. This is not autocompletion; this is completion upon user request, and we provide many APIs to control it. The simplest would be to use the NSControl delegate method - control:textView:completions:forPartialWordRange:indexOfSelectedItem: if you are using an NSTextField, or the NSTextView delegate method - textView:completions:forPartialWordRange:indexOfSelectedItem: if you are using an NSTextView. The proposed array of completions is passed in, and the delegate can modify this list and return it, or return nil to suppress completion. The index of the initially selected completion can also optionally be set. Douglas Davidson ___ 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: filtering a tableView from a pulldown
I can't work out what the controllers and key paths should be. The pulldown is bound as follows: content: arrangedObjects[PurchaseOrder Array Controller(NSArray Controller)] content values: Purchase ORder Array Controller arrangedObjects.orderReference The Table view has 6 columns, one of which is the Purchase Order number (as displayed in the pulldown) that column is bound as: content: arrangedObjects[PurchaseOrder Array Controller 13(NSArray Controller)] content values: arrangedObjects.orderReference does that help at all? I created the master/details interface by alt-dragging from the data model. In the model there are purchaseORderItems that have the following attributes/relationships: Attributes qty vendorsku Relationships product purchaseOrder shipment The tableview shows all the purchaseOrderItems, and I want to filter it by the order reference in the pulldown above the tableview. Many Thanks Amy On 28 Oct 2008, at 14:36, I. Savant wrote: I have a pulldown button, and a tableview. They both seem to be displaying the correct data, but I'd like to filter the content of the tableview based on the selection in the pulldown button. I've tried all manner of binding combinations but it doesn't seem to work. This is difficult to answer because you left out all the critical details (controller names, key paths, etc.). All that is left is to point you to the documentation: Cocoa Bindings Programming Topics - Creating a Master-Detail Interface http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaBindings/Tasks/masterdetail.html -- 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: Security - Write to protected directory
On Mon, Oct 27, 2008 at 5:43 PM, Michael Nickerson [EMAIL PROTECTED] wrote: On Oct 27, 2008, at 12:52 AM, Michael Ash wrote: On Mon, Oct 27, 2008 at 12:07 AM, Michael Nickerson [EMAIL PROTECTED] wrote: You can always set things up to ignore child processes: signal( SIGCHLD, SIG_IGN ); It's bad to rely on this sort of global state, though. What if some other bit of code relies on having a handler for this signal? (Of course it is relying on this sort of global state too in that case, but it takes two to screw things up) Libraries and frameworks shouldn't be setting or relying on signals. It is, as you say, a global state. So really, if you haven't specifically set it in your app, you should be fine and if you have you should already know about it. True enough, but it limits the usefulness because you can't safely use it in a framework or plugin. That way, if the children aren't specifically reaped they don't stay around as zombies. Do note that the wait functions *do* still work if you set that up, so this isn't going to mess anything up elsewhere that is reaping a child. How does that work, exactly? The whole purpose of the zombie is to store the end state of the dead process so that wait() can pick it up. If wait() still works, then what stores that end state if not a zombie process? More to the point, if wait() still works, that implies that *something*, *somewhere* is storing that end state. And if you never call wait() but you continue to create children, that storage will grow without limit, and this is bad. So it seems to me that either no, wait() doesn't really work in this scenario, or in fact you still get zombies or something like them. Am I missing something? Sorry, my fault for replying late at night. The wait functions will still block for the duration of the child process, but you do lose the state information about it. So if you're relying on state information I suppose you would consider that broken, but if all you're using wait for is to wait until the child process has terminated, then it still works as intended. Thanks for clarifying. Unfortunately this would then have the potential to break other code, in frameworks or plugins, which relies on wait() to return state information, so it seems like a dangerous thing to use. 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: Documentation of NSArchiver streamtyped format
On Mon, Oct 27, 2008 at 2:25 PM, Gregor Jasny [EMAIL PROTECTED] wrote: Hi, I'm looking for documentation of the binary format that is written by NSArchiver. The file utility tells me that it's called NeXT/Apple typedstream data, little endian, version 4, system 1000. I'm not aware that Apple has documented either NSArchiver or NSKeyedArchiver's format anywhere. GNUStep can read at least NSKeyedArchiver, and possibly NSArchiver, as it is able to decode some Apple nibs. I don't know if they've documented the formats anywhere or if they've just written code for it, but in either case that's where I'd start looking. As a last note, I'm not sure why you want this information, but I'd discourage you from writing something that relies on decoding Apple's formats if at all possible. Since Apple hasn't documented them any third-party reverse engineering is going to be error-prone. If you can, use a different interchange format that you know can be decoded reliably. 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: Finding files before app loads
I am now using [NSFileManager defaultManager], and all is working well (noob!) :o) -Original Message- From: I. Savant [mailto:[EMAIL PROTECTED] Sent: 28 October 2008 15:49 To: Glover,David Cc: Cocoa Development Subject: Re: Finding files before app loads On Tue, Oct 28, 2008 at 11:44 AM, Glover,David [EMAIL PROTECTED] wrote: Sorry, I've found a problem creating an NSFileManager instance, but this is resolved and the file checks are now working :o) Just as an aside, are you using +[NSFileManager defaultManager]? You shouldn't have to create an instance yourself. -- I.S. Promethean Limited is a company registered in England and Wales with company number 1308938 and VAT number GB 572 2599 18 __ Promethean Ltd and or associated and or subsidiary companies : The views expressed in this communication may not necessarily be the views held by Promethean Ltd and or associated and or subsidiary companies. This e-mail is for the exclusive use of the addressee(s). Unauthorised disclosure, copying or distribution is prohibited. This e-mail message has been swept for the presence of computer viruses. Promethean Ltd and or associated and or subsidiary companies accepts no liability for any loss resulting from this email transmission. Promethean, Promethean House, Lower Philips Road, Blackburn, Lancashire, BB1 5TH, UK. Please update your records accordingly. Thank you! * This email has been checked by the e-Sweeper Service * ___ 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: Message Forwarding Overhead / Performance
On Oct 28, 2008, at 8:30 AM, Jerry Krinock wrote: Although the documentation on message forwarding [1] explains that alot of stuff needs to happen, it does not say Warning: Don't do this in performance-critical applications. So I made a test tool which forwarded a simple message with one integer argument to a class which would add it to its 'sum', an instance variable. Sending this message 10,000 times and comparing the difference in elapsed time with a similar task that sends a similar message directly, I found that the average overhead for forwarding one message on my Intel Core 2 Duo Mac Mini was about 20 microseconds. That would be unacceptably slow for an iterated operation in a my application, and I decided to not use message forwarding in this particular case. That would not surprise me. An absolute microseconds overhead isn't a terribly useful measure without knowing the total # of microseconds. In general, measuring as a factor of speed -- 1.2x 20x 200x is more widely applicable (tends to be more consistent across different CPUs, for example). It is highly atypical to employ a design pattern that involves message forwarding in the midst of a tight loop. While your test case does test the absolute overhead, it doesn't test what is typically found in the real world. How many times does your iterated operation actually iterate? Human perception generally has a response granularity somewhere around about 120-160 msecs. Your users being above average, let's call it 100msecs. Slight apples and oranges here; response time is literally time to respond and we are really considering perception of how long something took. Same ballpark and we are going on the highly optimistic side. Given 20 microseconds overhead, your loop would have to iterate 5000 times to incur a delay that the user might perceive. And that, of course, assumes that 20 microseconds of overhead even matters in your loop. If your actual operation is, say, 50 microseconds then -- sure -- that 33% overhead will add up. At 500 microseconds, you are looking 4% overhead for that one operation and, quite likely, a fraction of percentage of total CPU time. So... sure... message forwarding is slow. But does it matter in your application? 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: Subview display problem
On 28 Oct, 2008, at 08:55, DKJ wrote: Maybe I should just make my help info into a PDF file, and display that on a CATextLayer. Oops, it's the contents property of a CALayer I was thinking of here. ___ 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: filtering a tableView from a pulldown
The pulldown is bound as follows: content: arrangedObjects[PurchaseOrder Array Controller(NSArray Controller)] content values: Purchase ORder Array Controller arrangedObjects.orderReference These bindings seem fine. How about selection? One of the popup's selection bindings should be bound to the PurchaseOrder Array Controller's selection. The Table view has 6 columns, one of which is the Purchase Order number (as displayed in the pulldown) This seems wrong. If your table is intended to display the line items belonging to the order, why have the order number on each line item? In any case, you need a *separate* controller to reflect the line items of the selected order. Create an array controller and set it up so that it holds your line item objects. We'll call it your Line Item Array Controller. Its contents should be bound to PurchaseOrder Array Controller's selection.lineItems (or whatever the key path is to your order's line items). Your table view's columns should each be bound to the Line Item Array Controller's arrangedObjects.property (where property refers to individual properties such as item number, description, quantity, etc.). This way, the PurchaseOrder Array Controller lists and maintains selection of purchase orders, where the Line Item Array Controller lists the line items for the selected purchase order. Spend as much time as you can manage reading over the documentation I sent you previously. If there are things you don't understand, post your questions back to the list for clarification. -- 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: Finding files before app loads
On Tue, Oct 28, 2008 at 12:09 PM, Glover,David [EMAIL PROTECTED] wrote: I am now using [NSFileManager defaultManager], and all is working well (noob!) :o) There are a lot of objects like this that follow the singleton design pattern. Always consult the documentation when using an unfamiliar class. The class methods section of any given class's API reference will make it obvious if it's intended to be treated as a singleton. -- 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: Code signing validation
I am aware of the -o kill flag but I am not sure that killing my code stone dead is what I require in this case. Any resource change, even a removed localisation would then be fatal. For me a string representation of the code signing is more of a sanity check. I just pass the -o kill flags to codesign. That way if the app has been tampered with it won't launch. Make sure you are using Xcode 3.1 or later so the codesigning is done after the stripping. Dave Jonathan Mitchell Central Conscious Unit http://www.mugginsoft.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: Message Forwarding Overhead / Performance
On Tue, Oct 28, 2008 at 11:30 AM, Jerry Krinock [EMAIL PROTECTED] wrote: Although the documentation on message forwarding [1] explains that alot of stuff needs to happen, it does not say Warning: Don't do this in performance-critical applications. Such a warning would be foolish, since that isn't true in the general case. There are plenty of operations which take *vastly* longer than message forwarding which don't come with that warning either. So I made a test tool which forwarded a simple message with one integer argument to a class which would add it to its 'sum', an instance variable. Sending this message 10,000 times and comparing the difference in elapsed time with a similar task that sends a similar message directly, I found that the average overhead for forwarding one message on my Intel Core 2 Duo Mac Mini was about 20 microseconds. That would be unacceptably slow for an iterated operation in a my application, and I decided to not use message forwarding in this particular case. Has anyone ever seen better performance for message forwarding? If 20us is too long for you (is it really? do you need to do this more than 50,000 times per second?) and you can require 10.5 and you just need strict forwarding of the identical message to another object (as opposed to intercepting the message and doing more clever processing), then the -forwardingTargetForSelector: method is likely to give you considerably better performance. 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: Turning off Auto Complete feature for NSTextField
Thank you, implementing the delegate method and returning nothing from it worked. By the way, this is pretty basic stuff. I think there should have been a line or two about it in the NSTextField documentation. Thank you. --- On Tue, 10/28/08, John Joyce [EMAIL PROTECTED] wrote: From: John Joyce [EMAIL PROTECTED] Subject: Re: Turning off Auto Complete feature for NSTextField To: cocoa-dev@lists.apple.com Date: Tuesday, October 28, 2008, 7:40 AM On Oct 28, 2008, at 8:42 AM, [EMAIL PROTECTED] wrote: Turning off Auto Complete feature for NSTextField To: cocoa-dev@lists.apple.com Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii Hi, I am encountering a small problem. I am using a simple NSTextField in my application. This textfield is editable. When user starts entering some text, the auto complete is by default ON, so on pressing escape key a list of suggestions is displayed. I don't want this feature. How can i turn off the auto complete feature for NSTextField. I couldn't find any option in Interface Builder or the documentation of NSTextField. Thanx Are you sure you're using NSTextField and not NSTextView? The behavior is part of NSTextView and the two are a bit different. You'll need to override some methods, so you'll want to subclass. You might be surprised how often the completion is available in apps. NSTextField does not appear to have the same methods. Oddly, both do have the Delegate method control:textView:completions:forPartialWordRange:indexOfSelectedItem: This is pretty simple to take over. You just hijack it by giving it nothing! An empty array. Of course this will still give you the system alert sound if esc is pressed to autocomplete. The normal set of completions will come from Dictionary.app so they will be locale-dependent. ___ 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/adilsaleem01%40yahoo.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: Turning off Auto Complete feature for NSTextField
On Oct 28, 2008, at 10:37 AM, Adil Saleem wrote: Thank you, implementing the delegate method and returning nothing from it worked. By the way, this is pretty basic stuff. I think there should have been a line or two about it in the NSTextField documentation. Feel free to file a bug against the documentation if you feel it is lacking. However, you should be aware in general that you always need to look at the documentation for an object's superclasses as well as for the class itself--this particular delegate method is documented with NSControl--and that you should look at the headers as well as the reference documentation. Douglas Davidson ___ 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: Can we ask iPhone questions yet? - YES
Hello! I posted a number questions to this discussion list. They were all questions about programming in the Cocoa environment. Sometimes my questions have been ignored / not replied to, however this is mostly because of my own poor writing skills rather than anything most siniister. There have been only a couple of occasions where my email was widtheld from the mailinglist - and in those cases it was because I had mistakenly sent my message from the wrong email account. I would say that in the absence of any input from the moderator, its best to look at the TC, which is Apple's official position on the matter. we like to keep things simple is stated pretty prominently in the TC, as short and straightforward as it is. http://lists.apple.com/tc.html The penalty for posting a message which contravenes the TC (at most) is that your message will be widtheld / deleted. There is a caveat in the TC which says that the list moderator has the final say. However in the absence / failure of the person who is the list moderator it simply falls down to you (the poster). Mailing lists are (by the majority part) supposed to be self - moderating and its a feature of list etiquette to take onboard the general consensus. If the moderator at a later time (after your post) decides to widthdraw your message because it contravenes the policy - that is part of their function. You simply need to be aware that when you post a message to this list - it may be widthdrawn. Only because cocoa-dev mailing list has grown to be such a large mailinglist - the Moderators (Scot included) created special list guidelines. There is no web page stating the guidelines, however they simply state - comply with the Apple iphone NDA. If you follow the NDA and respect the conditions of the contract on those intellectual property which you refer to in your message then your message cannot be held against you in a legal action. So what are you all still complaining about ? You should all be celebrating your american so called free speech by asking many hundreds of whimsical questions about iphone development. Surely you must be allowed exercise your own statutes / legal rights [or those of the country in which the list is served] ? And by the way it should be irrelevant whether Apple chooses to regard you as an iPhone developer or active iPhone developer. As long as you are an individual that has agreed to the terms of the Apple contractual agreement, and Apple has chosen to provide those intellectual property materials **to you**. Then you are free to discuss those materials (to which you must discuss only the version of those materials which was marked as released by Apple). This last point is important to understand if you who work for a company which is in partnership with Apple. You should also understand that the Apple mailing-list moderator is not a member of the Apple Legal department, and taking a legal action against you is unlikely to fall into their remit. Their function is simply to exercise due judgement and remove those messages from users which contravene the mailing list TC. Here it is again http://lists.apple.com/tc.html ___ 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: Code signing validation
even a removed localisation would then be fatal Just a clarification: removing a localization does not affect the signature (http://atomic-bird.com/blog/2007/11/leopard-code-signing-questions-and-answers ). Regards, Conor ___ 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: Can we ask iPhone questions yet?
I've asked for clarification. In the meantime, this type of feedback should be sent to cocoa-dev- admins rather than to the list at large On 28-Oct-08, at 10:42 AM, Nicko van Someren wrote: On 28 Oct 2008, at 10:51, Colin Barrett wrote: On Tue, Oct 28, 2008 at 1:27 AM, Torsten Curdt [EMAIL PROTECTED] wrote: IMO that does not really answer the question :) You are legally able to yes, assuming you have accepted the new NDA. However, as I understand it, your post would be off topic, Really? This list is called cocoa-dev, not cocoa-but-only-non-touch- cocoa-dev. Seriously, the similarities between Cocoa and Cocoa Touch are much greater than the differences. While there are many components which behave differently in the UIxxx form to the equivalent NSxxx form, the underlying structure is essentially the same. Most discussions regarding the Foundation components are going to be relevant to both platforms, as are discussions of CoreAnimation. Many of the UIView subclasses look different on screen but there is substantial overlap of both their functionality and their methods and even if Cocoa Touch were specifically excluded from this list (which as far as I can tell it currently is not) discussion of the differences would surely be of relevance to this list. As such I don't see any reason whatsoever why people should not post questions about about Cocoa Touch on this list. That said, perhaps the moderators who were so quick to pounce on all who previously raised the topic could now just as swiftly give us some clear guidance. ___ 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]
ASL Unicode in Xcode's Console
I've been experimenting with replacing my app's logging with Apple System Logger. When it comes to multi-byte characters, every thing looks OK in Console.app. However, Xcode's console shows things incorrectly. It probably won't come up often, but I'm wondering if it's fixable. For example, this bit of code: NSLog(@あ); aslclient client = asl_open(NULL, NULL, ASL_OPT_STDERR); // add STDERR's fd to the connection's set of fds so things show up in Xcode's console asl_log(client, NULL, ASL_LEVEL_ERR, あ); asl_close(client); Results in this output in Xcode: 2008-10-28 13:49:19.767 ASL[3484:10b] あ Tue Oct 28 13:49:19 iMac.local ASL[3484] Error: \M-c\M^A\M^B The call to NSLog displays correctly, but asl_log doesn't. (In case it doesn't survive email, the character in quotes is Hiragana Letter A, from Leopard's Character Palette East Asian Scripts Hiragana first character.) Karl Moskowski [EMAIL PROTECTED] Voodoo Ergonomics Inc. http://voodooergonomics.com/ 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]
[moderator] Re: Can we ask iPhone questions yet? - YES
Please, take this discussion off-list. Either to cocoa-dev-admins, or to private email. Discussing this here isn't going to solve the problem, and it isn't helping with the signal to noise ratio. I'll post new guidelines for the list just as soon as I have them. scott [moderator] On 28-Oct-08, at 1:45 PM, dreamcat7 wrote: Hello! I posted a number questions to this discussion list. They were all questions about programming in the Cocoa environment. Sometimes my questions have been ignored / not replied to, however this is mostly because of my own poor writing skills rather than anything most siniister. There have been only a couple of occasions where my email was widtheld from the mailinglist - and in those cases it was because I had mistakenly sent my message from the wrong email account. ___ 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: Why self? (Was: Newbie: Referencing Objects)
Coming from a Flex/Flash background I will have to say that there is BIG differences between ActionScript 2.0 and 3.0. AS 3.0 is a powerful OOP language and AS 2.0 is not. That being said, the same object oriented principles do apply in ActionScript 3.0 the same as Obj-C and the Cocoa Framework. I would say a good tutorial/book on MVC structure would clear up some things. Also obj-c is not as forgiving as ActionScript syntax wise. I could see the difficulty coming from Flash IDE into Cocoa. I think the transition is a little easier for a Flex Developer. Many mx.controls.* UI classes are similar to Cocoa UI classes except instead of listening for events you have targets, selectors, and delegates. -- Siavash Ghamaty On Oct 27, 2008, at 8:40 PM, Graham Cox wrote: On 28 Oct 2008, at 2:30 pm, john fogg wrote: I come from coding in Actionscript (Flash) and there things are apparently quite different. FWIW, I tried to do some coding in Actionscript a few years ago after being immersed in C++ for many years and then Objective-C/ Cocoa for a few years. To say that it was an exercise in utter frustration is an understatement. As a programmer in these real languages I found AS to be really mickey-mouse. Others' opinions will no doubt vary but I suspect that if you know AS well, moving to what I call a real language is going to mean unlearning a huge heap of rubbish. Sorry, just my opinion. --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/coldsweat%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]
Binding question
I'm reading about binding and KVC/KVO... and I have a question for which I can't seem to find an answer... I'll use a simple example, it'll be easier to explain that way... Let's say I have a simple class called File... my File class has a property called filePath which is an NSString representing the path of that file... Now, assuming I want to bind an array of those File objects to a Table View, however, what I would like to display in the table's column is not the complete path of the file, but just the file name (that I get with [filePath lastPathComponent]) What would be the best way to achieve that? Basically: I want to bind my column to a property that doesn't really exist (i.e. only part of the filePath property)... I did create a method called - NSString *fileName which only does this: return [filePath lastPathComponent]; It seems to work if I bind my table's column to the arrangedObjects.fileName model key but I am wondering if it is a good idea to do it like this? Basically the fileName method acts as if it was the getter of a fileName property, but that property doesn't really exist...it just returns a part of my filePath property... It's a bit harder to explain than I thought it would be but to sum it up: Is it ok to bind my column to a property that is, in fact, not a property but just a method that returns a string... or should I create an actual instance variable NSString *fileName with a regular getter and setter? It seems like there are a lot of cases where the data I want to show in my TableView is not an actual property of my class but a formatted or modified version of it.. Also, keep in mind that the table column is NOT editable so I don't really need a setter... Any help/suggestions would be appreciated! If I'm unclear let me know I'll try to explain it better! Jean-Nicolas Jolivet ___ 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: Binding question
On Oct 28, 2008, at 12:19 AM, Jean-Nicolas Jolivet wrote: Now, assuming I want to bind an array of those File objects to a Table View, however, what I would like to display in the table's column is not the complete path of the file, but just the file name (that I get with [filePath lastPathComponent]) What would be the best way to achieve that? Basically: I want to bind my column to a property that doesn't really exist (i.e. only part of the filePath property)... You can use a custom value transformer. You would implement +transformedValueClass to return an [NSString class] and - transformedValue: to return the lastPathComponent of the passed in string. Set the transformer for the binding and you should be set. There are a few samples that you can reach from the Xcode docs demonstrating this (just look up NSValueTransformer). -- 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: Binding question
On Oct 28, 2008, at 00:19, Jean-Nicolas Jolivet wrote: Is it ok to bind my column to a property that is, in fact, not a property but just a method that returns a string... or should I create an actual instance variable NSString *fileName with a regular getter and setter? A property *is* just a method (or, if readwrite, a pair of methods -- the getter and the setter). The instance variable, if there is one, is merely an implementation detail within the class. Some properties don't use an instance variable (NSString's lastPathComponent property almost certainly doesn't, for example). Some properties (like your fileName) use an instance variable, but compute a value from it. Furthermore, assuming that your File class has both filePath and fileName properties, then your fileName implementation: return [filePath lastPathComponent]; might alternatively be: return [self.filePath lastPathComponent]; If you get the difference, you're home free, conceptually. (The 2nd one extracts the file name from your filePath property, without any assumption about how the property is implemented. The 1st one uses a convenient instance variable that happens to contain the information you want. Either approach is fine in this case, but in more complicated cases, it's important to distinguish between the value of the property and the value of some variable.) Finally, you also need to pay attention to KVO compliance. Assuming your filePath property is compliant (meaning that changes to it produce the proper KVO notifications), your fileName property isn't (unless the filePath never changes in a File object after it is initialized, in which case the question is moot). 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: NSPredicateEditor error
On Oct 27, 2008, at 10:07 PM, Chris Idou wrote: I'm getting the following error: In NSPredicateEditor: 0x1096070, different number of items (3) than predicate template views (4) for template MyRowTemplate 0x12487e0: [move:] [] NSStringAttributeType From experimenting, the only difference between the NSPredicateEditorRowTemplate that is failing and my other ones that work fine, is that this one has a NSButton in its list of views. Has anyone else seen this before, and have any insight? One reason for this message (which could be a lot clearer) is that templateViews contains a NSPopUpButtonwith no items. NSPredicateEditor doesn't support empty popup buttons yet. Does that help? -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: Binding question
Mmmm seems like value transformer would be another way to do it! I will definitely look into both methods! Since my property is in fact only used for display purposes, I guess it would make sense to use a transformer to display it... Jean-Nicolas Jolivet David Duncan wrote: On Oct 28, 2008, at 12:19 AM, Jean-Nicolas Jolivet wrote: Now, assuming I want to bind an array of those File objects to a Table View, however, what I would like to display in the table's column is not the complete path of the file, but just the file name (that I get with [filePath lastPathComponent]) What would be the best way to achieve that? Basically: I want to bind my column to a property that doesn't really exist (i.e. only part of the filePath property)... You can use a custom value transformer. You would implement +transformedValueClass to return an [NSString class] and -transformedValue: to return the lastPathComponent of the passed in string. Set the transformer for the binding and you should be set. There are a few samples that you can reach from the Xcode docs demonstrating this (just look up NSValueTransformer). -- 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: Code signing validation
You may fill a feature request to ask Apple to publish this API that is part of the Security Framework: http://www.opensource.apple.com/darwinsource/10.5.5/libsecurity_codesigning-33803/lib/SecStaticCode.h Le 28 oct. 08 à 10:36, [EMAIL PROTECTED] a écrit : Hello list Having implemented code signing for my app I wanted to be able to do a quick visual check that things were as they should be. I used the following to display a code signing validation message in the app About window for both the application bundle and a couple of auxiliary executables. Has anyone else done anything similar, or hopefully, better? It would probably be a good idea to also check the signing identity. #import Cocoa/Cocoa.h typedef enum { CodesignUnrecognised = -2, CodesignError = -1, CodesignOkay = 0, CodesignFail = 1, CodesignInvalidArgs = 2, CodesignFailedRequirement = 3, } CodesignResult; @interface MGSCodeSigning : NSObject { NSString *_resultString; } @property (copy) NSString *resultString; - (CodesignResult)validateExecutable; - (CodesignResult)validatePath:(NSString *)path; - (CodesignResult)validateApplication; @end #import MGSCodeSigning.h #include dlfcn.h @implementation MGSCodeSigning @synthesize resultString = _resultString; /* validate executable */ - (CodesignResult)validateExecutable { Dl_info info; int errDlAddr = dladdr( (const void *)__func__, info ); if(errDlAddr == 0) { return CodesignError; } char *exec_path = (char *)(info.dli_fname); NSString *path = [NSString stringWithCString:exec_path encoding:NSUTF8StringEncoding]; return [self validatePath:path]; } /* validate this application */ - (CodesignResult)validateApplication { return [self validatePath:[[NSBundle mainBundle] bundlePath]]; } /* validate path */ - (CodesignResult)validatePath:(NSString *)path { self.resultString = nil; int status = CodesignError; @try { NSArray *arguments = [NSArray arrayWithObjects: @--verify, path, nil]; NSTask *task = [[NSTask alloc] init]; [task setArguments:arguments]; [task setLaunchPath:@/usr/bin/codesign]; [task setStandardOutput:[NSFileHandle fileHandleWithNullDevice]]; [task setStandardError:[NSFileHandle fileHandleWithNullDevice]]; [task launch]; [task waitUntilExit]; status = [task terminationStatus]; switch (status) { case CodesignOkay: self.resultString = NSLocalizedString(@Valid, @Codesign okay.); break; case CodesignFail: self.resultString = NSLocalizedString(@Invalid, @Codesign failed.); break; case CodesignInvalidArgs: self.resultString = NSLocalizedString(@Invalid arguments, @Codesign invalid arguments); break; case CodesignFailedRequirement: self.resultString = NSLocalizedString(@Failed requirement, @Codesign failed requirement.); break; default: self.resultString = NSLocalizedString(@Unrecognised response, @Codesign unrecognised response.); status = CodesignUnrecognised; break; } if (status != CodesignOkay) { NSLog(@codesign failure: %@, self.resultString); } [EMAIL PROTECTED] (NSException *e) { NSLog(@Exception launching codesign: %@, [e reason]); return CodesignError; } return status; } @end ___ 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/devlists%40shadowlab.org 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: Binding question
On Oct 28, 2008, at 12:30, Jean-Nicolas Jolivet wrote: One more thing, you mentioned the term KVO Compliance... I understand that this means to send the proper notifications when a change to my property has been made... But: would it be considered bad practice if my file class does have a property that is used just for displaying purpose (For example, by combining other properties (fileName, extension, size) into a nicely formatted string) to display in a tableView... by bad practice I mean: I know that this property is only used for display purpose and will never be edited... but will be modified when other properties (filePath etc..) have been modified? No, it's not bad practice to have a derived property for display purposes. That's basically what -[NSObject description] is, for example, and that's a *really* important property. Would it mean that this property is not KVO compliant and if so, is it a problem? Assuming I know it should never be observed (i.e. it will never be modified directly, only by modifying other properties)... Not sure what this means. Observed doesn't mean modifiable. It means some other object is watching for change notifications. In particular, if you bind something to your derived property (which is what you're doing in your table view), the property gets observed by the binding, and so must be KVO compliant. basically from your post I understand that.. technically, it's not a problem to do it like that, but... would it be considered bad practice since the property is not KVO compliant? and if so, is it even possible to make it KVO compliant? There's at least 2 ways. If you have a setter for filePath, you can do this: - (void) setFilePath: (NSString*) newValue { [self willChangeValueForKey: @fileName]; filePath = newValue; // plus retain/release code too, if you aren't using garbage collection [self didChangeValueForKey: @fileName]; } Or you can have it happen automatically: @implementation File + (NSSet*) keyPathsForValuesAffectingFileName { return [NSSet set withObject: @filePath]; } ... (The latter is the Leopard way. For Tiger, you use 'setKeys:triggerChangeNotificationsForDependentKey:' instead.) ___ 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: ASL Unicode in Xcode's Console
On Oct 28, 2008, at 14:01 , Karl Moskowski wrote: I've been experimenting with replacing my app's logging with Apple System Logger. When it comes to multi-byte characters, every thing looks OK in Console.app. However, Xcode's console shows things incorrectly. It probably won't come up often, but I'm wondering if it's fixable. For example, this bit of code: NSLog(@あ); aslclient client = asl_open(NULL, NULL, ASL_OPT_STDERR); // add STDERR's fd to the connection's set of fds so things show up in Xcode's console asl_log(client, NULL, ASL_LEVEL_ERR, あ); asl_close(client); Results in this output in Xcode: 2008-10-28 13:49:19.767 ASL[3484:10b] あ Tue Oct 28 13:49:19 iMac.local ASL[3484] Error: \M-c\M^A\M^B The call to NSLog displays correctly, but asl_log doesn't. This is a known issue... you can see where the mangling happens in the source code online when writing to stderr... the characters are properly encoded when sent to syslog and will show up correctly in asl queries and the console application, as you saw. I output japanese to logs a lot and have never really had a problem, except that during debugging I have to use console in those cases and not rely on general output. There are a number of bug reports on the issue, but I doubt it's a very high priority since it write the log to the database correctly. If you absolutely need this functionality, it's actually encoding it in some visual encoding form (you can see more about the form in the source code) so you could, in theory, handle it if you had to. Also, you should not be using non-ascii characters in string literals :) hopefully you're just doing this to demonstrate the issue. You should be doing something like this: char *hiragana_a = { 0xE3, 0x81, 0x82, 0x00 }; NSLog(@%@, [NSString stringWithCString:a encoding:NSUTF8StringEncoding]); asl_log(client, NULL, ASL_LEVEL_ERR, a); :) J 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]
NSTableView right clicked row
Hi list, I have a NSTableView, and i display a menu when the user right clicks a row, this menu allows the user to delete that item. My problem is, how do i get the row which was right clicked? Consider this: currently the row#1 is selected and the user right clicks row#3 the row#3's cell will have a blue border, now in the right click's menu's action method if i call [tableview selectedRow]; it'll return 1 where as what i want is 3 How do i identify the row that was right clicked? Thanks Chaitanya ___ 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]
Getting localized NSPredicateEditor
Hello List, is there a way to make NSPredicateEditor play nice with localized versions of an application, meaning that it's rule operators and criteria are translated to the language the rest of the application is using? Right now it appears that NSPredicateEditor uses English operator names (and compound criteria descriptions), regardless of which language is used. Regards Markus -- __ Markus Spoettl 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: Binding question
Well, I think that pretty much answers all my questions! Thanks a lot for the detailed explanation! I understand the KVC/KVO principle much better now! :) Jean-Nicolas Jolivet Quincey Morris wrote: On Oct 28, 2008, at 12:30, Jean-Nicolas Jolivet wrote: One more thing, you mentioned the term KVO Compliance... I understand that this means to send the proper notifications when a change to my property has been made... But: would it be considered bad practice if my file class does have a property that is used just for displaying purpose (For example, by combining other properties (fileName, extension, size) into a nicely formatted string) to display in a tableView... by bad practice I mean: I know that this property is only used for display purpose and will never be edited... but will be modified when other properties (filePath etc..) have been modified? No, it's not bad practice to have a derived property for display purposes. That's basically what -[NSObject description] is, for example, and that's a *really* important property. Would it mean that this property is not KVO compliant and if so, is it a problem? Assuming I know it should never be observed (i.e. it will never be modified directly, only by modifying other properties)... Not sure what this means. Observed doesn't mean modifiable. It means some other object is watching for change notifications. In particular, if you bind something to your derived property (which is what you're doing in your table view), the property gets observed by the binding, and so must be KVO compliant. basically from your post I understand that.. technically, it's not a problem to do it like that, but... would it be considered bad practice since the property is not KVO compliant? and if so, is it even possible to make it KVO compliant? There's at least 2 ways. If you have a setter for filePath, you can do this: - (void) setFilePath: (NSString*) newValue { [self willChangeValueForKey: @fileName]; filePath = newValue; // plus retain/release code too, if you aren't using garbage collection [self didChangeValueForKey: @fileName]; } Or you can have it happen automatically: @implementation File + (NSSet*) keyPathsForValuesAffectingFileName { return [NSSet set withObject: @filePath]; } ... (The latter is the Leopard way. For Tiger, you use 'setKeys:triggerChangeNotificationsForDependentKey:' instead.) ___ 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/silvertab%40videotron.ca 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: ASL Unicode in Xcode's Console
On 28-Oct-08, at 4:03 PM, Jason Coco wrote: This is a known issue... you can see where the mangling happens in the source code online when writing to stderr... the characters are properly encoded when sent to syslog and will show up correctly in asl queries and the console application, as you saw. I output japanese to logs a lot and have never really had a problem, except that during debugging I have to use console in those cases and not rely on general output. There are a number of bug reports on the issue, but I doubt it's a very high priority since it write the log to the database correctly. If you absolutely need this functionality, it's actually encoding it in some visual encoding form (you can see more about the form in the source code) so you could, in theory, handle it if you had to. Also, you should not be using non-ascii characters in string literals :) hopefully you're just doing this to demonstrate the issue. You should be doing something like this: char *hiragana_a = { 0xE3, 0x81, 0x82, 0x00 }; NSLog(@%@, [NSString stringWithCString:a encoding:NSUTF8StringEncoding]); asl_log(client, NULL, ASL_LEVEL_ERR, a); Thanks, Jason. Yeah, it was just for demo purposes. In actuality, the messages will be constructed, e.g., from file names. Anyway, I've filed a bug (#6326169), in case anyone wants to jump on the bandwagon. Karl Moskowski [EMAIL PROTECTED] Voodoo Ergonomics Inc. http://voodooergonomics.com/ 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: Binding question
On Oct 28, 2008, at 12:58, Quincey Morris wrote: return [NSSet set withObject: @filePath]; Er, I meant: return [NSSet setWithObject: @filePath]; Also, I think it's worth adding that it's also not bad practice to have properties that are not KVO-compliant (that is, properties that don't generate the proper KVO notifications when their value changes). If you're not going to observe them (e.g. aren't going to bind anything to them), there's no need to write code to make them observable. ___ 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: NSTableView right clicked row
On Oct 28, 2008, at 2:11 PM, chaitanya pandit wrote: Hi list, I have a NSTableView, and i display a menu when the user right clicks a row, this menu allows the user to delete that item. My problem is, how do i get the row which was right clicked? Consider this: currently the row#1 is selected and the user right clicks row#3 the row#3's cell will have a blue border, now in the right click's menu's action method if i call [tableview selectedRow]; it'll return 1 where as what i want is 3 How do i identify the row that was right clicked? clickedRow Returns the index of the row the user clicked to trigger an action message. - (NSInteger)clickedRow Return Value The index of the row the user clicked to trigger an action message. Returns –1 if the user clicked in an area of the table view not occupied by table rows. Discussion The return value of this method is meaningful only in the target’s implementation of the action or double-action method. Availability • Available in Mac OS X v10.0 and later. ___ 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: NSTableView right clicked row
Thanks Randall, funny that my subject says ...clicked row and i missed clickedRow :-) On 29-Oct-08, at 1:51 AM, Randall Meadows wrote: On Oct 28, 2008, at 2:11 PM, chaitanya pandit wrote: Hi list, I have a NSTableView, and i display a menu when the user right clicks a row, this menu allows the user to delete that item. My problem is, how do i get the row which was right clicked? Consider this: currently the row#1 is selected and the user right clicks row#3 the row#3's cell will have a blue border, now in the right click's menu's action method if i call [tableview selectedRow]; it'll return 1 where as what i want is 3 How do i identify the row that was right clicked? clickedRow Returns the index of the row the user clicked to trigger an action message. - (NSInteger)clickedRow Return Value The index of the row the user clicked to trigger an action message. Returns –1 if the user clicked in an area of the table view not occupied by table rows. Discussion The return value of this method is meaningful only in the target’s implementation of the action or double-action method. Availability • Available in Mac OS X v10.0 and later. ___ 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: NSTableView right clicked row
Note that the documentation is slightly wrong, as it is also valid when the menu pops up. Please see the DragNDropOutlineView demo app which shows how to properly create a dynamic contextual menu. ..corbin On Oct 28, 2008, at 1:34 PM, chaitanya pandit wrote: Thanks Randall, funny that my subject says ...clicked row and i missed clickedRow :-) On 29-Oct-08, at 1:51 AM, Randall Meadows wrote: On Oct 28, 2008, at 2:11 PM, chaitanya pandit wrote: Hi list, I have a NSTableView, and i display a menu when the user right clicks a row, this menu allows the user to delete that item. My problem is, how do i get the row which was right clicked? Consider this: currently the row#1 is selected and the user right clicks row#3 the row#3's cell will have a blue border, now in the right click's menu's action method if i call [tableview selectedRow]; it'll return 1 where as what i want is 3 How do i identify the row that was right clicked? clickedRow Returns the index of the row the user clicked to trigger an action message. - (NSInteger)clickedRow Return Value The index of the row the user clicked to trigger an action message. Returns –1 if the user clicked in an area of the table view not occupied by table rows. Discussion The return value of this method is meaningful only in the target’s implementation of the action or double-action method. Availability • Available in Mac OS X v10.0 and later. ___ 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]
Open Window from Input Manager
Hi, I'm working on a project for inserting special characters in text fields in all Cocoa apps by means of an Input Manager. After a given trigger/shortcut I have the need to open a window/panel, but I don't get it. I've tried to load a NIB file, but the Console reported -[NSWindowController loadWindow]: failed to load window nib file 'Chooser' Is there another way to do it right? I've basically the need to open a panel/window, change the keyboard focus from the textfield to the opened panel and then continue by closing the panel. Best regards, Daniel R. ___ 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]
Controller and NIB
Hi All, I have a controller.m and it has an awakeFromNib method. I have a NIB that is loaded on startup (specified in info.plist) I have code that is not getting called in awakeFromNib when the Nib is loaded. What am I forgetting to setup? I need to run some code after the nib has loaded. -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]
Re: Getting localized NSPredicateEditor
On Oct 28, 2008, at 1:12 PM, Markus Spoettl wrote: Hello List, is there a way to make NSPredicateEditor play nice with localized versions of an application, meaning that it's rule operators and criteria are translated to the language the rest of the application is using? Right now it appears that NSPredicateEditor uses English operator names (and compound criteria descriptions), regardless of which language is used. Regards Markus Hi Markus, Apple does not provide any translations of the operator names or criteria. This is because NSPredicateEditor is designed to be localized with sentence granularity, not word by word. Translating each word independently and piecing them together doesn't produce as good a localization. For example, in Finder, you can search for [Last modified date] is [within last] [5] [weeks]. That whole sentence is what gets localized - it appears in a strings file in Finder's bundle - and there can be a separate localization for each possible sentence. There's an example of a NSRuleEditor localized into Spanish at http://homepage.mac.com/gershwin/NibBasedSpotlightSearcher.zip (NSPredicateEditor's localization is identical). Also see NSNavRuleEditor.strings inside AppKit.framework/*.lproj for how the search in the Open panel gets localized. Of course, you can localize each word independently if you prefer, with the usual mechanism - set the title of each menu item in each popup to the translation you want. Let me know if you have any questions, -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]
Getting available free disk space on disk image
This is pretty obscure, I think. My app makes files which can be quite large. It also allows the user to distribute copies of those files to various locations. So, to test this I have tried creating and mounting a disk image which I tried making a copy to. The problem is that it seems I cannot check the actual available space on that mounted disk image. What I get instead is the available space on the disk where the image lives. I am using [[myFileManager fileSystemAttributesAtPath:mountedDiskImagePath] objectForKey:NSFileSystemFreeSize]; Does anyone know if it is possible to get the free space on a mounted disk image? ___ 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: Getting available free disk space on disk image
On Tue, Oct 28, 2008 at 2:15 PM, Paul Archibald [EMAIL PROTECTED] wrote: This is pretty obscure, I think. My app makes files which can be quite large. It also allows the user to distribute copies of those files to various locations. So, to test this I have tried creating and mounting a disk image which I tried making a copy to. The problem is that it seems I cannot check the actual available space on that mounted disk image. What I get instead is the available space on the disk where the image lives. I am using [[myFileManager fileSystemAttributesAtPath:mountedDiskImagePath] objectForKey:NSFileSystemFreeSize]; Is mountedDiskImagePath the path to the disk image itself, or to the place at which the image is mounted? -- 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]
Getting a file's icon
I was wondering how I can get an NSImage from a file's icon (assuming I have that file's path)... I've read about FileWrapper's icon method ([fileWrapper icon]) which returns exactly what I need, but I'm not really familiar with file wrappers and from what I understand from the Class documentation, a file wrapper actually holds the file's content in dynamic memory... does this mean it can be a problem if I open a bunch of big files? Do I really need to hold the file's content in memory if all I need is its icon? Jean-Nicolas Jolivet ___ 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: Getting a file's icon
NSWorkspace has: - (NSImage *)iconForFile:(NSString *)fullPath HTH, Dave On Oct 28, 2008, at 3:20 PM, Jean-Nicolas Jolivet wrote: I was wondering how I can get an NSImage from a file's icon (assuming I have that file's path)... ___ 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: KVO and array item observation
On Oct 28, 2008, at 2:13 AM, Ashley Clark wrote: I have a bid revision object that holds a to-many NSSet reference to a group of items that constitute a tree. Some of those items are roots and have a nil parent. In my bid revision object I've set up a rootItems method that uses a predicate to return a filtered set of the items with nil parents and uses keyPathsForValuesAffectingRootItems to be aware of changes to the items set as a whole and generate appropriate KVO notifications. I have a problem though that when an item that's already in the set, but not a root, becomes a root by having its' parent set to nil. This does not cause KVO notifications to be sent out for the rootItems property because technically the items set as a whole has not changed. I naïvely tried to add @items.parent to the keyPathsForValues... method which of course didn't work since you can't observe groups of properties in a set or array. Right now, I'm sending a willChange/ didChange method pair after performing parent changes of subitems and after undo/redo events and it *seems* to be working fine. This seems grotesque though and sure to cause me problems later. Is there any way to force a KVO update of a property besides a willChange/didChange method pair? Is there a better way? I've re-architected my design somewhat to work around the issue I described before and avoid issuing empty willChange/didChange pairs but I think I'm seeing a bug (in Apple's framework?) now that I'm not sure how to track. My object hierarchy looks like this: JTBidRevision maintains a set of JTBidItem objects that represent the top items of the tree. These JTBidItem objects in turn reference a JTInventory object. And these JTInventory objects each reference a set of JTInventoryDependency objects. My JTBidItem class has a method that returns a coalesced ordered array of objects that it displays as children, some of them are the JTInventoryDependency objects referenced through its JTInventory object and others are direct JTBidItem descendants of the node. The set of dependency objects returned also depends on the state of a variable in the parent JTBidRevision object. Depending on this variable some dependency objects will be or will not be part of the orderedChildren method result. I've set up my set of keyPaths that affect the orderedChildren set and it appears to be working in the general case in that if I change the watched value in my JTBidRevision instance the appropriate notifications are sent and the tree reloads correctly the first time for all elements. If I then change that value a second time, one of my objects has its orderedChildren method invoked twice while another of the objects gets skipped and the display of the tree is not updated correctly from that point on. The JTBidItem objects that are exhibiting this behavior both maintain a reference to the same JTInventory object. My keyPathsForValues... method looks like this for my JTBidItem's orderedChildren: + (NSSet *)keyPathsForValuesAffectingOrderedChildren { return [NSSet setWithObjects:@children, @inventoryItem.dependentInventoryItems, @owningRevision.piping, nil]; } The owningRevision itself is a derived value also with this keyPathsForValues..., the owningRevision method walks up the tree to find the owning revision object. + (NSSet *)keyPathsForValuesAffectingOwningRevision { return [NSSet setWithObjects:@parent, @bidRevision, nil]; } Everything else appears to be working fine and the problem only occurs when two or more bid item objects in my tree both reference the same JTInventory object. Ideas? Ashley ___ 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]
Sage advice
When I was but a newbie, I heard a wise man say, When using CALayers, Put NSViews away. Yet I set a CALayer, Then added NSView; Now many hours later, I wail, T'is true, t'is true! ___ 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: Sage advice
One question I have that maybe this list can help me understand. If you have views that are layer backed - why would one use any of the view methods instead of the layer methods? I have to admit in some ways I am somewhat perplexed why a CALayer doesn't replace the view itself completely. This is an area I have not yet had to delve into in the docs too much there, but what I have read it doesn't really explain much about the perceived dichotomy. I would love an eye-opener description here :) And for me its a Leopard/iPhone only world if that makes a difference. On Oct 28, 2008, at 4:35 PM, DKJ wrote: When I was but a newbie, I heard a wise man say, When using CALayers, Put NSViews away. Yet I set a CALayer, Then added NSView; Now many hours later, I wail, T'is true, t'is true! ___ 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/alex%40webis.net This email sent to [EMAIL PROTECTED] Alex Kac - President and Founder Web Information Solutions, Inc. There will always be death and taxes; however, death doesn't get worse every year. -- Anonymous ___ 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: Controller and NIB
On Oct 28, 2008, at 3:09 PM, J. Todd Slack wrote: I have a controller.m and it has an awakeFromNib method. I have a NIB that is loaded on startup (specified in info.plist) I have code that is not getting called in awakeFromNib when the Nib is loaded. What am I forgetting to setup? -awakeFromNib is only called when an object is instantiated by a nib, and the nib is loaded. Are you sure the object is being correctly instantiated? 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: performSelectorOnMainThread and exceptions
At 6:51 PM -0500 10/27/08, Ken Thomases wrote: On Oct 27, 2008, at 4:05 PM, [EMAIL PROTECTED] wrote: if i call -[anObject performSelectorOnMainThread:aSelector withObject:nil waitUntilDone:NO] and then later throw an exception (of my own), which i catch, the deferred execution of aSelector never happens. note that the performSelectonOnMainThread, and the throw and catch are all in the same run of the run loop and are all in the main thread. is this a bug (seems like it to me) or proper/expected behavior. if i didn't catch the exception, i could understand this, but as i said, i am catching it. if this is proper behavior, can anyone offer me an explanation as to why? Sounds like a bug to me. File it with Apple http://bugreport.apple.com. Out of curiosity, since you're only trying to defer a message and everything's on the main thread, does it still happen with [anObject performSelector:aSelector withObject:nil afterDelay:0]? for the archives. so i built a very simple test application in preparation to filing a bug report and to try [anObject performSelector:aSelector withObject:nil afterDelay:0]. and lo and behold, my deferred method was executed using either deferred variants! so i revisited the issue in my app, and sure enough it is now working as i expected, ie, the deferred method is invoked, even when an exception is thrown. musta been brain freeze the first time around! :-( ken Regards, 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: Message Forwarding Overhead / Performance
On 2008 Oct, 28, at 9:09, Bill Bumgarner wrote: That would not surprise me. An absolute microseconds overhead isn't a terribly useful measure without knowing the total # of microseconds. In general, measuring as a factor of speed -- 1.2x 20x 200x is more widely applicable (tends to be more consistent across different CPUs, for example). Well, since you asked. :)) Actually, I calculated this first but it seemed too ridiculous to publish. Time to send message and do 10,000 integer additions --- Direct messaging 250 microseconds typical Message Forwarding30 microseconds typical X factor: 1200 X Obviously this is because the real work was trivial. But I concocted my test that way purposely. The result of 20 microseconds per message on a 2006 Mac Mini gives me a measure which I can use to ^predict^ performance in this and future applications ^before^ writing code. So... sure... message forwarding is slow. But does it matter in your application? Early in the design process you need to make some guesses based on experience. Since I have an alternative to in this case, the decision is to use the alternative. Roughly, the lesson is: Don't use message forwarding for actual work. I was just wondering if anyone had ever found otherwise. Thanks again, Bill. ___ 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: NSPredicateEditor error
Yes, I thought I had an NSButton, but it turned out I'd wrongly put in a NSPopupButton. --- On Tue, 10/28/08, Peter Ammon [EMAIL PROTECTED] wrote: From: Peter Ammon [EMAIL PROTECTED] Subject: Re: NSPredicateEditor error To: [EMAIL PROTECTED] Cc: cocoa-dev@lists.apple.com Date: Tuesday, October 28, 2008, 11:41 AM On Oct 27, 2008, at 10:07 PM, Chris Idou wrote: I'm getting the following error: In NSPredicateEditor: 0x1096070, different number of items (3) than predicate template views (4) for template MyRowTemplate 0x12487e0: [move:] [] NSStringAttributeType From experimenting, the only difference between the NSPredicateEditorRowTemplate that is failing and my other ones that work fine, is that this one has a NSButton in its list of views. Has anyone else seen this before, and have any insight? One reason for this message (which could be a lot clearer) is that templateViews contains a NSPopUpButtonwith no items. NSPredicateEditor doesn't support empty popup buttons yet. Does that help? -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: Getting localized NSPredicateEditor
Hi Peter, On Oct 28, 2008, at 2:10 PM, Peter Ammon wrote: Apple does not provide any translations of the operator names or criteria. This is because NSPredicateEditor is designed to be localized with sentence granularity, not word by word. Translating each word independently and piecing them together doesn't produce as good a localization. For example, in Finder, you can search for [Last modified date] is [within last] [5] [weeks]. That whole sentence is what gets localized - it appears in a strings file in Finder's bundle - and there can be a separate localization for each possible sentence. There's an example of a NSRuleEditor localized into Spanish at http://homepage.mac.com/gershwin/NibBasedSpotlightSearcher.zip (NSPredicateEditor's localization is identical). Also see NSNavRuleEditor.strings inside AppKit.framework/*.lproj for how the search in the Open panel gets localized. OK, thanks very much! That's very interesting, I would have never figured that out from the documentation, and it appears my googling skills are very bad. Of course, you can localize each word independently if you prefer, with the usual mechanism - set the title of each menu item in each popup to the translation you want. In my case it might even work but I'd love to give this mechanism a try but... Let me know if you have any questions, I do! I tried to localize the All/Any/None sentence for the German localization. When I do this I get an exception and the following console log: 10/28/08 3:20:54 PM myApp[43721] Error parsing localization! Key: %d %@ Value: %1$d %2$@ Error is: The maximum given order was 2, but nothing has order 1. The localization part looks like this: %[Any]@ of the following are true = %[Eine]@ der folgenden Bedingungen treffen zu; %[All]@ of the following are true = %[Alle]@ der folgenden Bedingungen treffen zu; %[None]@ of the following are true = %[Keine]@ der folgenden Bedingungen treffen zu; I've set the predicate editor's formattingStringsFilename in - awakeFromNib and implemented - (NSDictionary *)ruleEditor:(NSPredicateEditor *)editor predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value inRow:(NSInteger)row { NSMutableDictionary *result = [NSMutableDictionary dictionary]; if ([value isKindOfClass:[NSString class]]) { if ([value isEqual:@Any]) [result setObject:[NSNumber numberWithInt:NSOrPredicateType] forKey:NSRuleEditorPredicateCompoundType]; else if ([value isEqual:@All]) [result setObject:[NSNumber numberWithInt:NSAndPredicateType] forKey:NSRuleEditorPredicateCompoundType]; else if ([value isEqual:@None]) [result setObject:[NSNumber numberWithInt:NSNotPredicateType] forKey:NSRuleEditorPredicateCompoundType]; } return result; } which never gets called (probably because it's a NSPredicateEditor and as such does not use delegate methods?). Any idea what I'm doing wrong? Thanks very much for your help! Regards Markus -- __ Markus Spoettl 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: Message Forwarding Overhead / Performance
On Oct 28, 2008, at 3:16 PM, Jerry Krinock wrote: On 2008 Oct, 28, at 9:09, Bill Bumgarner wrote: That would not surprise me. An absolute microseconds overhead isn't a terribly useful measure without knowing the total # of microseconds. In general, measuring as a factor of speed -- 1.2x 20x 200x is more widely applicable (tends to be more consistent across different CPUs, for example). Well, since you asked. :)) Actually, I calculated this first but it seemed too ridiculous to publish. Time to send message and do 10,000 integer additions --- Direct messaging 250 microseconds typical Message Forwarding30 microseconds typical X factor: 1200 X Obviously this is because the real work was trivial. But I concocted my test that way purposely. The result of 20 microseconds per message on a 2006 Mac Mini gives me a measure which I can use to ^predict^ performance in this and future applications ^before^ writing code. Oooh... trivial tests! I like those! Can you share the code? So... sure... message forwarding is slow. But does it matter in your application? Early in the design process you need to make some guesses based on experience. Since I have an alternative to in this case, the decision is to use the alternative. Roughly, the lesson is: Don't use message forwarding for actual work. I was just wondering if anyone had ever found otherwise. I'd rephrase that for archival purposes: Don't use message forwarding in tight loops or other repetitive use patterns. It doesn't make sense to have to figure out who is really going to do the work on each pass through a loop when figuring out who is so terribly expensive. 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: Getting localized NSPredicateEditor
Hi Peter, On Oct 28, 2008, at 3:33 PM, Markus Spoettl wrote: 10/28/08 3:20:54 PM myApp[43721] Error parsing localization! Key: %d %@ Value: %1$d %2$@ Error is: The maximum given order was 2, but nothing has order 1. The localization part looks like this: Never mind the previous mail. I put the localization in its own file and it works. I had it in Localizable.strings with tons of other stuff in it and apparently the system does expect it to be on its own. Time for some more experimenting, thanks very much for the quick help! Regards Markus -- __ Markus Spoettl 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: Getting localized NSPredicateEditor
On Oct 28, 2008, at 3:33 PM, Markus Spoettl wrote: Hi Peter, Let me know if you have any questions, I do! I tried to localize the All/Any/None sentence for the German localization. When I do this I get an exception and the following console log: 10/28/08 3:20:54 PM myApp[43721] Error parsing localization! Key: %d %@ Value: %1$d %2$@ Error is: The maximum given order was 2, but nothing has order 1. My guess is that you're using the same strings file for this and other uses. The %[...]@ syntax is unique to NSRuleEditor/NSPredicateEditor and so it needs its own strings file. %d should never appear in one of these strings. Here's something that may help - there's a method on NSRuleEditor: - (NSData *)_generateFormattingDictionaryStringsFile. It gives you a strings file (as UTF16 data) appropriate for that control - write the data to a .strings file and then you can start translating it. That method should never be called in production code but it can be useful for generating the strings file. The localization part looks like this: %[Any]@ of the following are true = %[Eine]@ der folgenden Bedingungen treffen zu; %[All]@ of the following are true = %[Alle]@ der folgenden Bedingungen treffen zu; %[None]@ of the following are true = %[Keine]@ der folgenden Bedingungen treffen zu; I've set the predicate editor's formattingStringsFilename in - awakeFromNib and implemented - (NSDictionary *)ruleEditor:(NSPredicateEditor *)editor predicatePartsForCriterion:(id)criterion withDisplayValue:(id)value inRow:(NSInteger)row { NSMutableDictionary *result = [NSMutableDictionary dictionary]; if ([value isKindOfClass:[NSString class]]) { if ([value isEqual:@Any]) [result setObject:[NSNumber numberWithInt:NSOrPredicateType] forKey:NSRuleEditorPredicateCompoundType]; else if ([value isEqual:@All]) [result setObject:[NSNumber numberWithInt:NSAndPredicateType] forKey:NSRuleEditorPredicateCompoundType]; else if ([value isEqual:@None]) [result setObject:[NSNumber numberWithInt:NSNotPredicateType] forKey:NSRuleEditorPredicateCompoundType]; } return result; } which never gets called (probably because it's a NSPredicateEditor and as such does not use delegate methods?). Right, those delegate methods are not used for NSPredicateEditor. All that's necessary for localization is to set the strings file. -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: Controller and NIB
On Tue, Oct 28, 2008 at 3:09 PM, J. Todd Slack [EMAIL PROTECTED] wrote: What is a full proof way to have code executed when a NIB is loaded? By loading it yourself, by implementing the supported delegate method if NSApplication is the one loading it, by implementing windowDidLoad in a subclassing NSWindowController, etc. It depends on who is loading the NIB. When my MainMenu.nib displays its Window, I want to execute some code. In this particular case look at the delegate methods of NSApplication. In particular applicationDidFinishLaunching:. -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: Message Forwarding Overhead / Performance
- Original Message From: Jerry Krinock [EMAIL PROTECTED] Roughly, the lesson is: Don't use message forwarding for actual work. I was just wondering if anyone had ever found otherwise. I don't think that's really fair. The lesson is not to use NSInvocation in extremely tight loops. For the bulk of most programs, the message forwarding overhead will be much less significant. Writing to disk is also relatively slow, but I've never heard anyone say it's not useful for actual work. 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]