GCD cancel handler invocation

2011-01-10 Thread Jonathon Kuo
I set up a source handler on a TCP socket like this: dispatch_source_t newsrc = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ,sockfd,0,globalQueue); It works well, and when a client process closes his socket my cancel_handler gets called, I clean up, and life is good. But if I do a

Re: GCD cancel handler invocation

2011-01-10 Thread Jonathon Kuo
On Jan 10, 2011, at 2:58 PM, Ken Thomases wrote: On Jan 10, 2011, at 4:20 PM, Dave Zarzycki wrote: On Jan 10, 2011, at 2:06 PM, Jonathon Kuo wrote: I set up a source handler on a TCP socket like this: dispatch_source_t newsrc = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ,sockfd,0

Re: Context in GCD source cancel handler?

2011-01-06 Thread Jonathon Kuo
On Jan 5, 2011, at 12:41 PM, Dave Keck wrote: Q: When a context object is set with dispatch_set_context(), is it retained? Or do I need to retain it first, set it, and then in the cancel handler release it? The 'context' argument is not retained. You can infer this primarily by the

Re: Context in GCD source cancel handler?

2011-01-06 Thread Jonathon Kuo
On Jan 6, 2011, at 1:15 PM, Fritz Anderson wrote: Taking by value to mean as many uninterpreted bits as will fit into a variable of type void*, yes. On Jan 6, 2011, at 1:14 PM, Dave Zarzycki wrote: Yes, that is the nature of void *. Nothing can be known about a void * other than the value

Re: Context in GCD source cancel handler?

2011-01-06 Thread Jonathon Kuo
of main(). Thereafter, Unix APIs like read(), write(), etc will return -1 and errno will be equal to EPIPE. davez On Jan 6, 2011, at 1:22 PM, Jonathon Kuo wrote: On Jan 6, 2011, at 1:15 PM, Fritz Anderson wrote: Taking by value to mean as many uninterpreted bits as will fit into a variable

Context in GCD source cancel handler?

2011-01-05 Thread Jonathon Kuo
When a GCD source gets cancelled, either via dispatch_source_cancel() or because the source went away, I have no context other than the dispatch_source_t source variable. How can I know for which source a source cancel handler gets invoked? I have many simultaneous sources (sockets, files,

Re: Context in GCD source cancel handler?

2011-01-05 Thread Jonathon Kuo
, at 10:58 AM, Jonathon Kuo wrote: When a GCD source gets cancelled, either via dispatch_source_cancel() or because the source went away, I have no context other than the dispatch_source_t source variable. How can I know for which source a source cancel handler gets invoked? I have many

cannot access __block variable of array type inside block

2010-12-14 Thread Jonathon Kuo
I'm trying to learn GCD and reading http://developer.apple.com/library/mac/#featuredarticles/BlocksGCD/index.html But the Global Concurrent Queues example in that document (last updated 2010-11-10) doesn't even compile. It complains about accessing array 'result' from within the block: #define

Re: cannot access __block variable of array type inside block

2010-12-14 Thread Jonathon Kuo
[COUNT]; } results; davez On Dec 14, 2010, at 7:30 PM, Jonathon Kuo wrote: I'm trying to learn GCD and reading http://developer.apple.com/library/mac/#featuredarticles/BlocksGCD/index.html But the Global Concurrent Queues example in that document (last updated 2010-11-10

Re: [iPhone] Toolbar button and Touch Down

2010-11-17 Thread Jonathon Kuo
On Nov 17, 2010, at 8:47 AM, Matt Neuburg wrote: On Nov 16, 2010, at 9:26 AM, Jonathon Kuo wrote: I agree: that's how I expected it to work, too, but that's not how it does work (Xcode 3.2.4). If I drag a Round Rect Button onto the Toolbar, it instantly gets promoted to a UIBarButtonItem

Re: [iPhone] Toolbar button and Touch Down

2010-11-17 Thread Jonathon Kuo
On Nov 17, 2010, at 10:54 AM, Matt Neuburg wrote: On Nov 17, 2010, at 10:25 AM, Jonathon Kuo wrote: One question though: Taking another poster's suggestion, I placed a UISwitch in the toolbar and set Touch Down on it. It does register, but only for the OFF - ON transition. Switching

Re: [iPhone] Toolbar button and Touch Down

