Quicklook thumbnails vs previews, API for previews?

2011-06-30 Thread Oleg Krupnov
Hi, The QuickLook API documentation defines and contrasts thumbnails and previews, but all I see on the client side is the only function QLThumbnailImageCreate. I assume this is for creating thumbnails, isn't it? In that case, how do I create previews on the client side? Alternatively, if this

Re: dealloc and scarce resources

2011-06-30 Thread Kyle Sluder
On Wed, Jun 29, 2011 at 10:38 PM, James Merkel jmerk...@mac.com wrote: Ok, thanks. For what I'm doing file descriptors are not a scarce resource. File descriptors are almost always a scarce resource. By default, each process only gets 256 of them. --Kyle Sluder

Re: NSUndoManager - unstable state

2011-06-30 Thread Kyle Sluder
On Wed, Jun 29, 2011 at 10:40 PM, livinginlosange...@mac.com wrote: Is there a way to check if the NSUndomanager is in an unstable state and reset it? No, NSUndoManager is very fragile, and if it gets into a bad state it is not recoverable. --Kyle Sluder

Re: dealloc and scarce resources

2011-06-30 Thread James Merkel
On Jun 29, 2011, at 11:07 PM, Kyle Sluder wrote: On Wed, Jun 29, 2011 at 10:38 PM, James Merkel jmerk...@mac.com wrote: Ok, thanks. For what I'm doing file descriptors are not a scarce resource. File descriptors are almost always a scarce resource. By default, each process only gets 256

Re: dealloc and scarce resources

2011-06-30 Thread Jean-Daniel Dupas
Le 30 juin 2011 à 08:19, James Merkel a écrit : On Jun 29, 2011, at 11:07 PM, Kyle Sluder wrote: On Wed, Jun 29, 2011 at 10:38 PM, James Merkel jmerk...@mac.com wrote: Ok, thanks. For what I'm doing file descriptors are not a scarce resource. File descriptors are almost always a scarce

Re: dealloc and scarce resources

2011-06-30 Thread Ken Thomases
On Jun 30, 2011, at 3:02 AM, Jean-Daniel Dupas wrote: Le 30 juin 2011 à 08:19, James Merkel a écrit : Ok, I'm looking at my application in Instruments File Activity. The column labeled FD I assume means file descriptors. Is that the total number of FDs in use at any given time? No,

Scaling CALayer produces blurry/distorted text

2011-06-30 Thread Ajay Sabhaney
Hello, I have an application in which the user can continuously zoom and pan a canvas (kind of like Google Maps). On the canvas, a user can have multiple text items. Each text item is a Core Animation layer, and the text is drawn using NSLayoutManager's drawGlyphsForGlyphRange method. When

Re: NSUndoManager - unstable state

2011-06-30 Thread Jerry Krinock
On 2011 Jun 29, at 23:08, Kyle Sluder wrote: On Wed, Jun 29, 2011 at 10:40 PM, livinginlosange...@mac.com wrote: Is there a way to check if the NSUndomanager is in an unstable state and reset it? No, NSUndoManager is very fragile, and if it gets into a bad state it is not recoverable.

Re: dealloc and scarce resources

2011-06-30 Thread James Merkel
On Jun 30, 2011, at 2:01 AM, Ken Thomases wrote: On Jun 30, 2011, at 3:02 AM, Jean-Daniel Dupas wrote: Le 30 juin 2011 à 08:19, James Merkel a écrit : Ok, I'm looking at my application in Instruments File Activity. The column labeled FD I assume means file descriptors. Is that the total

Re: Properties, Attributes and Retain+Autorelease

2011-06-30 Thread Markus Hanauska
On 2011-06-29, at 21:50 , Quincey Morris wrote: You're looking for provable correctness. That's laudable, and will probably mean that you keep all of your fingers. But you'll still end up in the emergency room -- in your case it will be for a stress-induced ulcer. :) My university

Re: Properties, Attributes and Retain+Autorelease (SOLVED)

2011-06-30 Thread Markus Hanauska
Since nobody was able to provide real answers to my questions, I wrote some dummy code to find out as much about that issue as possible. Here are the results: Remember, I listed the following cases: a) retain b) retain, nonatomic c) copy d) copy, nonatomic

Re: dealloc and scarce resources

2011-06-30 Thread James Merkel
On Jun 30, 2011, at 9:20 AM, James Merkel wrote: On Jun 30, 2011, at 2:01 AM, Ken Thomases wrote: On Jun 30, 2011, at 3:02 AM, Jean-Daniel Dupas wrote: Le 30 juin 2011 à 08:19, James Merkel a écrit : Ok, I'm looking at my application in Instruments File Activity. The column labeled FD

[Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-06-30 Thread JongAm Park
Hello, I wrote a method for NSArray. - (NSArray *)objectsForKey:(id)key { NSMutableArray *objectsArray = [NSMutableArray arrayWithCapacity:10]; for( id item in self ) { [objectsArray addObject:[item objectForKey:key]]; }

Re: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-06-30 Thread Dave DeLong
Yeah, that should be fine, but it's unnecessary. You can just do: NSArray *objectsArray = [theArray valueForKey:key]; And it'll do pretty much the same thing (except that it'll call -valueForKey: on each item in the array, and not objectForKey:. However, if the objects are NSDictionaries,

Re: dealloc and scarce resources

2011-06-30 Thread Kyle Sluder
On Thu, Jun 30, 2011 at 9:20 AM, James Merkel jmerk...@mac.com wrote: After a fair amount of application warm-up the FD shows 25 to 26. So, I assume I'm ok. And what happens when (not if) you introduce a leak, and these objects live longer than you expect them to? Or worse, someone else starts

Re: dealloc and scarce resources

2011-06-30 Thread James Merkel
On Jun 30, 2011, at 12:04 PM, Kyle Sluder wrote: On Thu, Jun 30, 2011 at 9:20 AM, James Merkel jmerk...@mac.com wrote: After a fair amount of application warm-up the FD shows 25 to 26. So, I assume I'm ok. And what happens when (not if) you introduce a leak, and these objects live longer

Re: dealloc and scarce resources

2011-06-30 Thread Kyle Sluder
On Thu, Jun 30, 2011 at 12:12 PM, James Merkel jmerk...@mac.com wrote: Ok, I don't know what an -invalidate method is, but I'll look it up. It's the thing Wim talked about. An explicit way to release the scarce resource you're holding on to. Depending on what that resource is, an appropriate

Re: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-06-30 Thread Heath Borders
You might also try HBCollections, a series of collections categories I wrote that makes it easy to do stuff like this. https://github.com/hborders/HBCollections -Heath On Jun 30, 2011 2:10 PM, Dave DeLong davedel...@me.com wrote: ___ Cocoa-dev mailing

Re: dealloc and scarce resources

2011-06-30 Thread James Merkel
On Jun 30, 2011, at 12:21 PM, Kyle Sluder wrote: On Thu, Jun 30, 2011 at 12:12 PM, James Merkel jmerk...@mac.com wrote: Ok, I don't know what an -invalidate method is, but I'll look it up. It's the thing Wim talked about. An explicit way to release the scarce resource you're holding on to.

Re: Activate app but bring only *one* window to the front

2011-06-30 Thread Jerry Krinock
On 2011 Jun 29, at 10:11, Kyle Sluder wrote: -[NSRunningApplication activateWithOptions:] Thank you, Kyle, that works. Indeed, in Mac OS 10.6+, the code [[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateIgnoringOtherApps] ; activates the app, but only

Re: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-06-30 Thread JongAm Park
Um... Thanks for your reply. The last time I used that was about 5 or 6 years ago, and I wondered yesterday where it went away. :) Thanks for pointing out that method. BTW, my actual question was if it is meant to use fast enumeration in a collection class implementation. Although I tried to

Re: dealloc and scarce resources

2011-06-30 Thread Jerry Krinock
On 2011 Jun 30, at 13:33, James Merkel wrote: I'm not sure where I would do that [-invalidate, releaseResources, removeObservers, whatever] That's a common dilemma. There is no general solution. Each situation will have its own least-worst solution. Apple could have helped things along

Re: dealloc and scarce resources

2011-06-30 Thread Jens Alfke
On Jun 30, 2011, at 1:33 PM, James Merkel wrote: We find from Kernighan and Ritchie (KR) second edition, section 8.1 that a file descriptor is a small non-negative integer that refers to a file and is maintained by the system. Actually file descriptors are used for any sort of I/O channel,

Re: Activate app but bring only *one* window to the front

2011-06-30 Thread Scott Ribe
On Jun 30, 2011, at 2:39 PM, Jerry Krinock wrote: However, Cocoa still wins. My purpose was to show an alert-type of window (my own custom version of NSAlert) without bringing forward a document window. Initially, it works, but when the user clicks a button which sends -[NSWindow close]

Re: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-06-30 Thread Quincey Morris
On Jun 30, 2011, at 13:51, JongAm Park wrote: The rationale behind enumerator pattern is to unify the way to access collection classes no matter what they actually look like. So, enumerator pattern is actually written in index based iteration wrapped with enumerator pattern. Similarly, I

Re: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-06-30 Thread JongAm Park
Wow.. great information! Thank you very much for sharing your idea! It definitely helped me! JongAm Park On Jun 30, 2011, at 2:41 PM, Quincey Morris wrote: On Jun 30, 2011, at 13:51, JongAm Park wrote: The rationale behind enumerator pattern is to unify the way to access collection

Core Data: stop object from firing fault?

2011-06-30 Thread Michael Link
Is there anyway to stop an NSManagedObject from firing a fault, say because it's actually been deleted? For instance if an object is created on the main thread and is then punted to a background thread and deleted (in a separate context of course) then the changes are merged back to the main

Instance Variables of NSManagedObject Subclasses

2011-06-30 Thread Allen Ingling
Dear cocoa-dev list, I want my NSManagedObjects to retain a variable valid for the lifetime the application instance but not between instances of the application. So I have subclassed NSManagedObject and added an instance variable to the NSManagedObject subclass and defined a property as

Instance Variables of NSManagedObject Subclasses

2011-06-30 Thread Allen Ingling
Dear cocoa-dev list, I want my NSManagedObjects to retain a variable valid for the lifetime the application instance but not between instances of the application. So I have subclassed NSManagedObject and added an instance variable to the NSManagedObject subclass and defined a property as

Instance Variables of NSManagedObject Subclasses

2011-06-30 Thread Allen Ingling
Dear cocoa-dev list, I want my NSManagedObjects to retain a variable valid for the lifetime the application instance but not between instances of the application. So I have subclassed NSManagedObject and added an instance variable to the NSManagedObject subclass and defined a property as

Re: dealloc and scarce resources

2011-06-30 Thread Greg Guerin
James Merkel wrote: Everyone doesn't approach this stuff with the same background. We find from Kernighan and Ritchie (KR) second edition, section 8.1 that a file descriptor is a small non-negative integer that refers to a file and is maintained by the system. Wikipedia is also a useful

Re: dealloc and scarce resources

2011-06-30 Thread Jeffrey Walton
On Thu, Jun 30, 2011 at 7:06 PM, Greg Guerin glgue...@amug.org wrote: James Merkel wrote: Everyone doesn't approach this stuff with the same background. We find from Kernighan and Ritchie (KR) second edition, section 8.1 that a file descriptor is a small non-negative integer that refers to a

Re: Core Data: stop object from firing fault?

2011-06-30 Thread Mike Abdullah
On 30 Jun 2011, at 23:01, Michael Link wrote: Is there anyway to stop an NSManagedObject from firing a fault, say because it's actually been deleted? For instance if an object is created on the main thread and is then punted to a background thread and deleted (in a separate context of

Re: dealloc and scarce resources

2011-06-30 Thread Greg Guerin
Jeffrey Walton wrote: Wikipedia is hardly the definitive reference. SEO comes to mind. Luckily, I didn't say Wikipedia was a definitive reference. I said useful reference. And anyone at all familiar with it knows full well that its accuracy (and usefulness) can vary widely. I, for one,

Modify metadata of existing file using AVFoundation

2011-06-30 Thread Indragie Karunaratne
Hi all, I'm playing around a bit with AVFoundation and it seems to have all the audio related functionality I could possibly want (playback, metadata, mixing, etc.) but there's one thing I'm having trouble figuring out. I know how to read metadata from a file via AVAsset's -commonMetadata

Re: Activate app but bring only *one* window to the front

2011-06-30 Thread Ken Thomases
On Jun 30, 2011, at 3:39 PM, Jerry Krinock wrote: On 2011 Jun 29, at 10:11, Kyle Sluder wrote: -[NSRunningApplication activateWithOptions:] Thank you, Kyle, that works. Indeed, in Mac OS 10.6+, the code [[NSRunningApplication currentApplication]

Re: dealloc and scarce resources

2011-06-30 Thread Ken Thomases
On Jun 30, 2011, at 3:33 PM, James Merkel wrote: So, my guess is that when Instruments shows an FD of -1 it refers to an FD that isn't mine. What the File Activity instrument is showing in its event list is a certain subset of system calls which operate on file descriptors. It is showing

Re: dealloc and scarce resources

2011-06-30 Thread Kyle Sluder
On Thu, Jun 30, 2011 at 6:34 PM, James Merkel jmerk...@mac.com wrote: Then wherever I was sending the -release, I need to also send a separate  -close. it could be before or after the release, it doesn't really matter. No, it really needs to be before the -release. When you call -release, you

Re: dealloc and scarce resources

2011-06-30 Thread James Merkel
On Jun 30, 2011, at 6:39 PM, Kyle Sluder wrote: On Thu, Jun 30, 2011 at 6:34 PM, James Merkel jmerk...@mac.com wrote: Then wherever I was sending the -release, I need to also send a separate -close. it could be before or after the release, it doesn't really matter. No, it really needs