NSPredicate speed improvement?

2014-03-01 Thread Koen van der Drift
Consider two entities in a many-to-many relationship: Library and Book. In a NSFetchResultController backed UITableView, I like to show all the books from one library, so I constructed the following fetch request: NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:

Re: NSPredicate speed improvement?

2014-03-01 Thread Sixten Otto
Two things: 1. No, doing a string comparison with contains (and case and diacritical folding active) is one of the slower kinds of string comparison. Straight equality should be much faster. 2. You say that there are two entities, with a relationship defined. Why, then, are you doing a string

NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
I have a Document whose file type is a package and potentially contains a few thousand files. My test case is about 7500 files (mostly images). I am using -(NSFileWrapper *)fileWrapperOfType:(NSString *)typeName error:(NSError **)outError The problem is that when there is a very small change

Re: NSPredicate speed improvement?

2014-03-01 Thread Koen van der Drift
You are right about the [cd], which is not supposed to be here, blame it on poor copy-paste skills. So how can I fix the predicate to compare entities? - Koen. On Mar 1, 2014, at 10:22 AM, Sixten Otto hims...@sfko.com wrote: Two things: 1. No, doing a string comparison with contains

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Quincey Morris
On Mar 1, 2014, at 07:23 , Trygve Inda cocoa...@xericdesign.com wrote: The problem is that when there is a very small change (just adding or removing one of the files in the package), the system does not save in place. Rather it reads the previous package file completely, writes out a copy

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
On Mar 1, 2014, at 07:23 , Trygve Inda cocoa...@xericdesign.com wrote: The problem is that when there is a very small change (just adding or removing one of the files in the package), the system does not save in place. Rather it reads the previous package file completely, writes out a

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
On Mar 1, 2014, at 11:11 , Trygve Inda cocoa...@xericdesign.com wrote: I really need this to be faster. I think the point I was trying to reach was that your next step is to investigate what is taking the time. IIRC there’s a NSURL attribute key you can use to retrieve a file’s inode

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Mike Abdullah
On 1 Mar 2014, at 19:11, Trygve Inda cocoa...@xericdesign.com wrote: On Mar 1, 2014, at 07:23 , Trygve Inda cocoa...@xericdesign.com wrote: The problem is that when there is a very small change (just adding or removing one of the files in the package), the system does not save in place.

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Quincey Morris
On Mar 1, 2014, at 14:53 , Mike Abdullah mabdul...@karelia.com wrote: It is -[NSFileWrapper writeToURL:options:originalContentsURL:error:] which has the feature of writing out hard links for efficiency. But it only does it if requested, by passing a suitable URL as the original contents URL.

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
On 1 Mar 2014, at 19:11, Trygve Inda cocoa...@xericdesign.com wrote: On Mar 1, 2014, at 07:23 , Trygve Inda cocoa...@xericdesign.com wrote: The problem is that when there is a very small change (just adding or removing one of the files in the package), the system does not save in place.

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Mike Abdullah
On 1 Mar 2014, at 23:26, Trygve Inda cocoa...@xericdesign.com wrote: I have a top level FileWrapper which contains the wrappers for all my files. Is there any sample code that would help me figure out the right way to do this? [NSFileWrapper writeToURL:options:originalContentsURL:error:]

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
On 1 Mar 2014, at 23:26, Trygve Inda cocoa...@xericdesign.com wrote: I have a top level FileWrapper which contains the wrappers for all my files. Is there any sample code that would help me figure out the right way to do this? [NSFileWrapper

Re: NSDocument save incremental file package in-place

2014-03-01 Thread Trygve Inda
On 1 Mar 2014, at 23:26, Trygve Inda cocoa...@xericdesign.com wrote: I have a top level FileWrapper which contains the wrappers for all my files. Is there any sample code that would help me figure out the right way to do this? [NSFileWrapper

Auto center within a custom NSView

2014-03-01 Thread Lorenzo Thurman
I have to add a variable number of NSSliders to a custom view, (although, probably no more than eight). I’d like these items centered within the view, but am unsure how to achieve this. I know I could probably “do the math” and just calculate the position of each as its added, but I thought I

Re: Auto center within a custom NSView

2014-03-01 Thread Kyle Sluder
On Sat, Mar 1, 2014, at 09:19 PM, Lorenzo Thurman wrote: I have to add a variable number of NSSliders to a custom view, (although, probably no more than eight). I’d like these items centered within the view, but am unsure how to achieve this. I know I could probably “do the math” and just

Re: Auto center within a custom NSView

2014-03-01 Thread Lorenzo Thurman
Thanks, I should have known that. On Mar 1, 2014, at 11:55 PM, Kyle Sluder k...@ksluder.com wrote: On Sat, Mar 1, 2014, at 09:19 PM, Lorenzo Thurman wrote: I have to add a variable number of NSSliders to a custom view, (although, probably no more than eight). I’d like these items centered