Re: Bindings to display an NSArray of NSStrings as a single NSString?

2008-08-07 Thread Hamish Allan
On Wed, Aug 6, 2008 at 3:27 AM, Erik Buck <[EMAIL PROTECTED]> wrote: > Um, why not just bind to "values.description" the -description method of > NSArray will return a string containing comma separated descriptions of the > contained objects. It will even work if the contained objects aren't all

Re: Bindings to display an NSArray of NSStrings as a single NSString?

2008-08-05 Thread Hamish Allan
On Mon, Aug 4, 2008 at 6:32 PM, Dustin Robert Kick <[EMAIL PROTECTED]> wrote: > This seems like it would be common enough, to me, that it would have > bindings for it. You could add a category to NSArray... @implementation NSArray (ArrayOfStringsAsSingleString) - (NSString *)arrayOfStringsAsSing

Re: Distributed Objects "connection went invalid while waiting for a reply"

2008-08-01 Thread Hamish Allan
On Fri, Aug 1, 2008 at 1:02 AM, Chris Suter <[EMAIL PROTECTED]> wrote: > The reason you're seeing the error is because as soon as you receive the > response in your client, you're printing it and terminating the application > but the server is expecting a response (even though the method has a voi

Re: Distributed Objects "connection went invalid while waiting for a reply"

2008-07-31 Thread Hamish Allan
Hi Chris, On Tue, Jul 29, 2008 at 3:33 AM, Chris Suter <[EMAIL PROTECTED]> wrote: > It sounds to me like you've got some kind of timing issue and that the delay > that you're adding is merely hiding the true cause of the problem. Are you > able to post a simple test case that displays the problem

[Newbie] Communication between two Views?

2008-07-29 Thread Hamish Allan
-- Forwarded message -- From: Hamish Allan <[EMAIL PROTECTED]> Date: Tue, Jul 29, 2008 at 5:09 PM Subject: Re: [Newbie] Communication between two Views? To: "I. Savant" <[EMAIL PROTECTED]> Cc: CocoaDev list On Tue, Jul 29, 2008 at 4:34 PM, I. Savant <

Re: Distributed Objects "connection went invalid while waiting for a reply"

2008-07-28 Thread Hamish Allan
thArgument:) withObject:arg afterDelay:0.0] I don't know why this should make a difference! Hamish On Wed, Jul 9, 2008 at 1:11 AM, Hamish Allan <[EMAIL PROTECTED]> wrote: > I'm seeing "connection went invalid while waiting for a reply" in a DO > callback. The client passes self

Re: [Newbie] Communication between two Views?

2008-07-28 Thread Hamish Allan
On Mon, Jul 28, 2008 at 8:12 PM, I. Savant <[EMAIL PROTECTED]> wrote: > On Mon, Jul 28, 2008 at 8:01 PM, Hamish Allan <[EMAIL PROTECTED]> wrote: > >> On Mon, Jul 28, 2008 at 5:51 PM, Wickl thomas <[EMAIL PROTECTED]> wrote: >> >>> I know how M

Re: [Newbie] Communication between two Views?

2008-07-28 Thread Hamish Allan
On Mon, Jul 28, 2008 at 5:51 PM, Wickl thomas <[EMAIL PROTECTED]> wrote: > I know how MVC works with one Model, one View and > one Controller but I really don´t understnd how the controllers of different > Views communicate with each other. Through the model. The controllers of different views do

Re: Design question, which controller class to use

2008-07-21 Thread Hamish Allan
On Mon, Jul 21, 2008 at 4:05 AM, James W. Walker <[EMAIL PROTECTED]> wrote: > I have these windows, each of which has a table displaying data from an > array of dictionaries. The data is never stored on disk, so I don't think > of these windows as "documents". In addition to what Jens said: If t

Re: NSViewController Binding Problem continued

2008-07-19 Thread Hamish Allan
On Sat, Jul 19, 2008 at 9:44 AM, Cathy Shive <[EMAIL PROTECTED]> wrote: [> Hamish wrote:] >> I haven't yet come across a situation in which it would be desirable >> for an NSTableView and its associated NSArrayController to be in >> separate nibs. I guess Apple haven't, either ;) > > Actually, I w

Re: NSViewController Binding Problem continued