2010-11-16 Thread Jonathon Kuo
On Nov 16, 2010, at 9:12 AM, Matt Neuburg wrote: On Mon, 15 Nov 2010 10:02:44 -0800, Jonathon Kuo newsli...@autonomy.caltech.edu said: Interesting idea, probably a little beyond me. :) Nonsense. This is perfectly standard and easy. A UIButton can send an action message on TouchDown

Re: [iPhone] Toolbar button and Touch Down

2010-11-15 Thread Jonathon Kuo
UIBarItem from NSObject. Since they're not really buttons, there doesn't appear any way to modify their behavior. If there is a way, I'd like to know, too... From: Jonathon Kuo newsli...@autonomy.caltech.edu To: Cocoa-Dev List cocoa-dev@lists.apple.com Sent

[iPhone] Toolbar button and Touch Down

2010-11-12 Thread Jonathon Kuo
I'm doing an iPhone 4.1 app and I have a toolbar at the bottom with bar buttons. The problem is that I need to set one of the bar buttons to Touch Down instead of the default Touch Up Inside but IB doesn't show any touch options for toolbar buttons (it does for buttons not in the toolbar). Is

Re: Get wrong tag value from NSPopupButtonCell

2010-10-29 Thread Jonathon Kuo
What's the point of doing this: NSPopUpButtonCell *testCell = [ [ [ NSPopUpButtonCell alloc] init] autorelease]; if you're doing this 2 lines later: testCell = [ olPopups selectedCell]; At this point, I would check for testCell being nil. -Jon On Oct 29, 2010, at 2:02 PM,

Re: NSImage is Caching

2010-10-05 Thread Jonathon Kuo
You're missing a [theImage release] at the end of your method. On Oct 5, 2010, at 2:46 PM, Chris Tracewell wrote: I have an NSImageView that accepts an image drop then sizes the image and ftp's it to a web server. The image view is bound to myObject.myImage property which set by a window

Re: Is it possible to set UISlider intervals?

2010-08-10 Thread Jonathon Kuo
On Aug 10, 2010, at 5:43 PM, Devraj Mukherjee wrote: Hi all, I am using UISliders in my iOS app. I can't see a way of setting the slide value interval. Is this possible? Or do I have to calculate the change based on the 0.1 increases? Minimum value set to -20 and Max to 20 and I want

Re: UIImageView and UIViewContentModeBottomLeft

2010-08-04 Thread Jonathon Kuo
On Aug 4, 2010, at 9:43 AM, David Duncan wrote: A UIView (really the CALayer owned by the view) can and will display content larger than its bounds if given to it. Is there a way to restrict this behavior, i.e., to make it that the UIView does not display content beyond its bounds? I'm

Re: Fast enumeration

2010-07-22 Thread Jonathon Kuo
On Jul 22, 2010, at 1:10 PM, Quincey Morris wrote: id _id; for (_id in array) { } if (_id) { } If I use this to go backward through the array: for (_id in [array reverseObjectEnumerator]) { } ...is it still considered 'fast' enumeration? -Jon

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Jonathon Kuo
On Jul 1, 2010, at 7:56 AM, Matt Neuburg wrote: Instance methods defined in a root class can be performed both by instances and by class objects. Therefore, all class objects have access to the instance methods defined in the root class. Not that it would generally be USEFUL to do so, since

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Jonathon Kuo
On Jul 1, 2010, at 9:49 AM, Kyle Sluder wrote: On Jul 1, 2010, at 9:42 AM, Jonathon Kuo newsli...@autonomy.caltech.edu wrote: On Jul 1, 2010, at 7:56 AM, Matt Neuburg wrote: Instance methods defined in a root class can be performed both by instances and by class objects. Therefore, all

Hit testing on NSTextField with custom cells

2010-03-18 Thread Jonathon Kuo
I've created a subclass of NSTextFieldCell that just adds the -hitTestForEvent:inRect:ofView: method. If I substitute my subclass in an NSTableView for the standard NSTextFieldCells, I do get this callback when a table element is clicked. But if I substitute my subclass in for an

Re: Clicking on an NSColorWell

2010-03-17 Thread Jonathon Kuo
mini color picker thingy. corbin On Mar 12, 2010, at 2:17 PM, Jonathon Kuo wrote: I need to generate an ad-hoc number of color swatches in a floating window so that when a user clicks on one of them, the 'active' color of a stylus will change to that color. Most likely NSColorWell

Clicking on an NSColorWell

