Re: os x gui scripting

2008-12-21 Thread Andrew Farmer
On 21 Dec 08, at 06:47, Luca Cioria wrote: First, I know little of os x programming since I bought my mac 2 weeks ago. I'd like to develop a set of command line tools that do gui scripting stuff. Some examples: click --> clicks the mouse at x y coordinates, optionally relative to current w

Toll Free Garbage

2008-12-21 Thread Gerriet M. Denkmann
Assume some plug-in, which must work with garbage collection on or off. Assume further, that there is a method (not under our control): - (NSString *)copySomething; And that this method returns either an NSString* or a toll free bridged CFStringRef, of which we are the owner (because the name

Re: Xcode Question

2008-12-21 Thread Robert Marini
This is probably better suited for the Xcode-users list http://lists.apple.com/mailman/listinfo/xcode-users but since it's here - this has most of what you're asking about http://cocoasamurai.blogspot.com/2008/02/complete-xcode-keyboard-shortcut-list.html -rob. On Dec 22, 2008, at 2:27 AM, Boo

Xcode Question

2008-12-21 Thread Boon Chew
Hi all, I am starting to develop heavily in XCode, and would like to find out what keyboard shortcuts you use most frequently (or you find to be most useful to know)? Also, is there a way to jump quickly between matching [ ]? (so I can easily nest more messages when I need to) Thanks. - boon

Re: Managed Object won't dealloc even after Hit with Kitchen Sink

2008-12-21 Thread Jerry Krinock
On 2008 Dec, 21, at 22:26, Quincey Morris wrote: The only control you have in general is to *prevent* an object from being deallocated, not to *force* an object to be deallocated. Thank you, Quincey, I see what you mean. Probably because I have never before seen an object ^not^ be dealloc

Re: NSMutableArray sorting

2008-12-21 Thread Robert Marini
I've never seen it documented though perceived performance would indicate this is indeed the case. I've rarely come across a case where sort descriptors weren't "fast enough" (indeed, given how well they work with bindings it is somewhat essential). In general, if this route is too slow t

Re: os x gui scripting

2008-12-21 Thread Robert Marini
I don't know how many on this list will be able to offer a solution. My method of accomplishing this sort of work in the past has been to ensure that my applications are scriptable and then executing automator workflows against them. If that's not a good route to take for you (I would enc

Re: Managed Object won't dealloc even after Hit with Kitchen Sink

2008-12-21 Thread Quincey Morris
(Comments sprinkled through your long post) On Dec 21, 2008, at 21:17, Jerry Krinock wrote: REAL-LIFE PROBLEM In a managed memory application, I have a managed object which, besides its Core Data managed properties, has a single instance variable, a worker-kind of object which does some he

Color space for cmyk eps images converting to rgb

2008-12-21 Thread Ken Tozier
Hi If you open an eps image in a text editor like BBEdit, you can see clearly what color space it was saved as but when you create an NSImage from the file and call [image representations] or [image bestRepresentationForDevice: ] all you get are images with "NSCalibratedRGBColorSpace." Mo

Managed Object won't dealloc even after Hit with Kitchen Sink

2008-12-21 Thread Jerry Krinock
REAL-LIFE PROBLEM In a managed memory application, I have a managed object which, besides its Core Data managed properties, has a single instance variable, a worker-kind of object which does some heavy lifting for it. So that this retained worker, etc., will be deallocced, I need this ma

Need advice on creating a new document from within another document

2008-12-21 Thread WT
Hello folks, in the document-based application I'm writing, a document shows in its window some graphics resulting from some long-running computations. The user can then select a rectangular area of that graphical output and, by double-clicking on it, zoom in on it by creating a *new* doc

Number Formatter Problems in IB

2008-12-21 Thread Avery Nickelby
I've looked through the archives and the documentation; most of the information is related to using NSNumberFormatter programatically. I am looking for a good explanation for using 10.4 style data formatters; when I configure a number data formatter I can only get one of two behaviors (I've tried d

os x gui scripting

2008-12-21 Thread Luca Cioria
First, I know little of os x programming since I bought my mac 2 weeks ago. I'd like to develop a set of command line tools that do gui scripting stuff. Some examples: click --> clicks the mouse at x y coordinates, optionally relative to current window, can be single click, double click, right, m

introduction and question of nesting NSCollectionView

2008-12-21 Thread Greg Beaver
Hi, I'm new to cocoa, having acquired a macbook pro in September. I have a question regarding an application I am working on. It is a port of a program originally written as an ajax app with javascript front and php/mysql backend that is used for running the internals of a summer music program t

Re: NSMutableArray sorting

2008-12-21 Thread Scott Ribe
> Have you tried using NSSortDescriptor for sorting? It caches the > result of valueForKeyPath: internally, and is quite fast (as long as > you don't subclass it). No. The documentation doesn't mention caching of values, and I had no idea it would do that. -- Scott Ribe scott_r...@killerbytes.c

Re: NSMutableArray sorting

2008-12-21 Thread Michael Ash
On Sun, Dec 21, 2008 at 10:08 PM, John Nairn wrote: > Yes, I think the key is that the expensive calculation is done only once for > each object rather than every time a comparison needs to be made. After the > caching, my approach does all the searching in one method using swaps of > integers. I

Re: NSMutableArray sorting

2008-12-21 Thread Adam R. Maxwell
On Dec 21, 2008, at 8:23 PM, Scott Ribe wrote: Yes, I think the key is that the expensive calculation is done only once for each object rather than every time a comparison needs to be made. Yes, largely. It is possible that the overhead from Objective-C method calls to a comparison select

Re: NSMutableArray sorting

2008-12-21 Thread Scott Ribe
> Yes, I think the key is that the expensive calculation is done only once for > each object rather than every time a comparison needs to be made. Yes, largely. It is possible that the overhead from Objective-C method calls to a comparison selector could then be significant after that optimization

Re: NSMutableArray sorting

2008-12-21 Thread John Nairn
On Dec 21, 2008, at 9:20 AM, Scott Ribe wrote: 1. Building a c++ array of integers with indices to the new sort order 2. Precalculate all crucial sort terms (that depend on external data) for the objects to be sorted. 3. Sort the index array manually (e.g., a shell sort from Numerical Recipes

NSFileManager copy -> AFP croaks on extended attributes

2008-12-21 Thread Gerd Knops
I am having trouble with NSFileManagers 'copyItemAtPath:toPath:error:' method: Assuming - the source path contains some files that use extended attributes - the destination is on an AFP mounted volume Under those circumstances copyItemAtPath:toPath:error:' fails and returns this error:

Re: Optimizing NSRectFill

2008-12-21 Thread Ken Thomases
On Dec 21, 2008, at 3:45 PM, Michael Ash wrote: However, something I didn't know: it appears that something coalesces mouseDragged: events. They don't pile up the way I thought I would. Rather, when you come back around, you only get one mouseDragged: with the latest location. In other words, wh

Re: Memory Management Q. 1 and 2

2008-12-21 Thread Robert Marini
Or if you want to store NSInvocation objects long-term, or if you need low latency processing, or if you want to be able to safely take the address of a global variable, or use the bytes pointer of a temporary NSData object without jumping through hoops, or GC can be nice, but there are a *to

Re: Memory Management Q. 1 and 2

2008-12-21 Thread Michael Ash
On Sun, Dec 21, 2008 at 3:04 PM, Andreas Mayer wrote: > > Am 21.12.2008 um 18:37 Uhr schrieb Bill Bumgarner: > >> Though still useful to know the above, for new code there is generally no >> reason to avoid GC: >> >> >> http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/In

Re: Optimizing NSRectFill

2008-12-21 Thread Michael Ash
On Sun, Dec 21, 2008 at 3:58 PM, Glenn L. Austin wrote: > On Dec 21, 2008, at 9:43 AM, Michael Ash wrote: > >> On Sun, Dec 21, 2008 at 11:49 AM, Scott Ribe >> wrote: >>> >>> I guess what Mike is proposing is that redrawing in response to >>> setNeedsDisplay is only deferred until the end of handl

Fwd: Stacks & Memory Management.

2008-12-21 Thread Robert Marini
This shouldve gone to the list - Sent from my iPhone Begin forwarded message: From: Robert Marini Date: December 21, 2008 4:04:40 PM EST To: Alex Kac Subject: Re: Stacks & Memory Management. Well, it was a dirty hack - I overrode -retain to retain every object twenty times and -release

Re: Stacks & Memory Management.

2008-12-21 Thread Alex Kac
Well yes, I know that :) I was meaning the sample he wrote. He said it was a contrived sample to show this and I was simply interested in seeing the sample because I find them informative. On Dec 21, 2008, at 2:37 PM, Bill Bumgarner wrote: On Dec 21, 2008, at 12:31 PM, Alex Kac wrote: For

Re: Optimizing NSRectFill

2008-12-21 Thread Glenn L. Austin
On Dec 21, 2008, at 9:43 AM, Michael Ash wrote: On Sun, Dec 21, 2008 at 11:49 AM, Scott Ribe > wrote: I guess what Mike is proposing is that redrawing in response to setNeedsDisplay is only deferred until the end of handling the current event? (And therefore only improves things when there are

Re: Stacks & Memory Management.

2008-12-21 Thread Bill Bumgarner
On Dec 21, 2008, at 12:31 PM, Alex Kac wrote: For curiosity sake - care to share? The retain count of any given objet at any given time is entirely an implementation detail. If you can guarantee that an instance of a class that you created has *never* passed through *any* of the system pr

Re: Stacks & Memory Management.

2008-12-21 Thread Alex Kac
For curiosity sake - care to share? On Dec 21, 2008, at 11:32 AM, Robert Marini wrote: Do not look at the retain counts. Down that path lies madness. Frankly, -retainCount should be removed (or, better, modified to just return rand()). b.bum Wiser words were never spoken (I actually pr

Re: selectionShouldChangeInTableView called twice

2008-12-21 Thread Andre Masse
On Dec 21, 2008, at 14:47, Andreas Mayer wrote: I'm using a similar design, not by locking the fields but setting a "isDirty" flag in the model after the user start editing the record. That's exactly the point I was trying to make. Editing should be a distinct mode, consciously chosen by

Re: Memory Management Q. 1 and 2

2008-12-21 Thread Andreas Mayer
Am 21.12.2008 um 18:37 Uhr schrieb Bill Bumgarner: Though still useful to know the above, for new code there is generally no reason to avoid GC: http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Introduction.html Unless you want your code to run on anything before

Re: selectionShouldChangeInTableView called twice

2008-12-21 Thread Andreas Mayer
Am 21.12.2008 um 20:47 Uhr schrieb Andreas Mayer: What about - (NSIndexSet *)tableView:(NSTableView *)tableView selectionIndexesForProposedSelection: (NSIndexSet*)proposedSelectionIndexes Ops. That's what you mentioned in your last sentence. Please ignore. :-}

Re: selectionShouldChangeInTableView called twice

2008-12-21 Thread Andreas Mayer
Am 21.12.2008 um 16:53 Uhr schrieb Andre Masse: I'm using a similar design, not by locking the fields but setting a "isDirty" flag in the model after the user start editing the record. That's exactly the point I was trying to make. Editing should be a distinct mode, consciously chosen by t

Re: Stacks & Memory Management.

2008-12-21 Thread Scott Ribe
> Overriding retain/release for the purpose of setting a breakpoint > shouldn't ever require touching retaincount. That was kind of my point: direct people away from retainCount, but don't direct them away from other forms of snooping into memory management activity. Note: also don't direct them t

Re: Stacks & Memory Management.

2008-12-21 Thread Robert Marini
Overriding retain/release for the purpose of setting a breakpoint shouldn't ever require touching retaincount. When I first started to play with cocoa a few years ago I recall attempting to use it to debug a retain cycle, it wasn't of any use and drove me mad(der) for a few minutes. Sent

Re: Stacks & Memory Management.

2008-12-21 Thread Scott Ribe
> Do not look at the retain counts. Down that path lies madness. > Frankly, -retainCount should be removed (or, better, modified to just > return rand()). I wonder if the documentation should be updated with an explicit warning: --- Because any number of framework objects may have retained an o

Re: Optimizing NSRectFill

2008-12-21 Thread Michael Ash
On Sun, Dec 21, 2008 at 11:49 AM, Scott Ribe wrote: > I guess what Mike is proposing is that redrawing in response to > setNeedsDisplay is only deferred until the end of handling the current > event? (And therefore only improves things when there are multiple calls on > the same view.) This is at

Re: Cocoa-dev Digest, Vol 5, Issue 2186

2008-12-21 Thread Michael Ash
On Sun, Dec 21, 2008 at 11:21 AM, Steve Wetzel wrote: > Thanks Mike, I thought about it a long time before posting, then posted, > then when going to bed realize the first part of what you said. I don't > need to create separate instances to push 100 objects onto the stack. Well actually no, you

Re: Memory Management Q. 1 and 2

2008-12-21 Thread mmalc Crawford
On Dec 21, 2008, at 9:09 AM, Nick Rogers wrote: These are 2 questions in a series of more upcoming ones. All memory management questions should be answered by this document: with the most concise summar

Re: Memory Management Q. 1 and 2

2008-12-21 Thread Bill Bumgarner
On Dec 21, 2008, at 9:09 AM, Nick Rogers wrote: While learning to program in cocoa, people usually start out without giving much thought to memory management especially about freeing the used up memory. I can say so, because I know a few people like that and also I'm one of them. My focus wa

Re: Stacks & Memory Management.

2008-12-21 Thread Robert Marini
Do not look at the retain counts. Down that path lies madness. Frankly, -retainCount should be removed (or, better, modified to just return rand()). b.bum Wiser words were never spoken (I actually presented a rather contrived piece of code at a local iphone meetup to demonstrate why eve

Re: (no subject)

2008-12-21 Thread Scott Ribe
> 1. Building a c++ array of integers with indices to the new sort order > 2. Precalculate all crucial sort terms (that depend on external data) > for the objects to be sorted. > 3. Sort the index array manually (e.g., a shell sort from Numerical > Recipes in C, pg 244 (my edition)) > 4. Once done,

Re: Memory Management Q. 1 and 2

2008-12-21 Thread Dave DeLong
Hi Nick, 1. Not releasing an object does not (that i've ever seen) crash an app. It does cause a memory leak (unless you clean it up elsewhere), which may *eventually* crash your app (if it runs out of memory), but that also seems unlikely. Is there a reason why you're not releasing th

Stacks & Memory Management.

2008-12-21 Thread Bill Bumgarner
On Dec 21, 2008, at 8:21 AM, Steve Wetzel wrote: Thanks Mike, I thought about it a long time before posting, then posted, then when going to bed realize the first part of what you said. I don't need to create separate instances to push 100 objects onto the stack. Actually, what Mike said

Memory Management Q. 1 and 2

2008-12-21 Thread Nick Rogers
Hi, While learning to program in cocoa, people usually start out without giving much thought to memory management especially about freeing the used up memory. I can say so, because I know a few people like that and also I'm one of them. My focus was on to get started on the project quickly a

Re: Optimizing NSRectFill

2008-12-21 Thread Scott Ribe
> I did a quick test. > I have a 1ms timer which just do -setNeedDisplay: on a small view. > And the result is that my timer callback is called 60 times per seconds. > If I remove the seetNeedDisplay: call, it is called 1000 times (as > expected). > > So I think that you're right (and that everyth

Re: Cocoa-dev Digest, Vol 5, Issue 2186

2008-12-21 Thread Steve Wetzel
You're very confused. When you assign something new to myObj, you're only affecting that one pointer. You don't affect anything else that has a reference to the original object. For example: NSString *str = @"hello"; [stack push:str]; str = @"world"; [stack push:str]; Your stack now contains @"h

Re: how to create a CIImage object from a given path safely?

2008-12-21 Thread Scott Andrew
I think the best method to create from a file is imageWithContentsOfURL.. CIImage* image = [CIImage imageWithContentsOfURL:[NSURL urlWithPath:somePath]]; Scott On Dec 21, 2008, at 7:50 AM, Alex.Wang wrote: Hi everyone. As the topic mentioned, I wanted to use a method to create a CIImage

Re: selectionShouldChangeInTableView called twice

2008-12-21 Thread Andre Masse
On Dec 21, 2008, at 09:27, Andreas Mayer wrote: All these cases somehow involve user errors. If this really is a problem, why not introduce a separate edit mode? I.e. in browse mode all fields in the detail pane are locked as in *not* editable. To edit anything the user has to enter edit mod

how to create a CIImage object from a given path safely?

2008-12-21 Thread Alex . Wang
Hi everyone. As the topic mentioned, I wanted to use a method to create a CIImage object from the given file path neatly, quickly and safely. I have investigated on these field for a while. However, since there are too many methods which can be used to do that, I don't know which one should be the

Re: selectionShouldChangeInTableView called twice

2008-12-21 Thread Andreas Mayer
Am 21.12.2008 um 04:14 Uhr schrieb Andre Masse: Now, suppose the user somehow move the focus from the detail view (by switching application and coming back, accidently clicking in the master view or whatever). This is a third case, he may have not completed its modifications and should be