Re: CoreData deleteAll of kind

2009-07-08 Thread Ben Trumbull
On 6 Jul 2009, at 23:37, Devraj Mukherjee wrote: Thanks all for your feedback. Seems quite inefficient. Wonder if this is filed as a suggestion to Apple. Seeming and being aren't the same. If you encounter performance issues with Core Data, please capture a Shark or Instruments trace and

Re: Clarification on accessors? (was: Yet another memory management question)

2009-07-09 Thread Ben Trumbull
-init and -dealloc are special in that the object is not in a consistent state during those methods (it either hasn't yet entered it's "initial" state or is transitioning out of its "final" state). If your accessors rely on the internal state of the object being "normal", they could blow up

Re: Core Data debugging

2009-07-16 Thread Ben Trumbull
On Jul 16, 2009, at 4:49 PM, Timothy Wood wrote: Sure, I should remember to ignore it or initialize it to nil myself or have a OBBaseError macro, but one day I'll forget. The current rules make me write more and more fragile code than I'd need to if we could just all depend on setting NSError loc

Re: Copying Managed Objects from App to Doc MOContext

2009-07-28 Thread Ben Trumbull
taining an NSNull value for keys that were nil, instead of omitting them. I posted the code I was using instead [1]. But then, on 2008 Dec 22, at 00:18, Ben Trumbull wrote: We tried omitting pairs with nil values, and stuff broke. Like views didn't get updated because iterating over th

Re: Copying Managed Objects from App to Doc MOContext

2009-07-28 Thread Ben Trumbull
On Jul 28, 2009, at 5:36 PM, Jerry Krinock wrote: But for restoring previous state over an existing object, that's undesirable. There are other more complicated approaches, but ultimately handling NSNull in your restore code is the least bad approach. In what practical situation would

re: Core Data Crash on MOC Release

2009-08-13 Thread Ben Trumbull
I have a iPhone 3.0 application that is using core data in an NSOperation to perform some updates. It is using it's own NSManagedObjectContext connected to a common (with the main thread) persistent store coordinator. Everything works great until the NSOperation ends and is releasing the managed

RE: Cleaning "garbage" in Core Data

2009-08-17 Thread Ben Trumbull
Squ, You're basically saying you don't want to model your data formally, but you do want to write your own relationship maintenance and delete propagation system. That is a lot of work. At this point, your problem doesn't have anything to do with Core Data. You have NSDictionaries wit

re: Core Data dog-slow when using first time after boot

2009-08-19 Thread Ben Trumbull
when fetching about 5000 objects from an sql store, Core Data is very slow the very first time after a boot. When running the app the first time it takes 50 to 90 seconds and when starting it the second time it is well below one second. Properly done, you could fetch 5000 objects on an original

Re: Core Data dog-slow when using first time after boot

2009-08-19 Thread Ben Trumbull
Interestingly enough, I experienced this behavior in my latest app which doesn't use Core Data. It uses SQLite directly instead. I recalled I had experienced this a long time ago (years ago) and someone (I don't remember who and where) mentioned a solution/ workaround/hack, which involves reading

Re: Core Data dog-slow when using first time after boot

2009-08-20 Thread Ben Trumbull
On Aug 20, 2009, at 2:34 AM, Ruotger Skupin wrote: Am 19.08.2009 um 22:00 schrieb Ben Trumbull: I debugged it with some Snow Leopard magic and found out, that firing faults is very slow the first time after boot. When I use -[NSArray filteredArrayUsingPredicate:] the fault firing is

RE: When do I need to override hash?

2009-08-20 Thread Ben Trumbull
The -hash method is important for objects that are used as keys in associative collections. [snip] So, in practice, it's perfectly safe in 99.9% of cases to base your hash off your object's properties. In the specific case when you're mutating objects that are keys in associative collections (NSD

Re: When do I need to override hash?

2009-08-20 Thread Ben Trumbull
On Aug 20, 2009, at 9:09 PM, Jeff Laing wrote: If you need to know whether or not another object has put your object into an NSDictionary, you're probably doing something wrong. Do you have a specific concern about Core Data using your objects ? No, I guess the point I was trying to make was

Re: Core Data dog-slow when using first time after boot

