Re: Is there any document to explain the process about the
http://developer.apple.com/documentation/Cocoa/Conceptual/NSPersistentDocumentTutorial/00_Introduction/introduction.html http://developer.apple.com/documentation/Cocoa/Conceptual/CoreDataUtilityTutorial/Articles/00_introduction.html http://developer.apple.com/iphone/library/documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html mmalc Thanks very much. Is there any document to show/explain the process to implement the CoreRecipe? sample concretely? Thx. Bright ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/ldl0313036%40163.com This email sent to ldl0313...@163.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: AsyncSocket. Troubles with MTMessageBroker didReceiveData
Nobody knows? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: AsyncSocket. Troubles with MTMessageBroker didReceiveData
On Jul 7, 2009, at 4:24 AM, Carlo Gulliani wrote: Nobody knows? If they did, they'd reply. Don't bump the list if you have nothing to add. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Sending launch and quit Apple Events: Crazy Connection Errors
I need to be able to quit and re-launch other applications, and have been getting all kinds of weird behavior. Maybe if someone could explain this one little test case I've isolated, it would be a big help. The code below attempts to launch TextEdit, wait 5 seconds, quit TextEdit, wait 5 seconds, repeat forever. I get a launch, a quit, and a launch. But when it tries to quit for the second time, AESendMessage returns a -609 Connection Invalid error. I imagine this is because it is trying to connect to the application instance that it had quit the first time. Documention of AESendMessage implies that recent versions of AppleScript will automatically try and reconnect, and that there is no more option to set. How can I get it to forget the old connection and make a new one? Thanks, Jerry P.S. I'm having another issue too. Under some conditions, if I launch an application using the NSWorkspace method, it will quit (quietly, no crash) as soon as my application resumes normal activity. I'm saving that for another post, unless someone has an Aha!. I've also tried using NSAppleScript and Scripting Bridge but have had similar problems. #import Cocoa/Cocoa.h void LaunchAndSleep(NSString* bundleIdentifier, float seconds) { NSLog(@Launching) ; BOOL ok ; ok = [[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier:bundleIdentifier options:0 additionalEventParamDescriptor:nil launchIdentifier:NULL] ; NSLog(@Launch success = %d, ok) ; NSLog(@Sleep after launch) ; usleep(seconds * 1e6) ; } void QuitAndSleep(NSString* bundleIdentifier, float seconds) { NSLog(@Quitting) ; const char* identifier = [bundleIdentifier UTF8String] ; NSAppleEventDescriptor *as ; as = [NSAppleEventDescriptor descriptorWithDescriptorType:typeApplicationBundleID bytes:identifier length:strlen(identifier)]; NSAppleEventDescriptor *ae ; ae = [NSAppleEventDescriptor appleEventWithEventClass:kCoreEventClass eventID:kAEQuitApplication targetDescriptor:as returnID:kAutoGenerateReturnID transactionID:kAnyTransactionID]; AppleEvent *quitApplicationAppleEventPtr = (AEDesc*)[ae aeDesc]; if (quitApplicationAppleEventPtr) { OSStatus err = AESendMessage(quitApplicationAppleEventPtr, NULL, kAENoReply, kAEDefaultTimeout) ; NSLog(@Quit err = %d, err) ; } NSLog(@Sleep after quit) ; usleep(seconds * 1e6) ; } int main (int argc, const char * argv[]) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSString* bundleIdentifier = @com.apple.TextEdit ; while (YES) { LaunchAndSleep(bundleIdentifier, 5) ; QuitAndSleep(bundleIdentifier, 5) ; } [pool release] ; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Bound array item is repeatedly copied and collected while scrolling table view
I have a nib file in which entries in an NSTableView are bound to an NSMutableArray via an NSArrayController. It is used in an application running under garbage collection. The array items are NSDictionaries, and one of these dictionaries contains a large dataset object that consumes a lot of memory. I noticed that, while I scrolled in the tableview, many copies of these large objects were being created and then immediately collected. This might have something to do with the way that proxy objects are used by the array controller, or perhaps it is because the 'dataset' object is itself an entry in one of the table columns (presenting the string generated by the default 'description' method). Either way, this is detrimental to performance and memory footprint since these objects are huge (and I wouldn't normally have expected or wanted them to be copied). Is there any way to control this behavior, for example forcing the actual object to be used instead of these transient copies? Failing that, I am wondering (yes, I know this is ugly) if there is a way to set up some kind of context flag so that my object's 'copy' methods will just return a lightweight proxy when being called in this kind of situation (copied as part of a dictionary that is itself being copied)? The 'dataset' object implements both mutable and immutable copying. It is the 'immutable' copy method that is called during table scrolling. Thanks for any insight someone can offer, Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
MVC....brief question
Hi all, I have just completed my first little cocoa app. Please, one brief question. The app follows ( or tries to) the MVC model, using bindings. ( A view, a single NSObjectController, and a model) I also used the method + (NSSet *)keyPathsForValuesAffectingBmi /* bmi is model Ivar */ { return [ NSSet setWithObjects:@weight, @height, nil]; } My question. I included the above method in the model, as this is the only place available. I just wonder if this is correct? (in a sense it enables the getter bmi. ) Apologies if this has previously been asked, or if there is a ref to this...I was not able to find it, but will gladly look if there is one. Thanks in advance. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: MVC....brief question
On Jul 7, 2009, at 6:31 AM, Michael de Haan wrote: + (NSSet *)keyPathsForValuesAffectingBmi /* bmi is model Ivar */ { return [ NSSet setWithObjects:@weight, @height, nil]; } My question. I included the above method in the model, as this is the only place available. I just wonder if this is correct? The only appropriate location for the method is the object that has all of the referenced properties. (in a sense it enables the getter bmi. ) Not in any sense, really. It simply tells all observers of bmi that bmi has changed every time weight or height changes. 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: MVC....brief question
On Jul 7, 2009, at 7:16 AM, Keary Suska wrote: On Jul 7, 2009, at 6:31 AM, Michael de Haan wrote: + (NSSet *)keyPathsForValuesAffectingBmi /* bmi is model Ivar */ { return [ NSSet setWithObjects:@weight, @height, nil]; } My question. I included the above method in the model, as this is the only place available. I just wonder if this is correct? The only appropriate location for the method is the object that has all of the referenced properties. Of course! :-) (in a sense it enables the getter bmi. ) Not in any sense, really. It simply tells all observers of bmi that bmi has changed every time weight or height changes. Beginning to really appreciated the beauty of cocoa...but it's a steep learning curve!! Thanks again for clarifying. Michael. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Display the elements of array in a tablview ?
Hi Everyone, There is an array with several elements in my application. And I have shown the elements in a tableview using binding. But now I need to display the elements using code only. Could anyone help me? Which method should I use? Thank you for help!! Bright ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Display the elements of array in a tablview ?
On Jul 7, 2009, at 10:43 AM, Bright wrote: There is an array with several elements in my application. And I have shown the elements in a tableview using binding. But now I need to display the elements using code only. Could anyone help me? Which method should I use? You want to study NSTableDataSource: http://developer.apple.com/documentation/Cocoa/Conceptual/TableView/Tasks/UsingTableDataSource.html#//apple_ref/doc/uid/2117 This is how things were done before Bindings. Read thoroughly. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: AsyncSocket. Troubles with MTMessageBroker didReceiveData
Not necessarily true ... if you are deemed persona non grata you will not get a reply. On Jul 7, 2009, at 5:00 AM, I. Savant wrote: On Jul 7, 2009, at 4:24 AM, Carlo Gulliani wrote: Nobody knows? If they did, they'd reply. Don't bump the list if you have nothing to add. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/airedale%40tularosa.net This email sent to aired...@tularosa.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: AsyncSocket. Troubles with MTMessageBroker didReceiveData
On Jul 7, 2009, at 11:11 AM, David Blanton wrote: Not necessarily true ... if you are deemed persona non grata you will not get a reply. True. List etiquette is key. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sending launch and quit Apple Events: Crazy Connection Errors
On Jul 7, 2009, at 8:21 AM, Jerry Krinock wrote: I need to be able to quit and re-launch other applications, and have been getting all kinds of weird behavior. Maybe if someone could explain this one little test case I've isolated, it would be a big help. The code below attempts to launch TextEdit, wait 5 seconds, quit TextEdit, wait 5 seconds, repeat forever. I get a launch, a quit, and a launch. But when it tries to quit for the second time, AESendMessage returns a -609 Connection Invalid error. I imagine this is because it is trying to connect to the application instance that it had quit the first time. Documention of AESendMessage implies that recent versions of AppleScript will automatically try and reconnect, and that there is no more option to set. How can I get it to forget the old connection and make a new one? Thanks, Jerry I added similar functionality to one of my apps, and had problems using the bundle id as well. I switched to using the PSN (typeProcessSerialNumber) and that seems to work. You can use this to get the PSN: void PSNForBundleIdentifier( NSString *bundleIdentifier, ProcessSerialNumber *psn ) { OSStatus anErr = noErr; ProcessSerialNumber aNum = { kNoProcess, kNoProcess }; if ( psn == NULL ) return; while ( (anErr == noErr) ) { anErr = GetNextProcess( aNum ); if ( anErr == noErr ) { CFDictionaryRef procInfo = ProcessInformationCopyDictionary( aNum, kProcessDictionaryIncludeAllInformationMask ); if ( [[(NSDictionary *)procInfo objectForKey:(NSString *)kCFBundleIdentifierKey] isEqualToString:bundleIdentifier] ) { *psn = aNum; CFRelease( procInfo ); break; } CFRelease( procInfo ); } } } And then change your QuitAndSleep function to: void QuitAndSleep(NSString* bundleIdentifier, float seconds) { NSLog(@Quitting) ; NSAppleEventDescriptor *as ; ProcessSerialNumber aNum = { kNoProcess, kNoProcess } ; PSNForBundleIdentifier( bundleIdentifier, aNum ); as = [NSAppleEventDescriptor descriptorWithDescriptorType:typeProcessSerialNumber bytes:aNum length:sizeof(aNum)]; NSAppleEventDescriptor *ae ; ae = [NSAppleEventDescriptor appleEventWithEventClass:kCoreEventClass eventID:kAEQuitApplication targetDescriptor:as returnID:kAutoGenerateReturnID transactionID:kAnyTransactionID]; AppleEvent *quitApplicationAppleEventPtr = (AEDesc*)[ae aeDesc]; if (quitApplicationAppleEventPtr) { OSStatus err = AESendMessage(quitApplicationAppleEventPtr, NULL, kAENoReply, kAEDefaultTimeout) ; NSLog(@Quit err = %d, err) ; } NSLog(@Sleep after quit) ; usleep(seconds * 1e6) ; } -- Darkshadow (aka Michael Nickerson) http://www.nightproductions.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: CoreData deleteAll of kind
On 7/7/09 1:19 AM, Mike Abdullah said: Thanks all for your feedback. Seems quite inefficient. Wonder if this is filed as a suggestion to Apple. Why should that matter? File a request anyway, it will make the existing request ore prominent. Not that I disagree with the file a request anyway attitude, but since you asked a question... :) One reason it could matter is because time is finite. With limited time, one might want to prioritize filing non-dupes. Finally, the whole validation issue is an important one. An object can refuse to be deleted because certain criteria are not satisfied. In your proposed -deleteObjects: API, how would it deal with some objects agreeing to be deleted, but others not? The same way deleteObject: does, by returning void. :) -- 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: AsyncSocket. Troubles with MTMessageBroker didReceiveData
Neither AsyncSocket nor MTMessageBroker are part of Cocoa, and thus you're very unlikely to find help on a Cocoa developer's list. They're both third-party classes. My best recommendation is that you try Google. The first result for searching *AsyncSocket MTMessageBroker* is thishttp://www.macresearch.org/cocoa-scientists-part-xxix-message, which seems to have an example that may help you. One other thought: if your delegate methods aren't being called, have you actually called [socket setDelegate:self]? -BJ On Tue, Jul 7, 2009 at 2:24 AM, Carlo Gulliani carlogulli...@yahoo.comwrote: Nobody knows? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/bjhomer%40gmail.com This email sent to bjho...@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: TableView displaying a zillion empty rows
Yet clearly later in the method returnValue is set to 22 via count method applied to my array. In my debugger and in my NSLogs returnValue is 22. But you are only logging the case where it does return 22, so what would you expect? Instead, try moving the NSLog to log the *actual* return value just before you return it. I bet you will see plenty of 0s going out. If at the beginning of the method I initailize returnValue to 22 all looks as expected. Also if at the end of the method I statically set returnValue to 22 all is well. It just doesn't seem to work if I set returnValue by using: returnValue = [playersArray count]; (debugger and NSLog confirm that returnValue is set to 22) I don't understand why? Because clearly there are two main pathways through this code but you're only logging one of them. The other pathway is what's causing the problem but isn't being logged, so you are not seeing its effects. Also, in the debugger you can set a conditional breakpoint at the last line on returnValue == 0. When it breaks, look at aTableView - it will be something other than the two you're expecting. Debug accordingly. --Graham Hi Graham, Thanks for your help. I put an NSLog for returnValue on the line before return. I also put a conditional breakpoint on return to break if returnValue == 0. The NSLog confirmed that returnValue was indeed set to 22. The conditional breakpoint did not break yet my tableView still responds as if returnValue = 0. Just to make certain that I didn't screw up my conditional breakpoint I reset it to break if returnValue =22. It did break. Maddening! As I debug I can clearly see that the program is not going through the other path. It is definitely traveling through the path that I am logging. Everything says that returnValue is 22 except the actual tableView. By the way when the program does use the other path everything works fine. So there is something about my code in here: - (int) numberOfRowsInTableView: (NSTableView *)aTableView{ unsigned int returnValue = 0; if (aTableView == gameScoresTableView) //This works as expected { if (currentIndex_= 0) { LNPlayer *currentPlayer = [playersArray objectAtIndex: currentIndex_]; NSMutableArray *tempGameRecordsArray = [NSMutableArray arrayWithArray: [currentPlayer gameRecordsArray]]; returnValue = [tempGameRecordsArray count]; NSLog (@returnValue = %d, returnValue); //NSLog prints returnValue = 22; } else{ NSBeep (); NSLog (@ERROR in LNAppController -- numberOfRowsInTableView:); return 0; } } else if (aTableView == playerManagementTableView) //This is the one that doesn't work { returnValue = [playersArray count]; //[playersArray count] = 22NSLog (@playersArray count = %d, returnValue); //returnValue = 22NSLog (@returnValue = %d, returnValue); //NSLog prints returnValue = 22; } NSLog (@returnValue = %d, returnValue); //NSLog prints returnValue = 22; return returnValue; //Conditional breakpoint set to returnValue == 0 does not break. But a conditional breakpoint set to returnValue == 22 does break!} that is wrong but I can't figure out what it is. Also if on the first line I don't initialize returnValue to 0 I get my zillion rows. The NSLog just before return still says returnValue = 22. Brian _ Insert movie times and more without leaving Hotmail®. http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Sending launch and quit Apple Events: Crazy Connection Errors
Wow, Michael! I pasted in your code, rebuilt, and it worked perfectly. Thanks! Since you made my day be being such a trooper, I decided to file a bug. Maybe we'll get this fixed someday. Jerry Problem ID: 7037206 Apple Event built with Bundle ID Tries Connect to previously-quit Process, Fails Summary: If an application quits another application using an Apple Event that was built with a Bundle ID, then re-launches the other application, then tries to quit it again, the re-quit Apple Event message fails, apparently because it tries to connect to the process that had been previously quit. Steps to Reproduce: 1. Build a Cocoa Tool using the code in the attached file AEDisconnectDemo.m. This tool is designed to repeatedly launch and then quit TextEdit.app Quitting is done by creating a Quit Apple Event using the bundle identifier of TextEdit.app. A new Apple Event is created with each launch/quit cycle. 2. Run the demo. Expected Results: It should launch TextEdit, sleep 5, quit TextEdit, sleep 5, then repeat this forever Actual Results: The second time it tries to quit TextEdit, AEMessageSend() returns a -609 Invalid Connection error and the operation fails. Apparently, it's trying to connect to the TextEdit process instance that it quit the first time. Notes: In the code, if you then un-comment USE_PSN_INSTEAD_OF_BUNDLE_ID, rebuild, and re-run, it works as expected. (Thanks to Michael Nickerson!) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: TableView displaying a zillion empty rows
On Jul 7, 2009, at 09:35, Brian Hughes wrote: As I debug I can clearly see that the program is not going through the other path. It is definitely traveling through the path that I am logging. Everything says that returnValue is 22 except the actual tableView. By the way when the program does use the other path everything works fine. So there is something about my code in here: You're flailing around here. It's time for your to get your thinking cap on. :) First of all, I assure you that table views and their data sources work fine, in the way that they're documented to work. Almost certainly, if something goes wrong like this, (a) it's not a magical happening, and (b) there's something wrong with your code, somewhere, or with your NIB file. If you can't find anything wrong with your numberOfRowsInTableView: data source method, it's probable that the problem is elsewhere. Second, you seem uncertain about what your data source is a data source for. Is it a data source for exactly two specific table views, or for those two plus an indeterminate number of others? If exactly two, then the most appropriate pattern (given that you're having problems) would be: - (NSInteger) numberOfRowsInTableView: (NSTableView*) aTableView { if (aTableView == table1) { ... return numberOfTable1Rows; } else if (aTableView == table2) { ... return numberOfTable2Rows; } else { NSLog (@Invalid table view); // bonus points for throwing an exception here return 0; } and set a breakpoint on the NSLog statement to catch the error condition. Third, everything you've described so far suggests that you actually have more than 2 tables using this data source method, AND/OR the table you're looking at in your window isn't one of these two. So, you need to actually find out. If you are creating table views (or setting their delegates and data sources) via code, you need to scrutinize that code. If you're setting them up in a NIB file, you need to scrutinize the view hierarchy and connections. If you're using bindings to provide any content to your table views, you need to make sure they're correct. If you're using a combination of those techniques, then you're going to have to look carefully for unwanted interactions. You may have to simplify the problem by *removing* some of this infrastructure, then adding it back in a controlled manner. If the problem you're having isn't in the code you're looking at, look elsewhere. There's more light under the streetlamp, but that may not be where you dropped your nickel. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Bound array item is repeatedly copied and collected while scrolling table view
On Jul 7, 2009, at 05:24, Rick Hoge wrote: I have a nib file in which entries in an NSTableView are bound to an NSMutableArray via an NSArrayController. It is used in an application running under garbage collection. The array items are NSDictionaries, and one of these dictionaries contains a large dataset object that consumes a lot of memory. I noticed that, while I scrolled in the tableview, many copies of these large objects were being created and then immediately collected. This might have something to do with the way that proxy objects are used by the array controller, or perhaps it is because the 'dataset' object is itself an entry in one of the table columns (presenting the string generated by the default 'description' method). Either way, this is detrimental to performance and memory footprint since these objects are huge (and I wouldn't normally have expected or wanted them to be copied). Is there any way to control this behavior, for example forcing the actual object to be used instead of these transient copies? Failing that, I am wondering (yes, I know this is ugly) if there is a way to set up some kind of context flag so that my object's 'copy' methods will just return a lightweight proxy when being called in this kind of situation (copied as part of a dictionary that is itself being copied)? The 'dataset' object implements both mutable and immutable copying. It is the 'immutable' copy method that is called during table scrolling. It's not the table view's fault. What generates the description for the data set? You wrote a 'description' method? How long is the string it returns? If the property to which a table column is bound has the copy attribute, then the value will indeed be copied every time the table view fetches a value for the column. Does you large dataset object support NSCopying? However, since you've chosen to use dictionary instead of real properties, this seems unlikely to be the cause of your problem, unless there's more you haven't told us. My bet's on a giant description string the size of Manhattan. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
NSConnection recursion -- (was Re: Long term performance of NSConnection)
Kirk Kerekes wrote: Use Activity Monitor (or other tool of your choice) to check for a port leak. It wasn't that... Turns out that the protocol on the connection had a call which took an Objective C object as a parameter. The parameter wasn't declared as /byref/ or /bycopy/, so I believe it defaulted to /byref/. In the remote function, that object was being sent a message, which appeared to call back into the original process. There was only one part of the object that was being used, an integer, so I changed the API to pass the integer value instead of the object, and the performance problems went away. Possibly declaring it as /bycopy/ would have done the same thing, but there was no point in copying the entire object when we only needed one piece of it. It's not completely clear why the performance hit was cumulative. I suspect that the call back to the original process was creating connections on the fly and not cleaning them up. If that's the case I think it's a bug in the NSDistantObject code. Kevin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Bound array item is repeatedly copied and collected while scrolling table view
... The array items are NSDictionaries, and one of these dictionaries contains a large dataset object that consumes a lot of memory. I noticed that, while I scrolled in the tableview, many copies of these large objects were being created and then immediately collected. It's not the table view's fault. What generates the description for the data set? You wrote a 'description' method? How long is the string it returns? If the property to which a table column is bound has the copy attribute, then the value will indeed be copied every time the table view fetches a value for the column. Does you large dataset object support NSCopying? However, since you've chosen to use dictionary instead of real properties, this seems unlikely to be the cause of your problem, unless there's more you haven't told us. My bet's on a giant description string the size of Manhattan. No - I don't override 'description' for my dataset class. The string NLVolumeDataset: 0x8000d81a0 presumably generated by NSObject's description method is displayed. My NLVolumeDataset does indeed support both NSCopying and NSMutableCopying. I know that this class's copyWithZone: method is called, and then very shortly thereafter 'finalize' is called. So it (the NSArrayController?) just seems to be firing off these huge copies so that it can call 'description' on them to display in the table, then discarding them. I agree it's not the table view's fault - it's just that even scrolling the table slightly so that the NLVolumeDataset entry comes in and out of view leads to the generation of large numbers of new copies. Thanks for the comments, Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rickhoge1%40mac.com This email sent to rickho...@mac.com (43092.6825) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Bound array item is repeatedly copied and collected while scrolling table view
Le 7 juil. 09 à 14:24, Rick Hoge a écrit : I have a nib file in which entries in an NSTableView are bound to an NSMutableArray via an NSArrayController. It is used in an application running under garbage collection. The array items are NSDictionaries, and one of these dictionaries contains a large dataset object that consumes a lot of memory. I noticed that, while I scrolled in the tableview, many copies of these large objects were being created and then immediately collected. This might have something to do with the way that proxy objects are used by the array controller, or perhaps it is because the 'dataset' object is itself an entry in one of the table columns (presenting the string generated by the default 'description' method). Either way, this is detrimental to performance and memory footprint since these objects are huge (and I wouldn't normally have expected or wanted them to be copied). Is there any way to control this behavior, for example forcing the actual object to be used instead of these transient copies? Failing that, I am wondering (yes, I know this is ugly) if there is a way to set up some kind of context flag so that my object's 'copy' methods will just return a lightweight proxy when being called in this kind of situation (copied as part of a dictionary that is itself being copied)? The 'dataset' object implements both mutable and immutable copying. It is the 'immutable' copy method that is called during table scrolling. Thanks for any insight someone can offer, Rick NSCells used to display table content copies the object it display. Instead of binding the cell value to your object directly, bind it to its description or an other relevant property. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Bound array item is repeatedly copied and collected while scrolling table view
... I noticed that, while I scrolled in the tableview, many copies of these large objects were being created and then immediately collected. ... NSCells used to display table content copies the object it display. Instead of binding the cell value to your object directly, bind it to its description or an other relevant property. Thanks for this suggestion, which clarifies things a bit. I thought about binding to 'description', but I want to be able to edit items in the table view when appropriate (it is not for my dataset object). I use the 'editable' binding to prevent edits to complex objects which shouldn't be edited in a collection view. Cheers, Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: CoreData deleteAll of kind
On Jul 7, 2009, at 9:17 AM, Sean McBride wrote: On 7/7/09 1:19 AM, Mike Abdullah said: Thanks all for your feedback. Seems quite inefficient. Wonder if this is filed as a suggestion to Apple. Why should that matter? File a request anyway, it will make the existing request ore prominent. Not that I disagree with the file a request anyway attitude, but since you asked a question... :) One reason it could matter is because time is finite. With limited time, one might want to prioritize filing non-dupes. You think filing an enhancement request takes time? You should try implementing it! But in all seriousness - you really REALLY should file a bug if you've got a compelling reason for wanting a feature/enhancement - and please be specific. Why? 2 reasons: 1. The often cited voting for features/enhancements argument. It's true, dupes count. 2. The existence of a previously filed request may not have as compelling a reason as yours - eg. the previous dupe says, I want to delete more than one object - yours is - I've tried using prefetching relationships to facilitate cascade deletes, tweaked my model and I still can't delete N objects in M seconds ... you get the idea. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: TableView displaying a zillion empty rows
On Jul 6, 2009, at 8:20 PM, Brian Hughes wrote: I really appreciate your other points about my error code -- I never thought about what the tableView might do if -1 was returned and now that I think about it I don't really want to find out so I changed it to 0. Others have already given you a lot of good advice about your general approach to handling the data source for your tables. I just want to comment on your reply here. I may be wrong, but it still sounds like you're not quite sure how data sources work since you casually decided to change the return value for the error case from -1 to 0 (even though that may, in fact, be the best value). What I was getting at in my reply is to determine what it -means- when that error case occurs. Is it because you hit that case and don't know why you got there? My read of your code is that currentIndex_ refers to a particular player in a list and that your table is displaying game scores for that player. I would expect the only times that currentIndex_ would be negative, then, would be that no players have been added to playersArray and/or there are players but none has been selected in some other part of your UI. In that case, your error case isn't an error at all but rather an expected situation. As others have suggested, you should understand how - numberOfRowsInTableView: works: it tells the NSTableView how many rows of real data it contains, not how many rows of the table should be displayed in the UI. The latter is determined by the physical layout of the table in IB as well as any resizing restrictions you put on the table when, say, the window is grown/shrunk. HTH, steve CC: cocoa-dev@lists.apple.com From: puns...@mac.com Subject: Re: TableView displaying a zillion empty rows Date: Mon, 6 Jul 2009 12:32:38 -0700 To: brian5hug...@hotmail.com On Jul 6, 2009, at 11:50 AM, Greg Guerin wrote: Brian Hughes wrote: -(int) numberOfRowsInTableView: (NSTableView *)aTableView { int returnValue; if (aTableView == gameScoresTableView) //This works as expected { if (currentIndex_= 0) { LNPlayer *currentPlayer = [playersArray objectAtIndex: currentIndex_]; NSMutableArray *tempGameRecordsArray = [NSMutableArray arrayWithArray: [currentPlayer gameRecordsArray]]; returnValue = [tempGameRecordsArray count]; } else { NSBeep (); NSLog (@ERROR in LNAppController -- numberOfRowsInTableView:); return -1; } } else if (aTableView == playerManagementTableView) //This is the one that doesn't work { returnValue = [playersArray count]; //[playersArray count] = 22 NSLog (@playersArray count = %d, returnValue); // returnValue = 22 } return returnValue; //However if I change this to: return returnValue = 22 it works fine! } What will returnValue be if aTableView is neither gameScoresTableView nor playerManagementTableView? Looks like an uninitialized local variable. Also, for your error case (table is gameScoresTableView and currentIndex_ is negative), is that a situation you should allow to happen or is that something that could be handled better/ differently by the underlying model or within your controller? What does NSTableView do when you tell it there are -1 rows? steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Display the elements of array in a tablview ?
I'm not even familiar with Bindings, is it convenient to use ? I did an intensive development with Cocoa starting with Cocoa Touch, so I'm used to using the equivalent UITableViewDataSource to populate table views. Jesse Armand (http://jessearmand.com) On Tue, Jul 7, 2009 at 10:45 PM, I. Savantidiotsavant2...@gmail.com wrote: On Jul 7, 2009, at 10:43 AM, Bright wrote: There is an array with several elements in my application. And I have shown the elements in a tableview using binding. But now I need to display the elements using code only. Could anyone help me? Which method should I use? You want to study NSTableDataSource: http://developer.apple.com/documentation/Cocoa/Conceptual/TableView/Tasks/UsingTableDataSource.html#//apple_ref/doc/uid/2117 This is how things were done before Bindings. Read thoroughly. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/mnemonic.fx%40gmail.com This email sent to mnemonic...@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: Display the elements of array in a tablview ?
On Jul 7, 2009, at 4:48 PM, Jesse Armand wrote: I'm not even familiar with Bindings, is it convenient to use ? Once you understand all of its prerequisites, it can be. The better question to ask is is it convenient to use in this particular scenario. The answer may be yes or no (perhaps emphatically). I did an intensive development with Cocoa starting with Cocoa Touch, so I'm used to using the equivalent UITableViewDataSource to populate table views. My understanding is there are differences in how the two work (from one platform to the other) but they are basically the same concept. I suggested it because Bright specifically mentioned (s)he used bindings but wants an approach using code only. I assumed (s)he meant not bindings. The only other way is the table datasource protocol. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Display the elements of array in a tablview ?
Now , I see. Thank you for everyone's help. Binding is useful, but sometimes maybe it is not suited to your need. Bright On Jul 7, 2009, at 4:48 PM, Jesse Armand wrote: I'm not even familiar with Bindings, is it convenient to use ? Once you understand all of its prerequisites, it can be. The better question to ask is is it convenient to use in this particular scenario. The answer may be yes or no (perhaps emphatically). I did an intensive development with Cocoa starting with Cocoa Touch, so I'm used to using the equivalent UITableViewDataSource to populate table views. My understanding is there are differences in how the two work (from one platform to the other) but they are basically the same concept. I suggested it because Bright specifically mentioned (s)he used bindings but wants an approach using code only. I assumed (s)he meant not bindings. The only other way is the table datasource protocol. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/ldl0313036%40163.com This email sent to ldl0313...@163.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: Display the elements of array in a tablview ?
Point of order, you CAN use bindings in code, it's just far more convenient to do so in IB. On Jul 7, 2009, at 1:59 PM, I. Savant wrote: On Jul 7, 2009, at 4:48 PM, Jesse Armand wrote: I'm not even familiar with Bindings, is it convenient to use ? Once you understand all of its prerequisites, it can be. The better question to ask is is it convenient to use in this particular scenario. The answer may be yes or no (perhaps emphatically). I did an intensive development with Cocoa starting with Cocoa Touch, so I'm used to using the equivalent UITableViewDataSource to populate table views. My understanding is there are differences in how the two work (from one platform to the other) but they are basically the same concept. I suggested it because Bright specifically mentioned (s)he used bindings but wants an approach using code only. I assumed (s)he meant not bindings. The only other way is the table datasource protocol. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/danhd123%40mac.com This email sent to danhd...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
unarchiving a font collection
hello list, as NSFontManager -fontDescriptorsInCollection is apparently unreliable, i would like to unarchive collections directly (it seems apple does not provide support for this): anyone had success with unarchiving a font collection? thanks to all in advance, edward m taffel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Cocoaheads Lake Forest (92630) meeting 7/8/2009 at 7 pm on dSym, the new symbol style for XCode
CocoaHeads Lake Forest will be meeting on the second Wednesday of the month. We will be meeting at the Orange County Public Library (El Toro) community room, 24672 Raymond Way, Lake Forest, CA 92630 Please join us from 7pm to 9pm on Wednesday, 7/8. Peter Hosey will be talking on a variety of topics, including recent work on dSym in Growl. I would like to extend my own personal thanks as well as the groups for the guest speakers we have been having. It is greatly appreciated. If you are able and willing to talk on Blocks in objective C, we have had a request for the topic, plus discussions on QuickTime and QTKit, animation, and OpenGL. Bring your comments, your books, and your bugs, and we will leap right in. As always, details can be found on the cocoaheads web site at www.cocoaheads.org. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: TableView displaying a zillion empty rows
So I changed my code to reflect Quincy Morris's recommendations. -(int) numberOfRowsInTableView: (NSTableView *)aTableView {if (aTableView == gameScoresTableView) //This works as expected { LNPlayer *currentPlayer = [playersArray objectAtIndex: currentIndex_]; NSMutableArray *tempGameRecordsArray = [NSMutableArray arrayWithArray: [currentPlayer gameRecordsArray]];return [tempGameRecordsArray count];} else if (aTableView == playerManagementTableView) {NSLog (@playersArray count = %d, [playersArray count]); //[playersArray count] = 22return [playersArray count];} else {NSLog (@Invalid table view);return 0;}} Since I only have two table views in my program the Invalid table view is never called. The first table view gameScoresTableView works perfectly. The playerManagementTableView does not. I do not create the table views progammatically. I use IB. I do not use bindings. My delegates are set correctly and are the same for both table views. I don't know enough about programming nor am I arrogant enough to think that there is something wrong with NSTableView. I have always thought the error was in my code. That is precisely why I asked for help. I couldn't seem to figure out what to do next. I have learned more about table views so I appreciate all the help. However it still does not work. I am going to try removing infrastructure and see if I can find the problem. Any other suggestions would be welcome. If I figure it out I will let you know. Meanwhile I am going to shine that streetlight on the bottle of beer on my desk. Maybe the solution is in there. } _ Lauren found her dream laptop. Find the PC that’s right for you. http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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