Re: Security - Write to protected directory

2008-10-26 Thread Michael Ash
On Mon, Oct 27, 2008 at 12:07 AM, Michael Nickerson <[EMAIL PROTECTED]> wrote: > > On Oct 24, 2008, at 10:46 PM, Michael Ash wrote: > >> On Fri, Oct 24, 2008 at 8:46 PM, Tommy Nordgren >> <[EMAIL PROTECTED]> wrote: >>> >>> On 3 okt 2008, at 16.39, Michael Ash wrote: >>> ...snip >>> Nope!

Re: Comparing results of @encode

2008-10-26 Thread Michael Ash
On Sun, Oct 26, 2008 at 6:23 PM, Graham Cox <[EMAIL PROTECTED]> wrote: >> Also note that NSNumber is smart enough to automatically convert its >> internal representation to whatever you ask for. So for example if >> 'double' encompasses every value you might need, then it's safe to >> simply use [m

Re: Security - Write to protected directory

2008-10-26 Thread Michael Nickerson
On Oct 24, 2008, at 10:46 PM, Michael Ash wrote: On Fri, Oct 24, 2008 at 8:46 PM, Tommy Nordgren <[EMAIL PROTECTED]> wrote: On 3 okt 2008, at 16.39, Michael Ash wrote: ...snip Nope! AEWP is a rather broken API in more ways than one. One of the ways that it's broken is that it is *impossi

Re: Newbie: Referencing Objects (second try)

2008-10-26 Thread john fogg
Hi again! I feel like I'm getting there. Though any help is still greatly appreciated! On Mon, Oct 27, 2008 at 3:58 AM, john fogg <[EMAIL PROTECTED]> wrote: > Or do I have to populate the variable once I created the object? It does work! I create the "secondSubObject" inside my "secondMainObjec

Re: Newbie: Referencing Objects (second try)

2008-10-26 Thread john fogg
Hi again! On Mon, Oct 27, 2008 at 3:20 AM, john fogg <[EMAIL PROTECTED]> wrote: > OK I did that. But as far as I can tell I now have an empty variable > named "secondMainObject" located in "secondSubObject". How do I store > the reference to "secondMainObject" in the variable? Or do I have to po

Re: Newbie: Referencing Objects (second try)

2008-10-26 Thread john fogg
Hi again! On Sun, Oct 26, 2008 at 10:40 PM, Nick Zitzmann <[EMAIL PROTECTED]> wrote: > Use accessors. In secondSubObject, create an @property(assign) > SecondMainObject *secondMainObject; so that you can call methods in > secondMainObjct from secondSubObject. OK I did that. But as far as I can t

Re: CFPreferences and init.

2008-10-26 Thread Kyle Sluder
On Sun, Oct 26, 2008 at 7:39 PM, Adam R. Maxwell <[EMAIL PROTECTED]> wrote: > > On Oct 26, 2008, at 2:47 PM, Kyle Sluder wrote: > >> And I've already noticed a memory management error in my own code; >> -setServers: leaks the old array. The first lines of the -setServers: >> method should look lik

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
On Oct27, 2008, at 12:46 AM, Adam R. Maxwell wrote: On Oct 26, 2008, at 4:23 PM, Adam Penny wrote: That's the binary plist representation. This will be transparent to well-behaved applications. Naughty ones will try to read the raw XML plist representation and fail, but ones that use th

Re: CFPreferences and init.

2008-10-26 Thread Adam R. Maxwell
On Oct 26, 2008, at 4:23 PM, Adam Penny wrote: That's the binary plist representation. This will be transparent to well-behaved applications. Naughty ones will try to read the raw XML plist representation and fail, but ones that use the plist serialization API won't know the difference. So f

Re: CFPreferences and init.

2008-10-26 Thread Adam R. Maxwell
On Oct 26, 2008, at 2:47 PM, Kyle Sluder wrote: And I've already noticed a memory management error in my own code; -setServers: leaks the old array. The first lines of the -setServers: method should look like this: -(void)setServers:(NSArray *)newServers { NSArray *oldServers = servers; ser

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
On Oct26, 2008, at 10:40 PM, Kyle Sluder wrote: On Sun, Oct 26, 2008 at 4:12 PM, Adam Penny <[EMAIL PROTECTED]> wrote: This is my code for the method in question and it's used for the NSTableView bindings: Your code is rather disorganized. Particularly, your use of else clauses is conf

Re: Getting Styluses/Track Pad Input in Cocoa

