Re: Core Data Fetches + Transient Properties + NSPredicateEditor = Sadness
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… On 17 Apr 2009, at 04:01, Jerry Krinock wrote: The fact that Core Data cannot fetch using a predicate based on transient properties [1] seems to greatly limit the utility of the NSPredicateEditor view, and makes me very sad. For example, say that my objects are student test results with a 'score' attribute and two dozen other properties. I could give the user an NSPredicateEditor and let them have oodles of fun constructing complex predicates. But what if I need the user to be able to set a predicate with a left-side-expression of letter grade and a right-side-expression popup menu showing 'A' - 'F'. If I could fetch based on a transient 'letterGrade' attribute, I could implement some custom accessors which would calculate 'letterGrade' from 'score' as needed, the predicate emitted from the NSPredicateEditor would just work, and life would be sweet. But since I can't use transient properties in my predicate, providing a popup like that in NSPredicateEditor seems to mean that I'm going to have to somehow deconstruct the compound predicate which Apple put so many man-years of engineering into, have Core Data do sub-fetches, then do my own filtering and put the results back together. I fear that writing bug-free code to handle the general compound predicate would be very time-consuming, and also it would be MVC hell with my NSPredicateEditor subclass (view) code wanting to have model logic such as if score 93, letterGrade = 'A'. Does anyone have any suggestions for a least worst workaround? Thanks, Jerry [1] http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFetching.html#/ /apple_ref/doc/uid/TP40002484 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Advanced Core Data and Inverse Relationships Question
I have two entities Boss and Employee. Boss has the to-many relationship 'employees'. The inverse is, naturally, the to-one relationship 'boss'. My problem is this. I have a custom key that I implement for Boss. And while I am BETWEEN (i.e. the code between) willChangeValue:forKey: and didChangeValue:forKey:, I want to create a new Employee with *self* as a Boss. In other words, I am doing something like [newEmployee setBoss:self]; between willChange and didChange. The problem is this: The inverse is not being maintained properly! That is, even though newEmployee's boss successfully becomes self, newEmployee is NOT added to self's employees collection! Is this normal? Is there any good reason for this? Or is this perhaps a bug in Core Data? For your information, this problem goes a way if I execute didChangeValue:forKey: directly after willChangeValue:forKey: and have all the code after those two, i.e. it works fine when the code is NOT BETWEEN the willChange and didChange. Well, as you can imagine, it also works fine if I first run the code and in the end do willChange and didChange in succession. Any ideas what is going on here? Thanks, U. _ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=createwx_url=/friends.aspxmkt=en-us___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Keeping IB class instance and xCode instance the same
I'm always anxious when I have to actually deal with IB... Sorry to say it, but it's true. It just makes very little sense to me... Anyway, I have a problem. I've got a class that's instantiated in IB, but I need to load it's state from a file. This file defines the class itself, so when I load the file, the instance changes, and my UI stuff gets borked because everything is pointing at the instance from IB, not the one loaded from the file... This probably isn't making much sense The thing is that the IB stuff is recent. Before I added any IB control, the class was instantiated in xCode, so it was rally easy to make sure the instance loaded from the file *became* the instance I was working with in the app. In my IB-challenged state, I know of no simple way to do this when working with IB. What I need to do, from what I can tell, is find some way to tell IB that the instance it has should sync somehow with the instance loaded from the file. Can I do that??? That is, can xCode tell IB to assign its instance to the one from xCode? This is a document based app, but the file I'm talking about is a sort of support file for the app - it's not part of the document, per se. Any thoughts appreciated. J. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Safe Signal Handling from the Run Loop
Hey list, Earlier today I spent awhile trying to re-find some sample code that I discovered awhile ago. I eventually found it, and thought I would mention it here in hopes that it'll help someone in the future. It allows you to handle signals safely within your app's runloop, rather than trying to muck around within the signal handler with all the issues that entails. Check it out here: http://developer.apple.com/SampleCode/PreLoginAgents/listing2.html The function's called InstallHandleSIGTERMFromRunLoop. It's 10.5-only, because it uses some new facilities like CFFileDescriptor and some new kevent stuff. It could be easily modified to handle other signals, or rewritten to be more Cocoa-esque. Anyway, it's pretty much the best code snippet ever. David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Keeping IB class instance and xCode instance the same
On 18/04/2009, at 9:03 AM, James Maxwell wrote: I'm always anxious when I have to actually deal with IB... Sorry to say it, but it's true. It just makes very little sense to me... Anyway, I have a problem. I've got a class that's instantiated in IB, but I need to load it's state from a file. This file defines the class itself, so when I load the file, the instance changes, and my UI stuff gets borked because everything is pointing at the instance from IB, not the one loaded from the file... This probably isn't making much sense The thing is that the IB stuff is recent. Before I added any IB control, the class was instantiated in xCode, so it was rally easy to make sure the instance loaded from the file *became* the instance I was working with in the app. In my IB- challenged state, I know of no simple way to do this when working with IB. What I need to do, from what I can tell, is find some way to tell IB that the instance it has should sync somehow with the instance loaded from the file. Can I do that??? That is, can xCode tell IB to assign its instance to the one from xCode? This is a document based app, but the file I'm talking about is a sort of support file for the app - it's not part of the document, per se. Any thoughts appreciated. Hi James, You need to go through the basic documentation on IB and in particular File's Owner. Objects in IB are the actual objects, with the exception of File's Owner, which is a proxy for an object in your app. That is pretty much the sole means of 'syncing' stuff in IB to your app. While that could be any object at all, typically it's the controller that manages the interface that that particular nib contains. If you have state info in a file, the controller could load this as part of its setup. If the file contains an actual object, maybe the controller could load and own this object. The term 'sync' usually rings alarm bells because in general, any need to 'sync' two objects or bits of data means your design is wrong. I suspect this is sounding just as vague as anything else you've read. Problem is, your question is a bit unfocused. That's why I suggest you need to read up in the basic documentation about nib files and how they work. Once you get a few key concepts straight there isn't much mystery about IB and it should become obvious how to arrange things. --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
Select Object in NSDictionaryController
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. And trying to use the inherited selectObjects: does not work (nothing happens, not even an error message). So: how can I select a row in my table? 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
Using CFStringTransform with Attributed strings or runs, maintaining the styling of the Attributes in transformed results.
Currently, I'm using CFStringTransform to convert Java-based strings files (JBoss .properties files) to something human-readable for verification. Works brilliantly. Luckily, these files are short and this function is super fast. This enables me to naively take all the text of a file provided or copied and pasted and convert it whole in one pass. My question is, will this function handle AttributedStrings? Presumably not. Is there a lazy way to handle this ? (since this function is super good about recognizing and transforming only string ranges that it targets) or is it going to require me coming up with an equivalently clever way of determining the ranges of attribute runs to make this practical?? I can certainly do it, but I am sure if there is a CF or NS way of it, that it is already more clever than anything I would come up 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: SQLite 3 crash report - debugging help needed
See TN2124: Mac OS X Debugging Magic ( http://developer.apple.com/technotes/tn2004/tn2124.html), specifically, the section titled Architecture Considerations. You'll know what types to expect for each argument to the function by looking at the sqlite3 source code. —Jeremy On Sat, Apr 18, 2009 at 11:57 AM, jmun...@his.com wrote: 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. The crash log came from one of my testers. 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. How do I do that? That's something I haven't learned as yet. 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: Using CFStringTransform with Attributed strings or runs, maintaining the styling of the Attributes in transformed results.
On Apr 19, 2009, at 1:42 PM, John Joyce wrote: Currently, I'm using CFStringTransform to convert Java-based strings files (JBoss .properties files) to something human-readable for verification. Works brilliantly. Luckily, these files are short and this function is super fast. This enables me to naively take all the text of a file provided or copied and pasted and convert it whole in one pass. My question is, will this function handle AttributedStrings? Presumably not. Is there a lazy way to handle this ? (since this function is super good about recognizing and transforming only string ranges that it targets) or is it going to require me coming up with an equivalently clever way of determining the ranges of attribute runs to make this practical?? You can try creating an NSMutableAttributedString and then calling CFStringTransform on its -mutableString. Some CF functions (e.g. CFStringTrimWhitespace) screw up the attributes when you do this, but it's worth a try. smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Using CFStringTransform with Attributed strings or runs, maintaining the styling of the Attributes in transformed results.
On Apr 19, 2009, at 3:42 PM, John Joyce wrote: Currently, I'm using CFStringTransform to convert Java-based strings files (JBoss .properties files) to something human-readable for verification. Works brilliantly. Luckily, these files are short and this function is super fast. This enables me to naively take all the text of a file provided or copied and pasted and convert it whole in one pass. My question is, will this function handle AttributedStrings? Presumably not. Is there a lazy way to handle this ? (since this function is super good about recognizing and transforming only string ranges that it targets) or is it going to require me coming up with an equivalently clever way of determining the ranges of attribute runs to make this practical?? I can certainly do it, but I am sure if there is a CF or NS way of it, that it is already more clever than anything I would come up with. Oh, one more question... 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! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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
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. The crash log came from one of my testers. 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. How do I do that? That's something I haven't learned as yet. 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