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: 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 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 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 David
I found a post with a solution similar to what I was asking about, http://lists.apple.com/archives/student-dev/2006/Jun/msg00104.html Essentially he proposed to maintain multiple mocs in sync using an in memory persistent store. But I worry that that will be too slow and consume excessive memory. _

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

2008-03-31 Thread Ben Lachman
On Mar 31, 2008, at 2:47 PM, Jeff LaMarche wrote: On Mar 31, 2008, at 2:36 PM, David wrote: On Mon, Mar 31, 2008 at 2:26 PM, Jeff LaMarche <[EMAIL PROTECTED]> wrote: 4) You can, as Ben mentioned, use performSelector:onMainThread: to actually have the object inserted on the main thread's co

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

2008-03-31 Thread Jeff LaMarche
On Mar 31, 2008, at 2:36 PM, David wrote: On Mon, Mar 31, 2008 at 2:26 PM, Jeff LaMarche <[EMAIL PROTECTED]> wrote: 4) You can, as Ben mentioned, use performSelector:onMainThread: to actually have the object inserted on the main thread's context. It's a bit of a pain, but threads are alw

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

2008-03-31 Thread David
On Mon, Mar 31, 2008 at 2:26 PM, Jeff LaMarche <[EMAIL PROTECTED]> wrote: > 4) You can, as Ben mentioned, use performSelector:onMainThread: to > actually have the object inserted on the main thread's context. It's a bit > of a pain, but threads are always at least a little painful. > How? Core da

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

2008-03-31 Thread Jeff LaMarche
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 earlier versions of OS X, a lot of software projects

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

2008-03-31 Thread David
Thank you very much for the response which is chock full of helpful information. Its taken me some time to try and digest.I must admit being a little demoralized. I've always considered threading to go hand and hand with GUI programming. I'm having trouble envisioning the scenarios where bindings a

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-30 Thread Ben Lachman
Ben: I was actually just uncovering some of this stuff myself. In my particular case I am mostly doing inserts so while the KVC stuff is interesting and very well may be useful at some point, it doesn't apply to my current situation. My problem is that I receive data from a connection 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 Lachman
On Mar 29, 2008, at 11:48 PM, Jeff LaMarche wrote: Are you using separate managed object contexts for each thread? According to the documentation here: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/ Articles/cdMultiThreading.html That's the way to do it - pass managed

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

2008-03-29 Thread Jeff LaMarche
Dave: Are you using separate managed object contexts for each thread? According to the documentation here: http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html That's the way to do it - pass managed object IDs between threads, not managed object