Re: Accessing array in thread safe way

2012-03-08 Thread Per Bull Holmen
Den 23:10 6. mars 2012 skrev Marco Tabini følgende: > On 2012-03-06, at 2:51 PM, Jan E. Schotsman wrote: > >> Hello, >> >> I have an array of progress values (number objects) for subprojects, from >> which I calculate the overall progress . >> The array is an atomic property of the project class.

Re: No indentation when displaying an icon in an NSMenuItem

2012-03-08 Thread Prime Coderama
I should have been more specific with what I wanted. The icon was in fact a tickbox, and the solution was to use NSMenuItem's setSate with a value of NSOnState On 07/03/2012, at 12:21 PM, Prime Coderama wrote: > I am trying to add an icon to only one NSMenuItem item but it is indenting > the i

Re: Accessing array in thread safe way

2012-03-08 Thread Preston Sumner
On Mar 6, 2012, at 12:51 PM, Jan E. Schotsman wrote: > Hello, > > I have an array of progress values (number objects) for subprojects, from > which I calculate the overall progress . > The array is an atomic property of the project class. > > Is it safe to access this array from multiple thread

Problem with refreshing NSMenuItems

2012-03-08 Thread Prime Coderama
I have an NSMenu with the following static NSMenuItems 1. NSMenuItem "Count of people" (hidden) 2. NSMenuItem (hidden) 3. NSMenuItem 4. NSMenuItem "Refresh List" 5. NSMenuItem 6. NSMenuItem "Quit" I then dynamically add n-amount of NSMenuItems between (2) and (3). This works great. The probl

Re: UIKit-additions and class references

2012-03-08 Thread Mikkel Islay
On 7 Mar 2012, at 06:10, Richard Somers wrote: > It appears that the same NSString Class Reference documentation for the Mac > OS X Developer Library is also used for the iOS Developer Library. The > original Mac OS X documentation does not mention iOS. No doubt that is the case. For example th

Re: Finding object array index when iterating through array

