Re: How to implement float min(float x, ...) ?

2008-11-16 Thread Andrew Farmer
On 16 Nov 08, at 23:38, Oleg Krupnov wrote: I apologize, this is plain old C, not Cocoa-specific question, but the fastest way to get the answer. I want to create a function that finds the minimum out of a variable-length list of simple float arguments. In other words, I want this function: flo

How to implement float min(float x, ...) ?

2008-11-16 Thread Oleg Krupnov
I apologize, this is plain old C, not Cocoa-specific question, but the fastest way to get the answer. I want to create a function that finds the minimum out of a variable-length list of simple float arguments. In other words, I want this function: float min(float x, ...); Can anyone suggest the

Writing a more usable AppleEvent logger

2008-11-16 Thread Ken Tozier
Hi I've been working with AppleEvents and discovering their internals by setting the following in the terminal > export AEDebugSends=1; export AEDebugReceives=1 What I'd like to be able to do is observe apple events exactly like this tool but format them into an NSDictionary so they can be

NSTokenField fails to tokenize with mixed text

2008-11-16 Thread Kyle Sluder
Hi list, I'm writing an Automator action that will allow users to insert properties of the input object into a format string to produce new strings. So, for example, if the input to the action is a list of iTunes tracks, the user can generate filenames of the pattern "«artist» - «album» - «name».

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Kyle Sluder
On Mon, Nov 17, 2008 at 1:03 AM, Stephen J. Butler <[EMAIL PROTECTED]> wrote: > 2) always use the value returned from an init* method. This isn't strictly necessary. If you need a singleton object that lives for the duration of your app, for example, there's no reason you can't just alloc/init on

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Stephen J. Butler
On Sun, Nov 16, 2008 at 11:52 PM, Sandro Noel <[EMAIL PROTECTED]> wrote: > as it turns out. with the bug fixed the mounts array is left null because > the file does not exist yet. > so further in the program is i try to add to the array, nothing happens. > > and if i try "mounts = [[NSMutableArray

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
OK. the double initialization was the problem. the first init was giving me a pointer, and the second one was returning nothing because the file did not exist, and i guess the compiler was reusing it... the problem was fixed like this, sorry for the confusion guy's and thanks for the help.

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
as it turns out. with the bug fixed the mounts array is left null because the file does not exist yet. so further in the program is i try to add to the array, nothing happens. and if i try "mounts = [[NSMutableArray alloc] init];" only the two arrays get the same pointer. transportTypes =

Set user agent for NSURL

2008-11-16 Thread Mr. Gecko
Hello I am working on a website crawler and I am needing to make a user agent string so people who monitoring who visits can know that my crawler visited. Thanks for the help, Mr. Gecko ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Charles Steinman
Have you fixed the [mounts initWithContentsOfFile:...] bug and it still happens? Cheers, Chuck - Original Message > From: Sandro Noel <[EMAIL PROTECTED]> > To: Scott Ribe <[EMAIL PROTECTED]> > Cc: cocoa-dev@lists.apple.com > Sent: Sunday, November 16, 2008 9:16:15 PM > Subject: Re: Two

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
I'm actually checking here in this function. - (IBAction)mountSomeServers:(id)sender { NSDictionary *mountDictionary; mountDictionary = [NSDictionary dictionaryWithObjectsAndKeys: [server stringValue], ServerNameKey,

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Scott Ribe
> This is a debug built, and I'm checking in the code where mounts is > being assigned objects Which, if I recall correctly, is before bonjourServices is allocated. What do you think the problem is? -- Scott Ribe [EMAIL PROTECTED] http://www.killerbytes.com/ (303) 722-0567 voice __

Re: Core data save error with multiple persistent stores

