Re: Using NSPredicateEditor with core data
Peter. Thank you very much. On Aug 14, 2010, at 12:27 AM, Peter Ammon wrote: > You can get the left and right expressions, etc. by calling through to super: > > NSComparisonPredicate *superPredicate = [super > predicateWithSubpredicates:subpredicates]; > NSExpression *lhs = [superPredicate leftExpression], *rhs = > [superPredicate rightExpression]; > ... > > You would return a new predicate constructed from from the pieces of super's > predicate, except substitute in your own modifier. > > -Peter > > On Aug 13, 2010, at 3:12 PM, Gustavo Pizano wrote: > >> Peter hello, first of all thanks for the reply. >> >> So yes, I need to cross a to-many relationship. let me see if I got this >> straight because my mind was heading in that same direction you commented, >> just I didn't know what to use or what was the name of the artifact, in this >> case the NSComparasionPredicateModifier. >> >> So due the fact that I already have overwritten NSPredicateEditorRowTemplate >> to enlarge the Floating-Decimal NSTextfield of the right expression, I would >> take that approach first, overwriden the predicateWithSubpredicates method >> and doing the following: >> >> - (NSPredicate *)predicateWithSubpredicates:(NSArray *)subpredicates{ >> NSPredicate * predicate = [NSComparasionPredicate >> predicateWithLeftExpression:(NSExpression *)lhs >> rightExpression:(NSExpression*)rhs modifier: NSAllPredicateModifier >> >> type:(NSPredicateOperatorType)type options:NSCaseInsensitivePredicateOption]; >> } >> >> I don't know what lhs, rhs and type must be. should I pass [[self >> leftExpresions] objectAtIndex:0] and also for the rightExpresion? or does it >> comes from the subpredicates parameter?. >> >> sorry I got little confused there... :( >> >> Thx >> >> Gustavo >> >> >> On Aug 13, 2010, at 11:49 PM, Peter Ammon wrote: >> >>> >>> On Aug 13, 2010, at 8:45 AM, Gustavo Pizano wrote: >>> Hello all once again. I have been searching but I hadn't found something useful, so please before if you know a place I can look at let me know. I have these 3 Entities ExpenditureGroup: name icon. --- toExpenditures. ->> Expenditure creationDate location total toExpenditureGroup -> toExpenditureDetails ->> ExpenditureDetail detailDescrb subTotal -- toExpenditure -> also I have an arrayController that fetches all the ExpenditureGroup Entities called _expenditureGorupArrayController. in my predicate editor I added the NSPredicateEditorRowTemplates with key paths for toExpenditures.location, toExpenditures.creationDate, toExpenditures.total, toExpenditures.toExpenditrueDetails.detailDescrb and finally toExpenditures.toExpenditureDetails.subTotal. I dunno if those last 2 are ok.. my guess NO. anyway, when I set the predicate, Im setting into the _expenditureGroupArrayController setFilterPredicate, and pass the predicate I just created, but nothing seems to work. >>> >>> Hi Gustavo, >>> >>> It looks like you want your predicate to cross a "to-many" relation. Is >>> that right? If so, you need to create a predicate that has an >>> NSComparisonPredicateModifier that knows how to cross to-many relations >>> (that is, either NSAllPredicateModifier or NSAnyPredicateModifier). >>> >>> If you're using NSPredicateEditor to create the predicate, then the >>> RowTemplate has to know to create a predicate with the right modifier. >>> Unfortunately you cannot yet set that up in IB, but you can do it >>> programmatically, by passing the right NSComparisonPredicateModifier to one >>> of the initWith... methods on NSPredicateEditorRowTemplate (see its header). >>> >>> You can also subclass NSPredicateEditorRowTemplate and override >>> -predicateWithSubpredicates: to create an NSPredicate with the proper >>> modifier. >>> >>> Hope that helps, let me know if that's not clear, >>> -Peter >>> >> > ___ 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
Recursive file remove
Hello, What is the best way to recursively remove a directory and all of it's sub directories and files, BTW I need to support 10.4 systems. Thanks, tom___ 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
Clarification on Associated Objects
Hi everyone, I'm adding an associated object (an NSMutableArray) to an NSView with a policy of OBJC_ASSOCIATION_RETAIN. If I'm reading the documentation correctly, I don't have to worry about clearing the associated object when the view is deallocated, because it will be taken care of for me, correct? Listing 7-1 on the associated objects page of the Objective-C Programming Language guide seems to indicate that this is the case. So am I good with letting the runtime clean things up, or do I need to take care of cleaning up the array myself at some point during object deallocation? Thanks, Dave 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
va_list customize strings and objects.
Hello, I'm wanting to let's say escape strings and objects in a va_list before I use NSString to place the format together into one string. I know that on OS X va_list is just a char * that is an array, so I know I should be able to make one manually in code, but how is the question. I read http://cocoawithlove.com/2009/05/variable-argument-lists-in-cocoa.html and that's how I know va_list is a char *. Here is what I have come up with so far, I just need to know how to replace the value of the object with a new one, and the value of the string with the new one, and to just leave everything else the same. I would expect that I'll have to make a a new char * with the arguments and the changes or at least have a reference to the start of the va_list so I can send that back to NSString's initWithFormat:arguments:. va_list ap; va_start(ap, format); if (format==nil) return; NSString *currentFormat = format; NSRange range = [currentFormat rangeOfString:@"%"]; while (range.location!=NSNotFound) { unichar character = [currentFormat characterAtIndex:range.location+1]; NSLog(@"%C", character); switch (character) { case '@': // Do something with the object. break; case 's': // Do something with the string. break; default: // Leave this alone. break; } currentFormat = [currentFormat substringWithRange:NSMakeRange(range.location+2, [currentFormat length]-(range.location+2))]; range = [currentFormat rangeOfString:@"%"]; } NSString *result = [[[NSString alloc] initWithFormat:format arguments:ap] autorelease]; va_end(ap); I know this is something hard to understand, I hope that code snippet above will help you understand what I'm trying to do. Any help at all will be greatly appreciated. Thanks, Mr. Gecko___ 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
Get an escape sequence out of an NSString
Given an NSString @"\ue001" like this, how does one get the value into an NSInteger so that its equal to 0xe001? I've tried converting it to an NSData with an encoding of NSUTF16BigEndianStringEncoding, but I'm not getting what I expect. Experience has taught me that usually its because I'm being dumb. So trying to get out of being dumb, I'm asking for help. ___ 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
url scheme for plugin
I am building a plugin application and are currently setting up potionstore, which emails out a license and a custom registration link. My question is: Is it possible to add a custom url scheme for plugins? I havnt been able to find a way to make my app plugin respond to my custom url scheme. any help, would be appreciated. thanks in advance.___ 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
initWithNibName:nil not working for UITableViewController?
I asked for a new file which was a UITableViewController along with the corresponding nib file. But when I instantiated my controller and presented it, the table was not taking on any of the characteristics I was specifying in the nib file. After some experimentation (subtext: this took all day to figure out), it turned out that this was because initWithNibName: was not behaving the way I expected. I was saying this: TableViewController* tvc = [[TableViewController alloc] initWithNibName:nil bundle:nil]; I changed it to this: TableViewController* tvc = [[TableViewController alloc] initWithNibName:@"TableViewController" bundle:nil]; And presto, everything worked fine. But I had expected initWithNibName: to follow the rule documented under UIViewController: "If you specify nil for the nibName parameter and do not override the loadView method in your custom subclass, the default view controller behavior is to look for a nib file whose name (without the .nib extension) matches the name of your view controller class. If it finds one, the class name becomes the value of the nibName property, which results in the corresponding nib file being associated with this view controller." But clearly that's not the behavior I was getting; instead, I had to specify the nib name explicitly, even though its name was the same as the name of the class. Is this a bug? I've made a small demonstration project that I can easily send in via bugreporter, if so. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ pantes anthropoi tou eidenai oregontai phusei Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide, 2nd edition http://www.tidbits.com/matt/default.html#applescriptthings Take Control of Exploring & Customizing Snow Leopard http://tinyurl.com/kufyy8 RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html TidBITS, Mac news and reviews since 1990, http://www.tidbits.com ___ 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: Unzip class/lib
you can also use the standard zlib library and create a category for NSData by using the 'bytes' of NSData and the inflate() and deflate() functions of the zlib library. ~John Ackert On Aug 13, 2010, at 8:56 PM, Kyle Sluder wrote: > On Fri, Aug 13, 2010 at 11:39 AM, Tom Jones wrote: >> I have been googling for a little while now and I'm not finding the answers. >> Does Mac OS X have a unzip library to unzip the archives created in the GUI. >> I guess I could do the NSTask thing but I would rather not. I would also >> like to avoid a framework as well as my app is a Foundation tool. > > Using NSTask to run ditto is the most compatible solution, especially > since that's what I believe the Finder does. It properly takes care of > the Mac-specific metadata. > > Why does being a Foundation tool make you want to avoid using a > framework? You're already dynamically linking against all the other > libraries, including Foundation. If you can get over your dislike of > frameworks, there's the OmniUnzip framework at > http://github.com/omnigroup/OmniGroup/tree/master/Frameworks/OmniUnzip/ > . > > --Kyle Sluder > ___ > > 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/cocoaschool%40aol.com > > This email sent to cocoasch...@aol.com ___ 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: NSCountedSet and NSString values question
Philip Mobley wrote: The author of the article is somewhat unsure whether using - isEqual: is safe, but after looking at the [NSString hash] documentation I feel confident in my current implementation. That author is confused, and should consult some reference documentation. It's really quite simple. In the words of the NSObject protocol reference doc, "This method defines what it means for instances to be equal." Any concerns over the details of the implementation, or reliance upon those details, runs counter to the principles of object-oriented programming and encapsulation. Short answer... yes. NSSet and subclasses *effectively* compares the value of the NSString and not the object address. Cocoa Fundamentals Guide, Cocoa Objects section, Introspection sub-section, Object Comparison heading. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ CocoaFundamentals/CocoaObjects/CocoaObjects.html It might be useful to read the whole guide if it's new to you, or read it again if you've read it before. I often find that rereading fundamentals gives new insights. Also see the Discussion under NSString isEqualToString: “Literal” when applied to string comparison means that various Unicode decomposition rules are not applied and Unicode characters are individually compared. So, for instance, “Ö” represented as the composed character sequence “O” and umlaut would not compare equal to “Ö” represented as one Unicode character. -- GG ___ 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: NSCountedSet and NSString values question
On Aug 13, 2010, at 17:13, Philip Mobley wrote: > I guess the issue is really more related to the fact that I didn't understand > how NSStrings work with the -isEqual: function. I have been reading up on > it, and have read some interesting things including: > > http://www.drobnik.com/touch/2009/11/the-world-on-an-nsstring/ > > The author of the article is somewhat unsure whether using -isEqual: is safe, > but after looking at the [NSString hash] documentation I feel confident in my > current implementation. Er, you probably don't want to take advice from authors who are "somewhat unsure". In the case, assuming I actually understood what was written there, the author was flat out wrong about the semantics of 'hash', and the rest of the comments following on from that are just noise. ___ 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: NSCountedSet and NSString values question
On Aug 13, 2010, at 4:14 PM, Greg Guerin wrote: >> My question is basically how does NSCountedSet handle string values, are >> they interpreted by their string values or by their object values? If they >> are by object, then I need to do more work to pull the exact key object from >> the NSDictionary. > > NSCountedSet inherits from NSSet and NSMutableSet, both of which use the hash > and isEqual: methods of contained objects. See the reference docs for each. > > In general, docs for a class do not repeat descriptions from a superclass, > unless there is a difference. So to fully understand what any class does, > you must often read the superclass's docs as well as the docs of the class > you wish to use. Thank you for your replies... I guess the issue is really more related to the fact that I didn't understand how NSStrings work with the -isEqual: function. I have been reading up on it, and have read some interesting things including: http://www.drobnik.com/touch/2009/11/the-world-on-an-nsstring/ The author of the article is somewhat unsure whether using -isEqual: is safe, but after looking at the [NSString hash] documentation I feel confident in my current implementation. Short answer... yes. NSSet and subclasses *effectively* compares the value of the NSString and not the object address. ___ 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: How to assure NSTask termination when parent dies
On 13 Aug 2010, at 22:32, Greg Guerin wrote: >> Process group code: >> >> // launch the task >> [task launch]; >> >> pid_t group = setsid(); >> if (group == -1) { >>NSLog(@"setsid() == -1"); >> group = getpgrp(); >> } >> if (setpgid([task processIdentifier], group) == -1) { >> NSLog(@"unable to put task into same group as self: errno = %i", >> errno); >> } > > The current process-group id is inherited across fork() and execve() - see > their respective man pages. So if you reorder the operations so setsid() > occurs before [task launch], then the child inherits automatically. > Hah! That does seem to have the desired effect. > This doesn't mean the child can't change its own pgid/sid. And since you > mention a shell, it's not unusual for shells to do exactly that. > In my simple test (one task forks/execs to bash which forks/execs 10 background sleeps) killing the process leader has the desired cascade of terminations. Thanks and regards Jonathan Mitchell Developer Mugginsoft LLP http://www.mugginsoft.com___ 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: NSCountedSet and NSString values question
Philip Mobley wrote: My question is basically how does NSCountedSet handle string values, are they interpreted by their string values or by their object values? If they are by object, then I need to do more work to pull the exact key object from the NSDictionary. NSCountedSet inherits from NSSet and NSMutableSet, both of which use the hash and isEqual: methods of contained objects. See the reference docs for each. In general, docs for a class do not repeat descriptions from a superclass, unless there is a difference. So to fully understand what any class does, you must often read the superclass's docs as well as the docs of the class you wish to use. -- GG ___ 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: Unzip class/lib
Tom Jones (tjo...@acworld.com) on 2010-08-13 14:39 said: >I have been googling for a little while now and I'm not finding the >answers. Does Mac OS X have a unzip library to unzip the archives >created in the GUI. I guess I could do the NSTask thing but I would >rather not. I would also like to avoid a framework as well as my app is >a Foundation tool. You might want to file a bug also, asking that NSWorkspaceDecompressOperation be implemented. It's there in the docs, teasing you, but says "Decompress file. This operation always returns an error.". :) Sean -- "How much harm does a company have to do before we question its right to exist?" — Paul Hawken___ 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
NSOutlineView Drop
When dragging into an NSOutlineView if I drop all is well. If in the same drag operation I continue out of the NSOutlineView cells remain highlighted. How should I keep this from happening? -koko ___ 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: Storing objects in NSMutableDictionary
On Fri, Aug 13, 2010 at 4:22 PM, Greg Parker wrote: > On Aug 13, 2010, at 1:09 PM, Geoffrey Holden wrote: >> Is it possible to store a class object in NSMutableDictionary? > > Class objects cannot be used as dictionary keys, because NSDictionary copies > its keys and class objects can't be copied. Class objects can be used as > dictionary values. This does not appear to be the case. From the NSObject docs: copyWithZone: Returns the receiver. + (id)copyWithZone:(NSZone *)zone Return Value The receiver. Discussion This method exists so class objects can be used in situations where you need an object that conforms to the NSCopying protocol. For example, this method lets you use a class object as a key to an NSDictionary object. You should not override this method. Mike ___ 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 NSPredicateEditor with core data
You can get the left and right expressions, etc. by calling through to super: NSComparisonPredicate *superPredicate = [super predicateWithSubpredicates:subpredicates]; NSExpression *lhs = [superPredicate leftExpression], *rhs = [superPredicate rightExpression]; ... You would return a new predicate constructed from from the pieces of super's predicate, except substitute in your own modifier. -Peter On Aug 13, 2010, at 3:12 PM, Gustavo Pizano wrote: > Peter hello, first of all thanks for the reply. > > So yes, I need to cross a to-many relationship. let me see if I got this > straight because my mind was heading in that same direction you commented, > just I didn't know what to use or what was the name of the artifact, in this > case the NSComparasionPredicateModifier. > > So due the fact that I already have overwritten NSPredicateEditorRowTemplate > to enlarge the Floating-Decimal NSTextfield of the right expression, I would > take that approach first, overwriden the predicateWithSubpredicates method > and doing the following: > > - (NSPredicate *)predicateWithSubpredicates:(NSArray *)subpredicates{ > NSPredicate * predicate = [NSComparasionPredicate > predicateWithLeftExpression:(NSExpression *)lhs > rightExpression:(NSExpression*)rhs modifier: NSAllPredicateModifier > > type:(NSPredicateOperatorType)type options:NSCaseInsensitivePredicateOption]; > } > > I don't know what lhs, rhs and type must be. should I pass [[self > leftExpresions] objectAtIndex:0] and also for the rightExpresion? or does it > comes from the subpredicates parameter?. > > sorry I got little confused there... :( > > Thx > > Gustavo > > > On Aug 13, 2010, at 11:49 PM, Peter Ammon wrote: > >> >> On Aug 13, 2010, at 8:45 AM, Gustavo Pizano wrote: >> >>> Hello all once again. >>> >>> I have been searching but I hadn't found something useful, so please >>> before if you know a place I can look at let me know. >>> >>> I have these 3 Entities >>> >>> ExpenditureGroup: >>> name >>> icon. >>> --- >>> toExpenditures. ->> >>> >>> >>> Expenditure >>> creationDate >>> location >>> total >>> >>> toExpenditureGroup -> >>> toExpenditureDetails ->> >>> >>> >>> ExpenditureDetail >>> detailDescrb >>> subTotal >>> -- >>> toExpenditure -> >>> >>> also I have an arrayController that fetches all the ExpenditureGroup >>> Entities called _expenditureGorupArrayController. >>> >>> in my predicate editor I added the NSPredicateEditorRowTemplates with key >>> paths for toExpenditures.location, toExpenditures.creationDate, >>> toExpenditures.total, toExpenditures.toExpenditrueDetails.detailDescrb and >>> finally toExpenditures.toExpenditureDetails.subTotal. >>> >>> I dunno if those last 2 are ok.. my guess NO. >>> >>> anyway, when I set the predicate, Im setting into the >>> _expenditureGroupArrayController setFilterPredicate, and pass the predicate >>> I just created, but nothing seems to work. >> >> Hi Gustavo, >> >> It looks like you want your predicate to cross a "to-many" relation. Is >> that right? If so, you need to create a predicate that has an >> NSComparisonPredicateModifier that knows how to cross to-many relations >> (that is, either NSAllPredicateModifier or NSAnyPredicateModifier). >> >> If you're using NSPredicateEditor to create the predicate, then the >> RowTemplate has to know to create a predicate with the right modifier. >> Unfortunately you cannot yet set that up in IB, but you can do it >> programmatically, by passing the right NSComparisonPredicateModifier to one >> of the initWith... methods on NSPredicateEditorRowTemplate (see its header). >> >> You can also subclass NSPredicateEditorRowTemplate and override >> -predicateWithSubpredicates: to create an NSPredicate with the proper >> modifier. >> >> Hope that helps, let me know if that's not clear, >> -Peter >> > ___ 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 NSPredicateEditor with core data
Peter hello, first of all thanks for the reply. So yes, I need to cross a to-many relationship. let me see if I got this straight because my mind was heading in that same direction you commented, just I didn't know what to use or what was the name of the artifact, in this case the NSComparasionPredicateModifier. So due the fact that I already have overwritten NSPredicateEditorRowTemplate to enlarge the Floating-Decimal NSTextfield of the right expression, I would take that approach first, overwriden the predicateWithSubpredicates method and doing the following: - (NSPredicate *)predicateWithSubpredicates:(NSArray *)subpredicates{ NSPredicate * predicate = [NSComparasionPredicate predicateWithLeftExpression:(NSExpression *)lhs rightExpression:(NSExpression*)rhs modifier: NSAllPredicateModifier type:(NSPredicateOperatorType)type options:NSCaseInsensitivePredicateOption]; } I don't know what lhs, rhs and type must be. should I pass [[self leftExpresions] objectAtIndex:0] and also for the rightExpresion? or does it comes from the subpredicates parameter?. sorry I got little confused there... :( Thx Gustavo On Aug 13, 2010, at 11:49 PM, Peter Ammon wrote: > > On Aug 13, 2010, at 8:45 AM, Gustavo Pizano wrote: > >> Hello all once again. >> >> I have been searching but I hadn't found something useful, so please before >> if you know a place I can look at let me know. >> >> I have these 3 Entities >> >> ExpenditureGroup: >> name >> icon. >> --- >> toExpenditures. ->> >> >> >> Expenditure >> creationDate >> location >> total >> >> toExpenditureGroup -> >> toExpenditureDetails ->> >> >> >> ExpenditureDetail >> detailDescrb >> subTotal >> -- >> toExpenditure -> >> >> also I have an arrayController that fetches all the ExpenditureGroup >> Entities called _expenditureGorupArrayController. >> >> in my predicate editor I added the NSPredicateEditorRowTemplates with key >> paths for toExpenditures.location, toExpenditures.creationDate, >> toExpenditures.total, toExpenditures.toExpenditrueDetails.detailDescrb and >> finally toExpenditures.toExpenditureDetails.subTotal. >> >> I dunno if those last 2 are ok.. my guess NO. >> >> anyway, when I set the predicate, Im setting into the >> _expenditureGroupArrayController setFilterPredicate, and pass the predicate >> I just created, but nothing seems to work. > > Hi Gustavo, > > It looks like you want your predicate to cross a "to-many" relation. Is that > right? If so, you need to create a predicate that has an > NSComparisonPredicateModifier that knows how to cross to-many relations (that > is, either NSAllPredicateModifier or NSAnyPredicateModifier). > > If you're using NSPredicateEditor to create the predicate, then the > RowTemplate has to know to create a predicate with the right modifier. > Unfortunately you cannot yet set that up in IB, but you can do it > programmatically, by passing the right NSComparisonPredicateModifier to one > of the initWith... methods on NSPredicateEditorRowTemplate (see its header). > > You can also subclass NSPredicateEditorRowTemplate and override > -predicateWithSubpredicates: to create an NSPredicate with the proper > modifier. > > Hope that helps, let me know if that's not clear, > -Peter > ___ 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
NSCountedSet and NSString values question
I am keeping track of the number of times an object is accessed by key value within a NSDictionary. I am using a manager type class where I request the object from the manager, and it accesses the NSDictionary for the object, therefore I am using a method such as this: - (CGImageRef) imageNamed:(NSString *)name; My question is basically how does NSCountedSet handle string values, are they interpreted by their string values or by their object values? If they are by object, then I need to do more work to pull the exact key object from the NSDictionary. ___ 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 NSPredicateEditor with core data
On Aug 13, 2010, at 8:45 AM, Gustavo Pizano wrote: > Hello all once again. > > I have been searching but I hadn't found something useful, so please before > if you know a place I can look at let me know. > > I have these 3 Entities > > ExpenditureGroup: > name > icon. > --- > toExpenditures. ->> > > > Expenditure > creationDate > location > total > > toExpenditureGroup -> > toExpenditureDetails ->> > > > ExpenditureDetail > detailDescrb > subTotal > -- > toExpenditure -> > > also I have an arrayController that fetches all the ExpenditureGroup Entities > called _expenditureGorupArrayController. > > in my predicate editor I added the NSPredicateEditorRowTemplates with key > paths for toExpenditures.location, toExpenditures.creationDate, > toExpenditures.total, toExpenditures.toExpenditrueDetails.detailDescrb and > finally toExpenditures.toExpenditureDetails.subTotal. > > I dunno if those last 2 are ok.. my guess NO. > > anyway, when I set the predicate, Im setting into the > _expenditureGroupArrayController setFilterPredicate, and pass the predicate I > just created, but nothing seems to work. Hi Gustavo, It looks like you want your predicate to cross a "to-many" relation. Is that right? If so, you need to create a predicate that has an NSComparisonPredicateModifier that knows how to cross to-many relations (that is, either NSAllPredicateModifier or NSAnyPredicateModifier). If you're using NSPredicateEditor to create the predicate, then the RowTemplate has to know to create a predicate with the right modifier. Unfortunately you cannot yet set that up in IB, but you can do it programmatically, by passing the right NSComparisonPredicateModifier to one of the initWith... methods on NSPredicateEditorRowTemplate (see its header). You can also subclass NSPredicateEditorRowTemplate and override -predicateWithSubpredicates: to create an NSPredicate with the proper modifier. Hope that helps, let me know if that's not clear, -Peter ___ 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: How to assure NSTask termination when parent dies
Process group code: // launch the task [task launch]; pid_t group = setsid(); if (group == -1) { NSLog(@"setsid() == -1"); group = getpgrp(); } if (setpgid([task processIdentifier], group) == -1) { NSLog(@"unable to put task into same group as self: errno = %i", errno); } The current process-group id is inherited across fork() and execve() - see their respective man pages. So if you reorder the operations so setsid() occurs before [task launch], then the child inherits automatically. This doesn't mean the child can't change its own pgid/sid. And since you mention a shell, it's not unusual for shells to do exactly that. -- GG ___ 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: iPhone app with searchable text that highlights
On Aug 12, 2010, at 17:31, Jonathan Schmidt wrote: > At its most basic level, I am creating an iPhone app that displays textual > information. When searching, I want the app to highlight the matching text. > I'm using Core Data with SQLite. The text is stored in a string attribute > right now. The strings can be up to a few kilobytes in size. > > I think I need to use the web view to do this? Anyone know of any sample > code out there that can do this? > You don't say where you are planning to display the results. If you are intending to use the result in a UITableView, I think you can throw out the UIWebView approach... there seems to be an inevitable loading delay with UIWebView that becomes a major nuisance in a scrolling table. Furthermore you run into a problem returning proper values in the UITableView heightForRowAtIndexPath: delegate method - your UIWebView won't have loaded by the time the row height is requested. If you are not displaying in a UITableView these problems are less severe to non-existent, and it becomes a simple matter of rendering out HTML with loadHTMLString: or the like. We have an app with very similar behavior that was designed before Core Text became available. I ended up writing my own custom view code that composites text and background views, with pixel-precise positioning courtesy of the various string size methods furnished by the UIKit additions to NSString. If I had to do it over, though, I would learn to use Core Text; my current approach is rather inelegant. If you want a quick, albeit clumsy, approach you might look at the TTStyle stuff in the three20 framework. But this is almost certainly not the best long term solution. -- Conrad Shultz www.synthetiqsolutions.com___ 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
SMTP Framework for Cocoa
Hi, Is there a easy to use framework for sending email via SMTP authentication? I did a some searchings and found MailCore, Pantomime, EdMessage, but they all seem quite out-dated to me. Thanks. Tony S. Wu tonyswu@gmail.com___ 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: How to assure NSTask termination when parent dies
On 13 Aug 2010, at 19:29, Michael Ash wrote: > > I'm not sure why your setpgid doesn't work. You might try a more > UNIX-oriented mailing list, such as darwin-dev. > > There are a couple of other things you could try. > > If your subprocess reads from standard input and exits on EOF, set its > standard input to a pipe. When your process exits, it will close its > end of the pipe. That will cause an EOF to be generated on the other > side, and it will exit. > > If your subprocess regularly writes to standard output, set its > standard output to a pipe. When your process exits, it will close its > end, which causes a SIGPIPE to be generated on the other side the next > time it tries to write to it. SIGPIPE kills the process by default. > Thanks for the suggestions Mike. I have the tasks piped up already but I am still able to get unruly child processes. I will take a close look at just how the pipes are being utilised. Regards Jonathan___ 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: Storing objects in NSMutableDictionary
On Aug 13, 2010, at 1:09 PM, Geoffrey Holden wrote: > Is it possible to store a class object in NSMutableDictionary? Class objects cannot be used as dictionary keys, because NSDictionary copies its keys and class objects can't be copied. Class objects can be used as dictionary values. > [currentMessages setObject:message forKey:messageID]; Is `messageID` supposed to be the class object? If so, that won't work. One solution is to use NSString class names for the dictionary keys, and use NSClassFromString() and NSStringFromClass() to convert. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ 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: Storing objects in NSMutableDictionary
On Aug 13, 2010, at 4:09 PM, Geoffrey Holden wrote: > Is it possible to store a class object in NSMutableDictionary? I want to do > something like the following - but it doesn't seem to work! > > NewMessage* message = [[NewMessage alloc] initWithApp:@"Messenger" :self]; > //initWithApp passes in the nib name and a reference to itself (wonder where > I got that clever idea from!) I'm sure that this isn't your problem, but you seem to be missing a part of the method name above... > [currentMessages setObject:message forKey:messageID]; > Brian Postow Senior Software Engineer Acordex Imaging Systems ___ 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: Storing objects in NSMutableDictionary
On Fri, Aug 13, 2010 at 1:09 PM, Geoffrey Holden <45rpmli...@googlemail.com> wrote: > Is it possible to store a class object in NSMutableDictionary? I want to do > something like the following - but it doesn't seem to work! > > NewMessage* message = [[NewMessage alloc] initWithApp:@"Messenger" :self]; > //initWithApp passes in the nib name and a reference to itself (wonder where > I got that clever idea from!) Really, this method is called -initWithApp::? > [currentMessages setObject:message forKey:messageID]; > > > Trouble is, this doesn't seem to work - currentMessages (an > NSMutableDictionary) seems to be able to store anything except a class object. What "doesn't work" about it? Not to mention no class objects are involved here, just an instance of NSDictionary, an instance of NewMessage, and whatever messageID is. --Kyle Sluder ___ 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
Storing objects in NSMutableDictionary
Is it possible to store a class object in NSMutableDictionary? I want to do something like the following - but it doesn't seem to work! NewMessage* message = [[NewMessage alloc] initWithApp:@"Messenger" :self]; //initWithApp passes in the nib name and a reference to itself (wonder where I got that clever idea from!) [currentMessages setObject:message forKey:messageID]; Trouble is, this doesn't seem to work - currentMessages (an NSMutableDictionary) seems to be able to store anything except a class object. On the other hand, when I tried this with NSMutableArray it worked - except that I couldn't store the messageID as part of the item, which is kind of important. An NSMutableDictionary would be perfect - any ideas how I can achieve this!? Regards, Geoff___ 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
MOC Migrations Using .xcdatamodeld
I'm having some real problems performing my first migration. I'm trying to add a single attribute to two entities in my model. I created a new version of the model using Design > Data Model > Add Model Version. This converted the .xcdatamodel into a .xcdatamodeld with two model versions. I renamed them to v1.xcdatamodel and v2.xcdatamodel. I set the new model as the current version using Design > Data Model > Set Current Version. I hit Build and Run and I'm getting an error message saying that it can't find the source data model. I found a post by Adam Swift on August 21, 2008, which states: If you want to use a model version bundle (xcdatamodeld) to group versions of your data model, then you need to write code to find the path for the source model, destination model and mapping model, then call the migration manager directly to perform the migration Is this still true? I used the code he provided and was able to make the migration happen, but, it seems like it's going to be a big hassle to update this code each time I make a change to the model that necessitates a new model version. If it makes a difference, I have 4 different models in the project. So, I'm using -modelByMergingModels rather than -mergedModelFromBundle. Thanks in advance. Brad ___ 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: Unzip class/lib
On Fri, Aug 13, 2010 at 11:39 AM, Tom Jones wrote: > I have been googling for a little while now and I'm not finding the answers. > Does Mac OS X have a unzip library to unzip the archives created in the GUI. > I guess I could do the NSTask thing but I would rather not. I would also like > to avoid a framework as well as my app is a Foundation tool. Using NSTask to run ditto is the most compatible solution, especially since that's what I believe the Finder does. It properly takes care of the Mac-specific metadata. Why does being a Foundation tool make you want to avoid using a framework? You're already dynamically linking against all the other libraries, including Foundation. If you can get over your dislike of frameworks, there's the OmniUnzip framework at http://github.com/omnigroup/OmniGroup/tree/master/Frameworks/OmniUnzip/ . --Kyle Sluder ___ 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
Unzip class/lib
Hello, I have been googling for a little while now and I'm not finding the answers. Does Mac OS X have a unzip library to unzip the archives created in the GUI. I guess I could do the NSTask thing but I would rather not. I would also like to avoid a framework as well as my app is a Foundation tool. Thanks, tom___ 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: How to assure NSTask termination when parent dies
On Fri, Aug 13, 2010 at 9:13 AM, jonat...@mugginsoft.com wrote: > My app generates a task using NSTask(). > > If my app is killed or calls abort() - which equates to raise(SIGABRT) - then > it would be desirable that the child die too. > > If I have the code for the launched task then a kqueue comes to the rescue: > http://old.nabble.com/Ensure-NSTask-terminates-when-parent-application-does-td22510014.html > > However, if I launch a shell this option isn't available. > So process groups come to mind. > > However calling setpgid (see code below) seems to fail however with RPERM - > operation not allowed. > Is this an OS X POSIX process implementation detail or a consequence of the > interior NSTask fork() implementation? > > I know that there are some OS NSTask substitutes available but I am not > certain that that is the answer. > > My only thought is to install a Cocoa friendly signal handler and explicitly > terminate the child. > But there is no guarantee that this sort of post trauma cleanup will always > succeed. I'm not sure why your setpgid doesn't work. You might try a more UNIX-oriented mailing list, such as darwin-dev. Your problem isn't really related to Cocoa except for the part where you're using an NSTask wrapper, and that *shouldn't* affect things There are a couple of other things you could try. If your subprocess reads from standard input and exits on EOF, set its standard input to a pipe. When your process exits, it will close its end of the pipe. That will cause an EOF to be generated on the other side, and it will exit. If your subprocess regularly writes to standard output, set its standard output to a pipe. When your process exits, it will close its end, which causes a SIGPIPE to be generated on the other side the next time it tries to write to it. SIGPIPE kills the process by default. Finally, if neither of these apply to your particular subprocess, you could make your own subprocess that DOES do these, and it could then kill the other subprocesses when it sees your process exit. Mike ___ 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: Does autoreleased NSURLConnection object guarantee job completion?
On Thu, Aug 12, 2010 at 10:51 PM, yanghb wrote: > if the instance is released in delegate, what to perform the following > code?OK, maybe code segment will always be there, but if the code > access some instance vairable, it just will cause EXEC_ACCESS_BAD, > isn't it? This is absolutely correct. If you're going to release an object from inside a delegate callback made by that object (which is *usually* something you should avoid anyway), then use autorelease, rather than release, to ensure that the object has a chance to finish its own code before being destroyed. Mike ___ 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
controlling keyboard cursor on NSTextFieldCell
Hi folks, I am developing against Mac OSX 10.5. I have an NSMatrix that has a bunch of NSTextFieldCell cells. I would like to programmatically control the position of the keyboard cursor within a NSTextFieldCell, but unfortunately I have not been able to figure out a way to do that. Any suggestions would be greatly appreciated. Thanks, Abdul ___ 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: Does autoreleased NSURLConnection object guarantee job completion?
In my self-defined network handler function, I use a instance variable "connection" to hold NSURLConnection alloced instance, when I will use to load request, so the instance variable can be canceled some where. and the instance will be released before next request performs. that is, if(connection){ [connection release]; } connection = [[NSURLConnection alloc] initWithRequest:.]; ... I do not think the method that release connection in delegate's message: connection:didFinishLoading, is a good form. It "MAY" cause EXEC_ACCESS_BAD, because I think if the instance was released, where the delegate'message will return to? eg, most of the instance to perfrom: .. if(delegate && [delegate respondsToSelector:@selector(connection:didFinishLoading)]){ [delegate connection:self didFinishLoading];//will "self" be released?? } ///perhaps some more code if the instance is released in delegate, what to perform the following code?OK, maybe code segment will always be there, but if the code access some instance vairable, it just will cause EXEC_ACCESS_BAD, isn't it? 2010/8/13 Keary Suska : > On Aug 12, 2010, at 1:41 PM, Conrad Shultz wrote: > >> On Aug 12, 2010, at 11:06, Keary Suska wrote: >> >>> If you really don't want (or can't have) an instance variable, you can >>> init/alloc then release in connectionDidFinishLoading: and >>> connection:didFailWithError:. I wouldn't recommend this though, as it is >>> probably "bad form", but as long you never want to memory-manage >>> NSURLConnections in that class, ever, it would be somewhat future proof. >> >> (First humble post - I will introduce myself properly when I have time to >> send out my own lingering Cocoa question.) >> >> Could you clarify why you think this paradigm is "bad form?" I only ask >> because as far as I can tell all of Apple's API docs follow said model. It >> seems like a good approach is to use init/alloc and still use an instance >> variable (to cancel the request, for example). > > The "bad form" paradigm is when you do *not* use an instance variable, or > some other means that allows reference within the class scope. > >> I also notice in the documentation that either of the init methods retain >> the delegate, whereas the class method is not documented as retaining the >> delegate. If my reading is correct, this will have design impact as well. > > Which is further reason why not having a reference to the instance could be > "bad idea". Retain cycle, anyone? Note also that retaining delegates is > inadvisable and should not be expected, hence the explicit documentation of > the behavior. A bug should be filed against the docs about the class > constructor--it either should indicate differing behavior or otherwise > indicate that it uses a specific instance init method. > > Keary Suska > Esoteritech, Inc. > "Demystifying technology for your home or business" > > ___ > > 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/sprhawk%40gmail.com > > This email sent to sprh...@gmail.com > ___ 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
iPhone app with searchable text that highlights
At its most basic level, I am creating an iPhone app that displays textual information. When searching, I want the app to highlight the matching text. I'm using Core Data with SQLite. The text is stored in a string attribute right now. The strings can be up to a few kilobytes in size. I think I need to use the web view to do this? Anyone know of any sample code out there that can do this? Thanks, Jonathan Schmidt___ 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: Does autoreleased NSURLConnection object guarantee job completion?
On Aug 12, 2010, at 11:06, Keary Suska wrote: > If you really don't want (or can't have) an instance variable, you can > init/alloc then release in connectionDidFinishLoading: and > connection:didFailWithError:. I wouldn't recommend this though, as it is > probably "bad form", but as long you never want to memory-manage > NSURLConnections in that class, ever, it would be somewhat future proof. (First humble post - I will introduce myself properly when I have time to send out my own lingering Cocoa question.) Could you clarify why you think this paradigm is "bad form?" I only ask because as far as I can tell all of Apple's API docs follow said model. It seems like a good approach is to use init/alloc and still use an instance variable (to cancel the request, for example). I also notice in the documentation that either of the init methods retain the delegate, whereas the class method is not documented as retaining the delegate. If my reading is correct, this will have design impact as well. -- Conrad Shultz www.synthetiqsolutions.com ___ 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: [BYUCH] CocoaHeads meeting tonight!
I think Dave's really excited because I'll be using his StackOverflow framework, StackKit. Also, for those iOS developers (like me) I hope to show you why Quartz Composer can still be relevant to you, and not just some cool Mac thing. Cory On Aug 12, 2010, at 10:53 AM, Dave DeLong wrote: > Hi everyone, > > BYU CocoaHeads will be having their August meeting (yes, it really is an > important meeting) tonight at 7pm in W110 TNRB on BYU campus. We'll be > continuing our discussions of Quartz Composer. (Parking is free, and a map > to the building is here: http://map.byu.edu/?building=tnrb ) > > Cory Kilger and Cole Joplin will be presenting how how to create QC plugins > and how to use Quartz Compositions in your projects. I overheard them > planning it out earlier this week, and I'm very very excited for their > presentations! > > See you there! > > Dave DeLong ___ 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: who stole my UIView?
On Aug 12, 2010, at 5:53 PM, Matt Neuburg wrote: > Where are the warnings? -[UIView layer] has this to say: "Warning: Since the view is the layer’s delegate, you should never set the view as a delegate of another CALayer object. Additionally, you should never change the delegate of this layer." > We're working with CALayer so that's where they need to be. Here's what we > find under CALayer's delegate property: I'm actually kind of surprised that the documentation mentions this at all. That said, the warning is ambiguous and I've filed a bug asking for the comment to be made more explicit. In general however, it is advisable to treat objects that are created on your behalf as at least somewhat special, in that you don't know the full extent of the dependencies that the creator setup on that object. You weren't just working with a CALayer here, you were also working with a UIView and you need to be mindful of its requirements as well. > All I was trying to do was save a little memory by not bothering to create a > bitmap and draw into it; I was just looking for a way to draw directly into a > layer's context (without subclassing). This seems like an innocent enough > thing to want to do... This can be accomplished directly using UIImageView and UIGraphicsBeginImageContext(). The data is marked copy-on-write, so you won't be using additional memory, provided that you are on iOS 3.2 or later (there was a bug in 3.1 and prior where UIGraphicsBeginImageContext() used a format that caused Core Animation to make a copy of the data). -- David Duncan ___ 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 NSPredicateEditor with core data
Hello all once again. I have been searching but I hadn't found something useful, so please before if you know a place I can look at let me know. I have these 3 Entities ExpenditureGroup: name icon. --- toExpenditures. ->> Expenditure creationDate location total toExpenditureGroup -> toExpenditureDetails ->> ExpenditureDetail detailDescrb subTotal -- toExpenditure -> also I have an arrayController that fetches all the ExpenditureGroup Entities called _expenditureGorupArrayController. in my predicate editor I added the NSPredicateEditorRowTemplates with key paths for toExpenditures.location, toExpenditures.creationDate, toExpenditures.total, toExpenditures.toExpenditrueDetails.detailDescrb and finally toExpenditures.toExpenditureDetails.subTotal. I dunno if those last 2 are ok.. my guess NO. anyway, when I set the predicate, Im setting into the _expenditureGroupArrayController setFilterPredicate, and pass the predicate I just created, but nothing seems to work. I was reading apple docs, and I see here I need to do some join, but there it says its not possible, that I have to fetch first something and then using operators get the other required objects. I really dunno even if the key paths I set for the templates are ok or no, because I thought that If im gonna apply the predicate to the arraycontroller with entity is ExpenditureGroup, then I can simple use the relationships. Any suggestion? Thx Gustavo ___ 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: Can't resize Floating-Number NSTextfield in NSPredicateEditor.
Dave: Thanks worked like charm! . Gustavo On Aug 13, 2010, at 3:39 PM, Dave DeLong wrote: > NSPredicateEditorRowTemplate ___ 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
Memory Management
I had a nasty memory bug. I spent hours and hours on it with nothing but increasing frustration as a result. Then I went back to basics and read Apple's "Memory Management Programming Guide". The problem was now readily apparent and easily fixed. This is an excellent document. I have read and studied other material on Cocoa memory management but this was so clear and well written that it just absorbed right into my brain. Thank you Apple technical writers! http://developer.apple.com/mac/library/documentation/cocoa/conceptual/MemoryMgmt/MemoryMgmt.html --Richard ___ 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: Can't resize Floating-Number NSTextfield in NSPredicateEditor.
Dave thanks for the reply Im gonna try it right away. Gustavo. On Aug 13, 2010, at 3:39 PM, Dave DeLong wrote: > This is only resizing the textfield of the row *template*, not the row > itself. I've found that the easiest way to do what you're wanting is to > subclass NSPredicateEditorRowTemplate and override the templateViews method. > In that method you'll invoke super's implementation, then alter the frame of > the last view in the array (just like you posted), and then return the array. > > Don't forget to change the row class in IB either! > > Dave DeLong > > Sent from my iPhone > > On Aug 13, 2010, at 7:33 AM, Gustavo Pizano > wrote: > >> Hello all, I come to you asking for humble guidance. >> >> after reading the way to resize the TextFields in some other topic, I tried >> myself, without success.. >> >> This is what I have. >> >> A parent view which display the panel that contains the predicate editor, >> this predicate editor controller (NSWindowController) has an @property >> (assign) pointing to the parent controller. In the parent controller I have >> a NSPredicate ivar which at the moment before initializing the panel, I >> initialize it with a Default Predicate. >> >> In IB, I set via Bindings the value for the predicate editor to >> _parentController.predicate. >> >> So when I run and click the button that display the panel, the panel appears >> and the predicate editor is there with the default predicate I set up. So >> far so Good. >> >> But I can' t rezise the NSTextField view of a Floating-Double number, in my >> PanelController on the awakefromNib method I added this code: >> >> NSArray* rtemplates = [pe rowTemplates]; >> for(NSPredicateEditorRowTemplate * peRT in rtemplates){ >> if([peRT rightExpressionAttributeType] == NSDoubleAttributeType){ >> NSView * v = [[peRT templateViews] lastObject]; >> if([v isKindOfClass:[NSTextField class]]){ >> NSRect frame = [v frame]; // comment 1 >> frame.size.width = 200; >> [v setFrame:frame]; >> >> } >> } >> } >> >> I set a Breakpoint into //comment 1, and I get the size of the field which >> is 25, then as you see I set it up to 200 and re-set the frame property. >> >> But nothing happens I still see that field with the small size >> >> >> What can I do?, what am I missing?... I have tried moving the code above to >> different methods such as the initWithNibName:, just testing ... with no >> good results either. >> >> >> thanks >> >> Gustavo >> >> >> ___ >> >> 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/davedelong%40me.com >> >> This email sent to davedel...@me.com > ___ > > 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/gustavxcodepicora%40gmail.com > > This email sent to gustavxcodepic...@gmail.com ___ 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: Can't resize Floating-Number NSTextfield in NSPredicateEditor.
This is only resizing the textfield of the row *template*, not the row itself. I've found that the easiest way to do what you're wanting is to subclass NSPredicateEditorRowTemplate and override the templateViews method. In that method you'll invoke super's implementation, then alter the frame of the last view in the array (just like you posted), and then return the array. Don't forget to change the row class in IB either! Dave DeLong Sent from my iPhone On Aug 13, 2010, at 7:33 AM, Gustavo Pizano wrote: > Hello all, I come to you asking for humble guidance. > > after reading the way to resize the TextFields in some other topic, I tried > myself, without success.. > > This is what I have. > > A parent view which display the panel that contains the predicate editor, > this predicate editor controller (NSWindowController) has an @property > (assign) pointing to the parent controller. In the parent controller I have a > NSPredicate ivar which at the moment before initializing the panel, I > initialize it with a Default Predicate. > > In IB, I set via Bindings the value for the predicate editor to > _parentController.predicate. > > So when I run and click the button that display the panel, the panel appears > and the predicate editor is there with the default predicate I set up. So far > so Good. > > But I can' t rezise the NSTextField view of a Floating-Double number, in my > PanelController on the awakefromNib method I added this code: > >NSArray* rtemplates = [pe rowTemplates]; >for(NSPredicateEditorRowTemplate * peRT in rtemplates){ >if([peRT rightExpressionAttributeType] == NSDoubleAttributeType){ >NSView * v = [[peRT templateViews] lastObject]; >if([v isKindOfClass:[NSTextField class]]){ >NSRect frame = [v frame]; // comment 1 >frame.size.width = 200; >[v setFrame:frame]; > >} >} >} > > I set a Breakpoint into //comment 1, and I get the size of the field which > is 25, then as you see I set it up to 200 and re-set the frame property. > > But nothing happens I still see that field with the small size > > > What can I do?, what am I missing?... I have tried moving the code above to > different methods such as the initWithNibName:, just testing ... with no good > results either. > > > thanks > > Gustavo > > > ___ > > 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/davedelong%40me.com > > This email sent to davedel...@me.com ___ 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
Can't resize Floating-Number NSTextfield in NSPredicateEditor.
Hello all, I come to you asking for humble guidance. after reading the way to resize the TextFields in some other topic, I tried myself, without success.. This is what I have. A parent view which display the panel that contains the predicate editor, this predicate editor controller (NSWindowController) has an @property (assign) pointing to the parent controller. In the parent controller I have a NSPredicate ivar which at the moment before initializing the panel, I initialize it with a Default Predicate. In IB, I set via Bindings the value for the predicate editor to _parentController.predicate. So when I run and click the button that display the panel, the panel appears and the predicate editor is there with the default predicate I set up. So far so Good. But I can' t rezise the NSTextField view of a Floating-Double number, in my PanelController on the awakefromNib method I added this code: NSArray * rtemplates = [pe rowTemplates]; for(NSPredicateEditorRowTemplate * peRT in rtemplates){ if([peRT rightExpressionAttributeType] == NSDoubleAttributeType){ NSView * v = [[peRT templateViews] lastObject]; if([v isKindOfClass:[NSTextField class]]){ NSRect frame = [v frame]; // comment 1 frame.size.width = 200; [v setFrame:frame]; } } } I set a Breakpoint into //comment 1, and I get the size of the field which is 25, then as you see I set it up to 200 and re-set the frame property. But nothing happens I still see that field with the small size What can I do?, what am I missing?... I have tried moving the code above to different methods such as the initWithNibName:, just testing ... with no good results either. thanks Gustavo ___ 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
Question about UIScrollviews
I have a UIScrollView that is serving to hold my own contra logic - that looks much like a UITableView and only scrolls vertically. When one of the items in the main UIScrollView is toggle tapped, I slide open a space below it and the slide in another UIScrollView full of different items. The problem here is that the vertical swiping on the main UIScrollView seem to prevent swiping from happening in the smaller slid-in UIScrollView. The content size of the slid-in scroll view is high enough to be able to trigger scrolling... but it's not. Is there a work-around for this? -- Interactive Designer and Developer Google Voice: (508) 656-0622 http://blog.ericd.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
How to assure NSTask termination when parent dies
My app generates a task using NSTask(). If my app is killed or calls abort() - which equates to raise(SIGABRT) - then it would be desirable that the child die too. If I have the code for the launched task then a kqueue comes to the rescue: http://old.nabble.com/Ensure-NSTask-terminates-when-parent-application-does-td22510014.html However, if I launch a shell this option isn't available. So process groups come to mind. However calling setpgid (see code below) seems to fail however with RPERM - operation not allowed. Is this an OS X POSIX process implementation detail or a consequence of the interior NSTask fork() implementation? I know that there are some OS NSTask substitutes available but I am not certain that that is the answer. My only thought is to install a Cocoa friendly signal handler and explicitly terminate the child. But there is no guarantee that this sort of post trauma cleanup will always succeed. Process group code: // launch the task [task launch]; pid_t group = setsid(); if (group == -1) { NSLog(@"setsid() == -1"); group = getpgrp(); } if (setpgid([task processIdentifier], group) == -1) { NSLog(@"unable to put task into same group as self: errno = %i", errno); } NSLog(@"new task process id = %i", [task processIdentifier]); NSLog(@"pgid = %i", group); Regards Jonathan Mitchell Developer Mugginsoft LLP http://www.mugginsoft.com ___ 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