2008-10-26 Thread Pierce Freeman
Thank you very much! That was definitely what I was looking for. Pierce F. On 10/26/08 3:56 PM, "Kevin Gessner" <[EMAIL PROTECTED]> wrote: > NSEvent > (http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Class > es/NSEvent_Class/Reference/Reference.html > ) has specific m

Re: Getting Styluses/Track Pad Input in Cocoa

2008-10-26 Thread Nick Zitzmann
On Oct 26, 2008, at 4:44 PM, Pierce Freeman wrote: I am currently looking into if there is some way to get input from a styluses using Cocoa. I have seen that there is a fair bit of information using Carbon but so far I haven't seen any that cover Cocoa. > Specifically look at the -poi

Re: Getting Styluses/Track Pad Input in Cocoa

2008-10-26 Thread Graham Cox
On 27 Oct 2008, at 9:44 am, Pierce Freeman wrote: Hi everyone. I am currently looking into if there is some way to get input from a styluses using Cocoa. I have seen that there is a fair bit of information using Carbon but so far I haven't seen any that cover Cocoa. In addition I am looki

Re: Getting Styluses/Track Pad Input in Cocoa

2008-10-26 Thread Kevin Gessner
NSEvent (http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSEvent_Class/Reference/Reference.html ) has specific methods for getting tablet/stylus info. It also covers scroll wheel events. For more about Cocoa's event handling in general, see http://developer.app

Re: Editing a dictionary using NSTableView

2008-10-26 Thread Graham Cox
On 27 Oct 2008, at 9:41 am, Jason Coco wrote: If I were doing it, I'd have a type key and let the user specify what type s/he wanted, like in the current property list editor. That way if the user wants to type a real number but actually wants it to be a string for whatever reason, it could

Getting Styluses/Track Pad Input in Cocoa

2008-10-26 Thread Pierce Freeman
Hi everyone. I am currently looking into if there is some way to get input from a styluses using Cocoa. I have seen that there is a fair bit of information using Carbon but so far I haven't seen any that cover Cocoa. In addition I am looking to get user input based on the track pad. For example

Re: Editing a dictionary using NSTableView

2008-10-26 Thread Jason Coco
On Oct 26, 2008, at 18:29 , Graham Cox wrote: Let's say I have a NS(Mutable)Dictionary and I'd like to make a very simple editor for its keys and values. So I have a NSTableView with two columns, key and value. The dictionary can contain any mix of strings and numbers, and the numbers can

Re: Newbie: Referencing Objects

2008-10-26 Thread Graham Cox
On 27 Oct 2008, at 8:11 am, john fogg wrote: Does this apply even if I create my UI programatically? It applies as much as you want it to apply... by which I mean you are free to make a big ol' mess if you wish! But the MVC pattern keeps things sanely organised and should generally be fol

Editing a dictionary using NSTableView

2008-10-26 Thread Graham Cox
Let's say I have a NS(Mutable)Dictionary and I'd like to make a very simple editor for its keys and values. So I have a NSTableView with two columns, key and value. The dictionary can contain any mix of strings and numbers, and the numbers can be ints or reals. I find that when setting an e

Re: Comparing results of @encode

2008-10-26 Thread Graham Cox
On 27 Oct 2008, at 3:28 am, Michael Ash wrote: For this particular case, it would be roughly just as fast and more reliable to do something like: if([myNumber objCType][0] == 'f') The type encoding characters are documented here: http://developer.apple.com/documentation/Cocoa/Conceptual/Obje

Cocoa and Printing (Advanced Q)

2008-10-26 Thread Tommy Nordgren
Is it possible to configure printing via Cocoa API:s such that: A specific printer can be used ONLY by a special app. Changing printer settings for an App affects that app only. -- "Home is not where you are born, but where your heart finds peace

Re: CFPreferences and init.

2008-10-26 Thread Kyle Sluder
And I've already noticed a memory management error in my own code; -setServers: leaks the old array. The first lines of the -setServers: method should look like this: -(void)setServers:(NSArray *)newServers { NSArray *oldServers = servers; servers = [[newServers copy] retain]; [oldServers r

Re: Newbie: Referencing Objects (second try)

2008-10-26 Thread Nick Zitzmann
On Oct 26, 2008, at 2:59 PM, john fogg wrote: When I'm inside "secondSubObject" how can I alter a variable in "secondMainObject"? Use accessors. In secondSubObject, create an @property(assign) SecondMainObject *secondMainObject; so that you can call methods in secondMainObjct from secondS

Re: CFPreferences and init.