2008-11-16 Thread Quincey Morris
On Nov 16, 2008, at 13:30, Arthur C. wrote: The example in the documentation:> http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdCreateMOs.html#/ >/apple_ref/doc/uid/TP40001654-SW2>>does the assignment immediately after the >"insertNewObjectForEntityForName" call

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
Forgot to answer the first question. This is a debug built, and I'm checking in the code where mounts is being assigned objects I have not enabled any optimization that I know of ... Sandro Noel. On 16-Nov-08, at 11:37 PM, Scott Ribe wrote: At what point in the code are you checking? Is th

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
Scott. thank you for your explanation. Mounts is being used, but just not in the init function. it is being used later in the code. that is why i was geting confused because the 2 arrays, are not meant to hold the same type of data. and right now, they contain mixed data type. witch makes m

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Scott Ribe
At what point in the code are you checking? Is this a release build, or a debug build in which you've gone & enabled some optimizations? In the code you posted mounts is init'd (twice actually, which is unecessary), then never used. It's perfectly possible that the two variables mounts & bonjourSe

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Markus Spoettl
On Nov 16, 2008, at 8:22 PM, Sandro Noel wrote: mounts = [[NSMutableArray alloc] init]; [mounts initWithContentsOfFile:[[self applicationSupportFolder] stringByAppendingPathComponent:@"Bonjour Mounter.plist"]]; You are initializing "mounts" twice, and you're also throwing

Re: Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
I just declared a third NSMutableArray to see if that one would have a different pointer, and well it had the same pointer somehow... what is this ? is it some type of setting ? Sandro Noel. On 16-Nov-08, at 11:22 PM, Sandro Noel wrote: Greetings. I'm having a weird behaviour, i have 2 arr

Two arrays sharing the same adress space.

2008-11-16 Thread Sandro Noel
Greetings. I'm having a weird behaviour, i have 2 arrays declared in the same controller, and for some reason they both share the same memory space. well actually in debug they share the same pointer, witch is not something I asked for. the bonjourservices and the mounts array's are the one

Fetch value from field editor during editing?

