Re: Zeroing out instance variables

2010-04-17 Thread Ken Thomases
On Apr 16, 2010, at 4:05 PM, Ben Haller wrote: > So I'm keeping an "unused pool" of these objects, and when I'm done with an > object I throw it into the pool, and when I need a new one I grab one from > the pool. I do these operations with inline functions, so I can get a new > object instan

Re: Launch app with params as front process and wait?

2010-04-17 Thread Ken Thomases
On Apr 17, 2010, at 8:14 AM, Gaurav Srivastava wrote: > I was working with NSTask and came across some issues. I searched on the > internet and found that there has been a similar query but that didn't have > any solution. The link for that is > http://lists.apple.com/archives/cocoa-dev//2003/May/

Re: Zeroing out instance variables

2010-04-17 Thread Ken Thomases
On Apr 16, 2010, at 5:34 PM, Paul Sanders wrote: > Another way might be to provide a method in each class or subclass called, > say, zeroIVars and code it as (typed in mail): > > - (void) zeroIVars > { >static ThisClass *clean_instance_of_this_class; > >assert ([self isMemberOfClass: [T

Re: Zeroing out instance variables

2010-04-17 Thread Ken Thomases
On Apr 17, 2010, at 8:53 AM, Paul Sanders wrote: > Something I've never been clear about though is > where an object's retain count is stored. This obviously > requires an iVar somewhere (in addition to isA), so there might > be a trap for the unwary there [...] My understanding, which is vag

Re: Zeroing out instance variables

2010-04-17 Thread Ken Thomases
On Apr 17, 2010, at 9:37 AM, Paul Sanders wrote: > > That is, retain counts are stored outside of the instance. > In that case there is a danger that a pointer to whatever is referenced would > be transferred to the copy of the object, which is not what you want. No, you misunderstand. There is

Re: Zeroing out instance variables

2010-04-17 Thread Ken Thomases
On Apr 17, 2010, at 9:35 AM, Jean-Daniel Dupas wrote: > That said, this is an implementation details. > > IIRC, GnuStep used to store the retain count in 4 additional bytes allocated > before each object. > > uint32_t *rc = (uint8_t *)self - 4; Well, it's an implementation detail of which you

Re: Zeroing out instance variables

2010-04-17 Thread Ken Thomases
On Apr 17, 2010, at 9:53 AM, Uli Kusterer wrote: > On 17.04.10 16:47, Ken Thomases wrote: >> On Apr 17, 2010, at 9:37 AM, Paul Sanders wrote: >>>> That is, retain counts are stored outside of the instance. >>> In that case there is a danger that a pointer to whatev

Re: Launch app with params as front process and wait?

2010-04-17 Thread Ken Thomases
On Apr 17, 2010, at 12:43 PM, Gaurav Srivastava wrote: > I am using following: > > NSTask* task = [NSTask launchedTaskWithLaunchPath:@"path" arguments:args]; > int pid = [task processIdentifier]; > ProcessSerialNumber psn; > GetProcessForPID(pid, &psn); > SetFrontProcess(&psn); > [task waitUntil

Re: Strange "autoreleased with no pool in place" message

2010-04-17 Thread Ken Thomases
On Apr 17, 2010, at 2:39 PM, Alexander Bokovikov wrote: > On 18.04.2010, at 1:30, Jens Alfke wrote: > >> >> On Apr 17, 2010, at 12:18 PM, Alexander Bokovikov wrote: >> >>> *** _NSAutoreleaseNoPool(): Object 0x209fa0 of class NSCFString >>> autoreleased with no pool in place - just leaking >>

Re: Converting an afp:NSURL to a filesystem path - or - Ya can't get there from here...

2010-04-17 Thread Ken Thomases
On Apr 17, 2010, at 6:46 PM, James Bucanek wrote: > How do I get the mount point path of a freshly mounted volume in Snow Leopard? > > In Leopard (10.5), the NSWorkspaceDidMountNotification included an > NSDevicePath value. It contained the path to the mount point of the freshly > mounted volum

Re: Warning with an initializer method of AMWorkflow

2010-04-18 Thread Ken Thomases
On Apr 18, 2010, at 2:56 PM, Mark Munz wrote: > If I try to create an AMWorkflow using the initContentsWithURL:error: > method, I get a warning. > warning: incompatible Objective-C types 'struct NSError **', expected > 'struct NSDictionary **' when passing argument 2 of > 'initWithContentsOfURL:e

Re: Introspecting the current method

2010-04-18 Thread Ken Thomases
On Apr 18, 2010, at 7:14 PM, Dave DeLong wrote: > If I'm inside a method, is there a way to know at runtime whether that method > is a class or an instance method? Keep in mind that class methods are just instance methods, where the instance is the class object. (The class object being an inst

Re: Introspecting the current method

2010-04-18 Thread Ken Thomases
On Apr 18, 2010, at 9:21 PM, Michael Ash wrote: > On Sun, Apr 18, 2010 at 10:15 PM, Dave DeLong wrote: >> Yes, code should obviously be written with this knowledge in mind. The use >> case I have for it is for macros. I like to use a debugging macro like the >> following to ensure that method

Re: Introspecting the current method

2010-04-18 Thread Ken Thomases
On Apr 18, 2010, at 9:26 PM, Dave DeLong wrote: > That's amazing! Is there some sort of coherent list of magic identifiers > somewhere? http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html Cheers, Ken ___

Re: No icon in Dock's Application folder HUD?

2010-04-24 Thread Ken Thomases
On Apr 24, 2010, at 2:47 PM, Scott Cherf wrote: > The running application icon shows up fine in the dock and if I place the > application in the dock the icon looks right when it isn't running also. No > problems with badging in the alert panels either, but when I put my > Applications folder i

Re: NSApplicationMain question

2010-04-26 Thread Ken Thomases
On Apr 25, 2010, at 10:23 AM, Paul Sanders wrote: > I tested my multiple-monitor support by plugging an external monitor into the > back of my 2009 MacBook. Note that the menu isn't necessary located on the > primary screen Um, actually the menu bar is on the primary display. That's the defin

Re: question about "read-only" rule for Memory Management

2010-04-26 Thread Ken Thomases
On Apr 26, 2010, at 11:39 PM, Kyle Sluder wrote: > On Mon, Apr 26, 2010 at 6:57 PM, Philip Mobley wrote: >> Question: is the BELOW method named appropriately? >> >> - (UIImage *) getImageWithTag:(NSString *)tag; > > No. The "get" prefix is used for return-via-pointer. For example, > -[NSString

Re: va_end() & [NSString initWithFormat:arguments:]

2010-04-29 Thread Ken Thomases
On Apr 29, 2010, at 9:44 PM, Patrick M. Rutkowski wrote: > Do I have to do a va_end() after using -[NSString initWithFormat:arguments:]? If you call va_start(), you need to call va_end(). From the stdarg(3) man page: "Note that each call to va_start() must be matched by a call to va_end(), from

Re: Value Bindings in IB - Where's the documentation?

2010-05-02 Thread Ken Thomases
On May 2, 2010, at 5:14 AM, Brian Bruinewoud wrote: > I'm trying to find documentation about what the various bindings in IB > actually do. If I look at the documentation for NSArrayController (or any > controller) and NSPopUpButton (or any UI control) I don't find what I'm > looking for. http

Re: Authenticate NSFileManager Operations

2010-05-05 Thread Ken Thomases
On May 5, 2010, at 10:32 AM, k...@highrolls.net wrote: > I am using > > - (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString > *)dstPatherror:(NSError **)error > > to copy a framework to /Library/Frameworks. > > But first I use > > - (BOOL)removeItemAtPath:(NSString *)path error:(NSErr

Re: Modal window that does not block the main runloop

2010-05-07 Thread Ken Thomases
On May 7, 2010, at 2:26 PM, Jens Alfke wrote: > On May 7, 2010, at 10:28 AM, David Alter wrote: > >> I need to bring a window up that is modal for the application (i.e. you can >> not make other windows active, and you can not use menus while this window >> is up). However after bringing the mod

Re: self = [super init], nil?

2010-05-08 Thread Ken Thomases
On May 8, 2010, at 9:06 AM, Joanna Carter wrote: > If you declare +init, you are writing a static method, not an instance method. And while we're correcting things, there's no such thing as a "static method" in Objective-C. There are class methods. The use of "static" in this way is a C++-ism

Re: Question about model observers

2010-05-11 Thread Ken Thomases
On May 11, 2010, at 10:17 AM, Keary Suska wrote: > There have been some lengthy discussions about this. An object may choose to > emit KVO notifications for its collection properties (but this behavior > should never be expected unless it is specifically documented), but no > collection will ev

Re: Question about model observers

2010-05-12 Thread Ken Thomases
On May 12, 2010, at 11:44 AM, Quincey Morris wrote: > *All* collections emit KVO notifications when their contents change, in the > sense of objects entering or leaving the collection. Add, remove and replace > for arrays, add and remove for sets, set and remove for dictionaries. Arrays and set

Re: Question about model observers

2010-05-12 Thread Ken Thomases
On May 12, 2010, at 2:39 PM, Quincey Morris wrote: > On May 12, 2010, at 11:04, Ken Thomases wrote: > >> On May 12, 2010, at 11:44 AM, Quincey Morris wrote: >> >>> *All* collections emit KVO notifications when their contents change, in the >>> sens

Re: new to cocoa

2010-05-13 Thread Ken Thomases
On May 13, 2010, at 11:38 PM, Kiel Gillard wrote: > This most certainly is happening because you cannot use UIButton objects as > keys in a dictionary because NSDictionary copies the objects used as keys. > Furthermore, UIButton does implement the NSCopying methods. I assume you meant "does _no

Re: Posix error 24

2010-05-15 Thread Ken Thomases
On May 15, 2010, at 9:39 AM, Paul Sanders wrote: >> On May 15, 2010, at 9:24 AM, The Geezer wrote: >> >> I wrote a cocoa application that periodically gets a posix error 24. >> I know this means my app's number of open files has exceeded >> kern.maxfilesperproc, however, I can't figure out when

Re: Posix error 24

2010-05-15 Thread Ken Thomases
On May 15, 2010, at 9:44 AM, Ken Thomases wrote: > Probably easier and more productive to use Instruments and the File Activity > instrument. Hmm. Looking at that instrument in detail, it's not clear that it catches all file descriptors. In particular, it seems to only tra

Re: Custom View Binding, Arrays, and observeValueForKeyPath

2010-05-19 Thread Ken Thomases
On May 19, 2010, at 2:05 AM, Mazen M. Abdel-Rahman wrote: > I have a custom view class with an array property. I want to bind that array > property to a model - which in my case is an array that is in a > container/manager object. The binding is done via a custom view controller > (in it's a

Re: getting file creation date from NTFS

2010-05-22 Thread Ken Thomases
On May 22, 2010, at 10:33 AM, Angelo Chen wrote: > I'd like to get creation date of a file, here are the codes: Since there seems to be a bug with Cocoa (that you should file at ), you may wish to try stat(2) or perhaps FSGetCatalogInfo(). For stat(2), if you're tar

Re: getting file creation date from NTFS

2010-05-23 Thread Ken Thomases
On May 23, 2010, at 4:19 AM, Paul Sanders wrote: > Assuming that these figures come from stat (man -S 2 stat for details), it > should be in something called st_birthtime. Yes, although the stat structure only has the st_birthtimespec field if you build with 64-bit inodes enabled. This is the

Re: getting file creation date from NTFS

2010-05-23 Thread Ken Thomases
On May 23, 2010, at 5:33 AM, Angelo Chen wrote: > I think FSGetCatalogInfo (&ref, kFSCatInfoCreateDate, &info, NULL, NULL, > NULL); info.createDate has the creation date, can see it clearly in debugger, > problem is, how to convert it into NSDate You should use UCConvertUTCDateTimeToCFAbsoluteT

Re: Object Ownership

2010-05-23 Thread Ken Thomases
On May 23, 2010, at 7:34 PM, Graham Cox wrote: > What I don't understand is why you make the copy. > > [NSURL URLWithString] doesn't require a mutable string, it requires a string, > so your whole method could be reduced to: He does have a comment ("do some stuff with aCopy here") indicating th

Re: Boolean Values in a plist

2010-05-23 Thread Ken Thomases
On May 23, 2010, at 10:23 PM, Dale Miller wrote: > I need to use the parameters obtained from a plist (via > NSPropertyListSerialization). I can get the process to work quite well, > except that I have to use in my code an undocumented class: NSCFBoolean. > Determining that the returned object i

Re: Suppressing visibility in the Dock

2010-05-23 Thread Ken Thomases
On May 23, 2010, at 11:01 PM, Ben Haller wrote: > So I've got an app that can run both as a UI app and as a command-line tool. One recommendation is to split the app into a GUI front-end and a back-end tool. I think you can also get away with using LSBackgroundOnly or LSUIElement and then, whe

Re: isKindofClass with NSData and NSKeyUnarchiver

2010-05-27 Thread Ken Thomases
On May 27, 2010, at 4:21 AM, Philip Vallone wrote: > I am passing different types of data to NSData (NSString, NSArray, UIImage). > I am trying to find out what kind of data t is so I know how to handle the > NSData when I receive it. NSData is just a byte sequence. It doesn't have any knowle

Re: Problem getting correct file URL in NSTask process

2010-05-27 Thread Ken Thomases
On May 27, 2010, at 4:33 AM, Antonio Nunes wrote: > I have a daemon that spawns NSTasks on request. A task is passed a number of > paths to process. These paths are pased correctly to the task, and in the > task I can correctly extract the path string from optarg. No, they aren't and no you can

Re: Problem getting correct file URL in NSTask process

2010-05-27 Thread Ken Thomases
On May 27, 2010, at 6:55 AM, Antonio Nunes wrote: > Thanks so much for the elaborate and pertinent answer Ken. You are right. I > was not passing the arguments correctly to the task. You're welcome. Glad I could help. > I was creating the arguments like this: > >[args addObject:[NSString

Re: UTI strings

2010-05-30 Thread Ken Thomases
On May 30, 2010, at 1:04 PM, julius wrote: > unless of course there's a way of specifying the constants for > NSAttributedString using the kUTTypes that I've not found yet The Snow Leopard AppKit release notes include this

Re: UTI strings

2010-05-31 Thread Ken Thomases
On May 30, 2010, at 5:15 PM, julius wrote: > On 30 May 2010, at 20:21, Ken Thomases wrote: > >> On May 30, 2010, at 1:04 PM, julius wrote: >> >>> unless of course there's a way of specifying the constants for >>> NSAttributedString using the kUTType

Re: Value Transformer with multiple Model Key Paths

2010-05-31 Thread Ken Thomases
On May 30, 2010, at 11:46 PM, Quincey Morris wrote: > On May 30, 2010, at 18:11, Markus Spoettl wrote: > >> What I usually do in such situations is create an artificial property on the >> model object that combines the state of multiple properties into one value. >> In your case that properties

Re: UTI strings

2010-05-31 Thread Ken Thomases
On May 31, 2010, at 4:06 AM, Jean-Daniel Dupas wrote: > Le 31 mai 2010 à 10:53, julius a écrit : > >> and which onto NSMacSimpleTextDocumentType ? > > In 3 major releases Apple didn't managed to declare UTI for modern file > formats like sdef, $ mdls foo.sdef ... kMDItemContentType

Re: va_list and unanticipated format specifiers

2010-06-03 Thread Ken Thomases
On Jun 3, 2010, at 6:47 AM, jonat...@mugginsoft.com wrote: > One of my logging methods uses a variable argument list and is accessed via a > macro > > #define MLog(level,s,...) [[MLog sharedController] withLevel:level > sourceFile:__FILE__ lineNumber:__LINE__ format:(s),## __VA_ARGS__] > > The

Re: va_list and unanticipated format specifiers

2010-06-03 Thread Ken Thomases
On Jun 3, 2010, at 8:46 AM, jonat...@mugginsoft.com wrote: > My app runs user supplied scripts. > > These scripts may contain RubyCocoa statements such as: > OSX::NSLog("task parameters are %@ and %@", a, b) > > These scripts may contain errors and the generated error reports may contain > the

Re: va_list and unanticipated format specifiers

2010-06-04 Thread Ken Thomases
On Jun 4, 2010, at 8:34 AM, jonat...@mugginsoft.com wrote: > Thanks for persisting Ken. You're welcome. > In general it would seem that when a method/function has format + va_list > signature > invocations should not contain single variable argument lists. > The following regex is reasonably

Re: Cross XIB references?

2010-06-06 Thread Ken Thomases
On Jun 6, 2010, at 2:19 AM, Jean-François Brouillet wrote: >> • Subject: Re: Cross XIB references? >> • User-agent: Microsoft-Entourage/12.23.0.091001 >> On Sat, 05 Jun 2010 22:14:22 +0100, Jean-Fran?ois Brouillet >> said: >>> So ... is there a way to refer to NIB1.objA from NIB2.objB ? >> >> Th

Re: Cross XIB references?

2010-06-06 Thread Ken Thomases
On Jun 6, 2010, at 3:12 AM, Jean-François Brouillet wrote: > [...] making reference to object id 123 in file one.xib to object id 456 > in file two.xib should be a walk in the park ... You're still not getting it. There are no such objects. NIBs are object graph templates, not object graphs.

Re: Cross XIB references?

2010-06-06 Thread Ken Thomases
On Jun 6, 2010, at 4:34 AM, Jean-François Brouillet wrote: > It would be more effective to just answer "No. What you say you want is not > supported" rather than missing the point. I did say that. I also tried to give you the conceptual grounding so that you could understand why. > This cont

Re: Notification of window visible?

2010-06-07 Thread Ken Thomases
> Am 04.06.2010 um 07:11 schrieb Chris Idou: > >> How does one get notification that a window has become visible? I >> can see notifications for most every type of window event except >> this most obvious one. Why do you need such a notification? Windows don't "spontaneously" become visible

Re: Notification of window visible?

2010-06-07 Thread Ken Thomases
On Jun 7, 2010, at 2:58 PM, Jens Alfke wrote: > On Jun 7, 2010, at 3:31 AM, Ken Thomases wrote: > >> Why do you need such a notification? Windows don't "spontaneously" become >> visible unbeknownst to your code. > > I’ve run into this in an app that

Re: Adding objects from one array to another and and Key Value Observing

2010-06-09 Thread Ken Thomases
On Jun 9, 2010, at 3:19 PM, Mazen M. Abdel-Rahman wrote: > I have a view class that observes changes in a model class's array via KVO. > Unfortunately - when ever the array is updated - the updates are sent to the > view one at at a time. > > In my model class I have the following line: > >

Re: application's menu item name always appears lowercase

2010-06-09 Thread Ken Thomases
On Jun 9, 2010, at 8:04 PM, Kyle Sluder wrote: > For Cocoa apps, the title of the application menu always matches the > localized name of the app. Which is obtained from the Info.plist and InfoPlist.strings files. The CFBundleName key. Technical Q&A QA1544 Obtaining the localized application

Re: Double binding not possible?

2010-06-11 Thread Ken Thomases
On Jun 11, 2010, at 9:33 AM, vincent habchi wrote: > I have a popUp button with which I'd like to update two objects at the same > time (one with the selected index, and the other with the selected value). > Can you confirm me it is impossible (once one binding of the selected type is > set, th

Re: Notification when network volume disappears

2010-06-14 Thread Ken Thomases
On Jun 14, 2010, at 4:52 AM, Boris Prohaska wrote: > i was just wondering, is there any way to determine when for example a > network cable is plugged off while copying data to a network share? The > Finder has a pretty long timeout... > > Is there a way in the FS API or ANY other way to get no

Re: Notification when network volume disappears

2010-06-14 Thread Ken Thomases
On Jun 14, 2010, at 11:40 AM, Boris Prohaska wrote: > Thats exactly the problem. IF the OS was aware of it, then there would be no > problem. There is also no setting for timeouts etc when performing blocking > operations onto the filesystem. > Maybe that is a OS X limitation?? The way around i

Re: Notification when network volume disappears

2010-06-14 Thread Ken Thomases
On Jun 14, 2010, at 1:37 PM, Jens Alfke wrote: > On Jun 14, 2010, at 11:13 AM, Ken Thomases wrote: > >> The way around it is to not do blocking operations. Use non-blocking, >> asynchronous I/O operations, and impose the timeout yourself. > > Last I heard (admittedly

Re: Adding attributes to NSMutableAttributedString

2010-06-14 Thread Ken Thomases
On Jun 10, 2010, at 5:18 PM, Tom Korsgren wrote: > I'm trying to add some attributes to a NSMutableAttributedString using the > code below but only get errors. > > NSMutableAttributedString *string = @"aaa"; This line is wrong. You are taking a NSString literal object

Re: Opening a file for writing text in /private/var/log

2010-06-14 Thread Ken Thomases
On Jun 13, 2010, at 10:24 AM, Pierre Fournier wrote: > Hi,I want to log something in a file at /private/var/log, using NSFileHandle. Do you really want to do that? Have you considered ~/Library/Logs? Or using the Apple System Log facility

Re: mutableArrayValueForKey: truth or dare

2010-06-17 Thread Ken Thomases
On Jun 17, 2010, at 12:10 PM, Mike Abdullah wrote: > On 17 Jun 2010, at 17:47, Matt Neuburg wrote: > >> There is an assertion often encountered in people's blogs, answers to >> questions on forums, etc., that the proxy object provided by >> mutableArrayValueForKey: is inefficient > > This is wro

Re: an oldie but a goodie: observing properties of collected objects

2010-06-17 Thread Ken Thomases
On Jun 17, 2010, at 2:21 PM, Matt Neuburg wrote: > It has been well said by mmalc that "Observing a collection is not the same > as observing the properties of the objects in a collection." Specifically, > in that oh-so-common configuration, an NSMutableArray of MSMutableDictionary > objects, if e

Re: an oldie but a goodie: observing properties of collected objects

2010-06-17 Thread Ken Thomases
On Jun 17, 2010, at 8:07 PM, Jerry Krinock wrote: > I was going to ask what happens if this object which owns 5000 widget objects > gets deallocated. Their observers have not been removed and I would expect > nastygrams like this [1]. But then I noticed that your observer is 'self'. > > Ken,

Re: an oldie but a goodie: observing properties of collected objects

2010-06-17 Thread Ken Thomases
On Jun 17, 2010, at 8:16 PM, Matt Neuburg wrote: > That's pretending that "self", who owns the array, is also the one who wants > to do the observing, that it always wants to do it, etc. Obviously that's > easy. > > I'm talking about the general problem of any object registering through the > arr

Re: mutableArrayValueForKey: truth or dare

2010-06-17 Thread Ken Thomases
On Jun 17, 2010, at 8:41 PM, Charles Srstka wrote: > On Jun 17, 2010, at 8:19 PM, Matt Neuburg wrote: > >> On or about 6/17/10 5:56 PM, thus spake "Roland King" : >> >>> if ... you just have a class variable called or _ then the >>> whole array is not replaced, the method you call on >>> NSMut

Re: Memory management on returning nil in init

2010-06-21 Thread Ken Thomases
On Jun 21, 2010, at 9:43 AM, Eiko Bleicher wrote: > One of my initializers can fail and thus it should return nil. Consider the > following example: > Does this code leak? I am inclined to think I need to call [self release] > before returning nil Yes, you need to release self. This is docume

Re: objc_msgSend

2010-06-21 Thread Ken Thomases
First, see the documentation for +[NSObject initialize] (a class method) to learn what that method is and does. Second, the crash report indicates infinite recursion and eventual exhaustion of the stack or heap. Third, when something like this only happens to one customer out of hundreds, I of

Re: docs, KVO and NSUserDefaults etc.

2010-06-21 Thread Ken Thomases
On Jun 21, 2010, at 12:28 PM, Matt Neuburg wrote: > On the one hand, Apple seems to warn in some documents that one should not > assume KVO-compliance unless explicitly asserted. On the other, KVO is far > more widely implemented in the built-in classes than is explicitly asserted. Those two stat

Re: Finder open / close notifications

2010-06-23 Thread Ken Thomases
On Jun 23, 2010, at 6:00 PM, dev.dig...@verostudios.com wrote: > I'm trying to receive a notification when a file is opened basically like the > main Recent Items menu. I'd like to poll a directory and monitor file > operations for certain file types. Specifically open / close operations ...

Re: Best way to determine if a directory is a package

2010-06-25 Thread Ken Thomases
On Jun 25, 2010, at 6:16 AM, Paul Sanders wrote: >> Hidden item names begin with a "." > > There is also a UF_HIDDEN flag in stat.st_flags. Google man stat os x for > details (you want stat(2)). The Finder respects this flag on my 10.6.3 > system. Whether it corresponds to kLSItemInfoIsVisib

Re: Getting rid of the field editor after editing

2010-06-26 Thread Ken Thomases
On Jun 26, 2010, at 2:27 AM, Graham Cox wrote: > What is the correct way to tear down or remove the field editor when editing > is complete? The field editor is intimately connected to the window, so it's often the window's responsibility to manage it. See the discussion of the -[NSWindow end

Re: Capturing output from another task with elevated privilages

2010-07-01 Thread Ken Thomases
On Jul 1, 2010, at 9:37 AM, Eric Hoaglin wrote: > I'm trying to capture the output of the task that I run. and from what I > understand, if you want to do so, you pass a FILE* > to AuthorizationExecuteWithPrivileges and then just read it as a normal file > (which you can see from lines 29-45 >

Re: Finder-like conversion of a fileURL to 'user-friendly' path

2010-07-01 Thread Ken Thomases
On Jul 1, 2010, at 12:33 PM, Kevin Wojniak wrote: > On Jul 1, 2010, at 10:29 AM, Rainer Standke wrote: > >> At the bottom of each finder window there is a 'path' display that indicates >> the path to the directory represented by the window. I'd like to be able to >> convert a path like this one

Re: horizontal radio group

2010-07-01 Thread Ken Thomases
On Jul 2, 2010, at 1:05 AM, Angelo Chen wrote: > radio group created in Interface builder is vertical, how to set it > horizontal? example, two radio buttons in one line? Thanks, A group of radio buttons is really an NSMatrix. The way to change the number of rows and columns in a matrix is to

Re: How to debug crash on startup of 64-bit build

2010-07-06 Thread Ken Thomases
On Jul 6, 2010, at 11:47 AM, Jeffrey J. Early wrote: > I just transitioned my (primarily Cocoa based) code from building 32-bit > i386/PPC, to also include x86_64. Unfortunately, when launching the 64-bit > version I'm getting a crash at launch and I can't figure out how to debug it. > Stack tr

Re: Pass-by value… warning

2010-07-07 Thread Ken Thomases
On Jul 7, 2010, at 10:27 AM, Greg Guerin wrote: > vincent habchi wrote: > >> That's true, the compiler cannot guarantee that dim > 1, which is always the >> case actually. >> I am going to put an extra text at the beginning of the method, like: "if >> (dim < 1) return;" and see what happens. >

Re: Sanity Check

2010-07-07 Thread Ken Thomases
On Jul 7, 2010, at 6:09 PM, k...@highrolls.net wrote: > Even though it would be better style would my approach cause any problem? I > don't see any. Yes. You alloc+init and you also retain. Then, you (presumably) only release once when the panel closes. Thus, you are leaking the window cont

Re: How to catch [NSEvent dealloc]?

2010-07-07 Thread Ken Thomases
On Jul 8, 2010, at 12:03 AM, Michael Ash wrote: > On Wed, Jul 7, 2010 at 6:34 PM, Paul Sanders > wrote: >>> If you can require 10.6 (or iOS 4, maybe?) then you can use the new >>> associated object API. Use objc_setAssociatedObject to attach your >>> object to the NSEvent object, and the runtime

Re: Data downloading performance

2010-07-17 Thread Ken Thomases
On Jul 17, 2010, at 12:36 AM, Rafael Cerioli wrote: > Le 16 juil. 2010 à 18:56, Kyle Sluder a écrit : > >> On Jul 16, 2010, at 3:46 PM, Rafael Cerioli wrote: >> >>> - using a NSURLConnection seams nice, but as it calls its delegate >>> (-connection:didReceiveData:) on the main thread, it has t

Re: How do I refresh NSTableView after programmatically changing bindings on a dataCell

2010-07-17 Thread Ken Thomases
On Jul 16, 2010, at 10:16 PM, François Beausoleil wrote: > I have an NSPopUpButton which holds the names of keys I want to display in an > NSTableView. A picture is worth a thousand words: > http://skitch.com/francoisb/dc63m/nstableview-redisplay > > I have an action on my controller which rebi

Re: Data downloading performance

2010-07-17 Thread Ken Thomases
On Jul 17, 2010, at 10:38 AM, Rafael Cerioli wrote: > Just out of curiosity, if there is communication between threads, even with > runloops, there must be a lock at some point ? To schedule something in the > main thread's runloop, you must lock the runloop don't you ? No. There are lockless

Re: Data downloading performance

2010-07-17 Thread Ken Thomases
On Jul 17, 2010, at 3:27 PM, Rafael Cerioli wrote: > Ok, ok busted : I'm not much experienced ! That's precisely why I was > writing to that list in the first place : trying to get knowledge more > concrete than my intuitions, I thought that was the point. Yes, but you pushed back whenever pe

Re: Initializing unichar variable with a human readable letter

2010-07-17 Thread Ken Thomases
On Jul 17, 2010, at 3:58 PM, vincent habchi wrote: > I have a very simple problem: I'd like to affect to a unichar variable the > value of the glyph é (or any non-ascii character). > > If I (naively) write: "unichar foo = 'é';", I get a warning from the compiler > about multibyte const and it d

Re: cocoa app is cancelling shutdown

2010-07-22 Thread Ken Thomases
On Jul 21, 2010, at 5:27 AM, Elizabeth Kellner wrote: > First is that app in question is a cocoa app that previously was a > command line app, and so it is *not* calling NSApplicationMain. It > starts its own run loop. Although I'm calling CFRunLoopRunInMode in > the loop, could there be some ot

Re: Array controllers in code?

2010-07-22 Thread Ken Thomases
On Jul 22, 2010, at 1:20 PM, Amy Gibbs wrote: > double *price, *uom, *cost; You have declared pointers to double, a scalar type. "double" is _not_ an object type. > price = [Product valueForKey:@"UOMcost"]; > uom = [Product valueForKey:@"purchaseUOM"]; The above is wrong, an

Re: Telling Auto Save, "No, I'm busy now"

2011-08-04 Thread Ken Thomases
On Aug 4, 2011, at 8:54 AM, Jerry Krinock wrote: > I'm getting a crash if I begin some operations and then hit the 'close' > button on the window while the operations are in progress… > > I take the four parameters I receive in > saveToURL:ofType:forSaveOperation:completionHandler: and put them

Re: NSImageView vs IKImageView

2011-08-07 Thread Ken Thomases
On Aug 7, 2011, at 7:17 AM, Graham Cox wrote: > Your implementation seems to be built on faulty assumptions about how > views/windows work, which in turn suggests you haven't read the documentation: > > http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaViewsGuide/Introd

Re: Using #define a good way for String constants, like enums for NSIntegers?

2011-08-09 Thread Ken Thomases
On Aug 9, 2011, at 7:58 AM, Jerry Krinock wrote: > This is how it's usually done: > > In a .m, .c or .cpp file, > > NSString* const constEntityNameLog = @"Log_entity" ; > > and if you need to use this constant in other files, add, in the counterpart > header file, > > extern NSString* const c

Re: confused by what seems to be a recursive declaration/definition

2011-08-11 Thread Ken Thomases
On Aug 11, 2011, at 9:27 PM, William Squires wrote: > On Aug 11, 2011, at 6:51 PM, Kyle Sluder wrote: > >> On Thu, Aug 11, 2011 at 4:26 PM, Jens Alfke wrote: >>> >>> On Aug 11, 2011, at 4:10 PM, Luther Baker wrote: >>> static void *AVPlayerDemoPlaybackViewControllerRateObservationContext

Re: Strange NSFileManager file replacement issue

2011-08-18 Thread Ken Thomases
On Aug 18, 2011, at 11:24 PM, Sixten Otto wrote: > - The download of the new data to a temporary file in NSTemporaryDirectory() > finishes successfully. > - I calculate the path I want to copy it to. > - I see that there's already a previous version of the file at that path. > - I try to use -[NSF

Re: Strange NSFileManager file replacement issue

2011-08-18 Thread Ken Thomases
On Aug 19, 2011, at 12:38 AM, Ken Thomases wrote: > Although it is easy to interpret "a temporary directory as provided by the > OS" being compatible with NSTemporaryDirectory(), I suspect it really means a > directory returned by > -URLForDirectory:inDomain:appropri

Re: Strange NSFileManager file replacement issue

2011-08-18 Thread Ken Thomases
On Aug 19, 2011, at 12:43 AM, Ken Thomases wrote: > On Aug 19, 2011, at 12:38 AM, Ken Thomases wrote: > >> Although it is easy to interpret "a temporary directory as provided by the >> OS" being compatible with NSTemporaryDirectory(), I suspect it really means

Re: Strange NSFileManager file replacement issue

2011-08-19 Thread Ken Thomases
On Aug 19, 2011, at 10:29 AM, Sixten Otto wrote: > This morning, I replaced the code between the "*** 1" and "*** 2" with > the following, which still failed in exactly the same way. It does get > create a replacement directory and return it, my temp file moves into > that directory without issue,

Re: Not Receiving Distributed Notifications Unless in Focus

2011-08-22 Thread Ken Thomases
On Aug 22, 2011, at 5:05 PM, Ian was here wrote: > I have a suite of apps that send distributed notifications to each other. I > have two apps in particular: > > 1) App A will launch app B. > 2) App B will then send a distributed notification to app A when it has > finished with its initializat

Re: NSInvocationOperations mysteriously whacked out of NSOperationQueue

2011-08-24 Thread Ken Thomases
On Aug 25, 2011, at 12:15 AM, Jerry Krinock wrote: > I discovered a bug in my app today caused by the following repeatable > behavior: When one particular NSInvocationOperation in an NSOperationQueue > executes, two others get whacked out of the queue, and thus never execute. > All but three o

Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Ken Thomases
On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne wrote: > I have an NSView subclass that I'm trying to capture right clicks in. I > override the rightMouseDown: method but it is never called. Any chance you simply have a typo or misspelling in your method signature? -Ken __

Re: Block until block is called

2011-08-26 Thread Ken Thomases
On Aug 26, 2011, at 11:40 PM, Brian Norh wrote: > I'm working against an API which looks like this: > > - (void)performOperationWithBlock:(void (^)(void))block > > The call returns directly and the execution continues. At some point > the block is eventually called. How would I do to block execu

Re: NSWindowController

2011-08-29 Thread Ken Thomases
On Aug 29, 2011, at 6:13 PM, Jens Alfke wrote: > On Aug 29, 2011, at 3:51 PM, koko wrote: > >> I have created a nib which contains a window. I have set the File's Owner to >> NSWindowController. >> I have connected the window outlet of File's Owner to the window defined in >> the nib. > > Don’

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Ken Thomases
On Sep 1, 2011, at 6:42 PM, Rainer Brockerhoff wrote: > On 01/09/2011, at 20:17, cocoa-dev-requ...@lists.apple.com wrote: >> From: Martin Wierschin >> Date: 1 de setembro de 2011 19:11:24 BRT >> To: Dave DeLong >> Cc: Cocoa Dev List >> >> Offhand does anyone know how to inspect the architectur

Re: Custom Cell Bindings

2011-09-03 Thread Ken Thomases
On Sep 3, 2011, at 1:16 AM, Seth Willits wrote: > The scenario is analogous to a custom text field cell where the cell is > displaying and editing an immutable NSString. With NSTextFieldCell when you > edit the text, the table view and cell cooperate to update value at the other > end of the bi

Re: Custom Cell Bindings

2011-09-03 Thread Ken Thomases
he box as I'd > expect, then perhaps there's some undocumented thing I'm supposed to be doing > in my NSActionCell subclass which is half of the implementation. As in, > perhaps my cell subclass is supposed to do X so the table view can correctly > do Y to propagate the va

Re: Windows and views and controls, oh my!

2011-09-05 Thread Ken Thomases
On Sep 5, 2011, at 10:32 AM, William Squires wrote: > While I can create the UI easily enough in IB, what I don't understand is how > to actually load, instantiate, and display the window from my view controller > object. A common approach is to: * Create a custom subclass of NSWindowControlle

<    1   2   3   4   5   6   7   8   9   10   >