2009-08-24 Thread Ben Trumbull
On Aug 24, 2009, at 3:20 AM, Ruotger Skupin wrote: Am 20.08.2009 um 22:28 schrieb Ben Trumbull: setRelationshipKeyPathsForPrefetching When I use setRelationshipKeyPathsForPrefetching the fetch throws: -[NSSQLAttribute inverseRelationship]: unrecognized selector sent to instance

re: Using Core Data NSManagedObject subclasses outside of a managed object context

2009-08-24 Thread Ben Trumbull
I have objects that I use with core data that were automatically generated for me by xcode and represent entities in my data store. They all subclass NSManagedObject, and do not have instance variables, but instead use the @dynamic setting for their properties, pretty standard. My understan

Re: Core Data dog-slow when using first time after boot

2009-08-25 Thread Ben Trumbull
On Aug 25, 2009, at 7:19 AM, Ruotger Skupin wrote: Am 24.08.2009 um 23:13 schrieb Ben Trumbull: When I use setRelationshipKeyPathsForPrefetching the fetch throws: -[NSSQLAttribute inverseRelationship]: unrecognized selector sent to instance 0x10ee150 Can you provide the entire stack

re: Correct way to have nil undo manager in Core Data document?

2009-08-29 Thread Ben Trumbull
Well, I've got a background worker process which opens an NSPersistenDocument. Since it has no "undo" capability, I want to set it to nil as recommended. (I have other reasons for not wanting an undo manager scurrying around.) But the document doesn't like having nil undo manager. When I ask f

re: Core Data Predicate Builder - comparing dates

2009-08-29 Thread Ben Trumbull
I have a Core Data entity that has a dateCreated and a dateModified - both NSDates in the object files. I'd like to construct a predicate that will retrieve all records where a record's dateModified is greater than that record's dateCreated. Its deceptively easy to setup something that looks like

re: Curious about $SUBST_VARS within a SUBQUERY of a fetch request template

2009-08-29 Thread Ben Trumbull
I just created a fetch request template in my MOM that looked like: SUBQUERY(platformInfos, $each, $each.platformName == $PLATFORM_NAME)@count == 0 I then looked up the template in the code and attempted to use it in the usual manner with: fetchRequestFromTemplateWithName:substitutionVaria

re: core-data app design question

2009-08-29 Thread Ben Trumbull
I have a question, or rather, I'm looking for advice, on the design of an application. Essentially I'm wanting to write a labbook-type application. My plan was to use core-data for the model. In the model will be an Entry entity. Each entry will have a one-to-one relationship to a Content entity.

re: Core Data observer exception in 10.6

2009-08-29 Thread Ben Trumbull
In a Core Data-based app that works fine in 10.5.x, I now get an exception as follows in 10.6 when opening a document. It targets 10.5, and the same exception occurs when rebuilding on 10.6 (still targeting 10.5, but also when targeting 10.6). I don't register or unregister any observers myself,

re: CoreData: Using to-may relationships in fetch request predicates

2009-08-29 Thread Ben Trumbull
in the typical CoreData example, if I want to fetch all departments whose employees have a salary higher than a specified value, I will perform a fetch on the Department entity using a predicate with the following format: "ANY employees.salary < %@" This is working fine. Now I want to fetch all

re: Core Data : Multiuser ?

2010-08-06 Thread Ben Trumbull
> Can more than one process be accessing the same Core Data sqlite file? > > This post from author Marcus Zarra says "no"∑ > > http://forums.pragprog.com/forums/90/topics/1476 > > But this post from Ben Trumbull seems to say "yes", as long as the two

re: Core Data : Multiuser ?

2010-08-06 Thread Ben Trumbull
p.s. - Ben ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the

Re: Core Data : Multiuser ?

2010-08-07 Thread Ben Trumbull
Hillegas wrote: > Given those limitations, how does one enable support for a 10.6+ target? > > On Aug 6, 2010, at 11:38 PM, Ben Trumbull wrote: > >> It possible, but inefficient, for a very limited number of clients to share >> over AFP. NFS doesn't work co

Re: Core Data : Multiuser ?

2010-08-07 Thread Ben Trumbull
s and > Apple's recent push into SMB, accessing a central database from each of these > devices via Core Data just makes too much sense. Maybe it isn't exactly Core > Data and maybe it's some tie-in to FileMaker, but, I've got to believe it's a > priority for

Re: Core Data : Multiprocess (was Multiuser) ?

