Re: Formatting float numbers

2010-08-23 Thread Ken Thomases
On Aug 22, 2010, at 6:35 PM, Adriano Brandão wrote: > But, just for curiosity, if I was using only c++ wouldn't I be able to do > that? You could presumably accomplish much the same thing using the CFNumberFormatter API. Regards, Ken ___ Cocoa-dev

Re: Another Icon Question

2010-08-23 Thread Ken Thomases
On Aug 23, 2010, at 9:59 PM, k...@highrolls.net wrote: > cmd-double click does nothing for me and I also get : error: > 'kToolbarDesktopFolderIcon' was not declared in this scope > > What am I dong wrong? What SDK are you building against? The toolbar icons were added in 10.6, apparently. Al

Re: UTI for Mach-O file

2010-08-25 Thread Ken Thomases
On Aug 25, 2010, at 12:46 PM, John Johnson wrote: > Hello. I'm implementing an NSDocument-based utility that loads mach-o files > and displays information about them. But no matter what UTI I put in the > Info.plist, I can't get the app to recognize the file when dropped on the > dock tile. The

Re: Performance issue

2010-08-26 Thread Ken Thomases
On Aug 26, 2010, at 8:39 AM, Uli Kusterer wrote: > On Aug 26, 2010, at 12:48 PM, Vijayakumar_Thota wrote: >> I am working on the performance issues of an application. I am facing a >> difficulty in finding out how many times a method is called in different >> contexts. >> >> Suppose there is a

Re: Changing tabview tab order with IB 3.2.3

2010-08-28 Thread Ken Thomases
On Aug 28, 2010, at 3:31 AM, Graham Cox wrote: > On 27/08/2010, at 10:01 PM, Nirias wrote: > >> Does anyone know how to re-order tabview tabs in the current IB? > > Just drag them left and right? That works, and for those occasions where a complex set of overlapping views makes it hard to mani

Re: Style question

2010-08-30 Thread Ken Thomases
On Aug 30, 2010, at 10:29 AM, Vincent Habchi wrote: > just an enquiry regarding coding style. What is considered best: > > baz = [[[Foo alloc] init] autorelease]; > … > return baz; > > or > > baz = [[Foo alloc] init]; > … > return [baz autorelease]; > > ? As with most style questions, there's

Re: [NSTextView] Is there a workaround for Snow Leopard new word selection behavior/bug?

2010-09-02 Thread Ken Thomases
On Sep 2, 2010, at 2:42 PM, Stephane Sudre wrote: > I need to detect double-click on a word when the alt key is hold down > (to do something similar to what Xcode does). > This does not work as well in Mac OS X 10.6. > > Because when you double-click on the word myclass in a text like this: > >

Re: Handling Connection Timeouts with NSStream

2010-09-10 Thread Ken Thomases
On Sep 10, 2010, at 12:52 PM, Carter R. Harrison wrote: > I'm working on a app that establishes a network connection using NSStream. I > found though that the code does not behave very well when it is trying to > connect to an unreachable IP address or an IP address that just isn't > accepting

Re: Memory question when added a view to the superView

2010-09-10 Thread Ken Thomases
On Sep 10, 2010, at 4:11 PM, Dave Carrigan wrote: > On Sep 10, 2010, at 1:08 PM, Philip Vallone wrote: >> >> Thanks for the prompt replay. >> >> Ok I added autorelease: >> >> PinDetailsView *detailsView= [[[PinDetailsView alloc] >> initWithFrame:CGRectMake(0, 0, 270, 420)]autorelease]; >> >>

Re: i5 & i7 auto graphics switching

2010-09-11 Thread Ken Thomases
On Sep 11, 2010, at 10:52 AM, Trygve Inda wrote: > Is there a way to be notified when the graphic card is switched? NSApplicationDidChangeScreenParametersNotification That fires when the GPU is switched, as well as well displays are rearranged or reconfigured. Regards, Ken ___

Re: i5 & i7 auto graphics switching

2010-09-12 Thread Ken Thomases
On Sep 11, 2010, at 10:57 PM, Trygve Inda wrote: >> On Sep 11, 2010, at 10:52 AM, Trygve Inda wrote: >> >>> Is there a way to be notified when the graphic card is switched? >> >> NSApplicationDidChangeScreenParametersNotification > > When it is running on the slow card, the CGDirectDisplayID wi

Re: Unix Signals Delivered from Quitting Cocoa Apps?

2010-09-13 Thread Ken Thomases
On Sep 13, 2010, at 2:30 AM, aaron smith wrote: > I'm working on a test to catch when an application crashes, and launch > another executable (eventually crash reporter). > > I'm exhibiting strange behavior - whenever I quit the application > normally, the information I'm getting back about what

Re: Unix Signals Delivered from Quitting Cocoa Apps?

