capture console output
Hi all, I'd like to be able to capture the output from console after running a command. My Googling investigations have lead me to using 'popen'. FILE *file = popen(sqlite3 test.db .tables,r); However, I've not been able to read the information from the returned file. I know there are other ways of getting the sqlite information, but I just want to know how to read outputs from console, for my own interest. Cheers, Billy Flatman b.flat...@googlemail.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: capture console output
FILE *file = popen(sqlite3 test.db .tables,r); However, I've not been able to read the information from the returned file. What exactly isn't working? Maybe this helps: NSString *fullPathToDatabase = @/Users/dave/test.db; NSTask *sqliteTask = [[NSTask alloc] init]; NSPipe *readPipe = [NSPipe pipe]; [sqliteTask setLaunchPath: @/usr/bin/sqlite3]; [sqliteTask setArguments: [NSArray arrayWithObjects: fullPathToDatabase, @.tables, nil]]; [sqliteTask setStandardOutput: readPipe]; [sqliteTask launch]; NSLog(@sqlite wisdom: %@, [[[NSString alloc] initWithData: [[readPipe fileHandleForReading] readDataToEndOfFile] encoding: NSUTF8StringEncoding] 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: capture console output
Hi Dave, Thanks for that, just what I was looking for. Cheers, Billy. On 22 Apr 2010, at 11:04, Dave Keck wrote: FILE *file = popen(sqlite3 test.db .tables,r); However, I've not been able to read the information from the returned file. What exactly isn't working? Maybe this helps: NSString *fullPathToDatabase = @/Users/dave/test.db; NSTask *sqliteTask = [[NSTask alloc] init]; NSPipe *readPipe = [NSPipe pipe]; [sqliteTask setLaunchPath: @/usr/bin/sqlite3]; [sqliteTask setArguments: [NSArray arrayWithObjects: fullPathToDatabase, @.tables, nil]]; [sqliteTask setStandardOutput: readPipe]; [sqliteTask launch]; NSLog(@sqlite wisdom: %@, [[[NSString alloc] initWithData: [[readPipe fileHandleForReading] readDataToEndOfFile] encoding: NSUTF8StringEncoding] autorelease]); Billy Flatman b.flat...@googlemail.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: Determining preferred localizations
At 12:02 -0700 21/04/10, cocoa-dev-requ...@lists.apple.com wrote: From: Gregory Weston gwes...@mac.com Date: Wed, 21 Apr 2010 09:59:48 -0400 Message-ID: a977463a-b8f0-4b24-9284-03012bee3...@mac.com I'm trying to display a localized list of attached displays, and getting unexpected results in Carbon and Cocoa when attempting to determine the best localization. I did all the obvious-to-me Google searches without finding much except a couple of other people over the years having similar issues and no real resolution. Sample code and results follow. Hoping someone can point me in the right direction. ... - (NSString*)bestLocalization:(NSArray*)inChoices { NSUserDefaults* theDefaults = [NSUserDefaults standardUserDefaults]; NSArray* theUserSettings = [theDefaults objectForKey:@AppleLanguages]; NSLog(@User Settings: %@, theUserSettings); NSLog(@Choices: %@, inChoices); NSArray* theBestOnes = [NSBundle preferredLocalizationsFromArray:inChoices]; NSLog(@Chose: %@, theBestOnes); return [theBestOnes objectAtIndex:0]; } I can't double-check this right now, but I solved a similar problem this way: NSArray* inChoices = [[NSBundle mainBundle] localizations]; // probably that's what you're passing in? NSArray* theBestOnes = [NSBundle preferredLocalizationsFromArray:inChoices forPreferences:[NSLocale preferredLanguages]]; HTH, -- Rainer Brockerhoff rai...@brockerhoff.net Belo Horizonte, Brazil In the affairs of others even fools are wise In their own business even sages err. Weblog: http://www.brockerhoff.net/bb/viewtopic.php ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Determining preferred localizations
On Apr 22, 2010, at 7:50 AM, Rainer Brockerhoff wrote: At 12:02 -0700 21/04/10, cocoa-dev-requ...@lists.apple.com wrote: From: Gregory Weston gwes...@mac.com Date: Wed, 21 Apr 2010 09:59:48 -0400 Message-ID: a977463a-b8f0-4b24-9284-03012bee3...@mac.com I'm trying to display a localized list of attached displays, and getting unexpected results in Carbon and Cocoa when attempting to determine the best localization. I did all the obvious-to-me Google searches without finding much except a couple of other people over the years having similar issues and no real resolution. Sample code and results follow. Hoping someone can point me in the right direction. ... - (NSString*)bestLocalization:(NSArray*)inChoices { NSUserDefaults* theDefaults = [NSUserDefaults standardUserDefaults]; NSArray* theUserSettings = [theDefaults objectForKey:@AppleLanguages]; NSLog(@User Settings: %@, theUserSettings); NSLog(@Choices: %@, inChoices); NSArray* theBestOnes = [NSBundle preferredLocalizationsFromArray:inChoices]; NSLog(@Chose: %@, theBestOnes); return [theBestOnes objectAtIndex:0]; } I can't double-check this right now, but I solved a similar problem this way: NSArray* inChoices = [[NSBundle mainBundle] localizations]; // probably that's what you're passing in? NSArray* theBestOnes = [NSBundle preferredLocalizationsFromArray:inChoices forPreferences:[NSLocale preferredLanguages]]; Thanks, but no. What I'm passing in is the keys for the dictionary I get as a result of this code: io_connect_t thePort = CGDisplayIOServicePort(theScreenNumber); CFDictionaryRef theInfo = (CFDictionaryRef)IODisplayCreateInfoDictionary(thePort, 0); CFDictionaryRef theNames = CFDictionaryGetValue(theInfo, CFSTR(kDisplayProductName)); theNames will look something like this: en_US - Color LCD en_GB - Colour LCD fr_FR - LCD couleur My workaround for the moment is to use NSLocale's currentLocale method, and if I don't find a key matching that I'll loop over the preferred language list until I find a key that has the language under consideration as a prefix. Problem is that seems needlessly convoluted and if I do end up with a dictionary that has multiple locales for the same language I'll essentially be picking among them at random. As I'm typing I've realized that the rest of the system uses the language list in preference to the current locale, though, so I have to fix that anyway. Greg ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NaN Problem Adding Numbers from NSTableView
On Apr 21, 2010, at 7:24 PM, Graham Cox wrote: On 22/04/2010, at 12:53 AM, Philip Juel Borges wrote: But some times I need to leave a tableview cell blank and then it writes NaN in the label. If I type in 0 (zero) it adds up the numbers nicely. But I'd rather just leave the selection empty rather than typing in a zero. Any ideas how to solve the NaN issue? Add a formatter to the cell and set the 'NaN symbol' to 0. You can do this in IB. I wouldn't think that the formatter would effect the calculation of a key path operator, which is the OP's main issue as I understan...@sum is choking on NaN... Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NaN Problem Adding Numbers from NSTableView
On 23/04/2010, at 12:47 AM, Keary Suska wrote: I wouldn't think that the formatter would effect the calculation of a key path operator, which is the OP's main issue as I understan...@sum is choking on NaN... Yep, I was thinking that by setting the NaN symbol it would prevent the cell from putting out a NaN value, but of course it works the other way around. It's odd though, surely any non-parsable string in the cell returns 0 for -stringValue? It could still be an effect of the formatter - it might be converting strings to NaN by some internal logic of its own. If so, a subclass that converts in another fashion would be the way to do 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
NSURLConnection Crashes : Mac OS 10.6.3 Edition! (Was: Async NSURLConnection...)
On 2010 Apr 19, at 21:55, Jeff Johnson wrote: I don't know about the FTP crash, but I believe that the other two crashes are due to a 10.6.3 regression. I've filed rdar://problem/7816615 I can definitely reproduce Jeff's crashes, and tried to isolate factors and relate to my apps, but this is a real bugger. In case anyone else finds themself crashing into the NSURLConnection Mac OS 10.6.3 Community, after you've tried Jeff's demos mentioned in the previous post, here's some more: My Demo Project: http://sheepsystems.com/engineering/NSURLConnectionCrash2010.zip Apple Problem ID: 7893849 Title: NSURLConnection Crashes : Mac OS 10.6.3 Edition! Summary: Back in 2005 there were several reports in cocoa-dev@lists.apple.com of NSURLConnection crashing in Mac OS X 10.4. For example see my Problem ID 4347324. Crashes occur when many NSURLConnections are open. Similar problems seem to have returned in Mac OS X 10.6.3. See Jeff Johnson's Problem ID 7816615. I spent most of yesterday in Apple's Cupertino lab trying to further refine Jeff's result and also see how it was related to crash reports I had received from two users of my applications. Unfortunately, I didn't get very far. Jeff and I may in fact be dealing with separate issues. Jeff's demo apps [1] open 194 connections simultaneously. Granted: That's not a good idea to do in real life. But my apps, with which my two users reported crashes, limit themselves to 16 open connections. The demo app which I have attached to this project allows the user to set the limit. Jeff's demo app gets 97 URLs by screen-scraping a videos web page of a member of the U.S. House of Representatives, and opening two connections for each of them. Attempting better control, my demo app reads these 97 URLs, plus the ~1200 URLs I received from my two users, from a file. One reason I say I didn't get very far is that even with this control I was unable to isolate the factors which cause the trouble or even reproduce the crashes. Using the URL arrays provided by my users, and using the same type of Macs at the lab, I was unable to reproduce the crashes (20 runs, 0 crashes). The users report crashing more often than not. One possible difference is the type of internet connection. I presume that my users have cable or DSL broadband service which is subject to traffic shaping as explained in Environment, below. No such traffic shaping is apparent in the Cupertino lab. Another reason I didn't get very far is that the only factor I was able to isolate was using the Instruments' Threads performance tool. This definitely causes the app to crash. More logging (NSLog) also seems to be inhibit crashes. Possibly Jeff's demo apps crash more consistently because they do very little logging. I hope to do some more work on this, but am submitting now in hopes that it may stimulate some action at Apple. Hoping for 10.6.4 :)) [1] Jeff has actually made two demo apps. The demo app submitted with Problem ID 7816615 uses the asynchronous NSURLConnection methods. The code given in the third post by 'lapcat' in this thread: https://rentzsch.lighthouseapp.com/projects/24342/tickets/615-crash-at-httpwwwpingreehousegovlegisappropriations uses the synchronous method -[NSString stringWithContentsOfURL:usedEncoding:error:] in threads created by -[[NSThread detachNewThreadSelector:toTarget]. The demo app I've attached to this problem allows the user to select either. Steps to Reproduce: Environment. The following results are reproducible on my Early 2006 Intel Core Duo Mac Mini, Mac OS X 10.6.3, Earthlink residential DSL service. I mention the latter because Earthlink residential DSL service obviously applies a traffic-shaping policy, which is to drop all packets for a minute or so, after a minute or so of rapidly visiting different servers. This Earthlink policy may be a factor in obtaining the results, just as Instruments' Threads tool. 1. Open in Xcode 3.2.1 2. Run Run with Performance Tool Threads 3. When window opens, leave default settings (Threaded, 16, loggingLevel=0) 4. Click Start Test 5. Watch progress in Console.app. Expected Result: No crash Actual Result: About 80% of the time, after a few seconds, one of the secondary threads will crash with a call stack very similar to that you get when running Jeff Johnson's demo app in Problem ID 7816615. See EXAMPLE CRASH below. If it does not crash, let it run for 70 seconds or so, until All NSURLConnection Threads have completed logs to console. (Laggard connections will time out after 60 seconds.) Then Start Test again. However, I've found that if it doesn't crash in the first few seconds after beginning the first test after application launch, it's not going to crash. Subsequent Start Test runs in the same application launch never crash. Variation: If instead of Run Run with Performance Tool Threads you click Build Build and Debug -
App is in Landscape Mode, but main UIWindow still th inks it’s portrait.
My App runs in landscape mode and I have been converting a CGPoint to the main UIWindow's co-ordinate system. I decided to check this was working all correctly by adding a couple of NSLog's to return the Co-Ordinates before and after it was converted and what I noticed was that before it was converted the Co-Ordinates were correct for Landscape mode but after conversion to the UIWindow's co-ordinate system the co-ordinates changed as if the iPhone was in portrait mode. Code and Debugger results are as follows. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft]; return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; currentTouch = [touch locationInView:self.view]; NSLog(@User tapped at %@, NSStringFromCGPoint(currentTouch)); CGPoint CPT = [self.view convertPoint:currentTouch toView:nil]; NSLog(@User tapped at %@, NSStringFromCGPoint(CPT)); } Debugger: 2010-04-21 16:39:35.199 InSight[31366:207] User tapped at {418, -6} 2010-04-21 16:39:35.200 InSight[31366:207] Point 0x1.a2p+8, -0x1.8p+2 2010-04-21 16:39:35.201 InSight[31366:207] Point 0x1.a2fffap-1034, -0x1.8p+2 2010-04-21 16:39:35.202 InSight[31366:207] Point 418, -6 2010-04-21 16:39:35.204 InSight[31366:207] User tapped at {38, 24} In my plist I also have this. Initial interface orientation |Landscape (left home button) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Simple question
Hello list, Im quite new, and probably missing something. I want to do a calculation of three fields inside of a entity in CoreData. Below is the code, what is wrong? NSNumber *fieldOne = [managedObject valueForKey:@key1]; NSNumber *fieldTwo = [managedObject valueForKey:@key2]; NSNumber *fieldThree = [managedObject valueForKey:@key3]; if (fieldTwo 0) { NSNumber *answer = ((fieldTwo - fieldOne) + fieldThree); [self.managedObject setValue:[answer intValue] forKey:@key4]; } If I debug the right values are being shown in the fieldOne, fieldTwo and fieldThree. But the calculation answer is all the time out of scope. What am I missing? hope someone can help... Arnold Nefkens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Simple question
On 23/04/2010, at 1:36 AM, Arnold Nefkens wrote: NSNumber *fieldOne = [managedObject valueForKey:@key1]; NSNumber *fieldTwo = [managedObject valueForKey:@key2]; NSNumber *fieldThree = [managedObject valueForKey:@key3]; if (fieldTwo 0) { NSNumber *answer = ((fieldTwo - fieldOne) + fieldThree); [self.managedObject setValue:[answer intValue] forKey:@key4]; } If I debug the right values are being shown in the fieldOne, fieldTwo and fieldThree. But the calculation answer is all the time out of scope. What am I missing? NSNumbers are objects that CONTAIN the value to be added, subtracted, etc. They cannot be added or subtracted directly. You need to extract the value in the form you want it using methods such as -floatValue, -intValue and so on before doing calculations. Unfortunately perhaps, Obj-C does not allow operator overloading to allow direct use of objects in math expressions. --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: Simple question
Try this: NSNumber *fieldOne = [managedObject valueForKey:@key1]; NSNumber *fieldTwo = [managedObject valueForKey:@key2]; NSNumber *fieldThree = [managedObject valueForKey:@key3]; NSNumber *answer; if (fieldTwo 0) { answer = ((fieldTwo - fieldOne) + fieldThree); [self.managedObject setValue:[answer intValue] forKey:@key4]; } -koko ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: [NSWindow title] isn't the title
Hi, you can use lastPathComponent on the string you received by title and use that as the title for the other window. Am 22.04.2010 um 07:05 schrieb Quincey Morris: This is more of a curiosity than anything else, but ... I have a (non-document) window whose title is set with 'setTitleWithRepresentedFilename:'. The title actually shown in the title bar is the last path component of the file path, as expected. I have an associated window whose title I'd like to be of the form base window title — Info. However when I try to build this from the base window's displayed title, I actually get a string with the file name and the path to the file, so I end up with something of the form base window title — long path to the file — Info, which isn't really what I want. The -[NSWindow title] documents this behavior (If the title has been set using setTitleWithRepresentedFilename:, this method returns the file’s path.), but that leaves no way to get the actual displayed title. Does anyone know of a way to get the actual displayed title? Note: 1. As a work around, I am building the associated window title from the base window's 'miniwindowTitle', but there's no guarantee I can see that ensures (in the future) this will be what's displayed in the actual title bar of the base window. 2. In the past, I've used [NSWindowController windowTitleForDocumentDisplayName:] for this purpose, but that doesn't work in this case, since there's no actual document. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/macmeideln%40googlemail.com This email sent to macmeid...@googlemail.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: Simple question
On 23/04/2010, at 1:59 AM, k...@highrolls.net wrote: Try this: Looks equally incorrect to me. The problem is that NSNumbers are not NUMBERS. --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 is in Landscape Mode, but main UIWi ndow still thinks it’s portrait.
On Apr 22, 2010, at 8:35 AM, Joshua Garnham wrote: My App runs in landscape mode and I have been converting a CGPoint to the main UIWindow's co-ordinate system. Why? There should generally be no need to convert to the window's coordinate system. UIWindow's co-ordinate system the co-ordinates changed as if the iPhone was in portrait mode. Thats because the window itself doesn't actually change coordinate systems, it applies a transform to its subviews that changes their coordinate system. Code and Debugger results are as follows. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft]; return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); } Also note that you should not be changing the status bar orientation here. It is sufficient to simply return YES for the orientations that you want (assuming that you've done everything else correctly). -- 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: Simple question
Ok. I was just putting answer in a broader scope as the OP indicated that was the problem. I see I must look into NSNumber ... Thx ! -koko On Apr 22, 2010, at 10:11 AM, Graham Cox wrote: On 23/04/2010, at 1:59 AM, k...@highrolls.net wrote: Try this: Looks equally incorrect to me. The problem is that NSNumbers are not NUMBERS. --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: Problem with CoreAnimation and OpenGL drawing from a safari plugin
On Apr 22, 2010, at 4:46 AM, varaha murthy wrote: I have a Safari out of process plugin which draws some 3d content using CAOpenGLLayer provided by Sfari by overriding darwInCglContext(). Inside darwInCglContext(), I draw content using opengl and call 'glFlush'(tried CGLFlushDrawable too) multiple times to generate a short-living custom animation. Yes, this won't work because you are actually rendering to an offscreen. Even if you were rendering on-screen, it would have been likely that you would miss many if not most of the frames of your animation doing this. Instead you use the timing information provided to you by -drawInCGLContext: to drive your animation. An exceptionally simple version of this is demonstrated in the CALayerEssentials sample's example CAOpenGLLayer. -- 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: NaN Problem Adding Numbers from NSTableView
On Apr 22, 2010, at 9:06 AM, Graham Cox wrote: On 23/04/2010, at 12:47 AM, Keary Suska wrote: I wouldn't think that the formatter would effect the calculation of a key path operator, which is the OP's main issue as I understan...@sum is choking on NaN... Yep, I was thinking that by setting the NaN symbol it would prevent the cell from putting out a NaN value, but of course it works the other way around. It's odd though, surely any non-parsable string in the cell returns 0 for -stringValue? It could still be an effect of the formatter - it might be converting strings to NaN by some internal logic of its own. If so, a subclass that converts in another fashion would be the way to do it. I suspect that the array controller is returning NaN for a nil value, and IIRC NaN + anything is NaN, which I think is the OP's problem. I don't think the OP can avoid interpreting nil as 0. Implementing a special-case pseudo-accessor that returns 0 for nil for use in such calculations may not be too atrocious a solution, and would still allow for blank cells in the UI. Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Simple question
Hi, correct me if I'm wrong, but what you're doing is a calculation with the pointers ( * of NSNumber) not the values. You have to calculate it like this: NSInteger fieldOne = [ [ managedObject valueForKey:@key1] intValue]; // if it's an integer NSInteger fieldTwo = [ [ managedObject valueForKey:@key2] intValue]; NSInteger fieldThree = [ [ managedObject valueForKey:@key3] intValue]; if ( fieldTwo 0 ) { NSNumber *answer = [ NSNumber numberWithInt:fieldTwo - fieldOne + fieldThree]; [ self.managedObject setValue:answer forKey:@key4]; // maybe you need to this instead [ self.managedObject setValue:[ answer stringValue] forKey:@key4]; } Don't know if intValue in this context works, if not then use this alternative, which must work in any way: Your code and change the following lines: NSNumber *answer = [ NSNumber numberWithInt: [fieldTwo intValue] - [fieldOne intValue] + [fieldThree intValue] ]; [ self.managedObject setValue:answer forKey:@key4]; //or [ self.managedObject setValue:[ answer stringValue] forKey:@key4]; //stringValue to present it in a textfield Hope that helped... MacMeideln Am 22.04.2010 um 17:36 schrieb Arnold Nefkens: Hello list, Im quite new, and probably missing something. I want to do a calculation of three fields inside of a entity in CoreData. Below is the code, what is wrong? NSNumber *fieldOne = [managedObject valueForKey:@key1]; NSNumber *fieldTwo = [managedObject valueForKey:@key2]; NSNumber *fieldThree = [managedObject valueForKey:@key3]; if (fieldTwo 0) { NSNumber *answer = ((fieldTwo - fieldOne) + fieldThree); [self.managedObject setValue:[answer intValue] forKey:@key4]; } If I debug the right values are being shown in the fieldOne, fieldTwo and fieldThree. But the calculation answer is all the time out of scope. What am I missing? hope someone can help... Arnold Nefkens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/macmeideln%40googlemail.com This email sent to macmeid...@googlemail.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: Determining preferred localizations
Le 22 avr. 2010 à 18:19, cocoa-dev-requ...@lists.apple.com a écrit : Thanks, but no. What I'm passing in is the keys for the dictionary I get as a result of this code: io_connect_t thePort = CGDisplayIOServicePort(theScreenNumber); CFDictionaryRef theInfo = (CFDictionaryRef)IODisplayCreateInfoDictionary(thePort, 0); CFDictionaryRef theNames = CFDictionaryGetValue(theInfo, CFSTR(kDisplayProductName)); theNames will look something like this: en_US - Color LCD en_GB - Colour LCD fr_FR - LCD couleur Did you check what Apple themselves do within IODisplayLib.c (IOKitUser / graphics.subproj) ? http://www.opensource.apple.com/source/IOKitUser/IOKitUser-514.8.1/graphics.subproj/IODisplayLib.c Check the function named GenerateProductName... Of course, it's all plain CoreFoundation, but for me it works (or I didn't see the problem you are seeing and I missed your point) -- Stephane ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 is in Landscape Mode, but main UIWindow st ill thinks it’s portrait.
The reason I have been doing it is because of a problem I have been having with moving a View. Maybe you could help me with that? The View is supposed to move as my touch moves but the view seems to flicker between to places, as you can see here. And this is the code I have been using. -- Joshua Garnham From: David Duncan david.dun...@apple.com To: Joshua Garnham joshua.garn...@yahoo.co.uk Cc: cocoa-dev@lists.apple.com Sent: Thu, 22 April, 2010 17:12:08 Subject: Re: App is in Landscape Mode, but main UIWindow still thinks it’s portrait. On Apr 22, 2010, at 8:35 AM, Joshua Garnham wrote: My App runs in landscape mode and I have been converting a CGPoint to the main UIWindow's co-ordinate system. Why? There should generally be no need to convert to the window's coordinate system. UIWindow's co-ordinate system the co-ordinates changed as if the iPhone was in portrait mode. Thats because the window itself doesn't actually change coordinate systems, it applies a transform to its subviews that changes their coordinate system. Code and Debugger results are as follows. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft]; return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); } Also note that you should not be changing the status bar orientation here. It is sufficient to simply return YES for the orientations that you want (assuming that you've done everything else correctly). -- 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: NSURLConnection Crashes : Mac OS 10.6.3 Edition! (Was: Async NSURLConnection...)
Instruments adds some extra safeguarding to some of their tools, so you should whittle down your functionality until you know this-or-that code will cause or not cause the crash, depending on inclusion. It's possible what you're seeing is a side-effect that is set up elsewhere and dies in a different place. Crashers typically are easier to track down, but some do require lots of detective work. On 04/22/2010 8:20 AM, Jerry Krinock je...@ieee.org wrote: Another reason I didn't get very far is that the only factor I was able to isolate was using the Instruments' Threads performance tool. This definitely causes the app to crash. More logging (NSLog) also seems to be inhibit crashes. Possibly Jeff's demo apps crash more consistently because they do very little logging. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSTableView delete row with key?
On Wed, 21 Apr 2010 00:15:44 -0700, Chris Idou said: What would be the appropriate way to have an NSTableView notice that you hit the delete key and delete the current row? My preferred solution is the following: - subclass NSTableView - add the following outlet: IBOutlet NSControl* deleteControl; - connect the tableview's deleteControl outlet to the push button that also performs delete (you should have such a button so that deleteability is discoverable) - add the following code. This way, pressing the delete key will blink the delete button and perform the same action as that button. - (void)deleteSelection { // Simulate a mouse click in the control. The control is expected to perform some kind of delete function. [deleteControl performClick:self]; } - (void)deleteBackward:(id)inSender { [self deleteSelection]; } - (void)deleteForward:(id)inSender { [self deleteSelection]; } - (void)keyDown:(NSEvent*)event { BOOL deleteKeyEvent = NO; // Check if the event was a keypress that matches either the backward or forward delete key. if ([event type] == NSKeyDown) { NSString* pressedChars = [event characters]; if ([pressedChars length] == 1) { unichar pressedUnichar = [pressedChars characterAtIndex:0]; // Test the key that was pressed. Note that this does not work with custom key bindings. Ideally, NSTableView should support the delete keys itself rdar://6305317. if ( (pressedUnichar == NSDeleteCharacter) || (pressedUnichar == NSDeleteFunctionKey) ) { deleteKeyEvent = YES; // Additionally, it would be ideal to be able to check if 'type select' is in progress and if so not treat this as a delete. The user may expect the delete key to delete the last keypress of this type select sequence. Type select does not work that way, but he might expect it nonetheless, and we shouldn't delete his data in this case. No such API exists: rdar://6305086. } } } // If it was a delete key, handle the event specially, otherwise call super. In general, we want super to handle most keypresses since it handles arrow keys, home, end, page up, page down, and type select. if (deleteKeyEvent) { // This will end up calling deleteBackward: or deleteForward:. [self interpretKeyEvents:[NSArray arrayWithObject:event]]; } else { [super keyDown:event]; } } Thanks to Corbin Dunn for 90% of this solution! -- 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: Simple question
On 22 Apr 2010, at 17:09, Graham Cox wrote: On 23/04/2010, at 1:59 AM, k...@highrolls.net wrote: Try this: Looks equally incorrect to me. The problem is that NSNumbers are not NUMBERS. If the OP has prior experience with c++ and operator overloading then their confusion might be somewhat explained. NSDecimalNumber includes arithmetic methods but you get nothing like c++'s operator convenience. Regards Jonathan Mitchell Developer http://www.mugginsoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Simple question
Hi Thanks Yeah the keys are ints and this helps a lot. Thanks again... On 22 apr 2010, at 18:31, Reinhard Segeler wrote: Hi, correct me if I'm wrong, but what you're doing is a calculation with the pointers ( * of NSNumber) not the values. You have to calculate it like this: NSInteger fieldOne= [ [ managedObject valueForKey:@key1] intValue]; // if it's an integer NSInteger fieldTwo = [ [ managedObject valueForKey:@key2] intValue]; NSInteger fieldThree = [ [ managedObject valueForKey:@key3] intValue]; if ( fieldTwo 0 ) { NSNumber *answer = [ NSNumber numberWithInt:fieldTwo - fieldOne + fieldThree]; [ self.managedObject setValue:answer forKey:@key4]; // maybe you need to this instead [ self.managedObject setValue:[ answer stringValue] forKey:@key4]; } Don't know if intValue in this context works, if not then use this alternative, which must work in any way: Your code and change the following lines: NSNumber *answer = [ NSNumber numberWithInt: [fieldTwo intValue] - [fieldOne intValue] + [fieldThree intValue] ]; [ self.managedObject setValue:answer forKey:@key4]; //or [ self.managedObject setValue:[ answer stringValue] forKey:@key4]; //stringValue to present it in a textfield Hope that helped... MacMeideln Am 22.04.2010 um 17:36 schrieb Arnold Nefkens: Hello list, Im quite new, and probably missing something. I want to do a calculation of three fields inside of a entity in CoreData. Below is the code, what is wrong? NSNumber *fieldOne = [managedObject valueForKey:@key1]; NSNumber *fieldTwo = [managedObject valueForKey:@key2]; NSNumber *fieldThree = [managedObject valueForKey:@key3]; if (fieldTwo 0) { NSNumber *answer = ((fieldTwo - fieldOne) + fieldThree); [self.managedObject setValue:[answer intValue] forKey:@key4]; } If I debug the right values are being shown in the fieldOne, fieldTwo and fieldThree. But the calculation answer is all the time out of scope. What am I missing? hope someone can help... Arnold Nefkens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/macmeideln%40googlemail.com This email sent to macmeid...@googlemail.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: Simple question
This is an interesting exercise! I would extract the values of the fields, manipulate them, then assign the contents of Field4 with the answer: int val1 = [managedObject valueForKey:@key1] // etc. for each user entry field1-3 int val4 = val1 + etc. // equation with final assignment to value4 (not actual managed object) [managedObject valueForKey:@key4 setValue:[NSNumber numberWithInt:val4] // final assigning of val4 to managed Object field4 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Simple question
You should really use 'integerValue' rather than 'intValue' if you're otherwise using NSIntegers. 'integerValue' will return an NSInteger (which may be 32 or 64 bits wide depending on your platform), but 'intValue' will return a C 'int' (which is always 32 bit on the Mac and iPhone, regardless of the 'natural' bit width of the platform). Jamie. On 22 Apr 2010, at 18:21, Arnold Nefkens wrote: Hi Thanks Yeah the keys are ints and this helps a lot. Thanks again... On 22 apr 2010, at 18:31, Reinhard Segeler wrote: Hi, correct me if I'm wrong, but what you're doing is a calculation with the pointers ( * of NSNumber) not the values. You have to calculate it like this: NSInteger fieldOne= [ [ managedObject valueForKey:@key1] intValue]; // if it's an integer NSInteger fieldTwo = [ [ managedObject valueForKey:@key2] intValue]; NSInteger fieldThree = [ [ managedObject valueForKey:@key3] intValue]; if ( fieldTwo 0 ) { NSNumber *answer = [ NSNumber numberWithInt:fieldTwo - fieldOne + fieldThree]; [ self.managedObject setValue:answer forKey:@key4]; // maybe you need to this instead [ self.managedObject setValue:[ answer stringValue] forKey:@key4]; } Don't know if intValue in this context works, if not then use this alternative, which must work in any way: Your code and change the following lines: NSNumber *answer = [ NSNumber numberWithInt: [fieldTwo intValue] - [fieldOne intValue] + [fieldThree intValue] ]; [ self.managedObject setValue:answer forKey:@key4]; //or [ self.managedObject setValue:[ answer stringValue] forKey:@key4]; //stringValue to present it in a textfield Hope that helped... MacMeideln Am 22.04.2010 um 17:36 schrieb Arnold Nefkens: Hello list, Im quite new, and probably missing something. I want to do a calculation of three fields inside of a entity in CoreData. Below is the code, what is wrong? NSNumber *fieldOne = [managedObject valueForKey:@key1]; NSNumber *fieldTwo = [managedObject valueForKey:@key2]; NSNumber *fieldThree = [managedObject valueForKey:@key3]; if (fieldTwo 0) { NSNumber *answer = ((fieldTwo - fieldOne) + fieldThree); [self.managedObject setValue:[answer intValue] forKey:@key4]; } If I debug the right values are being shown in the fieldOne, fieldTwo and fieldThree. But the calculation answer is all the time out of scope. What am I missing? hope someone can help... Arnold Nefkens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/macmeideln%40googlemail.com This email sent to macmeid...@googlemail.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/jamie%40montgomerie.net This email sent to ja...@montgomerie.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
Re: Simple question
On Apr 22, 2010, at 10:21, Arnold Nefkens wrote: Yeah the keys are ints and this helps a lot. Thanks again... On 22 apr 2010, at 18:31, Reinhard Segeler wrote: Hi, correct me if I'm wrong, but what you're doing is a calculation with the pointers ( * of NSNumber) not the values. You have to calculate it like this: NSInteger fieldOne = [ [ managedObject valueForKey:@key1] intValue]; // if it's an integer A minor correction. This should either be: int fieldOne = [ [ managedObject valueForKey:@key1] intValue]; or: NSInteger fieldOne = [ [ managedObject valueForKey:@key1] integerValue]; Otherwise the code is not quite portable between 32- and 64-bit architectures. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSOperation and WebView
On Tue, Apr 20, 2010 at 10:14 AM, Nick Zitzmann n...@chronosnet.com wrote: On Apr 18, 2010, at 4:36 PM, Hao Lü wrote: I am doing some analyzing work on a WebView (going through the DOM, checking links and texts). Since, sometimes this blocks the GUI, I am experimenting using NSOperation/NSInvocationOperation. What confuses me is that, my operation stops (not sure if it sleeps or is terminated) upon accessing the DOMDocument. There is no message shown in the console. Any clues? WebKit is not thread-safe, and a lot of WebKit classes will even throw exceptions if you try creating or accessing them in background threads. So what you observed doesn't surprise me too much... I did not see such exceptions been thrown, nor any crash Of course, if you really want to know what's going on, then you can try downloading the WebKit source from http://webkit.org/ and building your application against an open-source build of WebKit rather than the system's build. Doubt it. I am using a secondary hidden webView dedicated to the background thread. I was not sure if @synchronized would help, so I added anyway upon each access. But it did not make a difference. I feel that if it was caused by things related to thread-safe, linking a seperate WebKit might not help. - Hao 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: NSOperation and WebView
On Apr 22, 2010, at 12:09 PM, Hao Lü wrote: Doubt it. I am using a secondary hidden webView dedicated to the background thread. I was not sure if @synchronized would help, so I added anyway upon each access. But it did not make a difference. I feel that if it was caused by things related to thread-safe, linking a seperate WebKit might not help. No, but it would allow you to see what is really going on inside the debugger. That's much easier to do when you have the source code. 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: NSOperation and WebView
On Thu, Apr 22, 2010 at 11:09 AM, Hao Lü ryan@gmail.com wrote: I did not see such exceptions been thrown, nor any crash Those are two possible responses the code could have. It could also just abort the thread, or perhaps act errantly because data it expects is not the data it has, by virtue of being on a separate thread (accessing thread-local storage assuming you're always on the main thread would be a good example). Doubt it. I am using a secondary hidden webView dedicated to the background thread. I was not sure if @synchronized would help, so I added anyway upon each access. But it did not make a difference. I feel that if it was caused by things related to thread-safe, linking a seperate WebKit might not help. The suggestion was to download the WebKit source and build it so you could trace through it with the debugger to see what actually happened inside WebKit. If your idea of fixing thread safety is to throw in @synchronized because you're unsure if it could help, you will not be able to fix your threading problems. To start, @synchronized doesn't change the current thread of execution. --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: NSOperation and WebView
That's true. - Hao On Apr 22, 2010, at 11:11 AM, Nick Zitzmann n...@chronosnet.com wrote: On Apr 22, 2010, at 12:09 PM, Hao Lü wrote: Doubt it. I am using a secondary hidden webView dedicated to the background thread. I was not sure if @synchronized would help, so I added anyway upon each access. But it did not make a difference. I feel that if it was caused by things related to thread-safe, linking a seperate WebKit might not help. No, but it would allow you to see what is really going on inside the debugger. That's much easier to do when you have the source code. 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
Can't set a cursor on a programmatically created window
Hi, So, I'm programmatically creating a subwindow: self=[super initWithContentRect:rect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; attaching a view... MyView* cView=[[[PlayBarView alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)] autorelease]; [self setContentView:cView]; and then bringing it live... [[parent window] addChildWindow:self ordered:NSWindowAbove]; [self makeKeyAndOrderFront:self]; I'm asking it to change it's cursor... [self invalidateCursorRectsForView:[self contentView]]; And was expecting my implementation of resetCursorRects to be called on MyView but it's not. I've called 'areCursorRectsEnabled' on the subwindow and it returns YES. I also have lots of very similar code running in other views for the parent window (which is a 'traditional' IB created window) with no problems at all. Any pointers towards a cause (or solution) are much appreciated. TIA, 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
using grand central dispatch and c++ for inter-thread communication
Here's my write-up on using GCD with C++ for inter-thread communication: http://wagerlabs.com/grand-central-dispatch-c-and-inter-thread-com I wrote a user land USB driver, put in a framework and made the framework start the driver thread upon initialization. I then proceeded to use Grand Central Dispatch to have the driver run read, write, etc. I'm using CFRunLoop but I don't think that's an absolute necessity. Please let me know what you think! Thanks, Joel --- http://es.linkedin.com/in/joelreymont http://twitter.com/wagerlabs ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
NSApplicationMain question
hi all, i am converting from carbon to cocoa with NSApplicationMain i need to know how to call some startup code before receiving events and upon quit i need to call some shutdown code are there some docs on this issue? examples? advice? thanks, bill appleton ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Filling edges of NSView-customized NSMenu
Hi all, Does exist any way to fill top and bottom edges of pop-up NSMenu in a specified color? I perform porting of one carbon application to cocoa, to be 64-bit compatible. The problem is that the old application has dark-background menus, and when I tried to do the same thing under cocoa I found that no way exist to do so. I'm able to fill background of place where my NSView is drawn but I can't customize drawing of top and bottom edges/corners and they remain white. /-\ -- this remains white |My NSView 1 | -- here oll ok |My NSView 2 | |My NSView 3 | |My NSView 4 | |.. | \--/ -- here problem again ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Problem with CoreAnimation and OpenGL drawing from a safari plugin
Hi All, I hope I am in the right mailing list. Please point me to the correct one if not. I have a Safari out of process plugin which draws some 3d content using CAOpenGLLayer provided by Sfari by overriding darwInCglContext(). Inside darwInCglContext(), I draw content using opengl and call 'glFlush'(tried CGLFlushDrawable too) multiple times to generate a short-living custom animation. But what I observed is that the flush calls are not actually updating the screen, because of which the custom animation is not showing the effect. I know I can wait for the next darwInCglContext() to be called but thats too late for the very short-living animation I want to achieve. Any idea how I can update the screen immediately after drawing content? J V Murthy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: UIResponder Woes
I have a UIView subclass that overrides UIResponder's touchesMoved: message. I've noticed that when I swipe my finger very quickly across the UIView, my touchesMoved: message only gets called every so often and not constantly getting messaged. Any ideas? Thanks. On Apr 21, 2010, at 3:03 PM, cocoa-dev-requ...@lists.apple.com wrote: Send Cocoa-dev mailing list submissions to cocoa-dev@lists.apple.com To subscribe or unsubscribe via the World Wide Web, visit http://lists.apple.com/mailman/listinfo/cocoa-dev or, via email, send a message with subject or body 'help' to cocoa-dev-requ...@lists.apple.com You can reach the person managing the list at cocoa-dev-ow...@lists.apple.com When replying, please edit your Subject line so it is more specific than Re: Contents of Cocoa-dev digest... Today's Topics: 1. Re: appscript project gives warning with XCODE 3.2.2 (Karl Moskowski) 2. Determining preferred localizations (Gregory Weston) 3. NaN Problem Adding Numbers from NSTableView (Philip Juel Borges) 4. Re: Custom progress bar for QTMovie?? (douglas welton) 5. playing QuickTime movies on iPhone/iPad? (Steve Christensen) 6. Re: Determining preferred localizations (Gary L. Wade) 7. Re: need help getting Apple sample code to compile (David Duncan) 8. Re: using coregraphics with vector art from illustrator (Ross Carter) 9. Re: Why is compiler warning for +setKeys:triggerChangeNotificationsForDependentKey: ?? (Greg Parker) 10. Re: CoreData: updating property of fetched object and refetching (olivier destrebecq) -- Message: 1 Date: Wed, 21 Apr 2010 09:02:06 -0400 From: Karl Moskowski kolpa...@voodooergonomics.com Subject: Re: appscript project gives warning with XCODE 3.2.2 To: cocoa-dev@lists.apple.com Cc: jote...@charter.net Message-ID: d2944e51-f639-4b96-8b0d-e02525b3b...@voodooergonomics.com Content-Type: text/plain; charset=us-ascii On 2010-04-21, at 8:17 AM, John Love wrote: Everything worked just dandy for SourceForge's appscript with XCODE 3.2.1. But, with updating to 3.2.2, it is giving me some grief: For one project, it's giving a warning: ld: warning: directory '/Users/johnlove/Documents/XCode/Calculate Medical/../../../appscript/Appscript Framework Project/build/Debug' following -F not found Being a warning, app still runs and runs impeccably. I thought that maybe the appscript framework needed to be re-built with XCODE 3.2.2 .. but that attempt generates an error: There is no SDK with the name or path '/Developer/SDKs/MacOSX10.4u.sdk'. I can hardly remember Tiger sdk's being on my hard drive. Building with 3.2.1 gives no error. I've seen the same problem with tool-type targets, though only in build configs with the setting Build Active Architecture Only unchecked (e.g., the Release config, in a new Foundation tool project). I first noticed it with Sparkle on 3.2.2 - building the relaunch tool target shows these warnings. It looks like it's a bug in 3.2.2. I filed it (rdar://7872548), in case anyone else wants to jump on the bandwagon. Karl Moskowski kolpa...@voodooergonomics.com Voodoo Ergonomics Inc. http://voodooergonomics.com/ -- next part -- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3692 bytes Desc: not available Url : http://lists.apple.com/pipermail/cocoa-dev/attachments/20100421/50349804/smime.bin -- Message: 2 Date: Wed, 21 Apr 2010 09:59:48 -0400 From: Gregory Weston gwes...@mac.com Subject: Determining preferred localizations To: cocoa-dev Dev cocoa-dev@lists.apple.com Message-ID: a977463a-b8f0-4b24-9284-03012bee3...@mac.com Content-Type: text/plain; charset=us-ascii I'm trying to display a localized list of attached displays, and getting unexpected results in Carbon and Cocoa when attempting to determine the best localization. I did all the obvious-to-me Google searches without finding much except a couple of other people over the years having similar issues and no real resolution. Sample code and results follow. Hoping someone can point me in the right direction. FWIW, I've tried both en and English for both the Info.plist development region and the localized resources folder in the app. Thanks for any help. Greg - (NSString*)bestLocalization:(NSArray*)inChoices { NSUserDefaults* theDefaults = [NSUserDefaults standardUserDefaults]; NSArray* theUserSettings = [theDefaults objectForKey:@AppleLanguages]; NSLog(@User Settings: %@, theUserSettings); NSLog(@Choices: %@, inChoices); NSArray* theBestOnes = [NSBundle preferredLocalizationsFromArray:inChoices]; NSLog(@Chose: %@, theBestOnes); return [theBestOnes objectAtIndex:0]; } Mac mini (Early 2009) 10.6.3 with Dell
Re: NSApplicationMain question
On Wed, Apr 21, 2010 at 3:50 PM, Bill Appleton billapple...@dreamfactory.com wrote: with NSApplicationMain i need to know how to call some startup code before receiving events and upon quit i need to call some shutdown code Can't you do it in main before/after calling NSApplicationMain? --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: NSApplicationMain question
Try the NSApplicationDelegate . On Apr 21, 2010, at 6:50 PM, Bill Appleton wrote: hi all, i am converting from carbon to cocoa with NSApplicationMain i need to know how to call some startup code before receiving events use -applicationWillFinishLaunching and upon quit i need to call some shutdown code use -applicationWillTerminate are there some docs on this issue? examples? advice? http://developer.apple.com/mac/library/documentation/cocoa/reference/NSApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40008592-CH1-DontLinkElementID_2 thanks, bill appleton ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/karthikreddy09%40gmail.com This email sent to karthikredd...@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: Filling edges of NSView-customized NSMenu
On Apr 22, 2010, at 3:33 AM, Yuriy Shevyrov wrote: Hi all, Does exist any way to fill top and bottom edges of pop-up NSMenu in a specified color? I perform porting of one carbon application to cocoa, to be 64-bit compatible. The problem is that the old application has dark-background menus, and when I tried to do the same thing under cocoa I found that no way exist to do so. I'm able to fill background of place where my NSView is drawn but I can't customize drawing of top and bottom edges/corners and they remain white. No, sorry, this isn't possible yet. -Peter___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
setValue:forKey: and to-many relationships
Hi everyone, I'm working with some NSManagedObjects and relationships between them. When my code runs, I generate the appropriate key based on the data that I'm parsing. For non-relationship attributes, I can simply do: [myManagedObject setValue:aValue forKey:key]; My question is about to-many relationships. According to the Key-Value Coding guide, Core Data will generate an addKeyObject: method for me. I was wondering if there was a way I could add an object to this relationship without having to build the selector, kind of like an addObject:forKey: method. Does a method like that exist? (I couldn't see on in the docs) Or do I get to build the selector myself? Thanks, Dave 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: NSApplicationMain question
hi all, thanks for the feedback i wrote a subclass for NSWindow but now i am wondering how usefull that was do i have to subclass NSWindow to get events, or can I use delegates? i'm still a bit confused on the event model thanks, bill On Thu, Apr 22, 2010 at 12:39 PM, Abhinay Kartik Reddyreddy karthikredd...@gmail.com wrote: Try the NSApplicationDelegate . On Apr 21, 2010, at 6:50 PM, Bill Appleton wrote: hi all, i am converting from carbon to cocoa with NSApplicationMain i need to know how to call some startup code before receiving events use -applicationWillFinishLaunching and upon quit i need to call some shutdown code use -applicationWillTerminate are there some docs on this issue? examples? advice? http://developer.apple.com/mac/library/documentation/cocoa/reference/NSApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40008592-CH1-DontLinkElementID_2 thanks, bill appleton ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/karthikreddy09%40gmail.com This email sent to karthikredd...@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: NSApplicationMain question
What evets are you looking for...?? all events in the event loop...?? or soem specific events?? you get key and mouse events inside NSView. If you are looking to capture events at NSWindow or NSApp level override sendevent method - (void) sendEvent:(NSEvent *)cocoaEvent On Apr 22, 2010, at 4:34 PM, Bill Appleton wrote: hi all, thanks for the feedback i wrote a subclass for NSWindow but now i am wondering how usefull that was do i have to subclass NSWindow to get events, or can I use delegates? i'm still a bit confused on the event model thanks, bill On Thu, Apr 22, 2010 at 12:39 PM, Abhinay Kartik Reddyreddy karthikredd...@gmail.com wrote: Try the NSApplicationDelegate . On Apr 21, 2010, at 6:50 PM, Bill Appleton wrote: hi all, i am converting from carbon to cocoa with NSApplicationMain i need to know how to call some startup code before receiving events use -applicationWillFinishLaunching and upon quit i need to call some shutdown code use -applicationWillTerminate are there some docs on this issue? examples? advice? http://developer.apple.com/mac/library/documentation/cocoa/reference/NSApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40008592-CH1-DontLinkElementID_2 thanks, bill appleton ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/karthikreddy09%40gmail.com This email sent to karthikredd...@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: setValue:forKey: and to-many relationships
On Apr 22, 2010, at 2:28 PM, Dave DeLong wrote: I'm working with some NSManagedObjects and relationships between them. When my code runs, I generate the appropriate key based on the data that I'm parsing. For non-relationship attributes, I can simply do: [myManagedObject setValue:aValue forKey:key]; My question is about to-many relationships. According to the Key-Value Coding guide, Core Data will generate an addKeyObject: method for me. I was wondering if there was a way I could add an object to this relationship without having to build the selector, kind of like an addObject:forKey: method. Does a method like that exist? (I couldn't see on in the docs) Or do I get to build the selector myself? -mutableSetValueForKey: Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Can't set a cursor on a programmatically created window
On Wed, 21 Apr 2010 12:12:06 +1200, David Preece said: And was expecting my implementation of resetCursorRects to be called on MyView but it's not. I've called 'areCursorRectsEnabled' on the subwindow and it returns YES. I also have lots of very similar code running in other views for the parent window (which is a 'traditional' IB created window) with no problems at all. Any pointers towards a cause (or solution) are much appreciated. Does it work if you don't use NSBorderlessWindowMask? -- 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: NSApplicationMain question
when you say *you get key and mouse events inside NSView* that is only by subclassing? or can you use a delegate? thx bill On Thu, Apr 22, 2010 at 1:39 PM, Abhinay Kartik Reddyreddy karthikredd...@gmail.com wrote: What evets are you looking for...?? all events in the event loop...?? or soem specific events?? you get key and mouse events inside NSView. If you are looking to capture events at NSWindow or NSApp level override sendevent method - (void) sendEvent:(NSEvent *)cocoaEvent On Apr 22, 2010, at 4:34 PM, Bill Appleton wrote: hi all, thanks for the feedback i wrote a subclass for NSWindow but now i am wondering how usefull that was do i have to subclass NSWindow to get events, or can I use delegates? i'm still a bit confused on the event model thanks, bill On Thu, Apr 22, 2010 at 12:39 PM, Abhinay Kartik Reddyreddy karthikredd...@gmail.com wrote: Try the NSApplicationDelegate . On Apr 21, 2010, at 6:50 PM, Bill Appleton wrote: hi all, i am converting from carbon to cocoa with NSApplicationMain i need to know how to call some startup code before receiving events use -applicationWillFinishLaunching and upon quit i need to call some shutdown code use -applicationWillTerminate are there some docs on this issue? examples? advice? http://developer.apple.com/mac/library/documentation/cocoa/reference/NSApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40008592-CH1-DontLinkElementID_2 thanks, bill appleton ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/karthikreddy09%40gmail.com This email sent to karthikredd...@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: NSApplicationMain question
On Thu, Apr 22, 2010 at 1:34 PM, Bill Appleton billapple...@dreamfactory.com wrote: do i have to subclass NSWindow to get events, or can I use delegates? Subclassing NSWindow is very rare. i'm still a bit confused on the event model Rather than trying to shoehorn your Carbon event model into Cocoa, why not invest some time with the Cocoa documentation? Perhaps try some of the example projects first so you have an understanding of the New World first. --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
Forcing plist preferences file to be saved as text?
Is there any way to force the NSUserDefaults instances to save preferences of an application as a text-only plist file in 10.5 as it does on 10.6? For some reason, that seems to be happening only on 10.5. Thanks! -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://nemesys.dyndns.org Logiciels Nemesys Software laurent.daude...@gmail.com Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Forcing plist preferences file to be saved as text?
Le 22 avr. 2010 à 23:36, Laurent Daudelin a écrit : Is there any way to force the NSUserDefaults instances to save preferences of an application as a text-only plist file in 10.5 as it does on 10.6? For some reason, that seems to be happening only on 10.5. I don't think so. NSUserDefault storage format is an implementation details you shouldn't have to care about. And AFAIK, all preferences are saved as binary property list on both 10.5 and 10.6. Out of curiosity, why would you use the less efficient and larger XML format ? -- 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: Forcing plist preferences file to be saved as text?
Out of curiosity, why would you use the less efficient and larger XML format ? Human-readability I would imagine. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSApplicationMain question
On Thu, Apr 22, 2010 at 1:34 PM, Bill Appleton billapple...@dreamfactory.com wrote: hi all, thanks for the feedback i wrote a subclass for NSWindow but now i am wondering how usefull that was do i have to subclass NSWindow to get events, or can I use delegates? i'm still a bit confused on the event model I suggest a full stop forget your current carbon application for a while and instead learn Cocoa application development. I highly recommend grabbing a copy of Cocoa Programming for Mac OS X [1] and working thru all of the examples, etc. in the book. (other excellent books exist as well but this is the one we use to onboard new developers) Don't waste your time thrashing around. -Shawn [1] http://www.amazon.com/Cocoa-Programming-Mac-OS-3rd/dp/0321503619/ref=bxgy_cc_b_text_a ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Forcing plist preferences file to be saved as text?
On Thu, Apr 22, 2010 at 2:36 PM, Laurent Daudelin laurent.daude...@gmail.com wrote: Is there any way to force the NSUserDefaults instances to save preferences of an application as a text-only plist file in 10.5 as it does on 10.6? For some reason, that seems to be happening only on 10.5. /me points at... http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Reference/ManPages/man1/defaults.1.html ...and... http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Reference/ManPages/man1/plutil.1.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
Re: NSApplicationMain question
hi all, thanks for the great advice for better or worse i am porting a large piece of enterprise software from carbon/windows to cocoa/windows most of the code is platform independent, but i can't make big changes to the overall structure of the program so like step one is to replace WindowRef with NSWindow and watch the carnage ensue thx, bill On Thu, Apr 22, 2010 at 3:18 PM, Shawn Erickson shaw...@gmail.com wrote: On Thu, Apr 22, 2010 at 1:34 PM, Bill Appleton billapple...@dreamfactory.com wrote: hi all, thanks for the feedback i wrote a subclass for NSWindow but now i am wondering how usefull that was do i have to subclass NSWindow to get events, or can I use delegates? i'm still a bit confused on the event model I suggest a full stop forget your current carbon application for a while and instead learn Cocoa application development. I highly recommend grabbing a copy of Cocoa Programming for Mac OS X [1] and working thru all of the examples, etc. in the book. (other excellent books exist as well but this is the one we use to onboard new developers) Don't waste your time thrashing around. -Shawn [1] http://www.amazon.com/Cocoa-Programming-Mac-OS-3rd/dp/0321503619/ref=bxgy_cc_b_text_a ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSApplicationMain question
Before you go any further, i highly recommend purchasing a book as suggested previously. I recommend the book by Hillegass Work through a few samples from the book and you will better understand apples documentation. I'm working the other side ... writing windows code with a mac background. Documentation and examples have been an amazing help for me. jack On Apr 22, 2010, at 6:45 PM, Bill Appleton wrote: hi all, thanks for the great advice for better or worse i am porting a large piece of enterprise software from carbon/windows to cocoa/windows most of the code is platform independent, but i can't make big changes to the overall structure of the program so like step one is to replace WindowRef with NSWindow and watch the carnage ensue thx, bill On Thu, Apr 22, 2010 at 3:18 PM, Shawn Erickson shaw...@gmail.com wrote: On Thu, Apr 22, 2010 at 1:34 PM, Bill Appleton billapple...@dreamfactory.com wrote: hi all, thanks for the feedback i wrote a subclass for NSWindow but now i am wondering how usefull that was do i have to subclass NSWindow to get events, or can I use delegates? i'm still a bit confused on the event model I suggest a full stop forget your current carbon application for a while and instead learn Cocoa application development. I highly recommend grabbing a copy of Cocoa Programming for Mac OS X [1] and working thru all of the examples, etc. in the book. (other excellent books exist as well but this is the one we use to onboard new developers) Don't waste your time thrashing around. -Shawn [1] http://www.amazon.com/Cocoa-Programming-Mac-OS-3rd/dp/0321503619/ref=bxgy_cc_b_text_a ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/intrntmn%40aol.com This email sent to intrn...@aol.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: Strange autoreleased with no pool in place message
FYI, your crash was not because you had no autorelease pool in place. That would just cause some objects to never be reclaimed, which for a debug-only build is not necessarily anything to worry about. Your crash would have been because you were using [NSString stringWithFormat...] before the Cocoa runtime stuff was all initialized. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Wave form graph through Core Audio?
I'm working on generating a wave form for a sound bite, but I'm stuck in Core Audio, which seems to be not over-documented, so to speak. All I need for now is an array of integers, based on some sample rate, for a given sound file, but most of Core Audio seems to target more complex functionality. Are there any code snippets around for sampling a sound file? Regards, Izak --- Grinnikend door het leven... ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Wave form graph through Core Audio?
On Thu, Apr 22, 2010 at 4:37 PM, Izak van Langevelde eezac...@xs4all.nl wrote: I'm working on generating a wave form for a sound bite, but I'm stuck in Core Audio, which seems to be not over-documented, so to speak. This question is more appropriate for the coreaudio-api list. --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: Forcing plist preferences file to be saved as text?
On Apr 22, 2010, at 3:15 PM, Dave Keck wrote: Out of curiosity, why would you use the less efficient and larger XML format ? Human-readability I would imagine. 'defaults read' or 'plutil' will do for that. The files are stored in binary because it's more efficient. This was a performance optimization added in 10.5, and I was told that it really did make a measurable difference. —Jens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSApplicationMain question
On Apr 22, 2010, at 3:45 PM, Bill Appleton wrote: for better or worse i am porting a large piece of enterprise software from carbon/windows to cocoa/windows most of the code is platform independent, but i can't make big changes to the overall structure of the program so like step one is to replace WindowRef with NSWindow and watch the carnage ensue That is absolutely not going to work. You might be able to get away with it for a little hack, but not a large program. Carbon and Cocoa are too different — Carbon is a toolbox while Cocoa is a framework. Cocoa has a specific design that apps follow, with an inverted flow of control where you let the framework call your code. The approach you're taking is like the old Monty Python sketch where the pet shop owner wants to convert a dog into a fish by shaving it and sticking a tube through the back of its neck so it can breathe underwater. —Jens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Determining preferred localizations
On Apr 22, 2010, at 12:45 PM, Stephane Madrau wrote: Le 22 avr. 2010 à 18:19, cocoa-dev-requ...@lists.apple.com a écrit : Thanks, but no. What I'm passing in is the keys for the dictionary I get as a result of this code: io_connect_t thePort = CGDisplayIOServicePort(theScreenNumber); CFDictionaryRef theInfo = (CFDictionaryRef)IODisplayCreateInfoDictionary(thePort, 0); CFDictionaryRef theNames = CFDictionaryGetValue(theInfo, CFSTR(kDisplayProductName)); theNames will look something like this: en_US - Color LCD en_GB - Colour LCD fr_FR - LCD couleur Did you check what Apple themselves do within IODisplayLib.c (IOKitUser / graphics.subproj) ? http://www.opensource.apple.com/source/IOKitUser/IOKitUser-514.8.1/graphics.subproj/IODisplayLib.c Check the function named GenerateProductName... Of course, it's all plain CoreFoundation, but for me it works (or I didn't see the problem you are seeing and I missed your point) Ding! (Newer members to the list, please take note that this is why sometimes the first answer to your question is What are you *really* trying to do?) Passing the constant kIODisplayOnlyPreferredName as the second argument to IODisplayCreateInfoDictionary() obviated my problem of determining the correct localization to use by only actually giving me one (and a good one) back. Thanks very much, Stephane. Greg___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UIResponder Woes
On 22 Apr 2010, at 8:18 AM, Dylan Copeland wrote: I have a UIView subclass that overrides UIResponder's touchesMoved: message. I've noticed that when I swipe my finger very quickly across the UIView, my touchesMoved: message only gets called every so often and not constantly getting messaged. You are, of course, apologetic about posting an entire digest to the list. Remember to keep up the subject line. What user-visible behavior are you trying to produce? Every so often seems to mean not often enough for you, but it would help to know, not often enough for what? Are you expecting to be notified of every pixel's worth of movement, no matter how little time comes between? Back-of-the-envelope math: A fast swipe across the face of an iPhone may take 1/10 of a second, or 3200 pixels per second, or 312.5 microseconds per pixel. I suppose the screen refreshes 60 times a second, or every 16700 µs, which means the pixel movements are piling up 53 times faster than anything you can do to represent them on screen (even granting that your code can do any worthwhile graphical work in its share of 312 µs). So somebody — you or the OS — has to aggregate touch movements. You can't always get the smallest quantum of movement, so strictly speaking, every so often is all you can expect. The question then is: Is that often enough? And for what? I've heard people raising this sort of question about drawing programs. They had hoped to be notified of every pixel, so all they'd have to do is blit the brush tip onto the screen at each event. Can't do it; even desktop mouse movements get aggregated. If they wanted to do it, they had to calculate the straight line between the reported positions, and draw the brush tip at every pixel. — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSApplicationMain question
On 23/04/2010, at 8:45 AM, Bill Appleton wrote: so like step one is to replace WindowRef with NSWindow and watch the carnage ensue Which it certainly will, so why bother wasting your time? I came from a Carbon (in fact classic toolbox before that) background and have been doing Cocoa now for 6-7 years. Unless you are fairly familiar with a Carbon-based framework such as Powerplant, TCL or MacApp, it's unlikely that Cocoa will look very familiar. If you are porting an app where the majority of the functional code is GUI and platform independent then you'll probably be better off casting off all Carbon GUI code and building a Cocoa GUI from the ground up. This is much easier than it seems, especially given how much work you had to do in Carbon to get a functional GUI of any complexity working. All basic event handling, window selecting, menu and control handling and mouse input are pretty much handled for you. That's a big chunk of what most Carbon apps do taken away from you right there (though Carbon definitely does more than the original toolbox, which didn't even implement the main event loop for you). Read books. Hillegasse is frequently recommended, but there have been a number of more recent books released. Cocoa sticks pretty well to well-established design patterns, so the classic 'Design Patterns' (Gamma/Helm/Johnson/Vlissides) should have a place on your shelf. Build a small exploration app in Cocoa to familiarise yourself with how to program in Cocoa. A little time spent doing that without trying to port your existing code straight off will pay off greatly when you come to tackle the real thing. There's also plenty of sample code out there which show how real apps are put together. Trying to port a Carbon app at the event handler level is likely to be frustrating and will fail. On the bright side, chances are that when you're done your app will be significantly smaller and much less encumbered by structural baggage that contributes nothing to what makes your app worth 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: NSApplicationMain question
On Thu, Apr 22, 2010 at 6:45 PM, Bill Appleton billapple...@dreamfactory.com wrote: hi all, thanks for the great advice for better or worse i am porting a large piece of enterprise software from carbon/windows to cocoa/windows most of the code is platform independent, but i can't make big changes to the overall structure of the program so like step one is to replace WindowRef with NSWindow and watch the carnage ensue Step one should be to actually learn Cocoa. You seem to think that because you're going to be just swapping in Cocoa for Carbon that you don't really need to know a lot about how Cocoa works. In fact, precisely the opposite is true. If that's going to be your strategy, you need to know *more* about how Cocoa works than the average Cocoa programmer. Cocoa makes it easy to build conventional Cocoa apps, and you can often get away with not knowing all that much about how stuff works internally. But your proposed approach is highly unconventional. To succeed, you'll need to have a good understanding of how Cocoa works on the inside. In short, you need to know the rules extremely well before you start breaking them. Others have already addressed the merits of your proposed approach. If you decide to go with it anyway (and I can understand the temptation) then you'll probably want to take a time out, get a book or three on Cocoa, build a small test application and then expand it until you have something that exercises a decent fraction of the framework, and *then* come back and start doing your conversion. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com