Re: How to get the dispatch queue for the current thread's runloop?

2012-01-28 Thread Wade Tregaskis
Where do they say that? That's surely wrong. The man page says that in that case it returns the default-priority global [serial] queue. Nevermind, I'm not paying enough attention. I figured you'd have to return a serial queue, so my brain conveniently ignored the fact that the global

Re: Open a new terminal tab or window from a Cocoa app at a certain directory without using NSAppleScript?

2012-01-28 Thread Ron Hunsinger
On Jan 26, 2012, at 11:30 AM, Jens Alfke wrote: To work around this I suggest using single-quotes instead, and preprocessing the string to insert a backslash in front of any exclamation point or single-quote. I *think* that will be enough. After a single quote, the *only* character that

Drag and drop in collectionview

2012-01-28 Thread Luc Van Bogaert
I'm implementing drag and drop for a NSCollectionView. The idea is to rearrange objects in the collection by dragging them to another location. Having read the docs for NSCollectionViewDelegate and NSPasteboard, I still have a few general questions about the concept. The objects themselves

Re: Blocks and Methods...

2012-01-28 Thread Mike Abdullah
On 28 Jan 2012, at 05:32, R wrote: I'm writing code in for iOS 5 Ok, in my async com class, I'm receiving a block in one method and want to execute it in the another method. I've concluded that I need to place the block in a property. The only way that has worked is via copy. Is

Re: Trying to customize UITableViewCell with IB but having odd exception

2012-01-28 Thread Phillip Mills
On 2012-01-28, at 1:55 AM, James West wrote: I get -[UIAccessibiltyBundle setProduct:] unrecognized selector sent to instance It looks as if the cell has been deallocated and its address reused to hold a different kind of object. (UIAccessibiltyBundle) If it's not obvious how this is

Re: Recently Opened in Doc

2012-01-28 Thread Brad Stone
I have a shoebox app like iPhoto where the actual filename is irrelevant to the user. I control the file name. What I'd like to do is just capture the menu items before they're displayed and change the menu titles into something relevant to the user. In the scheme of things it's a minor

Re: Blocks and Methods...

2012-01-28 Thread R
I originally chose to hold the block in an array, but that failed. I'm still confused over that... On Jan 28, 7:02 am, Mike Abdullah cocoa...@mikeabdullah.net wrote: On 28 Jan 2012, at 05:32, R wrote: I'm writing code in for iOS 5 Ok, in my async com class, I'm receiving a block in

Re: Recently Opened in Doc

2012-01-28 Thread Quincey Morris
On Jan 28, 2012, at 08:19 , Brad Stone wrote: I have a shoebox app like iPhoto where the actual filename is irrelevant to the user. I control the file name. What I'd like to do is just capture the menu items before they're displayed and change the menu titles into something relevant

Re: Blocks and Methods...

2012-01-28 Thread Ken Thomases
On Jan 28, 2012, at 10:40 AM, R wrote: I originally chose to hold the block in an array, but that failed. I'm still confused over that... By itself, an array only retains the block. A block must be explicitly copied if it is to outlive the scope that created it. And, of course, that copy

Re: How to get the dispatch queue for the current thread's runloop?

2012-01-28 Thread Steve Sisak
At 12:14 PM -0800 1/27/12, Jens Alfke wrote: I'm really used to using -performSelector:withObject:afterDelay: to make something happen later. But I'd much rather use a block than a target/action. I can't find any API for this, however. Am I missing something? What I want is basically like

Re: Full-Height Toolbar Item

2012-01-28 Thread Mark Alldritt
On 2012-01-27, at 12:00 PM, Jens Alfke wrote: There's probably a private API for that. The bad news is that Apple apps use a lot of private APIs :( The good news is that these APIs often become public in later OS releases, especially if developers file bugs clamoring for them (hint hint).

Re: How to get the dispatch queue for the current thread's runloop?

