Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString

2009-01-10 Thread Ken Thomases
On Jan 11, 2009, at 1:28 AM, ewan.dela...@math.unicaen.fr wrote: If you must work character-by-character, use character constants (e.g. >'0' or '9') In that (unlikely) situation, how would I test, say, equality of characters ? For example, if I needed to know whether character number j in aSt

Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString

2009-01-10 Thread ewan . Delanoy
Thanks Ken and Steve, for the variety of clean solutions you offered. Just out of curiosity, I should like to return to a point mentioned by Ken : >If you must work character-by-character, >use character constants (e.g. >'0' or '9') In that (unlikely) situation, how would I test, say, equali

Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString

2009-01-10 Thread Ken Thomases
On Jan 11, 2009, at 12:24 AM, ewan.dela...@math.unicaen.fr wrote: I have a Cocoa app that performs some computations on large integers (but still in the "unsigned long long" range), some of which are entered by the user in a NSTextField. Do you really need to exceed the long long range? NSS

Re: How to add a -(unsigned long long)unsignedLongLongValue method to NSString

2009-01-10 Thread Stephen J. Butler
On Sun, Jan 11, 2009 at 12:24 AM, wrote: > I have a Cocoa app that performs some computations on > large integers (but still in the "unsigned long long" range), some > of which are entered by the user in a NSTextField. > > The problem , of course, is that NSControl has no > -(unsigned long lo

Re: CALayer, CATextLayer, and inheritance . . .

2009-01-10 Thread Scott Anguish
On 10-Jan-09, at 7:26 PM, Michael A. Crawford wrote: I know that the documentation states the CALayer entities are to be allocated with class methods: CALayer* l = [CALayer layer]; CATextLayer* tl = [CATextLayer layer]; Am I creating a problem by not allocating and initializing my layers

Re: CAD programming.

2009-01-10 Thread Graham Cox
On 10 Jan 2009, at 5:03 pm, Brian Bruinewoud wrote: Hi, I'm an experienced C++ developer but a relative newbie to Objective- C and Cocoa and am learning my way. I'm porting a program to Mac OS X Cocoa and part of the requirements is a CAD-like functionality. A substantial part of the rest

How to add a -(unsigned long long)unsignedLongLongValue method to NSString

2009-01-10 Thread ewan . Delanoy
Hello all, I have a Cocoa app that performs some computations on large integers (but still in the "unsigned long long" range), some of which are entered by the user in a NSTextField. The problem , of course, is that NSControl has no -(unsigned long long)unsignedLongLongValue metho

Re: CAD programming.

2009-01-10 Thread Andrew Farmer
On 09 Jan 09, at 22:03, Brian Bruinewoud wrote: I'm an experienced C++ developer but a relative newbie to Objective- C and Cocoa and am learning my way. I'm porting a program to Mac OS X Cocoa and part of the requirements is a CAD-like functionality. A substantial part of the rest of the pr

Re: A Data Object in Cocoa

2009-01-10 Thread Michael Ash
On Sat, Jan 10, 2009 at 3:33 PM, Andy Lee wrote: > On Saturday, January 10, 2009, at 12:39PM, "jonat...@mugginsoft.com" > wrote: >>For what it's worth Anguish et al states (p99) that Apple reserves the >>right to change "private" instance variables that begin with an >>underscore and no prefix.

Re: A Data Object in Cocoa

2009-01-10 Thread Michael Ash
On Sat, Jan 10, 2009 at 2:40 PM, jonat...@mugginsoft.com wrote: > > On 10 Jan 2009, at 19:23, Michael Ash wrote: >> I don't have whichever book you're referring to so I can't see what it >> actually says, but your summary makes no sense. Apple can't change >> *your* ivars. If it means they reserve

Re: changeKeyPath method documentation

2009-01-10 Thread Quincey Morris
On Jan 10, 2009, at 10:06, Russell Martin wrote: So, are you saying that changeKeyPath isn't an override or a delegate method? If so, then why don't I have to put a stub in the .h file? I thought that unless I was implementing an override or delegate method that the stub in the .h was requi

Re: CALayer, CATextLayer, and inheritance . . .

2009-01-10 Thread Gordon Apple
I would definitely recommend using the factory methods. You have no idea of what is going on inside those methods, but you better believe you need it, whatever it is. Also, I've found that some of those methods don't even cal init, which I found out when my own iVars were not getting initiali

Using UIImageView for animations

2009-01-10 Thread Alex Strand
Hi! I'm taking a set of 10-20 jpegs that I'd like to animate. I started out just using a UIImageView using setAnimationImages: and everything worked fantastically in the simulator but testing it on my device basically makes it slow to the point where it is unresponsive. I've done some s

Re: changeKeyPath method documentation

2009-01-10 Thread Russell Martin
So, are you saying that changeKeyPath isn't an override or a delegate method? If so, then why don't I have to put a stub in the .h file? I thought that unless I was implementing an override or delegate method that the stub in the .h was required. Is my thinking wrong on this? And, if so, when is

Re: A Data Object in Cocoa

2009-01-10 Thread Dietmar Planitzer
On 10 Jan, 2009, at 3:28 AM, Adam Foltzer wrote: I stand corrected; I've seen this many times before, and have never had problems. I'm guessing it's one of those patterns that causes problems under specific circumstances? To give some concrete examples where calling a setter from -init or

CAD programming.

2009-01-10 Thread Brian Bruinewoud
Hi, I'm an experienced C++ developer but a relative newbie to Objective-C and Cocoa and am learning my way. I'm porting a program to Mac OS X Cocoa and part of the requirements is a CAD-like functionality. A substantial part of the rest of the program is already written in Cocoa. I've b

Using Keychain during login

2009-01-10 Thread Patrick Neave
All, Is it possible to access the Keychain from an Authentication plugin during log in? I have the username and password from the plugin so I assume I can just use these to access the users keychain. Thanks for any help. Regards, Patrick ___

NSDateFormatter or NSDate or whatever

2009-01-10 Thread Alex Kac
I am on the iPhone so its similar to the Leopard environment except whats deprecated on Leopard is simply not available on the iPhone. In most places of our code we can use the built in styles of NSDateFormatter simply. But in one place I need to know if the user is setup for AM/PM or 24 ho

Re: IKImageBrowserView and the View Hierarchy

2009-01-10 Thread Jeffrey J . Early
I finally came up with a simple work around to this problem, one which actually works better for my purposes: instead of adding a view to the window's view hierarchy, add a new child window to the window. The view ordering then works as expected and doesn't break (or get broken by) IKImage

Re: What's the most cocoa-ey pattern for this?

2009-01-10 Thread Michael B Johnson
So I believe I figured out the most Cocoa-ey pattern to do this tracking of time ranges. In 10.5, Apple added the NSTrackingArea to NSView. This is exactly the analogous pattern; except in a view it's 2D with an offset, while what I'm interested in is time:1D with an offset. To make it e

CALayer, CATextLayer, and inheritance . . .

2009-01-10 Thread Michael A. Crawford
Ok, I think I'm hosed but I need one of you bright people to tell me just how bad it is. I'm working on a avionics simulation project that leverages Core Animation and layers in order to composite various elements of the display. These elements all have various behaviors and attributes b

Re: [commentary] The value of warnings [was: Re: A Data Object in Cocoa]

2009-01-10 Thread Andrew Farmer
On 10 Jan 09, at 08:46, Michael Ash wrote: Just to pick a nit, this depends greatly on what the warning is about. A lot of warnings are actually about code whose behavior is fully specified by the standard but which is still considered to be iffy. For example, writing if(a = b) will generate a wa

Re: [commentary] The value of warnings [was: Re: A Data Object in Cocoa]

2009-01-10 Thread Kyle Sluder
On Sat, Jan 10, 2009 at 6:20 PM, Sean McBride wrote: > Michael Ash (michael@gmail.com) on 2009-01-10 11:46 AM said: > My favourite example is when Cocoa has two methods with the same name > that return different types. Like -(NSRect)frame vs -(CGRect)frame, or - > (id)window vs -(NSWindow*)wi

Re: [commentary] The value of warnings [was: Re: A Data Object in Cocoa]

2009-01-10 Thread Sean McBride
Michael Ash (michael@gmail.com) on 2009-01-10 11:46 AM said: >However it's still a good idea to fix them, and many warnings *are* >about code whose behavior could change. Then there is the annoying situation of a warning that is in general very useful, but sometimes warns in cases where you r

Re: What is the best way to copy files

2009-01-10 Thread Sean McBride
David (enki1...@gmail.com) on 2009-01-10 4:23 PM said: >I'm looking for what I think are some fairly common requirements from >a file copy mechanism. >- simple. Why write something if you can reuse. >- support multi-threading so that you can stay responsive to the UI >while copying large files. >-

Re: Any nice way to quit a background/helper app?

2009-01-10 Thread has
Sean McBride wrote: Is there a way to quit a background app, other than having NSTask send a unix 'kill' ? Yeah: you can call the function kill(). man 2 kill That's not a 'nice way', as requested in the subject. :) The nice way is to send a quit AppleEvent Only if the process has a Carb

Re: What is the best way to copy files

2009-01-10 Thread j o a r
On Jan 10, 2009, at 1:23 PM, David wrote: This is sort of a conceptual question. The broader question is what is the purpose of Cocoa and how does it relate to Core Foundation and Unix. The specific question is, what is the best way to copy files. I think that one thing is clear: It's probab

What is the best way to copy files

2009-01-10 Thread David
This is sort of a conceptual question. The broader question is what is the purpose of Cocoa and how does it relate to Core Foundation and Unix. The specific question is, what is the best way to copy files. Several different ways to copy files come to mind including: Use Cocoa - NSFileManager copyP

Re: Any nice way to quit a background/helper app?

2009-01-10 Thread Jerry Krinock
On 2009 Jan, 10, at 9:07, Sean McBride wrote: You can usually get a psn event for 'background apps'. See GetProcessForPID(). Thank you, Sean. The documentation for struct ProcessSerialNumber implied to me that background apps do not have a process serial number, and -[NSWorkspace laun

Re: A Data Object in Cocoa

2009-01-10 Thread Andy Lee
On Saturday, January 10, 2009, at 12:39PM, "jonat...@mugginsoft.com" wrote: >For what it's worth Anguish et al states (p99) that Apple reserves the >right to change "private" instance variables that begin with an >underscore and no prefix. On Saturday, January 10, 2009, at 02:40PM, "jonat..

Re: A Data Object in Cocoa

2009-01-10 Thread Andy Lee
On Saturday, January 10, 2009, at 12:18PM, "Michael Ash" wrote: >Mechanisms like KVC will >look for ivars both with and without the underscore. Yup: file://localhost/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/C

Re: A Data Object in Cocoa

2009-01-10 Thread jonat...@mugginsoft.com
On 10 Jan 2009, at 19:23, Michael Ash wrote: On Sat, Jan 10, 2009 at 12:39 PM, jonat...@mugginsoft.com wrote: On 10 Jan 2009, at 17:18, Michael Ash wrote: On Sat, Jan 10, 2009 at 12:08 PM, Alastair Houghton wrote: On 10 Jan 2009, at 16:48, Michael Ash wrote: As for underscore being res

Re: performSelectorOnMainThread

2009-01-10 Thread Michael Ash
On Sat, Jan 10, 2009 at 2:00 PM, John Love wrote: > -performSelectorOnMainThread:withObject:waitUntilDone:, according to Apple > docs, is passed a SEL method that "should not have a significant return > value". > > I wish it to return a INT and I figure that that qualifies as > in-significant. Gi

Re: A Data Object in Cocoa

2009-01-10 Thread Michael Ash
On Sat, Jan 10, 2009 at 12:39 PM, jonat...@mugginsoft.com wrote: > > On 10 Jan 2009, at 17:18, Michael Ash wrote: > >> On Sat, Jan 10, 2009 at 12:08 PM, Alastair Houghton >> wrote: >>> >>> On 10 Jan 2009, at 16:48, Michael Ash wrote: >>> As for underscore being reserved, I have never been ab

Re: performSelectorOnMainThread

2009-01-10 Thread Quincey Morris
On Jan 10, 2009, at 11:00, John Love wrote: -performSelectorOnMainThread:withObject:waitUntilDone:, according to Apple docs, is passed a SEL method that "should not have a significant return value". I wish it to return a INT and I figure that that qualifies as in- significant. Given that

Re: performSelectorOnMainThread

2009-01-10 Thread glenn andreas
On Jan 10, 2009, at 1:00 PM, John Love wrote: -performSelectorOnMainThread:withObject:waitUntilDone:, according to Apple docs, is passed a SEL method that "should not have a significant return value". I wish it to return a INT and I figure that that qualifies as in- significant. Given th

Re: performSelectorOnMainThread

2009-01-10 Thread Ashley Clark
On Jan 10, 2009, at 1:00 PM, John Love wrote: -performSelectorOnMainThread:withObject:waitUntilDone:, according to Apple docs, is passed a SEL method that "should not have a significant return value". I wish it to return a INT and I figure that that qualifies as in- significant. Given tha

Re: performSelectorOnMainThread

2009-01-10 Thread Jelle De Laender
Don't try to return it but work with 'call by reference' (in stead of call by value). Note: use also a class and not a primitive type, for example: NSNumber CodingMammoth Jelle De Laender i...@codingmammoth.com On 10 Jan 2009, at 20:00, John Love wrote: -performSelectorOnMainThread:withObje

performSelectorOnMainThread

2009-01-10 Thread John Love
-performSelectorOnMainThread:withObject:waitUntilDone:, according to Apple docs, is passed a SEL method that "should not have a significant return value". I wish it to return a INT and I figure that that qualifies as in- significant. Given that assumption, my real question is how to imple

Scroll wheel and cover flow

2009-01-10 Thread Jon C. Munson II
Namaste! I am having a difficult time resolving this and am hoping someone here may have a good answer or least somehow point me in the right direction. In my application I have a Finder-like window. It contains a cover flow view and just below it, a tableview. I hacked the covertflow sample

Re: CALayer removeFromSupeLayer crashes

2009-01-10 Thread David Duncan
On Jan 9, 2009, at 12:19 PM, Dennis Christopher wrote: NSArray *theLayers = [[self layer] sublayers]; for(CALayer *layer in sublayers) { [layer removeFromSuperlayer]; I'm new to CALayer and at a loss as to what could be wrong with this. Any suggestions would be appreciated. (I've read thro

Re: A Data Object in Cocoa

2009-01-10 Thread jonat...@mugginsoft.com
On 10 Jan 2009, at 17:18, Michael Ash wrote: On Sat, Jan 10, 2009 at 12:08 PM, Alastair Houghton wrote: On 10 Jan 2009, at 16:48, Michael Ash wrote: As for underscore being reserved, I have never been able to figure out any consequence of a conflict with an Apple ivar name. It may cause y

Re: A Question on estimating +arrayWithCapacity

2009-01-10 Thread Ashley Clark
On Jan 10, 2009, at 2:10 AM, Bill Bumgarner wrote: On Jan 9, 2009, at 7:11 PM, Ashley Clark wrote: This should apply to NSNumber and NSDecimalNumber too right? Yet the NSNumber +numberWith... methods are declared to return (NSNumber *) and when called on NSDecimalNumber they return NSDecim

Re: A Data Object in Cocoa

2009-01-10 Thread Michael Ash
On Sat, Jan 10, 2009 at 12:08 PM, Alastair Houghton wrote: > On 10 Jan 2009, at 16:48, Michael Ash wrote: > >> As for underscore being reserved, I have never been able to figure out >> any consequence of a conflict with an Apple ivar name. It may cause >> your source to fail to compile, but it won

Re: A Data Object in Cocoa

2009-01-10 Thread Alastair Houghton
On 10 Jan 2009, at 16:48, Michael Ash wrote: As for underscore being reserved, I have never been able to figure out any consequence of a conflict with an Apple ivar name. It may cause your source to fail to compile, but it won't cause any *binary* compatibility problems, which is the real menace

Re: Any nice way to quit a background/helper app?

2009-01-10 Thread Sean McBride
Stephen J. Butler (stephen.but...@gmail.com) on 2009-01-10 11:18 AM said: >> Is there a way to quit a background app, other than having NSTask send a >> unix 'kill' ? > >Yeah: you can call the function kill(). man 2 kill That's not a 'nice way', as requested in the subject. :) The nice way is to

Re: A Data Object in Cocoa

2009-01-10 Thread Michael Ash
On Sat, Jan 10, 2009 at 7:45 AM, Alastair Houghton wrote: > On 10 Jan 2009, at 00:11, Adam Foltzer wrote: > >> I've noticed a pattern in some Apple code where the instance variables are >> all prefixed with an underscore, but the property name, and therefore the >> accessors, are what you'd expect

Re: [commentary] The value of warnings [was: Re: A Data Object in Cocoa]

2009-01-10 Thread Michael Ash
On Sat, Jan 10, 2009 at 12:56 AM, Andrew Farmer wrote: > Not to mention, there is no guarantee that future versions of the compiler > will behave identically when processing code that generates warnings. It is > not uncommon for warnings to later turn into errors, or (worse!) incorrect > behavior,

Re: accessing ivars in - (id)init

2009-01-10 Thread Michael Ash
On Sat, Jan 10, 2009 at 12:09 AM, Kyle Sluder wrote: > On Fri, Jan 9, 2009 at 11:49 PM, Michael Ash wrote: >> Note that the problems, such as they are, with calling setters only >> show up if your class is subclassed and the subclass does something >> weird that doesn't like being called when the

Re: Any nice way to quit a background/helper app?

2009-01-10 Thread Stephen J. Butler
On Sat, Jan 10, 2009 at 10:15 AM, Jerry Krinock wrote: > Is there a way to quit a background app, other than having NSTask send a > unix 'kill' ? Yeah: you can call the function kill(). man 2 kill ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Any nice way to quit a background/helper app?

2009-01-10 Thread Jerry Krinock
I would like my app to be able to quit its background helper. NSWorkspace and Process Manager methods seem to only find "applications (defined as things which can appear in the Dock that are not documents and are launched by the Finder or Dock)". Is there a way to quit a background app, ot

Re: changeKeyPath method documentation

2009-01-10 Thread Michael Donegan
I'm working through Aaron Hillegass' "Cocoa Programming For Mac OS X (3rd Ed)" and I'm near the end of chapter 9 (pg 148) where it is shown to make use of the changeKeyPath method. I'm in the habit of right clicking on method names and choosing "Find selected text in API reference/in docume

Re: A Data Object in Cocoa

2009-01-10 Thread Alastair Houghton
On 10 Jan 2009, at 13:00, Ricky Sharp wrote: On Jan 10, 2009, at 6:45 AM, Alastair Houghton wrote: But in general I think it's better not to prefix the names of member variables, and then in your initialisers, to use a different name for the argument. My personal pattern is to leave the i

Re: changeKeyPath method documentation

2009-01-10 Thread Barron Snyder
On Jan 9, 2009, at 1:44 PM, Russell Martin wrote: Hi. I'm completely new to the list and this is my first question. I'm working through Aaron Hillegass' "Cocoa Programming For Mac OS X (3rd Ed)" and I'm near the end of chapter 9 (pg 148) where it is shown to make use of the changeKeyPath m

Re: A Data Object in Cocoa

2009-01-10 Thread Ricky Sharp
On Jan 10, 2009, at 6:45 AM, Alastair Houghton wrote: On 10 Jan 2009, at 00:11, Adam Foltzer wrote: I've noticed a pattern in some Apple code where the instance variables are all prefixed with an underscore, but the property name, and therefore the accessors, are what you'd expect. Exce

Re: A Data Object in Cocoa

2009-01-10 Thread Alastair Houghton
On 10 Jan 2009, at 00:40, Kyle Sluder wrote: On Fri, Jan 9, 2009 at 7:11 PM, Adam Foltzer wrote: - (id)initWithInt:(int)foo { if (![super init]) return nil; [self setFoo:foo]; return self; } Do not use getters and setters in -init. You should be accessing the ivars directly.

Re: NKE Kernel extension

2009-01-10 Thread Jacob Rhoden
Thanks, I hadn't thought to check some other lists, ill check out what there is. On 10/1/09 11:39 PM, Alastair Houghton wrote: On 10 Jan 2009, at 07:01, Jacob Rhoden wrote: Anyone here ever done any Network kernel extensions? I am trying to start by doing something simple as monitoring networ

Re: A Data Object in Cocoa

2009-01-10 Thread Alastair Houghton
On 10 Jan 2009, at 00:11, Adam Foltzer wrote: I've noticed a pattern in some Apple code where the instance variables are all prefixed with an underscore, but the property name, and therefore the accessors, are what you'd expect. Except that there's a long-standing rule that we shouldn't us

Re: NKE Kernel extension

2009-01-10 Thread Alastair Houghton
On 10 Jan 2009, at 07:01, Jacob Rhoden wrote: Anyone here ever done any Network kernel extensions? I am trying to start by doing something simple as monitoring network traffic, but the apple documentation isn't getting me very far? Anyone know any useful websites or tutorials in this area?

XIB -> NIB

2009-01-10 Thread Francisco Tolmasky
I know ibtool can create xibs from nibs, but is it possible to go in the opposite direction. I can easily do this through Interface Builder, but I'd like to batch it if possible. Thanks, Francisco Tolmasky 714-224-6179 tolma...@gmail.com ___ C

Re: A Data Object in Cocoa

2009-01-10 Thread nik heger
Thanks for all your responses. I am indeed using synthesized properties which hopefully will free me from having to do play around with retain/release. How anyone can get any work done without an automatic GC is unclear to me - you guys are hard core ;) Prior to embarking on Cocoa develo

Re: A Question on estimating +arrayWithCapacity

2009-01-10 Thread Bill Bumgarner
On Jan 9, 2009, at 7:11 PM, Ashley Clark wrote: This should apply to NSNumber and NSDecimalNumber too right? Yet the NSNumber +numberWith... methods are declared to return (NSNumber *) and when called on NSDecimalNumber they return NSDecimalNumber objects which then have to be typecast. Th