2012-03-08 Thread Mike Abdullah
On 6 Mar 2012, at 20:42, Prime Coderama wrote: > I have an array and I am iterating through it using this technique: > >> for (id object in array) { >>// do something with object >> } > > Is there way to obtain the object's current array index position or do I > have to add a counter? We

Re: Accessing array in thread safe way

2012-03-08 Thread Per Bull Holmen
Den 23:48 6. mars 2012 skrev Conrad Shultz følgende: > Personally, I try to the maximum extent possible to make properties be > of immutable types for exactly this reason.  It allows you to centralize > management of locking/synchronization thus wipe out a whole category of > potential bugs.  It

Re: Accessing array in thread safe way

2012-03-08 Thread Per Bull Holmen
Den 14:33 7. mars 2012 skrev Per Bull Holmen følgende: > Den 23:48 6. mars 2012 skrev Conrad Shultz > følgende: > >> Personally, I try to the maximum extent possible to make properties be >> of immutable types for exactly this reason.  It allows you to centralize >> management of locking/synchron

Re: Finding object array index when iterating through array

2012-03-08 Thread Fritz Anderson
On 6 Mar 2012, at 2:42 PM, Prime Coderama wrote: > I have an array and I am iterating through it using this technique: > >> for (id object in array) { >>// do something with object >> } > > Is there way to obtain the object's current array index position or do I > have to add a counter? •

Re: Finding object array index when iterating through array

2012-03-08 Thread Nick Zitzmann
On Mar 6, 2012, at 1:42 PM, Prime Coderama wrote: > I have an array and I am iterating through it using this technique: > >> for (id object in array) { >>// do something with object >> } > > Is there way to obtain the object's current array index position or do I > have to add a counter?

Sandbox, CoreData, Spotlight

2012-03-08 Thread Gerd Knops
My sandboxed app with spotlight importer and using core data uses Record-Level Indexing as described here: https://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/SpotlightCoreData/Articles/recordLevel.html#//apple_ref/doc/uid/TP40008065-CH101-SW2 The importer does work,

NSOpenPanel may not respond to setDirectoryURL?

2012-03-08 Thread Howard Moon
Hi all, I'm really not that familiar with Objective-C and Cocoa yet, but I'm getting a warning for something that works fine, and I hate warnings. The warning is: 'NSOpenPanel' may not respond to '-setDirectoryURL:' I know that setDirectoryURL: is an NSSavePane

Re: UIKit-additions and class references

2012-03-08 Thread David Duncan
On Mar 6, 2012, at 1:28 PM, Mikkel Islay wrote: > Does anyone know the reason why the UIKit-additions for NSString, NSValue > etc. aren't mentioned in the respective class references in the Apple > documentation for iOS? Category additions are documented separately from the main class. For exa

Re: Finding object array index when iterating through array

2012-03-08 Thread David Duncan
On Mar 6, 2012, at 12:42 PM, Prime Coderama wrote: > I have an array and I am iterating through it using this technique: > >> for (id object in array) { >>// do something with object >> } > > Is there way to obtain the object's current array index position or do I > have to add a counter?

Re: UIKit-additions and class references

2012-03-08 Thread Mikkel Islay
On 7 Mar 2012, at 20:40, David Duncan wrote: > Category additions are documented separately from the main class. For > example, UIKit's NSString additions are in NSString(UIStringDrawing) (which > you can search for in the documetnation). Absolutely. However, it would be convenient (and helpful

Re: No indentation when displaying an icon in an NSMenuItem

2012-03-08 Thread Seth Willits
On Mar 6, 2012, at 5:21 PM, Prime Coderama wrote: > I am trying to add an icon to only one NSMenuItem item but it is indenting > the icon and text by 1 level. > > I tried to set the setIndentationLevel to "0" but that doesn't work. Because it is 0. The gap on the left is for menu state, not ima

Re: No indentation when displaying an icon in an NSMenuItem

2012-03-08 Thread Peter Ammon
The checkmark is the on-state image. Try calling [menuItem setState:NSOnState]; Hope this helps, -Peter On Mar 6, 2012, at 5:21 PM, Prime Coderama wrote: > I am trying to add an icon to only one NSMenuItem item but it is indenting > the icon and text by 1 level. > > I tried to set the setInde

Re: No indentation when displaying an icon in an NSMenuItem

2012-03-08 Thread Fritz Anderson
On 6 Mar 2012, at 7:21 PM, Prime Coderama wrote: > An example of what I am trying to achieve can be seen in the Wireless status > bar menu where the tickbox is displayed against the current WiFi your > connected to e.g. http://cl.ly/2T362b2I0f1G1O3b3G3z The check mark is not an icon, but a part

Re: No indentation when displaying an icon in an NSMenuItem

2012-03-08 Thread Ken Thomases
On Mar 6, 2012, at 7:21 PM, Prime Coderama wrote: > I am trying to add an icon to only one NSMenuItem item but it is indenting > the icon and text by 1 level. > > I tried to set the setIndentationLevel to "0" but that doesn't work. > > An example of what I am trying to achieve can be seen in th

Re: Accessing array in thread safe way

2012-03-08 Thread Don Quixote de la Mancha
> Personally, I avoid sharing mutable data between threads if I possibly can. > It can quickly turn into an unholy mess. > > —Jens The key to not just safe but performant multithreaded code is to redesign your data structures and algorithm so that you need not synchronize at all. Many problem

Twitter Account accountStore Permissions Dialog / Alert ...

2012-03-08 Thread R
I notice that when I call: [[self accountStore] requestAccessToAccountsWithType:[self accountType] withCompletionHandler:^(BOOL granted, NSError *error) { etc }]; when the dialog is presents and asks for allow or notAllow a

Re: Finding object array index when iterating through array

2012-03-08 Thread Stephen J. Butler
On Tue, Mar 6, 2012 at 8:19 PM, Marco Tabini wrote: >> I have an array and I am iterating through it using this technique: >> >>> for (id object in array) { >>>    // do something with object >>> } >> >> Is there  way to obtain the object's current array index position or do I >> have to add a co

Re: Finding object array index when iterating through array

2012-03-08 Thread Eric Wing
On 3/6/12, Prime Coderama wrote: > I have an array and I am iterating through it using this technique: > >> for (id object in array) { >> // do something with object >> } > > Is there way to obtain the object's current array index position or do I > have to add a counter? > > Thanks in advanc

Re: Finding object array index when iterating through array

2012-03-08 Thread Greg Parker
On Mar 6, 2012, at 6:19 PM, Marco Tabini wrote: >> I have an array and I am iterating through it using this technique: >> >>> for (id object in array) { >>> // do something with object >>> } >> >> Is there way to obtain the object's current array index position or do I >> have to add a count

Re: Accessing array in thread safe way

2012-03-08 Thread Charles Srstka
On Mar 6, 2012, at 1:51 PM, Jan E. Schotsman wrote: > Hello, > > I have an array of progress values (number objects) for subprojects, from > which I calculate the overall progress . > The array is an atomic property of the project class. > > Is it safe to access this array from multiple threads

Why are 2 Terminal windows opening with NSAppleScript?

2012-03-08 Thread Prime Coderama
If no Terminal app is open, the following code opens TWO Terminal windows. Why is it doing this? I only want one window to open. If only one Terminal window is open, then the following code opens only ONE additional window. NSAppleScript* terminal = [[NSAppleScript alloc] initWithSource:

[MEET] CocoaHeadsNYC Thursday night (tonight)

2012-03-08 Thread Andy Lee
When: Thursday, March 8, 2012, 6:30-8:00 PM, followed by pizza at Patsy's. Who: Two speakers this month: Samuel Goodwin and Bob Clair. What: Samuel's talk will be on "Refactoring: Why you should do it, when you should do it, how to do it, and what to aim for." Bob will discuss a few quirks of A

Re: Finding object array index when iterating through array

2012-03-08 Thread Jens Alfke
On Mar 6, 2012, at 6:19 PM, Marco Tabini wrote: > [array indexOfObject:object] should do the trick, though, if you need to do > it at every iteration, keeping a counter may be better. Not if the array contains objects that are equal to one another. (It’s also a fairly expensive method, and the

Re: Accessing array in thread safe way

2012-03-08 Thread Brian Lambert
No. Assuming the property you describe is declared something like this: @property (strong, atomic) NSMutableArray * myArray; Then what's atomic is getting and setting the entire array. That is [project setMyArray:[[NSMutableArray alloc] init]]; would be atomic. Once a caller obtains the array

Re: Finding object array index when iterating through array

2012-03-08 Thread J. C. Allen
On Mar 6, 2012, at 3:42 PM, Prime Coderama wrote: > I have an array and I am iterating through it using this technique: > >> for (id object in array) { >>// do something with object >> } > > Is there way to obtain the object's current array index position or do I > have to add a counter? >

Re: Finding object array index when iterating through array

2012-03-08 Thread John Maisey
Hi, If the items are unique, how about: [array indexOfObject:object]; Using a counter is likely be faster though. John Maisey www.nhoj.co.uk www.twitter.com/johnmaisey www.facebook.com/nhojcouk > Date: Wed, 07 Mar 2012 07:42:17 +1100 > From: Prime Coderama > To: cocoa-dev@lists.apple.co

Re: NSTableCellView subclass layout from independent nib

2012-03-08 Thread Seth Willits
On Mar 6, 2012, at 6:03 PM, Seth Willits wrote: > Another possible solution is to use a class method on the cell view class > which does loading from a nib. That method would then have some > TableCellViewNibLoader class be File's Owner when loading the nib, and then > the view inside the nib c

Re: Finding object array index when iterating through array

2012-03-08 Thread Graham Cox
On 07/03/2012, at 2:22 PM, Graham Cox wrote: That was over 28 hours ago. Why is it taking so long for posted messages to show up on the list? It's crazy, because by the time the response arrives, the question has been answered over and over and over again --Graham ___

Versions browser, file access, revertToSaved

2012-03-08 Thread Martin Hewitson
Dear list, I have an app which works with autosave and Versions browser. However, I have discovered some strange behaviour. If I have a file (text file) open in the app, and the file is somehow accessed on disk (doing touch on the file is enough), the app jumps in and out of the Versions browse

Dynamic NSMenuItems with default param

2012-03-08 Thread Prime Coderama
I am dynamically building menu's based on an array and there is a sub-menu is linked to an IBAction which opens a folder in Finder. The folder it opens is based on a property of the object in my initial array. Is there a way of linked the NSMenuItem action to the IBAction and passing in this di

Re: Dynamic NSMenuItems with default param

2012-03-08 Thread Prime Coderama
Figured it out: > NSMenuItem *menuItem; > menuItem = [subMenu addItemWithTitle:@"Open folder" > action:@selector(openDirectory:person.directory) keyEquivalent:@""]; > [menuItem setRepresentedObject:person]; On 08/03/2012, at 6:56 PM, Prime Coderama wrote: > I am dynamically building menu's based

Re: Finding object array index when iterating through array

2012-03-08 Thread Andreas Grosam
On Mar 7, 2012, at 3:35 AM, Conrad Shultz wrote: > On 3/6/12 12:42 PM, Prime Coderama wrote: >> I have an array and I am iterating through it using this technique: >> >>> for (id object in array) { >>>// do something with object >>> } >> >> Is there way to obtain the object's current array

Re: Accessing array in thread safe way

2012-03-08 Thread Jan E. Schotsman
Thanks for all the answers. 1. I'll read the ThreadSafetySummary. So far I had only read the Threading section of the Objective C Programming Language. 2. Accessing the progress values of the subprojects seems the way to go here. 3. Creating a proxy mutable array seems like overkill. Basi

Re: Problem with refreshing NSMenuItems

2012-03-08 Thread Gregory Weston
Prime Coderama wrote: > I have an NSMenu with the following static NSMenuItems > > 1. NSMenuItem "Count of people" (hidden) > 2. NSMenuItem (hidden) > 3. NSMenuItem > 4. NSMenuItem "Refresh List" > 5. NSMenuItem > 6. NSMenuItem "Quit" > > I then dynamically add n-amount of NSMenuItems between

Re: Finding object array index when iterating through array

2012-03-08 Thread Roland King
On Mar 8, 2012, at 9:47 AM, Stephen J. Butler wrote: > On Tue, Mar 6, 2012 at 8:19 PM, Marco Tabini wrote: >>> I have an array and I am iterating through it using this technique: >>> for (id object in array) { // do something with object } >>> >>> Is there way to obtain the

Re: Problem with refreshing NSMenuItems

2012-03-08 Thread Michael Babin
On Mar 7, 2012, at 2:40 AM, Prime Coderama wrote: > I have an NSMenu with the following static NSMenuItems > > 1. NSMenuItem "Count of people" (hidden) > 2. NSMenuItem (hidden) > 3. NSMenuItem > 4. NSMenuItem "Refresh List" > 5. NSMenuItem > 6. NSMenuItem "Quit" > > I then dynamically add n-a

Re: Finding object array index when iterating through array

2012-03-08 Thread Peter
Am 08.03.2012 um 03:39 schrieb Greg Parker: > On Mar 6, 2012, at 6:19 PM, Marco Tabini wrote: >>> I have an array and I am iterating through it using this technique: >>> for (id object in array) { // do something with object } >>> >>> Is there way to obtain the object's curren

Re: NSOpenPanel may not respond to setDirectoryURL?

2012-03-08 Thread Mike Abdullah
On 7 Mar 2012, at 19:07, Howard Moon wrote: > Hi all, > > I'm really not that familiar with Objective-C and Cocoa yet, but I'm > getting a warning for something that works fine, and I hate warnings. The > warning is: > > 'NSOpenPanel' may not respond to '-setDirectoryURL:

Re: Accessing array in thread safe way

2012-03-08 Thread CoGe - Tamas Nagy
Maybe this will helps you, here is my thread-safe subclass of NSMutableArray: http://code.google.com/p/cogeopensource/source/browse/trunk/CoGeOpenSource/CoGeThreadSafeMutableArray.m Works well for my project. On Mar 8, 2012, at 11:22 AM, Jan E. Schotsman wrote: > Thanks for all the answers. >

Re: Cocoa-dev Digest, Vol 9, Issue 161

2012-03-08 Thread John Maisey
Hi, The 'do script' command opens a new shell window. From Terminal's Applescript dictionary: do script v : Runs a UNIX shell script or command. This script opens a new window always. tell application "Terminal" activate do script end tell The previous window when the appl

Re: NSOpenPanel may not respond to setDirectoryURL?

2012-03-08 Thread Howard Moon
On Mar 8, 2012, at 6:21 AM, Mike Abdullah wrote: >> >> I'm really not that familiar with Objective-C and Cocoa yet, but I'm >> getting a warning for something that works fine, and I hate warnings. The >> warning is: >> >> 'NSOpenPanel' may not respond to '-setDirectoryURL:' >

Re: Finding object array index when iterating through array

2012-03-08 Thread Daniel Vollmer
On 7 Mar 2012, at 12:09, John Maisey wrote: > Hi, > > If the items are unique, how about: > > [array indexOfObject:object]; Congratulations, you have just (depending on NSArray-implementation details) "improved" your loop from from O(N) to O(N^2). Don't do this. > Using a counter is likely b

ivar access during -finalize

2012-03-08 Thread jonat...@mugginsoft.com
I largely eschew -finalize in my GC app but on some occasions I do use it and I am seeing some resurrection problems. I have read "Implementing a finalize method" and "Inapplicable Patterns" in the "Garbage Collection Programming Guide". Consider: - (void)finalize { // a single referenc

Re: Accessing array in thread safe way

2012-03-08 Thread Per Bull Holmen
Den 23:55 7. mars 2012 skrev Don Quixote de la Mancha følgende: > If you possibly can replace locking algorithms with what are commonly but > incorrectly called lock free algorithms.  They use Atomic Arithmetic > Primitives provided by the CPU Instruction Set  Archetector to manage very > shor

Re: Why are 2 Terminal windows opening with NSAppleScript?

2012-03-08 Thread Ken Thomases
On Mar 7, 2012, at 9:32 PM, Prime Coderama wrote: > If no Terminal app is open, the following code opens TWO Terminal windows. > Why is it doing this? I only want one window to open. > > If only one Terminal window is open, then the following code opens only ONE > additional window. > > NSAppl

Re: ivar access during -finalize

2012-03-08 Thread Quincey Morris
On Mar 8, 2012, at 07:39 , jonat...@mugginsoft.com wrote: > Consider: > > - (void)finalize > { > // a single reference to _myIvar is held by self > [[NSFileManager defaultManager] removeItemAtPath:_myIvar error:NULL] > [super finalize]; > } > I had initially assumed that _myIva

Re: ivar access during -finalize

2012-03-08 Thread Nick Zitzmann
On Mar 8, 2012, at 8:39 AM, jonat...@mugginsoft.com wrote: > I largely eschew -finalize in my GC app but on some occasions I do use it and > I am seeing some resurrection problems. > I have read "Implementing a finalize method" and "Inapplicable Patterns" in > the "Garbage Collection Programmin

Re: NSOpenPanel may not respond to setDirectoryURL?

2012-03-08 Thread Mike Abdullah
On 8 Mar 2012, at 14:54, Howard Moon wrote: > On Mar 8, 2012, at 6:21 AM, Mike Abdullah wrote: >>> >>> I'm really not that familiar with Objective-C and Cocoa yet, but I'm >>> getting a warning for something that works fine, and I hate warnings. The >>> warning is: >>> >>> 'N

Re: Accessing array in thread safe way

2012-03-08 Thread Mike Abdullah
On 8 Mar 2012, at 14:22, CoGe - Tamas Nagy wrote: > Maybe this will helps you, here is my thread-safe subclass of NSMutableArray: > http://code.google.com/p/cogeopensource/source/browse/trunk/CoGeOpenSource/CoGeThreadSafeMutableArray.m > > Works well for my project. License?

Re: Accessing array in thread safe way

2012-03-08 Thread Jan E. Schotsman
On Mar 8, 2012, at 3:22 PM, CoGe - Tamas Nagy wrote: Maybe this will helps you, here is my thread-safe subclass of NSMutableArray: http://code.google.com/p/cogeopensource/source/browse/trunk/CoGeOpenSource/CoGeThreadSafeMutableArray.m Thanks for the code. I have two questions: 1. If you bel

Re: NSOpenPanel may not respond to setDirectoryURL?

2012-03-08 Thread Howard Moon
On Mar 8, 2012, at 9:17 AM, Mike Abdullah wrote: > > On 8 Mar 2012, at 14:54, Howard Moon wrote: > >> On Mar 8, 2012, at 6:21 AM, Mike Abdullah wrote: I'm really not that familiar with Objective-C and Cocoa yet, but I'm getting a warning for something that works fine, and I

Re: Accessing array in thread safe way

2012-03-08 Thread CoGe - Tamas Nagy
LGPL, as the page mentions it;) Sent from my iPhone On Mar 8, 2012, at 6:18 PM, Mike Abdullah wrote: On 8 Mar 2012, at 14:22, CoGe - Tamas Nagy wrote: Maybe this will helps you, here is my thread-safe subclass of NSMutableArray: http://code.google.com/p/cogeopensource/source/browse/tru

Re: NSOpenPanel may not respond to setDirectoryURL?

2012-03-08 Thread Howard Moon
On Mar 8, 2012, at 10:10 AM, Howard Moon wrote: > > On Mar 8, 2012, at 9:17 AM, Mike Abdullah wrote: > >> >> On 8 Mar 2012, at 14:54, Howard Moon wrote: >> >>> On Mar 8, 2012, at 6:21 AM, Mike Abdullah wrote: > > I'm really not that familiar with Objective-C and Cocoa yet, but I'm

Re: NSOpenPanel may not respond to setDirectoryURL?

2012-03-08 Thread Howard Moon
>> Hmmm... I'm building a VST3/vstgui4 plug-in, and I think the base SDK and >> deployment targets are set as required, like this: >> >> SDKROOT = macosx10.5 >> SDKROOT[arch=x86_64] = $(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk >> >> When I build either a 32-bit or 64-bit build, while running on 10.6,

Re: Accessing array in thread safe way

2012-03-08 Thread Brian Lambert
Spin locks are useful in certain situations. First of all, on a single-processor system, it's never a good idea to use a spin lock because all it will do is burn up the waiting thread's scheduling quantum while preventing a thread that's holding the lock from getting scheduled so that it can compl

Re: Accessing array in thread safe way

2012-03-08 Thread CoGe - Tamas Nagy
On Mar 8, 2012, at 6:52 PM, Jan E. Schotsman wrote: > > On Mar 8, 2012, at 3:22 PM, CoGe - Tamas Nagy wrote: > >> Maybe this will helps you, here is my thread-safe subclass of >> NSMutableArray: >> http://code.google.com/p/cogeopensource/source/browse/trunk/CoGeOpenSource/CoGeThreadSafeMutabl

Re: Accessing array in thread safe way

2012-03-08 Thread Jeffrey Walton
On Thu, Mar 8, 2012 at 10:46 AM, Per Bull Holmen wrote: > Den 23:55 7. mars 2012 skrev Don Quixote de la Mancha > følgende: > >> If you possibly can replace locking algorithms with what are commonly but >> incorrectly called lock free algorithms.  They use Atomic Arithmetic >> Primitives provid

Re: Accessing array in thread safe way

2012-03-08 Thread Charles Srstka
On Mar 8, 2012, at 8:22 AM, CoGe - Tamas Nagy wrote: > Maybe this will helps you, here is my thread-safe subclass of > NSMutableArray:http://code.google.com/p/cogeopensource/source/browse/trunk/CoGeOpenSource/CoGeThreadSafeMutableArray.m > > Works well for my project. IMO, if anything is overki

Re: Accessing array in thread safe way

2012-03-08 Thread CoGe - Tamas Nagy
Thanks for the great explanation Brian. Having a dual-processor system is a need for my app, so that's why I chose SpinLocks. But using dispatch blocks is could be an other option, I guess. On Mar 8, 2012, at 8:19 PM, Brian Lambert wrote: > Spin locks are useful in certain situations. > > Fir

Re: Accessing array in thread safe way

2012-03-08 Thread Charles Srstka
On Mar 8, 2012, at 1:19 PM, Brian Lambert wrote: > In many simple scenarios, especially when contention is very low, > @synchronized will be the best choice because it's trivial to get right and > high-performance. @synchronized is easy-to-use, for sure, but it is far from high-performance. The

Re: Accessing array in thread safe way

2012-03-08 Thread CoGe - Tamas Nagy
I should subclass NSMutableArray because I had a project which used NSMutableArray (calls) before, but was not thread safe. Anyway, I can't really understand why it would be _really_ better to implement just accessors, but maybe you could explain it a bit more? On Mar 8, 2012, at 9:02 PM, Char

Re: Accessing array in thread safe way

2012-03-08 Thread Charles Srstka
On Mar 8, 2012, at 2:18 PM, CoGe - Tamas Nagy wrote: > I should subclass NSMutableArray because I had a project which used > NSMutableArray (calls) before, but was not thread safe. Anyway, I can't > really understand why it would be _really_ better to implement just > accessors, but maybe you c

Re: Accessing array in thread safe way

2012-03-08 Thread CoGe - Tamas Nagy
Thanks for the explanation, you are absolutely right! Tamas On Mar 8, 2012, at 9:32 PM, Charles Srstka wrote: > On Mar 8, 2012, at 2:18 PM, CoGe - Tamas Nagy wrote: > >> I should subclass NSMutableArray because I had a project which used >> NSMutableArray (calls) before, but was not thread saf

Re: ivar access during -finalize

2012-03-08 Thread jonat...@mugginsoft.com
On 8 Mar 2012, at 16:58, Quincey Morris wrote: > >> A more robust solution is a probably a separate -dispose method. > > Yes, though knowing when to call it can be a puzzle in itself, if there are > multiple references to the object. In general, you'll probably need to invent > a reference co

Re: NSOpenPanel may not respond to setDirectoryURL?

2012-03-08 Thread Mike Abdullah
Time for me to be cruel and pick apart your code. On 8 Mar 2012, at 18:10, Howard Moon wrote: > Hmmm... I'm building a VST3/vstgui4 plug-in, and I think the base SDK and > deployment targets are set as required, like this: > > SDKROOT = macosx10.5 > SDKROOT[arch=x86_64] = $(DEVELOPER_SDK_DIR)/M

Re: Accessing array in thread safe way

2012-03-08 Thread Mike Abdullah
Clearly I suck at Google code :( On 8 Mar 2012, at 18:12, CoGe - Tamas Nagy wrote: > LGPL, as the page mentions it;) > > Sent from my iPhone > > On Mar 8, 2012, at 6:18 PM, Mike Abdullah wrote: > >> >> On 8 Mar 2012, at 14:22, CoGe - Tamas Nagy wrote: >> >>> Maybe this will helps you, here

Re: Accessing array in thread safe way

2012-03-08 Thread Brian Lambert
I should have said, "relatively". As in, good enough for many scenarios where it will be used infrequently and keeping the code simple makes sense. Of course, you're right, Charles. 1,000,000 integer increments synchronized by @synchronized, OSSpinLock, and NSLock: PerfTimer[95716:403] 1,000,00

Re: NSOpenPanel may not respond to setDirectoryURL?

2012-03-08 Thread Howard Moon
Correct on all counts. Especially the "cruel" part. :-) (I actually had already realized the real reason calling release was wrong, but hadn't removed that line of code yet.) Thanks, Howard On Mar 8, 2012, at 12:47 PM, Mike Abdullah wrote: > Time for me to be cruel and pick apart your

@-directives

2012-03-08 Thread H. Miersch
hi. is there a list of @-directives (like @class, @property and @synthesize) somewhere out there? ___ 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 coc

Re: Accessing array in thread safe way

2012-03-08 Thread Charles Srstka
On Mar 8, 2012, at 2:51 PM, Brian Lambert wrote: > I should have said, "relatively". As in, good enough for many scenarios > where it will be used infrequently and keeping the code simple makes sense. > > Of course, you're right, Charles. > > 1,000,000 integer increments synchronized by @synch

Re: Accessing array in thread safe way

2012-03-08 Thread Brian Lambert
Cool! Thanks for that. My tests were run on an 27" iMac 3.4 GHz Intel Core i7. Code was compiled with -O3 (Fastest). The PerfTimer I used is my own. I blogged about it here: http://www.objective-brian.com/334 Feedback is welcome. Brian On Thu, Mar 8, 2012 at 1:20 PM, Charles Srstka wrote: >

Re: ivar access during -finalize

2012-03-08 Thread Quincey Morris
On Mar 8, 2012, at 09:09 , Nick Zitzmann wrote: > +defaultManager is not thread-safe IIRC. It's currently listed as thread-safe: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html I believe there was histo

Re: Accessing array in thread safe way

2012-03-08 Thread Quincey Morris
On Mar 8, 2012, at 12:18 , CoGe - Tamas Nagy wrote: > I should subclass NSMutableArray because I had a project which used > NSMutableArray (calls) before, but was not thread safe. Anyway, I can't > really understand why it would be _really_ better to implement just > accessors, but maybe you co

Re: Accessing array in thread safe way

2012-03-08 Thread Charles Srstka
On Mar 8, 2012, at 4:15 PM, Quincey Morris wrote: > Well, slap my head if I'm missing your intention, but I don't see how having > an *atomically* safe NSMutableArray helps at all. As soon as anyone in any > thread writes: > > for (NSInteger i = 0; i <= atomicallySafeArray.count; i++) { >

Re: Accessing array in thread safe way

2012-03-08 Thread Charles Srstka
On Mar 8, 2012, at 3:29 PM, Brian Lambert wrote: > Cool! Thanks for that. > > My tests were run on an 27" iMac 3.4 GHz Intel Core i7. Code was compiled > with -O3 (Fastest). > > The PerfTimer I used is my own. I blogged about it here: > http://www.objective-brian.com/334 > Feedback is welcom

Re: Accessing array in thread safe way

2012-03-08 Thread Quincey Morris
On Mar 8, 2012, at 14:29 , Charles Srstka wrote: > For those two examples, it seems like having the default accessor return an > immutable array via copy would solve the issue. It wouldn't solve, e.g., the possibly inconsistency between 'array.count' and a subsequent reference, unless it was co

Re: @-directives

2012-03-08 Thread Roland King
Can't find one (why is there not a formal language document in the documentation somewhere, perhaps because features are added every release) - maybe we can build one here @property @synthesize @class @interface @implementation @protocol @end @autoreleasepool @throw @catch @private @public @prot

Re: @-directives

2012-03-08 Thread Jeffrey Walton
On Thu, Mar 8, 2012 at 4:12 PM, H. Miersch wrote: > hi. > is there a list of @-directives (like @class, @property and @synthesize) > somewhere out there? Apple's official document (they seem to be spread around the document) * https://developer.apple.com/library/mac/documentation/Cocoa/Conceptua

Re: @-directives

2012-03-08 Thread Thomas Davie
Not that I know of off the top of my head, but here's my attempt at such a list: @class @interface @implementation @end @private @public @protected @protocol @required @optional @property @synthesize @try @catch @finally @autoreleasepool @synchronized Have I missed your favourite out? Bob if (*r

Re: Accessing array in thread safe way

2012-03-08 Thread Charles Srstka
On Mar 8, 2012, at 4:57 PM, Quincey Morris wrote: > It wouldn't solve, e.g., the possibly inconsistency between 'array.count' and > a subsequent reference, unless it was coded to keep a "consistent" local > reference to the copy of the array, in which case you'd want the copy to be > explicit i

Re: Accessing array in thread safe way

2012-03-08 Thread Kyle Sluder
On Mar 8, 2012, at 2:15 PM, Quincey Morris wrote: > On Mar 8, 2012, at 12:18 , CoGe - Tamas Nagy wrote: > >> I should subclass NSMutableArray because I had a project which used >> NSMutableArray (calls) before, but was not thread safe. Anyway, I can't >> really understand why it would be _reall

String Constants the solution

2012-03-08 Thread Prime Coderama
I have references to 'ground' and 'air' in multiple files. It is usually used in this context, but not always. > if ([transport.type isEqualToString:@"ground"]) { > // do something for automobiles > } > else if ([transport.type isEqualToString:@"air"]) { > // do something else for pl

Re: @-directives

2012-03-08 Thread Charles Srstka
On Mar 8, 2012, at 5:14 PM, Thomas Davie wrote: > Not that I know of off the top of my head, but here's my attempt at such a > list: > > @class > @interface > @implementation > @end > @private > @public > @protected > @protocol > @required > @optional > @property > @synthesize > @try > @catch >

Re: String Constants the solution

2012-03-08 Thread Eeyore
On Mar 8, 2012, at 4:29 PM, Prime Coderama wrote: > I have references to 'ground' and 'air' in multiple files. It is usually used > in this context, but not always. >> if ([transport.type isEqualToString:@"ground"]) { >>// do something for automobiles >> } >> else if ([transport.type isEq

Re: @-directives

2012-03-08 Thread Greg Parker
On Mar 8, 2012, at 3:04 PM, Roland King wrote: > Can't find one (why is there not a formal language document in the > documentation somewhere, perhaps because features are added every release) - > maybe we can build one here > > @property > @synthesize > @class > @interface > @implementation >

Re: Problem with refreshing NSMenuItems

2012-03-08 Thread Jerry Krinock
On Mar 7, 2012, at 2:40 AM, Prime Coderama wrote: > I then dynamically add n-amount of NSMenuItems between (2) and (3). This > works great. > > The problem I am having, is when I hit "Refresh" I haven't studied your case in detail, but the usual mechanism for implementing dynamic menus is the

Re: @-directives

2012-03-08 Thread Roland King
Good thinking .. OBJC1_AT_KEYWORD(not_keyword) OBJC1_AT_KEYWORD(class) OBJC1_AT_KEYWORD(compatibility_alias) OBJC1_AT_KEYWORD(defs) OBJC1_AT_KEYWORD(encode) OBJC1_AT_KEYWORD(end) OBJC1_AT_KEYWORD(implementation) OBJC1_AT_KEYWORD(interface) OBJC1_AT_KEYWORD(private) OBJC1_AT_KEYWORD(protected) OBJ

Re: Versions browser, file access, revertToSaved

2012-03-08 Thread Jerry Krinock
On 2012 Mar 07, at 23:48, Martin Hewitson wrote: > I have an app which works with autosave and Versions browser. Oh, so you've implemented +[NSDocument autosavesInPlace] ;) > I have a file-monitor in the app which reloads the document if it changes on > disk. Great feature. I've done that to

Re: UIKit-additions and class references

2012-03-08 Thread Matt Neuburg
On Wed, 07 Mar 2012 11:40:41 -0800, David Duncan said: >On Mar 6, 2012, at 1:28 PM, Mikkel Islay wrote: > >> Does anyone know the reason why the UIKit-additions for NSString, NSValue >> etc. aren't mentioned in the respective class references in the Apple >> documentation for iOS? > >Category ad

Re: Why are 2 Terminal windows opening with NSAppleScript?

2012-03-08 Thread Matt Neuburg
On Thu, 08 Mar 2012 14:32:07 +1100, Prime Coderama said: >If no Terminal app is open, the following code opens TWO Terminal windows. Why >is it doing this? I only want one window to open. > >If only one Terminal window is open, then the following code opens only ONE >additional window. > >NSApp

Re: @-directives

2012-03-08 Thread Matt Neuburg
On Thu, 08 Mar 2012 23:14:02 +, Thomas Davie said: >Not that I know of off the top of my head, but here's my attempt at such a >list: > >@class >@interface >@implementation >@end >@private >@public >@protected >@protocol >@required >@optional >@property >@synthesize >@try >@catch >@finally >@

NSTableView update basics

2012-03-08 Thread Erik Stainsby
I have a tableView which will accept one new row and updates to that row succeed. Subsequent application of the same process does add new rowData dictionary objects to the tableData model (NSMutableArray) but the tableView will not display these additions. A button on the UI is wired up to - (I

Re: NSTableView update basics

2012-03-08 Thread Conrad Shultz
This doesn't make sense - it will either return 1 or 0. Hence only 1 row appears. Just return [tableData count]. (Sent from my iPhone.) -- Conrad Shultz On Mar 8, 2012, at 21:42, Erik Stainsby wrote: > - (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView { >return [tableData

Uncaught Exception: NSUnknownKeyException

2012-03-08 Thread Donald Hall
Does anyone have any idea what might be wrong if I am getting this exception: Uncaught Exception: NSUnknownKeyException [ valueForUndefinedKey:]: this class is not key value coding-compliant for the key (null). Action is one of my classes. I am upgrading an old project for Lion. The present ve

Re: Uncaught Exception: NSUnknownKeyException

2012-03-08 Thread Mike Abdullah
Got a stack trace? Sent from my iPad On 9 Mar 2012, at 06:57 AM, Donald Hall wrote: > Does anyone have any idea what might be wrong if I am getting this exception: > > Uncaught Exception: > NSUnknownKeyException > [ valueForUndefinedKey:]: this class is not key value > coding-compliant for th

  1   2   >