2008-10-26 Thread Kyle Sluder
On Sun, Oct 26, 2008 at 4:12 PM, Adam Penny <[EMAIL PROTECTED]> wrote: > This is my code for the method in question and it's used for the NSTableView > bindings: Your code is rather disorganized. Particularly, your use of else clauses is confusing and prone to introducing logic errors. > - (void

Re: Newbie: Referencing Objects

2008-10-26 Thread john fogg
Hi again! On Sun, Oct 26, 2008 at 10:02 PM, Ken Thomases <[EMAIL PROTECTED]> wrote: > [...] Does that help? Oh man, that helped a lot!! Thank you! Does this apply even if I create my UI programatically? I lay out all my interface elements with code and not in Interface Builder.

Re: Newbie: Referencing Objects

2008-10-26 Thread Ken Thomases
On Oct 26, 2008, at 3:21 PM, Nathan Kinsinger wrote: On Oct 26, 2008, at 2:05 PM, john fogg wrote: Hi again! Thank you everybody for your answers. On Sun, Oct 26, 2008 at 7:45 PM, Andy Lee <[EMAIL PROTECTED]> wrote: I don't know Actionscript but it looks like it has a global dictionary of

Re: Newbie: Referencing Objects (second try)

2008-10-26 Thread john fogg
Hi again! And thank you for your kind help!! Let me rephrase my question. I create two objects: "fistMainObject" and "secondMainObject". Inside the second I create another object called "secondSubObject". When I'm inside "secondSubObject" how can I alter a variable in "secondMainObject"? And how

Re: Leaking CGColor objects

2008-10-26 Thread Julien Jalon
self.foregroundColor = nil in your -dealloc is totally useless (and in this case, it's even logging some error log!). Taking care of foregroundColor is you superclass responsibility. You are only responsible of the object YOU create or retain (that's why the temp pattern is indeed the right one) >

Re: Newbie: Referencing Objects

2008-10-26 Thread Nathan Kinsinger
On Oct 26, 2008, at 2:05 PM, john fogg wrote: Hi again! Thank you everybody for your answers. On Sun, Oct 26, 2008 at 7:45 PM, Andy Lee <[EMAIL PROTECTED]> wrote: I don't know Actionscript but it looks like it has a global dictionary of objects that you can reference by name. There is noth

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
Hi again, I got the CFPreferences synchronize app working but, I'm now having issues with CFPreferencesSetApp value for an array. This is my code for the method in question and it's used for the NSTableView bindings: - (void) setServers:(NSMutableArray *)a; { //Method for adding

Re: Leaking CGColor objects

2008-10-26 Thread DKJ
I'm still puzzled. When I put this: self.foregroundColor = nil; in my layer's dealloc method, I get this error: attempting to modify layer that is being finalized But if I don't put that line in dealloc, Instruments doesn't detect any leaks. In the documentation, the foregr

Re: Newbie: Referencing Objects

2008-10-26 Thread john fogg
Hi again! Thank you everybody for your answers. On Sun, Oct 26, 2008 at 7:45 PM, Andy Lee <[EMAIL PROTECTED]> wrote: > I don't know Actionscript but it looks like it has a global dictionary of > objects that you can reference by name. There is nothing like "_root" in > Objective-C. I see, this

Re: Leaking CGColor objects

2008-10-26 Thread Charles Steinman
--- On Sun, 10/26/08, DKJ <[EMAIL PROTECTED]> wrote: > On 26 Oct, 2008, at 12:09, Clark S. Cox III wrote: > > You must do both, otherwise you will leak. > > > I understand why I have to release the temp object, but why > does it > leak if I don't set foregroundColor to nil as well? Because ot

Re: Leaking CGColor objects

2008-10-26 Thread Charles Steinman
--- On Sun, 10/26/08, DKJ <[EMAIL PROTECTED]> wrote: > If I do this in MyCALayer's dealloc: > > self.foregroundColor = nil; > > do I need to do this in init: > > CGColorRef temp = CGColorCreateGenericRGB( etc. ); > self.foregroundColor = temp; > CFRelease( temp );

Re: Leaking CGColor objects

2008-10-26 Thread DKJ
On 26 Oct, 2008, at 12:09, Clark S. Cox III wrote: You must do both, otherwise you will leak. I understand why I have to release the temp object, but why does it leak if I don't set foregroundColor to nil as well? ___ Cocoa-dev mailing list (Coco

Re: Leaking CGColor objects

2008-10-26 Thread Clark S. Cox III
You must do both, otherwise you will leak. Sent from my iPhone On Oct 26, 2008, at 10:58, DKJ <[EMAIL PROTECTED]> wrote: Thanks to everyone for the replies. I have one (hopefully last) question (on this topic): On 26 Oct, 2008, at 09:23, Clark Cox wrote: As long as MyCALayer's dealloc is p

Re: Newbie: Referencing Objects

2008-10-26 Thread Andy Lee
On Oct 25, 2008, at 1:20 PM, john fogg wrote: If this helps: In Actionscript I'd write "_root.myObjectName.myFunctionName" and be set. Is there a way to access objects like this in Objective-C? I don't know Actionscript but it looks like it has a global dictionary of objects that you can refe

Re: Newbie: Referencing Objects

2008-10-26 Thread Nick Zitzmann
On Oct 25, 2008, at 11:20 AM, john fogg wrote: I create a Button and in the course of that I set a "target:" and an "action:". Unlike any and all of the examples I found on the web and on Apple's site I don't want the message sent to my current object, so I don't want "target:self" but another

Callback for when a window from another app is moved

2008-10-26 Thread Steve McLeod
How can I ask for a function to receive notification whenever a window (from any application or one specific application) is moved, resized or closed? Thanks Steve McLeod ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin

Newbie: Referencing Objects

2008-10-26 Thread john fogg
Hi there! I'm stuck with Objective-C but then again I'm new to this. I searched the web for the last two days but maybe I'm looking in the wrong direction? I create a Button and in the course of that I set a "target:" and an "action:". Unlike any and all of the examples I found on the web and on

Re: Leaking CGColor objects

2008-10-26 Thread DKJ
Thanks to everyone for the replies. I have one (hopefully last) question (on this topic): On 26 Oct, 2008, at 09:23, Clark Cox wrote: As long as MyCALayer's dealloc is properly implemented (to release foregroundColor, or set it to nil), you should never need to explicitly do so in code that us

Re: Just starting off in obj C

2008-10-26 Thread Scott Ribe
> Interesting, but that's no longer ansi-C. Plus it still won't support you > creating your own kinds of format strings. Yeah, if you want standard + type safe + custom types you have to use C++ ;-) -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303) 722-0567 voice __

