Re: Opening file with C++ iostream from application bundle
Forgot...here is the file loading code bool ::LoadFromFile( string fileName, int which ) { ifstream fin; string temp, item; int itemCount, i; int lineCount = 0; fin.open( fileName.c_str() ); if(fin) { while( !fin.eof() ) { getline( fin, temp ); //...ETC ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Converting String Representations at Runtime
Is there an easy way to take input (user or file based) at runtime and convert unicode strings such as \u8D64 (UTF8 character) or a whole series of these to the human-readable characters they represent? I imagine I should be using NSScanner, but is there not some simple function or method to lookup and return the character as it should be represented? Happy to RTFM, just need a pointer to the docs I should be looking at. Does CFStringTransform do what you want? http://www.cocoabuilder.com/archive/message/cocoa/2007/11/6/192402 Adam, Thanks!! Sorry for the late reply, haven't been able to address this since last week. CFStringTransform does exactly what I wanted to do. It even pretty gracefully handles the whole string supplied. (no idea to how far mileage would vary with this based on supplied string size or content... maybe somebody from apple can comment on that) Oddly enough, that archived thread mentions supplying a constant that is not in the documentation as best as I could tell... perhaps the CF docs dong get as much attention as they should? I can certainly file a bug if appropriate... The only catch was I finally had to sit down and look at how to handle toll-free bridging. But thankfully that was not too bad. Mostly a matter of typecasting really. Thanks a million! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSSavePanel and file formats
On 18/04/2009, at 7:56 AM, Quincey Morris wrote: I notice that the current HIG recommends the use of a file format popup in the Save dialog, when an application supports multiple formats: http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGMenus/XHIGMenus.html#/ /apple_ref/doc/uid/TP3356-TPXREF105 and the picture of the Save dialog seems to suggest that the popup is to be implemented in an accessory view: http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/XHIGWindows.html#/ /apple_ref/doc/uid/2961-SW47 It seems to me that *each* of the formats in the popup is going to have its *own* list of valid file extensions, so that changing the selected item in the popup should make a corresponding change to NSSavePanel's allowedFileTypes. I can sort of see my way to doing that by subclassing a NSViewController that owns the accessory view, and making the view controller responsible for calling allowedFileTypes when the popup selection changes, but I'm wondering if I'm overlooking a more direct solution. I'm also wondering if changing allowedFileTypes while the Save dialog is displayed will actually work. (Will it replace the extension of whatever is currently in the file name text field?) Comments, anyone? The save dialog shows the format pop-up automatically if you declare in your info.pList that you export multiple types. Presumably it also takes care of everything else too - you just need to set up the pList and respond to the type passed to your document's -daatOfType:error: method which will depend on what the user chose. --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
Looking for Drag and Drop samples
Hey everyone, I'm working on some drag and drop stuff, and have reached an impasse. Currently, I've got a basic master-detail view, where I can drag and drop to rearrange the groups in the master outline view. What I'd now like is to be able to drop items from the detail view onto one of the group items to copy it into that group (just like dragging an email into a new folder in Mail.app, or dragging a song into a playlist in iTunes). I tried adding the type of the dragged item (a simple NSStringPboardType) to the outline view's regsiterForDraggedType's array, but I'm still not entirely sure what all the various delegate methods are doing. I managed to get it working for rearranging, but I'm now looking for somewhere that has a clear explanation of what the delegate methods are, when they're fired, why they're fired, and maybe some sample code to go with it. I've taken a look at the Drag and Drop outline view in the sample code, and also the Drag and Drop guide in the docs, but I'm really looking for something that could explain this step by step. Any pointers? Thanks! Dave DeLong ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
[MEET] Amsterdam CocoaHeads Wed, April 22
Hello, The next meeting of the Amsterdam CocoaHeads will be this Wednesday, April 22 from 7-9PM. Location and presentation info can be found here: http://groups.google.com/group/cocoaheads-amsterdam/browse_thread/thread/4221ef40dbf68e7d?hl=en Hope to see you there! Cathy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSSavePanel and file formats
On Apr 20, 2009, at 00:16, Graham Cox wrote: The save dialog shows the format pop-up automatically if you declare in your info.pList that you export multiple types. Presumably it also takes care of everything else too - you just need to set up the pList and respond to the type passed to your document's - daatOfType:error: method which will depend on what the user chose. Ah, I didn't know that. If I did, I would have mentioned that this is actually for an Export As... dialog, so that the file types are by definition not in info.plist. I did actually get the popup to work via a NSViewController subclass for an accessory view, and calling setAllowedFileTypes: while the dialog is displayed works just fine. But one annoying problem remains. When exporting files (at least in my case) it's highly desirable for some formats to get a suffix on the default filename (specifically, because some of the formats require creating a folder of stuff instead of a file, and an extension on the folder isn't desirable at all), but there appears to be no way to change the filename while the dialog is displayed. There's no setFilename method, and no delegate method that appears to allow the filename to be changed. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem: sqlite3 and .sqlite-journal files
On Apr 17, 2009, at 12:47 PM, Тимофей Даньшин wrote: However, a strange thing happens: when the user _creates_ a database, everything is stored as hoped. But when the user _opens_ an existing database, nothing is stored in it, and a new file gets created, which name coincides with the name of the database the user opened with -journal in the extension. (I did read about that on the sqlite3 site, but it didn't seem to help). That file is, as its name implies, the journal file for the database. It's used by SQLite to implement its transactional data- integrity guarantees. -- Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel and file formats
On 20/04/2009, at 5:51 PM, Quincey Morris wrote: But one annoying problem remains. When exporting files (at least in my case) it's highly desirable for some formats to get a suffix on the default filename (specifically, because some of the formats require creating a folder of stuff instead of a file, and an extension on the folder isn't desirable at all), but there appears to be no way to change the filename while the dialog is displayed. There's no setFilename method, and no delegate method that appears to allow the filename to be changed. Have I followed correctly? You want to name a folder, say Foo, but then place files inside called e.g. Foo_001, Foo_002 etc? This is perfectly possible - NSFileWrapper is a convenient way to encapsulate a whole bunch of files inside a folder, and you can return a file wrapper from NSDocument's -fileWrapperOfType:error: method. It would entirely be up to your document to construct the folder the way you want it - this wouldn't be the job of NSSavePanel. The only purpose of the save panel is to return the full path where the user wants the file object(s) saved, not to perform the save, so in general it's up to the user to enter a filename as they wish. I guess the fact that there's no -setFilename: method reflects that. You can set whether the extension part is hidden of not of course. In this case, the user enters Foo and you append the suffixes when you actually save the data to that Folder. Delegate methods do allow you to validate the entered filename. It's not unreasonable to provide your own UI for handling this sort of thing if you really need something different. In one app I wrote I did something similar, where my save panel's accessory view had extra stuff for specifying how a series of automated file suffixes were built, but the main save panel simply supplied the root name and target directory. --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: Looking for Drag and Drop samples
On Apr 18, 2009, at 5:52 PM, Dave DeLong wrote: I've taken a look at the Drag and Drop outline view in the sample code, and also the Drag and Drop guide in the docs, but I'm really looking for something that could explain this step by step. The docs *do* explain this step by step. Maybe if you mention what parts are unclear to you, that'd be a much easier starting point than please rephrase the entire DnD documentation for me. :-) -- 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
Is there a way where we can avoid the machine from going to sleep...?
Hi All, I am developing a small CD/DVD Wirting Application. There seems to be a problem when the user leaves the app for writing DVD's sometimes the machine goes to sleep and my application gives a Writing error. Is there a way where we can avoid the machine from going to sleep...? Can anybody help me out. Thanks in Advance. Regards, Anshul jain ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: C numerical libraries for integrating with Cocoa
On Apr 17, 2009, at 1:53 PM, Boyd Collier wrote: Have you looked at the book Numerical Recipes in C? You can view a copy on-line at http://www.fizyka.umk.pl/nrbook/c1-0.pdf (and probably other places as well). Yes, maybe I should have mentioned that. (Actually, I'm old enough that my copy is Numerical Recipes in Fortran, but it's easy enough to translate.) I was looking for an alternative to rolling my own. I think I'm going to try the GNU Scientific Library, anyone have experience with that? Thanks to Kevin Cathey for pointing out that some of this is built into Mac OS X. Didn't realize that! Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
Problem solved. Although predicates cannot involve transient properties, you can follow relationships in a predicate using a key path. Obj-C Categories to the rescue… For example, you can write a category on NSNumber containing a method - letterGrade. Then use this to create the leftExpression in the row template. Now everything works nicely, except you need to dig into the template after creating it, get the views and change the title of the menu item from score.letterGrade to something like Letter Grade. But, in a real-life app, you need to do that for localization anyhow. On 2009 Apr 18, at 05:03, Mike Abdullah wrote: If it helps, the reason for Apple only supporting searching of persistent properties is for performance. If you're using the SQLite store for example, the predicate is not evaluated against the in- memory objects, but against the individual bits of data in the SQLite table. Of course, why Apple couldn't have then added automatic support for in-memory matching as the second step I don't know… Yes, I figured something like that was going on but didn't want to get my hand slapped for trying to peek under Core Data's covers :) I also tried Keary's suggestion, and learned some stuff that may be useful to have in the list archives... On 2009 Apr 17, at 09:27, Keary Suska wrote: I am not really up to speed on NSPredicateEditor, but could you use - ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow: to convert the display case of grade = A-F to a predicate that is actually grade = = score range? I imagine you would need to construct a compound predicate with subpredicates (sub-rows). Either that or use the BETWEEN operator. Good question. Long answer: The method you refer to is one of five delegate methods of the NSPredicate superclass NSRuleEditor, three of which the delegate must implement. My guess is that implementing an NSPredicateEditor delegate is way to override the default row template generation. Might be what I need. However… • No documentation on how to implement a delegate. • Delegate seems to be ignored. I sent -setDelegate:self and echoed it back at several points. I implemented the three required methods, returning nil or 0. Expected result: Probably empty rule editors. Actual result: None of my delegate methods ever get invoked and everything still works as before. Echoing back -delegate returns self as expected. • Even if the delegate methods worked, I don't think I could implement them to return the required results. For example, ruleEditor:displayValueForCriterion:inRow: is supposed to return The criterion for which the value is required. I know what a criterion is in English but to write code one needs something precise. No explanation in either this document or the Predicate Programming Guide. Oh, and the type of it is id :( One clue I can find is that -criteriaForRow returns the same [items] as those returned from the delegate method ruleEditor:child:forCriterion:withRowType:. Aha -- so I send - criteriaForRow for each row up to -numberOfRows, log the results and get an array like this: 2009-04-19 17:22:45.521 TestApp[52864:10b] criteria for row 2: ( _NSPredicateEditorItem: 0x15b71ce0 [Name], _NSPredicateEditorItem: 0x15b6fbf0 [contains], _NSPredicateEditorItem: 0x15b70e80 [NSTextField: 0x15b50fe0] ) I can see what they're doing -- these are the three subviews in the template. But notice the underscore prefix on _NSPredicateEditorItem. Since I can't create those, I'd need a way to get this default answer and then tweak it, and I have no idea how to do either. Conclusion: Judging from these results and the lack of results in web searches, NSRuleEditor seems to be seldom used, NSPredicateEditor is rarely used, and probably delegate support in NSPredicateEditor is incomplete and unusable in Mac OS X 10.5. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Opening file with C++ iostream from application bundle
Hi everyone, my Cocoa app (Objective-C++) works perfectly from within Xcode. However when I double click the application in Finder it does not load my data file.The file is a short text file which was placed next to the executable in the buildDebug or buildRelease folders. It is loaded with standard C++ iostream methods. Now, however, I'd like to place this file somewhere within the Application contents folder and load it from there, so I can use the app as a standalone. 1. I know this is not the recommended way to open a file in a Cocoa App, but this is just a quick utility for use in class, so I don't wan't to change my file loading code and deal with File dialogs, bundle loading or preferences. This is not really a preferences file either. It contains some data which is vital to the application but will not be modified by the user. 2. Where should I place the file? 3. How do I direct my executable to it so that I can load it with my stream reading code? 4. Can it be done with a path in info.plist or somethinglike that? Thanks already for any help/suggestion/link. Carlos ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Opening file with C++ iostream from application bundle
Am 19.04.2009 um 03:50 schrieb Carlos Eduardo Mello: 1. I know this is not the recommended way to open a file in a Cocoa App, but this is just a quick utility Your code is shorter than 2 lines Objective-C? for use in class, so I don't wan't to change my file loading code and deal with File dialogs, bundle loading or preferences. No dealings necessary. This is not really a preferences file either. It contains some data which is vital to the application but will not be modified by the user. 2. Where should I place the file? Inside resources. XCode will copy it to the right location. 3. How do I direct my executable to it so that I can load it with my stream reading code? NSString *aPath = [[NSBundle mainBundle] pathForResource:@Filename ofType:@extension]; 4. Can it be done with a path in info.plist or somethinglike that? No. But you can load it with one of these lines, depending on the content: NSData *someDataBlob = [NSData dataWithContentsOfFile:aPath NSDictionary *aDictionary = [NSDictionary dictionaryWithContentsOfFile:aPath]; NSArray *anArray = [NSArray arrayWithContentsOfFile:aPath]; atze ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Is there a way where we can avoid the machine from going to sleep...?
On 20 Apr 2009, at 6:22 AM, Anshul jain wrote: I am developing a small CD/DVD Wirting Application. There seems to be a problem when the user leaves the app for writing DVD's sometimes the machine goes to sleep and my application gives a Writing error. Is there a way where we can avoid the machine from going to sleep...? Google site:developer.apple.com prevent sleep. Technical QA 1340, second entry. http://developer.apple.com/qa/qa2004/qa1340.html — F -- Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- http://x3u.manoverboard.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: how to get the windows ‘s coordinate
On 20 Apr 2009, at 2:01 AM, Joe Yi wrote: hello all:I have no way to get the app window 's coordinateapplewebdata://A2B49717-8F5F-4246-991B-60F9DC323717/;coordinate 。please show me the detail method. thanks. You don't provide enough information on what you want to do. What is your target system? iPhone (UIWindow)? Mac OS X (NSWindow)? Have you looked in the class reference for the class you are interested in? Did you look in the class reference for the superclass? What is that URL you provide? My system does not recognize the applewebdata scheme. — 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: NSSavePanel and file formats
On Apr 20, 2009, at 12:51 AM, Quincey Morris wrote: On Apr 20, 2009, at 00:16, Graham Cox wrote: The save dialog shows the format pop-up automatically if you declare in your info.pList that you export multiple types. Presumably it also takes care of everything else too - you just need to set up the pList and respond to the type passed to your document's -daatOfType:error: method which will depend on what the user chose. Ah, I didn't know that. If I did, I would have mentioned that this is actually for an Export As... dialog, so that the file types are by definition not in info.plist. Can you use NSExportableTypes or NSExportableAs in Info.plist? It's been a long time since I had to deal with that, but ISTR it will handle the types popup for you (and hopefully the extension as well). 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
to check wifi connection. how?
is there easy way how to check is enabled wifi connection on mac or not? I need to show warning's alert (when app was launched) if the wifi's connection is not available. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: to check wifi connection. how?
- (BOOL) connectedToNetwork { // Create zero addy struct sockaddr_in zeroAddress; bzero(zeroAddress, sizeof(zeroAddress)); zeroAddress.sin_len = sizeof(zeroAddress); zeroAddress.sin_family = AF_INET; // Recover reachability flags SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)zeroAddress); SCNetworkReachabilityFlags flags; BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, flags); CFRelease(defaultRouteReachability); if (!didRetrieveFlags) { printf(Error. Could not recover network reachability flags\n); return 0; } BOOL isReachable = flags kSCNetworkFlagsReachable; BOOL needsConnection = flags kSCNetworkFlagsConnectionRequired; return (isReachable !needsConnection) ? YES : NO; } On Mon, Apr 20, 2009 at 10:31 AM, Carlo Gulliani carlogulli...@yahoo.comwrote: is there easy way how to check is enabled wifi connection on mac or not? I need to show warning's alert (when app was launched) if the wifi's connection is not available. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com This email sent to edole...@gmail.com -- http://ericd.net Interactive design and development ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: to check wifi connection. how?
wow, very good. many thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: SQLite 3 crash report - debugging help needed
I haven't been able to track this down to anything specific - it doesn't happen with any regularity or frequency, nor does it occur anywhere on my development machine that will allow me to track it down. How did you come by this crash log? From the 0x48, it looks like it's attempting to dereference an int passed into sqlite3VdbeExec where a pointer should go, but that's a wild guess. It's dying in sqlite3 code, so you have access to the source. Take advantage of that. If you can attach to it in the debugger around the time of the crash, you can observe the arguments passed into that last function call. —Jeremy On Fri, Apr 17, 2009 at 3:43 PM, Jon C. Munson II jmun...@his.com wrote: Namaste! I'm not sure that this is the correct list to post this. My app is done in Cocoa though, with a sqlite 3 backend using CoreData to access/manage it. Here's the short version of the crash log (the whole log can be provided, but I didn't want to clutter this email with what may be useless over-info): Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x0048 Crashed Thread: 0 Thread 0 Crashed: 0 libsqlite3.0.dylib 0x95a677a5 sqlite3VdbeExec + 2821 1 libsqlite3.0.dylib 0x95a72ea2 sqlite3Step + 386 2 libsqlite3.0.dylib 0x95a7355d sqlite3_step + 29 3 com.apple.CoreData 0x905166c8 _execute + 56 4 com.apple.CoreData 0x90515f88 -[NSSQLiteConnection execute] + 632 5 com.apple.CoreData 0x90511e3b newFetchedRowsForFetchPlan_MT + 907 6 com.apple.CoreData 0x9050aa10 -[NSSQLCore objectsForFetchRequest:inContext:] + 304 7 com.apple.CoreData 0x9050a88d -[NSSQLCore executeRequest:withContext:] + 461 8 com.apple.CoreData 0x9050997a - [NSPersistentStoreCoordinator(_NSInternalMethods) executeRequest:withContext:] + 522 9 com.apple.CoreData 0x9050705b -[NSManagedObjectContext executeFetchRequest:error:] + 587 10 com.apple.AppKit0x960df4e8 -[_NSManagedProxy fetchObjectsWithFetchRequest:error:] + 147 11 com.apple.AppKit0x95f81923 - [NSArrayController(NSManagedController) _performFetchWithRequest:merge:error:] + 76 12 com.apple.AppKit0x960dea13 - [NSObjectController(NSManagedController) fetchWithRequest:merge:error:] + 209 13 com.apple.AppKit0x960dea99 - [NSObjectController(NSManagedController) _executeFetch:didCommitSuccessfully:actionSender:] + 106 14 com.apple.AppKit0x9620e03e _NSSendCommitEditingSelector + 66 15 com.apple.AppKit0x95ff4d54 -[NSController _controllerEditor:didCommit:contextInfo:] + 197 16 com.apple.CoreFoundation0x95581a3d __invoking___ + 29 17 com.apple.CoreFoundation0x95581428 -[NSInvocation invoke] + 136 I haven't been able to track this down to anything specific - it doesn't happen with any regularity or frequency, nor does it occur anywhere on my development machine that will allow me to track it down. In short, it seems to just happen. Anyone have any idea how to address this problem??? Thanks in advance! Peace, Love, and Light, /s/ Jon C. Munson II ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jeremyw.sherman%40gmail.com This email sent to jeremyw.sher...@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: Converting String Representations at Runtime
On Sat, Apr 18, 2009 at 4:44 PM, John Joyce dangerwillrobinsondan...@gmail.com wrote: CFStringTransform does exactly what I wanted to do. It even pretty gracefully handles the whole string supplied. (no idea to how far mileage would vary with this based on supplied string size or content... maybe somebody from apple can comment on that) Oddly enough, that archived thread mentions supplying a constant that is not in the documentation as best as I could tell... perhaps the CF docs dong get as much attention as they should? I can certainly file a bug if appropriate... From the documentation: On Mac OS X v10.4 and later, you can also use any valid ICU transform ID defined in the ICU User Guide for Transforms. 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
Re: Select Object in NSDictionaryController
On Apr 19, 2009, at 1:29 AM, Gerriet M. Denkmann wrote: I have a table with two columns, labeled Key and Value bound to myDictionaryController.key and myDictionaryController.value. Now I want to select a row programmatically (e.g. [ myDictionaryController selectRowWIthKey: @someKey ]; ). But such a method I cannot find. There is no such facility, unfortunately. It would be nice. Why not file an enhancement request? And trying to use the inherited selectObjects: does not work (nothing happens, not even an error message). Well, -selectObjects: can't be used to change a controller's selection, so no wonder you aren't getting anywhere. So: how can I select a row in my table? Normally, -setSelectedObjects:, -setSelectionIndex:, or - setSelectionIndexes:. If they don't work, and you want help with that, then be specific about what precisely you tried (i.e. show code!). It also helps to mention what you expect to happen, and what is actually happening differently than your expectation. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
hud panel tiger
Hello, Just to be sure the HUD panel in IB3 cannot be used if the app is for tiger correct? Is there any workaround or basically it has to be done in code? As a note I notice all the 3rd party frameworks seem to be leopard only as well? Thank you, 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: Using CFStringTransform with Attributed strings or runs, maintaining the styling of the Attributes in transformed results.
On Apr 19, 2009, at 1:44 PM, John Joyce wrote: I didn't see it in the function documentation, but is there a way for CFStringTransform to tell me the ranges of the the transformations it has done in the returned string?! That would certainly be nifty! Take a look at the header comments. Notice that the range argument is actually a range pointer, and the comments specify that on return, range is modified to reflect the new range corresponding to the original range. As far as your original question goes, using CFStringTransform on an NSMutableAttributedString's -mutableString should do something sensible, though I can't guarantee it will do exactly what you want. Another option would be to iterate through the string by attribute ranges and act on each range individually, though of course you'll have to account for changes in length due to the transforms. Douglas Davidson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
printer name via NSPrintInfo after running Page Setup
after i run the page setup dialog (successfully), if i examine the name of the chosen printer (via [[printInfo printer] name]) should it reflect the printer chosen in the page setup dialog? i'm not seeing this. in fact, i am seeing the same printer name before and after running the page setup dialog. i'm not sure if this has to do with the printer's i have setup on my machine, or if this is a bug (in my code or one of the system frameworks). can anyone verify whether or not changing the printer in the page setup dialog should be reflected in the print info contained within the NSPageSetup sent to the page setup did complete method? thanx, ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSavePanel and file formats
On Apr 20, 2009, at 03:45, Graham Cox wrote: You want to name a folder, say Foo, but then place files inside called e.g. Foo_001, Foo_002 etc? No, I mean there are, say, export formats A, B and C. Assuming the document file name is something like 'myData.data', export format A should show a suggested name like 'myData.a'; format B should show a suggested name like 'myData B Stuff'; format C should show a suggested name like 'myData C Stuff'. In the latter cases, the name in the Save panel's filename text field is the folder name, not a file name. (The names of the files inside those folders is fixed.) Not that this is really about folders. Another hypothetical example might be exporting information from a contacts database as text files. The export formats might be 'Names Only', 'Names Addresses' and 'Names and Phone Numbers'; the corresponding suggested files names might be 'myDatabase Names.txt', 'myDatabase Addresses.txt' and 'myDatabase Phones.txt', so that different exports do not by default overwrite each other. File name suffixes are the only choice in this case since the extension doesn't distinguish between them. On Apr 20, 2009, at 07:08, Adam R. Maxwell wrote: Can you use NSExportableTypes or NSExportableAs in Info.plist? It's been a long time since I had to deal with that, but ISTR it will handle the types popup for you (and hopefully the extension as well). I didn't know about that either, but it doesn't exactly help here, since handling the extension isn't the problem any more. (It was when I first asked the question.) Also, I'm trying to implement what appears to be a fairly new recommendation in the HIG, which uses Export As… on the File menu to replace Save a Copy As…, Save To…, or Save As… to a format the application can't open. That implies keeping the export file formats out of the Save As… dialog, and keeping document types out of the Export As… dialog, which NSExportableTypes doesn't seem designed to do. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Select Object in NSDictionaryController
On 20 Apr 2009, at 23:05, Keary Suska wrote: On Apr 19, 2009, at 1:29 AM, Gerriet M. Denkmann wrote: I have a table with two columns, labeled Key and Value bound to myDictionaryController.key and myDictionaryController.value. Now I want to select a row programmatically (e.g. [ myDictionaryController selectRowWIthKey: @someKey ]; ). But such a method I cannot find. There is no such facility, unfortunately. It would be nice. Why not file an enhancement request? And trying to use the inherited selectObjects: does not work (nothing happens, not even an error message). Well, -selectObjects: can't be used to change a controller's selection, so no wonder you aren't getting anywhere. Sorry about this. It was setSelectedObjects: which I tried. So: how can I select a row in my table? Normally, -setSelectedObjects:, -setSelectionIndex:, or - setSelectionIndexes:. If they don't work, and you want help with that, then be specific about what precisely you tried (i.e. show code!). Here it is: NSArray *defs = ...some array... (which is bound to content of definitionsArrayController) NSUInteger defIndex = 0; for( NSDictionary *aDef in defs ) { for( NSString *defKey in aDef ) { NSString *value = [ aDef objectForKey: defKey ]; BOOL ok = ... some test with value if ( !ok ) // select the bad thing { [ definitionsArrayController setSelectionIndex: defIndex ]; // this works fine // now the table shows aDef and the first row in the table is selected [ myDictionaryController setSelectedObjects: [ NSArray arrayWithObject: defKey ] ]; // now no row is selected return NO; }; }; defIndex++; }; It also helps to mention what you expect to happen, and what is actually happening differently than your expectation. Well: there is this table bound to myDictionaryController. And I would expect that the row which contains defKey would be selected, but nothing is selected instead. This code works (but seems incredibly complicated and inefficient): NSArray *arrangedObjects = [ dictController arrangedObjects ]; id theThing = nil; for( id something in arrangedObjects ) { NSString *key = [ something key ]; if ( [ key isEqualToString: defKey ] ) { theThing = something; break; }; }; if ( theThing == nil ) // error { NSLog(@%s Error not found,__FUNCTION__); } else { [ dictController setSelectedObjects: [ NSArray arrayWithObject: theThing ] ]; }; Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Compiling a XIB creates a different NIB file everytime
Hello All, I've been asked to look into an oddity that concerns our build team. Our XIB files are being compiled to NIB files differently each time even though no changes have been made. Everything works fine, but we would expect that the if the XIB file hasn't changed, the NIB file should be an exact match every time it is created. Can someone explain what is going on? Is this typical? For example, the md5 digest for the MainMenu.nib file for the first compile, then the second will be: 41b45f46eede541399e36db5b2e10dfa a59180e3d2310b88480f830ca867615a Thanks for any information. Regards, Lyndsey Ferguson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Compiling a XIB creates a different NIB file everytime
On Mon, Apr 20, 2009 at 1:47 PM, Lyndsey Ferguson lyndsey.fergu...@gmail.com wrote: Everything works fine, but we would expect that the if the XIB file hasn't changed, the NIB file should be an exact match every time it is created. Where is this promised? If there's so much as one GUID in the resultant NIB then your theory is completely destroyed. Why are you concerned about the identity of the compiled NIB? --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: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
On 2009 Apr 20, at 04:50, Jerry Krinock wrote: Problem solved But there's an even better way. Upon further study of the Predicate Programming Guide, I find that there are even more limitations to Core Data fetches with predicates. The most troubling is that: The Core Data SQL store supports only one to-many operation per query; therefore in any predicate sent to the SQL store, there may be only one operator (and one instance of that operator) from ALL, ANY, and IN. A much better way appears to be to fetch all objects from the store with no predicate and then use -[NSArray filteredArrayWithPredicate:]. This takes only one more line of code, solves all problems, and is supposedly cheaper too: If you use the Core Data framework, the array methods provide an efficient means of filtering an existing array of objects without —- as a fetch does —- requiring a round trip to a persistent data store. Furthermore, now since my left-side expressions don't need to be managed properties I don't need the categories -- I can just add simple derived-attribute getters to my target object class and predicate upon the derived attribute directly. So, I guess the reason why Apple has never noticed that Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness is because there's a better way to do it. Makes me wonder why NSFetchRequest even supports a predicate, since its predicate has all these limitations and is supposedly more expensive when compared to fetching all objects and then using - [NSArray filteredArrayWithPredicate:] ? It would have saved me a day on the learning curve had it not been there for me to hang myself with. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: C numerical libraries for integrating with Cocoa
I've used parts of the GNU Scientific Library. The code for particular functions is excellent (or at least what I've used or looked at), but the library is very large and it took me quite a while to separate out just the parts that I wanted to use and to make sure that I had the needed headers without included many others that I didn't need. Maybe that's an admission of lack of skill and knowledge on my part more than anything else. Good luck to you, if that's the way you choose to go. Boyd On Apr 17, 2009, at 3:41 PM, Chris Goedde wrote: On Apr 17, 2009, at 1:53 PM, Boyd Collier wrote: Have you looked at the book Numerical Recipes in C? You can view a copy on-line at http://www.fizyka.umk.pl/nrbook/c1-0.pdf (and probably other places as well). Yes, maybe I should have mentioned that. (Actually, I'm old enough that my copy is Numerical Recipes in Fortran, but it's easy enough to translate.) I was looking for an alternative to rolling my own. I think I'm going to try the GNU Scientific Library, anyone have experience with that? Thanks to Kevin Cathey for pointing out that some of this is built into Mac OS X. Didn't realize that! Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/bcollier%40sunstroke.sdsu.edu This email sent to bcoll...@sunstroke.sdsu.edu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Quartz Comp on iPhone
Is it possible to load a quartz composition on iPhone? I'm not seeing anything in the APIs ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
On Mon, April 20, 2009 11:02 am, Jerry Krinock wrote: Makes me wonder why NSFetchRequest even supports a predicate, since its predicate has all these limitations and is supposedly more expensive when compared to fetching all objects and then using - [NSArray filteredArrayWithPredicate:] ? It would have saved me a day on the learning curve had it not been there for me to hang myself with. filteredArrayWithPredicate: is only an option if you have a relatively small dataset. There's overhead to loading an object into memory, both in terms of memory and CPU cycles. Doing filtering in memory is a code smell. It generally signals that you're fetching against the wrong entity, or that your model needs to be tweaked to be more efficient. +Melissa ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
On Apr 20, 2009, at 2:02 PM, Jerry Krinock wrote: A much better way appears to be to fetch all objects from the store with no predicate and then use -[NSArray filteredArrayWithPredicate:]. This takes only one more line of code, solves all problems, and is supposedly cheaper too: If you use the Core Data framework, the array methods provide an efficient means of filtering an existing array of objects without —- as a fetch does —- requiring a round trip to a persistent data store. [...] Makes me wonder why NSFetchRequest even supports a predicate, since its predicate has all these limitations and is supposedly more expensive when compared to fetching all objects and then using - [NSArray filteredArrayWithPredicate:] ? You are taking that quote out of context and misinterpreting it. If you already have an array of NSManagedObjects (fully realized, no faults), then it is going to be faster to filter that array than it is to execute a fetch request with a predicate, which always round trips to the store. They key is if you already have an array... (Or a set.) If you don't, then fetching a limited set with a predicate is (usually) going to be considerably faster than fetching all objects, and reducing the result after the fact with a predicate. Consider what happens when you fetch all objects of a particular type. Now consider what happens if you can give Core Data a predicate which says no, just these 3. Jim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: printer user friendly paper name to internal paper name?
daniel, thanx for the response. its not clear from the documentation whether or not the name specified for pageSizeForPaper is an internal name or a user name. in any case, i've solve my problem via methods i posted yesterday to this email list. ken At 10:56 AM +0200 4/20/09, Daniel Demiss wrote: Hi. I'm not quite sure if I got you right but: Am 17.04.2009 um 23:24 schrieb kvic...@pobox.com: my app is fully recordable and scriptable. when the user changes the page setup, i am able to successfully record it and indicate the paper name chosen via -[NSPrintInfo localizedPaperName]. How about saving the return value of paperName instead, which you could use in conjunction with NSPrinter's pageSizeForPaper:? Validation of the string would be as simple as NSZeroSize != [myPrinter pageSizeForPaper:userSuppliedPaperName] HTH 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: printer name via NSPrintInfo after running Page Setup
On Apr 20, 2009, at 09:46, kvic...@pobox.com wrote: after i run the page setup dialog (successfully), if i examine the name of the chosen printer (via [[printInfo printer] name]) should it reflect the printer chosen in the page setup dialog? I'm pretty sure that it never worked the way you're expecting, all the way back to Mac OS 7. Note that in Leopard at least, all of the Page Setup options are available in the Print dialog, so I think there's never any need to use Page Setup at all *unless* you specifically want to format the page for a printer other than the one you're printing on -- in which case you likely wouldn't want Page Setup to switch printers on you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSArray merge sorting
Am I missing something, or is there really not a built-in to merge two arrays? I can roll my own, of course, but there are so many builtins, I'd have thought one was lurking somewhere. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
On 4/20/09 11:02 AM, Jerry Krinock said: But there's an even better way. Upon further study of the Predicate Programming Guide, I find that there are even more limitations to Core Data fetches with predicates. The most troubling is that: The Core Data SQL store supports only one to-many operation per query; therefore in any predicate sent to the SQL store, there may be only one operator (and one instance of that operator) from ALL, ANY, and IN. Anyone know of a way to catch such 'SQL-unfriendly' predicates at compile time? Or with a static analyser? It strikes me that if one currently develops with with XML store, and then one day switches to the SQL store (say when it becomes compatible with GC apps, grrr) when one is in for lots of things suddenly breaking. -- 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: Compiling a XIB creates a different NIB file everytime
Hey Lyndsey - A NIB file contains many hash based unordered data structures, and won't have a byte for byte identical representation from one save/ compile operation to the next - even when the represented interface is identical. Jon Hess On Apr 20, 2009, at 10:47 AM, Lyndsey Ferguson wrote: Hello All, I've been asked to look into an oddity that concerns our build team. Our XIB files are being compiled to NIB files differently each time even though no changes have been made. Everything works fine, but we would expect that the if the XIB file hasn't changed, the NIB file should be an exact match every time it is created. Can someone explain what is going on? Is this typical? For example, the md5 digest for the MainMenu.nib file for the first compile, then the second will be: 41b45f46eede541399e36db5b2e10dfa a59180e3d2310b88480f830ca867615a Thanks for any information. Regards, Lyndsey Ferguson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jhess%40apple.com This email sent to jh...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Select Object in NSDictionaryController
On Apr 20, 2009, at 11:12 AM, Gerriet M. Denkmann wrote: NSArray *defs = ...some array... (which is bound to content of definitionsArrayController) NSUInteger defIndex = 0; for( NSDictionary *aDef in defs ) { for( NSString *defKey in aDef ) { NSString *value = [ aDef objectForKey: defKey ]; BOOL ok = ... some test with value if ( !ok ) // select the bad thing { [ definitionsArrayController setSelectionIndex: defIndex ]; // this works fine // now the table shows aDef and the first row in the table is selected [ myDictionaryController setSelectedObjects: [ NSArray arrayWithObject: This doesn't work because the selected object(s) need to be the actual objects managed by the controller. This code works (but seems incredibly complicated and inefficient): NSArray *arrangedObjects = [ dictController arrangedObjects ]; id theThing = nil; for( id something in arrangedObjects ) { NSString *key = [ something key ]; if ( [ key isEqualToString: defKey ] ) { theThing = something; break; }; }; if ( theThing == nil ) // error { NSLog(@%s Error not found,__FUNCTION__); } else { [ dictController setSelectedObjects: [ NSArray arrayWithObject: theThing ] ]; }; This, or something similar, is probably your best bet. Also, chances are any other apparently shorter solution would really just do the same thing. Best, 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: Compiling a XIB creates a different NIB file everytime
On Apr 20, 2009, at 4:17 PM, Jonathan Hess wrote: A NIB file contains many hash based unordered data structures, and won't have a byte for byte identical representation from one save/ compile operation to the next - even when the represented interface is identical. Okay, thanks Jon, Lyndsey ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSArray merge sorting
Would NSSet cut the mustard here? On 20 Apr 2009, at 20:54, David Scheidt wrote: Am I missing something, or is there really not a built-in to merge two arrays? I can roll my own, of course, but there are so many builtins, I'd have thought one was lurking somewhere. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jonathan%40mugginsoft.com This email sent to jonat...@mugginsoft.com Jonathan Mitchell Central Conscious Unit http://www.mugginsoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Empty stack trace in crash reports
Alright, not strictly Cocoa related, but someone will surely know :) What are the empty threads that show up in a crash report? ie Thread 22 crashed, and there's 20 threads listed in the report, but 17-21 have no stack trace. Is this a thread that hasn't started, hasn't finished, is spazzed because of stack corruption? I'm wondering if this could be a potential clue for some patterns that I should be learning. -- Seth Willits ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSArray merge sorting
I was thinking about NSSet/NSMutableSet as well, but there may be a problem with that solution: I don't think the order of elements is guaranteed to remain the same between adding the elements and accessing them. Wagner On Apr 20, 2009, at 10:44 PM, jonat...@mugginsoft.com wrote: Would NSSet cut the mustard here? On 20 Apr 2009, at 20:54, David Scheidt wrote: Am I missing something, or is there really not a built-in to merge two arrays? I can roll my own, of course, but there are so many builtins, I'd have thought one was lurking somewhere. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: printer user friendly paper name to internal paper name?
for the archives... i received the following off-list and it is exactly what i was looking for. Just an idea, why not use: PMPrinterGetPaperList and then loop through them all and compare what you have to: PMPaperCreateLocalizedName you can get the PMPrinter from: PMSessionGetCurrentPrinter which you can get from -[NSPrintInfo PMPrintSession] At 2:24 PM -0700 4/17/09, kvic...@pobox.com wrote: my app is fully recordable and scriptable. when the user changes the page setup, i am able to successfully record it and indicate the paper name chosen via -[NSPrintInfo localizedPaperName]. however, if the user attemps to write a script (either directly or by modifying a previously recorded script), i need to validate any paper name the user has specified. i don't see how to go from a user specified paper name to an internal name such that i can call -[NSPrintInfo setPaperName:]. have i missed something? thanx, ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Quartz Comp on iPhone
On Apr 20, 2009, at 11:17 AM, Development wrote: Is it possible to load a quartz composition on iPhone? I'm not seeing anything in the APIs Quartz Composer is not part of the iPhone SDK. -- 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: Compiling a XIB creates a different NIB file everytime
On Apr 20, 2009, at 1:44 PM, Lyndsey Ferguson wrote: On Apr 20, 2009, at 4:17 PM, Jonathan Hess wrote: A NIB file contains many hash based unordered data structures, and won't have a byte for byte identical representation from one save/ compile operation to the next - even when the represented interface is identical. Okay, thanks Jon, If you're producing unflattened NIB's via ibtool's --flatten NO, or Xcode's IBC_FLATTEN_NIBS build setting, and you're primarily interested in detecting semantic changes to the file you could instead MD5 the result of running ibtool --all against the produced NIB file. You won't be able to use ibtool --all against a flattened/ stripped NIB. Jon Hess Lyndsey ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jhess%40apple.com This email sent to jh...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Problem in displaying image in NSTableView
Hello All, In my NSTableView I am using NSImageCell as one column to display images. And I have implemented my datastore method like this - - (id) tableView: (NSTableView *)aTableView objectValueForTableColumn: (NSTableColumn *)aTableColumn row: (NSInteger)rowIndex { /* code to display other column data . */ //Code to display image if (coloumnIndex == 2) { NSImage *tmpImage = [[tableData objectAtIndex: rowIndex] personPhoto]; NSLog(@TableController::dataSourceSecondAPI : [ Debug ] Coloumn Index = 2, so returning the image); return tmpImage; } } And my persons init method looks like this - - (id) init { [super init]; personName = @New name; personAddr = @New addrress; personPhoto = [[NSImage alloc] initWithContentsOfFile: @/Volumes/Working/cocoa/Play-NSTableView/Linea.jpg]; if (personPhoto == nil) { return nil; } return self; } After running my application the image looks very small like an icon. Can any one tell me how to display a bigger image in NSTableView? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
simulating nested classes in objective-c
I'm working on a project that involves translating C# code to Objective-C (so I never have to write network protocol definitions again!). I've run into an issue: C# (and Java) both have nested classes which is the ability to define a new class inside of an existing class. This is a nice feature for breaking up functionality within a class, reducing namespace pollution and generally organizing data structures. The problem, of course, is that Objective-C doesn't have nested classes. Luckily I don't actually need to translate the C# nested classes to something of similar functionality, I just need to solve the problem of naming collisions. For instance, if the C# code has two classes that both define a nested class named ResultInfo then I end up with a collision. My first soltion was to prepend the name of the containing class to the name of the nested class so in the previous example I would end up with SomeContainerClass_ResultInfo and SomeOtherContainerClass_ResultInfo. My issue with this is that the names are wy too long. I'm wondering if anyone has had to deal with this issue before and has any ideas of what I can do to keep the names short, not kill the usefulness of Code Sense in XCode, and come at least close to gauranteeing no naming collisions between these translated nested classes. I've read a ton of docs about the porting of and bridges between Java code and Objective-C but they all seem to gloss over the issue of nested classes... Thanks in advance! Aroon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Tracking rects, tracking areas and events
I have a few questions about the subject. 1. What is the difference between tracking areas and tracking rects? 2. If I register a tracking rect, will the mouseMoved: message keep on spamming, or will only mouseEntered: and mouseExited: be sent? If I understood this correctly, all three are activated with the setAcceptsMouseMovedEvents: message. 3. What happens if two rects intersect? Which one will be called? Is it possible to create tree-like priorities like views and subviews? Thanks, - Fisk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
iPhoto and Scripting Bridge
Hi, Does anybody know how to create new albums via Scripting Bridge in iPhoto? Doing this in AppleScript is not difficult, but I don't get it work via Scripting Bridge. Any ideas? With best wishes, Stefan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Creating table rows from XML
Hello all, I'm writing my first iPhone application and I've run into a problem I can't seem to get a grasp on. In short I want to parse an XML file and display a UITableView with data from a set of XML elements. I've got all the code written for this but whenever I try to access my array of data inside of - tableView:cellForRowAtIndexPath: I crash without an error message in console. Here are the two relevant classes: @interface PDPagesViewController : UITableViewController { NSData* received_data; NSMutableArray* pages; } - (void)beginParsing; @end @interface PDPage : NSObject { NSNumber* page_id; NSString* title; } @property(nonatomic,retain) NSNumber* page_id; @property(nonatomic,copy) NSString* title; -(id)init; -(id)initWithID:(int)in_id andTitle:(NSString*)in_title; @end I init my PDPagesViewController as follows: - (id)init { if (self = [super init]) { pages = [[NSMutableArray alloc] init]; [self beginParsing]; } return self; } I construct my NSURLRequest and setup my parser inside of beginParsing. Here is the delegate method which then builds my array: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { // Handle page elements if ([elementName isEqualToString:@page]) { NSString *titleAttr = [attributeDict objectForKey:@title]; NSString *idAttr = [attributeDict objectForKey:@id]; if (titleAttr idAttr) { PDPage* newPage = [[PDPage alloc] initWithID:[idAttr intValue] andTitle:titleAttr]; [pages addObject:newPage]; [newPage release]; } return; } } Insofar as I can tell, everything is ok so far. The problem occurs in this table delegate method (again, part of PDPagesViewController), with crashing lines and received output listed in comments: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @Cell; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } // Set up the cell... NSLog(@Setting up table cell %d, [indexPath row]); // Setting up table cell: 8 NSLog(@retain count: %d, [pages retainCount]); // retain count: 1 NSLog(@array count: %d, [pages count]); // array count: 16 NSLog(@page retain count: %d, [(PDPage*)[pages objectAtIndex: [indexPath row]] retainCount]); // page retain count: 1 NSLog(@title: %@, [(PDPage*)[pages objectAtIndex:[indexPath row]] title]); // This line causes a crash NSLog(@pages array right now: %@, pages); // This line causes a crash cell.text = [[pages objectAtIndex:[indexPath row]] title]; // This line causes a crash return cell; } It seems to me that whenever I try to interact with my NSMutableArray as such in this method it crashes, but when I use only its NSObject methods it's fine. And yet, it and its contents have the right retain count. I feel like I must be missing something basic, so any insight would be much appreciated. Thank you! -- Phil Dokas -//- p...@jetless.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: printer user friendly paper name to internal paper name?
Hi. I'm not quite sure if I got you right but: Am 17.04.2009 um 23:24 schrieb kvic...@pobox.com: my app is fully recordable and scriptable. when the user changes the page setup, i am able to successfully record it and indicate the paper name chosen via -[NSPrintInfo localizedPaperName]. How about saving the return value of paperName instead, which you could use in conjunction with NSPrinter's pageSizeForPaper:? Validation of the string would be as simple as NSZeroSize != [myPrinter pageSizeForPaper:userSuppliedPaperName] HTH 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
OpenGL
dear all, i am new on OpenGL Framework, i dnt know to that how to display the simple 3D image using OpenGL. Thanks in advance. Regards, Fawad Shafi _ Rediscover Hotmail®: Get quick friend updates right in your inbox. http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Updates2_042009___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: hud panel tiger
20 apr 2009 kl. 18.15 skrev Rick C.: Hello, Just to be sure the HUD panel in IB3 cannot be used if the app is for tiger correct? Is there any workaround or basically it has to be done in code? As a note I notice all the 3rd party frameworks seem to be leopard only as well? Thank you, Rick Hi, I believe you are correct on your first point. As a substitution you could use Matt Gemmell's HUDWindow (which can be found at http://mattgemmell.com/source) . Cheers, Tim Andersson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Binding NSDictionary controller to a read-only ivar
Dear all, I was fiddeling around with the NSDictionary controller to display a dictionary of NSStrings along with its corresponding keys in a NSTableView. It works so far, one column is bound to key the other to value of the arranged objects, while the content of the dictionary controller is bound to a dictionary in my model object. So far so good. Now I have a getter method in the model object that returns a NSDictionary in which the values of the original dictionary have been altered. This dictionary is generated on the fly and is returned autoreleased. Now I unbind the dictionary controller of my dictionary property and bind it programatically to the read-only dictionary. It works, but after one run loop I think the dictionary gets released and the dictionary controller's contend is bound to a released object. How do I mange it properly? Do I have to store the altered dictionary as an ivar in the object to get memory management right? Thanks in advance for your help Thomas ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Tracking rects, tracking areas and events
On Apr 19, 2009, at 15:20, Erik Österlund wrote: 1. What is the difference between tracking areas and tracking rects? Tracking rects are available pre-Leopard. NSTrackingArea was introduced in Leopard to fix significant problems that made tracking rects pretty much useless for anything but the simplest cases. 2. If I register a tracking rect, will the mouseMoved: message keep on spamming, or will only mouseEntered: and mouseExited: be sent? Tracking rects have no effect on the production of mouseMoved messages. If I understood this correctly, all three are activated with the setAcceptsMouseMovedEvents: message. No, setAcceptsMouseMovedEvents is something else again. If you're not using NSTrackingArea, or if the mouse isn't inside a NSTrackingArea, you'll get old-style mouseMoved events if setAcceptsMouseMovedEvents: YES has been called for the window. Pre- Leopard, this was the only way to get mouseMoved events. If the mouse is inside a NSTrackingArea, you'll get new-style mouseMoved events instead. To prevent confusion, you'd almost certainly never call setAcceptsMouseMovedEvents: YES if you're using NSTrackingArea. 3. What happens if two rects intersect? If you're asking about tracking rects, there were supposed to be rules about which one won, but I don't recall you could ever rely on it working properly in all cases. Which one will be called? If you asking about NSTrackingArea, all of the relevant areas respond. You're responsible for choosing which ones should really do something. Is it possible to create tree-like priorities like views and subviews? Not with NSTrackingArea. Keep in mind that mouseEntered/mouseExited/ mouseMoved are sent to the tracking area's owner, regardless of the view/subview structure. (OTOH cursorUpdate is sent to the topmost view under the mouse pointer, regardless of the tracking area's owner.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
On 2009 Apr 20, at 11:24, Jim Correia wrote: On Apr 20, 2009, at 2:02 PM, Jerry Krinock wrote: Makes me wonder why NSFetchRequest even supports a predicate, since its predicate has all these limitations and is supposedly more expensive when compared to fetching all objects and then using - [NSArray filteredArrayWithPredicate:] ? You are taking that quote out of context and misinterpreting it. Yes, you're correct about that; I was being sloppy there. However, I did my own experiment on this with about 1200 objects a few months ago, each object having about 2 dozen attributes and a couple of relationships. A couple hundred bytes in each record. I compared the time for a Core Data fetch-with-predicate versus Core Data fetch- without-predicate followed by array filtering. Apples versus apples. The latter was slightly faster. For others this may not be true -- Always test performance in your own app -- and now I understand why NSFetchRequest supports a predicate. But in my case the search completes in milliseconds, and not having to program around the limitations of Core Data's fetch-with- predicate is a huge advantage. On 2009 Apr 20, at 13:09, Sean McBride wrote: It strikes me that if one currently develops with with XML store, and then one day switches to the SQL store ... when one is in for lots of things suddenly breaking. Yup. I gleefully chucked that off my list of things to retest after I ditched the Core Data fetch-with-predicate. On 2009 Apr 20, at 11:23, Melissa Turner wrote: Doing filtering in memory is a code smell. It generally signals that you're fetching against the wrong entity, or that your model needs to be tweaked to be more efficient. Well, when I first started with Core Data, my religion was: Oooo -- database -- relationships -- Oooo -- queries -- fast -- cool. But it doesn't always pan out. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Tracking rects, tracking areas and events
Apr 21, 2009 kl. 12:07 AM skrev Quincey Morris: 2. If I register a tracking rect, will the mouseMoved: message keep on spamming, or will only mouseEntered: and mouseExited: be sent? Tracking rects have no effect on the production of mouseMoved messages. So is there any difference at all between using NSPointInRect on the mouseMoved: event instead of using tracking rects? I mean, the events would have been sent anyway, if I understood this correctly. Then it would also be much easier to dynamically determine which object should be activated and choose whatever rules you want. If I understood this correctly, all three are activated with the setAcceptsMouseMovedEvents: message. No, setAcceptsMouseMovedEvents is something else again. If you're not using NSTrackingArea, or if the mouse isn't inside a NSTrackingArea, you'll get old-style mouseMoved events if setAcceptsMouseMovedEvents: YES has been called for the window. Pre- Leopard, this was the only way to get mouseMoved events. If the mouse is inside a NSTrackingArea, you'll get new-style mouseMoved events instead. To prevent confusion, you'd almost certainly never call setAcceptsMouseMovedEvents: YES if you're using NSTrackingArea. Are the new-style mouseMoved events the same then, except they are sent only when mouse is over the area, while old-style were sent all the time? I thought the point with having tracking rects/areas would be to lower the amount of events sent, and send them only when mouse entered or exited the area. Which one will be called? If you asking about NSTrackingArea, all of the relevant areas respond. You're responsible for choosing which ones should really do something. I suppose that is for the mouseMoved: event, so does the same go for mouseDragged: events? They seem to be both related and unrelated somehow since they have the same kind of behaviour but do not need to be activated to be sent... Is it possible to create tree-like priorities like views and subviews? Not with NSTrackingArea. Keep in mind that mouseEntered/mouseExited/ mouseMoved are sent to the tracking area's owner, regardless of the view/subview structure. (OTOH cursorUpdate is sent to the topmost view under the mouse pointer, regardless of the tracking area's owner.) If this is an OpenGL-view and it has no subviews, but I'd like to have the subview behaviour, would the best approach be to just manually handle events as mentioned earlier, use layers with tracking areas somehow, or perhaps a completely different solution? -Fisk ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: OpenGL
On 20 Apr 09, at 06:59, fawad shafi wrote: i am new on OpenGL Framework, i dnt know to that how to display the simple 3D image using OpenGL. This doesn't appear to be relevant to Cocoa development, at least until the Cocoa OpenGL views get involved. If you're just getting started with OpenGL, you may want to begin by getting yourelf a copy of the OpenGL Red Book. http://www.opengl.org/documentation/red_book/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Tracking rects, tracking areas and events
On Apr 20, 2009, at 16:03, Erik Österlund wrote: So is there any difference at all between using NSPointInRect on the mouseMoved: event instead of using tracking rects? I mean, the events would have been sent anyway, if I understood this correctly. Then it would also be much easier to dynamically determine which object should be activated and choose whatever rules you want. If all you want to do is know where mouse is, then using old-style mouseMoved events is much safer than using tracking rects. But the drawback (as spelled out in the NSWindow documentation) the drawback is that old-style mouseMoved events are spewed out indiscriminately, so long as setAcceptsMouseMovedEvents: YES is in effect for the window. If you don't need to support Tiger, tracking areas are a better solution. Are the new-style mouseMoved events the same then, except they are sent only when mouse is over the area, while old-style were sent all the time? Basically, yes. Well, the new-style events can also tell you which tracking area they were generated for. I thought the point with having tracking rects/areas would be to lower the amount of events sent, and send them only when mouse entered or exited the area. It would have been the point, if tracking rects ever had the capability of limiting the number of mouseMoved events. But they don't, and that is one of their deficiencies. I suppose that is for the mouseMoved: event, so does the same go for mouseDragged: events? They seem to be both related and unrelated somehow since they have the same kind of behaviour but do not need to be activated to be sent... Nope, mouseDragged events are different. They're generated while the mouse is down, and are sent to the view that the mouseDown was sent to. Old-style mouseMoved events (if enabled) are not sent while the mouse is down. New-style mouseMoved events (if enabled during dragging by the NSTrackingEnabledDuringMouseDrag option) are sent while the mouse is down. If this is an OpenGL-view and it has no subviews, but I'd like to have the subview behaviour, would the best approach be to just manually handle events as mentioned earlier, use layers with tracking areas somehow, or perhaps a completely different solution? It's hard to say in general. NSTrackingArea is fairly easy to get started with, so I'd suggest you just experiment to find the best approach for you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem in displaying image in NSTableView
On Apr 18, 2009, at 7:54 PM, cocoa learner wrote: Hello All, In my NSTableView I am using NSImageCell as one column to display images. And I have implemented my datastore method like this - - (id) tableView: (NSTableView *)aTableView objectValueForTableColumn: (NSTableColumn *)aTableColumn row: (NSInteger)rowIndex { /* code to display other column data . */ //Code to display image if (coloumnIndex == 2) { NSImage *tmpImage = [[tableData objectAtIndex: rowIndex] personPhoto]; NSLog(@TableController::dataSourceSecondAPI : [ Debug ] Coloumn Index = 2, so returning the image); return tmpImage; } } And my persons init method looks like this - - (id) init { [super init]; Probably safer to use self = [super init]; here. For most classes self won't change, but it has been brought up on-list before that there are some exceptions where [super init] can give you a completely different instance. personName = @New name; personAddr = @New addrress; personPhoto = [[NSImage alloc] initWithContentsOfFile: @/Volumes/Working/cocoa/Play-NSTableView/Linea.jpg]; if (personPhoto == nil) { You need a call to [self dealloc] here, otherwise you leak an instance of the class if you can't load the image. return nil; } return self; } After running my application the image looks very small like an icon. Can any one tell me how to display a bigger image in NSTableView? The image is scaled to fit the table's row height, rather than having the row height adjusted to fit a particular image. If the row height isn't currently large enough, you can either change it in IB or in code. And for 10.4 and later, you can have your table's delegate implement -tableView:heightOfRow: to change the height on a row-by- row basis. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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 in displaying image in NSTableView
On Apr 20, 2009, at 8:01 PM, Steve Christensen wrote: personName = @New name; personAddr = @New addrress; personPhoto = [[NSImage alloc] initWithContentsOfFile: @/Volumes/Working/cocoa/Play-NSTableView/Linea.jpg]; if (personPhoto == nil) { You need a call to [self dealloc] here, otherwise you leak an instance of the class if you can't load the image. Small correction here: For a failure in -init, call [self release], not dealloc. You should never call dealloc directly except from dealloc itself to call [super dealloc]. -- Gwynne, Daughter of the Code This whole world is an asylum for the incurable. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: OpenGL
On Apr 20, 2009, at 4:23 PM, Andrew Farmer wrote: On 20 Apr 09, at 06:59, fawad shafi wrote: i am new on OpenGL Framework, i dnt know to that how to display the simple 3D image using OpenGL. This doesn't appear to be relevant to Cocoa development, at least until the Cocoa OpenGL views get involved. If you're just getting started with OpenGL, you may want to begin by getting yourelf a copy of the OpenGL Red Book. http://www.opengl.org/documentation/red_book/ ...and subscribe to the mac-opengl mailing list, which is also a better place to ask these sorts of questions. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSArray merge sorting
Would NSSet cut the mustard here? NSArray allows duplicate items; NSSet does not. What do you propose happen if one or both NSArray inputs have items that compare as equal? Algorithmically speaking, a merge sort from two inputs into a new output seems pretty simple. Simply choose the lesser of the two available next-items and append it to the new array. Or if both next- items are equal, choose one arbitrarily. -- GG ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSArray merge sorting
On Apr 20, 2009, at 5:32 PM, Greg Guerin wrote: Would NSSet cut the mustard here? NSArray allows duplicate items; NSSet does not. What do you propose happen if one or both NSArray inputs have items that compare as equal? Algorithmically speaking, a merge sort from two inputs into a new output seems pretty simple. Simply choose the lesser of the two available next-items and append it to the new array. Or if both next-items are equal, choose one arbitrarily. You should probably choose the one that came first in the original array. Merge sort should be order preserving, and even though the objects are ordered the same with respect to the comparison function, their identities my be different and their relative ordering should be preserved. Jon Hess -- GG ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jhess%40apple.com This email sent to jh...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: OpenGL
On 20 Apr 09, at 06:59, fawad shafi wrote: i am new on OpenGL Framework, i dnt know to that how to display the simple 3D image using OpenGL. On Mon, Apr 20, 2009 at 5:27 PM, Steve Christensen puns...@mac.com wrote: ...and subscribe to the mac-opengl mailing list, which is also a better place to ask these sorts of questions. And for goodness' sake, please look at http://linuxmafia.com/faq/Essays/smart-questions.html; before posting such requests for help! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSArray merge sorting
On Apr 20, 2009, at 8:39 PM, Jonathan Hess wrote: On Apr 20, 2009, at 5:32 PM, Greg Guerin wrote: Would NSSet cut the mustard here? NSArray allows duplicate items; NSSet does not. What do you propose happen if one or both NSArray inputs have items that compare as equal? Algorithmically speaking, a merge sort from two inputs into a new output seems pretty simple. Simply choose the lesser of the two available next-items and append it to the new array. Or if both next-items are equal, choose one arbitrarily. You should probably choose the one that came first in the original array. Merge sort should be order preserving, and even though the objects are ordered the same with respect to the comparison function, their identities my be different and their relative ordering should be preserved. This is what computer scientists call a stable sort. Handy if you want to provide a list of names that's sorted by key1, and if key1 is identical, by key2. (last name, then first name, then ID number, for example.) I'm prefectly capable of writing a merge sort. It's just that it seemed like a pretty basic function, which I'm going to use what I'd have thought was a pretty common reason (merging two arrays of strings as possible values for NSComboBoxes), and if Apple had gone to the trouble of writing one, I wanted to use it. Apple's code tends to be faster than the stuff I write, for one thing, and it gets debugged by more people. My quick hack for avoiding this until I wrote a mergesortWithSelector:RemoveDuplicates category on NSArray was to stick the two lists into an NSMutableSet, and then put them into an NSMutableArray and sort that with sortUsingSelector:. That works fine, and seems fast enough (though I didn't instrument it), but offends my sense of elegance. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Creating table rows from XML
On Apr 20, 2009, at 12:30 AM, Phil Dokas wrote: PDPage* newPage = [[PDPage alloc] initWithID:[idAttr intValue] andTitle:titleAttr]; In the -initWithID:andTitle: method are you sure you are copying the title? --Nathan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Creating table rows from XML
What happens when you run it in the debugger, you say this is your first iPhone application if you are new to using a debugger then you really need to learn how to use that, it will make finding bugs like this a lot easier, for example you can break just before you add an object to you array (pages) and type 'po pages' in the terminal to see what pages is, if I have miss read you and you are familiar with the debugger then just ignore everything I have said. On 20/04/2009, at 4:30 PM, Phil Dokas wrote: Hello all, I'm writing my first iPhone application and I've run into a problem I can't seem to get a grasp on. In short I want to parse an XML file and display a UITableView with data from a set of XML elements. I've got all the code written for this but whenever I try to access my array of data inside of - tableView:cellForRowAtIndexPath: I crash without an error message in console. Here are the two relevant classes: @interface PDPagesViewController : UITableViewController { NSData* received_data; NSMutableArray* pages; } - (void)beginParsing; @end @interface PDPage : NSObject { NSNumber* page_id; NSString* title; } @property(nonatomic,retain) NSNumber* page_id; @property(nonatomic,copy) NSString* title; -(id)init; -(id)initWithID:(int)in_id andTitle:(NSString*)in_title; @end I init my PDPagesViewController as follows: - (id)init { if (self = [super init]) { pages = [[NSMutableArray alloc] init]; [self beginParsing]; } return self; } I construct my NSURLRequest and setup my parser inside of beginParsing. Here is the delegate method which then builds my array: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { // Handle page elements if ([elementName isEqualToString:@page]) { NSString *titleAttr = [attributeDict objectForKey:@title]; NSString *idAttr = [attributeDict objectForKey:@id]; if (titleAttr idAttr) { PDPage* newPage = [[PDPage alloc] initWithID:[idAttr intValue] andTitle:titleAttr]; [pages addObject:newPage]; [newPage release]; } return; } } Insofar as I can tell, everything is ok so far. The problem occurs in this table delegate method (again, part of PDPagesViewController), with crashing lines and received output listed in comments: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @Cell; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } // Set up the cell... NSLog(@Setting up table cell %d, [indexPath row]); // Setting up table cell: 8 NSLog(@retain count: %d, [pages retainCount]); // retain count: 1 NSLog(@array count: %d, [pages count]); // array count: 16 NSLog(@page retain count: %d, [(PDPage*)[pages objectAtIndex: [indexPath row]] retainCount]); // page retain count: 1 NSLog(@title: %@, [(PDPage*)[pages objectAtIndex:[indexPath row]] title]); // This line causes a crash NSLog(@pages array right now: %@, pages); // This line causes a crash cell.text = [[pages objectAtIndex:[indexPath row]] title]; // This line causes a crash return cell; } It seems to me that whenever I try to interact with my NSMutableArray as such in this method it crashes, but when I use only its NSObject methods it's fine. And yet, it and its contents have the right retain count. I feel like I must be missing something basic, so any insight would be much appreciated. Thank you! -- Phil Dokas -//- p...@jetless.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/nathan_day%40mac.com This email sent to nathan_...@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
how to combine two cocoa application together
I have two cocoa applications which have the functionality I want to use. Are there any easy way to combine them together. Thanks! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Notifications for the low battery...?
Hi All, I am developing a small Application to perform a Task. Which can drain lot of battery(in Laptops). IOKit provides the APIs to get the battery status but i was not able to find the Notification which can notify the application when the battery is Low. So I want to get the Notifications for the low battery. Is this Possible..? Can anybody help me out. Thanks in Advance. Regards, Anshul jain ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: hud panel tiger
Thank you Tim...just wanted to be sure I wasn't overlooking anything... Much appreciated, Rick From: Cocoa Dev co...@relindor.org To: Rick C. jo_p...@yahoo.com Cc: cocoa-dev@lists.apple.com Sent: Tuesday, April 21, 2009 2:04:21 AM Subject: Re: hud panel tiger 20 apr 2009 kl. 18.15 skrev Rick C.: Hello, Just to be sure the HUD panel in IB3 cannot be used if the app is for tiger correct? Is there any workaround or basically it has to be done in code? As a note I notice all the 3rd party frameworks seem to be leopard only as well? Thank you, Rick Hi, I believe you are correct on your first point. As a substitution you could use Matt Gemmell's HUDWindow (which can be found at http://mattgemmell.com/source). Cheers, Tim Andersson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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