2012-01-28 Thread Steve Sisak
At 12:14 PM -0800 1/27/12, Jens Alfke wrote: I'm really used to using -performSelector:withObject:afterDelay: to make something happen later. But I'd much rather use a block than a target/action. At 12:23 PM -0500 1/28/12, Steve Sisak wrote: This reminds me that, IIRC, a block (after it's

Re: Blocks and Methods...

2012-01-28 Thread R
That is precisely what is giving me the confusion. If retained the received block in a NSMutableArray, the block should stick around (via a strong array pointer) for another method. It only stays around if I equate the block to a typedef variable and then put that variable in the array. I'm

Re: Recently Opened in Doc

2012-01-28 Thread Brad Stone
Thanks Quincey, I've already subclassed my NSDocumentController and I use noteNewRecentDocument to prevent my index file from showing up in the list. The code never gets past the continue call because every time this method is called the only menu item in [openRecentMenu itemArray] is Clear

Re: Recently Opened in Doc

2012-01-28 Thread Quincey Morris
On Jan 28, 2012, at 11:57 , Brad Stone wrote: Thanks Quincey, I've already subclassed my NSDocumentController and I use noteNewRecentDocument to prevent my index file from showing up in the list. The code never gets past the continue call because every time this method is called the only

Re: How to get the dispatch queue for the current thread's runloop?

2012-01-28 Thread Jens Alfke
On Jan 28, 2012, at 11:35 AM, Steve Sisak wrote: [self performSelector:@selector(performBlock:) withObject:^{ NSLog(@Done Later); } afterDelay:1.0]; Don't you need to copy the block? Or is -performSelector:withObject:afterDelay: smart enough to know to call

Re: Open a new terminal tab or window from a Cocoa app at a certain directory without using NSAppleScript?

2012-01-28 Thread Jens Alfke
On Jan 28, 2012, at 1:17 AM, Ron Hunsinger wrote: After a single quote, the *only* character that has a special meaning is another single quote, which ends the quotation. …or a newline :) [And yes, I have encountered filenames with newlines in them. It happened after I downloaded a PDF

Re: Blocks and Methods...

2012-01-28 Thread Mikkel Islay
On 28 Jan 2012, at 20:50, R wrote: That is precisely what is giving me the confusion. If retained the received block in a NSMutableArray, the block should stick around (via a strong array pointer) for another method. It only stays around if I equate the block to a typedef variable and then

Re: Blocks and Methods...

2012-01-28 Thread Ben Kennedy
On 28 Jan 2012, at 8:51 am, Ken Thomases wrote: By itself, an array only retains the block. A block must be explicitly copied if it is to outlive the scope that created it. If so, isn't that a fundamental semantic change to the meaning of retain? On any other object a retain will cause it

Re: Blocks and Methods...

2012-01-28 Thread R
To all, Thanks for taking the time to post advice. I think I now understand much better! --Ron On Jan 28, 12:50 pm, R r4eem...@gmail.com wrote: That is precisely what is giving me the confusion.  If retained the received block in a NSMutableArray, the block should stick around (via a

Key Value Observing of NSMutableArray inside an object

2012-01-28 Thread Mikael Wämundson
Hi, Background: I have put an NSMutableArray (dataObjectArray) in my class DataObjectCollection. I have also made it possible to add objects to DataObjectCollection and hence the array by implementing - (void)addDataObject:(DataObject *)theDataObject { NSIndexSet *loneIndex = [NSIndexSet

Re: How to get the dispatch queue for the current thread's runloop?

2012-01-28 Thread Steve Sisak
At 12:39 PM -0800 1/28/12, Jens Alfke wrote: On Jan 28, 2012, at 11:35 AM, Steve Sisak wrote: [self performSelector:@selector(performBlock:) withObject:^{ NSLog(@Done Later); } afterDelay:1.0]; Don't you need to copy the block? Or is

Re: Drag and drop in collectionview

2012-01-28 Thread Luc Van Bogaert
Follow up : Reading some more, I've found that I could just use a custom representation for my objects, containing their index in the model array, to write to the pasteboard, and then use that index to perform to move when the dragging session is accepted. On 28 Jan 2012, at 13:35, Luc Van

Re: Key Value Observing of NSMutableArray inside an object

2012-01-28 Thread Keary Suska
On Jan 28, 2012, at 2:28 PM, Mikael Wämundson wrote: Is there something I need to do with my class DataObjectCollection to make the observing work, i.e. to make it KVO compliant? Implement and use collection accessor methods:

Re: Recently Opened in Doc

2012-01-28 Thread James Merkel
On 28 Jan 2012 08:46:48 -0800 Quincey Morris wrote: On Jan 28, 2012, at 08:19 , Brad Stone wrote: I have a shoebox app like iPhoto where the actual filename is irrelevant to the user. I control the file name. What I'd like to do is just capture the menu items before they're displayed

Re: Key Value Observing of NSMutableArray inside an object

2012-01-28 Thread Quincey Morris
On Jan 28, 2012, at 13:28 , Mikael Wämundson wrote: I have put an NSMutableArray (dataObjectArray) in my class DataObjectCollection. I have also made it possible to add objects to DataObjectCollection and hence the array by implementing - (void)addDataObject:(DataObject *)theDataObject {

Re: afterDelay not working?

2012-01-28 Thread GW Rodriguez
Just an update: Thanks for the help guys.  I found out I wasn't running on the current loop and didn't realize that time based methods and classes wont work.  My flash method was being called in the background. Thanks GW ___ Cocoa-dev mailing list

Is NSRuleEditor worth the learning curve?

2012-01-28 Thread Erik Stainsby
Hello list folks, I'm struggling with the abstraction and sketchy documentation that surround NSRuleEditor. I feel a need to know that the effort is worthwhile, versus cobbling together something in a table or outline view instead. The domain I am working in really fits well within the

Re: Key Value Observing of NSMutableArray inside an object

2012-01-28 Thread R
Mikael, I think all you need is: - (void)addDataObject:(DataObject *)theDataObject { dataObjectArrayKVC=[self mutableArrayValueForKey:@dataObjectArray]; [dataObjectArrayKVC addObject:theDataObject]; } dataObjectArrayKVC is a proxy for dataObjectArray. Objects added/ removed to/from

Re: Key Value Observing of NSMutableArray inside an object

2012-01-28 Thread R
More appropriate: - (void)addDataObject:(DataObject *)theDataObject { NSMutableArray *dataObjectArrayKVC=[self mutableArrayValueForKey:@dataObjectArray]; [dataObjectArrayKVC addObject:theDataObject]; } On Jan 28, 8:19 pm, R r4eem...@gmail.com wrote: Mikael, I think all you need is:

getting a nsurl file size

2012-01-28 Thread Eric Smith
All, I'm trying to determine the size of a file on a server. If I send the following message to an NSURL named path, I get: [path getResourceValue:value forKey:@content-length error:error]; value comes back nil. If I send: value = [path propertyForKey:@content-length]; which is deprecated,

Re: CoreData, and design of document model

2012-01-28 Thread Jerry Krinock
On 2012 Jan 27, at 01:07, David Mirabito wrote: Right now am working with the notion that when the document is created I add one System managedObject if one doesnt exist, and then never add another in the document's lifetime. Right now in MyDocument's -didLoadNib whilst experimenting but

Re: getting a nsurl file size

2012-01-28 Thread Ken Thomases
On Jan 28, 2012, at 11:53 PM, Eric Smith wrote: I'm trying to determine the size of a file on a server. If I send the following message to an NSURL named path, I get: [path getResourceValue:value forKey:@content-length error:error]; value comes back nil. Two things: * Did the method

Re: getting a nsurl file size

2012-01-28 Thread Charles Srstka
On Jan 29, 2012, at 12:21 AM, Ken Thomases wrote: * The keys that are valid for that method are those listed in the NSURL documentation. They may bear no relation to HTTP response header fields. So, I see no reason to believe that content-length is a valid key. Have you tried

How to parse multipart/form-data?

2012-01-28 Thread Kai Cao
Hi, I'm using CocoaHTTPServer to upload files from computer to iOS devices. But the result NSData received from the browser is multipart form data, which is really hard to parse manually. I know I can write a parser from scratch, however, it's time consuming and bug prone. I'm wondering wether