Re: A question of memory management style

2011-07-19 Thread John Brownie
Thanks for the suggestions. I decided to go with having the handler object retain itself and release itself when the interaction is completed. That avoids having to have more instance variables in the document object to track handlers and release them when done. Also, thanks for the pointers

Re: Why are these objects still faults?

2011-07-19 Thread vincent habchi
Le 19 juil. 2011 à 07:21, Gideon King gid...@novamind.com a écrit : But I told it to pre-fetch the view relationship. Any ideas why it wouldn't work? Maybe a silly answer, but isn’it a side effect of lazy loading? V. ___ Cocoa-dev mailing list

Re: NSArrayController nib binding vs code binding

2011-07-19 Thread Mike Abdullah
On 19 Jul 2011, at 02:41, Trygve Inda wrote: [myArrayController bind:@content toObject:myClassObject withKeyPath:@places options:NULL]; Hmm... Seems like it should be bind:@contentArray Please use the NSContentArrayBinding constant as that's what's it exists for, despite being fairly

Optimizing a loop

2011-07-19 Thread Eric E. Dolecki
I have an NSMutableArray that contains a MPMediaItem and song title as it's key. I then take a search string and loop through the entire NSMutableArray looking for a fuzzy match. It works very well, the problem is that the array contains 1,777 items (could contain more) and the search takes

Re: Why are these objects still faults?

2011-07-19 Thread Heath Borders
Is your topic node self-referential? Maybe CoreData doesn't prefetch circular references. -Heath Borders heath.bord...@gmail.com Twitter: heathborders http://heath-tech.blogspot.com On Tue, Jul 19, 2011 at 12:21 AM, Gideon King gid...@novamind.com wrote: Hi, I'm doing a fetch of some objects

Re: Optimizing a loop

2011-07-19 Thread Vincent Habchi
I have an NSMutableArray that contains a MPMediaItem and song title as it's key. I then take a search string and loop through the entire NSMutableArray looking for a fuzzy match. It works very well, the problem is that the array contains 1,777 items (could contain more) and the search takes

Re: Optimizing a loop

2011-07-19 Thread Eric E. Dolecki
Oops - I meant to say it's an NSMutableDictionary! What might a quick stubbed example of that be? Not sure I am following. How much speed would it generally gain? Google Voice: (508) 656-0622 Twitter: eric_dolecki XBoxLive: edolecki PSN: eric_dolecki http://blog.ericd.net On

Re: Optimizing a loop

2011-07-19 Thread Vincent Habchi
Oops - I meant to say it's an NSMutableDictionary! What might a quick stubbed example of that be? Not sure I am following. How much speed would it generally gain? Simple example. Init a NSMutableDictionary. For each string, compute a hash key as the sum of all chars composing it (in a

Re: Optimizing a loop

2011-07-19 Thread Eric E. Dolecki
Someone told me to look into -enumerateKeysAndObjectsWithOptions:usingBlock: (using NSEnumerationConcurrent) Would that be a better way? If so, I haven't seen this used before - how could I apply it? - Eric Simple example. Init a NSMutableDictionary. For each string, compute a hash key as the

Re: Optimizing a loop

2011-07-19 Thread Vincent Habchi
Someone told me to look into -enumerateKeysAndObjectsWithOptions:usingBlock: (using NSEnumerationConcurrent) Would that be a better way? If so, I haven't seen this used before - how could I apply it? You can try to use that, but, basically, it is the same problem: you enumerate all entries

Re: Optimizing a loop

2011-07-19 Thread Eric E. Dolecki
Thanks. The distance is computed because the entry string is dynamic and it's providing a distance between the title of the song and what was entered as text. So I can't pre-compute that data and stuff into a dictionary. Each time the method is called, the *stringValue* will be different. On Tue,

Re: Optimizing a loop

2011-07-19 Thread Vincent Habchi
Thanks. The distance is computed because the entry string is dynamic and it's providing a distance between the title of the song and what was entered as text. So I can't pre-compute that data and stuff into a dictionary. Each time the method is called, the stringValue will be different.

Re: Optimizing a loop

2011-07-19 Thread Eric E. Dolecki
I think I see what you're onto here now. So I might only have about 30 or so keys to search through instead of all 1,777 items, and then just grab an array (or probably a dictionary) of stuff out of that to search on... resulting in a lot less searching to hopefully get to a potential match. a

Re: Why are these objects still faults?

2011-07-19 Thread Gideon King
Interesting idea. The structure is that I have a grandparent with just a single attribute, a parent which has parent and children (self referential) relationships, and a couple of one way to-one self referential relationships on the topic node object itself, so there are a few things going on

Re: Optimizing a loop

2011-07-19 Thread Jens Alfke
On Jul 19, 2011, at 6:22 AM, Vincent Habchi wrote: It's not easy, but I would recommend using a hash table instead. You can compute a hash code that depends more or less on the spelling of your strings, then use that hash key to access a set of candidate for your fuzzy search. I take it

Re: Understanding layer-backed views