2010-08-07 Thread Ben Trumbull
> Sorry. I see I've created confusion by putting "Multiuser" in the subject. > I should have said "Multiprocess" yeah. >> Yes, several Apple frameworks use Core Data databases from multiple >> processes simultaneously with a single user account and single physical >> machine. > > Later, a r

re: KVO and Core data

2010-08-09 Thread Ben Trumbull
> Hi all, > > I have a KVO registration like this: > > [self addObserver:self forKeyPath:@"toOne.attribute" options:0 context:NULL]; > > I establish this on -awakeFromInsert or -awakeFromFetch, and have the > corresponding removeObserver called on -willTurnIntoFault. > > The problem is that wh

Re: Core Data mergeChangesFromContextDidSaveNotification: does not *completely* update the context ?

2010-12-20 Thread Ben Trumbull
On Dec 19, 2010, at 9:49 PM, Aurélien Hugelé wrote: > Hi! > > I think mergeChangesFromContextDidSaveNotification: does not work as most > people expect: > I have a mainthread and a subthread. My subthread updates a managed object > (change one of the property value) and save. > In the mainthre

Re: Multi-storage Core Data

2008-05-22 Thread Ben Trumbull
At 9:54 AM -0700 5/22/08, [EMAIL PROTECTED] wrote: > A MOC is associated with a persistent store coordinator. A PSC can have multiple stores associated with it. What you do not get for free is cross-store relationships. Which is how I understood it, and I'm willing to write some glue here.

re: CoreData Statement Still Active (CoreData Multithreading)

2008-05-22 Thread Ben Trumbull
Dex, This error message is pretty much always a multi-threading bug. -tryLock before a fetch request is not one of the recommended patterns. Consider reviewing the Core Data Programming Guide's multithreading section. You should try the Debug Libraries from ADC. These allow you to enable

Re: Core-Data Multithreading question about save

2008-05-22 Thread Ben Trumbull
At 3:55 AM -0700 5/22/08, [EMAIL PROTECTED] wrote: Il giorno 22/mag/08, alle ore 01:00, Hamish Allan ha scritto: Do you really need to do this after every object inserted? Could you do it in bulk? Not necessarily. I've tried to do this sequence: - my second thread add objects into second co

re: Core Data, transient properties and saving

2008-05-23 Thread Ben Trumbull
As a summary, you can't fetch or sort against transient properties reliably. They don't exist in the persistent store (database). The in memory filtering will apply your predicate to any dirty objects to reconcile unsaved changes with the results from the persistent store. So saving the st

re: Core Data dynamic attributes and fetching

2008-05-24 Thread Ben Trumbull
At 2:56 AM -0700 5/24/08, [EMAIL PROTECTED] wrote: I have a core data object graph using an SQLite store where several entities have an attribute containing a date (eg, birthDate). This is stored as a date type. I am currently implementing an NSPredicateEditor for building smart groups. Each

Re: Incompatible CoreData store format

2008-05-28 Thread Ben Trumbull
Rick, Try cleaning all the targets and rebuilding the entire project. Create a new document instead of opening an existing one. You're probably either getting an old model, a weird union of models, or a corrupted model from previous work. If that doesn't help, you can try adding the documen

Re: warning: 'NSEntityDescription' may not respond to

2008-05-30 Thread Ben Trumbull
The compiler only knows about methods declared somewhere or the headers, and Core Data accessor methods are handled at runtime and not declared anywhere. It's only a warning and not an error because the compiler is smart enough to know that Objective C can do cool stuff like that. One solut

re: CoreData file format stability

2008-06-03 Thread Ben Trumbull
1) The file format for saved files. I'd rather not make some proprietary/closed Microsoft-ish thing - I'd like it to be possible for other programs to read/write my file format, including hypothetical programs that might get written for other platforms so that my file format could possibly be read

re: Core Data merge and "statement is still active" error?

2008-06-03 Thread Ben Trumbull
Michael, This error is almost always a multi-threading problem. When you used the _debug version of Core Data, did you enable the threading assertions with the user default -com.apple.CoreData.ThreadingDebug 3 ? What version of OSX are you using ? Is there a reason you're not using Cor

Re: Core Data merge and "statement is still active" error?