2010-03-12 Thread Jonathon Kuo
How can I intercept or get notified when a user clicks on an NSColorWell? OSX 10.6.2 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at

Re: Clicking on an NSColorWell

2010-03-12 Thread Jonathon Kuo
: Subclass and override mouseDown: - however if you're trying to intercept right before the color panel is shown, or a drag starts, that may be trickier. What are you trying to do generally? On Mar 12, 2010, at 1:30 PM, Jonathon Kuo wrote: How can I intercept or get notified when a user clicks

Cocoa-based GPS framework?

2010-02-12 Thread Jonathon Kuo
There used to be an open source Cocoa-based GPS framework for OSX called FourCoordinates, but I can't find it anywhere on the web anymore, just dead links. Is there something more modern that has replaced it? ___ Cocoa-dev mailing list

Re: Cocoa-based GPS framework?

2010-02-12 Thread Jonathon Kuo
Location, which is pretty solid from my understanding. -Steven On Fri, Feb 12, 2010 at 11:57 AM, Jonathon Kuo newsli...@autonomy.caltech.edu wrote: There used to be an open source Cocoa-based GPS framework for OSX called FourCoordinates, but I can't find it anywhere on the web anymore

Multiple variable rules in for() statement

2009-11-12 Thread Jonathon Kuo
I can't chance upon the right incantation for using both an existing variable and an inline new one in a for loop. I've boiled this down to a trivial show case, same results for both gcc 4.0.1 and 4.2.1: int i; . . . for (i=0, int m=0; i5; i++) { . . . }; printf(Final value of i:

Re: Multiple variable rules in for() statement

2009-11-12 Thread Jonathon Kuo
On Nov 12, 2009, at 12:14 PM, Greg Parker wrote: On Nov 12, 2009, at 11:29 AM, Jonathon Kuo wrote: I can't chance upon the right incantation for using both an existing variable and an inline new one in a for loop. I've boiled this down to a trivial show case, same results for both gcc 4.0.1

Coding with VM limitation on the iPhone?

2009-08-18 Thread Jonathon Kuo
I'm writing an app for the iPhone, but I need to be mindful how much virtual memory there is available to the app when it runs, so I can manage allocing and deallocing some large arrays. I'm guessing that the OS runs in a small amount (100MB?) of flash memory compared to the 16GB or 32GB

Re: Coding with VM limitation on the iPhone?

2009-08-18 Thread Jonathon Kuo
On Aug 18, 2009, at 4:37 PM, Luke the Hiesterman wrote: Your app will not be paged to the disk at all. It must run entirely on in physical memory. To know when you're running out of memory, override -[UIViewController didReceiveMemoryWarning] On Aug 18, 2009, at 4:38 PM, Alex Kac wrote:

Re: NSNotificationQueue NSOperationQueue thread death

2009-05-06 Thread Jonathon Kuo
On May 4, 2009, at 8:12 PM, Ken Thomases wrote Re: 'A couple NSRunLoop questions': Every thread has exactly one run loop associated with it. You don't create run loops nor do you remove them. On May 5, 2009, at 9:24 PM, Michael Ash wrote Re: 'NSNotificationQueue NSOperationQueue thread

Re: NSNotificationQueue NSOperationQueue thread death

2009-05-06 Thread Jonathon Kuo
On May 6, 2009, at 9:03 AM, Michael Ash wrote: It is correct that every thread conceptually has exactly one runloop. I say conceptually because in fact they are created on demand. So if a thread has no need to pay attention to asynchronous events (timers, input sources, etc) but is only in

-hexValue for NSString?

2009-03-23 Thread Jonathon Kuo
In NSString theres -intValue, -floatValue, -doubleValue, but no - hexValue (that I can find). I'd like to convert ascii hex NSStrings (@001A4CD3 etc) into integer values. Having a -hexValue method would make that a snap. If theres no Cocoa way, I guess I could try my hand at writing a

Re: -hexValue for NSString?

2009-03-23 Thread Jonathon Kuo
success = [[NSScanner scannerWithString:string] scanHexInt:yourValueHere]; Ali On Mar 23, 2009, at 6:00 PM, Jonathon Kuo wrote: In NSString theres -intValue, -floatValue, -doubleValue, but no - hexValue (that I can find). I'd like to convert ascii hex NSStrings (@001A4CD3 etc) into integer

Re: - [NSBitmapImageRep tiffRepresentation] malloc error

2008-12-12 Thread Jonathon Kuo
On Dec 12, 2008, at 2:29 PM, Nick Zitzmann wrote: In most 32-bit programs, even trying to allocate hundreds of megabytes of contiguous RAM at once often fails due to memory fragmentation. Is there a function that allocates contiguous RAM? You mean VRAM, right? I thought anything you

Re: Announce the time every 30 minutes

2008-12-12 Thread Jonathon Kuo
On Dec 12, 2008, at 10:36 AM, has wrote: Mr. Gecko wrote: I'm trying to find out how to announce the time every 30 minutes, You could run 'say `date`' as a cron job. Interesting. The speaker translates Fri Dec 12 17:52:58 PST 2008 into these spoken words: free december twelfth

Re: D.O. [NSPortCoder sendBeforeTime:sendReplyPort:] timed out

2008-12-08 Thread Jonathon Kuo
No, we were never able to find a fix or workaround for this. We're operating now on the assumption that it's an unfixable design flaw in DO. This makes for a very fragile client/server implementation. Jonathon On Dec 6, 2008, at 1:31 AM, Bridger Maxwell wrote: Hey, Did you ever figure

NSImageView antialiasing when scaling up images

2008-12-02 Thread Jonathon Kuo
I have some tiny images (4x3, etc) that I'm displaying in a large NSImageView. I set the view with setImageScaling:NSScaleToFit. This works, but instead of getting well-defined block 'pixels', I get sort of a 'shower-door' gradient effect within each pixel block. inline: Picture 59.png

Re: NSImageView antialiasing when scaling up images

2008-12-02 Thread Jonathon Kuo
: NSImageInterpolationNone]; On 2 Dec 2008, at 23:45, Jonathon Kuo wrote: I have some tiny images (4x3, etc) that I'm displaying in a large NSImageView. I set the view with setImageScaling:NSScaleToFit. This works, but instead of getting well-defined block 'pixels', I get sort of a 'shower-door