2011-07-19 Thread Michael Crawford
Graham; Scott, I have a follow-up question on this topic, if you don't mind. Do either of you have a recommendation on the idea of adding a layer-hosting view as a subview of a layer-backed view? I'm thinking of adding a virtual keyboard to an existing app that is layer-backed. I would like

Re: Optimizing a loop

2011-07-19 Thread Greg Guerin
Eric E. Dolecki wrote: //Get the very best match there is to be found for song. if(match currentFoundValue){ currentFoundValue = match; test = [songsDictionary objectForKey:thisSong]; dis = [NSArray

32 - 64 bit serializations, NSNumber, int, NSInteger

2011-07-19 Thread Philip Dow
Related to a previous posting of mine regarding floats and CGFloats when decoding older 32 bit serializations in a 64 bit runtime, I am now also in the process of modernizing some old code that used int values encapsulated by NSNumber in keyed archives. The current serializations were

Modal dialog, run loop and core data

2011-07-19 Thread Vincent
Hi! I'm facing a little dilemma: in a modal dialog, I'd like to create a new core data entity with -[aNSArrayControllerInEntityMode insert:] and initialize some attributes of this new entity. However, the creation and insertion of the new entity is delayed one run loop iteration; but, in a

Simple iOS app works on device but crashes in simulator, in AppleSpell

2011-07-19 Thread Jens Alfke
I’m working on a fairly simple iOS app with some other folks, and it works fine for me on a real iOS device, but whenever I run it in the 4.3 simulator it crashes as soon as I type a few characters into a text field. The crash is always inside the system method -[AppleSpell init]. The other

Re: Modal dialog, run loop and core data

2011-07-19 Thread Jens Alfke
On Jul 19, 2011, at 11:31 AM, Vincent wrote: I'm facing a little dilemma: in a modal dialog, I'd like to create a new core data entity with -[aNSArrayControllerInEntityMode insert:] and initialize some attributes of this new entity. I know it’s considered rude to answer a coding question

Re: Simple iOS app works on device but crashes in simulator, in AppleSpell

2011-07-19 Thread Jens Alfke
On Jul 19, 2011, at 11:46 AM, I wrote: I’m working on a fairly simple iOS app with some other folks, and it works fine for me on a real iOS device, but whenever I run it in the 4.3 simulator it crashes as soon as I type a few characters into a text field. The crash is always inside the

Re: Modal dialog, run loop and core data

2011-07-19 Thread Vincent
Hi Jens, I know it’s considered rude to answer a coding question with a UI critique, but the best solution would really be to avoid using a modal dialog at all. They’re a poor user experience compared to a sheet or some other kind of in-window display, and as you’ve seen, they can cause

Printing options

2011-07-19 Thread Amy Gibbs
Hi, I've read everything that says printing is easy...but I'm struggling with it! I have googled, but nothing quite seems to fit my situation, I just want a single page. In my app I have customer orders, and I just want to print out a copy. I can't work out what the best option would

Re: 32 - 64 bit serializations, NSNumber, int, NSInteger

2011-07-19 Thread Nick Zitzmann
On Jul 19, 2011, at 12:24 PM, Philip Dow wrote: Related to a previous posting of mine regarding floats and CGFloats when decoding older 32 bit serializations in a 64 bit runtime, I am now also in the process of modernizing some old code that used int values encapsulated by NSNumber in

Re: 32 - 64 bit serializations, NSNumber, int, NSInteger

2011-07-19 Thread Quincey Morris
On Jul 19, 2011, at 12:32, Nick Zitzmann wrote: The only problem I ever had with unarchiving 32-bit app archives in a 64-bit app was with longs in non-keyed archives that were encoded using @encode(long)*, and that doesn't apply to your scenario. The other issue that might rear its head is

Re: 32 - 64 bit serializations, NSNumber, int, NSInteger

2011-07-19 Thread Philip Dow
Thanks for the tips Quincey and Nick. I'll keep an eye out for the use of NSNotFound. ~Phil On Jul 19, 2011, at 2:46 PM, Quincey Morris wrote: On Jul 19, 2011, at 12:32, Nick Zitzmann wrote: The only problem I ever had with unarchiving 32-bit app archives in a 64-bit app was with longs

Re: NSArrayController nib binding vs code binding

2011-07-19 Thread Trygve Inda
On 19 Jul 2011, at 02:41, Trygve Inda wrote: [myArrayController bind:@content toObject:myClassObject withKeyPath:@places options:NULL]; Hmm... Seems like it should be bind:@contentArray Please use the NSContentArrayBinding constant as that's what's it exists for, despite being fairly

Stupid (virtual) keyboard mistake... I think

2011-07-19 Thread William Squires
What's the proper way to detect if the Enter key on the virtual (on-screen) keyboard in iOS is touched? Is this part of the UITextField delegate protocol? Or is it supposed to be the Editing Did End event you see when you right-click on the UITextField in question (in IB, of course)? I've

linking an Apple framework into a static lib project and then linking the static lib into an application project...