2010-09-13 Thread Ken Thomases
On Sep 13, 2010, at 3:05 AM, aaron smith wrote: > Thanks for pointing that I can't use high level frameworks in a child. > I'll set up everything I need for the execvp call before the actual > fork. You haven't addressed the problem. I was not talking about the later fork(), but the first one.

Re: bindings and NSNumberFormatter, enforcing min/max values

2010-09-16 Thread Ken Thomases
On Sep 16, 2010, at 5:06 PM, Quincey Morris wrote: > Regarding NSUserDefaults, I don't see anything in the documentation that > claims KVC compliance for NSUserDefaults, though I could easily have missed > it. You're not supposed to bind to the shared NSUserDefaults instance. There's a separa

Re: SCPreferencesLock issue?

2010-09-17 Thread Ken Thomases
On Sep 17, 2010, at 2:43 AM, Jeremy Matthews wrote: > For some reason, I can't seem to get a lockwas wondering if anyone else > has been here before: I haven't dealt with this API before, but the below code is a mess. You also don't explain what you mean by "I can't seem to get a lock". T

Re: Extract Text From NSLabels to Mail

2010-09-17 Thread Ken Thomases
On Sep 17, 2010, at 6:37 AM, PJBorges wrote: > In my app I have a feature that opens Mail.app. The feature extracts > the contents of a number of labels into the message area of Mail, but > it is only the first label that is extracted, the rest are not. > > > My code: > MailOutgoingMessage *emai

Re: Extract Text From NSLabels to Mail

2010-09-18 Thread Ken Thomases
On Sep 18, 2010, at 3:59 AM, Philip Juel Borges wrote: > Thanks Ken for your input. You're welcome. I'm bringing this back to Cocoa-Dev rather than one-on-one so that others can participate. > I tried the below but it returns this error: > MyReport: unknown type

Re: What's the point of @properties?

2010-09-19 Thread Ken Thomases
On Sep 19, 2010, at 2:52 PM, Jim Thomason wrote: > I know I'd get use of the dot syntax (I do need to use @properties to > do that, right?) No. Dot syntax is syntactic sugar for invoking accessors. The accessor do not have to be related to a declared property (i.e. @property). Dot syntax work

Re: Distributed object vending problem

2010-09-20 Thread Ken Thomases
On Sep 18, 2010, at 11:14 AM, Ken Tozier wrote: > I'm writing two apps: A server and client and am having some trouble figuring > exactly what to link to in the client program. The server application has a > main class that has dozens of dependencies. I don't want to have to import > all the se

Re: NSInvocationOperation problem with a signal exc_bad_access

