Dynamically Positioning Resized WebView
Hi Everyone: In my application, I am placing multiple instances of WebView right below each other in a NSWindow. And in order to show the whole content without scrolling, I am resizing the web views to the size of their content in (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)webFrame. Normally when pragmatically positioning, I adjust the NSRectMake y axis to the sum of the previous heights. However, as the resizing is done in a separate function after the web view loads, I am unsure of how to have this affect the main y axis variable in the original function. If anyone could point me in the right direction, it would be much appreciated! ___ 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
Creating Vcards on iPhone
Hi Everyone: On the Mac, there is this function to create Vcards: initWithVCardRepresentation:. However, I have not heard of a method that replicates this behavior on the iPhone. As the built-in Address Book app can do it, I assume there must be a way that isn't too complex. Is there some framework or otherwise that will allow me to create Vcards on the iPhone? Thanks for any 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
Re: Disabling Exposé in SystemUIMode
It won't be, sorry. Yeah, that's kind of what I figured. But it would be pretty cool if it made it into, like, 10.6.5 or something like that. I don't have any good recommendations. It might be possible to intercept and suppress the physical Exposé key on the keyboard using some IOKit callbacks; I haven't tried this. Hot corner and four-finger- swipe activations of Exposé can be disabled in System Prefs, so you could instruct your users to disable those before running your application. I'll definitely look into these both. Thanks for your 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
Re: Disabling Exposé in SystemUIMode
I take that back! It looks like this is already fixed in SnowLeopard. Wow, I think that just made my day. So, both of them are fixed? In other words, the gestures and the hardware key? ___ 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: Disabling Exposé in SystemUIMode
In my testing on my MacBook Pro running a recent build of SnowLeopard, yes. SnowLeopard has not been released to customers yet, so of course there's always a possibility of something changing, but it does seem to work properly at the moment. Further discussion of SnowLeopard should probably be moved to the developer forums on developer.apple.com. Wow. Thanks for letting me know. I may just have to make my app Snow Leopard only then. After all, it's only $29. ___ 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: Disabling Exposé in SystemUIMode
Very true, so I guess I'll have to weigh my options. Thanks to everyone for their help! On 8/7/09 10:08 AM, Sean McBride s...@rogue-research.com wrote: On 8/7/09 9:47 AM, Pierce Freeman said: I may just have to make my app Snow Leopard only then. After all, it's only $29. Only $29, yes; but remember it's also Intel-only. So if you require 10.6, you loose any/all PowerPC customers. -- 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: Disabling Exposé in SystemUIMode
Hi Sean: Yeah, I completely copied his code and inserted it into my project. Even odder, it doesn't allow the Apple-Tab function (which is what it is supposed to do) but lets Exposé work just fine. I don't mean that it broke in the latest version of Leopard, as the old version I was using still did not have it enabled. I was wondering if it worked on Leopard at all, and based on your reply it does. So I don't have much idea as to what to try now. On 8/6/09 7:56 AM, Sean McBride s...@rogue-research.com wrote: On 8/5/09 7:39 PM, Pierce Freeman said: Which version of OS X are you using? With the latest of Leopard, it just doesn't seem to work. Are you using the same flags are Ricky? I use SetSystemUIMode (kUIModeAllSuppressed, 0) and Exposé is allowed (which I want). Or do you mean this broke in 10.5.8 (which I haven't installed yet). -- 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
Change Opacity of Image
Hi Everyone: I am looking for an easy way to fade into one photo from another photo. In other words, from the middle point, you can see both of the photos on top of each other to compare the changes. I am currently using Quartz to do this, but am running into a lot of trouble with that, so I am wondering what you all would suggest. I would be happy to send over my current project if you would like - it's based off of Scott Stevenson's tutorial here: http://cocoadevcentral.com/d/intro_to_quartz_two/. Thanks for any 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
Re: Change Opacity of Image
Hi Pavel: Thanks for the suggestion. How would you suggest I get the NSImage to the screen, a custom NSView, NSImageWell, etc? On 8/6/09 10:29 AM, Pavel Dudrenov dudre...@gmail.com wrote: Look into NSImage and NSCompositingOperation. On Thu, Aug 6, 2009 at 10:17 AM, Pierce Freeman piercefreema...@comcast.net wrote: Hi Everyone: I am looking for an easy way to fade into one photo from another photo. In other words, from the middle point, you can see both of the photos on top of each other to compare the changes. I am currently using Quartz to do this, but am running into a lot of trouble with that, so I am wondering what you all would suggest. I would be happy to send over my current project if you would like - it's based off of Scott Stevenson's tutorial here: http://cocoadevcentral.com/d/intro_to_quartz_two/. Thanks for any 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 http://lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/dudrenov%40gmail.com This email sent to dudre...@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: Change Opacity of Image
Hi Douglas: Do you have one that you can suggest? It doesn't have to do much - just change the opacity. On 8/6/09 12:46 PM, douglas welton douglas_wel...@earthlink.net wrote: Core Image Filters are your friend. Check out the CIFilter reference documentation and you'll find bunches of filters to handle compositing. On Aug 6, 2009, at 1:29 PM, Pavel Dudrenov wrote: Look into NSImage and NSCompositingOperation. On Thu, Aug 6, 2009 at 10:17 AM, Pierce Freeman piercefreema...@comcast.net wrote: Hi Everyone: I am looking for an easy way to fade into one photo from another photo. In other words, from the middle point, you can see both of the photos on top of each other to compare the changes. I am currently using Quartz to do this, but am running into a lot of trouble with that, so I am wondering what you all would suggest. I would be happy to send over my current project if you would like - it's based off of Scott Stevenson's tutorial here: http://cocoadevcentral.com/d/intro_to_quartz_two/. Thanks for any 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
Re: Disabling Exposé in SystemUIMode
Really odd, do you think you could send me a little example to see if your same code works on my system? On 8/6/09 2:59 PM, Ricky Sharp rsh...@mac.com wrote: On Aug 5, 2009, at 9:39 PM, Pierce Freeman wrote: Which version of OS X are you using? With the latest of Leopard, it just doesn't seem to work. When writing my initial response to this thread, it was 10.5.7. Just tested with 10.5.8 and all is still well (no Expose, no process switching). ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.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: Disabling Exposé in SystemUIMode
That's definitely a possibility. However, I am basically creating my windows the same way that you are. The only difference is, I didn't set any of those attributes and my main window just appears by Cocoa default. On 8/6/09 3:10 PM, Ricky Sharp rsh...@mac.com wrote: On Aug 6, 2009, at 10:10 AM, Pierce Freeman wrote: Yeah, I completely copied his code and inserted it into my project. Even odder, it doesn't allow the Apple-Tab function (which is what it is supposed to do) but lets Exposé work just fine. I don't mean that it broke in the latest version of Leopard, as the old version I was using still did not have it enabled. I was wondering if it worked on Leopard at all, and based on your reply it does. So I don't have much idea as to what to try now. Hmm, I wonder if it has something to do with how I create my windows? I create blanking windows and put one of those on each screen (borderless window covers entire screen). Then, I create a content window (also borderless) that is then set to appropriate size (1024 x 768 in my case), centered on, and made a child of, the blanking window on the main screen. The call to SetSystemUIMode is made in applicationDidFinishLaunching: before I create windows. Both the blanking and content windows are subclasses of NSWindow. Blanking window's designated initializer is just a thin wrapper around NSWindow's initWithContentRect:styleMask:backing:defer: - styleMask is NSBorderlessWindowMask - backing is NSBackingStoreBuffered - defer is NO I then set these additional attributes: - hidesOnDeactivate (YES) - releasedWhenClosed (NO) - movableByWindowBackground (NO) - hasShadow (NO) - optimizedDrawing (YES) - opaque (YES) I also override canBecomeKeyWindow (returns NO) and canBecomeMainWindow (also returns NO). In my content window subclass, same setup as blanking window (in terms of attributes listed above). And, overrides to canBecomeKeyWindow and canBecomeMainWindow return YES. ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.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: Disabling Exposé in SystemUIMode
Hi Eric: I am using the four finger swipe gesture on a Unibody MacBook Pro and the key. Neither of which SetSystemUIMode over rides. Maybe there is a way to just set a window to be at the edges of the screen all the time, and then put the main window in front of that? On 8/6/09 3:59 PM, Eric Schlegel eri...@apple.com wrote: On Aug 6, 2009, at 8:10 AM, Pierce Freeman wrote: Hi Sean: Yeah, I completely copied his code and inserted it into my project. Even odder, it doesn't allow the Apple-Tab function (which is what it is supposed to do) but lets Exposé work just fine. Pierce, how are you entering Exposé: function key, mouse button, or screen hot corner? SetSystemUIMode attempts to disable Exposé as best it can, but only the function key and mouse button methods are disabled. Screen hot corners are still enabled so you'd have to disable those manually in System Prefs. -eric ___ 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: Disabling Exposé in SystemUIMode
Hi Eric: I'll make sure to file a big about that - hopefully it can get resolved before shipment. But, when using the key, it should stop Exposé, shouldn't it? I have also tested this and it still doesn't work. Any ideas? On 8/6/09 5:02 PM, Eric Schlegel eri...@apple.com wrote: On Aug 6, 2009, at 4:03 PM, Pierce Freeman wrote: Hi Eric: I am using the four finger swipe gesture on a Unibody MacBook Pro and the key. Neither of which SetSystemUIMode overrides. Yes, that's the problem. SetSystemUIMode doesn't prevent entering Exposé via that method. Please file a bug about that; we have the infrastructure in place finally in SnowLeopard to fix this, so we should be able to address the problem in a future release. Maybe there is a way to just set a window to be at the edges of the screen all the time, and then put the main window in front of that? I don't think I understand what you're proposing. In general, I don't think there's a way to prevent Exposé from occurring in this case, without just disabling the gesture in System Prefs. -eric ___ 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: Disabling Exposé in SystemUIMode
And is there any way to make reproduce the display capture effect without using this or SetSystemUIMode. I am attempting to make a full screen app, and don't want the user to have to disable this in the system preferences. On 8/6/09 5:02 PM, Eric Schlegel eri...@apple.com wrote: On Aug 6, 2009, at 4:03 PM, Pierce Freeman wrote: Hi Eric: I am using the four finger swipe gesture on a Unibody MacBook Pro and the key. Neither of which SetSystemUIMode overrides. Yes, that's the problem. SetSystemUIMode doesn't prevent entering Exposé via that method. Please file a bug about that; we have the infrastructure in place finally in SnowLeopard to fix this, so we should be able to address the problem in a future release. Maybe there is a way to just set a window to be at the edges of the screen all the time, and then put the main window in front of that? I don't think I understand what you're proposing. In general, I don't think there's a way to prevent Exposé from occurring in this case, without just disabling the gesture in System Prefs. -eric ___ 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
Disabling Exposé in SystemUIMode
Hi Everyone: I am wondering if anyone knows of a way to disable Exposé in SystemUIMode. I am using this class to create a kiosk-based application and don't want the user to be able to switch between other windows. If there isn't a way to do this inside the class, is there another class that can accomplish this instead? Thanks for any 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
Re: Disabling Exposé in SystemUIMode
Hi Ricky: Which version of OS X are you using? With the latest of Leopard, it just doesn't seem to work. On 8/5/09 7:34 PM, Ricky Sharp rsh...@mac.com wrote: On Aug 5, 2009, at 8:45 PM, Pierce Freeman wrote: I am wondering if anyone knows of a way to disable Exposé in SystemUIMode. I am using this class to create a kiosk-based application and don't want the user to be able to switch between other windows. If there isn't a way to do this inside the class, is there another class that can accomplish this instead? Using SetSystemUIMode disables Expose in my app just fine. I call it with these parameters: OSStatus status = SetSystemUIMode (kUIModeAllHidden, kUIOptionDisableProcessSwitch); There's a technote here which covers the options (although seems a bit outdated) http://developer.apple.com/technotes/tn2002/tn2062.html ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.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: NSScrollView Not Updating
If you can't answer this question, you need to cover some basic fundamentals. Did you override -drawRect: is a very simple question that you can answer by simply looking at what code you've written. I kind of figured that I didn't do it, as I didn't write any code that would have caused this to happen. But I wasn't sure if it maybe was doing something behind the scenes that caused it to be implemented. Based upon your answer, it's a no. [subView addSubview:text1]; When you add a subview to a superview, it doesn't resize the superview. NSScrollView has no idea about the contents of its document view's subviews, it only cares about its document view's size. Since it never changes, there's nothing for it to scroll. That makes a lot of sense. So I called setFrame: on the NSView, and it works really well now. However, when I enlarge the window, the top element seems to come down. Is there some way to stop this from happening, in other words, is there a way to nail an element in place. ___ 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: NSScrollView Not Updating
You need to post your code. I'll put my main code at the end of this email. It sounds like you've overridden -drawRect: to draw custom contents. The view's frame determines how the scroll view behaves; if you're just drawing all over the place in -drawRect: without properly calling -setFrame:, you need to stop that. I'm not quite sure if I'm over riding -drawRect:, but it's possible that I have. Hopefully my code will see if I have. AppController.m @interface AppController : NSObject { IBOutlet NSView *subView; IBOutlet NSScrollView *mainView; } @end AppController.h for (NSInteger i = 0; i 100; i++) { NSRect location = NSMakeRect(50, (i*120 + (i+9)*10), 400, 22); NSTextField *text1 = [[NSTextField alloc] initWithFrame:location]; [subView addSubview:text1]; [subView setAutoresizesSubviews:YES]; } ___ 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
Switching Contents of NSView
Hi Everyone: I am making an application that has a choice of what function the user wants to perform. When the user clicks on their choice, I want a NSView to take on the contents of a specific nib file. I assume there must be a way (hopefully) easy that this is accomplished with, as most applications must do something like this with their user interface. Thanks for any 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
Re: Switching Contents of NSView
That makes sense - I'll definitely try that! And just asking, but from the first link you sent, what does this return? [NSBundle loadNibNamed:@someNibFile owner:d]; My assumption is that it's not a view. On 7/5/09 3:31 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:30 PM, Pierce Freeman wrote: And for the NSView function that you suggested, does this replace all the subviews in that view as I will most likely have more then one? Read the documentation. It replaces the view you specify with the other view you specify. Put each group in their own container views, then only swap the containers ... -- I.S. ___ 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: Switching Contents of NSView
You're right, I was looking in the wrong place. A good Google search (versus the built in documentation) did the trick. For future reference, it's under NSBundle Additions versus the plain NSBundle. On 7/5/09 3:45 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote: That makes sense - I'll definitely try that! And just asking, but from the first link you sent, what does this return? [NSBundle loadNibNamed:@someNibFile owner:d]; My assumption is that it's not a view. Come on, you're not even trying. Look the method up in the *documentation* to find out what it returns. That's what it's there for. -- I.S. ___ 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: Switching Contents of NSView
I am finally reverting to using NSView's replaceSubview:with: command. The only problem is that when I run this command partnered with addSubview, it removes the view from the window where I placed it originally. This is problematic when I try to go back and forth between views as the application can no longer find the view and then crashes. Any suggestions? On 7/5/09 3:21 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote: I am making an application that has a choice of what function the user wants to perform. When the user clicks on their choice, I want a NSView to take on the contents of a specific nib file. I assume there must be a way (hopefully) easy that this is accomplished with, as most applications must do something like this with their user interface. Do you need help figuring out how to load the NIB[1], replace the view[2], or both? 1 - http://cocoadevcentral.com/articles/64.php 2 - -[NSView replaceSubview:with:] - http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classe s/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/replaceSubvi ew:with: -- I.S. ___ 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: Switching Contents of NSView
Kiel: Wasn't suggesting Google is always the right place to look, but in this case it just happened to find it right away. And just checked my preferences, and it did in fact have title selected. Will have to change that... On 7/5/09 4:25 PM, Kiel Gillard kiel.gill...@gmail.com wrote: If you are suggesting Google was the right place to look, unfortunately you are mistaken. Directly underneath the toolbar of the documentation window should be a scope bar that attempts to help you find the information you're looking for. Perhaps you're searching the documentation by Title instead of by API? If I search by API and type loadNibNamed I immediately get the NSBundle Additions API, however if I search by Title I get nothing. Hope this helps, Kiel On 06/07/2009, at 8:55 AM, Pierce Freeman wrote: You're right, I was looking in the wrong place. A good Google search (versus the built in documentation) did the trick. For future reference, it's under NSBundle Additions versus the plain NSBundle. On 7/5/09 3:45 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:42 PM, Pierce Freeman wrote: That makes sense - I'll definitely try that! And just asking, but from the first link you sent, what does this return? [NSBundle loadNibNamed:@someNibFile owner:d]; My assumption is that it's not a view. Come on, you're not even trying. Look the method up in the *documentation* to find out what it returns. That's what it's there for. -- I.S. ___ 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/kiel.gillard%40gmail.com This email sent to kiel.gill...@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: Switching Contents of NSView
Once again, I fail when the documentation succeeds. I¹ll have to work on my documentation reading skills over the next week or so. On 7/5/09 4:33 PM, Andy Lee ag...@mac.com wrote: Make sure you heed this part of the documentation: This method causes oldView to be released; if you plan to reuse it, be sure to retain it before sending this message and to release it as appropriate when adding it as a subview of another NSView. --Andy On Jul 5, 2009, at 7:26 PM, Pierce Freeman wrote: I am finally reverting to using NSView's replaceSubview:with: command. The only problem is that when I run this command partnered with addSubview, it removes the view from the window where I placed it originally. This is problematic when I try to go back and forth between views as the application can no longer find the view and then crashes. Any suggestions? On 7/5/09 3:21 PM, I. Savant idiotsavant2...@gmail.com wrote: On Jul 5, 2009, at 6:18 PM, Pierce Freeman wrote: I am making an application that has a choice of what function the user wants to perform. When the user clicks on their choice, I want a NSView to take on the contents of a specific nib file. I assume there must be a way (hopefully) easy that this is accomplished with, as most applications must do something like this with their user interface. Do you need help figuring out how to load the NIB[1], replace the view[2], or both? 1 - http://cocoadevcentral.com/articles/64.php 2 - -[NSView replaceSubview:with:] - http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Clas se s/nsview_Class/Reference/NSView.html#//apple_ref/occ/instm/NSView/replaceSub vi ew:with: -- I.S. ___ 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/aglee%40mac.com This email sent to ag...@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
Re: Switching Contents of NSView
Joel: Thanks for the link - I'll definitely check it out. On 7/5/09 6:50 PM, Joel Norvell framewor...@yahoo.com wrote: Pierce, As an adjunct to document reading skills, I've found that there's no substitute for a class browser. Andy Lee has written Appkido, an excellent class browser for Cocoa! http://homepage.mac.com/aglee/downloads/appkido.html There are other ways to browse the Cocoa class hierarchy, but Appkido is my favorite :-) Thanks Andy!! Yours in Cocoa, Joel ___ 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: Programmatically Picking Elements
Hey Kyle: Thanks for your reply... I looks like that took a lot of time to type. ;) Ah. Please do re-read the documentation, as it will at the very least better inform your vocabulary. An outlet is a property or instance variable that has been tagged with the IBOutlet macro and as such is available for wiring in Interface Builder. For example, the nextResponder outlet on instance of NSResponder. Objects themselves cannot be outlets. The term you're looking for is View. Read the View Programming Guide, especially the section on the View Hierarchy. Everything contained in a window is a view. Views draw themselves in response to -drawRect: (sometimes using helper objects like instances of NSCell). Views can also contain other views. I suppose that's what I get from constantly switching between web programming and Cocoa programming. Sometimes it takes a few days to fully switch mindsets - Which my clients don't seem to be too willing to give me. First off, only tackle this if you are incredibly comfortable with the view hierarchy and Cocoa in general. You're going to need to understand a lot about how views work, much more than just playing around with IB will tell you. Unfortunately, I kind of figured this... Most of the complex things aren't easy. Yes, obviously, as they are considered complex. ;) Secondly, you're going to need a very sharp delineation between your business-side concept of a user interface and the Cocoa concept of a user interface. Your business terms, for example, might include things such as List of People or Expense Report. Your Cocoa terms are things like NSTableView and NSTextFieldCell. Your biggest challenge is going to be drawing the line between these two things, and sometimes it's very difficult to say what is a business requirement and what is an implementation detail. You're only ready to make these distinctions when you've had quite a bit of experience with the framework. Third, don't expect to implement a web-based Interface Builder. You will set yourself up for failure quite quickly. Resist the temptation to offer your users a generic table in which they can create columns, bind controls to business objects, etc. There's a tool that does that already, and its name is Interface Builder. It sounds like you're developing an internal application -- despite the fact that this setup allows for greater communication and faster turnaround between the developers and the customers, too often developers (myself included) have taken a very release-oriented attitude. You don't need to make a super-generic tool that your customers can use to implement their dream interface. You have the convenience of proximity, which means the customer can walk down the hall and say: We need a window that looks like X so we can do Y. Those of us in the consumer software market would kill for this kind of customer interactivity. Besides, do your customers really want to learn how to make an interface? They've got more important things to do! I feel really bad about typing this next part as it looks like that took a LOT of time to write. When I said more going for I more meant the following: A user logs on to a web application. They have some options for filing a web report. Choices: single line and multiple line. They can choose how many of these fields they have for various variables that they want to input. This is then saved in a MYSQL database for later use. The client side application fetches the data in the MYSQL databases and then displays it. The problem is that it is a variable number of fields and a variable number of types. So, it's technically not a online Interface Builder - I think I'll let the capable guys at 280 North handle that. It's more a dynamic online tool, which I think may require a lot of the same tools. But I'll let more experienced people (you) tell me if I'm totally wrong on that. In short, don't try to obsolete yourself. You will wind up with happier customers if you accept your limitations and they accept theirs. Take advantage of your situation: iterate frequently, be responsive to customer needs, and don't be afraid to say no to crazy requirements proposals -- including your own. That's very good advice, especially with dealing with some of my clients. One wants some fading elements, noises, complete dynamic... On the web. Just Wow. Once again, thanks for all your help. Sincerely, Pierce Freeman ___ 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
Programmatically Picking Elements
Hi Everyone: I am wondering if there is some way to pick the element type (and amount of them) shown in a xib file. I am working on an application that needs to take data from the server, and there are usually differing amounts of it. For example, User A chooses on the web for there to be 10 NSTextFields. User B chooses on the web for there to be 3 NSTextFields and 4 NSTableViews. Is there some way to display these elements for the user using Cocoa once the system gets the elements that you want. Thanks for any 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
Re: Programmatically Picking Elements
Hi Kyle: While there may be a more official name for them (outlets, maybe?), I consider an element to be any element that goes on the screen. For instance a NSTextField or a NSImageView. I am more going for creating a UI on the server and then displaying it on the client side. Does this still fall under the category of View Programming, or something different entirely? Thanks for your help. On 6/25/09 1:09 PM, Kyle Sluder kyle.slu...@gmail.com wrote: What is an element? Sounds like you want to show/hide portions of your user interface based on the data you receive from the server. Or do you want the user to be able to create whatever UI they want on the server and show it on the client? You're going to have to write code to do it either way. It sounds like you should review the documentation, specifically the View Programming Guide: http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/Intr oduction/Introduction.html --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: Blur NSImage
Kyle: Thanks for your suggestion. I ended up doing it in Interface Builder, and it works great! Thanks! On 6/13/09 8:37 PM, Kyle Sluder kyle.slu...@gmail.com wrote: Look into Core Image filters. You can apply them to any layer-backed view. You can even do it from within Interface Bulder, on the View Effects tab of the inspector. --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
Get Key Commands in Fullscreen
Hi Everyone: I am following the steps described here: http://www.cocoadevcentral.com/articles/28.php to make a fullscreen application but am running into a problem when I want to get key input. For some reason, it seems that when you convert the Panel to take up the screen, you also loose the ability for it to get the key down events. I am attempting to make a button trigger when the user types s, which works fine in a regular panel, but doesn't seem to work when this change is applied. Thanks for any 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
Blur NSImage
Hi Everyone: I will say before hand that I don't really want to dive into Quartz, etc. at the moment and simply want to stick with the image basics. Anyway, I am making a fullscreen app that has window with a NSImageView that fills the screen. I only say this as it may change how to address this issue (not quite sure about that). Anyway, I am looking to add a quick blur to the NSImage before I insert it into the NSImageView. I have not found any sample code that does this without going into some other framework, and am wondering if anyone here would have any suggestions. Thanks for any 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
Searching in NSArray
Hi Everyone: I am most likely overlooking this function, but I just can't seem to find it in the documentation. I am looking for some way to search an NSArray listing for one string that is part of multiple objects in the array. This search then returns the number of objects that contained that string in it. I imagine this would be built into NSArray, so if anyone could steer me in the right direction, it would be greatly appreciated! ___ 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: Searching in NSArray
Hi KK: I was aware of this method to do so, but can this be done if you needed to search for, say, ³Good² and wanted it to return Goodbye? Thanks for your help. On 6/5/09 8:50 AM, KK kthem...@gmail.com wrote: I'm not sure if this is what you're looking for, but Objective-C 2.0 has this: NSArray *a = [NSArray arrayWithObjects:@Hello,@Goodbye,nil]; for (NSString *s in a) { if ([s isEqualToString:@Goodbye]) { NSLog(@it is equal); } } And you can have an additional int (or NSInteger) counter to keep track of which object it is. Oh, you could also do [NSArray indexOfObject:]. if it returns NSNotFound, it's not in the array. On Fri, Jun 5, 2009 at 11:36 AM, Pierce Freeman piercefreema...@comcast.net wrote: Hi Everyone: I am most likely overlooking this function, but I just can't seem to find it in the documentation. I am looking for some way to search an NSArray listing for one string that is part of multiple objects in the array. This search then returns the number of objects that contained that string in it. I imagine this would be built into NSArray, so if anyone could steer me in the right direction, it would be greatly appreciated! ___ 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 http://lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kthemank%40gmail.com This email sent to kthem...@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: Searching in NSArray
Kyle: This looks like an interesting lead, I'll look into it later. On 6/5/09 8:52 AM, Kyle Sluder kyle.slu...@gmail.com wrote: Look at the predicate programming guide, documentation for NSPredicate, and -[NSArray filteredArrayUsingPredicate:]. --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
Hidden API?
Hi Everyone: I am wondering if the method that the iWork apps use to add themselves to the dock (after install, they add themselves to the dock) requires a private API. I am looking into a way to use this method not to add icons but to do some quick preference switching of the dock without relaunching it. Sincerely, Pierce Freeman ___ 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: LaunchAgent Creation
Thanks for your reply Jerry. I'll try putting the -Rf before listing the paths. You mentioned newer and better methods in 10.4 and 10.5 and since I am only planning to support these, could you give me a bit more detail to what you are referring to. -- In reply to: You've almost got it. I believe this might come close to working, assuming for example that you want -Rf options on cp: ... keyProgram/key string/bin/cp/string keyProgramArguments/key array string-R/string stringf/string string/source/path/string string/destin/path/string /array ... By the way, if cp works for you, that's fine but there are newer and better methods available in Mac OS 10.4, 10.5. ___ 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: File Reading Problems
Hey Ken: Your advice is really appreciated, and I will definitely look over the Memory Management Guidelines when I have a bit more time in my day. ;) On 4/29/09 1:12 PM, Ken Thomases k...@codeweavers.com wrote: On Apr 28, 2009, at 9:19 PM, Pierce Freeman wrote: - (void)awakeFromNib { NSFileHandle *remoteConnection = [NSFileHandle fileHandleForReadingAtPath:@/Users/user/Desktop/file.plist]; The above does not promise to keep the NSFileHandle object around for as long as you need it. It's not at all clear to me that - readToEndOfFileInBackgroundAndNotify retains the file handle for its duration. So, you need to manage the lifetime of the file handle by retaining it here and releasing it when you know you're done with it. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readAllTheData:) name:NSFileHandleReadToEndOfFileCompletionNotification object:remoteConnection]; [remoteConnection readToEndOfFileInBackgroundAndNotify]; } - (void)readAllTheData:(NSNotification *)note { NSString *errors = nil; NSData *contentsOfDockFile = [note object]; NSLog(@%@, contentsOfDockFile); NSDictionary *testing = [NSPropertyListSerialization propertyListFromData:contentsOfDockFile mutabilityOption:NSPropertyListImmutable format:nil errorDescription:errors]; NSLog(@%@, testing); [[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleReadToEndOfFileCompletionNotification object:[note object]]; [testing release]; } On Apr 28, 2009, at 10:15 PM, Pierce Freeman wrote: I added [testing retain] after the declaration of the variable, and I no longer get the wheel of death and my app freezing up. This smacks of flailing without understanding. The problem with your original code is that -propertyListFromData:... gives you an object, but does not give you the right/responsibility for releasing it, and yet you were releasing it anyway. While it is technically correct to solve this by adding [testing retain], it is redundant. You could have just removed your [testing release]. The object is guaranteed to live at least until you return out of your -readAllTheData: method, so you need not retain it. And, if you don't retain it, you should not release it. All this is to concur with Adam's suggestion that you reread the memory management guide. Regards, Ken ___ 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
File Reading Problems
Hi everyone. I have a small problem with readToEndOfFileInBackgroundAndNotify which is that I can't seem to get it to work right. ;) I am seeding the connection with the file name, and everything looks right except that I keep getting NSConcreteFileHandle: 0x1abfd0 and *** -[NSConcreteFileHandle length]: unrecognized selector sent to instance 0x1abfd0 when attempting to use it. My code is as follows. - (void)awakeFromNib { NSFileHandle *remoteConnection = [NSFileHandle fileHandleForReadingAtPath:@/Users/user/Desktop/file.plist]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readAllTheData:) name:NSFileHandleReadToEndOfFileCompletionNotification object:remoteConnection]; [remoteConnection readToEndOfFileInBackgroundAndNotify]; } - (void)readAllTheData:(NSNotification *)note { NSString *errors = nil; NSData *contentsOfDockFile = [note object]; NSLog(@%@, contentsOfDockFile); NSDictionary *testing = [NSPropertyListSerialization propertyListFromData:contentsOfDockFile mutabilityOption:NSPropertyListImmutable format:nil errorDescription:errors]; NSLog(@%@, testing); [[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleReadToEndOfFileCompletionNotification object:[note object]]; [testing release]; } Thanks for any 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
Re: File Reading Problems
Thanks for your help. I don't get those strange errors anymore, however no if I try to save the NSDIctionary to a file (NSDictionary's writeToFile), my app seems to freeze up and in the Debugger it says: Program loaded. sharedlibrary apply-load-rules all Attaching to program: `/Users/user/Desktop/location', process 3361. (gdb) On 4/28/09 7:35 PM, Stephen J. Butler stephen.but...@gmail.com wrote: On Tue, Apr 28, 2009 at 9:19 PM, Pierce Freeman piercefreema...@comcast.net wrote: - (void)readAllTheData:(NSNotification *)note { NSString *errors = nil; NSData *contentsOfDockFile = [note object]; NSLog(@%@, contentsOfDockFile); NSDictionary *testing = [NSPropertyListSerialization propertyListFromData:contentsOfDockFile mutabilityOption:NSPropertyListImmutable format:nil errorDescription:errors]; NSLog(@%@, testing); [[NSNotificationCenter defaultCenter] removeObserver:self name:NSFileHandleReadToEndOfFileCompletionNotification object:[note object]]; [testing release]; } [note object] is your NSFileHandle. You want [[note userInfo] objectForKey:NSFileHandleNotificationDataItem]]. ___ 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: File Reading Problems
Hey Adam: Thanks for your reply. I added [testing retain] after the declaration of the variable, and I no longer get the wheel of death and my app freezing up. In response to your comment about why I am using NSFileHandle, it is because in the final version of this app I will need to scan several hundred plist files and I would like the app to stay responsive during this process. I am aware that I could just use threading for this, but this seemed a less hassle way to accomplish the same thing. On 4/28/09 8:03 PM, Adam R. Maxwell amaxw...@mac.com wrote: On Apr 28, 2009, at 7:50 PM, Pierce Freeman wrote: Thanks for your help. I don't get those strange errors anymore, however no if I try to save the NSDIctionary to a file (NSDictionary's writeToFile), You're releasing a variable that you don't own (testing). See the Cocoa memory ownership rules at http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/MemoryMgmt/MemoryMgm t.html . Why are you using NSFileHandle asynchronous reading for a plist file, anyway? This is unusual, to say the least. ___ 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
Keynote Scripting
Hi everyone: While this may not be the correct place to ask this question, and I apologize for that, I could not find a list dedicated to Keynote - So I decided to post it here. Also, the people of this list have been so helpful in the past so I hope that you all can help me now. Anyway, for a big presentation (about 400 slides of just pictures), I really want to automate a way to import the selected photos from my drive to the presentation with the format of 3 per slide (following the master template). If anyone could suggest a way to do this, it would be great! Sincerely, Pierce Freeman ___ 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: Beachball on Lengthy Task
Stuart: That sounds like it could work, however, pointed out by someone else - I think NSFileHandle's readToEndOfFileInBackgroundAndNotify could work better as I am dealing with reading files. On 4/4/09 8:45 PM, Stuart Malin stu...@zhameesha.com wrote: On Apr 4, 2009, at 5:36 PM, Pierce Freeman wrote: And, if you are 10.5 only, there's also NSObject's performSelectorInBackground:withObject: Is this a timer or a thread creator? I don't believe it has inputs for the time, or could it just do it automatically? Also, is there some way I can make this work with a function already created? That is a thread creator. It will initiate the specified selector of the receiver (the invoked object). You can pass a single object to it; that object can, of course, contain references to other objects. Please be careful to distinguish method from function. If you meant an Objective-C method, yes, it will work with that. If you meant a C function, then no, it will not work, at least not directly, but in such case it would be easy to create a method that called the function. Note: as has already been pointed out, you must be very careful regarding thread safety. A background thread task must carefully constrain which objects it instantiates and methods used to those that are thread safe. Certainly no U/I. Read the cited references, and additional material germane to these. btw: by any stretch of the imagination, I'm not an expert with threads. ___ 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: Beachball on Lengthy Task
David: Thanks for your help, this seems like a class that will be perfect for what I am doing! Just a few questions: 1. Is there any concern of thread safety using this class? 2. How can I pass NSFileHandle the file URL of my files? 3. How could I create a method that will take the contents of the file and do something with them? Sorry about the big questions. ;) Sincerely, Pierce Freeman On 4/4/09 9:10 PM, Dave Keck davek...@gmail.com wrote: Yeah, it really helped! I am trying to get the contents of the files in a certain directory, so I think that I could probably get away with using a timer. In this case, the reason your task is taking several seconds to complete is most likely attributed to the sheer time it takes the read the contents of the files; that is, most of the time that it takes for the lengthy-task to complete isn't due to lots of computation-intensive stuff going on, but rather the age-old slow disk read. On the list of the 3 best times to use threads, reading large files from disk would perhaps be one of them... I probably should have asked for more information before forming my last post - for this case in particular, I would use NSFileHandle's asynchronous file reading mechanisms (which create separate threads for you, so you don't have to worry about it). Read about NSFileHandle in the docs, specifically, check out -readToEndOfFileInBackgroundAndNotify. At any rate, to get the contents of every file in a directory, I would iterate over the files in the directory, creating an NSFileHandle for each one, and call -readToEndOfFileInBackgroundAndNotify for each. Depending on how many files you're expecting, you may need to call -readToEndOfFileInBackgroundAndNotify on a small number of NSFileHandles, wait until those have finished reading, call it on the next group of NSFileHandles, etc. Note that while you may have escaped from using threads this time (directly, at least) that's not always going to be the case :). Threads are indispensable and with the number of cores chips are sporting these days, will only become more so... Good luck! David ___ 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: Beachball on Lengthy Task
Dear Kirk: While I probably won't be using that in my current project, it sounds like a good idea and I will probably look into it if I ever have a need... On 4/5/09 6:33 AM, Kirk Kerekes kkere...@cox.net wrote: Along with threads and various asynchronous techniques already mentioned, you should also consider creating a separate UI-less foundation tool to perform your lengthy task, controlled with NSTask in your main app. This yields all of the benefits of a thread, with none of the threading pitfalls. Getting real-time feedback (for a progress indicator, for example) from the task is more complex than with a thread, and getting result data back is slightly more involved, but the absolute freedom from threading issues is often worth it. Several of Apple's utility apps are constructed as a UI shell that invokes one or more tools. ___ 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: Beachball on Lengthy Task
David: Thanks for all your help, it's almost working... Just one more question: Question: I am attempting to turn the object returned into a NSDictionary, but it doesn't seem like something that can be turned into a NSDictionary. Am I doing something wrong here? The file is a plist file. Sincerely, Pierce Freeman On 4/5/09 6:36 PM, Dave Keck davek...@gmail.com wrote: 1. Is there any concern of thread safety using this class? 2. How can I pass NSFileHandle the file URL of my files? 3. How could I create a method that will take the contents of the file and do something with them? 1. No. NSFIleHandle takes care of creating a separate thread for you, and notifies your main thread when it's finished reading the given file, with a NSFileHandleReadToEndOfFileCompletionNotification notification. 2. If you have a NSURL and need to create a NSFileHandle with that, simply use NSURL's -path method to get the NSURL's filesystem path. Otherwise, just create your file handle with a NSString path using -fileHandleForReadingAtPath:. 3. Register for the NSFileHandleReadToEndOfFileCompletionNotification notification. Once it's received, you can access its respective NSFileHandle using the notification's -object method. All of this has happened before, and it will all happen again, as they say. The answers to 2 3 can be found with a little searching - I encourage you to do so. David ___ 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
Beachball on Lengthy Task
Hi everyone: I am getting the beachball of death when I try to run an action that takes over a few seconds to complete. Given, the beachball goes away after the task is completed - But for lengthy tasks, why can't I just allow the user to go along with their work instead of having them wait with the beachball? Would this be a problem with memory management, or something else entirely? Sincerely, Pierce Freeman ___ 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: Beachball on Lengthy Task
John: Good idea, I¹ll look into threads and hopefully it will work. On 4/4/09 6:37 PM, john chen johnchen...@gmail.com wrote: You can try to do that task in another thread. John On Sat, Apr 4, 2009 at 8:08 PM, Pierce Freeman piercefreema...@comcast.net wrote: Hi everyone: I am getting the beachball of death when I try to run an action that takes over a few seconds to complete. Given, the beachball goes away after the task is completed - But for lengthy tasks, why can't I just allow the user to go along with their work instead of having them wait with the beachball? Would this be a problem with memory management, or something else entirely? Sincerely, Pierce Freeman ___ 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 http://lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/johnchen202%40gmail.com This email sent to johnchen...@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: Beachball on Lengthy Task
Hey Ryan: I have heard of threads before, but am just looking into them now to see if they will work. On 4/4/09 6:40 PM, Ryan Joseph thealchemistgu...@gmail.com wrote: Are you aware of threading or run loops? There is no problem here, you must share the processor with OS X. Read about those concepts and come back later with questions. ;) On Apr 5, 2009, at 8:08 AM, Pierce Freeman wrote: Hi everyone: I am getting the beachball of death when I try to run an action that takes over a few seconds to complete. Given, the beachball goes away after the task is completed - But for lengthy tasks, why can't I just allow the user to go along with their work instead of having them wait with the beachball? Would this be a problem with memory management, or something else entirely? Sincerely, Pierce Freeman ___ 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/thealchemistguild%40gmail.co m This email sent to thealchemistgu...@gmail.com Regards, Josef ___ 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: Beachball on Lengthy Task
Hey Dave: Yeah, it really helped! I am trying to get the contents of the files in a certain directory, so I think that I could probably get away with using a timer. I assume you mean NSTimer for the timer, though there could be another class that I am totally missing. ;) In addition, if you are to use NSTimer, how would you suggest setting the timer to call another function that requires a passed variable? Thanks again. On 4/4/09 7:27 PM, Dave Keck davek...@gmail.com wrote: I am getting the beachball of death when I try to run an action that takes over a few seconds to complete. Given, the beachball goes away after the task is completed - But for lengthy tasks, why can't I just allow the user to go along with their work instead of having them wait with the beachball? Would this be a problem with memory management, or something else entirely? Something else entirely. User interface events (mouse clicks, typing, etc) are handled on the main thread. If you start performing a long task on the main thread, the main thread is blocked from reacting to any user events until this lengthy-task is complete. In more technical terms, while this long task is running, the main thread's run loop (the mechanism that helps handle UI events) cannot perform another iteration until your lengthy-function returns. (Note that the beachball appears when an app's main thread is blocked, as you've seen.) There are two ways I solve this problem: either create a separate thread, or use a timer. Creating a separate thread could be opening a can of worms, depending on how complex your app is. When using threads in your app, you must make sure that your threads communicate safely. If you choose to go the thread route, research thread safety. There's around a bajillion+1 articles on the subject; of course, you should look for thread-safety articles written for the context of OS X/Cocoa. Also note that much of Cocoa is _not_ thread-safe, so the burden will often be on you to ensure that you're not using certain Cocoa classes incorrectly in regard to thread safety. (That is, using locks where appropriate, and not using certain classes or methods if they don't support multiple threads.) An excellent article on thread-safety and Cocoa can be found here: http://mikeash.com/?page=pyblog/friday-qa-2009-01-09.html On the other hand, you could use a timer. The idea behind a timer is you complete a small part of the task every time the timer fires, until the task is complete. In some respects, using a timer can be 'cleaner' than creating a separate thread: since a timer runs in the main thread, you don't have to worry about using locks everywhere. In other respects, using a timer can be much less elegant: you'll have to store the lenghty-task's state somewhere, so every time the timer fires, it knows where it left off. This can lead to some confusing and overall inelegant code, but sometimes can still be easier than creating a separate thread and dealing with the caveats of thread-safety. (And sometimes you simply can't use a separate thread, if something you rely on doesn't play nice with threads.) The route you choose really depends on how well your task can be self-contained. For example, if I'm calculating pi to ten billion digits, but want the UI to remain responsive, this is a perfect time to use a separate thread. On the other hand, if a lengthy task requires access to Cocoa classes that don't like threads (and the lenghty-task can be broken up into smaller chunks) then a timer may be a better choice. Hope this helps, David ___ 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: Beachball on Lengthy Task
And, if you are 10.5 only, there's also NSObject's performSelectorInBackground:withObject: Is this a timer or a thread creator? I don't believe it has inputs for the time, or could it just do it automatically? Also, is there some way I can make this work with a function already created? ___ 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: NSDate with Format?
-- NSDateFormatter is your friend. =) You use it like this: NSDateFormatter * f = [[NSDateFormatter alloc] init]; [f setDateFormat:@-mm-dd]; NSLog([f stringFromDate:aDate]); [f release]; There's also a really handy dateFromString method that will parse a string according to the format string you specify. This page has lots of good info on what the formatting specifiers are: http://unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns HTH, Dave -- @Dave DeLong Sorry, didn't get your previous message. I think something may be wrong with my email account. ;) In any event, here is my current code: NSCalendarDate *date = [NSCalendarDate calendarDate]; NSString *dateString = [date descriptionWithCalendarFormat:@%Y-%m%d]; Now I am wondering how I can take that special formatted string and save it back into NSCalendarDate or NSDate (knowing how it was formatted). I looked up some information regarding dateFromString but it returns null when I pass it my string. Though I could be doing something wrong regarding dateFromString. Thanks for any 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
NSDate with Format?
Hi everyone. I am looking into a way to change the format of what a NSDate instance shows to the user. I am aware there is a way to do this with NSCalendarDate, but since its documentation says that it may be deprecated in Snow Leopard - I would rather not take a chance. Also, I need some way to be able to create a NSDate instance out of this format contained in a string (for example %Y-%m-%d). Thanks for any 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
Re: NSMutableArray is null?
Hey Graham : Yeah, I finally figured that out. ;) It now works like a charm. On 3/31/09 7:20 PM, Graham Cox graham@bigpond.com wrote: On 01/04/2009, at 1:16 PM, Pierce Freeman wrote: The global variable is in the Controller.h... Is this what you are asking for? No. Just declaring globalVariable doesn't actually make an instance of NSMutableArray. You have to write code to do that. Where is it? If you haven't done this, that's your problem. Somewhere you need: globalVariable = [[NSMutableArray alloc] init]; --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: NSMutableArray is null?
Yeah, it helps a lot... And hopefully anyone that has this problem will look at this before writing to any support site. :) On 4/1/09 8:06 AM, I. Savant idiotsavant2...@gmail.com wrote: On Wed, Apr 1, 2009 at 10:33 AM, Pierce Freeman piercefreema...@comcast.net wrote: Yeah, I finally figured that out. ;) It now works like a charm. Just for completeness, the plain-language concept to remember is: // Let there be an NSMutableArray pointer named 'globalVariable'. NSMutableArray * globalVariable; ... and ... // Create an NSMutableArray instance and assign it to the 'globalVariable' pointer // ... so when I talk to 'globalVariable', I mean this instance of NSMutableArray. globalVariable = [[NSMutableArray alloc] init]; By contrast, when you're creating objects inside a method (temporary objects whose scope is limited to that method), do this all in one go: NSMutableArray * myTemporaryArray = [[NSMutableArray alloc] init]; - or, more simply - NSMutableArray * myTemporaryArray = [NSMutableArray array]; ... then you'll use it then let it die, or hand it off to someone else. However, since you're creating an instance variable in your class, you declare the pointer in your header and then create an array and assign it to the pointer somewhere in your implementation. The most likely place (arguably by best practice) would be the class's -init method, since you want a mutable array ready for use when an instance of your class is created (allocated and initialized). I hope that helps a bit. -- I.S. ___ 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
NSMutableArray is null?
Hi everyone: I am having a strange problem with NSMutableArray which is that it doesn't seem to work with addObjectsFromArray. I try setting this for a global variable (forget what they are called in Cocoa) and it just returned null. Here is my code (assuming that global Variable is the global variable which is a NSMutable Array): NSArray *testing = [NSArray arrayWithObjects:@testing, @testing, nil]; [globalVariable addObjectsFromArray:testing]; Thanks for any 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
Re: NSMutableArray is null?
Whoops, sorry I didn't put that in... @interface Example_Class : NSObject { IBOutlet NSTableView *tableView; NSMutableArray *globalVariable; } On 3/31/09 7:09 PM, I. Savant idiotsavant2...@gmail.com wrote: We *can't* assume anything. You left out the most relevant part of your code: how are you creating globalVariable? -- I.S. On Mar 31, 2009, at 10:05 PM, Pierce Freeman wrote: Hi everyone: I am having a strange problem with NSMutableArray which is that it doesn't seem to work with addObjectsFromArray. I try setting this for a global variable (forget what they are called in Cocoa) and it just returned null. Here is my code (assuming that global Variable is the global variable which is a NSMutable Array): NSArray *testing = [NSArray arrayWithObjects:@testing, @testing, nil]; [globalVariable addObjectsFromArray:testing]; Thanks for any 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/idiotsavant2005%40gmail.com This email sent to idiotsavant2...@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: NSMutableArray is null?
The global variable is in the Controller.h... Is this what you are asking for? On 3/31/09 7:14 PM, Chris Suter csu...@sutes.co.uk wrote: On Wed, Apr 1, 2009 at 1:12 PM, Pierce Freeman piercefreema...@comcast.net wrote: Whoops, sorry I didn't put that in... @interface Example_Class : NSObject { IBOutlet NSTableView *tableView; NSMutableArray *globalVariable; } :-D You still haven't put it in! Where do you set globalVariable to something? Regards, Chris ___ 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: NSMutableArray is null?
In my instance variable programming, I totally forgot that even for instance variables you have to do that code. :) Sorry for any inconvenience for such a stupid question. On 3/31/09 7:17 PM, Bryan Henry bryanhe...@mac.com wrote: You declared a pointer to an instance of NSMutableArray as an instance variable of Example_Class (its in no way global) there, but you didn't create an instance of NSMutableArray. Did you do something like this at some point? globalVariable = [[NSMutableArray alloc] init]; - Bryan On Mar 31, 2009, at 10:12 PM, Pierce Freeman wrote: Whoops, sorry I didn't put that in... @interface Example_Class : NSObject { IBOutlet NSTableView *tableView; NSMutableArray *globalVariable; } On 3/31/09 7:09 PM, I. Savant idiotsavant2...@gmail.com wrote: We *can't* assume anything. You left out the most relevant part of your code: how are you creating globalVariable? -- I.S. On Mar 31, 2009, at 10:05 PM, Pierce Freeman wrote: Hi everyone: I am having a strange problem with NSMutableArray which is that it doesn't seem to work with addObjectsFromArray. I try setting this for a global variable (forget what they are called in Cocoa) and it just returned null. Here is my code (assuming that global Variable is the global variable which is a NSMutable Array): NSArray *testing = [NSArray arrayWithObjects:@testing, @testing, nil]; [globalVariable addObjectsFromArray:testing]; Thanks for any 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/idiotsavant2005%40gmail.co m This email sent to idiotsavant2...@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/bryanhenry%40mac.com This email sent to bryanhe...@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
Re: NSMutableArray is null?
No, I didn't call it that. ;) And in my instance variable programming, I forgot that you have to run that code no matter what. On 3/31/09 7:17 PM, Chris Suter csu...@sutes.co.uk wrote: On Wed, Apr 1, 2009 at 1:16 PM, Pierce Freeman piercefreema...@comcast.net wrote: The global variable is in the Controller.h... Is this what you are asking for? Unless you set globalVariable to something (I do hope you haven't actually called it that BTW), it will remain nil forever. Messages to nil will yield nil. We're looking for something along the lines of: globalVariable = [[NSMutableArray alloc] init]; Regards, Chris ___ 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: NSMutableArray is null?
Ken: Note to self, don't go writing to support boards when I am already half asleep. ;) I realize that now, and I understand what instance variables are, just I couldn't think of the name when I was writing my original post. And in my instance variable programming, I forgot that you have to run this no matter if it is an instance variable or not: globalVariable = [[NSMutableArray alloc] init]; On 3/31/09 7:19 PM, Ken Thomases k...@codeweavers.com wrote: On Mar 31, 2009, at 9:12 PM, Pierce Freeman wrote: Whoops, sorry I didn't put that in... @interface Example_Class : NSObject { IBOutlet NSTableView *tableView; NSMutableArray *globalVariable; } That's not a global variable. It's an instance variable. That's a massive conceptual error, and you should do your best to understand why you made it before going much further. Perhaps reading Apple's guide to Object-Oriented Programming with Objective-C would help: http://developer.apple.com/documentation/Cocoa/Conceptual/OOP_ObjC/index.html Next, what you showed is the declaration of the variable. The variable is a pointer, which may point to an object. Declaring a pointer does not allocate or initialize the object, nor make the pointer point to the object (or anything in particular). You have to do that separately. Regards, Ken ___ 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: NSMutableArray is null?
Hey Roland: Yeah, thanks to yourself and others I finally remembered that you have to make the variable somewhere. ;) And I know what a instance variable is, it's just that I couldn't think of the term when writing my original post. On 3/31/09 7:20 PM, Roland King r...@rols.org wrote: well no that's just the declaration of the NSMutableArray pointer, you have to actually make it somewhere, in the initializer of your Example_Class (and release it somewhere too) And that variable isn't global, it's a class instance variable. You might want to go back to the Objective-C 2.0 Programming Language chapter about classes and initialization, that whole document is very good and may help you sort out some ideas. Pierce Freeman wrote: Whoops, sorry I didn't put that in... @interface Example_Class : NSObject { IBOutlet NSTableView *tableView; NSMutableArray *globalVariable; } On 3/31/09 7:09 PM, I. Savant idiotsavant2...@gmail.com wrote: We *can't* assume anything. You left out the most relevant part of your code: how are you creating globalVariable? -- I.S. On Mar 31, 2009, at 10:05 PM, Pierce Freeman wrote: Hi everyone: I am having a strange problem with NSMutableArray which is that it doesn't seem to work with addObjectsFromArray. I try setting this for a global variable (forget what they are called in Cocoa) and it just returned null. Here is my code (assuming that global Variable is the global variable which is a NSMutable Array): NSArray *testing = [NSArray arrayWithObjects:@testing, @testing, nil]; [globalVariable addObjectsFromArray:testing]; Thanks for any 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/idiotsavant2005%40gmail.co m This email sent to idiotsavant2...@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/rols%40rols.org This email sent to r...@rols.org ___ 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: NSMutableArray is null?
Thanks Roland, I probably shouldn't - It was just such a beginner's mistake. ;) And as for your mistake, I probably wouldn't have gotten that ever figured out. On 3/31/09 7:45 PM, Roland King r...@rols.org wrote: don't beat yourself up too much. I spent 30 minutes last night staring at this line of code and trying to figure out why it wouldn't compile. Checked headers, checked libraries, checked the definition of the function sin(). Pulled out hair by the handful, restarted XCode .. when it finally dawned on me I decided it was time to go to bed .. double sin = sin( angle ); Pierce Freeman wrote: Ken: Note to self, don't go writing to support boards when I am already half asleep. ;) I realize that now, and I understand what instance variables are, just I couldn't think of the name when I was writing my original post. And in my instance variable programming, I forgot that you have to run this no matter if it is an instance variable or not: globalVariable = [[NSMutableArray alloc] init]; On 3/31/09 7:19 PM, Ken Thomases k...@codeweavers.com wrote: On Mar 31, 2009, at 9:12 PM, Pierce Freeman wrote: Whoops, sorry I didn't put that in... @interface Example_Class : NSObject { IBOutlet NSTableView *tableView; NSMutableArray *globalVariable; } That's not a global variable. It's an instance variable. That's a massive conceptual error, and you should do your best to understand why you made it before going much further. Perhaps reading Apple's guide to Object-Oriented Programming with Objective-C would help: http://developer.apple.com/documentation/Cocoa/Conceptual/OOP_ObjC/index.htm l Next, what you showed is the declaration of the variable. The variable is a pointer, which may point to an object. Declaring a pointer does not allocate or initialize the object, nor make the pointer point to the object (or anything in particular). You have to do that separately. Regards, Ken ___ 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/rols%40rols.org This email sent to r...@rols.org ___ 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: Spotlight and Leopard
Scott: Thanks for your reply. I more mean what has changed in the actual structure in Spotlight for Leopard. For example, I tried to follow this article: http://oreilly.com/pub/a/mac/2005/07/12/spotlight.html but it seems as if some of the code has been removed from Leopard (HISearchWindowShow, etc). I find it rather surprising that there is hardly any up-to-date documentation, at least in the places I have been looking, for integration with Spotlight. Any ideas would be very helpful (even if it is just regarding searching for a file that changes locations in another way). Sincerely, Pierce Freeman On 3/29/09 12:38 AM, Scott Anguish sc...@cocoadoc.com wrote: On 29-Mar-09, at 1:31 AM, Pierce Freeman wrote: Hi everyone. I have been looking into a way to search the user's hard drive for a files and have settled on Spotlight. I will say ahead of time that if anyone has a better way to search for files that are in changing places, I would love to hear about it! Anyway, all the documentation I found on integrating Spotlight into my application was regarding Tiger and I couldn't really find any new material. If anyone could point me to a tutorial or quickly tell me the basics, it would be very appreciated. There weren't any major new features in Leopard as far as Spotlight goes. A couple of new metadata keys, that's about 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: Spotlight and Leopard
Thanks for your reply Matt. I have been looking about all the problems with using Spotlight (including this problem) and am thinking that formulating a UNIX find command would probably be easier. Please comment back with any thoughts about this idea. On 3/29/09 12:51 PM, Matt Neuburg m...@tidbits.com wrote: On Sat, 28 Mar 2009 22:31:01 -0700, Pierce Freeman piercefreema...@comcast.net said: Hi everyone. I have been looking into a way to search the user's hard drive for a files and have settled on Spotlight. I will say ahead of time that if anyone has a better way to search for files that are in changing places, I would love to hear about it! Well, a user can accidentally or intentionally put a file in a place where Spotlight is blind (either because it is hard-wired not to look there, or because it is one of the places designated in the user's Spotlight Privacy prefs), and then you are SOL. Whereas, if a file is moving around the same hard drive, an alias (once formed) always works. m. ___ 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: Spotlight and Leopard
I'm not aware of that being removed (and typically I would be) It's in the headers on Leopard. That example does have an issue in that it doesn't link against Carbon. But if you do that, it compiles without warning, and clicking on the search button brings up the current Leopard HI for searching. That makes more sense now - I was wondering why that totally disappeared. ;) Due to problems with Spotlight not searching other drives on default, I have decided on integrating the UNIX find command. Please reply with any ideas you have regarding this, including (please) something about saving the locations of the files that it found to an array. ___ 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
Spotlight and Leopard
Hi everyone. I have been looking into a way to search the user's hard drive for a files and have settled on Spotlight. I will say ahead of time that if anyone has a better way to search for files that are in changing places, I would love to hear about it! Anyway, all the documentation I found on integrating Spotlight into my application was regarding Tiger and I couldn't really find any new material. If anyone could point me to a tutorial or quickly tell me the basics, it would be very appreciated. ___ 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
Sorting through .plist in NSDictionary
Hi everyone. I am attempting to sort through the contents of a .plist file in NSDictionary, but am running into some problems. Since .plist files are kind of like a tree, I can't just call objectForKey as there is no way for me to return the instance that I am looking for. How would someone get a certain key for each part of the tree? Sincerely, Pierce Freeman ___ 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
Programmatically Change Icon
Hi everyone: I am wondering if there is some way to change another applications icon programmatically. The problem that I see if that every application's icon name is different and I haven't found a way to read that application's icon location or will just return a NSImage that is the icon. Thanks for any 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
Re: Programmatically Change Icon
Well, that's what I get for typing this when I was still half asleep. I meant to simply view instead of changing the icon. Would there be any problems (legally or otherwise) with doing this? You seem to know about these issues a lot better them myself... I definitely agree with all the problems you outlined, and never wanted to cause problems. If you would mind saying, though, how would changing the Application's icon involve legal issues? Since the users of the computers do it all the time. Also I agree that using an application that would change them without the user's permission would be very disconcerting and I would probably trash that application right away. Thanks for your help. On 3/22/09 10:55 AM, I. Savant idiotsavant2...@gmail.com wrote: On Mar 22, 2009, at 12:27 PM, Pierce Freeman wrote: I am wondering if there is some way to change another applications icon programmatically. The problem that I see if that every application's icon name is different and I haven't found a way to read that application's icon location or will just return a NSImage that is the icon. Problems: 1 - Not all users are administrators of their computer, and so a user- space application may not be able to modify the application bundles in question. You'll need to authenticate/authorize the user to perform this change if the application is in the /Applications folder, or the user has no write permissions for the app bundles otherwise. 2 - Some applications may be digitally signed, in which case modifying the application bundles in question may at least cause disconcerting warnings for the user launching the modified applications, and at worst break the application(s). 3 - This may be technically in violation of the EULA of the applications in question. IANAL, but I certainly would look into this before trying it, especially with the very loosely-defined DMCA laws. 4 - All the above aside, make sure you have your users' express permission to perform this action ... it is a pretty big deal and I would personally not use any application that does this, and you can count on others feeling the same way, so make sure you ask in very clear, plain language. That said, to get the application's icon, you can do what the Finder does and use the app bundle's Info.plist and ask for the value for the CFBundleIconFile key. Then ask the application bundle for the resource with the returned name. See the documentation for the permissions issue and for how to work with the icon file format. -- I.S. ___ 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: Programmatically Change Icon
Heh - ... some way to change another applications icon ... Changing has all those issues attached. Viewing on the other hand is easy. My point exactly. ;) As Uli mentioned, NSWorkspace should be all you need simply to get a copy of the icon. The bundle stuff is only necessary if you want to get at the file itself (say, to modify it :-)). Would NSWorkspace also work if the app was not running, or only if it is? Best answer: I don't know for sure. Note the use of IANAL (I Am Not A Lawyer) and might be. :-) In the US, distributing software that modifies third-party software is uncomfortably close to the fence of a number of copyright laws and regulations. It's something any independent software business owner should be aware of. Again, this is from the perspective of a US citizen; it may be a non-issue for you, but you should definitely consult a lawyer before distributing such an application. That's all I meant to say. While it doesn't have to do with me, it's good advice to know. However, as you said, I assume these problems aren't true with just showing the icon (versus changing it). This discussion, however, is off-topic for cocoa-dev, so I'll leave it at that. I suggest the macsb group on Yahoo Groups. True, I'll look there if I have any more questions. Thanks for all your 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
Re: Programmatically Change Icon
Slightly-challenging-answer: Try it and see. Non-smarmy-answer: Yes. So would the other, more complicated approach. Lol, just wanted to make sure. I would assume this as well ... there'd be a number of software companies in hot water otherwise. Especially OS vendors like Apple and Microsoft, since Finder and Windows Explorer both show other applications' icons. :-) Yeah, this is more or less what I figured... Application icons are more or less made to be viewed. ;) ___ 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: Programmatically Change Icon
Slightly-challenging-answer: Try it and see. Non-smarmy-answer: Yes. So would the other, more complicated approach. Just tried it, and it works great... Thanks! Just two questions so far: 1. How can I get different sizes of the icon, or are they just linked to the size of the outlet? 2. If you link to a non-existent application, it still returns an image - Is there some way to set it to return an error if this happens? Thanks for all your 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
Re: Programmatically Change Icon
I suggest some reading: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classe s/nsimage_Class/Reference/Reference.html http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Im ages/Images.html http://developer.apple.com/documentation/Cocoa/Conceptual/ImageView/ImageView. html Thanks for the links, I'll look them over when I get a chance. This is what I'd expect ... if an application has no custom icon, it gets the standard, generic application icon. In this case, you'd probably want to go with the get the app icon file name, then ask the app bundle for the resource of that name route. This way, if there's nothing set for the app icon key, you'll know there's no custom icon. If so, you can just use the NSWorkspace call to get that custom icon. I think I may just go this route, especially if it doesn't break any copyright/patent/etc. Laws. ;) But the odd thing is, if I set the path to a file that I know doesn't exist (ex. /Applications/soidaoidaiodsaoidiasoadsoidoiaadiosoaidiodaoidasoidaoidasoiado iasdoidaoidadasoidiaosasidoosdiaiodsiodsa.app) it will still return some weird page icon. ___ 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: Programmatically Change Icon
Come to think of it, it's strange that you get an icon for a non- existent file, but if it *does* exist, I'd always expect some sort of icon. I've never run into this situation personally. Which specific method are you using? There are: iconForFile: iconForFileType: iconForFiles: I kind of figured that it was a bit odd. I am using iconForFile and then the path. In your case, though, if you're going after applications, you'd presumably already have a list of app bundle paths, so it shouldn't be a problem, right? Presumably, but if the user deleted the application it would be nice to alert the user saying something instead of just showing some empty page icon. ;) ___ 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
Background Process?
Hi everyone: I am wondering how to create a background process that will only run when the user is logged in and will run every certain minutes (a bit like Time Machine). I am also not sure in which way the action in the background process would be programmed, so any information regarding this would be great. Thanks for any 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
Re: Path for writeToFile
Maybe I'm off base here, but I haven't really found any more documentation on FSFindFolder() and a search of Google doesn't really revile anything either. Also, I read on one archived site, that the 10.5.6 upgrade breaks FSFindFolder(). On 3/3/09 8:55 AM, Nick Zitzmann n...@chronosnet.com wrote: On Mar 3, 2009, at 8:40 AM, Pierce Freeman wrote: I may be crazy here, but could you point me to some documentation? The only one I found is legacy. I think the parent meant FSFindFolder(), which will return an FSRef for a given special folder. That API is not legacy, and works on all four architectures. You can search the archives of this list for more details. Nick Zitzmann http://www.chronosnet.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: Path for writeToFile
Did you try Cocoabuilder? We've discussed FSFindFolder() on this list in the past. http://www.cocoabuilder.com/search/archive/cocoa?words=FSFindFolder Looks like Cocoabuilder saved the day once again. I found some code on there and it works wonderfully. That's news to me; I haven't noticed that. Maybe the author mistakenly posted it, as I am running 10.5.6 and the code from Cocoabuilder seems to work. Thanks for the 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
Re: Path for writeToFile
I may be crazy here, but could you point me to some documentation? The only one I found is legacy. On 3/2/09 8:56 PM, Graham Cox graham@bigpond.com wrote: On 03/03/2009, at 3:36 PM, Pierce Freeman wrote: Hi everyone: I am running into a bit of a problem when trying to use writeToFile with NSDictionary. My problem is that I want to be able to get a file on the Desktop but I can't find a way to do that without knowing the directory structure of the user. If anyone could point me in the right direction, it would be great. FindFolder with a type of kDesktopFolderType. --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
Path for writeToFile
Hi everyone: I am running into a bit of a problem when trying to use writeToFile with NSDictionary. My problem is that I want to be able to get a file on the Desktop but I can't find a way to do that without knowing the directory structure of the user. If anyone could point me in the right direction, it would be great. Pierce ___ 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: Name to PSN
Since the dock is an application (at least based on what you/I am saying) why wouldn't it show up in NSWorkspace? On 2/27/09 10:53 PM, Andrew Farmer andf...@gmail.com wrote: On 27 Feb 09, at 22:49, Kyle Sluder wrote: On Sat, Feb 28, 2009 at 1:41 AM, Pierce Freeman piercefreema...@comcast.net wrote: Does anyone have any ideas? To restart the dock, you send a quit event to the Finder. No, that'll just quit the Finder. The Dock is a separate application which you can tell to quit separately. ___ 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: Name to PSN
Then would there be some way to either trick the system into quitting it in Cocoa, or simply using another way other then Apple Events? On 2/28/09 12:42 PM, Scott Ribe scott_r...@killerbytes.com wrote: Since the dock is an application (at least based on what you/I am saying) why wouldn't it show up in NSWorkspace? It's a special application which the system knows about and treats specially in various ways. ___ 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: Name to PSN
That makes sense... So we have found out that the dock is definitely an app. After my reinstall of Xcode finishes, I'll see if I can quit it. If I can't, I'll let you all know. On 2/28/09 12:59 PM, Paul Sanders p.sand...@dsl.pipex.com wrote: Then would there be some way to either trick the system into quitting it in Cocoa, or simply using another way other then Apple Events? ps -A | grep Dock finds it, at least, so it's definitely an app. And kill -9 would undoubtedly get rid of it, although maybe that's a bit brutal. I didn't want to actually try this as I am using the machine! ___ 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: Name to PSN
Then I'm guessing that NSWorkspace wouldn't be the right item for this task. What substitute that shows LSUIIElements would you recommend? On 2/28/09 1:07 PM, Nick Zitzmann n...@chronosnet.com wrote: On Feb 28, 2009, at 1:25 PM, Pierce Freeman wrote: Since the dock is an application (at least based on what you/I am saying) why wouldn't it show up in NSWorkspace? NSWorkspace ignores LSUIElement applications, as well as other background-only apps that connect to the window server. The Dock is an LSUIElement application. Nick Zitzmann http://www.chronosnet.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: Name to PSN
I thought that based on the info, you couldn't do it using Apple Events... Apparently I misinterpreted. I'll try this in a little bit and I'll post back my results. On 2/28/09 1:22 PM, Scott Ribe scott_r...@killerbytes.com wrote: Then would there be some way to either trick the system into quitting it in Cocoa, or simply using another way other then Apple Events? What's wrong with Apple Events? NSDictionary *err = nil; NSAppleEventDescriptor *desc = NSAppleScript alloc] initWithSource: @tell application \System Events\\r...] autorelease] executeAndReturnError: err]; OK, yeah, I wouldn't (don't) actually try to jam it all on one line like that, but it's just to give you the idea... ___ 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: Name to PSN
First off I would just like to thank everyone that helped me through this issue. I really wouldn't have been able to figure it out without all of you. In the end, using Apple Events with Apple Script seems to work very well... And it is very easy to manage. Thanks again! ___ 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: Name to PSN
I have been doing some more research on this... And it seems as if the dock is an application. It lives in Hard Drive/System/Library/Core Services/Dock and all of it's bundle info seem to point to it being an application. But this still leaves the problem of how to restart it (or send a quit event for it to restart). Does anyone have any ideas? On 2/22/09 10:14 AM, Ken Thomases k...@codeweavers.com wrote: On Feb 21, 2009, at 10:21 PM, Pierce Freeman wrote: Is there some panel in Activity Monitor that I'm missing that shows you the Bundle ID of all the processes? I am not quitting my own application (as you may have guessed) but I do need some way to find it for another application. Is there one specific application that you will be quitting? You can look into its application bundle at its Info.plist file to get its bundle ID. On another topic: Is there someway to have NSWorkspace show all the processes open? Right now it is showing me the applications, but the process that I'm targeting isn't really an application and doesn't have an interface. As I recall, you were planning to send a quit Apple Event to the process to ask it to quit. Are you sure it will respond to such an event? If it's a BSD-level tool or daemon or the like, it very likely won't. If it's an LSUIElement application, then it probably will. In addition to the documentation that Jerry Krinock referred you to, you might want to read this technote http://developer.apple.com/technotes/tn/tn2050.html , especially the caveats regarding Process Serial Number-based APIs. Cheers, Ken ___ 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: Name to PSN
Is there one specific application that you will be quitting? You can look into its application bundle at its Info.plist file to get its bundle ID. It's not a application per say, but a daemon. At least I think... It's rather confusing. You see, the dock is a daemon (I think) but there is an application in Core Services that is Dock.app As I recall, you were planning to send a quit Apple Event to the process to ask it to quit. Are you sure it will respond to such an event? If it's a BSD-level tool or daemon or the like, it very likely won't. If it's an LSUIElement application, then it probably will. As I said above, I'm just not sure. If it's an application an Apple Event probably will work, but if it's a daemon (as you pointed out) it probably won't. In addition to the documentation that Jerry Krinock referred you to, you might want to read this technote http://developer.apple.com/technotes/tn/tn2050.html , especially the caveats regarding Process Serial Number-based APIs. Okay Ken, I'll look into 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: Name to PSN
Very true, very true. Is the dock considered an agent (or daemon) anyway? It is on the screen, but I don't think I'd classify it as an application. It's kind of confusing. @_@ Pierce On 2/22/09 1:46 PM, Kyle Sluder kyle.slu...@gmail.com wrote: On Sun, Feb 22, 2009 at 3:37 PM, Pierce Freeman piercefreema...@comcast.net wrote: As I said above, I'm just not sure. If it's an application an Apple Event probably will work, but if it's a daemon (as you pointed out) it probably won't. Don't forget that there are also agents. See http://developer.apple.com/technotes/tn2005/tn2083.html for more info. --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
Name to PSN
Hi everyone. I am having a little trouble finding a way to go from the name of a process to its PSN. Maybe it's just something I have overlooked, but all the documentation seems to be going from the PSN to its name. My goal is to use the name of a particular process and kill it using Apple Events. I have kind of done this before (with a notification of a new application) but I have never tried it in this particular way. Any help would be greatly appreciated. ___ 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: Name to PSN
Hi Ken: Thanks for your reply. I see where you're coming from regarding NSWorkspace, and it seems like a great idea! How would you recommend scanning it? A loop or something else more creative? ;) Is there some reason it is better/easier to use the bundle identifiers instead of the name? And I assume you would get this by sorting through NSWorkspace as well. Pierce On 2/21/09 9:06 AM, Ken Thomases k...@codeweavers.com wrote: On Feb 21, 2009, at 10:57 AM, Pierce Freeman wrote: I am having a little trouble finding a way to go from the name of a process to its PSN. Maybe it's just something I have overlooked, but all the documentation seems to be going from the PSN to its name. My goal is to use the name of a particular process and kill it using Apple Events. You can scan the array of dictionaries returned by -[NSWorkspace launchedApplications] for the one which matches your criteria, and get the PSN from that. In general, I recommend that you use the bundle identifier, rather than the name, to discriminate among applications/processes. Cheers, Ken ___ 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: Name to PSN
Just got a chance to look into your replies... So here are my questions/comments. A loop, sure. The same way you enumerate any array. Fast enumeration if you're targeting Leopard, or using an index or NSEnumerator. Okay, sounds good. A bundle ID is guaranteed to be unique and stable. With a name, there may be other applications out there that are named the same thing. Also, the user is free to rename your application, although I don't know off-hand if the name provided by NSWorkspace is the on-disk name or the CFBundleName. That makes sense, as application names are subject to change. Is there some panel in Activity Monitor that I'm missing that shows you the Bundle ID of all the processes? I am not quitting my own application (as you may have guessed) but I do need some way to find it for another application. The bundle ID is one of the values in the dictionary elements of the array returned from -launchedApplications. I didn't get a chance to play around with NSWorkspace before I emailed you back, so I didn't quite know if it was. On another topic: Is there someway to have NSWorkspace show all the processes open? Right now it is showing me the applications, but the process that I'm targeting isn't really an application and doesn't have an interface. 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: Checking One Array Against Another
The only problem with running that is that I get a error in the log and it doesn't seem to be working: -[NSCFSet minusSet:]: mutating method sent to immutable object My slightly modified code is below: NSMutableSet *openApplicationsSet = [NSSet setWithArray:openApplications]; NSSet *allowedApplicationsSet = [NSSet setWithArray:applicationsAllowedMutableArray]; NSSet *badApplicationsSet = [openApplicationsSet minusSet:allowedApplicationsSet]; NSLog(badApplicationsSet); Sincerely, Pierce F. On 11/28/08 10:51 PM, Graff [EMAIL PROTECTED] wrote: On Nov 28, 2008, at 9:59 PM, Pierce Freeman wrote: Would there be some way using the NSSet method to output a list of the applications that the user needs to close in order for the current applications to be in the good list? You can use the NSMutableSet method minusSet: NSSet *allowedSet = [NSSet setWithObjects:@one,@two,@three,nil]; NSMutableSet *openSet = [NSMutableSet setWithObjects:@one,@four,@five,nil]; if([openSet isSubsetOfSet:allowedSet]) NSLog(@The user has only the okay applications open); else { NSLog(@The user has these not okay applications open:); [openSet minusSet:allowedSet]; for(id anItem in openSet) NSLog(anItem); } ___ 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 [EMAIL PROTECTED]
Re: Checking One Array Against Another
Klaus: For whatever reason, Xcode is telling me that error: void value not ignored as it ought to be when I try to make badApplicationsSet a mutable set. Sincerely, Pierce F. On 11/29/08 10:22 AM, Klaus Backert [EMAIL PROTECTED] wrote: On 29.11.2008, at 19:00, Pierce Freeman wrote: The only problem with running that is that I get a error in the log and it doesn't seem to be working: -[NSCFSet minusSet:]: mutating method sent to immutable object My slightly modified code is below: NSMutableSet *openApplicationsSet = [NSSet setWithArray:openApplications]; NSSet *allowedApplicationsSet = [NSSet setWithArray:applicationsAllowedMutableArray]; NSSet *badApplicationsSet = [openApplicationsSet minusSet:allowedApplicationsSet]; badApplicationsSet is as NSSet * NOT mutable here, but you want to mutate it just as the compiler told you: mutating method sent to immutable object. NSMutableSet * badApplicationsSet = ... NSLog(badApplicationsSet); Better, to avoid more crashs, would be: NSLog(@badApplicationsSet: %@, badApplicationsSet); Klaus ___ 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 [EMAIL PROTECTED]
Re: Checking One Array Against Another
I may be totally wrong about this, but I think it said that it takes something away from the Mutable Array, and that it doesn't necessarily return anything... As I said, I may be totally wrong about this though. ;) Sincerely, Pierce F. On 11/29/08 10:37 AM, Charles Steinman [EMAIL PROTECTED] wrote: --- On Sat, 11/29/08, Pierce Freeman [EMAIL PROTECTED] wrote: For whatever reason, Xcode is telling me that error: void value not ignored as it ought to be when I try to make badApplicationsSet a mutable set. Take a look at the documentation for -[NSMutableSet minusSet:]. Specifically, take a look at what it returns. Cheers, Chuck ___ 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 [EMAIL PROTECTED]
Re: Checking One Array Against Another
Okay... That makes sense. :) Thanks for your (and everyone else's) help. Sincerely, Pierce F On 11/29/08 10:58 AM, Ashley Clark [EMAIL PROTECTED] wrote: On Nov 29, 2008, at 12:47 PM, Pierce Freeman wrote: NSMutableSet *openApplicationsSet = [NSSet setWithArray:openApplications]; While openApplicationsSet is declared to be an NSMutableSet you are not creating one. Your assignment should be [NSMutableSet setWithArray:...] NSSet *allowedApplicationsSet = [NSSet setWithArray:applicationsAllowedMutableArray]; NSMutableSet *badApplicationsSet = [openApplicationsSet minusSet:allowedApplicationsSet]; The minusSet: method doesn't return a new object. It mutates the receiver, in this case openApplicationsSet, by removing items it shares in common with the passed in set, allowedApplicationsSet. NSAlert * askToContinue = [NSAlert alertWithMessageText:@Warning! defaultButton:@Continue alternateButton:@Quit otherButton:nil informativeTextWithFormat:@Quit [EMAIL PROTECTED], badApplicationsSet]; Ashley ___ 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 [EMAIL PROTECTED]
Re: Sort Through Commas in Cocoa
Would this still work for a NSMutable array? Sincerely, Pierce F -- Pierce Freeman [EMAIL PROTECTED] On 11/26/08 6:40 PM, Nick Zitzmann [EMAIL PROTECTED] wrote: On Nov 26, 2008, at 7:28 PM, Pierce Freeman wrote: Thanks for your reply. I understand how you would do that much, but how exactly would you do that if Apple, Banana, Grape were stored in a variable? Same thing as I wrote, except substitute the variable's name for the constant. Nick Zitzmann http://www.chronosnet.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 [EMAIL PROTECTED]
NSArray to NSMutableArray
Hi everyone. I am wondering the correct/recommended technique to make a NSMutableArray out of a NSArray. I see online that there are ways to do this, but am not sure what is the best way. Sincerely, Pierce F. -- Pierce Freeman [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Checking One Array Against Another?
Hi everyone. I am attempting to check one array's contents against another's, but so far it hasn't been working. In the actual application, I am checking the current open applications against an okay application list, and just thought of another problem: If the user chooses only has some open on the list, it will return that the user has some open that is not on the list. Some example code (with different variables) is below: [CODE] for (int arraySort = 0; arraySort [arrayInfo count]; arraySort++) { for (int arrayNewSort = 0; arrayNewSort [arrayNewInfo count]; arrayNewSort++) { if ([ arrayInfo objectAtIndex:arraySort] == [arrayNewInfo objectAtIndex:arrayNewSort]) { some++; } } } If (some == [arrayNewInfo count] { NSLog(@The user has only the okay applications open); } [END CODE] Thanks for any help. Sincerely, Pierce F. -- Pierce Freeman [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Checking One Array Against Another
Hi everyone. I am attempting to check one array's contents against another's, but so far it hasn't been working. In the actual application, I am checking the current open applications against an okay application list, and just thought of another problem: If the user doesn't have an application open that is on the list, it will think the reverse. Some example code (with different variables) is below: [CODE] for (int arraySort = 0; arraySort [arrayInfo count]; arraySort++) { for (int arrayNewSort = 0; arrayNewSort [arrayNewInfo count]; arrayNewSort++) { if ([ arrayInfo objectAtIndex:arraySort] == [arrayNewInfo objectAtIndex:arrayNewSort]) { some++; } } } If (some == [arrayNewInfo count] { NSLog(@The user has only the okay applications open); } [END CODE] Thanks for any help. Sincerely, Pierce F. -- Pierce Freeman [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]