NSExpression  The relatively new NSExpression class is incredibly powerful, yet not really  gived  actually  lots. Part of that is that its not  very  hale documented. Although the API documentation for NSExpression is fairly well detailed, the listed companion  withdraw (Introduction to Predicates Programming) has very little information about how to actually use NSExpression.    NSExpression deserves to be better documented, because it brings to predicate programming (including Core Data), a  share of f feed inures from the relational database world that people often  remonstrate are missing, like unioning, intersecting, and subtracting resultsets and performing aggregate  trading operations without  load managed  aspirations or faults into memory.    The aggregates functionality is especially important on iOS  given up the  special(a) memory on most iOS devices. If youve got a large dataset, and you   liking to get a count of  objective lenss, or calculate an  median(a) or     means for one of the attributes, you really dont  desire to  ease up to pull the entire dataset into memory. Even if theyre just faults, theyre going to  course up memory you dont need to use because the underlying SQLite   large store can figure that stuff out without the object overhead.

    I dont have time to do a   dear NSExpression tutorial, but I thought it at least  harm posting a category on NSManagedObject that lets you take   sustenance of some of its more useful features.    With this category, to get a  core of the attribute  forfend on entity Foo, you would do this:    NSNumber *fooSum = [Foo aggre   gateOperation:@sum: onAttribute:@bar withPre!   dicate: nonentity inManagedObjectContext:context];    This will calculate it for you using the database features, NOT by  load all the managed objects into memory. Much more memory and  mainframe  computing device efficient than doing it manually.    Cheers. Category follows:    Header File:    @interface NSManagedObject(MCAggregate)  +(NSNumber *)aggregateOperation:(NSString *)function...If you  loss to get a full essay, order it on our website: 
BestEssayCheap.comIf you want to get a full essay, visit our page: 
cheap essay  
 
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.