2008-07-18 Thread Hamish Allan
On Fri, Jul 18, 2008 at 11:18 PM, Cathy Shive <[EMAIL PROTECTED]> wrote: > I wonder if it would actually make a difference in this case. Since the nib > doesn't get loaded until the 'load view' method is called Nor it does. > and she's setting > the rO directly after the initializer (before req

Re: NSMutableDictionary autorelease chrashes application

2008-07-18 Thread Hamish Allan
On Fri, Jul 18, 2008 at 10:10 PM, Andy Lee <[EMAIL PROTECTED]> wrote: > On Jul 18, 2008, at 4:55 PM, Hamish Allan wrote: >> >> On Fri, Jul 18, 2008 at 9:21 PM, Andy Lee <[EMAIL PROTECTED]> wrote: >> >>> What would you use for adjectives -- "owned

Re: NSMutableDictionary autorelease chrashes application

2008-07-18 Thread Hamish Allan
On Fri, Jul 18, 2008 at 9:21 PM, Andy Lee <[EMAIL PROTECTED]> wrote: > What would you use for adjectives -- "owned" and "unowned"? How about "retained" and "unretained"? As in: "this method returns an unretained object". Hamish ___ Cocoa-dev mailing l

Re: Inverse Regex Library?

2008-07-18 Thread Hamish Allan
On Thu, Jul 17, 2008 at 8:49 PM, Philip Mötteli <[EMAIL PROTECTED]> wrote: > I try to analyze objects, that have been serialized using keyed encoding. > As long as there are only simple values, I have no problem. But the members > of too-many IVars are usually keyed by using something like > "IVar

Re: NSViewController Binding Problem continued

2008-07-18 Thread Hamish Allan
On Thu, Jul 17, 2008 at 8:50 PM, Ron Lue-Sang <[EMAIL PROTECTED]> wrote: > The tableview is expecting to be bound to the arraycontroller directly. It > doesn't know that representedObject is an arrayController. You might wish to file an enhancement request for NSViewController to provide an init

Re: IBOutlet to same control in different nibs

2008-07-18 Thread Hamish Allan
On Thu, Jul 17, 2008 at 5:42 PM, Trygve Inda <[EMAIL PROTECTED]> wrote: > I'll have one instance of this class for each > screen, one of which will be handling the "main" screen. > [...] > Can a single class have an IBOutlet that goes two different (though > functionally identical) places? It's a

Re: Setting Core Data attribute values to related entity attribute values

2008-07-16 Thread Hamish Allan
On Wed, Jul 16, 2008 at 5:12 PM, Jamie Phelps <[EMAIL PROTECTED]> wrote: > I have a Core Data entity in a Master-Detail view. In the detail view, I > have a button that is bound to the createFoo: method of the selected object > where Foo is the class name of the related entity. What I want to do i

Re: KVO notifications and threads

2008-07-16 Thread Hamish Allan
On Tue, Jul 15, 2008 at 7:45 PM, Jerry Isdale <[EMAIL PROTECTED]> wrote: > Means we have at least three copies of the data shuffling around memory, but > hey thats why we buy machines with 2-4 Gb of ram. If you've got such a large amount of data, it seems unlikely you'd want to be updating it all

Re: how to add modal dialog once application begin to run

2008-07-15 Thread Hamish Allan
On Tue, Jul 15, 2008 at 1:15 PM, 李国良 <[EMAIL PROTECTED]> wrote: > the situation like this: when user launch the application, the main > window open, before user click any button in the window, there is a modal > dialog attached to the main window, warning any operation will be > un-protected..., s

Re: Keypaths

2008-07-15 Thread Hamish Allan
On Tue, Jul 15, 2008 at 11:48 AM, Niklas Saers <[EMAIL PROTECTED]> wrote: > Hi, > I've implemented a little tree through my class Node that contains the > properties NSString* name and NSMutableArray *subnodes > > I'd love to say something like "Give me the nodes that have a grand-father > named B

Re: NSViewController and View Swapping

2008-07-15 Thread Hamish Allan
On Mon, Jul 14, 2008 at 3:26 PM, Brad Gibbs <[EMAIL PROTECTED]> wrote: > But, that screen (with its tab view and all of the custom views to be made > available from within the tab view) is one of several screens like it. The > other tab views will contain different numbers of tabs. The user will

Re: Why aren't my bindings firing?

2008-07-13 Thread Hamish Allan
In subsequent discussion off-list, Mmalc has made it known to me that in questioning Scott's statements that Key-Value Binding and Cocoa Bindings are the same thing -- or rather, in failing to capitulate to his insistence that Ron made the identical claim -- I have caused him considerable physical

Re: Overriding v alueForKeyPath

2008-07-09 Thread Hamish Allan
On Wed, Jul 9, 2008 at 2:39 PM, Laurent Cerveau <[EMAIL PROTECTED]> wrote: > Apparently what is happening is that the keyPath is decomposed, each object > is verified to be KVC compliant for the appropriate subPath and here we go : > nothing unexpected if I refer to the doc except that..the part I

Re: Distributed Objects "connection went invalid while waiting for a reply"

2008-07-09 Thread Hamish Allan
Hi Ken, Thanks for your reply. I already had NSZombieEnabled, so no help there, but the Object Allocations Instrument highlighted that -[NSConnection invalidate] was being called; a breakpoint on that revealed the following trace for thread 2: #0 0x91b1f916 in -[NSConnection invalidate] #1

Re: Distributed Objects "connection went invalid while waiting for a reply"

2008-07-09 Thread Hamish Allan
On Wed, Jul 9, 2008 at 10:14 AM, Mike Bellerby <[EMAIL PROTECTED]> wrote: > I use DOs on 10.3, 10.4 and 10.5. They work correctly on all versions. From > your description I'm not entirely sure what you are trying to do. Could you > post a code example and I try to help. Thanks, Mike. Will do -- I

Re: Why aren't my bindings firing?

2008-07-08 Thread Hamish Allan
On Wed, Jul 9, 2008 at 2:43 AM, Scott Anguish <[EMAIL PROTECTED]> wrote: > > On Jul 8, 2008, at 11:33 AM, Hamish Allan wrote: > >> Scott, for what it's worth, I really don't agree with you that Cocoa >> Bindings and KVB are "the same thing" or that

Distributed Objects "connection went invalid while waiting for a reply"

2008-07-08 Thread Hamish Allan
I'm seeing "connection went invalid while waiting for a reply" in a DO callback. The client passes self in a call to the server; some time later, the server calls a method on that client (proxy), the program hangs for a second or so, the "connection went invalid" connection appears, but the method

Re: iPhone SDK and sms.db file

2008-07-08 Thread Hamish Allan
On Tue, Jul 8, 2008 at 3:29 PM, <[EMAIL PROTECTED]> wrote: > I hope this is the right mailing list, because I couldn't find anything > iPhone-related. Just out of interest, what search terms did you use? Because it seems likely to me that searching for "iphone" would have given you a fairly cat

Re: Proposal for metadata interoperability on OS X

2008-07-08 Thread Hamish Allan
On Tue, Jul 8, 2008 at 4:20 PM, Tom Andersen <[EMAIL PROTECTED]> wrote: > I think that > the way to go about this is to talk this back and forth here for a bit, then > have someone go and write some code to implement the guidelines and turn > them into a nice cocoa api. For instance, one thing tha

Re: Why aren't my bindings firing?

2008-07-08 Thread Hamish Allan
On Tue, Jul 8, 2008 at 5:29 AM, Ron Lue-Sang <[EMAIL PROTECTED]> wrote: > KVB is an informal protocol. So Cocoa Bindings™(R) provides a concrete > implementation (on NSObject) of the KVB protocols. > In addition to providing a KVB implementation, Cocoa Bindings(R)™ adds a set > of reusable control

Re: Why aren't my bindings firing?

2008-07-07 Thread Hamish Allan
On Thu, Jul 3, 2008 at 1:12 AM, mmalc crawford <[EMAIL PROTECTED]> wrote: > > On Jul 2, 2008, at 4:04 PM, Hamish Allan wrote: > >> This is a rather unuseful attitude to take. Clearly, this thread >> started as a result of the distinction. Also, Apple's own >>

Re: garbage collection and NSConnection

2008-07-07 Thread Hamish Allan
On Mon, Jul 7, 2008 at 6:33 PM, Sean McBride <[EMAIL PROTECTED]> wrote: > There's always the lower-level: > >objc_collect (OBJC_EXHAUSTIVE_COLLECTION | >OBJC_WAIT_UNTIL_DONE); If this were called from the main thread, would it guarantee that the collector run without interruption, giv

Re: garbage collection and NSConnection

2008-07-06 Thread Hamish Allan
On 7/4/08, Chris Hanson <[EMAIL PROTECTED]> wrote: > Under non-GC, an object's memory may not be reclaimed until the current > autorelease pool is drained. However, under GC, an object's memory can be > reclaimed as soon as the collector can tell there are no more references to > it -- no matter

Re: Why aren't my bindings firing?

2008-07-02 Thread Hamish Allan
On Wed, Jul 2, 2008 at 5:31 PM, Scott Anguish <[EMAIL PROTECTED]> wrote: > Key value Binding and Cocoa Bindings are the same thing. > > Key-Value Binding is implemented at the foundation level. Cocoa Bindings is > the name used for the additional features (controllers, views that support > bindin

Re: KVO Bug With Keypaths

2008-07-01 Thread Hamish Allan
On Tue, Jul 1, 2008 at 11:18 PM, Keary Suska <[EMAIL PROTECTED]> wrote: > When I modify their contents, they are modified using setObject:forKey:, > which I issues KVO notifications, IIRC. At least I know it does in certain > situations, as rely on that behavior in a number of places. > > I also m

Re: KVO Bug With Keypaths

2008-07-01 Thread Hamish Allan
On Tue, Jul 1, 2008 at 9:50 PM, Keary Suska <[EMAIL PROTECTED]> wrote: > I thought I saw somewhere a bug in KVO where notifications aren't properly > sent in certain situations when "upper" parts of the path are updated. E.g., > I have a situation where is am observing a keypath > "relations.relat

Re: Why aren't my bindings firing?

2008-07-01 Thread Hamish Allan
On Tue, Jul 1, 2008 at 12:56 AM, Michael Ash <[EMAIL PROTECTED]> wrote: > However, if you're curious about what Apple does, it shouldn't be too > hard to find out. You know one thing that happens reliably: your > model's key is set. So set up a test app, put a breakpoint on the > model's setter, t

Re: Trying to display a static image on my window. Any tips would be great

2008-07-01 Thread Hamish Allan
On Tue, Jul 1, 2008 at 2:41 PM, Papa-Raboon <[EMAIL PROTECTED]> wrote: > Can't seem to get it to display. I believe I have a line of code > missing that will tie my MSImage to my NSImageView but not sure how. Have you tried [theImage setImage:tempImage]? That is, setting the image of the image vi

Re: Why aren't my bindings firing?

2008-06-30 Thread Hamish Allan
On Mon, Jun 30, 2008 at 10:43 PM, Ron Lue-Sang <[EMAIL PROTECTED]> wrote: > Yes! infoForBinding is what you should use to implement the logic in #1. > [...] > 2b) Implement the "read" logic yourself by implementing bind:. What puzzles me is that NSTextField doesn't seem to do either of these, yet

Re: garbage collection and NSConnection

2008-06-30 Thread Hamish Allan
On Mon, Jun 30, 2008 at 9:10 PM, eblu <[EMAIL PROTECTED]> wrote: >hostname = [sender hostName]; >socket = (NSSocketPort*)[[NSSocketPortNameServer sharedInstance] > portForName:@"BKOtherPort" host:hostname]; >connection = [NSConnection connectionWithReceivePort: nil sendPort

Re: Why aren't my bindings firing?

2008-06-30 Thread Hamish Allan
On Mon, Jun 30, 2008 at 3:56 PM, Michael Ash <[EMAIL PROTECTED]> wrote: > Although Apple's sample code shows overriding -bind:... to store > information about the new binding, it doesn't look like this is > necessary. You can simply use -infoForBinding: to obtain the info > dictionary, extract the

Re: Why aren't my bindings firing?

2008-06-29 Thread Hamish Allan
On Mon, Jun 30, 2008 at 5:33 AM, Charles Srstka <[EMAIL PROTECTED]> wrote: > Wait, what? Okay, that contradicts the understanding that I had come to... > so the built-in views establish two-way bindings *without* overriding > bind:toObject:withKeyPath:options:? Great, that puts us back to square o

Re: Why aren't my bindings firing?

2008-06-29 Thread Hamish Allan
On Sat, Jun 28, 2008 at 4:17 PM, Charles Srstka <[EMAIL PROTECTED]> wrote: > I wouldn't worry about that too much - everything you said seems to jibe > perfectly with what views do - the text field's binding *is* called "value" > and not "stringValue" (that was my bad), and there's no correspondin

Re: Is this still true?

2008-06-29 Thread Hamish Allan
On Mon, Jun 30, 2008 at 12:37 AM, Scott Anguish <[EMAIL PROTECTED]> wrote: > the controller classes don't return old and new values, that's the part that > isn't implemented. > > your own classes (provided they're written in a KVO compliant manner) will > return both. Unless their properties are

Re: Is this still true?

2008-06-29 Thread Hamish Allan
On Sun, Jun 29, 2008 at 9:48 PM, Alex Wait <[EMAIL PROTECTED]> wrote: > But does the bug it talks about still exist? I'm afraid so. But what I really want to know is, *why* won't it be fixed any time soon? I presume there *is* a reason, otherwise why would mmalc make such a claim? Hamish ___

Re: Style Question

2008-06-29 Thread Hamish Allan
On Sat, Jun 28, 2008 at 6:15 AM, Alex Wait <[EMAIL PROTECTED]> wrote: > I was meaning to imply that if it was called "FirstName" would setFirstName > still be called? See the first word of Jens' reply. But more importantly, just as Jens says, unask the question :) Hamish

Re: [Moderator] List Guidelines - Must Read

2008-06-26 Thread Hamish Allan
On Thu, Jun 26, 2008 at 4:51 PM, Scott Anguish <[EMAIL PROTECTED]> wrote: > Discussing NDA Projects (Snow Leopard and iPhone OS) and Private API > > > This list is not an appropriate forum for the discussion of issues that are >

Re: Can/should UIViewController work with multiple views?

2008-06-26 Thread Hamish Allan
On Thu, Jun 26, 2008 at 11:44 AM, Aleksandar Vacić <[EMAIL PROTECTED]> wrote: >In the iPhone Simulator, when you load Photos app, iPhone simulator? I have heard tell of such a thing... but Photos app? I'd imagine anyone with direct experience of anything like that would be under NDA and t

Re: SSH Wrapper

2008-06-25 Thread Hamish Allan
On Wed, Jun 25, 2008 at 10:01 PM, Kevin Ferguson <[EMAIL PROTECTED]> wrote: > There doesn't appear to > be any way to make my application wait for the password prompt, either. If stdin is not a tty (which is indeed the case running from an NSTask) and the environment variables DISPLAY and SSH_ASK

Re: Adding a new type of NSButton

2008-06-25 Thread Hamish Allan
On Wed, Jun 25, 2008 at 11:01 PM, P Teeson <[EMAIL PROTECTED]> wrote: > What appealed to me about the NSButton was it maturity as an interface item > and I wanted to take advantage of that. This is a double-edged sword: I for one would find it unsettling if a standard-looking button started behav

Re: Newbie question: error in creating a NSData object using handle (Resource Management)

2008-06-25 Thread Hamish Allan
On Wed, Jun 25, 2008 at 2:08 PM, Kyle Sluder <[EMAIL PROTECTED]> wrote: > On Wed, Jun 25, 2008 at 4:42 AM, Tran Kim Bach <[EMAIL PROTECTED]> wrote: > >> But I checked the exe file and it's absolutely there(in the bundle). > > What is this "exe file" nonsense? I don't have any files with the > ext

NSSegmentedControl segment bindings

2008-06-24 Thread Hamish Allan
Hi, As far as I can tell, the enabled state of specific segments of an NSSegmentedControl (which you can set / get through setEnabled:forSegment: / -isEnabledForSegment:) are not accessible through bindings. This surprises me, so I thought I'd ask here in case I'm missing something? Thanks, Hamis

Re: Learning SQLite by watching Core Data?

2008-06-23 Thread Hamish Allan
On Mon, Jun 23, 2008 at 7:06 PM, David Carlisle <[EMAIL PROTECTED]> wrote: > I had read it was possible to study SQLite using Core Data On Mon, Jun 23, 2008 at 8:19 PM, David Carlisle <[EMAIL PROTECTED]> wrote: > In a 2005 entry on the Big Nerd Ranch Weblog titled "Life with SQLite", it > says:

Re: Can a nib be confused about its owner?

2008-06-22 Thread Hamish Allan
On Mon, Jun 23, 2008 at 1:19 AM, John Murphy <[EMAIL PROTECTED]> wrote: > Since the File's Owner "object" in a nib file is actually a proxy for an > object that is provided at runtime, what happens if the nib is expecting > NSApplication to be its File's Owner but you called for the nib to be lo

Re: Bindings: NSTreeController sends redundant "selection" keypath KVO notifications

2008-06-20 Thread Hamish Allan
On Fri, Jun 20, 2008 at 1:00 PM, Milen Dzhumerov <[EMAIL PROTECTED]> wrote: > I'm building a 3-pane interface and I have a NSTreeController managing the > sidebar. My actual content displayed in the main view is bound to the > "selection" of the tree controller. When I insert a new object into the

Re: NSViewContoller contained subviews not redrawing

2008-06-19 Thread Hamish Allan
On Thu, Jun 19, 2008 at 12:43 PM, Godfrey van der Linden <[EMAIL PROTECTED]> wrote: > Ah hah think a developer possiblly I buggered up the 'representedObject' > property in the NSViewController subclasses, but no such luck When I > programatically ask the sub-xib's tree controllers the count of

Re: Working if Cocoa Core Data

2008-06-18 Thread Hamish Allan
On Wed, Jun 18, 2008 at 7:33 PM, Thiago Rossi <[EMAIL PROTECTED]> wrote: > *Amount* is an calculated field and it depends on the previous transactions. > I don't know how to do it! It is not a value I can save on database, for > example, because it changes all the time (I guess I have to mark the

Re: Keys dependent on NSArrayController's selection

2008-06-17 Thread Hamish Allan
On Thu, May 8, 2008 at 8:02 PM, Sean McBride <[EMAIL PROTECTED]> wrote: > On 5/8/08 1:45 PM, Dave Dribin said: > >>On May 8, 2008, at 9:22 AM, Sean McBride wrote: >> >>> On 5/8/08 1:53 AM, Dave Dribin said: >>> For kicks, I did try "peopleController.selectionIndex" as well as "peopleCont

Re: How can an object know when another object has gone away?

2008-06-16 Thread Hamish Allan
On Mon, Jun 16, 2008 at 1:39 AM, James W. Walker <[EMAIL PROTECTED]> wrote: > No, the controller does not keep a reference to the task. Why would it need > to do that in order to "keep it alive"? Because that's how memory management works. *Something* needs to keep a reference to your NSTask, ot

Re: Strange leak reported by leaks command line tool

2008-06-16 Thread Hamish Allan
On Mon, Jun 16, 2008 at 4:51 PM, Jens Alfke <[EMAIL PROTECTED]> wrote: > or your code is running on a background thread that doesn't have an > autorelease pool. Or it has an autorelease pool, but never drains it. Maybe the OP is running a select() loop with an autorelease pool around it rather t

Re: How can an object know when another object has gone away?

2008-06-15 Thread Hamish Allan
On Sun, Jun 15, 2008 at 11:20 PM, James W. Walker <[EMAIL PROTECTED]> wrote: > Here's my specific situation. I have several controllers that can create > tasks, using an NSTask wrapper based on the Moriarty sample. When a task > completes, it sends a message to the controller that created it. I

Re: Converting to NSPersistentDocument

2008-06-15 Thread Hamish Allan
On Sun, Jun 15, 2008 at 11:42 AM, Steven Hamilton <[EMAIL PROTECTED]> wrote: > I've been a busy bee learning Cocoa and core data (as my frequent postings > may reveal) and now I wish to add NSPersistentDocument functionality. I > started my project using the normal Core Data template so how do I c

Re: NSNotifications & background apps?

2008-06-15 Thread Hamish Allan
On Sat, Jun 14, 2008 at 8:52 PM, dream cat7 <[EMAIL PROTECTED]> wrote: > Seeing notifications from outside: > [...] > Sometimes 2 process are > communicating And one of them is launching / closing multiple times during > the session (e.g. sending kill message as NSNotification). You refer to NSNo

Re: Simple question - Subclassing NSView

2008-06-12 Thread Hamish Allan
On Thu, Jun 12, 2008 at 6:54 PM, Vikas <[EMAIL PROTECTED]> wrote: > NSRectFill() is a C function, not part of any class e.g. NSView. aRect is > simply a struct which specify location points (doesnt contain reference of > any window). How the function knows about the drawing surface, in which > win

Re: Simple question - Subclassing NSView

2008-06-12 Thread Hamish Allan
Hi Vikas, On Thu, Jun 12, 2008 at 6:26 PM, Vikas <[EMAIL PROTECTED]> wrote: > I have recently started programming on Mac using Objective-C and Cocoa. I am > coming from C++/C# world. So, its a fairly basic question. Please help me > understand the following code: > > @implementation MyView

Re: NSTreeController's arrangedObjects returning _NSControllerTreeProxy for KVC path?

2008-06-12 Thread Hamish Allan
On Thu, Jun 12, 2008 at 4:35 PM, Danny Price <[EMAIL PROTECTED]> wrote: > What I don't understand is why the same binding returns a different object > in two cases? Why don't get this proxy object when I bind the view directly > to the controller? Good question. I would guess that not everything

Re: argument checks

2008-06-12 Thread Hamish Allan
On Thu, Jun 12, 2008 at 6:50 AM, Ashley Perrien <[EMAIL PROTECTED]> wrote: > Noob question: I'm putting together a small code library and I'm trying to > include some error checking in the methods; what I want to protect against > is the following: > > NSNumber *myNum; > > // Lots of code where I'

Re: From c array to NSImage

2008-06-11 Thread Hamish Allan
On Wed, Jun 11, 2008 at 9:50 PM, Bill Prinzmetal <[EMAIL PROTECTED]> wrote: > I would like to create an NSImage starting from a c array. I have a c > array, e.g., > > float myArray[256][256]; > > Where the values go from 0.0 (will be black) to 1.0 (will be white) > I would like to may a gray leve

Re: Bound NSTreeNode - Inserting Children

2008-06-11 Thread Hamish Allan
On Wed, Jun 11, 2008 at 8:50 PM, Robert Sesek <[EMAIL PROTECTED]> wrote: > I have no other ideas for how to get this to work. Basically, the tree > displayed is incomplete, and as the user expands the tree, data is fetched > from a server and then inserted beneath a node. Do you really want to ad

Re: Garbage collector vs variable lifetime

2008-06-11 Thread Hamish Allan
On Wed, Jun 11, 2008 at 8:01 AM, John Engelhart <[EMAIL PROTECTED]> wrote: > A return type of NSArray * means something very explicit. "But all you can > expect is an object that behaves like a NSArray, so returning a subclass of > NSArray, like NSMutableArray, is perfectly legal!" You're exactl

Re: applicationWillTerminate and asynchronous orderly shutdown

2008-06-10 Thread Hamish Allan
On Tue, Jun 10, 2008 at 9:12 PM, Stuart Malin <[EMAIL PROTECTED]> wrote: > I have an app that establishes multiple TCP connections. If the user quits > the app, I'd like to shut all those connections gracefully (i.e., conduct a > bit of protocol) rather than just close them abruptly. To most prope

Re: Updating a progress bar from a code loop

2008-06-10 Thread Hamish Allan
On Tue, Jun 10, 2008 at 11:17 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > In this case I can do that... though out of curiosity I wonder if there is a > way to do this "cooperatively" on the main thread without having to break up > the loop doing the actual work. For example, in Carbon one can run

Re: Garbage collector vs variable lifetime

2008-06-10 Thread Hamish Allan
On Tue, Jun 10, 2008 at 4:28 PM, Charles Srstka <[EMAIL PROTECTED]> wrote: > I think the problem is that if NSArray has +[NSArray array] returning an > NSArray, then NSMutableArray has to return an NSArray also, since it can't > have a different method signature for the same method. As a result, i

Re: Updating a progress bar from a code loop

2008-06-10 Thread Hamish Allan
On Tue, Jun 10, 2008 at 7:24 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > How do I give some time to the event loop while I'm running my own loop? See here for a recent discussion: http://www.cocoabuilder.com/archive/message/cocoa/2008/6/5/209308 Hamish __

Re: Garbage collector vs variable lifetime

2008-06-09 Thread Hamish Allan
On Mon, Jun 9, 2008 at 7:39 PM, Chris Hanson <[EMAIL PROTECTED]> wrote: > It is perfectly legal to return an NSMutableArray from a hypothetical > +(NSArray *)array method. > > However, all the sender of that +(NSArray *)array message can know is that > the result can be treated as an NSArray. It

Re: Garbage collector vs variable lifetime

2008-06-09 Thread Hamish Allan
On Mon, Jun 9, 2008 at 7:02 PM, Chris Hanson <[EMAIL PROTECTED]> wrote: > The reason these kinds of methods have a return type of (id) is that there > is no way to say "returns an object of the receiver's class." For example, > +[NSArray array] returns (id) rather than (NSArray *) because otherwi

Re: Garbage collector vs variable lifetime

2008-06-08 Thread Hamish Allan
On Sun, Jun 8, 2008 at 3:10 AM, Michael Ash <[EMAIL PROTECTED]> wrote: > In many cases, including this one, the release build is actually > exposing faulty code, whereas the debug build is hiding it by working > as the programmer wants it to despite the code not actually being > correct. My thank

Re: Garbage collector vs variable lifetime

2008-06-08 Thread Hamish Allan
On Sun, Jun 8, 2008 at 1:23 AM, Bill Bumgarner <[EMAIL PROTECTED]> wrote: > Consider: > > { >int foo; > >... calculate on foo ... > >int bar = getirdone(foo); > >while(1) { >func(bar); >func2(bar); >... etc ... >} > } > > Without being able to recycle th

Re: Garbage collector vs variable lifetime

2008-06-08 Thread Hamish Allan
Hi Peter, On Sun, Jun 8, 2008 at 1:15 AM, Peter Duniho <[EMAIL PROTECTED]> wrote: > Maybe it's just because I've been using GC systems more than you have, and > so I've gotten used to thinking about memory allocations in the paradigm > that GC systems impose. I'm starting to realise that this is

Re: Garbage collector vs variable lifetime

2008-06-07 Thread Hamish Allan
On Sat, Jun 7, 2008 at 11:24 PM, Hamish Allan <[EMAIL PROTECTED]> wrote: > Sure, you could design NSData differently to mask a design problem in > GC. But GC won't be easier to use than retain/release/autorelease > without simple rules like "if you declare it on the stac

Re: Garbage collector vs variable lifetime

2008-06-07 Thread Hamish Allan
On Sat, Jun 7, 2008 at 7:35 PM, Michael Ash <[EMAIL PROTECTED]> wrote: > This is pretty nitpicky. If it's in scope but you don't use it, then > it doesn't matter. Kind of like a Zen koan: if an object is collected > in the forest but nobody is pointing to it anymore, does it make a > sound? :) I

Re: Garbage collector vs variable lifetime

2008-06-07 Thread Hamish Allan
On Sat, Jun 7, 2008 at 7:34 PM, Peter Duniho <[EMAIL PROTECTED]> wrote: >> Date: Sat, 7 Jun 2008 15:31:43 +0100 >> From: "Hamish Allan" <[EMAIL PROTECTED]> >> >> We're just interpreting this promise differently. To my mind, while >> the

Re: Garbage collector vs variable lifetime

2008-06-07 Thread Hamish Allan
On Sat, Jun 7, 2008 at 2:18 PM, Michael Ash <[EMAIL PROTECTED]> wrote: > The business about scanning the stack is essentially an > implementation detail; the promise that is being made is that objects > which you're still pointing to won't go away. We're just interpreting this promise differently

Re: Learning Cocoa with RubyCocoa (was Regular Expressions)

2008-06-07 Thread Hamish Allan
On Sat, Jun 7, 2008 at 8:20 AM, Allison Newman <[EMAIL PROTECTED]> wrote: > Really, once you figure out how to translate > > obj = [[SomeClass alloc] initWithName: @'my name' size: 16] > > to > > obj = SomeClass.alloc.initWithName_size('my name', 16) > > you're ready to start programming with Ruby

Re: Garbage collector vs variable lifetime

2008-06-07 Thread Hamish Allan
On Sat, Jun 7, 2008 at 12:34 PM, Michael Ash <[EMAIL PROTECTED]> wrote: > The problem here is > that you're expecting one pointer to keep a *different* pointer live, > which the GC does not make any guarantees about. Pre garbage collection, this was straightforward: as long as you retain your NSD

Re: Garbage collector vs variable lifetime

2008-06-07 Thread Hamish Allan
On Sat, Jun 7, 2008 at 12:42 AM, Bill Bumgarner <[EMAIL PROTECTED]> wrote: > The easiest way to do this is to simply to use data once after the for() > loop: > >NSData* data = ; >const unsigned char* bytes = [data bytes]; >NSUInteger count = [data length]; >for (NSU

Re: Garbage collector vs variable lifetime

2008-06-07 Thread Hamish Allan
On Sat, Jun 7, 2008 at 12:31 AM, Bill Bumgarner <[EMAIL PROTECTED]> wrote: > Yes, it is an exceedingly important optimization. Most likely, that stack > slot is being reused by some variable later on. I can see how this might be "exceedingly important" for deeply recursive functions, but for the

Re: Garbage collector vs variable lifetime

2008-06-06 Thread Hamish Allan
On Fri, Jun 6, 2008 at 11:48 PM, Bill Bumgarner <[EMAIL PROTECTED]> wrote: > The garbage collector does not currently interpret inner pointers as > something that can keep an encapsulating object alive. But it's not the inner pointers I would expect to keep the object alive -- it's the fact that

Re: Regular Expressions?

2008-06-06 Thread Hamish Allan
On Fri, Jun 6, 2008 at 8:31 AM, Cemil Browne <[EMAIL PROTECTED]> wrote: > This might be a really silly question - but am I missing something obvious? > Is there any support at all for regular expressions in the Cocoa libraries? You can use NSPredicate for regexp matching, though no substitution

Re: App hangs when displaying any sheet in 10.5 [SOLVED]

2008-06-05 Thread Hamish Allan
On Fri, Jun 6, 2008 at 6:26 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > I guess the question is, given an object type 'id', which method signature > will the compiler go with? Does the return type affect the method signature? > (In C++ it doesn't for example), so two methods: > > - (CGPoint) posit

Re: App hangs when displaying any sheet in 10.5 [SOLVED]

2008-06-05 Thread Hamish Allan
On Thu, Jun 5, 2008 at 5:12 PM, Brian Stern <[EMAIL PROTECTED]> wrote: > While float and int are the same size they are returned from functions in > different registers (on both ppc and intel). If the calling function expects > a float returned type but an int is returned instead the calling funct

Re: App hangs when displaying any sheet in 10.5 [SOLVED]

2008-06-05 Thread Hamish Allan
On Thu, Jun 5, 2008 at 4:43 PM, Graham Cox <[EMAIL PROTECTED]> wrote: > If I turn this on, I get thousands of warnings, none of which appear to be > telling me anything useful (i.e. the code is perfectly legitimate). With > that amount of noise if it does pick up the odd case like this I'm never >

Re: Bindings Cocoa and new Thread (Spinning Beach Ball an new Thread)

2008-06-04 Thread Hamish Allan
Hi Alex, On Thu, Jun 5, 2008 at 12:10 AM, Alexander Hartner <[EMAIL PROTECTED]> wrote: > 1.) I gathered i have to create a new NSAutoReleasePool in my "threaded" > method. Is this correct ? Yes. > 2.) During execution of this I am updating the UI components from a thread > which is not the main

Re: Newbie Question on a method signature

2008-06-04 Thread Hamish Allan
On Wed, Jun 4, 2008 at 9:38 PM, James Cicenia <[EMAIL PROTECTED]> wrote: > What the heck is wrong with my declaration? It's for a method called returnUIForFont:, not returnUIColorForFont:. Take a few minutes to try to work out what's wrong before asking the list. Finding your own mistakes is an

Re: Newbie Question on a method signature

2008-06-04 Thread Hamish Allan
On Wed, Jun 4, 2008 at 9:14 PM, James Cicenia <[EMAIL PROTECTED]> wrote: > why does it tell me: > > warning: (Messages without a matching method signature will be assumed to > return 'id' and accept... I'm guessing your method's definition comes after the code that uses that method, and you have

Re: IBOutlet, multiple nibs, method duplication

2008-06-04 Thread Hamish Allan
On Wed, Jun 4, 2008 at 8:46 PM, Trygve Inda <[EMAIL PROTECTED]> wrote: > Thoughts? It sounds like you're going for the "two instances of the same class" approach. In which case, you have a single combined controller class with your singe set of outlets and actions. Set your File's Owner in each

Re: IBOutlet, multiple nibs, method duplication

2008-06-04 Thread Hamish Allan
On Wed, Jun 4, 2008 at 8:17 PM, Trygve Inda <[EMAIL PROTECTED]> wrote: > I'd need two instances of WindowController. The way I see it, you have a choice: either a single instance of a controller with 2n outlets, or two instances of a controller with n outlets. If you want to have "one controller

Re: IBOutlet, multiple nibs, method duplication

2008-06-04 Thread Hamish Allan
On Tue, Jun 3, 2008 at 10:21 PM, Trygve Inda <[EMAIL PROTECTED]> wrote: > Since the IBOutlets in Main point to a different Nib than the IBOutlets in > Aux (even though they are functionally identical) is there a good, clean way > to manage this? Can you not wire the IBOutlets in Aux to the File's

Re: The KVO Race

2008-06-04 Thread Hamish Allan
On Tue, Jun 3, 2008 at 8:20 PM, Gordon Apple <[EMAIL PROTECTED]> wrote: >I guess I don't know hw to use that. The particular situation was a nib > that is document related, but loaded and opened later by menu. Ah, okay. But the solution is essentially the same: set up the observers when you'

Re: Main window disappears. Sometimes.

2008-06-03 Thread Hamish Allan
On Tue, Jun 3, 2008 at 6:02 PM, Andy Lee <[EMAIL PROTECTED]> wrote: > On Jun 2, 2008, at 1:50 PM, Bill Bumgarner wrote: > >> If your window is sometimes disappearing under GC -- is sometimes being >> collected prior to when you think it should be -- that means that the >> collector doesn't believe

  1   2   3   >