Finding out that a volume is going away before it does

2008-10-26 Thread Gregory Weston
Amusingly, when you register an unmount or eject approval function with DiskArbitration, that function gets invoked *after* NSWorkspace sends its didUnmount notification. How's that for a lead-in anecdote? So anyway, I'm looking to react to the imminent or even potential departure of a volu

Re: Comparing results of @encode

2008-10-26 Thread Michael Ash
On Sun, Oct 26, 2008 at 7:45 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > I'm porting some older code to my project. In this code, a variety of data > types (integer, string, etc) are enumerated in a simple enumeration. I'd > like to be able to automatically figure out what data type I need to use >

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
Hello again, I was just trying to update the plist with CFPreferencesAppSynchronize(appID), where appID = CFSTR("uk.co.pennynet.Wopol") eventhoughthe CFPreferencesSetAppValue is definitely working. Currently my plist is in ~/Library/Preferences/ uk.co.pennynet.Wopol.plist and the control

Re: Leaking CGColor objects

2008-10-26 Thread Clark Cox
On Sun, Oct 26, 2008 at 7:25 AM, DKJ <[EMAIL PROTECTED]> wrote: > I've got this in the init method of MyCALayer: > >self.foregroundColor = >CGColorCreateGenericRGB( 1.0, 1.0, 0.9, 1.0 ); Here's your problem. CoreFoundation-style functions, of the form Create... (like CGColo

Re: Leaking CGColor objects

2008-10-26 Thread Julien Jalon
On Sun, Oct 26, 2008 at 4:20 PM, Antonio Nunes <[EMAIL PROTECTED]>wrote: > On 26 Oct 2008, at 14:25, DKJ wrote: > > 1. Is there such a thing as a CGColor class? I don't see it in the >> documentation; but "CGColor" is what Instruments lists as the leaked >> objects. >> > > You are creating CGColo

Re: Leaking CGColor objects

2008-10-26 Thread Antonio Nunes
On 26 Oct 2008, at 14:25, DKJ wrote: 1. Is there such a thing as a CGColor class? I don't see it in the documentation; but "CGColor" is what Instruments lists as the leaked objects. You are creating CGColor objects to which you receive pointers of type CGColorRef. You are at C level here,

Re: Leaking CGColor objects

2008-10-26 Thread DKJ
Misprint in my last message: [[MyCALayer alloc] init]; should be: id mylayer = [[MyCALayer alloc] init]; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Co

Leaking CGColor objects

2008-10-26 Thread DKJ
I've got this in the init method of MyCALayer: self.foregroundColor = CGColorCreateGenericRGB( 1.0, 1.0, 0.9, 1.0 ); And in the controller I do this: [[MyCALayer alloc] init]; [rootLayer addSublayer:myLayer]; [myArray addObject:myLayer]; [

[Resolved] Re: class method called on an instance

2008-10-26 Thread Roland King
yes, thanks, that is exactly what I was thinking of and was what I was searching for. On Oct 26, 2008, at 10:12 PM, Adam R. Maxwell wrote: On Oct 26, 2008, at 6:25 AM, Roland King wrote: I'm sure I read somewhere that there is a specific case where you can call a class method (a + one) on

Re: class method called on an instance

2008-10-26 Thread Adam R. Maxwell
On Oct 26, 2008, at 6:25 AM, Roland King wrote: I'm sure I read somewhere that there is a specific case where you can call a class method (a + one) on an instance, but my documentation search techniques are failing me and I can't find the case. Would someone be so kind as to point me in th

Re: Comparing results of @encode

2008-10-26 Thread Jim Correia
On Oct 26, 2008, at 7:45 AM, Graham Cox wrote: I'm porting some older code to my project. In this code, a variety of data types (integer, string, etc) are enumerated in a simple enumeration. I'd like to be able to automatically figure out what data type I need to use from a property's type

class method called on an instance

2008-10-26 Thread Roland King
I'm sure I read somewhere that there is a specific case where you can call a class method (a + one) on an instance, but my documentation search techniques are failing me and I can't find the case. Would someone be so kind as to point me in the correct direction please. Thanks very much. R

Re: Not so long filenames

2008-10-26 Thread Gerriet M. Denkmann
On 26 Oct 2008, at 00:30, Postmaster wrote: On 14 Oct 2008, at 21:00, Gerriet M. Denkmann wrote: On 14 Oct 2008, at 18:07, Jason Coco wrote: On Oct 14, 2008, at 11:28 , Gerriet M. Denkmann wrote: HFS+ and Finder can use filenames which use in Utf-16 up to 255 shorts. But in the prog

Re: Just starting off in obj C

2008-10-26 Thread Chris Idou
Interesting, but that's no longer ansi-C. Plus it still won't support you creating your own kinds of format strings. --- On Sun, 10/26/08, Chris Suter <[EMAIL PROTECTED]> wrote: > From: Chris Suter <[EMAIL PROTECTED]> > Subject: Re: Just starting off in obj C > To: [EMAIL PROTECTED] > Date: Su

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
On Oct26, 2008, at 1:12 PM, Jean-Daniel Dupas wrote: Le 26 oct. 08 à 13:02, Adam Penny a écrit : Hi there, Thanks for your response Kyle. Based on that I did this in my -(id)initWithBundle method and tested it with and without a PList in the right place and it works: servers= [[NSMutabl

Re: CFPreferences and init.

2008-10-26 Thread Jean-Daniel Dupas
Le 26 oct. 08 à 13:02, Adam Penny a écrit : Hi there, Thanks for your response Kyle. Based on that I did this in my -(id)initWithBundle method and tested it with and without a PList in the right place and it works: servers= [[NSMutableArray alloc] init]; CFPropertyListRef serversFromPli

Re: CFPreferences and init.

2008-10-26 Thread Adam Penny
Hi there, Thanks for your response Kyle. Based on that I did this in my -(id)initWithBundle method and tested it with and without a PList in the right place and it works: servers= [[NSMutableArray alloc] init]; CFPropertyListRef serversFromPlist=CFPreferencesCopyAppValue( CFSTR("servers"),

Comparing results of @encode

2008-10-26 Thread Graham Cox
I'm porting some older code to my project. In this code, a variety of data types (integer, string, etc) are enumerated in a simple enumeration. I'd like to be able to automatically figure out what data type I need to use from a property's type or, since many properties are encapsulated in a

compare:options:range: bug ?

2008-10-26 Thread cacaodev
Hello list. Very simple question. [@"a" compare:@"b" options:0 range:NSMakeRange(3,4)]; ... does not raise an exception. The doc for this method says : "Important: Raises an NSRangeException if range exceeds the bounds of the receiver." Question: is this a bug in cocoa or in the doc ? MacO