2010-09-20 Thread Ken Thomases
On Sep 20, 2010, at 11:06 AM, ico wrote: > NSInvocationOperation *theOp = [[[NSInvocationOperation alloc] > initWithTarget:dp selector:@selector(massiveWork:) object:nil] autorelease]; The selector here is "massiveWork:" with a colon. > - (void) massiveWork { The selector for this method is "

Re: Distributed object vending problem

2010-09-20 Thread Ken Thomases
On Sep 20, 2010, at 4:14 AM, Ken Tozier wrote: > server: (** NSConnection 0x114720 receivePort sendPort > refCount 1 **) > Ultimately, the client and server will need to work on different machines on > a network, thus the call to [NSSocketPortNameServer sharedInstance] > > Anyone see what I'

Re: Efficiently adding a bunch of items to an NSMutableArray

2010-09-22 Thread Ken Thomases
On Sep 22, 2010, at 05:46, Oleg Krupnov wrote: > It seems that the -addObjectsFromArray: method may be what I > need, but the docs do not make it clear if it's internally optimized > to do only a single memory re-allocation. I'll add my two cents: you should almost always use the method that dire

Re: NSURLConnection sync vs async connections

2010-09-23 Thread Ken Thomases
On Sep 23, 2010, at 4:21 AM, Devraj Mukherjee wrote: > Previous version I used NSURLConnection to make synchronous calls to > the API > I would like to move towards using async requests. I can grab / parse > the data using the delegate methods, what I am struggling with is how > I return the data

Re: cool way to call super?

2010-09-23 Thread Ken Thomases
On Sep 23, 2010, at 9:45 AM, Matt Neuburg wrote: > Is there a cool dynamic Cocoa way to call super with the same parameters > that came to me? Nope. > I guess what I'm looking for is a pre-configured invocation > of the current command where I can just change the target to super. Super isn't an

Re: DO problem with NSConnection/NSSocketPortNameServer

2010-09-24 Thread Ken Thomases
On Sep 24, 2010, at 1:35 AM, Ken Tozier wrote: > However, when I try to use NSSocketPortNameServer instead of > NSPortNameServer, I get server = nil > > server = [[NSConnection serviceConnectionWithName: @"PMXServer" > rootObject: self > usingNameServer: [NSSocketPor

Re: -[NSCFArray initWithObjects:count:]: nil object. Why no crash?

2010-09-26 Thread Ken Thomases
On Sep 26, 2010, at 4:32 PM, Jerry Krinock wrote: > When my app runs for a particular user it emits these to the console once in > awhile: > > *** -[NSCFArray initWithObjects:count:]: attempt to insert nil object at > objects[0] > > However, the app does not crash for him when this happens. >

Re: -[NSCFArray initWithObjects:count:]: nil object. Why no crash?

2010-09-27 Thread Ken Thomases
On Sep 26, 2010, at 7:51 PM, Jerry Krinock wrote: > On 2010 Sep 26, at 16:58, Ken Thomases wrote: > >> Have you tried actually using the method that's in his log >> (-initWithObjects:count:), instead of a different one? Or even >> +arrayWithObjects:count:? >

Re: Acquiring an NSConnection otherwise than by registered name?

2010-09-27 Thread Ken Thomases
On Sep 28, 2010, at 12:24 AM, Oleg Krupnov wrote: > My question is: is it possible to acquire the connection in another > way than using a name? Yes, of course. Have you looked at the NSConnection class reference, where it documents multiple methods for obtaining connection objects? First of a

Re: Acquiring an NSConnection otherwise than by registered name?

2010-09-28 Thread Ken Thomases
rom -connectionForProxy is the same for the both > threads. Is it a problem? Won't the two threads somehow interfere? I believe you are being bitten by what I wrote about here: > On Tue, Sep 28, 2010 at 9:12 AM, Ken Thomases wrote: > >> For a multi-threaded client which w

Re: Acquiring an NSConnection otherwise than by registered name?

2010-09-28 Thread Ken Thomases
On Sep 28, 2010, at 1:23 PM, Oleg Krupnov wrote: > So, let's assume I create the connection in this way: > > NSConnection* connection = [NSConnection connectionWithReceivePort:nil > sendPort:[[NSMachBootstrapServer sharedInstance] portForName:@"foo"]]; > > or even > > NSConnection* connection =

Re: Acquiring an NSConnection otherwise than by registered name?

2010-09-29 Thread Ken Thomases
Hi Oleg, On Sep 29, 2010, at 5:16 AM, Oleg Krupnov wrote: > Now I see. I hardly find words to thank you for your patience! :) You're welcome. I'm glad I could help. > Now I see that the correct picture is the following. There is only one > connection point, and there is only one root vended o

Re: I want a window's file owner that's not a NSWindowController

2010-09-29 Thread Ken Thomases
On Sep 29, 2010, at 3:21 AM, Jonny Taylor wrote: > OK, while that's a very handy thing to know, I think I have worked out a > simpler way that does not require an intermediate class - I'll state it here > for the archives (and any comments welcome...) > > I show the window using the following c

Re: Button performs action and then stores result to a binding?

2010-09-29 Thread Ken Thomases
On Sep 29, 2010, at 6:31 AM, Jonny Taylor wrote: > I have a modal dialog which, among other things, contains a number of file > paths. There are "set..." buttons to set which files these are pointing to. You should probably by using NSPathControl instead of displaying paths and having "set" but

Re: Acquiring an NSConnection otherwise than by registered name?

2010-09-29 Thread Ken Thomases
Hi Oleg, On Sep 29, 2010, at 9:57 AM, Oleg Krupnov wrote: > I tried -[NSConnection removeRunLoop:[NSRunLoop currentRunLoop]], but > it doesn't seem to change anything. Huh. I don't know what's going on there. You might consider opening a developer technical support incident with Apple to ask

Re: Acquiring an NSConnection otherwise than by registered name?

2010-09-30 Thread Ken Thomases
On Sep 30, 2010, at 6:21 AM, Oleg Krupnov wrote: > I have checked the mailing archives and it seems that I am not alone > with the problem that runInNewThread does not necessarily cause the > request to be processed in the new thread. Some folks report that > -removeRunLoop helped them, but my exp

Re: Acquiring an NSConnection otherwise than by registered name?

2010-09-30 Thread Ken Thomases
On Sep 30, 2010, at 11:17 AM, Oleg Krupnov wrote: > NSSocketPort* port = [[NSSocketPort alloc] initWithTCPPort:1234]; > NSConnection* connectionPoint = [[NSConnection alloc] > initWithReceivePort:port sendPort:nil]; > if ([connectionPoint registerName:CONNECTION_NAME > withNameServer:[NSSocketPort

Re: info.plist with DYLD_LIBRARY_PATH = ~/test

2010-10-02 Thread Ken Thomases
On Oct 1, 2010, at 11:49 PM, Kurt Sutter wrote: > In our application, the user should be able to change the version of a > library that the application is linked to. Don't link to the library/framework. Dynamically load it (dlopen, dlsym, etc.), instead. Granted, this is a pain in the neck co

Re: App works in debugger, won't launch in Finder

2010-10-02 Thread Ken Thomases
On Oct 1, 2010, at 11:52 PM, Rick Mann wrote: > I have an app that has a framework internally (and some plug-ins). When I > launch it from Xcode (debugging), everything works fine. But if I launch it > by double-clicking the icon in the Finder, I get the crash dialog with > "Library not loaded:

Re: info.plist with DYLD_LIBRARY_PATH = ~/test

2010-10-02 Thread Ken Thomases
On Oct 2, 2010, at 3:48 AM, Kurt Sutter wrote: > Yes, that is an option I have considered. But, if I understand this > correctly, it would mean resolving some hundred symbols through dlsym and > providing a glue function for each of them. Right? I don't see the need for a glue function. You do

Re: info.plist with DYLD_LIBRARY_PATH = ~/test

2010-10-02 Thread Ken Thomases
On Oct 2, 2010, at 5:10 AM, Kurt Sutter wrote: > Sorry to be obtuse, but it may be that I am overlooking something. Presently, > we have calls such as > > n = PyNumber_Float(obj) > s = PyString_AsString(obj) > > I understand that I would need to generate #defines for all those names, such > as

Re: allKeys and allValues

2010-10-04 Thread Ken Thomases
On Oct 4, 2010, at 4:21 PM, gMail.com wrote: > On the docs I read that for both the NSDictionary's allKeys and allValues, > the order of the elements in the array is not defined. Ok. > But, are the two arrays aligned each other? If the docs don't contain that promise, then you can't rely on it.

Re: Problem with MakeKeyandOrderFront

2010-10-05 Thread Ken Thomases
On Oct 5, 2010, at 1:55 PM, Amy Heavey wrote: > Now when I click the button the focus goes from the main window but the > second window doesn't appear. If I move the data file it works fine. Have I > just overloaded it already? Even if all I do is open the app and go to the > second tab and cli

Re: dictionaryWithObjectsAndKeys

2010-10-09 Thread Ken Thomases
On Oct 9, 2010, at 2:05 PM, k...@highrolls.net wrote: > I want to make a NSDictionary of text attributes to apply to text being > drawn in a NSTextFieldCell. > > This > > m_textAttributes = [NSDictionary dictionaryWithObjectsAndKeys: [NSFont > systemFontOfSize:12.0], NSFontAttributeName, NSRi

Re: dictionaryWithObjectsAndKeys

2010-10-09 Thread Ken Thomases
On Oct 9, 2010, at 2:30 PM, k...@highrolls.net wrote: > Is this the correct way to right justify text in an NSTextFieldCell? I believe you have to invoke -setAlignment: on the cell, not (just) include it in the attributes. Regards, Ken ___ Cocoa-dev

Re: NSDictionary allValues not mutable

2010-10-09 Thread Ken Thomases
On Oct 9, 2010, at 3:06 PM, Trygve Inda wrote: >> I have an NSMutableDictionary made from a plist with >> CFPropertyListCreateDeepCopy so that all leaves and containers are mutable. >> >> In this plist is an dict whose values I want to move into a mutable array to >> be displayed and edited in an

Re: NSDictionary setValue KVO

2010-10-10 Thread Ken Thomases
On Oct 10, 2010, at 10:32 AM, Keary Suska wrote: > On Oct 10, 2010, at 5:54 AM, Trygve Inda wrote: > >> I have a nib with an NSArrayController bound to this object with a keypath >> of mydi...@allvalues >> >> This works, but when I want to add an item to the dict (and have it >> reflected in the

Re: NSDictionary setValue KVO

2010-10-10 Thread Ken Thomases
On Oct 10, 2010, at 3:19 PM, Kyle Sluder wrote: > On Sun, Oct 10, 2010 at 12:57 PM, Ken Thomases wrote: >> A quick test program on Snow Leopard: a) confirms that NSMutableDictionary >> sends out change notifications for its keys, but b) does not send out change >>

Re: NSDictionary setValue KVO

2010-10-10 Thread Ken Thomases
On Oct 10, 2010, at 4:00 PM, Quincey Morris wrote: > On Oct 10, 2010, at 12:57, Ken Thomases wrote: > >> and b) what the heck "mydi...@allvalues" is supposed to mean. I'm not aware >> of that being a valid KVC collection operator. > > From the discussion

Re: remove icon from Dock

2010-10-12 Thread Ken Thomases
On Oct 12, 2010, at 7:57 AM, kirankumar wrote: > Need help , is there any command line for removing icon from Dock. > > I don't want to do drag option and aslo do not want right click on > Remove from Dock. If you intend to do this programmatically, only do so with the consent of the user. The

Re: Dynamically subclassing an observed object

2010-10-13 Thread Ken Thomases
On Oct 13, 2010, at 2:44 PM, Dave DeLong wrote: > I maintain some code that does dynamic subclassing to override an object's > -dealloc method to do some extra cleanup prior to deallocation. (And for the > curious, this cleanup is not necessary when using Garbage Collection) As mentioned, it's

Re: NSSavePanel does replace / in the filename with a :

2010-10-16 Thread Ken Thomases
On Oct 16, 2010, at 2:25 AM, Thorsten Lemke wrote: > The NSSavePanel does replace upon close a / in the filename with a : > How can I avoid this? You can't. Slashes are illegal characters in file names at the BSD/Posix layer, and thus in Cocoa. The slash is the path separator characters. It

Re: running a timer while displaying a sheet

2010-10-16 Thread Ken Thomases
On Oct 16, 2010, at 6:29 AM, Nick Rogers wrote: > When I run a sheet, I want it to display a text field which has to be updated > every second or so (basically showing a count down "60 Seconds", "59 Seconds" > and so on. > I am starting a timer in main thread using: > timerRawScanMsg = [NS

Re: NSSavePanel does replace / in the filename with a :

2010-10-16 Thread Ken Thomases
On Oct 16, 2010, at 9:46 AM, Fritz Anderson wrote: > On 16 Oct 2010, at 8:44 AM, Ken Thomases wrote: > >> (This doesn't happen in Carbon because Carbon still uses colons as path >> separators.) > > It doesn't much matter, but I had thought the imposture was t

Re: NSSavePanel does replace / in the filename with a :

2010-10-16 Thread Ken Thomases
On Oct 16, 2010, at 10:34 AM, Thorsten Lemke wrote: > The problem is: > I enter as name i.e.: Part 1/2.jpg into the save panel. > I click on ok. > I get as filename in the code: "Part 1:2.jpg". > > So, how can I avoid this? You don't avoid it. You don't want to. The *user-visible* file name i

Re: NSSavePanel does replace / in the filename with a :

2010-10-18 Thread Ken Thomases
On Oct 18, 2010, at 3:20 AM, Uli Kusterer wrote: > -> If you're converting between POSIX/Cocoa paths and CoreServices file > manager paths, use the existing conversion calls. CFURLRef includes some neat > methods to let you convert between both kinds of paths. In any case, Apple's > recommended

Re: NSDictionary allValues not mutable

2010-10-18 Thread Ken Thomases
On Oct 18, 2010, at 10:22 AM, Trygve Inda wrote: >> So if the master dictionary and the array for the NSTable are >> encapsulated together in a class, you could use NSMutableArray as the >> primary structure, and encapsulate a hidden NSMutableDictionary used >> only for faster searching. Both are

Re: NSDictionary allValues not mutable

2010-10-18 Thread Ken Thomases
On Oct 18, 2010, at 10:59 AM, Trygve Inda wrote: > I guess I am just not seeing how my NSArrayController would ties to this. So > I have a class MyDataClass and since my NSTableView is tied to an > NSArrayController, then the NSArrayController needs to get it's data from > MyDataClass. > > So is

Re: DO over unnamed sockets

2010-10-23 Thread Ken Thomases
On Oct 23, 2010, at 6:00 AM, Dave Keck wrote: > Can DO work over unnamed sockets? It appears not. I wasn't able to find a way to make your code work, either. My past experience and the Distributed Objects Programming Guide both suggest that NSConnection expects to work more like the case with

Re: fork/exec vs NSTask

2010-10-24 Thread Ken Thomases
On Oct 24, 2010, at 12:03 PM, eveningnick eveningnick wrote: > I am wondering, if NSTask can be replaced with low-level fork/exec > calls. Looking through forums, i often met statements that launching a > process with "fork/exec" is not an "OS X way", especially if i am > using Cocoa framework (a

Re: NSError help

2010-10-24 Thread Ken Thomases
On Oct 24, 2010, at 5:54 PM, Tom Jones wrote: > I'm trying to understand why I'm getting thrown in to the debugger when using > NSError. I have three methods and I'm overloading them and trying to pass the > NSError along the way. What am I doing wrong? > -(NSString *)getDataForType:(NSString *

Re: Switching app type from background only to full UI, and back?

2010-11-04 Thread Ken Thomases
On Nov 4, 2010, at 7:46 PM, Jim Wintermyre wrote: > TransformProcessType() looked promising, but it only goes in one direction. There is no going back. The transformation is unidirectional. There is no "secret" technique. What you've already found is it. Regards, Ken __

Re: Interrupt copyItemAtPath

2010-11-06 Thread Ken Thomases
On Nov 6, 2010, at 5:27 PM, gMail.com wrote: > I copy a 14GB file with > Since the copy could take several minutes, I would grant the user the > opportunity to interrupt the copy pressing a given button. > Or should I use the latest methods from FSCopyObject.c ? FSCopyObject.c? From Apple's sa

Re: Understanding the Run loop idea and the updating of controls during long operations

2010-11-06 Thread Ken Thomases
On Nov 6, 2010, at 9:19 PM, eveningnick eveningnick wrote: > I am trying to understand how does Run loop work. > Basically the problem i need to solve is like the following: > I have a Cocoa application, which is a little "adhoc" - for better > understanding of the "internals" of my app i do not

Re: Launchd and terminal process launch - is there any difference from that process' viewpoint?

2010-11-08 Thread Ken Thomases
On Nov 8, 2010, at 1:10 PM, eveningnick eveningnick wrote: > what is the difference between a process that was started by launchd and the > same process, started via terminal (without sudo command) in Mac OS 10.5? The execution context, as defined in this tech note: http://developer.apple.com/li

Re: Problem with redirecting stdout

2010-11-09 Thread Ken Thomases
On Nov 9, 2010, at 5:48 PM, Edmond Ho wrote: > To summarize, I use dup2() to "bind" stdout to my own NSPipe, and then add > an NSNotification observer to listen for an > NSFileHandleReadCompletionNotification on the NSPipe; the notification > callback then reads the NSPipe. NSFileHandle readInBack

Re: Detecting reading a key in KVC

2010-11-11 Thread Ken Thomases
On Nov 11, 2010, at 7:11 AM, Graham Cox wrote: > Just write a wrapper for -setObject:forKey: and -valueForKey: The first just > calls the same method on its (mutable) dictionary, the second can first check > for whether the value is actually present and if not kick off some task to > fetch it,

Re: Detecting reading a key in KVC

2010-11-11 Thread Ken Thomases
On Nov 11, 2010, at 4:57 PM, Graham Cox wrote: > On 12/11/2010, at 3:30 AM, Ken Thomases wrote: > >> You should not override -setValue:forKey: or -valueForKey: if you can avoid >> it. Instead, implement the methods -setValue:forUndefinedKey: and >> -valueForUndefinedK

Re: Default keyword selector type

2010-11-13 Thread Ken Thomases
On Nov 10, 2010, at 9:17 PM, Michael Hall wrote: > In looking at NSControl.h there is a NSKeyboardUI category definition with > the following instance method declaration > > - -- (void)performClick:sender; > > This category is defined a number of places and at least some of them > indicate tha

Re: Numbers and mutable sets and retain counts, oh my!

2010-11-13 Thread Ken Thomases
On Nov 13, 2010, at 8:57 AM, William Squires wrote: > Let's say I have some sample code that looks like: > > -(NSMutableSet *)allOddNumbersExcept5Set > { > NSMutableSet *results = [[NSMutableSet alloc] initWithCapacity:1]; > > for (int i=1; i<=10; i+=2) > { > if (i != 5) >{ >NSString *

Re: System resources and number of operations on an NSOperationQueue

2010-11-14 Thread Ken Thomases
On Nov 14, 2010, at 3:58 AM, Antonio Nunes wrote: > I'm developing a daemon to run tasks as files get dropped into a folder. When > a new file is detected, a new operation gets put onto the daemon's operation > queue. The operation launches a task and waits for it to finish, then the > operatio

Re: System resources and number of operations on an NSOperationQueue

2010-11-14 Thread Ken Thomases
On Nov 14, 2010, at 12:39 PM, Antonio Nunes wrote: > On 14 Nov 2010, at 16:25, Ken Thomases wrote: > >> -[NSProcessInfo activeProcessorCount] > > I see there is also processorCount. The docs totally don't explain what the > difference is. Is an active processor

Re: Detecting shared folders

2010-11-16 Thread Ken Thomases
On Nov 15, 2010, at 4:01 AM, Leo wrote: > I wonder if it's possible to detect a shared folder? That is a folder that > is shared via File Sharing. It would seem to be possible, since the Finder puts a banner in the window for shared folders. > Am I missing something obvious? Not obvious, no.

Re: readonly property which is a mutable array

2010-11-18 Thread Ken Thomases
On Nov 18, 2010, at 9:33 AM, Keary Suska wrote: > On Nov 18, 2010, at 5:35 AM, Remco Poelstra wrote: > >> Hi, >> >> I've a object like to following: >> @interface { >> NSMutableArray *items; >> } >> @property (nonatomic,readonly) NSMutableArray *items; >> @end >> >> I also have a protocol

Re: Infinite Loop invoking super ?? -[NSDocument canCloseDocumentWithSelector:::]

2010-11-22 Thread Ken Thomases
On Nov 22, 2010, at 11:32 AM, Jerry Krinock wrote: > How can there be an infinite loop invoking super in a method? Looks like it > was re-invoking itself instead of invoking super. Busted method or isa swizzling, maybe? Or a memory smasher that messed up the dispatch table? Regards, Ken ___

Re: respondsToSelector & "warning: may not respond"

2010-11-26 Thread Ken Thomases
On Nov 26, 2010, at 12:27 PM, Mike Abdullah wrote: > C) Typecast the object to a class that is known to implement -setOrdinal: D) Typecast the object to id. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin

Re: hidden file

2010-11-28 Thread Ken Thomases
On Nov 28, 2010, at 4:21 PM, Nick Zitzmann wrote: > On Nov 28, 2010, at 3:09 PM, Ariel Feinerman wrote: > >> Hi everyone, >> >> how to check whether a file is hidden in Finder? There seems file manager >> has no any methods to change file`s visibility like lchflags(). > > There are three differ

Re: Load Tab View Items Lazily for Performance - How

2010-12-01 Thread Ken Thomases
On Dec 1, 2010, at 1:44 PM, Jerry Krinock wrote: > The document window in a Core Data app has now grown to the point where it > has several tabs and sub-tabs. Some of them, a "Reports" tab in particular, > can take a long time to load for large documents, so that upon opening such a > document

Re: [CFBundleIdentifier] Is is really a hyphen or a minus?

2010-12-04 Thread Ken Thomases
On Dec 4, 2010, at 12:42 PM, Iceberg-Dev wrote: > By "hyphen", does the documentation actually mean a minus glyph (like the one > on the numeric keypad) or really the hyphen typographic glyph? > If the former, why not just write minus? That character's Unicode name is HYPHEN-MINUS. Calling it

Re: [CFBundleIdentifier] Is is really a hyphen or a minus?

2010-12-04 Thread Ken Thomases
On Dec 4, 2010, at 4:09 PM, Iceberg-Dev wrote: > I'm not trying to be pedantic here, I'm trying to figure out exactly which > characters are accepted and which patterns are supposedly correct. Since bundle identifiers are reverse DNS, they follow the same rules as domain names.

Re: Problem instantiating an array

2010-12-06 Thread Ken Thomases
Hi, On Dec 5, 2010, at 12:39 PM, Dennis Birch wrote: > - (id)initWithFrame:(NSRect)frame { >self = [super initWithFrame:frame]; >if (self) { >// Initialization code here. > TileColumn *allColumns[boardDimension - 1]; The above declaration is wrong for what you're tr

Re: Problem instantiating an array

2010-12-07 Thread Ken Thomases
On Dec 7, 2010, at 2:40 AM, Graham Cox wrote: > On 07/12/2010, at 5:35 PM, Ken Thomases wrote: > >>> gameColumns = [NSArray arrayWithObjects:allColumns count: boardDimension]; > > Another issue with this line is that, assuming 'gameColumns' is an instance >

Re: Problem instantiating an array

2010-12-07 Thread Ken Thomases
On Dec 7, 2010, at 12:11 PM, Dennis wrote: > Thanks for taking a look at my code. Sure. > On Dec 6, 2010, at 10:35 PM, Ken Thomases wrote: > >> If you step after the line "TileColumn *allColumns[boardDimension - 1]", >> nothing has happened, yet. That's

Re: NSScanner troubles

2010-12-10 Thread Ken Thomases
On Dec 10, 2010, at 9:06 PM, WT wrote: > Note that the scanner returns the wrong result when the string to be parsed > contains a '.' but I can't see why. NSScanner doesn't understand group separators, regardless of locale. You want to look into NSNumberFormatter. Cheers, Ken ___

Re: NSScanner troubles

2010-12-10 Thread Ken Thomases
On Dec 10, 2010, at 9:38 PM, WT wrote: > thank you both for the very fast response. You're welcome. > Is that behavior of NSScanner documented anywhere? I read the docs but don't > remember coming across it. I'm a bit stunned. What's the point of having a > scanner if it ignores certain key as

Re: what's the correct key path to observe for a BOOL property?

2010-12-16 Thread Ken Thomases
On Dec 16, 2010, at 7:45 AM, Roland King wrote: > If I have a property foo and it's boolean and has the getter/setter > isFoo/setFoo:, what's the correct key path to observe for KVO, assuming > default automatic KVO generation as provided by NSObject, is it 'foo', or is > it 'isFoo'? It's "fo

Re: Use of mutableArrayValueForKey

2010-12-17 Thread Ken Thomases
On Dec 17, 2010, at 3:42 AM, Giannandrea Castaldi wrote: > I have a class with a NSMutableArray as readonly property and I need > to execute an action when a new item is added to the array. > I would like: > - to use key-value observing on my NSMutableArray with the collection > accessor pattern >

Re: Strange error solved by turning off "Non-contiguous Layout"

2010-12-21 Thread Ken Thomases
On Dec 21, 2010, at 10:08 PM, Brad Stone wrote: > I have an NSTextView that has about 1,900 characters in it. Just regular > text. If I edit the text and save my app hangs at [[self > managedObjectContext] commitEditing]; I found setting nonContinuousLayout to > NO in the NSTextView prevent

Re: Exception Location

2010-12-21 Thread Ken Thomases
On Dec 21, 2010, at 11:25 PM, Richard Somers wrote: > The following exception message that is being sent by the frameworks: > -[NSCFArray objectAtIndex:]: index (x) beyond bounds (y) > > The method 'objectAtIndex:' is called in many location within the code base > but the console message gives

Re: Multiple File Open Strategy

2010-12-29 Thread Ken Thomases
On Dec 22, 2010, at 3:25 PM, Jeremy Torres wrote: > I have a working implementation using Grand Central dispatch queues that open > a file and compute an OpenSSL DSA hash, writing out the hash to a new "side > car" file for later verification. > > I would like to open multiple files at the same

Re: track files even if moved

2010-12-30 Thread Ken Thomases
On Dec 30, 2010, at 2:39 AM, Wesley Smith wrote: > I was looking at NSFileManager and the low-level file manage docs, > trying to figure out a way to track a file no matter where it gets > moved on the system, even if my app is not running. For example, > let's say my app references a document, b

Re: Calculate next occurrence of a NSDate

2010-12-31 Thread Ken Thomases
On Dec 31, 2010, at 7:22 AM, WT wrote: > The following is straight out of my code, and computes the next Wed or Sat > from a given date. Computing days by calculating the number of seconds in a day will fail when crossing into or out of Daylight Saving Time. Use -[NSCalendar dateByAddingCompon

Re: Communicating to a process started by root from non-root app

2011-01-05 Thread Ken Thomases
On Jan 3, 2011, at 1:22 PM, eveningnick eveningnick wrote: >> Unless I'm forgetting something basic, you should be able to connect to your >> daemon's socket from a non-root process if you first change the permissions >> on the socket (using chmod, as if it were a file). The man page for the >>

Re: GCD cancel handler invocation

2011-01-10 Thread Ken Thomases
On Jan 10, 2011, at 4:20 PM, Dave Zarzycki wrote: > On Jan 10, 2011, at 2:06 PM, Jonathon Kuo wrote: > >> I set up a source handler on a TCP socket like this: >> dispatch_source_t newsrc = >> dispatch_source_create(DISPATCH_SOURCE_TYPE_READ,sockfd,0,globalQueue); >> >> It works well, and whe

Re: Mutable to-many relationship not observable

2011-01-15 Thread Ken Thomases
On Jan 14, 2011, at 5:23 AM, Remco Poelstra wrote: > I add the observer as follows: > [[DigiDevicesManager sharedDigiDevicesManager] addObserver:self > forKeyPath:@"digiDevices" options:NSKeyValueObservingOptionOld context:nil]; > It's superclass is NSObject and I did not disable automatic

Re: Determining whether a dictionary is mutable or not

2011-01-15 Thread Ken Thomases
On Jan 15, 2011, at 5:38 AM, Tito Ciuro wrote: > On Jan 15, 2011, at 7:36 AM, Ken Ferry wrote: > >> I'm not sure this has been made clear: It is intentional that it is >> difficult to determine whether a dictionary is mutable. >> >> That's because you shouldn't do it. Whether a dictionary i

Re: Image Type for Button

2011-01-15 Thread Ken Thomases
On Jan 15, 2011, at 8:13 PM, John Joyce wrote: > Cannot seem to find this in the HIG. > What type of image would give the inverted look of the built in media types > (NSQuicklookTemplate for example) when in a Textured Square Button or > Segmented control? > > The images appear black with a cle

Re: How to change the product name with command line builds?

2011-01-15 Thread Ken Thomases
On Jan 14, 2011, at 7:55 AM, Gabriel Zachmann wrote: > I've got an Xcode project that compiles and works fine. > > The short question now is: what is the proper way to change the bundle's name > from the command line? Assuming your project is set up like normal (e.g. with Info.plist values base

Re: “EXC_BAD_ACCESS” object is not nil but not accessible

2011-01-16 Thread Ken Thomases
On Jan 16, 2011, at 10:37 PM, Marco Frisan wrote: > I verified with Instruments - Leaks the version available on the provided > link (since I modified my local copy) and the result is that I have no memory > leak. A leak is when something is under-released. The most likely culprit in your cas

Re: How to correctly load the bundle of a screen saver (was: How to change the product name with command line builds?)

2011-01-17 Thread Ken Thomases
On Jan 17, 2011, at 12:06 PM, Gabriel Zachmann wrote: >> On Jan 16, 2011, at 7:59 AM, Ken Thomases wrote: > >> xcodebuild -target Foo -configuration Release build PRODUCT_NAME=Foo2 > > Thanks a lot for your response. You're welcome. > The executable I am worki

Re: Using NSWindow without NIB (XIB) file ?

2011-01-25 Thread Ken Thomases
On Jan 25, 2011, at 4:48 AM, David Remacle wrote: > Is it possible to use NSWindow without NIB file ? It is definitely possible to create NSWindow objects in code, without using a NIB. However, the rest of your email suggests you're trying to build an entire application without either NIBs or

<    5   6   7   8   9   10   11   12   13   14   >