From cb at df.lth.se Wed Aug 1 02:04:56 2001 From: cb at df.lth.se (Christian Brunschen) Date: Thu Nov 3 14:47:00 2005 Subject: NSArray Enumeration In-Reply-To: <200107311915.AA08505@ocs.cz> Message-ID: On Tue, 31 Jul 2001, Ondra Cada wrote: > Rainer, > > >>>>>> Rainer Brockerhoff (RB) wrote at Tue, 31 Jul 2001 12:05:07 -0300: > RB> @implementation whatever > RB> + (NSArray*) getObjects { > RB> whatever* thingA = [[whatever alloc] init]; > RB> whatever* thingB = [[whatever alloc] init]; > RB> return [NSArray arrayWithObjects:thingA,thingB,nil]; > > No need to read on -- that's bad. Both things will leak this way. The > easiest and recommended way of doing this is That should be 'one easy and recommended way' :) The other way, equally easy and recommended is, of course, to simple balance the allocation with releasing: @implementation whatever + (NSArray*) getObjects { whatever* thingA = [[whatever alloc] init]; whatever* thingB = [[whatever alloc] init]; NSArray *array = [NSArray arrayWithObjects:thingA,thingB,nil]; [thingA release]; [thingB release]; return array; } > whatever *ta=[whatever whatever]; // there should be the standard class > "creator" method It is always a good idea to > whatever *tb=[[[whatever alloc] init] autorelease]; // otherwise you have to > mimic its behaviour > > Of course, you can release the objects after they were added to the array, > but generally the slight efficiency gain is not worth the effort. We will just have to agree to disagree here :) In this particular case, I would actually write the method as + (NSArray *) getObjects { return [NSArray arrayWithObjects: [[[whatever alloc] init] autorelease], [[[whatever alloc] init] autorelease], nil]; } ... which will not bother with storing the allocated objects in intermediate variables at all. However, in general, balancing allocation with releasing the object is just as valid as your suggested approach of immediately autoreleasing the object after allocation, and does indeed offer a performance benefit, which may or may not be significant depending on how the method in question is used. > Ondra Cada Best wishes // Christian Brunschen From ssudre at intego.com Wed Aug 1 02:31:19 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:00 2005 Subject: CFBundle unloading code Message-ID: <1215464162-383618@transeo.com> * Did someone succeed in making CFBundleUnloadExecutable work ? The results I'm getting are crashy. From andy at livingmemory.demon.co.uk Wed Aug 1 02:58:39 2001 From: andy at livingmemory.demon.co.uk (Andy) Date: Thu Nov 3 14:47:00 2005 Subject: very dumb question In-Reply-To: <200108010035.RAA06969@smtpout.mac.com> Message-ID: on 1/8/01 1:35 am, vaucanson at vaucanson@mac.com wrote: > When I look through a header file from AppKit or Foundation Frameworks > should I be scared about accidentally making changes to one of the files > and messing everything up? > Yes you should. Be very careful never to save any changes accidentally made to a system header ! Back them up, copy them and look at the copies if you're worried. As you gain more experience you will lose your nervousness :) > As I say a dumb question but it might save me a nervouse attack! I don't > want to try it to find out! Do try, do look, just be careful. Andy. From ocs at ocs.cz Wed Aug 1 04:15:47 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:00 2005 Subject: CFBundle unloading code In-Reply-To: <1215464162-383618@transeo.com> References: <1215464162-383618@transeo.com> Message-ID: <200108011118.AA09196@ocs.cz> Stephane, >>>>>> Stephane Sudre (SS) wrote at Wed, 1 Aug 2001 11:31:35 +0200: SS> * Did someone succeed in making CFBundleUnloadExecutable work ? Unless you are working on a *REALLY* big system, there's no need to unload anything, IMHO. All the unneeded loaded things can easily lay swapped out until the application quits (or until the world ends, for all what the system cares ;) -- the disk space is vast and the performance penalty is negligible. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ocs at ocs.cz Wed Aug 1 04:17:42 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:00 2005 Subject: very dumb question In-Reply-To: References: Message-ID: <200108011120.AA09201@ocs.cz> Andy, and all others who recommended to be careful: >>>>>> Andy (A) wrote at Wed, 01 Aug 2001 10:56:35 +0100: A> >When I look through a header file from AppKit or Foundation Frameworks A> >should I be scared about accidentally making changes to one of the files A> >and messing everything up? A> A> Yes you should. Do you really log in as root for programming?!?!?!?!?!?!?!? That's quite a bad idea, you know. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From joakimar at hem.passagen.se Wed Aug 1 04:23:03 2001 From: joakimar at hem.passagen.se (Joakim Arfvidsson) Date: Thu Nov 3 14:47:00 2005 Subject: NSOpenGLView and threading Message-ID: <200108011122.f71BMju16962@d1o1008.telia.com> When I draw into the NSOpenGLContext in another thread, I soon get a kernel panic in the Rage 128 kernel extension. I have not touched the context in the main thread (where it was created when the OpenGLView woke up from nib). A pity this doesnt work, since it seemed very smooth until it crashed, three seconds later. Anyway, what's the correct way to make my subclass of NSOpenGLView update all the time? I'd really like to have it in another thread so I could handle events and stuff in the main thread, but how? Any help, so I at least can get my app limping along, would be appreciated:-) From raphael_sebbe at mac.com Wed Aug 1 05:12:41 2001 From: raphael_sebbe at mac.com (Raphael Sebbe) Date: Thu Nov 3 14:47:00 2005 Subject: NSOpenGLView and threading In-Reply-To: <200108011122.f71BMju16962@d1o1008.telia.com> Message-ID: <200108011211.FAA10225@smtpout.mac.com> OpenGL, generally speaking, is not thread safe. What you can do though, as demonstrated at WWDC 2001, is create multiple contexts (even shared) that can *each* be accessed from *their* thread. That is used for example to load texture from a secondary thread in a shared context. But I believe what you need is a timer (NSTimer). You'll stay in the main thread, yet receive all the events. Raphael On Wednesday, August 1, 2001, at 01:22 PM, Joakim Arfvidsson wrote: > When I draw into the NSOpenGLContext in another thread, I soon get a > kernel panic in the Rage 128 kernel extension. I have not touched the > context in the main thread (where it was created when the OpenGLView > woke up from nib). > > A pity this doesnt work, since it seemed very smooth until it crashed, > three seconds later. > > Anyway, what's the correct way to make my subclass of NSOpenGLView > update all the time? I'd really like to have it in another thread so I > could handle events and stuff in the main thread, but how? > > Any help, so I at least can get my app limping along, would be > appreciated:-) > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From lucsky at mac.com Wed Aug 1 05:20:31 2001 From: lucsky at mac.com (Luc Heinrich) Date: Thu Nov 3 14:47:00 2005 Subject: CFBundle unloading code In-Reply-To: <200108011118.AA09196@ocs.cz> Message-ID: <200108011220.FAA22025@omnigroup.com> On Wednesday, August 1, 2001, at 01:18 , Ondra Cada wrote: > Unless you are working on a *REALLY* big system, there's no need to > unload > anything, IMHO. The size of the system is totally irrelevant. If I want to be able to update NSBundle based plugins *without* quitting and relaunching the host application, for example, unloading *is* the only way to go. -- Luc - lucsky@mac.com From joakimar at hem.passagen.se Wed Aug 1 05:21:17 2001 From: joakimar at hem.passagen.se (Joakim Arfvidsson) Date: Thu Nov 3 14:47:00 2005 Subject: NSOpenGLView and threading In-Reply-To: <200108011211.FAA04778@smtpout.mac.com> Message-ID: <200108011221.f71CL8u07631@d1o1008.telia.com> Wouldn't an NSTimer be inefficient? I wanted to divide it into threads so I can respond more quickly to events. I'll try it... thanks for the tip. Any pointers on how to set up two contexts so that I can do my gl drawing in a second thread? On onsdag, augusti 1, 2001, at 02:16 , Raphael Sebbe wrote: > OpenGL, generally speaking, is not thread safe. What you can do though, > as demonstrated at WWDC 2001, is create multiple contexts (even shared) > that can *each* be accessed from *their* thread. That is used for > example to load texture from a secondary thread in a shared context. > > But I believe what you need is a timer (NSTimer). You'll stay in the > main thread, yet receive all the events. From ssudre at intego.com Wed Aug 1 06:34:04 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:00 2005 Subject: CFBundle unloading code In-Reply-To: <200108011220.FAA22025@omnigroup.com> Message-ID: <1215449620-1258659@transeo.com> On mercredi, ao?t 1, 2001, at 02:20 PM, Luc Heinrich wrote: > On Wednesday, August 1, 2001, at 01:18 , Ondra Cada wrote: > >> Unless you are working on a *REALLY* big system, there's no need to >> unload >> anything, IMHO. > > The size of the system is totally irrelevant. If I want to be able to > update NSBundle based plugins *without* quitting and relaunching the > host application, for example, unloading *is* the only way to go. That's exactly the purpose of unloading CFBundle code in my case. From ssudre at intego.com Wed Aug 1 06:36:07 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:00 2005 Subject: NSOpenGLView and threading In-Reply-To: <200108011221.f71CL8u07631@d1o1008.telia.com> Message-ID: <1215449491-1266383@transeo.com> On mercredi, ao?t 1, 2001, at 02:20 PM, Joakim Arfvidsson wrote: > Wouldn't an NSTimer be inefficient? I wanted to divide it into threads > so I can respond more quickly to events. I'll try it... thanks for the > tip. I may be wrong but the NSScreenSaver API seems to use NSTimer and it's working well. From andy at livingmemory.demon.co.uk Wed Aug 1 06:57:22 2001 From: andy at livingmemory.demon.co.uk (Andy) Date: Thu Nov 3 14:47:00 2005 Subject: very dumb question In-Reply-To: <200108011120.AA09201@ocs.cz> Message-ID: on 1/8/01 12:19 pm, Ondra Cada at ocs@ocs.cz wrote: > Do you really log in as root for programming?!?!?!?!?!?!?!? That's quite a > bad idea, you know. noooh, reeeally? you don't say ;) I think I was actually saying that, in general, it's not a good idea to save alterations to system headers, even if you can. I would think it is obvious to all when the system tells you that you don't have privileges to do it that you can't. As was clearly stated by t'other Andy ... > However, when you always log in as root, you'd rather not use Project > Builder >> As I say a dumb question but it might save me a nervouse attack! I don't >> want to try it to find out! > > Do try, do look, just be careful. Part of being careful would be NOT to log in as root! From rcerny at dataline.cz Wed Aug 1 08:58:05 2001 From: rcerny at dataline.cz (Robert Cerny) Date: Thu Nov 3 14:47:00 2005 Subject: release window Message-ID: <200108011559.f71FxIA28196@linux.dataline.cz> Hi, I would like to ask you about the correct solution for my example. I have a main nib and preferences nib. - (IBAction)showPreferences:(id)sender { if (!prefsControl) [NSBundle loadNibNamed:@"Preferences" owner:self]; [[prefsControl window] makeKeyAndOrderFront:self]; } So far so good. I'm catching "windowWillClose" notification in prefs window to be able to save changes into user defaults. Then I remove my observer to be nice to system. My question is: I would like to "release when closed" prefs window to free memory but showPreferences causes a crash in this case because prefsControl is not invalidated. Should I simply catch the notification in AppDelegate and set prefsControl to nil or is there a better solution? Thanks Robert From mtrent at best.com Wed Aug 1 10:58:55 2001 From: mtrent at best.com (Mike Trent) Date: Thu Nov 3 14:47:01 2005 Subject: CFBundle unloading code In-Reply-To: <200108011220.FAA22025@omnigroup.com> Message-ID: I agree with you having an unload scheme is important for any plug-in system. Being unable to unload modules causes problems with screen savers and docklings. Quitting a server to reload an ObjC bundle is lame. Alas, there is no way to unload ObjC code once it is loaded into an application's namespace. Feel free to download objc4 from Darwin and take a look at the unload methods to see what I mean. Mike Trent > On Wednesday, August 1, 2001, at 01:18 , Ondra Cada wrote: > >> Unless you are working on a *REALLY* big system, there's no need to >> unload >> anything, IMHO. > > The size of the system is totally irrelevant. If I want to be able to > update NSBundle based plugins *without* quitting and relaunching the > host application, for example, unloading *is* the only way to go. > > -- > Luc - lucsky@mac.com > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From mtrent at best.com Wed Aug 1 11:08:46 2001 From: mtrent at best.com (Mike Trent) Date: Thu Nov 3 14:47:01 2005 Subject: NSOpenGLView and threading In-Reply-To: <200108011221.f71CL8u07631@d1o1008.telia.com> Message-ID: I have had success using NSTimers to update an NSOpenGLView. You do need to make sure your OpenGL drawing doesn't chew up more than a fraction of a second to keep your UI from feeling laggy, but with some careful OpenGL programming you can get phenominal framerates on accelerated hardware. Doing GL drawing on a second thread isn't too hard. You need to make sure no-one accesses your NSOpenGLView from the main thread. You don't really need to worry about shared contexts unless you're trying to pull textures in on the fly (like a screen saver, perhaps). Mike Trent > Wouldn't an NSTimer be inefficient? I wanted to divide it into threads > so I can respond more quickly to events. I'll try it... thanks for the > tip. > > Any pointers on how to set up two contexts so that I can do my gl > drawing in a second thread? > > > On onsdag, augusti 1, 2001, at 02:16 , Raphael Sebbe wrote: > >> OpenGL, generally speaking, is not thread safe. What you can do though, >> as demonstrated at WWDC 2001, is create multiple contexts (even shared) >> that can *each* be accessed from *their* thread. That is used for >> example to load texture from a secondary thread in a shared context. >> >> But I believe what you need is a timer (NSTimer). You'll stay in the >> main thread, yet receive all the events. > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From Alec.Bartsch at disney.com Wed Aug 1 11:10:07 2001 From: Alec.Bartsch at disney.com (Alec Bartsch) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration In-Reply-To: Message-ID: On Wednesday, August 1, 2001, at 01:58 AM, Christian Brunschen wrote: > However, in general, balancing allocation with releasing the object is > just as valid as your suggested approach of immediately autoreleasing > the > object after allocation, and does indeed offer a performance benefit, > which may or may not be significant depending on how the method in > question is used. I'm new to all this reference-counting memory-management business--what would be the performance benefit of a release over an autorelease? Is there some significant overhead involved in managing the autorelease pool? Thanks, Alec --------------------------------------------- Alec Bartsch Walt Disney Feature Animation: The Secret Lab The back of this email message is imprinted with an artificial watermark. Hold at a slight angle to view. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 935 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010801/5faa325e/attachment.bin From ssudre at intego.com Wed Aug 1 11:17:34 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:01 2005 Subject: CFBundle unloading code In-Reply-To: Message-ID: <1215432619-2281657@transeo.com> On mercredi, ao?t 1, 2001, at 07:56 PM, Mike Trent wrote: > I agree with you having an unload scheme is important for any plug-in > system. Being unable to unload modules causes problems with screen > savers > and docklings. Quitting a server to reload an ObjC bundle is lame. > > Alas, there is no way to unload ObjC code once it is loaded into an > application's namespace. Feel free to download objc4 from Darwin and > take a > look at the unload methods to see what I mean. I need this for a pure CoreFoundation code. CFBundle with C/C++ code. Is there any possibility it is supposed to work in this case ? From eblueBeta at mac.com Wed Aug 1 11:47:33 2001 From: eblueBeta at mac.com (eblueBeta) Date: Thu Nov 3 14:47:01 2005 Subject: help me add an NSPICTImageRep to my NSImage Message-ID: <200108011845.LAA00414@smtpout.mac.com> heres my code, that does not work: * theNewImage is a NSImage, and theSaveRep is a NSPICTImageRep; theNewImage = [[NSImage alloc] initWithSize:theNewSize]; [theSaveRep = [[NSPICTImageRep alloc] initWithData:nil]; [theSaveRep setSize:theNewSize]; [theSaveRep setAlpha:YES]; [theSaveRep setBitsPerSample:8]; [theSaveRep setPixelsWide:720]; [theSaveRep setPixelsHigh:540]; // add the pict image rep [theNewImage addRepresentation:theSaveRep]; I've been trying lots of different approaches, but Its been a few days and I have had zero success with experimenting, and documentation. I know that NSPICTImageRep doesnt respond to: initWithSize, but that leaves me with much larger problems: initWithData doesn't seem to work at all if you send a nil as the data, and I have not successfully been able to convert one type of data to another, so I have no image data to init with. can anybody shed some light on how I can add an image rep to an image? thanx in advance, ted From Joe at MacTelligence.com Wed Aug 1 12:17:35 2001 From: Joe at MacTelligence.com (Joe Schiwall) Date: Thu Nov 3 14:47:01 2005 Subject: NSOpenGLView and threading In-Reply-To: Message-ID: on 8/1/01 2:02 PM, Mike Trent at mtrent@best.com wrote: > I have had success using NSTimers to update an NSOpenGLView. You do need to > make sure your OpenGL drawing doesn't chew up more than a fraction of a > second to keep your UI from feeling laggy, but with some careful OpenGL > programming you can get phenominal framerates on accelerated hardware. > The NSTimer will not work if you have any clickable controls in the window. If the user clicks on a button and holds the mouse down, the NSTimer will not fire while the button is being tracked, and your animation will stop. There is a release not on using threads which states that you must call lockFocusIfCanDraw on the view in order to draw from another thread. I haven't tried it yet though. Joe Schiwall MacTelligence From medcalf at caerdroia.org Wed Aug 1 12:18:03 2001 From: medcalf at caerdroia.org (Jeff Medcalf) Date: Thu Nov 3 14:47:01 2005 Subject: getting a pointer to an element in a NIB Message-ID: How do I get a pointer to an object that is instantiated from a nib file, so that I can send it a message? Thanks -jeff -- /------------------+-----------------------+----------------------------\ | Jeff Medcalf )O( | medcalf@caerdroia.org | www.caerdroia.org/~medcalf | +------------------+-----------------------+----------------------------+ | God bless those Pagans. - Homer Simpson | \-----------------------------------------------------------------------/ From ddavidso at apple.com Wed Aug 1 12:28:31 2001 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:47:01 2005 Subject: NSOpenGLView and threading In-Reply-To: Message-ID: <7F1480DC-86B3-11D5-8786-000502935EF5@apple.com> On Wednesday, August 1, 2001, at 12:17 PM, Joe Schiwall wrote: > The NSTimer will not work if you have any clickable controls in the > window. > If the user clicks on a button and holds the mouse down, the NSTimer > will > not fire while the button is being tracked, and your animation will > stop. That depends entirely on what run loop modes the timer is registered for. If the timer is registered for the event tracking run loop mode, then it will continue to fire while the mouse is being tracked. There are three common event loop modes used by the AppKit: the default mode, the event tracking mode, and the modal panel mode. Try registering your timer for all of these modes. Douglas Davidson From rainer at brockerhoff.net Wed Aug 1 12:31:01 2001 From: rainer at brockerhoff.net (Rainer Brockerhoff) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration (longish) In-Reply-To: <200107311724.KAA12247@lists.omnigroup.com> References: <200107311724.KAA12247@lists.omnigroup.com> Message-ID: Wow, this is great feedback. Thanks to all who replied on the list or privately. My apologies for the long reply... I'm collecting material for an article, so I'd like to reason this through. First, one suggestion to other newbies: like buying diet books, downloading web articles doesn't help much if you don't read them. I've found 3 (three!!) copies of Don Yacktman's "Hold me, use me, free me" article (published at StepWise) on my hard drive, in the "Should Be Read Real Soon Now" section. Apparently I decided I must have read them already, but somehow didn't. My fault... To recap, I wrote: >Date: Tue, 31 Jul 2001 12:05:07 -0300 >From: Rainer Brockerhoff >... >@implementation whatever >+ (NSArray*) getObjects { > whatever* thingA = [[whatever alloc] init]; > whatever* thingB = [[whatever alloc] init]; > return [NSArray arrayWithObjects:thingA,thingB,nil]; >} >@end > >Outside I called this as follows: > NSArray* things = [whatever getObjects]; > NSEnumerator* enum = [things objectEnumerator]; > whatever* something; > while ((something = [enum nextObject])) { > // process each something (actually link it into a structure) > } > [things release]; My thinking here was, the calling procedure asks the whatever class for a group of objects, keeps them somewhere, releases the array itself which isn't needed anymore, then releases each object separately (much) later when that object should be killed... the decision is taken by whoever's has the objects pointer, of course. Retrospectively I see this comes from my C++/PowerPlant days. Use "new whatever" somewhere, "delete whateverPointer" elsewhere. Now for the responses: >Date: Tue, 31 Jul 2001 16:37:14 +0100 >From: Richard Frith-Macdonald >Euch ... non-localised retain/release ... breaks the convention that a >method >should only release objects it 'owns' and leads to future trouble when >you >have forgotten how your code was structured. >The following is the 'correct' solution - > >@implementation whatever >+ (NSArray*) getObjects { > NSArray *tmp; > whatever* thingA = [[whatever alloc] init]; > whatever* thingB = [[whatever alloc] init]; > tmp = [NSArray arrayWithObjects:thingA,thingB,nil]; > [thingA release]; > [thingB release]; > return tmp; >} >@end If I understood this, the getObject method _is_ the owner of thingA and thingB and therefore should release them. They hang on to life only as long as they're contained in the NSArray; if they're removed, or the array is released, they're freed. Both actions would of course happen in the calling code. However, another respondent wrote me privately, saying (in part and paraphrased): >In the getObject method you should write: >[[[whatever alloc] init] autorelease]; > >The method does not own this object and therefore shouldn't return >a retained copy... then put it into an autoreleased array >created by arrayWithObjects. In contrast, here it seems the getObject method _isn't_ the owner of thingA and thingB... and therefore should autorelease them, so again they survive only courtesy of the array itself. It's not clear to me whether arrayWithObjects autoreleases the NSArray it returns, or whether I should autorelease that array myself... I'd say the second, since the NSArray docs don't mention it. However, I've read warnings in the docs that autorelease shouldn't be used indiscriminately, because of efficiency concerns. Don Yacktman's paper also says: >Another thing to remember is that -release is much faster than -autorelease. Unless you need the special functionality of -autorelease (ie, you need the object to stick around for a brief period of time after its final release so that someone else can grab it if they want to), then you should use -release. Applications that overuse -autorelease tend to run very slowly. Yet another response was: >Date: Tue, 31 Jul 2001 21:15:10 +0200 >From: Ondra Cada > >RB> @implementation whatever >RB> + (NSArray*) getObjects { >RB> whatever* thingA = [[whatever alloc] init]; >RB> whatever* thingB = [[whatever alloc] init]; >RB> return [NSArray arrayWithObjects:thingA,thingB,nil]; > >No need to read on -- that's bad. Both things will leak this way... Well, I wouldn't say they _will_ leak. Only if the programmer, for some reason, forgets to release them elsewhere... but I'd rather avoid subjective words like "bad". >...The easiest and recommended way of doing this is > >whatever *ta=[whatever whatever]; // there should be the standard class >"creator" method >whatever *tb=[[[whatever alloc] init] autorelease]; // otherwise you have to >mimic its behaviour > >Of course, you can release the objects after they were added to the array, >but generally the slight efficiency gain is not worth the effort. This agrees with the preceding response, but doesn't mention ownership. (I frankly don't see a need for a "standard class creator method" in my case, since this is the only place I need to create this kind of object, and don't want need to be creating isolated, empty instances of it somewhere else.) >RB> The solution was to insert [things release] after the while loop > >That was a pretty bad solution, try to guess why! My first guess would be that it's bad because it doesn't conform to your mental model of how object release should be done :-). You don't explain it explicitly here... I got it working using a different mental model, which I'm willing to concede may perhaps not be as widely applicable. Well, it seems that it boils down to the ownership concept and to conventions and rules of thumb. "Ownership" as far as I could understand boils down to deciding who is holding the "official" pointer to the object. I found it a little more intuitive to consider short-lived and longer-lived objects. When short-lived objects (like resultant NSStrings and NSArrays of temporary lists) are requested, whoever fulfills the request should return them already autoreleased. if the requestor needs them for longer it stashes a retained pointer. But normally one just wants to look at the contents, or use them immediately as an operand, or whatever, so they're freed by the end of the pool cycle. I agree with that reasoning. So my first inclination would be to write: + (NSArray*) getObjects { whatever* thingA = [[whatever alloc] init]; whatever* thingB = [[whatever alloc] init]; return [[NSArray arrayWithObjects:thingA,thingB,nil] autorelease]; } since the NSArray itself can go away as soon as the "thing" objects are gotten at. However (at least in my particular use of this, which is more complex than I'm admitting here), the "thing" objects are comparatively long-lived - they encapsulate a view/controller pair which ultimately is referenced by a window. They're created through a relatively long chain of intermediate messages, and released through a different chain when the window is closed, and then I need them to go away immediately, not at the end of the pool cycle. So my rationale "du jour" now is, I'll use autorelease for short-lived objects, and explicit release by the ultimate owner for longer-lived objects. If you're writing a library, or a textbook, or anything where responsibility for allocation/deallocation is divided, use autorelease always but be sure to tell the other guy about it. -- Rainer Brockerhoff Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." http://www.brockerhoff.net/ (updated July 2000) From cb at df.lth.se Wed Aug 1 12:43:41 2001 From: cb at df.lth.se (Christian Brunschen) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration In-Reply-To: Message-ID: On Wed, 1 Aug 2001, Alec Bartsch wrote: > On Wednesday, August 1, 2001, at 01:58 AM, Christian Brunschen wrote: > > > However, in general, balancing allocation with releasing the object is > > just as valid as your suggested approach of immediately autoreleasing > > the > > object after allocation, and does indeed offer a performance benefit, > > which may or may not be significant depending on how the method in > > question is used. > > I'm new to all this reference-counting memory-management business--what > would be the performance benefit of a release over an autorelease? Is > there some significant overhead involved in managing the autorelease > pool? Well, an autorelease pool basically contains an array of references to the objects that hae been autoreleased in it - which means that for each object that gets autoreleased, one extra pointer needs to fit into the autorelease pool's array. Also, adding an object to an autorelease pool involves a message send ([NSAutoreleasePool addObject:theObject]) beyond the actual release message to the object itself, so there is a minor speed hit. The other thing is that if we explicitly release the object at a time when its release count is 1 (which is often the case for transient objects, i.e., ones that are used just briefly within a conditional or internally within a method) then the memory is immediately reclaimed, whereas the objects handled y the autorelease pool will stick around until the autorelease pool itself gets deallocated. So basically, if we know the precise lifetime of an object, then managing it completely manually will save you time and memory both, in comparison to handing the object over to the autorelease pool. Another issue is the special case where an object's retain count equals one, which is handled extra efficiently, so it is good practice to not try to retain objects unnecessarily (thus bumping their retain count above 1, requiring a more expensive implementation), but that is not really relevant in this particular context. Note, however, that these issues are not generally a problem, but that being aware of them can help you in those cases where they _do_ become problematic. > Thanks, No problem :) > Alec // Christian Brunschen From plau at ati.com Wed Aug 1 12:49:28 2001 From: plau at ati.com (Peter Lau) Date: Thu Nov 3 14:47:01 2005 Subject: no semget, semctl, msgget, msgctl on X? Message-ID: <9108E71D2127D211B7A000805FBB3FB302FC9F73@cvhwexh01.atitech.com> Hi there, we inherited some code that uses semget, semctl, msgget, msgctl plus a few others. As a first pass, we tried to compile the code as a C++ tool project but it could not because the header files are not found. So, we stubbed out some headers to trick the compiler. Then we got 0x2d as the return code from those functions and according to /usr/include/errno.h, it means "Operation not supported". Did we do something wrong? Or semget, semctl, msgget, or msgctl is not (and will not be) on X? Thanks for any info or pointers. pete -- > Peter Lau - plau@ati.com - Macintosh Software Engineer > ATI Technologies Inc. - 905.882.2600 ext.2186 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman/archive/macosx-dev/attachments/20010801/f42ec597/attachment.html From creed at broadjump.com Wed Aug 1 12:55:06 2001 From: creed at broadjump.com (Chris Reed) Date: Thu Nov 3 14:47:01 2005 Subject: Carbon pushbuttons and backgrounds Message-ID: Hi... I've got an interesting problem that I don't see any immediate solution to. I've got a Carbon app that has an client-defined picture as a background for its main window and has several pushbuttons atop the picture. The problem here is that under Carbon, buttons are apparently drawn with a rectangle filled with the background color outset from the button's bounds. This does not happen under Cocoa. Try this: in Interface Builder, create a new carbon window nib and a cocoa nib. In each, drag two pushbuttons onto the window so that they overlap. You'll immediately see what I'm talking about. So, is there a way to turn of this "feature"? BTW, the app is a PowerPlant app, but that appears to be inconsequential to this matter. (The fix most definitely won't be, though.) Thanks -chris From dtrevas at houston.rr.com Wed Aug 1 12:59:15 2001 From: dtrevas at houston.rr.com (David Trevas) Date: Thu Nov 3 14:47:01 2005 Subject: help me add an NSPICTImageRep to my NSImage In-Reply-To: <200108011930.MAA09364@lists.omnigroup.com> Message-ID: <200108011958.f71JwVmV000891@texlog2.texas.rr.com> > I wish I could, but I don't understand why you'd want to put a blank imageRep in an image. My process (a version that preserves the original size) goes something like this: NSImageRep *myRep; NSImage *myImage; NSSize repSize; NSString *fileName = @"/Users/myname/Pictures/nicePicture.pict"; myRep = [NSImageRep imageRepWithContentsOfFile:fileName]; // Notice I used NSImageRep, not NSPICTImageRep. By letting the system figure it out, I've had success with gif, tiff, pict and jpg. repSize = [myRep size]; myImage = [[NSImage alloc] initWithSize: repSize]; [myImage addRepresentation:myRep]; I don't know if this helps, but I hope it sheds some light on your problem. Dave From rainer at brockerhoff.net Wed Aug 1 13:14:53 2001 From: rainer at brockerhoff.net (Rainer Brockerhoff) Date: Thu Nov 3 14:47:01 2005 Subject: CFBundle unloading code In-Reply-To: <200108011829.LAA03651@lists.omnigroup.com> References: <200108011829.LAA03651@lists.omnigroup.com> Message-ID: >From: Ondra Cada >Date: Wed, 1 Aug 2001 13:18:11 +0200 > >>>>>> Stephane Sudre (SS) wrote at Wed, 1 Aug 2001 11:31:35 +0200: >SS> * Did someone succeed in making CFBundleUnloadExecutable work ? > >Unless you are working on a *REALLY* big system, there's no need to unload >anything, IMHO. > >All the unneeded loaded things can easily lay swapped out until the >application quits (or until the world ends, for all what the system cares ;) >-- the disk space is vast and the performance penalty is negligible. >Date: Wed, 01 Aug 2001 10:56:28 -0700 >Subject: Re: CFBundle unloading code > >Alas, there is no way to unload ObjC code once it is loaded into an >application's namespace. Feel free to download objc4 from Darwin and take a >look at the unload methods to see what I mean. This is disappointing.. I'm allowing the user to dynamically install new plugins without quitting, and naturally assumed that allowing de-install would also be doable. I'm using NSBundle however, which has no unload capability... then again, I assume NSBundle just wraps CFBundle with some additional Appkit stuff. But I found some interesting things. In CFBundle.h, it says: /* ==================== Primitive Code Loading API ==================== */ /* This API abstracts the various different executable formats supported on */ /* various platforms... */ /* Note that Cocoa-based bundles containing Objective-C or Java code must */ /* be loaded with NSBundle, not CFBundle. Once they are loaded, however, */ /* either CFBundle or NSBundle can be used. */ ... CF_EXPORT Boolean CFBundleLoadExecutable(CFBundleRef bundle); CF_EXPORT void CFBundleUnloadExecutable(CFBundleRef bundle); So in principle it _should_ be possible to unload a NSBundle. In objc-load.h it says: OBJC_EXPORT int objc_loadModule ( char * moduleName, void (*class_callback) (Class, Category), int * errorCode); OBJC_EXPORT long objc_unloadModules( void *errorStream, /* input (optional) */ void (*unloadCallback)(Class, Category) /* input (optional) */ ); So there is some API for unloading stuff at a very low level. Do you mean that these calls are actually buggy or disabled? -- Rainer Brockerhoff Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." http://www.brockerhoff.net/ (updated July 2000) From bierman at apple.com Wed Aug 1 13:17:12 2001 From: bierman at apple.com (Peter Bierman) Date: Thu Nov 3 14:47:01 2005 Subject: no semget, semctl, msgget, msgctl on X? In-Reply-To: <9108E71D2127D211B7A000805FBB3FB302FC9F73@cvhwexh01.atitech.com> Message-ID: At 3:46 PM -0400 8/1/01, Peter Lau wrote: >Did we do something wrong? Or semget, semctl, msgget, or msgctl is not >(and will not be) on X? This is a good question for the darwin-development list. There is kernel patch that implements SYSV style semaphores. I don't think it's been rolled into the main codebase yet. When that happens can probably be influenced by demand. -pmb From mtrent at best.com Wed Aug 1 14:15:40 2001 From: mtrent at best.com (Michael Trent) Date: Thu Nov 3 14:47:01 2005 Subject: NSOpenGLView and threading In-Reply-To: Message-ID: > > I have had success using NSTimers to update an NSOpenGLView. You do need to > > make sure your OpenGL drawing doesn't chew up more than a fraction of a > > second to keep your UI from feeling laggy, but with some careful OpenGL > > programming you can get phenominal framerates on accelerated hardware. > > > The NSTimer will not work if you have any clickable controls in the window. > If the user clicks on a button and holds the mouse down, the NSTimer will > not fire while the button is being tracked, and your animation will stop. This is not a hard limitation of NSTimer. Just add the timer to the runloop's NSEventTrackingRunLoopMode: [[NSRunLoop currentRunLoop] addTimer:animationTimer forMode:NSEventTrackingRunLoopMode]; This is working just fine in my NSTimer based animation programs. Mike Trent From lamiraux at apple.com Wed Aug 1 14:39:07 2001 From: lamiraux at apple.com (Henri Lamiraux) Date: Thu Nov 3 14:47:01 2005 Subject: getting a pointer to an element in a NIB In-Reply-To: Message-ID: <200108012138.OAA22459@scv3.apple.com> Create an oultet on your File's Owner and make a connection to the object you want to get a pointer to. This is one of the main role of the File's Owner. On Wednesday, August 1, 2001, at 12:17 PM, Jeff Medcalf wrote: > How do I get a pointer to an object that is instantiated from a nib > file, so that I can send it a message? > Henri Lamiraux Engineering Manager User Interface Tools Group Apple -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 490 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010801/42f8e210/attachment.bin From adrian_ridner at hp.com Wed Aug 1 14:44:42 2001 From: adrian_ridner at hp.com (Adrian Ridner) Date: Thu Nov 3 14:47:01 2005 Subject: Help Loading Auxiliary Nib files Message-ID: <200108012143.OAA11582@yale.vcd.hp.com> Hi all, I'm new to the list, but I hope and can find some fellow Cocoa developers with any ideas... I'm trying to use lazy loading of nib files when a user click at the menu item in a Cocoa application. After looking at several examples (I'm new to Objective-C although with solid C/C++ background), I decided that some panels like the Preferences only require shared instances. I split all my windows (about 9 created from clicking menu items) in different nib files and tried to share instances. I seem to be able to load the files (all the methods are called) including awakeFromNib....and showWindow, however no window displays. Only the main window loads. I have tried different ways of loading nibs, and nothing worked. What is the standard practice for loading other nibs besides MainMenu? I have looked at endless tutorials including "Learning Cocoa" (no help) and Cocoa Dev Central, etc. All help is appreciated. It is actually worth mentioning I'm not dealing with Documents (my app just have panels like Preferences). How do you load your Preferences nib? Here is how I setup my code just in case it helps someone. Let me know if you see something wrong: I have my AppDelegate where all the actions from the menu's are connected to, then I have the auxiliary nib (say Preferences.nib), and a frozen object in the nib with all the connections and a controller in my application that owns the nib. I derive all my controllers from a common object subclass of NSWindowController that has this code in init (and I keep the naming of the controller object the same as the nib file:) - (id) init { // Continue the designated initializer chain: [super init]; // here's a fuller invocation of "loadNibNamed:" which shows the loading of the // dictionary with the key-value pair NSOwner, which has a value of "self". [NSBundle loadNibFile:[[NSBundle mainBundle] pathForResource:NSStringFromClass([self class]) ofType:@"nib"] externalNameTable:[NSDictionary dictionaryWithObjectsAndKeys:self, @"NSOwner", nil] withZone:[self zone]]; // place other initialization code here return self; } Then the Preferences.m, the controller for Preferences.nib, inherits the init above and has the shareInstance method below: + (id) sharedInstance { static Preferences *_shared = nil; if (!_shared) { NSLog(@"This means the instance was not created yet"); _shared = [[Preferences allocWithZone:[self zone]] init]; } return _shared; } Then the frozen object (PreferencesCO.m) has the usuals: IBOutlets/actions and some reference code just to know they are being called: - (id) init { [super init]; NSLog(@"In init of PreferencesCO"); return self; } - (void) awakeFromNib { NSLog(@"in awakeFromNib in PreferencesCO"); } Finally when a user clicks Preferences... in the menu the corresponding IBAction is called in the application delegate and this code runs: - (IBAction)showPreferences:(id)sender { NSLog(@"I'm in Preferences..."); [[Preferences sharedInstance] showWindow:sender]; NSLog(@"Just loaded the Preferences in AppdDelegate"); } All input and ideas are more than welcome, I have run out of ideas and I can't move forward on this. Please help and feel free to use the ideas here for your own... Adrian Ridner **************************** - Take a little, give a little - From devMacOS at digiwerks.net Wed Aug 1 14:46:14 2001 From: devMacOS at digiwerks.net (Richard Whittaker) Date: Thu Nov 3 14:47:01 2005 Subject: Learning to use the debugger Message-ID: <1010801174444.3b68784c.d12a23a2.1.0.0.0.1634@209.42.35.162> Hello, Does anyone know where there are good tutorials on the debugger used in PB thanks, richard From devMacOS at digiwerks.net Wed Aug 1 14:57:55 2001 From: devMacOS at digiwerks.net (Richard Whittaker) Date: Thu Nov 3 14:47:01 2005 Subject: Help Loading Auxiliary Nib files In-Reply-To: <200108012143.OAA11582@yale.vcd.hp.com> Message-ID: <1010801175623.3b687b07.d12a23a2.1.0.0.0.1657@209.42.35.162> Look at NSMenu and read about validateMentItem. This may be the reason why no window appears....... On Wednesday, August 1, 2001, at 05:43 PM, Adrian Ridner wrote: > Hi all, > > I'm new to the list, but I hope and can find some fellow Cocoa > developers with any ideas... > I'm trying to use lazy loading of nib files when a user click at the > menu item in a Cocoa application. After looking at several examples > (I'm new to Objective-C although with solid C/C++ background), I > decided that some panels like the Preferences only require shared > instances. I split all my windows (about 9 created from clicking menu > items) in different nib files and tried to share instances. I seem to > be able to load the files (all the methods are called) including > awakeFromNib....and showWindow, however no window displays. Only the > main window loads. I have tried different ways of loading nibs, and > nothing worked. What is the standard practice for loading other nibs > besides MainMenu? I have looked at endless tutorials including > "Learning Cocoa" (no help) and Cocoa Dev Central, etc. All help is > appreciated. It is actually worth mentioning I'm not dealing with > Documents (my app just have panels like Preferences). How do you load > your Preferences nib? > > Here is how I setup my code just in case it helps someone. Let me know > if you see something wrong: > > I have my AppDelegate where all the actions from the menu's are > connected to, then I have the auxiliary nib (say Preferences.nib), and > a frozen object in the nib with all the connections and a controller in > my application that owns the nib. > > I derive all my controllers from a common object subclass of > NSWindowController that has this code in init (and I keep the naming of > the controller object the same as the nib file:) > > - (id) init { > > // Continue the designated initializer chain: > [super init]; > > // here's a fuller invocation of "loadNibNamed:" which shows the > loading of the > // dictionary with the key-value pair NSOwner, which has a value of > "self". > [NSBundle loadNibFile:[[NSBundle mainBundle] > pathForResource:NSStringFromClass([self class]) > ofType:@"nib"] > externalNameTable:[NSDictionary > dictionaryWithObjectsAndKeys:self, @"NSOwner", nil] > withZone:[self zone]]; > > // place other initialization code here > return self; > > } > > Then the Preferences.m, the controller for Preferences.nib, inherits > the init above and has the shareInstance method below: > > + (id) sharedInstance { > > static Preferences *_shared = nil; > > if (!_shared) { > NSLog(@"This means the instance was not created yet"); > _shared = [[Preferences allocWithZone:[self zone]] init]; > } > > return _shared; > > } > > Then the frozen object (PreferencesCO.m) has the usuals: > IBOutlets/actions and some reference code just to know they are being > called: > > > - (id) init { > > [super init]; > > NSLog(@"In init of PreferencesCO"); > > return self; > > } > > - (void) awakeFromNib { > > NSLog(@"in awakeFromNib in PreferencesCO"); > > } > Finally when a user clicks Preferences... in the menu the corresponding > IBAction is called in the application delegate and this code runs: > > - (IBAction)showPreferences:(id)sender { > > NSLog(@"I'm in Preferences..."); > > [[Preferences sharedInstance] showWindow:sender]; > NSLog(@"Just loaded the Preferences in AppdDelegate"); > > } > > All input and ideas are more than welcome, I have run out of ideas and > I can't move forward on this. Please help and feel free to use the > ideas here for your own... > > Adrian Ridner > > **************************** > - Take a little, give a little - > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From brantv at rhapsodicdevelopment.com Wed Aug 1 14:58:47 2001 From: brantv at rhapsodicdevelopment.com (Brant Vasilieff) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration In-Reply-To: <200108011930.MAA09348@lists.omnigroup.com> Message-ID: <200108012158.f71Lw4h02813@smtp.easystreet.com> On Wednesday, August 1, 2001, at 12:30 PM, macosx-dev- request@omnigroup.com wrote: > I'm new to all this reference-counting memory-management business--what > would be the performance benefit of a release over an autorelease? Is > there some significant overhead involved in managing the autorelease > pool? Alec, Consider the following two methods, one using autorelease the other release. - (void)setTitleA:(NSString*)inTitle { [title autorelease]; title = [inTitle retain]; } - (void)setTitleB:(NSString*)inTitle { id oldTitle = title; title = [inTitle retain]; [oldTitle release]; } Because every method call first checks against a nil object, they would look internally somewhat like the following sudo code. - (void)setTitleA:(NSString*)inTitle { if (title != nil) // 1T title->autorelease(); // 1M title = (inTitle != nil) ? inTitle >retain() : nil; // 1T, 1A, 1M } - (void)setTitleB:(NSString*)inTitle { id oldTitle = title; // 1A title = (inTitle != nil) ? inTitle >retain() : nil; // 1T, 1A, 1M if (oldTitle != nil) // 1T oldTitle->release(); // 1M } After control exits the stack back to the run loop, and the autorelease pool is released it iterates though all the items in the pool and calls release on the items. No matter which we choose, the contents of the pool will be iterated, so the setup of the for loop or NSEnumerator can't be avoided, so for each item added by setTitleA, the release of the pool will have to do an extra compare to see if we continue the loop and a call to release. On top of that, the adding of the item to the list is more complicated than simply decrementing a counter. So a released object would have at a minimum the extra overhead of: if (i < n) // 1T objectPtr->release(); // 1M objectPtr++; // 1I So autorelease would have 3 tests, 1 assignment, 3 method calls, and 1 increment. Release would have 2 tests, 2 assignments, and 2 method calls. The difference is: Autorelease: title->autorelease(); // 1M if (i < n) // 1T objectPtr++; // 1I Release: id oldTitle = title; // 1A Considering that the decrement includes an assignment, the Autorelease's main difference is the extra method call, and that the method call itself does more than just decrement a value. Not knowing what goes on inside autorelease, I could only guess, which I don't want to do. But we know it has to add the object to a list, and then iterate that list latter. One area though where autoreleasing can be seem faster, is where you want to delay the execution of lengthy dealloc methods. HTH, Brant From am at yline.com Wed Aug 1 15:04:48 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:01 2005 Subject: Help Loading Auxiliary Nib files In-Reply-To: <200108012143.OAA11582@yale.vcd.hp.com> Message-ID: <200108012203.PAA20689@omnigroup.com> On Wednesday, August 1, 2001, at 11:43 , Adrian Ridner wrote: > I'm trying to use lazy loading of nib files when a user click at the menu > item in a Cocoa application. After looking at several examples (I'm new > to Objective-C although with solid C/C++ background), I decided that some > panels like the Preferences only require shared instances. I split all my > windows (about 9 created from clicking menu items) in different nib files > and tried to share instances. I seem to be able to load the files (all > the methods are called) including awakeFromNib....and showWindow, however > no window displays. Only the main window loads. I have tried different > ways of loading nibs, and nothing worked. What is the standard practice > for loading other nibs besides MainMenu? I have looked at endless > tutorials including "Learning Cocoa" (no help) and Cocoa Dev Central, etc. > All help is appreciated. It is actually worth mentioning I'm not > dealing with Documents (my app just have panels like Preferences). How > do you load your Preferences nib? Did you check "Visible at launch time" in IB (in the window's inspector)? > // here's a fuller invocation of "loadNibNamed:" which shows the > loading of the > // dictionary with the key-value pair NSOwner, which has a value of > "self". > [NSBundle loadNibFile:[[NSBundle mainBundle] > pathForResource:NSStringFromClass([self class]) > ofType:@"nib"] > externalNameTable:[NSDictionary > dictionaryWithObjectsAndKeys:self, @"NSOwner", nil] > withZone:[self zone]]; I'd just use loadNibNamed:owner:, it does the same and is two lines shorter. andy -- Discussion forthcoming. From chaoswerks at earthlink.net Wed Aug 1 15:48:23 2001 From: chaoswerks at earthlink.net (David P. Henderson) Date: Thu Nov 3 14:47:01 2005 Subject: Help Loading Auxiliary Nibs files In-Reply-To: <200108011803.LAA01084@yale.vcd.hp.com> Message-ID: <200108012247.PAA05297@gull.mail.pas.earthlink.net> On Wednesday, August 1, 2001, at 02:03 , Adrian Ridner wrote: > I derive all my controllers from a common object subclass of > NSWindowController that has this code in init (and I keep the naming of > the controller object the same as the nib file:) > > - (id) init { > > // Continue the designated initializer chain: > [super init]; > > // here's a fuller invocation of "loadNibNamed:" which shows the > loading of the > // dictionary with the key-value pair NSOwner, which has a value of > "self". > [NSBundle loadNibFile:[[NSBundle mainBundle] > pathForResource:NSStringFromClass([self class]) > ofType:@"nib"] > externalNameTable:[NSDictionary > dictionaryWithObjectsAndKeys:self, @"NSOwner", nil] > withZone:[self zone]]; > > // place other initialization code here > return self; > > } > Firstly, if the above init is in an NSWindowController subclass, the NSWindowController docs state that you should invoke super with one of the following initializers: initWithWindowNibName:; initWithWindowNibName:owner:; initWithWindow:. Secondly, loadNibFile is expecting the name of the nib file sans extension not a path which is what you're passing it. Try [super initWithWindowNibName:NSStringFromClass([self class]) owner:self] instead. You should take a look at the source for Sketch as it uses shared NSWindowController subclass instances to implement its tools panel, preferences panel, info panel and grid panel. Dave -- Chaos Assembly Werks "Suburbia is where the developer bulldozes out the trees, then names the streets after them." - Bill Vaughn -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1721 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010801/2d9ecd1f/attachment.bin From ocs at ocs.cz Wed Aug 1 17:19:25 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration In-Reply-To: References: Message-ID: <200108020020.AA09727@ocs.cz> Alec, >>>>>> Alec Bartsch (AB) wrote at Wed, 1 Aug 2001 10:42:40 -0700: AB> However, in general, balancing allocation with releasing the object is AB> just as valid as your suggested approach of immediately autoreleasing the AB> object after allocation, and does indeed offer a performance benefit, AB> which may or may not be significant depending on how the method in AB> question is used. AB> AB> I'm new to all this reference-counting memory-management business--what AB> would be the performance benefit of a release over an autorelease? Is AB> there some significant overhead involved in managing the autorelease AB> pool? Well, wait for Christian's answer. My one is: unless you are writing an _unusually_ complicated code, there is *NO* significant difference. You should use the easier way of using autorelese; if you happen to find the application's slow (which is *QUITE* improbable), you can optimize afterwards. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From knapps at trivectus.com Wed Aug 1 19:40:40 2001 From: knapps at trivectus.com (Aaron Knapp) Date: Thu Nov 3 14:47:01 2005 Subject: Monitor-Sleep and Depth-Switching Message-ID: ATI cards in particular seem to demonstrate a very nasty dithering when a 16-bit OpenGL context is applied to a 32-bit screen. (I need to switch to the 16-bit GL context when memory is tight.) If I change the screen color depth to 16-bit, the dithering is less noticeable. (Any graphics gurus out there know why this might be the case?) I'm doing this with a screen saver, and eventually the monitors might go to sleep. When this happens and I wake them up, the screen becomes horribly garbled. This only happens when I switch color depths. Is the OS trying to restore the screen to the *system*-supplied value for the color depth and OpenGL is coughing on it? Any other theories? Wild guess? TIA! Regards, Aaron -- TriVectus From demarco at apple.com Wed Aug 1 22:12:23 2001 From: demarco at apple.com (Vince DeMarco) Date: Thu Nov 3 14:47:01 2005 Subject: Learning to use the debugger In-Reply-To: <1010801174444.3b68784c.d12a23a2.1.0.0.0.1634@209.42.35.162> Message-ID: On Wednesday, August 1, 2001, at 02:44 PM, Richard Whittaker wrote: > Hello, > > Does anyone know where there are good tutorials on the debugger used in > PB > > thanks, > richard > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev Look at this file on your machine /Developer/Documentation/DeveloperTools/gdb/gdb/gdb_toc.html or around there. vince From kcd at jumpgate.com Wed Aug 1 23:51:32 2001 From: kcd at jumpgate.com (Kenneth C. Dyke) Date: Thu Nov 3 14:47:01 2005 Subject: Monitor-Sleep and Depth-Switching In-Reply-To: Message-ID: <200108020704.f7274pA08015@whitestar.jumpgate.com> On Wednesday, August 1, 2001, at 07:40 PM, Aaron Knapp wrote: > > ATI cards in particular seem to demonstrate a very nasty dithering when > a 16-bit OpenGL context is applied to a 32-bit screen. (I need to > switch to the 16-bit GL context when memory is tight.) If I change the > screen color depth to 16-bit, the dithering is less noticeable. (Any > graphics gurus out there know why this might be the case?) Not sure on this one. If it was 3dfx hardware I could explain that sort of thing in excruciating detail, but since it's not.... ;) > I'm doing this with a screen saver, and eventually the monitors might > go to sleep. When this happens and I wake them up, the screen becomes > horribly garbled. This only happens when I switch color depths. Is the > OS trying to restore the screen to the *system*-supplied value for the > color depth and OpenGL is coughing on it? This is probably just a bug in a driver somewhere. There have been issues in the past with OpenGL surfaces not getting restored properly after mode changes under all conditions, but in theory everything should be okay at this point. The way thins are supposed to work is that if a display is being put to sleep, all of the VRAM contents are supposed to be paged off to system memory and then acceleration is shut off. Once the display wakes up, everything is supposed to be restored the way it was. If you'd like, you could sent me something to try out and I can give it a whirl with the latest drivers. In general we've tried to make things as straightforward as possible on OS X. Our feeling is that app programmers shouldn't have to do much of anything to handle sleep, display mode changes, etc. Of course, they (you) are free to respond to such things in your own way if you like. -Ken Kenneth Dyke, kcd@jumpgate.com (personal), kdyke@apple.com (work) Sr. Mad Scientist, MacOS X OpenGL Group, Apple Computer, Inc. C++: The power, elegance and simplicity of a hand grenade. From cb at df.lth.se Thu Aug 2 03:06:00 2001 From: cb at df.lth.se (Christian Brunschen) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration In-Reply-To: <200108020020.AA09727@ocs.cz> Message-ID: On Thu, 2 Aug 2001, Ondra Cada wrote: > Alec, > > >>>>>> Alec Bartsch (AB) wrote at Wed, 1 Aug 2001 10:42:40 -0700: > AB> However, in general, balancing allocation with releasing the object is > AB> just as valid as your suggested approach of immediately autoreleasing the > AB> object after allocation, and does indeed offer a performance benefit, > AB> which may or may not be significant depending on how the method in > AB> question is used. > AB> > AB> I'm new to all this reference-counting memory-management business--what > AB> would be the performance benefit of a release over an autorelease? Is > AB> there some significant overhead involved in managing the autorelease > AB> pool? > > Well, wait for Christian's answer. My one is: unless you are writing an > _unusually_ complicated code, there is *NO* significant difference. Um, this is not true. The code does not have to be complex at all: It suffices that the code in question is called a large number of times before the autorelease pool gets released. This is in fact a very _simple_ situation, nothing complex or unusual about it. > You > should use the easier way of using autorelese; if you happen to find the > application's slow (which is *QUITE* improbable), you can optimize > afterwards. Premature heavy optimization can often be a waste of time; but by avoiding the problem altogether (ie, using autorelease pools only where they are _needed_) you can save yourself a lot of hassle and headscratching later on. In general, it is good advice to start with the simplest code, and only add complexity (such as for optimization) when forced to. Please, Ondra, make it clearer that you are stating your _opinion_ in this matter, lest newbies get confused and think there is only one right way to do things (there are more than one, of course). > Ondra Cada // Christian Brunschen From ocs at ocs.cz Thu Aug 2 03:18:46 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration In-Reply-To: References: Message-ID: <200108021019.AA10138@ocs.cz> Christian, >>>>>> Christian Brunschen (CB) wrote at Thu, 2 Aug 2001 12:05:42 +0200 (MEST): CB> Please, Ondra, make it clearer that you are stating your _opinion_ in CB> this matter On Thu, 2 Aug 2001, Ondra Cada wrote: > Well, wait for Christian's answer. My one is:... ??? Looks like one of us does not understand English ??? --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From cb at df.lth.se Thu Aug 2 03:22:37 2001 From: cb at df.lth.se (Christian Brunschen) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration In-Reply-To: <200108021019.AA10138@ocs.cz> Message-ID: On Thu, 2 Aug 2001, Ondra Cada wrote: > Christian, > > >>>>>> Christian Brunschen (CB) wrote at Thu, 2 Aug 2001 12:05:42 +0200 (MEST): > CB> Please, Ondra, make it clearer that you are stating your _opinion_ in > CB> this matter > > On Thu, 2 Aug 2001, Ondra Cada wrote: > > Well, wait for Christian's answer. My one is:... > > ??? Looks like one of us does not understand English ??? That states you are giving your _answer_, not your _opinion_ - those are different things. And the phrasing of your advice is very much as if you were giving _authoritative facts_ regarding the 'right' way to program, rather than your _opinions_ on that subject. > Ondra Cada // Christian Brunschen From ocs at ocs.cz Thu Aug 2 03:25:24 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:01 2005 Subject: autorelease pool vs. manual release when really needed Message-ID: <200108021028.AA10147@ocs.cz> Reading the list I guess the following excerpt of my private discussion with Christian should be put here: it elucidates, I hope, my point quite cleanly (and I hope Christian would not mind my quoting of his one line here, although it was in private mail): CB> You see it as something that should handle _all_ object releasing. Nope, that's misperception. I see it as the autorelease pools should be used to handle objects "by default", *unless there are explicit and well thought through reasons to do otherwise*. I guess we could almost meet at this point? ;) If we cooperate on a project, I would end with that. Though, my particular point _in this list_ was that for newbie it would be better just to autorelease anything for awhile to wondering "which approach to be used here" unnecessarily -- until he gains experience enough to distinguish those cases. The thing is that a newbie generally tends to fear the late binding, autorelease pools, posingAs, and other nice Cocoa features, since he fears that "they are slow". Generally, they are not! IMHO the best way is to encourage newbies to use them as frequently as possible. Of course, they *CAN* bump into a situation when the slowness would truly occur, but until that, they would learn an easy and efficient way of writing some, I guess, 98% of code. Otherwise they would -- IMHO, of course! -- unnecessarily take precautions of "not to be slow" almost anywhere, and that would seriously and unnecessarily limit their effectivity. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From john at toastedmarshmallow.com Thu Aug 2 04:27:35 2001 From: john at toastedmarshmallow.com (john@toastedmarshmallow.com) Date: Thu Nov 3 14:47:01 2005 Subject: Looking for someone to take over a GPL project Message-ID: <20010802112656.C003F11C008@fimail01.cabinet.net> I've done an initial port of UAE (Universal/Unix/Useless Amiga Emulator) version 0.8.16. It runs Workbench, and all the Mac OS X specific code seems to work OK. Audio is still left to do, among other things. (It's quite possible that the Mac OS sound code can be reused, I haven't looked closely.) I used the NeXT port as a starting point, but I've cleaned it up a fair bit. (Multi threaded, event based, input model, so the user interface is responsive, etc.) The code needs some refactoring; currently the view class does controller things, I've not bothered to change that from the NeXT version, but when more features are added it will become cluttered otherwise. It there anyone here that would like to take this project on? I think it could be a fun project for any Cocoa beginner, and in particular for any former Amiga developer. Regards, John Hornkvist -- ToastedMarshmallow, the perfect Cocoa companion http://www.toastedmarshmallow.com From marcel at metaobject.com Thu Aug 2 05:11:15 2001 From: marcel at metaobject.com (Marcel Weiher) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration In-Reply-To: <1010729225251.3b64cc03.d12a23a2.1.0.0.0.1282@209.42.35.162> Message-ID: On Monday, July 30, 2001, at 04:52 Uhr, Richard Whittaker wrote: > What is the code style in Obj-c to enumerate thru a NSArray Probably the easiest way, if you have a simple message to send, is to use Higher Order Messaging. Sounds complicated, is simple. > NSEnumerator *enumerator = [customerArray objectEnumerator]; > int i=0; > > > 1. while( [enumerator hasMoreElements]){ > do someting > } > > note: I can not find a like hasMoreElements . is there one for > NSEnumerator > > 2. while(i< [customerArray count]){ > do something > i++ > } 3. [[customerArray do] doSomething:arg1 and:arg2]; Down with loops! Marcel From marcel at metaobject.com Thu Aug 2 05:13:03 2001 From: marcel at metaobject.com (Marcel Weiher) Date: Thu Nov 3 14:47:01 2005 Subject: NSBezierPath, glyphs --> poor quality In-Reply-To: Message-ID: On Monday, July 30, 2001, at 03:02 Uhr, Jens Baumeister wrote: [text-engine for OS-X 'upgraded'] > Well, that shouldn't be surprising if the bug is inside of the display > engine: Both NeXTStep and MOSXS 1.x use Display Postscript whereas OS X > uses > Display PDF. A complete rewrite of the engine leaves lots of room for > bugs. > ;-) Hmm, this is probably due more to ATS(UI) than CoreGraphics. Marcel From ocs at ocs.cz Thu Aug 2 05:38:09 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:01 2005 Subject: HOM (was: NSArray Enumeration) In-Reply-To: References: Message-ID: <200108021240.AA10236@ocs.cz> Marcel, >>>>>> Marcel Weiher (MW) wrote at Thu, 2 Aug 2001 14:12:33 +0200: MW> Probably the easiest way, if you have a simple message to send, is to MW> use Higher Order Messaging. Sounds complicated, is simple. ... MW> [[customerArray do] doSomething:arg1 and:arg2]; Yeah, HOM's a killer. But so far as I know, it is not supported in Cocoa (yet?). I can write my own bunch of forwarding objects of course, but I am afraid those who ask "how to enumerate an array" can't. Or am I mistaken and the HOM was silently added to Foundation (which would be great)? Or, if it is part of some freely available 3rd party kit, you might add at least a pointer where it is available from... MW> Down with loops! Uh, my own estimate is that you can easily use HOM instead of some 30% of loops, roughly. The remaining majority would be naturally doable that way too, but the result code would be more complicated with HOM than without. That all totally IMHO, of course. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From imeepmeep at hotmail.com Thu Aug 2 06:20:22 2001 From: imeepmeep at hotmail.com (Jeremy K) Date: Thu Nov 3 14:47:01 2005 Subject: Text drawing was: Re: Text Sizing Message-ID: I'm wondering how I can change the color of text I draw to the screen. It's always black even if i do [someColor set]; before drawing. that's what the SonOfSIllyBalls example does when drawing bo3b but i noticed that it doesn't work in that example(it sets it to black, but you can try other colors, still black) any ideas? -jerome _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From am at yline.com Thu Aug 2 06:45:40 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:01 2005 Subject: HOM (was: NSArray Enumeration) In-Reply-To: <200108021240.AA10236@ocs.cz> Message-ID: <200108021345.GAA19524@omnigroup.com> On Thursday, August 2, 2001, at 02:40 , Ondra Cada wrote: > Marcel, > >>>>>>> Marcel Weiher (MW) wrote at Thu, 2 Aug 2001 14:12:33 +0200: > MW> Probably the easiest way, if you have a simple message to send, is to > MW> use Higher Order Messaging. Sounds complicated, is simple. > ... > MW> [[customerArray do] doSomething:arg1 and:arg2]; > > Yeah, HOM's a killer. But so far as I know, it is not supported in Cocoa > (yet?). I can write my own bunch of forwarding objects of course, but I am > afraid those who ask "how to enumerate an array" can't. Hm... // // hom.h // #import @interface hom : NSProxy { NSArray *dad; } + (id)homWithArray:(NSArray*)array; - (id)initWithArray:(NSArray*)array; - (void)dealloc; - (void)forwardInvocation:(NSInvocation *)anInvocation; @end // // hom.m // #import @implementation hom + (id)homWithArray:(NSArray*)array { hom *h=[[[hom alloc] initWithArray:array] autorelease]; return h; } - (id)initWithArray:(NSArray*)array { dad=[array retain]; return self; } - (void)dealloc { [dad release]; } - (void)forwardInvocation:(NSInvocation *)anInvocation { NSEnumerator *e=[dad objectEnumerator]; id o; while(o=[e nextObject]) [anInvocation invokeWithTarget:o]; } @end @implementation NSArray (HOMAddition) - (id)do { return [hom homWithArray:self]; } @end I didn't test it, but it should work that way (and it compiles without any warning). Isn't ObjC great? andy -- Description forthcoming. From am at yline.com Thu Aug 2 07:02:21 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:01 2005 Subject: HOM (was: NSArray Enumeration) In-Reply-To: <200108021345.GAA19524@omnigroup.com> Message-ID: <200108021402.HAA20234@omnigroup.com> Tried it, forgot to implement methodSignatureForSelector:. That's a small hack, since it returns the first one it can get from the array. But they have to be the same for all objects either ways. On Thursday, August 2, 2001, at 03:45 , Andreas Monitzer wrote: > // > // hom.h > // > > #import > > @interface hom : NSProxy { > NSArray *dad; > } > > + (id)homWithArray:(NSArray*)array; > - (id)initWithArray:(NSArray*)array; > - (void)dealloc; > > - (void)forwardInvocation:(NSInvocation *)anInvocation; - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector; > > @end > > // > // hom.m > // > > #import > > @implementation hom > > + (id)homWithArray:(NSArray*)array { > hom *h=[[[hom alloc] initWithArray:array] autorelease]; > > return h; > } > > - (id)initWithArray:(NSArray*)array { > dad=[array retain]; > return self; > } > > - (void)dealloc { > [dad release]; > } > > - (void)forwardInvocation:(NSInvocation *)anInvocation { > NSEnumerator *e=[dad objectEnumerator]; > id o; > > while(o=[e nextObject]) > [anInvocation invokeWithTarget:o]; > } - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { NSMethodSignature *msig; NSEnumerator *e=[dad objectEnumerator]; id o; while(o=[e nextObject]) { msig=[o methodSignatureForSelector:aSelector]; if(msig) return msig; } return nil; } > > @end > > @implementation NSArray (HOMAddition) > > - (id)do { > return [hom homWithArray:self]; > } > > @end andy -- Description forthcoming. From ssudre at intego.com Thu Aug 2 07:13:07 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:01 2005 Subject: CFMutableDataRef optimizing Message-ID: <1215360851-6600069@transeo.com> Which of the following call series is supposed to be used to get better performance when appending bytes to it: CFMutableDataRef tMutableDataRef=CFDataCreateMutable(NULL,-1); or CFMutableDataRef tMutableDataRef=CFDataCreateMutable(NULL,realFinalSize); ? I would bet on the second one but I may be wrong. From rainer at brockerhoff.net Thu Aug 2 07:29:52 2001 From: rainer at brockerhoff.net (Rainer Brockerhoff) Date: Thu Nov 3 14:47:01 2005 Subject: autorelease pool vs. manual release when really needed In-Reply-To: <200108021224.FAA03030@lists.omnigroup.com> References: <200108021224.FAA03030@lists.omnigroup.com> Message-ID: >From: Ondra Cada >Date: Thu, 2 Aug 2001 12:28:01 +0200 > >The thing is that a newbie generally tends to fear the late binding, >autorelease pools, posingAs, and other nice Cocoa features, since he fears >that "they are slow". Generally, they are not! IMHO the best way is to >encourage newbies to use them as frequently as possible. Of course, they >*CAN* bump into a situation when the slowness would truly occur, but until >that, they would learn an easy and efficient way of writing some, I guess, >98% of code. As a Cocoa newbie I'd agree with that, as long as one's writing simpler programs. Late binding indeed had this effect on me for a week or so. I still wouldn't use those "nice Cocoa features" in the inner loop of a realtime data acquisition program, or a game... But in my many-years-long experience as a newbie :-), one thing I've learned to fear is automatic, behind-the-curtain stuff when it's not adequately documented or understood. Granted this is subjective. I've seen quite a number of people on this list complaining about getting a fault signal due to autoreleased objects; the first time this happened to me it was very disconcerting. You get an exception much later on, in a place where you have no access to source code, can't look at variables (except the arguments for main()), and have no easy way of finding out which object is implicated. -- Rainer Brockerhoff Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." http://www.brockerhoff.net/ (updated July 2000) From sgehrman at mac.com Thu Aug 2 07:30:22 2001 From: sgehrman at mac.com (Steve Gehrman) Date: Thu Nov 3 14:47:01 2005 Subject: Major Bug in Cocoa (With sample Code!!) In-Reply-To: <200108020911.f729BOj23666@lists.apple.com> Message-ID: <200108021426.HAA28447@smtpout.mac.com> OK, I put together a sample project that shows a major bug with forwardinvocation. The problem is that the forwardinvocation stuff retains the objects it returns from methods and everytime you call the method, the retain count just keeps growing. Check out the code and you will see what I'm talking about. This is a major pain in the ass. I structured a large part of my app around this forwardinvocation stuff and my app hogs memory like a mofo!! Apple, please fix soon!! (or tell me what I'm doing wrong) goto http://www.cocoatech.com to download the project: filename = duh.tgz steve From eblueBeta at mac.com Thu Aug 2 08:24:06 2001 From: eblueBeta at mac.com (eblueBeta) Date: Thu Nov 3 14:47:01 2005 Subject: help me add an NSPICTImageRep to my NSImage Message-ID: <200108021520.IAA09669@smtpout.mac.com> David Trevas , I am 'converting' unknown image formats to pict files, letting the system sort it out just isn't an option for me. I must have a pict file when all is said and done. I thought that i might be able to generate a blank pict rep for my newly created NSImage, and then draw a copy of my NSimage into my newly created rep, and then remove the original rep. But I have found that my pict rep doesn't work. so far I have not found one example, mention, or hint as to how to convert say: a tiff file into a pict file. From rcerny at dataline.cz Thu Aug 2 09:10:58 2001 From: rcerny at dataline.cz (Robert Cerny) Date: Thu Nov 3 14:47:01 2005 Subject: assigning a key equiv. in IB Message-ID: <200108021612.f72GCqA13923@linux.dataline.cz> Hi, I have probably a very stupid question but how can I assign a hot key (Apple D) to push button without having a menu with the same command? Thanks Robert From marcel at metaobject.com Thu Aug 2 09:31:37 2001 From: marcel at metaobject.com (Marcel Weiher) Date: Thu Nov 3 14:47:01 2005 Subject: HOM (was: NSArray Enumeration) In-Reply-To: <200108021240.AA10236@ocs.cz> Message-ID: On Thursday, August 2, 2001, at 02:40 Uhr, Ondra Cada wrote: > Or am I mistaken and the HOM was silently added to Foundation (which > would > be great)? Sadly, not yet. > Or, if it is part of some freely available 3rd party kit, you > might add at least a pointer where it is available from... HOM is availabel as part of MPWFoundation, which can be downloaded from http://www.metaobject.com/downloads/Objective-C/ I've just added a new higher order message: -selectWhereValueForKey:someKey; This allows you to do simple queries, similar but I think somewhat more light-weight than the NSArray-EOQualifier extensions. /* fire all employees whose last name begins with 'H' */ [[[[employes selectWhereValueForKey:@"lastName"] __hasPrefix:@"H"] do] fire]; (the __ msg. prefix is sadly still necessary...) > MW> Down with loops! > > Uh, my own estimate is that you can easily use HOM instead of some 30% > of > loops, roughly. Yes, for some earlier projects, I have seen numbers roughly like that, although somehwat higher. However... > The remaining majority would be naturally doable that way > too, but the result code would be more complicated with HOM than > without. ...while I agree with your sentiments in principle, a recent small project of mine has 23 HOM uses and not a single loop, and I don't think I was forcing it. (In fact, I was surprised that there were no loops at all when I just checked, I thought there were some). Regards, Marcel -- HOM is available as part of MPWFoundation at From mwatson at apple.com Thu Aug 2 10:15:01 2001 From: mwatson at apple.com (Matt Watson) Date: Thu Nov 3 14:47:01 2005 Subject: autorelease pool vs. manual release when really needed In-Reply-To: Message-ID: <200108021714.KAA17511@scv3.apple.com> On Thursday, August 2, 2001, at 07:07 AM, Rainer Brockerhoff wrote: > I've seen quite a number of people on this list complaining about > getting a fault signal due to autoreleased objects; the first time this > happened to me it was very disconcerting. You get an exception much > later on, in a place where you have no access to source code, can't > look at variables (except the arguments for main()), and have no easy > way of finding out which object is implicated. See: matt. From marcel at metaobject.com Thu Aug 2 10:26:25 2001 From: marcel at metaobject.com (Marcel Weiher) Date: Thu Nov 3 14:47:01 2005 Subject: HOM (was: NSArray Enumeration) In-Reply-To: <200108021345.GAA19524@omnigroup.com> Message-ID: On Thursday, August 2, 2001, at 03:45 Uhr, Andreas Monitzer wrote: [Mini implementation of HOM snipped] > I didn't test it, but it should work that way (and it compiles without > any warning). > Isn't ObjC great? Sure is! However: 1. This will only manage the equivalent of the -do higher order message, not -collect, -select, -reject, -selectWithValueForKey: or -fold (there are a couple more). 2. It only works with arrays, the HOM implementation works with any enumerator (anything supporting -nextObject). 3. It only supports iterating its target, and the target must be variable. HOM supports an arbitrary mix of variable or fixed arguments, the target need not be variable. So you can have: [[@"prefix" collect] stringByAppendingString:[suffixes each]]; in order to pre-pend @"prefix" to each of the strings in suffixes, or [[prefixes collect] stringByAppendingString:[suffixes each]]; to combine a list of prefixes with a list of prefixes (iterated together, but a cross-product would also be neat). Here is another example, the 'generic encoder' method: -(void)encodeWithCoder:(NSCoder*)aCoder { [[aCoder do] encodeKey:[[[self class] keys] each] ofObject:self]; } +keys is a method that uses the runtime to get a list of the object's instance variable names. -encodeKey:ofObject: has been added to NSCoder in a category and uses key-value coding to encode an instance variable. The 'generic copy' method looks similar: -copyWithZone:(NSZone*)zone { id copy = [[[self class] allocWithZone:zone] init]; id keys = [[self class] keys]; [[copy do] takeKey:[keys each] from:self]; return copy; } -takeKey:aKey from:anObject is another key-value based method similar to -encodeKey:ofObject: 4. It is slow While I strongly believe in not doing premature optimization, a basic service like array iteration mustn't have undue overhead or it won't be used / usable. I tested your implementation against HOM on an 1000 element array filled with 1000 references to the same constant string instance. The message sent is defined in a category and increments a counter in order to verify that it is being called. The array is completely iterated 10000 times, for a total of 10 million invocations of that method. The numbers ( beige G3/DT/233Mhz), user time: HOM 6.11 s Andreas's HOM 73 s objectAtIndex: 16.5 s objectAtIndex:/max 12.3 s ( the array's count is stashed in an int) enumerator 7.6 s ( I found this surprising, but the counter was OK) fast HOM 2.6 s ( an experimental version of the -do HOM optimized for arrays) So, the MPWFoundation HOM implementation is about 10 times faster than the little sample implementation, and actually faster than both the -objectEnumerator and -objectAtIndex: iteration styles, and it is possible to go around 3 times faster still. This shows how higher levels of abstraction and reuse actually help speed: because the one loop running inside the HOM-code will be reused a lot, it makes sense to optimize the heck out of it, using IMP-caching and manual code-layout, whereas it probably wouldn't be worth it to optimize all the individual loops in a program. -- Marcel Weiher marcel@metaobject.com HOM: From demarco at apple.com Thu Aug 2 10:28:27 2001 From: demarco at apple.com (Vince DeMarco) Date: Thu Nov 3 14:47:01 2005 Subject: assigning a key equiv. in IB In-Reply-To: <200108021612.f72GCqA13923@linux.dataline.cz> Message-ID: <7FEF7F36-876B-11D5-85CA-0003930FDF98@apple.com> On Thursday, August 2, 2001, at 09:10 AM, Robert Cerny wrote: > Hi, > I have probably a very stupid question but how can I assign a hot key > (Apple D) to push button without having a menu with the same command? > You can't in the release you have. You can only assign a single key. vince From rcerny at dataline.cz Thu Aug 2 10:30:22 2001 From: rcerny at dataline.cz (Robert Cerny) Date: Thu Nov 3 14:47:01 2005 Subject: working with data Message-ID: <200108021730.f72HUlA15180@linux.dataline.cz> Well, after spending the whole afternoon in foundation html files I give up. I need your help. I have a utility which works with pdf files. (They can be pretty big). I need to open the file, search for a string inside, add a few lines and close it. That's it. I think that I can use NSMutableData inited with the contents of my file but have no idea about the rest. What are the functions with serialize/deserialize? Is it better to simply use fget and sprintf for this case? Thanks Robert From ckane at apple.com Thu Aug 2 10:50:33 2001 From: ckane at apple.com (Chris Kane) Date: Thu Nov 3 14:47:01 2005 Subject: CFMutableDataRef optimizing In-Reply-To: <1215360851-6600069@transeo.com> Message-ID: Well, the first is just plain wrong, and will likely return NULL or crash the program. I think you mean "0" not "-1". Obviously the second will be better, because a fixed-size data never needs reallocation. The first, when corrected, will likely need roughly log2(eventualLength) resizes, and likely need to memmove() the data each time to the new larger memory (which on average means each eventual byte was moved once). However, if you're wrong about what the eventual length will be, you'll need to make a new data yourself of the more accurate size. Chris Kane Cocoa Frameworks, Apple On Thursday, August 2, 2001, at 07:13 AM, St?phane Sudre wrote: > Which of the following call series is supposed to be used to get better > performance when appending bytes to it: > > CFMutableDataRef tMutableDataRef=CFDataCreateMutable(NULL,-1); > > or > > CFMutableDataRef > tMutableDataRef=CFDataCreateMutable(NULL,realFinalSize); > > ? > > I would bet on the second one but I may be wrong. > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From tjw at omnigroup.com Thu Aug 2 11:35:13 2001 From: tjw at omnigroup.com (Timothy J. Wood) Date: Thu Nov 3 14:47:01 2005 Subject: Major Bug in Cocoa (With sample Code!!) In-Reply-To: <200108021426.HAA28447@smtpout.mac.com> Message-ID: <200108021835.LAA05974@omnigroup.com> This list is not where bugs should be reported. Please report bugs (especially since you have a test case) in bugreport.apple.com. Failure to report the bug to Apple means that it won't get fixed! (but yeah, I get the same behaviour, and OmniObjectMeter shows that NSInvocation is doing two retains but only one release). -tim On Thursday, August 2, 2001, at 07:26 AM, Steve Gehrman wrote: > > OK, I put together a sample project that shows a major bug with > forwardinvocation. The problem is that the forwardinvocation stuff > retains the objects it returns from methods and everytime you call the > method, the retain count just keeps growing. Check out the code and > you will see what I'm talking about. > > This is a major pain in the ass. I structured a large part of my app > around this forwardinvocation stuff and my app hogs memory like a mofo!! > > Apple, please fix soon!! (or tell me what I'm doing wrong) > > goto http://www.cocoatech.com to download the project: filename = > duh.tgz > > steve > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From rayna at poly.polytechnique.fr Thu Aug 2 12:29:09 2001 From: rayna at poly.polytechnique.fr (Thierry Rayna) Date: Thu Nov 3 14:47:01 2005 Subject: ObjCJava Warnings Message-ID: <3b69a9a63c6af50b@villosa.wanadoo.fr> (added by villosa.wanadoo.fr) Hi ! Does someone know the meaning (and the causes) of the following warnings? ObjCJava WARNING: _jobjc_currentJniEnv() returns NULL. If caller is jobjc_releaseJavaObjectOfClass(), this is only a warning. Otherwise, it is fatal. ObjCJava WARNING: jobjc_releaseJavaObjectForObjCObject(): no current JNI env. - will leak one proxy pair... They often appear after displaying the following alert panel: int reponse = NSAlertPanel.runInformationalAlert("Satisfait ?", "Votre ?quipier est satisfait du r?sultat, et vous ?", "oui", "non", null); This alert panel is displayed in front of a NSView that contains circles drawn using NSBezierPath. After these alert appears a few times, the app unexpectedly quits with sigbus signal (10, but I'm not sure). Thanks for your help. -- Thierry Rayna GREQAM Doctorant GREQAM 15-19, all?e Claude Forbin rayna@poly.polytechnique.fr 13627 Aix en Provence Cedex Fax: 04 42 23 39 28 From njriley at uiuc.edu Thu Aug 2 13:57:20 2001 From: njriley at uiuc.edu (Nicholas Riley) Date: Thu Nov 3 14:47:01 2005 Subject: assigning a key equiv. in IB In-Reply-To: <7FEF7F36-876B-11D5-85CA-0003930FDF98@apple.com>; from demarco@apple.com on Thu, Aug 02, 2001 at 10:26:25AM -0700 References: <200108021612.f72GCqA13923@linux.dataline.cz> <7FEF7F36-876B-11D5-85CA-0003930FDF98@apple.com> Message-ID: <20010802165232.A888@uiuc.edu> On Thu, Aug 02, 2001 at 10:26:25AM -0700, Vince DeMarco wrote: > > On Thursday, August 2, 2001, at 09:10 AM, Robert Cerny wrote: > > > Hi, > > I have probably a very stupid question but how can I assign a hot key > > (Apple D) to push button without having a menu with the same command? > > > You can't in the release you have. You can only assign a single key. Can you do this from code, then? If so, how? Another question - how do you display the command key - what's the proper character to use? Control-Q (which works in classic Mac OS) doesn't work in Cocoa. I'm trying to have my Cocoa buttons behave the way other apps' buttons do, where if you hold down the command key, they display their equivalents. -- Nicholas Riley | From thierrybucco at mac.com Thu Aug 2 15:26:10 2001 From: thierrybucco at mac.com (Thierry Bucco) Date: Thu Nov 3 14:47:01 2005 Subject: just set a custom cursor on NSButton... Message-ID: <200108022229.RAA21258@adaro.host4u.net> Hi, I just want to change the mouse cursor when I move the it over a button. I use this code : NSCursor *theCursor = [[NSCursor alloc] initWithImage:[NSImage imageNamed:@"cursor.tiff"] hotSpot:NSMakePoint(1,1)]; [[mainWindow contentView] addCursorRect:[theButton frame] cursor:theCursor]; But it doesn't work have you an idea ? Thanks Thierry From rick at icons.cx Thu Aug 2 15:31:02 2001 From: rick at icons.cx (Rick Roe) Date: Thu Nov 3 14:47:01 2005 Subject: assigning a key equiv. in IB In-Reply-To: <20010802165232.A888@uiuc.edu> Message-ID: > Another question - how do you display the command key - what's the > proper character to use? Control-Q (which works in classic Mac OS) > doesn't work in Cocoa. You can use the appropriate Unicode character. The command key is #8984, which you can probably enter using the Unicode input method. Or forget the input method nonsense and just copy and paste the character from some place you see it displayed, such as in OmniWeb's Help pages. :) -- Rick Roe icons.cx / The Omni Group From ptepesch at stny.rr.com Thu Aug 2 15:57:54 2001 From: ptepesch at stny.rr.com (Patrick Tepesch) Date: Thu Nov 3 14:47:01 2005 Subject: Image viewing program Message-ID: <200108022256.f72MuYq04660@mailout4-0> How difficult would it be to write a cocoa program to display, scroll, and resize (zoom) an image from a tiff file? Is there some source code available that would basically do this? The reason I ask, is that I have some code to do various image analysis functions, and I'd like to use the code to display results. What about grabbing mouse position on the image? I've done a lot of C/Fortran programming, some Microsoft Visual C++ MFC stuff, and a bit of cocoa programming in obj-c. I've done no image display coding. Thanks for any help, suggestions, links, pointers, etc... Patrick Tepesch From joakimar at hem.passagen.se Thu Aug 2 16:16:10 2001 From: joakimar at hem.passagen.se (Joakim Arfvidsson) Date: Thu Nov 3 14:47:01 2005 Subject: Image viewing program In-Reply-To: <200108022256.f72MuYq04660@mailout4-0> Message-ID: <200108022315.f72NFeu23574@d1o1008.telia.com> Look at NSImage, NSImageView and NSScrollView. You should put an NSImageView into an NSScrollView (you could do it in Interface Builder) and set the image displayed by the NSImageView. This way you would get scrolling. I'm not sure how to implement zooming. You might try to change the size of the NSImageView and configure it to scale its image. On fredag, augusti 3, 2001, at 12:57 , Patrick Tepesch wrote: > How difficult would it be to write a cocoa program to display, scroll, > and resize (zoom) an image from a tiff file? Is there some source code > available that would basically do this? The reason I ask, is that I > have some code to do various image analysis functions, and I'd like to > use the code to display results. What about grabbing mouse position on > the image? > > I've done a lot of C/Fortran programming, some Microsoft Visual C++ MFC > stuff, and a bit of cocoa programming in obj-c. I've done no image > display coding. > > Thanks for any help, suggestions, links, pointers, etc... > > Patrick Tepesch > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From kena at cs.colorado.edu Thu Aug 2 16:23:59 2001 From: kena at cs.colorado.edu (Kenneth M. Anderson) Date: Thu Nov 3 14:47:01 2005 Subject: addAttributeInRange horribly slow? Message-ID: <20010802172326-r01010700-f7db70da-0910-0108@128.138.204.112> Hi, I'm working on a Java-based Cocoa application that occasionally must loop through an array of objects and for each object make a series of calls to addAttributeInRange. This is a method of the NSMutableAttributedString class, and, for this application, I'm making these calls on the textStorage object (which is a subclass of NSMutableAttributedString) of a textView interface widget. I have discovered that addAttributeInRange (and its counterpart, addAttributesInRange) is extremely slow. For instance, iterating over 25 objects takes about 30 seconds! Here is an outline of what I'm doing: ========================= textView.textStorage().beginEditing(); for each object in my array do { range = calculateRange(); text.addAttributeInRange("endpoint", e, range); text.addAttributeInRange( NSAttributedString.UnderlineStyleAttributeName, new Integer(NSAttributedString.SingleUnderlineStyle), range); text.addAttributeInRange( NSAttributedString.ForegroundColorAttributeName, NSColor.blueColor(), range); } textView.textStorage().endEditing(); ========================= So, I'm essentially underlining a text range, turning it blue, and associating a custom object for each object in my array. And this code is taking *forever* to execute. Using some primitive profiling techniques, I've determined that the bottleneck is addAttributeInRange. I tried switching to addAttributesInRange, which requires taking my three attributes and placing them in an NSMutableDictionary and passing that instead. This approach was just as slow. Can anyone provide feedback on how to speed this up? Thanks in advance, Ken ----------------------------------------------------------------------- Kenneth M. Anderson | Phone: 303-492-6003 Assistant Professor | Fax : 303-492-2844 Dept. of Computer Science | University of Colorado, Boulder | ----------------------------------------------------------------------- From demarco at apple.com Thu Aug 2 16:41:08 2001 From: demarco at apple.com (Vince DeMarco) Date: Thu Nov 3 14:47:01 2005 Subject: assigning a key equiv. in IB In-Reply-To: <20010802165232.A888@uiuc.edu> Message-ID: On Thursday, August 2, 2001, at 02:52 PM, Nicholas Riley wrote: > On Thu, Aug 02, 2001 at 10:26:25AM -0700, Vince DeMarco wrote: >> >> On Thursday, August 2, 2001, at 09:10 AM, Robert Cerny wrote: >> >>> Hi, >>> I have probably a very stupid question but how can I assign a hot key >>> (Apple D) to push button without having a menu with the same command? >>> >> You can't in the release you have. You can only assign a single key. > > Can you do this from code, then? If so, how? > Not yet which is why IB doesn't support it (In the version you have) > Another question - how do you display the command key - what's the > proper character to use? Control-Q (which works in classic Mac OS) > doesn't work in Cocoa. > > I'm trying to have my Cocoa buttons behave the way other apps' buttons > do, where if you hold down the command key, they display their > equivalents. vince From imeepmeep at hotmail.com Thu Aug 2 17:35:49 2001 From: imeepmeep at hotmail.com (Jeremy K) Date: Thu Nov 3 14:47:01 2005 Subject: Image viewing program Message-ID: I think there's a setScalesOnResize:(BOOL) method for NSImage you use and you can set the size of the NSView and it'll resize.... or i'm wrong... i only used it in a NSView subclass with resizing the window and th eiamge would resize with the window & view. -jerome >From: Joakim Arfvidsson >To: Patrick Tepesch >CC: macosx-dev@omnigroup.com >Subject: Re: Image viewing program >Date: Fri, 3 Aug 2001 01:15:37 +0200 > >Look at NSImage, NSImageView and NSScrollView. You should put an >NSImageView into an NSScrollView (you could do it in Interface Builder) >and set the image displayed by the NSImageView. This way you would get >scrolling. I'm not sure how to implement zooming. You might try to >change the size of the NSImageView and configure it to scale its image. > _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From rainer at brockerhoff.net Thu Aug 2 17:58:47 2001 From: rainer at brockerhoff.net (Rainer Brockerhoff) Date: Thu Nov 3 14:47:01 2005 Subject: autorelease pool vs. manual release when really needed In-Reply-To: <200108021714.KAA17511@scv3.apple.com> References: <200108021714.KAA17511@scv3.apple.com> Message-ID: At 10:14 -0700 on 02/08/2001, Matt Watson wrote: >On Thursday, August 2, 2001, at 07:07 AM, Rainer Brockerhoff wrote: > >>I've seen quite a number of people on this list complaining about getting a fault signal due to autoreleased objects; the first time this happened to me it was very disconcerting. You get an exception much later on, in a place where you have no access to source code, can't look at variables (except the arguments for main()), and have no easy way of finding out which object is implicated. > >See: > >html> Proves my point. Yes, I found out about this after wasting some time, but it's hard to find... your specific link is in the WebObjects documentation, where a Cocoa newbie probably wouldn't have thought to search. -- Rainer Brockerhoff Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." http://www.brockerhoff.net/ (updated July 2000) From bmiller at asu.edu Thu Aug 2 18:31:58 2001 From: bmiller at asu.edu (Brad Miller) Date: Thu Nov 3 14:47:01 2005 Subject: Image viewing program Message-ID: > Look at NSImage, NSImageView and NSScrollView. You should put an > NSImageView into an NSScrollView (you could do it in Interface Builder) > and set the image displayed by the NSImageView. This way you would get > scrolling. I'm not sure how to implement zooming. You might try to > change the size of the NSImageView and configure it to scale its image. Stupid newbie question time. How do I make a NSScrollView for a NSImageView in IB? I figure its probably something easy and I'm just being dense right now. I really should stop trying to learn junk when tired. =) Brad bmiller@asu.edu _________________________________________________________________ The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt. - Bertrand Russell From epeyton at epicware.com Thu Aug 2 18:35:05 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:01 2005 Subject: Image viewing program In-Reply-To: Message-ID: Click on the NSImageView. Select Group In Scroll View from the Layout -> Group In -> Menu. Not intuitive at all, but it works. Eric On Thursday, August 2, 2001, at 08:31 PM, Brad Miller wrote: >> Look at NSImage, NSImageView and NSScrollView. You should put an >> NSImageView into an NSScrollView (you could do it in Interface >> Builder) >> and set the image displayed by the NSImageView. This way you would get >> scrolling. I'm not sure how to implement zooming. You might try to >> change the size of the NSImageView and configure it to scale its >> image. > > > Stupid newbie question time. How do I make a NSScrollView for a > NSImageView > in IB? I figure its probably something easy and I'm just being > dense right > now. I really should stop trying to learn junk when tired. =) > > > Brad > bmiller@asu.edu > > _________________________________________________________________ > > The trouble with the world is that > the stupid are cocksure and the > intelligent are full of doubt. > - Bertrand Russell > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From devMacOS at digiwerks.net Thu Aug 2 19:07:47 2001 From: devMacOS at digiwerks.net (Richard Whittaker) Date: Thu Nov 3 14:47:01 2005 Subject: MP3 framworks Message-ID: <1010802220637.3b6a072d.d12a23a2.1.0.0.0.1779@209.42.35.162> Hello, I would like to write a like cocoa app. to do following things 1. open a URL that is streaming an mp3 steam 2. play the steam so I can listen to it. 3. record the steam to a file while it is playing. So, are there any frameworks for free that are in obj-c that I can us for this. thanks Richard From njriley at uiuc.edu Thu Aug 2 19:33:23 2001 From: njriley at uiuc.edu (Nicholas Riley) Date: Thu Nov 3 14:47:01 2005 Subject: MP3 framworks In-Reply-To: <1010802220637.3b6a072d.d12a23a2.1.0.0.0.1779@209.42.35.162>; from devMacOS@digiwerks.net on Thu, Aug 02, 2001 at 10:06:36PM -0400 References: <1010802220637.3b6a072d.d12a23a2.1.0.0.0.1779@209.42.35.162> Message-ID: <20010802222900.B9216@uiuc.edu> On Thu, Aug 02, 2001 at 10:06:36PM -0400, Richard Whittaker wrote: > I would like to write a like cocoa app. to do following things > > 1. open a URL that is streaming an mp3 steam > > 2. play the steam so I can listen to it. > > 3. record the steam to a file while it is playing. You could probably do it all with QuickTime, but that's probably going to be unnecessarily complicated. I was considering writing an app to do the above, but got interested in something else instead. My current solution is to use two programs, one when I need relaying and one when I don't. The relay solution is streamripper, which is available here: And the non-relay one is a perl script that Jamie Zawinski wrote: (archiver.pl) I wrap these with shell scripts; you could quite easily wrap them with a Cocoa app too. streamripper uses a LOT more CPU, especially when relaying, I haven't been able to figure out why (though I haven't tried either). It tries to parse the stream to pull out individual songs, which may be part of the problem. I don't know enough about Perl networking but it may also not be too much hassle to adapt Jamie's script to relay, so you don't need streamripper at all. -- Nicholas Riley | From njriley at uiuc.edu Thu Aug 2 19:36:53 2001 From: njriley at uiuc.edu (Nicholas Riley) Date: Thu Nov 3 14:47:01 2005 Subject: NSComboBox up/down arrow keys Message-ID: <20010802223230.C9216@uiuc.edu> Hi, I'm trying to have the up and down arrow keys in an NSComboBox do something other than go to the beginning and end of the text. I've tried using an NSComboBox delegate, as well as subclassing NSComboBox and overriding: - (void)keyDown:(NSEvent *)theEvent { - (void)moveUp:(id)sender { - (void)moveDown:(id)sender { but none of my methods ever get called. I've done similar things with an NSOutlineView and my methods -do- get called (all of the above). Any ideas how I can capture the up/down arrow keys? Thanks, -- Nicholas Riley | From greg at omnigroup.com Thu Aug 2 19:49:12 2001 From: greg at omnigroup.com (Greg Titus) Date: Thu Nov 3 14:47:01 2005 Subject: NSComboBox up/down arrow keys In-Reply-To: <20010802223230.C9216@uiuc.edu> Message-ID: <200108030248.TAA29752@omnigroup.com> On Thursday, August 2, 2001, at 08:32 PM, Nicholas Riley wrote: > Hi, > > I'm trying to have the up and down arrow keys in an NSComboBox do > something other than go to the beginning and end of the text. I've > tried using an NSComboBox delegate, as well as subclassing NSComboBox > and overriding: > > - (void)keyDown:(NSEvent *)theEvent { > - (void)moveUp:(id)sender { > - (void)moveDown:(id)sender { > > but none of my methods ever get called. I've done similar things with > an NSOutlineView and my methods -do- get called (all of the above). > > Any ideas how I can capture the up/down arrow keys? The combo box is using an NSTextView to do the actual text editing, which it is the delegate of. I suspect that if you subclass NSComboBox and override -textView:doCommandBySelector: to look for the -moveUp: and -moveDown: selectors, that should do what you want... Hope this helps, -Greg From bwebster at owlnet.rice.edu Thu Aug 2 20:31:52 2001 From: bwebster at owlnet.rice.edu (Brian Webster) Date: Thu Nov 3 14:47:01 2005 Subject: Quick string-set search Message-ID: <200108030331.f733Vff22955@marsh.owlnet.rice.edu> Can someone point me to sample code or an algorithm description for doing a quick substring search in a set of strings? I'm looking to implement a behavior like that in iTunes' search or Explorer/OmniWeb's address completion; namely, given a set of strings and a substring, find all the strings that contain the substring. -- Brian Webster bwebster@owlnet.rice.edu http://www.owlnet.rice.edu/~bwebster From cmh at bDistributed.com Thu Aug 2 22:02:57 2001 From: cmh at bDistributed.com (Chris Hanson) Date: Thu Nov 3 14:47:01 2005 Subject: MP3 framworks In-Reply-To: <1010802220637.3b6a072d.d12a23a2.1.0.0.0.1779@209.42.35.162> References: <1010802220637.3b6a072d.d12a23a2.1.0.0.0.1779@209.42.35.162> Message-ID: At 10:06 PM -0400 8/2/01, Richard Whittaker wrote: >So, are there any frameworks for free that are in obj-c that I can >us for this. QuickTime is accessible from Objective-C, just like the rest of Carbon. -- Chris -- Chris Hanson bDistributed.com: Making Business Distributed From wave at pixar.com Thu Aug 2 22:18:22 2001 From: wave at pixar.com (Michael B. Johnson) Date: Thu Nov 3 14:47:01 2005 Subject: Image viewing program References: <200108022256.f72MuYq04660@mailout4-0> Message-ID: <3B6A33F9.F1749039@pixar.com> Patrick Tepesch wrote: > > How difficult would it be to write a cocoa program to display, scroll, > and resize (zoom) an image from a tiff file? Is there some source code > available that would basically do this? The reason I ask, is that I > have some code to do various image analysis functions, and I'd like to > use the code to display results. What about grabbing mouse position on > the image? > Take a look at my WKImageView2D IB framework/IB palette at http://softrak.stepwise.com/search?keyword=WavesKit&os=20 I have a more recent one I need to put up (with assignable hotkeys and such), but that should get you going... -- --> Michael B. Johnson, Ph.D. -- wave@pixar.com --> Studio Tools, Pixar Animation Studios --> http://xenia.media.mit.edu/~wave From ocs at ocs.cz Fri Aug 3 01:09:35 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:01 2005 Subject: Quick string-set search In-Reply-To: <200108030331.f733Vff22955@marsh.owlnet.rice.edu> References: <200108030331.f733Vff22955@marsh.owlnet.rice.edu> Message-ID: <200108030811.AA11067@ocs.cz> Brian, >>>>>> Brian Webster (BW) wrote at Thu, 2 Aug 2001 22:32:17 -0500: BW> Can someone point me to sample code or an algorithm description BW> for doing a quick substring search in a set of strings? I'm BW> looking to implement a behavior like that in iTunes' search or BW> Explorer/OmniWeb's address completion; namely, given a set of BW> strings and a substring, find all the strings that contain the BW> substring. Would be something like NSArray *allTheStrings... NSString *searchThis... NSEnumerator *en=[allTheStrings objectEnumerator]; NSString *s; NSRange rr; while (s=[en nextObject]) if ((rr=[s rangeOfString:searchThis]).length>0) break; // either rr.length==0, or s contains sought string and rr shows where sufficient, or do you need more flexibility, effectivity, etc? --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ocs at ocs.cz Fri Aug 3 01:15:50 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:01 2005 Subject: Quick string-set search In-Reply-To: <200108030811.AA11067@ocs.cz> References: <200108030331.f733Vff22955@marsh.owlnet.rice.edu> <200108030811.AA11067@ocs.cz> Message-ID: <200108030818.AA11108@ocs.cz> Sorry for a slight mistake, >>>>>> Ondra Cada (OC) wrote at Fri, 3 Aug 2001 10:11:41 +0200: OC> NSRange rr; OC> while (s=[en nextObject]) OC> if ((rr=[s rangeOfString:searchThis]).length>0) break; OC> // either rr.length==0, or s contains sought string and rr shows where Initialize rr.lenght to zero in case you want it to work properly for an empty set of strings. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From zak_ziggy at hotmail.com Fri Aug 3 04:48:39 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:01 2005 Subject: NSMutableString class - 20 string limit in stringWithFormat: Message-ID: Try this NSMutableString *crashString = [NSMutableString new]; NSString *anyString = [NSString stringWithSring:@"someString"]; /* This string with only 20 %@ strings in it is okay */ [crashString setString:[NSString stringWithFormat:@"1.%@ 2.%@ 3.%@ 4.%@ 5.%@ 6.%@ 7.%@ 8.%@ 9.%@ 10.%@ 11.%@ 12.%@ 13.%@ 14.%@ 15.%@ 16.%@ 17.%@ 18.%@ 19.%@ 20.%@ ", anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString]]; /* This string with 21 %@ strings in it WILL CRASH ANY PROGRAM EVERY TIME because it has more then 20 */ [crashString setString:[NSString stringWithFormat:@"1.%@ 2.%@ 3.%@ 4.%@ 5.%@ 6.%@ 7.%@ 8.%@ 9.%@ 10.%@ 11.%@ 12.%@ 13.%@ 14.%@ 15.%@ 16.%@ 17.%@ 18.%@ 19.%@ 20.%@ 21.%@ ", anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString]]; Say no more ! I am thinking of reporting it, to feedback. Also this is a test of macosx-dev@omnigroup.com, just to see if any messages are working because I see nothing posted, and there is so much to tell. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From zak_ziggy at hotmail.com Fri Aug 3 04:59:56 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:01 2005 Subject: MIME did not work and other new guy questions. Message-ID: I an new here, just a few questions, please. Sorry the reason I saw no messages is because I was set to MIME, not plain text. It must be hotmail. Does anybodies MIME setting work? Will I recieve meesages in that format at all ? with parts missing? _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From am at yline.com Fri Aug 3 05:08:42 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:01 2005 Subject: MIME did not work and other new guy questions. In-Reply-To: Message-ID: <200108031208.FAA15374@omnigroup.com> On Friday, August 3, 2001, at 01:59 , Zak Ziggy wrote: > I an new here, just a few questions, please. > Sorry the reason I saw no messages is because I was set to MIME, not > plain text. > It must be hotmail. Does anybodies MIME setting work? Will I recieve > meesages in that format at all ? with parts missing? MIME messages work fine with Apple Mail. They don't work at all with Eudora (showing up as attachment). That's why the default setting is to receive text digests. andy -- Description forthcoming. From mark at oaai.com Fri Aug 3 06:19:56 2001 From: mark at oaai.com (Mark Onyschuk) Date: Thu Nov 3 14:47:01 2005 Subject: Quick string-set search In-Reply-To: <200108030811.AA11067@ocs.cz> Message-ID: <0GHH00849UC257@sims-px3.cg.sfl.net> Most often when you need to do this, you'll build a Trie which is a kind of n-way tree with words at either the nodes or leaves (IIRC - it's been a while since CS324 :-). Regards, Mark --- GLYPHIX Diagramming for Mac OS X http://www.oaai.com/ On Friday, August 3, 2001, at 04:11 AM, Ondra Cada wrote: > Brian, > >>>>>>> Brian Webster (BW) wrote at Thu, 2 Aug 2001 22:32:17 -0500: > BW> Can someone point me to sample code or an algorithm description > BW> for doing a quick substring search in a set of strings? I'm > BW> looking to implement a behavior like that in iTunes' search or > BW> Explorer/OmniWeb's address completion; namely, given a set of > BW> strings and a substring, find all the strings that contain the > BW> substring. > > Would be something like > > NSArray *allTheStrings... > NSString *searchThis... > > NSEnumerator *en=[allTheStrings objectEnumerator]; > NSString *s; > NSRange rr; > while (s=[en nextObject]) > if ((rr=[s rangeOfString:searchThis]).length>0) break; > // either rr.length==0, or s contains sought string and rr shows where > > sufficient, or do you need more flexibility, effectivity, etc? > --- > Ondra Cada > OCSoftware: ocs@ocs.cz http://www.ocs.cz > private ondra@ocs.cz http://www.ocs.cz/oc > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From ocs at ocs.cz Fri Aug 3 06:40:57 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:01 2005 Subject: NSMutableString class - 20 string limit in stringWithFormat: In-Reply-To: References: Message-ID: <200108031343.AA11340@ocs.cz> Zak, >>>>>> Zak Ziggy (ZZ) wrote at Fri, 03 Aug 2001 04:48:05 -0700: ZZ> NSMutableString *crashString = [NSMutableString new]; ZZ> NSString *anyString = [NSString stringWithSring:@"someString"]; Why not just 'anyString=@"someString";'??? ZZ> /* This string with 21 %@ strings in it WILL CRASH ANY PROGRAM EVERY TIME In MOSXS1.x it works without any problem. Looks like another nice result of the Carbon (CoreFoundation, to be precise) :(((( --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From rasmussn at lanl.gov Fri Aug 3 06:53:33 2001 From: rasmussn at lanl.gov (Craig E Rasmussen) Date: Thu Nov 3 14:47:01 2005 Subject: Missing items in glob.h Message-ID: <200108031353.f73DrTO444171@acl.lanl.gov> I'm trying to port some software to MacOSX and I'm missing some #define's, in particular, GLOB_ABORTED and GLOB_NOMATCH. Have there been updates to the development environment that may have fixed this that I haven't installed. I seem to recall a new developer release a couple of months ago but I can't find any information about it. I only have the original developer CD from 10.0. Is there a way to download headers and libraries from the Darwin release? Thanks, Craig From ryanstevens at mac.com Fri Aug 3 09:13:45 2001 From: ryanstevens at mac.com (Ryan Stevens) Date: Thu Nov 3 14:47:01 2005 Subject: NSMutableString class - 20 string limit in stringWithFormat: In-Reply-To: Message-ID: <200108031613.JAA24308@omnigroup.com> On Friday, August 3, 2001, at 04:48 AM, Zak Ziggy wrote: > > Try this > NSMutableString *crashString = [NSMutableString new]; > NSString *anyString = [NSString stringWithSring:@"someString"]; > > /* This string with only 20 %@ strings in it is okay */ > [crashString setString:[NSString stringWithFormat:@"1.%@ 2.%@ 3.%@ 4.%@ > 5.%@ 6.%@ 7.%@ 8.%@ 9.%@ 10.%@ 11.%@ 12.%@ 13.%@ 14.%@ 15.%@ 16.%@ > 17.%@ 18.%@ 19.%@ 20.%@ ", anyString, anyString, anyString, anyString, > anyString, anyString, anyString, anyString, anyString, anyString, > anyString, anyString, anyString, anyString, anyString, anyString, > anyString, anyString, anyString, anyString]]; > > /* This string with 21 %@ strings in it WILL CRASH ANY PROGRAM EVERY > TIME because it has more then 20 */ > [crashString setString:[NSString stringWithFormat:@"1.%@ 2.%@ 3.%@ 4.%@ > 5.%@ 6.%@ 7.%@ 8.%@ 9.%@ 10.%@ 11.%@ 12.%@ 13.%@ 14.%@ 15.%@ 16.%@ > 17.%@ 18.%@ 19.%@ 20.%@ 21.%@ ", anyString, anyString, anyString, > anyString, anyString, anyString, anyString, anyString, anyString, > anyString, anyString, anyString, anyString, anyString, anyString, > anyString, anyString, anyString, anyString, anyString, anyString]]; > > > Say no more ! I am thinking of reporting it, to feedback. > > Also this is a test of macosx-dev@omnigroup.com, just to see if any > messages are working because I see nothing posted, and there is so much > to tell. > [snip] While I do agree that it's a bug(and should be reported), isn't there a better way to do that? // produce the same thing without crashing.. NSMutableString *crashString = [NSMutableString string]; NSNumber *incrementalNum; int i=1; for (; i<22; i++) { incrementalNum = [NSNumber numberWithInt:i]; [crashString appendString: [incrementalNum stringValue]]; [crashString appendString:@".someString"]; } NSLog(crashString); It seems like you're misusing NSMutableString in that block of code -- you might as well be using an NSString instead (which also seems to show off the bug)... NSString *crashString; NSString *anyString = @" someString "; /* This string with only 20 %@ strings in it is okay */ crashString = [NSString stringWithFormat:@"1.%@ 2.%@ 3.%@ 4.%@ 5.%@ 6.%@ 7.%@ 8.%@ 9.%@ 10.%@ 11.%@ 12.%@ 13.%@ 14.%@ 15.%@ 16.%@ 17.%@ 18.%@ 19.%@ 20.%@ ", anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString]; /* This string with 21 %@ strings in it WILL CRASH ANY PROGRAM EVERY TIME because it has more then 20 */ crashString = [NSString stringWithFormat:@"1.%@ 2.%@ 3.%@ 4.%@ 5.%@ 6.%@ 7.%@ 8.%@ 9.%@ 10.%@ 11.%@ 12.%@ 13.%@ 14.%@ 15.%@ 16.%@ 17.%@ 18.%@ 19.%@ 20.%@ 21.%@ ", anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString, anyString]; From rosyna at unsanity.com Fri Aug 3 09:21:25 2001 From: rosyna at unsanity.com (Rosyna) Date: Thu Nov 3 14:47:01 2005 Subject: NSMutableString class - 20 string limit in stringWithFormat: In-Reply-To: <200108031613.JAA24308@omnigroup.com> References: <200108031613.JAA24308@omnigroup.com> Message-ID: I think the point was just to show the bug, not actually use it for anything. Ack, at 8/3/01, Ryan Stevens said: >While I do agree that it's a bug(and should be reported), isn't >there a better way to do that? > >// produce the same thing without crashing.. >NSMutableString *crashString = [NSMutableString string]; >NSNumber *incrementalNum; >int i=1; > >for (; i<22; i++) { > incrementalNum = [NSNumber numberWithInt:i]; > [crashString appendString: [incrementalNum stringValue]]; > [crashString appendString:@".someString"]; >} >NSLog(crashString); > >It seems like you're misusing NSMutableString in that block of code >-- you might as well be using an NSString instead (which also seems >to show off the bug)... -- Sincerely, Rosyna Keller Technical Support/Holy Knight/Always needs a hug Unsanity: Unsane Tools for Insane People From richard at brainstorm.co.uk Fri Aug 3 09:44:40 2001 From: richard at brainstorm.co.uk (Richard Frith-Macdonald) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration In-Reply-To: <200108020020.AA09727@ocs.cz> Message-ID: <200108020832.f728WIE00561@mail.brainstorm.co.uk> On Thursday, August 2, 2001, at 01:20 AM, Ondra Cada wrote: > Alec, > >>>>>>> Alec Bartsch (AB) wrote at Wed, 1 Aug 2001 10:42:40 -0700: > AB> However, in general, balancing allocation with releasing the object > is > AB> just as valid as your suggested approach of immediately > autoreleasing the > AB> object after allocation, and does indeed offer a performance > benefit, > AB> which may or may not be significant depending on how the method in > AB> question is used. > AB> > AB> I'm new to all this reference-counting memory-management > business--what > AB> would be the performance benefit of a release over an autorelease? > Is > AB> there some significant overhead involved in managing the autorelease > AB> pool? > > Well, wait for Christian's answer. My one is: unless you are writing an > _unusually_ complicated code, there is *NO* significant difference. You > should use the easier way of using autorelese; if you happen to find the > application's slow (which is *QUITE* improbable), you can optimize > afterwards. If we ignore the issue of actual object deallocation (which takes the same time whatever - it just occurs at different points) ... I'd actually say the performance difference is greatest when you are writing unusually simple code. ie. when the release/autorelease is a significant part of what you are doing. For instance, I would not be surprised if a method to set an instance variable (releasing the old version) is twice as fast when using release as when using autorelease The actual difference between the two mechanisms in terms of performance is that in a release we simply decrement and test a reference count (though for some objects we may have to fetch the reference count from a hashtable), while with an autorelease, we store the autoreleased object in come container, then when the autorelease pool is allocated we get the object form that container and then *we release it anyway*. So the additional overhead of an autorelease is the extra method call to the autorelease method itsself, plus the code needed to store the object in the pool and remove it from the pool later. Another consideration is memory management ... if enough code that uses autorelease is executed in methods called from within a loop, the size of the autorelease pool (and of the allocated objects which have not been released and deallocated because they are inside the pool) can grow huge. The process of growing the pool and adding objects to it will on average be slower for larger pools, and you might even end up forcing the operating system to start paging your app out to disk! Of course, the correct answer to this is to intermittently release the autorelease pool and create a new one in looping code where this is a problem, but if the methods you are calling minimise their autorelease use, the problem might never arise. From isaac at jpmktg.com Fri Aug 3 10:15:33 2001 From: isaac at jpmktg.com (i.) Date: Thu Nov 3 14:47:01 2005 Subject: Shared Library Problems... Message-ID: *This message was transferred with a trial version of CommuniGate(tm) Pro* Hello, all. Please let me know if this is too [OT] for this list. It just seemed like the place to ask... Here is my problem. I am trying to link some shared libraries to an application. I have successfully linked libjpeg, libpng, and libtiff. I have been and am still trying to link libpdf to no avail. During the 'configure' proccess I get this message in my config.log: /usr/bin/ld: /usr/local/lib/libpdf.dylib is input for the dynamic link editor, is not relocatable by the static link editor again configure: failed program was: #line 40685 "configure" My gut tells me it has to do with the lack of dl() support in OSX, but, I am not really sure. If anyone can tell me how to fix this, I would be eternally grateful. Thanks, Isaac From imeepmeep at hotmail.com Fri Aug 3 10:16:10 2001 From: imeepmeep at hotmail.com (Jeremy K) Date: Thu Nov 3 14:47:01 2005 Subject: NSBezierPath help... Message-ID: I just wanted to ask if someone could give me a hand in using NSBezierPath, i want to make a round-cornered rectangle that i can resize and such. problem is trying ot make those little round corners. the way NSBezier path does it's curves (special the appendPathWithArcWithCenter) completely baffles me. i figure i could give that method 0 & 90 as degrees and it'd draw a quarter circle line segment but hell no! anybody got suggestions? =P -jerome _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From greg at omnigroup.com Fri Aug 3 11:16:37 2001 From: greg at omnigroup.com (Greg Titus) Date: Thu Nov 3 14:47:01 2005 Subject: Quick string-set search In-Reply-To: <0GHH00849UC257@sims-px3.cg.sfl.net> Message-ID: <200108031816.LAA29791@omnigroup.com> On Friday, August 3, 2001, at 06:17 AM, Mark Onyschuk wrote: > Most often when you need to do this, you'll build a Trie which is a > kind of n-way tree with words at either the nodes or leaves (IIRC - > it's been a while since CS324 :-). Actually, tries are great for fast string matching or prefix matching, but they don't do arbitrary substring matching. To do fast substring finding, you need a PAT tree instead, which is sort of like a trie that includes every possible tail of each string. (That is, for the word "tree", you'd include "tree", "ree", "ee", and "e" in the tree. But if you know you are doing that then you can make a more efficient implementation then just adding all those entries to a normal trie.) You'll find a fast Trie implementation that also hooks into our string scanner class in OmniFoundation. We use them for tag and attribute matching in OmniWeb. But we don't have a PAT tree class, and you don't really need one unless the text you are searching over is very large. Ondra's suggestion of just running through all the strings and looking for the substring in each is likely to be fast enough for most cases. Especially if you add the obvious optimization: remember the last string that you searched for, and if your new search string has the old search string as a substring, you only need to search the previous set of matches instead of the entire list. -Greg >>>>>>>> Brian Webster (BW) wrote at Thu, 2 Aug 2001 22:32:17 -0500: >> BW> Can someone point me to sample code or an algorithm description >> BW> for doing a quick substring search in a set of strings? I'm >> BW> looking to implement a behavior like that in iTunes' search or >> BW> Explorer/OmniWeb's address completion; namely, given a set of >> BW> strings and a substring, find all the strings that contain the >> BW> substring. >> >> Would be something like >> >> NSArray *allTheStrings... >> NSString *searchThis... >> >> NSEnumerator *en=[allTheStrings objectEnumerator]; >> NSString *s; >> NSRange rr; >> while (s=[en nextObject]) >> if ((rr=[s rangeOfString:searchThis]).length>0) break; >> // either rr.length==0, or s contains sought string and rr shows where >> >> sufficient, or do you need more flexibility, effectivity, etc? >> --- >> Ondra Cada >> OCSoftware: ocs@ocs.cz http://www.ocs.cz >> private ondra@ocs.cz http://www.ocs.cz/oc >> _______________________________________________ >> MacOSX-dev mailing list >> MacOSX-dev@omnigroup.com >> http://www.omnigroup.com/mailman/listinfo/macosx-dev >> > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2830 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010803/71de56a6/attachment.bin From adrian_ridner at hp.com Fri Aug 3 11:21:08 2001 From: adrian_ridner at hp.com (Adrian Ridner) Date: Thu Nov 3 14:47:01 2005 Subject: Help Loading Auxiliary Nibs files In-Reply-To: <200108012247.PAA05297@gull.mail.pas.earthlink.net> Message-ID: <200108031820.LAA17518@yale.vcd.hp.com> Thanks everybody who answered my question (online and offline). I have changed a few things in the code including shorter loadNibNamed:owner call and checked the box in IB that says "Visible at launch time". I was extremely satisfied because the window loaded, however I noticed it only loads when I initialize it! After that if I try [[PreferencesController sharedInstance] showWindow:self]; it doesn't show the window again! Got ideas? Please send them my way Adrian On Wednesday, August 1, 2001, at 03:40 PM, David P. Henderson wrote: > On Wednesday, August 1, 2001, at 02:03 , Adrian Ridner wrote: > > >> I derive all my controllers from a common object subclass of >> NSWindowController that has this code in init (and I keep the naming >> of the controller object the same as the nib file:) >> >> - (id) init { >> >> // Continue the designated initializer chain: >> [super init]; >> >> // here's a fuller invocation of "loadNibNamed:" which shows the >> loading of the >> // dictionary with the key-value pair NSOwner, which has a value >> of "self". >> [NSBundle loadNibFile:[[NSBundle mainBundle] >> pathForResource:NSStringFromClass([self class]) >> ofType:@"nib"] >> externalNameTable:[NSDictionary >> dictionaryWithObjectsAndKeys:self, @"NSOwner", nil] >> withZone:[self zone]]; >> >> // place other initialization code here >> return self; >> >> } >> >> > Firstly, if the above init is in an NSWindowController subclass, the > NSWindowController docs state that you should invoke super with one of > the following initializers: initWithWindowNibName:; > initWithWindowNibName:owner:; initWithWindow:. Secondly, loadNibFile is > expecting the name of the nib file sans extension not a path which is > what you're passing it. Try [super > initWithWindowNibName:NSStringFromClass([self class]) owner:self] > instead. > > You should take a look at the source for Sketch as it uses shared > NSWindowController subclass instances to implement its tools panel, > preferences panel, info panel and grid panel. > > Dave > -- > Chaos Assembly Werks > "Suburbia is where the developer bulldozes out the trees, then names the > streets after them." > - Bill Vaughn > *************************************** Adrian Ridner Mac Software Team Hewlett-Packard 360.212.1779 adrian_ridner@hp.com *************************************** Soyons R?alistes, Demandons L'Impossible. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2585 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010803/ad0f674f/attachment.bin From rainer at brockerhoff.net Fri Aug 3 15:32:44 2001 From: rainer at brockerhoff.net (Rainer Brockerhoff) Date: Thu Nov 3 14:47:01 2005 Subject: NSArray Enumeration Message-ID: Just to return for a moment to the original subject (NSArray enumeration)... To find out more about the exact places where other code calls retain, release, and autorelease, I overrode these methods for my object and placed breakpoints on the [super ...] lines. The main flow of control was roughly like this: foo* thing = [[foo alloc] init] ... NSArray* arr = [NSArray arrayWithObject:thing]; ... NSEnumerator* bar = [arr objectEnumerator]; ... while ((x = [bar nextObject])) {...}; As documented, arrayWithObject retains its argument. Also as documented, objectEnumerator retains the array and releases it again as soon as the enumerator is finished (or, I suppose, when the enumerator is released). What is _not_ documented is that nextObject retains the returned object and autoreleases it when called again... so the object gets added to the autorelease pool as a side effect. -- Rainer Brockerhoff Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." http://www.brockerhoff.net/ (updated July 2000) From zak_ziggy at hotmail.com Fri Aug 3 22:46:59 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:01 2005 Subject: The Applications Directory Message-ID: I am trying to find a way to get the running application's directory. Is there a way to determine the location of the application itself? I can not remember what it was in OpenStep and can not currently find it for OS X Server. From Zak P.S. = [[NSworkspace sharedWorkspace] fullPathForApplication:@"ThisRunningApp"]; and = [[NSFileManager defaultManager] currentDirectoryPath]; (/tmp at first) are not good enough! _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From zak_ziggy at hotmail.com Fri Aug 3 23:04:13 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: Running App Directory Message-ID: I finally found [[NSBudle mainBundle] resourcePath], that is going to work for me. So when I put a directory of images in the Resources folder of the ProjectBuilder's file panel, the compiled program dumps the indivudual files in to the Resources folder, and I am not able to select the their folder as a target to built. I guess I will copy it manually every time I think there is a place for a scriptto do this. Any suggestions or details would be helpful. From Zak _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From ddavidso at apple.com Fri Aug 3 23:04:27 2001 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:47:02 2005 Subject: The Applications Directory In-Reply-To: Message-ID: On Friday, August 3, 2001, at 10:46 PM, Zak Ziggy wrote: > I am trying to find a way to get the running application's directory. > Is there a way to determine the location of the application itself? > I can not remember what it was in OpenStep and can not currently find > it for OS X Server. > > From Zak > > P.S. = [[NSworkspace sharedWorkspace] > fullPathForApplication:@"ThisRunningApp"]; > and > = [[NSFileManager defaultManager] currentDirectoryPath]; > (/tmp at first) are not good enough! The functionality you want is in NSBundle. Try [[NSBundle mainBundle] bundlePath] for the path to your application's bundle, or executablePath for the path to the executable itself, or any of the other related NSBundle path methods. As for your second example, remember that the current working directory can be absolutely anything at the launch of your application; it is determined by whatever launches you. Don't assume anything about it unless you set it yourself. Douglas Davidson From itrat at mac.com Fri Aug 3 23:09:05 2001 From: itrat at mac.com (Itrat Khan) Date: Thu Nov 3 14:47:02 2005 Subject: The Applications Directory In-Reply-To: Message-ID: <20010804060901.MFDD20845.femail7.sdc1.sfba.home.com@localhost> On Saturday, August 4, 2001, at 01:46 AM, Zak Ziggy wrote: > I am trying to find a way to get the running application's directory. > Is there a way to determine the location of the application itself? > I can not remember what it was in OpenStep and can not currently find > it for OS X Server. Use [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent] .......................................... Itrat Khan http://www.itrat.net From epimetrias at bigfoot.com Fri Aug 3 23:11:47 2001 From: epimetrias at bigfoot.com (James Callender) Date: Thu Nov 3 14:47:02 2005 Subject: Threads, timers, sockets....AH! Message-ID: <200108040611.CAA10322@mercury.superuser.net> Hey, I've been working on a MUD client for OSX for a while, and needless to say it is quite buggy. Since this is actually one of my first programs in Cocoa, I've been learning all the ins and outs of development. Right now I've been having some trouble related to the receiving thread i have set up to capture all information coming from the MUD. I have the thread set up in a Connection object (though i'm about to change it to a Controller class i have, since i figure that makes a little more sense) and it simply relays all information to the document class. I have too main glitches I'm trying to work out - one is with scrolling. I have it set now so when the connection receives text, it prints it out, and then scrolls. This doesn't always work as desired, and might leave the scrollbar not fully scrolled, or even jumped all the way to the top. I've put a lock around the the methods that are called to put the string, and update (scroll), but this didn't really seem to help much. The other glitch seems to come when receiving large messages, basically i just get the spinning ball of death (i've tried to reproduce this while debugging, but it is a pain to find something that will send me a large message). I know I probably sound a little weird, but it is 2 AM and i'm very much a newbie. Any help/suggestions would be appreciated, one could say i basically i have no idea what i'm doing. - James From ddavidso at apple.com Fri Aug 3 23:14:56 2001 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:47:02 2005 Subject: Running App Directory In-Reply-To: Message-ID: <2C33D752-88A0-11D5-855B-000502935EF5@apple.com> On Friday, August 3, 2001, at 11:03 PM, Zak Ziggy wrote: > I finally found [[NSBudle mainBundle] resourcePath], that is going to > work for me. > So when I put a directory of images in the Resources folder of the > ProjectBuilder's file panel, the compiled program dumps the indivudual > files in to the Resources folder, and I am not able to select the their > folder as a target to built. I guess I will copy it manually every time > I think there is a place for a scriptto do this. > Any suggestions or details would be helpful. If you are looking for an individual file within the Resources directory, try the pathForResource:ofType:... methods. The inDirectory: versions allow you to specify a subdirectory within the Resources directory. I'm not sure exactly what you want Project Builder to do, but I believe it can put files in a subdirectory of the Resources directory, although I don't have precise instructions for that. Douglas Davidson From starmacs at mac.com Fri Aug 3 23:27:41 2001 From: starmacs at mac.com (Mark T) Date: Thu Nov 3 14:47:02 2005 Subject: Running App Directory Message-ID: >I finally found [[NSBudle mainBundle] resourcePath], that is going >to work for me. >So when I put a directory of images in the Resources folder of the >ProjectBuilder's file panel, the compiled program dumps the >indivudual files in to the Resources folder, and I am not able to >select the their folder as a target to built. I guess I will copy it >manually every time I think there is a place for a scriptto do this. >Any suggestions or details would be helpful. > > From Zak There are two ways to do this. The easier way is to drag the entire folder of images into Project Builder and when it pops up the panel, select the lower radio button:"create Folder Refernces for Any Added Folder". Your folder should be left intact in the resources folder of the built application. The other option is to create a new build phase. To do this, open the application Target in Project Builder and select the Files and Build Phases tab. From the Project menu, select New Build Phase and from the submenu, select New copy Files Build phase. Then, just drag the images you want to be in a subfolder into the phase and enter the path you want them to be at. Mark T. From zak_ziggy at hotmail.com Fri Aug 3 23:43:29 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: Running App's Directory Bundle Message-ID: Great I finally discovered what the other option in the Add Files panel (of the ProjectBuilder) is for. The radio switch option is called 'Create Folder References for any added folders', and it allows the entire folder to show up in the Resources folder of the Built Application. Then [[NSBundle mainBundle] resourcePath]; will point me to the right place, I know what the directory is called. Thanks for the help Zak _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From zak_ziggy at hotmail.com Fri Aug 3 23:53:24 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: Running App Directory Now: Adding Bundles, Build Phases, and Deployment Message-ID: I found the function of the add Files switch, >[snip] The other option is to create a new build >phase. To do this, open the application Target in Project Builder and >select the Files and Build Phases tab. From the Project menu, select >New Build Phase and from the submenu, select New copy Files Build >phase. Then, just drag the images you want to be in a subfolder into >the phase and enter the path you want them to be at. > >Mark T. but the 'New Build Phase' submenu has always been unselectable (grayed out) for me, and I never was able to understand what it was for. Even if I have the 'Files and Build Phases tab' selected. Why does this not work for me ? (Is yours never grayed out?) The other thing while I am on the topic of things in PB not working. Is the Install or Deployment built type, the problem is even with the path set and everything, it does not seem to install or deploy the Application I have to copy it manually. (Like in the case of a ScreenSaver, require for testing.) From Zak _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From zak_ziggy at hotmail.com Sat Aug 4 00:00:48 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: Running App Directory Message-ID: Now I see that I must select a Bundle item first, but the path is edited manually. Can I put no leading / and be in the Project's directory and just put extraResourceDirectory, now there is no way of editting the Files field. What do I do now? Is this new stuff documented anywhere it is a bit confusing? From Zak _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From zak_ziggy at hotmail.com Sat Aug 4 00:07:22 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: (no subject) Message-ID: Great one final question about Build Phases. Can I delete them after adding the Copy Files, AppleScript, and Shell Script options to a Project's target ? Thanks again Zak _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From ocs at ocs.cz Sat Aug 4 02:04:33 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:02 2005 Subject: The Applications Directory In-Reply-To: References: Message-ID: <200108040907.AA12163@ocs.cz> Zak, >>>>>> Zak Ziggy (ZZ) wrote at Fri, 03 Aug 2001 22:46:27 -0700: ZZ> I am trying to find a way to get the running application's directory. ZZ> Is there a way to determine the location of the application itself? ZZ> I can not remember what it was in OpenStep and can not currently find it ZZ> for OS X Server. NSBundle.html, app-specific information you'll find via mainBundle. I don't remember the appropriate service names since I never used them explicitly, but they are there (and were in the OpenStep as well). NSProcessInfo should, incidentally, provide similar features (I'm not quite sure), but I would stick with the NSBundle. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ocs at ocs.cz Sat Aug 4 02:04:42 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:02 2005 Subject: Running App Directory In-Reply-To: <2C33D752-88A0-11D5-855B-000502935EF5@apple.com> References: <2C33D752-88A0-11D5-855B-000502935EF5@apple.com> Message-ID: <200108040906.AA12160@ocs.cz> Douglas, >>>>>> Douglas Davidson (DD) wrote at Fri, 3 Aug 2001 23:15:59 -0700: DD> I'm not sure exactly what you want Project Builder to do, but I believe DD> it can put files in a subdirectory of the Resources directory, although DD> I don't have precise instructions for that. Just place a directory into resources (instead of a file). It should work as intended. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From kubernan at 10191.com Sat Aug 4 02:27:34 2001 From: kubernan at 10191.com (kubernan) Date: Thu Nov 3 14:47:02 2005 Subject: Multiple windows : a little bit confused Message-ID: <200108040927.CAA25196@omnigroup.com> Hello all ! After reading omnigroup de dev. mailing list, i'm still confused with my app. I have two window in this application : - the main window in which double clicking in a row of a table view opens a new window. Each window are in seperate .nib files. The doubleClick method execute this code : if (![NSBundle loadNibNamed:@"myNibFile" owner:self]) { NSLog(@"Failed to load Document.nib"); [self release]; } [window makeKeyAndOrderFront:self]; I don't know if its good but myNibFile appears but...but.. nothing happens in the .m associated (NSBeep(); in awaikFromNib doesn't work). At this time, the corresponding controller in .h file was defined as a subclass of NSWindowController. I have buttons on the window but it appears i'm not able to specify the target in IB defined in the .m file. The target doesn't appear in IB. If i defined the controlleras a sublass of NSWindowController in .h file, the target appears but after double click for launching the window i have this message : could not connect MyAction to the Delegate... I'm looking for simple sample of two windows app. (the Apple example have two much code). Or if you have idea on my prb... Thx for your help From tschnitzer at t-online.de Sat Aug 4 03:05:38 2001 From: tschnitzer at t-online.de (Thomas Schnitzer) Date: Thu Nov 3 14:47:02 2005 Subject: assigning a key equiv. in IB In-Reply-To: <200108021612.f72GCqA13923@linux.dataline.cz> Message-ID: <15SyJI-0Pwe6iC@fwd07.sul.t-online.com> Hi, a somewhat related question: if I assign the delete key as a key equivalent to a menu command in IB, it shows up correctly (the left headed arrow with the x inside). But if I run my application (or even test the interface inside IB), cmd-del doesn't work and the key equivalent shows up as a right headed arrow (forward delete?). Any suggestions? Thanks in advance, Thomas From pmougin at acm.org Sat Aug 4 07:38:55 2001 From: pmougin at acm.org (Philippe Mougin) Date: Thu Nov 3 14:47:02 2005 Subject: HOM (was: NSArray Enumeration) In-Reply-To: <200108021924.MAA24139@lists.omnigroup.com> Message-ID: <3b6c08cd3c980c74@mahonia.wanadoo.fr> (added by mahonia.wanadoo.fr) Marcel Weiher : > [...] > > The numbers ( beige G3/DT/233Mhz), user time: > > HOM 6.11 s > Andreas's HOM 73 s > objectAtIndex: 16.5 s > objectAtIndex:/max 12.3 s ( the array's count is stashed in an int) > enumerator 7.6 s ( I found this surprising, but the counter was OK) > > fast HOM 2.6 s ( an experimental version of the -do > HOM optimized for arrays) > Very interesting numbers and examples. Thanks for sharing. The enumerator number is indeed surprising. This probably means that the private NSArray subclass provided by Apple has a custom, optimized, implementation for its enumerator, which directly access the array content without going through an objectAtIndex: call > So, the MPWFoundation HOM implementation is about 10 times faster than > the little sample implementation, and actually faster than both the > -objectEnumerator and -objectAtIndex: iteration styles, and it is > possible to go around 3 times faster still. > > This shows how higher levels of abstraction and reuse actually help > speed: because the one loop running inside the HOM-code will be reused > a lot, it makes sense to optimize the heck out of it, using IMP-caching > and manual code-layout, whereas it probably wouldn't be worth it to > optimize all the individual loops in a program. > Yes, you hit the nail on the head. BTW, The number you give for fast HOM are amazing, and I look forward to adapt your optimization techniques to my project. I would recommend to anyone wanting to dig deeper into the original capacities of Objective-C (including how it allows to combine high level object concepts and hardcore optimization), to take a look at HOM and the rest of the metaobject package. It's great code, and is both fun and powerful. Phil From vaucanson at mac.com Sat Aug 4 10:59:43 2001 From: vaucanson at mac.com (vaucanson) Date: Thu Nov 3 14:47:02 2005 Subject: Drag/Drop onto NSToolbar button? In-Reply-To: <200108040906.AA12160@ocs.cz> Message-ID: <200108041759.KAA02991@smtpout.mac.com> I'd like to have an button on my NSToolbar accept text dropped onto it - is this easy/possible? Thanks -jacques From alex at mindlube.com Sat Aug 4 11:25:31 2001 From: alex at mindlube.com (Alex Rice) Date: Thu Nov 3 14:47:02 2005 Subject: updating UI from other thread Message-ID: <200108041825.f74IPrs48782@taka.swcp.com> I was surprised to read this in the NSTimer docs: For example, you could create an NSTimer that sends a message to a window, telling it to update itself after a certain time interval. Is that safe to do? I would have assumed that once could not safely send messages to GUI objects from subthreads. Is it safe to do something like this: NSTimer *myTimer = [NSTimer scheduledTimerWithTimeInterval:60 target:myListView selector:selector(reloadData) userInfo:nil repeats:NO]; Until I read that sentence in NSTimer, I was using NSDistributedNotificationCenter because that seems like it's intended for thread safe messaging. What's the best practice for this kind of thing? TIA Alex Rice From demarco at apple.com Sat Aug 4 11:55:36 2001 From: demarco at apple.com (Vince DeMarco) Date: Thu Nov 3 14:47:02 2005 Subject: assigning a key equiv. in IB In-Reply-To: <15SyJI-0Pwe6iC@fwd07.sul.t-online.com> Message-ID: <46C675B4-890A-11D5-83F0-0003930FDF98@> On Saturday, August 4, 2001, at 03:04 AM, Thomas Schnitzer wrote: > Hi, > > a somewhat related question: if I assign the delete key as a key > equivalent to a menu command in IB, it shows up correctly (the left > headed arrow with the x inside). But if I run my application (or even > test the interface inside IB), cmd-del doesn't work and the key > equivalent shows up as a right headed arrow (forward delete?). > > Any suggestions? > Its a bug in the AppKit, hopefully it gets fixed for the next release, but the workaround is to set the key equivalent for this particular menu in code. vince From ocs at ocs.cz Sat Aug 4 11:56:06 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:02 2005 Subject: updating UI from other thread In-Reply-To: <200108041825.f74IPrs48782@taka.swcp.com> References: <200108041825.f74IPrs48782@taka.swcp.com> Message-ID: <200108041858.AA12631@ocs.cz> Alex, >>>>>> Alex Rice (AR) wrote at Sat, 4 Aug 2001 12:25:11 -0600: AR> For example, you could create an NSTimer that sends a message to a AR> window, AR> telling it to update itself after a certain time interval. AR> AR> Is that safe to do? I would have assumed that once could not safely send AR> messages to GUI objects from subthreads. Is it safe to do something like AR> this: NSTimer has, if I remember well and if the API did not change, *NOTHING* to do with threads. So far as I know, it is served the very plain way in the event loop: when the timer is due, the event loop will sent the appropriate event. No multithreading involved. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From wave at pixar.com Sat Aug 4 12:25:36 2001 From: wave at pixar.com (Michael B. Johnson) Date: Thu Nov 3 14:47:02 2005 Subject: Drag/Drop onto NSToolbar button? In-Reply-To: <200108041759.KAA02991@smtpout.mac.com> Message-ID: <200108041924.MAA08048@pixar.pixar.com> sure, just use a custom view for the toolbar items you put on the toolbar. Reading the header closely will probably help... On Saturday, August 4, 2001, at 10:59 AM, vaucanson wrote: > I'd like to have an button on my NSToolbar accept text dropped onto > it - is this easy/possible? > > Thanks > -jacques > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > --> Michael B. Johnson, Ph.D. -- wave@pixar.com --> Studio Tools, Pixar Animation Studios --> http://xenia.media.mit.edu/~wave From epeyton at epicware.com Sat Aug 4 13:24:28 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:02 2005 Subject: updating UI from other thread In-Reply-To: <200108041825.f74IPrs48782@taka.swcp.com> Message-ID: You can definitely use a timer to do this sort of thing. A timer (by default) is not in another thread anyway, it is on the main thread as part of the run loop. Eric On Saturday, August 4, 2001, at 01:25 PM, Alex Rice wrote: > I was surprised to read this in the NSTimer docs: > > For example, you could create an NSTimer that sends a message > to a window, > telling it to update itself after a certain time interval. > > Is that safe to do? I would have assumed that once could not > safely send messages to GUI objects from subthreads. Is it safe to > do something like this: > > NSTimer *myTimer = [NSTimer scheduledTimerWithTimeInterval:60 > target:myListView > selector:selector(reloadData) > userInfo:nil > repeats:NO]; > > Until I read that sentence in NSTimer, I was using > NSDistributedNotificationCenter because that seems like it's > intended for thread safe messaging. What's the best practice for > this kind of thing? > > TIA > > Alex Rice > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From mikevannorsdel at qwest.net Sat Aug 4 13:34:41 2001 From: mikevannorsdel at qwest.net (Mike Vannorsdel) Date: Thu Nov 3 14:47:02 2005 Subject: Archiving Revisited Message-ID: <200108042034.NAA11040@omnigroup.com> This topic was discussed quite some time back. I just wanted to check up on what's new now. I'm still looking for a solution to backup data on Mac OS X that preserves resource forks, posix permissions, and owner data. I also can't seem to locate hfstar which I'd like to try for this. What about the Retrospect beta? Does it preserve the posix permissions and owners as of yet? What else is there? Using CpMac or ditto to a disk image doesn't quite work since the owner is changed. From jensbaumeister at mac.com Sat Aug 4 13:34:57 2001 From: jensbaumeister at mac.com (Jens Baumeister) Date: Thu Nov 3 14:47:02 2005 Subject: Major Bug in Cocoa (With sample Code!!) In-Reply-To: <200108021426.HAA28447@smtpout.mac.com> Message-ID: <200108042034.NAA21204@smtpout.mac.com> Am Donnerstag, 2. August 2001 um 16:26 schrieb Steve Gehrman: > > OK, I put together a sample project that shows a major bug with > forwardinvocation. The problem is that the forwardinvocation stuff > retains the objects it returns from methods and everytime you call the > method, the retain count just keeps growing. Check out the code and > you will see what I'm talking about. > > This is a major pain in the ass. I structured a large part of my app > around this forwardinvocation stuff and my app hogs memory like a mofo!! Here's a quick and dirty fix for your problem. Add a category like this: InvCat.h #import @interface NSInvocation (InvCat) -(void)newInvokeWithTarget:(id)target; @end -------- InvCat.m #import "InvCat.h" @implementation NSInvocation (InvCat) -(void)newInvokeWithTarget:(id)target { int myCount; myCount = [target retainCount]; [self invokeWithTarget:target]; if ([target retainCount] > myCount) { [target release]; } } @end --------- If you change your call from invokeWithTarget to newInvokeWithTarget , the retain count will stay the same. Needless to say, this is not an ideal solution and you should still report the bug to Apple. Questio: Would it be possible to name the category method invokeWithTarget and still somehow access the original invokeWithTarget from within the category - the way a call to super works from within a subclass? That would make the whole thing more elegant, because you wouldn't need to change the code outside the category. ---------------------------------- Jens Baumeister, Bullex GmbH, Cologne Is it a bird? Is it a plane? Is it an UFO? No, it's a 136-speed CD-rom! From greg at omnigroup.com Sat Aug 4 13:52:33 2001 From: greg at omnigroup.com (Greg Titus) Date: Thu Nov 3 14:47:02 2005 Subject: Major Bug in Cocoa (With sample Code!!) In-Reply-To: <200108042034.NAA21204@smtpout.mac.com> Message-ID: <200108042052.NAA11658@omnigroup.com> On Saturday, August 4, 2001, at 01:34 PM, Jens Baumeister wrote: > > Here's a quick and dirty fix for your problem. Add a category like this: [...] > If you change your call from invokeWithTarget to newInvokeWithTarget , > the retain count will stay the same. Needless to say, this is not an > ideal solution and you should still report the bug to Apple. > > Questio: Would it be possible to name the category method > invokeWithTarget and still somehow access the original invokeWithTarget > from within the category - the way a call to super works from within a > subclass? > > That would make the whole thing more elegant, because you wouldn't need > to change the code outside the category. You can do it by modifying the Obj-C runtime directly and replacing the existing implementation pointer with your new implementation, saving the old implementation pointer and calling it directly inside the new implementation. There are a couple bug fixes similar to yours in OmniFoundation which do this - you can look at them for examples. OmniBase includes a function OBReplaceMethodImplementationWithSelector() to do the switch (just search for that function). -Greg -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1243 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010804/0dfc55e5/attachment.bin From aozer at apple.com Sat Aug 4 15:40:20 2001 From: aozer at apple.com (Ali Ozer) Date: Thu Nov 3 14:47:02 2005 Subject: Major Bug in Cocoa (With sample Code!!) In-Reply-To: <200108021426.HAA28447@smtpout.mac.com> Message-ID: On Thursday, August 2, 2001, at 07:26 , Steve Gehrman wrote: > OK, I put together a sample project that shows a major bug with > forwardinvocation. The problem is that the forwardinvocation stuff > retains the objects it returns from methods and everytime you call the > method, the retain count just keeps growing. Check out the code and > you will see what I'm talking about. > > This is a major pain in the ass. I structured a large part of my app > around this forwardinvocation stuff and my app hogs memory like a mofo!! > > Apple, please fix soon!! (or tell me what I'm doing wrong) Ok!! The fix should be in 10.1. I believe we intend the fix to take effect only against apps linked with 10.1 or better, as there might be dependencies on such a change. Ali From ocs at ocs.cz Sat Aug 4 17:25:21 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:02 2005 Subject: Major Bug in Cocoa (With sample Code!!) In-Reply-To: <200108042034.NAA21204@smtpout.mac.com> References: <200108042034.NAA21204@smtpout.mac.com> Message-ID: <200108050027.AA12859@ocs.cz> Jens, >>>>>> Jens Baumeister (JB) wrote at Sat, 4 Aug 2001 22:34:35 +0200: JB> Questio: Would it be possible to name the category method JB> invokeWithTarget and still somehow access the original invokeWithTarget JB> from within the category - the way a call to super works from within a JB> subclass? Nope, with categories it is not possible. Though... JB> That would make the whole thing more elegant, because you wouldn't need JB> to change the code outside the category. ...there is poseAsClass: method, which ellows exactly that (and more)! See the doc in NSObject.html. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ocs at ocs.cz Sat Aug 4 18:26:04 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:02 2005 Subject: ObjC enhancements? (was: Major Bug in Cocoa (With sample Code!!)) References: <200108042034.NAA21204@smtpout.mac.com> Message-ID: <200108050128.AA12918@ocs.cz> Incidentally, >>>>>> Ondra Cada (OC) wrote at Sun, 5 Aug 2001 02:27:25 +0200: JB>> Questio: Would it be possible to name the category method JB>> invokeWithTarget and still somehow access the original invokeWithTarget JB>> from within the category - the way a call to super works from within a JB>> subclass? OC> OC> Nope, with categories it is not possible. Though... so far as I understand the category mechanic, it _SHOULD_ be relatively easy to add some special receiver ("[categorySuper message]" or whatever), which would ensure that (the original method table's still available, only the category's one is searched first, isn't it so?). It *might* be a desirable change in the compiler... perhaps. OTOH, poseAsClass:ing can be used, so it is not that important. Speaking of compiler changes: I personally could find use for - C++ like declarations "anywhere" (slightly improved over the C++ ones); - default method arguments (late bound ones, ie. totally different from the C++ ones); - "__attribute__ ((format..." improved so as it understands and can check %@ !!! Any comments from others? Any comments from Apple? A few more details: (i) declarations anywhere It would be quite nice if one C++ bug can be corrected. The C++ does not allow goto (or "hidden" gotos like switch etc) with initialization, not even in cases when it is perfectly proper, like: if (?) goto Lbl; int i=1; ... Lbl: // below this point i is *never* used For consistency sake, even the *bad* variant when i is used below Lbl: should be a warning, not an error, since it is absolutely equivalent to a *VALID* code of int i; if (?) goto Lbl; i=1; ... Lbl: (ii) default argument values The C++ way of default arguments is, just like the whole C++, compile-time, and thus quite inconvenient. I would prefer a compiler extension, which would _automatically define 'simpler' methods_. An example to elucidate: @implementation... // the default arguments will, OF COURSE, be in the imlpementation, not in the header! -(void)methodWith:(int)i with:(int)j=5 { ... } @end would be totally equivalent of implementation @implementation... -(void)methodWith:(int)i with:(int)j { ... } -(void)methodWith:(int)i {[self methodWith:i with:5];} @end --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From wave at pixar.com Sat Aug 4 18:39:21 2001 From: wave at pixar.com (Michael B. Johnson) Date: Thu Nov 3 14:47:02 2005 Subject: documentation generators for Cocoa/Obj-C? In-Reply-To: <200108050027.AA12859@ocs.cz> Message-ID: <200108050138.SAA14748@pixar.pixar.com> So what do people use to generate nice doc from their source code? I'd like to use doxygen, because we use it as work and it generates the most sophisticated documentation I've ever seen, but unfortunately it doesn't understand Objective-C. Pointers? --> Michael B. Johnson, Ph.D. -- wave@pixar.com --> Studio Tools, Pixar Animation Studios --> http://xenia.media.mit.edu/~wave From embuck at earthlink.net Sat Aug 4 19:13:00 2001 From: embuck at earthlink.net (Erik M. Buck) Date: Thu Nov 3 14:47:02 2005 Subject: documentation generators for Cocoa/Obj-C? References: <200108050138.SAA14748@pixar.pixar.com> Message-ID: <005601c11d54$3863af80$18a5fc9e@bc7440b> > So what do people use to generate nice doc from their source code? I'd Autodoc http://softrak.stepwise.com/display?pkg=2163&os=20 From anarkhos at mac.com Sat Aug 4 21:45:41 2001 From: anarkhos at mac.com (strobe anarkhos) Date: Thu Nov 3 14:47:02 2005 Subject: Archiving Revisited In-Reply-To: <200108042034.NAA11040@omnigroup.com> References: <200108042034.NAA11040@omnigroup.com> Message-ID: At 2:35 PM -0600 8/4/01, Mike Vannorsdel wrote: >This topic was discussed quite some time back. I just wanted to check up on what's new now. > >I'm still looking for a solution to backup data on Mac OS X that preserves resource forks, posix permissions, and owner data. I also can't seem to locate hfstar which I'd like to try for this. What about the Retrospect beta? Does it preserve the posix permissions and owners as of yet? What else is there? Using CpMac or ditto to a disk image doesn't quite work since the owner is changed. There are only two things that work: a) device copy b) Synk in MacOS (not OS X) Synk would work in OS X if it were not for a bug in Carbon OS X which overrides the owner/group Synk wants a file to use. Instead it just sets the owner/group to whomever is running the process. From zak_ziggy at hotmail.com Sat Aug 4 21:47:16 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: Threads ? etc. Message-ID: From sanguish at digifix.com Sat Aug 4 22:02:15 2001 From: sanguish at digifix.com (Scott Anguish) Date: Thu Nov 3 14:47:02 2005 Subject: Archiving Revisited In-Reply-To: Message-ID: On Sunday, August 5, 2001, at 12:45 AM, strobe anarkhos wrote: > There are only two things that work: > > a) device copy > > b) Synk in MacOS (not OS X) > > Synk would work in OS X if it were not for a bug in Carbon OS X which > overrides the owner/group Synk wants a file to use. Instead it just > sets the owner/group to whomever is running the process. that's not a bug.. that's a security issue. You should not be able to change ownership on a file to a user you are not. unless you are root of course... what happens if you run it as root? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 633 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010804/c2acf471/attachment.bin From howard at quercus.demon.co.uk Sun Aug 5 01:30:48 2001 From: howard at quercus.demon.co.uk (Howard Oakley) Date: Thu Nov 3 14:47:02 2005 Subject: Archiving Revisited In-Reply-To: Message-ID: On 5/8/01 5:45, "strobe anarkhos" wrote: > At 2:35 PM -0600 8/4/01, Mike Vannorsdel wrote: >> I'm still looking for a solution to backup data on Mac OS X that preserves >> resource forks, posix permissions, and owner data. I also can't seem to >> locate hfstar which I'd like to try for this. What about the Retrospect >> beta? Does it preserve the posix permissions and owners as of yet? What >> else is there? Using CpMac or ditto to a disk image doesn't quite work since >> the owner is changed. > > There are only two things that work: > > a) device copy > > b) Synk in MacOS (not OS X) AFAIK hfspax does this just fine. If it does not, then no-one has reported the bug to me - currently the bug list is empty, and I am looking to release the first proper beta in the next week or two. hfspax is free from http://homepage.mac.com/howardoakley/ hfstar seems to be an old utility aimed at Darwin rather than OS X. Although the source is around (try the Darwin software sites), I have not found anyone who has got it to work under OS X release. I cannot speak for the Retrospect beta - it apparently requires the server to be installed (high cost), and is unsupported. However, I think some folk have got it to work without paying for the server. Howard. Dr Howard Oakley * M1BWR: QRV on 2, 4 & 6 m SSB EHN & DIJ Oakley * Internet howard@quercus.demon.co.uk Brooklands Lodge * CompuServe 70734,120 Park View Close * http://www.quercus.demon.co.uk Wroxall, Ventnor * voice +44 1983 853605 Isle of Wight, PO38 3EQ, UK * fax +44 1983 853253 From ocs at ocs.cz Sun Aug 5 05:10:11 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:02 2005 Subject: ObjC enhancements? (was: Major Bug in Cocoa (With sample Code!!)) In-Reply-To: References: Message-ID: <200108051212.AA13391@ocs.cz> Finlay, >>>>>> Finlay Dobbie (FD) wrote at Sun, 5 Aug 2001 11:57:52 +0100: FD> >- C++ like declarations "anywhere" (slightly improved over the C++ FD> >ones); FD> FD> You mean inline declarations? Sorry, but I am not that sure what "inline declaration" means. If it has anything to do with inline functions, then I don't mean them. FD> That's part of the C99 spec, so I guess FD> gcc3 implements it and Apple is working on that. I could be wrong, FD> though. Sorry I haven't expressed myself clearly: I meant the ability to declare variables whenever a statement can be (and not just at the beginning of a block). Of course, the _main_ reason is the ability to use for (int i=0;...); or, in Cocoa, rather for (NSEnumerator *en=[x objectEnumerator];...) ;) --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From zak_ziggy at hotmail.com Sun Aug 5 05:20:41 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: windows ? File's Owner and a miracle connection occurs Message-ID: I recall a confusing thing somebody had to tell me from a NeXT user group when I started developing with NIBs. It goes like this ... In a NIBs instances there is a thing (top left or first instance) called the File's Owner. What you do is set it to the other NIBs controller object in the inspector (command-1). Then you can have a connection from another controller instance (not the File's Owner) to the File's Owner instance, which will globally connect. It is kind of hard to explain and most people know it but do not have the time to tell you, but that wasn't too hard. If you need more explanation just ask. Is that going to help? Did ya know that already? From Zak p.S. Again it is like the two nib's controlllers are then connected through the file's owner of the second NIB. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From zak_ziggy at hotmail.com Sun Aug 5 05:36:30 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: Strobing Buttons ? some confusion Message-ID: In my last message I said "People do not have time to explain the FIle's Owner, to you". Sorry, I meant it is kind of confusion so it is instinctively avoided. I was not going to bother myself because it seemed like it might not be his problem either. I wanted to ask about getting a button to strobe (flash blue). I tried the methods setKeyCell: and become first Responder, but it did not seem to work can anybody explain. These new features should be in some kind of changes documentation or something somewhere. From Zak P.S. I noticed somebody respond about a documentation reference I asked, but I meant about the changes to ProjectBuilder. Maybe NSBundle explains the 'New Bundle' menu command in PB or something (I do not think so). So I still ask, (but know there probably is not and the NSBundle.html is as close as it gets), "Is there documentation about the newer features of ProjectBuilder?". _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From ocs at ocs.cz Sun Aug 5 13:32:16 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:02 2005 Subject: windows ? File's Owner and a miracle connection occurs In-Reply-To: References: Message-ID: <200108052034.AA13745@ocs.cz> Zak, >>>>>> Zak Ziggy (ZZ) wrote at Sun, 05 Aug 2001 05:20:08 -0700: ZZ> I recall a confusing thing somebody had to tell me from a NeXT user group ZZ> when I started developing with NIBs. It goes like this ... ZZ> In a NIBs instances there is a thing (top left or first instance) called ZZ> the File's Owner. What you do is set it to the other NIBs controller ZZ> object in the inspector (command-1). ZZ> Then you can have a connection from another controller instance (not the ZZ> File's Owner) to the File's Owner instance, which will globally connect. Ouch?!? I'm lost! ZZ> It is kind of hard to explain and most people know it but do not have the ZZ> time to tell you, but that wasn't too hard. If you need more explanation ZZ> just ask. I am asking -- for elucidation, at least. So far as I understand -- the thing is pretty simple: When NIB which contains N objects is loaded, the outlets/actions of precisely N+1 objects are resolved: of those loaded from NIB, plus exactly one more -- the NIB's owner (which must exist before NIB loading). In more details: - the File Owner _represents_ the object which is the owner of NIB (not part of it); - all its outlets are properly filled when NIB is loaded; - so as they can be specified, the IB needs to know its class, which is specified in the Cmd-1 (or Cmd-5 or so) inspector; - in code, it is specified as the owner: argument of the loadNibFile:owner: method (or in the dictionary of other methods); Or have I forgotten something? --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From zisa at swbell.net Sun Aug 5 15:27:50 2001 From: zisa at swbell.net (Clifton) Date: Thu Nov 3 14:47:02 2005 Subject: "Learning Cocoa" -Travel Advisor tutorial... In-Reply-To: <200108051925.MAA10179@lists.omnigroup.com> Message-ID: <0GHM00B1C8WU4Q@mta5.rcsntx.swbell.net> If you know what I am talking about in the subject line, read on... I implemented much of this program without any error reported by the compiler. Then, I get to the populateFields: method, which does not compile because of this line: [currencyRateField setFloatValue:[aRec currencyRate]]; I get an "incompatible type for argument 1 of 'setFloatValue:'" error. I have gone through the program. Everything looks correct. currencyRateField is an NSTextField, aRec is an object-value holder created by my "Country" class (object), and currencyRate is a float-value kept in the object. Here is the method which will not compile if the line, above, is in it. /******** START CODE *******/ - (void)populateFields:(Country *)aRec { [countryField setStringValue:[aRec name]]; [[logisticsForm cellAtIndex:LGAirports] setStringValue: [aRec airports]]; [[logisticsForm cellAtIndex:LGAirlines] setStringValue: [aRec airlines]]; [[logisticsForm cellAtIndex:LGTransportation] setStringValue: [aRec transportation]]; [[logisticsForm cellAtIndex:LGHotels] setStringValue: [aRec hotels]]; [currencyNameField setStringValue:[aRec currencyName]]; /***** this line never compiles for some reason... *****/ [currencyRateField setFloatValue:[aRec currencyRate]]; /********************************************************/ [languagesField setStringValue:[aRec languages]]; [englishSpokenSwitch setState:[aRec englishSpoken]]; [commentsLabel setStringValue:[NSString stringWithFormat: @"Notes and Itinerary for %@", [aRec name]]]; [commentsField setString:[aRec comments]]; [countryField selectText:self]; } /********************* END CODE **************/ Perhaps it is in my Country object implementation file? Here are the methods for currencyRate. Does this look right...? /***********************************/ - (float)currencyRate { return currencyRate; } - (void)setCurrencyRate:(float)val { currencyRate = val; } /**********************************/ Sorry, I know it's a lot of stuff to read, I just can't seem to find an explanation. Any help would be appreciated deeply... Clifton R. From dweebert at home.com Sun Aug 5 16:42:57 2001 From: dweebert at home.com (Graeme Hiebert) Date: Thu Nov 3 14:47:02 2005 Subject: "Learning Cocoa" -Travel Advisor tutorial... In-Reply-To: <0GHM00B1C8WU4Q@mta5.rcsntx.swbell.net> Message-ID: <200108052342.QAA15941@omnigroup.com> Is the type of aRec known by the compiler, or does it think it's an "id"? Unless the compiler knows aRec's type, and has included the corresponding header file, it cannot know what the return value of -currencyRate is. -g -- On Sunday, August 5, 2001, at 05:30 PM, Clifton wrote: > If you know what I am talking about in the subject line, read on... > > I implemented much of this program without any error reported by the > compiler. > > Then, I get to the populateFields: method, which does not compile > because of this line: > > [currencyRateField setFloatValue:[aRec currencyRate]]; > > I get an "incompatible type for argument 1 of 'setFloatValue:'" error. > I have gone through the program. Everything looks correct. > currencyRateField is an NSTextField, aRec is an object-value holder > created by my "Country" class (object), and currencyRate is a > float-value kept in the object. From pekeler at codefab.com Sun Aug 5 16:46:46 2001 From: pekeler at codefab.com (Christian Pekeler) Date: Thu Nov 3 14:47:02 2005 Subject: documentation generators for Cocoa/Obj-C? In-Reply-To: <200108050138.SAA14748@pixar.pixar.com> Message-ID: <200108052346.f75NkVT36119@pi.codefab.com> > So what do people use to generate nice doc from their source code? Try writing unit tests instead of documenting the source. Unit tests don't even help you to deliver bug freer code, they also act as documentation by example, showing features, limits and pre-/postconditions. I wish Apple would unit test their frameworks and make the tests available. something like @implementation NSString (Test) - (void)testIntValue { NSAssert([@"" intValue] == 0, @"default"); NSAssert([@"xyz123" intValue] == 0, @"default"); NSAssert([@" \t\n\r123" intValue] == 123, @"ignore leading whitespace"); NSAssert([@"999" intValue] == 999, @"max"); NSAssert([@"1000" intValue] == INT_MAX, @"overflow"); NSAssert([@"-999" intValue] == -999, @"min"); NSAssert([@"-1000" intValue] == INT_MIN, @"overflow"); } instead of - (int)intValue Returns the integer value of the receiver's text, assuming a decimal representation and skipping whitespace at the beginning of the string. Returns INT_MAX or INT_MIN on overflow. Returns 0 if the receiver doesn't begin with a valid decimal text representation of a number. Christian From zisa at swbell.net Sun Aug 5 17:14:51 2001 From: zisa at swbell.net (Clifton) Date: Thu Nov 3 14:47:02 2005 Subject: "Learning Cocoa" -Travel Advisor tutorial... In-Reply-To: <0GHM00L5WCO3OA@mta2.rcsntx.swbell.net> Message-ID: <0GHM007HWE0FG4@mta8.rcsntx.swbell.net> aRec is whatever Country Object is passed into it (it's declared in the method line, so it recieves an object) /*****/ - (void)populateFields:(Country *)aRec { ... } /*****/ I dont know why, it accepts the other variables. Clifton > Is the type of aRec known by the compiler, or does it think it's an > "id"? > > Unless the compiler knows aRec's type, and has included the > corresponding header file, it cannot know what the return value of > -currencyRate is. > > -g > -- > On Sunday, August 5, 2001, at 05:30 PM, Clifton wrote: > >> If you know what I am talking about in the subject line, read on... >> >> I implemented much of this program without any error reported by the >> compiler. >> >> Then, I get to the populateFields: method, which does not compile >> because of this line: >> >> [currencyRateField setFloatValue:[aRec currencyRate]]; >> >> I get an "incompatible type for argument 1 of 'setFloatValue:'" error. >> I have gone through the program. Everything looks correct. >> currencyRateField is an NSTextField, aRec is an object-value holder >> created by my "Country" class (object), and currencyRate is a >> float-value kept in the object. > From rainer at brockerhoff.net Sun Aug 5 18:40:36 2001 From: rainer at brockerhoff.net (Rainer Brockerhoff) Date: Thu Nov 3 14:47:02 2005 Subject: How to get volume format? Message-ID: Hi folks, I was calling NSWorkspace's getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description:type: method in the hope of getting information about a given volume. The BOOL flags return OK (although I wasn't able to deduce the difference between isRemovable and isUnmountable), but the description and type NSStrings always return set to nil. The docs say they would contain information like "HFS", "UFS" and so forth... but I tried several different types of volumes, they always return nil. The call is returning YES, so the strings should be valid... Well, failing that, I decided to use the information returned from FSGetVolumeInfo (some of which I needed anyway), namely filesystemID and signature in FSVolumeInfo. (I realize this is slightly off-topic here on a Cocoa list... apologies. Reply privately, if necessary) I've succeeded, through trial and error, to get these values as returned for most common volume types. Does anyone have a compreensive list? Just FYI, I have: filesystemID signature format 0 'BD' HFS 0 'H+' HFS+ 0 0xD2D7 MFS 0 'AG' ISO 9960 0 'BB' High Sierra 'cu' 'JH' Audio CD 0x55DF 0x75DF DVD-ROM 'as' any above formats over AppleShare 'IS' 'BD' MS-DOS TIA, -- Rainer Brockerhoff Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." http://www.brockerhoff.net/ (updated July 2000) From demarco at apple.com Sun Aug 5 18:49:40 2001 From: demarco at apple.com (Vince DeMarco) Date: Thu Nov 3 14:47:02 2005 Subject: How to get volume format? In-Reply-To: Message-ID: <47B2B158-8A0D-11D5-905D-0003930FDF98@> On Sunday, August 5, 2001, at 06:40 PM, Rainer Brockerhoff wrote: > Hi folks, > > I was calling NSWorkspace's > getFileSystemInfoForPath:isRemovable:isWritable:isUnmountable:description: > type: method in the hope of getting information about a given volume. > > The BOOL flags return OK (although I wasn't able to deduce the difference > between isRemovable and isUnmountable), but the description and type > NSStrings always return set to nil. > > The docs say they would contain information like "HFS", "UFS" and so > forth... but I tried several different types of volumes, they always > return nil. The call is returning YES, so the strings should be valid... > > Well, failing that, I decided to use the information returned from > FSGetVolumeInfo (some of which I needed anyway), namely filesystemID and > signature in FSVolumeInfo. (I realize this is slightly off-topic here on > a Cocoa list... apologies. Reply privately, if necessary) > > I've succeeded, through trial and error, to get these values as returned > for most common volume types. Does anyone have a compreensive list? Just > FYI, I have: > filesystemID signature format > 0 'BD' HFS > 0 'H+' HFS+ > 0 0xD2D7 MFS > 0 'AG' ISO 9960 > 0 'BB' High Sierra > 'cu' 'JH' Audio CD > 0x55DF 0x75DF DVD-ROM > 'as' any above formats over AppleShare > 'IS' 'BD' MS-DOS > > TIA, > > Failing that you could just call statfs() then look at the contents of the f_fstypename item in the statfs structure if you want the filesystem ID you can get that via the f_fsid item in the statfs structure. the code looks like this char path[1024]; struct statfs stat_struct; if (statfs(path,&stat_struct) < 0){ printf("got error %s\n",strerror(errno)); } printf("file system at %s is a %s type its fsid is %d\n", path, stat_struct.f_fstypename,stat_struct.f_fsid); vince From am at yline.com Sun Aug 5 19:01:34 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:02 2005 Subject: How to get volume format? In-Reply-To: Message-ID: <200108060202.EAA01182@am.homeip.net> On Monday, August 6, 2001, at 03:40 , Rainer Brockerhoff wrote: > The BOOL flags return OK (although I wasn't able to deduce the difference > between isRemovable and isUnmountable), but the description and type > NSStrings always return set to nil. My boot disk is neither removeable nor unmountable. My ZIPs are removeable and unmountable. My Firewire disk is not removeable but unmountable. Maybe "removeable" should read "ejectable". andy -- Discussion forthcoming. From zak_ziggy at hotmail.com Sun Aug 5 21:14:35 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: windows ? File's Owner and a miracle connection occurs Message-ID: You have included more detail, I think you get it now. So if your second NIB's file's owner is set to the Class type of the main NIB, connections can be established in various ways. If you did not understand this before, now you basically do. Has it helped with your problem? I think you would need to have the awakeFromNib method tell the Owner to register itself with an array of loaded windows or document NIB's. Again I believe the TextEdit App example source code should demonstrate this fully, once you know what to look for. From Zak P.S. NIB means NeXT Interface Builder not the liquorish kind. If you have more questions? I can even try to take a look at a some stripped down example source code. Unless it is in a language other than English, that might be a little confusing for me. If it is big and downloadable somewhere that might be easier. Also sending to the group may not be required anymore (or desired in the case of Source Code), you should address me only then. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From zak_ziggy at hotmail.com Sun Aug 5 21:28:35 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: windows ? File's Owner and a miracle connection occurs Message-ID: I got kubernan@10191.com confused with ocs@ocs.cz, sorry. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From zak_ziggy at hotmail.com Sun Aug 5 22:38:58 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: Apache POST problems, serious PROBLEMS Message-ID: >Date: Sat, 4 Aug 2001 22:02:14 -0700 >From: JF To: macos-x-server@lists.apple.com >Subject: Apache POST problems >i was curious to see whether anybody out there had resolved the Apache >POST CGI issues that had been plaguing a few poor souls out there. i >have a couple of servers that I cannot get to the cgi's to work properly >because of this problem. any info would be greatly appreciated.> >- jf I can explain I bit about this to you JF, and I think since I am equally pissed, I will explain it to the groups and Apple too. By no means does this message represent JF's beliefs but I think it is at the heart of all our problems. Apple knows that threading is needing work badly, but they say no time before next release (I'm moving), and pushing these bugs to future releases (can't bother now). Mean while Apple is scrambling to fix their own search tools, bugreporter, etc. Which are probably plagued with these intermittent threading problems. To me the problems are in NSThreads and NSConnections (and the combination there of), but certain bugs reported go deeper into the problem, in (I think) the pthreads and forks, or child processes etc. or NeXT, sorry they were perfect, I mean Apple, functions like mach_msg_overwrite_trap, __CFRunLoopRun, RunEventLoopInModeUntilEventArrives, malloc_zone_malloc, obj_msgSend, CFSetGetValue, syscall, sigProcMask, abort, the NSMachPort class, and not even God knows what else is not to the OpenStep spec. I have even seen [NSConnection member:] and [NSPortMessage member:] errors that say "Selector Not Recognized"(it is for NSSet only) so one can assume NSSet is buggy too. The list goes on I am dead in the water until these problems are addressed and they clearly are saying few really care at this point, maybe later. (Eat cake [WebObjects] for now) That is bullshit, as soon as the system bugreporter is rebuilt and the few more minor easier to fix problems I have reported are address at all, I will be making yet another bugreport that describes this in detail (and references the other related bug). This problems are also tangled into ProjectBuilder and cause program crashes and kernel panics. (The Panics are Damaging this HFS File System. Although it does recover from the Crashes faster (then UFS), it is not server quality. I fear that the crashes are causing damage and there is not a way, that comes with OSX without OS9.x, to check the level of deframentation at this point. (Adding the destroy only later Trash, seems to help fragment also.) Further it all requires testing in a way that I admit is fairly extreme, and that is Apache 1.3.20 child processes calling, cgi-bin processes, that uses dual NSThreaded NSConnections to establish true multithreaded multiuser connections to an NSApplication (or tool, basically Cocoa NSConnections). Even if I could fix or rebuild these things (which is doubtful) I would have to change a decades worth of code to a way not of the spec. This is financially not possible either so, I am dead in the water until OS X (Server) is restored to it's former OpenStep specifications and glory. Many companies will fold waiting for this to be fixed (four years just to release the unusable Beta), it is extremely serious and upsetting. Most really well built programs are multithreaded and it is likely they will not be released until this is addressed and fix, tested to the level required, and released. A significant number of developers/companies these days, (although it is complicated) require a multithreaded Apache->child -> cgi-bin -> NSConnections -> Cocoa App level of system design just to be competitive. Clearly at this point Apple just wants Old-Mac Code to run for the average user, which is a big mistake, because the benefits that OpenStep was bringing to a wired (multithreaded world) and otherwise dead OperatingSystem(9) has not been realized. I did not buy OS X (Server) to run OldMac Code or anything OS9(Classic). I hope you can understand my anger and situation, I beg of you Apple please fix threading now, and fully test it in the way that I have explained. So, JF and everybody else, there is little you can do accept wait or find another solution. OSX-1.2 and OpenStep 4.2 all work perfectly, without any problems. It is likely you will not be using or releasing good apps, or intelligent web sites, developed with or distributed by Apple hardware with OSX software. (Until it is out of date, like already especially those that bought before the release.) I imagine the problem will actually be in the hardware and all of this time and money has been wasted lying to everybody, because Apple have (and will) not address the most important issues, threading. Mad As Hell Zak (Stretching on the rack, for being caught using OpenStep.) P.S. I dare you to prove this is a viable solution, fix this now not later when you fell like you might have time. Thanks and sorry for the rage that Apple/OSX has caused me to have to share with you. It is/was a good system/idea, in theory anyway. It is a disgrace to all of use for even one person to have to say even once (for even only a month) I would be better off with windowz. I have lost a decades work including 4 years of waiting for OSX, and it is like it will take 4 more (+3 to go). Pleas add to the complaints at Apple about this issue, until it is fix and distributed. Will all my software say you need the latest upgrade OSX that ships is unuseable, will you try to put the upgrades on to a disk? Nobody will ever have an OSX disk that works properly ! _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From jmcintyre at dfsoftware.com Sun Aug 5 22:44:08 2001 From: jmcintyre at dfsoftware.com (Jared McIntyre) Date: Thu Nov 3 14:47:02 2005 Subject: Looking for Network and Bundle examples Message-ID: I'm in the process of prepping a technology preview for a port of our game server monitoring tool and I am trying to hunt down some simple example code for two basic areas: 1) I can't seem to find any networking information at all on Apple's site that pertains to Cocoa. Do you have to use BSD Sockets? Also, does anyone know where I can download documentation on Onmi's networking frameworks? 2) I think I have a decent handle on how bundles can be used as plugins, but I was hoping for some simple project that I could peruse through just to make myself completely comfortable with what I plan to do (don't want to hop down the wrong path too early). Everything else looks to go really smoothly. These are the last two ares I need to research before I start the proof-of-concept. Thanks for the help, -- Jared McIntyre Deep Fried Software Deep Fried LLC Owner/Engineer http://www.dfsoftware.com jmcintyre@dfsoftware.com From zak_ziggy at hotmail.com Sun Aug 5 23:15:59 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:02 2005 Subject: Terminal trick + DockIcon . View control? Message-ID: I noticed that when an action is waiting to be processed, updating of the Dock Icon's NSImage does not display until after the action is completed. [This is where I send to macosx-dev@omnigroup.com also] The method I was using is [NSApp setApplicationIconImage:(NSImage *)dockImage]. Is there a way to achieve [NSApp setApplicationDockView:(NSView *)dockView]; There should be. Possible is there a way to tell the Dock to update in an NSTimer triggered call, while the Application function is locked out. Since threading is broken and I do not want to disable all function during the action personally I was hoping that there was a way (to ultimately have the Dock icon animate when a process is busy). Maybe this was over looked in the changes. Somebody suggested the iDisk App can have controls in it's Dock Icon. Does anybody know how that is done? In OpenStep the Dock Icon was a Window with a View in the NSApp's -windows Array. Now it is in a Dock App and totally different, I assumed it no longer had the power and ability it once had it the past (OpenStep). Is there really still a public way to get access to the View object in the Dock? I would try sending it an NSTimer triggered display message during the long button action (or menu), to show the Application is busy processing. From Zak _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From ocs at ocs.cz Sun Aug 5 23:37:01 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:02 2005 Subject: "Learning Cocoa" -Travel Advisor tutorial... In-Reply-To: <200108052342.QAA15941@omnigroup.com> References: <200108052342.QAA15941@omnigroup.com> Message-ID: <200108060637.AA14147@ocs.cz> Graeme, >>>>>> Graeme Hiebert (GH) wrote at Sun, 5 Aug 2001 16:42:51 -0700: GH> Is the type of aRec known by the compiler, or does it think it's an "id"? GH> GH> Unless the compiler knows aRec's type, and has included the GH> corresponding header file, it cannot know what the return value of GH> -currencyRate is. Not really. The compiler either knows aRec is SomeClass and then checks all the SomeClass methods, or, it takes aRec as id, and then checks *all* known methods. If there is none or more of the same name, warning is issued; if there's just one of the given name, it's used. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From raphael_sebbe at mac.com Mon Aug 6 03:21:59 2001 From: raphael_sebbe at mac.com (Raphael Sebbe) Date: Thu Nov 3 14:47:02 2005 Subject: looking for faster sqrt Message-ID: <200108061021.DAA06903@smtpout.mac.com> Hi all, I just found a paper from Omni about game-dev where it is said to use frsqrte for faster square root computation. I sampled my code and sqrt is taking more than 25 % of CPU time for specific task. But how can it be used ? Anyone could give a small example code showing how to embed PPC assembly in C code ? And about precision ? How does it compare to sqrt() ? Thanks in advance, Raphael From kubernan at 10191.com Mon Aug 6 03:30:48 2001 From: kubernan at 10191.com (kubernan) Date: Thu Nov 3 14:47:02 2005 Subject: My instances jump window Message-ID: <200108061030.DAA03521@omnigroup.com> Hello, From my main window i can launch same other window multiple times. But doing this, the new window "stole" all instances from previous window. Look : WindowX launched --> buttonX ---> FieldX When i click buttonX FieldX is filled with some strings Then, WindowX' launched (previous WindowX still alive) --> buttonX' --> FieldX' When i click buttonX (first window), the FieldX' (second window) is filled instead of FieldX !!! With only one WindowX loaded, all works well. WindowX is linked in IB to MyWinControl (subclass of NSObject). What's happening ? Kub. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 16 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/20899e68/attachment.bin From ocs at ocs.cz Mon Aug 6 04:08:48 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:02 2005 Subject: My instances jump window In-Reply-To: <200108061030.DAA03521@omnigroup.com> References: <200108061030.DAA03521@omnigroup.com> Message-ID: <200108061111.AA14351@ocs.cz> kubernan, >>>>>> kubernan (k) wrote at Mon, 6 Aug 2001 12:31:50 +0200: k> >From my main window i can launch same other window multiple times. k> But doing this, the new window "stole" all instances from previous window. I guess you "launch a new window" by loading the NIB again, don't you? If so, then of course the outlets are "stolen" by the new one. Whenever you load a NIB, the outlets are filled appropriately. If you load a NIB moree than once with the same owner, of course the outlets contain the last values. Generally the best solution is to have a specific controller instance for each window, ie. somthing like id ctrl=[WinCtrl new]; [NSBundle loadNibNamed:... owner:ctrl] (of course, it'd be better to load the NIB from a -[WinCtrl init], and it'd be best to use the NSWindowController, which is specifically designed for such things) If it happens not to be appropriate for asome project (ie. you do need to load NIB more than once with the same owner), you just have to store the old values, something like NSMutableDictionary *winButtons...; IBOutlet NSButton *button; // bound in NIB [NSBundle loadNibNamed:... owner:self]; [winButtons setObject:button forKey:[[button window] title]]; --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From am at yline.com Mon Aug 6 04:39:57 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:02 2005 Subject: Looking for Network and Bundle examples In-Reply-To: Message-ID: <200108061140.NAA00374@am.homeip.net> On Monday, August 6, 2001, at 07:44 , Jared McIntyre wrote: > 1) I can't seem to find any networking information at all on Apple's site > that pertains to Cocoa. Do you have to use BSD Sockets? Not necessarily, but the only networking API available is DO. Here's an explanation of sockets: http://www.netppl.fi/~pp/glibc21/libc_16.html There's a class for simple networking (a sockets-wrapper): http://smallsockets.sourceforge.net > Also, does anyone know where I can download documentation on Onmi's > networking frameworks? Erm... Documentation? What's that? > 2) I think I have a decent handle on how bundles can be used as plugins, > but I was hoping for some simple project that I could peruse through just > to make myself completely comfortable with what I plan to do (don't want > to hop down the wrong path too early). Write some test projects, that's always the best way to know if it works like expected. andy -- Discussion forthcoming. From john at toastedmarshmallow.com Mon Aug 6 04:40:10 2001 From: john at toastedmarshmallow.com (=?iso-8859-1?Q?John_H=F6rnkvist?=) Date: Thu Nov 3 14:47:02 2005 Subject: looking for faster sqrt In-Reply-To: <200108061021.DAA06903@smtpout.mac.com> Message-ID: <20010806113933.636F911C015@fimail01.cabinet.net> On Monday, August 6, 2001, at 12:25 PM, Raphael Sebbe wrote: > Hi all, > > I just found a paper from Omni about game-dev where it is said to use > frsqrte for faster square root computation. I sampled my code and sqrt > is taking more than 25 % of CPU time for specific task. But how can it > be used ? Anyone could give a small example code showing how to embed > PPC assembly in C code ? Here is an example of using embedded assemly: main() { unsigned long long place=0; unsigned long long _data_=0xFFFFFFFFFFFFFFFF-1; asm volatile( "mr r3,%1\n" "lfd f0,0(r3)\n" "mr r3,%0;\n" "stfd f0,0(r3)\n" "eieio\n" : //No output : /* %0 */ "r" (&place), /* %1 */ "r" (&_data_) : "r3", "f0", "memory" ); printf("%x%x\n",place); printf("%x%x\n",_data_); } I think there may be some in the GCC manual, too. > And about precision ? How does it compare to sqrt() ? I suggest you look at the PPC instruction set manuals from Motorola. Regards, John Hornkvist -- ToastedMarshmallow, the perfect Cocoa companion http://www.toastedmarshmallow.com From mmark at fivespeed.com Mon Aug 6 04:40:36 2001 From: mmark at fivespeed.com (Mason Mark) Date: Thu Nov 3 14:47:02 2005 Subject: My instances jump window In-Reply-To: <200108061030.DAA03521@omnigroup.com> References: <200108061030.DAA03521@omnigroup.com> Message-ID: <1103857.997072728@adsl-64-169-39-229.dsl.snfc21.pacbell.net> How are you loading the windows? It sounds like you have a single object (controller) loading the different nibs. In that case, things happen something like this: 1) when you load the nib for window 1, your controller's buttonX and fieldX instance variables are set to buttonX and fieldX of window 1 2) when you load the nib for window 2, your same controller object is having its buttonX and fieldX instance variables set to buttonX and fieldX of window 2, which just replaces their former value. buttonX in window 1 still works, because its target is still set to point to your controller object, to whom it sends its action message when clicked. But your controller object's fieldX instance variable now points to fieldX in the second window, so that is why that field gets updated. What you probably want to do is have a separate controller for each window. Depending on your needs, you could just add the class to your nib and use "Instantiate" command in IB, which will create a new one automatically when the nib is loaded. -- Mason --On Monday, August 6, 2001 12:31 PM +0200 kubernan wrote: > Hello, > >> From my main window i can launch same other window multiple times. > But doing this, the new window "stole" all instances from previous window. > > Look : > > WindowX launched > --> buttonX > ---> FieldX > When i click buttonX FieldX is filled with some strings > > Then, > > WindowX' launched (previous WindowX still alive) > --> buttonX' > --> FieldX' > > When i click buttonX (first window), the FieldX' (second window) is > filled instead of FieldX !!! With only one WindowX loaded, all works well. > > WindowX is linked in IB to MyWinControl (subclass of NSObject). > What's happening ? > > Kub. > From mmark at fivespeed.com Mon Aug 6 04:43:22 2001 From: mmark at fivespeed.com (Mason Mark) Date: Thu Nov 3 14:47:02 2005 Subject: Looking for Network and Bundle examples In-Reply-To: References: Message-ID: <1119942.997072996@adsl-64-169-39-229.dsl.snfc21.pacbell.net> --On Sunday, August 5, 2001 11:44 PM -0600 Jared McIntyre wrote: > I'm in the process of prepping a technology preview for a port of our > game server monitoring tool and I am trying to hunt down some simple > example code for two basic areas: > > 1) I can't seem to find any networking information at all on Apple's > site that pertains to Cocoa. Do you have to use BSD Sockets? Also, > does anyone know where I can download documentation on Onmi's > networking frameworks? You might also want to check out SmallSockets (http://smallsockets.sourceforge.net/), which is a lighter weight Obj C interface to BSD sockets than the OmniNetworking stuff. (We use OmniNetworking and have been very pleased with it, but I don't think there is any documentation...you just have to read through the code.) -- Mason From snoyes at execpc.com Mon Aug 6 05:35:57 2001 From: snoyes at execpc.com (snoyes@execpc.com) Date: Thu Nov 3 14:47:02 2005 Subject: windowDeviceRound: error In-Reply-To: <200107281628.SAA27484@post.webmailer.de> Message-ID: <200108061234.f76CY6S94096@pop0.nwbl.wi.voyager.net> I have received this when I am trying to draw a Bezier path that contains 100's of paths. I have found that if, instead, I break it up into several smaller paths (about 100-150 or so) I can avoid this error. Steven Noyes On Saturday, July 28, 2001, at 09:29 AM, Markus Hitter wrote: > > Am Samstag, 28. Juli 2001 um 03:27 schrieb Richard Whittaker: > >> Hello, >> >> I am try to open a file that my app saved and I get this error. >> >> windowDeviceRound: error creating graphics ctxt object for ctxt:42243, >> window:-1 > > ^^^^^^^^^^ > You try to draw into a non-existing window? > > There's a similar warning message which appears randomly and can be > ignored safely. > >> WHAT DOES THIS MEAN? in english.......... > > windowDeviceRound = sort of event loop for output into graphical > windows (?) > ctxt = context > > The other words should appear in your favourite english dictionary ;-) > > > Cheers, > Markus > - - - - - - - - - - - - - - - - - - - > Dipl. Ing. Markus Hitter > http://www.jump-ing.de/ > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From jgrosjean at gooeyball.com Mon Aug 6 05:50:53 2001 From: jgrosjean at gooeyball.com (Jesse Grosjean) Date: Thu Nov 3 14:47:02 2005 Subject: Debugging "Save - Coun't save document" In-Reply-To: <200108061054.DAA24231@lists.omnigroup.com> Message-ID: <200108061236.MAA39080721@smtp5ve.mailsrvcs.net> I have a document based app that occasionally gives the error message: "Save Couldn't save document" when trying to save a document. This happens when I open a document from my running application, and then try to save that document with the "save" command. I can do "Save as" and everything works. I can create a new document and "save" that repeatedly. Unfortunately i'm not really sure where to go to fix this problem and am wondering if anyone has ideas on where i should look. The one thing that i've noticed is when i put a breakpoint in saveDocument: and po the _savePanelSaveType the value is for my documents that wont save, but the value is set to my document type for documents that will save. So i'm suspicious about this, i just don't know what i could have done to mess it up. And even for my documents the wont save their _fileType and _fileName are correct. Thanks for any help, Jesse From ssudre at intego.com Mon Aug 6 06:06:38 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:02 2005 Subject: String Encoding Format in .plist and in .strings file Message-ID: <1215019304-27155815@transeo.com> What's the string encoding format (for a object of course) in a .plist file created with the PropertyList Editor ? MacRoman ? Unicode ? I'm also wondering about the format in the .strings file. Looking at the French localization of OmniWeb, it seems that you can't have "d?dale" in a .strings file. You need to use "d\U00E9dale". This strongly looks like some Unicode stuff. But is there a .strings Unicode editor provided somewhere ? From epeyton at epicware.com Mon Aug 6 06:15:59 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:02 2005 Subject: Terminal trick + DockIcon . View control? In-Reply-To: Message-ID: <2A770745-8A6D-11D5-96E1-003065CBD1E2@apple.com> On Monday, August 6, 2001, at 01:15 AM, Zak Ziggy wrote: > I noticed that when an action is waiting to be processed, updating > of the Dock Icon's NSImage does not display until after the action > is completed. That completely depends on how your code is structured. > [This is where I send to macosx-dev@omnigroup.com also] > The method I was using is [NSApp setApplicationIconImage:(NSImage > *)dockImage]. Is there a way to achieve [NSApp > setApplicationDockView:(NSView *)dockView]; There should be. There is no api or spi like this in cocoa at this time. > Possible is there a way to tell the Dock to update in an NSTimer > triggered call, while the Application function is locked out. Sure, I do it all the time. Why isn't it working for you? > Since threading is broken and I do not want to disable all > function during the action personally I was hoping that there was > a way (to ultimately have the Dock icon animate when a process is > busy). How is threading broken? Throwing a statement like that on to a development list with no history helps no-one. > Maybe this was over looked in the changes. > Somebody suggested the iDisk App can have controls in it's Dock Icon. > Does anybody know how that is done? In OpenStep the Dock Icon was > a Window with a View in the NSApp's -windows Array. Now it is in a > Dock App and totally different, I assumed it no longer had the > power and ability it once had it the past (OpenStep). That is absolutely true. In Nextstep the dock window itself was truly owned by the application running on the dock. Now the dock window is owned by the dock itself. This has negative and positive connotations, but one of the negative ones is far less control by the controlling application. There is no api for you to do things like have a button in the dock icon that can be "pressed". There is no concept of the mouseDown at x,y location ... > Is there really still a public way to get access to the View > object in the Dock? No. > I would try sending it an NSTimer triggered display message > during the long button action (or menu), to show the Application > is busy processing. Yes, that can be done pretty easily. Eric > > From Zak > > > _________________________________________________________________ > Get your FREE download of MSN Explorer at > http://explorer.msn.com/intl.asp > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2750 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/329a1b9b/attachment.bin From marcel at metaobject.com Mon Aug 6 06:18:17 2001 From: marcel at metaobject.com (Marcel Weiher) Date: Thu Nov 3 14:47:02 2005 Subject: looking for faster sqrt In-Reply-To: <200108061021.DAA06903@smtpout.mac.com> Message-ID: On Monday, August 6, 2001, at 12:25 Uhr, Raphael Sebbe wrote: > I just found a paper from Omni about game-dev where it is said to use > frsqrte for faster square root computation. I sampled my code and sqrt > is taking more than 25 % of CPU time for specific task. But how can it > be used ? Anyone could give a small example code showing how to embed > PPC assembly in C code ? This code is adapated from some that floated on the list a while back: static inline double frsqrtd(double x) { double y0, y1, t0, t1, half = 0.5, one = 1.0; asm volatile("frsqrte %0,%1" : "=f" (y0) : "f" (x)); // Do y1 = y0 + 0.5*y0*(1-x*y0*y0) asm volatile("fmul %0,%1,%2" : "=f" (t0) : "f" (y0), "f" (y0)); asm volatile("fmul %0,%1,%2" : "=f" (t1) : "f" (y0), "f" (half)); asm volatile("fnmsub %0,%1,%2,%3" : "=f" (t0) : "f" (x), "f" (t0), "f" (one)); asm volatile("fmadd %0,%1,%2,%3" : "=f" (y1) : "f" (t0), "f" (t1), "f" (y0)); y0 = y1; // Refine it a 2nd time... asm volatile("fmul %0,%1,%2" : "=f" (t0) : "f" (y0), "f" (y0)); asm volatile("fmul %0,%1,%2" : "=f" (t1) : "f" (y0), "f" (half)); asm volatile("fnmsub %0,%1,%2,%3" : "=f" (t0) : "f" (x), "f" (t0), "f" (one)); asm volatile("fmadd %0,%1,%2,%3" : "=f" (y1) : "f" (t0), "f" (t1), "f" (y0)); y0 = y1; // And a 3rd... asm volatile("fmul %0,%1,%2" : "=f" (t0) : "f" (y0), "f" (y0)); asm volatile("fmul %0,%1,%2" : "=f" (t1) : "f" (y0), "f" (half)); asm volatile("fnmsub %0,%1,%2,%3" : "=f" (t0) : "f" (x), "f" (t0), "f" (one)); asm volatile("fmadd %0,%1,%2,%3" : "=f" (y1) : "f" (t0), "f" (t1), "f" (y0)); y0 = y1; // And a fourth... asm volatile("fmul %0,%1,%2" : "=f" (t0) : "f" (y0), "f" (y0)); asm volatile("fmul %0,%1,%2" : "=f" (t1) : "f" (y0), "f" (half)); asm volatile("fnmsub %0,%1,%2,%3" : "=f" (t0) : "f" (x), "f" (t0), "f" (one)); asm volatile("fmadd %0,%1,%2,%3" : "=f" (y1) : "f" (t0), "f" (t1), "f" (y0)); y0 = y1; return y0; } static inline double fsqrtd(double x) { return frsqrtd(x)*x; } > And about precision ? How does it compare to sqrt() ? Precision can be controlled by how often you do the iteration. -- Marcel Weiher marcel@metaobject.com HOM: From am at yline.com Mon Aug 6 06:30:33 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:02 2005 Subject: String Encoding Format in .plist and in .strings file In-Reply-To: <1215019304-27155815@transeo.com> Message-ID: <200108061331.PAA00465@am.homeip.net> On Monday, August 6, 2001, at 03:06 , St?phane Sudre wrote: > What's the string encoding format (for a object of > course) in a .plist file created with the PropertyList Editor ? > > MacRoman ? Unicode ? > > I'm also wondering about the format in the .strings file. Looking at the > French localization of OmniWeb, it seems that you can't have "d?dale" in > a .strings file. You need to use "d\U00E9dale". > > This strongly looks like some Unicode stuff. But is there a .strings > Unicode editor provided somewhere ? I'm successfully using UTF8 (found out by trial-and-error). You can set the encoding in Project Builder using Format -> File Encodings. andy -- "He was addicted to life. But we cured him" From infisys at po.jaring.my Mon Aug 6 06:36:33 2001 From: infisys at po.jaring.my (K.K.Chan) Date: Thu Nov 3 14:47:02 2005 Subject: Modal problem Message-ID: <200108061329.f76DTrA01744@smtp8.jaring.my> I am getting exception and program sudden quit. I think have to do with the code related with modal window. However, it does not always crash. Below is the 2 methods which cause the problem and a crash log. Is it safe to have nested modal windows under Cocoa ? K.K.Chan // ++++++++ Caller "FileSelController" - (IBAction)renameFile:(id)sender { id win; if (![NSBundle loadNibNamed:@"OneEditPanel" owner:self]) return; [externalCtrl initOwnData]; win = [externalCtrl window]; [NSApp runModalForWindow:win]; [externalCtrl release]; externalCtrl = nil; } // --------- OneEditPanel window - (IBAction)saveButton:(id)sender { // do whatever.... blah blah [[self window] close]; [NSApp stopModal]; } Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_INVALID_ADDRESS (0x0001) at 0x39350000 Thread 0: #0 0x7081ab98 in _objc_msgSend () #1 0x70f6ff58 in _runModalCleanup () #2 0x70e21954 in -[NSApplication endModalSession:] #3 0x70e21cfc in -[NSApplication runModalForWindow:] #4 0x000112fc in _OneEditPanel () #5 0x000082ec in -[FileSelController renameFile:] #6 0x709810bc in -[NSObject performSelector:withObject:] #7 0x70d94908 in -[NSApplication sendAction:to:from:] #8 0x70d94860 in -[NSControl sendAction:to:] #9 0x70d94810 in -[NSCell _sendActionFrom:] #10 0x70d943f8 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:] #11 0x70d93e3c in -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] #12 0x70d95bc0 in -[NSControl mouseDown:] #13 0x70d85600 in -[NSWindow sendEvent:] #14 0x70d78d50 in -[NSApplication sendEvent:] #15 0x70d7548c in -[NSApplication run] #16 0x70d9799c in _NSApplicationMain () #17 0x00012ce4 in _main () #18 0x00002bfc in __start () #19 0x00002a3c in start () From rcerny at dataline.cz Mon Aug 6 07:26:35 2001 From: rcerny at dataline.cz (Robert Cerny) Date: Thu Nov 3 14:47:02 2005 Subject: NSFileHandle Message-ID: <200108061428.f76ESPA17040@linux.dataline.cz> Hi, I would like to use NSFileHandle methods to partially read a big file. The problem is that I don't know how to obtain file's length. I expected that [fileHandle readDataOfLength] will return data of actual length , it means only valid data. When the file will be not long enough (pointer is on the end of file), than return only valid data of smaller length. According to my application, it returns some kind of garbage... I thought I will use something like [fileHandle length] but such a function doesn't exists. Any ideas? Thanks Robert From rhind at orange.net Mon Aug 6 07:35:11 2001 From: rhind at orange.net (Russell Hind) Date: Thu Nov 3 14:47:02 2005 Subject: Gathering information running processes Message-ID: <016a01c11e84$a4f9b870$971410ac@MARYLEBONE> Firstly, which API section should I look at for getting information about running applications (that have an icon displayed in the dock)? Secondly, I also want a list of running processes, basically the same as 'top' so I can write a replacement for Apple's process viewer. I have a copy of the code for 'top' but when calling host_processor_sets I get an 'invalid argument' error (mach_error_t type 4). The port I am passing in is correct (I have tried this by passing in a null port and getting an 'invalid destination port' error). The other two parameters are exactly the same as the 'top' code but the call fails (I haven't got the code with me but I think it is something like this) processor_set_name_array_t psets; unsigned int pcount; host_processor_set(mach_port_self(), &psets, &pcount); All this code is lifted from 'top' but this call fails. Can anybody help. Is there documentation on the 'host_' and other 'mach' related calls anyway? Thanks Russell From jba at bullex.de Mon Aug 6 07:35:40 2001 From: jba at bullex.de (Jens Baumeister) Date: Thu Nov 3 14:47:02 2005 Subject: Modal problem Message-ID: > -----Original Message----- > From: K.K.Chan [mailto:infisys@po.jaring.my] > // ++++++++ Caller "FileSelController" > - (IBAction)renameFile:(id)sender > { > id win; > > if (![NSBundle loadNibNamed:@"OneEditPanel" owner:self]) > return; > > [externalCtrl initOwnData]; > win = [externalCtrl window]; > [NSApp runModalForWindow:win]; > [externalCtrl release]; > externalCtrl = nil; Why do you release externalCtrl here? You didn't alloc it within the method, so you probably shouldn't release it, either. > } _____________________________________ Jens Baumeister Bullex GmbH, Cologne, Germany She sells c-shells by the sea shore. From epeyton at epicware.com Mon Aug 6 07:45:45 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:02 2005 Subject: Gathering information running processes In-Reply-To: <016a01c11e84$a4f9b870$971410ac@MARYLEBONE> Message-ID: On Monday, August 6, 2001, at 09:32 AM, Russell Hind wrote: > Firstly, which API section should I look at for getting > information about > running applications (that have an icon displayed in the dock)? I would use the Carbon process Manager. > > Secondly, I also want a list of running processes, basically the > same as > 'top' so I can write a replacement for Apple's process viewer. I > have a > copy of the code for 'top' but when calling host_processor_sets I > get an > 'invalid argument' error (mach_error_t type 4). The port I am > passing in is > correct (I have tried this by passing in a null port and getting > an 'invalid > destination port' error). The other two parameters are exactly > the same as > the 'top' code but the call fails (I haven't got the code with me > but I > think it is something like this) > > processor_set_name_array_t psets; > unsigned int pcount; > > host_processor_set(mach_port_self(), &psets, &pcount); > > All this code is lifted from 'top' but this call fails. Can > anybody help. > Is there documentation on the 'host_' and other 'mach' related > calls anyway? > Did you happen to notice that top itself is setuid root? [localhost:~/Projects/Apple/BatteryMonitor] [epeyton] ls -la /usr/bin/top -r-sr-xr-x 1 root wheel 43820 Jul 14 00:39 /usr/bin/top Many of the processor_* calls require root access. Obviously, this is not what you want when you are trying to write a process viewer (I guarantee that *I* won't install a setuid application that I have no reason to trust :-) ). Eric > Thanks > > Russell > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1868 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/dbb3d99f/attachment.bin From kubernan at 10191.com Mon Aug 6 07:45:58 2001 From: kubernan at 10191.com (kubernan) Date: Thu Nov 3 14:47:02 2005 Subject: (Solved) Re: My instances jump window In-Reply-To: <200108061111.AA14351@ocs.cz> Message-ID: <200108061445.HAA15989@omnigroup.com> Le lundi 6 ao?t 2001, ? 01:11, Ondra Cada a ?crit : > kubernan, > >>>>>>> kubernan (k) wrote at Mon, 6 Aug 2001 12:31:50 +0200: > k> >From my main window i can launch same other window multiple times. > k> But doing this, the new window "stole" all instances from previous > window. > > I guess you "launch a new window" by loading the NIB again, don't you? > Yep !!! Completely forgot this... > If so, then of course the outlets are "stolen" by the new one. Whenever > you > load a NIB, the outlets are filled appropriately. If you load a NIB > moree > than once with the same owner, of course the outlets contain the last > values. > > Generally the best solution is to have a specific controller instance > for > each window, ie. somthing like > > id ctrl=[WinCtrl new]; > [NSBundle loadNibNamed:... owner:ctrl] > > (of course, it'd be better to load the NIB from a -[WinCtrl init], and > it'd > be best to use the NSWindowController, which is specifically designed > for > such things) > Wonderfull..it works great. Thx a lot. > If it happens not to be appropriate for asome project (ie. you do need > to > load NIB more than once with the same owner), you just have to store > the old > values, something like > > NSMutableDictionary *winButtons...; > > IBOutlet NSButton *button; // bound in NIB > > [NSBundle loadNibNamed:... owner:self]; > [winButtons setObject:button forKey:[[button window] title]]; > --- > Ondra Cada > OCSoftware: ocs@ocs.cz http://www.ocs.cz > private ondra@ocs.cz http://www.ocs.cz/oc > From ddavidso at apple.com Mon Aug 6 08:38:52 2001 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:47:02 2005 Subject: String Encoding Format in .plist and in .strings file In-Reply-To: <1215019304-27155815@transeo.com> Message-ID: <10BE1F58-8A7F-11D5-855B-000502935EF5@apple.com> On Monday, August 6, 2001, at 06:06 AM, St?phane Sudre wrote: > What's the string encoding format (for a object of > course) in a .plist file created with the PropertyList Editor ? > > MacRoman ? Unicode ? > > I'm also wondering about the format in the .strings file. Looking at > the French localization of OmniWeb, it seems that you can't have > "d?dale" in a .strings file. You need to use "d\U00E9dale". > > This strongly looks like some Unicode stuff. But is there a .strings > Unicode editor provided somewhere ? XML property lists are in UTF-8. I believe you will even see the notation encoding="UTF-8" on the first line. .strings files in the usual strings file format should be Unicode files. We don't ship a specific strings file editor, but TextEdit will open and save Unicode files just fine (make it plain text, and take a look at the encoding popup in the save panel). Douglas Davidson From zisa at swbell.net Mon Aug 6 08:47:38 2001 From: zisa at swbell.net (Clifton) Date: Thu Nov 3 14:47:02 2005 Subject: "Learning Cocoa" -Travel Advisor tutorial... Message-ID: <0GHN009DDKOS72@mta5.rcsntx.swbell.net> Yes, it did turn out to be a header which needed importing, the Country header in this case. Now, I'm faced with another issue, which I'll probably have to handle myself. The program crashes every time I select the "Add" button, which adds a "record" to the NSTableView. Although, it does not crash if I trash it's data file, which the program creates every time you exit and, encoding and storing the data from the NSTableView, also which is supposed to decoded and loaded every time you open the program. The debugger says "166*stopped,signal- name="EXC_BAD_ACCESS",signal-meaning="Could not access memory",thread- id="1" " when I press the add button. There must be a mistake in the code, somewhere... Thanks a lot for the help, Clifton R. C> Perhaps it is in my Country object implementation file? C> Here are the methods for currencyRate. Does this look right...? C> C> /***********************************/ C> - (float)currencyRate It does. But since this is a _compile-time_ error, check rather the header: is the currencyRate method declared in the @interface properly? Is the header imported? --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1270 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/0805f8c0/attachment.bin From ocs at ocs.cz Mon Aug 6 09:47:49 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:02 2005 Subject: NSFileHandle In-Reply-To: <200108061428.f76ESPA17040@linux.dataline.cz> References: <200108061428.f76ESPA17040@linux.dataline.cz> Message-ID: <200108061500.AA14517@ocs.cz> Robert, >>>>>> Robert Cerny (RC) wrote at Mon, 6 Aug 2001 16:26:11 +0200: RC> I thought I will use something like [fileHandle length] but such a RC> function doesn't exists. Any ideas? In the ire at seeing another thing not working properly in the carbonized remnants of the poor OpenStep, I've overlooked this question, sorry. === another excerpt === seekToEndOfFile - (unsigned long long)seekToEndOfFile Puts the file pointer at the end of the file referenced by the receiver and returns the new file offset (thus yielding the size of the file).... === cut here === --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From tjw at omnigroup.com Mon Aug 6 10:10:02 2001 From: tjw at omnigroup.com (Timothy J. Wood) Date: Thu Nov 3 14:47:02 2005 Subject: looking for faster sqrt In-Reply-To: <200108061021.DAA06903@smtpout.mac.com> Message-ID: <200108061710.KAA00698@omnigroup.com> On Monday, August 6, 2001, at 03:25 AM, Raphael Sebbe wrote: > I just found a paper from Omni about game-dev where it is said to use > frsqrte for faster square root computation. I sampled my code and sqrt > is taking more than 25 % of CPU time for specific task. But how can it > be used ? Anyone could give a small example code showing how to embed > PPC assembly in C code ? > > And about precision ? How does it compare to sqrt() ? I should really put this up next to the paper... :) /* Metrowerks has an intrisinc function for __frsqrte(), so we'll use that name if we are building with GCC */ #ifdef __GNUC__ static inline float __frsqrte(float number) { float y; asm("frsqrte %0,%1" : "=f" (y) : "f" (number)); return y; } #endif /* Compute an approximation 1/sqrt(x) with one Newton-Rhaphson refinement step */ static inline float FastReciprocalSqrt( float number ) { float x = 0.5f * number; float y; y = __frsqrte( number ); return y * (1.5f - (x * y * y)); } /* Use the identity sqrt(x) = x/sqrt(x) */ static inline float FastSqrt(float x) { return x * FastReciprocalSqrt(x) } My comments from the code I added to Quake3 were that for the range 0.6..2.0, I'd get about 3 to 5 decimal places of accuracy. I've done some more testing, but I don't recall where I put the testing code specifically for frsqrte. I _do_ have a testing harness that I used for testing my sin/cos estimation functions. This could easily be adapted to testing the speed and accuracy of fsqrte. Note, also, that you could define multiple versions of the FastReciprocalSqrt() function above that do more refinement steps if you need more accuracy in specific situations (collision detection vs. lighting calculations, for example). See the PPC manual for info on doing this. Here is my 'fasttrig.c' testing harness (which also has versions of sin() and cos() that are faster than the ones in libm by quite a bit). -tim -------------- next part -------------- Skipped content of type multipart/mixed From ddavidso at apple.com Mon Aug 6 10:10:19 2001 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:47:03 2005 Subject: String Encoding Format in .plist and in .strings file In-Reply-To: <1215019304-27155815@transeo.com> Message-ID: <10BE1F58-8A7F-11D5-855B-000502935EF5@apple.com> On Monday, August 6, 2001, at 06:06 AM, St?phane Sudre wrote: > What's the string encoding format (for a object of > course) in a .plist file created with the PropertyList Editor ? > > MacRoman ? Unicode ? > > I'm also wondering about the format in the .strings file. Looking at > the French localization of OmniWeb, it seems that you can't have > "d?dale" in a .strings file. You need to use "d\U00E9dale". > > This strongly looks like some Unicode stuff. But is there a .strings > Unicode editor provided somewhere ? XML property lists are in UTF-8. I believe you will even see the notation encoding="UTF-8" on the first line. .strings files in the usual strings file format should be Unicode files. We don't ship a specific strings file editor, but TextEdit will open and save Unicode files just fine (make it plain text, and take a look at the encoding popup in the save panel). Douglas Davidson From kubernan at 10191.com Mon Aug 6 10:11:09 2001 From: kubernan at 10191.com (kubernan) Date: Thu Nov 3 14:47:03 2005 Subject: (Solved) Re: My instances jump window In-Reply-To: <200108061111.AA14351@ocs.cz> Message-ID: <200108061445.HAA15989@omnigroup.com> Le lundi 6 ao?t 2001, ? 01:11, Ondra Cada a ?crit : > kubernan, > >>>>>>> kubernan (k) wrote at Mon, 6 Aug 2001 12:31:50 +0200: > k> >From my main window i can launch same other window multiple times. > k> But doing this, the new window "stole" all instances from previous > window. > > I guess you "launch a new window" by loading the NIB again, don't you? > Yep !!! Completely forgot this... > If so, then of course the outlets are "stolen" by the new one. Whenever > you > load a NIB, the outlets are filled appropriately. If you load a NIB > moree > than once with the same owner, of course the outlets contain the last > values. > > Generally the best solution is to have a specific controller instance > for > each window, ie. somthing like > > id ctrl=[WinCtrl new]; > [NSBundle loadNibNamed:... owner:ctrl] > > (of course, it'd be better to load the NIB from a -[WinCtrl init], and > it'd > be best to use the NSWindowController, which is specifically designed > for > such things) > Wonderfull..it works great. Thx a lot. > If it happens not to be appropriate for asome project (ie. you do need > to > load NIB more than once with the same owner), you just have to store > the old > values, something like > > NSMutableDictionary *winButtons...; > > IBOutlet NSButton *button; // bound in NIB > > [NSBundle loadNibNamed:... owner:self]; > [winButtons setObject:button forKey:[[button window] title]]; > --- > Ondra Cada > OCSoftware: ocs@ocs.cz http://www.ocs.cz > private ondra@ocs.cz http://www.ocs.cz/oc > From zisa at swbell.net Mon Aug 6 10:12:10 2001 From: zisa at swbell.net (Clifton) Date: Thu Nov 3 14:47:03 2005 Subject: "Learning Cocoa" -Travel Advisor tutorial... Message-ID: <0GHN009DDKOS72@mta5.rcsntx.swbell.net> Yes, it did turn out to be a header which needed importing, the Country header in this case. Now, I'm faced with another issue, which I'll probably have to handle myself. The program crashes every time I select the "Add" button, which adds a "record" to the NSTableView. Although, it does not crash if I trash it's data file, which the program creates every time you exit and, encoding and storing the data from the NSTableView, also which is supposed to decoded and loaded every time you open the program. The debugger says "166*stopped,signal- name="EXC_BAD_ACCESS",signal-meaning="Could not access memory",thread- id="1" " when I press the add button. There must be a mistake in the code, somewhere... Thanks a lot for the help, Clifton R. C> Perhaps it is in my Country object implementation file? C> Here are the methods for currencyRate. Does this look right...? C> C> /***********************************/ C> - (float)currencyRate It does. But since this is a _compile-time_ error, check rather the header: is the currencyRate method declared in the @interface properly? Is the header imported? --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1270 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/0805f8c0/attachment-0001.bin From epeyton at epicware.com Mon Aug 6 10:12:36 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:03 2005 Subject: Gathering information running processes In-Reply-To: <016a01c11e84$a4f9b870$971410ac@MARYLEBONE> Message-ID: On Monday, August 6, 2001, at 09:32 AM, Russell Hind wrote: > Firstly, which API section should I look at for getting > information about > running applications (that have an icon displayed in the dock)? I would use the Carbon process Manager. > > Secondly, I also want a list of running processes, basically the > same as > 'top' so I can write a replacement for Apple's process viewer. I > have a > copy of the code for 'top' but when calling host_processor_sets I > get an > 'invalid argument' error (mach_error_t type 4). The port I am > passing in is > correct (I have tried this by passing in a null port and getting > an 'invalid > destination port' error). The other two parameters are exactly > the same as > the 'top' code but the call fails (I haven't got the code with me > but I > think it is something like this) > > processor_set_name_array_t psets; > unsigned int pcount; > > host_processor_set(mach_port_self(), &psets, &pcount); > > All this code is lifted from 'top' but this call fails. Can > anybody help. > Is there documentation on the 'host_' and other 'mach' related > calls anyway? > Did you happen to notice that top itself is setuid root? [localhost:~/Projects/Apple/BatteryMonitor] [epeyton] ls -la /usr/bin/top -r-sr-xr-x 1 root wheel 43820 Jul 14 00:39 /usr/bin/top Many of the processor_* calls require root access. Obviously, this is not what you want when you are trying to write a process viewer (I guarantee that *I* won't install a setuid application that I have no reason to trust :-) ). Eric > Thanks > > Russell > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1868 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/dbb3d99f/attachment-0001.bin From jg at cs.tu-berlin.de Mon Aug 6 10:29:10 2001 From: jg at cs.tu-berlin.de (Joerg Garbers) Date: Thu Nov 3 14:47:03 2005 Subject: Objective C Category Method naming suggestions In-Reply-To: <200108061054.DAA24279@lists.omnigroup.com> Message-ID: <200108061453.QAA10063@mail.cs.tu-berlin.de> Hi, I do not know, if this is the right place for Objective-C style questions, and I do not want to start a JavaPackages/Objective-C discussion again. One really useful thing in Objective-C are the categories. You can use them for enriching or patching Classes, someone else wrote. This can be dangerous, if You merge different Frameworks in the same Application that define the same Category methods. That results in name clashes and unforseeable behaviour. I suggest, that creators of Frameworks, e.g. OmniGroup, Sente, Marcel Weiher, You and me (jg) use not only Namespaces for their class names (like JGCalculator) but also for category methods defined on common Classes, that really add Functionality (not for Patches): @interface NSObject (JGObject) - doJG; // instead of -do; (which clashes with MPWFoundation) @end I thought about putting the Namespace before: (-jgDo), but that does not look nice and also raises Problems in get/set Methods -myVal/setMyVal: -jgMyVal/setJgMyVal :-( -myValJG/setMyValJG: :-) So putting the initials after seems better. - setStringJG is also not too difficult to understand. I also would recommend not to write: - doThis: withThatJG: but - doThisJG: withThat: Maybe these simple conventions can make living with multiple merged Frameworks in Objective C much healthier. Joerg From jba at bullex.de Mon Aug 6 10:38:30 2001 From: jba at bullex.de (Jens Baumeister) Date: Thu Nov 3 14:47:03 2005 Subject: "Learning Cocoa" -Travel Advisor tutorial... Message-ID: -----Original Message----- From: Clifton [mailto:zisa@swbell.net] The debugger says "166*stopped,signal-name="EXC_BAD_ACCESS",signal-meaning="Could not access memory",thread-id="1" " when I press the add button. There must be a mistake in the code, somewhere... Sounds like a memory management problem to me - you're probably either releasing or not retaining something that should be kept around. _____________________________________ Jens Baumeister Bullex GmbH, Cologne, Germany She sells c-shells by the sea shore. -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman/archive/macosx-dev/attachments/20010806/1dc01531/attachment.html From jmagee at apple.com Mon Aug 6 10:38:57 2001 From: jmagee at apple.com (Jim Magee) Date: Thu Nov 3 14:47:03 2005 Subject: Gathering information running processes In-Reply-To: Message-ID: <74D8EEC6-8A82-11D5-9481-000A2789A5D2@apple.com> On Monday, August 6, 2001, at 07:45 AM, Eric Peyton wrote: > > On Monday, August 6, 2001, at 09:32 AM, Russell Hind wrote: >> processor_set_name_array_t psets; >> unsigned int pcount; >> >> host_processor_set(mach_port_self(), &psets, &pcount); >> >> All this code is lifted from 'top' but this call fails. Can anybody >> help. >> Is there documentation on the 'host_' and other 'mach' related calls >> anyway? >> > > Did you happen to notice that top itself is setuid root? > > [localhost:~/Projects/Apple/BatteryMonitor] [epeyton] ls -la > /usr/bin/top > -r-sr-xr-x 1 root wheel 43820 Jul 14 00:39 /usr/bin/top > > Many of the processor_* calls require root access. Actually, from Mach's perspective, only mach_host_self() is different for a privileged task/process. While Mach knows nothing about "root" (uid 0), BSD changes the host port registered with the task when it is run as root. It changes it from the regular host port, to the privileged host port. So, when root processes call mach_host_self(), they get back a send right to the privileged host port. With that port, you can do everything the regular host "name" port can do, but also may other things. In this particular example, the host_processor_sets() call is only supported on the host privilege port. To see which port is required for which call, you can consult the MIG .defs files that define the APIs. See vs. to tell which is supported on which port. Also note that in the past host_processor_sets() did not require the host privileged port in OSF Mach. We changed that because we wanted to discourage the use of processor_set APIs while we figured out what future they had in Darwin. But almost every current valid use of them was followed by a host_processor_set_priv() which converted from the processor_set name port to the processor_set control/privileged port. That DID require privilege, so it we didn't see it as too onerous a restriction. > Obviously, this is not what you want when you are trying to write a > process viewer (I guarantee that *I* won't install a setuid application > that I have no reason to trust :-) ). And once this processor viewer gets the task ports for "all" tasks in the system (the goal of looking up the processor_set ports is to then get the task ports for all the tasks belonging to each set), it better be trusted. Having the task port for the kernel task is pretty much having the keys to the kingdom (can read and write kernel memory, etc...) wouldn't you say? Instead of going the top (Mach driven) route, you may want to look at ps. It lists all the PIDs, and then tries to get the task port for each. If it has sufficient privilege (same UID as the target process, or running as root) it gets it. Otherwise, it can only get basic BSD info about the process. It's a much better approach is you don't absolutely have to dig around inside each task in the whole system, and don't want to have to be setuid(root). --Jim -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 3160 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/c06be4f5/attachment.bin From epeyton at epicware.com Mon Aug 6 10:41:59 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:03 2005 Subject: Gathering information running processes In-Reply-To: <01bd01c11e96$de235630$971410ac@MARYLEBONE> Message-ID: <2BF9F047-8A92-11D5-96E1-003065CBD1E2@apple.com> On Monday, August 6, 2001, at 11:43 AM, Russell Hind wrote: > Thanks. I forgot to mention that I'm using cocoa. Are there any > problems > with calling Carbon APIs from cocoa apps? Yes, don't mix UI, but most Carbon and Carbon Core calls can be called fine from Cocoa applications. (Cocoa is built, in many ways, on top of carbon as it is). > > And thanks to both of you for the info on 'top' and its root > privleges. I > agree that making an app that needs to run as root is a bad idea. > I shall > have a look at the source for 'ps' but I assume this means I can't list > 'root' processes (as Process Viewer does). Process Viewer uses ps (embedded, sort of :-) ) to do it's stuff, so you should be able to do the same thing as Process Viewer. > > Basically what I'm planning on doing in something similar to NT's task > manager which shows CPU load, applications running and individual > processes > and there cpu usage in 1 (mainly for a fun task to do, but also because > 'Process Viewer' is crap, and although top is very good, I prefer GUI > programs). I suppose I could just show extra lines on a graph for > 'other > users' processes (much as NT Task Manager shows 'kernel' usage) by > working > out the CPU usage of the current users's processes againt the total CPU > usage and show this as 'other processes' usage. > > I don't know, I could just be blabbering!! Or you could just file enhancement request against process viewer :-) Eric > > Cheers > > Russel > > ----- Original Message ----- > From: Eric Peyton > To: Russell Hind > Cc: macosx-Dev@omnigroup.com > Sent: Monday, August 06, 2001 3:45 PM > Subject: Re: Gathering information running processes > > > > On Monday, August 6, 2001, at 09:32 AM, Russell Hind wrote: > > > Firstly, which API section should I look at for getting > information about > running applications (that have an icon displayed in the dock)? > > > I would use the Carbon process Manager. > > > > Secondly, I also want a list of running processes, basically the > same as > 'top' so I can write a replacement for Apple's process viewer. I have a > copy of the code for 'top' but when calling host_processor_sets I > get an > 'invalid argument' error (mach_error_t type 4). The port I am > passing in is > correct (I have tried this by passing in a null port and getting > an 'invalid > destination port' error). The other two parameters are exactly the > same as > the 'top' code but the call fails (I haven't got the code with me but I > think it is something like this) > > processor_set_name_array_t psets; > unsigned int pcount; > > host_processor_set(mach_port_self(), &psets, &pcount); > > All this code is lifted from 'top' but this call fails. Can > anybody help. > Is there documentation on the 'host_' and other 'mach' related > calls anyway? > > > > Did you happen to notice that top itself is setuid root? > > [localhost:~/Projects/Apple/BatteryMonitor] [epeyton] ls -la > /usr/bin/top > -r-sr-xr-x 1 root wheel 43820 Jul 14 00:39 /usr/bin/top > > Many of the processor_* calls require root access. > > Obviously, this is not what you want when you are trying to write > a process > viewer (I guarantee that *I* won't install a setuid application > that I have > no reason to trust :-) ). > > Eric > > > > Thanks > > Russell > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 3577 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/c1a326bb/attachment.bin From rhind at orange.net Mon Aug 6 11:42:04 2001 From: rhind at orange.net (Russell Hind) Date: Thu Nov 3 14:47:03 2005 Subject: Gathering information running processes References: Message-ID: <01bd01c11e96$de235630$971410ac@MARYLEBONE> Thanks. I forgot to mention that I'm using cocoa. Are there any problems with calling Carbon APIs from cocoa apps? And thanks to both of you for the info on 'top' and its root privleges. I agree that making an app that needs to run as root is a bad idea. I shall have a look at the source for 'ps' but I assume this means I can't list 'root' processes (as Process Viewer does). Basically what I'm planning on doing in something similar to NT's task manager which shows CPU load, applications running and individual processes and there cpu usage in 1 (mainly for a fun task to do, but also because 'Process Viewer' is crap, and although top is very good, I prefer GUI programs). I suppose I could just show extra lines on a graph for 'other users' processes (much as NT Task Manager shows 'kernel' usage) by working out the CPU usage of the current users's processes againt the total CPU usage and show this as 'other processes' usage. I don't know, I could just be blabbering!! Cheers Russel ----- Original Message ----- From: Eric Peyton To: Russell Hind Cc: macosx-Dev@omnigroup.com Sent: Monday, August 06, 2001 3:45 PM Subject: Re: Gathering information running processes On Monday, August 6, 2001, at 09:32 AM, Russell Hind wrote: Firstly, which API section should I look at for getting information about running applications (that have an icon displayed in the dock)? I would use the Carbon process Manager. Secondly, I also want a list of running processes, basically the same as 'top' so I can write a replacement for Apple's process viewer. I have a copy of the code for 'top' but when calling host_processor_sets I get an 'invalid argument' error (mach_error_t type 4). The port I am passing in is correct (I have tried this by passing in a null port and getting an 'invalid destination port' error). The other two parameters are exactly the same as the 'top' code but the call fails (I haven't got the code with me but I think it is something like this) processor_set_name_array_t psets; unsigned int pcount; host_processor_set(mach_port_self(), &psets, &pcount); All this code is lifted from 'top' but this call fails. Can anybody help. Is there documentation on the 'host_' and other 'mach' related calls anyway? Did you happen to notice that top itself is setuid root? [localhost:~/Projects/Apple/BatteryMonitor] [epeyton] ls -la /usr/bin/top -r-sr-xr-x 1 root wheel 43820 Jul 14 00:39 /usr/bin/top Many of the processor_* calls require root access. Obviously, this is not what you want when you are trying to write a process viewer (I guarantee that *I* won't install a setuid application that I have no reason to trust :-) ). Eric Thanks Russell _______________________________________________ MacOSX-dev mailing list MacOSX-dev@omnigroup.com http://www.omnigroup.com/mailman/listinfo/macosx-dev From lance at mac.com Mon Aug 6 11:44:24 2001 From: lance at mac.com (Lance M. Westerhoff) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X Message-ID: Hello All- Is there any way to interface a Cocoa or a Carbon client-side app with an Oracle server-side database? I am writing an app that will need to communicate with an Oracle database at various times. Currently I am doing this with a MySQL database, but as time goes on, I'm going to need to more to an Oracle RDBMS. Thanks! -Lance -- _____________________ Lance M. Westerhoff PennState Chemistry Graduate Researcher & UNIX Systems Administrator - Merz Computational Biochemistry Research Group Phone: 814-863-7591 Email: lance@mac.com Web: http://merz.chem.psu.edu/~lance/ **************************************************** MacOSX: Combining the power of UNIX and the openness of Linux with the ease of use and broad applications base of Macintosh. http://www.apple.com/macosx/ **************************************************** From ssudre at intego.com Mon Aug 6 11:47:36 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:03 2005 Subject: Gathering information running processes In-Reply-To: <016a01c11e84$a4f9b870$971410ac@MARYLEBONE> Message-ID: <1215006360-27934707@transeo.com> On lundi, ao?t 6, 2001, at 04:32 PM, Russell Hind wrote: > Secondly, I also want a list of running processes, basically the same as > 'top' so I can write a replacement for Apple's process viewer. I have a > copy of the code for 'top' but when calling host_processor_sets I get an > 'invalid argument' error (mach_error_t type 4). The port I am passing > in is > correct (I have tried this by passing in a null port and getting an > 'invalid > destination port' error). The other two parameters are exactly the > same as > the 'top' code but the call fails (I haven't got the code with me but I > think it is something like this) > > processor_set_name_array_t psets; > unsigned int pcount; > > host_processor_set(mach_port_self(), &psets, &pcount); > > All this code is lifted from 'top' but this call fails. Can anybody > help. > Is there documentation on the 'host_' and other 'mach' related calls > anyway? What about using the 'ps' code ? From jba at bullex.de Mon Aug 6 11:55:43 2001 From: jba at bullex.de (Jens Baumeister) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X Message-ID: > -----Original Message----- > From: Lance M. Westerhoff [mailto:lance@mac.com] > > Is there any way to interface a Cocoa or a Carbon client-side app > with an Oracle server-side database? If you're using Java with Cocoa, you can use standard JDBC together with Oracle's Java classes. (You should also be able to just code the DB connection part in Java and do the rest in Obj-C, but I'm really not an expert in mixing the two languages and crossing the Java Bridge is expensive as far as performance is concerned.) _____________________________________ Jens Baumeister Bullex GmbH, Cologne, Germany She sells c-shells by the sea shore. From rainer at brockerhoff.net Mon Aug 6 12:06:05 2001 From: rainer at brockerhoff.net (Rainer Brockerhoff) Date: Thu Nov 3 14:47:03 2005 Subject: How to get volume format? In-Reply-To: <200108060202.EAA01182@am.homeip.net> References: <200108060202.EAA01182@am.homeip.net> Message-ID: At 03:59 +0200 on 06/08/2001, Andreas Monitzer wrote: >On Monday, August 6, 2001, at 03:40 , Rainer Brockerhoff wrote: > >>The BOOL flags return OK (although I wasn't able to deduce the difference between isRemovable and isUnmountable), but the description and type NSStrings always return set to nil. > >My boot disk is neither removeable nor unmountable. My ZIPs are removeable and unmountable. My Firewire disk is not removeable but unmountable. >Maybe "removeable" should read "ejectable". All my local drive partitions are neither removeable nor unmountable. My ZIPs are both, as are drive images and CDs. My Firewire disk is neither, contrary to yours - even when I make sure no files are open on it. A remote PC drive mounted via DAVE, strangely enough, shows up as neither removeable nor unmountable, though it should be... but then it also shows as not writeable! Must some bug in DAVE. Anyway, I've still been unable to find a volume that is unmountable but not removeable, or vice-versa... And I'm still trying to find out if these flags accurately predict whether unmountAndEjectDeviceAtPath will fail or not, due to open files. More later... -- Rainer Brockerhoff Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." http://www.brockerhoff.net/ (updated July 2000) From brantv at rhapsodicdevelopment.com Mon Aug 6 12:14:30 2001 From: brantv at rhapsodicdevelopment.com (Brant Vasilieff) Date: Thu Nov 3 14:47:03 2005 Subject: Running tasks as different user. Message-ID: <200108061913.f76JDBf24099@smtp.easystreet.com> In the archives, there are a few examples, but I'm still not clear on a few things. 1) Is there a function for returning a user's id besides wrapping it in a task to call "id"? I'm not talking about getuid, but finding the id of a specific user. I want my server to setuid to another user defined in a config file. Similar to how apache does with switching to user "www". I want the user to be able to compile and add plugins, and don't want those to have access to either root or the other users data on the system. 2) Will a task launched by a server running as "serverUser" also run as serverUser by defautt? I want to eventually run those plugins in their own tasks under a different user, so I can further protect the main server from them. 3) What is the safest way to launch a task as another user? Currently, I'm thinking about either: A) create a setuid-tool that immediately switches from root to the desired user, and then loads the plugin and executes it's contents. B) create a similar tool, that instead launches a separate task running as the desired user. Actually I have a specific case in one of my applications that does require this approach. 4) What would be the best way to protect these from being abused? I'm planning on authenticating any arguments, and assure that it is my application that is making the request, but I'd like a back up. 5) Can I safely include the tool next to my server in my client's bundle? 6) If that tool is setuid, will the user be required to authenticate to install it? Kind of hope so, even if it does throw a monkey wrench into things. I want to be able to keep a simple drag install if possible for the client, while allowing an authenticated install button in the client to setup the server. The last thing I want, is to have a security notice wipe out any previous good reviews. Any help or ideas would be greatly appreciated, Brant From raphael_sebbe at mac.com Mon Aug 6 12:24:16 2001 From: raphael_sebbe at mac.com (Raphael Sebbe) Date: Thu Nov 3 14:47:03 2005 Subject: faster sqrt, cnt'd Message-ID: <200108061920.MAA19911@smtpout.mac.com> Thanks for the replies. I found out that 2 iterations were enough for single precision floating-points (7 significant digits), and that's what I need (well, it depends on the value, I believe, tested for 1.0->160000.0...). That gives a 3.8x speed-up on a G3 (not tested on G4 yet)! BTW, looking at the developer doc provided on OS X, I found the fsqrt and fsqrts operators (respectively for double and single fp sqrt op., I was just curious about the later), but was not able to use them with the following directive : float TD_ffsqrt(float f) { double x = f, y0, y1, t0, t1, half = 0.5, one = 1.0; asm volatile("fsqrts %0,%1" : "=f" (y0) : "f" (x)); return y0; } getting signal 4 (SIGILL). (same with fsqrt) Is the operator name incorrect in the documentation, or something else is wrong in my code ? Other interesting thoughts : which one is the fastest from tjw's (4 elem. fp ops) and the one forwarded (the last 2 asm dir. seems more complex, don't they) ? Thanks again, Raphael > static inline double frsqrtd(double x) > { > double y0, y1, t0, t1, half = 0.5, one = 1.0; > asm volatile("frsqrte %0,%1" : "=f" (y0) : "f" (x)); > > // Do y1 = y0 + 0.5*y0*(1-x*y0*y0) > asm volatile("fmul %0,%1,%2" : "=f" (t0) : "f" (y0), "f" (y0)); > asm volatile("fmul %0,%1,%2" : "=f" (t1) : "f" (y0), "f" (half)); > asm volatile("fnmsub %0,%1,%2,%3" : "=f" (t0) : "f" (x), "f" (t0), > "f" (one)); > asm volatile("fmadd %0,%1,%2,%3" : "=f" (y1) : "f" (t0), "f" (t1), > "f" (y0)); > > y0 = y1; > // Refine it a 2nd time... > asm volatile("fmul %0,%1,%2" : "=f" (t0) : "f" (y0), "f" (y0)); > asm volatile("fmul %0,%1,%2" : "=f" (t1) : "f" (y0), "f" (half)); > asm volatile("fnmsub %0,%1,%2,%3" : "=f" (t0) : "f" (x), "f" (t0), > "f" (one)); > asm volatile("fmadd %0,%1,%2,%3" : "=f" (y1) : "f" (t0), "f" (t1), > "f" (y0)); > > y0 = y1; > // And a 3rd... > asm volatile("fmul %0,%1,%2" : "=f" (t0) : "f" (y0), "f" (y0)); > asm volatile("fmul %0,%1,%2" : "=f" (t1) : "f" (y0), "f" (half)); > asm volatile("fnmsub %0,%1,%2,%3" : "=f" (t0) : "f" (x), "f" (t0), > "f" (one)); > asm volatile("fmadd %0,%1,%2,%3" : "=f" (y1) : "f" (t0), "f" (t1), > "f" (y0)); > > y0 = y1; > // And a fourth... > asm volatile("fmul %0,%1,%2" : "=f" (t0) : "f" (y0), "f" (y0)); > asm volatile("fmul %0,%1,%2" : "=f" (t1) : "f" (y0), "f" (half)); > asm volatile("fnmsub %0,%1,%2,%3" : "=f" (t0) : "f" (x), "f" (t0), > "f" (one)); > asm volatile("fmadd %0,%1,%2,%3" : "=f" (y1) : "f" (t0), "f" (t1), > "f" (y0)); > > y0 = y1; > > return y0; > } > > static inline double fsqrtd(double x) > { > return frsqrtd(x)*x; > } -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2729 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/d33ed653/attachment.bin From ocs at ocs.cz Mon Aug 6 12:26:23 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:03 2005 Subject: NSFileHandle In-Reply-To: <200108061428.f76ESPA17040@linux.dataline.cz> References: <200108061428.f76ESPA17040@linux.dataline.cz> Message-ID: <200108061457.AA14507@ocs.cz> Robert, >>>>>> Robert Cerny (RC) wrote at Mon, 6 Aug 2001 16:26:11 +0200: RC> I expected RC> that [fileHandle readDataOfLength] will return data of actual length , RC> it means only valid data. When the file will be not long enough (pointer RC> is on the end of file), than return only valid data of smaller length And so it does! See eg. the documentation excerpt from NSFileHandle.html: === cut here === - (NSData *)readDataOfLength:(unsigned int)length If the receiver is a file, returns the data obtained by reading from the file pointer to length or to the end of the file, whichever comes first.... === cut here === It works exactly this way in practice, too (MOSXS1.x): 172 /tmp\> cat frtest/frtest_main.m #import int main (int argc, const char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSFileHandle *fp=[NSFileHandle fileHandleForReadingAtPath:@"/tmp/test"]; NSData *d=[fp readDataOfLength:1000]; NSLog(@"read %d bytes",[d length]); [pool release]; exit(0); // _E_nsure the process exit status is 0 return 0; // ...and make main fit the ANSI spec. } 173 /tmp\> ls -l /tmp/test -rw-r--r-- 1 ocs staff 422 Aug 6 10:02 /tmp/test 174 /tmp\> frtest/frtest Aug 06 16:48:07 frtest[15058] read 422 bytes 175 /tmp\> RC> According to my application, it returns some kind of garbage... Check again whether there is no problem on your side. If not and this is what truly happens in OS X, it is a *S*E*R*I*O*U*S* bug (caused probably by the Core Foundation or other "improvement", since the original code wokred properly), which is to be reported to Apple and fixed by them ASAP!!!!!! --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ocs at ocs.cz Mon Aug 6 12:26:42 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:03 2005 Subject: Modal problem In-Reply-To: <200108061329.f76DTrA01744@smtp8.jaring.my> References: <200108061329.f76DTrA01744@smtp8.jaring.my> Message-ID: <200108061509.AA14525@ocs.cz> K., >>>>>> K.K.Chan (KKC) wrote at Mon, 6 Aug 2001 21:25:31 +0800: KKC> I am getting exception and program sudden quit. I think have to do with KKC> the code related with modal window. Sorry for my haripn on the subject, but there should not be any modal window unless absolutely necessary... KKC> // ++++++++ Caller "FileSelController" KKC> - (IBAction)renameFile:(id)sender ... which hardly seems to be renaming a file (but of course, since I don't know the application you are writing, I can be mistaken in that). KKC> { KKC> id win; KKC> KKC> if (![NSBundle loadNibNamed:@"OneEditPanel" owner:self]) KKC> return; KKC> KKC> [externalCtrl initOwnData]; KKC> win = [externalCtrl window]; KKC> [NSApp runModalForWindow:win]; KKC> [externalCtrl release]; This look kinda suspicious! Try *not* to release it, I guess that might be the problem. Looks to me you release some view from a window, which of course can lead to nasty surprises later... KKC> externalCtrl = nil; KKC> } KKC> Is it safe to have nested modal windows under Cocoa ? So far as I know it is. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From tjw at omnigroup.com Mon Aug 6 13:10:16 2001 From: tjw at omnigroup.com (Timothy J. Wood) Date: Thu Nov 3 14:47:03 2005 Subject: faster sqrt, cnt'd In-Reply-To: <200108061920.MAA19911@smtpout.mac.com> Message-ID: <200108062009.NAA17774@omnigroup.com> On Monday, August 6, 2001, at 12:22 PM, Raphael Sebbe wrote: > BTW, looking at the developer doc provided on OS X, I found the fsqrt > and fsqrts operators (respectively for double and single fp sqrt op., I > was just curious about the later), but was not able to use them with > the following directive : > > float TD_ffsqrt(float f) > { > double x = f, y0, y1, t0, t1, half = 0.5, one = 1.0; > asm volatile("fsqrts %0,%1" : "=f" (y0) : "f" (x)); > return y0; > } If you are using fsqrts you probably need to use 'float's instead of doubles in for the locals.... just a guess, though :) > Other interesting thoughts : which one is the fastest from tjw's (4 > elem. fp ops) and the one forwarded (the last 2 asm dir. seems more > complex, don't they) ? I don't know about speed, but I found that the compiler emitted reasonable code w/o manual scheduling. Once I switched Q3 from using sqrt() in this particular case, the % time that the function was using for normalizing vectors was something like 1-2% ... not really worth optimizing more :) YMMV, of course, depending on how often you are calling sqrt() right now. -tim -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1227 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/217b35fc/attachment.bin From rpeskin at rlpcon.com Mon Aug 6 13:19:06 2001 From: rpeskin at rlpcon.com (Richard Peskin) Date: Thu Nov 3 14:47:03 2005 Subject: float to string Message-ID: <200108062018.f76KIuu27551@mailgate1.sover.net> How do I represent a float as a string that can be passed to NSString? For example, I might want to display mouse location. Assume I get the eventLocation from a mouseUp. myLocation float; myLocation = [myView convertPoint: eventLocation fromView: nil]; //Now I want to draw an NSString at myLocation to show myLocation.x and myLocation.y thanks, --dick peskin Richard L. Peskin, RLP Consulting, Londonderry, VT http://www.rlpcon.com http://www.caip.rutgers.edu/~peskin -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 549 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010806/9ac3ecb2/attachment.bin From ocs at ocs.cz Mon Aug 6 13:32:17 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X In-Reply-To: References: Message-ID: <200108062034.AA14774@ocs.cz> Lance, >>>>>> Lance M. Westerhoff (LMW) wrote at Mon, 6 Aug 2001 14:44:25 -0400: LMW> Is there any way to interface a Cocoa or a Carbon client-side app LMW> with an Oracle server-side database? Well, the best and most profitable one would be to make Apple to bring back the EOF! --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ian.cardenas at ultraviolent.com Mon Aug 6 13:41:32 2001 From: ian.cardenas at ultraviolent.com (Ian P. Cardenas) Date: Thu Nov 3 14:47:03 2005 Subject: float to string In-Reply-To: <200108062018.f76KIuu27551@mailgate1.sover.net> Message-ID: On Mon, 6 Aug 2001, Richard Peskin wrote: > How do I represent a float as a string that can be passed to NSString? > have a look at -stringWithFormat: http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSString.html#//apple_ref/occ/clm/NSString/stringWithFormat: the format token for floats is %f (just like printf/NSLog) -- Ian P. Cardenas Computer Scientist, Software From ocs at ocs.cz Mon Aug 6 13:46:05 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:03 2005 Subject: float to string In-Reply-To: <200108062018.f76KIuu27551@mailgate1.sover.net> References: <200108062018.f76KIuu27551@mailgate1.sover.net> Message-ID: <200108062048.AA14797@ocs.cz> Richard, >>>>>> Richard Peskin (RP) wrote at Mon, 6 Aug 2001 16:18:35 -0400: RP> How do I represent a float as a string that can be passed to NSString? RP> For example, I might want to display mouse location. Assume I get the RP> eventLocation from a mouseUp. myLocation float; RP> myLocation = [myView convertPoint: eventLocation fromView: nil]; RP> //Now I want to draw an NSString at myLocation to show myLocation.x and RP> myLocation.y [NSString stringWithFormat:@"%f",myLocation] --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From raisplin at rcn.com Mon Aug 6 13:47:11 2001 From: raisplin at rcn.com (Greg Evans) Date: Thu Nov 3 14:47:03 2005 Subject: More on USB In-Reply-To: <200108062018.f76KIuu27551@mailgate1.sover.net> Message-ID: I just recently asked about connecting to a USB device and have received some input from the Developer of Z-Term that I could use the "SerialPortSample" project from Apple and make "easy" modifications to it to make it find my modem-like device on the USB port connected via a Keyspan adapter. I have looked at the USB bits of the IOKit, but being so new to this, I think I just don't quite know what I am looking for .... The section of the SerialPortSample code that "seems" to be the relevant part that needs changing to me is: // Serial devices are instances of class IOSerialBSDClient classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue); //SerialBSDServiceValue if (classesToMatch == NULL) printf("IOServiceMatching returned a NULL dictionary.\n"); else { CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDAllTypes)); // Each serial device object has a property with key // kIOSerialBSDTypeKey and a value that is one of kIOSerialBSDAllTypes, // kIOSerialBSDModemType, or kIOSerialBSDRS232Type. You can experiment with the // matching by changing the last parameter in the above call to CFDictionarySetValue. // As shipped, this sample is only interested in modems, // so add this property to the CFDictionary we're matching on. // This will find devices that advertise themselves as modems, // such as built-in and USB modems. However, this match won't find serial modems. } But I am unsure exactly _what_ I need to change it to to make it find my device on the USB port.... I tried looking through the IOKit/usb/*.h files to find something to use, but I think I just don;t get it...The "rest" of what I am working on seems to be going ok (probably can be improved, but I will work on that later), but I just don't understand what I need to be looking for ....am I way off base as to where/what I should be trying to change??? and could someone point me in the right direction of what I should be looking at to change in the example from Apple, and what parts of the USB bit of the IOKit I may need to use?? I am using this because this is what the programmer of Z*term told me is how _he_ did it, and Z*Term will find my device and I can move data from it to the Z*term window.... TIA Greg From tblanchard at cacheon.com Mon Aug 6 13:49:27 2001 From: tblanchard at cacheon.com (Todd Blanchard) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X In-Reply-To: Message-ID: To my knowledge, neither Apple nor Oracle have any intentions of allowing this to happen. Oracle has no plans to support OSX as a client via client libs and Apple has neither plans to lobby Oracle to change their minds, nor intentions of doing the work themselves. -----Original Message----- From: macosx-dev-admin@omnigroup.com [mailto:macosx-dev-admin@omnigroup.com]On Behalf Of Lance M. Westerhoff Sent: Monday, August 06, 2001 11:44 AM To: macosx-dev@omnigroup.com Subject: Oracle and OS X Hello All- Is there any way to interface a Cocoa or a Carbon client-side app with an Oracle server-side database? I am writing an app that will need to communicate with an Oracle database at various times. Currently I am doing this with a MySQL database, but as time goes on, I'm going to need to more to an Oracle RDBMS. Thanks! -Lance -- _____________________ Lance M. Westerhoff PennState Chemistry Graduate Researcher & UNIX Systems Administrator - Merz Computational Biochemistry Research Group Phone: 814-863-7591 Email: lance@mac.com Web: http://merz.chem.psu.edu/~lance/ **************************************************** MacOSX: Combining the power of UNIX and the openness of Linux with the ease of use and broad applications base of Macintosh. http://www.apple.com/macosx/ **************************************************** _______________________________________________ MacOSX-dev mailing list MacOSX-dev@omnigroup.com http://www.omnigroup.com/mailman/listinfo/macosx-dev From ian.cardenas at ultraviolent.com Mon Aug 6 14:01:56 2001 From: ian.cardenas at ultraviolent.com (Ian P. Cardenas) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X In-Reply-To: Message-ID: On Mon, 6 Aug 2001, Todd Blanchard wrote: > To my knowledge, neither Apple nor Oracle have any intentions of allowing > this to happen. Oracle has no plans to support OSX as a client via client > libs and Apple has neither plans to lobby Oracle to change their minds, nor > intentions of doing the work themselves. > At WWDC, the Oracle rep said that a full OCI library would be available by the end of the year. My notes from the WebObjects State of the Union: - Oracle was there - "The future of all database development is Java" - Database Marketshare - 33% Oracle - 33% IBM - 13% MS SQL Server - 4% Informix - 3% Sybase - With IBM's acquisition of Informix that pushes them 4% over Oracle J - Early release of OCI library with WO4.5.1 - "Full release" of OCI library be end of the year - oclfeedback@apple.com - Oracle 9i wil be released on June 14th -- Ian P. Cardenas Computer Scientist, Software From cwolf at mac.com Mon Aug 6 14:04:05 2001 From: cwolf at mac.com (Christopher Wolf) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X In-Reply-To: Message-ID: According to: "In a boost for Mac OS X as a corporate platform, Oracle Corp. has announced that it is developing client software to connect workstations running Apple Computer Inc.'s new OS to Oracle's own database applications." - Chris On Monday, August 6, 2001, at 04:49 PM, Todd Blanchard wrote: > *This message was transferred with a trial version of CommuniGate(tm) > Pro* > To my knowledge, neither Apple nor Oracle have any intentions of > allowing > this to happen. Oracle has no plans to support OSX as a client via > client > libs and Apple has neither plans to lobby Oracle to change their minds, > nor > intentions of doing the work themselves. > > > -----Original Message----- > From: macosx-dev-admin@omnigroup.com > [mailto:macosx-dev-admin@omnigroup.com]On Behalf Of Lance M. Westerhoff > Sent: Monday, August 06, 2001 11:44 AM > To: macosx-dev@omnigroup.com > Subject: Oracle and OS X > > > Hello All- > > Is there any way to interface a Cocoa or a Carbon client-side app > with an Oracle server-side database? I am writing an app that will > need to communicate with an Oracle database at various times. > Currently I am doing this with a MySQL database, but as time goes on, > I'm going to need to more to an Oracle RDBMS. > > Thanks! > > -Lance > -- > _____________________ > Lance M. Westerhoff > PennState Chemistry Graduate Researcher & > UNIX Systems Administrator > - Merz Computational Biochemistry Research Group > Phone: 814-863-7591 > Email: lance@mac.com > Web: http://merz.chem.psu.edu/~lance/ > > **************************************************** > MacOSX: Combining the power of UNIX and the openness > of Linux with the ease of use and broad applications > base of Macintosh. http://www.apple.com/macosx/ > **************************************************** > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From ocs at ocs.cz Mon Aug 6 14:10:09 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X In-Reply-To: References: Message-ID: <200108062112.AA14822@ocs.cz> Ian, >>>>>> Ian P. Cardenas (IPC) wrote at Mon, 6 Aug 2001 15:01:16 -0600 (MDT): IPC> >Apple has neither plans to lobby Oracle to change their minds, nor IPC> >intentions of doing the work themselves Well, Apple has the complete EOF source code, including the Oracle adaptor. The only problem is that they dumbly decided to trash the complete thing and replace it by an utterly unuseable Java-only toy :((((((((((((((((((((((((((((((((((((((( --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From rick at icons.cx Mon Aug 6 14:25:19 2001 From: rick at icons.cx (Rick Roe) Date: Thu Nov 3 14:47:03 2005 Subject: String Encoding Format in .plist and in .strings file In-Reply-To: <1215019304-27155815@transeo.com> Message-ID: > I'm also wondering about the format in the .strings file. Looking at the > French localization of OmniWeb, it seems that you can't have "d?dale" in > a .strings file. You need to use "d\U00E9dale". Yes, you can use Unicode in a strings file. At first, our localizers weren't aware of that, and so we have a few places where they're ASCII with exape codes. Most of our later localizations are saved as UTF8 or UTF16. -- Rick Roe icons.cx / The Omni Group From tblanchard at cacheon.com Mon Aug 6 14:40:44 2001 From: tblanchard at cacheon.com (Todd Blanchard) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X In-Reply-To: Message-ID: What of the C Oracle Client Library? Without a decent *native* interface there's no story. -----Original Message----- From: Ian P. Cardenas [mailto:ian.cardenas@ultraviolent.com] Sent: Monday, August 06, 2001 2:01 PM To: Todd Blanchard Cc: Lance M. Westerhoff; macosx-dev@omnigroup.com Subject: RE: Oracle and OS X On Mon, 6 Aug 2001, Todd Blanchard wrote: > To my knowledge, neither Apple nor Oracle have any intentions of allowing > this to happen. Oracle has no plans to support OSX as a client via client > libs and Apple has neither plans to lobby Oracle to change their minds, nor > intentions of doing the work themselves. > At WWDC, the Oracle rep said that a full OCI library would be available by the end of the year. My notes from the WebObjects State of the Union: - Oracle was there - "The future of all database development is Java" - Database Marketshare - 33% Oracle - 33% IBM - 13% MS SQL Server - 4% Informix - 3% Sybase - With IBM's acquisition of Informix that pushes them 4% over Oracle J - Early release of OCI library with WO4.5.1 - "Full release" of OCI library be end of the year - oclfeedback@apple.com - Oracle 9i wil be released on June 14th -- Ian P. Cardenas Computer Scientist, Software From tblanchard at cacheon.com Mon Aug 6 14:58:24 2001 From: tblanchard at cacheon.com (Todd Blanchard) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X In-Reply-To: Message-ID: You neglected to mention: "The Mac client will provide programmatic connectivity to Oracle databases but will not provide any client tools (executables) such as SQL*Plus," he said. "As such, it is not a full client like that on [Microsoft] Windows." "The purpose of the 8.1.6 and 8.1.7 clients is to provide ISVs and developers with an OCI programmatic connectivity today, while preparing for a longer-term strategy to migrate Mac OS X development toward Java and JDBC connectivity," he said. "...all future development work at Oracle will be done only on the Thin JDBC Driver." IOW, no ObjectiveC (or just plain C) support and no tools. Thus, there is point in doing Cocoa apps that use Oracle on the back end. If you have to work in Java, you might as well write using swing and get Windows support at the same time. While we're at it, I guess we should specify Windows clients - they're cheaper anyhow. That is the best development strategy. What the hell is Apple's platform strategy group thinking? -----Original Message----- From: macosx-dev-admin@omnigroup.com [mailto:macosx-dev-admin@omnigroup.com]On Behalf Of Christopher Wolf Sent: Monday, August 06, 2001 1:58 PM To: Todd Blanchard Cc: Christopher Wolf; macosx-dev@omnigroup.com; Lance M. Westerhoff Subject: Re: Oracle and OS X According to: "In a boost for Mac OS X as a corporate platform, Oracle Corp. has announced that it is developing client software to connect workstations running Apple Computer Inc.'s new OS to Oracle's own database applications." - Chris On Monday, August 6, 2001, at 04:49 PM, Todd Blanchard wrote: > *This message was transferred with a trial version of CommuniGate(tm) > Pro* > To my knowledge, neither Apple nor Oracle have any intentions of > allowing > this to happen. Oracle has no plans to support OSX as a client via > client > libs and Apple has neither plans to lobby Oracle to change their minds, > nor > intentions of doing the work themselves. > > > -----Original Message----- > From: macosx-dev-admin@omnigroup.com > [mailto:macosx-dev-admin@omnigroup.com]On Behalf Of Lance M. Westerhoff > Sent: Monday, August 06, 2001 11:44 AM > To: macosx-dev@omnigroup.com > Subject: Oracle and OS X > > > Hello All- > > Is there any way to interface a Cocoa or a Carbon client-side app > with an Oracle server-side database? I am writing an app that will > need to communicate with an Oracle database at various times. > Currently I am doing this with a MySQL database, but as time goes on, > I'm going to need to more to an Oracle RDBMS. > > Thanks! > > -Lance > -- > _____________________ > Lance M. Westerhoff > PennState Chemistry Graduate Researcher & > UNIX Systems Administrator > - Merz Computational Biochemistry Research Group > Phone: 814-863-7591 > Email: lance@mac.com > Web: http://merz.chem.psu.edu/~lance/ > > **************************************************** > MacOSX: Combining the power of UNIX and the openness > of Linux with the ease of use and broad applications > base of Macintosh. http://www.apple.com/macosx/ > **************************************************** > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev _______________________________________________ MacOSX-dev mailing list MacOSX-dev@omnigroup.com http://www.omnigroup.com/mailman/listinfo/macosx-dev From dweebert at home.com Mon Aug 6 15:27:16 2001 From: dweebert at home.com (Graeme Hiebert) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X In-Reply-To: Message-ID: <200108062227.PAA28443@omnigroup.com> On Monday, August 6, 2001, at 02:40 PM, Todd Blanchard wrote: > What of the C Oracle Client Library? Without a decent *native* > interface > there's no story. > > > -----Original Message----- > From: Ian P. Cardenas [mailto:ian.cardenas@ultraviolent.com] > > At WWDC, the Oracle rep said that a full OCI library would be available > by > the end of the year. My notes from the WebObjects State of the Union: OCI ("Oracle Call Interface") is Oracle's C library. From the quote in your other message: > "The Mac client will provide programmatic connectivity to Oracle > databases > but will not provide any client tools (executables) such as SQL*Plus," > he > said. "As such, it is not a full client like that on [Microsoft] > Windows." > > "The purpose of the 8.1.6 and 8.1.7 clients is to provide ISVs and > developers with an OCI programmatic connectivity today, while preparing > for > a longer-term strategy to migrate Mac OS X development toward Java and > JDBC > connectivity," he said. This says very clearly to me that they Oracle's C interface will be in place, but they won't be providing any of their utilities for Mac OS X. While it would be nice to have SQL*Plus, that isn't a big deal to me. (Surely someone could whip up something similar in an afternoon.) This is very good news to me, as the only platform my employer's software cannot currently support Oracle database connectivity with is Mac OS X, my preferred platform, and a great deal the bugs I have to track down are in my Oracle code. Once I have OCI libs, I will hardly have to use my Win2K PC or a Solaris login session at all! :^) I think it's a mistake to focus future development entirely on JDBC, but that's the way it's going on all platforms. (I'm sure they mean that all future *application* development at Oracle will be done only on the Thin JDBC driver. I hope they're not planning on implementing future complex spatial analysis entirely in Java. :^) BTW, does anyone know of any decent sample code for accessing JDBC databases? I'd love to add JDBC support to my employer's software, but haven't come across anything but the most basic of JDBC sample code. -g From svet at binaryvoid.com Mon Aug 6 15:58:25 2001 From: svet at binaryvoid.com (Steven Downum) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X In-Reply-To: <200108062227.PAA28443@omnigroup.com> Message-ID: <200108062202.f76M28Q07072@64-39-1-73.dhcp.hq.rackspace.com> Graeme, Try this snippit: import java.sql.*; // various class and/or method definitions here java.sql.Connection dbconnection; String dbquery = "SELECT * FROM foo"; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url ="jdbc:odbc:"; dbconnection = DriverManager.getConnection(url, "", ""); } catch(ClassNotFoundException e) { System.err.println(e); } catch(SQLException e) { System.err.println(e); } } // Now, here the query snippit: try { Statement stmt = dbconnection.createStatement(); ResultSet rs = stmt.executeQuery(dbquery); while(rs.next() ){ // EXAMPLE: Print your results from the SELECT query // NOTE: in this example, the String argument to getString is name // of the particular column in hypothetical database foo String id = rs.getString("ID"); String name = rs.getString("EMPLOYEE_ID"); Srting emaiil = rs.getString("EMAIL"); System.out.println(id + "\t" + name + "\t" + "email"); } } catch(SQLException e) { System.err.println(e); } Cheers, Steven Downum Am Montag, 6. August 2001 um 17:27 schrieb Graeme Hiebert > > BTW, does anyone know of any decent sample code for accessing JDBC > databases? I'd love to add JDBC support to my employer's software, but > haven't come across anything but the most basic of JDBC sample code. > > -g > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From am at yline.com Mon Aug 6 16:54:02 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:03 2005 Subject: Oracle and OS X In-Reply-To: Message-ID: <200108062353.BAA01024@am.homeip.net> On Monday, August 6, 2001, at 11:59 , Todd Blanchard wrote: > "...all future development work at Oracle will be done only on the Thin > JDBC > Driver." > > Thus, there is point in doing Cocoa apps that use Oracle on the back end. > If you have to work in Java, you might as well write using swing and get > Windows support at the same time. > While we're at it, I guess we should specify Windows clients - they're > cheaper anyhow. > > That is the best development strategy. I won't argue with you about that - I too think that everybody should stop developing for Mac OS X immediately and go Windows-only instead. However, I want to inform you about one of the greatest achievements of human history: the Java bridge. It's possible to use the Java Database Connectivity suite inside an Objective-C program. Theoretically, it's possible to use JDBC without writing a line of Java code, but the last time I checked it didn't work (some kind of bridge bug) . There's a tutorial about that stuff by someone who hasn't got a clue about development strategies at http://www.cocoadevcentral.com/tutorials/showpage.php?show=00000016.php andy -- Discussion forthcoming. From mikevannorsdel at qwest.net Mon Aug 6 16:59:23 2001 From: mikevannorsdel at qwest.net (Mike Vannorsdel) Date: Thu Nov 3 14:47:03 2005 Subject: Archiving Revisited In-Reply-To: Message-ID: <200108062359.QAA03003@omnigroup.com> This seems to be doing just what I want, as long as I remember to use "-p e" when extracting. The only quirk I can see is that the creation date is not preserved; the creation date is given the same date as the modification date. But this is not a problem in my situation. Thanks. On Sunday, August 5, 2001, at 02:30 AM, Howard Oakley wrote: > AFAIK hfspax does this just fine. If it does not, then no-one has > reported > the bug to me - currently the bug list is empty, and I am looking to > release > the first proper beta in the next week or two. > > hfspax is free from http://homepage.mac.com/howardoakley/ > > hfstar seems to be an old utility aimed at Darwin rather than OS X. > Although > the source is around (try the Darwin software sites), I have not found > anyone who has got it to work under OS X release. > > I cannot speak for the Retrospect beta - it apparently requires the > server > to be installed (high cost), and is unsupported. However, I think some > folk > have got it to work without paying for the server. From gerard_iglesias at mac.com Mon Aug 6 17:52:07 2001 From: gerard_iglesias at mac.com (Gerard Iglesias) Date: Thu Nov 3 14:47:03 2005 Subject: Objective C Category Method naming suggestions In-Reply-To: <200108061453.QAA10063@mail.cs.tu-berlin.de> Message-ID: <200108070051.RAA24396@smtpout.mac.com> Le Monday 6 August 2001, ? 04:53, Joerg Garbers a ?crit : > Hi, > > I do not know, if this is the right place for Objective-C style > questions, > and I do not want to start a JavaPackages/Objective-C discussion again. I would suggest a AdaPackage/ObjC religious war......... no no I am jocking. More seriously I vote for your suggestion. I reserve the suffix GI. Gerard [ObjC retain] From gerard_iglesias at mac.com Mon Aug 6 17:54:36 2001 From: gerard_iglesias at mac.com (Gerard Iglesias) Date: Thu Nov 3 14:47:03 2005 Subject: looking for faster sqrt In-Reply-To: <200108061710.KAA00698@omnigroup.com> Message-ID: <200108070051.RAA24384@smtpout.mac.com> Thank you very much to all for these concrete examples of using ASM PPC inline in OSX code. But I would like to know what is the right way to learn everything about integrating PPC asm in GCC compiled code, I didn't see anything useful in the GCC doc. Thank you in advance. Gerard From gerard_iglesias at mac.com Mon Aug 6 17:55:47 2001 From: gerard_iglesias at mac.com (Gerard Iglesias) Date: Thu Nov 3 14:47:03 2005 Subject: windows ? File's Owner and a miracle connection occurs In-Reply-To: <200108052034.AA13745@ocs.cz> Message-ID: <200108070052.RAA24468@smtpout.mac.com> Well, a good exercise, explaining what is a nib file and this famous File's Owner icon, it take me between 3 to six months, ten years ago to be understood. I hope that what I am going to write will be clear enough, if not don't hesitate to ask other questions :-), I am French and it is hard also to explain this subject in french also, then I am sticking to english... A nib file is a file that contains archived objects, the destiny of this file is to be loaded by an application one or more times, during the loading of this file a lot of magic happens, to understand this magic we have to describe first what is contained in the graphic representation of a nib file shown by IB. In a typical nib file we can see an icon standing for the File's Owner, a second for the First Responder, a third for the Main Menu and the last one for a NSWindow instance. Two of these icons represent real objects that when unarchived will be the same in the application : the menu and the window. The icon that stand for the first responder represent in fact no specific object, the first responder is dynamically set depending on the user actions, hence we can see a first object in the nib file that doesn't really exist, that stand for something less concrete, the object that at a certain time becomes the object ready to receive keyboard event in the main window. How does it work? IB is used in the most part to assemble object together and connect them with the help of outlets. Each time you make a connection, for example, from a button in the window to the first responder in the nib document window, IB creates an instance of NSNibConnector (or a subclass of), in place of making a hard wired connection, with the help of this indirection all the magic of IB happens. This connector object contains two outlets : source and destination. This connector is going to play a very important role during the unarchiving process. When the connection is made between a control toward the first responder the connector has its source instance variable set to the address of the control object and its destination set to nil, it is the value that means "First responder", we will see later why. During the unarchiving process the connector will establish the connection dynamically between the two objects, in this example it will say to the source object to set its target outlet to the nil value. This value works for the First Responder target because when a control is going to send the message to the target it sends the message with the help of the NSApp instance and ask it to - (BOOL)sendAction:(SEL)anAction to:(id)aTarget from:(id)sender and if you look at the doc, you will see that if the target is nil, NSApp look first at the objects in the responder chain. Like the firstResponder icon in the nib file doesn't represent a real object, the icon of the File's Owner doesn't represent an object that is really in the nib file. Like its name said this icon represent the owner of the nib file, but what is the owner? When you load a nib file, you make it with the help of one NSBundle methods, especially you can use -(BOOL)loadNibName:owner: and the second parameter is the object that is going to be the famous File's Owner, hence the icon in the nib file window represents an object that is standing for an object that will be know when the file will be loaded. Then how does the connection work? First to connect an outlet from the File's Owner to an other object in the nib file, IB needs to know what is the class of the File's Owner in order to know what are the outlet name of the instance, you set the class of the instance with the attribute inspector, and you inform IB of the Class by dropping the header of this class in the nib file window. You have to be aware that IB know only what is defined in the header, nothing else and it will not be synchronized automaticaly with the modification you will made to this class. When everything is OK, then you will be able to connect an outlet from the File's Owner icon to an object in the nib file, at this time IB created an instance of the NSNibConnector class (or one of its subclass) that will contain the information that the source is the File's Owner. Then during the unarchiving process, executing the message -loadNibNamed:owner:, the File's Owner is known, hence the connector object will be able to know what is the real File's Owner object in order to build the right connection during the call of the establishConnection method. To make short, the File's Owner is a Proxy that stand for the owner of the nib set as the second parameter of the loadNibNamed:onwer: method, and the connection from or to the File's Owner is delayed until the unarchiving process of the nib file and the magic is realized during the execution of the code in the of the NSNibConnector class. When a nib file is loaded, at the end, when all establishConnection methods have been called, then each object contained in the nib as real or proxied object receive the awakeFromNib message, this is one of the place you can put your own magic :-) That's all for this time, I hope that the things are clear enough to be understandable. Best regards. Gerard From gerard_iglesias at mac.com Mon Aug 6 17:56:54 2001 From: gerard_iglesias at mac.com (Gerard Iglesias) Date: Thu Nov 3 14:47:03 2005 Subject: Objective C Category Method naming suggestions In-Reply-To: <200108061453.QAA10063@mail.cs.tu-berlin.de> Message-ID: <200108070051.RAA19080@smtpout.mac.com> Le Monday 6 August 2001, ? 04:53, Joerg Garbers a ?crit : > Hi, > > I do not know, if this is the right place for Objective-C style > questions, > and I do not want to start a JavaPackages/Objective-C discussion again. I would suggest a AdaPackage/ObjC religious war......... no no I am jocking. More seriously I vote for your suggestion. I reserve the suffix GI. Gerard [ObjC retain] From tjw at omnigroup.com Mon Aug 6 18:13:53 2001 From: tjw at omnigroup.com (Timothy J. Wood) Date: Thu Nov 3 14:47:03 2005 Subject: looking for faster sqrt In-Reply-To: <200108070051.RAA24384@smtpout.mac.com> Message-ID: <200108070113.SAA06486@omnigroup.com> On Monday, August 6, 2001, at 03:46 PM, Gerard Iglesias wrote: > But I would like to know what is the right way to learn everything > about integrating PPC asm in GCC compiled code, I didn't see anything > useful in the GCC doc. The first general stuff is in the compiler docs at: file:///Developer/Documentation/DeveloperTools/Compiler/Compiler.3c.html This only addresses the general stuff, though -- for specifics about each machine, you need to look at the lower level docs that specify special constraints for each CPU. Sadly, I can't find the reference for this, but I do remember the important one, 'b' for 'base register'. On the PPC, many operations treat 'r0' as '0' rather than 'the contents of r0'. The 'b' constraint means anything register other than 'r0'. Also, there was this thread on the egcs list in Oct 1999 (note that there are apparently corrections to this document elsewhere in the thread -- there may be a unified document on http://gcc.gnu.org now). http://gcc.gnu.org/ml/gcc/1999-10n/msg00488.html -tim From infisys at po.jaring.my Mon Aug 6 19:00:58 2001 From: infisys at po.jaring.my (K.K.Chan) Date: Thu Nov 3 14:47:03 2005 Subject: Modal problem Message-ID: <200108070200.f7720IN14956@smtp2.jaring.my> Sorry, I did not give enough details earlier on, it was a long listing (read below). The externalCtrl is link to OneEditPanel. Now I think is because of releasing externalCtrl, which might have cause the problem. It must have been some stuff I did earlier on, when I was just started learning Cocoa. Just to be sure, does it means the external controller (which is load by loadNibNamed) will be auto release later after the window is close ? +++++ I do not really like modal window or panel but given the nature of Cocoa, it is possible to open up many windows. For me, modal window forces the user to complete the input of data before doing other stuff. Some of the design which requires nested windows, let's say for example below, menu --> file select --> page settings --> sub page settings (non modal) (modal) (modal) nib 1 nib 2 nib 3 At times when a window is "cramped" with many controls, (in this case "page settings"), it is desirable to move some of the control groupings into one or several windows. I do not know it is the best way to organize since there is not many Cocoa app to refer to. Please comment. K.K.Chan @interface FileSelController : NSObject { // other stuff... id externalCtrl; } // other methods ... - (IBAction)renameFile:(id)sender; @end; // ++++++++ Caller "FileSelController" - (IBAction)renameFile:(id)sender { id win; if (![NSBundle loadNibNamed:@"OneEditPanel" owner:self]) return; [externalCtrl initOwnData]; win = [externalCtrl window]; [NSApp runModalForWindow:win]; [externalCtrl release]; externalCtrl = nil; } // ========================================= @interface OneEditPanel : NSObject // other declarations... - (NSWindow *) window { return win; } // --------- OneEditPanel window - (IBAction)saveButton:(id)sender { // do whatever.... blah blah [[self window] close]; [NSApp stopModal]; } Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_INVALID_ADDRESS (0x0001) at 0x39350000 Thread 0: #0 0x7081ab98 in _objc_msgSend () #1 0x70f6ff58 in _runModalCleanup () #2 0x70e21954 in -[NSApplication endModalSession:] #3 0x70e21cfc in -[NSApplication runModalForWindow:] #4 0x000112fc in _OneEditPanel () #5 0x000082ec in -[FileSelController renameFile:] #6 0x709810bc in -[NSObject performSelector:withObject:] #7 0x70d94908 in -[NSApplication sendAction:to:from:] #8 0x70d94860 in -[NSControl sendAction:to:] #9 0x70d94810 in -[NSCell _sendActionFrom:] #10 0x70d943f8 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:] #11 0x70d93e3c in -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] #12 0x70d95bc0 in -[NSControl mouseDown:] #13 0x70d85600 in -[NSWindow sendEvent:] #14 0x70d78d50 in -[NSApplication sendEvent:] #15 0x70d7548c in -[NSApplication run] #16 0x70d9799c in _NSApplicationMain () #17 0x00012ce4 in _main () #18 0x00002bfc in __start () #19 0x00002a3c in start () From celledge at mac.com Mon Aug 6 19:36:03 2001 From: celledge at mac.com (Chris Elledge) Date: Thu Nov 3 14:47:03 2005 Subject: Help with modifying NSTextView Message-ID: <200108070235.TAA07548@smtpout.mac.com> I have a program that is using two NSTextViews in one window. One of them is used as output, and the other as input. I have two questions, one for each the the two. 1) Is there a straight forward way to allow an NSTextView to have different background colors for sections of text? I am currently using setTextColor:range: to set the foreground color of the appropriate text sections, but I have not come up with a good idea for applying background colors. This text is not user editable, but I would like select and copy to work on it (minus the colors most likely). 2) How can I intercept keyboard input going to an NSTextView? I would like to be able to filter out certain key presses/ key combinations for my own use before they reach the NSTextView. Thank you for your help, Chris Elledge From rick at icons.cx Mon Aug 6 21:57:30 2001 From: rick at icons.cx (Rick Roe) Date: Thu Nov 3 14:47:03 2005 Subject: Looking for Network and Bundle examples In-Reply-To: <1119942.997072996@adsl-64-169-39-229.dsl.snfc21.pacbell.net> Message-ID: > Also, does anyone know where I can download documentation on Onmi's > networking frameworks? There's an (old) tutorial on OmniNetworking at http://www.stepwise.com/Articles/Technical/OmniNetworking.html. -- Rick Roe icons.cx / The Omni Group From marcel at metaobject.com Tue Aug 7 01:35:01 2001 From: marcel at metaobject.com (Marcel Weiher) Date: Thu Nov 3 14:47:03 2005 Subject: looking for faster sqrt In-Reply-To: <200108070113.SAA06486@omnigroup.com> Message-ID: On Tuesday, August 7, 2001, at 03:13 Uhr, Timothy J. Wood wrote: > On the PPC, many operations treat 'r0' as '0' rather than 'the > contents of r0'. IIRC, the PPC architecture defines the contents of register 0 to always be zero. -- Marcel Weiher marcel@metaobject.com HOM: From zak_ziggy at hotmail.com Tue Aug 7 01:54:29 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:03 2005 Subject: Bug Tracker ? I can not find it, please help. Message-ID: I was wondering if you could shed some like on what happened to the bug tracker. I can not seem to find it anymore. There are critical bugs to do with multithreading, etc., that not only am I interested in making important business decisions based on the status of these messages, but also the quickness that they are repaired in. Further I need to reference the Bug ID's in other BugReports to enable better and quicker solution resolution, and facilitate awareness of potential bug integration, and the far reaching scope of the problems, that even are tangled into ProjectBuilder itself leading to Kernel Panics. (Which I might add are adding to the defragmentation issue, which really is another problem nobody seems to be addressing, and avoiding like the plague.) From Zak (Your trying to be friendly, delegated Sh-t Disturber.) P.S. Right now it kind of seems as though one can only see their own Bug's status. I am suspectful that the global Bug Tracker has been disabled as if Apple is too embarrassed to admit that serious problems such as threading are not being address until many versions down the road. This seems like a terrible mistake to me if it has been removed from the public's eyes. I am also suggesting it be placed clearly on the http://bugreporter.apple.com web page (where I believe I saw it before). The bugreporter is one of the most critical areas especially in light of Darwin in which Apple is dependent on Developers showing them how things use to work properly in OpenStep and are now no longer working half as well or in some cases, such as NSThreads and NSConnections, they are not at all. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From rhind at orange.net Tue Aug 7 02:36:13 2001 From: rhind at orange.net (Russell Hind) Date: Thu Nov 3 14:47:03 2005 Subject: Gathering information running processes References: <2BF9F047-8A92-11D5-96E1-003065CBD1E2@apple.com> Message-ID: <00a301c11f24$1c038140$971410ac@MARYLEBONE> But that takes the fun out of it, doesn't it :) ----- Original Message ----- From: Eric Peyton Or you could just file enhancement request against process viewer :-) From thierrybucco at mac.com Tue Aug 7 02:52:16 2001 From: thierrybucco at mac.com (Thierry Bucco) Date: Thu Nov 3 14:47:03 2005 Subject: makeKeyAndOrderFront not for the main window Message-ID: <200108070955.EAA12777@adaro.host4u.net> Hi, I have 2 windows, I want to make the second window (not the main window) the key window when the user put my application in foreground (applicationWillBecomeActive notification) I use makeKeyAndOrderFront to put the second window in foreground, this one is shown but I have to click one more time on it to become active, how can I do to avoid this click ? thanks for your help. Thierry From gerard_iglesias at mac.com Tue Aug 7 02:54:35 2001 From: gerard_iglesias at mac.com (Gerard Iglesias) Date: Thu Nov 3 14:47:03 2005 Subject: Gathering information running processes In-Reply-To: <2BF9F047-8A92-11D5-96E1-003065CBD1E2@apple.com> Message-ID: <200108070952.CAA19187@smtpout.mac.com> Le Monday 6 August 2001, ? 07:40, Eric Peyton a ?crit : > > Or you could just file enhancement request against process viewer :-) Sure... It would be nice to be able to know when you want what are the most cpu consuming process under the mouse with some shortcut. Gerard -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 327 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010807/78826210/attachment.bin From mmeisel at uclink.berkeley.edu Tue Aug 7 03:10:54 2001 From: mmeisel at uclink.berkeley.edu (Michael Meisel) Date: Thu Nov 3 14:47:03 2005 Subject: Displaying incomplete images Message-ID: <200108071010.f77AApl31128@uclink4.berkeley.edu> Hi everyone, Is there any support for incomplete/partial images in NSImage? I'm trying to load pictures off of the web, and I'd like to show the portion that's been downloaded so far as the image loads, akin to a web browser. These images are usually jpegs, but I'd like to be able to do this with any type of image that NSImage supports. If there isn't any way to do this with Apple's framework, can someone direct me to the correct location in/usage of Omni's free source code for this? Thanks in Advance, Michael From kubernan at 10191.com Tue Aug 7 03:13:23 2001 From: kubernan at 10191.com (kubernan) Date: Thu Nov 3 14:47:03 2005 Subject: Keyboard focus Message-ID: <200108071013.DAA25668@omnigroup.com> Hum... Sorry for this simple question but... how to set up the keyboard focus of NSButton, NSTextField and so on ? I see nothing in the documentation for that .. Kub. From ocs at ocs.cz Tue Aug 7 03:31:38 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:03 2005 Subject: Modal problem In-Reply-To: <200108070202.f7721sN15564@smtp2.jaring.my> References: <200108070202.f7721sN15564@smtp2.jaring.my> Message-ID: <200108071033.AA15319@ocs.cz> K., >>>>>> K.K.Chan (KKC) wrote at Tue, 7 Aug 2001 09:57:35 +0800: KKC> Just to be sure, does it means the external controller (which is load by KKC> loadNibNamed) Is it? (it is if instantiated in NIB, I don't know whether it's your case) KKC> will be auto release later after the window is close ? It will not, just like the window is not released when closed (unless you explicitly specified so in the IB). KKC> I do not really like modal window or panel but given the nature of KKC> Cocoa, it is possible to open up many windows. For me, modal window KKC> forces the user to complete the input of data before doing other stuff. That's very true, just like the fact that _for user_ the modal window is always an annoyance (sometimes unavoidable, of course). KKC> menu --> file select --> page settings --> sub page settings KKC> (non modal) (modal) (modal) KKC> nib 1 nib 2 nib 3 KKC> KKC> At times when a window is "cramped" with many controls, (in this case KKC> "page settings"), it is KKC> desirable to move some of the control groupings into one or several KKC> windows. I do not know it is the best way to organize since there is not KKC> many Cocoa app to refer to. so far as I understand, a better model would be menu --> file select (modal file selector -- it should not be modal, incidentally, but that's a AppKit problem and not yours) --> window opened in default state (*) menu --> current window inspector containing page settings with as many "subpages" (in tabview or anything) as needed --> when clicked "OK", current window is restructured If possible, of course. (*) If it is desirable to be able to set something before window is opened, the NSOpenPanel's accessory view's the best place for that. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ssudre at intego.com Tue Aug 7 04:11:47 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:03 2005 Subject: makeKeyAndOrderFront not for the main window In-Reply-To: <200108070955.EAA12777@adaro.host4u.net> Message-ID: <1214939786-31940556@transeo.com> On mardi, ao?t 7, 2001, at 11:51 AM, Thierry Bucco wrote: > Hi, > > I have 2 windows, I want to make the second window (not the main > window) the key window when the user put my application in foreground > (applicationWillBecomeActive notification) > > I use makeKeyAndOrderFront to put the second window in foreground, this > one is shown but I have to click one more time on it to become active, > how can I do to avoid this click ? Is your second Window's "One Shot" flag enabled ? From ssudre at intego.com Tue Aug 7 04:19:16 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:03 2005 Subject: Gathering information running processes In-Reply-To: <200108070952.CAA19187@smtpout.mac.com> Message-ID: <1214939336-31967671@transeo.com> On mardi, ao?t 7, 2001, at 11:53 AM, Gerard Iglesias wrote: > Le Monday 6 August 2001, ? 07:40, Eric Peyton a ?crit : >> >> Or you could just file enhancement request against process viewer :-) > > Sure... > > It would be nice to be able to know when you want what are the most cpu > consuming process under the mouse with some shortcut. One great enhancement would be to use the shortcut 'Command + K' (K for Kill) instead of 'Shift + Command + Q' which is already used to logout (oh oh, I think I saw a bug). Let's go and use the Bat bug report page. From zak_ziggy at hotmail.com Tue Aug 7 05:09:36 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:03 2005 Subject: Bug Tracker ? I can not find it, please help. Message-ID: I did post the Source as you requested I hope that I have not made a really dump mistake, but this does work on OpenStep and OSX-1.2 fine, and fails on OSX. I would like some feedback about it and hope you help carry the flame, as it were to the crumbing (next)steps of Apple Headquarters, and into the hearts and minds of the average sterile unsuspecting consumers of plant earth, as well as those few rare and lucky enough to be development conscious beings in the universe, subscribed to macosx-dev@omnigroup.com. For those that may have missed the posting I can send it to you personally as requested, but it might become searchable in the omnigroup.com macosx-dev mail list archive. The BugApps have been uploaded to macosx-dev@omnigroup.com at about 4:44 am WestMex time, for those in the other groups interested. >From: Matt Watson >To: Zak Ziggy >CC: macosx-dev@omnigroup.com >Subject: Re: Bug Tracker ? I can not find it, please help. >Date: Tue, 7 Aug 2001 02:08:57 -0700 >MIME-Version: 1.0 (Apple Message framework v388) >Received: from [204.179.120.89] by hotmail.com (3.2) with ESMTP id >MHotMailBD38FB64007540043721CCB37859E2810; Tue, 07 Aug 2001 02:09:56 -0700 >Received: by smtpout.mac.com; Tue, 7 Aug 2001 02:08:57 -0700 (PDT) >Received: from asmtp01.mac.com ([10.13.10.65]) by >smtp-relay01.mac.com (Netscape Messaging Server 4.15 relay01 Jun >21 2001 23:53:48) with ESMTP id GHOXEX00.SHZ for >; Tue, 7 Aug 2001 02:08:57 -0700 >Received: from localhost ([65.12.13.236]) by asmtp01.mac.com >(Netscape Messaging Server 4.15 asmtp01 Jun 6 2001 13:16:42) with >ESMTP id GHOXEW00.AT4; Tue, 7 Aug 2001 02:08:56 -0700 >From mgw@mac.com Tue, 07 Aug 2001 02:10:58 -0700 >Message-Id: <200108070908.CAA21955@smtpout.mac.com> >X-Mailer: Apple Mail (2.388) >In-Reply-To: > >Could you post the code for an app that shows the threading bugs? > >matt. > >p.s. http://bugreporter.apple.com looks fine to me under Internet >Explorer. Ya after I sent many messages to devbugs@apple.com about it. They say they are changing it, but the only problem other then Updates of your own submissions, is the bug tracker seems to have disappeared from sight, it showed all the holes people have pointed out so far and the embarrassing responses from the technicians, saying "serious problem", "pushing to future release". Basically no plans to fix this exist or are going to be soon, without some heavy squeaking, ranting, complaining, and further public embarrassment, motivating a snowball effect of complaints. From Zak (Attack) Your Designated Friendly Sh-t Disturber ! Desparate for the solutions that were promised, but still not realized. P.S. More bread please, here try some yourself. Mmmmm... that's good crApple, can I have another one. _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From epeyton at epicware.com Tue Aug 7 05:47:39 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:03 2005 Subject: Gathering information running processes In-Reply-To: <1214939336-31967671@transeo.com> Message-ID: <5D277C66-8B32-11D5-84A1-003065CBD1E2@apple.com> Yes, please don't write bug/enhancements on this list. a) I don't own or work on Process Viewer.app, so I don't really care :-) b) Who knows if the person at Apple who does own it is on this list. c) Once they are in the bug database they can be tracked. On this list they can't. Write them up in the bug database as an enhancement request. Eric On Tuesday, August 7, 2001, at 06:19 AM, St?phane Sudre wrote: > > On mardi, ao?t 7, 2001, at 11:53 AM, Gerard Iglesias wrote: > >> Le Monday 6 August 2001, ? 07:40, Eric Peyton a ?crit : >>> >>> Or you could just file enhancement request against process viewer :-) >> >> Sure... >> >> It would be nice to be able to know when you want what are the >> most cpu consuming process under the mouse with some shortcut. > > One great enhancement would be to use the shortcut 'Command + K' > (K for Kill) instead of 'Shift + Command + Q' which is already > used to logout (oh oh, I think I saw a bug). > > Let's go and use the Bat bug report page. > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From epeyton at epicware.com Tue Aug 7 06:24:56 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:03 2005 Subject: Keyboard focus In-Reply-To: <200108071013.DAA25668@omnigroup.com> Message-ID: <8D11F8BC-8B37-11D5-84A1-003065CBD1E2@apple.com> You cannot setup keyboard focus for non-text input GUI elements in OS X 10.0.x. It has been disabled. To set up the keyboard focus chain, you can either programatically set it up using nextKeyView: or you can use connections in Interface Builder. Just Control-Drag between GUI elements in IB and connect the nextKeyView target. Make sure that you Control-drag from the window to the first GUI element and set the initialFirstResponder target as well. Eric On Tuesday, August 7, 2001, at 05:14 AM, kubernan wrote: > Hum... > Sorry for this simple question but... how to set up the keyboard > focus of > NSButton, NSTextField and so on ? > > I see nothing in the documentation for that .. > > Kub. > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From phillipm at truespectra.com Tue Aug 7 06:39:18 2001 From: phillipm at truespectra.com (Phillip Mills) Date: Thu Nov 3 14:47:03 2005 Subject: Running tasks as different user. In-Reply-To: <200108061913.f76JDBf24099@smtp.easystreet.com> Message-ID: On 8/6/01 3:13 PM, "Brant Vasilieff" wrote: > 1) Is there a function for returning a user's id besides wrapping it in > a task to call "id"? I'm not talking about getuid, but finding the id > of a specific user. > > I want my server to setuid to another user defined in a config file. > Similar to how apache does with switching to user "www". I want the > user to be able to compile and add plugins, and don't want those to have > access to either root or the other users data on the system. On Solaris I use getpwnam(), but I haven't tried it on Mac OS X. It's not documented in the 'man' pages -- which is no proof of anything -- however it exists in /usr/include/pwd.h. (The function on Solaris gives back a passwd record, containing a value that can then be used with setuid().) From ssudre at intego.com Tue Aug 7 06:44:51 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:03 2005 Subject: So many File Managers, so many questions... Message-ID: <1214930608-32492834@transeo.com> I'm currently having some doubts about File Management under OS X. On one layer, I have the POSIX/BSD stuff with its characters path and fopen, fread stuff. On another layer, I have CoreFoundation and CFURLRef. (Supports Unicode) On other layers, I have FSRef and NSURL and NSFileManager. (Supports Unicode) I confess I had not look in the source of fopen and all the Unix stuff such mkdir. Anyway from the Unix headers , it seems that the max length for a path is PATH_MAX (1024). This scheme might not have really been designed to handle Unicode filename. So supposing it's working - which I guess is the case -, using an Unicode encoding on 2 bytes gives me a new max length for a path of 512. As a Finder file name can be 256 Unicode characters wide, using fopen, I may only be able to describe a 1 folder hierarchy. Am I missing something huge ? For the moment being, I'm doing most of my file stuff with NSURL, CFURL and FSRef due to this annoying doubt. From ocs at ocs.cz Tue Aug 7 06:45:23 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:03 2005 Subject: makeKeyAndOrderFront not for the main window In-Reply-To: <1214939786-31940556@transeo.com> References: <1214939786-31940556@transeo.com> Message-ID: <200108071347.AA15515@ocs.cz> Stephane, >>>>>> Stephane Sudre (SS) wrote at Tue, 7 Aug 2001 13:12:13 +0200: SS> >I use makeKeyAndOrderFront to put the second window in foreground, this SS> >one is shown but I have to click one more time on it to become active, SS> >how can I do to avoid this click ? SS> SS> Is your second Window's "One Shot" flag enabled ? What should that be good for? The "one shot" means that the window device is destroyed when the window is closed (taken offscreen, more precisely). Seems to me quite independent on the problem... --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From TDeval at PrimeOBJ.COM Tue Aug 7 07:05:05 2001 From: TDeval at PrimeOBJ.COM (Thierry Deval) Date: Thu Nov 3 14:47:03 2005 Subject: looking for faster sqrt In-Reply-To: Message-ID: <200108071404.HAA05070@omnigroup.com> On Tuesday, August 7, 2001, at 10:36 , Marcel Weiher wrote: > > On Tuesday, August 7, 2001, at 03:13 Uhr, Timothy J. Wood wrote: > > >> On the PPC, many operations treat 'r0' as '0' rather than 'the >> contents of r0'. > > IIRC, the PPC architecture defines the contents of register 0 to always > be zero. Really ? How come that some compilers generate the following sequence to implement function entry stubs ? mfspr r0,lr ; Move from spec reg LinkReg to Reg0 : retrieve return address stmw r29,0xfff4(r1) ; Store multiple regs from Reg29 to addr(Reg1 - 12) : save on stack stw r0,0x8(r1) ; Store Reg0 to addr(Reg1 + 8) : save return address on stack stwu r1,0xffb0(r1) ; Store Reg1 to addr(Reg1 - 80) and update : reserve stack space and to return from : lwz r0,0x58(r1) ; Load Reg0 with content of addr(Reg1 + 88) : restore return address addi r1,r1,0x50 ; Set Reg1 += 80 : unlink stack mtspr lr,r0 ; Move Reg0 to spec reg LinkReg : prepare return lmw r29,0xfff4(r1) ; Load multiple regs from Reg29 from addr(Reg1 - 12) : restore regs blr ; Branch to instruction pointed by LinkReg : return from function This is usual to use r0 as a plain work register... If you want to load 0 into a register, you have the Load Immediate (li) instruction : li r0,0x0 ; takes a signed 16-bits value and extend to word size T. From wave at pixar.com Tue Aug 7 07:15:30 2001 From: wave at pixar.com (Michael B. Johnson) Date: Thu Nov 3 14:47:03 2005 Subject: anyone seen broken resize behavior in NSView subclass? In-Reply-To: <8D11F8BC-8B37-11D5-84A1-003065CBD1E2@apple.com> Message-ID: <200108071414.HAA25499@pixar.pixar.com> so somewhere in a recent revision of one of my classes I somehow managed to break the resizability of my NSView subclass when it's in a window. If I group it in a scrollview or splitter, it pays attention to its resize flags, but if it's just sitting in a window, or in a box, it doesn't resize. weird. as NSView subclasses go, it's got a fair amount of lines of code (~2.5K), so it's not leaping out at me what I've done (especially since I need a huge ground up rewrite between versions). I'm still digging around, but I'm wondering if anyone else seen this before; any hints what I might have screwed up? I print out my autoresizeFlags in awakeFromNib, and they're all being archived correctly... --> Michael B. Johnson, Ph.D. -- wave@pixar.com --> Studio Tools, Pixar Animation Studios --> http://xenia.media.mit.edu/~wave From infisys at po.jaring.my Tue Aug 7 07:30:23 2001 From: infisys at po.jaring.my (K.K.Chan) Date: Thu Nov 3 14:47:03 2005 Subject: Dissambling PPC and optimizing Message-ID: <200108071429.f77ETj005525@smtp1.jaring.my> Hello, I am looking a way to dump (disassemble) my Cocoa/C object code from Project Builder or command line. I really miss Code Warrior IDE's quick disassembling. Is there any web sites which deal with Power PC optimizing, not just Altivec but in general target for G3/G4 ? Best Regards, K.K.Chan From ian.cardenas at ultraviolent.com Tue Aug 7 07:41:14 2001 From: ian.cardenas at ultraviolent.com (Ian P. Cardenas) Date: Thu Nov 3 14:47:03 2005 Subject: Dissambling PPC and optimizing In-Reply-To: <200108071429.f77ETj005525@smtp1.jaring.my> Message-ID: On Tue, 7 Aug 2001, K.K.Chan wrote: > I am looking a way to dump (disassemble) my Cocoa/C object code > from Project Builder or command line. I really miss Code Warrior IDE's > quick disassembling. > if you add the '-S' flag to cc, you'll get a .s file which contains the assembly code. -- Ian P. Cardenas Computer Scientist, Software From avi_drissman at baseview.com Tue Aug 7 07:46:14 2001 From: avi_drissman at baseview.com (Avi Drissman) Date: Thu Nov 3 14:47:03 2005 Subject: r0 == 0? (was Re: looking for faster sqrt) In-Reply-To: References: Message-ID: At 10:36 AM +0200 8/7/01, Marcel Weiher wrote: >IIRC, the PPC architecture defines the contents of register 0 to >always be zero. Only in certain cases. For example, one of those cases is addi rD, rA, SIMM, which has the description in "PowerPC Microprocessor Family: The Programming Environments (32-bit)" of "The sum (rA|0) + SIMM is placed into rD." In that case, if rA is r0, then 0 is used instead. It's similar in cases such as lhz. But in other cases, it's not so. rlwimi, for example, uses the contents of r0 rather than 0. And it sometimes depends on subtle things. stb turns r0 into 0, while stbu doesn't. Nothing beats a good reference book. Avi "I <3 rlwimi" Drissman -- Avi Drissman avi_drissman@baseview.com Bit bashing since 1977 From wave at pixar.com Tue Aug 7 07:49:50 2001 From: wave at pixar.com (Michael B. Johnson) Date: Thu Nov 3 14:47:03 2005 Subject: anyone seen broken resize behavior in NSView subclass? In-Reply-To: <200108071414.HAA25499@pixar.pixar.com> Message-ID: <200108071449.HAA26465@pixar.pixar.com> sigh. I have a subliminal message encoded in my brain that stops me from seeing certain errors in my code until I've posted a question publicly. Thanks for your help; I figured it out. as Emily Litella used to say, "never mind". On Tuesday, August 7, 2001, at 07:11 AM, Michael B. Johnson wrote: > so somewhere in a recent revision of one of my classes I somehow > managed to break the resizability of my NSView subclass when it's in a > window. If I group it in a scrollview or splitter, it pays attention > to its resize flags, but if it's just sitting in a window, or in a box, > it doesn't resize. > > weird. > > as NSView subclasses go, it's got a fair amount of lines of code > (~2.5K), so it's not leaping out at me what I've done (especially > since I need a huge ground up rewrite between versions). > > I'm still digging around, but I'm wondering if anyone else seen this > before; any hints what I might have screwed up? I print out my > autoresizeFlags in awakeFromNib, and they're all being archived > correctly... > > --> Michael B. Johnson, Ph.D. -- wave@pixar.com --> Studio Tools, Pixar Animation Studios --> http://xenia.media.mit.edu/~wave > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From ocs at ocs.cz Tue Aug 7 07:55:41 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:03 2005 Subject: Dissambling PPC and optimizing In-Reply-To: <200108071429.f77ETj005525@smtp1.jaring.my> References: <200108071429.f77ETj005525@smtp1.jaring.my> Message-ID: <200108071458.AA15651@ocs.cz> K., >>>>>> K.K.Chan (KKC) wrote at Tue, 7 Aug 2001 22:25:20 +0800: KKC> I am looking a way to dump (disassemble) my Cocoa/C object code KKC> from Project Builder or command line. I really miss Code Warrior IDE's KKC> quick disassembling. In gdb, try 'help disass'. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ocs at ocs.cz Tue Aug 7 08:12:19 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:03 2005 Subject: Dissambling PPC and optimizing In-Reply-To: References: Message-ID: <200108071514.AA15679@ocs.cz> Ian, >>>>>> Ian P. Cardenas (IPC) wrote at Tue, 7 Aug 2001 08:40:25 -0600 (MDT): IPC> >I am looking a way to dump (disassemble) my Cocoa/C object code IPC> >from Project Builder or command line. I really miss Code Warrior IDE's IPC> >quick disassembling. IPC> > IPC> if you add the '-S' flag to cc, you'll get a .s file which contains the IPC> assembly code. Yep, but that does not look to me like "disassembling" ;))) As for my original message with gdb and its disass command, I forgot that otool can disassemble as well (man otool); it can be much more convenient sometimes. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ddavidso at apple.com Tue Aug 7 08:17:21 2001 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:47:03 2005 Subject: So many File Managers, so many questions... In-Reply-To: <1214930608-32492834@transeo.com> Message-ID: <5720A0AC-8B47-11D5-999C-000393115062@apple.com> On Tuesday, August 7, 2001, at 06:45 AM, St?phane Sudre wrote: > Am I missing something huge ? Yes. At the BSD level, all filenames are in UTF-8. Douglas Davidson From ddavidso at apple.com Tue Aug 7 08:26:08 2001 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:47:03 2005 Subject: Help with modifying NSTextView In-Reply-To: <200108070235.TAA07548@smtpout.mac.com> Message-ID: <95A6C70A-8B48-11D5-999C-000393115062@apple.com> On Monday, August 6, 2001, at 07:35 PM, Chris Elledge wrote: > 1) Is there a straight forward way to allow an NSTextView to have > different background colors for sections of text? I am currently using > setTextColor:range: to set the foreground color of the appropriate text > sections, but I have not come up with a good idea for applying > background colors. This text is not user editable, but I would like > select and copy to work on it (minus the colors most likely). Modify the underlying NSTextStorage. A text storage is an attributed string, and the relevant attributes are listed in the AppKit's NSAttributedString.h. Among them is NSBackgroundColorAttributeName. > 2) How can I intercept keyboard input going to an NSTextView? I would > like to be able to filter out certain key presses/ key combinations for > my own use before they reach the NSTextView. This relates to the key-binding system; look in NSResponder.h. The funnel point for key events before they go to key-binding or input management is interpretKeyEvents:. Afterwards they go either to insertText: (for typed characters) or to doCommandBySelector: (for keys that are bound to commands). Douglas Davidson -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1268 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010807/8267e764/attachment.bin From ocs at ocs.cz Tue Aug 7 08:29:01 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:03 2005 Subject: Retained items and autorelease pool Message-ID: <200108071531.AA15715@ocs.cz> Christian, >>>>>> Christian Mike (CM) wrote at Tue, 7 Aug 2001 08:50:32 -0500: CM> I am still trying to figure out memory management. I have some CM> initialization code scattered throughout many routines that I am wanting CM> to protect with an autorelease pool. What happens to myString in the CM> following example? CM> CM> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; CM> ... much code here... CM> ... in some subroutine somewhere: CM> // myString is a loose global variable, not a class member of CM> anything CM> myString = [[NSString stringWithCString:someString] retain]; CM> ... much other code here ... CM> ... back in earlier routine: CM> [pool release]; CM> CM> Did I just lose myString? If so, how do I allocate things that don't get CM> cleaned up by releasing the pool? Nope, you did not: 'retain' made it to survive (and if you won't release it later, it will leak). The thing's quite simple: myString keeps a reference count. It is incremented by retain, decremented by release. When it gets decremented to zero, the object is (inside of 'release' method) immediately deleted. So far we haven't mention autorelease. It DOES NOT DO ANYTHING with the retain count; instead, it places a reference to the object to the current autorelease pool. When _the pool_ is released, it sends release to all objects referenced there (decrementing thus actually their retain counts, and deallocation those of them which happen to have the r.c. of zero). Or, from other point of view: - alloc, copy, mutableCopy set retain count of the new object to 1, so they can be viewed "as if" they sent 'retain' internally; - 'autorelease' means that object _will get_ 'release' soon (let's for the moment forget the natural question 'how soon'); now, taking that into account: - if object got more 'retains' than 'releases', it remains in memory; - if object got as many 'releases' as 'retains', it is deleted (as soon as the last release is performed); - if object got more 'releases' than 'retains', program will crash ;) --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From kena at cs.colorado.edu Tue Aug 7 08:38:09 2001 From: kena at cs.colorado.edu (Ken Anderson) Date: Thu Nov 3 14:47:03 2005 Subject: makeKeyAndOrderFront not for the main window In-Reply-To: <200108070955.EAA12777@adaro.host4u.net> Message-ID: <200108071536.f77FaEQ30953@mroe.cs.colorado.edu> Hi Thierry, Have you tried making the widget where you want the keystrokes to appear the first responder? In my application, I have a situation where I need a window to pop up to the front and I want its textView object to become active. In order to avoid the "second click" that you talk about, I had to write code like this: window.makeKeyAndOrderFront(this); window.makeFirstResponder(document.getTextView()); The first line brings the window to the front, the second line makes its textView object the first responder. Then if I type characters, they appear in the textView object. Hope this helps, Ken On Tuesday, August 7, 2001, at 03:51 AM, Thierry Bucco wrote: > Hi, > > I have 2 windows, I want to make the second window (not the main window) > the key window when the user put my application in foreground > (applicationWillBecomeActive notification) > > I use makeKeyAndOrderFront to put the second window in foreground, this > one is shown but I have to click one more time on it to become active, > how can I do to avoid this click ? > > thanks for your help. > > Thierry > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From ssudre at intego.com Tue Aug 7 08:53:07 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:03 2005 Subject: So many File Managers, so many questions... In-Reply-To: <5720A0AC-8B47-11D5-999C-000393115062@apple.com> Message-ID: <1214922945-32953952@transeo.com> On mardi, ao?t 7, 2001, at 05:17 PM, Douglas Davidson wrote: > > On Tuesday, August 7, 2001, at 06:45 AM, St?phane Sudre wrote: > >> Am I missing something huge ? > > Yes. At the BSD level, all filenames are in UTF-8. Ah. Important fact. Does that mean that the MAX_PATH is in fact 1024 UniChars ? While making some tests, I found that issuing a cd to the fifth directory of a hierarchy whose directory name are 234 characters wide just kill the shell. So the MAX_PATH limit can be really problematic. From kena at cs.colorado.edu Tue Aug 7 09:07:04 2001 From: kena at cs.colorado.edu (Kenneth M. Anderson) Date: Thu Nov 3 14:47:03 2005 Subject: [REPOST]: addAttributeInRange horribly slow? Message-ID: <20010807100626-r01010700-866982a7-0910-0108@128.138.204.112> Hi, My initial post received no replies. Since I would really like help on this problem and I'm posting this message again. Please help! Ken ================================================== Hi, I'm working on a Java-based Cocoa application that occasionally must loop through an array of objects and for each object make a series of calls to addAttributeInRange. This is a method of the NSMutableAttributedString class, and, for this application, I'm making these calls on the textStorage object (which is a subclass of NSMutableAttributedString) of a textView interface widget. I have discovered that addAttributeInRange (and its counterpart, addAttributesInRange) is extremely slow. For instance, iterating over 25 objects takes about 30 seconds! Here is an outline of what I'm doing: ========================= textView.textStorage().beginEditing(); for each object in my array do { range = calculateRange(); text.addAttributeInRange("endpoint", e, range); text.addAttributeInRange( NSAttributedString.UnderlineStyleAttributeName, new Integer(NSAttributedString.SingleUnderlineStyle), range); text.addAttributeInRange( NSAttributedString.ForegroundColorAttributeName, NSColor.blueColor(), range); } textView.textStorage().endEditing(); ========================= So, I'm essentially underlining a text range, turning it blue, and associating a custom object for each object in my array. And this code is taking *forever* to execute. Using some primitive profiling techniques, I've determined that the bottleneck is addAttributeInRange. I tried switching to addAttributesInRange, which requires taking my three attributes and placing them in an NSMutableDictionary and passing that instead. This approach was just as slow. Can anyone provide feedback on how to speed this up? Thanks in advance, Ken ----------------------------------------------------------------------- Kenneth M. Anderson | Phone: 303-492-6003 Assistant Professor | Fax : 303-492-2844 Dept. of Computer Science | University of Colorado, Boulder | ----------------------------------------------------------------------- From chandler at nrlssc.navy.mil Tue Aug 7 09:32:16 2001 From: chandler at nrlssc.navy.mil (Howard Chandler) Date: Thu Nov 3 14:47:03 2005 Subject: ORBacou on OSX ? In-Reply-To: <200107222023.NAA07479@smtpout.mac.com> References: <200107222023.NAA07479@smtpout.mac.com> Message-ID: Has anyone compiled ORBacus for MAC OSX ? Was it straight forward or did you have to do alot to get it to work? Are there some other Corba packages out there that I should be looking at? Thanks Howard Chandler -- From erbronni at earthlink.net Tue Aug 7 09:59:59 2001 From: erbronni at earthlink.net (erbronni@earthlink.net) Date: Thu Nov 3 14:47:03 2005 Subject: ORBacou on OSX ? References: <200107222023.NAA07479@smtpout.mac.com> Message-ID: <3B701E1E.F59373AC@earthlink.net> TAO (The ACE Orb) available at http://www.cs.wustl.edu/~schmidt/TAO.html. It relies on ACE (http://www.cs.wustl.edu/~schmidt/ACE.html). I've compiled it and used it before on OSX, but the latest beta, 1.1.8, has given me link time errors that I need to resolve. (I think ORBacus might rely on a private version of ACE also, but don't quote me. Occasionally I see emails in the TAO mailing list about library conflicts with regards to interpretability.) I haven't tried MICO yet, http://www.mico.org, but that is another C++/CORBA implementation that I have had success with in the past. There is also ORBit, which is the GNOME CORBA implementation in C. -Eric Bronnimann Howard Chandler wrote: > > Has anyone compiled ORBacus for MAC OSX ? Was it straight forward or > did you have to do alot to get it to work? > > Are there some other Corba packages out there that I should be looking at? > > Thanks > > Howard Chandler > > -- > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From cottingham at mac.com Tue Aug 7 10:33:26 2001 From: cottingham at mac.com (Craig S. Cottingham) Date: Thu Nov 3 14:47:03 2005 Subject: looking for faster sqrt In-Reply-To: <200108071404.HAA05070@omnigroup.com> Message-ID: <200108071732.KAA17955@smtpout.mac.com> On Tuesday, August 7, 2001, at 10:36 , Marcel Weiher wrote: > On Tuesday, August 7, 2001, at 03:13 Uhr, Timothy J. Wood wrote: > >> On the PPC, many operations treat 'r0' as '0' rather than 'the >> contents of r0'. > > IIRC, the PPC architecture defines the contents of register 0 > to always be zero. According to both "PowerPC 601 RISC Microprocessor User's Manual" (page 2-6) and "PowerPC 603 RISC Microprocessor User's Manual" (page 2-5), GPR0 is a general-purpose register that can hold any 32-bit value. Were you perhaps thinking of instructions like "addi rD,rA,SIMM", where the value of the second operand is 0 if rA=0, else is is the contents of register A? -- Craig S. Cottingham cottingham@mac.com PGP key available from: ID=0xA2FFBE41, fingerprint=6AA8 2E28 2404 8A95 B8FC 7EFC 136F 0CEF A2FF BE41 From tjw at omnigroup.com Tue Aug 7 10:48:07 2001 From: tjw at omnigroup.com (Timothy J. Wood) Date: Thu Nov 3 14:47:03 2005 Subject: looking for faster sqrt In-Reply-To: Message-ID: <200108071748.KAA18192@omnigroup.com> On Tuesday, August 7, 2001, at 01:36 AM, Marcel Weiher wrote: > IIRC, the PPC architecture defines the contents of register 0 to always > be zero. Nope... you're thinking of MIPS, I think. Maybe other RISC machines do this too. PPC only does this in a few cases (those in the manual that say something like 'rA|0'). For an example, compare the 'lwzx' instruction to the 'add' instruction documentation. -tim From alex at mindlube.com Tue Aug 7 11:38:04 2001 From: alex at mindlube.com (Alex Rice) Date: Thu Nov 3 14:47:03 2005 Subject: printing concepts Message-ID: <200108071838.f77IcDC76347@taka.swcp.com> Hi, Can someone give me a pointer or some example code how to approach this problem? I have a NSTableView which I am printing. It prints fine. However, I want to add a header and footer for printing. The header and footer don't exist until print time. So I was thinking- OK in my printing method I will create a new NSTextView, and some sub-views to it, including my NSTableView, and then print the new NSTextView which will now contain the header, table and footer. The thing is that my then my tableview dissapears from my app's visible frame when the print panel runs- not what I indended. Am I on the right track here? TIA, Alex Rice From mmark at fivespeed.com Tue Aug 7 12:26:23 2001 From: mmark at fivespeed.com (Mason Mark) Date: Thu Nov 3 14:47:03 2005 Subject: So many File Managers, so many questions... In-Reply-To: <1214922945-32953952@transeo.com> References: <1214922945-32953952@transeo.com> Message-ID: <76820.997187130@[64.169.39.229]> --On Tuesday, August 7, 2001 5:52 PM +0200 St?phane Sudre wrote: > > On mardi, ao?t 7, 2001, at 05:17 PM, Douglas Davidson wrote: > >> >> On Tuesday, August 7, 2001, at 06:45 AM, St?phane Sudre wrote: >> >>> Am I missing something huge ? >> >> Yes. At the BSD level, all filenames are in UTF-8. > > Ah. Important fact. Does that mean that the MAX_PATH is in fact 1024 > UniChars ? No, its 1024 bytes. However, in UTF-8 (unlike NSUnicodeStringEncoding or other similar ones), a filename "This file is really a very long filename! Quite extended, in fact!" is still only 66 bytes, just like in ASCII... It might be a more serious limitation if all your file and directory names were in Kanji, or something (but then, Kanji and similar human text systems pack more info into fewer characters, so maybe not...) What are you doing that wants to have paths >1024 bytes, anyway? (Just out of curiousity.) -- Mason From shaxxerd at home.com Tue Aug 7 12:52:49 2001 From: shaxxerd at home.com (David Shaffer) Date: Thu Nov 3 14:47:03 2005 Subject: interface discovery Message-ID: <20010807195234.ITME27925.femail38.sdc1.sfba.home.com@localhost> in most java dev tools there is the ability to get method completion or a list of interfaces available for an object. what is the quickest way to discover interfaces that are available for an object in PB? From shaxxerd at home.com Tue Aug 7 12:54:24 2001 From: shaxxerd at home.com (David Shaffer) Date: Thu Nov 3 14:47:03 2005 Subject: finder APIs Message-ID: <20010807195419.IQJO863.femail28.sdc1.sfba.home.com@localhost> is there a way to use the indexes built by sherlock from w/in an application? where can i find some docs on how to use finder type features in an application? From RustyLittle at mac.com Tue Aug 7 13:38:13 2001 From: RustyLittle at mac.com (Rusty Little) Date: Thu Nov 3 14:47:04 2005 Subject: [Q] Security.framework APIs Message-ID: <200108072037.NAA28453@smtpout.mac.com> Has anyone used the security framework to send root privileges to another process (like a tool)? I easily got 'AuthorizationExecuteWithPrivileges()' to work to launch a tool with root access. However, Apple prefers we not use that unless you're working on an installer. It was mentioned at WWDC to use an "AuthorizationExternalForm" to pass access rights from one process to another, but I've had trouble getting it to work. Since there isn't any documentation yet, other than comments on the headers, I was hoping someone else might point me in the right direction. I'm sure I'm overlooking something, probably something obvious :) Any help would be greatly appreciated. Thanks in advance. Rusty From tsoslow at mac.com Tue Aug 7 13:45:18 2001 From: tsoslow at mac.com (Tim Soslow) Date: Thu Nov 3 14:47:04 2005 Subject: TextField Target (Newbie) Message-ID: <200108072044.NAA16657@smtpout.mac.com> I have a single text field that a user can enter keywords into and a search button completes the search to an internet search engine. I would like to be able to press "return" or "enter" within the text field to start the search button's method. I've tried using the textfield's target in IB, but that also calls the method when the text box is deselected which is not acceptable for my app. Is there any way to turn that part off or to programatically set the return and enter buttons in the text field? -Tim From epeyton at epicware.com Tue Aug 7 13:48:15 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:04 2005 Subject: [Q] Security.framework APIs In-Reply-To: <200108072037.NAA28453@smtpout.mac.com> Message-ID: <8012AC93-8B75-11D5-84DA-003065CBD1E2@apple.com> Check out the code to the autodiskmount server and disk arbitration framework in the darwin repository. I use AuthorizationExternalForm to send the security token generated in the standard user application (all Cocoa and Carbon applications) to the root daemon autodiskmount. Here is a little code sample ... Here is the code executed in the non-root application void SetSecure(void) { static int securityTokenPassed = 0; if (!securityTokenPassed) { AuthorizationRef ref; int error; int flags = kAuthorizationFlagPreAuthorize | kAuthorizationFlagPartialRights | kAuthorizationFlagExtendRights; error = AuthorizationCreate(NULL, NULL, flags, &ref); // printf("Passing security token err = %d\n", error); if (!error) { AuthorizationExternalForm externalForm; error = AuthorizationMakeExternalForm(ref, &externalForm); // printf("Making security pass err = %d\n", error); if (!error) { DiskArbSetSecuritySettingsForClient_rpc(gDiskArbSndPort, getpid(), externalForm.bytes); } } securityTokenPassed++; } return; } Of course, I am using mig to pass the parameters, you can use whatever is appropriate for you (mig, direct mach messages, DO, etc.) And in the receiver ... This recreates the authorization in the server and the authorization is stored with every client record ... kern_return_t DiskArbSetSecuritySettingsForClient_rpc ( mach_port_t server, pid_t pid, DiskArbSecurityToken token) { kern_return_t err = 0; ClientPtr clientPtr = LookupClientByPID( pid ); if (!clientPtr) { dwarning(("%s(pid=%d): no known client with this pid.\n", __FUNCTION__, pid)); err = -1; } else { AuthorizationRef ref; int ok = AuthorizationCreateFromExternalForm((const AuthorizationExternalForm *)token, &ref); if (0 == ok && ref) { dwarning(("%s Setting token for (pid=%d)\n", __FUNCTION__, pid)); // good clientPtr->clientAuthRef = ref; } else { // bad } } return err; } And then the authorization can be used in the server ... int authorizationAllowedForEvent(ClientPtr client, char *event) { OSStatus err = 0; int authorized = 0; AuthorizationRights rights; AuthorizationItem items[1]; if (!client->clientAuthRef) { return 0; } items[0].name = event; items[0].value = NULL; items[0].valueLength = 0; items[0].flags = 0; rights.count = 1; rights.items = items; err = AuthorizationCopyRights(client->clientAuthRef, &rights, kAuthorizationEmptyEnvironment, kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed, NULL); authorized = (errAuthorizationSuccess == err); return authorized; } Of course, much of this code will not make much sense without looking at the disk arbitration code (project DiskArbitration in the darwin cvs repository), but it should give you a pretty handy glimpse at what you can do. Eric On Tuesday, August 7, 2001, at 03:37 PM, Rusty Little wrote: > Has anyone used the security framework to send root privileges to > another process (like a tool)? > > I easily got 'AuthorizationExecuteWithPrivileges()' to work to > launch a tool with root access. However, Apple prefers we not use > that unless you're working on an installer. It was mentioned at > WWDC to use an "AuthorizationExternalForm" to pass access rights > from one process to another, but I've had trouble getting it to > work. Since there isn't any documentation yet, other than comments > on the headers, I was hoping someone else might point me in the > right direction. I'm sure I'm overlooking something, probably > something obvious :) > > Any help would be greatly appreciated. Thanks in advance. > > Rusty > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From rick at icons.cx Tue Aug 7 13:52:48 2001 From: rick at icons.cx (Rick Roe) Date: Thu Nov 3 14:47:04 2005 Subject: Displaying incomplete images In-Reply-To: <200108071010.f77AApl31128@uclink4.berkeley.edu> Message-ID: > Hi everyone, Is there any support for incomplete/partial images in NSImage? Nope. > can someone direct me to the correct location in/usage of Omni's free source > code for this? That would be the Omni Image Framework, or OIF. It's not listed in the descriptions on our Source Code page, but it's in the same FTP directory as the rest of our frameworks. -- Rick Roe icons.cx / The Omni Group From rick at icons.cx Tue Aug 7 13:55:51 2001 From: rick at icons.cx (Rick Roe) Date: Thu Nov 3 14:47:04 2005 Subject: TextField Target (Newbie) In-Reply-To: <200108072044.NAA16657@smtpout.mac.com> Message-ID: > I would like to be able to press "return" or "enter" within the text field to > start the search button's method. I've tried using the textfield's target in > IB, but that also calls the method when the text box is deselected which is > not acceptable for my app. > In the Attributes pane of the Info window you can set it so the text field sends its action message "only on enter". -- Rick Roe icons.cx / The Omni Group From deirdre at deirdre.net Tue Aug 7 15:01:43 2001 From: deirdre at deirdre.net (Deirdre Saoirse Moen) Date: Thu Nov 3 14:47:04 2005 Subject: Oracle and OS X In-Reply-To: References: Message-ID: At 2:59 PM -0700 8/6/01, Todd Blanchard wrote: >"...all future development work at Oracle will be done only on the Thin JDBC >Driver." > >IOW, no ObjectiveC (or just plain C) support and no tools. > >Thus, there is point in doing Cocoa apps that use Oracle on the back end. >If you have to work in Java, you might as well write using swing and get >Windows support at the same time. Well, the point of not using Oracle on the back end, if we do things right, will mean that eventually Oracle will get the point that JDBC is not the One True Way. After all, JDBC is relatively expensive compared to ODBC et al. Why not get the most out of your database? >That is the best development strategy. >What the hell is Apple's platform strategy group thinking? Is there evidence that there was thought involved? Or was it just buzzword compliance? -- _Deirdre Stash-o-Matic: http://fuzzyorange.com http://deirdre.net "Cannot run out of time.... Is infinite time. You... are finite.... Zathrus... is finite. This... is wrong tool!" -- Zathrus From shaxxerd at home.com Tue Aug 7 15:35:40 2001 From: shaxxerd at home.com (David Shaffer) Date: Thu Nov 3 14:47:04 2005 Subject: beginer qt question Message-ID: <20010807223532.GCGR29550.femail23.sdc1.sfba.home.com@localhost> i have.. @implementation QtController - (void) awakeFromNib { NSMovie *mov; id url; url = [NSURL initFileURLWithPath:@"/Volumes/maxtor2/MOV/test.mov"]; //- (id)initWithURL:(NSURL*)url // byReference:(BOOL)byRef mov = [NSMovie initWithURL:url byReference:FALSE]; [go seMovie:mov]; [go setLoopMode: 1]; [go start: self]; } @end .. basically, i just want a window to come up and play a movie.. i get the following exception when running.. Aug 07 16:31:17 SandBox[665] *** +[NSURL initFileURLWithPath:]: selector not recognized Aug 07 16:31:17 SandBox[665] AppKitJava: uncaught exception NSInvalidArgumentException (*** +[NSURL initFileURLWithPath:]: selector not recognized) Aug 07 16:31:17 SandBox[665] AppKitJava: exception = *** +[NSURL initFileURLWithPath:]: selector not recognized Aug 07 16:31:17 SandBox[665] AppKitJava: terminating. SandBox.app has exited with status 1. are there any simple examples of how to do these sort of things? i do not see any in the Developer folder. From R.Butler at lake.com.au Tue Aug 7 15:59:31 2001 From: R.Butler at lake.com.au (Roger Butler) Date: Thu Nov 3 14:47:04 2005 Subject: Altivec vector declarations under PB Message-ID: <2CFFFCDE74E9D4118CFD00902762A0E40660EE@NEXUS6> > I have a CodeWarrior project that I'm trying to port from OS9. It has > many declarations of the form: > > vector float vfZero = {0.0, 0.0, 0.0, 0.0}; > > but Project Builder is giving the errors: > incompatible types in initialization > warning: excess elements in scalar initializer > warning: (near initialization for 'vfZero') > > Any ideas on how to initialize a vector at compile time? > > Roger Butler. From aozer at apple.com Tue Aug 7 16:06:33 2001 From: aozer at apple.com (Ali Ozer) Date: Thu Nov 3 14:47:04 2005 Subject: String Encoding Format in .plist and in .strings file In-Reply-To: <10BE1F58-8A7F-11D5-855B-000502935EF5@apple.com> Message-ID: > XML property lists are in UTF-8. I believe you will even see the > notation encoding="UTF-8" on the first line. > > .strings files in the usual strings file format should be Unicode > files. We don't ship a specific strings file editor, but TextEdit will > open and save Unicode files just fine (make it plain text, and take a > look at the encoding popup in the save panel). In addition, genstrings, which can be used to generate development-language strings files from source code, generates Unicode (2 byte) strings files. Ali From mwatson at apple.com Tue Aug 7 16:11:49 2001 From: mwatson at apple.com (Matt Watson) Date: Thu Nov 3 14:47:04 2005 Subject: Altivec vector declarations under PB In-Reply-To: <2CFFFCDE74E9D4118CFD00902762A0E40660EE@NEXUS6> Message-ID: <200108072311.QAA12720@scv1.apple.com> Try: vector float vfZero = (vector float)(0.0, 0.0, 0.0, 0.0); matt. On Tuesday, August 7, 2001, at 04:01 PM, Roger Butler wrote: > >> I have a CodeWarrior project that I'm trying to port from OS9. It has >> many declarations of the form: >> >> vector float vfZero = {0.0, 0.0, 0.0, 0.0}; >> >> but Project Builder is giving the errors: >> incompatible types in initialization >> warning: excess elements in scalar initializer >> warning: (near initialization for 'vfZero') >> >> Any ideas on how to initialize a vector at compile time? >> >> Roger Butler. > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From RustyLittle at mac.com Tue Aug 7 16:16:19 2001 From: RustyLittle at mac.com (Rusty Little) Date: Thu Nov 3 14:47:04 2005 Subject: [Q] Security.framework APIs In-Reply-To: <8012AC93-8B75-11D5-84DA-003065CBD1E2@apple.com> Message-ID: <200108072312.QAA16001@smtpout.mac.com> Thanks Eric. I appreciate you taking the time to help out here. I used your code as a template. Unfortunately, I'm still not getting the results I'm looking for. I'm using Core Foundation to pass the AuthExternalForm and that works fine. The contents of the flatten data is the same on both ends. It seems to all be OK except when I call AuthCopyRights from within the tool, I don't get an error back, but I also don't gain the root privileges. Here's a summation of my code: // *** MyAppClass is the User app that passes root access to the tool *** OSStatus MyAppClass::GetRootPrivileges( AuthorizationExternalForm * pOutExtForm) { ........ // initialize an AuthorizationRef to use to get root privileges // that will be passed to the tool authRights.count = 0; authRights.items = NULL; authFlags = kAuthorizationFlagPreAuthorize | kAuthorizationFlagPartialRights | kAuthorizationFlagExtendRights; err = ::AuthorizationCreate(NULL, NULL, authFlags, &mAuthorization); if( ! err ) { // flatten the authorization so it can be sent to the tool err = ::AuthorizationMakeExternalForm(mAuthorization, pOutExtForm); } return err; } OSStatus MyAppClass::SendPrivileges( AuthorizationExternalForm * pAuthExtForm) { CFDataRef sentData; CFDataRef returnedData; if( mHasToolConnection ) { sentData = CFDataCreate(NULL, (const UInt8 *) &(pAuthExtForm->bytes), kAuthorizationExternalFormLength); err = CFMessagePortSendRequest(mMessagePort, kAuthExtFormMsg, sentData, kSendTimeoutValue, kWaitTimeoutValue, CFSTR("WAIT"), &returnedData); ........ ....... ....... return err; } // *** THIS IS THE CODE IN THE TOOL TO PROMOTE THE PRIVILEGES *** OSStatus ToolClass::PromotePrivileges( CFDataRef data) { AuthorizationExternalForm authExternForm; AuthorizationRights rights; AuthorizationItem items[1]; .... range.location = 0; range.length = CFDataGetLength(data); if( range.length == kAuthorizationExternalFormLength) { CFDataGetBytes(data, range, (UInt8 *) &(authExternForm.bytes)); err = AuthorizationCreateFromExternalForm((const AuthorizationExternalForm *) &(authExternForm.bytes), &mAuthRef); if( ! err ) { items[0].name = kAuthorizationRightExecute; // <-- this is "system.privilege. admin" items[0].value = NULL; items[0].valueLength = 0; items[0].flags = 0; rights.count = 1; rights.items = items; err = AuthorizationCopyRights(mAuthRef, &rights, kAuthorizationEmptyEnvironment, kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed, NULL); } .... } ..... } Now I noticed your "event" is a string like "system.volume.eject". I figured I should use the standard "admin" string. Other than the string in the authoriztion item, I don't see a lot of difference in our code. In my original code I had major differences in flags and some differences in arguments, but I've altered it to what you had to see if that would work. Still didn't. I don't expect hand holder here, but since there's no documentation, I'm having to make some educated guesses. That, of course, is so freaky not to know exactly what you are and are not supposed to do. So you might spot something that I've guessed at. Thanks again for your help!!!! Rusty On Tuesday, August 7, 2001, at 03:48 PM, Eric Peyton wrote: > Check out the code to the autodiskmount server and disk arbitration > framework in the darwin repository. I use AuthorizationExternalForm to > send the security token generated in the standard user application (all > Cocoa and Carbon applications) to the root daemon autodiskmount. Here > is a little code sample ... > > Here is the code executed in the non-root application > > void SetSecure(void) > { > static int securityTokenPassed = 0; > > if (!securityTokenPassed) { > AuthorizationRef ref; > int error; > > int flags = kAuthorizationFlagPreAuthorize | > kAuthorizationFlagPartialRights | kAuthorizationFlagExtendRights; > > error = AuthorizationCreate(NULL, NULL, flags, &ref); > > // printf("Passing security token err = %d\n", error); > > if (!error) { > AuthorizationExternalForm externalForm; > error = AuthorizationMakeExternalForm(ref, > &externalForm); > > // printf("Making security pass err = %d\n", > error); > > if (!error) { > > DiskArbSetSecuritySettingsForClient_rpc(gDiskArbSndPort, getpid(), > externalForm.bytes); > } > } > > securityTokenPassed++; > } > > return; > } > > Of course, I am using mig to pass the parameters, you can use whatever > is appropriate for you (mig, direct mach messages, DO, etc.) > > And in the receiver ... This recreates the authorization in the server > and the authorization is stored with every client record ... > > kern_return_t DiskArbSetSecuritySettingsForClient_rpc ( mach_port_t > server, pid_t pid, DiskArbSecurityToken token) > { > kern_return_t err = 0; > ClientPtr clientPtr = LookupClientByPID( pid ); > > if (!clientPtr) { > dwarning(("%s(pid=%d): no known client with this > pid.\n", __FUNCTION__, pid)); > err = -1; > } else { > AuthorizationRef ref; > int ok = AuthorizationCreateFromExternalForm((const > AuthorizationExternalForm *)token, &ref); > > if (0 == ok && ref) { > dwarning(("%s Setting token for (pid=%d)\n", > __FUNCTION__, pid)); > // good > clientPtr->clientAuthRef = ref; > > } else { > // bad > } > > > } > > return err; > > } > > And then the authorization can be used in the server ... > > int authorizationAllowedForEvent(ClientPtr client, char *event) > { > OSStatus err = 0; > int authorized = 0; > AuthorizationRights rights; > AuthorizationItem items[1]; > > if (!client->clientAuthRef) { > return 0; > } > > items[0].name = event; > items[0].value = NULL; > items[0].valueLength = 0; > items[0].flags = 0; > > rights.count = 1; > rights.items = items; > > err = AuthorizationCopyRights(client->clientAuthRef, &rights, > kAuthorizationEmptyEnvironment, kAuthorizationFlagExtendRights | > kAuthorizationFlagInteractionAllowed, NULL); > > authorized = (errAuthorizationSuccess == err); > > return authorized; > > } > > Of course, much of this code will not make much sense without looking > at the disk arbitration code (project DiskArbitration in the darwin cvs > repository), but it should give you a pretty handy glimpse at what you > can do. > > Eric > > On Tuesday, August 7, 2001, at 03:37 PM, Rusty Little wrote: > >> Has anyone used the security framework to send root privileges to >> another process (like a tool)? >> >> I easily got 'AuthorizationExecuteWithPrivileges()' to work to launch >> a tool with root access. However, Apple prefers we not use that unless >> you're working on an installer. It was mentioned at WWDC to use an >> "AuthorizationExternalForm" to pass access rights from one process to >> another, but I've had trouble getting it to work. Since there isn't >> any documentation yet, other than comments on the headers, I was >> hoping someone else might point me in the right direction. I'm sure >> I'm overlooking something, probably something obvious :) >> >> Any help would be greatly appreciated. Thanks in advance. >> >> Rusty >> _______________________________________________ >> MacOSX-dev mailing list >> MacOSX-dev@omnigroup.com >> http://www.omnigroup.com/mailman/listinfo/macosx-dev > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From cameron at topiaventures.com Tue Aug 7 17:06:36 2001 From: cameron at topiaventures.com (Cameron Bahan) Date: Thu Nov 3 14:47:04 2005 Subject: Distributed Object connections Message-ID: <200108080006.RAA06384@toxygen.topiaventures.com> A couple questions about distributed object communication. First, I have read the info on NSDistantObject and NSConnection which details out how to vend objects and retrieve vended objects. (1) Can not get distributed objects communicating across the network. (2) Don't fully understand the details behind the @protocol() which I am suppose to set. Details about the problem: During the opening of a connection: connection = [ NSConnection connectionWithRegisteredName:@"Server" host:@"*" ] ; You pass the name of the object ( "Server" in this case) and the host that it is suppose to be on. According to the documentation that I have read, if "*" is passed as the host it looks on the local network, if 'nil' is used it defaults to localhost, and I assume (wrong as I may be) that the string "207.107.92.141" will specify a specific machine while "localhost" will also specify the local machine (duplicating the results of 'nil'). However, when 'nil' is used the system works fine ... fast even. It provides great communication between separate applications. However, if an IP or "localhost" or "*" is used I get nothing. [ Having tried it on the local machine and remote machines ] I am completely confused as to why this is. Only possibly leaving out the "protocol" which I was suppose to set. [ Though it seemed to be a optional state providing network conservation ]. Honestly I could not figure out exactly what the protocol was defined to be, and I have not found any good documentation describing it - so information here would be nice as well. The code goes as follows: // CLIENT NSConnection *connection = nil ; connection = [ NSConnection connectionWithRegisteredName:@"Server" host:@"*" ] ; // The object 'client' is a pre-defined user interface tool if ( connection == nil ) [ client DisplayString:@"The connection failed." ] ; theProxy = [ [ connection rootProxy ] retain ] ; // This is suppose to save network traffic ... but not really sure what it is yet ! // [ theProxy setProtocolForProxy:@protocol(ServerProtocol)] ; // Make the call on the distant object if ( theProxy != nil ) { [ theProxy Test ] ; [ theProxy ConnectClient:client ] ; } else { [ client DisplayString:@"Did not return the Distant Object\n" ] ; } // SERVER NSConnection *connection = nil ; // allocate the linked object // Has both a Test method and a ConnectClient method defined theLink = [[ Linker alloc ] initArg:self ] ; printf ( "Publishing the linked object for clients.\n" ) ; connection = [ NSConnection defaultConnection ] ; [ connection setRootObject:theLink ] ; if ( [ connection registerName:@"Server"] == NO ) { printf ( "Vending the object failed.\n" ) ; } // --- END OF CODE Thanks in advance, Cameron Bahan From john at nisus.com Tue Aug 7 17:39:52 2001 From: john at nisus.com (jgo) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <200107150616.f6F6G9E15020@mail.brainstorm.co.uk> References: <02f250130230e71FE6@Mail6.nc.rr.com> Message-ID: > Richard Frith-Macdonald 2001-07-15 07:16:08 +0100 wrote: >> On Sunday, 2001 July 15 at 00:27, Mikey wrote: >> Where is the Cocoa queue container class (i.e. NSQueue)?... > I think NSMutableArray *is* the queue class. > > For small queues, an array implementation is for most purposes more > efficient than a linked list implementation in terms of both memory > use and speed. > > You have, the methods needed for queueing - objectAtIndex:0, lastObject, > insertObjectAtIndex:0, addObject, removeObjectAtIndex:0, removeLastObject > ... > I suspect that the people at NeXT thought it was better to keep the class > count in the Foundation down (and keep the API simpler to learn), than to > add a linked list queue implementation which would be very infrequently > used by most people... The implementation considerations are well-taken but it seems counter to object-oriented philosophy, i.e. to make the data and functions conform to the characteristics of the abstract view of the desired object. FIFO queues, LIFO stacks, linked lists, sparse linked-lists, dequeues, prioritized queues, and trees are all generally useful containers that best fit different circumstances. They were added to STLs because they're extremely reusable and dispense with a lot of grunt work that people need to do otherwise, decreasing the number of errors and time eaten. John G. Otto Nisus Software, Engineering www.infoclick.com www.mathhelp.com www.nisus.com software4usa.com EasyAlarms PowerSleuth NisusEMail NisusWriter MailKeeper QUED/M Will program Macs for food. From am at yline.com Tue Aug 7 17:50:05 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: Message-ID: <200108080050.CAA00784@am.homeip.net> On Tuesday, August 7, 2001, at 07:16 , jgo wrote: > The implementation considerations are well-taken but it seems > counter to object-oriented philosophy, i.e. to make the data and > functions conform to the characteristics of the abstract view of > the desired object. FIFO queues, LIFO stacks, linked lists, > sparse linked-lists, dequeues, prioritized queues, and trees > are all generally useful containers that best fit different > circumstances. They were added to STLs because they're extremely > reusable and dispense with a lot of grunt work that people need > to do otherwise, decreasing the number of errors and time eaten. I rather like to use a generic class for all tasks than reading the documentation for 20 mins for each array/queue I need (FIFO, LIFO...). When I need a container in Java (I never used STL), I first check the docs to find out which one fits the task best (usually none does), then I learn the API, then I use it. In Foundation I just use NSArray/NSMutableArray since I remember the API (because I always use the same methods). andy -- "He was addicted to life. But we cured him" From mmeisel at uclink.berkeley.edu Tue Aug 7 17:54:06 2001 From: mmeisel at uclink.berkeley.edu (Michael Meisel) Date: Thu Nov 3 14:47:04 2005 Subject: Displaying incomplete images In-Reply-To: Message-ID: <200108080054.f780s1520330@uclink4.berkeley.edu> I've been trying to incorporate OIF into my application, but I can't figure out how anything works. OIImage doesn't seem to do much of anything. Is there any sample code using OIF available, or would you be kind enough to give me a quick run down of displaying images with OIF? -Michael On Tuesday, August 7, 2001, at 01:52 PM, Rick Roe wrote: >> Hi everyone, Is there any support for incomplete/partial images in >> NSImage? > > Nope. > >> can someone direct me to the correct location in/usage of Omni's free >> source >> code for this? > > That would be the Omni Image Framework, or OIF. It's not listed in the > descriptions on our Source Code page, but it's in the same FTP > directory as > the rest of our frameworks. > > -- > Rick Roe > icons.cx / The Omni Group > From epeyton at epicware.com Tue Aug 7 18:06:16 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:04 2005 Subject: [Q] Security.framework APIs In-Reply-To: <200108072312.QAA28504@smtpout.mac.com> Message-ID: <8C1CB8A8-8B99-11D5-859B-003065CBD1E2@apple.com> On Tuesday, August 7, 2001, at 06:12 PM, Rusty Little wrote: > Thanks Eric. I appreciate you taking the time to help out here. I > used your code as a template. Unfortunately, I'm still not getting > the results I'm looking for. > > I'm using Core Foundation to pass the AuthExternalForm and that > works fine. The contents of the flatten data is the same on both > ends. It seems to all be OK except when I call AuthCopyRights from > within the tool, I don't get an error back, but I also don't gain > the root privileges. Applications cannot "gain root privileges". the unix stack in OS X does not allow that kind of thing. Your application either needs to a) be run by root (as autodiskmount is) or b) be installed setuid root or c) use the authorization to launch another application as root. This is intentional and cannot be changed. A user mode process cannot magically "become" root. Eric > > Here's a summation of my code: > > // *** MyAppClass is the User app that passes root access to the > tool *** > > OSStatus MyAppClass::GetRootPrivileges( > AuthorizationExternalForm * pOutExtForm) > { > ........ > > // initialize an AuthorizationRef to use to get root privileges > // that will be passed to the tool > authRights.count = 0; > authRights.items = NULL; > > authFlags = kAuthorizationFlagPreAuthorize | > kAuthorizationFlagPartialRights > | kAuthorizationFlagExtendRights; > > err = ::AuthorizationCreate(NULL, NULL, authFlags, &mAuthorization); > if( ! err ) > { > // flatten the authorization so it can be sent to the tool > err = ::AuthorizationMakeExternalForm(mAuthorization, pOutExtForm); > } > > return err; > } > > OSStatus MyAppClass::SendPrivileges( > AuthorizationExternalForm * pAuthExtForm) > { > CFDataRef sentData; > CFDataRef returnedData; > > if( mHasToolConnection ) > { > sentData = CFDataCreate(NULL, (const UInt8 *) > &(pAuthExtForm->bytes), > kAuthorizationExternalFormLength); > > err = CFMessagePortSendRequest(mMessagePort, > kAuthExtFormMsg, sentData, > kSendTimeoutValue, kWaitTimeoutValue, > CFSTR("WAIT"), &returnedData); > ........ > ....... > ....... > return err; > } > > // *** THIS IS THE CODE IN THE TOOL TO PROMOTE THE PRIVILEGES *** > > OSStatus ToolClass::PromotePrivileges( > CFDataRef data) > { > AuthorizationExternalForm authExternForm; > AuthorizationRights rights; > AuthorizationItem items[1]; > .... > > range.location = 0; > range.length = CFDataGetLength(data); > if( range.length == kAuthorizationExternalFormLength) > { > CFDataGetBytes(data, range, (UInt8 *) &(authExternForm.bytes)); > > err = AuthorizationCreateFromExternalForm((const > AuthorizationExternalForm *) > &(authExternForm.bytes), &mAuthRef); > > if( ! err ) > { > items[0].name = kAuthorizationRightExecute; // <-- this is "system.privilege. > admin" > items[0].value = NULL; > items[0].valueLength = 0; > items[0].flags = 0; > > rights.count = 1; > rights.items = items; > > err = AuthorizationCopyRights(mAuthRef, &rights, > kAuthorizationEmptyEnvironment, > kAuthorizationFlagExtendRights | > kAuthorizationFlagInteractionAllowed, NULL); > } > .... > } > ..... > } > > > > Now I noticed your "event" is a string like "system.volume.eject". > I figured I should use the standard "admin" string. Other than the > string in the authoriztion item, I don't see a lot of difference > in our code. In my original code I had major differences in flags > and some differences in arguments, but I've altered it to what you > had to see if that would work. Still didn't. I don't expect hand > holder here, but since there's no documentation, I'm having to > make some educated guesses. That, of course, is so freaky not to > know exactly what you are and are not supposed to do. So you might > spot something that I've guessed at. > > Thanks again for your help!!!! > > Rusty > > > On Tuesday, August 7, 2001, at 03:48 PM, Eric Peyton wrote: > >> Check out the code to the autodiskmount server and disk >> arbitration framework in the darwin repository. I use >> AuthorizationExternalForm to send the security token generated in >> the standard user application (all Cocoa and Carbon applications) >> to the root daemon autodiskmount. Here is a little code >> sample ... >> >> Here is the code executed in the non-root application >> >> void SetSecure(void) >> { >> static int securityTokenPassed = 0; >> >> if (!securityTokenPassed) { >> AuthorizationRef ref; >> int error; >> >> int flags = kAuthorizationFlagPreAuthorize | >> kAuthorizationFlagPartialRights | kAuthorizationFlagExtendRights; >> >> error = AuthorizationCreate(NULL, NULL, flags, &ref); >> >> // printf("Passing security token err = %d\n", error); >> >> if (!error) { >> AuthorizationExternalForm externalForm; >> error = >> AuthorizationMakeExternalForm(ref, &externalForm); >> >> // printf("Making security pass err = >> %d\n", error); >> >> if (!error) { >> >> DiskArbSetSecuritySettingsForClient_rpc(gDiskArbSndPort, >> getpid(), externalForm.bytes); >> } >> } >> >> securityTokenPassed++; >> } >> >> return; >> } >> >> Of course, I am using mig to pass the parameters, you can use >> whatever is appropriate for you (mig, direct mach messages, DO, >> etc.) >> >> And in the receiver ... This recreates the authorization in the >> server and the authorization is stored with every client >> record ... >> >> kern_return_t DiskArbSetSecuritySettingsForClient_rpc >> ( mach_port_t server, pid_t pid, DiskArbSecurityToken token) >> { >> kern_return_t err = 0; >> ClientPtr clientPtr = LookupClientByPID( pid ); >> >> if (!clientPtr) { >> dwarning(("%s(pid=%d): no known client with this >> pid.\n", __FUNCTION__, pid)); >> err = -1; >> } else { >> AuthorizationRef ref; >> int ok = >> AuthorizationCreateFromExternalForm((const >> AuthorizationExternalForm *)token, &ref); >> >> if (0 == ok && ref) { >> dwarning(("%s Setting token for >> (pid=%d)\n", __FUNCTION__, pid)); >> // good >> clientPtr->clientAuthRef = ref; >> >> } else { >> // bad >> } >> >> >> } >> >> return err; >> >> } >> >> And then the authorization can be used in the server ... >> >> int authorizationAllowedForEvent(ClientPtr client, char *event) >> { >> OSStatus err = 0; >> int authorized = 0; >> AuthorizationRights rights; >> AuthorizationItem items[1]; >> >> if (!client->clientAuthRef) { >> return 0; >> } >> >> items[0].name = event; >> items[0].value = NULL; >> items[0].valueLength = 0; >> items[0].flags = 0; >> >> rights.count = 1; >> rights.items = items; >> >> err = AuthorizationCopyRights(client->clientAuthRef, >> &rights, kAuthorizationEmptyEnvironment, >> kAuthorizationFlagExtendRights | >> kAuthorizationFlagInteractionAllowed, NULL); >> >> authorized = (errAuthorizationSuccess == err); >> >> return authorized; >> >> } >> >> Of course, much of this code will not make much sense without >> looking at the disk arbitration code (project DiskArbitration in >> the darwin cvs repository), but it should give you a pretty handy >> glimpse at what you can do. >> >> Eric >> >> On Tuesday, August 7, 2001, at 03:37 PM, Rusty Little wrote: >> >>> Has anyone used the security framework to send root privileges to >>> another process (like a tool)? >>> >>> I easily got 'AuthorizationExecuteWithPrivileges()' to work to >>> launch a tool with root access. However, Apple prefers we not use >>> that unless you're working on an installer. It was mentioned at >>> WWDC to use an "AuthorizationExternalForm" to pass access rights >>> from one process to another, but I've had trouble getting it to >>> work. Since there isn't any documentation yet, other than >>> comments on the headers, I was hoping someone else might point me >>> in the right direction. I'm sure I'm overlooking something, >>> probably something obvious :) >>> >>> Any help would be greatly appreciated. Thanks in advance. >>> >>> Rusty >>> _______________________________________________ >>> MacOSX-dev mailing list >>> MacOSX-dev@omnigroup.com >>> http://www.omnigroup.com/mailman/listinfo/macosx-dev >> >> _______________________________________________ >> MacOSX-dev mailing list >> MacOSX-dev@omnigroup.com >> http://www.omnigroup.com/mailman/listinfo/macosx-dev >> From bwebster at owlnet.rice.edu Tue Aug 7 18:07:57 2001 From: bwebster at owlnet.rice.edu (Brian Webster) Date: Thu Nov 3 14:47:04 2005 Subject: beginer qt question In-Reply-To: <200108080024.RAA22037@lists.omnigroup.com> Message-ID: <200108080107.f7817Rf17194@marsh.owlnet.rice.edu> On Tuesday, August 7, 2001, at 07:24 PM, macosx-dev- request@omnigroup.com wrote: > i have.. > > @implementation QtController > - (void) awakeFromNib > { > NSMovie *mov; > id url; > > url = [NSURL > initFileURLWithPath:@"/Volumes/maxtor2/MOV/test.mov"]; > > //- (id)initWithURL:(NSURL*)url > // byReference:(BOOL)byRef > mov = [NSMovie initWithURL:url byReference:FALSE]; > [go seMovie:mov]; > [go setLoopMode: 1]; > [go start: self]; > } > @end > > > .. basically, i just want a window to come up and play a movie.. i get > the following exception when running.. > > Aug 07 16:31:17 SandBox[665] *** +[NSURL initFileURLWithPath:]: > selector > not recognized Your problem here is that you're sending an init message to the NSURL class object. You should either allocate a new object and then initialize it... url = [[NSURL alloc] initFileURLWithPath:@"/Volumes/maxtor2/MOV/test.mov"]; ... or you can use the convenience method... url = [NSURL fileURLWithPath:@"/Volumes/maxtor2/MOV/test.mov"]; ... which will autorelease the url for you. If you use the first method, you should release url at the end of your method so it doesn't leak. -- Brian Webster bwebster@owlnet.rice.edu http://www.owlnet.rice.edu/~bwebster From charles at okito.net Tue Aug 7 20:46:53 2001 From: charles at okito.net (Charles Jolley) Date: Thu Nov 3 14:47:04 2005 Subject: Help with modifying NSTextView In-Reply-To: <200108070235.TAA07548@smtpout.mac.com> Message-ID: <200108080344.f783iNI13428@krunk.okito.net> > 1) Is there a straight forward way to allow an NSTextView to have > different background colors for sections of text? I am currently using > setTextColor:range: to set the foreground color of the appropriate text > sections, but I have not come up with a good idea for applying > background colors. This text is not user editable, but I would like > select and copy to work on it (minus the colors most likely). > Hi Chris: I have done some things similar to this by using the temporary attributes methods in the NSLayoutManager class (see -addTemporaryAttributes: forCharacterRange:) Unlike modifying the NSTextStorage directly, this will only show up in the display, not when you copy text, etc., which works on the TextStorage. Try something like: [yourLayoutManager addTemporaryAttributes: [NSDictionary dictionaryWithObject: [NSColor redColor] forKey: NSBackgroundColorAttributeName] forCharacterRange: yourRange] ; You can remove these attributes using the -removeTemporaryAttribute: forCharacterRange: For example: [yourLayoutManager removeTemporaryAttribute: NSBackgroundColorAttributeName forCharacterRange: yourRange] ; Hope that helps. Cheers, -Charles From anarkhos at mac.com Tue Aug 7 23:14:45 2001 From: anarkhos at mac.com (strobe anarkhos) Date: Thu Nov 3 14:47:04 2005 Subject: finder APIs In-Reply-To: <20010807195419.IQJO863.femail28.sdc1.sfba.home.com@localhost> References: <20010807195419.IQJO863.femail28.sdc1.sfba.home.com@localhost> Message-ID: At 1:54 PM -0600 8/7/01, David Shaffer wrote: >is there a way to use the indexes built by sherlock from w/in an application? where can i find some docs on how to use finder type features in an application? http://developer.apple.com/technotes/tn/tn1180.html From kubernan at 10191.com Wed Aug 8 01:54:11 2001 From: kubernan at 10191.com (kubernan) Date: Thu Nov 3 14:47:04 2005 Subject: Distributed Object connections In-Reply-To: <200108080006.RAA06384@toxygen.topiaventures.com> Message-ID: <200108080854.BAA02802@omnigroup.com> Some responses from my e-mail database : -------- Response from Apple : Others have given some more complete answers, but another reason this doesn't work is the port name server you're using. The default port name server only does naming service (1) for a type of NSPort transport (NSMachPort) which works within the machine only and (2) does it in such a way that it named lookup can only be done within a machine. (A subtle distinction not worth worrying about). You need to use NSSocketPorts as the NSConnection ports, and create the connection with -initWithReceivePort:sendPort: (or whatever the name of the method is). I will forward a followup mail message to this list with an example I created several months ago. -------- in omnigroup mail archive : I believe you have to construct a port from an NSSocket. Here's a couple of snippets of code I wrote a while back that I know worked. Server: NSSocketPort *port = [[NSSocketPort alloc] initWithTCPPort:SERVER_PORT]; NSConnection *theConnection = [NSConnection connectionWithReceivePort:port sendPort:nil]; Client: NSSocketPort *port = [[NSSocketPort alloc] initRemoteWithTCPPort:SERVER_PORT host:@"172.24.81.250"]; NSConnection *connection = [NSConnection connectionWithReceivePort:nil sendPort:port]; ----------- Hope this help you. Kub. Le mercredi 8 ao?t 2001, ? 02:05, Cameron Bahan a ?crit : > A couple questions about distributed object communication. First, I > have read the info on NSDistantObject and NSConnection which details > out how to vend objects and retrieve vended objects. > > (1) Can not get distributed objects communicating across the network. > (2) Don't fully understand the details behind the @protocol() which I > am suppose to set. > > Details about the problem: > During the opening of a connection: > connection = [ NSConnection > connectionWithRegisteredName:@"Server" host:@"*" ] ; > You pass the name of the object ( "Server" in this case) and the host > that it is suppose to be on. According to the documentation that I > have read, if "*" is passed as the host it looks on the local network, > if 'nil' is used it defaults to localhost, and I assume (wrong as I may > be) that the string "207.107.92.141" will specify a specific machine > while "localhost" will also specify the local machine (duplicating the > results of 'nil'). > > However, when 'nil' is used the system works fine ... fast even. It > provides great communication between separate applications. However, > if an IP or "localhost" or "*" is used I get nothing. [ Having tried it > on the local machine and remote machines ] > > I am completely confused as to why this is. Only possibly leaving out > the "protocol" which I was suppose to set. [ Though it seemed to be a > optional state providing network conservation ]. Honestly I could not > figure out exactly what the protocol was defined to be, and I have not > found any good documentation describing it - so information here would > be nice as well. > > The code goes as follows: > > // CLIENT > > NSConnection *connection = nil ; > > connection = [ NSConnection > connectionWithRegisteredName:@"Server" host:@"*" ] ; > > // The object 'client' is a pre-defined user interface tool > if ( connection == nil ) > [ client DisplayString:@"The connection failed." ] ; > > theProxy = [ [ connection rootProxy ] retain ] ; > > // This is suppose to save network traffic ... but not really sure > what it is yet ! > // [ theProxy setProtocolForProxy:@protocol(ServerProtocol)] ; > > // Make the call on the distant object > if ( theProxy != nil ) > { > [ theProxy Test ] ; > [ theProxy ConnectClient:client ] ; > } > else > { > [ client DisplayString:@"Did not return the Distant Object\n" ] ; > } > > // SERVER > > NSConnection *connection = nil ; > > // allocate the linked object > // Has both a Test method and a ConnectClient method defined > theLink = [[ Linker alloc ] initArg:self ] ; > > printf ( "Publishing the linked object for clients.\n" ) ; > > connection = [ NSConnection defaultConnection ] ; > [ connection setRootObject:theLink ] ; > > if ( [ connection registerName:@"Server"] == NO ) > { > printf ( "Vending the object failed.\n" ) ; > } > > > // --- END OF CODE > > > Thanks in advance, > Cameron Bahan > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From ocs at ocs.cz Wed Aug 8 02:05:28 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: References: <02f250130230e71FE6@Mail6.nc.rr.com> Message-ID: <200108080906.AA16477@ocs.cz> jgo, >>>>>> jgo (j) wrote at Tue, 7 Aug 2001 10:16:27 -0700: j> The implementation considerations are well-taken but it seems j> counter to object-oriented philosophy, i.e. to make the data and j> functions conform to the characteristics of the abstract view of j> the desired object. FIFO queues, LIFO stacks, linked lists, j> sparse linked-lists, dequeues, prioritized queues, and trees j> are all generally useful containers that best fit different j> circumstances. They were added to STLs because they're extremely j> reusable and dispense with a lot of grunt work that people need j> to do otherwise, decreasing the number of errors and time eaten. Nope. The reasonable OO philosophy does not make a new class for each trifle; quite contrariwise, it heavily supports reusability. Foundation Kit is an excellent example, since its fifty-odd classes offer much more power than hundreds and hundreds of classes from an average C++ kit. Actually, it decreases the number of errors and increases effectivity *MIGHTILY*, since you don't need to worry with slightly different APIs of ten slightly different classes: just you use the one well-known API and that's that. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ssudre at intego.com Wed Aug 8 02:52:57 2001 From: ssudre at intego.com (=?iso-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:47:04 2005 Subject: So many File Managers, so many questions... In-Reply-To: <76820.997187130@[64.169.39.229]> Message-ID: <1214858114-36855152@transeo.com> On mardi, ao?t 7, 2001, at 09:25 PM, Mason Mark wrote: > > > --On Tuesday, August 7, 2001 5:52 PM +0200 St?phane Sudre > wrote: > >> >> On mardi, ao?t 7, 2001, at 05:17 PM, Douglas Davidson wrote: >> >>> >>> On Tuesday, August 7, 2001, at 06:45 AM, St?phane Sudre wrote: >>> >>>> Am I missing something huge ? >>> >>> Yes. At the BSD level, all filenames are in UTF-8. >> >> Ah. Important fact. Does that mean that the MAX_PATH is in fact 1024 >> UniChars ? > > No, its 1024 bytes. > > However, in UTF-8 (unlike NSUnicodeStringEncoding or other similar > ones), a filename "This file is really a very long filename! Quite > extended, in fact!" is still only 66 bytes, just like in ASCII... > > It might be a more serious limitation if all your file and directory > names were in Kanji, or something (but then, Kanji and similar human > text systems pack more info into fewer characters, so maybe not...) > > What are you doing that wants to have paths >1024 bytes, anyway? (Just > out of curiousity.) The user can select a location to save some documents. I need to save this location. One way to save this location is to save its path (pro: portable cons: a lot). It allows me to use some fopen, fread, fwrite stuff too (portability considerations) Knowing users, the limits case is always reached so it's a little problematic to use this solution. Moreover I need to take into consideration Japanese users (I'm in a Localization questioning period). The solution I'm currently thinking about is to use a char buffer path, build a CFStringRef from it, build a CFURLRef from the CFStringRef and finally a FSRef from the CFURLRef so that I can use some -not limited- calls. But so far for portability and pure CoreFoundation stuff. The limited path question is interesting too on the Cocoa side since the NSOpenPanel is sending you back a NSString to describe the path. I tend to believe that some softwares are using this NSString path to get a C string path and then use fopen, fread, fwrite and fclose which is going to lead to a potential bug. From john at toastedmarshmallow.com Wed Aug 8 03:36:38 2001 From: john at toastedmarshmallow.com (=?iso-8859-1?Q?John_H=F6rnkvist?=) Date: Thu Nov 3 14:47:04 2005 Subject: Distributed Object connections In-Reply-To: <200108080006.RAA06384@toxygen.topiaventures.com> Message-ID: <20010808103534.474E011C00D@fimail01.cabinet.net> On Wednesday, August 8, 2001, at 02:05 AM, Cameron Bahan wrote: > (2) Don't fully understand the details behind the @protocol() which I > am suppose to set. Setting a protocol is an optimization. From vague memory, it lets the client gather the argument/return data correctly without having to send a methodSignatureForSelector: to the server. @protocol MyServiceProtocol - (oneway void) doSomethingAsynchronous; - (void) doSomethingWithArgument:(id)anArgument ; - (id)doSomethingElse; @end @interface MyServer:NSObject // The protocol - (oneway void) doSomethingAsynchronous; - (void) doSomethingWithArgument:(id)anArgument ; - (id)doSomethingElse; // Stuff the clients don't have to know about - (void)myLocalMethod; @end The protocol has two functions; at compile time it helps type checking, and at run time it helps performance. (You can also use a protocol in the server with a secondary proxy (NSProtocolChecker) to limit the services you hand out, this can provide some insulation between client and server.) Regards, John Hornkvist -- ToastedMarshmallow, the perfect Cocoa companion http://www.toastedmarshmallow.com From chris.ridd at messagingdirect.com Wed Aug 8 04:07:28 2001 From: chris.ridd at messagingdirect.com (Chris Ridd) Date: Thu Nov 3 14:47:04 2005 Subject: So many File Managers, so many questions... In-Reply-To: <1214858114-36855152@transeo.com> Message-ID: <314460000.997268800@bagheera.isode.com> St?phane Sudre wrote: > > On mardi, ao?t 7, 2001, at 09:25 PM, Mason Mark wrote: > >> >> >> --On Tuesday, August 7, 2001 5:52 PM +0200 St?phane Sudre >> wrote: >> >>> >>> On mardi, ao?t 7, 2001, at 05:17 PM, Douglas Davidson wrote: >>> >>>> >>>> On Tuesday, August 7, 2001, at 06:45 AM, St?phane Sudre wrote: >>>> >>>>> Am I missing something huge ? >>>> >>>> Yes. At the BSD level, all filenames are in UTF-8. >>> >>> Ah. Important fact. Does that mean that the MAX_PATH is in fact 1024 >>> UniChars ? >> >> No, its 1024 bytes. >> >> However, in UTF-8 (unlike NSUnicodeStringEncoding or other similar >> ones), a filename "This file is really a very long filename! Quite >> extended, in fact!" is still only 66 bytes, just like in ASCII... >> >> It might be a more serious limitation if all your file and directory >> names were in Kanji, or something (but then, Kanji and similar human >> text systems pack more info into fewer characters, so maybe not...) >> >> What are you doing that wants to have paths >1024 bytes, anyway? (Just >> out of curiousity.) > > The user can select a location to save some documents. I need to save > this location. > > One way to save this location is to save its path (pro: portable cons: a > lot). It allows me to use some fopen, fread, fwrite stuff too > (portability considerations) > > Knowing users, the limits case is always reached so it's a little > problematic to use this solution. Moreover I need to take into > consideration Japanese users (I'm in a Localization questioning period). > > The solution I'm currently thinking about is to use a char buffer path, > build a CFStringRef from it, build a CFURLRef from the CFStringRef and > finally a FSRef from the CFURLRef so that I can use some -not limited- > calls. But so far for portability and pure CoreFoundation stuff. > > The limited path question is interesting too on the Cocoa side since the > NSOpenPanel is sending you back a NSString to describe the path. I tend > to believe that some softwares are using this NSString path to get a C > string path and then use fopen, fread, fwrite and fclose which is going > to lead to a potential bug. Whatever fopen uses internally (ie open()) will fail if you give it a pathname that's too long, and set errno appropriately (maybe ERANGE). If you aren't handling fopen failures, then that's a big problem right there :-) What exactly does this limitation apply to, anyway? POSIX doesn't define a maximum size for *complete* pathnames, but it does let you find out a maximum size for pathnames *relative* to some directory. eg pathconf("/path/to/some/directory", _PC_PATH_MAX); It also lets you find out a maximum size for a filename in some directory: pathconf("/path/to/some/directory", _PC_NAME_MAX); Cheers, Chris From chmod007 at mac.com Wed Aug 8 04:16:03 2001 From: chmod007 at mac.com (David Remahl) Date: Thu Nov 3 14:47:04 2005 Subject: overriding cocoa classes globally Message-ID: This page contains information on how to hook into Foundation framework to do lots of interesting explorations. Check it out! http://www.cocoadev.com/index.pl?GlobalModifications / David Remahl From classic at sover.net Wed Aug 8 05:18:31 2001 From: classic at sover.net (Morgan Aldridge) Date: Thu Nov 3 14:47:04 2005 Subject: Screen resize events Message-ID: <20010808121239.15370@mail.sover.net> Can anyone describe how to get screen resize events of some kind? Mac OS X will automatically scale my windows down, but it mangles the placement when going back to the higher resolution, so I'd like to handle it myself. Morgan From epeyton at epicware.com Wed Aug 8 05:43:09 2001 From: epeyton at epicware.com (Eric Peyton) Date: Thu Nov 3 14:47:04 2005 Subject: Screen resize events In-Reply-To: <20010808121239.15370@mail.sover.net> Message-ID: Register for the NSApplication notification NSApplicationDidChangeScreenParametersNotification. Then use the new NSScreen settings to move your windows around. Eric On Wednesday, August 8, 2001, at 07:12 AM, Morgan Aldridge wrote: > Can anyone describe how to get screen resize events of some kind? > Mac OS > X will automatically scale my windows down, but it mangles the > placement > when going back to the higher resolution, so I'd like to handle it > myself. > > Morgan > > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From chmod007 at mac.com Wed Aug 8 06:06:13 2001 From: chmod007 at mac.com (David Remahl) Date: Thu Nov 3 14:47:04 2005 Subject: Screen resize events In-Reply-To: <20010808121239.15370@mail.sover.net> Message-ID: > Can anyone describe how to get screen resize events of some kind? Mac OS > X will automatically scale my windows down, but it mangles the placement > when going back to the higher resolution, so I'd like to handle it myself. > > Morgan The applications notifies its delegate + those registered for the notifications. This is at least partially documented. / david From bbum at codefab.com Wed Aug 8 07:34:16 2001 From: bbum at codefab.com (Bill Bumgarner) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (i.e. NSQueue)? In-Reply-To: <200108081055.DAA06294@lists.omnigroup.com> Message-ID: <200108081434.f78EYDT81378@pi.codefab.com> A bit of history that some may find interesting (and others will probably correct me on :-)... Richard nailed it-- near the end of the NeXTSTEP lifecycle, the APIs in the AppKit (there was no Foundation) had become somewhat bloated in that there had been lots of convenience API introduced and a number of classes that provided relatively specific functionality without being terribly flexible. As the OpenStep specification was designed, one of the fundamental goals was to keep the APIs as simple as reasonably possible. As such, there was less of an emphasis on creating a large number of classes to cover many specific bits of functionality and more of an emphasis on creating a handful of classes that encapsulate a great degree of functionality in a very generic set of containers. Part of this was to eliminate a bunch of convenience methods. While convenient, they proved to be a maintenance nightmare and relatively confusing to the developer. I.e Given... + createThingFromStuff: (Stuff *) aStuff withThis: (This *) aThis andThat: (That *) aThat; + createThingFromStuff: (Stuff *) aStuff withThis: (This *) aThis; + createThingFromStuff: (Stuff *) aStuff andThat: (That *) aThat; + createThingFromStuff: (Stuff *) aStuff; ...where the last three were simply covers for the first method, passing default values in for aThis and aThat, it made the developer's life more difficult in that it wasn't always clear what methods needed to be overridden and what "default" really means. In the Foundation, the design pattern is to just declare the first method and implement the functionality of the last three by, say, passing nil in for the appropriate argument or by requiring the developer to create and pass a value. In any case, the end result is that code-- while slightly more verbose-- becomes much more explicit in what it is doing. Similarly, the decision was made to minimize the class count. While Taligent was in the process of creating a solution that emphasized subclasses for *everything* and required the developer to create massive quantities of subclasses to get anything done, NeXT wanted to create a set of APIs that allowed the developer to get their work done through a minimal amount of subclassing while also preserving the ability to create elegant object oriented solutions. To these ends, the decision was made to use a minimal number of classes, to create a dichotomy between mutable and immutable classes to naturally support the concept of read-only vs. read-write data encapsulation and to hide a number of irrelevant concrete implementations-- optimizations, really-- within class clusters to further simplify the APIs. b.bum On Wednesday, August 8, 2001, at 06:55 AM, macosx-dev- request@omnigroup.com wrote: > >> Richard Frith-Macdonald 2001-07-15 07:16:08 +0100 wrote: >>> On Sunday, 2001 July 15 at 00:27, Mikey wrote: >>> Where is the Cocoa queue container class (i.e. NSQueue)?... >> ... >> I suspect that the people at NeXT thought it was better to keep the >> class >> count in the Foundation down (and keep the API simpler to learn), than >> to >> add a linked list queue implementation which would be very infrequently >> used by most people... From snoyes at execpc.com Wed Aug 8 07:57:12 2001 From: snoyes at execpc.com (Steven Noyes) Date: Thu Nov 3 14:47:04 2005 Subject: Screen resize events In-Reply-To: <20010808121239.15370@mail.sover.net> from "Morgan Aldridge" at Aug 8, 1 08:12:39 am Message-ID: <200108081456.JAA06234@earth.execpc.com> Just a thought. I have found that when this happens I do not have logical minimum sizes set for my Window in IB or I have some springs set wrong. On split views, a few simple delegate implementations of ... I can't remember (See the NSSplitView docs, they are well documented. splitViewWillResizeSubviews: I think) works very well. In short, the chances are there is a very easy method already provided to solve this problem. The trick is finding it. Steven Noyes > > Can anyone describe how to get screen resize events of some kind? Mac OS > X will automatically scale my windows down, but it mangles the placement > when going back to the higher resolution, so I'd like to handle it myself. > > Morgan > > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From chuck at benatong.com Wed Aug 8 09:02:12 2001 From: chuck at benatong.com (Charles Bennett) Date: Thu Nov 3 14:47:04 2005 Subject: Distributed Object connections References: <200108080006.RAA06384@toxygen.topiaventures.com> Message-ID: <3B71627A.262FB032@benatong.com> Cameron Bahan wrote: > > A couple questions about distributed object communication. First, I > have read the info on NSDistantObject and NSConnection which details out > how to vend objects and retrieve vended objects. > > (1) Can not get distributed objects communicating across the network. > (2) Don't fully understand the details behind the @protocol() which I am > suppose to set. setting @protocol to an agreed upon protocol is a performance enhancer. If you don't, then each time you execute a method on the remote object, that object has to be asked if it actually can perform that method. This allows a local exception to be thrown if you try and send a bad method. It wouldn't due to thrown the message on the "other end" because it's really the calling app's mistake, not the server. > > Details about the problem: > During the opening of a connection: > connection = [ NSConnection > connectionWithRegisteredName:@"Server" host:@"*" ] ; > You pass the name of the object ( "Server" in this case) and the host > that it is suppose to be on. According to the documentation that I have > read, if "*" is passed as the host it looks on the local network, if > 'nil' is used it defaults to localhost, and I assume (wrong as I may be) > that the string "207.107.92.141" will specify a specific machine while > "localhost" will also specify the local machine (duplicating the results > of 'nil'). > > However, when 'nil' is used the system works fine ... fast even. It > provides great communication between separate applications. However, if > an IP or "localhost" or "*" is used I get nothing. [ Having tried it on > the local machine and remote machines ] > > I am completely confused as to why this is. Only possibly leaving out > the "protocol" which I was suppose to set. [ Though it seemed to be a > optional state providing network conservation ]. Honestly I could not > figure out exactly what the protocol was defined to be, and I have not > found any good documentation describing it - so information here would > be nice as well. This is a known problem that isn't going to be fixed (I don't think) You MUST use a know TCP port to setup the connection's across machine. If I understood Apple correctly when this came uup last time, "*" is not going to be supported. From ddavidso at apple.com Wed Aug 8 09:10:46 2001 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:47:04 2005 Subject: Help with modifying NSTextView In-Reply-To: <200108080344.f783iNI13428@krunk.okito.net> Message-ID: <13440186-8C18-11D5-A600-000502935EF5@apple.com> On Tuesday, August 7, 2001, at 08:46 PM, Charles Jolley wrote: > I have done some things similar to this by using the temporary > attributes methods in the NSLayoutManager class (see > -addTemporaryAttributes: forCharacterRange:) Unlike modifying the > NSTextStorage directly, this will only show up in the display, not when > you copy text, etc., which works on the TextStorage. I'm glad to see that temporary attributes are getting some usage. This is exactly what they were intended for--making temporary appearance modifications, specific to a particular layout manager, without modifying the underlying text. Note that not all attributes are supported as temporary attributes--you can set any attributes you choose, of course, but currently only foreground color, background color, and underline style are recognized. Douglas Davidson From kubernan at 10191.com Wed Aug 8 09:49:54 2001 From: kubernan at 10191.com (kubernan) Date: Thu Nov 3 14:47:04 2005 Subject: segmentation fault (MacOS 10.0.4 build 4Q12) Message-ID: <200108081649.JAA02277@omnigroup.com> Hello, Trying to modify my source code, i discovered all new executable compiling under OS 10..0.4 with project builider 1.0.1 (v63.0) fall in segmentation fault. My source code call C++ function (wrapping with C code). It seems the crash appears in the call of this function (i have nothing in the debugger). I try with my backuped source code and i have the same problem. But executable building in previous version of MacOS X works well under 10.0.4 Any idea ? Kub. From cameron at topiaventures.com Wed Aug 8 13:20:59 2001 From: cameron at topiaventures.com (Cameron Bahan) Date: Thu Nov 3 14:47:04 2005 Subject: Distributed Object connections In-Reply-To: <3B71627A.262FB032@benatong.com> Message-ID: <200108082020.NAA17976@toxygen.topiaventures.com> Thanks to all that responded. I was able to get things "kinda" working. If the host lookup is @"localhost" it works locally. Also if the host is @"server-name" it works provided that the server-name is registered with the DNS server. It fails if an basic IP address is used (@"10.0.1.12"). IE. It will not work behind a NAT or in adhoc mode. Did I miss something in NSSocketPort that takes an IP address. [ initRemoteWithProtocolFamily:socketType:protocol:address: ] ??? My suspicions with the protocol were in-line with what I was reading and understanding, thanks for clearing up some of the confusion. That will be the next part of the project ;) Just looking to get it connecting using a basic IP address, hopefully I was not typing it in wrong ;) Guess it is time to clean up the coded a little, once this is solved it should not be hard to get call backs working. Does each NSConnection require a different port ? I do know that only one object can be vended through a NSConnection (its rootObject), atleast that is what I read (or at least remember). Also, guess this is a note for Apple. NSConnection documentation states that the following code chunk will look for the Object registered as "Server" on the local area network. If this call ends up working only for IPC on the local machine the remote machine solution needs to be identified. Other solutions to this problem are welcome, I am interested in hearing Apple's take on the situation and their future outlook and solutions. // connection = [ NSConnection // connectionWithRegisteredName:@"Server" host:@"*" ] ; And for anyone following this and is interested in how to get things working here is the latest chunk of code that allows DO communication between machines. // SERVER NSSocketPort *port = nil ; NSConnection *connection = nil ; // allocate the linked object theLink = [[ Linker alloc ] initArg:self ] ; [ self DisplayString:@"Publishing the linked object for clients." ] ; port = [ [ NSSocketPort alloc ] initWithTCPPort:9999 ]; connection = [ [ NSConnection alloc ] initWithReceivePort:port sendPort:nil ]; [ connection setRootObject:theLink ] ; // This no longer works - IPC communication only // if ( [ connection registerName:@"Server"] == NO ) // { // [ self DisplayString:@"Vending the object failed.\n" ] ; // } // CLIENT id theProxy ; NSSocketPort *port = nil ; NSConnection *connection = nil ; // The 'server' host is a NSString being passed in // (must be registered with the DNS server) port = [ [ NSSocketPort alloc ] initRemoteWithTCPPort:9999 host:server ]; connection = [ NSConnection connectionWithReceivePort:nil sendPort:port ]; if ( connection == nil ) [ client DisplayString:@"The connection failed." ] ; theProxy = [ [ connection rootProxy ] retain ] ; // Setting this will reduce network traffic // [ theProxy setProtocolForProxy:@protocol(ServerProtocol)] ; // Make the call on the distant object if ( theProxy != nil ) { [ theProxy Test ] ; [ theProxy ConnectClient:client ] ; } else { [ client DisplayString:@"Did not return the Distant Object\n" ] ; } Thanks, Cameron Bahan -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 3368 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010808/31cd9c4f/attachment.bin From campbell at world.std.com Wed Aug 8 18:24:34 2001 From: campbell at world.std.com (Larry Campbell) Date: Thu Nov 3 14:47:04 2005 Subject: Distributed Object connections In-Reply-To: <200108082020.NAA17976@toxygen.topiaventures.com> Message-ID: <200108090116.VAA11198@world.std.com> On Wednesday, August 8, 2001, at 04:20 PM, Cameron Bahan wrote: > If the host lookup is @"localhost" it works locally. Also if the host > is @"server-name" it works provided that the server-name is registered > with the DNS server. It fails if an basic IP address is used > (@"10.0.1.12"). IE. It will not work behind a NAT or in adhoc mode. > Did I miss something in NSSocketPort that takes an IP address. I don't think this is correct. I know I've gotten it to work passing a raw IP address. -- Legalize freedom: repeal the DMCA. http://www.eff.org From imikey at bellsouth.net Wed Aug 8 20:27:47 2001 From: imikey at bellsouth.net (Mikey) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) Message-ID: <023224027030981FE8@mail8.nc.rr.com> I think it's admirable that framework designers take such pains to be thrifty in their supply of classes and methods; however it seems like overkill to liberate the OS of a fundamental computer science data structure that is used in some fashion in almost every application. For example, the whole event management architecture of the AppKit is based on *queuing* events. It just doesn't make sense to me. Oh well, I guess, like countless others, I'll just re-implement my own queue class. From snoyes at execpc.com Wed Aug 8 22:01:21 2001 From: snoyes at execpc.com (snoyes@execpc.com) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <023224027030981FE8@mail8.nc.rr.com> Message-ID: <200108090501.f7951Bv97699@pop5.nwbl.wi.voyager.net> Why re-emplement when there is a queue and a FIFO already provide. A simple implementation might be: #define NSqueue NSMutableArray I have used these many many many times for queues and FIFOs and they served there purpose very well. And with good performance. Just wondering. Steven Noyes On Wednesday, August 8, 2001, at 08:24 PM, Mikey wrote: > I think it's admirable that framework designers take such pains to be > thrifty in their supply of classes and methods; however it seems like > overkill to liberate the OS of a fundamental computer science data > structure that is used in some fashion in almost every application. For > example, the whole event management architecture of the AppKit is based > on *queuing* events. > > It just doesn't make sense to me. Oh well, I guess, like countless > others, I'll just re-implement my own queue class. > > From Andreas Monitzer : > >> I rather like to use a generic class for all tasks than reading the >> documentation for 20 mins for each array/queue I need (FIFO, LIFO...). >> When I need a container in Java (I never used STL), I first check the >> docs >> to find out which one fits the task best (usually none does), then I >> learn >> the API, then I use it. >> In Foundation I just use NSArray/NSMutableArray since I remember the >> API >> (because I always use the same methods). > > > > > Michael Sullivan > imikey@bellsouth.net > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From zak_ziggy at hotmail.com Wed Aug 8 23:17:04 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:04 2005 Subject: Bug Tracker ? I can not find it, please help. Threading bugs and very upset! Message-ID: >>I have been forced >>into being a bit of a sh-t disturber lately, because I am trying to >>provoke >>some quicker attention to all the bugs with threading that are fully >>demonstrated in some BugApps I have put together. (If you like I will >>email them to anybody that asks. > >Hi, > >Conducting correspondence in this manner will not get quicker results. > >Conrad (Apple support) > Well I only mean, telling others that there is no solution when they ask "I am a new developer in Cocoa and I am having a hard time learning NSThreads and NSConnections what am I missing?". I, equally upset and confused, respond "Your missing a bugless environment!". Then I send them the BugApp's with source code, and explain it works perfectly (flawlessly) in OpenStep and OSX-1.2, but in OSX (and OSX-Server) it generates many errors, and I proceed to list the stack calls for each thread of the many randomly occur points when it breaks/crashes. Also in your next letter, you try to help me find the BugTracker without pointing to it. Now I continue to try to find the Bug Tracker! NOT the Bug Reporter (I have through complaints got that to work finally (mostly) or ADC, which because you keep avoiding the fact that it has been, removed. (I figure due to embarrassment of the severity and lack of problem solving going on about it, it has been turned off.) In the Bug Tracker everybody could lookup all the Bugs reported (by everybody), not just their own bugs as listed in the BugReporter. In the bug Tracker (which is now conveniently removed), under problems that crash, it showed the technicians messages, reporting things like, "Very serious problem!", "No time for next release.", "Tangled in ProjectBuilder, and Kernel Panic problems.", "I'm moving.", "Pushing to future release.", "Unknown when these threading problem fixes will even be planned to be addressed properly.". Very embarrassing stuff! Now I have told you I need to reference the bug report numbers in more bug reports that address NSThreading and NSConnections (specifically), and need to (and have the right to) access this material, in order to (like other people) make business decisions based on, not only the current status of the fixes, but the ability of Apple to address these problems (I told you it means many machines for my company, and is for code developed over the last decade worth millions which is been made useless in OSX), fix them and distribute the repairs (that will likely mean a lot of customers have OSX systems that can not run programs that work and were developed on patched OSX systems [All Upgrades Required! Warnings will be needed.]). So due to the fact that this information (BugTracker) has now been removed, my only hope is continue to forward my correspondence (with you etc.) to everybody (even if your not in those groups [sorry], so I will Bcc your address and that should keep your address from the eyes of people not in your news group, but I am sure it is your job to happily help anybody with there requests. [This seemed like just an attempt to keep me from telling everybody what and how badly the real (underlying all other) problems are being handled. This is how I am being forced to be a sh-t disturber, and I think if others find out and help complain about the Threading Bugs, help them find the Bug Tracker, to hold off on business purchases until threading has been repaired, (so they do not also get scammed by marketing lies) and you feel some financial and mass consumer presser, to actually fix them before releasing more garbage at everybody's expense. (All so this will mean millions of dollars spent so far and my life's work are not wasted further.) All this complaining will also benifit the few people dumb enough to ask me to stop solving are mutual problems (To you I say; "Bahhhh."). Basically you are further provoking my rage and helping me distribute the fact that you (Apple) are withholding critical bug information, and not repairing the problems reported in it. The Traker, I need to help you (Apple) interconnect similar bug reports, and far reaching problems within this buggy unusable (specifically threading or NSThreading and NSConnections) system, that is official a big waste of my time having to even ask for help or send one email to a news group list, which is something I never ever require in a decade of OpenStep (and even OSX-1.2) development. Now I think because of your last response without the location of the Bug Tracker, you do not know what I am talking about, as if it never existed. I wish now that I had saved this information (for reference) but was more interested in tracking the current status of the bugs, which was "We (Apple) are not even going to look at solving it for many versions down the road (that is a bullshit additude to have). Now personally if I worked at apple I would not be snarky about a whinner and just hang up (or be less helpful as you suggested) because the angry customer is not being polite enough, (that is bullshit). Squeaky wheels get the greese (and ones that publicly announce what a bogus experience dealing with this f'ed up system (OSX and bug reporting/tracking customer support) and kind of personalized emotionally interferance, in helping the really upset customers, trying to address critical problems that address everybody (and the belated, (and repeating) future of humanity as I see it.) You can bet I am going to FEEDBACK publicly, until something is done (right for once). Let's put and end to the emotional interference factor and address the major difficult and upsetting (far reaching) issues first, and with the kind of positive additude and emmidiate attention that this type of problem demands. My rage does not stop me from Reporting Bugs, why should it keep you from addressing them? (Is it not your jobs? Is that not part of what we all pay for and expect)? Further the harsher I get the more attention that is created, so I think it is going to "get quicker results"! Anything is better then the current state, which is, 'nothing is being done about (in general) Threading' (specifically NSThreading and NSConnections). In the keynote they called the guy resonsible a dweeb, as if they new how badly he f'ed it up, damaging the entire company, and the millions trying to do good with a system that has been basturdized by this merger with Mac garbage, AppleScripts, Java and QuickTime included. From Zak (in flak) P.S. Now, remember OpenStep and OSX-1.2 was/are perfect! What happened or how this was not ported by the push of a button (like OSX-1.2) is beyond my comprehension (and leaves me very suspectful of many things). _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From kubernan at 10191.com Thu Aug 9 02:10:47 2001 From: kubernan at 10191.com (kubernan) Date: Thu Nov 3 14:47:04 2005 Subject: NSConnection and reply mode Message-ID: <200108090910.CAA20026@omnigroup.com> Hello, I use DO in my app : GUI Client -----> send data using DO to server GUI Client waits for the reply It seems it's the default mode. The problem is doing that, all my GUI client is locked until the reply comes. How can set up my DO connection allowing me to use the GUI until the reply comes ? Thx. Kub. From zak_ziggy at hotmail.com Thu Aug 9 05:56:02 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:04 2005 Subject: Help with modifying NSTextView Message-ID: Try setBackgroundColor: and textDidEndEditing: or maybe keyDown: with some Event stuff to learn there. you might need or be able to get away with doing some of these with delegation, or you subclass. From Zak _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From manu at nantes.inserm.fr Thu Aug 9 07:12:09 2001 From: manu at nantes.inserm.fr (Manuel Bardies) Date: Thu Nov 3 14:47:04 2005 Subject: GNU cc equivalent to Sun cc -dalign Message-ID: Hi, I'm trying to port a code from my Sun to my Mac. It's a mixture of Fortran and C. The C routine is compiled like that on my Sun: cc -dalign -c -I/usr/openwin/include mcnpc.c I understand the -c and -I options, but I see no equivalent of the -dalign option in the Objective-C compiler manual. For the Sun, -dalign is explained like that: '(SPARC) generates double-word load/store instructions wherever possible for improved performance. Assumes that all double and long long type data are double-word aligned. Do not use this option when correct alignment is not assured.' So I conclude that this option is not compulsory for building the program, it just helps to make it quicker. Since this was in the make file of the program, which was designed to run on a Sun workstation, I also assume that correct alignment IS assured. Still I don't understand that option... Could someone explain and tell me if there's an equivalent with the Objective-C compiler ? Thanks Manuel -- Manuel Bardies INSERM U463 9 Quai Moncousu 44035 Nantes Cedex France Tel: (33) 2 40 08 47 47 Fax: (33) 2 40 35 66 97 e-mail: manu@nantes.inserm.fr From pbucher at mjwire.com Thu Aug 9 07:13:37 2001 From: pbucher at mjwire.com (Paul Bucher) Date: Thu Nov 3 14:47:04 2005 Subject: Bug Tracker ? I can not find it, please help. Threading bugs and very upset! In-Reply-To: Message-ID: > P.S. Now, remember OpenStep and OSX-1.2 was/are perfect! What happened or > how this was not ported by the push of a button (like OSX-1.2) is beyond my > comprehension (and leaves me very suspectful of many things). hmm, OSX-1.2 was not perfect, try "tail /var/log/system.log" a few times, then wait 24 hours and let me know how life is. As for public bug tracking try "http://publicsource.apple.com/bugs/". This tracks publicly submitted bugs of code Apple has open sourced. While not perfect is does give you a good glimpse into core of the OS and what bugs have been reported in there. Now for your ranting about NSThreading. NSThreading had to be rewritten for SMP. Your beloved Openstep & X 1.2 where worthless for multiprocessor machines. The kernel, various libs, etc where not SMP safe, things had to be rewritten. Now let's stop airing rants about programming level stuff in forms dedicated to admining & working with OS X. Try the Darwin lists out for OS Level stuff and send your warnings to like macosx-dev. - Paul Bucher From kubernan at 10191.com Thu Aug 9 08:05:47 2001 From: kubernan at 10191.com (kubernan) Date: Thu Nov 3 14:47:04 2005 Subject: NSConnection and reply mode In-Reply-To: <007601c120df$f897fa70$0300000a@karma> Message-ID: <200108091505.IAA05674@omnigroup.com> Read..but not seen.. In fact, i launch my DO connection in separated thread. It works fine. K. Le jeudi 9 ao?t 2001, ? 04:31, Erik M. Buck a ?crit : >> How can set up my DO connection allowing me to use the GUI until the >> reply comes ? > > Use void oneway RTFM > > > > From demars at mminternet.com Thu Aug 9 08:12:47 2001 From: demars at mminternet.com (Dennis C. De Mars) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <200108090501.f7951Bv97699@pop5.nwbl.wi.voyager.net> Message-ID: on 8/9/01 12:00 AM, snoyes@execpc.com at snoyes@execpc.com wrote: > Why re-emplement when there is a queue and a FIFO already provide. A > simple implementation might > be: > > #define NSqueue NSMutableArray > > I have used these many many many times for queues and FIFOs and they > served there purpose > very well. And with good performance. > > Just wondering. A queue and a FIFO are the same thing. You can use an array to implement a queue, but it does not give you particularly good performance. If you do it the most straightforward way, simply appending new objects at the end of the array and removing objects from the beginning, then removing items from the queue is an inefficient operation. Of course, what most of us do if we have to use an array to implement a queue for some reason, is maintain indexes or pointers to the beginning and end of the queue and treat the array as a circular buffer. This gives good performance as long as the size of the queue doesn't have to grow beyond the size of the array, but it requires auxiliary variables to keep track of the head and tail of the queue, and the operations you have to do to these auxiliary variables when you add and remove from the queue are complex enough to encapsulate in functions or methods. (Also, to be efficient you need an array bigger than the number of elements you actually have in the queue, straightforward in a plain old C array but not so straitforward for an NSMutableArray. What do you with the "empty" slots? Can't set them to nil, that will cause an exception...) So, I'd argue that Foundation has _not_ provided a ready-made queue object in NSMutableArray. If you really wanted to use it as a queue, you'd probably want to subclass it to add the instance variables and methods to add, remove, and probably some to tell you if the queue is empty or how many elements are in the queue. NSMutableArray can be used to implement a stack (i.e. LIFO) efficiently, and the operations you need are already provided, so if you want to say Foundation already provides a stack, I'd agree with that. From richard at brainstorm.co.uk Thu Aug 9 08:28:30 2001 From: richard at brainstorm.co.uk (Richard Frith-Macdonald) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: Message-ID: <200108091528.f79FSHE11281@mail.brainstorm.co.uk> On Thursday, August 9, 2001, at 04:12 PM, Dennis C. De Mars wrote: > on 8/9/01 12:00 AM, snoyes@execpc.com at snoyes@execpc.com wrote: > >> Why re-emplement when there is a queue and a FIFO already provide. A >> simple implementation might >> be: >> >> #define NSqueue NSMutableArray >> >> I have used these many many many times for queues and FIFOs and they >> served there purpose >> very well. And with good performance. >> >> Just wondering. > > A queue and a FIFO are the same thing. > > You can use an array to implement a queue, but it does not give you > particularly good performance. If you do it the most straightforward > way, > simply appending new objects at the end of the array and removing > objects > from the beginning, then removing items from the queue is an inefficient > operation. Actually, I'd beg to differ. Your assertion is only true if you want a *large* queue. If your queue is small, the overheads of a linked-list implementation are likely higher than those of an array implementation .... With an array, removal of the first object shuffles pointers in the remainder of the array. With a linked list, removal of the first object may actually involve more work - especially if the list element pointing to the removed item needs to be deallocated. In either case, for small queues the overhead of the method call is likely to be greater than that of the pointer movement. Now for most queuing applications that I've had, the consumer would generally be taking things the queue faster than the producer added them, and the queue would typically be empty, and the existence of a large queue would be evidence of problems elsewhere, so my producer would do something like - if ([queue count] > threshold) // Take some remedial action Of course, a list-based implementation *is* better in some circumstances, but IMO an array based implementation is good for the majority of cases. From cameron at topiaventures.com Thu Aug 9 08:33:29 2001 From: cameron at topiaventures.com (Cameron Bahan) Date: Thu Nov 3 14:47:04 2005 Subject: NSConnection and reply mode In-Reply-To: <200108091505.IAA05674@omnigroup.com> Message-ID: <200108091532.IAA29327@toxygen.topiaventures.com> The way I plan to accomplish this is to set up call backs, where both the server and client have vended objects. This allows the client to receive information at any time from the server without being stuck polling. Though putting it in another thread, as you mentioned, will also work. From demars at mminternet.com Thu Aug 9 08:45:57 2001 From: demars at mminternet.com (Dennis C. De Mars) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <200108091528.f79FSHE11281@mail.brainstorm.co.uk> Message-ID: on 8/9/01 8:28 AM, Richard Frith-Macdonald at richard@brainstorm.co.uk wrote: > > On Thursday, August 9, 2001, at 04:12 PM, Dennis C. De Mars wrote: > >> on 8/9/01 12:00 AM, snoyes@execpc.com at snoyes@execpc.com wrote: >> >>> Why re-emplement when there is a queue and a FIFO already provide. A >>> simple implementation might >>> be: >>> >>> #define NSqueue NSMutableArray >>> >>> I have used these many many many times for queues and FIFOs and they >>> served there purpose >>> very well. And with good performance. >>> >>> Just wondering. >> >> A queue and a FIFO are the same thing. >> >> You can use an array to implement a queue, but it does not give you >> particularly good performance. If you do it the most straightforward >> way, >> simply appending new objects at the end of the array and removing >> objects >> from the beginning, then removing items from the queue is an inefficient >> operation. > > Actually, I'd beg to differ. > Your assertion is only true if you want a *large* queue. > If your queue is small, the overheads of a linked-list implementation > are likely higher > than those of an array implementation .... > > With an array, removal of the first object shuffles pointers in the > remainder of > the array. > With a linked list, removal of the first object may actually involve > more work - especially > if the list element pointing to the removed item needs to be deallocated. > In either case, for small queues the overhead of the method call is > likely to be greater than > that of the pointer movement. That's true, actually you are doing an extra memory allocation every time you add an element and a deallocation every time you remove one (unless you maintain a pool or something -- at any rate it is more inefficient than fixing up pointers). > Now for most queuing applications that I've had, the consumer would > generally be taking things > the queue faster than the producer added them, and the queue would > typically be empty, and > the existence of a large queue would be evidence of problems elsewhere, > so my producer would > do something like - > > if ([queue count] > threshold) > // Take some remedial action > > > Of course, a list-based implementation *is* better in some > circumstances, but IMO an array based > implementation is good for the majority of cases. This is probably one reason why the STL allows the user the option of specifying the underlying data structure (stacks and queues are actually "adapters" to more basic containers in that system). OK, you convinced me that a linked list is not optimum for this purpose. I was trying to see how these data structures could be supported without an explosion of container classes, but you wouldn't want to carry around a permanent performance tax just to maintain a small number of classes. I still think NSMutableArray is not the most suitable way to implement a queue, though, it would probably be better to create a class that used a plain C array internally. - Dennis D. From rcerny at dataline.cz Thu Aug 9 09:05:15 2001 From: rcerny at dataline.cz (Robert Cerny) Date: Thu Nov 3 14:47:04 2005 Subject: NSMenu Message-ID: <200108091607.f79G7GA00394@linux.dataline.cz> Hi, I have an AppDelegate, which installs global menu in awakeFromNib. I thought that when I double-click my menu, it will switch me into my application but it doesn't work this way. How can I implement it? Thanks Robert From rosyna at unsanity.com Thu Aug 9 09:18:07 2001 From: rosyna at unsanity.com (Rosyna) Date: Thu Nov 3 14:47:04 2005 Subject: Thread Manager and Cocoa In-Reply-To: <200108091528.f79FSHE11281@mail.brainstorm.co.uk> References: <200108091528.f79FSHE11281@mail.brainstorm.co.uk> Message-ID: Is it safe to make Carbon Thread Manager calls from Cocoa? -- Sincerely, Rosyna Keller Technical Support/Holy Knight/Always needs a hug Unsanity: Unsane Tools for Insane People From ocs at ocs.cz Thu Aug 9 09:33:46 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <023224027030981FE8@mail8.nc.rr.com> References: <023224027030981FE8@mail8.nc.rr.com> Message-ID: <200108091636.AA17919@ocs.cz> Mikey, >>>>>> Mikey (M) wrote at Wed, 8 Aug 2001 23:24:17 -0400: M> For M> example, the whole event management architecture of the AppKit is based M> on *queuing* events. Which is what NSArray can do nicely, with many other things. M> It just doesn't make sense to me. Oh well, I guess, like countless M> others, I'll just re-implement my own queue class. It's quite unnecessary waste of time, but you are naturally free to do so. Agreed that a priority queue needs some code (which, of course, can be added as a reusable category ;) --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From manu at nantes.inserm.fr Thu Aug 9 09:44:04 2001 From: manu at nantes.inserm.fr (Manuel Bardies) Date: Thu Nov 3 14:47:04 2005 Subject: -r option with ld Message-ID: Hi, Could someone explain to me the -r option of ld? I'm trying to link some programs, and I seem to have a lot of 'undefined symbols' whereas I feel I should not. It is said in the man ld pages that this option will suppress that diagnostics, but I don't understand what it does, and I don't know if it's safe to use it... Sorry if my question is unclear, a lot of things are really unclear to me... Thanks Manuel -- Manuel Bardies INSERM U463 9 Quai Moncousu 44035 Nantes Cedex France Tel: (33) 2 40 08 47 47 Fax: (33) 2 40 35 66 97 e-mail: manu@nantes.inserm.fr From am at yline.com Thu Aug 9 09:53:27 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:04 2005 Subject: -r option with ld In-Reply-To: Message-ID: <200108091653.SAA00467@am.homeip.net> On Thursday, August 9, 2001, at 06:42 , Manuel Bardies wrote: > Could someone explain to me the -r option of ld? > I'm trying to link some programs, and I seem to have a lot of 'undefined > symbols' whereas I feel I should not. > It is said in the man ld pages that this option will suppress that > diagnostics, but I don't understand what it does, and I don't know if it' > s safe to use it... > Sorry if my question is unclear, a lot of things are really unclear to me. > .. In my experience, removing diagnostics doesn't fix mistakes :-) Maybe you forgot to add some files to the correct target? The "o" on the left side of the file name in "Groups & Files" indicates whether a file is included in the compilation of the current target. andy -- "He was addicted to life. But we cured him" From ocs at ocs.cz Thu Aug 9 10:22:29 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: References: Message-ID: <200108091723.AA17979@ocs.cz> Dennis, >>>>>> Dennis C. De Mars (DCDM) wrote at Thu, 09 Aug 2001 08:12:10 -0700: DCDM> ...there are applications where what you want is a linked DCDM> list... Save some 0.1% of *VERY SPECIAL* code, there are *NOT*: what you want is an abstract array, and nobody cares whether there's linked list hidden inside or not. You -- probably due to your unfortunate C++ background -- are too occupied by thinking particular implementation that you don't see the algorithm. Try to get rid of this bad habit, and you'll improve your effectivity considerably. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ocs at ocs.cz Thu Aug 9 10:33:19 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: References: Message-ID: <200108091734.AA17995@ocs.cz> Dennis, >>>>>> Dennis C. De Mars (DCDM) wrote at Thu, 09 Aug 2001 08:45:28 -0700: DCDM> I still think NSMutableArray is not the most suitable way to implement DCDM> a queue, You're thinking wrong. Not speaking of the "theory", the raw fact is that we who are trying to give you an advice are successfully using NSMutableArray for queues (and much more) for five-odd years already. DCDM> though, it would probably be better to create a class that DCDM> used a plain C array internally. It would not, but do it, if you do insist. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From cameron at topiaventures.com Thu Aug 9 11:26:39 2001 From: cameron at topiaventures.com (Cameron Bahan) Date: Thu Nov 3 14:47:04 2005 Subject: Distributed Object connections In-Reply-To: <200108090116.VAA11198@world.std.com> Message-ID: <200108091826.LAA30669@toxygen.topiaventures.com> Do you know if the machines you were testing it on were listed in the local DNS server ? I have found that once a machine is listed, I can access it through IP or by name. However, if not listed (take my NAT network behind the Airport at home) it does not work. It is unable to resolve the IP address directly. I have tried creating my own NSHost and connecting that way, I have tried using a NSPortNameServer to register the receiving port and also do a lookup for it. I am have played with a couple other methods in NSConnection and NSSocketPort. Is anyone else running into this? It sure seems like it should work ... and I can not figure out what I am doing wrong. If there anything obvious is the following code ? Figure I am just forgetting to do something since NSSocketPort and NSConnection are the basis for all network applications in OS X. Client code once more: NSString *hostString = @"10.0.1.6" ; // Create the TCP port port = [ [ NSSocketPort alloc ] initRemoteWithTCPPort:9999 host:hostString ]; // Create port through the name server // port = [ [ NSPortNameServer systemDefaultPortNameServer ] // portForName:@"ToServer" host:@"10.0.1.6:9999" ] ; if ( port == nil ) { [ client DisplayString:@"Could not open the port" ] ; } else { // Actually form the connection connection = [NSConnection connectionWithReceivePort:nil sendPort:port]; if ( connection == nil ) [ client DisplayString:@"The connection failed." ] ; } On Wednesday, August 8, 2001, at 06:16 PM, Larry Campbell wrote: > On Wednesday, August 8, 2001, at 04:20 PM, Cameron Bahan wrote: > >> If the host lookup is @"localhost" it works locally. Also if the host >> is @"server-name" it works provided that the server-name is registered >> with the DNS server. It fails if an basic IP address is used >> (@"10.0.1.12"). IE. It will not work behind a NAT or in adhoc mode. >> Did I miss something in NSSocketPort that takes an IP address. > > I don't think this is correct. I know I've gotten it to work passing a > raw IP address. > -- > Legalize freedom: repeal the DMCA. > http://www.eff.org From demars at mminternet.com Thu Aug 9 11:28:04 2001 From: demars at mminternet.com (Dennis C. De Mars) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <200108091723.AA17979@ocs.cz> Message-ID: <200108091728.f79HSh031920@zeus.mminternet.com> Ondra Cada said: > Dennis, > > >>>>>> Dennis C. De Mars (DCDM) wrote at Thu, 09 Aug 2001 08:12:10 -0700: > DCDM> ...there are applications where what you want is a linked > DCDM> list... > > Save some 0.1% of *VERY SPECIAL* code, there are *NOT*: what you want is an > abstract array, and nobody cares whether there's linked list hidden inside or > not. > > You -- probably due to your unfortunate C++ background -- are too occupied > by thinking particular implementation that you don't see the algorithm. Try > to get rid of this bad habit, and you'll improve your effectivity > considerably. I have a background in a lot of computer languages. I wonder what it is in your background that leads you to beleive that the condescending tone you displayed in your last paragraph is acceptable in a discussion between professionals. - Dennis D. From zoldar256 at yahoo.com Thu Aug 9 11:39:26 2001 From: zoldar256 at yahoo.com (Corey O'Connor) Date: Thu Nov 3 14:47:04 2005 Subject: Thread Manager and Cocoa In-Reply-To: Message-ID: <20010809183923.73070.qmail@web3604.mail.yahoo.com> Ummmm... Why would you? There are signifigantly better ways to thread under Cocoa. I actually don't know how you would even pull this off. The structures might be too different to do it anyways. So, in short my answer is: Is it safe? Proabably, but I wouldn't do it. It's like buying a corvet and putting a VW bus engine in it. ;-) --- Rosyna wrote: > Is it safe to make Carbon Thread Manager calls from > Cocoa? > -- > Sincerely, > Rosyna Keller > Technical Support/Holy Knight/Always needs a hug > > Unsanity: Unsane Tools for Insane People > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ From ocs at ocs.cz Thu Aug 9 11:46:36 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:04 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <200108091728.f79HSh031920@zeus.mminternet.com> References: <200108091728.f79HSh031920@zeus.mminternet.com> Message-ID: <200108091847.AA18088@ocs.cz> Dennis, >>>>>> Dennis C. De Mars (DCDM) wrote at Thu, 9 Aug 2001 17:28:49 -0000: DCDM> >DCDM> ...there are applications where what you want is a linked DCDM> >DCDM> list... DCDM> > DCDM> >Save some 0.1% of *VERY SPECIAL* code, there are *NOT*: what you want DCDM> >is DCDM> an DCDM> >abstract array, and nobody cares whether there's linked list hidden DCDM> >inside or not. DCDM> > DCDM> >You -- probably due to your unfortunate C++ background -- are too DCDM> >occupied by thinking particular implementation that you don't see the DCDM> >algorithm. Try to get rid of this bad habit, and you'll improve your DCDM> >effectivity considerably. DCDM> DCDM> I have a background in a lot of computer languages. I wonder what it is DCDM> in your background that leads you to beleive that the condescending DCDM> tone you displayed in your last paragraph is acceptable in a discussion DCDM> between professionals. It's not in my background, it's in your mails. Anyway, I, with some hundreds of thousands OpenStep lines after me, am trying my best to help those who are starting with the thing to find the best way with it. I don't force anybody to really take my advices. Feel free to trash them, and be happy. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ddavidso at apple.com Thu Aug 9 11:48:36 2001 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:47:04 2005 Subject: Distributed Object connections In-Reply-To: <200108091826.LAA30669@toxygen.topiaventures.com> Message-ID: -[NSSocketPort initRemoteWithTCPPort:host:] is a convenience cover for -[NSSocketPort initRemoteWithProtocolFamily:PF_INET socketType:SOCK_STREAM protocol:IPPROTO_TCP address:address] where address is an NSData containing an appropriate struct sockaddr_in. If you have an IP address rather than a hostname it is probably more appropriate to use the latter method. Douglas Davidson From rosyna at unsanity.com Thu Aug 9 11:50:50 2001 From: rosyna at unsanity.com (Rosyna) Date: Thu Nov 3 14:47:05 2005 Subject: Thread Manager and Cocoa In-Reply-To: <20010809183923.73070.qmail@web3604.mail.yahoo.com> References: <20010809183923.73070.qmail@web3604.mail.yahoo.com> Message-ID: Simple reason, I want a cooperative thread. NSThreads are not cooperative and take up ungodly amount of CPU time. If you have any suggestions for decreasing the CPU time of an NSThread without stopping it, I am open to them. Ack, at 8/9/01, Corey O'Connor said: > Ummmm... Why would you? There are signifigantly >better ways to thread under Cocoa. I actually don't >know how you would even pull this off. The structures >might be too different to do it anyways. > So, in short my answer is: Is it safe? Proabably, >but I wouldn't do it. It's like buying a corvet and >putting a VW bus engine in it. ;-) -- Sincerely, Rosyna Keller Technical Support/Holy Knight/Always needs a hug Unsanity: Unsane Tools for Insane People From manu at nantes.inserm.fr Thu Aug 9 12:03:58 2001 From: manu at nantes.inserm.fr (Manuel =?iso-8859-1?Q?Bardi=E8s?=) Date: Thu Nov 3 14:47:05 2005 Subject: -r option with ld Message-ID: <3B72DDA0.404DFAAF@nantes.inserm.fr> > > In my experience, removing diagnostics doesn't fix mistakes :-) Is it just what the -r option does? removing diagnostics? I knew the -undefined warning option was doing that too, and didn't like the idea. I though the -r was doing something else, although I still don't understand clearly what. > Maybe you forgot to add some files to the correct target? The "o" on the > left side of the file name in "Groups & Files" indicates whether a file is > included in the compilation of the current target. I don't use PB to build my programs, so all files have to be added using the command line. That is what confuses me... It should be fine - runs perfectly well on my SUN workstation with 'standard' libraries. What is supposedly undefined passes the compilation stage (because it is indeed defined in the code) but then seems to upset the linker... I'm very new to C programming, that's why it probably is some very basic thing, but I don't find it... Thanks, Manuel From rickjarosh at lycos.com Thu Aug 9 12:06:36 2001 From: rickjarosh at lycos.com (Rick Jarosh) Date: Thu Nov 3 14:47:05 2005 Subject: undefined symbols Message-ID: I've gotten a compiler error message "undefined symbols" but when I click on the Stop icon all that comes up is the entire project folder,rather than having the particular line that is causing the problem highlighted.Does anyone know how I can find out where the problem arises. Thanks, Rick Get 250 color business cards for FREE! http://businesscards.lycos.com/vp/fastpath/ From greg at omnigroup.com Thu Aug 9 12:10:08 2001 From: greg at omnigroup.com (Greg Titus) Date: Thu Nov 3 14:47:05 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: Message-ID: <200108091909.MAA23912@omnigroup.com> On Thursday, August 9, 2001, at 08:12 AM, Dennis C. De Mars wrote: > Of course, what most of us do if we have to use an array to implement a > queue for some reason, is maintain indexes or pointers to the beginning > and > end of the queue and treat the array as a circular buffer. This gives > good > performance as long as the size of the queue doesn't have to grow > beyond the > size of the array, but it requires auxiliary variables to keep track of > the > head and tail of the queue, and the operations you have to do to these > auxiliary variables when you add and remove from the queue are complex > enough to encapsulate in functions or methods. (Also, to be efficient > you > need an array bigger than the number of elements you actually have in > the > queue, straightforward in a plain old C array but not so straitforward > for > an NSMutableArray. What do you with the "empty" slots? Can't set them to > nil, that will cause an exception...) Hi Dennis, A circular buffer is indeed a pretty good way of implementing a queue in most circumstances. I think you and Richard Frith-Macdonald did a pretty good job of describing when a circular buffer beats a linked list and vice versa. > So, I'd argue that Foundation has _not_ provided a ready-made queue > object > in NSMutableArray. If you really wanted to use it as a queue, you'd > probably > want to subclass it to add the instance variables and methods to add, > remove, and probably some to tell you if the queue is empty or how many > elements are in the queue. Ah, but here is where you are mistaken. You are making the assumption that NSMutableArray is implemented internally as a simple C array. In fact, NSMutableArray is implemented in terms of CFMutableArray, and the CoreFoundation project is part of Darwin so you can go look at the source yourself. If you do so you will find that there are, in fact, three different implementations of mutable array that the code switches among depending upon the size of the array and whether that size is fixed. The most common implementation (for a non-fixed but small size - which is what NSMutableArray will use unless you add many many objects or give it a very large capacity on initialization), is actually a circular buffer! Thus, [array objectAtIndex:0] is O(1), [array removeObjectAtIndex:0] is O(1), and [array addObject:newObject] is O(1) - unless the buffer needs to be expanded. That seems like a pretty decent queue implementation to me... > NSMutableArray can be used to implement a stack (i.e. LIFO) > efficiently, and > the operations you need are already provided, so if you want to say > Foundation already provides a stack, I'd agree with that. Okay then, so we're all happy and can stop arguing now? :-) --Greg From tblanchard at cacheon.com Thu Aug 9 12:17:03 2001 From: tblanchard at cacheon.com (Todd Blanchard) Date: Thu Nov 3 14:47:05 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: Message-ID: >This is probably one reason why the STL allows the user the option of specifying the underlying data structure (stacks and queues are actually "adapters" to more basic containers in that system). >OK, you convinced me that a linked list is not optimum for this purpose. I was trying to see how these data structures could be supported without an explosion of container classes, but you wouldn't want to carry around a permanent performance tax just to maintain a small number of classes. >I still think NSMutableArray is not the most suitable way to implement a queue, though, it would probably be better to create a class that used a plain C array internally. I think you're missing some thing here. Right now this whole argument is about premature optimization. Its an error in thinking to care at all how NSArray works or how it performs for implementing your queue at this stage. Just write your program using the most expedient mechanism available (NSArray) - if you simply must have a queue interface (which only needs, push, pop, peek, and count), throw one onto an NSArray as a category. I'll wager dollars to doughnuts though that if NSArray's performance turns out to be inadequate in some way (which you can only tell after *profiling* your working application) then you have very stringent performance requirements indeed. I'd further guess that at this level, the overhead of ObjectiveC's messaging will begin to matter and you'll have to use a high performance C implementation. The number of people who think they need to care about writing high performance code is significantly greater than the number of people who actually need to care -- or -- 1) Make it work (you haven't done this yet). 2) Make it work right (ditto) 3) If its not fast enough - make it work fast. Hardly anybody ever needs to do 3 and when you do - profiling always shows you that the problem is someplace you never would have predicted. NSArray makes a great queue. From matthewmajka at mac.com Thu Aug 9 12:22:56 2001 From: matthewmajka at mac.com (Matt Majka) Date: Thu Nov 3 14:47:05 2005 Subject: -r option with ld In-Reply-To: <200108091653.SAA00467@am.homeip.net> Message-ID: <200108091922.MAA01506@smtpout.mac.com> On Thursday, August 9, 2001, at 11:53 am, Andreas Monitzer wrote: > On Thursday, August 9, 2001, at 06:42 , Manuel Bardies wrote: > >> Could someone explain to me the -r option of ld? >> I'm trying to link some programs, and I seem to have a lot of 'undefined >> symbols' whereas I feel I should not. >> It is said in the man ld pages that this option will suppress that >> diagnostics, but I don't understand what it does, and I don't know if it' >> s safe to use it... >> Sorry if my question is unclear, a lot of things are really unclear to >> me. >> .. > > In my experience, removing diagnostics doesn't fix mistakes :-) The '-r' option creates a relocatable image/executable meaning that the linker does not complain about unresolved symbols because you have told it that you will perform a "static" link at some later time. It's used all the time in embedded systems and dynamic loading of object modules. The unresolved symbols get resolved when you load the object module (your program) into the OS. In general, you don't need to use this option with workstation development. From demars at mminternet.com Thu Aug 9 12:34:05 2001 From: demars at mminternet.com (Dennis C. De Mars) Date: Thu Nov 3 14:47:05 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <200108091909.MAA23912@omnigroup.com> Message-ID: <200108091933.f79JX8020979@zeus.mminternet.com> Greg Titus said: > > On Thursday, August 9, 2001, at 08:12 AM, Dennis C. De Mars wrote: > > > Of course, what most of us do if we have to use an array to implement a > > queue for some reason, is maintain indexes or pointers to the beginning > > and > > end of the queue and treat the array as a circular buffer. This gives > > good > > performance as long as the size of the queue doesn't have to grow > > beyond the > > size of the array, but it requires auxiliary variables to keep track of > > the > > head and tail of the queue, and the operations you have to do to these > > auxiliary variables when you add and remove from the queue are complex > > enough to encapsulate in functions or methods. (Also, to be efficient > > you > > need an array bigger than the number of elements you actually have in > > the > > queue, straightforward in a plain old C array but not so straitforward > > for > > an NSMutableArray. What do you with the "empty" slots? Can't set them to > > nil, that will cause an exception...) > > Hi Dennis, > > A circular buffer is indeed a pretty good way of implementing a queue in > most circumstances. I think you and Richard Frith-Macdonald did a pretty > good job of describing when a circular buffer beats a linked list and > vice versa. > > > So, I'd argue that Foundation has _not_ provided a ready-made queue > > object > > in NSMutableArray. If you really wanted to use it as a queue, you'd > > probably > > want to subclass it to add the instance variables and methods to add, > > remove, and probably some to tell you if the queue is empty or how many > > elements are in the queue. > > Ah, but here is where you are mistaken. You are making the assumption > that NSMutableArray is implemented internally as a simple C array. In You're right, that's exactly what I was assuming... > fact, NSMutableArray is implemented in terms of CFMutableArray, and the > CoreFoundation project is part of Darwin so you can go look at the > source yourself. If you do so you will find that there are, in fact, > three different implementations of mutable array that the code switches > among depending upon the size of the array and whether that size is > fixed. > > The most common implementation (for a non-fixed but small size - which > is what NSMutableArray will use unless you add many many objects or give > it a very large capacity on initialization), is actually a circular > buffer! > > Thus, [array objectAtIndex:0] is O(1), [array removeObjectAtIndex:0] is > O(1), and [array addObject:newObject] is O(1) - unless the buffer needs > to be expanded. That seems like a pretty decent queue implementation to > me... That's totally cool! And of course, I must capitulate to the notion that you can directly use NSMutableArray as a queue, since the internal implementation (for the common case) is already the most efficient way to implement a queue. > > > NSMutableArray can be used to implement a stack (i.e. LIFO) > > efficiently, and > > the operations you need are already provided, so if you want to say > > Foundation already provides a stack, I'd agree with that. > > Okay then, so we're all happy and can stop arguing now? :-) Well, I didn't see it as an agrument, I just thought we were tossing ideas back and forth on the options for implementing a queue. I do agree that with your post and Richard Frith-Macdonald's post we now have a wealth of information on the subject. - Dennis D. From demars at mminternet.com Thu Aug 9 12:50:31 2001 From: demars at mminternet.com (Dennis C. De Mars) Date: Thu Nov 3 14:47:05 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: Message-ID: <200108091950.f79JoJ023650@zeus.mminternet.com> Todd Blanchard said: > I think you're missing some thing here. Right now this whole argument is > about premature optimization. Its an error in thinking to care at all how > NSArray works or how it performs for implementing your queue at this stage. > Just write your program using the most expedient mechanism available > (NSArray) - if you simply must have a queue interface (which only needs, > push, pop, peek, and count), throw one onto an NSArray as a category. I agree with the general sentiment about premature optimization. However, I think it is appropriate to be aware of the efficiency of basic library components that will be used ubiquitously in every application. Some of the most pointless examples of "premature optimization" I've seen were due to the programmer having an exaggerated idea of the cost of doing certain operations. So, I don't think it hurts, going into a project, to have an accurate idea of what the cost of using the basic library components is. It can actually prevent you from the temptation to do premature optimization, if you already know it won't save you much. > I'll wager dollars to doughnuts though that if NSArray's performance turns > out to be inadequate in some way (which you can only tell after *profiling* > your working application) then you have very stringent performance > requirements indeed. I'd further guess that at this level, the overhead of > ObjectiveC's messaging will begin to matter and you'll have to use a high > performance C implementation. > > The number of people who think they need to care about writing high > performance code is significantly greater than the number of people who > actually need to care -- or -- > > 1) Make it work (you haven't done this yet). > 2) Make it work right (ditto) > 3) If its not fast enough - make it work fast. > > Hardly anybody ever needs to do 3 and when you do - profiling always shows > you that the problem is someplace you never would have predicted. > > NSArray makes a great queue. I agree (after seeing Greg Titus' post, and by the way I apologize to the list for accidently replying twice to that post). Although I didn't get involved in this thread until today, I'm glad I did because I learned something important (in my estimation) about the NSArray implementation. - Dennis D. From mah at jump-ing.de Thu Aug 9 12:57:54 2001 From: mah at jump-ing.de (Markus Hitter) Date: Thu Nov 3 14:47:05 2005 Subject: NSMenu In-Reply-To: <200108091607.f79G7GA00394@linux.dataline.cz> Message-ID: <200108091957.VAA06538@post.webmailer.de> Am Donnerstag, 9. August 2001 um 18:04 schrieb Robert Cerny: > Hi, > I have an AppDelegate, which installs global menu in awakeFromNib. (awakeFromNib is called even without a delegate set, I wouldn't count it to the delegate methods.) > I thought that when I double-click my menu, Menu items can't be double-clicked. If you're thinking of something like an NSCell in a window, watch out for one of the setDoubleClick methods. > it will switch me into my application If you receive the click, you're "in" your app. If you want to have your window fully visible, add a [window orderFront]; or a [window makeKeyAndOrderFront]; depending on your needs. > [...] Hope that helps a little, Markus - - - - - - - - - - - - - - - - - - - Dipl. Ing. Markus Hitter http://www.jump-ing.de/ From demarco at apple.com Thu Aug 9 13:20:15 2001 From: demarco at apple.com (Vince DeMarco) Date: Thu Nov 3 14:47:05 2005 Subject: Thread Manager and Cocoa In-Reply-To: Message-ID: On Thursday, August 9, 2001, at 11:42 AM, Rosyna wrote: > Simple reason, I want a cooperative thread. NSThreads are not cooperative > and take up ungodly amount of CPU time. If you have any suggestions for > decreasing the CPU time of an NSThread without stopping it, I am open to > them. > Use mutexes and conditions correctly to put the thread to sleep. They are using alot of cpu because the (I haven't seen your code), threads are probably waiting in a busy loop for something. vince > Ack, at 8/9/01, Corey O'Connor said: > >> Ummmm... Why would you? There are signifigantly >> better ways to thread under Cocoa. I actually don't >> know how you would even pull this off. The structures >> might be too different to do it anyways. >> So, in short my answer is: Is it safe? Proabably, >> but I wouldn't do it. It's like buying a corvet and >> putting a VW bus engine in it. ;-) > > -- Sincerely, > Rosyna Keller > Technical Support/Holy Knight/Always needs a hug > > Unsanity: Unsane Tools for Insane People > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From Alec.Bartsch at disney.com Thu Aug 9 14:20:15 2001 From: Alec.Bartsch at disney.com (Alec Bartsch) Date: Thu Nov 3 14:47:05 2005 Subject: Hints on NSData Message-ID: Hi, This recent discussion about using NSArrays to implement queues has been very interesting and enlightening to someone like myself who is new to Cocoa and OO techniques in general. And the idea of "premature optimization" leads nicely into the question I need to ask. My problem is this: I need to scan through potentially huge data files as fast as possible, and due to the nature of the data this scanning will typically have to be done one byte at a time. My first thought would be to use NSData's dataWithContentsOfFile: method to instantiate my file in memory, since the docs say: "Data objects can wrap data of any size. When the data size is more than a few memory pages, the object uses virtual memory management." Fine. This leads me to wonder why one would ever need to use the dataWithContentsOfMappedFile: method instead, but that's another question. But more importantly, I'm wondering about the distinction between the bytes: method, which returns a pointer to the data, and the various getBytes: methods, which copy the data into a preallocated buffer. If I simply acquire the pointer once at the beginning using bytes:, then treat my data as one massive char array and go to town with pointer deferencing, does that approach (a) violate the spirit of using an object-oriented data wrapper in the first place, and/or (b) simply not work, due to some special virtual memory management going on internally in the object? The docs say that the bytes: method "returns read-only access to the data," which is what I need, but does that somehow imply or guarantee that the data is actually in a contiguous address space? Basically, I'm concerned about the performance overhead of using the various getBytes or deserialize methods to grab a single byte at a time from my enormous files. Would this be an example of premature optimization? Is NSData another example of an object for which there's source code available to examine? Thanks, Alec --------------------------------------------- Alec Bartsch Walt Disney Feature Animation: The Secret Lab The back of this email message is imprinted with an artificial watermark. Hold at a slight angle to view. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2268 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010809/a832108f/attachment.bin From am at yline.com Thu Aug 9 14:30:06 2001 From: am at yline.com (Andreas Monitzer) Date: Thu Nov 3 14:47:05 2005 Subject: Hints on NSData In-Reply-To: Message-ID: <200108092130.XAA00721@am.homeip.net> On Thursday, August 9, 2001, at 11:19 , Alec Bartsch wrote: > Basically, I'm concerned about the performance overhead of using the > various getBytes or deserialize methods to grab a single byte at a time > from my enormous files. Would this be an example of premature > optimization? Try to grab four bytes at once and process them. The PowerPC-processor is a 32 bit-machine, that means that processing 32 bits is just as fast as processing 8 bits. Conclusion: By using four bytes at a time you can speed up your processing by factor four. andy -- Discussion forthcoming. From bwebster at owlnet.rice.edu Thu Aug 9 14:31:45 2001 From: bwebster at owlnet.rice.edu (Brian Webster) Date: Thu Nov 3 14:47:05 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <200108091932.MAA20457@lists.omnigroup.com> Message-ID: on 8/9/01 2:32 PM, macosx-dev-request@omnigroup.com at macosx-dev-request@omnigroup.com wrote: > on 8/9/01 8:28 AM, Richard Frith-Macdonald at richard@brainstorm.co.uk > wrote: > >> >> On Thursday, August 9, 2001, at 04:12 PM, Dennis C. De Mars wrote: >> >> Of course, a list-based implementation *is* better in some >> circumstances, but IMO an array based >> implementation is good for the majority of cases. > > This is probably one reason why the STL allows the user the option of > specifying the underlying data structure (stacks and queues are actually > "adapters" to more basic containers in that system). > > OK, you convinced me that a linked list is not optimum for this purpose. I > was trying to see how these data structures could be supported without an > explosion of container classes, but you wouldn't want to carry around a > permanent performance tax just to maintain a small number of classes. > > I still think NSMutableArray is not the most suitable way to implement a > queue, though, it would probably be better to create a class that used a > plain C array internally. Perhaps a compromise could be that when creating an array, you could pass in a "hint" as to how the array is going to be used, and thus the implementation could use one data structure or another that will give best performance for what you pass in. It'd be similar in concept to NSMutableArray's -initWithCapacity: except it would be -initWithStorageHint: or something like that, and you could pass in NSOptimizeForInsertion or NSOptimizeForMemory or NSOptimizeForAccess, depending on which operations you want to be fastest. If need be, the hint could be ignored, like if someone were writing their own NSArray subclass with a specific storage method, just like -initWithCapacity: isn't guaranteed to allocate all the memory it needs upon initialization. I think this would be a pretty good solution in terms of compatilibility and encapsulation, while still providing the developer some way to perform optimizations. -- Brian Webster bwebster@owlnet.rice.edu http://www.owlnet.rice.edu/~bwebster/ From ocs at ocs.cz Thu Aug 9 15:01:06 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:05 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <200108092131.f79LVvw09790@scv2.apple.com> References: <200108092131.f79LVvw09790@scv2.apple.com> Message-ID: <200108092202.AA18233@ocs.cz> BFrank, >>>>>> BFrank (B) wrote at Thu, 9 Aug 2001 16:26:20 -0500: B> id returnValue = [self lastObject]; B> [self removeLastObject]; B> return returnValue; I would not really recommend that ;) Try rather something on lines of id retval=[[self lastObject] retain]; [self removeLastObject]; return [retval autorelease]; --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From mwatson at apple.com Thu Aug 9 15:28:34 2001 From: mwatson at apple.com (Matt Watson) Date: Thu Nov 3 14:47:05 2005 Subject: Thread Manager and Cocoa In-Reply-To: Message-ID: <200108092228.PAA15773@scv3.apple.com> Could you post an example of what you're doing? You should be using NSConditionLock to synchronize between threads. Sounds like you're busy-waiting instead. matt. On Thursday, August 9, 2001, at 11:42 AM, Rosyna wrote: > Simple reason, I want a cooperative thread. NSThreads are not > cooperative and take up ungodly amount of CPU time. If you have any > suggestions for decreasing the CPU time of an NSThread without stopping > it, I am open to them. > > Ack, at 8/9/01, Corey O'Connor said: > >> Ummmm... Why would you? There are signifigantly >> better ways to thread under Cocoa. I actually don't >> know how you would even pull this off. The structures >> might be too different to do it anyways. >> So, in short my answer is: Is it safe? Proabably, >> but I wouldn't do it. It's like buying a corvet and >> putting a VW bus engine in it. ;-) > > -- Sincerely, > Rosyna Keller > Technical Support/Holy Knight/Always needs a hug > > Unsanity: Unsane Tools for Insane People > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From sgehrman at mac.com Thu Aug 9 16:03:19 2001 From: sgehrman at mac.com (Steve Gehrman) Date: Thu Nov 3 14:47:05 2005 Subject: Relaunching App as Root In-Reply-To: <200108092255.PAA01782@lists.omnigroup.com> Message-ID: <200108092302.QAA18632@smtpout.mac.com> I can launch an app as root using Authorization framework with out problems, but I would like to have an option to relaunch my app as root. Does anyone have a cool technique to do this? I tried to issue an open on my app (the same app that I am currently running) but it didn't do anything. I can launch a separate copy of my app as root, but I really want to issue an open, quit my app, and have my app relaunch as root. steve From snoyes at execpc.com Thu Aug 9 16:31:47 2001 From: snoyes at execpc.com (snoyes@execpc.com) Date: Thu Nov 3 14:47:05 2005 Subject: Hints on NSData In-Reply-To: Message-ID: <200108092331.f79NVLv82474@pop5.nwbl.wi.voyager.net> On Thursday, August 9, 2001, at 02:19 PM, Alec Bartsch wrote: > Hi, > > This recent discussion about using NSArrays to implement queues has > been very interesting and enlightening to someone like myself who is > new to Cocoa and OO techniques in general. And the idea of "premature > optimization" leads nicely into the question I need to ask. > > My problem is this: I need to scan through potentially huge data files > as fast as possible, and due to the nature of the data this scanning > will typically have to be done one byte at a time. My first thought > would be to use NSData's dataWithContentsOfFile: method to instantiate > my file in memory, since the docs say: "Data objects can wrap data of > any size. When the data size is more than a few memory pages, the > object uses virtual memory management." Fine. This leads me to wonder > why one would ever need to use the dataWithContentsOfMappedFile: method > instead, but that's another question. > Memory. If you have a 100 MByte file it might be better to keep the data mapped to the disk instead of reading in the entire file and writing the thing back out to the VM swap file. > But more importantly, I'm wondering about the distinction between the > bytes: method, which returns a pointer to the data, and the various > getBytes: methods, which copy the data into a preallocated buffer. If I > simply acquire the pointer once at the beginning using bytes:, then > treat my data as one massive char array and go to town with pointer > deferencing, does that approach (a) violate the spirit of using an > object-oriented data wrapper in the first place, and/or (b) simply not > work, due to some special virtual memory management going on internally > in the object? The docs say that the bytes: method "returns read-only > access to the data," which is what I need, but does that somehow imply > or guarantee that the data is actually in a contiguous address space? getBytes returns a copy. Do you want to carry around a 100 MB copy? The answer might be yes. It might be, I don't care. > > Basically, I'm concerned about the performance overhead of using the > various getBytes or deserialize methods to grab a single byte at a time > from my enormous files. I would use the "bytes" method and walk through the file using a C pointer. As for the "dataWithContentsOfMappedFile", there have been problems in the past but it is probably working well now. Give it a try. And don't worry about the VM unless it slows things down. Then think about it. > Would this be an example of premature optimization? Is NSData another > example of an object for which there's source code available to examine? > In GNUStep maybe? > Thanks, > > Alec Steven Noyes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2950 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20010809/11a69496/attachment.bin From pa44 at cornell.edu Thu Aug 9 16:34:10 2001 From: pa44 at cornell.edu (Peter Ammon) Date: Thu Nov 3 14:47:05 2005 Subject: undefined symbols In-Reply-To: Message-ID: on 8/9/01 12:05 PM, Rick Jarosh at rickjarosh@lycos.com wrote: > I've gotten a compiler error message "undefined symbols" but when I click on > the Stop icon all that comes up is the entire project folder,rather than > having the particular line that is causing the problem highlighted.Does anyone > know how I can find out where the problem arises. > Thanks, > Rick Undefined symbols occur when a function or a class that you use is never defined. In my experience, the most common cause of undefined symbols using Project Builder is that I accidentally removed one of the files from the target. Look at the list of files; there should be a dot on the left side of every header and source file (but not directories). If there isn't a dot, that file has been removed; click the place where the dot should be to add it again. Hope this helps. -Peter From tnorton at lacie.com Thu Aug 9 16:50:50 2001 From: tnorton at lacie.com (Thane Norton) Date: Thu Nov 3 14:47:05 2005 Subject: Checksum In-Reply-To: <200108092130.XAA00721@am.homeip.net> References: <200108092130.XAA00721@am.homeip.net> Message-ID: I am putting some checksum code into my application, and I wanted to know what functions I should be using. At first I was going to use sha or ripemd, but neither header file (openssl/sha.h, openssl/ripemd.h) seem to exist, except in a number of Darwin projects. I guess I will fall back to md5, unless someone has a better suggestion. -- V. Thane Norton III Software Engineer LaCie, Ltd. Phone: 503.844.4569 Cell: 503.351.7971 Fax: 503.844.4593 mail: tnorton@lacie.com page: thanephone@crashbox.com From brian_hill at unioncab.com Thu Aug 9 17:22:03 2001 From: brian_hill at unioncab.com (Brian Hill) Date: Thu Nov 3 14:47:05 2005 Subject: Checksum In-Reply-To: Message-ID: On Thursday, August 9, 2001, at 06:50 PM, Thane Norton wrote: > I am putting some checksum code into my application, and I wanted > to know what functions I should be using. At first I was going to > use sha or ripemd, but neither header file (openssl/sha.h, > openssl/ripemd.h) seem to exist, except in a number of Darwin > projects. I guess I will fall back to md5, unless someone has a > better suggestion. The openssl libraries are in /usr/lib (crypto and ssl), it's just the headers that are missing from the dev package (I have no idea why...). You can get them from Darwin -- I got mine from the openssl site. If you use the openssl functions on OSX, you can rely on the libraries being on the user's system. Just add '-lcrypto -lssl' to the OTHER_LDFLAGS item in PB, Brian brianhill@mac.com http://personalpages.tds.net/~brian_hill ?????????????????????????????????????????????????????? "Why? I came into this game for adventure - go anywhere, travel light, get in, get out, wherever there's trouble, a man alone. Now they've got the whole country sectioned off and you can't move without a form. I'm the last of a breed." -- Archibald "Harry" Tuttle, Rogue HVAC Repairman From d.theisen at gmx.net Thu Aug 9 17:26:32 2001 From: d.theisen at gmx.net (Dirk Theisen) Date: Thu Nov 3 14:47:05 2005 Subject: Custom Spelling Dictionaries? Message-ID: Hi! I am wondering, if it is possible to provide additional dictionaries for the AppleSpell.service. Currently, Apple only ships an english spell checker, which is unfortunate. I'd like to be able to add a new (empty) dictionary and have it learn lots of correct Text. I know there is documentation about how to write your own spell server, but that is not what I have time to. Any hints (from the old NeXTies?) welcome... Dirk From jco at blueneptune.com Thu Aug 9 17:30:49 2001 From: jco at blueneptune.com (Jay O'Conor) Date: Thu Nov 3 14:47:05 2005 Subject: Mac OS X Finder contextual menus? Message-ID: <200108100030.RAA19183@rainey.blueneptune.com> How does one go about adding contextual menu modules for Mac OS X's Finder? I thought I'd start by trying FSFindFolder with kContextualMenuItemsFolderType on OS X to see where CMMs go, but that just returns -43 (fnfErr). Anyone have any clues? Jay From ddavidso at apple.com Thu Aug 9 17:32:10 2001 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:47:05 2005 Subject: Custom Spelling Dictionaries? In-Reply-To: Message-ID: <323388E4-8D27-11D5-AE78-000393115062@apple.com> On Thursday, August 9, 2001, at 04:41 PM, Dirk Theisen wrote: > I am wondering, if it is possible to provide additional dictionaries > for the AppleSpell.service. Currently, Apple only ships an english > spell checker, which is unfortunate. > > I'd like to be able to add a new (empty) dictionary and have it learn > lots of correct Text. > > I know there is documentation about how to write your own spell server, > but that is not what I have time to. At the moment the only option is to write your own spellchecker. We are working on this, though. Douglas Davidson From rainer at brockerhoff.net Thu Aug 9 17:36:40 2001 From: rainer at brockerhoff.net (Rainer Brockerhoff) Date: Thu Nov 3 14:47:05 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <200108092255.PAA01734@lists.omnigroup.com> References: <200108092255.PAA01734@lists.omnigroup.com> Message-ID: >Date: Thu, 9 Aug 2001 19:33:16 -0000 >From: "Dennis C. De Mars" > >And of course, I must capitulate to the notion that you can directly use >NSMutableArray as a queue, since the internal implementation (for the common >case) is already the most efficient way to implement a queue. >... > > Okay then, so we're all happy and can stop arguing now? :-) > >Well, I didn't see it as an agrument, I just thought we were tossing ideas back >and forth on the options for implementing a queue. I do agree that with your post >and Richard Frith-Macdonald's post we now have a wealth of information on the >subject. One aspect which (I think) has not been mentioned about the "NSMutableArray as a queue" solution is the thread aspect. Is NSMutableArray thread-safe, so one thread can push low-volume data to another thread? I'd guess not... (yes, I know there are other, better, solutions). This leads me to a question, does anybody know if a thread can safely post an event to the main thread's event queue, using [NSApp sendEvent:...]? -- Rainer Brockerhoff Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." http://www.brockerhoff.net/ (updated July 2000) From bbum at codefab.com Thu Aug 9 19:30:34 2001 From: bbum at codefab.com (Bill Bumgarner) Date: Thu Nov 3 14:47:05 2005 Subject: Where is the Cocoa queue container class (NSQueue?) In-Reply-To: <200108092131.f79LVvw09790@scv2.apple.com> Message-ID: <0GHT0070DYYHV2@mta4.srv.hcvlny.cv.net> I would encourage folks to not implement the queueing API as a category to NSMutableArray simply because it will make it a bear to optimize into its own class later as there will be no way to tell if [NSMutableArray array] means "give me an array" or "give me a queue" and, as such, finding and replacing all of the "give me a queue" uses will require actually reviewing each use of NSMutableArray. Instead, create a class-- either subclass of NSMutableArray or NSObject-- that encapsulates an instance of NSMutableArray and implement's Bob's API. Even if you subclass NSMutableArray, you will need to contain an instance of NSMutableArray due to the class cluster nature of NSMutableArray (when you instantiate an NSMutableArray via, say, the +array method, you are actually instantiating an opaque subclass of the class cluster parent). Not only will this make optimization easier later in that it is easy to find the uses of the queue class, but it will make the queue implementation easier in that you only need to optimize the methods on the queue class and don't have to worry about the methods on NS*Array that you may not have implemented. An alternative implementation is to create a subclass of NSMutableArray, implement the category as Bob indicated, and refer to the subclass only when creating instances of array's that will be used in a queue context. This maintains the ease of optimization-- if it becomes necessary-- without incurring any significant amount of extra work. (In general, I'm hesitant to use categories to extend Foundation classes. While ultra convenient, it tends to be abused and makes the codebase extremely difficult to figure out if one isn't familiar with everything within. In particular, it changes or extends the behavior of classes such that one cannot assume that a class works the same way across two projects. It also makes maintenance across multiple revisions of the Foundation considerably more difficult and can lead to some really painful bugs-- anyone remember the -addObjectIfAbsent: fiasco? That one left scars.) b.bum On Thursday, August 9, 2001, at 05:26 PM, BFrank wrote: > On Thursday, August 9, 2001, at 02:14 PM, Todd Blanchard wrote: > >> . . . this whole argument is about premature optimization. Its an >> error in thinking to care at all how NSArray works or how it performs >> for implementing your queue at this stage. . . . . if you simply must >> have a queue interface (which only needs, push, pop, peek, and count), >> throw one onto an NSArray as a category. > > Hi all, > > I couldn't agree more. I was just going to toss up this category for > anyone on the list that wants it. Enjoy, use, critique, ignore ... > whatever. > > -Bob Frank > > PS: very interesting discussion. From rickjarosh at lycos.com Fri Aug 10 00:59:58 2001 From: rickjarosh at lycos.com (Rick Jarosh) Date: Thu Nov 3 14:47:05 2005 Subject: NSRect bounds syntax/documentation Message-ID: I'm trying out an example app from the appendix of O'Reilly's Learning Cocoa that draws a simple string in an NSView starting at one-quarter the width of the view and 5 pixels down,the code that is listed in the book doesn't compile,the offending line is: [string drawAtPoint: NSMakePOint()myBounds size.width/4.0),5) withAttributes: attrs]; Placed in the context of the full method it is: - (void)drawRect:(NSRect)rect { NSRect myBounds = [self bounds]; NSMutableDictionary *attrs = [NSMutableDictionary dictionary]; [attrs setObject: font forKey: NSFontAttributeName]; [string drawAtPoint: NSMakePoint(myBounds size.width/4.0, 5) withAttributes: attrs]; } Basically I want to calculate 1/4 the bounds of the NSRect myBounds,but the syntax "myBounds size.width" sounds like Java to me,if so what is it doing here?Anyway,I want to fix this so that it will compile,any suggestions will be appreciated. Thanks, Rick Get 250 color business cards for FREE! http://businesscards.lycos.com/vp/fastpath/ From rickjarosh at lycos.com Fri Aug 10 01:16:32 2001 From: rickjarosh at lycos.com (Rick Jarosh) Date: Thu Nov 3 14:47:05 2005 Subject: IgnoreMyLastPost:ProblemSolved Message-ID: myBounds size.width/4.0 should read myBounds.size.width/4.0 By the way does anyone know the reason for the Java-like syntax? Rick Get 250 color business cards for FREE! http://businesscards.lycos.com/vp/fastpath/ From jerome.foucher at free.fr Fri Aug 10 01:17:59 2001 From: jerome.foucher at free.fr (jerome.foucher) Date: Thu Nov 3 14:47:05 2005 Subject: Mac OS X Finder contextual menus? In-Reply-To: <200108100030.RAA19183@rainey.blueneptune.com> Message-ID: <20010810081752.5408A20F69@s2.relay.oleane.net> On vendredi, ao?t 10, 2001, at 02:30 , Jay O'Conor wrote: > How does one go about adding contextual menu modules for Mac OS X's > Finder? > If I'm right, under 10.0.x, there's no support for external contextual menu plugins for the Finder. And thus, no APIs for creating ones. It should be one of the so-many-features that should appear in 10.1, but as far as I've seen (build 5F26 seeded last week), the contextual menu plugins are still missing. Can anyone confirm that ? J?rome From rick at icons.cx Fri Aug 10 01:29:16 2001 From: rick at icons.cx (Rick Roe) Date: Thu Nov 3 14:47:05 2005 Subject: IgnoreMyLastPost:ProblemSolved In-Reply-To: Message-ID: > By the way does anyone know the reason for the Java-like syntax? It's not Java-like. An NSRect is a structure with two fields, origin and size. origin is an NSPoint -- another structure, with fields x and y -- and size is an NSSize, a structure with fields width and height. Structures (and the dot operator as a means of accessing them) are a C construct that has been around longer than I have. :) -- Rick Roe icons.cx / The Omni Group From rick at icons.cx Fri Aug 10 01:33:01 2001 From: rick at icons.cx (Rick Roe) Date: Thu Nov 3 14:47:05 2005 Subject: Mac OS X Finder contextual menus? In-Reply-To: <20010810081752.5408A20F69@s2.relay.oleane.net> Message-ID: > It should be one of the so-many-features that should appear in > 10.1, but as far as I've seen (build 5F26 seeded last week), the > contextual menu plugins are still missing. As far as the charter of this mailing list is concerned, 5F26 doesn't exist. -- Rick Roe icons.cx / The Omni Group From jshockey at world.std.com Fri Aug 10 01:35:26 2001 From: jshockey at world.std.com (John Shockey) Date: Thu Nov 3 14:47:05 2005 Subject: IgnoreMyLastPost:ProblemSolved In-Reply-To: References: Message-ID: At 4:15 AM -0400 8/10/01, Rick Jarosh wrote: >myBounds size.width/4.0 should read >myBounds.size.width/4.0 > >By the way does anyone know the reason for the Java-like syntax? NSRect is just a plain old struct -- not an Objective-C class. John Shockey jshockey@world.std.com From jerome.foucher at free.fr Fri Aug 10 01:39:04 2001 From: jerome.foucher at free.fr (jerome.foucher) Date: Thu Nov 3 14:47:05 2005 Subject: Mac OS X Finder contextual menus? In-Reply-To: Message-ID: <20010810083855.AAABF20F8F@s2.relay.oleane.net> On vendredi, ao?t 10, 2001, at 10:32 , Rick Roe wrote: >> It should be one of the so-many-features that should appear in >> 10.1, but as far as I've seen (build 5F26 seeded last week), the >> contextual menu plugins are still missing. > > As far as the charter of this mailing list is concerned, 5F26 > doesn't exist. Sorry, my fault. I didn't mean to break rules.... J?rome From thomasdeniau at mac.com Fri Aug 10 02:01:13 2001 From: thomasdeniau at mac.com (Thomas Deniau) Date: Thu Nov 3 14:47:05 2005 Subject: NSRect bounds syntax/documentation In-Reply-To: Message-ID: <20010810090039.0D023CF177@clubinfo.eu.org> Le vendredi 10 ao?t 2001, ? 09:59, Rick Jarosh a ?crit : > the syntax "myBounds size.width" sounds like Java to me,if so what is > it doing here?Anyway,I want to fix this so that it will compile, I think that you have to write myBounds.size.width, not myBounds size.width. From ocs at ocs.cz Fri Aug 10 02:30:55 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:05 2005 Subject: Mac OS X Finder contextual menus? In-Reply-To: <20010810081752.5408A20F69@s2.relay.oleane.net> References: <20010810081752.5408A20F69@s2.relay.oleane.net> Message-ID: <200108100933.AA18855@ocs.cz> jerome., >>>>>> jerome.foucher (jf) wrote at Fri, 10 Aug 2001 10:16:17 +0200: jf> It should be one of the so-many-features that should appear in jf> 10.1, but as far as I've seen (build 5F26 seeded last week), the jf> contextual menu plugins are still missing. _IF_ the Services are really supported as someone said here, you need no such beast. (for things like Open With) --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ocs at ocs.cz Fri Aug 10 02:31:23 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:05 2005 Subject: NSRect bounds syntax/documentation In-Reply-To: References: Message-ID: <200108100933.AA18865@ocs.cz> Rick, >>>>>> Rick Jarosh (RJ) wrote at Fri, 10 Aug 2001 03:59:08 -0400: RJ> NSMakePOint()myBounds size.width/4.0),5) This can't compile indeed. NSMakePoint(myBounds.size.width/4,5) should. RJ> Basically I want to calculate 1/4 the bounds of the NSRect myBounds,but RJ> the syntax "myBounds size.width" sounds like Java to me,if so what is it RJ> doing here? For things so lightweigth that is it not worth to make classes for them (points, rects, sizes,...) plain old C structs are used. Check the headers -- in this case, AppKit/NSGeometry.h. --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From ocs at ocs.cz Fri Aug 10 02:33:09 2001 From: ocs at ocs.cz (Ondra Cada) Date: Thu Nov 3 14:47:05 2005 Subject: NSRect bounds syntax/documentation References: Message-ID: <200108100935.AA18878@ocs.cz> Oh, and I forgot: >>>>>> Ondra Cada (OC) wrote at Fri, 10 Aug 2001 11:33:26 +0200: RJ>> NSMakePOint()myBounds size.width/4.0),5) OC> OC> This can't compile indeed. OC> OC> NSMakePoint(myBounds.size.width/4,5) OC> OC> should. NSMakePoint(NSWidth(myBounds)/4,5) would be even better! --- Ondra Cada OCSoftware: ocs@ocs.cz http://www.ocs.cz private ondra@ocs.cz http://www.ocs.cz/oc From chris.ridd at messagingdirect.com Fri Aug 10 03:03:22 2001 From: chris.ridd at messagingdirect.com (Chris Ridd) Date: Thu Nov 3 14:47:05 2005 Subject: NSRect bounds syntax/documentation In-Reply-To: <200108100935.AA18878@ocs.cz> Message-ID: <108800000.997437755@bagheera.isode.com> Ondra Cada wrote: > Oh, and I forgot: > >>>>>>> Ondra Cada (OC) wrote at Fri, 10 Aug 2001 11:33:26 +0200: > RJ>> NSMakePOint()myBounds size.width/4.0),5) > OC> > OC> This can't compile indeed. > OC> > OC> NSMakePoint(myBounds.size.width/4,5) > OC> > OC> should. > > NSMakePoint(NSWidth(myBounds)/4,5) > > would be even better! Everyone is of course aware that O'Reilly publish confirmed and reported errata for all of their books, including Learning Cocoa? The missing '.' here has been reported (maybe by the original poster :-) http://www.oreilly.com/catalog/learncocoa/errata/ Cheers, Chris From kubernan at 10191.com Fri Aug 10 03:12:50 2001 From: kubernan at 10191.com (kubernan) Date: Thu Nov 3 14:47:05 2005 Subject: How to (NSPortTimeoutException in DO) ??? Message-ID: <200108101012.DAA14465@omnigroup.com> Bonjour, I want to set up a timeout (for the reply) in my Distributed Object connection. It's the first time i use NSNotificationCenter and i have pbs with raising NSPortTimeoutException : Here is the log : *** malloc[996]: Deallocation of a pointer not malloced: 0x13b3f80; This could be a double free(), or free() called with the middle of an allocated block; Try setting environment variable MallocHelp to see tools to help debug Aug 10 12:06:12 Interactive Braininabox 1.8[996] An uncaught exception was raised Aug 10 12:06:12 Interactive Braininabox 1.8[996] connection timeout: did not receive reply Aug 10 12:06:12 Interactive Braininabox 1.8[996] *** Uncaught exception: connection timeout: did not receive reply Here is the part of my source code : -(void)ThreadTest:(bycopy NSMutableDictionary*)data_for_server { // ..some code NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init ]; serverConn = [NSConnection connectionWithRegisteredName:@"ThreadedNeuralNetwork" host:nil]; theProxy = [[serverConn rootProxy] retain]; [[NSNotificationCenter defaultCenter] addObserver:theProxy selector:@selector(connectionTimeOut:) name:NSPortTimeoutException object:nil]; // tried with serverConn Object [serverConn enableMultipleThreads]; [serverConn setReplyTimeout:timeout]; threadedNeuralNetwork = [[[serverConn rootProxy] retain] autorelease]; reply = [[[threadedNeuralNetwork network_process:data_for_server] retain] autorelease]; // reply is NSMutableDic.... [pool release]; } -(void)connectionTimeOut { NSBeep(); } - What i don't understand is the "*** malloc[996]: Deallocation of a ...". I tried to add autorelease of all my objects in this part of source code, but .. have the same pb. - What i don't understand is why i'm not able to hear the Beep ! Can you help Me ? From zak_ziggy at hotmail.com Fri Aug 10 06:52:22 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:05 2005 Subject: Distributed Object connections Message-ID: Cameron, I have a BugApp that is made specifically to address a code sample for NSConnections. I can email you (or anybody) this and a threaded version if you like. First off this code has been ported back to OpenStep to confirm that it works perfectly there, but in OSX all hell brakes loss. Starting with the host:nil issue which is not to spec and suggests there is a problem. I have an Apple guy by chance (because I mentioned it in this group) analyzing it when he has a chance. He was able to show me a solution to another mystery that I had. So now I am hopeful, he can find some way to make it work to shut me up in the message boards, but because this code works in OpenStep I am sure there is a problem (like host:nil suggests). There are other problems regarding threading that can be found in the Bug Tracker (at http://publicsource.apple.com/bugs) under Crashers, recently hidden from public (from what I can tell, it is hidden pretty good if it is not total removed from link hunting. It should be located in bugreporter.apple.com's main page. I will be submitting this as a bug just as soon as I hear back from the Apple guy (depending, but at least the host:nil thing will get there). What happens is detailed in the readme of the BugApp, but basically many errors occur randomly (about 5+) viewable in debug mode when analyzing the stack list for all the threads. Mostly when getting the value from the Connection Server, it crashes. The difference between our code from what I can tell is I use a method enableMutipleThreads which is needed for my purposes badly (and makes no difference without it), and you are using something for the RootProxy I use self [theConnection setRootProxy:self], (which I bet makes no difference and if it did I do not use one so that should work first. From bbum at codefab.com Fri Aug 10 07:40:16 2001 From: bbum at codefab.com (Bill Bumgarner) Date: Thu Nov 3 14:47:05 2005 Subject: undefined symbols In-Reply-To: <200108100955.CAA22073@lists.omnigroup.com> Message-ID: <200108101440.f7AEe7T32703@pi.codefab.com> There is an evil bug in Project Builder that causes undefined symbols to not actually be reported in the parsed build output window-- i.e. the pane of the window that contains the error messages that you can click on. Worse, it won't appear in the the build console log either unless you change a preference. In the build preferences, change the output mode to VERBOSE (or extra noisy or whatever the maximum level is) and the undefined symbols will be listed in the build console (but not the parsed build output). Do you see any warnings when building? Often, an undefined symbol is because of a misspelled function/global reference which produced a warning at compile time and an undefined symbol when linking. b.bum On Friday, August 10, 2001, at 05:55 AM, macosx-dev- request@omnigroup.com wrote: > Date: Thu, 09 Aug 2001 16:34:04 -0700 > Subject: Re: undefined symbols > From: Peter Ammon > To: > CC: > > on 8/9/01 12:05 PM, Rick Jarosh at rickjarosh@lycos.com wrote: > >> I've gotten a compiler error message "undefined symbols" but when I >> click on >> the Stop icon all that comes up is the entire project folder,rather >> than >> having the particular line that is causing the problem >> highlighted.Does anyone >> know how I can find out where the problem arises. >> Thanks, >> Rick From zak_ziggy at hotmail.com Fri Aug 10 07:44:57 2001 From: zak_ziggy at hotmail.com (Zak Ziggy) Date: Thu Nov 3 14:47:05 2005 Subject: Distributed Object connections Message-ID: Well at first I was amazed to see somebody has this working, but after implementation of the code attached... (with a few typos) Involving no more 'registration name'! Something I would have to rebuild if it is not working. After testing this I get the error [NSPortCoder sendBeforeTime: sendReplyPort:] timed out. So this is not a workable solution, in multiple ways. >Looks like it's time for another small example project. and yes "It is way past time for another small example project!", and close to rebuilding a subclass of NSConnection that works to the OpenStep spec if possible, but I am still convinced that this goes deeper, into the threading problems, that have been pushed back many versions away from getting out of Beta. I would not allow 10.1 to ship without this problem solved. I would like to speak to the person(s) at that say ... >This is a known problem that isn't going to be fixed (I don't think) >If I understood Apple correctly when this came up last time, "*" is not >going to be supported. But what about registerName: and connectionWithRegisteredName:? Anyone/Everyone please HELP (Apple focus by complaining) !! Zak \ \ \ \ \ or this is were we are going \ \ \ \ \ down to \ \ \ HELL(P)! _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp From RustyLittle at mac.com Fri Aug 10 09:02:41 2001 From: RustyLittle at mac.com (Rusty Little) Date: Thu Nov 3 14:47:05 2005 Subject: [Q] Process blocking and waking Message-ID: <200108101601.JAA07105@smtpout.mac.com> Background: I'm a Mac guy that's still trying to learn Unix details. I've got one process (A) that launches another process (B). B needs to do some initialization and I would like A to block until B's initialization is complete, then A would continue with some duties before blocking for "events". The initialization has a short duration, less than 1/4 of a second. I'm trying to figure out what's the best way for A to be blocked and then awakened by B when it's initialization is complete. I've looked at: 1) mutexes 2) mach messages (I'm already using these for communication between the processes) 3) signals (I handle some signals already) 4) sleep But, I haven't discovered what appears to me as the obvious way to do this. Any hint as to the best and normal way for me to do this would be greatly appreciated. Thanks in advance! Have a great weekend! Rusty From dshadow at zort.net Fri Aug 10 09:14:39 2001 From: dshadow at zort.net (John Bafford) Date: Thu Nov 3 14:47:05 2005 Subject: [Q] Process blocking and waking In-Reply-To: <200108101601.JAA07105@smtpout.mac.com> Message-ID: Your parent could spawn the child, and then SIGSTOP itself. The child process can then do it's initialization and SIGCONT the parent process. This requires your subprocess to be spawned directly from your process, though, and not from a shell. -John On Fri, 10 Aug 2001, Rusty Little wrote: > I've got one process (A) that launches another process (B). B needs to > do some initialization and I would like A to block until B's > initialization is complete, then A would continue with some duties > before blocking for "events". The initialization has a short duration, > less than 1/4 of a second. -- John Bafford dshadow@zort.net http://www.dshadow.com/ From dshadow at zort.net Fri Aug 10 09:19:05 2001 From: dshadow at zort.net (John Bafford) Date: Thu Nov 3 14:47:05 2005 Subject: [Q] Process blocking and waking In-Reply-To: Message-ID: