Re: NSDrawer
Hi, One potential problem I see with drawers is - if the window was in full screen mode, nothing appears to happen unless they know to get out of full screen (which isn’t a good experience). Instead, I would say that Mac apps nowadays tend to have the ability to toggle showing a sidebar-like inspector within the existing window, rather than a drawer extending out of the window. Because the contents of the existing window is modified, this solves the full screen problem. Apps like Xcode, and in the current iWork suite do this. When doing this though, there is one case I can think of that you would need to handle - if the window is at its minimum size, the window would have no choice but to expand itself. I think this is something NSSplitViewController can help with though. Hope that helps, - Phil > On 15 Jul 2018, at 05:00, cocoa-dev-requ...@lists.apple.com wrote: > > Send Cocoa-dev mailing list submissions to > cocoa-dev@lists.apple.com > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.apple.com/mailman/listinfo/cocoa-dev > or, via email, send a message with subject or body 'help' to > cocoa-dev-requ...@lists.apple.com > > You can reach the person managing the list at > cocoa-dev-ow...@lists.apple.com > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Cocoa-dev digest..." > Today's Topics: > > 1. Re: NSDrawer (Uli Kusterer) > 2. Re: NSDrawer (Casey McDermott) > > >> On 3. Jul 2018, at 04:08, Casey McDermott = > wrote: >> =20 >> NSDrawer is deprecated, but it's also perfect for our application. >> We still haven't found a good substitute. >> =20 >> Our app has an outline view that loads various types of business = > records >> into a tab view. Some of them have optional extra info. When it's = > small a panel is fine, >> but some records have large tables: about the same size as the main = > record. =20 >> A drawer is perfect for viewing them side-by-side with the main info. =20= > >> In a panel it obscure the main record, and users need to see both. >> =20 >> Is there a work-around for an attached window that pops out on the = > side, >> and acts like a drawer? =20 >> =20 >> Any idea when deprecation turns into total non-support? >> =20 >> Thanks, >> =20 >> Casey McDermott >> www.TurtleSoft.com >> ___ >> =20 >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> =20 >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> =20 >> Help/Unsubscribe/Update your Subscription: >> = > https://lists.apple.com/mailman/options/cocoa-dev/witness.of.teachtext%40g= > mx.net >> =20 >> This email sent to witness.of.teacht...@gmx.net > > Cheers, > -- Uli Kusterer > "The Witnesses of TeachText are everywhere..." > http://www.zathras.de > > > > > > > NSPanel is still modal, but longer lasting. We use it a lot, and it > looks better than the modal dialogs in the current app. > > NSDrawer is a non-modal extension to the main window, designed to stick > around for a while. > > In our case, we have business data entry forms, and then sometimes people > add an optional table of details. Sometimes they'll spend hours on the table > (e.g. for > a construction estimate with hundreds of line items). > > They still need to see/edit the main form at the same time, so NSPanel won't > work, > and NSDrawer is just right. If it's ever removed entirely, we'll pretty much > have > to duplicate it in code. > > The current app switches between multiple layouts with and without the table, > but the new look is cleaner, and better suited for a single window with > outline & tabs. > > Thanks, > > Casey McDermott > http://www.turtlesoft.com > > > On Fri, 7/13/18, Uli Kusterer wrote: > > Subject: Re: NSDrawer > To: "Casey McDermott" > Cc: cocoa-dev@lists.apple.com > Date: Friday, July 13, 2018, 9:13 PM > > Just for completeness' sake: > You're aware of NSPopover? > > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins (at) lists.apple.com > > https://lists.apple.com/mailman/listinfo/cocoa-dev ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Very basic need, very difficult to achieve.
> On 4 May 2016, at 09:18, Graham Coxwrote: > > I could not download 10.9 as the button was greyed out with “downloaded” on > it. Yeah, about that. Whenever you download from the App Store, save a copy of the installer BEFORE you run it. Copy it off onto some removable media device. If you ever want to re-download the same installer, make sure that removable device is disconnected. App Store searches for the installer (starting in /Applications but going through every mounted device) to see if the installer is already present. If it is, you get the greyed-out button. ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Customising the IKImageBrowserView bezel mode disclosure button
So I'm using an IKImageBrowserView with IKGroupBezelStyle, and it's working well. My problem is that I want to move and/or customise the appearance of the small rectangular black button which opens and closes the group. It's drawn over the top of the first image - I want to move it so it doesn't obscure the image. Notably, IKImageBrowserGroupTitleKey, despite being documented as This string is used for the disclosure style only is used as the label on this button. All advice welcome. Thanks Phil ___ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Core Audio Help
I have been reading the Core Audio documentation at the Apple Developer site and I am not sure I know any more today then when I started. Are there any Core Audio programmers on this list or is there a better spot. Basically, I am planning to experiment with various DSP filters on an input audio signal. So, take in the audio analog signal which then goes through ADC via the hardware then I want the stream of numbers. Of course, there are a lot of details on the way. What I need is help in pointing me in the right direction. That is, what are the important parts of Core Audio where I need to focus my attention. Thanks, phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Audio Help
Yes, I know of that promised book. It seems to have been in the works for a long time. I just checked Amazon and it says April 2012. Well, I think I have seen such a release date before but it was probably a year or two ago. On Dec 23, 2011, at 9:25 AM, Ravi Singh wrote: I have been eagerly waiting for Chris Adamson(sp) book or Core Audio, and my Amazon order I think is around 2 years old now. I would look for his site and talks at iDev360 and VTM because he is the best resource I found for interesting stuff. On Dec 23, 2011, at 11:14 AM, Phil Hystad wrote: I have been reading the Core Audio documentation at the Apple Developer site and I am not sure I know any more today then when I started. Are there any Core Audio programmers on this list or is there a better spot. Basically, I am planning to experiment with various DSP filters on an input audio signal. So, take in the audio analog signal which then goes through ADC via the hardware then I want the stream of numbers. Of course, there are a lot of details on the way. What I need is help in pointing me in the right direction. That is, what are the important parts of Core Audio where I need to focus my attention. Thanks, phil ___ 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/ravisingh7%40me.com This email sent to ravisin...@me.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Audio Help
You know -- I looked for Core Audio before in the Apple lists but did not see it. I only saw that other list that begins with c. But, I did find it this time -- more careful reading on my part -- and joined up and posted my message. On Dec 23, 2011, at 9:39 AM, Steve Bird wrote: On Dec 23, 2011, at 12:14 PM, Phil Hystad wrote: I have been reading the Core Audio documentation at the Apple Developer site and I am not sure I know any more today then when I started. Are there any Core Audio programmers on this list or is there a better spot. I know there is a Core Audio list. I was going to suggest searching at Lists.apple.com. But that web page is hosed. It tells me: An error occured! Inverted word index not found. Probably you forgot to run 'indexer -Eblob'. I didn't know I was supposed to run an indexer on the Eblob. Click on the LISTS link and you get page not found ANYWAY, there is a CoreAudio list, but if we tell you where to subscribe, we'll have to kill you. Steve Bird Culverson Software - Elegant software that is a pleasure to use. www.Culverson.com (toll free) 1-877-676-8175 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Audio Help
Thanks. On Dec 23, 2011, at 10:02 AM, Antonio Nunes wrote: On 23 Dec 2011, at 18:44, Phil Hystad wrote: Yes, I know of that promised book. It seems to have been in the works for a long time. I just checked Amazon and it says April 2012. Well, I think I have seen such a release date before but it was probably a year or two ago. Go to Safari books online. You should be able to get access to the book now through the Rough Cuts option. http://my.safaribooksonline.com/9780321636973 -António Energy is like a muscle, it grows stronger through being used. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Audio Help
So, what web U/I are you talking about that has been down for a month? I was able to go to lists.apple.com earlier today and join the core audio api list. Got my confirmation e-mail and everything. Plus, even received a couple of messages posted to core audio from others. phil On Dec 23, 2011, at 8:14 PM, Jens Alfke wrote: On Dec 23, 2011, at 9:14 AM, Phil Hystad wrote: I have been reading the Core Audio documentation at the Apple Developer site and I am not sure I know any more today then when I started. Are there any Core Audio programmers on this list or is there a better spot. coreaudio...@lists.apple.com … but I think you need the web UI to subscribe to it, and apparently that’s still down (for like, a month now? What’s up with that?) Anyway, I feel your pain. CoreAudio is possibly the gnarliest Mac API in existence*. It’s a toss-up between it and the Security APIs — CoreAudio makes you deal with threading, but Security has even worse docs and less sample code. :-P Have you looked at AVFoundation? I believe it’s available on 10.7 now. It appears to be the high-level OOP audio API I would have turned tricks for in 2007. —Jens * Among deceased APIs, of course, QuickTime is the worst. OMG THE HORROR ___ 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
iPad store ?
This may be off-topic but I am not sure of the right forum. Is there any way to deploy an iPad app other then the AppStore? I don't mean for development testing or other temporary purposes. Situation is the development of an application for a particular customer who would use the app for specific in-house purposes. The app would not be generally available, at least that is the intent. Thanks for any comments or directions to a more suitable list. Phil Sent from my iPad ___ 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: iPad store ?
Thanks. I will look at that. PEH's iPhone On Sep 12, 2011, at 10:17 AM, Hunter Hillegas li...@lastonepicked.com wrote: There's an Enterprise program meant for internal deployments. http://developer.apple.com/programs/ios/enterprise/ On Sep 12, 2011, at 10:04 AM, Phil Hystad wrote: Is there any way to deploy an iPad app other then the AppStore? I don't mean for development testing or other temporary purposes. Situation is the development of an application for a particular customer who would use the app for specific in-house purposes. The app would not be generally available, at least that is the intent. ___ 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
Initial project shell and handling of window pointer
I am not sure if this is a question for Cocoa-dev or for Xcode. I just started playing around with iOS 4 and Xcode 4. Learning the ropes of the new Xcode I see a difference in how the project templates are used to create a simple Cocoa window app in iOS versus Mac OS X. With iOS, the app delegate handler code .h file does not declare the window pointer variable which I see is prefixed with an underscore as in _window. With Mac OS X, the app delegate handler .ht file does indeed create an instance variable for window and it does not have the prepended underscore. Can someone describe why this was done (differently) if there is a purpose to this? Where is the _window instance variable created? Thanks, phil___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: sending a message from an initializer method
You can do the following, in your implementation file create a local procedure and then call it from your init method. I did not bother copying your arguments but you define them in the regular way. -(void)myCalculation { // do the calculation } - (id) init { if ( self = [super init] ) { // do your init var3 = [self myCalculation]; } return self; } On Jan 12, 2011, at 3:41 AM, Luc Van Bogaert wrote: Hi, I have a question about how to design a initializer mehod. I have defined a class with three instance variables. Two of them are arrays and their value can be initialized straightforward in the initializer method, but the value of the third instance variable is the result of a complex algorithm, based on the contents of the two arrays. I would like to implement that algorithm in a seperate method, instead of writing it directly in the initializer. Is that OK, and could I then message self in the initializer like: - (id) init { self = [super init]; if (self) { var1 = ...; var2 = ...; var3 = [self computerVar3With:var1:var2]; } return self; } Or is it better to write the algorithm directly as part of the initializer? Thanks, -- Luc Van Bogaert luc.van.boga...@me.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/phystad%40mac.com This email sent to phys...@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
Initializing a view controller...
Is there a proper way to initialize a view controller. So far, I have been doing this in the application delegate by calling calling an initialize method ( i.e. [viewController initialize]) in application:didFinishLaunchingWithOptions: method (prior to the view being added to the window and the window made visible). However, I am not sure if this is the Cocoa canonical way of doing things. By the way, this example comes from UIKit but the same question would apply to any OS X Cocoa application too. phil phys...@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: Initializing a view controller...
Andreas: Thanks for the information. Now, I should kick myself for picking the name initialize but then maybe I should complain about Apple picking all the best names for methods. I think I have used the -viewDidLoad method before. phil On Jan 10, 2011, at 9:58 AM, Andreas Grosam wrote: On Jan 10, 2011, at 4:17 PM, Phil Hystad wrote: Is there a proper way to initialize a view controller. So far, I have been doing this in the application delegate by calling calling an initialize method ( i.e. [viewController initialize]) in application:didFinishLaunchingWithOptions: method (prior to the view being added to the window and the window made visible). *** Important *** +(void)initialize is a class method which the runtime sends to the class exactly once just before any of this class' method is invoked, and any of its super class if +initialized has not yet been invoked. You rarely need to override +initialize -- and you never call it yourself! But yes, there is a proper way to do initialization of a view controller object :) There are lots of examples of how you should do this within the iOS or Mac OS X documentation. Basically, when you load your view from a nib you will override these methods in order to initialize a view controller: -viewDidLoad This method is called regardless of whether the views were stored in a nib file or created programmatically. You usually override it to do additional setup after the view has been loaded from a nib. If you override -viewDidLoad you may want to override -viewDidUnload accordingly, which is the counterpart of -viewDidLoad. -awakeFormNib To do additional setup after the view has been loaded from a nib. You often can do all your setup in viewDidLoad, but sometimes this seems a better place. At the time the method is invoked, outlet and action connections are already established. In the cases where you want to create the controller's view yourself programmatically, you have to use -loadView. If you do so, you need to create the view hierarchy and assign the root view to the view property of the controller. You must not call any of these methods yourself! The framework will do this for you when it is appropriate. An example might be useful: The following code assumes you have a nib where you load the view: @interface MyViewController : UIViewController { IBOutlet UIView* mySpecialSubView; NSArray* myArray; } @property (retain) UIView* mySpecialSubView; @property (retain) NSArray* myArray; @end @implementation @synthesize mySpecialSubView; @synthesize myArray; - (void) viewDidLoad { [super viewDidLoad]; // always invoke super! // In debug mode, you might check here whether you have established the links for your outlets in IB: NSAssert(mySpecialSubView, @IBOutlet 'mySpecialSubView' is nil); // forgot to setup the link in IB? // configure my view unless this is already done in IB: self.view.backgroundColor = [UIColor blackColor]; // do other setup, for instance setting up a navigation bar, navigation item ... // if your view controller needs to initialize other ivars, you might initialize them here, // or do lazy initialization (see below) ... // Note, that viewDidLoad will be called *everytime* the view gets reloaded from // the resource! // Sometimes, you explicitly DON'T want to perform certain initialization steps again // after the view will be reloaded. In this case, use a flag as an ivar which determines // whether you have done these initialization steps: if (!isInitialized) { [self setupOnce]; isInitialized = YES; // this is an ivar } } You have to override -viewDidUnload in certain cases, e.g.: - (void) viewDidUnload { self.mySpecialSubView = nil;// Outlets shall be set to nil! // optionally, you might want to release myArray - just in order to safe memory. But // this depends on your needs, and often you explicitly don't want the array to be // recreated after a reload of the view. self.myArray = nil; // optionally } // lazy initialization - this overrides the getter method which was otherwise defined // by the @synthesize directive: - (NSArray*) myArray { if (myArray == nil) { myArray = [NSArray alloc] init... ]; } return myArray; } // don't forget to release ivars if required: -(void) dealloc { [mySpecialSubView release], mySpecialSubView = nil; [myArray release], myArray = nil; [super dealloc]; // always invoke super (at the last statement) } One thing you should care of: -viewDidLoad and -awakeFormNib, as well as -loadView may be called more than once for the lifetime of the view controller. So, be carefully not to initialize ivars in such a way that you get a memory
Re: Initializing a view controller...
Fritz... Thanks for the pointers to the documentation. I was going to get to reading it if I struck out here. I am really not lazy, just old. phil On Jan 10, 2011, at 8:42 AM, Fritz Anderson wrote: On 10 Jan 2011, at 9:17 AM, Phil Hystad wrote: Is there a proper way to initialize a view controller. So far, I have been doing this in the application delegate by calling calling an initialize method ( i.e. [viewController initialize]) in application:didFinishLaunchingWithOptions: method (prior to the view being added to the window and the window made visible). I first wrote a brief essay on what to do, where, depending on whether you instantiate programmatically or in a NIB. But why not refer you to a better explanation than I can piece together in five minutes? View Controller Programming Guide for iOS. http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html Particularly: Understanding the View Management Cycle http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/BasicViewControllers/BasicViewControllers.html%23//apple_ref/doc/uid/TP40007457-CH101-SW19 — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Missing Cocoa/Cocoa.h ??
I just started playing around with Xcode and Cocoa again and doing a few little iPad apps. When I add a class to the project, (simple NSObject based class) the .h file includes the import for Cocoa/Cocoa.h. But, the build and compile fails because it says this header file is not found. This happens even if I do absolutely nothing to the class files other then use the regular File create class option. This can be repeated easily by merely creating an iPad view application shell. If you do an immediate build it works. If you were to create a new class as I described (and not modify the generated .h,.m files) the build fails with the Cocoa.h file not being found. Obviously something is askew in what I am doing. phil phys...@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: Missing Cocoa/Cocoa.h ??
I just did it again. I create a new project, iOS View Application for iPad. Do an immediate build and it works and runs fine (with blank view of course). The, I add a class, which I called MyModel just for the heck of it. It is based on NSObject and it imports Cocoa.h as generated by the template. Now, when I build, it gets an error because Cocoa.h is not found. There must be some problem with my template. I am up to date on Xcode and the SDKs and I think I refreshed the iOS SDKs just the other day. So, either I have something screwed up in my templates (which I have never mucked with) or there is a bug in the template as it came from Apple. phil phys...@mac.com On Jan 3, 2011, at 8:11 PM, Roland King wrote: ipad? That's iOS and those templated files should include Foundation/Foundation.h not Cocoa/Cocoa.h, did you pick the wrong file type from the template. On 04-Jan-2011, at 1:47 AM, Phil Hystad wrote: I just started playing around with Xcode and Cocoa again and doing a few little iPad apps. When I add a class to the project, (simple NSObject based class) the .h file includes the import for Cocoa/Cocoa.h. But, the build and compile fails because it says this header file is not found. This happens even if I do absolutely nothing to the class files other then use the regular File create class option. This can be repeated easily by merely creating an iPad view application shell. If you do an immediate build it works. If you were to create a new class as I described (and not modify the generated .h,.m files) the build fails with the Cocoa.h file not being found. Obviously something is askew in what I am doing. phil phys...@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/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: Missing Cocoa/Cocoa.h ??
Roland, Yes, I just discovered that I was creating the object template from the Mac OS X section even though I created the project from iOS. Now, I have no idea how that template section got referenced but it seems to be that the template selection should be automatically switched to iOS if you create the project from iOS. I will have to watch that in the future. phil On Jan 3, 2011, at 8:23 PM, Roland King wrote: Which template are you using to add the object ... There's two sets, the ones at the top of the list are for iOS, the ones at the bottom are for OS X, you want to add an object from the top set. On 04-Jan-2011, at 12:20 PM, Phil Hystad wrote: I just did it again. I create a new project, iOS View Application for iPad. Do an immediate build and it works and runs fine (with blank view of course). The, I add a class, which I called MyModel just for the heck of it. It is based on NSObject and it imports Cocoa.h as generated by the template. Now, when I build, it gets an error because Cocoa.h is not found. There must be some problem with my template. I am up to date on Xcode and the SDKs and I think I refreshed the iOS SDKs just the other day. So, either I have something screwed up in my templates (which I have never mucked with) or there is a bug in the template as it came from Apple. phil phys...@mac.com On Jan 3, 2011, at 8:11 PM, Roland King wrote: ipad? That's iOS and those templated files should include Foundation/Foundation.h not Cocoa/Cocoa.h, did you pick the wrong file type from the template. On 04-Jan-2011, at 1:47 AM, Phil Hystad wrote: I just started playing around with Xcode and Cocoa again and doing a few little iPad apps. When I add a class to the project, (simple NSObject based class) the .h file includes the import for Cocoa/Cocoa.h. But, the build and compile fails because it says this header file is not found. This happens even if I do absolutely nothing to the class files other then use the regular File create class option. This can be repeated easily by merely creating an iPad view application shell. If you do an immediate build it works. If you were to create a new class as I described (and not modify the generated .h,.m files) the build fails with the Cocoa.h file not being found. Obviously something is askew in what I am doing. phil phys...@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/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
Threading and Event Queue Question
I am not an experienced programmer in Cocoa -- I have only dabbled. But, I have a question with regard to how event queue (terminology may not be correct) is done differently then a windows platform. As an example, I noticed that each separate Tab of a Chrome browser instance is itself a separate process. Yet, each separate tab of Safari seems to be folded into the single Safari process. I have also noted that tabs in Safari are totally independent of each other such that I can be playing music from Pandora on one tab and watching a Netflix movie in another tab of the same Safari instance. From my knowledge of the MS Windows platform (WPF for example), this cannot be done. That is, a process has a single event queue from which events are dispatched (control events like mouse, timer, and so on). Yet, on Apple Cocoa it seems that you can have multiple event queues within a single process. Is this true or am I barking up a wrong tree? Thanks for your comments phil ___ 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: Threading and Event Queue Question
You asked Why does this matter? What are you trying to accomplish? The matter part is that I am just curious and I am not trying to accomplish or do anything. The question came up when I noticed the different behavior of tabbed windows on browser differences and I asked a question of a guy at work whose answer led me to think that maybe Windows and Cocoa managed their run loops differently. That is why I asked the question. thanks for the comments. On Aug 3, 2010, at 1:59 PM, Nick Zitzmann wrote: On Aug 3, 2010, at 2:40 PM, Phil Hystad wrote: I am not an experienced programmer in Cocoa -- I have only dabbled. But, I have a question with regard to how event queue (terminology may not be correct) is done differently then a windows platform. I think you meant run loop here. As an example, I noticed that each separate Tab of a Chrome browser instance is itself a separate process. Yet, each separate tab of Safari seems to be folded into the single Safari process. I have also noted that tabs in Safari are totally independent of each other such that I can be playing music from Pandora on one tab and watching a Netflix movie in another tab of the same Safari instance. And they're all using the same run loop, with the following exceptions: 1. CoreAudio will take audio queues from any thread, but only plays them in a background thread. 2. If Safari is running as a 64-bit app, then it runs 32-bit NSAPI plugins in a background task. That's how it continues to support 32-bit plugins such as Flash and Silverlight within a 64-bit task. From my knowledge of the MS Windows platform (WPF for example), this cannot be done. That is, a process has a single event queue from which events are dispatched (control events like mouse, timer, and so on). Yet, on Apple Cocoa it seems that you can have multiple event queues within a single process. Yes and no. There can be multiple run loops, but there can be only one run loop per thread. Although background threads can have run loops, IIRC they can't listen for GUI events, so they can only really used for timers, etc. But in practice, run loops in threads other than the main thread are quite rare. Is this true or am I barking up a wrong tree? Why does this matter? What are you trying to accomplish? 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: Memory management on returning nil in init
Does this mean we don't get to find out what the ok variable is all about? If the ok variable has meaning then the code would be much better written as something like: -(id) initWithBool:(BOOL)ok { if ( !ok ) return nil; ...rest of code... } On Jun 21, 2010, at 7:55 AM, Eiko Bleicher wrote: Thank you all, this gives me confidence in my code. I was just hesistant because I didn't call alloc in the initializer - but that's probably one of the reasons why you always use alloc/init together when calling. :-) Thanks to everyone who responded. Eiko Am 21.06.2010 um 16:51 schrieb Markus Hanauska: On Monday, 2010-06-21, at 16:43, Eiko Bleicher wrote: -(id) initWithBool:(BOOL)ok { if (self = [super init]) { if (!ok) { return nil; // Point of interest } } return self; } Does this code leak? According to my understanding of Cocoa, it does leak. You should call [self release], as otherwise the just created object (the object has already been created by [CLASS alloc] when init is being called) is never released otherwise. Further no other object that [super init] might create is released. My inits usually look like this: - (id)initWithBool:(BOOL)ok { self = [super init]; if (self) { if (!ok) { [self release]; self = nil; } } return self; } -- Markus Hanauska ___ 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/phystad%40mac.com This email sent to phys...@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: Memory management on returning nil in init
I do not understand your argument -- apparently the ok variable is input to this initWithBool method and this method DOES NOT alter the ok variable in any way. Therefore, when you test the ok variable, you are testing a condition that is totally independent of anything that initWithBool might do. But, you seem to be using it as a condition test that might be confused with the result of the [super init] message. Thus, either this is a bug in your code in how the ok variable is being used or you are doing something else that defies understanding from the code fragment we have before us -- thus, my original question. My question was not about how Obj-c works with memory management and when to properly do a release, that was another subject that was correctly answered by several others. On Jun 21, 2010, at 9:08 AM, Eiko Bleicher wrote: That would leak. Shouldn't this instance be released? Alloc already did its job if we get into init. On the other hand, we shouldn't call release, because super wasn't initialized. So as of my (maybe limited) understanding by now, doing the code after [super init] is the way to go. Am 21.06.2010 um 18:00 schrieb Phil Hystad: Does this mean we don't get to find out what the ok variable is all about? If the ok variable has meaning then the code would be much better written as something like: -(id) initWithBool:(BOOL)ok { if ( !ok ) return nil; ...rest of code... } On Jun 21, 2010, at 7:55 AM, Eiko Bleicher wrote: Thank you all, this gives me confidence in my code. I was just hesistant because I didn't call alloc in the initializer - but that's probably one of the reasons why you always use alloc/init together when calling. :-) Thanks to everyone who responded. Eiko Am 21.06.2010 um 16:51 schrieb Markus Hanauska: On Monday, 2010-06-21, at 16:43, Eiko Bleicher wrote: -(id) initWithBool:(BOOL)ok { if (self = [super init]) { if (!ok) { return nil; // Point of interest } } return self; } Does this code leak? According to my understanding of Cocoa, it does leak. You should call [self release], as otherwise the just created object (the object has already been created by [CLASS alloc] when init is being called) is never released otherwise. Further no other object that [super init] might create is released. My inits usually look like this: - (id)initWithBool:(BOOL)ok { self = [super init]; if (self) { if (!ok) { [self release]; self = nil; } } return self; } -- Markus Hanauska ___ 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/phystad%40mac.com This email sent to phys...@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: iPhone/iPad: Desktop wallpaper can't be set.
I hope this feature is not supported. The last thing I want is some application changing my desktop background which is my choice, not one of the application. Yes, I know this can be done with some kind of dialog for approval but then that really stresses the logic of why you would want to do this -- OS X already provides a way for me to set my background, I don't need to buy or use an app to do that. I vote no -- don't do it. phil On May 19, 2010, at 9:08 AM, David Duncan wrote: On May 19, 2010, at 7:55 AM, sebi wrote: A customer wants an app that changes the desktop background image. I told him that is not possible (and probably won't be in the near future) because that would mean to play outside the sandbox. Is this correct? Correct, this is not possible in the current API. I would recommend filing a bug report asking for this capability. -- David Duncan Apple DTS Animation and Printing ___ 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/phystad%40mac.com This email sent to phys...@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
NSString and Regular Expressions
I was sort of suspecting that regular expression matches would be supported by NSString yet I find no message interface for supporting regular expressions. So, is the only capability for handling regular expressions in Objective-C the Posix Regex library? phil phys...@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
File system file renaming question...
This question is not specifically about Cocoa programming but I hope that some Mac OS X experts out there can give me an answer. I sent an attached photo to my daughter so that she could print it out using Costco print services. I sent it at high resolution, the photo image was 1.6 MB. It seems that Mac mail changed the resolution to a more web friendly size of about 64 K with much reduced resolution. So, I thought that a way to get around this was to change the file type (extension) of the image file to something other then .jpg such as .dat (and, I tried .zz, .q, and null). However, the file was still recognized and interpreted as a jpeg file and treated in the same manner by mail (and, also by the finder that displayed the image). So, it looks like Mac OS X is interpreting the file based on contents and not based on file extension. This seems to be a very wrong thing to do in my opinion. Does anyone know of a way to turn this off or is this considered a feature for some ease-of-use aspect of OS X?___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] Why so many calls?
I did this just for grins to see what I came up with. Boy was I surprised! Here's a listing of the calls made loading a table with 2 sections where the first section has 1 row and the second has 2 rows. Each section has a header title and a footer title. NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: initWithStyle: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: viewDidLoad NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: viewWillAppear: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: numberOfSectionsInTableView: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: viewDidAppear: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: numberOfSectionsInTableView: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForHeaderInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForHeaderInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForFooterInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForFooterInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:numberOfRowsInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForHeaderInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForHeaderInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForFooterInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForFooterInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:numberOfRowsInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForHeaderInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:cellForRowAtIndexPath: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:cellForRowAtIndexPath: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:cellForRowAtIndexPath: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForHeaderInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForFooterInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForHeaderInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForFooterInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForHeaderInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForFooterInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForHeaderInSection: NavBasedTestBed37232:20b Object: RootViewController: 0x3d1d3a0 Received: tableView:titleForFooterInSection: To summarize, there are: 9 tableView:titleForHeaderInSection: 8 tableView:titleForFooterInSection: 2 numberOfSectionsInTableView: 2 tableView:numberOfRowsInSection: -// I hope we all agree 3 tableView:cellForRowAtIndexPath: --// these make sense But can anyone explain all the other duplicate calls? Waiting with baited breath. -Phil ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Why so many calls?
But can anyone explain all the other duplicate calls? Why does it matter? If you have eight or nine sections it makes perfect sense. Or you could have one section and it needs to draw multiple times, and whoever designed the API didn't want to go through the expense of a KVO observation, instead asking the delegate for the header/footer each time it needed it. But none of that matters. Kyle- But, as I thought I explained in the original post, the table only has 2 sections, 1 with 2 rows and 1 with 1 row. The table is only being loaded once. So why does it take: 9 tableView:titleForHeaderInSection: calls for 2 sections 8 tableView:titleForFooterInSection: calls for 2 sections 2 numberOfSectionsInTableView: calls for a single load In a table of this size, you're right - Why does it matter. But what if my real table has 99 sections? Why should I get bogged down with 800-900 calls for section header titles and section footer titles. Seems like an incredible waste of effort. Just curious if anyone knows why this happens. If you don't know why, just say so. I happen to live in a world of disturbing images. What can I say? -Phil ___ 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: what is this currency symbol?
On Jul 21, 2009, at 11:53 AM, Andy Lee wrote: ¤ …is the all-purpose currency sign in unicode. Its use is to denote that the attached number is a currency value when the appropriate symbol for the locale isn't available. -- Phil Dokas -//- p...@jetless.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
Interface Builder Questions...
I am new to Interface Builder and I am still trying to figure out some subtle details of how things work. And, my frustration level is growing because although I have access to a very rich set of documentation, a number of questions I have pondered are not answered. Some of these may be rather silly but remember I am very new to Cocoa and Interface Builder. (1) The default Cocoa Application created by Xcode creates a simple application with a single window and a default menu (among other things I presume). This window has a content view which I am assuming is an instance of NSView but I actually can't find out if that is true. Therefore, are there any inspectors that tell me the actual class used for a particular view. The class identity part of the Inspector for the content view suggests has a drop down that allows me to choose various classes but there must be a specific class that is used already. How do I find this? (2) I am trying to understand how the window sizing features of the view inspector relate to the window itself. As best as I can tell, none of the actual window sizing features for the content view are usable as they do not really seem to do anything. Is this true? Is it possibly the case that the content view, being bound to the window frame, is sized automatically based on the window size? (3) Again, on the window sizing inspector, if I resize the window using the resize thingy in the lower right hand corner, I can see the updated pixel size in the inspector, but only after I stop resizing. If I want to resize to a particular dimension, say 300 x 225 (or, whatever), it is a try this, check, try that check, and so on. Is there a way to enable the size values of height and width to resize dynamically as I change the window size? I have looked all over the documentation and tried a lot of things but nothing seems to make the behavior different. (4) And, finally, on the window sizing inspector, in the part called autosizing when I click on the content view (remember, it is empty, just as created by Xcode), there is an animated image that expands and contracts in size and I have absolutely no idea why it is animated or what it means. Any help? Thanks, InterfaceBuilder newbie phil ___ 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: Interface Builder Questions...
(3) Again, on the window sizing inspector, if I resize the window using the resize thingy in the lower right hand corner, I can see the updated pixel size in the inspector, but only after I stop resizing. If I want to resize to a particular dimension, say 300 x 225 (or, whatever), it is a try this, check, try that check, and so on. Is there a way to enable the size values of height and width to resize dynamically as I change the window size? I have looked all over the documentation and tried a lot of things but nothing seems to make the behavior different. Don't think so. File a radar: http://bugreport.apple.com You can also enter the values directly in the text fields. Good suggestion. Note though, that if you already know the dimension you want to use, it's probably easier to set it using the numeric input fields in the inspector directly. Also note that if you hold down the Command key while resizing in IB it will resize smoothly, and not snap to guides. This often makes pixel resizing / alignment a lot easier. So, are you telling me that everyone else can see dynamic changes to these height and width pixel values but I can't? I would submit that it is a little early to submit a bug report -- certainly there must be something I am not doing right. Yes, I know that I can enter them in manually but I am more interested in trying to figure out if anything is broken with my IB or not. Maybe I am seeing normal behavior. But, if this is normal, it sure seems to be very awkward which does not seem like IB or Xcode. phil ___ 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
Opinion on managed memory and garbage collection
Being relatively new to Cocoa and Objective-C, what is the consensus on using the new version 2.0 managed memory features (garbage collection). If you were writing a new Cocoa application from scratch, would garbage collection be the preferred method over the reference counting (retain/release) method. Having spent years in Java I would prefer a GC'd approach but I have also seen the great improvement of GC in Java over the years. Therefore, I am also curious on how the new Objective- C design for GC compares. The applications I have in mind are mostly graphic (Quartz 2D) oriented and likely also some OpenGL work. Thanks for your opinions and comments. phil ___ 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 table rows from XML
Hello all, I'm writing my first iPhone application and I've run into a problem I can't seem to get a grasp on. In short I want to parse an XML file and display a UITableView with data from a set of XML elements. I've got all the code written for this but whenever I try to access my array of data inside of - tableView:cellForRowAtIndexPath: I crash without an error message in console. Here are the two relevant classes: @interface PDPagesViewController : UITableViewController { NSData* received_data; NSMutableArray* pages; } - (void)beginParsing; @end @interface PDPage : NSObject { NSNumber* page_id; NSString* title; } @property(nonatomic,retain) NSNumber* page_id; @property(nonatomic,copy) NSString* title; -(id)init; -(id)initWithID:(int)in_id andTitle:(NSString*)in_title; @end I init my PDPagesViewController as follows: - (id)init { if (self = [super init]) { pages = [[NSMutableArray alloc] init]; [self beginParsing]; } return self; } I construct my NSURLRequest and setup my parser inside of beginParsing. Here is the delegate method which then builds my array: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { // Handle page elements if ([elementName isEqualToString:@page]) { NSString *titleAttr = [attributeDict objectForKey:@title]; NSString *idAttr = [attributeDict objectForKey:@id]; if (titleAttr idAttr) { PDPage* newPage = [[PDPage alloc] initWithID:[idAttr intValue] andTitle:titleAttr]; [pages addObject:newPage]; [newPage release]; } return; } } Insofar as I can tell, everything is ok so far. The problem occurs in this table delegate method (again, part of PDPagesViewController), with crashing lines and received output listed in comments: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @Cell; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; } // Set up the cell... NSLog(@Setting up table cell %d, [indexPath row]); // Setting up table cell: 8 NSLog(@retain count: %d, [pages retainCount]); // retain count: 1 NSLog(@array count: %d, [pages count]); // array count: 16 NSLog(@page retain count: %d, [(PDPage*)[pages objectAtIndex: [indexPath row]] retainCount]); // page retain count: 1 NSLog(@title: %@, [(PDPage*)[pages objectAtIndex:[indexPath row]] title]); // This line causes a crash NSLog(@pages array right now: %@, pages); // This line causes a crash cell.text = [[pages objectAtIndex:[indexPath row]] title]; // This line causes a crash return cell; } It seems to me that whenever I try to interact with my NSMutableArray as such in this method it crashes, but when I use only its NSObject methods it's fine. And yet, it and its contents have the right retain count. I feel like I must be missing something basic, so any insight would be much appreciated. Thank you! -- Phil Dokas -//- p...@jetless.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: SSH Tunnel
On Sat, Feb 21, 2009 at 7:23 PM, Seth Willits sli...@araelium.com wrote: Does anyone have any experience with this? Am I barking up the wrong tree trying to use the command line app to do it? Perhaps I should be using a yet-to-be-discovered library instead. There are a number of SSH libraries that may meet your needs, for example: http://0xbadc0de.be/wiki/libssh:libssh http://www.libssh2.org/ Phil ___ 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: best way to do precise timing on iphone?
On Fri, Feb 6, 2009 at 1:06 AM, Memo Akten m...@memo.tv wrote: Hi ALl, i'm aware that on desktop using mach_absolute_time() is the way to go for precise timing of code (http://developer.apple.com/qa/qa2004/qa1398.html) but I was wondering what is the alternative for iphone? not sure if this is the right place to post, but Id gladly repost if someone could point me to the right place. I'm guessing NSDate isn't going to be that accurate for this kind of stuff... You can use mach_absolute_time() on the iPhone. Future questions about iPhone development should be directed to the developer forums though: https://devforums.apple.com/ Phil ___ 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: NSWindow With Only Close Button?
On Mon, Jan 12, 2009 at 1:18 PM, Chunk 1978 chunk1...@gmail.com wrote: i noticed the window of the OS Install Assistant of Parallels 4.0 only has a close button in the top left corner of the window. i didn't know this was possible. how is this accomplished? With the exception of Panels, this is discouraged by the Apple HIG (Title Bar Buttons subsection): http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/chapter_18_section_4.html Phil ___ 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
NSLog ??
Why can't I find any reference page for NSLog? I believe I have searched all over all documentation that I have and the closest match is NSLogicalTest. I even tried a search using Spotlight on my entire system. I was able to find a usage of NSLog in a program but no documentation hits. Help needed for snowed in beginning Cocoa programmer. -phil- ___ 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
The Ages Old __MyCompanyName__ Question
OK, I am fairly new to Xcode and Cocoa programming and I want to change the __MyCompanyName__ template macro definition. So, I google this question, find answers, and try it out. It did not work. So, is there something different in today's Xcode that means the procedure for changing __MyCompanyName__ is different. I think the most recent entry I found (with a date) was 2005 or so. The procedure I tried was to set ORGANIZATIONNAME in the PBXCustomTemplateMacroDefinitions key of the Xcode plist. First, I could not find it by looking at the plist. So, I tried the defaults command from the shell and this seemed to work but no change in behavior on Xcode in spite of cycling Xcode and trying a number of other things. So, How do you change __MyCompanyName__? Thanks, phil phys...@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: How to get a list of all known file types?
On Fri, Nov 7, 2008 at 2:12 PM, Chris Idou [EMAIL PROTECTED] wrote: I've got an app which is matching on file types, so I want the user to be able to say show me all the... say... MS-Word documents, or JPeg images or whatever. So I need to present the user with all the possible types their system knows about, so they can select what files they are interested in. IIRC, this question has come up before and there doesn't appear to be a way to get a list of all known UTIs from Launch Services. The 10.4 version of Finder appeared to have some private way of getting this list, however, the list was mostly useless for browsing through due to the inordinate number of UTIs that applications/bundles had declared. Phil ___ 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: Porting from Windows to Mac
On Sat, Nov 1, 2008 at 11:35 PM, Rakesh Singhal [EMAIL PROTECTED] wrote: Do I need to change the existing code (Windows code) very much. I have not used Qt before this. Does Qt support the MFC? If your code is written for MFC, then any code that depends on it will require re-writing---regardless of the approach you choose. Qt is one of many UI frameworks that allow cross-platform development (personally, I prefer GTK+). However, if your code is already written against the MFC framework, then you will need to re-write your UI code. Coding against a framework like Qt makes maintence of the code easier, but doesn't help you much if you already have a large existing codebase written for another framework. Phil ___ 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: Storing Instances of a structure in a file
On Sun, Sep 21, 2008 at 9:13 PM, Adil Saleem [EMAIL PROTECTED] wrote: Hi, I want to store instances of a structure in a file so that my application can retreive them and read them.(Basically they are different configuration presets for the application) I also want each instance that is stored to be unique. I know this becomes a typical database problem but i don't want to use database. Is there any Cocoa API that can help me with this problem ? I know it can be done in plain C language, but that would be lengthy and error-prone. If there is anything in Cocoa that can help me, it would be great. If you're talking about plain-C structs then you can wrap them up in NSValue or NSData instances, which you can then write out with an NSCoder (or if you have lots of them, put them into an NSArray and do the same). Phil ___ 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: Storing Instances of a structure in a file
On Sun, Sep 21, 2008 at 11:09 PM, Adil Saleem [EMAIL PROTECTED] wrote: And what if the fields in structures are instances of Cocoa classes (like NSNumber etc) ? Do you have to use structs, or can you wrap them up in an Objective-C class that implements NSCoding? Phil ___ 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: Storing Instances of a structure in a file
On Sun, Sep 21, 2008 at 11:21 PM, Adil Saleem [EMAIL PROTECTED] wrote: I will have to use structs. Then you will have to write your own code to handle any fields that are pointers to values/objects that exist elsewhere. Phil ___ 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: structs in Mutable containers
On Tue, Sep 16, 2008 at 9:18 PM, Christian Giordano [EMAIL PROTECTED] wrote: Hi guys, I'm finding myself trying to add to mutable containers like NSMutableDictionary or NSMutableArray instead of NSObjects subclasses, just structs. For instance in a NSMutableDictionary the key was an integer defined with #define. In this case I sort it with: ... forKey:[[NSNumber alloc] initWithInt:BAND_RED]]; Not a really elegant solution but I can understand that those containers require pointers. You should really be using NSValue's for this. Take a read of: http://developer.apple.com/documentation/Cocoa/Conceptual/NumbersandValues/Articles/Values.html Now I need to create a NSMutableArray of CGPoint, how can I make it became a pointer? ... addObject:CGPointMake(x,y)]; See NSValue's +valueWithPoint: Phil ___ 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: structs in Mutable containers
On Tue, Sep 16, 2008 at 10:46 PM, Christian Giordano [EMAIL PROTECTED] wrote: I just realized valueWithPoint is not available on the iPhone SDK It's just a convenience method for something like: [NSValue valueWithBytes:somePoint objCType:@encode(NSPoint)] You can implement this yourself in a category of NSValue. Phil ___ 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: structs in Mutable containers
On Wed, Sep 17, 2008 at 12:41 AM, Phil [EMAIL PROTECTED] wrote: [NSValue valueWithBytes:somePoint objCType:@encode(NSPoint)] Should be: NSPoint somePoint = NSMakePoint(x,y); [NSValue valueWithBytes:somePoint objCType:@encode(NSPoint)]; Phil ___ 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: Best 'native' formats for NSImage and NSSound?
On Tue, Sep 2, 2008 at 5:18 AM, Matt [EMAIL PROTECTED] wrote: In running Shark on my app recently I noticed that by far, my app spent most of its time in: CGSConvertBGR888toRGBA. This has come up on the quartz-dev mailing list: http://lists.apple.com/archives/quartz-dev/2006/Jul/msg00055.html Where there was a suggestion that you can get much better performance through OpenGL with some Apple extensions: http://lists.apple.com/archives/quartz-dev/2006/Jul/msg00060.html Phil ___ 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: How to create a GUID?
On Tue, Sep 9, 2008 at 12:13 AM, Chris Suter [EMAIL PROTECTED] wrote: On Leopard (and possibly earlier–I haven't checked), it appears that the string returned is actually a UUID created with the CFUUID functions concatenated with the process ID and the result of mach_absolute_time() so the result isn't a proper UUID. I'm not sure where the host name is coming from; it's possible that the CFUUID functions incorporate it somehow. The documentation doesn't specify any particular format for the string returned, only the information used to seed it---I wouldn't recommend depending on this method always returning a UUID incase this changes (even though it probably won't). Phil ___ 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: How did I miss this?
On Mon, Sep 8, 2008 at 1:25 PM, John Murphy [EMAIL PROTECTED] wrote: I just released the the view on NSViewController objects can be accessed with dot syntax, i.e., self.view instead of [self view]. Has this always been the case? I don't see any listing of Properties in documentation. I'm hitting myself for not discovering it sooner. This is accidental, from the way the compiler translates self.view into [self view]. Properties are just syntactic sugar. The documentation on the dot syntax explains this: http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_2_section_3.html#//apple_ref/doc/uid/TP30001163-CH11-SW17 The sub-section on Incorrect Use, also explains that you shouldn't use this syntax if it's not on a declared property (and NSViewController doesn't have any). Phil ___ 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: How did I miss this?
On Mon, Sep 8, 2008 at 3:23 PM, mmalc crawford [EMAIL PROTECTED] wrote: On Sep 7, 2008, at 7:01 PM, Phil wrote: The sub-section on Incorrect Use, also explains that you shouldn't use this syntax if it's not on a declared property (and NSViewController doesn't have any). I'm not sure where you got this from? It is certainly not incorrect to use the dot syntax if there is not a declared property. The introduction states: Objective-C provides a dot (.) operator that offers a compact and convenient syntax you can use as an alternative to square bracket notation ([]s) to invoke accessor methods. Hmm, I seem to have interpreted the patterns under incorrect use as being a bit broader than they actually are. Phil ___ 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: string convertion: converting getter name to setter
On Fri, Sep 5, 2008 at 12:40 PM, steph thirion [EMAIL PROTECTED] wrote: from the selector of a given getter function, I need to get the selector of the equivalent setter function. For instance, from color I should get setColor. I assume you want to do more with the selector than just invoke it---otherwise you can just use KVC and save yourself some grief. There are a few cases you may encounter here: 1. There is no setter. 2. There is a setter and the class is KVC compliant for the key. 3. There is a setter and the class isn't KVC compliant for the key, but there is a setter defined as part of a property definition. 4. (3) but without the property definition. char* getterName = sel_getName(getterSelector); Instead of using C strings, you can use NSStrings and NSSelectorFromString() and NSStringFromSelector()---making string manipulation much easier. However, for case (3), you'll need to do some parsing of the property attribute list from property_getAttributes(). What would be the less costly way, performance wise, to convert the C string color to setColor? I have no experience in working with strings in objc, and was hoping someone would point me in the right direction before I start. If you're working in Cocoa (and I assume you are, since this is a cocoa-dev list), this is a good starting point: http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/ Phil ___ 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: string convertion: converting getter name to setter
On Fri, Sep 5, 2008 at 1:27 PM, Andrew Merenbach [EMAIL PROTECTED] wrote: SEL getterSel = @selector(balloonColor); NSString *getterName = NSStringFromSelector(getterSel); NSString *setterName = [@set stringByAppendingString:getterName]; SEL setterSel = NSSelectorFromString(setterName); Selector's are case-sensitive, so you'll have to do... setterName = [@set stringByAppendingString:[getterName capitalizedString]]; Phil ___ 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: string convertion: converting getter name to setter
On Fri, Sep 5, 2008 at 1:53 PM, Steve Weller [EMAIL PROTECTED] wrote: From memory I think that does not work: capitalizedString also decapitalizes all but the first character, so capitalizedString will become setCapitalizedstring instead of setCapitalizedString. Gah, you're right! I guess the only way to do it then is with an NSMutableString: NSMutableString *getterName = [NSStringFromSelector(...) mutableCopy] [getterName replaceCharactersInRange:NSMakeRange(0, 1) withString:[[getterName substringToIndex:1] uppercaseString]]; Maybe it is easier with C strings: const char *getterName = sel_getName(...) char *getterName_m = strdup(getterName); getterName_m[0] = toupper(getterName_m[0]); // and clean up... Phil ___ 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: Accessing SDL Frameworks Bundled with Leopard...
On Fri, Sep 5, 2008 at 4:04 PM, John Joyce [EMAIL PROTECTED] wrote: Does anybody know any official or proper way to link to the SDL framework that is bundled in the root library in Leopard? /Library/Frameworks/SDL.framework is surprisingly, there! Not on my system. /Library/Frameworks is typically for frameworks shared by installed applications on the system, the frameworks that come bundles with the system are in /System/Library/Frameworks. Something else has probably installed SDL.framework. I would suggest getting your own copy of the SDL framework to use. Phil ___ 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: string convertion: converting getter name to setter
On Fri, Sep 5, 2008 at 2:51 PM, steph thirion [EMAIL PROTECTED] wrote: I was trying to go with performSelector, but just a while ago I was stunned to find out there's no way to pass along an argument that is a basic type. Same with NSInvocation, AFAIK you can only pass objects. And I'd rather avoid having NSNumber instances instead of simply int variables just because of that. Using an instance where I simply need an int or a float seems a waste of memory and performance, correct me if I'm wrong. You can use +instanceMethodForSelector: to get a function that you can use to call the method with primitive arguments---see the overview section of the NSObject class reference. Then there's KVC. Which I haven't been able to pull out because of some int / id problems in arithmetics that I couldn't understand yet. But the concept of KVC seems like it could be costly, at least more than pointing directly to the right door, like performSelector or NSInvocation does. However, finding the correct door is probably just as costly (or potentially more than) KVC. I'd suggest avoiding developing your own solution unless you know there's a problem with using what's provided by the framework. If you can tell us a bit more about what you're trying to accomplish, we might be able to suggest some better approaches. Phil ___ 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: Message stack limitations
On Wed, Sep 3, 2008 at 9:23 PM, RGA [EMAIL PROTECTED] wrote: Putting aside for now whether this is the right way to implement, my question is how are messages processed? What is the maximum stack depth for number of recursive messages? How is this affected by the introduction of 64bit frameworks? Is there a way to see the current stack depth auto-magically? What happens in the event of the message handling stack becoming full and is there a way to deal with this event? Some of these questions are answered in QA1419: http://developer.apple.com/qa/qa2005/qa1419.html Although you may think of the stack in terms of stack-frames, what really matters to the operating system is the memory footprint of the stack (since each frame isn't a constant size---it varies depending on the memory requirements of the called method). You can examine the current stack (in terms of frames---more specifically, return addresses) using backtrace(3): http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/backtrace.3.html Generally though, if you're hitting the stack size limit, you're doing something wrong. Phil ___ 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: accessing netinfo db from cocoa?
On Sun, Aug 31, 2008 at 8:57 PM, Kieren Eaton [EMAIL PROTECTED] wrote: I am trying to find a way to access the netinfo DB from cocoa. Specifically the sharing (AFP, SMB, etc). know that server has the command line util 'sharing' for just this purpose. unfortunately this command is not available in the Client version of os x :( You'll probably be able to get the information you want out of the DirectoryService framework: http://developer.apple.com/documentation/Networking/Conceptual/Open_Directory/ Phil ___ 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: Busy doing nothing
On Fri, Aug 29, 2008 at 9:42 PM, Gerriet M. Denkmann [EMAIL PROTECTED] wrote: If I add these magic lines it will use 0.2% of my Cpu just doing nothing: NSMetadataQuery *query = [ [ NSMetadataQuery alloc] init]; [ query startQuery ]; [ query stopQuery ]; NSArray *results = [ query results ]; // _NSMetadataQueryResultArray [ query release ]; From now on until quit I get every 100 msec one Context Switch and two Mach System Calls - as observed via Activity Monitor. It's noted in the documentation that using -results is not recommended due to performance and memory issues. My guess is that Spotlight might be keeping something alive for it; you might want to post this on the Spotlight-dev list, that's where the people who know about Spotlight behind-the-scenes tend to hang out. Phil ___ 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]
Quitting all active applications
Is there a simple way to quit all running applications? Basically I want to achieve the same result as the first stage of hitting 'shut down' (closing all applications) without actually shutting down the system. 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 [EMAIL PROTECTED]
Re: Quitting all active applications
On Thu, Aug 28, 2008 at 10:36 PM, Phil Faber [EMAIL PROTECTED] wrote: Is there a simple way to quit all running applications? Basically I want to achieve the same result as the first stage of hitting 'shut down' (closing all applications) without actually shutting down the system. What do you mean by all running applications? There are GUI applications, background daemons owned by the user, applications of other users, system processes, etc. Also, what do you mean by quit? Do you want to force quit them, or tell them to gracefully quit? (During the shutdown process, applications have the opportunity to cancel the event). And depending on the type of application, the preferred way of getting them to quit changes. What are you trying to achieve here? I would suggest reading Apple's documentation of the shutdown process at: http://developer.apple.com/DOCUMENTATION/MacOSX/Conceptual/BPSystemStartup/Articles/BootProcess.html Phil ___ 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: Creating Interface
On Fri, Aug 29, 2008 at 12:32 AM, Jean-Daniel Dupas [EMAIL PROTECTED] wrote: When you use the idprotocol syntaxt, the compiler assume your object only implements the method declared in your protocol. If you want to use some other function, you have to use an object type that declare thoses functions, for example in your case, NSObject. However, NSObject is both a class and a protocol. Although most classes inherit from NSObject, this is not always the case (for example, using DO, where objects inherit from the NSProxy root class). It's preferrable if your protocol incorporates the NSObject protocol as well, which enforces all implementors to also conform to the NSObject protocol (and you take an idMyProtocol)---because you don't actually care if you have an NSObject subclass, just that whatever you've got behaves like an NSObject. Phil ___ 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: Quitting all active applications
Yes I agree it could be most annoying in the majority of cases to quit other people's apps! All I'm trying to achieve is a tiny app that only quits open apps and then quits itself; the purpose being when I want to release as much memory and disc space as possible before I run another memory / processor intensive app. I could just quit each one individually but I guess I'm lazy! I'm not suggesting anything more sinister! Thanks to you everyone for the advice. Phil On 28 Aug 2008, at 12:12, Rob Keniger wrote: On 28/08/2008, at 8:36 PM, Phil Faber wrote: Is there a simple way to quit all running applications? Basically I want to achieve the same result as the first stage of hitting 'shut down' (closing all applications) without actually shutting down the system. You could get the launched applications by using [[NSWorkspace sharedWorkspace] launchedApplications] and then send each of them a Quit Apple Event. But why would you want to do this? It is possibly one of the most annoying things you could do to someone's machine and you would want to have a very, very good reason for it. -- Rob Keniger ___ 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: File Extensions Problem
On Thu, Aug 28, 2008 at 10:59 AM, R.L. Grigg [EMAIL PROTECTED] wrote: Hmm, I guess the wrinkle in this particular case is if the contract doesnt specify something that the programmer assumes to be safe to do (like enumerating backwards), how can you know how to implement your end? I guess there are times when the underlying implementation details can/must influence your highlevel design? If the contract doesn't specify something, then the only thing that's safe to assume is that it's not supported. I'd argue that implementation details shouldn't influence higher-level design if the contract is well-specified. Although, it's probably unavoidable that it happens---but, you want to make sure that your design doesn't *depend* on an implementation detail that's not specified in the contract. Phil ___ 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: how to release CFData
On Wed, Aug 27, 2008 at 4:26 PM, lajos kamocsay [EMAIL PROTECTED] wrote: I have found several ways to create CFData, but how do I release a CFDataRef? CFRelease(). More information about Core Foundation's memory management functions is available in the following guide: http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/ Phil ___ 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: 64-bit = Objc 2.0????
On Tue, Aug 26, 2008 at 1:18 AM, Stéphane Sudre [EMAIL PROTECTED] wrote: Probably a stupid question but I don't see anything in the objc headers or in some old slides corroborating this. When you build a project for a 64-bit architecture (such as x86_64), does this imply the Objective-C version for this architecture is going to be 2.0? When you compile for 10.5, Objective-C 2.0 is implied. When compiling for 64-bit, several other things are implied, but it's all Objective-C 2.0: http://developer.apple.com/releasenotes/Cocoa/RN-ObjectiveC/ http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_7.html Phil ___ 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: CFBoolean
On Mon, Aug 25, 2008 at 1:33 PM, Chris Idou [EMAIL PROTECTED] wrote: How do I create a property in the user defaults of type boolean? Internally it seems to use a NSCFBoolean which is an undocumented type. If I make the assumption it is the same as a CFBoolean, and overlooking the oddness of having to fall back to Carbon for such a fundamental thing, the documentation of CFBoolean doesn't seem to provide a documented method for creating one. There's a table of Cocoa/CoreFoundation types and their XML property list representations at: http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Articles/XMLPListsConcept.html I'm curious as to why you need a boolean, rather than just what -setBool:forKey: gives you? Phil ___ 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: Implementing isEqual: and hash
On Sat, Aug 23, 2008 at 11:41 PM, Graham Cox [EMAIL PROTECTED] wrote: I have a class for which equality can be defined as having the same internal string value (which happens to be a UUID-turned-string). I can easily implement isEqual: based on that but the docs say I also need to implement -hash. Any pointers on what is a good way to do that? Could I just safely defer to the -hash returned by the string in question? If you're deferring both -isEqual: and -hash to an NSString, you'll be fine. Hash doesn't need to be anything complicated (although a good distribution is nice), just as long as two objects that return YES for -isEqual: return the same value for -hash (the inverse doesn't have to be true). Phil ___ 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: File Extensions Problem
On Fri, Aug 22, 2008 at 7:28 PM, Graham Cox [EMAIL PROTECTED] wrote: Or just use reverseObjectEnumerator. Removing the current iteration item from the array while iterating backwards is OK. Even going backwards, it's still not ok... From the -reverseObjectEnumerator 'special considerations' section of the documentation: When you use this method with mutable subclasses of NSArray, you must not modify the array during enumeration. And from NSEnumerator: Some enumerators may currently allow enumeration of a collection that is modified, but this behavior is not guaranteed to be supported in the future. Phil ___ 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: File Extensions Problem
On Fri, Aug 22, 2008 at 6:29 PM, Adil Saleem [EMAIL PROTECTED] wrote: Currently what i am doing is that i am getting the file names in an NSMutableArray using NSFileManager function directoryContentsAtPath I get the list, but the problem is that it get all the files. I want only those files that have a certain extension (for example mp4, mp3). How can i do that. I'd recommend using -enumeratorAtPath: and adding each path that meets your criteria to a new array. Also, consider if you want to check for a particular file extension, or a particular file type: do you just want files ending in .mp3, or any valid MP3 file? If you want the latter, then you should investigate checking the file extensions for conformance against the particular UTIs you're interested in. The documentation for UTIs isn't great, but take a look at the UTType.h and UTCoreTypes.h header files. Phil ___ 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: File Extensions Problem
On Fri, Aug 22, 2008 at 10:23 PM, Graham Cox [EMAIL PROTECTED] wrote: You shouldn't go modifying the array in general, for sure. But the special case of modification by deleting the last item in the array is safe, and always will be. In fact deleting any item with a higher index than current is safe, and always will be. Why? Because an ordinary for loop that counts down is free to do this and the existence of such loops in shipped code means that NSMutableArray can never be changed in such a way as to break code like that. (It's also hard to see how it could be, even theoretically). Although an NSEnumerator is analogous to a for loop using an index variable, that doesn't make the contract on them the same. NSMutableArray can't be changed to break the traditional for loop that modifies the array, but the NSEnumerator returned by NSMutableArray can be. You're making an assumption about the implementation of how the enumerator moves through the list; and although I think this is a sane assumption (any other way of enumerating through the list would be strange), you're still breaking the contract of NSEnumerator. There is no documented exception about the objects that have already been enumerated over, so it shouldn't be assumed that there is one. Phil ___ 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: Design Question: Pro Cons of KVC/KVO
On Fri, Aug 22, 2008 at 3:59 PM, Kyle Sluder [EMAIL PROTECTED] wrote: @implementation ToolBar { -(id) init { [[[NSNotificationCenter] defaultCenter] addObserver:self selector:@selector(splitViewResized:) object:mySplitView]; } -(void)dealloc { [[NSNotificationCenter] defaultCenter] removeObserver:self]; [super dealloc]; } @end I've generally only used notifications for events that can't be handled with KVO---ie. those that aren't associated with a property change; and I've noticed that this is generally the trend in Cocoa frameworks as well. Why use NSNotifications when there's already perfectly good notification mechanism? That said, notifications also give you a lot more flexibility about when observers will be called, and coalescence of multiple notifications. Phil ___ 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: Question about directory for Application Caches
On Sat, Aug 16, 2008 at 3:33 AM, Jason Coco [EMAIL PROTECTED] wrote: 1) ~/Library/Caches is world writable too... so as long as you're logged in, even if you have your filevault armed, you're still gonna be somewhat vulnerable to cache attacks. 2) The new temporary directory (returned the same by confstr(_CS_DARWIN_USER_TEMP_DIR,...) and NSTemporaryDirectory(...) is also outside the sphere of filevault /and/ your files there are not necessarily erased on log-out. I think it's cleaned up with the computer boots (although it may be deleted on shutdown, but I don't think so)... so if any sensitive information were written to the temp dir and the application relied on it being cleaned by the OS, that could be an issue too if your physical drive were compromised... Also consider the case that the user has a network home directory. If your caches are going to be very large and frequently accessed (off the disk), then there may be some performance penalties. Phil ___ 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: I don't understand why this is leaking...
On Tue, Aug 12, 2008 at 10:25 PM, Gerriet M. Denkmann [EMAIL PROTECTED] wrote: Yes, I have. 1. Simple Test: In IB create new window, add NSTextField with content $null (without the quotes) save in 10.2 or later format. Close. Open again. Look at your string. [...] Maybe this will work on Leopard. On Tiger it does not. (No crash, nor error message either). I tested this in Leopard, 2.x NIBs have this problem, but 3.X NIBs and XIBs do not. It looks like it was a bug that's fixed in Leopard, but preserved in some cases for backwards compatability. Although, I wouldn't consider this bug much of a reason for not using keyed archiving. Even though NS(Un)Archiver aren't deprecated, they have been replaced. Phil ___ 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: Archiving NSColor as NSData
On Wed, Aug 13, 2008 at 9:26 AM, Rein Hillmann [EMAIL PROTECTED] wrote: colorAsData: 040b7374 7265616d 74797065 6481e803 84014084 8484074e 53436f6c 6f720084 84084e53 4f626a65 63740085 84016301 8404 0101 000186 I suspect it's archiving other ivars in the color object. If so, is this much data in a single color object not a little extreme? I'm just guessing here, but it may also be archiving the NSColorSpace associated with the NSColor, which contains information about the colour profile so that it can accurately reproduce your NSColor on any output device. It might be able to take short cuts with certain colours or built-in colour spaces---again, just a guess. Phil ___ 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: How to get array of characters from NSString
I'm a newbie myself but this might help you: As far as I know, [ob characterAtIndex:num] (replacing num with the character you are after) ..will extract the single character at index num. For example: NSLog(@%c,[ob characterAtIndex:i]); Outputs to the console that character in question. Phil On 8 Aug 2008, at 05:27, SridharRao M wrote: Hi,I want to retrieve characters from NSString Can any one guide me how to do it. Ex: NSString *ob=@TEST Object; Now how to retrieve the Test Object value into my Char Array. Regards, Sri. ___ 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]
[Newbie] Extracting a specific character number from a string
I'm trying to learn more about string manipulation and want to be able to extract a single character from a string. I think I need to use subStringWithRange (exacting from and to the same character location) but I'm not sure and I'm also unsure how to code it. Basically I'm after the equivalent of the old-fashioned BASIC command MID$ [ i.e. MID$(This is the sentence to check,4,1) to get character 4. ] The following code works fine except for the.. NSLog(@Character %i of %@ is %@,i,pass1,[pass1 substringWithRange: 1,2]); ...line simply because I don't know how to code that line. I think it's something to do with how to set the range that I'm getting wrong. Can anyone please advise what than line is supposed to be to pull out the correct character? Thanks. Phil { NSMutableString *pass1; int i; pass1=@This is the sentence to check; NSLog(@length of %@ is %i,pass1,[pass1 length]); for (i=1;i=[pass1 length];i++) { // This displays characters UP to character 'i' NSLog(@Characters up to %i of %@ are %@,i,pass1,[pass1 substringToIndex:i]); // This is SUPPOSED to display character number 'i' ONLY NSLog(@Character %i of %@ is %@,i,pass1,[pass1 substringWithRange:i,i]); } } ___ 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: My own listbox
On Sat, Aug 2, 2008 at 8:40 PM, Vitaly Ovchinnikov [EMAIL PROTECTED] wrote: The problem is that my control will work like listbox, but don't exactly. Actually I need to draw every row myself. And these rows will have some padding and many graphics stuff inside. And they will have adjustable height... And so on. I don't think that it is possible to do this with standard controls. Am I wrong? You can get an NSTableView (NSTableColumn) or NSOutlineView to use a custom NSCell subclass for each of the rows in your list box. An NSOutlineView is probably easiest to use for this because it only exposes a single column. Apple has some sample code that may help you with this: http://developer.apple.com/samplecode/Clock_Control/ http://developer.apple.com/samplecode/SourceView/ Phil ___ 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: Thread safety with background fetching
On Fri, Aug 1, 2008 at 4:59 AM, Ben [EMAIL PROTECTED] wrote: and then -[XMLFetcherParser doYourThing] repeatedly sends newly created objects to receiveItem: using the performSelectorOnMainThread method. Once the spawned thread has done this, it never uses the sent object again. My question is how should I protect this code from thread related problems? Do I just place @synchronized(){} blocks around the code in receiveItem: and it's counterpart in the spawned thread? Or is that just plain wrong? Or (likely) am I barking up totally the wrong tree? Since it doesn't look like you're sharing any ivars or objects between the threads, I don't think you'll need any @synchronized blocks or locking. The only thing I can see you'll want to watch out for is the memory management of the objects that you pass to -receiveItem:. Phil ___ 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: Authenticate Password.
On Tue, Jul 29, 2008 at 7:31 PM, Macarov Anatoli [EMAIL PROTECTED] wrote: My program requests user's password for further work. Tha's why I'd like to check password, if the user has entered it correctly. And for this I use Authorization Service. What further work? If you're wanting to peform priveleged operations, you should let Authorization Services handle prompting the user for their password and validating it. Phil ___ 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: Detecting platform architecture within Cocoa app?
On Wed, Jul 30, 2008 at 7:56 AM, Jack Skellington [EMAIL PROTECTED] wrote: Is there a way to determine if an App is running on Intel or PPC from within the App? Gestalt() is still good for this, using the gestaltSysArchitecture selector. http://developer.apple.com/documentation/Carbon/Reference/Gestalt_Manager/ Phil ___ 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]
How to locate coding examples for specified commands [Newbie]
Can anyone direct me to an on-line resource that includes examples of how to use specific Cocoa commands? (Are things like - (NSString *)capitalizedString called 'commands' or should I call them something else?) It's often so much easier to understand how it works by seeing an example. I would like, for example, to see that - (NSString *)capitalizedString ..is available for use and that an example of its use might be: [textField1 setStringValue:[[textField2 stringValue] capitalizedString]]; or NSString *string = @tHe uniVERSity of TEXAS; NSString *capstring = [string capitalizedString]; (The above example I found at http://www.macdevcenter.com/pub/a/mac/2001/07/13/cocoa.html?page=lastx-order=datex-maxdepth=0 after a brief trawl) I realise I can Google 'capitalizedString' and start going through the 917 results to see which links contain examples and then try to extract the example that are Cocoa but this seems a very slow and cumbersome way of finding the answer - especially if I have to do it for every single command I'm trying to study. For example, these from Google are (presumably!) not Cocoa: set contents of text field inputField of window myWindow to call method capitalizedString of (contents of text field inputField of window myWindow myString.capitalizedString() pbString := pbString capitalizedString. etc. If someone can recommend a searchable resource, the first thing I'll be looking up is stringWithContentsOfFile:encoding:error: (I would have used this as an example above but can't find an example of its usage!) ___ 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: unsigning NSNumber
On Wed, Jul 23, 2008 at 12:20 AM, Steven Hamilton [EMAIL PROTECTED] wrote: Can anyone tell me the most efficient way to unsign a floatvalue in an NSNumber? Like change a -1.47 to 1.47 ? fabsf(3) http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/fabs.3.html Phil ___ 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: XML serialization and deserialization
On Fri, Jul 25, 2008 at 6:06 PM, Oleg Krupnov [EMAIL PROTECTED] wrote: I have read it now and I believe the guide suggests that i archive my object tree in a binary byte stream, not an XML. There are no implementations of NSCoder that would output XML, are there? NSKeyedArchiver can, see it's -setOutputFormat: method. Phil ___ 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: Is checking -count worth it?
On Thu, Jul 24, 2008 at 4:15 PM, Steve Cronin [EMAIL PROTECTED] wrote: I have a mutable array, M. I want to remove an object, O, from M; O might not be in M. M which is being constantly diminished could become empty. Is this code worth it? if ([M count]0) [M removeObject:O]; OR should I just do [M remove O]; I'm not quite sure what you gain in the first case? If the array is already empty, then what extra processing do you imagine will be in -removeObject: that you will save by checking -count first. You may be making assumptions about how the mutable array works internally (I'm assuming you mean an NSMutableArray), which is a bad thing to do for any class and in the case of Apple's collection classes, the internals can change on you: http://ridiculousfish.com/blog/archives/2005/12/23/array/ I think that your first piece of code is far less readable than the second, because I don't find it obvious why you're checking -count first? And as mentioned, measuring performance is the only way to get a true answer as to which method is better. Phil ___ 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: Obtaining the number of characters in a string
Thanks to all who helped me with this challenge of obtaining the number of characters in a string. On 20 Jul 2008, at 13:12, Tim Isted wrote: Try using [text2 setStringValue:[NSString stringWithFormat:@%i, [[Field1 stringValue] length]]]; Using setIntValue on a text field won't set the text field's stringValue to be a string from that int. That worked perfectly - thanks Tim. On 20 Jul 2008, at 13:16, Ron Fleckner wrote: Still struggling with documentation! That might be because the documentation makes the reasonable assumption that you already know how to use C and Objective-C. You're not recognising the difference between the data types 'int' and 'pointer to object'. The text field expects a pointer to an NSString. Telling it to setIntValue:someInt is just you hoping it'll work. What you need to do is [text2 setStringValue:[NSString stringWithFormat:@%d, [text1 length]]]; You should read the documentation, paying attention to method return types and etcetera. Also, bone up on basic C. It will help a lot. I'm trying! Honest! I've studied 'Learn C for Cocoa' at http://cocoadevcentral.com/articles/81.php , and a C programming book, as well as looking up stuff on the Web but it's a very slow process. The fact that I'm dyslexic doesn't help (although that's not a good excuse) as I need to go over things again and again to 'get' them ... although once I've 'got it', it tends to stay put! Getting there. Slowly. On 20 Jul 2008, at 14:41, Andy Lee wrote: On Jul 20, 2008, at 8:12 AM, Tim Isted wrote: Try using [text2 setStringValue:[NSString stringWithFormat:@%i, [[textField1 stringValue] length]]]; Using setIntValue on a text field won't set the text field's stringValue to be a string from that int. I believe this is incorrect. Try simply [text2 setIntValue:[[text1 stringValue] length]]; The original mistake was using [text1 length], which asks the text *field* for its length (no such method) instead of asking the text field's *string*. Interesting. Although Tim's original suggest did work (so it wasn't 'wrong' as such...) your simpler version also works and seems much neater as it simply asks for the length of the string value of text1. Thanks everyone! Phil ___ 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: NOT or NONE in NSPredicate
On Fri, Jul 18, 2008 at 2:52 PM, Chad Harrison [EMAIL PROTECTED] wrote: I have a fairly complex NSPredicate which works correctly, but I am trying to compound it with with a subpredicate that contains a logical NOT. I have tried using many combinations of the predicate syntax, but I can't seem to get it working. What I am trying to do it exclude files from being picked up based on an NSArray of names From the content of your predicate, it looks like you're running a Spotlight query (NSMetadataQuery), as such, the spotlight-dev list might be a better place for this. The Spotlight query syntax the the NSPredicate syntax aren't quite the same, and the behind-the-scenes conversion leaves a bit to be desired. I remember running into a situation similar to what you're trying a while ago, and eventually giving up and construcing my own Spotlight query strings and using MDQuery to run them. http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pSpotlightComparison.html Do you get the error if you change your predicates to: kMDItemFSName != %@ Some else to keep in mind is that there is (or, was the last time I checked---10.4) an upper-limit to the length of Spotlight queries. If this list of files is going to get BIG, then you may want to re-consider your approach, or do the filtering after you have the results. Phil ___ 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: how to measure an attributedString or string with attributes
On Thu, Jul 17, 2008 at 12:18 AM, norio [EMAIL PROTECTED] wrote: I think QuickTime API had an api for measuring the width and the height of an attributed string. If width was passed as an argument, the height was returned. And if height, returned its width. Is there any ways to get such information? For an NSString with attributes dictionary, AppKit has a category with some methods that sound like what you want: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSString_AppKitAdditions/ For an NSAttributedString there are a couple of methods in its AppKit category too: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSAttributedString_AppKitAdditions/ (Namely, -size and -boundingRectWithSize:options:) Phil ___ 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]
Newbie: How to understand Xcode's documentation
Hi all. As a relative newbie I'm eager to learn but my biggest stumbling block is understanding that the XCode's HelpDocumentation actually means; can someone guide me? For example, if I want to put a substring of a larger string (eg. ertyu from qwertyuiop) into a second field, I search the documentation and come across a thing under NSString called getCharacters:range. I assume this will do the job as it seems to get characters from a string as specified by a range; I then look at the usage information which reads: - (void)getCharacters:(unichar *)buffer range:(NSRange)aRange My challenge is that I don't know what this means or how to convert this into actual code. So I have to keep guessing which surely can't be the preferred way to learn! So I try: [newField setStringValue:[NSString getCharacters:buffer range:2,3]]; ..and am told: error: 'buffer' undeclared warning: 'NSString' may not respond to '+getCharacters:range:' ..so I try: [newField setStringValue:[NSString getCharacters:2,3]]; ..and am told: warning: 'NSString' may not respond to '+getCharacters:' .. so I try: [newField setStringValue:[NSString getCharacters:buffer range:2-3]]; ..and am told: error: 'buffer' undeclared warning: 'NSString' may not respond to '+getCharacters:range:' ..and so on. I'm a newbie; I'm still learning how to do simply stuff like add two numbers together, display 'hello world' and so on! What I could really do with is the documentation giving examples. Can anyone explain how I can 'decode' the usage information shown in the documentation into real code? Not just for this example, but in general. If I can't understand this, I fear I'll spend most of my time asking others how to achieve the most basic of tasks. Thanks. Phil ___ 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: [NSDate +dateWithNaturalLanguageString] question
On Jul 13, 2008, at 12:05 PM, Keith Duncan wrote: The problem is that NSCalendarDate uses the gregorian calendar exclusively I must be out of the loop on the population of developers and/or users complaining about this. If the issue is the reliance on the Gregorian calendar, where's the push for this coming from? Perhaps Apple sees the Genealogy/Ancient History/Religion as the next killer app category? Sarcasm aside, I'd really like to understand what *common* modern uses there are for non-Gregorian calendars that make what appears to be an ongoing push away from easy so worthwhile. Thanks, Phil ___ 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: [NSDate +dateWithNaturalLanguageString] question
On Jul 13, 2008, at 2:50 PM, Jens Alfke wrote: On 13 Jul '08, at 10:52 AM, Phil wrote: I'd really like to understand what *common* modern uses there are for non-Gregorian calendars Are you serious? A large fraction of the world's population uses other calendars. From the Wikipedia entry Calendar: Apparently ignorant, but quite serious. While the Gregorian calendar is widely used in Israel's business and day-to-day affairs, the Hebrew calendar, used by Jews worldwide for religious and cultural affairs, also influences civil matters in Israel (such as national holidays) and can be used there for business dealings (such as for the dating of checks). The Persian calendar is used in Iran and Afghanistan. The Islamic calendar is used by most non-Persian Muslims worldwide. The Chinese,Hebrew, Hindu, and Julian calendars are widely used for religious and/or social purposes. The Ethiopian calendar or Ethiopic calendar is the principal calendar used in Ethiopia and Eritrea. In Thailand, where the Thai solar calendar is used, the months and days have adopted the western standard, although the years are still based on the traditional Buddhist calendar. Even where there is a commonly used calendar such as the Gregorian calendar, alternate calendars may also be used, such as a fiscal calendar or the astronomical year numbering system[1]. Add that up and it's probably over 75% of the world's population using other calendars, at least for non-business purposes. So I'm just be trapped in my own perspective/needs on this (i.e. when I read the 'business and day-to-day affairs' comment on the Hebrew calendar I think 'that's well over 90% of the use cases I can think of using the Gregorian calendar.') OK, I'll quit complaining and quietly (re)implement what I need for my purposes. Hardcoding the Gregorian calendar is a serious internationalization problem, just like hardcoding the Roman alphabet or left-to-right text layout or octagonal red stop-sign icons. —Jens I appreciate you taking the time to explain that this really is an issue for some folks as I didn't appreciate it as being as important as it apparently is. Thanks, Phil___ 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: Debugging strategy - exceptions
On Wed, Jul 9, 2008 at 10:13 PM, Ruotger Skupin [EMAIL PROTECTED] wrote: *** -[NSCFDictionary initWithObjects:forKeys:count:]: attempt to insert nil value at objects[0] (key: NSFont) So an exception got thrown for a pretty obvious reason, but where? Could be anywhere, even in WebKit (which we use). Is there any chance to get near the culprit without a stack trace (which I don't have)? You really need to get more information. If the user can reproduce this problem, then could you give them a version of your application with some additional code to print out a stack trace/state information that they can send to you? Depending on what's going on, there's a few different ways you can go about this. Take a read of: http://developer.apple.com/documentation/Cocoa/Conceptual/Exceptions/ In particular, Uncaught Excpetions and Controlling a Program's Response to Exceptions. Phil ___ 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: controlling system muting ?
On Tue, Jul 8, 2008 at 3:25 PM, Jason Bobier [EMAIL PROTECTED] wrote: Has anyone figured out how to control a machine's volume level (specifically muting) from code? I know that you can do it from Applescript, but running an applescript from code seems to be a rather clunky approach. This is for emergency notification, so I have to be able to crank the volume on the system and then restore it afterwards. Take a read of QA1016: http://developer.apple.com/qa/qa2006/qa1016.html Also, TN2102, if you haven't already: http://developer.apple.com/technotes/tn2002/tn2102.html However, I would urge you not to mess around with the user's volume control, even you think it is an emergency---the user may feel very differently. Your application should play an alert sound, and trust that the user's system output volume and alert volume are correct for what they want to hear (although, I have no idea what your application does; but in the general case, messing around with user settings when they don't expect it isn't good). -Phil ___ 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: how to monitor the system status?
On Mar 5, 2008, at 5:13 PM, Scott.D.R wrote: Hi everyone. As the titled mentioned, How to monitor the system status? Mac OS X provided a very powerful application Activity Monitor, which can let you inspect the system status such as CPU usage, disk usage, network usage and so on. But how to retrieve these information using APIs? There are various API's depending on what you want to monitor. You might want to take a look at a project like MenuMeters (http://www.ragingmenace.com/software/menumeters/ ) which provides a fairly comprehensive overview of system status and provides source code so you can see how it was done. I'm sure there's also some Apple example code that demonstrates aspects of this but I can't recall anything that does it all in one project like MenuMeters. Phil ___ 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]
Changing IKPictureTaker flash effect?
Just wondering if anyone knows of a way to either disable the 'flash' effect, or better yet change the color it flashes to, when the takeAPicture is called? Thanks, Phil ___ 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]