Re: Wrapping C functions in Objective C proxy objects: naming convention?

2008-11-20 Thread Jonathon Kuo
On Nov 19, 2008, at 9:27 PM, Austin Ziegler wrote: For a project that I'm working on, I have a need to write a code generator that will wrap certain kinds of C functions as Objective C messages on an Objective C proxy. Because I don't ultimately control the input, the parameters on the C

Re: Wrapping C functions in Objective C proxy objects: naming convention?

2008-11-20 Thread Jonathon Kuo
On Nov 20, 2008, at 2:07 PM, Shawn Erickson wrote: On Thu, Nov 20, 2008 at 1:23 PM, Jonathon Kuo [EMAIL PROTECTED] wrote: Just my 2 cents, but it seems an abuse to turn functions into objects. Functions don't retain state; objects do. Objective C very gracefully allows objects to call C

Re: Wrapping C functions in Objective C proxy objects: naming convention?

2008-11-20 Thread Jonathon Kuo
On Nov 20, 2008, at 5:06 PM, Charles Srstka wrote: On Nov 20, 2008, at 5:58 PM, Jonathon Kuo wrote: On Nov 20, 2008, at 2:07 PM, Shawn Erickson wrote: On Thu, Nov 20, 2008 at 1:23 PM, Jonathon Kuo [EMAIL PROTECTED] wrote: Just my 2 cents, but it seems an abuse to turn functions

Re: Wrapping C functions in Objective C proxy objects: naming convention?

2008-11-20 Thread Jonathon Kuo
On Nov 20, 2008, at 5:53 PM, Charles Srstka wrote: On Nov 20, 2008, at 7:40 PM, Jonathon Kuo wrote: On Nov 20, 2008, at 5:06 PM, Charles Srstka wrote: On Nov 20, 2008, at 5:58 PM, Jonathon Kuo wrote: On Nov 20, 2008, at 2:07 PM, Shawn Erickson wrote: On Thu, Nov 20, 2008 at 1:23 PM

Re: Delete myDriver.kext files from normal user.

2008-10-17 Thread Jonathon Kuo
On Oct 17, 2008, at 5:33 PM, Michael Ash wrote: On Fri, Oct 17, 2008 at 5:29 PM, Kyle Sluder [EMAIL PROTECTED] wrote: On Fri, Oct 17, 2008 at 5:17 PM, Jonathon Kuo [EMAIL PROTECTED] wrote: Just curious why the recommendation against system()? 1) There's no need for it here. Why launch