Re: copy & isEqual nightmares

2012-02-15 Thread Uli Kusterer
On 14.02.2012, at 17:35, Quincey Morris wrote: > Yes, you're right, I rashly forgot to consider all the possibilities. There > is a kind of class whose instances are *not* (necessarily) isEqual to > themselves over time. I don't know that there's terminology for this -- > "mutable object" doesn'

Re: Odd display of percent character

2012-02-15 Thread Uli Kusterer
On 14.02.2012, at 17:53, Jens Alfke wrote: > On Feb 14, 2012, at 5:38 AM, Uli Kusterer wrote: >> In addition to this, whenever I do not actually need a format in a case like >> NSRunAlertPanel or whatever, I set the string to @"%@" and specify the >> actual string at the end in the ... section. T

IKPictureTaker crash

2012-02-15 Thread Appa Rao Mulpuri
Hi List, I am using IKPictureTaker class for getting the picture and crop an image. If I pass an image with one pixel width/ height its getting crashed and giving the following exception. Is there any way to prevent the crash. #0 0x7fff92d0c390 in objc_msgSend_vtable14 () #1 0x7ff

Re: How can I detect a mouse click outside a child window on Leopard?

2012-02-15 Thread Uli Kusterer
On 14.02.2012, at 14:39, Michael Crawford wrote: > I was just looking at the documentation for NSApplication and wondering if > overriding sendEvent is the way to go? I was thinking I could monitor events > dispatched to my app and then, when one arrives that is not destined for the > child win

Re: -[NSOutlineView ibIsInDesignMode]: unrecognized selector (???)

2012-02-15 Thread Uli Kusterer
On 14.02.2012, at 23:55, Kyle Sluder wrote: > On Tue, Feb 14, 2012 at 12:34 PM, Mikkel Eide Eriksen > wrote: >> Hi, >> >> I was going to implement a source list, but it's causing XCode and the >> Simulator to freak out. I did the following in my existing project (and then >> in a fresh projec

Re: -[NSOutlineView ibIsInDesignMode]: unrecognized selector (???)

2012-02-15 Thread Kyle Sluder
On Feb 15, 2012, at 1:18 AM, Uli Kusterer wrote: > Any chance of you posting this radar on http://openradar.me ? I'd love to > learn more about this issue. That's really pretty much all there is to it. I suppose it might be worth posting so others know about it, but the entire bug is that view

Re: Sandbox - Security Scoped URLs (10.7.3)

2012-02-15 Thread Kyle Sluder
On Feb 14, 2012, at 11:13 PM, Seth Willits wrote: > So 10.7.3 added URLs you can restore in a sandboxed process after relaunch > (AKA, needed by tons of apps that will be sandboxed), but I can't get them to > work. > > http://www.opensource.apple.com/source/CF/CF-635.19/CFURL.h > > Whenever I

Re: Custom UIView drawing but can't figure out when/where it's loading

2012-02-15 Thread Matt Neuburg
On Tue, 14 Feb 2012 18:48:10 -0600, William Squires said: >So what's the correct place to put initialization code for a custom UIView >subclass? Depends how it's instantiated. If in code, initWithFrame. But if from a nib, initWithFrame will never be called; instead, use initWithCoder or awakeFr

Re: Sandbox - Security Scoped URLs (10.7.3)

2012-02-15 Thread Mike Abdullah
On 15 Feb 2012, at 07:13, Seth Willits wrote: > So 10.7.3 added URLs you can restore in a sandboxed process after relaunch > (AKA, needed by tons of apps that will be sandboxed), but I can't get them to > work. > > http://www.opensource.apple.com/source/CF/CF-635.19/CFURL.h > > Whenever I try

[ Was NSReadPIxel ]

2012-02-15 Thread koko
Here is what I am trying to do. My users may scan a thread color say Robinson Anton Poly 40, by wrapping the thread around some cardboard stock and then placing this on the scanner bed. As you might imagine there will variations in the color due to the thread being wrapped … peaks , valleys, r

