Re: stopping an application

2009-04-13 Thread Andrew Farmer
On 12 Apr 09, at 23:55, Arjun SM wrote: Use the 'do shell script' command do shell script kill -9 PID That should work. No, actually, don't do that. We are discussing Cocoa programming here. Running an Applescript that executes a shell script command that wraps a system call is an incredib

Re: How to create an ISO disc image

2009-04-13 Thread Charles Srstka
On Apr 12, 2009, at 6:37 PM, David wrote: How can I create an ISO disc image. Can the disc recording framework do it? What about the DiskImages framework? I can't find an API for it. I think the only way to do that is to use NSTask to launch /usr/bin/ hdiutil with the appropriate arguments.

static vs non-static. Recommendation needed.

2009-04-13 Thread Тимофей Даньшин
Hello. A foreword: In my application I need to allow the user to create a database. So i display a dialogue panel, collect all the necessary information about the db to be created and create a "DatabaseInfo" object. Then i pass that DatabaseInfo object to the DatabaseCreator to actually crea

Re: How to open two nibs at app launch ? Beginners question

2009-04-13 Thread Mario Kušnjer
On 2009.04.13, at 05:40, Quincey Morris wrote: It's not wrong at all. Separate nibs are the recommended way of doing this. You may just need to tell your window controller to display its window. Trying adding: [myWindowController showWindow: nil]; after you've initialized your

Re: static vs non-static. Recommendation needed.

2009-04-13 Thread Dave Keck
> Is it all right to init an object just to dealloc it in the next line (or > create an autorelease object using a convenience method for that matter)? I > mean, if i made it non-static, i would have something like this in the class > that uses it: > > DatabaseCreator *dbc = [DatabaseCreator creato

Re: [SOLVED ] NSPredicateEditorTemplateRow , pop up with Core Data objects

2009-04-13 Thread Dan Waltin
mmalc and Daniel Vollmer: thank you very much for your replies! I still haven't got the IBOutlet NSArrayController stuff to work, but I have solved my original problem: i.e. to populate the Core Data objects popup. I'm using a fetch predicate, quite straight forward. Kind regards Dan Walt

Re: How to open two nibs at app launch ? Beginners question

2009-04-13 Thread Quincey Morris
On Apr 13, 2009, at 01:14, Mario Kušnjer wrote: But I actually don't understand those application delegate's concept. How do I make something to delegate to something else (did I even get that right ?) ? Application delegate would be (in my case) an object added in MainMenu.nib that would

Re: static vs non-static. Recommendation needed.

2009-04-13 Thread Quincey Morris
On Apr 13, 2009, at 01:13, Тимофей Даньшин wrote: As i don't need that DatabaseCreator to exist for a long time i thought it better to make it completely static. Sorry if the terminology is wrong, but what i mean is: it cannot be initialized, it has no instance variables, it has no instance

Re: stopping an application

2009-04-13 Thread Luca C.
2009/4/13 Bill Janssen > > > I was afraid of that... Is there an easy way to do that from the > command line given its PID? Using an AppleEvent given the appropriate bundle id of the application is actually pretty easy.I have found this in one my quite old project: + (OSStatus)quitApplicationW

Re: How to open two nibs at app launch ? Beginners question

2009-04-13 Thread Mario Kušnjer
On 2009.04.13, at 11:15, Quincey Morris wrote: Not exactly. Make your application delegate (let's say its class is MyAppDelegate) separate from your window controller. So, the steps are: -- write a MyAppDelegate class (subclass of NSObject) -- in IB, drag an object into MainMenu.xib, and

Re: static vs non-static. Recommendation needed.

2009-04-13 Thread Gregory Weston
ok5.admin wrote: Hello. A foreword: In my application I need to allow the user to create a database. So i display a dialogue panel, collect all the necessary information about the db to be created and create a "DatabaseInfo" object. Then i pass that DatabaseInfo object to the DatabaseCreator to

Re: static vs non-static. Recommendation needed.

2009-04-13 Thread Тимофей Даньшин
But I might suggest you've omitted a couple of options. Would it be, for example, particularly evil if your DatabaseInfo object include a createDatabase method? Well, not exactly, i suppose. The point is that i create DatabaseInfo either before creating a new database or after opening an ex

Exit an Application

2009-04-13 Thread Luca Ciciriello
Hi All. I Know this, may be, is the most stupid question on this list by I'm pretty new using cocoa (I'm a C++ developer). I've created an application with a button "Exit" and I've connected it with the method: - (IBAction)exitApp:(id)sender { // TODO } Now my question is: "Which ca

Re: Exit an Application

2009-04-13 Thread Luca C.
[[NSApplication sharedApplication] terminate:self]; 2009/4/13 Luca Ciciriello > Hi All. > I Know this, may be, is the most stupid question on this list by I'm pretty > new using cocoa (I'm a C++ developer). > I've created an application with a button "Exit" and I've connected it with > the method

Re: Exit an Application

2009-04-13 Thread Filip van der Meeren
You could always call exit(); from C or [NSApp terminate:XXX]; Filip van der Meeren fi...@code2develop.com http://sourceforge.net/projects/xlinterpreter On 13 Apr 2009, at 16:13, Luca Ciciriello wrote: Hi All. I Know this, may be, is the most stupid question on this list by I'm pretty new us

Re: Exit an Application

2009-04-13 Thread Filip van der Meeren
You could always call exit(); from C or [NSApp terminate:XXX]; Filip van der Meeren fi...@code2develop.com http://sourceforge.net/projects/xlinterpreter On 13 Apr 2009, at 16:13, Luca Ciciriello wrote: Hi All. I Know this, may be, is the most stupid question on this list by I'm pretty new u

Need to find out why I get Cocoa error 256 . . .

2009-04-13 Thread Michael A. Crawford
Where can I find detail on the following error code? Or, can someone point me to information on how to effectively debug a failure for a CoreData -[NSManagedObjectContext save] invocation? 2009-04-13 10:17:28.625 SpecialOrders[4923:20b] Failed to save context with new data: Error Domain=NS

Re: Exit an Application

2009-04-13 Thread Luca Ciciriello
Thanks to everybody. You saved my life I'v released the application to my Boss just in time. Bye. Luca. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderat

Re: NSDocument reference held by NSSavePanel?

2009-04-13 Thread Michael Ash
On Sun, Apr 12, 2009 at 11:33 PM, Quincey Morris wrote: > Here's something strange. I have a NSDocument-based GC app whose data model > contains an object that uses a resource. (The resource is actually exclusive > access to a MMC-controlled device, but that's not really relevant.) The > object ha

