NSPredicate like NSLiteralSearch
This works. i.e. returns {0,1}: NSRange r2 = [ @ก่ี rangeOfString: @ก options: NSAnchoredSearch | NSLiteralSearch ]; (without NSLiteralSearch it returns NSNotFound). but an NSPredicate with: someProperty BEGINSWITH ก does NOT find ก่ี. (the NSPredicate is to be used with -[NSArrayController setFilterPredicate:] to query Core Data). So: is there some string_option equivalent to NSLiteralSearch? And a related question: where are the available string_options defined? The Predicate Programming Guide has: string_options ::= c | d | cd but also an example with w: ((* = FooBar*wcd)) || (kMDItemTextContent = FooBar*cd)) 10.6.2 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 arch...@mail-archive.com
Re: memcpy with 64 bit
Ouch! That's my old code. But it works on 64-bit Intel, Base SDK 10.6, x86_64, GCC 4.2, Target Mac OS X 10.6 I need an handle to store image bitmap data for later reuse by the OpenGL API glTexImage2D. Do you know a better way? -- Leonardo Da: Andrew Farmer andf...@gmail.com Data: Mon, 14 Dec 2009 20:17:41 -0800 A: gMail.com mac.iphone@gmail.com Cc: cocoa-dev@lists.apple.com Oggetto: Re: memcpy with 64 bit On 14 Dec 2009, at 11:06, gMail.com wrote: Handle imagesH = NewHandleClear(totImages * oneImageSize); Wait, Handle? NewHandleClear? Your use of these functions suggests that you may be working from a dangerously old textbook. There's really no reason to use them in new code. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: memcpy with 64 bit
malloc/calloc is a better way. «Mac OS X implements a highly-tuned, threadsafe allocation library, providing standard implementations of the malloc,calloc, realloc, and free routines, among others. If you are allocating memory using older routines such as NewPtr or NewHandle, you should change your code to use malloc instead. The end result is the same since most legacy routines are now wrappers for malloc anyway.» from http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ManagingMemory/Articles/MemoryAlloc.html Le 15 déc. 2009 à 09:50, gMail.com a écrit : Ouch! That's my old code. But it works on 64-bit Intel, Base SDK 10.6, x86_64, GCC 4.2, Target Mac OS X 10.6 I need an handle to store image bitmap data for later reuse by the OpenGL API glTexImage2D. Do you know a better way? -- Leonardo Da: Andrew Farmer andf...@gmail.com Data: Mon, 14 Dec 2009 20:17:41 -0800 A: gMail.com mac.iphone@gmail.com Cc: cocoa-dev@lists.apple.com Oggetto: Re: memcpy with 64 bit On 14 Dec 2009, at 11:06, gMail.com wrote: Handle imagesH = NewHandleClear(totImages * oneImageSize); Wait, Handle? NewHandleClear? Your use of these functions suggests that you may be working from a dangerously old textbook. There's really no reason to use them in new code. ___ 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 devli...@shadowlab.org -- Jean-Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: memcpy with 64 bit
On Dec 15, 2009, at 2:50 AM, gMail.com wrote: Da: Andrew Farmer andf...@gmail.com Data: Mon, 14 Dec 2009 20:17:41 -0800 On 14 Dec 2009, at 11:06, gMail.com wrote: Handle imagesH = NewHandleClear(totImages * oneImageSize); Wait, Handle? NewHandleClear? Your use of these functions suggests that you may be working from a dangerously old textbook. There's really no reason to use them in new code. Ouch! That's my old code. But it works on 64-bit Intel, Base SDK 10.6, x86_64, GCC 4.2, Target Mac OS X 10.6 I need an handle to store image bitmap data for later reuse by the OpenGL API glTexImage2D. Do you know a better way? There's no good reason why it has to be a handle. Use an NSMutableData or even just malloc a chunk of the heap. Handles have an unnecessary level of indirection. Back in the day, that came with relocatability, but it doesn't anymore. It's just obscure and excessively complicated. 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 arch...@mail-archive.com
Re: pls explain rotated iPhone coordinates to me
This seems wrong. When do you call this code? Usually it is just enough to set the springs of your scroll view in IB. Then, after rotation, refit your content. atze Am 15.12.2009 um 03:46 schrieb Matt Neuburg: I am not grasping how coordinates work in a rotated iPhone app, and I'm hoping someone will explain them. My goal is a scroll view consisting of two equal pages side by side with the iPhone sideways (landscape). I have accomplished this, but I don't understand how I did it; I used pure trial and error, and what works makes no sense to me. Here's what I did. The scroll view occupies the entire window (except for the status bar, of course). It has a view controller implemented so as to permit the autorotation, and the plist tells us to start up in landscape mode. And we do. So far so good. Now I populate the scroll view. I want its content to be double-wide, but I have to widen its *height* (svc is the scroll view's controller): CGRect f = svc.view.frame; CGSize sz = CGSizeMake(f.size.height * 2.0, f.size.width); // swap! ((UIScrollView*)svc.view).contentSize = sz; Now I place the first page content: CardController* cc = [[CardController alloc] initWithCard: [data objectAtIndex: 0]]; svc.view.frame = f; // don't swap!! [svc.view addSubview:cc.view]; Now I place the second page content: f.origin.x += f.size.height; // ??? height and width are swapped... // but x and y are not swapped? CardController* cc2 = [[CardController alloc] initWithCard: [data objectAtIndex: 1]]; cc2.view.frame = f; [svc.view addSubview: cc2.view]; This works great. But why? What on earth is going on here? Thanks - m. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iPhone Testing Internet Connection?
i have been researching how to do this, and while i believe my code is correct, i always receive the alert stating the internet connection is unavailable. what am i doing wrong? -=-=-=-=- - (BOOL)internetConnection { //INTERNET CONNECTION TESTING //Add the SystemConfiguration framework //#import SystemConfiguration/SCNetworkReachability.h //#include netinet/in.h //Create zero addy struct sockaddr_in zeroAddress; bzero(zeroAddress, sizeof(zeroAddress)); zeroAddress.sin_len = sizeof(zeroAddress); zeroAddress.sin_family = AF_INET; //Recover reachability flags SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)zeroAddress); SCNetworkReachabilityFlags flags; BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, flags); CFRelease(defaultRouteReachability); if (!didRetrieveFlags) { printf(Error. Could not recover network reachability flags\n); return 0; } BOOL isReachable = flags kSCNetworkFlagsReachable; BOOL needsConnection = flags kSCNetworkFlagsConnectionRequired; return (isReachable !needsConnection) ? YES : NO; } - (IBAction)gotoAppStore { if (internetConnection == YES) [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@http://www.google.com;]]; else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:NSLocalizedString(SMConstNoInternetConnectionAlertMessage, nil) delegate:self cancelButtonTitle:@OK otherButtonTitles:nil]; [alert show]; [alert release]; } } -=-=-=-=- ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone Testing Internet Connection?
Perhaps you should be calling the internetConnection function, rather than comparing its address to 0x001 ? if (internetConnection() == YES) 2009/12/15 Chunk 1978 chunk1...@gmail.com: i have been researching how to do this, and while i believe my code is correct, i always receive the alert stating the internet connection is unavailable. what am i doing wrong? -=-=-=-=- - (BOOL)internetConnection { //INTERNET CONNECTION TESTING //Add the SystemConfiguration framework //#import SystemConfiguration/SCNetworkReachability.h //#include netinet/in.h //Create zero addy struct sockaddr_in zeroAddress; bzero(zeroAddress, sizeof(zeroAddress)); zeroAddress.sin_len = sizeof(zeroAddress); zeroAddress.sin_family = AF_INET; //Recover reachability flags SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)zeroAddress); SCNetworkReachabilityFlags flags; BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, flags); CFRelease(defaultRouteReachability); if (!didRetrieveFlags) { printf(Error. Could not recover network reachability flags\n); return 0; } BOOL isReachable = flags kSCNetworkFlagsReachable; BOOL needsConnection = flags kSCNetworkFlagsConnectionRequired; return (isReachable !needsConnection) ? YES : NO; } - (IBAction)gotoAppStore { if (internetConnection == YES) [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@http://www.google.com;]]; else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:NSLocalizedString(SMConstNoInternetConnectionAlertMessage, nil) delegate:self cancelButtonTitle:@OK otherButtonTitles:nil]; [alert show]; [alert release]; } } -=-=-=-=- ___ 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/maillist%40steelskies.com This email sent to maill...@steelskies.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone Testing Internet Connection?
haha... yeah, i just figured out my idiot mistake at the same time as your reply. clearly i need more coffee. thanks :) On Tue, Dec 15, 2009 at 7:33 AM, Jonathan del Strother maill...@steelskies.com wrote: Perhaps you should be calling the internetConnection function, rather than comparing its address to 0x001 ? if (internetConnection() == YES) 2009/12/15 Chunk 1978 chunk1...@gmail.com: i have been researching how to do this, and while i believe my code is correct, i always receive the alert stating the internet connection is unavailable. what am i doing wrong? -=-=-=-=- - (BOOL)internetConnection { //INTERNET CONNECTION TESTING //Add the SystemConfiguration framework //#import SystemConfiguration/SCNetworkReachability.h //#include netinet/in.h //Create zero addy struct sockaddr_in zeroAddress; bzero(zeroAddress, sizeof(zeroAddress)); zeroAddress.sin_len = sizeof(zeroAddress); zeroAddress.sin_family = AF_INET; //Recover reachability flags SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)zeroAddress); SCNetworkReachabilityFlags flags; BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, flags); CFRelease(defaultRouteReachability); if (!didRetrieveFlags) { printf(Error. Could not recover network reachability flags\n); return 0; } BOOL isReachable = flags kSCNetworkFlagsReachable; BOOL needsConnection = flags kSCNetworkFlagsConnectionRequired; return (isReachable !needsConnection) ? YES : NO; } - (IBAction)gotoAppStore { if (internetConnection == YES) [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@http://www.google.com;]]; else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:NSLocalizedString(SMConstNoInternetConnectionAlertMessage, nil) delegate:self cancelButtonTitle:@OK otherButtonTitles:nil]; [alert show]; [alert release]; } } -=-=-=-=- ___ 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/maillist%40steelskies.com This email sent to maill...@steelskies.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone Testing Internet Connection?
haha... yeah, i just figured out my idiot mistake at the same time as your reply. clearly i need more coffee. thanks :) Or cocoa? :) -- regards Claus When lenity and cruelty play for a kingdom, the gentler gamester is the soonest winner. Shakespeare twitter.com/kometen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: memcpy with 64 bit
Thanks, I have just read that doc http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ ManagingMemory/Articles/MemoryAlloc.html So it seems I can really calloc e.g. 60MB with calloc. Can you confirm? If not, I could use NSMutableData. If so, could I get the pointer with this? imageBase = [data bytes]; If I use calloc, then when I call free(ptr) does the memory get release immediately? Or does it behave as I call [data release]; ? -- Leo Da: Ken Thomases k...@codeweavers.com Data: Tue, 15 Dec 2009 04:50:07 -0600 A: gMail.com mac.iphone@gmail.com Cc: cocoa-dev@lists.apple.com Oggetto: Re: memcpy with 64 bit On Dec 15, 2009, at 2:50 AM, gMail.com wrote: Da: Andrew Farmer andf...@gmail.com Data: Mon, 14 Dec 2009 20:17:41 -0800 On 14 Dec 2009, at 11:06, gMail.com wrote: Handle imagesH = NewHandleClear(totImages * oneImageSize); Wait, Handle? NewHandleClear? Your use of these functions suggests that you may be working from a dangerously old textbook. There's really no reason to use them in new code. Ouch! That's my old code. But it works on 64-bit Intel, Base SDK 10.6, x86_64, GCC 4.2, Target Mac OS X 10.6 I need an handle to store image bitmap data for later reuse by the OpenGL API glTexImage2D. Do you know a better way? There's no good reason why it has to be a handle. Use an NSMutableData or even just malloc a chunk of the heap. Handles have an unnecessary level of indirection. Back in the day, that came with relocatability, but it doesn't anymore. It's just obscure and excessively complicated. 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 arch...@mail-archive.com
Re: pls explain rotated iPhone coordinates to me
First of all, it's important for you to mention where this code gets called. Without that, we can't know the whole story, but I'll grant some notes. On Dec 14, 2009, at 6:46 PM, Matt Neuburg wrote: I am not grasping how coordinates work in a rotated iPhone app, and I'm hoping someone will explain them. My goal is a scroll view consisting of two equal pages side by side with the iPhone sideways (landscape). I have accomplished this, but I don't understand how I did it; I used pure trial and error, and what works makes no sense to me. Here's what I did. The scroll view occupies the entire window (except for the status bar, of course). It has a view controller implemented so as to permit the autorotation, and the plist tells us to start up in landscape mode. And we do. So far so good. Now I populate the scroll view. I want its content to be double- wide, but I have to widen its *height* (svc is the scroll view's controller): CGRect f = svc.view.frame; This is weird. You use this rect both to apply back to svc.view.frame later (which isn't necessary) and you use it for positioning subviews. Subviews should be positioned within the superview's bounds, not frame. CGSize sz = CGSizeMake(f.size.height * 2.0, f.size.width); // swap! Ok, you're not doubling the height. You're making a size whose width is twice the height of your view ((UIScrollView*)svc.view).contentSize = sz; Now I place the first page content: CardController* cc = [[CardController alloc] initWithCard: [data objectAtIndex: 0]]; svc.view.frame = f; // don't swap!! Weird. You never changed f, and you're assigning it back to svn.view.frame from whence it came. Why is this line here? [svc.view addSubview:cc.view]; You never applied any frame to cc.view and now you're adding it? Now I place the second page content: f.origin.x += f.size.height; // ??? height and width are swapped... // but x and y are not swapped? You're placing the origin at the midway point of the contentView, because you previously specified that the content width be f.size.height * 2.0 CardController* cc2 = [[CardController alloc] initWithCard: [data objectAtIndex: 1]]; cc2.view.frame = f; Again, should be using a rect based on the bounds, not the frame. [svc.view addSubview: cc2.view]; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Help Debugging NSPredicateEditor reloadCriteria Exception
Under 10.6.2 my program is throwing an exception when I call the NSPredicateEditor method reloadCriteria. I do not see the behavior on earlier releases of 10.6 or 10.5. When the exception is thrown the stack is the following: #0 0x96f624e6 in objc_exception_throw () #1 0x95657138 in +[NSException raise:format:arguments:] () #2 0x956570aa in +[NSException raise:format:] () #3 0x9926b496 in -[NSPredicateEditor _predicateFromRowItem:] () #4 0x9926a320 in -[NSPredicateEditor _updatePredicateFromRows] () #5 0x9920ac4e in -[NSRuleEditor observeValueForKeyPath:ofObject:change:context:] () #6 0x9820aca7 in NSKeyValueDidChange () #7 0x981ef6d0 in -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] () #8 0x981e587a in -[NSCFDictionary setObject:forKey:] () #9 0x98206dac in _NSSetUsingKeyValueSetter () #10 0x982e5674 in -[NSKeyValueSlowMutableArray removeObjectAtIndex:] () #11 0x95645c73 in -[NSMutableArray removeAllObjects] () #12 0x982e4825 in -[NSKeyValueMutableArray setArray:] () #13 0x992051a6 in -[NSRuleEditor reloadCriteria] () #14 0x99269f0b in -[NSPredicateEditor reloadCriteria] () #15 0x00026971 in -[Game_Document Display_Filter_Window:] (self=0x1053ec0, _cmd=0x336af, sender=0x10b75b0) at /Volumes/HD/Football_Review/Source/Game_Document.m:1705 #16 0x98b98f86 in -[NSApplication sendAction:to:from:] () #17 0x98c78705 in -[NSControl sendAction:to:] () #18 0x98c741ba in -[NSCell _sendActionFrom:] () #19 0x98c734b1 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:] () #20 0x98cc895d in -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] () #21 0x98c71f07 in -[NSControl mouseDown:] () #22 0x98c6ff10 in -[NSWindow sendEvent:] () #23 0x98b88b2f in -[NSApplication sendEvent:] () #24 0x98b1c4ff in -[NSApplication run] () #25 0x98b14535 in NSApplicationMain () #26 0x2960 in main (argc=1, argv=0xb7ec) at /Volumes/HD/Football_Review/Source/main.m:13 The following information is output to the console log: 2009-12-15 09:32:49.865 Football_Review[987:a0f] In NSPredicateEditor: 0x10ab0b0, different number of items (1) than values (2) Below is my function that calls reloadCriteria: - (IBAction) Display_Filter_Window:(id)sender { if ( ! [main_window makeFirstResponder:main_window]) //force edit compleation return; [plays_predicate_editor reloadCriteria]; [ NSApp beginSheet:filter_window modalForWindow: main_window modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:NULL]; } I have greatly simplified my predicate and I still get the exception. If I comment out the call to reloadCriteria the predicate editor is correctly displayed with the default values setup in IB. What is the log message trying to tell me?. What strategies and tools can I use to debug such a problem? Thank you for the help. Marshall ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: memcpy with 64 bit
On Tue, Dec 15, 2009 at 6:33 AM, gMail.com mac.iphone@gmail.com wrote: Thanks, I have just read that doc http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ ManagingMemory/Articles/MemoryAlloc.html So it seems I can really calloc e.g. 60MB with calloc. Can you confirm? Yes, why wouldn't you be able to? If not, I could use NSMutableData. If so, could I get the pointer with this? imageBase = [data bytes]; You would want to use [data mutableBytes]. If I use calloc, then when I call free(ptr) does the memory get release immediately? Yes. Or does it behave as I call [data release]; ? -- Leo Da: Ken Thomases k...@codeweavers.com Data: Tue, 15 Dec 2009 04:50:07 -0600 A: gMail.com mac.iphone@gmail.com Cc: cocoa-dev@lists.apple.com Oggetto: Re: memcpy with 64 bit On Dec 15, 2009, at 2:50 AM, gMail.com wrote: Da: Andrew Farmer andf...@gmail.com Data: Mon, 14 Dec 2009 20:17:41 -0800 On 14 Dec 2009, at 11:06, gMail.com wrote: Handle imagesH = NewHandleClear(totImages * oneImageSize); Wait, Handle? NewHandleClear? Your use of these functions suggests that you may be working from a dangerously old textbook. There's really no reason to use them in new code. Ouch! That's my old code. But it works on 64-bit Intel, Base SDK 10.6, x86_64, GCC 4.2, Target Mac OS X 10.6 I need an handle to store image bitmap data for later reuse by the OpenGL API glTexImage2D. Do you know a better way? There's no good reason why it has to be a handle. Use an NSMutableData or even just malloc a chunk of the heap. Handles have an unnecessary level of indirection. Back in the day, that came with relocatability, but it doesn't anymore. It's just obscure and excessively complicated. 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/clarkcox3%40gmail.com This email sent to clarkc...@gmail.com -- Clark S. Cox III clarkc...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data Save As Binary Error
It's probably unrelated, but why are you using NSArchiver? There's almost no need to these days, and it's more-or-less deprecated (not available on the iPhone for example). On 14 Dec 2009, at 12:41, Richard Somers wrote: I have a Core Data document based application. Saving the file as XML or SQLite works fine. Saving as binary results in an error: *** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs. The struct in question is a transformable attribute using a custom value transformer. - (id)transformedValue:(id)value { return [NSArchiver archivedDataWithRootObject:value]; } No where in my code do I call NSKeyedArchiver. Why does the core data framework work fine saving as XML or SQLite but not binary? --Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Localization.strings in UTF16 vs UTF8
Anyone know of any reasonable explanation why for Cocoa localization files need to be in UTF16? http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/StringsFiles.html#//apple_ref/doc/uid/2005-SW1 Is this just to make using SCMs painful? Or what is wrong with using UTF-8? Anyone filed a radar for this yet? At least I didn't find anything over at http://www.openradar.appspot.com 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 arch...@mail-archive.com
Re: pls explain rotated iPhone coordinates to me
On or about 12/15/09 7:00 AM, thus spake Luke the Hiesterman luket...@apple.com: should be using a rect based on the bounds Will do, thanks! I think this will make a big difference. :) m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide, 2nd edition http://www.tidbits.com/matt/default.html#applescriptthings Take Control of Exploring Customizing Snow Leopard http://tinyurl.com/kufyy8 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSPredicate like NSLiteralSearch
I believe you need the diacritic insensitive option: 'someProperty BEGINSWITH[d] ?' Look up NSComparisonPredicate options in the documentation for more discussion. As for what the 'w' means, it's Spotlight specific. The Comparison is word based, and also detects transitions from lower-case to upper-case. http://developer.apple.com/Mac/library/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/QueryFormat.html -- Jim http://nukethemfromorbit.com On Tue, Dec 15, 2009 at 1:30 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: This works. i.e. returns {0,1}: NSRange r2 = [ @??? rangeOfString: @? options: NSAnchoredSearch | NSLiteralSearch ]; (without NSLiteralSearch it returns NSNotFound). but an NSPredicate with: someProperty BEGINSWITH ? does NOT find ???. (the NSPredicate is to be used with -[NSArrayController setFilterPredicate:] to query Core Data). So: is there some string_option equivalent to NSLiteralSearch? And a related question: where are the available string_options defined? The Predicate Programming Guide has: string_options ::= c | d | cd but also an example with w: ((* = FooBar*wcd)) || (kMDItemTextContent = FooBar*cd)) 10.6.2 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/jturner.lists%40gmail.com This email sent to jturner.li...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Localization.strings in UTF16 vs UTF8
On 15 dec 2009, at 07.47, Torsten Curdt wrote: Anyone know of any reasonable explanation why for Cocoa localization files need to be in UTF16? Hello Torsten, I think that this is simply a documentation bug. Cocoa expects, or at least expected, strings files in the product to be UTF16. For that reason, the recommendation was for you to maintain your strings files as UTF16. Recent versions of Xcode (both 3.1.x and 3.2.x) will convert your strings files to UTF16 automatically as they are copied over to the build product, allowing you to maintain the source version of the strings file in the more manageable UTF8. It's easy to change the encoding of your strings files by using the file inspector in Xcode. You'll also find that when you create new projects / files in Xcode, strings files are provided as UTF8 out of the box. You can find snippets of information about this in the Xcode release notes: http://developer.apple.com/mac/library/releasenotes/DeveloperTools/RN-Xcode/index.html Please file a bug report on any documentation that you find that isn't updated: http://developer.apple.com/bugreporter/ Thanks, j o a 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 arch...@mail-archive.com
Re: Core Data Save As Binary Error
On Dec 15, 2009, at 8:34 AM, Mike Abdullah wrote: It's probably unrelated, but why are you using NSArchiver? There's almost no need to these days, and it's more-or-less deprecated (not available on the iPhone for example). It worked. I plan on switching to NSKeyedArchiver but have not been able to get it to work yet with a custom C struct. --Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Localization.strings in UTF16 vs UTF8
This topic came up during yesterdays CocoaHeads and there was quite some confusion around this. Many thanks for the the clarification, Joar. 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 arch...@mail-archive.com
Re: pls explain rotated iPhone coordinates to me
On or about 12/15/09 7:00 AM, thus spake Luke the Hiesterman luket...@apple.com: should be using a rect based on the bounds Okay, but things are still reversed from the way I naively think they should be. Just consider this code alone (I've moved everything into the view's controller): UIScrollView* sv = (UIScrollView*)self.view; CGRect f = self.view.bounds; sv.contentSize = CGSizeMake(f.size.height * 2.0, f.size.width); Now, what I'm trying to do is make the content twice as *wide* as the scroll view, so that I page from side to side, in this landscape-oriented app. And I am succeeding in doing so! The question is: why? As you can see from the code, I'm finding that I have to take my bounds and use its *height* as my content size's *width* (and double it, in order to get my two-page setup) and its *width* as my content size's *height*. But why *is* that? The scroll view *is* rotated (i.e. I'm not merely holding the iPhone sideways; things drawn in the scroll view in IB with the view rotated are appearing correctly in the running app) so shouldn't width mean width? My code works perfectly, I just want to understand why. Does rotation not really mean rotation? Am I supposed to manually apply a coordinate transform that the docs have failed to warn me about? I did the three things we are asked to do here: http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/i PhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#/ /apple_ref/doc/uid/TP40007072-CH7-SW18 m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide, 2nd edition http://www.tidbits.com/matt/default.html#applescriptthings Take Control of Exploring Customizing Snow Leopard http://tinyurl.com/kufyy8 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone Testing Internet Connection?
On Dec 15, 2009, at 4:25 AM, Chunk 1978 wrote: i have been researching how to do this, and while i believe my code is correct, i always receive the alert stating the internet connection is unavailable. what am i doing wrong? Don't use Reachability synchronously. At some point you will be blocked, you will hit a watchdog timer, and your application will be killed. The current reachability sample correctly demonstrates how to use Reachability asynchronously, but most importantly it continuously updates you on the current state of the network, so you can properly adapt to changes (such as when the train the user is on goes into a tunnel and the network goes down). In your particular case, it would allow you to disable or hide the button when the network is down, rather than displaying an alert when the user tries to use it. You can find the sample here: http://developer.apple.com/iphone/library/samplecode/Reachability/index.html -- 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 arch...@mail-archive.com
Re: image not found
But that means the difference should not really matter here then. You are correct. The problem here is not because of using @executable_path instead of @loader_path. The problem is because the binary was moved outside of Contents/MacOS where it belongs. Well, those user will not go into the package and will move the bundle resources around (from what I read from the reports they don't even have a clue what a bundle is ;) Right now I suspect the unzipping of the app to be a problem or something. But anyway ...seems like there is nothing obvious that I have missed. 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 arch...@mail-archive.com
Ideas for multi-type inspector design
Hi All, I am trying to make an inspector like panel for my application and could use some input on the design of that. My application has an NSOutlineView displaying objects of multiple types. These objects are stored in an NSTreeController. Now, I would like to have an inspector panel show some attributes for the object selected in this NSOutlineView. The set ob attributes to be displayed/made editable via the inspector depends on the type of object selected - essentailly the same as e.g. InterfaceBuilder is doing when different elements in a NIB file is selected. I am able to get the infrastructure of the inspector up and running and also able to make a NIB file and an NSWindowController subclass for each object type to go into the inspector. Where I need some input is on how to determine which of these controllers are activated when the selection in the OutlineView changes so that the correct NIB can be swapped into the inspector window ? - One solution is to hold a dictionary mapping some kind of type-id to the appropriate WindowController-pointer. Surely this is not a nice solution as this dict must be changed when new types are created in later versions of the app - either manually or by a bundle-loading-like approach. -Also, the dataobjects should not know about their respective inspector-panel/controller as this will violate the MVC pattern. Any ideas or thougts are greatly appreciated. Thanks, Mads___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: memcpy with 64 bit
Great. The errors were 576 at the beginning. Now they are only 20... The porting continues. Maybe you know this too: I can't longer use the APIs from QTMovie.h IsMovieDone MoviesTask SetMovieDrawingCompleteProc SetMovieGWorld UnlockPixels Do you know how to replace them? I am porting everything to the new QTMovie class but these APIs above seem to not have an equivalent there. I already asked to the QT list, still waiting for a reply. So I ask here, which is a more responsive list. -- Leo Da: Clark Cox clarkc...@gmail.com Data: Tue, 15 Dec 2009 07:27:41 -0800 A: gMail.com mac.iphone@gmail.com Cc: Ken Thomases k...@codeweavers.com, cocoa-dev@lists.apple.com Oggetto: Re: memcpy with 64 bit On Tue, Dec 15, 2009 at 6:33 AM, gMail.com mac.iphone@gmail.com wrote: Thanks, I have just read that doc http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ ManagingMemory/Articles/MemoryAlloc.html So it seems I can really calloc e.g. 60MB with calloc. Can you confirm? Yes, why wouldn't you be able to? If not, I could use NSMutableData. If so, could I get the pointer with this? imageBase = [data bytes]; You would want to use [data mutableBytes]. If I use calloc, then when I call free(ptr) does the memory get release immediately? Yes. Or does it behave as I call [data release]; ? -- Leo Da: Ken Thomases k...@codeweavers.com Data: Tue, 15 Dec 2009 04:50:07 -0600 A: gMail.com mac.iphone@gmail.com Cc: cocoa-dev@lists.apple.com Oggetto: Re: memcpy with 64 bit On Dec 15, 2009, at 2:50 AM, gMail.com wrote: Da: Andrew Farmer andf...@gmail.com Data: Mon, 14 Dec 2009 20:17:41 -0800 On 14 Dec 2009, at 11:06, gMail.com wrote: Handle imagesH = NewHandleClear(totImages * oneImageSize); Wait, Handle? NewHandleClear? Your use of these functions suggests that you may be working from a dangerously old textbook. There's really no reason to use them in new code. Ouch! That's my old code. But it works on 64-bit Intel, Base SDK 10.6, x86_64, GCC 4.2, Target Mac OS X 10.6 I need an handle to store image bitmap data for later reuse by the OpenGL API glTexImage2D. Do you know a better way? There's no good reason why it has to be a handle. Use an NSMutableData or even just malloc a chunk of the heap. Handles have an unnecessary level of indirection. Back in the day, that came with relocatability, but it doesn't anymore. It's just obscure and excessively complicated. 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/clarkcox3%40gmail.com This email sent to clarkc...@gmail.com -- Clark S. Cox III clarkc...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSPredicate like NSLiteralSearch
On 15 Dec 2009, at 23:13, Jim Turner wrote: I believe you need the diacritic insensitive option: 'someProperty BEGINSWITH[d] ก' Well, no. BEGINSWITH[d] tells me that กิน begins with กุ - that is: it ignores not only the tone-marks, but also some vowels, which makes it quite unusable for Thai text. MATCHES can be used (it seems to act like NSLiteralSearch) but it is quite slow. Look up NSComparisonPredicate options in the documentation for more discussion. NSComparisonPredicate Class Reference mentions under NSComparisonPredicate Options the [n] modifier. I just tried it: BEGINSWITH[n] finds that กิน begins with ก - same as NSLiteralSearch. But CONTAINS[n] does not work like NSLiteralSearch. As for what the 'w' means, it's Spotlight specific. The Comparison is word based, and also detects transitions from lower-case to upper-case. http://developer.apple.com/Mac/library/documentation/Carbon/Conceptual/SpotlightQuery/Concepts/QueryFormat.html Somehow I have the feeling that the documention for NSPredicates has some room for improvements. Thanks very much for your links! Gerriet. -- Jim http://nukethemfromorbit.com On Tue, Dec 15, 2009 at 1:30 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: This works. i.e. returns {0,1}: NSRange r2 = [ @ก่ี rangeOfString: @ก options: NSAnchoredSearch | NSLiteralSearch ]; (without NSLiteralSearch it returns NSNotFound). but an NSPredicate with: someProperty BEGINSWITH ก does NOT find ก่ี. (the NSPredicate is to be used with -[NSArrayController setFilterPredicate:] to query Core Data). So: is there some string_option equivalent to NSLiteralSearch? And a related question: where are the available string_options defined? The Predicate Programming Guide has: string_options ::= c | d | cd but also an example with w: ((* = FooBar*wcd)) || (kMDItemTextContent = FooBar*cd)) 10.6.2 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sorted Table Column
On 12/14/09 10:09 PM, Graham Cox said: I have an NSTableView with just one column, filled by some NSArrayController. Initially the items are not in any recognizable order. When I click on the NSTableHeaderView a triangle appears and now the items are nicely sorted. Is it possible (either in InterfaceBuilder or programmatically) to make the NSTableColumn start with this sorted behaviour? In your -awakeFromNib method, pass the sortDescriptors from the table view to the array controller. I think I got that wrong Actually, that's what I do, and it works well. You can set up sort properties in IB on a tablecolumn but not on an array controller. On the tablecolumn, I'll set the 'sort key' attribute and the 'selector' attribute (to localizedStandardCompare:, if you support 10.6+) then in my windowcontroller's awakeFromNib I set the arraycontroller's sort descriptor by fetching the tableview's. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Wierd Crash Report
On 12/14/09 1:29 PM, Nick Zitzmann said: Well, for starters, the garbage collector doesn't work under Rosetta, and Rosetta will crash if you try to start up a GC-enabled app in its environment. So if you make a GC-enabled app, you also must set the info.plist key that requires native execution, or something like this could happen on application startup. The key is LSRequiresNativeExecution BTW. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone Testing Internet Connection?
On Dec 15, 2009, at 6:20 PM, David Duncan wrote: Don't use Reachability synchronously. At some point you will be blocked, you will hit a watchdog timer, and your application will be killed. I find that a little misleading. It seems to depend on how you use the API. If you check for a specific host name that is certainly true, but if you just check for the presence of a network the response is quick. The Readme of the Reachability sample states: You can use the API synchronously, but do not issue a synchronous check by hostName on the main thread. If the device cannot reach a DNS server or is on a slow network, a synchronous call to the SCNetworkReachabilityGetFlags function can block for up to 30 seconds trying to resolve the hostName. If this happens on the main thread, the application watchdog will kill the application after 20 seconds of inactivity. I'm only posting this because after suffering a minor heart attack reading your post I thought it might be interesting for other readers as well. 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 arch...@mail-archive.com
Ideas for multi-type inspector design
Hi All, I am trying to make an inspector like panel for my application and could use some input on the design of that. My application has an NSOutlineView displaying objects of multiple types. These objects are stored in an NSTreeController. Now, I would like to have an inspector panel show some attributes for the object selected in this NSOutlineView. The set ob attributes to be displayed/made editable via the inspector depends on the type of object selected - essentailly the same as e.g. InterfaceBuilder is doing when different elements in a NIB file is selected. I am able to get the infrastructure of the inspector up and running and also able to make a NIB file and an NSWindowController subclass for each object type to go into the inspector. Where I need some input is on how to determine which of these controllers are activated when the selection in the OutlineView changes so that the correct NIB can be swapped into the inspector window ? - One solution is to hold a dictionary mapping some kind of type-id to the appropriate WindowController-pointer. Surely this is not a nice solution as this dict must be changed when new types are created in later versions of the app - either manually or by a bundle-loading-like approach. -Also, the dataobjects should not know about their respective inspector-panel/controller as this will violate the MVC pattern. Any ideas or thougts are greatly appreciated. Thanks, Mads___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Error on third opening of preferences window
Okay, all: can somebody explain this error to me? The debugger isn't much help and the problem is not in my code (because I can reproduce this without writing any code!). 1) Make a new document-based cocoa project in XCode. 2) Open MainMenu.xib in IB, add a new blank window. Set the window to Not visible on Launch. 3) Hook up the Preferences menu item to makeKeyAndOrderFront of this new window. 4) Build and run. 5) Upon launch you'll see your document. 6) Open prefs, close it, open it, close it, try to open it again - EXC_BAD_ACCESS ! (Sometimes I get the error sooner). The error is happening in [NSMenu _enableItem:]. Is there some other menu item that has to be hooked up to something? Do I need to do some Info.plist initializing perhaps? Is makeKeyAndOrderFront an incorrect way to show a window? The same behavior happens in a non-document-based app. -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 arch...@mail-archive.com
Re: Error on third opening of preferences window
On Dec 15, 2009, at 8:02 PM, David Hirsch wrote: The same behavior happens in a non-document-based app. Did you switch off Release When Closed for the window in IB? If not, the window will be released after the first round and you're messaging a released object when trying to open it again. 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 arch...@mail-archive.com
Re: Error on third opening of preferences window
Ah, I see. Strange that this would be the default behavior. -Dave On Dec 15, 2009, at 11:07 AM, Markus Spoettl wrote: On Dec 15, 2009, at 8:02 PM, David Hirsch wrote: The same behavior happens in a non-document-based app. Did you switch off Release When Closed for the window in IB? If not, the window will be released after the first round and you're messaging a released object when trying to open it again. Regards Markus -- __ Markus Spoettl ___ 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/dhirsch%40mac.com This email sent to dhir...@mac.com Dave Hirsch Associate Professor Department of Geology Western Washington University persistent email: dhir...@mac.com http://www.davehirsch.com voice: (360) 389-3583 aim: dhir...@mac.com vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: pls explain rotated iPhone coordinates to me
You should probably post a sample project which demonstrates this. Luke On Dec 15, 2009, at 9:09 AM, Matt Neuburg wrote: On or about 12/15/09 7:00 AM, thus spake Luke the Hiesterman luket...@apple.com: should be using a rect based on the bounds Okay, but things are still reversed from the way I naively think they should be. Just consider this code alone (I've moved everything into the view's controller): UIScrollView* sv = (UIScrollView*)self.view; CGRect f = self.view.bounds; sv.contentSize = CGSizeMake(f.size.height * 2.0, f.size.width); Now, what I'm trying to do is make the content twice as *wide* as the scroll view, so that I page from side to side, in this landscape-oriented app. And I am succeeding in doing so! The question is: why? As you can see from the code, I'm finding that I have to take my bounds and use its *height* as my content size's *width* (and double it, in order to get my two-page setup) and its *width* as my content size's *height*. But why *is* that? The scroll view *is* rotated (i.e. I'm not merely holding the iPhone sideways; things drawn in the scroll view in IB with the view rotated are appearing correctly in the running app) so shouldn't width mean width? My code works perfectly, I just want to understand why. Does rotation not really mean rotation? Am I supposed to manually apply a coordinate transform that the docs have failed to warn me about? I did the three things we are asked to do here: http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/i PhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#/ /apple_ref/doc/uid/TP40007072-CH7-SW18 m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide, 2nd edition http://www.tidbits.com/matt/default.html#applescriptthings Take Control of Exploring Customizing Snow Leopard http://tinyurl.com/kufyy8 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: memcpy with 64 bit
I agree. Anyway, I can't use some APIs from QuickTime. Do you know any replacement for 64-bit Intel + 10.6 only? MoviesTask SetMovieDrawingCompleteProc SetMovieGWorld UnlockPixels -- Leo Da: Sean McBride s...@rogue-research.com Organizzazione: Rogue Research Inc. Data: Tue, 15 Dec 2009 14:22:41 -0500 A: Jean-Daniel Dupas devli...@shadowlab.org, gMail.com mac.iphone@gmail.com Cc: cocoa-dev@lists.apple.com Oggetto: Re: memcpy with 64 bit On 12/15/09 11:46 AM, Jean-Daniel Dupas said: «Mac OS X implements a highly-tuned, threadsafe allocation library, providing standard implementations of the malloc,calloc, realloc, and free routines, among others. If you are allocating memory using older routines such as NewPtr or NewHandle, you should change your code to use malloc instead. The end result is the same since most legacy routines are now wrappers for malloc anyway.» from http://developer.apple.com/mac/library/documentation/Performance/ Conceptual/ManagingMemory/Articles/MemoryAlloc.html I would think one place that using NewHandle() is still the best idea is when an API requires a handle. This is the case for many QuickTime APIs, and the OP did mention using QuickTime. Another would be the Alias Manager. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: memcpy with 64 bit
On Dec 15, 2009, at 12:22 PM, gMail.com wrote: I agree. Anyway, I can't use some APIs from QuickTime. Do you know any replacement for 64-bit Intel + 10.6 only? MoviesTask SetMovieDrawingCompleteProc SetMovieGWorld UnlockPixels Asking how to replace APIs usually leads to people asking What are you trying to do? So... what are you trying to do? :). -- 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 arch...@mail-archive.com
Core Data and pre loading objects (importing).
Hi, I am pretty new to cocoa so thanks for being patient... I have spent some time building a command line tool that reads a .txt file saved locally by an online poker client. This file contains data on my own playing history. I have a chunky method that dissects this file and creates different objects of type Tournament, Table, Player, Hand, Card etc and works well. Having accomplished this, I set about trying to build a core data app to display the data. I have replicated my model exactly as it is in the original project and successfully set bindings etc. For example, I can create, edit and remove players. But I am entirely stuck on how to join the two projects. All I really want to do is use the method I already have to populate the core data application, but despite hours of searching I don't know where or how to start. I have been able to programmatically create new players using: NSManagedObject *player = [NSEntityDescription insertNewObjectForEntityForName:@Player inManagedObjectContext:[self managedObjectContext]]; I have put this in the init of MyDocument and it creates and dsiplays the player (via the binding) as expected. But what I want to do is use a tournament builder class from the original project that takes in a filepath and returns a Tournament, complete with all it's players, tables etc. This function works well in the original project but when I try to use it in the core data project I get: Failed to call designated initializer on NSManagedObject class 'Tournament' All of my classes have created by xcode and inherit from NSManagedObject. I have then replaced the contents of each .m file with the original classes. I know I'm doing something horribly wrong here, so my question is this... How am I meant to load into core data a whole graph of objects (tournament and its constituent parts) that are returned from a function, and where should I be putting the code? Thanks in advance for any help. Ben___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSUndoManager auto-grouping?
I'm having an odd problem with multiple levels of undo/redo. Same basic setup for a number of routines, however certain types of routines seem to be automatically be grouped. prepareWithInvocationTarget is used for all of these. I have some image processing routines that are on another thread and undo objects are created. When these are done in a series by the user (several minutes apart) and an undo is preformed then one by one they are invoked from just one undo request. The inverse is true for redo. The non-threaded items work as expected. if a non-threaded item is done after a threaded item then it all works correctly. Is there a reason for this and how do I make sure each undo action from the user only causes one undo step to be preformed? Thank you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSNumber stringValue
on Sat, Dec 12, 2009 Andy Lee may have said: As glenn pointed out, that string most certainly *can* be a string that can be converted back to a bitwise equivalent of the original float. Ben's question was whether in practice it is guaranteed to be so, or whether stringValue uses a maximum number of decimal places that would lead to rounding error. I can't tell from a quick look at the docs. A float is 32 bits, so it can not represent in exact bits every integer value, not to mention decimal places. Thus while a string can be converted back to a bitwise equivalent of the original float, there is no guarantee that it will be. Also, keep in mind that internally Apple represents many values as doubles. Thus some of the examples in the discussion, such as: whether going out to the stringValue and back to the doubleValue is guaranteed to yield a float that is bitwise identical to the original float are giving up 32 bits of precision for no reason. If you start with a NSNumber, write that out as a string, then read it back in as a string, convert back to an NSNumber, and then get that value as a float you are not only converting the value back and forth between binary and string representations, but also from 64bit to 32bit representations. The binary conversion is likely to loose more precision than the string conversions. If you are starting with a value that can be represented as a double, keep it in that format. Unless you are on a mobile device, GPU code or other specialty code the use of doubles is not costly enough to worry about and it gives you much better precision during calculations as well as better retention when converting back and forth between string and binary representations. Lane Roathe, CEO Ideas From the Deep, llc http://www.ideasfromthedeep.com ___ Life is cheap, but the accessories will break you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Data - Importing using NSOperation - Problems on main thread
Hi, I have an application that persists its data using core data. It uses an NSOperation to download new versions of the data asynchronously. This NSOperation uses its own MOC (moc2) (as opposed to the MOC (moc1) used in the main thread, which is used by the UI). Both MOCs share the same persistent store which, as I understand it, this is the paradigm recommended by Apple (for using Core with multiple threads). My problem occurs when the NSOperation is almost complete and deletes all the old Managed Objects (that have been replaced by the new data) performs a [managedObjectContext save:error] with the intent of making the new data available in the other MOC (moc1). The old data is deleted using [managedObjectContext deleteObject:objectToDelete] after the new data has been added. At the same point in time as the update is taking place, the user may be scrolling through the data in a UITableView (using custom cells populated with data from managed objects in the main thread MOC moc1)). The heavy lifting is performed by a NSFetchedResultsController - using code similar to that in the Apple CoreDataBooks example There are a number of problems with this approach If the user happens to select the view causing the fetched results controller to be initialised i.e. [self.fetchedResultsController performFetch: error] whilst the NSOperation is deleting the old Managed Objects, and attempts to scroll an exception is thrown in cellForRowAtIndexPath (as the object that it is referring to has just been deleted) Problems also occur in the fetched results controller delegate methods, where the didChangeObject methods gets called with NSFetchedResultsChangeUpdate instead of NSFetchedResultsChangeDelete if the user is scrolling up and down the list at the same time (though everything works if the user is not scrolling). Any ideas on how I can avoid these problems, or come up with a more elegant solution? -- NB ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSBitmapImageRep - Fallback Background Color for JPEG output
Hello, Leopard introduced a new NSBitmapImageRep attribute NSImageFallbackBackgroundColor. I often use it in my applications. Now in Snow Leopard this option does not work anymore. Also the equivalent option in the ImageIO framework kCGImageDestinationBackgroundColor is useless. Here is some code: NSData *dt = [mBitmapRep representationUsingType:NSJPEGFileType properties:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:0.7], NSImageCompressionFactor, [NSColor blackColor], NSImageFallbackBackgroundColor, nil]]; [dt writeToFile:@MyImage.jpg atomically:NO]; I need a black fallback color, not the white default background color. Any ideas? Thank you. Jakob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTableView, NSDateFormatter, CoreData
Hello, I have a NSTableView with a CoreData model. This model is irrelevant except for the fact that at least one model class has an optional date field. I have an NSDateFormatter instantiated in the NIB since there are several columns sharing the same formatting behavior. When the user enters in a date, this is saved correctly. When the user blanks out the field, I get an error The value is invalid. Please provide a valid value. [ Discard Change ] [ OK ] I can't figure out how to accept a blank input, and map this blank input to nil in the CoreData model. I've tried several things but nothing seems to work. Kind regards, Samuel___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Smooth Scrolling for NSScrollView
There was a smooth scrolling feature that was introduced in 10.3 which seems to be automatically enabled for NSTextViews, but it doesn't seem to work for NSScrollViews with custom views. Is there anything I need to do to enable this? Or is this enabled by default now (I'm using the 10.5 SDK, running 10.6)? Just wanted to make sure because my scrolling certainly does not feel smooth. Looked up documentation on how to do this, but found nothing. I don't kow about NSScrollViews but with the Apple mouse with the little scrolling ball, and with two finger track pad scrolling, scrolling is perfectly smooth because of the fine resolution. 'Smooth scrolling' which tried to filter the large steps of the old clicking scroll wheels, seems obsolete. Somehow Opera hasn't got the message. It still scrolls in steps, even with track pad scrolling. TextEdit has an odd behavior too: When jumping to the top or bottom of a large file it seems to coast in with smooth scrolling and go instantly without it, which I much prefer. - Bill Ehrich ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSUndoManager issues
I'm having an odd problem with multiple levels of undo/redo. Same basic setup for a number of routines, however certain types of routines seem to be automatically be grouped. prepareWithInvocationTarget is used for all of these. I have some image processing routines that are on another thread and undo objects are created. When these are done in a series by the user (several minutes apart) and an undo is preformed then one by one they are invoked from just one undo request. The inverse is true for redo. The non-threaded items work as expected. if a non-threaded item is done after a threaded item then it all works correctly. Is there a reason for this and how do I make sure each undo action from the user only causes one undo step to be preformed? Thank you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CGEventCreateMouseEvent - iPhone as remote control for Mac
Hi! I'm Trying to do the following: - Connect an iPhone app with a little Cocoa app using the AsyncSocket class - Send touch events from the iPhone and post mouse events on the Mac with CGEventCreateMouseEvent to have a remote control for my Mac I've written a little protocol for the communication using only necessary data, so the traffic is at a minimum. Everything works, but the mouse pointer acts not very smooth. Means that it feels like the mouse always is behind the finger and sometimes it even sticks for a while. When I log the incoming messages, it seems that they are arriving immediatly. Now I wonder if using CGEventCreateMouseEvent is not meant for this kind of usage. Can someone help me? Br, Benjamin___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] Sample code for live camera stream?
I am having problems of getting live images from the iPhone's camera. I suppose this should be quite simple but I am not sure how to do it. Basically, what I want to do is this loop forever: grab current image from the camera do some computer vision processing (object detection) display results on the iPhone's screen (possible overlayed on the camera image) But I have no idea how to go about the first step in the loop, i.e., grabbing the current (live) image from the camera. I did some googling, to no avail. The documentation of UIImagePickerController is not clear to me. And I couldn't find any sample code. So, could somebody please point me to more documentation? or to some sample code? Thanks a lot in advance. Best regards, Gabriel. 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 arch...@mail-archive.com
Ideas for multi-type inspector design
Hi All, I am trying to make an inspector like panel for my application and could use some input on the design of that. My application has an NSOutlineView displaying objects of multiple types. These objects are stored in an NSTreeController. Now, I would like to have an inspector panel show some attributes for the object selected in this NSOutlineView. The set ob attributes to be displayed/made editable via the inspector depends on the type of object selected - essentailly the same as e.g. InterfaceBuilder is doing when different elements in a NIB file is selected. I am able to get the infrastructure of the inspector up and running and also able to make a NIB file and an NSWindowController subclass for each object type to go into the inspector. Where I need some input is on how to determine which of these controllers are activated when the selection in the OutlineView changes so that the correct NIB can be swapped into the inspector window ? - One solution is to hold a dictionary mapping some kind of type-id to the appropriate WindowController-pointer. Surely this is not a nice solution as this dict must be changed when new types are created in later versions of the app - either manually or by a bundle-loading-like approach. -Also, the dataobjects should not know about their respective inspector-panel/controller as this will violate the MVC pattern. Any ideas or thougts are greatly appreciated. Thanks, Mads ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[moderator] Re: Don't Report Documentation Bugs to Apple Bug Reporter
Followup Nothing has changed. If bugs are found in the documentation in the reference library (essentially developer.apple.com/*/library) they should be sent to bugreporter.apple.com or use the feedback mechanism. documentation bugs found in articles on the ADC site (outside the reference library) should go to devprograms. On Dec 14, 2009, at 11:04 PM, Scott Anguish wrote: Putting my “Moderator/Dev Publications Engineer/Writer hat on” I’ve asked Jerry off-list for the radar number to follow up on the developer documentation issue. If it isn’t a technical issue, it could be redirected there I suppose, but that’s the only reason I can think of. I’ve asked my manager for clarification. In the interim, use the feedback button if you don’t want to use bugreporter.apple.com I will respond to this thread when I have clear information. On Dec 14, 2009, at 9:22 PM, Jerry Krinock wrote: Some time ago we had a discussion as to whether documentation bugs should be reported to the Did this document help you? link at the bottom, or by filing a Bug Report. The conclusion at the time was that, although both were acceptable, the formal Bug Report was better. Apparently, no more. Yesterday I reported three bugs. For the one that involved documentation, I received a polite letter of rejection, saying that I should send documentation bugs to devprogr...@apple.com -- which is a now a THIRD way. Well, I think I'll use the Did this document help you? link from now on. If anyone believes this advice is incorrect, please explain. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
There is not currently API for this. The API allows you to place overlays on the screen, but video data is not delivered to your app until the user is finished recording. Luke On Dec 15, 2009, at 9:24 AM, Gabriel Zachmann wrote: I am having problems of getting live images from the iPhone's camera. I suppose this should be quite simple but I am not sure how to do it. Basically, what I want to do is this loop forever: grab current image from the camera do some computer vision processing (object detection) display results on the iPhone's screen (possible overlayed on the camera image) But I have no idea how to go about the first step in the loop, i.e., grabbing the current (live) image from the camera. I did some googling, to no avail. The documentation of UIImagePickerController is not clear to me. And I couldn't find any sample code. So, could somebody please point me to more documentation? or to some sample code? Thanks a lot in advance. Best regards, Gabriel. ___ 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/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
There is not currently API for this. The API allows you to place overlays on the screen, but video data is not delivered to your app until the user is finished recording. So, how do all the so-called augmented reality apps do it? Best regards, Gabriel. 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 arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
They place UI elements over the video feed provided on screen by the built in video capture window, but they don't have access to the actual video data. Mark On 15 Dec 2009, at 16:04, Gabriel Zachmann wrote: There is not currently API for this. The API allows you to place overlays on the screen, but video data is not delivered to your app until the user is finished recording. So, how do all the so-called augmented reality apps do it? Best regards, Gabriel. ___ 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/mark.woollard%40mac.com This email sent to mark.wooll...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: pls explain rotated iPhone coordinates to me
On or about 12/15/09 11:29 AM, thus spake Luke the Hiesterman luket...@apple.com: You should probably post a sample project which demonstrates this. http://www.apeth.com/example.zip Thanks for any enlightenment! m. On Dec 15, 2009, at 9:09 AM, Matt Neuburg wrote: On or about 12/15/09 7:00 AM, thus spake Luke the Hiesterman luket...@apple.com: should be using a rect based on the bounds Okay, but things are still reversed from the way I naively think they should be. Just consider this code alone (I've moved everything into the view's controller): UIScrollView* sv = (UIScrollView*)self.view; CGRect f = self.view.bounds; sv.contentSize = CGSizeMake(f.size.height * 2.0, f.size.width); Now, what I'm trying to do is make the content twice as *wide* as the scroll view, so that I page from side to side, in this landscape-oriented app. And I am succeeding in doing so! The question is: why? As you can see from the code, I'm finding that I have to take my bounds and use its *height* as my content size's *width* (and double it, in order to get my two-page setup) and its *width* as my content size's *height*. But why *is* that? The scroll view *is* rotated (i.e. I'm not merely holding the iPhone sideways; things drawn in the scroll view in IB with the view rotated are appearing correctly in the running app) so shouldn't width mean width? My code works perfectly, I just want to understand why. Does rotation not really mean rotation? Am I supposed to manually apply a coordinate transform that the docs have failed to warn me about? I did the three things we are asked to do here: http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/i PhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#/ /apple_ref/doc/uid/TP40007072-CH7-SW18 m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide, 2nd edition http://www.tidbits.com/matt/default.html#applescriptthings Take Control of Exploring Customizing Snow Leopard http://tinyurl.com/kufyy8 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Setting the port of an NSURL
I need to send a post request to a URL but I need it sent to a port other than the standard 80, 8080 etc. How can I set the port that an NSURLRequest or URL is on? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Setting the port of an NSURL
On Dec 15, 2009, at 2:42 PM, Development wrote: I need to send a post request to a URL but I need it sent to a port other than the standard 80, 8080 etc. How can I set the port that an NSURLRequest or URL is on? [NSURL URLWithString:@http://www.example.com:/path/to/something/;] and replace with the non-standard port number you wish to use. There is no built-in API that creates a new URL with a port number like -initWithScheme:host:path:, but you can just use a string instead... 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 arch...@mail-archive.com
Re: NSUndoManager auto-grouping?
On Sat, Dec 12, 2009 at 12:16 PM, Scott Squires scottsqui...@mac.com wrote: Same basic setup for a number of routines, however certain types of routines seem to be automatically be grouped. Have you read the documentation for per-event grouping? I have some image processing routines that are on another thread and undo objects are created. Have you read the documentation about how multithreading and NSUndoManager really don't mix? grin http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#//apple_ref/doc/uid/1057i-CH12-122647-BBCCEGFF Are you, in fact, running image processing routines in the background and expecting them to add undo groups when they're completed? Surely you can't expect this to make sense; the order in which they wind up on the undo stack (even if it were thread safe) is indeterministic, making undo almost useless. Or are the operations simply internally parallelized? In that case, the threads should coordinate amongst themselves, perhaps locking around a shared undo manager. Alternatively, you could have a serial GCD queue, and as your work units finish they could enqueue blocks that themselves register undo events. (And we should file bug reports to see a block-based API for NSUndoManager…) --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
On Tue, Dec 15, 2009 at 12:54 PM, Luke the Hiesterman luket...@apple.com wrote: There is not currently API for this. The API allows you to place overlays on the screen, but video data is not delivered to your app until the user is finished recording. Erm, Ustream Live Broadcaster does it just fine. Are you suggesting they are circumventing API restrictions? http://www.techcrunch.com/2009/12/09/iphone-live-streaming-ustream/ --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Sending a non http request
I am trying to post data to NSString * url = [NSString stringWithFormat:@ipp://%@:%i/%@,host,[service port],item]; Which as you can see is an ipp address. However the code below fails as I get an error from the NSError that I am using an unsupported url. Obviously if I send it as http:// all I get is the cups page. So the question then is how to format this url or how to send the request. NSMutableData * sendData= [[NSMutableData alloc]init]; NSMutableData * body= [[NSMutableData alloc]init]; NSString * boundry = @@@##$$rew**^%^; NSInputStream* stream = [[[NSInputStream alloc]initWithData:imageData] retain]; [body appendData:[[NSString stringWithFormat:@-...@\r\n,boundry]dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:[@Content-Type: image/png\r\n\r\n dataUsingEncoding:NSUTF8StringEncoding]]; [body appendData:imageData]; [body appendData:[[NSString stringWithFormat:@\r\n...@--\r\n,boundry]dataUsingEncoding:NSUTF8StringEncoding]]; //int totalSize =[body length]; [sendData appendData:body]; NSMutableURLRequest* post = [NSMutableURLRequest requestWithURL: [NSURL URLWithString:path]]; [post addValue: @application/ipp; boundary=@@##$$rew**^%^ forHTTPHeaderField: @Content-Type]; [post setHTTPBodyStream:stream]; [post setHTTPMethod: @POST]; [post setHTTPBody:sendData]; NSURLResponse* response; NSError* error; NSLog(@Sending request now %@,[NSURL URLWithString:path]); NSLog(@Scheme: %@,[[NSURL URLWithString:path]scheme]); NSLog(@Port %@,[[NSURL URLWithString:path]port]); NSData* result = [NSURLConnection sendSynchronousRequest:post returningResponse:response error:error]; NSString * incoming = [[[NSString alloc] initWithData:result encoding:NSASCIIStringEncoding] autorelease]; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
Erm, Ustream Live Broadcaster does it just fine. Are you suggesting they are circumventing API restrictions? http://www.techcrunch.com/2009/12/09/iphone-live-streaming-ustream/ There was recently a clarification in the developer forums from Michael Jurewitz; I’d suggest you take a look there. -Ben___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSUndoManager auto-grouping?
Also it's quite rude to submit the same question to the list twice within two hours. If someone can/is willing to help you out, they will. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
On Tue, Dec 15, 2009 at 2:24 PM, Benjamin Stiglitz s...@apple.com wrote: There was recently a clarification in the developer forums from Michael Jurewitz; I’d suggest you take a look there. That would probably be that link which made its rounds on Twitter today, and which I couldn't view because I can't get to the iPhone dev forums. :) (Apparently access is not granted for team members, only to those with individual developer registrations. I can get into the Mac forums, though.) --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
Scratch that, I have access. It's just that the link I was provided did not work on my phone. For those who also have access to the iPhone forums, here is the relevant link: https://devforums.apple.com/message/149553 Not reproducing the contents here, obviously. --Kyle Sluder On Tue, Dec 15, 2009 at 2:31 PM, Kyle Sluder kyle.slu...@gmail.com wrote: That would probably be that link which made its rounds on Twitter today, and which I couldn't view because I can't get to the iPhone dev forums. :) (Apparently access is not granted for team members, only to those with individual developer registrations. I can get into the Mac forums, though.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Ideas for multi-type inspector design
Please refrain from reposting the same message over and over. It's rude and filling up everyone's inboxes. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
They place UI elements over the video feed provided on screen by the built in video capture window, but they don't have access to the actual video data. So, how do they do this: http://www.youtube.com/watch?v=QoZRHLmUKtM ? Or this: http://www.youtube.com/watch?v=5M-oAmBDcZk ? Erm, Ustream Live Broadcaster does it just fine. Are you suggesting they are circumventing API restrictions? http://www.techcrunch.com/2009/12/09/iphone-live-streaming-ustream/ According to this http://www.tuaw.com/2009/12/14/app-store-approved-app-brings-video-recording-to-iphone-3g-and-1/ they use the non-documented UIGetScreenImage(). I'd love to use that if it's the only way -- if only somebody could provide me with some simple sample code how to use it ... Regards, Gabriel. 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 arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
On Dec 15, 2009, at 3:11 PM, Gabriel Zachmann wrote: According to this http://www.tuaw.com/2009/12/14/app-store-approved-app-brings-video-recording-to-iphone-3g-and-1/ they use the non-documented UIGetScreenImage(). I'd love to use that if it's the only way -- if only somebody could provide me with some simple sample code how to use it . while (youWantImages) { CGImageRef image = UIGetScreenImage(); //process image here CGImageRelease(image); //even though this is a Get function, it returns a retained image. } Luke___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Sample code for live camera stream?
Ah that's probably why the message in the forums says that it will be superceded in the future, for proper naming and hopefully slightly more functionality). Thanks Apple! On Dec 15, 2009, at 5:14 PM, Luke the Hiesterman wrote: On Dec 15, 2009, at 3:11 PM, Gabriel Zachmann wrote: According to this http://www.tuaw.com/2009/12/14/app-store-approved-app-brings-video-recording-to-iphone-3g-and-1/ they use the non-documented UIGetScreenImage(). I'd love to use that if it's the only way -- if only somebody could provide me with some simple sample code how to use it . while (youWantImages) { CGImageRef image = UIGetScreenImage(); //process image here CGImageRelease(image); //even though this is a Get function, it returns a retained image. } Luke___ 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 a...@webis.net Alex Kac - President and Founder Web Information Solutions, Inc. If at first you don't succeed, skydiving is not for you. -- Francis Roberts ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
ipp help - need advice
I have constructed a url request to send a png file to a ipp printer to be printed. The problem is that I get a Bad Request error when I post it. I am wondering if some one that knows how to construct a correct ipp job request would look at my code and point out what I have done wrong. I know that printing from an iPhone is a huge secret that no one wants to share but I hope that I can get one of you to share the ipp job request format so I can do 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 arch...@mail-archive.com
Re: Ideas for multi-type inspector design
On 16/12/2009, at 7:38 AM, Mads Paulin wrote: I am able to get the infrastructure of the inspector up and running and also able to make a NIB file and an NSWindowController subclass for each object type to go into the inspector. Where I need some input is on how to determine which of these controllers are activated when the selection in the OutlineView changes so that the correct NIB can be swapped into the inspector window ? - One solution is to hold a dictionary mapping some kind of type-id to the appropriate WindowController-pointer. Surely this is not a nice solution as this dict must be changed when new types are created in later versions of the app - either manually or by a bundle-loading-like approach. -Also, the dataobjects should not know about their respective inspector-panel/controller as this will violate the MVC pattern. Any ideas or thougts are greatly appreciated. I've done this using a naming convention of my own devising, based on the classname. So you could get the object's class, convert it to a string using NSStringFromClass(), append some other stuff if you want and look that up as the nib name. It's extensible without coding changes, though you'll probably want to build in some protection against having the nib not found and so on. Also, some simple protocol (or base class) shared by all the loaded controllers will allow the loader to treat them all equally, in terms of getting the view to be installed in the window and passing the object to be inspected to it. --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 arch...@mail-archive.com
Re: NSUndoManager issues
On 15/12/2009, at 1:02 PM, Scott Squires wrote: I have some image processing routines that are on another thread and undo objects are created. When these are done in a series by the user (several minutes apart) and an undo is preformed then one by one they are invoked from just one undo request. The inverse is true for redo. The non-threaded items work as expected. if a non-threaded item is done after a threaded item then it all works correctly. Is there a reason for this and how do I make sure each undo action from the user only causes one undo step to be preformed? I haven't experimented with Undo from another thread, but I suspect that's going to be awkward, if it's even allowed. On the main thread, an undo group is automatically opened by the first task submitted to the undo manager and closed at the end of the event cycle, unless -setGroupsByEvent: is NO. Undo tasks submitted from a thread will be completely out of synch with this mechanism, so you'll find groups not being correctly formed - the opened group will be closed on the main thread regardless, I think, so they'll be closed at arbitrary points relative to the execution of the thread. You should probably arrange for the thread to submit its undo tasks to the undo manager on the main thread, and give some thought to managing the groups manually. At that point you'll probably start to run into the numerous bugs and glitches that NSUndoManager suffers from, and start to tear out your hair. That's been mine and others' experiences anyway. --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 arch...@mail-archive.com
Managed Object with Transformable Attribute (C Struct)
I have a managed object with a transformable attribute. The attribute is a C struct and uses a custom value transformer. The transformer uses the depreciated NSArchiver but it is drop dead simple and it works. I am trying to implement keyed archiving and can't figure out what to do or which way to go. I can't seem to see the forest for the trees and keep going around in circles in the documentation and on the web. The C struct Foo is defined like this. typedef struct { double a; double b; double c; double d; } Bar; typedef struct { Bar e; Bar f; } Foo; The current custom value transformer. @interface MyArchiveToDataTransformer : NSValueTransformer @end @implementation MyArchiveToDataTransformer + (Class)transformedValueClass { return [NSData class]; } + (BOOL)allowsReverseTransformation { return YES; } - (id)transformedValue:(id)value { return [NSArchiver archivedDataWithRootObject:value]; } - (id)reverseTransformedValue:(id)data { return [NSUnarchiver unarchiveObjectWithData:data]; } @end Any suggestions or insight for the lost and confused? --Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
App works when launched from Xcode, not from Finder
I'm having a *really* strange issue here. First of all, my app works fine in Debug mode. I can launch it from Xcode or from Finder and it will work fine. The problem comes when using Release. If I pick the Release config and then click the Build button from Xcode, the app still works fine. _However_ when launching the app from Finder (in the build/Release directory) the app just completely throws up all over itself. Authentication errors, request timed out (I'm contacting a web API), just about everything that could go wrong does go wrong. I don't know why this is happening. I don't think its an issue with my code if it works in Debug (Xcode Finder) and Release (Xcode only). My build configurations for both Debug and Release are identical (I haven't checked thoroughly, but I know I didnt change much). Both configs are set to use the LLVM GCC 4.2 compiler, and GC is set to Required. The only other change I've made is adding a few header search paths. Any help is greatly appreciated. Thanks___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: App works when launched from Xcode, not from Finder
On 16/12/2009, at 11:34 AM, PCWiz wrote: My build configurations for both Debug and Release are identical (I haven't checked thoroughly, but I know I didnt change much). Both configs are set to use the LLVM GCC 4.2 compiler, and GC is set to Required. The only other change I've made is adding a few header search paths. Any help is greatly appreciated. Thanks___ Anything logged to the Console, which might indicate what's happening? Do you have any frameworks that should be copied into the final build but are not being? --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 arch...@mail-archive.com
Re: App works when launched from Xcode, not from Finder
In Xcode, are you running the target's executable with any command line arguments? Kiel On 16/12/2009, at 11:34 AM, PCWiz wrote: I'm having a *really* strange issue here. First of all, my app works fine in Debug mode. I can launch it from Xcode or from Finder and it will work fine. The problem comes when using Release. If I pick the Release config and then click the Build button from Xcode, the app still works fine. _However_ when launching the app from Finder (in the build/Release directory) the app just completely throws up all over itself. Authentication errors, request timed out (I'm contacting a web API), just about everything that could go wrong does go wrong. I don't know why this is happening. I don't think its an issue with my code if it works in Debug (Xcode Finder) and Release (Xcode only). My build configurations for both Debug and Release are identical (I haven't checked thoroughly, but I know I didnt change much). Both configs are set to use the LLVM GCC 4.2 compiler, and GC is set to Required. The only other change I've made is adding a few header search paths. Any help is greatly appreciated. Thanks___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com This email sent to kiel.gill...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: App works when launched from Xcode, not from Finder
On Tue, Dec 15, 2009 at 4:34 PM, PCWiz pcwiz.supp...@gmail.com wrote: I don't know why this is happening. I don't think its an issue with my code if it works in Debug (Xcode Finder) and Release (Xcode only). Two rules of software development: Rule 1: Check again. It's probably your fault. Rule 2: It's still probably your fault. My build configurations for both Debug and Release are identical (I haven't checked thoroughly, but I know I didnt change much). Both configs are set to use the LLVM GCC 4.2 compiler, and GC is set to Required. The only other change I've made is adding a few header search paths. When it comes to debugging, there is no such thing as not checking thoroughly. There is only Checking thoroughly and not checking at all. Checking thoroughly means proving (not convincing, but actually sitting down with a backtraces, a debugger, and even single-stepping through your source code if necessary) that your program is behaving as designed. So, run your release-built app from inside gdb (yes, you can run a non-debug app inside a debugger). When it does something wrong, trap that error in the debugger and figure out what happened. Then fix your bug. Rinse, repeat. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: App works when launched from Xcode, not from Finder
I have 2 frameworks set in a Copy Files build phase and both are being copied as they should. I haven't explicitly set any command line arguments for the app, but where would I check that? And nothing is being logged into the Console. I'll make a quick screen capture right now to demonstrate what's happening. On 2009-12-15, at 5:40 PM, Kiel Gillard wrote: In Xcode, are you running the target's executable with any command line arguments? Kiel On 16/12/2009, at 11:34 AM, PCWiz wrote: I'm having a *really* strange issue here. First of all, my app works fine in Debug mode. I can launch it from Xcode or from Finder and it will work fine. The problem comes when using Release. If I pick the Release config and then click the Build button from Xcode, the app still works fine. _However_ when launching the app from Finder (in the build/Release directory) the app just completely throws up all over itself. Authentication errors, request timed out (I'm contacting a web API), just about everything that could go wrong does go wrong. I don't know why this is happening. I don't think its an issue with my code if it works in Debug (Xcode Finder) and Release (Xcode only). My build configurations for both Debug and Release are identical (I haven't checked thoroughly, but I know I didnt change much). Both configs are set to use the LLVM GCC 4.2 compiler, and GC is set to Required. The only other change I've made is adding a few header search paths. Any help is greatly appreciated. Thanks___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com This email sent to kiel.gill...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Dirtying NSSearchField
I have a document based Core Date app. MyDocument.nib contains among other things an NSSearchField (or NSTextField - same behaviour) which has it's value bound to some NSString in MyDocument.h. When I type in this SearchField the window gets marked as dirty (documentEdited) and the Edit menu has an item Undo Typing. When I click somewhere else (so that the SearchField loosed it's blue focus ring) the window becomes clean again and the Edit → Undo menu item is disabled (light gray). The problem: when I type in the SearchField and then close the (now dirty) window, a panel comes up with: Do you want so save ... your changes will be lost otherwise ..., which I find extremely confusing, as the real data have NOT been changed at all. Also: Undo for a SearchField is not really a necessary feature. I unselected in InterfaceBuilder the Allows Undo for my NSSearchFieldCell. Now no more Undo Typing in the Edit menu, but still the window gets marked as documentEdited. So how to make the NSSearchField refrain from messing with the documentEdited status of my window? 10.6.2 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 arch...@mail-archive.com
Highlighting a row in an NSTableView
When I (by clicking selecting it) highlight a row in an NSTextView the background changes to light blue and the selected text is easily readable. But when I (by clicking it) highlight a row in an NSTableView the background changes to dark blue and the text becomes very hard to read. Is there a way to modify the highlight behaviour of an NSTableView? The cells in my table view are ordinary NSTextFieldCells. 10.6.2 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 arch...@mail-archive.com
Re: NSUndoManager issues
On 2009 Dec 15, at 16:15, Graham Cox wrote: You should probably arrange for the thread to submit its undo tasks to the undo manager on the main thread, Indeed, NSUndoManager is not thread-safe. I use one of the -performSelectorOnMainThread... methods in this situation. Watch for deadlocks :) At that point you'll probably start to run into the numerous bugs and glitches that NSUndoManager suffers from, and start to tear out your hair. That's been mine and others' experiences anyway. Download some apps that have won Apple Design Awards, then try and undo and redo a dozen actions. If you can get past 5 or 6 most of the time, you're doing pretty good.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Managed Object with Transformable Attribute (C Struct)
On 2009 Dec 15, at 16:24, Richard Somers wrote: I am trying to implement keyed archiving and can't figure out what to do or which way to go. I can't seem to see the forest for the trees and keep going around in circles in the documentation and on the web. Concentrate on this one: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Archiving/Tasks/codingctypes.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 arch...@mail-archive.com
Even slider values with OpenAL pitch shifting
i have a seemingly simple enough problem, but i can't wrap my head around it. i have an even slider with a min value of 0.0, a maximum value of 2.0 and a neutral default value of 1.0. i need to be able to shift the pitch of a sound down one octave (to slider value 0.0) and shift the pitch up one octave (to slider value 2.0) using OpenAL's pitch. however, in OpenAL a normal sound file with no pitch has a value of 1.0, one octave above the normal sound the pitch shifts up to 2.0, but one octave below the normal sound the pitch shifts down to 0.5, not 0.0 as i had expected! any thoughts on how i can solve this kind of problem? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Even slider values with OpenAL pitch shifting
On Tue, Dec 15, 2009 at 6:01 PM, Chunk 1978 chunk1...@gmail.com wrote: any thoughts on how i can solve this kind of problem? Have your controller correctly map between the two number systems? Pitch grows geometrically (+1 octave = 2x the freq, -1 octave = 1/2 the freq, as you have deduced), while sliders are linear. So assuming you've taken intermediate algebra, you will be able to translate between the two. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Even slider values with OpenAL pitch shifting
On 16/12/2009, at 1:01 PM, Chunk 1978 wrote: in OpenAL a normal sound file with no pitch has a value of 1.0, one octave above the normal sound the pitch shifts up to 2.0, but one octave below the normal sound the pitch shifts down to 0.5, not 0.0 as i had expected! any thoughts on how i can solve this kind of problem? Set the slider's minimum value to 0.5? One octave is a factor of two - going up doubles the pitch (frequency), going down halves it. If you multiplied the frequency by 0.0 it would become 0, not half its original value. If you want the slider to operate as a linear control with 1.0 in the centre, you'll have to apply an offset and scale factor to its value externally to get the geometric range change needed. --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 arch...@mail-archive.com
Re: Sending a non http request
On 15 Dec 2009, at 14:22, Development wrote: I am trying to post data to NSString * url = [NSString stringWithFormat:@ipp://%@:%i/%@,host,[service port],item]; Which as you can see is an ipp address. However the code below fails as I get an error from the NSError that I am using an unsupported url. Obviously if I send it as http:// all I get is the cups page. So the question then is how to format this url or how to send the request. This is more of a question about IPP than about Cocoa... start reading up on how IPP works. http://tools.ietf.org/html/rfc2910 http://tools.ietf.org/html/rfc2911 Once you've figured out how to properly format the request, just call it HTTP and send it off. If you're still just getting the CUPS page, your request isn't formatted properly.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: App works when launched from Xcode, not from Finder
Here's the screen capture that demonstrates this issue: http://www.vimeo.com/8208563 This time around, I got a few errors logged in Console: *** -[NSRecursiveLock unlock]: lock (NSRecursiveLock: 0x16c2340 '(null)') unlocked from thread which did not lock it *** Break on _NSLockError() to debug. *** -[NSRecursiveLock unlock]: lock (NSRecursiveLock: 0x16c2340 '(null)') unlocked when not locked *** Break on _NSLockError() to debug. *** -[NSRecursiveLock finalize]: lock (NSRecursiveLock: 0x16c2340 '(null)') finalized while still in use *** Break on _NSLockError() to debug. *** -[NSRecursiveLock finalize]: lock (NSRecursiveLock: 0x16ca9c0 '(null)') finalized while still in use *** Break on _NSLockError() to debug. I've gotten these before, and they don't seem to affect the operation of the app so I doubt this is what's causing my problem, however I have set a breakpoint on _NSLockError to catch this next time (It happens randomly, not all the time). In the meanwhile, I directly launched the apps executable using Terminal, and here is the error it logs: fail: 'Error Domain=NSURLErrorDomain Code=-1012 UserInfo=0x2004dad80 The operation couldn’t be completed. (NSURLErrorDomain error -1012.) Underlying Error=(Error Domain=kCFErrorDomainCFNetwork Code=-1012 UserInfo=0x2004dad00 The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1012.))' This would explain my apps screwup. If it can't connect then that would explain the request timed out and authentication errors. The problem is, I have no idea why this only happens on the Release config *when launched from Finder* And I don't know how to debug this, as this problem doesn't occur when the app is launched by Xcode. Is there a way to load an executable into gdb manually? Thanks On 2009-12-15, at 5:43 PM, Kyle Sluder wrote: On Tue, Dec 15, 2009 at 4:34 PM, PCWiz pcwiz.supp...@gmail.com wrote: I don't know why this is happening. I don't think its an issue with my code if it works in Debug (Xcode Finder) and Release (Xcode only). Two rules of software development: Rule 1: Check again. It's probably your fault. Rule 2: It's still probably your fault. My build configurations for both Debug and Release are identical (I haven't checked thoroughly, but I know I didnt change much). Both configs are set to use the LLVM GCC 4.2 compiler, and GC is set to Required. The only other change I've made is adding a few header search paths. When it comes to debugging, there is no such thing as not checking thoroughly. There is only Checking thoroughly and not checking at all. Checking thoroughly means proving (not convincing, but actually sitting down with a backtraces, a debugger, and even single-stepping through your source code if necessary) that your program is behaving as designed. So, run your release-built app from inside gdb (yes, you can run a non-debug app inside a debugger). When it does something wrong, trap that error in the debugger and figure out what happened. Then fix your bug. Rinse, repeat. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Managed Object with Transformable Attribute (C Struct)
On Dec 15, 2009, at 6:36 PM, Jerry Krinock wrote: Concentrate on this one: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Archiving/Tasks/codingctypes.html Ok. I changed -transformedValue: of the custom value transformer to look like this. - (id)transformedValue:(id)value { Foo foo; [value getValue:foo]; NSMutableData *data = [NSMutableData dataWithCapacity:64]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data]; [archiver encodeDouble:foo.e.a forKey:@e.a]; [archiver encodeDouble:foo.e.b forKey:@e.b]; [archiver encodeDouble:foo.e.c forKey:@e.c]; [archiver encodeDouble:foo.e.d forKey:@e.d]; [archiver encodeDouble:foo.f.a forKey:@f.a]; [archiver encodeDouble:foo.f.b forKey:@f.b]; [archiver encodeDouble:foo.f.c forKey:@f.c]; [archiver encodeDouble:foo.f.d forKey:@f.d]; [archiver finishEncoding]; return [NSKeyedArchiver archivedDataWithRootObject:value]; } When I save the document I get an error: *** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs. Any ideas what's wrong? --Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Managed Object with Transformable Attribute (C Struct)
On 16/12/2009, at 3:11 PM, Richard Somers wrote: return [NSKeyedArchiver archivedDataWithRootObject:value]; } When I save the document I get an error: *** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs. Any ideas what's wrong? You're archiving 'value'. You want instead to return the mutableData that the first archiver wrote to, which is otherwise unused. return data; --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 arch...@mail-archive.com
Re: App works when launched from Xcode, not from Finder
On Dec 15, 2009, at 8:05 PM, PCWiz wrote: This would explain my apps screwup. If it can't connect then that would explain the request timed out and authentication errors. The problem is, I have no idea why this only happens on the Release config *when launched from Finder* And I don't know how to debug this, as this problem doesn't occur when the app is launched by Xcode. Is there a way to load an executable into gdb manually? Try this: - ssh into your development machine from another Mac - in the ssh session, run gdb, and type attach -waitfor NameOfYourApp - launch your app from Finder - when your app launches, gdb in the ssh session will attach automatically - then you can set breakpoints as usual, debug, etc -eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Managed Object with Transformable Attribute (C Struct)
On Dec 15, 2009, at 9:18 PM, Graham Cox wrote: You're archiving 'value'. You want instead to return the mutableData that the first archiver wrote to, which is otherwise unused. Thanks. Saving keyed archive of struct foo now works for xml store (I think, when I open up the xml document I was expecting to see the keys for foo but instead just see data as before). Prior to this change document saved ok in xml and sqlite but save as binary resulted in error: *** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs. With this change saving to xml is ok but saving as sqlite or binary results in error: The document could not be saved as document.foo is a required value. My whole application works fine with core data, bindings, saving to different store types, etc. Just this one attribute is causing problems. Any ideas? --Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: App works when launched from Xcode, not from Finder
Is there any way to do this using one mac? On 2009-12-15, at 9:33 PM, Eric Schlegel wrote: On Dec 15, 2009, at 8:05 PM, PCWiz wrote: This would explain my apps screwup. If it can't connect then that would explain the request timed out and authentication errors. The problem is, I have no idea why this only happens on the Release config *when launched from Finder* And I don't know how to debug this, as this problem doesn't occur when the app is launched by Xcode. Is there a way to load an executable into gdb manually? Try this: - ssh into your development machine from another Mac - in the ssh session, run gdb, and type attach -waitfor NameOfYourApp - launch your app from Finder - when your app launches, gdb in the ssh session will attach automatically - then you can set breakpoints as usual, debug, etc -eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: App works when launched from Xcode, not from Finder
On Tue, Dec 15, 2009 at 8:47 PM, PCWiz pcwiz.supp...@gmail.com wrote: Is there any way to do this using one mac? Yes, just launch Terminal, cd to YourAppBundle.app/Contents/MacOS, and run gdb from there. Read the gdb manual, tutorials online, and TN2124 for more. http://developer.apple.com/mac/library/technotes/tn2004/tn2124.html --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Managed Object with Transformable Attribute (C Struct)
On 16/12/2009, at 3:47 PM, Richard Somers wrote: Thanks. Saving keyed archive of struct foo now works for xml store (I think, when I open up the xml document I was expecting to see the keys for foo but instead just see data as before). I can't comment on the other (main) problem, but this is what I'd expect. You're creating an archive-within-an-archive and an archive is just a block of binary data by default. If you set the output format type of your secondary archive to XML, you'll be able to see the keys, but it will still be a separate second archive within the main one. If you don't want to archive as a secondary archive, implement -initWithCoder for your 'Foo' object (you'll need to make it into an object supporting NSCoding) and write its members individually. I'd suggest that anyway rather than using simple structs, precisely to avoid the problem you've been having. --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 arch...@mail-archive.com
Re: App works when launched from Xcode, not from Finder
On 15 dec 2009, at 16.48, PCWiz wrote: I have 2 frameworks set in a Copy Files build phase and both are being copied as they should. So you intend for your frameworks to be copied into and used from the bundle of your app? If so, have you set their Installation Directory build setting to @executable_path/../Frameworks? If not, that would probably explain why it works from Xcode, but not from Finder. See: http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html#//apple_ref/doc/uid/20002258-106880 Xcode sets DYLD_FRAMEWORK_PATH to your build folder, so your app will pick up any copies of your frameworks found there when launched from Xcode. j o a 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 arch...@mail-archive.com
Re: Managed Object with Transformable Attribute (C Struct)
On Dec 15, 2009, at 10:06 PM, Graham Cox wrote: You're creating an archive-within-an-archive and an archive is just a block of binary data by default. If you set the output format type of your secondary archive to XML, you'll be able to see the keys, but it will still be a separate second archive within the main one. Thanks for the clarification but I do not fully understand part of your comment. The value of 'foo' comes into -(id)transformedValue: (id)value as a NSConcreteValue instance. The frameworks automatically wrap it thus. In my new implementation of this method I get the value of 'foo' back into a struct and encode with the keyed archiver. It is then sent out as NSData (thanks to your corrections) archived only a single time directly from the struct. So just a single archive is sent into the Core Data store. So I don't understand what you mean by an archive-within-an-archive. Sorry if this is a dumb question. If you don't want to archive as a secondary archive, implement - initWithCoder for your 'Foo' object (you'll need to make it into an object supporting NSCoding) and write its members individually. I'd suggest that anyway rather than using simple structs, precisely to avoid the problem you've been having. I was trying to emulate what Apple does with NSRect, NSSize, NSPoint, etc. I thought if Apple can get the Cocoa frameworks to work with simple structs then why can't I. My struct 'Foo' really wants to be a struct not a class, I think. It is used in a lot of heavy duty math calculations and functions but I also need to save it to the persistent store. Perhaps I should try using two attributes, one transient and the other a shadow representation. The documentation for 10.5 seems to favor transformable attributes for non-standard persistent attributes. I was initially successful using a transformable attribute with a simple custom value transformer using NSArchiver so I thought I was on the right track. Every thing worked but the save document as binary. --Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Managed Object with Transformable Attribute (C Struct)
On 16/12/2009, at 5:12 PM, Richard Somers wrote: On Dec 15, 2009, at 10:06 PM, Graham Cox wrote: You're creating an archive-within-an-archive and an archive is just a block of binary data by default. If you set the output format type of your secondary archive to XML, you'll be able to see the keys, but it will still be a separate second archive within the main one. Thanks for the clarification but I do not fully understand part of your comment. The value of 'foo' comes into -(id)transformedValue:(id)value as a NSConcreteValue instance. The frameworks automatically wrap it thus. In my new implementation of this method I get the value of 'foo' back into a struct and encode with the keyed archiver. It is then sent out as NSData (thanks to your corrections) archived only a single time directly from the struct. So just a single archive is sent into the Core Data store. So I don't understand what you mean by an archive-within-an-archive. Sorry if this is a dumb question. Ah, I think I'd misunderstood something - I thought you were archiving a bunch of objects for file saving, which would not archive your struct, so you were archiving the struct to a separate piece of data which could be archived. Hence archive-within-an-archive. What you actually have is an archive-within-a-core-data-store. I don't have any experience of Core Data so I don't know how it represents itself on disk, but I sort of gather that it will use one of: sqlite store, archive (binary) or archive (XML). If either of the latter you do have an archive-within-an-archive, it's just that the main archive is built and written by Core Data. I was trying to emulate what Apple does with NSRect, NSSize, NSPoint, etc. I thought if Apple can get the Cocoa frameworks to work with simple structs then why can't I. Because there are special conversion functions such as NSStringFromRect(), etc which are used when archiving, so in fact the structs are stored as strings. My struct 'Foo' really wants to be a struct not a class, I think. It is used in a lot of heavy duty math calculations and functions but I also need to save it to the persistent store. Making it an object wouldn't necessarily impact on that. You could return the struct itself as a property or just implement the math as methods of the Foo class. But it's up to you - as a naked struct it will be a poor cousin to a first-class object when it comes to all sorts of handy things, such as memory management, collections and archiving. Perhaps I should try using two attributes, one transient and the other a shadow representation. The documentation for 10.5 seems to favor transformable attributes for non-standard persistent attributes. I was initially successful using a transformable attribute with a simple custom value transformer using NSArchiver so I thought I was on the right track. Every thing worked but the save document as binary. Well, I can't help there - this is in the realms of Core Data which I haven't got any experience of. There are likely others who can chip in on this point. --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 arch...@mail-archive.com
Re: Core Data and pre loading objects (importing).
On 2009 Dec 12, at 08:34, Ben Packard wrote: NSManagedObject *player = [NSEntityDescription insertNewObjectForEntityForName:@Player inManagedObjectContext:[self managedObjectContext]]; The above is good. But what I want to do is use a tournament builder class from the original project that takes in a filepath and returns a Tournament, complete with all it's players, tables etc. This function works well in the original project but when I try to use it in the core data project I get: Failed to call designated initializer on NSManagedObject class 'Tournament' From NSManagedObject documentation, If you instantiate a managed object directly, you must call the designated initializer (initWithEntity:insertIntoManagedObjectContext:). Or, -[NSEntityDescription insertNewObjectForEntityForName:inManagedObjectContext:], as you've used above, should do the same thing. Some subtleties are explained in its documentation. How am I meant to load into core data a whole graph of objects (tournament and its constituent parts) that are returned from a function, One at a time. Just like you did with Players. Do the same with all the Tables, all the Tournaments, etc. You need to convert all these regular objects into managed objects. and where should I be putting the code? wherever it feels good, probably after you read the file. As long as it's running on the main thread. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com