Re: [NSSound isPlaying] fails to indicate sound termination in Lion

2012-07-23 Thread Jens Alfke
On Jul 22, 2012, at 7:52 PM, Jay Reynolds Freeman jay_reynolds_free...@mac.com wrote: I guess my main problem with all this is that Apple provides [NSSound isPlaying] with no indication that the method is not general-purpose; reading the documentation would have you think that it would

Re: [NSSound isPlaying] fails to indicate sound termination in Lion

2012-07-23 Thread Jens Alfke
On Jul 22, 2012, at 9:29 PM, Gavin Stokes stokest...@gmail.com wrote: I struggled with this when getting into iOS programming and networking; everything's asynchronous, and you can't just have your UI locked up. So what is my app to do while it's waiting? Nothing. Just return from your

Re: [NSSound isPlaying] fails to indicate sound termination in Lion

2012-07-23 Thread Gavin Stokes
Asynchronous programming means you'll be called back when things happen, and in the meantime you should return control so other stuff can run. It doesn't mean that you should go into an infinite loop trying to force something async to run synchronously. That question was rhetorical. The

Re: [NSSound isPlaying] fails to indicate sound termination in Lion

2012-07-23 Thread Jay Reynolds Freeman
Using a delegate with the call-back method did indeed solve the problem. I have filed a bug report about this one, because the documentation for -NSSound isPlaying is simply wrong: That method does not always return a valid answer under 10.7.4. (And because it did work as documented under

ARC Extending Lifetime of Objects

2012-07-23 Thread Andreas Grosam
Suppose, I have C-arrays defined as follows: int count = [dictionary count]; id __unsafe_unretained values[count]; id __unsafe_unretained keys[count]; I fill these arrays with: [dictionary getObjects:values andKeys:keys]; Now, I would like to reuse these arrays through holding objects

Re: [NSSound isPlaying] fails to indicate sound termination in Lion

2012-07-23 Thread Charles Srstka
On Jul 23, 2012, at 2:53 AM, Jay Reynolds Freeman wrote: Using a delegate with the call-back method did indeed solve the problem. I have filed a bug report about this one, because the documentation for -NSSound isPlaying is simply wrong: That method does not always return a valid answer

Profound UITableView rendering-performance problem, but only at certain positions? mostly resolved

2012-07-23 Thread Gavin Stokes
I found that this only happened when 51 pixels or fewer of the last row of a section were visible at the top of the screen. The row height returned was 97. So 51 was a baffling number, not being half the row height or of any other significance I could see. Turns out that the tableview specified

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Mike Abdullah
On 23 Jul 2012, at 09:00, Andreas Grosam agro...@onlinehome.de wrote: Suppose, I have C-arrays defined as follows: int count = [dictionary count]; id __unsafe_unretained values[count]; id __unsafe_unretained keys[count]; I fill these arrays with: [dictionary getObjects:values

Re: [NSSound isPlaying] fails to indicate sound termination in Lion

2012-07-23 Thread Charles Srstka
On Jul 23, 2012, at 3:27 AM, Jay Reynolds Freeman wrote: If it had never worked properly I would have found and fixed the problem during testing under Snow Leopard. The problem is that the 10.6 implementation worked *exactly* as the documentation specifies, but the 10.7 one doesn't. My

Design issue related to my problem with NSSound -isPlaying

2012-07-23 Thread Jay Reynolds Freeman
I wanted to thank everyone again for the assistance and advice delivered on thread [NSSound isPlaying] fails to indicate sound termination in Lion. I know what to do with that one now, and if Apple ever says anything about my bug report, I will let those of you who have helped most know what

Re: Design issue related to my problem with NSSound -isPlaying

2012-07-23 Thread Graham Cox
On 23/07/2012, at 8:10 PM, Jay Reynolds Freeman wrote: So: In Cocoa, is there a reasonable approach to getting things to happen quickly, that works when call-back on the main event loop isn't fast enough? It is probably not a matter of great consequence for my situation, but it might

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Andreas Grosam
On 23.07.2012, at 10:36, Mike Abdullah wrote: I think all this begs the questions: - Why do you want to get these objects stored in arrays rather than a dictionary? - Why C arrays, rather than NSArray? Well, I want to create a new dictionary from copies of elements from another

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Mike Abdullah
On 23 Jul 2012, at 11:48, Andreas Grosam agro...@onlinehome.de wrote: On 23.07.2012, at 10:36, Mike Abdullah wrote: I think all this begs the questions: - Why do you want to get these objects stored in arrays rather than a dictionary? - Why C arrays, rather than NSArray? Well, I

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Andreas Grosam
On 23.07.2012, at 13:09, Mike Abdullah wrote: Aha, now we're talking. You want -initWithDictionary:copyItems: No, this is not a deep copy. Suppose, there is an element within the array, whose value is a mutable dictionary. If I change the that mutable dictionary (or its values), the copy

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Mike Abdullah
On 23 Jul 2012, at 12:57, Andreas Grosam agro...@onlinehome.de wrote: On 23.07.2012, at 13:09, Mike Abdullah wrote: Aha, now we're talking. You want -initWithDictionary:copyItems: No, this is not a deep copy. Suppose, there is an element within the array, whose value is a mutable

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Graham Cox
On 23/07/2012, at 9:57 PM, Andreas Grosam wrote: Thus, I need to define a deepCopy method for NSDictionary (and NSArray, too). So, do that. However, are you really sure? I remember thinking I needed this at one time and implemented a whole series of -deepCopy: methods in a variety of

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Andreas Grosam
On 23.07.2012, at 14:04, Mike Abdullah wrote: On 23 Jul 2012, at 12:57, Andreas Grosam agro...@onlinehome.de wrote: On 23.07.2012, at 13:09, Mike Abdullah wrote: Aha, now we're talking. You want -initWithDictionary:copyItems: No, this is not a deep copy. Suppose, there is an

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Yingshen Yu
Dictionaries doesn't do deepCopy, but they do support NSCoding. Do you think you can use serialization to a NSData (a memory block) instead? It will have other benefit when you have too much undo items and want to page to a file. ;) -Jonny 在 2012-7-23,下午9:12,Andreas Grosam

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Graham Cox
On 23/07/2012, at 11:12 PM, Andreas Grosam wrote: Due to the lack of attributes attachable to properties in Objective-C language and a momento method (I already warned that I'll possibly digressing ;) ) I just use a deep copy for creating the momento. Another solution is to use archiving

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Andreas Grosam
On 23.07.2012, at 15:22, Graham Cox wrote: And @Jonny Another solution is to use archiving to turn your object graph into a block of data. Yes, I considered that option, too. This would keep inter-object references intact, too - while a (naive) deepCopy would force to copy any mutable

Re: Design issue related to my problem with NSSound -isPlaying

2012-07-23 Thread Kyle Sluder
On Jul 23, 2012, at 3:10 AM, Jay Reynolds Freeman jay_reynolds_free...@mac.com wrote: The issue is synching animations -- visual ones -- with sounds. Think of it as lip-synching. You will recall that what I wanted to do was have a cat-face appear, open its mouth, say (play sound) meow,

NSDocument -canCloseDocumentWithDelegate::: not called when terminating

2012-07-23 Thread Markus Spoettl
Hello, when I close my document window without terminating the application, -canCloseDocumentWithDelegate::: is called, independent of whether the document is dirty. When I quit the application, -canCloseDocumentWithDelegate::: is only called if the document reports it is dirty. If it is

Re: Profound UITableView rendering-performance problem, but only at certain positions?

2012-07-23 Thread Fritz Anderson
I think the first problem you should concentrate on should be the multiply-overlaid drawings. It's hard to tell what's going on unless you share some code, or at least your design, so I can only ask general questions. I assume you're using the UIAccelerometer delegate method to receive your

Re: Profound UITableView rendering-performance problem, but only at certain positions? mostly resolved

2012-07-23 Thread Fritz Anderson
Oh well, serves me right for not looking at other threads before replying. Never mind, then. — F On 23 Jul 2012, at 3:18 AM, Gavin Stokes wrote: Turns out that the tableview specified a row height of 97 (in the XIB), but the custom cells in it give themselves a height of 100 upon

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Ken Thomases
On Jul 23, 2012, at 3:00 AM, Andreas Grosam wrote: int count = [dictionary count]; id __unsafe_unretained values[count]; id __unsafe_unretained keys[count]; Now, I would like to reuse these arrays through holding objects maintained by ARC (if possible): for (int i = 0; i count; ++i) {

Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating

2012-07-23 Thread Fritz Anderson
Perhaps I'm missing something — is writing the preferences file very time-consuming? If not, why not write it whether you need to or not? Or whenever a preferences value changes, which is what you'd do with NSUserDefaults? — F On 23 Jul 2012, at 10:12 AM, Markus Spoettl wrote: My

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread Kyle Sluder
On Jul 23, 2012, at 3:48 AM, Andreas Grosam agro...@onlinehome.de wrote: Sure, I could use fast enumeration, and a separate NSArray for keys and values to accomplish what I want. But I was also hoping, the first approach is possibly faster. Using fast enumeration appears quite suboptimal for

Re: ARC Extending Lifetime of Objects

2012-07-23 Thread James Montgomerie
I think this does what you want. It works by [arguably ab-] using the CF bridging casts: NSUInteger count = [dictionary count]; // Are you sure you don't want to malloc and free these? Might blow the // stack if they're large. id __unsafe_unretained values[count]; id

Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating

2012-07-23 Thread Kevin Perry
I can't really recommend an approach that essentially lies about the dirty state of a document. If you have something to write into the document bundle, then the document is dirty and it should be declared so with the available NSDocument APIs. If the existing APIs don't meet your needs for

Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating

2012-07-23 Thread Kyle Sluder
On Jul 23, 2012, at 8:12 AM, Markus Spoettl ms_li...@shiftoption.com wrote: Are there better options to do a last-minute save? I do not want to change the design, meaning I don't want preferences to contribute to the change count state or even worse be undoable. Plus I do want the

Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating

2012-07-23 Thread Markus Spoettl
On 7/23/12 5:42 PM, Fritz Anderson wrote: Perhaps I'm missing something — is writing the preferences file very time-consuming? If not, why not write it whether you need to or not? Or whenever a preferences value changes, which is what you'd do with NSUserDefaults? Thanks for your suggestion.

Re: Design issue related to my problem with NSSound -isPlaying

2012-07-23 Thread Jens Alfke
On Jul 23, 2012, at 7:53 AM, Kyle Sluder k...@ksluder.com wrote: NSSound is not the appropriate API for this. It makes no guarantees about its responsiveness. Look into AVFoundation. Agreed. NSSound is basically a convenience for playing beep sounds as UI feedback, nothing more. It's not

Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating

2012-07-23 Thread Kyle Sluder
On Jul 23, 2012, at 9:06 AM, Kevin Perry kpe...@apple.com wrote: I can't really recommend an approach that essentially lies about the dirty state of a document. If you have something to write into the document bundle, then the document is dirty and it should be declared so with the available

Re: Icon Overlay on Mac OSX

2012-07-23 Thread koko
On Jul 22, 2012, at 11:02 PM, Alfian Busyro wrote: So essentially you'd be building a (very limited and much simpler) mini-Finder that only does what is needed for your application. We do this with our apps and it is a good approach. -koko ___

Re: saving images

2012-07-23 Thread Matt Neuburg
On Sat, 21 Jul 2012 17:03:23 +0100, H. Miersch hmier...@me.com said: i just started a new ios project where i want to download images using NSimage's initwithcontentsofURL: method. now i also want to write those images to permanent storage, but how do i do that? (1) There is no NSImage on

Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating

2012-07-23 Thread Markus Spoettl
On 7/23/12 6:06 PM, Kevin Perry wrote: I can't really recommend an approach that essentially lies about the dirty state of a document. If you have something to write into the document bundle, then the document is dirty and it should be declared so with the available NSDocument APIs. If the

Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating

2012-07-23 Thread Markus Spoettl
On 7/23/12 6:22 PM, Kyle Sluder wrote: I don't have my crazy autosave flowchart handy, but I *think* you should be able to simply override -hasUnautosavedChanges to return YES if either super returns YES or if your preferences file needs to be saved. -autosaveWithImplicitCancellability:: is

Badge drawing like NSDockTile

2012-07-23 Thread qvacua
Hi, is there a canonical AppKit-way to draw badges to an arbitrary NSImage which looks like the badges drawn by NSDockTile? Thanks in advance, Tae ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

Re: 10.7 Full-Screen transition animation corrupts my UI - how to avoid?

2012-07-23 Thread Motti Shneor
Thanks, guys, for all the help. Of course the implementation below is meaningless, and also isn't the right thing to do --- It should have returned min/max size if at all. I only put it to see if I get there in the debugger (set a breakpoint on the strange lower-than-minimal situation). -

Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating

2012-07-23 Thread Kevin Perry
On Jul 23, 2012, at 10:51 AM, Markus Spoettl ms_li...@shiftoption.com wrote: On 7/23/12 6:22 PM, Kyle Sluder wrote: I don't have my crazy autosave flowchart handy, but I *think* you should be able to simply override -hasUnautosavedChanges to return YES if either super returns YES or if your

Profound UITableView rendering-performance problem, but only at certain positions? No, not resolved.

2012-07-23 Thread Gavin Stokes
Actually, I spoke too soon. This problem continues to occur, but the critical position of the partial row at the top varies with the table's row height. And it's not even always the bottom portion; sometimes if the last row in the previous section is cut off in a middle region, rendering will

Re: Profound UITableView rendering-performance problem, but only at certain positions?

2012-07-23 Thread Gavin Stokes
On Mon, Jul 23, 2012 at 8:16 AM, Fritz Anderson fri...@manoverboard.orgwrote: I think the first problem you should concentrate on should be the multiply-overlaid drawings. It's hard to tell what's going on unless you share some code, or at least your design, so I can only ask general

Re: Profound UITableView rendering-performance problem, but only at certain positions?

2012-07-23 Thread Luke Hiesterman
On Jul 23, 2012, at 2:03 PM, Gavin Stokes wrote: On Mon, Jul 23, 2012 at 8:16 AM, Fritz Anderson fri...@manoverboard.orgmailto:fri...@manoverboard.orgwrote: I think the first problem you should concentrate on should be the multiply-overlaid drawings. It's hard to tell what's going on unless

Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating

2012-07-23 Thread Markus Spoettl
On 7/23/12 9:34 PM, Kevin Perry wrote: If there would be a way to tell NSDocument to forgo asking whether to save a document if -isDocumentEdited returned YES, and instead just save it, that would be a solution. All I want is a silent save, when only preferences need to be saved (since I'm using

Forcing Core Data to save attribute changed behind its back?

2012-07-23 Thread Sean McBride
Hi all, I have a managed object where one of the attributes is quite large and so when I change it, instead of the usual setAttribute:newValue I mutate the object directly. Of course, Core Data does not know that I've done this. I'm looking for a way to tell it. (Otherwise, if the thing is

Re: Profound UITableView rendering-performance problem, but only at certain positions?

2012-07-23 Thread Gavin Stokes
Though probably off topic, this is unnecessary work. If you just want to change where your arrow is pointing, you should reach into the cells and change the position of the arrow - you shouldn't be doing a reload for that. Think something more like for (UITableViewCell* cell in [tableView

Re: Profound UITableView rendering-performance problem, but only at certain positions?

2012-07-23 Thread Luke Hiesterman
On Jul 23, 2012, at 4:34 PM, Gavin Stokes wrote: Though probably off topic, this is unnecessary work. If you just want to change where your arrow is pointing, you should reach into the cells and change the position of the arrow - you shouldn't be doing a reload for that. Think something more