2008-06-05 Thread Ben Trumbull
On Jun 3, 2008, at 8:15 PM, Michael Link wrote: Is there a reason you're not using Core Data's - mergeChangesFromContextDidSaveNotification: ? If the object is modified (inserted, update, or deleted), you should pass in YES to -refreshObject:mergeChanges: Actually I am using mergeChangesF

Re: Core Data merge and "statement is still active" error?

2008-06-05 Thread Ben Trumbull
On Jun 5, 2008, at 7:49 PM, Michael Link wrote: On Jun 5, 2008, at 4:37 PM, Ben Trumbull wrote: On Jun 3, 2008, at 8:15 PM, Michael Link wrote: Is there a reason you're not using Core Data's - mergeChangesFromContextDidSaveNotification: ? If the object is modified (inserted,

Re: Core Data Questions

2008-06-09 Thread Ben Trumbull
All object ivars (except the array for the next lower-level), including those of Shapes, reside in dictionaries. These have certain required properties plus many optional properties, some not currently defined and some possibly not even know to the containing object. Assuming a large fraction

re: Dot syntax

2008-06-17 Thread Ben Trumbull
I've been playing with Core Data and the syntax I use to access a Core Data attribute. In Mac OS X 10.4 I used syntax like: [a valueForKeyPath @"b.selection.c"] where b is a NSObjectController bound to a Core Data entity with Cocoa Bindings and c is an attribute of that entity. In Mac OS X 10.

re: Working if Cocoa Core Data

2008-06-18 Thread Ben Trumbull
*- I'm a Java programmer who wants to migrate to ObjC/Cocoa.* Welcome. Unlike some of the others, I don't think Core Data requires an advanced degree in Cocoa. However, in my experience, trying to learn both Cocoa Bindings and Core Data simultaneously overwhelms many people new to Cocoa.

Re: Creating a Bundle via Code

2008-06-21 Thread Ben Trumbull
Grant, You don't need a bundle or package or anything besides a plain old directory. Core Data doesn't care where you place your images on the file system. One file URL is just as good as any other to Core Data. As others have mentioned, it's probably the transition from JPEG->NSImage->NSD

re: Learning SQLite by watching Core Data?

2008-06-23 Thread Ben Trumbull
David, I highly recommend these two books: Now

Re: Learning SQLite by watching Core Data?

2008-06-23 Thread Ben Trumbull
While Core Data technically uses SQLite, it does undocumented voodoo with SQLite, Core Data only use public SQLite API. For all intents and purposes, Core Data + SQLite should basically be considered a proprietary format. It's the same SQLite file format as on any other platform. The layout

Re: CoreData local and on server sync

2008-06-23 Thread Ben Trumbull
The way that I did before was, creating my own local database, en then when there was a change, replicate the changed data, using DO, to the server. But then I have to keep things in memory. I was hoping for new ideas or that In the Snow version was something new. I guess the way to go is, u

Re: CoreData pagination

2008-06-23 Thread Ben Trumbull
Anyway, is there any way to query CoreData in chunks? I have a very large CoreData SQl store (>1 million) of managed objects and it's taking for ever (well, tens of minutes) to load it all in, never mind to search through it all. (1) Why do you want to load it all in ? (2) Why won't you let Co

re: Core data question in multiwindow doc app

2008-06-27 Thread Ben Trumbull
When I add a new account entity my outlineview doesn't know. Should I be using a notification to find out when a new account entity is added. If so, which one? The easiest way to track insertions and deletions in the NSManagedObjectContext is the notification NSManagedObjectContextObjectsDidCh

valueForKey: on collections [was: Re: Using isMemberOfClass with a tree of subclass of NSManagedObject]

2008-06-28 Thread Ben Trumbull
On Jun 28, 2008, at 1:08 PM, Kyle Sluder wrote: On Sat, Jun 28, 2008 at 2:14 PM, Bill Bumgarner <[EMAIL PROTECTED]> wrote: You want -objectForKey: -valueForKey: is for key value coding, -objectForKey: is for extracting objects from a dictionary. Shouldn't cause a problem. I thought the colle

Re: Guidelines for Cocoa frameworks supporting garbage collection?

2008-07-06 Thread Ben Trumbull
My experience has been that almost every time I've convinced myself that it was safe to use a particular collectable object in another's finalize, I was just plain wrong. This has been my experience as well. Because the ordering of finalization is undefined, it will often work anyway, making

re: How to create to-many accessor methods at runtime

2008-07-06 Thread Ben Trumbull
Steve, First, have you considered the low tech approach of using a gcc variadic macro (#define) ? You can generate a lot of template code this way. With one line of code per key you can generate all the accessors you need. A seco

Re: KVO notifications and threads

2008-07-11 Thread Ben Trumbull
At 1:10 PM -0700 7/11/08, [EMAIL PROTECTED] wrote: So having mutiple CPUs and cores doesnt buy us much more than bragging rights, at least as far as KVO and UI goes. oh well. I like Clark Cox's suggestion for wrapping the set methods in a category that forces the actual set to occur on the MainT

Re: Storing structured data in file - any easy way?

2008-07-11 Thread Ben Trumbull
At 12:39 AM -0700 7/11/08, [EMAIL PROTECTED] wrote: > Out of curiosity, what do you find not simple about doing the above using Core Data? It is easy enough to create the data model using xcode, but how that connects to actual code is harder to see. Maybe I'm just overwhelmed... I've had

re: mysterious core data crash

2008-07-12 Thread Ben Trumbull
Whenever I try to add a new item, the app crashes. I don't get the normal gdb window: instead I get a window that says 'loading stack frames' and the assembly code. The line that the program seems to be stuck on is this: 0x92efbfe2 <+0018> call 0x92efbfe7 But here's the really strange part:

re: Core-data save problem

2008-07-19 Thread Ben Trumbull
I try to save the data, then I am sometimes present with a dialog saying: "The document “Untitled” could not be saved as “pktest.”. Cannot save objects with references outside of their own stores." Dirkjan, How many persistent stores have you added to the NSPersistentStoreCoordinator ? That'

Re: CoreData Property access compiles, but fails at runtime

2008-07-20 Thread Ben Trumbull
You probably should be using @synthesize instead For modeled Core Data properties, @dynamic is better. - Ben ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the mod

re: Autosaving in an NSPersistentDocument

2008-07-20 Thread Ben Trumbull
Rick, There's a difference in NSDocument parlance between "save", "save as", "save to", and "auto save". None of those things are "saves automatically, after a timer or notification" You can easily implement "saves automatically". Apps like iCal simply save at the end of the event, pigg

re: Core Data Debugging

2008-07-25 Thread Ben Trumbull
I use Core Data to store the information and it all runs pretty smoothly, that is until the app has been running for 15-20mins and I start getting Core Data save errors such as "CoreData does not support persistent cross-store relationships" This happens when you save objects to a store that h

Re: Design Question: Pro & Cons of KVC/KVO

2008-08-21 Thread Ben Trumbull
So, does everybody really always use KVC/KVO for implementing MVC, in all projects? Is this the recommended best practice? From code written after 10.2, yeah, pretty much. Coupled with the tools support in Interface Builder and the AppKit support with Cocoa Bindings, it's really not worth t

re: core data hanging

2008-08-26 Thread Ben Trumbull
Chris, No idea why NSURLConnection is hanging on you. Actually, the information here is incomplete so it might not even be NSURLConnection. Attaching to the app in gdb and getting a stack trace of all the active threads would be useful: 'thread apply all bt' and 'info threads'. I susp

re:Core Data: Instantiating linked entities

2008-09-01 Thread Ben Trumbull
- (void) awakeFromInsert { [super awakeFromInsert]; _rect = [NSEntityDescription insertNewObjectForEntityForName:@"Rect" inManagedObjectContext:[self managedObjectContext]]; [_rect retain]; _color = [NSEntityDescription insertNewObjectForEntityForName:@

Re: Core Data: Instantiating linked entities

2008-09-02 Thread Ben Trumbull
On Sep 1, 2008, at 3:48 PM, Godfrey Van Der Linden wrote: On 02/09/2008, at 8:26, Ben Trumbull <[EMAIL PROTECTED]> wrote: - (void) awakeFromInsert { [super awakeFromInsert]; _rect = [NSEntityDescription insertNewObjectForEntityForName:@"Rect" inManagedObj

re: basic Core Data scaling question

2008-09-02 Thread Ben Trumbull
Michael, There are three common issues. First has to do with keeping a stable heap and general memory management. You can find suggestions about how to import a lot of data with Core Data in the Core Data Programming Guide

re: CoreData _PK NSManagedObject

2008-09-17 Thread Ben Trumbull
does somebody know a way to retrieve a NSManagedObject (whose db has already been saved) if I know its _PK in sqlite ? [snip] The result gives me the Z_PK of objects. This Z_PK is the index in the db. NSManagedObject does not accept "_PK" key. Please leave the Z_PK alone. It is not the col

re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Ben Trumbull
Sean, Jon, The documentation is correct for 10.4. On 10.5, things are more forgiving, and you can call -setPrimitiveValue:forKey: with a public set. We won't use that object, but we will use its contents. It does no inverse maintenance, so unless it's part of the public setter for the

re: NSManagedObject subclass accessor pattern mystery?

2008-09-30 Thread Ben Trumbull
So I have a CoreData app (10.5.5, 64 bit only) that has a NSManagedObject that has an NSColor* that is part of its data model. Because this color is actually a computed value that we want to cache, it is declared as a property: @property (retain) NSColor* color; but since we may need to calcula

Re: NSManagedObject subclass accessor pattern mystery?

2008-09-30 Thread Ben Trumbull
On Sep 30, 2008, at 8:38 AM, Michael B Johnson wrote: Thanks for all the insight. A few questions: On Sep 30, 2008, at 3:08 AM, Ben Trumbull wrote: So I have a CoreData app (10.5.5, 64 bit only) that has a NSManagedObject that has an NSColor* that is part of its data model. Because this

Re: Core Data and retain count

2008-03-04 Thread Ben Trumbull
Bill, On Mar 2, 2008, at 5:35 PM, Ben Trumbull wrote: My question is, why would changing a property value cause another property to have its retain count increase? No idea. Why don't you run it in gdb and break on the -retain method and get some stack traces ? This works best i

re: Core Data, SQLite, and Housekeeping

2008-03-05 Thread Ben Trumbull
... so that's fine, but SQLite's documentation says of auto_vacuum: "When the auto-vacuum flag is 1 (full), the freelist pages are moved to the end of the file and the file is truncated to remove the freelist pages at every commit. Note, however, that auto-vacuum only truncates the freelist page

Re: Core Data, SQLite, and Housekeeping

2008-03-05 Thread Ben Trumbull
If you have any performance data showing problems with internal db fragmentation (i.e. sqlite3 dbname 'vacuum' fixes it, but cp doesn't), we'd love to hear about it. Thanks, Ben, for this informative response. So what you're saying, in summary is: 1 - Vacuuming on every save is inefficient

Re: Undo and Core Data issue

2008-03-05 Thread Ben Trumbull
I call processPendingChanges from both the *Will* and *Did* notifications. Please stop. It doesn't make sense for the context to coalesce pending changes in the middle of the change to a single object during the KVO callbacks. Your original problem description is a bit sparse. Common probl

Re: Undo and Core Data issue

2008-03-05 Thread Ben Trumbull
At 6:58 PM -0800 3/5/08, Michael Latta wrote: The calls are on the Will/Did undo/redo notifications not the KVO callbacks on object changes. Ah, okay. There shouldn't be any need to call -processPendingChanges there, unless you're programmatically working with your own undo groups. What I

[ANN] 10.5.2 Core Data debug library available

2008-03-13 Thread Ben Trumbull
All, For ADC members, debug libraries for 10.5, and now 10.5.1 & 10.5.2, are available in the Developer Tools section of Downloads as "Debug and Profile Libraries for Mac OS X 10.5". There's a tech note about how to use these frameworks with DYLD_IMAGE_SUFFIX. 'man dyld' also works. Since

re: sorting large tables

2008-03-13 Thread Ben Trumbull
Unfortunately, the table is not KVO-compliant so I cannot use NSSortDescriptor. And I need to pass the primary and secondary sort fields at runtime, so I cannot use sortUsingSelector since it takes no parameters. NSSortDescriptor requires an object be *KVC* compliant. It does not use KVO. S

Re: sorting large tables

2008-03-13 Thread Ben Trumbull
oops, lost the list on the cc: At 2:55 PM -0700 3/13/08, [EMAIL PROTECTED] wrote: In answer to your question, each record is a "GenericRecord" which contains an array of fields and a numfields count (which varies by record). The table is a "GenericTable" that has an ivar that holds an array of

Re: Best Way To Lookup From a Huge Table

2008-03-14 Thread Ben Trumbull
Frankly, if it's just a table of 100,000 NSNumbers pointing to 8-character strings, CoreData seems a little excessive to me. :) The file system is excellent at something this straight forward. The table can live in RAM and it shouldn't cause any problem. Well if we're really serious, one cou

re: CoreData code working on Tiger - not on Leopard

2008-03-18 Thread Ben Trumbull
Steve, You can get some more information. Add an @try/@catch block to your AppDelegate.m:700 line, and log both the exception and its userInfo dictionary. Also, if you search the archives for my recent post "[ANN] 10.5.2 Core Data debug library available" you can run against a version of Co

re: Core Data faulting and bindings: recursive KVO notifications?

2008-03-28 Thread Ben Trumbull
The problem I'm having arises when selecting all images at once (Command+A), if they are fairly large in number (in my store: ~2000). This takes an enormous time that is definitely > O(n). Command-A should be instantaneous, even for selections 10x larger. The typical performance problems I've

Re: Core Data faulting and bindings: recursive KVO notifications?

2008-03-28 Thread Ben Trumbull
On Mar 28, 2008, at 7:38 PM, Dennis Lorson wrote: On 28 Mar 2008, at 20:24, Ben Trumbull wrote: The problem I'm having arises when selecting all images at once (Command+A), if they are fairly large in number (in my store: ~2000). This takes an enormous time that is definitely

re: NSPersistentDocument Revert Question

2008-03-30 Thread Ben Trumbull
Mike, Each persistent document has its own Core Data stack. When you close one, and reopen it, it has a new NSPersistentStoreCoordinator, NSManagedObjectModel, and NSManagedObjectContext. So any bindings to managed objects or their entity descriptions from the old, deallocated persistent do

Re: Core Data and NSOperation

2008-03-30 Thread Ben Trumbull
Daniel, Each NSOperation is, conceptually, its own thread. In addition to using NSInvocationOperation to easily dispatch a work function to an object, you'll also need to follow the multi-threading rules described in the Core Data Programming Guide. -- -Ben _

re: Core Data migration

2008-03-30 Thread Ben Trumbull
David, To sum up: Relationships to entities from which another entity inherits are not automatically set up properly. Unfortunately. This is a known issue. Anyone have any experience with this, or know how to handle this situation? I suppose I could write a whole bunch of custom code to han

re: NSManagedObject Copy and Paste

2008-03-30 Thread Ben Trumbull
I have a question regarding implementing copy and paste with NSManagedObjects-- You're more or less on the right track. Here's an excerpt regarding moving values between threads which may help you with copy&paste: At 8:22 AM -0700 3/1/06, [EMAIL PROTECTED] wrote: The problem with insertions

re: Core Data Client/Server Application

2008-03-30 Thread Ben Trumbull
Philip, Core Data doesn't support client server applications. Some developers have successfully used it on the client for its data management (undo, change tracking, notifications, etc) and Cocoa Bindings support, with an in-memory store they manage themselves. A few developers have done mor

Re: Core Data faulting and bindings: recursive KVO notifications?

2008-03-30 Thread Ben Trumbull
Dennis, Well, it might be far from ideal for CD performance, but that doesn't mean it's bound poorly. It is done exactly to do what we need it to do, otherwise this binding would have been the first to be targeted for rewrite. Creating a gigantic autoreleased NSArray from valueForKeyPath: a

re: Threads and Core Data, bindings results in view corruption

2008-03-30 Thread Ben Trumbull
David, Jeff, Ben There are a few issues here. First, enough pieces of AppKit and Cocoa Bindings are not thread safe that, even without Core Data, you just can't do this in this particular fashion. If you want multi-threaded work with the view and controller classes in Cocoa, you'll need to

Re: Threads and Core Data, bindings results in view corruption

2008-03-30 Thread Ben Trumbull
On Mar 30, 2008, at 7:50 PM, Ben Lachman wrote: I'm guessing the bugs really should be filed on the documentation since one page on performance of a highly complex API like CD is nowhere near enough. My guess is that documentation doesn't get as many bugs as it should since it is, at the

Re: Threads and Core Data, bindings results in view corruption

2008-03-31 Thread Ben Trumbull
At 4:05 PM -0400 3/31/08, Ben Lachman wrote: You also should try using an SQLite store. It will be faster than a binary store for saving incrementally since it only touches part(s) of the file. Binary store ? Binary store ? The xml, binary, and custom atomic stores are all atomic. The entir

Re: Threads and Core Data, bindings results in view corruption

2008-03-31 Thread Ben Trumbull
At 4:05 PM -0400 3/31/08, Ben Lachman wrote: If you needed to do further work on that entity, like adding relationships to it, then it would get to be trickier, as you'd also need to get its managedObjectID back to your thread. Actually this isn't true. You can add relationships, etc. without

Re: Threads and Core Data, bindings results in view corruption

2008-03-31 Thread Ben Trumbull
At 2:26 PM -0400 3/31/08, Jeff LaMarche wrote: David: I can't speak for Apple (I'll leave that to Ben), but there are a few things to keep in mind here: 1) Core Data is still a relatively new technology. Sure, it came out with Tiger, but since using it keeps your app from running on earli

Re: Threads and Core Data, bindings results in view corruption

2008-03-31 Thread Ben Trumbull
At 1:49 PM -0400 3/31/08, David wrote: I'm relatively new to Cocoa. Welcome. From my previous work in win32 and Java this is the normal scenario, not an unusual one. Can someone point me to some sample code that illustrates how to have a worker thread updating data which is displayed in the

re: core data - beyond the simple example

2008-04-04 Thread Ben Trumbull
Torsten, I've followed some tutorials to get started but somehow I am a bit lost when I want to do some more complex things. This might actually be more because of bindings than because of core data. Or maybe I just did not look at the right place. Maybe you guys can give me some hints links

Re: core data - beyond the simple example

2008-04-04 Thread Ben Trumbull
At 5:19 PM -0700 4/4/08, [EMAIL PROTECTED] wrote: It's a bummer the headstart videos are only available with a non-free ADC membership. really ? Did you try: -- -Ben ___ Cocoa-dev mailing list (C

re: Core Data for managing subtree?

2008-04-13 Thread Ben Trumbull
At 6:13 PM -0700 4/8/08, [EMAIL PROTECTED] wrote: However, I would like to use Core Data to manage these items. I figure I could have my add and remove methods insert and remove objects from the managed object context as well as the KVO-compliant mutable array, but when I undo such an action, the

Re: Why should we set ivars to nil in dealloc?

2008-04-13 Thread Ben Trumbull
Seriously, we're arguing about this ? If you want a total hack, just assign (id) 0x1 to any variable that ... please step away from the tequila. I have a radical suggestion: Test your software. Like crazy talk!! The detection of this class of bugs is extraordinarily easy to automate, so m

re: Chained Migration of Leopard CoreData stores

2008-04-16 Thread Ben Trumbull
Hi, let's say I have four versions of my data model: DataModel1.xcdatamodel DataModel2.xcdatamodel DataModel3.xcdatamodel DataModel4.xcdatamodel (this is the current one) and three model mapping files which always map from version n to version n+1: Mapping1to2.xcmappingmodel Mapping2to3.xcma

re: ManagedObjectContext save issue

2008-04-24 Thread Ben Trumbull
Steve, What's the error, what's in it's userInfo dictionary, and if you use: future-break +[NSError errorWithDomain:code:userInfo:] in gdb, what's the stack trace from the point that creates the error ? -- -Ben ___ Cocoa-dev mailing list (Cocoa-dev@

Re: Counting instances in Core Data

2008-04-29 Thread Ben Trumbull
> In Tiger that was the best means available, but if you're targeting Leopard there is a better option available: Create your fetch request to fetch all instances of a given entity and execute the fetch with countForFetchRequest:error: which will simply return the number of instances/rows

re: CoreData and "conflictList" error during save

2008-05-13 Thread Ben Trumbull
At 10:44 AM -0700 5/12/08, [EMAIL PROTECTED] wrote: Hello, I'm using core-data in a program of mine. It uses two context where one of these is used in a second thread to perform saving operation. Sometimes at the end of all operations when I perform a save operation on my main context I receive

re: Core data model, bindings advice.

2008-05-13 Thread Ben Trumbull
I must admit the bindings for this are really playing with my head. I struggled quite immensely getting the selection from the treecontroller and in the end it started working without me fully understanding why. I have further complications to come as I have the decide whether the transaction am

<    1   2   3   >