Re: NSEvent locationInWindow undefined for non-mouse events, how to catch?

2012-02-15 Thread Sean McBride
On Tue, 14 Feb 2012 21:08:38 -0800, Kyle Sluder said: >> Are you calling -type on the events you are receiving? Checking that >value should make it clear whether the event you have received is a >mouse event or not. If not, and you need the mouse location, you can >get if from NSEvent's +mouseLoc

Re: copy & isEqual nightmares

2012-02-15 Thread Quincey Morris
On Feb 15, 2012, at 00:50 , Uli Kusterer wrote: > Why would there ever be an object that is not -isEqual: to itself? Now you've > lost me. Sorry, it was a poor choice of words. I was just acknowledging the difference between (say) a NSMutableDictionary whose internal state changes over time wi

Re: NSEvent locationInWindow undefined for non-mouse events, how to catch?

2012-02-15 Thread Gary L. Wade
What it sounds like you're really asking in the latest part of this thread is for every object in a given runtime to track the messages called upon it with a time stamp in order to compare those for an exact ordering of calls conducive to your needs. That COULD be useful, but it would be really

Re: NSEvent locationInWindow undefined for non-mouse events, how to catch?

2012-02-15 Thread Sean McBride
On Wed, 15 Feb 2012 09:56:33 -0800, Gary L. Wade said: >What it sounds like you're really asking in the latest part of this >thread is for every object in a given runtime to track the messages >called upon it with a time stamp in order to compare those for an exact >ordering of calls conducive to

Re: NSEvent locationInWindow undefined for non-mouse events, how to catch?

2012-02-15 Thread Quincey Morris
On Feb 15, 2012, at 08:12 , Sean McBride wrote: > In the meantime, I'll create a category method that wraps locationInWindow > and delegates to mouseLocation or similar otherwise. Depending on how correct you want to be, you do have to be a bit cautious with this. +[NSEvent mouseLocation] isn't

Re: copy & isEqual nightmares

2012-02-15 Thread Jonathan Hull
This reminded me of this blog post, which you may find interesting: http://ridiculousfish.com/blog/posts/array.html Thanks, Jon On Feb 14, 2012, at 8:35 AM, Quincey Morris wrote: > NSDictionary may not use the value object hashes, but I don't see that > there's anything from preventing it from

receptionist pattern question: NSOperationQueue vs. GCD