2011-07-19 Thread Glen Haderman
I've got a Mac/Cocoa static library project.  It links against IOKit.framework.  It builds fine. I take the .a and header and import them into a Mac/Cocoa project. I get the following linker errors: Undefined symbols:   _IORegistryEntryCreateCFProperty, referenced from:   +[MyLibrary

Re: Stupid (virtual) keyboard mistake... I think

2011-07-19 Thread William Squires
Oops, should have stipulated: iOS 4 dev on Xcode 3.2.whatever. On Jul 19, 2011, at 6:57 PM, William Squires wrote: What's the proper way to detect if the Enter key on the virtual (on-screen) keyboard in iOS is touched? Is this part of the UITextField delegate protocol? Or is it supposed to

Re: Stupid (virtual) keyboard mistake... I think

2011-07-19 Thread Fritz Anderson
On 19 Jul 2011, at 6:57 PM, William Squires wrote: What's the proper way to detect if the Enter key on the virtual (on-screen) keyboard in iOS is touched? Is this part of the UITextField delegate protocol? Like textFieldShouldReturn:? Or do you mean something else? — F

Opening a file read-only?

2011-07-19 Thread Graham Cox
I'm using +[NSData dataWithContentsOfMappedFile:] to access a file. Is it possible to ensure this opens read-only? I see there's a version that takes options, but none of these options seem to open it read-only. --Graham ___ Cocoa-dev mailing list

Re: Opening a file read-only?

2011-07-19 Thread Greg Parker
On Jul 19, 2011, at 6:29 PM, Graham Cox wrote: I'm using +[NSData dataWithContentsOfMappedFile:] to access a file. Is it possible to ensure this opens read-only? I see there's a version that takes options, but none of these options seem to open it read-only. I believe it already opens the

Re: Opening a file read-only?

2011-07-19 Thread Graham Cox
On 20/07/2011, at 11:43 AM, Greg Parker wrote: On Jul 19, 2011, at 6:29 PM, Graham Cox wrote: I'm using +[NSData dataWithContentsOfMappedFile:] to access a file. Is it possible to ensure this opens read-only? I see there's a version that takes options, but none of these options seem to

Re: Understanding layer-backed views

2011-07-19 Thread Scott Anguish
On Jul 19, 2011, at 12:27 PM, Michael Crawford wrote: Graham; Scott, I have a follow-up question on this topic, if you don't mind. Do either of you have a recommendation on the idea of adding a layer-hosting view as a subview of a layer-backed view? Yes. You shouldn’t. When you turn

NSBeep() blocks for some users

2011-07-19 Thread George Nachman
I've had a few users complain that if my app calls NSBeep() many times in quick succession the program blocks until each of the beeps has played sequentially. I can't reproduce this: on my system, NSBeep() returns immediately and a subsequent call to NSBeep() will cause the sound to stop and

Re : Optimizing a loop

2011-07-19 Thread Mathieu Suen
When computing the string distance depending on the chosen algorithm you can exit the function earlier if the distance is becoming too high. An other possible way is to do some fuzzy string search: http://en.wikipedia.org/wiki/Fuzzy_string_searching HTH -- mathk - Message d'origine

Double-click a main window's title bar to minimize

2011-07-19 Thread Satoshi Nakagawa
Hi, Is there a way to read Double-click a main window's title bar to minimize setting in Appearance tab in the system preferences? I want to read the setting in my code to make a custom window work with the setting. Regards, Satoshi ___ Cocoa-dev

Customize NSScroller in the NSScrollView

2011-07-19 Thread Dawid Naglik
Hello Could anyone describe me a way to customize the NSScroller look inside NSScrollView? I know that NSScrollView and NSScroller have to be subclassed but I'm stuck with that. Could anyone tell me how to exchange slider bitmaps and implement the new slider into NSScrollView? Thanks in

NSLayoutManager / Justification incorrect when using drawGlyphsForGlyphRange

2011-07-19 Thread vade
I am drawing an NSAttributedString into a bitmap image and uploading to OpenGL as a texture. The strings origin is animated to mimic a scroll view, so speed is of the essence. Considering my need for animation I have migrated to NSLayoutManager / NSTextContainer and NSTextStorage, as opposed

NSLayoutManager / Justification incorrect when using drawGlyphsForGlyphRange

2011-07-19 Thread vade
I am drawing an NSAttributedString into a bitmap image and uploading to OpenGL as a texture. The strings origin is animated to mimic a scroll view, so speed is of the essence. Considering my need for animation I have migrated to NSLayoutManager / NSTextContainer and NSTextStorage, as opposed

Re: Understanding layer-backed views

2011-07-19 Thread Michael Crawford
Well, I suppose I could make sure the window's contentView is not layer backed and then put all of the content that used to be in that view into a new layer-backed view and then add the new layer-backed view as a subview of the contentView. Next, I create my layer-hosting view and add it to

Re: Understanding layer-backed views

2011-07-19 Thread Scott Anguish
Exactly. That’s an excellent example and should work fine. Great solution. On Jul 19, 2011, at 11:59 PM, Michael Crawford wrote: Well, I suppose I could make sure the window's contentView is not layer backed and then put all of the content that used to be in that view into a new