McAfee Internet Security for Mac
Hi All, McAfee has come up with a new security product for Mac. McAfee Internet Security for Mac 1.0 This has Anti-virus, Desktop firewall and Application protection. Also it features SiteAdvisor which works for firefox 3.0.5 and above. I have used this product personally and good. Personally i liked SiteAdvisor and Anti-virus. Sorry in advance if you consider this as a spam. Thanks Arun ___ 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: Class Message
Hi Kevin, since you said you don't need instance variables, why not do it with a category of AppDelegate or even NSApplication (not sure about this one, just throwing it in)? Best, Sebastian Am 29.03.2010 um 10:48 schrieb Kevin Bracey: Hi all, This may be a matter of style... I have a simple class whose job it is to check if it's a first run and create all the Folders required such as App Support and Logs, check CFBundleVersion and if different from the last run update any App Support files and reset any UserDefaults. That sort of thing. I know how to do this, but I'm not sure of the best/simplest pattern for Cocoa. My Class has only 1 message and stores no instance data, all the states are in the UserDefaults. Trash the Preferences .plist and you get a nice fresh firstrun. I currently have ad-hock code in the AppDelegate, duplicated functionality in quiet a few apps and want to standardise on one way, cutting down on the code I need to maintain 1. Is this the best place to use a Class Message such as +( BOOL )firstRunError:(NSError **)error; I'm not sure as the main use of Class Messages seems to be for convenience initialisers or returning singletons. 2. But the alloc/init/autorelease seems like an over-kill when there is no properties and one very quick call 99% of the time. 3. Maybe make it a function, I'm not strong on mixing C and Cocoa source files and code, if this is the best way it would be great if you can share some links to documentation or examples. I'm happy to read-up on this, but haven't found anything that compares the different approaches to skinning this cat. Perhaps there's a better trick that I'm unaware of. Thanks for any ideas Kevin ___ 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/sebastianmorsch%40mac.com This email sent to sebastianmor...@mac.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
Class Message
Hi all, This may be a matter of style... I have a simple class whose job it is to check if it's a first run and create all the Folders required such as App Support and Logs, check CFBundleVersion and if different from the last run update any App Support files and reset any UserDefaults. That sort of thing. I know how to do this, but I'm not sure of the best/simplest pattern for Cocoa. My Class has only 1 message and stores no instance data, all the states are in the UserDefaults. Trash the Preferences .plist and you get a nice fresh firstrun. I currently have ad-hock code in the AppDelegate, duplicated functionality in quiet a few apps and want to standardise on one way, cutting down on the code I need to maintain 1. Is this the best place to use a Class Message such as + ( BOOL )firstRunError:(NSError **)error; I'm not sure as the main use of Class Messages seems to be for convenience initialisers or returning singletons. 2. But the alloc/init/autorelease seems like an over-kill when there is no properties and one very quick call 99% of the time. 3. Maybe make it a function, I'm not strong on mixing C and Cocoa source files and code, if this is the best way it would be great if you can share some links to documentation or examples. I'm happy to read-up on this, but haven't found anything that compares the different approaches to skinning this cat. Perhaps there's a better trick that I'm unaware of. Thanks for any ideas Kevin ___ 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
-[NSDateFormatter dateFormatFromTemplate:options:locale:] does not work as expected
Hi, I am having problems using -[NSDateFormatter dateFormatFromTemplate:options:locale:] (new in 10.6.). It’s a great API which makes world-savvy custom date formats possible. Unfortunately it does not seem to work. Examples of wrong results are: - Hour format templates like h a (12 Hour with AM/PM) are converted to format H (24 Hour) under US locale. Other combinations (ha , h, H under US or German locale) also always return H. - The template EEyMd is converted to format EE, -M-d under German locale. This is completely wrong, expected would be EE, d.M.. I filed a bug under rdar://7803429. Does anybody have similar experiences with this method? Any work around to make it work? - Kai - Test code: The following code: NSLocale* usLocale = [[NSLocale alloc] initWithLocaleIdentifier:@en-US]; NSLocale* germanLocale = [[NSLocale alloc] initWithLocaleIdentifier:@de-DE]; NSString* format = [NSDateFormatter dateFormatFromTemplate:@h a options:0 locale:usLocale]; NSLog (@Template “h a” with US local results in �...@”, format); format = [NSDateFormatter dateFormatFromTemplate:@H options:0 locale:usLocale]; NSLog (@Template “H” with US local results in �...@”, format); format = [NSDateFormatter dateFormatFromTemplate:@h options:0 locale:usLocale]; NSLog (@Template “h” with US local results in �...@”, format); format = [NSDateFormatter dateFormatFromTemplate:@h a options:0 locale:germanLocale]; NSLog (@Template “h a” with German local results in �...@”, format); format = [NSDateFormatter dateFormatFromTemplate:@H options:0 locale:germanLocale]; NSLog (@Template “H” with German local results in �...@”, format); format = [NSDateFormatter dateFormatFromTemplate:@EEyMd options:0 locale:germanLocale]; NSLog (@Template “EEyMd” with German local results in �...@”, format); gives me this output: Template “h a” with US local results in “H” Template “H” with US local results in “H” Template “h” with US local results in “H” Template “h a” with German local results in “H” Template “H” with German local results in “H” Template “EEyMd” with German local results in “EE, -M-d” ___ 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: Class Message
On Mar 29, 2010, at 01:48, Kevin Bracey wrote: I have a simple class whose job it is to check if it's a first run and create all the Folders required such as App Support and Logs, check CFBundleVersion and if different from the last run update any App Support files and reset any UserDefaults. That sort of thing. I know how to do this, but I'm not sure of the best/simplest pattern for Cocoa. My Class has only 1 message and stores no instance data, all the states are in the UserDefaults. Trash the Preferences .plist and you get a nice fresh firstrun. I currently have ad-hock code in the AppDelegate, duplicated functionality in quiet a few apps and want to standardise on one way, cutting down on the code I need to maintain Think about it this way: a class method is a lot like a global function, except that it lives in a class-specific name space. (This gives it a slight advantage over a real global function, which pollutes the global namespace.) So, you can create a global function method like this: + (BOOL) validateFirstRun: (NSError**) outError; (If there are no parameters in the method signature other than the returned error, it's not usual to put Error in the method name.) You don't need to advertise outside of the class how this method is implemented -- no outside clients care whether there's any class instance involved. Your app delegate simply invokes [FirstRun validateFirstRun: error] and deals with the return error if any. Within the class, you can take two approaches: 1. Do everything you need with class methods, using file-local static variables for storage. You don't ever need to create an instance of the class. This works pretty well in most cases. 2. Sometimes, not having instance variables turns out to be awkward. In that case, you can have your public class method create an instance of the class, and put all the work in instance methods. Or you can use #2 if you just prefer to code with instance methods -- there's no real downside. ___ 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: Case sensitive fileName
Hi, I have finally realized that the API realpath traverses the sym links. And I need to not to traverse them. Any other idea? Thanks. displayNameAtPath is not suitable because it translates paths like /Applications stringByStandardizingPath is not suitable because it could traverse SymLinks. -- Leonardo Da: Jens Alfke j...@mooseyard.com Data: Wed, 17 Mar 2010 09:07:26 -0700 A: gMail.com mac.iphone@gmail.com Cc: cocoa-dev@lists.apple.com Oggetto: Re: Case sensitive fileName On Mar 17, 2010, at 6:35 AM, gMail.com wrote: Now I need to get its real case sensitive file name, which is indeed e.g. FileName.txt How can I get it in a fast way? I thought by its inode, but I can't really know how to do that. Have you tried -[NSString stringByStandardizingPath], or the BSD function realpath()? The docs don¹t explicitly say they correct case, but it seems like the kind of thing they would do. Jens ___ 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
-forwardInvocation: like NSInvocation creation
Hello, I need to temporary save the invocation of a method. For that, I just need to put the stack frame into an NSInvocation. Unfortunately, Apple has removed the -setStackFrame: from NSInvocation. Though they still use something like it, because they need it for -forwardInvocation:. Has anybody implemented a method like [NSInvocation initWithArgframe: (arglist_t)frame selector: (SEL)aSelector]? Thanks ___ 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
Attributes set in NSTextStorage ignored/overridden
I am attempting to display information in an NSTextView. The information is added line-by-line with some lines to be displayed in bold font and underlined, while other lines are to be displayed normally. I add each line as follows: tstor = [textView textStorage]; [tstor beginEditing]; [tstor appendAttributedString:[[NSAtttributedString alloc] initWithString: --- (NSString) --- attributes:stext]]; /* or btext for the bold,underlined text */ [tstor endEditing]; After adding the first line which should be in bold/underline, NSLog(@tstor = %@,tstor) shows the following: tstor = NWISSysInit:1 { BitstreamVeraSansMono-Bold 9.00 pt. P [] (0x001922e0) fobj=0x0018a180, spc=5.42 = NSFont; 1 = NSUnderline; NSFont = Helvetica 12.00 pt. P [] (0x00192300) fobj=0x00150430, spc=3.33; } So, all my text comes out in Helvetica 12, no underline. I have textview as editable, and as richText Why is the underline ignored, and why is the font overridden? I don't understand the contradiction and the reversed syntax between the first and third line of the log of the text storage attributes. I have two fonts: sfont = [NSFont fontWithName:@Bitstream Vera Sans Mono size:9.0]; bfont = [NSFont fontWithName:@Bitstream Vera Sans Mono Bold size:9.0]; NSLog of the two fonts: sfont = BitstreamVeraSansMono-Roman 9.00 pt. P [] (0x0018a470) fobj=0x00189e20, spc=5.42 bfont = BitstreamVeraSansMono-Bold 9.00 pt. P [] (0x0018a470) fobj=0x0018a180, spc=5.42 two attribute dictionaries: stext = [[NSDictionary alloc]initWithObjectsAndKeys: NSFontAttributeName,sfont, NSUnderlineStyleAttributeName,[NSNumber numberWithInt:NSUnderlineStyleNone], nil]; btext = [[NSDictionary alloc]initWithObjectsAndKeys: NSFontAttributeName,bfont, NSUnderlineStyleAttributeName,[NSNumber numberWithInt:NSUnderlineStyleSingle], nil]; NSLog of the two dictionaries: stext = { BitstreamVeraSansMono-Roman 9.00 pt. P [] (0x0018a470) fobj=0x00189e20, spc=5.42 = NSFont; 0 = NSUnderline; } btext = { BitstreamVeraSansMono-Bold 9.00 pt. P [] (0x0018a470) fobj=0x0018a180, spc=5.42 = NSFont; 1 = NSUnderline; } Dale Miller dalelmil...@comcast.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
Re: Attributes set in NSTextStorage ignored/overridden
You've got your keys and values the wrong way around in your dictionary. The method name hints at this - object first, then key. On 30/03/2010, at 3:12 AM, Dale Miller wrote: two attribute dictionaries: stext = [[NSDictionary alloc]initWithObjectsAndKeys: NSFontAttributeName,sfont, NSUnderlineStyleAttributeName,[NSNumber numberWithInt:NSUnderlineStyleNone], nil]; btext = [[NSDictionary alloc]initWithObjectsAndKeys: NSFontAttributeName,bfont, NSUnderlineStyleAttributeName,[NSNumber numberWithInt:NSUnderlineStyleSingle], nil]; ___ 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:Attributes set in NSTextStorage ignored/overridden (solved)
Solved by Gideon King (Thank you!). One of my rookie tricks invoked by working past my bedtime. I had the keys and objects reversed in the attribute dictionaries creations. Dale Miller dalelmil...@comcast.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
Re: Case sensitive fileName
On Mar 29, 2010, at 6:24 AM, gMail.com wrote: I have finally realized that the API realpath traverses the sym links. And I need to not to traverse them. Any other idea? Thanks. This is turning into a filesystem API question … you might get more ideas if you post on the darwin-userlevel list. —Jens___ 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: McAfee Internet Security for Mac
On Mar 29, 2010, at 12:10 AM, Arun wrote: Hi All, McAfee has come up with a new security product for Mac. McAfee Internet Security for Mac 1.0 This has Anti-virus, Desktop firewall and Application protection. Also it features SiteAdvisor which works for firefox 3.0.5 and above. I have used this product personally and good. Personally i liked SiteAdvisor and Anti-virus. Sorry in advance if you consider this as a spam. Then why did you send it? Of course it's off-topic for the list, and basically spam. Don't do that again. —Jens ___ 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 get wifi information
Dear all, I would like to get wifi information, such as wifi on or off, SSID; is there a way using the iPhone SDK to get them? I can not find them from public API for iPhone SDK 3, is there any private API to do it? Thanks a lot. - GLee ___ 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 add a DOCTYPE declaration to an NSXMLDocument?
I want to add a DOCTYPE declaration to my NSXMLDocument, but can't seem to find the right incantation. The thing that comes closest to working is: NSString *myXMLString = [NSString stringWithFormat:@?xml version=\1.0\ encoding=\UTF-8\?myDocElement/myDocElement]; NSXMLDocument *myDoc = [[NSXMLDocument alloc] initWithXMLString:myXMLString options:0 error:err]; NSString *myDoctypeString = @!DOCTYPE myDocElem; NSXMLDTD *theDTD = [[NSXMLDTD alloc] initWithData:[myDoctypeString dataUsingEncoding:NSUTF8StringEncoding] options:nil error:err]; [myDoc setDTD:theDTD]; The result should be: ?xml version=1.0 encoding=UTF-8? !DOCTYPE myDocElement myDocElement/myDocElement but what I get is: ?xml version=1.0 encoding=UTF-8? !DOCTYPE myDocElement/myDocElement What am I doing wrong? ___ 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
Custom NSTextView for text annotations
Hi, I am currently working on a document reader and annotation program. This program will allow the user to import text files and annotate them, both in the margins and by attaching annotations to specific words. As the cursor is hovered over a word, its annotation will appear in some sort of coloured 'bubble' beside it. I will have a custom file format to store the locations of these annotations in relation to the text file. I am fairly new to Cocoa and I am not sure about how to implement my annotations. I do not want to use PDF because most of the imported documents will only be in text format, for example works from Project Gutenberg. I have done some searching and the closest I have come to a solution is NSTextAttachment, but this inserts an object into the flow of the text and changes the line height of the text for example. I am thinking that I will have to somehow subclass NSTextView and do some custom drawing. Is this the right way to go about it? How should I write this feature? Any advice is much appreciated. Thank you, -- Isaac ___ 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
building for 64-bit Logic
Hello all! I would like to ask, with the new 64-bit Logic, how do you build a 64- bit plug-in for it? My stuff is all pretty simple, so I thought that setting Architecture in the build options to 32/64 bit Universal should do it. It builds fine and works well, does that mean that the job is done then? ;-) Thanks and best wishes, Artemiy. ___ 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
NSTextView’s adjustScroll method
I'm trying to implement typewriter scrolling in my Cocoa text editor, keeping the insertion point centered vertically in its scrollview. Toward this end, I have subclassed NSClipView to provide a scrollToPointWithoutConstraint method, which scrolls the document to a specified point without calling constrainScrollPoint. This is necessary because for short documents the insertion point can't be centered unless we scroll beyond the document's bounds. This seems reasonably straightforward so far and does what I want. The problem comes in when I try to scroll using the scroll bars. If I'm scrolled to the end of the document, such that part of the scroll view contains an area outside the document's bounds, trying to scroll up by a small increment causes the scroll view to jump, immediately clamping to the document's actual bounds. I gather that I might need to subclass NSTextView and override the adjustScroll method; this is where my actual question begins. The proposedVisibleRect that is passed to adjustScroll already has its dimensions adjusted so that they lie within the document's actual bounds. Is there a way that I can change the value of proposedVisibleRect before adjustScroll is called? Alternatively, am I going about this entirely wrong? Any suggestions would be greatly appreciated at this point. ___ 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
Removing custom properties from ABRecords
Hi, while working on some AB integration with my app, I had to recognize, that removing custom properties does simply not work, due to This method is not implemented. Did anybody came up with a reasonable solution for this issue? Furthermore with a solution that can be used in an app given to customers, too? After this is an explanation why custom properties are not removed, in some cases the situation becomes really bad. I found one machine with an addressbook containing nearly 100 custom properties due to lots of apps with AB integration tested on this account. After custom properties NOT being synced (as documented) I would expect doing a full reset from .Mac would solve it, but of course it does not. Anybody with an idea what went wrong here? TIA, regards Thorsten Hohage -- objectmanufactur.com - Hamburg,Germany ___ 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: -forwardInvocation: like NSInvocation creation
Hi, Am 29.03.2010 um 18:52 schrieb A.M.: On Mar 29, 2010, at 11:07 AM, Philip Mötteli wrote: I need to temporary save the invocation of a method. For that, I just need to put the stack frame into an NSInvocation. Unfortunately, Apple has removed the -setStackFrame: from NSInvocation. Though they still use something like it, because they need it for -forwardInvocation:. Has anybody implemented a method like [NSInvocation initWithArgframe: (arglist_t)frame selector: (SEL)aSelector]? Hm- you haven't made it clear why you need the stack frame. The stack frame is still there (or constructed on-the-fly), but it is an opaque, hidden structure. As long as you call retainArguments, NSInvocation can be saved for later use. I see, I really wasn't enough clear. Lets say, I have a method - someMethodWithArgument:(struct *)anArgument andSomeOtherArgument:(id)anotherArgument { // Here I want to create an NSInvocation, capturing the call of this method. Something like: NSInvocation *anInvocation = [NSInvocation initWithArgframe: (arglist_t)frame selector: _cmd]; } Thanks ___ 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: Custom NSTextView for text annotations
On Mar 27, 2010, at 6:48 PM, Isaac Alston wrote: I am currently working on a document reader and annotation program. This program will allow the user to import text files and annotate them, both in the margins and by attaching annotations to specific words. As the cursor is hovered over a word, its annotation will appear in some sort of coloured 'bubble' beside it. I will have a custom file format to store the locations of these annotations in relation to the text file. I am fairly new to Cocoa and I am not sure about how to implement my annotations. I do not want to use PDF because most of the imported documents will only be in text format, for example works from Project Gutenberg. I have done some searching and the closest I have come to a solution is NSTextAttachment, but this inserts an object into the flow of the text and changes the line height of the text for example. I am thinking that I will have to somehow subclass NSTextView and do some custom drawing. Is this the right way to go about it? How should I write this feature? Any advice is much appreciated. For starters, you could try out using NSToolTipAttributeName. That may not get you the appearance you want, though; if you want full control over the appearance, you will probably need to do some custom drawing of your own. If you look around, you can probably find some code that does things like drawing line numbers in the margins of a text view, which could give you a place to start from. Douglas Davidson ___ 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: -forwardInvocation: like NSInvocation creation
On Mon, Mar 29, 2010 at 11:15 AM, Philip Mötteli philip.moett...@tele2.ch wrote: - someMethodWithArgument:(struct *)anArgument andSomeOtherArgument:(id)anotherArgument { // Here I want to create an NSInvocation, capturing the call of this method. Something like: NSInvocation *anInvocation = [NSInvocation initWithArgframe: (arglist_t)frame selector: _cmd]; } So you're trying to implement continuations? Could you perhaps rearchitect your code to use blocks instead? --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
Re: -forwardInvocation: like NSInvocation creation
On 2010 Mar 29, at 11:15, Philip Mötteli wrote: - someMethodWithArgument:(struct *)anArgument andSomeOtherArgument:(id)anotherArgument { // Here I want to create an NSInvocation, capturing the call of this method. Something like: NSInvocation *anInvocation = [NSInvocation initWithArgframe: (arglist_t)frame selector: _cmd]; } I don't see anything special about your situation. You've got the target (self), selector (_cmd), and arguments in there. You should be able to create an invocation with available methods, for example +[NSInvocation invocationWithMethodSignature:], then add arguments. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/DistrObjects/Tasks/invocations.html No touching stack frames needed! We're high-level folks here. ___ 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: -forwardInvocation: like NSInvocation creation
Am 29.03.2010 um 20:36 schrieb Kyle Sluder: On Mon, Mar 29, 2010 at 11:15 AM, Philip Mötteli philip.moett...@tele2.ch wrote: - someMethodWithArgument:(struct *)anArgument andSomeOtherArgument:(id)anotherArgument { // Here I want to create an NSInvocation, capturing the call of this method. Something like: NSInvocation *anInvocation = [NSInvocation initWithArgframe: (arglist_t)frame selector: _cmd]; } So you're trying to implement continuations? Well, I don't know continuations. I would more likely call them forwarders. Could you perhaps rearchitect your code to use blocks instead? I thought about blocks, but then I need to rewrite such a block for every method, where I want to use this functionality. Everytime adapting the method name and the arguments in that block. That is dynamic redundancy. Thanks ___ 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: -forwardInvocation: like NSInvocation creation
Am 29.03.2010 um 20:49 schrieb Jerry Krinock: On 2010 Mar 29, at 11:15, Philip Mötteli wrote: - someMethodWithArgument:(struct *)anArgument andSomeOtherArgument:(id)anotherArgument { // Here I want to create an NSInvocation, capturing the call of this method. Something like: NSInvocation *anInvocation = [NSInvocation initWithArgframe: (arglist_t)frame selector: _cmd]; } I don't see anything special about your situation. That's exactly the point. Apple uses this everytime -forward:: is called. Why hide it now from us. It was available for years. You've got the target (self), selector (_cmd), and arguments in there. You should be able to create an invocation with available methods, I never said, it's not possible. But it's a huge task to re-implement a general method like this. If you understand, that you have to treat every different argument type dynamically. No touching stack frames needed! We're high-level folks here. Not when we have to re-implement the same thing a few thousend times instead of just once! This is called redundancy, which you as a high level guy should know to avoid. That's the reason, why Apple implemented a general method in -forward::. ___ 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: Sending a Cmd-V keystroke
Try [windowObject makeFirstResponder:testField1]; instead of [textField1 becomeFirstResponder]; Thanks, Chaitanya Pandit On Mar 26, 2010, at 5:53 AM, Jim Graham wrote: Hi This is a problem that occurred a few months back in a project. I Never actually used it in the project but it has bugged me ever since. I have simplified the problem into a small example There is a window with three NSTextFields and a button. The button is connected to the doPaste action and the fields are outlets Here is the code -(IBAction)doPaste:(id)sender{ NSPasteboard *pb = [NSPasteboard generalPasteboard]; [pb declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self]; [pb setString:@Field 1 forType:NSStringPboardType]; [textField1 becomeFirstResponder]; [self pasteIt]; [pb setString:@Field 2 forType:NSStringPboardType]; [textField2 becomeFirstResponder]; [self pasteIt]; [pb setString:@Field 3 forType:NSStringPboardType]; [textField3 becomeFirstResponder]; [self pasteIt]; } -(void)pasteIt{ CGEventSourceRef sourceRef = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState); if (!sourceRef) { NSLog(@No event source); return; } //9 = v CGEventRef eventDown = CGEventCreateKeyboardEvent(sourceRef, (CGKeyCode)9, true); CGEventSetFlags(eventDown, kCGEventFlagMaskCommand); CGEventRef eventUp = CGEventCreateKeyboardEvent(sourceRef, (CGKeyCode)9, false); CGEventPost(kCGHIDEventTap, eventDown); CGEventPost(kCGHIDEventTap, eventUp); CFRelease(eventDown); CFRelease(eventUp); CFRelease(sourceRef); } I expected that each of the fields would have their respective text pasted into them. What actually happens is that the last field gets three copies of it's text, Field 3, pasted into it. The other two fields are blank. Can anybody explain why that should happen. Jim Graham___ 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/chaitanya%40expersis.com This email sent to chaita...@expersis.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 get wifi information
On 27 Mar 2010, at 3:43 AM, Gavin(??) wrote: I would like to get wifi information, such as wifi on or off, SSID; is there a way using the iPhone SDK to get them? In Mac OS X, that information would likely be gotten from the System Configuration framework. The framework is present in iPhone OS, but it's stripped down so what you're looking for isn't there. The Reachability API in that framework would tell you whether you can get out on the net, by whatever means. That's not what you're looking for, but it's something. — F ___ 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: -forwardInvocation: like NSInvocation creation
On 2010 Mar 29, at 12:06, Philip Mötteli wrote: I never said, it's not possible. But it's a huge task to re-implement a general method like this. If you understand, that you have to treat every different argument type dynamically. Maybe I don't understand, but a couple years ago I wrote this little method that creates an invocation in one line of code + (NSInvocation*)invocationWithTarget:(id)target selector:(SEL)selector retainArguments:(BOOL)retainArguments argumentAddresses:(void*)firstArgumentAddress, ... ; It handles all argument types, using varargs and the method signature of the selector. I'll post the code if you're interested. ___ 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
Removing Object form ArrayController without managedObjectContext
Hello all. before this email I had a problem with a to-many relationship, that after saving the other view wasn't showing the invoice details, I found the error, but I can't find the solution. So what was happening, was that after saving I was clearing the data of the NSArraycontroller that was used by the table that allowed insertion of ItemXInvoice items, then after save was successful, I was doing the following: //=== //Clears the Fields of the view //=== -(void)clearFieldsData{ [_itemsArrayController removeObjectsAtArrangedObjectIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [[_itemsArrayController arrangedObjects] count])]]; [_dueDateSelection release]; _newInvoice = nil; } so my table was clean again and ready to create a new invoice, or at least that was what I thought, but unfortunately when I wanted to check the created invoice in the other view, I couldn't see any detail, ItemXInvoices, but after closing the app, I was NOT able to see them. I commented the line that called the above method and then I was able to see the invoice details of the newly created invoice. My guess was that when removing the objects form the array controller, these were being removed form the MOC, and therefore I couldn't see them in the consultation mode, only after restarting the app when the MOC fetch again the data. Now I need to be able to clean the table after saving, otherwise I can't create more items unless I restart the app, or if I clean the table I must restart the app in order to see the newly created invoice's details. I dunno what can I do here... Please any advice will be appreciate it. Thanks in advance 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: -forwardInvocation: like NSInvocation creation
Am 29.03.2010 um 21:31 schrieb Jerry Krinock: On 2010 Mar 29, at 12:06, Philip Mötteli wrote: I never said, it's not possible. But it's a huge task to re-implement a general method like this. If you understand, that you have to treat every different argument type dynamically. Maybe I don't understand, but a couple years ago I wrote this little method that creates an invocation in one line of code + (NSInvocation*)invocationWithTarget:(id)target selector:(SEL)selector retainArguments:(BOOL)retainArguments argumentAddresses:(void*)firstArgumentAddress, ... ; It handles all argument types, using varargs and the method signature of the selector. That's a big step into the right direction. I'll post the code if you're interested. That would be nice! Thanks! ___ 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:Attributes set in NSTextStorage ignored/overridden
Be aware that it your textView is bound to an NSTextStorage (or NSAttributedString) elsewhere, that programmatic changes will not be stored unless someone does a manual edit afterwards. Programmatic changes do not trigger a KVO to make it update, such as what happens with manual edits. I haven't found a workaround for this yet. I recently filed a bug report on it. Message: 2 Date: Mon, 29 Mar 2010 10:40:44 -0700 From: Dale Miller dalelmil...@comcast.net Subject: Re:Attributes set in NSTextStorage ignored/overridden (solved) To: COCOA cocoa-dev@lists.apple.com Message-ID: 8643d1f9-ebc2-4d29-b8ac-20becfad8...@comcast.net Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Solved by Gideon King (Thank you!). One of my rookie tricks invoked by working past my bedtime. I had the keys and objects reversed in the attribute dictionaries creations. Dale Miller dalelmil...@comcast.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
Re: Removing Object form ArrayController without managedObjectContext
On Mar 29, 2010, at 1:43 PM, Gustavo Pizano wrote: My guess was that when removing the objects form the array controller, these were being removed form the MOC, and therefore I couldn't see them in the consultation mode, only after restarting the app when the MOC fetch again the data. An array controller won't remove MO's unless you have told it to. Check the setting in IB, or set it explicitly in code. Now I need to be able to clean the table after saving, otherwise I can't create more items unless I restart the app, or if I clean the table I must restart the app in order to see the newly created invoice's details. This is a sign of poor design. The items array controller should use the invoice relationship as its content and it will take care of itself. HTH, 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to catch modal window appearance?
On Mar 27, 2010, at 1:23 AM, Alexander Bokovikov wrote: On 27.03.2010, at 12:48, Ken Thomases wrote: I'm not really sure what you're asking for. A modal window being shown on screen is not something that happens spontaneously _to_ your application, it's something that your application does. So, whatever you want to do after the window is shown, just do it after the point in your code where you show it. I tried to achieve the next effect: some automatic process should be started on the modal window appearance on screen. A popup panel with progress indicator appears, etc. My idea was not to initiate such process from the calling code (where modal window is called from), but do it asynchronously, as soon as the modal window will appear on the screen. Of course, I've solved the problem by calling this process from the calling code just before [NSApp runModalForWindow:] call. But it is not pretty correct from the OOP philosophy point of view, at least as I understand it. Well, if you're using runModalForWindow: and relying on it to show the window, it goes away before the method returns, so there is no point in the code after show and before hide. But you can always do makeKeyAndOrderFront: explicitly: [myWindow makeKeyAndOrderFront:self]; // Stuff I need to do [NSApp runModalForWindow:myWindow]. ___ 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
AppleScriptability Meets NSOperation
I do some lengthy, multi-step tasks in an app like this: * Wrap each of their dozen or so steps in an NSOperation. * Set dependencies so that they execute in sequence. * Add them to a suspended NSOperationQueue. * Un-suspend the queue. If an error occurs, all operations in the queue are cancelled and all ends gracefully. But many of the operations involve updating progress in the user interface, or accessing the document's managed object context, so they actually call back to performSelectorOnMainThread:, via a handy little wrapper in my NSOperation subclass. The user interface unblocks between operations, and I'm happy with the way this works. But when I invoke a task like this from AppleScript, of course, it returns immediately after loading the queue. That's no good, especially if an error occurs -- the script has already moved on. All I can think of is to implement a whole-nother script mode execution mechanism for these tasks, that maybe instead of wrapping the steps as NSOperations would branch to wrap them as NSInvocations, then collect them in an array, and finally loop to invoke each. The user interface would be blocked from beginning to end, but scripters should expect that by definition. However I have this dent in my forehead which has developed from testing similar inventions. Is there a neater way to do this? Jerry Krinock ___ 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: -forwardInvocation: like NSInvocation creation
Am 29.03.2010 um 22:14 schrieb Jerry Krinock: On 2010 Mar 29, at 12:53, Philip Mötteli wrote: Am 29.03.2010 um 21:31 schrieb Jerry Krinock: It handles all argument types Correction. I forgot one little limitation, per NSInvocation documentation, none of the the parameters of the selector being invoked may themselves be a va_arg argument list, nor a union Ok. I'll post the code if you're interested. That would be nice! you've got a few other bonus methods in there too. I've already implemented the main thread invocation some years ago. Thanks! ___ 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
CALayer Grid jerky animation
Hi All, I have a grid of equal sized CALayers in a parent layer - in my case it's a calendar grid - but it could also be a chess board for example. After adding all the cell (child) layers to the parent layer I iterate through them again to add constraints. The parent layer can have it's width resized. The height is constant. For all cell layers I added the following constraint: [cellLayer addConstraint:[CAConstraintconstraintWithAttribute:kCAConstraintWidth relativeTo:@superlayer attribute:kCAConstraintWidth scale:(1/numColumns) offset:0]]; so that as the parent layer is resized all the child layers are resized as well. For all layers except those in the right most column I add the following constraint: [cellLayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMaxX relativeTo:[rightLayer name] attribute:kCAConstraintMinX offset:0]]; so that each layer's right edge is always touching the left edge of the layer to it's right. Finally - the layers in the right most column are constrained by: [cellLayer addConstraint:[CAConstraint constraintWithAttribute:kCAConstraintMaxX relativeTo:@superlayer attribute:kCAConstraintMaxX offset:0]]; so that their right edge always matches the right edge of the parent layer. My problem is that when the parent layer is resized the animation of the layers being resized/moved is jerky. The child layers are moved/resized after the parent layer is finished resizing. Is there a way to make this smoother? I would love to copy how iCal does it - where the rectangles (which I assume are CALayers) containing the appointments are smoothly resized as the iCal window is being resized. Thanks! Mazen Abdel-Rahman ___ 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: NSTableView ignores changes to cell's objectValue outside mouse tracking methods?
On Fri, 26 Feb 2010 13:20:08 -0800, Corbin Dunn said: Take a look at the AnimatedTableView demo app. I added a custom color well cell type of thing, and demonstrate how to update values outside the normal click+tracking way of doing things. Last years WWDC talk covered this too (I think you can buy it on iTunes). Corbin, The example is very helpful! I basically want to do exactly that, but in my case, I need to show the standard NSColorPanel, not a custom colour picker. NSColorPanel is a modeless window, whereas your example displays a sorta- modal window, which allows you to assume things like the table columns not being reordered while the window is shown. Is this why you auto- close the ATPopupWindow if the user does almost anything other that pick a colour right away? I wondered if you might have a suggestion on how to proceed... Thanks, -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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: Removing Object form ArrayController without managedObjectContext
On Mar 29, 2010, at 13:22, Keary Suska wrote: On Mar 29, 2010, at 1:43 PM, Gustavo Pizano wrote: My guess was that when removing the objects form the array controller ... Now I need to be able to clean the table after saving, otherwise I can't create more items unless I restart the app, or if I clean the table I must restart the app in order to see the newly created invoice's details. This is a sign of poor design. I agree. Just to make it explicit: The OP has mistaken the array controllers for his data model. The Core Data managed object context is the data model, the M part of MVC design, and the array controllers are merely glue objects that simplify the V. Array controllers aren't really containers, they're proxy objects for containers in the data model, sort of. It makes no sense to talk of removing the objects from the array controller as something independent of the data model. I tried to scare Gustavo off trying to code using the array controllers, in the earlier thread dealing with the problem. Obviously I wasn't scary enough. ___ 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: Removing Object form ArrayController without managedObjectContext
Keary Hi. On Mar 29, 2010, at 10:22 PM, Keary Suska wrote: On Mar 29, 2010, at 1:43 PM, Gustavo Pizano wrote: My guess was that when removing the objects form the array controller, these were being removed form the MOC, and therefore I couldn't see them in the consultation mode, only after restarting the app when the MOC fetch again the data. An array controller won't remove MO's unless you have told it to. Check the setting in IB, or set it explicitly in code. In IB Im not setting the Delete Objects on Remove because the only binding it has its the MOC, and second I wouldn't put it if I could becuase I know it will remove them form the MOC, Now I need to be able to clean the table after saving, otherwise I can't create more items unless I restart the app, or if I clean the table I must restart the app in order to see the newly created invoice's details. This is a sign of poor design. The items array controller should use the invoice relationship as its content and it will take care of itself. I have, Invoice - ItemXInvoice Invoice, the Array controller I set up with ItemXInvoice entity, and when I click an add button I do: Item * newItem = [NSEntityDescription insertNewObjectForEntityForName:@Item inManagedObjectContext:[self managedObjectContext]]; ItemXInvoice * newItemXInvoice = [NSEntityDescription insertNewObjectForEntityForName:@ItemXInvoice inManagedObjectContext: [self managedObjectContext]]; [newItemXInvoice setValue:newItem forKey:@toItem]; [newItem addToInvoiceXItemsObject:newItemXInvoice]; [_itemsArrayController addObject:newItemXInvoice]; if(_newInvoice == nil){ _newInvoice = [NSEntityDescription insertNewObjectForEntityForName:@Invoice inManagedObjectContext:[self managedObjectContext]]; } [_newInvoice addToItemsXInvoiceObject:newItemXInvoice]; So Im creating a ItemXInvoice relate it to an Item and then relate it to the Invoice relationship as you say. Unless I misunderstood your point and the NSArrayController (ItemXInvoice) the Array Content binding shall be set to the instance with keypath: _newInvoice.toItemXInvoice... I dunno its late here in this part of the work, Im just rumble around.. Any thoughts? Thanks for the reply. G HTH, 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: AppleScriptability Meets NSOperation
Jerry Krinock wrote: I do some lengthy, multi-step tasks in an app like this: * Wrap each of their dozen or so steps in an NSOperation. * Set dependencies so that they execute in sequence. * Add them to a suspended NSOperationQueue. * Un-suspend the queue. If an error occurs, all operations in the queue are cancelled and all ends gracefully. But many of the operations involve updating progress in the user interface, or accessing the document's managed object context, so they actually call back to performSelectorOnMainThread:, via a handy little wrapper in my NSOperation subclass. The user interface unblocks between operations, and I'm happy with the way this works. But when I invoke a task like this from AppleScript, of course, it returns immediately after loading the queue. That's no good, especially if an error occurs -- the script has already moved on. The Apple Event Manager supports suspend and resume, but I have no idea if you'll be able to take advantage of this feature in your application; I suspect it'll largely depend on how your scripting support is implemented (Cocoa Scripting?). Another option might be to use a similar approach to that used by iTunes and other applications where a task may run for an indeterminate length of time: implement a command to start the operation (c.f. iTune's play command), then provide a status property that the script can periodically poll to see if the task is complete. This also avoids the need for the user to mess around with 'timeout' blocks and won't freeze your GUI while the script is waiting for a response. (I think the SIG recommends this approach in these situations.) A third option would be to go the notification route, where you require client scripts to be run as stay-open applets; when the task completes, your application sends a command to the applet to let it know. Less common, though I have heard of it being used by scriptable backup software (I forget the name). HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.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
Re: NSTableView ignores changes to cell's objectValue outside mouse tracking methods?
On Mar 29, 2010, at 2:05 PM, Sean McBride wrote: On Fri, 26 Feb 2010 13:20:08 -0800, Corbin Dunn said: Take a look at the AnimatedTableView demo app. I added a custom color well cell type of thing, and demonstrate how to update values outside the normal click+tracking way of doing things. Last years WWDC talk covered this too (I think you can buy it on iTunes). Corbin, The example is very helpful! I basically want to do exactly that, but in my case, I need to show the standard NSColorPanel, not a custom colour picker. NSColorPanel is a modeless window, whereas your example displays a sorta- modal window, which allows you to assume things like the table columns not being reordered while the window is shown. Is this why you auto- close the ATPopupWindow if the user does almost anything other that pick a colour right away? I wondered if you might have a suggestion on how to proceed... overall: you'll have to keep more state when you show the color panel. Set the target to your controller and control the last color well and last row you want to edit. Update the value as you get notifications in the controller when the color changes. corbin ___ 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: Core Data doesn't save toMany relations please HELP :S
So was digging more into the problem, and realize that the Items are being saved the ItemXInvoice are being saved and related to the invoice, but I can't acces the invoice detail (ItemXInvoice) immediately I get a console error: The array controller doesn't appreciate what you're doing to it. Is there a reason you haven't just configured it in Entity mode with an Entity name and a Managed Object Context binding ? Then the array controller will just listen to the NSManagedObjectContext notifications and do most of this for you. Cannot remove an observer NSTableBinder 0x116087000 for the key path toItem.descr from ItemXInvoice 0x116024800, most likely because the value for the key toItem has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the ItemXInvoice class. Somewhere you've changed the toItem property without going through the setter method properly. I then checked the class and in the setItem Im doing: -(void)setToItem:(Item *)value{ [self willChangeValueForKey:@toItem]; [value retain]; [self setPrimitiveValue:value forKey:@toItem]; [self didChangeValueForKey:@toItem]; } Where'd you get this ? It's not from any of the Xcode templates, and it's wrong (leaks). There is no need to retain value, and since this setter doesn't do anything interesting, you should just delete it and use the @dynamic property from the Xcode Design menu - Data Modeling - Copy Objective-C 2.0 Method Declarations to Clipboard -(IBAction)addItemXInvoice:(id)sender{ Item * newItem = [NSEntityDescription insertNewObjectForEntityForName:@Item inManagedObjectContext:[self managedObjectContext]]; ItemXInvoice * newItemXInvoice = [NSEntityDescription insertNewObjectForEntityForName:@ItemXInvoice inManagedObjectContext: [self managedObjectContext]]; [newItemXInvoice willChangeValueForKey:@toItem]; [newItemXInvoice setValue:newItem forKey:@toItem]; [newItemXInvoice didChangeValueForKey:@toItem]; [_itemsArrayController addObject:newItemXInvoice]; if(_newInvoice == nil){ _newInvoice = [NSEntityDescription insertNewObjectForEntityForName:@Invoice inManagedObjectContext:[self managedObjectContext]]; } [_newInvoice addToItemsXInvoiceObject:newItemXInvoice]; [_tempItemsArray addObject:newItem]; //I need to keep track of the newly created itmes by this method so I can safelty remove them. //Set the creationItemPrice for each ItemXInvoice } uhm. lots of not healthy things here. You shouldn't be calling -willChange/-didChange explicitly here. That's the purpose of the setter methods (or KVC). Not sure why a bunch of this code isn't in -awakeFromInsert. Or why you have _tempItemsArray at all. As others have noted, Cocoa Bindings isn't your Model layer and trying to use it that way is both tedious and error prone. It's the Controller layer that intermediates between your Model objects and the UI. You really want to focus these kinds object graph (data management) operations on the Core Data objects, and leverage those APIs along with KVO and NSNotification. - Ben ___ 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: Sending a Cmd-V keystroke
Hi Thanks to all who have replied to this. I will try to explain to you why I was looking at this and what I have discovered. In the education establishment where I was employed, one of the departments had an AppleScript that was used to parse the standard format emails received from students and to process the data. The department wanted to have a program to do the same and to store the data in an SQLite format to be used as an archive and to be viewed via other applications. I agreed to do this as the requirement could be met using a very simple core data program. As the AppleScript performed the parsing I decide to use it in the program and called the handlers within to get the data into the program. While I was writing the program the head of the department, who had written the original AppleScript, asked if it would not be simpler just to paste the data from the script into the fields in the program. I told him it was not really simpler as we could easily propagate the fields within the program which was the correct way to do it but when I had finished I would show him how it could be done by pasting. Of course it did not work. I fiddled about with it for a while and then dumped it. Recently I had a slack period and decided to look again to see what was happening just as a matter of interest. I had decided it was probably a problem with the queue or dequeueing but could not see what. A few days ago, after corresponding with Jim Correia who also stated het thought it was a dequeueing problem, I wrote a method that emulated the tab key being pressed to use in place of makeFirstResponder. So I had a method emulating the CMD-v (pasteIt) and one for the tab key (tabIt). The sequence of calls was put the first text on the pasteboard pasteIt tabIt put the second text on the pasteboard pasteIt tabIt put the third text on the pasteboard pasteIt With this set up all three fields get text pasted into them but all of them have the third piece of text that was pasted onto the pasteboard. It looks like the system puts all three pieces of text on the pasteboard before the first call to paste gets dequeued in the app. I have satisfied myself about what is happening so have now moved on to pastures new. Thanks again Jim Graham ___ 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
CIFilter and grayscale image
Hi, I would like to apply a custom CIFilter to a grayscale image. The problem is that the kernel of the CIFilter is for RGB images. So the output is a RGB image but I would like to convert it in grayscale and I have no idea how I could do that.This would be to display in a IKImageview. If someone have an idea let me know,Thanks,Paul _ Hotmail: Free, trusted and rich email service. https://signup.live.com/signup.aspx?id=60969___ 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: AppleScriptability Meets NSOperation
On 2010 Mar 29, at 14:30, has wrote: The Apple Event Manager supports suspend and resume Great tip, has. I searched and found Cocoa Scripting Guide How Cocoa Applications Handle Apple Events Suspending and Resuming Apple Events and Script Commands In there, it looks like -suspendExecution and -resumeExecutionWithResult: have been provided for my situation exactly. (I am using Cocoa Scripting and NSScriptCommand.) And it appears that we have solved the problem. But since I couldn't find any sample code using -suspendExecution or -resumeExecutionWithResult:, I shall describe this so I can find it in the list archives next time I forget :) In my subclass' implementation of performDefaultImplementation:, [[SSYOperationQueue mainQueue] setScriptCommand:self] ; [self suspendExecution] ; In the first line, I stash the command away in an ivar for later, which is necessary because -suspendExecution causes -currentCommand to subsequently return nil. Then in my asynchronous completion routine, NSScriptCommand* scriptCommand = [[SSYOperationQueue maenQueue] scriptCommand] ; if (!ok) { [scriptCommand setScriptErrorNumber:errorValue] ; [scriptCommand setScriptErrorString:errorString] ; } [scriptCommand resumeExecutionWithResult:nil] ; Seems to work perfectly, although it's kind of spooky how it works. Maybe they're setting up a sleeping thread for me behind the scenes. And thank you very much has!! You really kept me from making a big mistake today. ___ 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: Removing Object form ArrayController without managedObjectContext
On Mar 29, 2010, at 3:29 PM, Gustavo Pizano wrote: I have, Invoice - ItemXInvoice Invoice, the Array controller I set up with ItemXInvoice entity, and when I click an add button I do: Whenever possible, manipulate relationships directly. Perhaps you do this, but the code isn't shown. If your array controller is bound to the relationship, you shouldn't have make any calls to it at all. It will update itself. If it isn't updating, it means you aren't using your relationships properly. Item * newItem = [NSEntityDescription insertNewObjectForEntityForName:@Item inManagedObjectContext:[self managedObjectContext]]; ItemXInvoice * newItemXInvoice = [NSEntityDescription insertNewObjectForEntityForName:@ItemXInvoice inManagedObjectContext: [self managedObjectContext]]; [newItemXInvoice setValue:newItem forKey:@toItem]; [newItem addToInvoiceXItemsObject:newItemXInvoice]; [_itemsArrayController addObject:newItemXInvoice]; if(_newInvoice == nil){ _newInvoice = [NSEntityDescription insertNewObjectForEntityForName:@Invoice inManagedObjectContext:[self managedObjectContext]]; } [_newInvoice addToItemsXInvoiceObject:newItemXInvoice]; So Im creating a ItemXInvoice relate it to an Item and then relate it to the Invoice relationship as you say. Unless I misunderstood your point and the NSArrayController (ItemXInvoice) the Array Content binding shall be set to the instance with keypath: _newInvoice.toItemXInvoice... I dunno its late here in this part of the work, Im just rumble around.. Any thoughts? I would need to know what the -add* methods do to make any suggestions. Chances are, these methods are not updating the relationships properly. 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CIFilter and grayscale image
On 30/03/2010, at 9:59 AM, paul morel wrote: Hi, I would like to apply a custom CIFilter to a grayscale image. The problem is that the kernel of the CIFilter is for RGB images. So the output is a RGB image but I would like to convert it in grayscale and I have no idea how I could do that.This would be to display in a IKImageview. If someone have an idea let me know,Thanks,Paul A greyscale RGB image contains identical data in the three channels, so throw any two away. You can probably do that easily by creating a bitmap having the greyscale characteristics you want and drawing the RGB image into it. That's likely to be faster than picking over the bitmap data yourself. --Graham ___ 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 get wifi information
If you're just playing around with an app that only you will be using, have fun exploring. However, if you're planning to release it through Apple's store, I've read that they will reject your app if it's using private API calls. On Mar 27, 2010, at 1:43 AM, Gavin(??) wrote: I would like to get wifi information, such as wifi on or off, SSID; is there a way using the iPhone SDK to get them? I can not find them from public API for iPhone SDK 3, is there any private API to do it? ___ 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 catch modal window appearance?
On 30.03.2010, at 2:27, Lee Ann Rucker wrote: Well, if you're using runModalForWindow: and relying on it to show the window, it goes away before the method returns, so there is no point in the code after show and before hide. I understand it of course. I told about the window controller class code, not about the calling procedure code. But you can always do makeKeyAndOrderFront: explicitly: [myWindow makeKeyAndOrderFront:self]; // Stuff I need to do [NSApp runModalForWindow:myWindow]. Now I understand it. Initially I believed that there is an appropriate notification to do it. Thanks. ___ 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