2012-02-15 Thread Matt Neuburg
In Apple's delightful documentation of Chris Kane's Receptionist pattern (which I think of as a trampoline), the key method looks like this: - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { [queue addOperati

CGContextSaveGState

2012-02-15 Thread William Squires
Does this method store the context state in a stack, or just store it in a local variable (struct) somewhere (i.e. does calling this more than once overwrite the previously saved context info?) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Re: receptionist pattern question: NSOperationQueue vs. GCD

2012-02-15 Thread Matt Neuburg
This might be another way of phrasing the same question: why does the new iOS 5 method +[NSURLConnection sendAsynchronousRequest:queue:completionHandler:] want an NSOperationQueue as its queue rather than a dispatch queue? m. -- matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/ pa

Re: Sandbox - Security Scoped URLs (10.7.3)

2012-02-15 Thread Seth Willits
On Feb 15, 2012, at 5:49 AM, Kyle Sluder wrote: >> So 10.7.3 added URLs you can restore in a sandboxed process after relaunch >> (AKA, needed by tons of apps that will be sandboxed), but I can't get them >> to work. >> >> http://www.opensource.apple.com/source/CF/CF-635.19/CFURL.h >> >> Whenev

Block Behavior

2012-02-15 Thread koko
I need to know why a line of code that is OK outside a Block is invalid inside. = [sp beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) { if (result == NSFileHandlingPanelOKButton) { Str px("a"); prefs.

Re: CGContextSaveGState

2012-02-15 Thread David Duncan
On Feb 15, 2012, at 11:22 AM, William Squires wrote: > Does this method store the context state in a stack, or just store it in a > local variable (struct) somewhere (i.e. does calling this more than once > overwrite the previously saved context info?) It stores it on a state stack that is ass

Re: CGContextSaveGState

2012-02-15 Thread Conrad Shultz
On 2/15/12 11:22 AM, William Squires wrote: > Does this method store the context state in a stack, or just store it > in a local variable (struct) somewhere (i.e. does calling this more > than once overwrite the previously saved context info?) It's a stack - a great many graphics operations would

Re: receptionist pattern question: NSOperationQueue vs. GCD

2012-02-15 Thread Seth Willits
On Feb 15, 2012, at 11:19 AM, Matt Neuburg wrote: > My question is simply this: in a world that has GCD, is there any reason why > we wouldn't have "queue" be a GCD dispatch queue (probably the main queue) > and call dispatch_asynch? I don't believe there's any difference in this example. >

Re: How can I detect a mouse click outside a child window on Leopard?

2012-02-15 Thread Seth Willits
On Feb 15, 2012, at 1:14 AM, Uli Kusterer wrote: > On 14.02.2012, at 14:39, Michael Crawford wrote: >> I was just looking at the documentation for NSApplication and wondering if >> overriding sendEvent is the way to go? I was thinking I could monitor >> events dispatched to my app and then, whe

Re: receptionist pattern question: NSOperationQueue vs. GCD

2012-02-15 Thread Sean McBride
On Wed, 15 Feb 2012 11:19:49 -0800, Matt Neuburg said: >My question is simply this: in a world that has GCD, is there any reason >why we wouldn't have "queue" be a GCD dispatch queue (probably the main >queue) and call dispatch_asynch? Putting it even more generally (and >this is probably my *real

__block __weak - am I doing this right?

2012-02-15 Thread Matt Neuburg
This appears to be working from all points of view (thank you, Instruments!): MyMandelbrotOperation* op = [[MyMandelbrotOperation alloc] initWithSize:self.bounds.size center:center zoom:1]; __block __weak id observer = [[NSNotification

Re: CGContextSaveGState

2012-02-15 Thread Fritz Anderson
On 15 Feb 2012, at 1:22 PM, William Squires wrote: > Does this method store the context state in a stack, or just store it in a > local variable (struct) somewhere (i.e. does calling this more than once > overwrite the previously saved context info?) It's stacked. From the first sentence of the

Re: [ Was NSReadPIxel ]

2012-02-15 Thread Seth Willits
On Feb 15, 2012, at 7:32 AM, koko wrote: > I want to capture a rect centered on the point where the user clicked so I > can get a best fit for the color. Here's a thought: [NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMovedMask handler:^(NSEvent * event){ if (e

Re: CGContextSaveGState

2012-02-15 Thread Seth Willits
On Feb 15, 2012, at 11:22 AM, William Squires wrote: > Does this method store the context state in a stack, or just store it in a > local variable (struct) somewhere (i.e. does calling this more than once > overwrite the previously saved context info?) It's a stack. Save pushes, Restore pops.

Re: CGContextSaveGState

2012-02-15 Thread Mike Abdullah
On 15 Feb 2012, at 19:22, William Squires wrote: > Does this method store the context state in a stack, or just store it in a > local variable (struct) somewhere (i.e. does calling this more than once > overwrite the previously saved context info?) To quote the docs: "Each graphics context ma

Re: receptionist pattern question: NSOperationQueue vs. GCD

2012-02-15 Thread Matt Neuburg
On Feb 15, 2012, at 12:53 PM, Sean McBride wrote: > Apple's always saying to use the highest level API available We must be watching different versions of the WWDC videos... :))) Backwards compatibility is a good reason on the desktop, but I'm on iOS and on iOS if you've got blocks you've got

Re: receptionist pattern question: NSOperationQueue vs. GCD

2012-02-15 Thread Mike Abdullah
Because it's a higher-level API answers pretty much all your questions. You have a little more easy flexibility with what you can do to an NSOperationQueue compared to raw GCD. To put it another way, what downside are you seeing to using NSOperationQueue? On 15 Feb 2012, at 19:32, Matt Neuburg

Re: CGContextSaveGState

2012-02-15 Thread Gideon King
The documentation says it pushes it on to a stack: "Pushes a copy of the current graphics state onto the graphics state stack for the context." It also says: "To restore your drawing environment to a previously saved state, you can use CGContextRestoreGState." with the clear implication that

Re: receptionist pattern question: NSOperationQueue vs. GCD

2012-02-15 Thread Kyle Sluder
On Wed, Feb 15, 2012 at 11:19 AM, Matt Neuburg wrote: > My question is simply this: in a world that has GCD, is there any reason why > we wouldn't have "queue" be a GCD dispatch queue (probably the main queue) > and call dispatch_asynch? Putting it even more generally (and this is > probably my

Re: CGContextSaveGState

2012-02-15 Thread Kyle Sluder
On Wed, Feb 15, 2012 at 11:22 AM, William Squires wrote: > Does this method store the context state in a stack, or just store it in a > local variable (struct) somewhere (i.e. does calling this more than once > overwrite the previously saved context info?) First line of the CGContextSaveGState

Re: copy & isEqual nightmares

2012-02-15 Thread Graham Cox
On 16/02/2012, at 4:39 AM, Quincey Morris wrote: > There are, of course, potentially, objects that aren't isEqual to themselves. Surely the first thing that -isEqual: does is to trivially accept the case where self == otherObject? Certainly when I've implemented -isEqual: I do that as a matte

Re: [ Was NSReadPIxel ]

2012-02-15 Thread Graham Cox
On 16/02/2012, at 2:32 AM, koko wrote: > Now we want to bring that thread color into our embroidery program. The > scanned image may be on any connected display. > > I want to capture a rect centered on the point where the user clicked so I > can get a best fit for the color. > > This is eas

Re: CGContextSaveGState

2012-02-15 Thread Nick Zitzmann
On Feb 15, 2012, at 12:22 PM, William Squires wrote: > Does this method store the context state in a stack, or just store it in a > local variable (struct) somewhere (i.e. does calling this more than once > overwrite the previously saved context info?) CoreGraphics state save/load operations

Re: Block Behavior

2012-02-15 Thread Mike Abdullah
Give us the full details. What specific error are you seeing? On 15 Feb 2012, at 20:14, koko wrote: > I need to know why a line of code that is OK outside a Block is invalid > inside. > > > > = >[sp beginSheetModalForWindow:[self window] completionHandler:^(NSInteger > r

Re: Block Behavior

2012-02-15 Thread David Duncan
Which compiler are you using? On Feb 15, 2012, at 12:14 PM, koko wrote: > I need to know why a line of code that is OK outside a Block is invalid > inside. > > > > = >[sp beginSheetModalForWindow:[self window] completionHandler:^(NSInteger > result) >{ >if (

Re: Block Behavior

2012-02-15 Thread Greg Parker
On Feb 15, 2012, at 12:14 PM, koko wrote: > I need to know why a line of code that is OK outside a Block is invalid > inside. > > = >[sp beginSheetModalForWindow:[self window] completionHandler:^(NSInteger > result) >{ >if (result == NSFileHandlingPanelOKButton

Re: Make Custom Struct Key-Value Coding Compliant

2012-02-15 Thread Richard Somers
SOLVED - Thanks for all the comments. On Feb 11, 2012, at 11:56 PM, Graham Cox wrote: > Making it an object is easy and usually it turns out that the desire to > resist doing that is misguided, based on some faulty assumptions. I decided to resist no longer and make my custom strut an object.

Re: __block __weak - am I doing this right?

2012-02-15 Thread Greg Parker
On Feb 15, 2012, at 12:58 PM, Matt Neuburg wrote: > This appears to be working from all points of view (thank you, Instruments!): > >MyMandelbrotOperation* op = >[[MyMandelbrotOperation alloc] initWithSize:self.bounds.size > center:center

Re: __block __weak - am I doing this right?

2012-02-15 Thread Roland King
I had a similar one the other week, same idea, notification I wanted to remove in its handler. I assume that before you added __block you were getting an exception in the block handler, EACCESS was mine I think. I also changed to a block variable and it started working. My presumption was th

Re: __block __weak - am I doing this right?

2012-02-15 Thread Wim Lewis
On 15 Feb 2012, at 12:58 PM, Matt Neuburg wrote: > * Why was I crashing until I said __block? Without __block, the value of the variable is copied into the block (effectively as a const local variable) when the block is created. With __block, both the code inside and outside the block referenc

Re: [ Was NSReadPIxel ]

2012-02-15 Thread Kyle Sluder
On Wed, Feb 15, 2012 at 7:32 AM, koko wrote: > Here is what I am trying to do. > > My users may scan a thread color say Robinson Anton Poly 40, by wrapping the > thread around some cardboard stock and then placing this on the scanner bed. > As you might imagine there will  variations in the colo

Re: Block Behavior

2012-02-15 Thread koko
Apple llvm 3.0 No matching member function for call to 'Set' Candidate function not viable: 'this' argument has type 'const BPreferences', but method is not marked const As you can see from what I included this error is not generated if the function being called is outside the block On Feb

Re: Block Behavior

2012-02-15 Thread Dave Zarzycki
Koko, Are you using C++? (Probably.) If you are, then do you have a "const" version of Set? (Probably not.) If the above is not true, then what is the exact compiler error, and can you reduce this down to a test case? Thanks! davez On Feb 15, 2012, at 3:14 PM, koko wrote: > I need to know

Re: receptionist pattern question: NSOperationQueue vs. GCD

2012-02-15 Thread Preston Sumner
On Feb 15, 2012, at 12:32 PM, Matt Neuburg wrote: > This might be another way of phrasing the same question: why does the new iOS > 5 method +[NSURLConnection sendAsynchronousRequest:queue:completionHandler:] > want an NSOperationQueue as its queue rather than a dispatch queue? m. In OS X 10.6

Re: Custom UIView drawing but can't figure out when/where it's loading

2012-02-15 Thread H. Miersch
>> Or is my installation of Xcode screwed up? > > Probably not. Why would you think that. It's not as unlikely as it sounds. i had an issue where xcode would crash so often it became impossible to get anything done. even loading a workspace would be enough to make it crash. reinstalling xcode

Re: ARC + return of autoreleased CFType

2012-02-15 Thread Matt Neuburg
On Thu, 20 Oct 2011 17:38:03 -0400, Bill Cheeseman said: > >Specifically, if your Cocoa method returns a CFTypeRef object retained, and >you don't put "Copy" or "Create" in the method name, Analyze reports a >"potential" memory leak. Go back and insert "Copy" or "Create" into the method >name,

Re: Block Behavior

2012-02-15 Thread Jens Alfke
On Feb 15, 2012, at 4:41 PM, koko wrote: > Candidate function not viable: 'this' argument has type 'const BPreferences', > but method is not marked const Blocks can’t modify variables in the enclosing scope unless the variables are marked ‘__block’. In C++ code, I suppose that extends to inter

Creating a file using NSURL

2012-02-15 Thread Quincey Morris
Am I missing something obvious here? I'm trying to create an empty file (prior to using a NSFileHandle to write its contents), and I have a URL for the place to create it, and I want to avoid path-based API where possible, and I'm targeting 10.6. The only URL-based file creation API I know of i