2008-11-16 Thread Russ
I need to be able to find the current value of a NSTextField even if it is being edited. I have the following code to check if it is being edited, and get the value from the field editor instead: fresp = [[txtf window] firstResponder]; if ([fresp isKindOfClass:[NSTextView class]

Re: newbie NSMutable dictionary subclass question

2008-11-16 Thread Chris Suter
> Why does that crash when the first does not? Are subclasses required to > have member variables, or can they just have new functions? Mine don't have > any variables, maybe that is the problem? See:

newbie NSMutable dictionary subclass question

2008-11-16 Thread Bob Sabiston
Can the value part of a key-value pair in an NSMutableDictionary be a literal NSString, like @"name"? It would seem so, because this works or at least doesn't crash: NSMutableDictionary *bobo; bobo = [[NSMutableDictionary alloc] init]; [bobo setValue:@"root" forKey:@"na

Re: XML Datasource question on persistence

2008-11-16 Thread Chris Idou
I would say it depends on how big the dataset is. If the data is small and/or you have to slurp it all into memory anyway, then I like the simplicity of just keeping it as XML. But if the data is arbitrarily large and/or you don't want it all in memory at once, then going to sqlite becomes some

NSExpression and CAST (NSPredicate)

2008-11-16 Thread Chris Idou
NSExpression contains the following mysterious information: "All methods must take 0 or more id arguments and return an id value, although you can use the CAST expression to convert datatypes with lossy string representations (for example, CAST(, "NSDate")). The CAST expression is extended

RE: Core data save error with multiple persistent stores

2008-11-16 Thread Arthur C .
From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Core data save error with multiple persistent storesDate: Sun, 16 Nov 2008 21:02:37 +0100 In my application I have two managed object contexts, as I need to be able to save two subsets of my Core Data setup separately. These are both using one and

Re: NSView positioning problems

2008-11-16 Thread Andre Masse
Quincey you were right on the money: the new view had a wrong flag (anchored to the bottom). Thanks a lot to everyone, Andre Masse On Nov 16, 2008, at 14:41, Quincey Morris wrote: There's not quite enough information here to be certain what's going on, but in a sense it shouldn't matter *w

XML Datasource question on persistence

2008-11-16 Thread Mark McCray
Hey there,I'm wondering if anyone has any guidance on something. I'm getting an xml datafeed every so often that should populate data for my iphone app. I could keep this file local and read every time the app starts up and update it every so often from the web. I could also parse the xml into a

Re: NSView positioning problems

2008-11-16 Thread Andy Lee
On Nov 16, 2008, at 3:30 PM, Quincey Morris wrote: On Nov 16, 2008, at 12:16, Andy Lee wrote: Does -[NSView replaceSubview:with:] take care of these? IDK, but I see nothing in the documentation to suggest that it does anything but deal with the subview ordering. Which makes me realize, if

Re: NSView positioning problems

2008-11-16 Thread Quincey Morris
On Nov 16, 2008, at 12:16, Andy Lee wrote: Does -[NSView replaceSubview:with:] take care of these? IDK, but I see nothing in the documentation to suggest that it does anything but deal with the subview ordering. If it does, that would be useful information to know. ___

Using NSDateFormatter on NSPopUpButton in IB

2008-11-16 Thread Mikael Wämundson
Hi all experienced developers! It is possible to apply a NSDateFormatter on a NSPopUpButton in IB, but whatever settings I do with the formatter I can't get it to format the date. The PopUpButton is connected to an ArrayController using binding. The array contains objects with a NSCalendarD

Re: Core data save error with multiple persistent stores

2008-11-16 Thread Quincey Morris
On Nov 16, 2008, at 12:02, Arthur C. wrote: I take care that every object instance gets inserted into the right managedObjectContext, by using [NSEntityDescription insertNewObjectForEntityForName: ...]. And it gets assigned to the right persistent store by using - (void) awakeFromInsert {

Re: NSView positioning problems

2008-11-16 Thread Andy Lee
On Nov 16, 2008, at 2:41 PM, Quincey Morris wrote: There's not quite enough information here to be certain what's going on, but in a sense it shouldn't matter *when* you do the replacement, as long as it's an *exact* replacement at the time when you do it. In particular, that means: -- set

Re: NSArrayController bound to an array of strings

2008-11-16 Thread Andy Lee
On Nov 16, 2008, at 1:45 PM, Chris Suter wrote: The only trick I can think of is to use "string" as the model key and then, because NSString doesn't have a "string" method, you need to add a category method to NSString: - (NSString *)string { return self; } I don't know bindings, but it might

Core data save error with multiple persistent stores

2008-11-16 Thread Arthur C .
In my application I have two managed object contexts, as I need to be able to save two subsets of my Core Data setup separately. These are both using one and the same persistent store coordinator; the coordinator has two stores. I take care that every object instance gets inserted into the r

Re: NSView positioning problems

2008-11-16 Thread Quincey Morris
On Nov 16, 2008, at 10:25, Andre Masse wrote: In a nib, I have a view (OutputView) which contains a table view and a custom view (OutputToolbarView) which will be loaded from another nib. This view will end up in a NSTabView. So in IB, I placed a dummy custom view above the table view like

Re: NSView positioning problems

2008-11-16 Thread Iceberg-Dev
On Nov 16, 2008, at 7:25 PM, Andre Masse wrote: Hi all, In a nib, I have a view (OutputView) which contains a table view and a custom view (OutputToolbarView) which will be loaded from another nib. This view will end up in a NSTabView. So in IB, I placed a dummy custom view above the tab

Re: NSArrayController bound to an array of strings

2008-11-16 Thread Chris Suter
On Mon, Nov 17, 2008 at 4:45 AM, Meik Schuetz <[EMAIL PROTECTED]> wrote: > Dear all, > If have seen lots of examples in which a NSTableView is bound to an > NSArrayController which is bound to an array of entity objects, having > various properties. However I am now trying to bind a table column to

NSView positioning problems

2008-11-16 Thread Andre Masse
Hi all, In a nib, I have a view (OutputView) which contains a table view and a custom view (OutputToolbarView) which will be loaded from another nib. This view will end up in a NSTabView. So in IB, I placed a dummy custom view above the table view like this: - |

NSArrayController bound to an array of strings

2008-11-16 Thread Meik Schuetz
Dear all, If have seen lots of examples in which a NSTableView is bound to an NSArrayController which is bound to an array of entity objects, having various properties. However I am now trying to bind a table column to an array of strings and I don't seem to get this working. The string co

Re: Layer-backed NSOpenGLView not showing up

2008-11-16 Thread David Duncan
On Oct 3, 2008, at 9:46 AM, Albert Martin wrote: videoLayer = [[CALayer layer] retain]; NSOpenGLPixelFormatAttribute attributes[] = { NSOpenGLPFANoRecovery, NSOpenGLPFAColorSize, 24, NSOpenGLPFAAlphaSize, 8, NSOpenGLPFADepthSize, 16,

Re: Archiving NSError

2008-11-16 Thread Mike Abdullah
Have a look at the documentation for -writeToFile:atomically: In particular this quote: "This method recursively validates that all the contained objects are property list objects (instances of NSData, NSDate, NSNumber, NSString, NSArray, or NSDictionary) before writing out the file, and

Re: Archiving NSError

2008-11-16 Thread Jean-Daniel Dupas
Le 16 nov. 08 à 15:41, Vera Tkachenko a écrit : Hello to mac developers :) If I don't misunderstand things NSError objects can be archived because NSError implements NSCoding protocol. I try to archive it as follows: NSMutableDictionary * dict = [[NSMutableDictionary alloc]

Archiving NSError

2008-11-16 Thread Vera Tkachenko
Hello to mac developers :) If I don't misunderstand things NSError objects can be archived because NSError implements NSCoding protocol. I try to archive it as follows: NSMutableDictionary * dict = [[NSMutableDictionary alloc] init]; NSError * error = [[NSError alloc] initWith

Re: Playing around with BWToolKit

2008-11-16 Thread Brandon Walkin
On 16-Nov-08, at 5:10 AM, Nathan Kinsinger wrote: On Nov 16, 2008, at 1:50 AM, Brandon Walkin wrote: Hi Dave, If the user isn't able to configure the toolbar, then all you need to do is get a reference to the BWSelectableToolbar and call this method on it: - (void)switchToItemAtIndex:(

Re: Configure a button added in IB

2008-11-16 Thread Mikael Wämundson
Thanks! Works like a charm. Didn't work at first because I put theButton = [[NSButton alloc] init]; before the [theButton setTitle:@"send steve money"]; When that was removed, it worked ok (and you will probably get your money). wamund 16 nov 2008 kl. 02.48 skrev Steven Riggs: To do it fr

Re: Playing around with BWToolKit

2008-11-16 Thread Nathan Kinsinger
On Nov 16, 2008, at 1:50 AM, Brandon Walkin wrote: Hi Dave, If the user isn't able to configure the toolbar, then all you need to do is get a reference to the BWSelectableToolbar and call this method on it: - (void)switchToItemAtIndex:(int)anIndex animate:(BOOL)shouldAnimate The index is

Re: Playing around with BWToolKit

2008-11-16 Thread Brandon Walkin
Hi Dave, If the user isn't able to configure the toolbar, then all you need to do is get a reference to the BWSelectableToolbar and call this method on it: - (void)switchToItemAtIndex:(int)anIndex animate:(BOOL)shouldAnimate The index is the raw toolbar index - it's zero based and includes

Re: Finder's sidebar background color

2008-11-16 Thread Benjamin Dobson
Well, it is kind of a source list (a list of command descriptions). It is hard to explain in words, please take a look at the link to OnMyCommand I've posted earlier. However, I do think it really fits its purpose :D I agree, but I don't understand why a real source list doesn't do what y