Re: Best way to pass large objects between tasks?

2009-04-13 Thread Michael Ash
On Mon, Apr 13, 2009 at 2:09 AM, Oleg Krupnov wrote: > I need to pass objects from one task (child) to another (parent) on > the same machine. > > Currently I am considering two alternatives: Pipes vs Distributed > Objects, and my main concern is performance, because the object is > really large.

Re: How to open two nibs at app launch ? Beginners question

2009-04-13 Thread Michael Ash
On Mon, Apr 13, 2009 at 6:27 AM, Mario Kušnjer wrote: > > On 2009.04.13, at 11:15, Quincey Morris wrote: >> >> Not exactly. Make your application delegate (let's say its class is >> MyAppDelegate) separate from your window controller. So, the steps are: >> >> -- write a MyAppDelegate class (subcla

Re: How to open two nibs at app launch ? Beginners question

2009-04-13 Thread Filip van der Meeren
On 13 Apr 2009, at 17:21, Michael Ash wrote: On Mon, Apr 13, 2009 at 6:27 AM, Mario Kušnjer wrote: On 2009.04.13, at 11:15, Quincey Morris wrote: Not exactly. Make your application delegate (let's say its class is MyAppDelegate) separate from your window controller. So, the steps are:

Re: NSDocument reference held by NSSavePanel?

2009-04-13 Thread Corbin Dunn
On Apr 12, 2009, at 8:33 PM, Quincey Morris wrote: (gdb) info gc-roots 0x1225400 Number of roots: 1 Root: 0 Kind: global rc: 0 Address: 0xa03f1214 Symbol: shared.176062 warning: can't find class named `NSToolTipManager' given by ObjC class object 1 Kind: object rc: 0 Address: 0x0

Re: NSDocument reference held by NSSavePanel?

2009-04-13 Thread Quincey Morris
On Apr 13, 2009, at 08:08, Michael Ash wrote: Can you really withstand having that exclusive resource be occupied for seconds after your document closes? Actually, in this case, yes. If the GC decides not to collect that object for a much longer period of time, say, six years, which it is pe

Re: NSDocument reference held by NSSavePanel?

2009-04-13 Thread Quincey Morris
On Apr 13, 2009, at 09:05, Corbin Dunn wrote: This may be a bug in NSSavePanel accidentally referencing something too long (with a root!). Please log a bug on this, and if possible, provide a test app that reproduces the problem. As a work around, try setting the delegate to nil on the NSSa

Re: How to open two nibs at app launch ? Beginners question

2009-04-13 Thread Quincey Morris
On Apr 13, 2009, at 08:29, Filip van der Meeren wrote: Instead of overriding the init method, you could override windowNibName - (NSString*)windowNibName { return @"MyNibName"; } and then just call your WindowController alloc init methods... This doesn't look correct. This pattern is used

Re: NSDocument reference held by NSSavePanel?

2009-04-13 Thread Michael Ash
On Mon, Apr 13, 2009 at 12:34 PM, Quincey Morris wrote: > On Apr 13, 2009, at 08:08, Michael Ash wrote: > >> Can you really withstand having that exclusive resource be occupied >> for seconds after your document closes? > > Actually, in this case, yes. > >> If the GC decides not to >> collect that

Dynamically getting the type of ivars

2009-04-13 Thread Dave DeLong
Hey everyone, Is there a way to get the class of an ivar that's an object? I know that I can call ivar_getTypeEncoding() on the Ivar and get a c string of the type encoding, and I've noticed that many of the Ivars that are objects are of the form @"{class name}". Is that consistent? Can

Simple mac server app seems can't receive incoming connection (code signing problem?)

2009-04-13 Thread Bill So
Hi I have developed a simple TCP/IP server based on a very simple custom protocol. It works perfectly fine without enabling Leopard's firewall. But when firewall is enabled, the server just cannot accept incoming connection after the system has started up. This means, every time the mac is rebo

Re: NSDocument reference held by NSSavePanel?

2009-04-13 Thread Quincey Morris
On Apr 13, 2009, at 10:07, Michael Ash wrote: I'm confused. If you can't stand six years then you can't rely on -finalize. Nothing guarantees that it will *ever* be called in a timely fashion. No need to be confused. I was just admitting your correctness and then hiding behind a smiley face.

Re: Dynamically getting the type of ivars

2009-04-13 Thread Nick Zitzmann
On Apr 13, 2009, at 11:10 AM, Dave DeLong wrote: Can I reliably pull out that stuff in between the quotes to get the class of the Ivar? (This seems sketchy to me...) Is this the best way to do this? No. If not, what do I need to do to get the Ivar's type? Just use the -class and +cl

Re: Dynamically getting the type of ivars

2009-04-13 Thread Dave DeLong
I don't think that'll work. Here's what I'm doing: unsigned int numIvars = 0; Ivar * ivars = class_copyIvarList(aClass, &numIvars); for (int i = 0; i < numIvars; i++) { Ivar thisIvar = ivars[i]; Class ivarClass = somethingToGetTheIvarClassIfItsAnObject(thisIvar); } I can check to see if an

Re: Need to find out why I get Cocoa error 256 . . . (more info)

2009-04-13 Thread Michael A. Crawford
When I change the persistent-store type from SQLite to Binary, my code works. I'm able to save the Managed Object Context. On the next run, my fetch works because there is not data in the persistent store. Anyone have any idea why the store type makes the difference? /** Returns the per

Re: Dynamically getting the type of ivars

2009-04-13 Thread Greg Guerin
Dave DeLong wrote: unsigned int numIvars = 0; Ivar * ivars = class_copyIvarList(aClass, &numIvars); for (int i = 0; i < numIvars; i++) { Ivar thisIvar = ivars[i]; Class ivarClass = somethingToGetTheIvarClassIfItsAnObject(thisIvar); } I can check to see if an Ivar is an object by checking to

Re: Dynamically getting the type of ivars

2009-04-13 Thread Dave DeLong
Again, I don't think that's what I'm looking for. For example, let's say I create a class called "Bogus", that has one ivar, a pointer to another Bogus object. Let's say I get the Ivar pointer via the class_copyIvarList function, and then print the typeEncoding of the Bogus ivar, like this

Re: Dynamically getting the type of ivars

2009-04-13 Thread Greg Parker
On Apr 13, 2009, at 1:41 PM, Dave DeLong wrote: Still not what I'm looking for. I have an Ivar pointer, and I want to get its static type (if it has one). You can't. The runtime metadata for ivars does not include the static type for objects. Sorry. The BridgeSupport metadata for system l

NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS

2009-04-13 Thread jonat...@mugginsoft.com
Is this a known issue with NSDecimalNumber ? NSDecimalNumber *n1 = (NSDecimalNumber *)[NSDecimalNumber numberWithDouble:1.0]; NSDecimalNumber *n2 = nil; n = [n decimalNumberByAdding:n2]; result = EXC_BAD_ACCESS There seems to be nothing in the docs to suggest that the parameter is unduly s

Re: NSDocument reference held by NSSavePanel?

2009-04-13 Thread David Scheidt
On Apr 13, 2009, at 2:01 PM, Quincey Morris wrote: On Apr 13, 2009, at 10:07, Michael Ash wrote: I'm confused. If you can't stand six years then you can't rely on -finalize. Nothing guarantees that it will *ever* be called in a timely fashion. No need to be confused. I was just admitting yo

Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS

2009-04-13 Thread iseecolors
In the third line where you do the assignment, do you mean to work with n1, or is there another object somewhere? Rich On Apr 13, 2009, at 1:47 PM, jonat...@mugginsoft.com wrote: Is this a known issue with NSDecimalNumber ? NSDecimalNumber *n1 = (NSDecimalNumber *)[NSDecimalNumber numberW

Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS

2009-04-13 Thread jonat...@mugginsoft.com
Dumb typo corrected: NSDecimalNumber *n1 = (NSDecimalNumber *)[NSDecimalNumber numberWithDouble:1.0]; NSDecimalNumber *n2 = nil; n1 = [n1 decimalNumberByAdding:n2]; result = EXC_BAD_ACCESS There seems to be nothing in the docs to suggest that the parameter is unduly sensitive. On 13 Apr

Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS

2009-04-13 Thread Kyle Sluder
On Mon, Apr 13, 2009 at 4:47 PM, jonat...@mugginsoft.com wrote: > NSDecimalNumber *n2 = nil; > n = [n decimalNumberByAdding:n2]; You can't assume that nil is a valid argument. So no, the lack of any documentation stating that "passing nil will blow up" is not a bug. --Kyle Sluder __

typeFromFileExtension in Leopard SDK

2009-04-13 Thread Eric Slosser
When I switched my SDKROOT from 10.4 to 10.5, my calls to - [NSDocumentController typeFromFileExtension:] started returning nil. - with Xcode 3.1.1 on Leopard 10.5.6 - make a new Cocoa NSDocument app - in the target info window, properties pane, assign a document type, giving it name

Re: Dynamically getting the type of ivars

2009-04-13 Thread Dave DeLong
Thanks for the definitive answer. My observations indicate that every statically typed object has a type encoding of @"ClassName", so I'm going ahead with my original plan to pull the class out of that (I still don't like it, but I need that class). Dave On Apr 13, 2009, at 2:44 PM, Greg

Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS

2009-04-13 Thread jonat...@mugginsoft.com
On 13 Apr 2009, at 22:13, Kyle Sluder wrote: On Mon, Apr 13, 2009 at 4:47 PM, jonat...@mugginsoft.com wrote: NSDecimalNumber *n2 = nil; n1 = [n1 decimalNumberByAdding:n2]; You can't assume that nil is a valid argument. So no, the lack of any documentation stating that "passing nil will blo

Re: typeFromFileExtension in Leopard SDK

2009-04-13 Thread Kyle Sluder
On Mon, Apr 13, 2009 at 5:15 PM, Eric Slosser wrote: > I see in the release notes for Leopard that -[NSDocumentController > typeFromFileExtension:] is deprecated, but that doesn't mean "stops > working", does it? Not necessarily. > Am I doing something wrong? Did you declare your com.comp.app.d

Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS

2009-04-13 Thread Kyle Sluder
On Mon, Apr 13, 2009 at 5:29 PM, jonat...@mugginsoft.com wrote: > Whatever way you slice it, bug or not, this is fairly toxic behaviour. You can't dereference a null pointer, and you can't divide by zero. Must every possible occurrence of these be marked? nil is a very special value. Sometimes

Re: Dynamically getting the type of ivars

2009-04-13 Thread Kyle Sluder
On Mon, Apr 13, 2009 at 5:29 PM, Dave DeLong wrote: > Thanks for the definitive answer.  My observations indicate that every > statically typed object has a type encoding of @"ClassName", so I'm going > ahead with my original plan to pull the class out of that (I still don't > like it, but I need

Autosaving the selection in an NSTableView

2009-04-13 Thread Martin Stanley
I have a core-data document-based application that uses a NSTableView with an NSArrayController as its data source. I have managed to figure out the magic IB incantations required to save the column sort, order and hidden data to the shared NSDeafulsController. What I would like to do is to

Re: Best way to pass large objects between tasks?

2009-04-13 Thread Yoshiaki Katayanagi
Oleg Krupnov wrotes >I haven't tried either of the methods I mentioned so far (because I'm >lazy, sorry:), but what I have tried is I created NSData from the >large object by using NSKeyedArchiver. It has taken forever, so that I >had to force-quit the process. That's why I am asking if the same

CGContextClipToMask

2009-04-13 Thread aashram
I need to fill a shape which is in a image with a gradient fill like progress bar. Looking into CGContextClipToMask and using a mask to achieve this. Would this be the best way ? Does anyone have a very simple example where I have a grayspace mask and a image and doing a gradient fill. I am not ve

'Strange' issue with NSOutlineView in NSMenuItem

2009-04-13 Thread Marcel Trapman
Hi, I have set up an application as 'menuling' (if I am correct). For that I have created a menu in a nib file as well as an outline view. I linked the view of one of the menuitems to the outline view. Following that I have created a doubleclick method and linked that to the doubleclick acti

NSSliderCell, lockFocus question

2009-04-13 Thread Frederik Slijkerman
Hi all, This is my first question here. I'm trying to port a cross-platform app to OS X using Cocoa. I've already got good results so far, but sometimes it's difficult to find out how things are supposed to work. Currently I'm porting a custom slider control that needs to draw parts of the its i

Re: Exit an Application

2009-04-13 Thread Uli Kusterer
On 13.04.2009, at 16:19, Filip van der Meeren wrote: You could always call exit(); from C or [NSApp terminate:XXX]; Well, calling exit() is the best way to shoot yourself in the foot. That would exit the app immediately, without saving any unsaved documents, without writing any cached NS

Re: Dynamically getting the type of ivars

2009-04-13 Thread Dave DeLong
I understand the distinction, and your clarification has prompted me to think of another way I could do this. Currently, the code where I'm getting the list of Ivars is in a class method. However, I also have an instance method where I'm doing something very similar. I could move the typ

Re: Dynamically getting the type of ivars

2009-04-13 Thread Chris Hanson
What are you really trying to accomplish using the class information of an instance variable? Generally you should treat instance variables as 100% private to their class; their uses can change from version to version? -- Chris On Apr 13, 2009, at 2:29 PM, Dave DeLong wrote: Thanks for

Best way to get a non-repeating random number?

2009-04-13 Thread Eric E. Dolecki
I'd like to make sure a new random (int) number doesn't equal the previous. In ActionScript 3 I could just run a little while loop check against the previous value. So while it wasn't equal to the last it would be used. So this isn't using an Array by any means for anything. What's the best way to

Re: NSSliderCell, lockFocus question

2009-04-13 Thread Kyle Sluder
On Mon, Apr 13, 2009 at 4:30 PM, Frederik Slijkerman wrote: > Currently I'm porting a custom slider control that needs to draw parts > of the its interface, like the slider bar and the knob, in the OS style. > The code that I currently have draws this to a temporary bitmap to avoid > flicker on Wi

Re: NSSliderCell, lockFocus question

2009-04-13 Thread Uli Kusterer
On 13.04.2009, at 22:30, Frederik Slijkerman wrote: Currently I'm porting a custom slider control that needs to draw parts of the its interface, like the slider bar and the knob, in the OS style. The code that I currently have draws this to a temporary bitmap to avoid flicker on Windows and I

Re: Obvious NSSegmentedControl Bug?

2009-04-13 Thread Peter Ammon
This looks like a bug. I appreciate your taking the time to check and hopefully to file it. -Peter On Apr 12, 2009, at 1:22 PM, Seth Willits wrote: I need a sanity check before I file a bug report. sc is a 3-segment NSSegmentedControl with either Select One or Select Any as its mode.

Re: Best way to get a non-repeating random number?

2009-04-13 Thread Luca C.
This isn't objc related, but mostly c related. In order to get a random int you may want to use the rand() function. rand() returns a number between 0 and RAND_MAX, and you have to initialize this random generator by calling srand(). You can put every (unsigned) value you want in there, though i

Re: Best way to get a non-repeating random number?

2009-04-13 Thread Uli Kusterer
On 14.04.2009, at 01:44, Luca C. wrote: You can put every (unsigned) value you want in there, though in general it's used passing (unsigned)time(NULL) as parameter. This way you'll always get a different int. No you won't. It's a *random* number generator. The seed simply means you get a d

Re: Exit an Application

2009-04-13 Thread WT
On Apr 13, 2009, at 11:52 PM, Uli Kusterer wrote: Well, calling exit() is the best way to shoot yourself in the foot. That would exit the app immediately, without saving any unsaved documents, without writing any cached NSUserDefaults changes to the hard disk etc. Its effect in a regular

Re: NSDocument reference held by NSSavePanel?

2009-04-13 Thread Quincey Morris
On Apr 13, 2009, at 13:56, David Scheidt wrote: In general, though, it's perfectly reasonable to put off garbage collection for as long as possible. It's fairly expensive, and if there is no pressure on the resource being garbage-collected, it's perfectly reasonable to defer garbage collec

Re: Best way to get a non-repeating random number?

2009-04-13 Thread WT
On Apr 14, 2009, at 1:57 AM, Uli Kusterer wrote: On 14.04.2009, at 01:44, Luca C. wrote: You can put every (unsigned) value you want in there, though in general it's used passing (unsigned)time(NULL) as parameter. This way you'll always get a different int. No you won't. It's a *random* n

Re: Best way to get a non-repeating random number?

2009-04-13 Thread Uli Kusterer
On 14.04.2009, at 02:17, WT wrote: On Apr 14, 2009, at 1:57 AM, Uli Kusterer wrote: No you won't. It's a *random* number generator. The seed simply means you get a different sequence of random numbers. However, random really means RANDOM. I.e. it's perfectly possible to get the same number

Re: NSDocument reference held by NSSavePanel?

2009-04-13 Thread Michael Ash
On Mon, Apr 13, 2009 at 2:01 PM, Quincey Morris wrote: > If the answer is that it might take six years (i.e. more or less never) then > your earlier statement can't be true in any practical sense: > >> -finalize should do two things. First, it should clean up any memory >> allocations that aren't

Re: Best way to get a non-repeating random number?

2009-04-13 Thread Michael Ash
On Mon, Apr 13, 2009 at 7:57 PM, Uli Kusterer wrote: > On 14.04.2009, at 01:44, Luca C. wrote: >> >> You can put every (unsigned) value you want in there, though in >> general it's used passing (unsigned)time(NULL) as parameter.  This way >> you'll always get a different int. > >  No you won't. It

Re: stopping an application

2009-04-13 Thread Bill Janssen
Nick Zitzmann wrote: > > On Apr 12, 2009, at 7:48 PM, Bill Janssen wrote: > > > I was afraid of that... Is there an easy way to do that from the > > command line given its PID? > > > Not really. First, you need a window server connection; you cannot > send Apple events without one. Second, y

Re: stopping an application

2009-04-13 Thread Bill Janssen
Greg Guerin wrote: > Bill Janssen wrote: > > > I was afraid of that... Is there an easy way to do that from the > > command line given its PID? > > Use the osascript command. > > Form a query using a 'whose' clause to select the process ID. I > forget what the exact wording is, or whether to

Re: stopping an application

2009-04-13 Thread Bill Janssen
James W. Walker wrote: > tell app "System Events" to set x to file of first process whose unix > id is 902 > tell app (POSIX path of x) to quit Thanks, that "unix id is xxx" was what I was looking for. > Hmm, now what did this have to do with Cocoa? I didn't have to do this till I started usin

Re: stopping an application

2009-04-13 Thread Bill Janssen
"From the command line"... Luca C. wrote: > 2009/4/13 Bill Janssen > > > > > > I was afraid of that... Is there an easy way to do that from the > > command line given its PID? > > > Using an AppleEvent given the appropriate bundle id of the application is > actually pretty easy.I have found

Re: Best way to get a non-repeating random number?

2009-04-13 Thread Uli Kusterer
On 14.04.2009, at 02:36, Michael Ash wrote: Note that writing a proper shuffling algorithm is harder than it sounds. More properly, it's easy, but figuring out whether you got the correct one or one of the zillions of ones that look correct but aren't is difficult. Curious which ones look cor

Re: NSMatrix of NSButtonCells prototype bindings not applied to instances in matrix

2009-04-13 Thread Ron Lue-Sang
On Apr 6, 2009, at 19:35 , Ben Golding wrote: I've been trying to create a calendar matrix of days which are clickable to select a day in the month. It's a something of a classic example of using NSMatrix from what I've read but I'm trying to use bindings to hook it up. I am using an

Re: stopping an application

2009-04-13 Thread Uli Kusterer
On 14.04.2009, at 02:42, Bill Janssen wrote: % osascript -e 'tell application "/Applications/Utilities/foo.app" to quit' Avoid building and executing scripts if there's API. I hate tearing people a new one because they build a script and incorrectly escape special characters. E.g. imagin

Re: typeFromFileExtension in Leopard SDK

2009-04-13 Thread Eric Slosser
On Apr 13, 2009, at 5:29 PM, Kyle Sluder wrote: Did you declare your com.comp.app.doc1 UTI as an exported type in your Info.plist? Nope. Since you seemed to be suggesting that was the problem, I added the following to Info.plist. But it didn't help. Am I missing something?

Re: Best way to get a non-repeating random number?

2009-04-13 Thread Eric E. Dolecki
For an example I might want to generate numbers from 1 to 10 over and over. All I want to do is when I generate a new number is not allow it to equal the previously held value. I can imagine a few approaches but I just wanted to make sure I was using the most accepted way of doing it. E. On Mon, A

Re: Best way to get a non-repeating random number?

2009-04-13 Thread Michael Ash
On Mon, Apr 13, 2009 at 8:46 PM, Uli Kusterer wrote: > On 14.04.2009, at 02:36, Michael Ash wrote: >> >> Note that writing a >> proper shuffling algorithm is harder than it sounds. More properly, >> it's easy, but figuring out whether you got the correct one or one of >> the zillions of ones that

Re: NSDocument reference held by NSSavePanel?

2009-04-13 Thread David Scheidt
On Apr 13, 2009, at 8:14 PM, Quincey Morris wrote: On Apr 13, 2009, at 13:56, David Scheidt wrote: In general, though, it's perfectly reasonable to put off garbage collection for as long as possible. It's fairly expensive, and if there is no pressure on the resource being garbage-collecte

Re: Need to find out why I get Cocoa error 256 . . .

2009-04-13 Thread Jeremy W. Sherman
Hi Michael, You'll find the error defined in : NSFileReadUnknownError = 256, // Read error (reason unknown) —Jeremy On Mon, Apr 13, 2009 at 10:25 AM, Michael A. Crawford wrote: > Where can I find detail on the following error code?  Or, can someone point > me to in

Re: Need to find out why I get Cocoa error 256 . . .

2009-04-13 Thread Scott Anguish
Or, in the docs search for it in Xcode's Documentation window On 13-Apr-09, at 9:32 PM, Jeremy W. Sherman wrote: Hi Michael, You'll find the error defined in : NSFileReadUnknownError = 256, // Read error (reason unknown) —Jeremy On Mon, Apr 13, 2009 at 10:25 AM

Re: stopping an application

2009-04-13 Thread Jeremy W. Sherman
A caveat: typeApplicationBundleID just picks whichever target if there is more than one instance of an app with the same bundle id running. This can be the case if, for example, you're running both the current version of PowerPoint and an older version. typeProcessSerialNumber will always target th

Re: Obvious NSSegmentedControl Bug?

2009-04-13 Thread Seth Willits
Filed. #6787552. Thanks. -- Seth Willits On Apr 13, 2009, at 4:17 PM, Peter Ammon wrote: This looks like a bug. I appreciate your taking the time to check and hopefully to file it. -Peter On Apr 12, 2009, at 1:22 PM, Seth Willits wrote: I need a sanity check before I file a bug re

Re: Best way to get a non-repeating random number?

2009-04-13 Thread Gwynne Raskind
On Apr 13, 2009, at 8:36 PM, Michael Ash wrote: You can put every (unsigned) value you want in there, though in general it's used passing (unsigned)time(NULL) as parameter. This way you'll always get a different int. No you won't. It's a *random* number generator. The seed simply means you

Re: typeFromFileExtension in Leopard SDK

2009-04-13 Thread Michael Ash
On Mon, Apr 13, 2009 at 5:29 PM, Kyle Sluder wrote: > On Mon, Apr 13, 2009 at 5:15 PM, Eric Slosser wrote: >> I see in the release notes for Leopard that -[NSDocumentController >> typeFromFileExtension:] is deprecated, but that doesn't mean "stops >> working", does it? > > Not necessarily. It's

Re: NSDecimalNumber nil parameter to -decimalNumberByAdding: causes Mach exception EXC_BAD_ACCESS

2009-04-13 Thread Michael Ash
On Mon, Apr 13, 2009 at 5:29 PM, jonat...@mugginsoft.com wrote: > > On 13 Apr 2009, at 22:13, Kyle Sluder wrote: > >> On Mon, Apr 13, 2009 at 4:47 PM, jonat...@mugginsoft.com >> wrote: >>> >>> NSDecimalNumber *n2 = nil; >>> n1 = [n1 decimalNumberByAdding:n2]; >> >> You can't assume that nil is a

Re: Autosaving the selection in an NSTableView

2009-04-13 Thread Volker in Lists
Hi Martin, I archive the selectionIndexes of the array controller and store them within thecore data document's metadata. I think you need to serialize (archive) the selectionIndexes to be able to save it either in NSUserDefaults or anywhere else. When loading a CD document I check if the

Re: NSSliderCell, lockFocus question

2009-04-13 Thread Frederik Slijkerman
Hi Uli, Currently I'm porting a custom slider control that needs to draw parts of the its interface, like the slider bar and the knob, in the OS style. The code that I currently have draws this to a temporary bitmap to avoid flicker on Windows and I'd like to keep it like this as much as possibl