From wjcheeseman at earthlink.net Fri Nov 1 04:28:01 2002 From: wjcheeseman at earthlink.net (Bill Cheeseman) Date: Thu Nov 3 14:50:20 2005 Subject: Program built on 10.2 does not run correctly In-Reply-To: Message-ID: on 02-10-31 10:12 PM, Nigel Pearson at nigel@ind.tansu.com.au wrote: > I have narrowed the problem down a bit, but not much: I thought some of the replies (including mine) to your earlier post made it clear that there are backward compatibility issues with 10.2 apps, and what some of the cures and workarounds might be. Check the archives on mamasam if you missed them. Also, the last recipe of my book covers this subject -- it's due out within a couple of weeks. Or maybe I missed subsequent discussions, and you're raising a different issue? Anyway, if you do a batch search of the AppKit and Foundation for text containing the string "10_2", you'll get a list of every item in the headers that is new in Mac OS X 10.2. There are 111 of them (or 109, depending on how you count). If your code uses any of the global variables that are new in 10.2, your app won't launch on 10.1.x or older. If it calls any of the C functions that are new in 10.2, it won't launch on older systems unless you enclose it in a block testing for 10.2 or newer. If it calls any of the methods that are new in 10.2, you have to block those calls out with any appropriate test, such as respondsToSelector:. That's the simple answer, omitting a few technical details. -- Bill Cheeseman - wjcheeseman@earthlink.net Quechee Software, Quechee, Vermont, USA http://www.quecheesoftware.com The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes Croquet Club of Vermont - http://members.valley.net/croquetvermont From jim.correia at pobox.com Fri Nov 1 06:15:01 2002 From: jim.correia at pobox.com (Jim Correia) Date: Thu Nov 3 14:50:20 2005 Subject: strip -s -R file format? Message-ID: <3527CB34-EDA4-11D6-B696-000A27D7C068@pobox.com> I'm trying to post process a binary with strip using -s or -R (I'm just trying to make it work now...) The man page says the file format is one symbol name per line, but I can't get it to work. What should the file look like? Just a name? A name with arguments? A name followed by parentheses? Right now I'm just trying plain c symbols run through the c compiler. I've tried different possibilities, and strip always complains that the symbol can't be found. (I can see it with nm.) And since after the above problem gets solved I'm sure this will be my next question: How do I deal with C++ symbols? Feed the mangled version, the unmangled version, or something else? Thanks, Jim From finlay at dobbie.net Fri Nov 1 08:11:01 2002 From: finlay at dobbie.net (Finlay Dobbie) Date: Thu Nov 3 14:50:20 2005 Subject: strip -s -R file format? In-Reply-To: <3527CB34-EDA4-11D6-B696-000A27D7C068@pobox.com> Message-ID: <60AD68FC-EDB4-11D6-BA41-000502319F17@dobbie.net> On Friday, November 1, 2002, at 02:14 pm, Jim Correia wrote: > What should the file look like? Just a name? A name with arguments? A > name followed by parentheses? Right now I'm just trying plain c > symbols run through the c compiler. I did play with this some time ago, I think it's just the symbol name, like for void MyFunction(blah blah blah) the symbol would be _MyFunction (this is standard C, not C++ name mangling). As for C/C++, I'd presume you'd need the name mangled equivalents, and I think there's a utility somewhere for converting between the two. Not sure, though. Also, make sure you're using unix line breaks, I guess. That bit me when I was writing a .htpasswd file last week :-) -- Finlay From jerry.levan at eku.edu Fri Nov 1 08:14:02 2002 From: jerry.levan at eku.edu (Jerry LeVan) Date: Thu Nov 3 14:50:20 2005 Subject: How can I start an application by dragging a file to an app Message-ID: Hi, In my effort to learn cocoa I am building a "CSV" (comma sep values) editor. I can display files in a table ok so the first version is semi functional. I am currently getting the file via NSOpenPanel. I would like to start the application by dragging a file onto the app. I am having a bit of trouble finding documentation on how to set things up so that the application is launched and is made aware of the path name of the file dragged onto the application. Jeff LaMarche suggested that I would need to fiddle with the info.plist. It appears that what is needed is CFBundleDocumentTypes entry. Perhaps something like: CFBundleDocumentTypes CFBundleTypeExtensions * CFBundleTypeName NSStringPboardType CFBundleTypeOSTypes **** CFBundleTypeRole Editor But it is not clear to me how the launched application is made aware of the file that was dragged onto the app. I assume that there is some notification that is posted that the application can use to find the file name. If this is the case, then it is not clear to me how and when to make use of this infomation. I have spent a reasonable amount of time trying to search the apple documentation but have come up dry. Could some kind soul illuminate me... --Jerry From jim.correia at pobox.com Fri Nov 1 08:19:01 2002 From: jim.correia at pobox.com (Jim Correia) Date: Thu Nov 3 14:50:20 2005 Subject: strip -s -R file format? In-Reply-To: <60AD68FC-EDB4-11D6-BA41-000502319F17@dobbie.net> Message-ID: <7EDC256E-EDB5-11D6-B696-000A27D7C068@pobox.com> On Friday, November 1, 2002, at 11:10 AM, Finlay Dobbie wrote: > On Friday, November 1, 2002, at 02:14 pm, Jim Correia wrote: > >> What should the file look like? Just a name? A name with arguments? A >> name followed by parentheses? Right now I'm just trying plain c >> symbols run through the c compiler. > > I did play with this some time ago, I think it's just the symbol name, > like for > void MyFunction(blah blah blah) > > the symbol would be > _MyFunction > > (this is standard C, not C++ name mangling). Sorry - I didn't include that information in the original message. I've tried _MyFunction. Still says correia% strip -R stripme.txt test strip: symbols names listed in: stripme.txt not in: test _MyFunction > Also, make sure you're using unix line breaks, I guess. That bit me > when I was writing a .htpasswd file last week :-) Yes - using unix line breaks. Jim From jmdisher at student.math.uwaterloo.ca Fri Nov 1 09:14:01 2002 From: jmdisher at student.math.uwaterloo.ca (Jeff Disher) Date: Thu Nov 3 14:50:20 2005 Subject: How can I start an application by dragging a file to an app In-Reply-To: Message-ID: <4E4EB861-EDBD-11D6-8F46-000393B6A966@student.math.uwaterloo.ca> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: Jeff Disher.vcf Type: text/directory Size: 340 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021101/17f41f65/JeffDisher.bin -------------- next part -------------- Skipped content of type multipart/alternative From brock at bergdesign.com Fri Nov 1 09:28:01 2002 From: brock at bergdesign.com (Brock Brandenberg) Date: Thu Nov 3 14:50:20 2005 Subject: pdf transparency, again In-Reply-To: <200210312001.g9VK15f05704@slowbro.omnigroup.com> Message-ID: > I have found out what the problem is - if I include any text in PDF, > transparency in Quartz goes away, somehow. If there is no text in pdf > file (e.g. only rectangle fills), transparency works. Could this be > true? I am currently using transparency with mixed text and graphics in PDF files without any problems. My question would be, what method are you using to draw the text? I am drawing individual lines of text (titles, not big bodies of text) using the CG routines like CGContextShowGlyphsAtPoint(). The color is being set in the context with CGContextSetRGBFillColor() to workaround the AppKit deficiencies. Note that the text being written into the PDF is indeed a line of text with embedded font characters, not as outlines. I have outlining routines also and they too are working fine. TO generate the PDF, I'm using the Cocoa dataWithPDFInsideRect: method. Some text methods draw using context attributes while others use the text attributes. Might there be a conflict between the context and text attributes that is causing your problem? Brock Brandenberg ----- industrial design @ www.bergdesign.com ------ From ben at zygoat.ca Fri Nov 1 10:31:01 2002 From: ben at zygoat.ca (Ben Kennedy) Date: Thu Nov 3 14:50:20 2005 Subject: [OT] please ditch the attachments In-Reply-To: <4E4EB861-EDBD-11D6-8F46-000393B6A966@student.math.uwaterloo.ca> References: <4E4EB861-EDBD-11D6-8F46-000393B6A966@student.math.uwaterloo.ca> Message-ID: <20021101183000.14902@balsam> Hey Jeff, I'm sure I speak for others; would you kindly stop sending the "jeff disher.vcf" attachment to the mailing lists? (I'm getting tired of having to delete the file repeatedly) thanks, -ben -- Ben Kennedy, chief magician zygoat creative technical services 613-228-3392 | 1-866-466-4628 http://www.zygoat.ca From martin-gilles.lavoie at oracle.com Fri Nov 1 10:48:01 2002 From: martin-gilles.lavoie at oracle.com (Martin-Gilles Lavoie) Date: Thu Nov 3 14:50:20 2005 Subject: [OT] please ditch the attachments In-Reply-To: <20021101183000.14902@balsam> Message-ID: <458A9EA2-EDCA-11D6-A4F6-0003938E758A@oracle.com> Le Vendredi, 1 nove 2002, ? 13:30 America/Montreal, Ben Kennedy a ?crit : > Hey Jeff, > > I'm sure I speak for others; would you kindly stop sending the "jeff > disher.vcf" attachment to the mailing lists? (I'm getting tired of > having to delete the file repeatedly) > > thanks, > > -ben These attachments are automatic by some e-mailers. Besides, it's not like the file contains kilobytes of data. The mime-encoded vCard takes a few dozen bytes at most. Just ignore them, and your blood pressure should return to normal. ______________________________________________________________________ Martin-Gilles Lavoie From ben at zygoat.ca Fri Nov 1 10:55:01 2002 From: ben at zygoat.ca (Ben Kennedy) Date: Thu Nov 3 14:50:20 2005 Subject: [OT] please ditch the attachments In-Reply-To: <458A9EA2-EDCA-11D6-A4F6-0003938E758A@oracle.com> References: <458A9EA2-EDCA-11D6-A4F6-0003938E758A@oracle.com> Message-ID: <20021101185452.9749@balsam> On 01,11,02 at 1:46 pm -0500, Martin-Gilles Lavoie wrote: >These attachments are automatic by some e-mailers. Bad design. (Wouldn't you be a tad miffed if I sent a JPEG image of my face with everything I wrote, just for the hell of it, and blamed my mailer for it?) >Besides, it's not like the file contains kilobytes of data. The >mime-encoded vCard takes a few dozen bytes at most. My issue was not with the space they occupy, it was with having to delete them manually from my filesystem. My MUA (PowerMail) saves attachments into a directory when receiving mail. Therefore, I end up with a fresh vcf every time somebody attaches one. If Jeff chooses to force attachments on each individual he corresponds with, it's not my place to complain. However, when dozens (hundreds? thousands?) of other users on a mailing list are forced to swallow, it seems it would be courteous to reconsider the practice. If I were laying blame (I'm not), I might also castigate the list server for allowing attachments through. A well-behaved listserv oughtn't propagate attachments. >Just ignore them, and your blood pressure should return to normal. Not so simple, as you mis-read the reason for my complaint. -ben -- Ben Kennedy, chief magician zygoat creative technical services 613-228-3392 | 1-866-466-4628 http://www.zygoat.ca From jmdisher at student.math.uwaterloo.ca Fri Nov 1 11:06:01 2002 From: jmdisher at student.math.uwaterloo.ca (Jeff Disher) Date: Thu Nov 3 14:50:20 2005 Subject: [OT] please ditch the attachments In-Reply-To: <20021101185452.9749@balsam> Message-ID: Well, I removed the vCard from my sig but I don't actually think that you make a very good case. Essentially, your reasoning could be extended to some arbitrary degree where we could claim that having any sig at all is evil. Hey, why not go as far as to not have mailing lists at all? Since the vCard takes up almost no space, I don't think that this is an issue (although, if saved to a FS it will use one inode which is 4K in our case, anyway). I might as well do without it so I have removed it at your request. Why you sent this request to the list and not just to me is beyond my understanding, however. Also, please don't claim that including something automatically is bad design and then go on to talk about this horrible feature your client has to save attachments over and over. One could make a simple argument that both of those ideas are indicative of a bad design. That said, I just use Mail.app which doesn't do this. It was part of my sig but is now removed. Most importantly, this conversation should definitely NOT go to the list. I am posting this reply to the list to clarify the issue and apologize for anyone annoyed by the few bytes of space I was wasting in E-Mails. Hopefully we can look past this and get to the real issue (you know, code and design). All future communications on this issue from me will not go through the list and I request that the others involved do the same. Sorry about that, Jeff. On Friday, November 1, 2002, at 01:54 PM, Ben Kennedy wrote: > On 01,11,02 at 1:46 pm -0500, Martin-Gilles Lavoie wrote: > >> These attachments are automatic by some e-mailers. > > Bad design. (Wouldn't you be a tad miffed if I sent a JPEG image of my > face with everything I wrote, just for the hell of it, and blamed my > mailer for it?) > >> Besides, it's not like the file contains kilobytes of data. The >> mime-encoded vCard takes a few dozen bytes at most. > > My issue was not with the space they occupy, it was with having to > delete > them manually from my filesystem. > > My MUA (PowerMail) saves attachments into a directory when receiving > mail. Therefore, I end up with a fresh vcf every time somebody > attaches one. > > If Jeff chooses to force attachments on each individual he corresponds > with, it's not my place to complain. However, when dozens (hundreds? > thousands?) of other users on a mailing list are forced to swallow, it > seems it would be courteous to reconsider the practice. > > If I were laying blame (I'm not), I might also castigate the list > server > for allowing attachments through. A well-behaved listserv oughtn't > propagate attachments. > >> Just ignore them, and your blood pressure should return to normal. > > Not so simple, as you mis-read the reason for my complaint. > > -ben > > > -- > Ben Kennedy, chief magician > zygoat creative technical services > 613-228-3392 | 1-866-466-4628 > http://www.zygoat.ca > > Jeff Disher President and Lead Developer of Spectral Class Spectral Class: Shedding Light on Innovation http://www.spectralclass.com/ From jerry.levan at eku.edu Fri Nov 1 11:35:01 2002 From: jerry.levan at eku.edu (Jerry LeVan) Date: Thu Nov 3 14:50:20 2005 Subject: How can I start an application by dragging a file to an app In-Reply-To: <200211011715.gA1HFAf22287@slowbro.omnigroup.com> Message-ID: Earlier I requested assistance for launching an App by dragging a file onto its icon ( and capturing the filename of the dragged file) I have made a tiny bit of progress... If I paste: CFBundleDocumentTypes CFBundleTypeExtensions * CFBundleTypeName NSStringPboardType CFBundleTypeOSTypes **** CFBundleTypeRole Editor Into the info.list, the application *will* launch when a file is dropped on the app's icon! I don't seem to be able to make the modified info.list permanent. Every time I rebuild the app, the info.list looses the CFBundleDocumentTypes entry :) Anyway it was suggested that I could capture the filename of the file dropped on the app icon by implementing the application:openfile method, here is what I added to the app: - (BOOL) application: (NSApplication*) anApplication openFile: (NSString* ) aFileName { // NSLog(@"Delegate invoked"); NSBeep(); theFile = [[[NSString alloc] initWithString:aFileName ] retain]; return YES; } Regretably, as far as I can tell (no beep) the method is not invoked by dragging a file onto the app icon. It is not clear to me when the rascal would be invoked ( before awakeFromNib ?) What does everyone else know that I don't... (with respect to this problem). Thanks... Jerry -------------- next part -------------- CFBundleDevelopmentRegion English CFBundleExecutable SelectorApp CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType APPL CFBundleSignature ???? CFBundleVersion 0.1 CFBundleDocumentTypes CFBundleTypeExtensions * CFBundleTypeName NSStringPboardType CFBundleTypeOSTypes **** CFBundleTypeRole Editor NSMainNibFile MainMenu NSPrincipalClass NSApplication From chmod007 at mac.com Fri Nov 1 11:39:02 2002 From: chmod007 at mac.com (David Remahl) Date: Thu Nov 3 14:50:20 2005 Subject: How can I start an application by dragging a file to an app In-Reply-To: Message-ID: > I don't seem to be able to make the modified info.list permanent. Every time > I rebuild the app, the info.list looses the CFBundleDocumentTypes entry :) Edit the Info.plist from the Target editor in Project Builder. > Regretably, as far as I can tell (no beep) the method is not invoked by > dragging a file onto the app icon. It is not clear to me when the rascal > would be invoked ( before awakeFromNib ?) > > What does everyone else know that I don't... (with respect to this problem). > > Thanks... You must implement the abovementioned method in the application delegate. Is that what you are doing? / Sincerely, David Remahl From jerry.levan at eku.edu Fri Nov 1 12:15:01 2002 From: jerry.levan at eku.edu (Jerry LeVan) Date: Thu Nov 3 14:50:20 2005 Subject: [Solved] : How can I start an application by dragging a file to an app In-Reply-To: Message-ID: Hooray.. I was not connecting the FileOwner to the Class file and setting the delegate! It works! Evidently the application:openFile method is called after awakeFromNib. In short to launch an application by dragging a file onto the app's icon. Do the following: 1) add a CFDocumentTypes entry into the info.list, this will allow the finder to start the application when a file is dragged onto the app's icon. 2) In IB connect the Fileowner Icon to the Class Icon by control dragging and connect the delegate entry to the class. 3) implement the application:openFile method in your class file, this will be invoked after the awakeFromNiB method, your method can capture the path name of the file that was dragged onto the app Icon. Thanks to all for the help... --Jerry >> I don't seem to be able to make the modified info.list permanent. > Every time >> I rebuild the app, the info.list looses the CFBundleDocumentTypes > entry :) > > Edit the Info.plist from the Target editor in Project Builder. > >> Regretably, as far as I can tell (no beep) the method is not invoked > by >> dragging a file onto the app icon. It is not clear to me when the > rascal >> would be invoked ( before awakeFromNib ?) >> >> What does everyone else know that I don't... (with respect to this > problem). >> >> Thanks... > > You must implement the abovementioned method in the application > delegate. Is > that what you are doing? > I just plopped it into my class code...how can I register the rascal? --Jerry > / Sincerely, David Remahl > From ijeyd at mac.com Fri Nov 1 14:46:01 2002 From: ijeyd at mac.com (Morgan Redman) Date: Thu Nov 3 14:50:20 2005 Subject: Debugging Multiple Bundles In-Reply-To: <119AC9FC-ED43-11D6-9C6D-000393658196@mac.com> Message-ID: <90AE5120-EDEB-11D6-B636-00039344C692@mac.com> When I type the path name.. nothing seems to happen. All my source files are in the same directory, the project directory... I dont understand why it says "no source file..." ...... Morgan On Thursday, October 31, 2002, at 06:38 PM, Fabien Roy wrote: > In order to debug into your bundle, at the gdb prompt type: > dir > > Hope that helps. > > Fabien > > On Thursday, Oct 31, 2002, at 16:05 US/Pacific, Morgan Redman wrote: > >> >> No one replied to my original email........ Im still stuck... >> >> -Morgan >> >> On Monday, October 28, 2002, at 04:31 PM, Morgan Redman wrote: >> >>> How does one debug a project when it is spread across multiple >>> bundles? When I try to set a breakpoint in a bundle other than the >>> main one, when the program loads I get the Error: >>> >>> Error from Debugger: No source file named >> the main bundle> >>> >>> Is there any way to make this work without combining all my classes >>> into the main bundle? >>> >>> -Morgan >>> >>> _______________________________________________ >>> 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 mtm26 at cornell.edu Fri Nov 1 14:59:03 2002 From: mtm26 at cornell.edu (Michael Mulligan) Date: Thu Nov 3 14:50:20 2005 Subject: [OT] please ditch the attachments In-Reply-To: Message-ID: On 11/01/02 2:05 PM, "Jeff Disher" wrote: > Well, I removed the vCard from my sig but I don't actually think that > you make a very good case. Essentially, your reasoning could be > extended to some arbitrary degree where we could claim that having any > sig at all is evil. Hey, why not go as far as to not have mailing > lists at all? > > Since the vCard takes up almost no space, I don't think that this is an > issue (although, if saved to a FS it will use one inode which is 4K in > our case, anyway). I might as well do without it so I have removed it > at your request. I think that this is blowing it a tad out of proportion. I don't think that Ben's request was all that unreasonable as it's just common netiquette to not send attachments, not send HTML-formatted email, etc. regardless of the file size. > Why you sent this request to the list and not just to > me is beyond my understanding, however. I think that he sent this out because there are occasionally others who have attachment-signatures and so I wouldn't take it as a personal attack but just a reminder to the whole community about things that make this easier for everybody. -m^2 __________ Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread! __________ From steve at dekorte.com Fri Nov 1 16:16:01 2002 From: steve at dekorte.com (Steve Dekorte) Date: Thu Nov 3 14:50:20 2005 Subject: NSMatrix dragging Message-ID: <35DF0250-EDF8-11D6-A469-000393ACB27C@dekorte.com> I need to implement a custom dragging behavior in a subclass of NSMatrix but the mouseDragged: method never seems to get called. mouseDown: gets called, but never mouseDragged: or mouseUp:. Is there a secret to overriding dragging behavior on an NSMatrix? Steve From dgomez at dkgomez.com Fri Nov 1 16:49:01 2002 From: dgomez at dkgomez.com (Dave Gomez) Date: Thu Nov 3 14:50:20 2005 Subject: [OT] please ditch the attachments In-Reply-To: <20021101185452.9749@balsam> Message-ID: On 11/1/02 11:54 AM, "Ben Kennedy" wrote: > On 01,11,02 at 1:46 pm -0500, Martin-Gilles Lavoie wrote: > >> These attachments are automatic by some e-mailers. > > Bad design. (Wouldn't you be a tad miffed if I sent a JPEG image of my > face with everything I wrote, just for the hell of it, and blamed my > mailer for it?) > >> Besides, it's not like the file contains kilobytes of data. The >> mime-encoded vCard takes a few dozen bytes at most. > > My issue was not with the space they occupy, it was with having to delete > them manually from my filesystem. wait a minute, aren't you now blaming your mailer (or conversely your reader), of having shortcomings, and want someone else to change the way they do things to accommodate you? maybe it's time for a better behaved email reader? dg From dustin+macosx-dev at spy.net Fri Nov 1 17:52:01 2002 From: dustin+macosx-dev at spy.net (Dustin Sallings) Date: Thu Nov 3 14:50:20 2005 Subject: NSMatrix dragging In-Reply-To: <35DF0250-EDF8-11D6-A469-000393ACB27C@dekorte.com> Message-ID: Around 16:15 on Nov 1, 2002, Steve Dekorte said: # I need to implement a custom dragging behavior in a subclass of # NSMatrix but the mouseDragged: method never seems to get called. # mouseDown: gets called, but never # mouseDragged: or mouseUp:. Is there a secret to overriding dragging # behavior on an NSMatrix? Yeah, it's just a bit more complicated than that if you're doing what I think you're doing. I'll describe to you what I remember about what I did, and you can go from there. Please ignore if this is unrelated to what you're doing. :) You have to implement - (NSDragOperation)draggingEntered:(id )sender And return a proper value before dragging will be enabled. Here is the implementation I'm using for dropping files into my matrix: - (NSDragOperation)draggingEntered:(id )sender { NSDragOperation sourceDragMask = [sender draggingSourceOperationMask]; if (sourceDragMask & NSDragOperationLink) { return NSDragOperationLink; } else if (sourceDragMask & NSDragOperationCopy) { return NSDragOperationCopy; } return NSDragOperationNone; } When I'm ready to deal with what was dragged (a list of files), I do this (performDragOperation in my case): -(BOOL)performDragOperation:(id )sender { NSPasteboard *pboard=[sender draggingPasteboard]; NSArray *files = [pboard propertyListForType:NSFilenamesPboardType]; [...stuff with files]; return (TRUE); } -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From mikezornek at mikezornek.com Fri Nov 1 18:08:09 2002 From: mikezornek at mikezornek.com (Michael Zornek) Date: Thu Nov 3 14:50:20 2005 Subject: Question about C++ tool template in PB Message-ID: Ok, so here I am in 10.2's PB creating a C++ tool. In the files pane I got a folder called 'Documentation' that has a file named HelloWorld.1 This looks like a place where I would create a man page for my C++ Tool, is this a correct assumption? If so, are there any good resources I could look at on editing this to be a true man page? ~ Mike -- http://www.mikezornek.com From jmerkel2 at mac.com Fri Nov 1 18:23:01 2002 From: jmerkel2 at mac.com (James J. Merkel) Date: Thu Nov 3 14:50:20 2005 Subject: How can I start an application by dragging a file to an app In-Reply-To: <200211012001.gA1K1Cf26469@slowbro.omnigroup.com> Message-ID: On Friday, November 1, 2002, at 12:01 PM, Jerry LeVan wrote: > Anyway it was suggested that I could capture the filename of the file > dropped on the app icon by implementing the application:openfile > method, > here is what I added to the app: > - (BOOL) application: (NSApplication*) anApplication > openFile: (NSString* ) aFileName > { > // NSLog(@"Delegate invoked"); > NSBeep(); > theFile = [[[NSString alloc] initWithString:aFileName ] retain]; > return YES; > } > > Regretably, as far as I can tell (no beep) the method is not invoked by > dragging a file onto the app icon. It is not clear to me when the > rascal > would be invoked ( before awakeFromNib ?) You need to have the following line of code in the same class that you have the above code in: [NSApp setDelegate:self]; I put it in the awakeFromNib method. Hope this helps. Jim Merkel From steve at dekorte.com Fri Nov 1 19:51:01 2002 From: steve at dekorte.com (Steve Dekorte) Date: Thu Nov 3 14:50:20 2005 Subject: NSMatrix dragging In-Reply-To: Message-ID: <33334C19-EE16-11D6-A469-000393ACB27C@dekorte.com> On Friday, November 1, 2002, at 05:50 PM, Dustin Sallings wrote: > Yeah, it's just a bit more complicated than that if you're doing > what I think you're doing. I'll describe to you what I remember about > what I did, and you can go from there. Please ignore if this is > unrelated > to what you're doing. :) Thanks for the response. I'm actually trying to implement dragging from a matrix(instead of dragging to a matrix). Cheers, Steve OSX freeware and shareware: http://www.dekorte.com/downloads.html From dreamless at attbi.com Fri Nov 1 21:54:01 2002 From: dreamless at attbi.com (Nick Zitzmann) Date: Thu Nov 3 14:50:20 2005 Subject: New dev tools update out Message-ID: <707B5543-EE27-11D6-B19A-0050E410B21A@attbi.com> I haven't seen anyone else post this, so... Most of you have probably seen this in the new ADC news, but for those of you who don't get ADC's newsletter, there's a new "October Dev Tools Update" out that apparently fixes a nib corruption bug in the nibtool program. It's out now on ... HTH. Nick Zitzmann AIM/iChat: dragonsdontsleep Check out my software page: http://dreamless.home.attbi.com/ "La la la! I sing, too! For food, for food! La la la!" - Gabo, Dragon Warrior VII From izidor.jerebic at siol.net Sat Nov 2 00:44:01 2002 From: izidor.jerebic at siol.net (Izidor Jerebic) Date: Thu Nov 3 14:50:20 2005 Subject: pdf transparency, again In-Reply-To: Message-ID: <5C31E2C8-EE3F-11D6-AAB1-003065717ABE@siol.net> Hello! It seems that CMYK text transparency is a problem for Quartz. I was setting the color in my test example using CG CMYK Fill/Stroke color routines, and drawing text using[NSBezierPath drawPackedGlyphs:atPoint:]. It seems that the PDF is correct - both text and rectangle fills are transparent in Acrobat Reader, but nothing is tranparent in Preview (neither text nor rectangles). When I draw just rectangles, they are transparent in Preview. And when I set the text color with RGB colorspace, everything is transparent in Preview. The point is - the transparency in resulting PDF is recognized by Acrobat Reader, but not by Quartz. So something written by Quartz is not recognized by it. izidor On Friday, Nov 1, 2002, at 18:27 Europe/Ljubljana, Brock Brandenberg wrote: >> I have found out what the problem is - if I include any text in PDF, >> transparency in Quartz goes away, somehow. If there is no text in pdf >> file (e.g. only rectangle fills), transparency works. Could this be >> true? > > I am currently using transparency with mixed text and graphics in PDF > files > without any problems. My question would be, what method are you using > to > draw the text? > > I am drawing individual lines of text (titles, not big bodies of text) > using > the CG routines like CGContextShowGlyphsAtPoint(). The color is being > set in > the context with CGContextSetRGBFillColor() to workaround the AppKit > deficiencies. Note that the text being written into the PDF is indeed > a line > of text with embedded font characters, not as outlines. I have > outlining > routines also and they too are working fine. TO generate the PDF, I'm > using > the Cocoa dataWithPDFInsideRect: method. > > Some text methods draw using context attributes while others use the > text > attributes. Might there be a conflict between the context and text > attributes that is causing your problem? > > Brock Brandenberg > > ----- industrial design @ www.bergdesign.com ------ > > From simX at mac.com Sat Nov 2 01:42:01 2002 From: simX at mac.com (Simone Manganelli) Date: Thu Nov 3 14:50:20 2005 Subject: Optimized Code crashing Message-ID: <4D78ACD2-EE47-11D6-A549-000393B909BA@mac.com> Hi -- I'm having problems while creating an application in Objective-C (this is my first major project in Objective-C, so I'm kind of inexperienced :) ). Specifically, when I run the program unoptimized, the program works as expected ? the program shows a list of data, and there's just a button to refresh the data. However, if I set the compiler to optimize at any setting other than no optimization, my program crashes whenever I press the refresh button. What could cause this problem? My code seems to work fine unoptimized, so I don't see how my code could be causing the problem. Any help would be much appreciated. -- Simone Manganelli From philippe.robert at gmx.net Sat Nov 2 03:55:01 2002 From: philippe.robert at gmx.net (Philippe C.D. Robert) Date: Thu Nov 3 14:50:20 2005 Subject: Optimized Code crashing In-Reply-To: <4D78ACD2-EE47-11D6-A549-000393B909BA@mac.com> Message-ID: <1761620C-EE5A-11D6-BB57-00039384668A@gmx.net> Hi, On Saturday, November 2, 2002, at 10:41 Uhr, Simone Manganelli wrote: > Hi -- > > I'm having problems while creating an application in Objective-C (this > is my first major project in Objective-C, so I'm kind of inexperienced > :) ). > > Specifically, when I run the program unoptimized, the program works as > expected ? the program shows a list of data, and there's just a button > to refresh the data. However, if I set the compiler to optimize at > any setting other than no optimization, my program crashes whenever I > press the refresh button. > > What could cause this problem? My code seems to work fine > unoptimized, so I don't see how my code could be causing the problem. > > Any help would be much appreciated. Sounds like a memory leak - please send a backtrace and a more detailed description wrt the crash, otherwise it is not possible to give you a real answer. -Phil -- Philippe C.D. Robert http://www.nice.ch/~phip From simX at mac.com Sat Nov 2 04:34:01 2002 From: simX at mac.com (Simone Manganelli) Date: Thu Nov 3 14:50:20 2005 Subject: Optimized Code crashing In-Reply-To: <1761620C-EE5A-11D6-BB57-00039384668A@gmx.net> Message-ID: <47DB7F5E-EE5F-11D6-B5D3-000393B909BA@mac.com> Phil -- By "backtrace", I'm assuming you mean a crash log ? I'm not up on the lingo of Obj-C developers just yet. ;) Basically what my program does is it gets some data from a command line process, parses it and puts the data into several objects that are referenced in an array, and a table view updates the data. All this happens every time the user presses the "Refresh" button in the main window. I have sometimes been able to get it to work with optimized code, but that's usually only after I restart my computer, delete the build folder, and then build & run the executable under optimized code. I do seem to have a memory leak that I can't pin down, though ? I understand that objects that are created via "alloc" or "copy" methods need to be explicitly released, but I seem to have every "alloc" paired with a "release", so I don't know where I would have a memory leak. Since I'm new Objective-C, I'm not sure where to start ? if this problem is related to a memory leak, maybe tips on where to look for memory leaks could help me fix the problem since it's not crashing currently. Here is the crash log: Date/Time: 2002-11-02 04:30:48 -0800 OS Version: 10.2.1 (Build 6D52) Host: (omitted) Command: Memory Usage Getter PID: 1098 Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_INVALID_ADDRESS (0x0001) at 0x207b5448 Thread 0 Crashed: #0 0x9068ba64 in objc_msgSend #1 0x90137080 in CFEqual #2 0x907e304c in -[NSCFString isEqualToString:] #3 0x00006434 in -[Process setFullProcessName:] (Process.m:78) #4 0x9088254c in -[NSObject takeValue:forKey:] #5 0x00005e18 in -[MemoryGetter getStats] (MemoryGetter.m:207) #6 0x000043e0 in -[MemoryGetter refresh:] (MemoryGetter.m:29) #7 0x930cfe2c in -[NSApplication sendAction:to:from:] #8 0x9315bff0 in -[NSControl sendAction:to:] #9 0x93113a38 in -[NSCell _sendActionFrom:] #10 0x93113fc4 in -[NSCell trackMouse:inRect:ofView:untilMouseUp:] #11 0x930fef78 in -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] #12 0x9315c898 in -[NSControl mouseDown:] #13 0x9336dfd4 in -[NSWindow sendEvent:] #14 0x930ce328 in -[NSApplication sendEvent:] #15 0x930ca524 in -[NSApplication run] #16 0x930d2598 in NSApplicationMain #17 0x00003ea4 in _start (crt.c:267) #18 0x00003d24 in start Thread 1: #0 0x90074328 in mach_msg_trap #1 0x90006670 in mach_msg #2 0xc00076cc in __ape_internal #3 0xc0000dd0 in __ape_agent #4 0x90021428 in _pthread_body PPC Thread State: srr0: 0x9068ba64 srr1: 0x0200f030 vrsave: 0x00000000 xer: 0x20000000 lr: 0x90137080 ctr: 0x9068ba3c mq: 0x00000000 r0: 0x9068d714 r1: 0xbfffe8b0 r2: 0x24000224 r3: 0x019c93d8 r4: 0x9068d714 r5: 0xa07e3424 r6: 0x000007c8 r7: 0x00000001 r8: 0x0000c1d3 r9: 0xa0130d48 r10: 0x00000001 r11: 0x81fc47e0 r12: 0x80684700 r13: 0x00000000 r14: 0x00000000 r15: 0x00000000 r16: 0xa3073b98 r17: 0xa3093b98 r18: 0xa3093b98 r19: 0xa3093b98 r20: 0x00000000 r21: 0xa30a3b98 r22: 0x00000000 r23: 0x000829b0 r24: 0x019f2d60 r25: 0xa07e23f0 r26: 0x000082b8 r27: 0x019c93d8 r28: 0xa07e3424 r29: 0x9068ba3c r30: 0xa0130dac r31: 0x90136f1c Again, thanks for any help (and thanks for being patient with me). -- Simone Manganelli On Saturday, November 2, 2002, at 03:56 AM, Philippe C.D. Robert wrote: > Hi, > > On Saturday, November 2, 2002, at 10:41 Uhr, Simone Manganelli wrote: >> Hi -- >> >> I'm having problems while creating an application in Objective-C >> (this is my first major project in Objective-C, so I'm kind of >> inexperienced :) ). >> >> Specifically, when I run the program unoptimized, the program works >> as expected ? the program shows a list of data, and there's just a >> button to refresh the data. However, if I set the compiler to >> optimize at any setting other than no optimization, my program >> crashes whenever I press the refresh button. >> >> What could cause this problem? My code seems to work fine >> unoptimized, so I don't see how my code could be causing the problem. >> >> Any help would be much appreciated. > > Sounds like a memory leak - please send a backtrace and a more > detailed description wrt the crash, otherwise it is not possible to > give you a real answer. > > -Phil > -- > Philippe C.D. Robert > http://www.nice.ch/~phip > From steve at dekorte.com Sat Nov 2 04:35:03 2002 From: steve at dekorte.com (Steve Dekorte) Date: Thu Nov 3 14:50:20 2005 Subject: NSBrowser continuous scrolling Message-ID: <662743FA-EE5F-11D6-A469-000393ACB27C@dekorte.com> The default horizontal scrolling behavior for NSBrowser seems to be to "jump" between sets of columns. Is there any way to get it to scroll continuously as the Finder does in column view mode? Cheers, Steve OSX freeware and shareware: http://www.dekorte.com/downloads.html From shawn at freetimesw.com Sat Nov 2 08:14:00 2002 From: shawn at freetimesw.com (Shawn Erickson) Date: Thu Nov 3 14:50:20 2005 Subject: Optimized Code crashing In-Reply-To: <47DB7F5E-EE5F-11D6-B5D3-000393B909BA@mac.com> Message-ID: I would fire up your application in the debugger to better watch what happens and inspect the crash. On Saturday, November 2, 2002, at 04:33 AM, Simone Manganelli wrote: > Thread 0 Crashed: > #0 0x9068ba64 in objc_msgSend > #1 0x90137080 in CFEqual > #2 0x907e304c in -[NSCFString isEqualToString:] > #3 0x00006434 in -[Process setFullProcessName:] (Process.m:78) > #4 0x9088254c in -[NSObject takeValue:forKey:] > #5 0x00005e18 in -[MemoryGetter getStats] (MemoryGetter.m:207) > #6 0x000043e0 in -[MemoryGetter refresh:] (MemoryGetter.m:29) It looks like you are some how sending an invalid object reference (pointer) into setFullProcessName or it is working with an invalid string object (it looks like you do some type of string compare). You could have a retain problem, using something that you didn't allocate but are not retaining it. Cannot help much more without seeing the code. -Shawn From brock at bergdesign.com Sat Nov 2 08:14:15 2002 From: brock at bergdesign.com (Brock Brandenberg) Date: Thu Nov 3 14:50:20 2005 Subject: pdf transparency, again In-Reply-To: <5C31E2C8-EE3F-11D6-AAB1-003065717ABE@siol.net> Message-ID: > The point is - the transparency in resulting PDF is recognized by > Acrobat Reader, but not by Quartz. So something written by Quartz is > not recognized by it. Yea, it is a little inconsistent. Here's something else I've noticed. When I open a PDF with transparency in Preview, it will render differently at different zoom levels. If I'm zoomed out so that I can see the whole doc/image, it renders properly. But when I zoom in until the doc/image is clipped, the transparency goes away and all graphics are rendered with an alpha of 1.0. My examples have been simple ones, so this may not be exactly right in all cases, but it does occur with small docs with a dozen or so text and graphic objects in them. Very odd. Brock Brandenberg ----- industrial design @ www.bergdesign.com ------ From simX at mac.com Sat Nov 2 10:54:13 2002 From: simX at mac.com (Simone Manganelli) Date: Thu Nov 3 14:50:20 2005 Subject: Optimized Code crashing In-Reply-To: Message-ID: <5B4385C2-EE94-11D6-8841-000393B909BA@mac.com> Well, how am I supposed to debug it if the crash only happens on optimized code? The problem doesn't crop up until I optimize it, so I guess I don't understand why that would happen. Also, how exactly do you read a crash log and find out where the problem is? I can see that it shows the line numbers and stuff, but how can you tell what is causing the crash (like how did you come up with the problem that you think exists)? Thanks again for helping me out with this problem and for being patient with all my incessant questions. :) -- Simone Manganelli On Saturday, November 2, 2002, at 08:13 AM, Shawn Erickson wrote: > I would fire up your application in the debugger to better watch what > happens and inspect the crash. > > On Saturday, November 2, 2002, at 04:33 AM, Simone Manganelli wrote: > >> Thread 0 Crashed: >> #0 0x9068ba64 in objc_msgSend >> #1 0x90137080 in CFEqual >> #2 0x907e304c in -[NSCFString isEqualToString:] >> #3 0x00006434 in -[Process setFullProcessName:] (Process.m:78) >> #4 0x9088254c in -[NSObject takeValue:forKey:] >> #5 0x00005e18 in -[MemoryGetter getStats] (MemoryGetter.m:207) >> #6 0x000043e0 in -[MemoryGetter refresh:] (MemoryGetter.m:29) > > It looks like you are some how sending an invalid object reference > (pointer) into setFullProcessName or it is working with an invalid > string object (it looks like you do some type of string compare). You > could have a retain problem, using something that you didn't allocate > but are not retaining it. > > Cannot help much more without seeing the code. > > -Shawn > From mwatson at apple.com Sat Nov 2 11:09:00 2002 From: mwatson at apple.com (Matt Watson) Date: Thu Nov 3 14:50:20 2005 Subject: Optimized Code crashing In-Reply-To: <5B4385C2-EE94-11D6-8841-000393B909BA@mac.com> Message-ID: <6DBD0C00-EE96-11D6-80DB-000393536FCA@apple.com> > Well, how am I supposed to debug it if the crash only happens on > optimized code? You can debug optimized code. Based on the crash log, you are either releasing an object you didn't alloc, retain or copy, or not retaining or copying something that you should be. I'd suspect the latter. If you get an object back from a method call and don't retain or copy it, the object will be automatically released the next time through the event loop. If you try to use that object reference later, it no longer points to a valid object and you crash. See: http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ ProgrammingTopics/MemoryMgmt/MemoryMgmt.html http://www.stepwise.com/Articles/Technical/HoldMe.html matt. From rdm at cfcl.com Sat Nov 2 16:43:01 2002 From: rdm at cfcl.com (Rich Morin) Date: Thu Nov 3 14:50:20 2005 Subject: Solaris-style truss(1) for Mac OS X? Message-ID: Even with the Developer Tools installed, my Mac OS X system has no truss(1) command. The FreeBSD truss command is, sadly, only a shadow of the Solaris version. Most critically (in my case), it has no option to trace a process _and all of its descendents_. Is there (any chance of getting :-) a Solaris-style truss(1) for Mac OS X? -r -- email: rdm@cfcl.com; phone: +1 650-873-7841 http://www.cfcl.com/rdm - my home page, resume, etc. http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc. http://www.ptf.com/dossier - Prime Time Freeware's DOSSIER series http://www.ptf.com/tdc - Prime Time Freeware's Darwin Collection From njriley at uiuc.edu Sat Nov 2 17:06:01 2002 From: njriley at uiuc.edu (Nicholas Riley) Date: Thu Nov 3 14:50:20 2005 Subject: Solaris-style truss(1) for Mac OS X? In-Reply-To: References: Message-ID: <20021103010529.GB1883374@uiuc.edu> On Sat, Nov 02, 2002 at 04:43:14PM -0800, Rich Morin wrote: > Even with the Developer Tools installed, my Mac OS X system has no truss(1) > command. The FreeBSD truss command is, sadly, only a shadow of the Solaris > version. Most critically (in my case), it has no option to trace a process > _and all of its descendents_. > > Is there (any chance of getting :-) a Solaris-style truss(1) for Mac OS X? ktrace -d will trace descendents on OS X 10.2 (and on the FreeBSD 4.6 system I checked; the manpage appears identical). The equivalent outputs are below: [Solaris] execve("/usr/bin/ls", 0xFFBEF69C, 0xFFBEF6A4) argc = 1 [FreeBSD] 66518 ktrace CALL execve(0xbfbff44c,0xbfbff954,0xbfbff95c) 66518 ktrace NAMI "/bin/ls" 66518 ls RET execve 0 [OS X] 2298 ktrace CALL execve(0xbffff150,0xbffff748,0xbffff750) 2298 ktrace NAMI "/usr/local/bin/ls" 2298 ktrace NAMI "/usr/lib/dyld" 2298 ls RET execve 0 The only difference appears to be in the representation of arguments, though obviously Solaris's output is quite a bit more user-friendly. I don't have a truss command on this FreeBSD system, and the source code I found fails to compile because I don't have a full source tree. However, this code has a -f option: -f Follow the child processes of the process being traced. -- =Nicholas Riley | Pablo Research Group, Department of Computer Science and Medical Scholars Program, University of Illinois at Urbana-Champaign From fabienlroy at mac.com Sat Nov 2 18:09:01 2002 From: fabienlroy at mac.com (Fabien Roy) Date: Thu Nov 3 14:50:20 2005 Subject: Debugging Multiple Bundles In-Reply-To: <90AE5120-EDEB-11D6-B636-00039344C692@mac.com> Message-ID: <1762B41C-EED1-11D6-9755-000393658196@mac.com> Another way is to have all bundle project open in "ProjectBuilder". On Friday, Nov 1, 2002, at 14:45 US/Pacific, Morgan Redman wrote: > When I type the path name.. nothing seems to happen. All my source > files are in the same directory, the project directory... I dont > understand why it says "no source file..." From nigel at ind.tansu.com.au Sun Nov 3 16:17:02 2002 From: nigel at ind.tansu.com.au (nigel@ind.tansu.com.au) Date: Thu Nov 3 14:50:20 2005 Subject: Program built on 10.2 does not run correctly In-Reply-To: <200211011715.gA1HF1f22203@slowbro.omnigroup.com> from "macosx-dev-request@omnigroup.com" at Nov 01, 2002 09:15:01 AM Message-ID: <20021104001503.25895.qmail@quoll.ind.tansu.com.au> I wrote: > I have narrowed the problem down a bit, but not much: Bill replied: > I thought some of the replies (including mine) to your earlier post made it > clear that there are backward compatibility issues with 10.2 apps I received a few emails (prune extra frameworks, try older GCC), but none from you :-( I get the list in digest mode, and thought I may have missed something, but a check of the OmniGroup archives revealed only some slightly related API usage problems. Perhaps thinking of someone else's problem? Mine is a program with several threads, one of which is a m68K emulator. The emulator never writes to its screen when built on 10.2 with DIRECT_ADDRESSING. ... > Anyway, if you do a batch search of the AppKit and Foundation for text > containing the string "10_2", you'll get a list of every item in the headers > that is new in Mac OS X 10.2. Sure, but the issue isn't really a 10.1 vs 10.2 API usage issue. I don't use any new 10.2-only methods (well, not directly), and I am comparing a program built on 10.1 which runs fine on 10.1 and 10.2 with a program built on 10.2 that does not run correctly on 10.2. -- | Nigel Pearson, nigel@ind.tansu.com.au | "Things you own | | Telstra BI&D, Sydney, Australia | end up owning you" | | Office: 8255 4222 Fax: 8255 3153 | "not a beautiful snowflake" | | Mobile: 0408 664435 Home: 9792 6998 | Tyler - Fight Club | From simX at mac.com Sun Nov 3 19:34:01 2002 From: simX at mac.com (Simone Manganelli) Date: Thu Nov 3 14:50:20 2005 Subject: NSScanner problems Message-ID: <218937DB-EFA6-11D6-B607-000393B909BA@mac.com> I'm having a few more problems that I need to figure out, if someone can help me out. I'm trying to use an NSScanner to scan a string and see if it contains a substring. I have an array of strings that I want to search for in each string, and if any of them are present, then I want to set a flag. Here's the code: NSScanner *scanner; NSMutableArray *arrayOfValues = [[NSUserDefaults standardUserDefaults] objectForKey:@"User-Defined Values"]; int i; int j; BOOL flag = NO; for (i=0; i < [processArray count]; i++) { scanner = [NSScanner scannerWithString:[[processArray objectAtIndex:i] processName]]; for (j=0; j < [arrayOfValues count]; j++) { NSLog(@"%@",[[processArray objectAtIndex:i] processName]); NSLog(@"%@",[arrayOfValues objectAtIndex:j]); if ([scanner scanString:[arrayOfValues objectAtIndex:j] intoString:nil]) { flag = YES; } if (flag) {NSLog(@"YES!");} } } The problem is, the NSScanner returns sets the flag as YES for each step. That is, every time the log displays the processName and the scanString, it always returns a YES, regardless of whether processName actually contains scanString or not. Am I doing something wrong here? Thanks for any help. -- Simone Manganelli From chicagobob at mac.com Sun Nov 3 22:06:01 2002 From: chicagobob at mac.com (Bob Frank) Date: Thu Nov 3 14:50:20 2005 Subject: Meeting - Chicago CAWUG Tuesday Nov. 5th Message-ID: <64C1A78A-EFBB-11D6-8B82-003065995190@mac.com> Hi, Just a reminder. The next CAWUG meeting is this Tuesday night, please remember to RSVP if you want to come. Hope to see you there, -Bob Begin forwarded message: > From: Bob Frank > Date: Wed Oct 30, 2002 10:38:11 PM America/Chicago > To: webobjects-talk@omnigroup.com, webobjects-dev@omnigroup.com, > cocoa-dev@lists.apple.com, macosx-dev@omnigroup.com, cawug@king.net > Subject: [cawug] Meeting - Chicago CAWUG Tuesday Nov. 5th (DTW & > BDRuleEngine) > > Hi All, > > The Chicago Cocoa And WebObjects User Group (CAWUG) is holding our > next meeting next Tuesday, November 5th at 6:00 PM. > > Agenda: > - Introductions & Announcements > - Jonathan Rentzsch of Red Shed Software on WebObjects DirectToWeb > system > - Chris Hanson of bDistributed.com on the BDRuleEngine framework > for Cocoa > - Pizza & Q&A > > When: Tuesday, November 5th, 6:00 PM > Where: Apple's Chicago Office > 10 S. Wacker, 33rd Floor > corner of Wacker & Madison St. > 1 block East of Nothwestern train station > http://maps.yahoo.com/py/ > maps.py?&country=us&addr=10+S+Wacker+Dr&city=Chicago&state=IL&zip=60606 > -7453&mag=9 > > Last month we had a great meeting with Eric Peyton discussing > Rendezvous and Jon Rentzsch discussing Project WONDER. This month we > have another good meeting planned. Also, for building security > purposes, please RSVP if you are going to attend (or are even > considering attending, I'll just add your name to the list). > > 1) Jonathan Rentzsch of Red Shed Software on DirectToWeb > > "What WebObjects is to the rest of app server market, DirectToWeb is > to WebObjects -- Jim Roepcke" DirectToWeb is a superset of the > WebObjects Framework that dramatically cuts down on the amount of time > it takes to build a fully functional web application which interacts > with a database. Jon will show you how DirectToWeb blends your > database model file with rules you define and your custom components > to dynamically generate web applications with minimal code. > > 2) Chris Hanson of bDistributed.com on the BDRuleEngine framework > > Chris Hanson of bDistributed.com will be talking about his company's > Open Source BDRuleEngine framework, which adds a rule engine to Cocoa. > Chris will give an overview of the principal classes in BDRuleEngine > and show how to build a simple Cocoa application that derives its > behavior from rules. Chris will also discuss the key differences > between BDRuleEngine and the rule engine in DirectToWeb. The > BDRuleEngine framework and the BDControl framework on which it depends > can both be downloaded from . > They are both Open Source, under a BSD-style license. > > > We will, as usual, also have Q & A and pizza, a discussion of future > meeting topics and dates. Thanks to Kiwi Internet Group for the > pizza. Also, thanks to Alex Johnson, the CAWG calendar is available > as an iCal: > > http://ical.mac.com/alex27/CAWUG (view on the web) > webcal://ical.mac.com/alex27/CAWUG.ics (subscribe to in iCal) > > Lastly, if you are working on a project and would like to talk about > it briefly / promote it, I think it would be fun for people to hear > about other people's projects. Please email me off line you can talk > at this meeting or a future meeting. > > > -Bob From alexis.belhomme at free.fr Mon Nov 4 05:29:01 2002 From: alexis.belhomme at free.fr (Alexis Belhomme) Date: Thu Nov 3 14:50:20 2005 Subject: NSMenu setMenuBarVisible In-Reply-To: <218937DB-EFA6-11D6-B607-000393B909BA@mac.com> Message-ID: <4CA24157-EFF9-11D6-8FCB-0003934656F6@free.fr> Hello, I'm writing a Cocoa application that, at a given moment, toggle in full screen mode. In this mode, I've got a floating window that I'd like to position anywhere I want. However, by default, this palette window cannot be placed where the application menu bar usually lies (at the top of the window - it is stopped when I try to drag it up there). I've used the NSMenu +setMenuBarVisible to hide the menu bar, however it only works if I call this method inside my awakeFromNib method: otherwise, the menu bar disappear, but I still cannot move my palette up. Of course, since I want the menu bar to disappear only when in full screen mode, that doesn't fit. Does anybody knows what could be going on here? Thanks Alexis -- Alexis Belhomme - alexis.belhomme@free.fr "Deux choses sont infinies : l'univers et la betise humaine, en ce qui concerne l'univers, je n'ai pas acquis la certitude absolue." -- Albert Einstein From eric.c at mac.com Mon Nov 4 06:10:01 2002 From: eric.c at mac.com (Eric Circlaeys) Date: Thu Nov 3 14:50:20 2005 Subject: Fwd: URL Types & NSURLHandle Message-ID: Hi Guys! I hope you could help me... The aim is quite simple, reproduce what iCal do, interacting with Internet Explorer types, when I enter webcal://url into IE prompt then it launches an Apple Event that iCal handles... I did the following: (1) Into Project Builder, I add a URL Type (Name:URLSubscribeHandle, Schemes:webfind, IconFile:WebfindScheme) (2) I add a minimal subclass of NSURLHandle called URISubscribeHandle (code at the end) (3) Then I add inside the main controller the registration to this subclass But it only works internally to the application, BUT no way to handle anything when I enter an URL into Internet Explorer, it launched my application, but the subclass is not called! and the app still being in foreground even if I click on the desktop! Could someone help me! What did i forget? Eric. (3) - (void)applicationDidFinishLaunching:(NSNotification *)notification { [URISubscribeHandle registerURLHandleClass]; } (2) #define URLTYPE @"webtoto" @implementation URISubscribeHandle - (id)init { if (self = [super init]) { } return (self); } - (void)dealloc { [super dealloc]; } + (BOOL)canInitWithURL:(NSURL *)anURL { NSString *scheme = [[anURL scheme] lowercaseString]; NSLog(@"canInitWithURL - %@", anURL); return ([scheme isEqualToString:URLTYPE]); } + (NSURLHandle *)cachedHandleForURL:(NSURL *)anURL { NSURLHandle *result = nil; NSLog(@"cachedHandleForURL - %@", anURL); if (result == nil) { result = [[[self alloc] initWithURL:anURL cached:YES] autorelease]; } else { } return (result); } - (id)initWithURL:(NSURL *)anURL cached:(BOOL)willCache { NSLog(@"initWithURL - %@", anURL); if (self = [super initWithURL:anURL cached:willCache]) { } return (self); } - (id)propertyForKey:(NSString *)propertyKey { id result = [self propertyForKeyIfAvailable:propertyKey]; NSLog(@"propertyForKey - %@", propertyKey); if (result == nil) { } return (result); } - (id)propertyForKeyIfAvailable:(NSString *)propertyKey { id result = nil; NSLog(@"propertyForKeyIfAvailable - %@", propertyKey); return (result); } - (NSData *)loadInForeground { NSData *result = nil; NSLog(@"loadInForeground"); return (result); } - (void)beginLoadInBackground { NSLog(@"beginLoadInBackground"); } - (void)cancelLoadInBackground { NSLog(@"cancelLoadInBackground"); } - (void)endLoadInBackground { NSLog(@"endLoadInBackground"); } + (void)registerURLHandleClass { [NSURLHandle registerURLHandleClass:self]; } On Sunday, October 27, 2002, at 11:30 PM, Eric Circlaeys wrote: > I need your help and your experience, > > I want to handle an URL scheme in a Cocoa Application, > > I did the addition into Project Builder in the URL Types table: for > example the scheme is "webomni" > > After compiling my application, all is working well, when i enter > "webomni://things" IE launched the event and then my application was > starting or put in foreground. > > Now the next step is to be retained when it happens, but there is no > notification. > > But how can I have access to the URL? > > I tried to make a subclass of NSURLHandle with 2 or 3 overwriting > methods (+ (BOOL)canInitWithURL:(NSURL *)aURL, - > (id)initWithURL:(NSURL *)aURL cached:(BOOL)willCache, ...) > > And then register the class into main controller (+ > (void)registerURLHandleClass:(Class)aURLHandleSubclass) > But nothing change! My methods are not called! > > Could someone explain me how it works? > > Thank you very much! > > Cheers, > Eric. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 6608 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021104/be90b046/attachment.bin From martin-gilles.lavoie at oracle.com Mon Nov 4 06:39:02 2002 From: martin-gilles.lavoie at oracle.com (Martin-Gilles Lavoie) Date: Thu Nov 3 14:50:20 2005 Subject: PowerPlant & ProjectBuilder Message-ID: <12289E08-F003-11D6-8AD0-0003938E758A@oracle.com> I know this has been asked in the past. It's also been asked on comp.sys.mac.programmer, but most of the questions I've read about it date back quite some time and I have not seen an answer that's useful yet. The title says it all. I'm looking for the proper compiler settings to get PowerPlant compiled from ProjectBuilder. This probably involves getting rid of MSL, which is fine by me. This also probably involves tweaking the PP code, which is also fine by me. Any hints would be welcomed. ______________________________________________________________________ Martin-Gilles Lavoie (steltor.com) From luc.regnault at wanadoo.fr Mon Nov 4 08:58:01 2002 From: luc.regnault at wanadoo.fr (Luc Regnault) Date: Thu Nov 3 14:50:20 2005 Subject: Bug in CGGetDisplayTransferByTable ? Message-ID: <7B1B38DC-F016-11D6-BF0C-003065CBA36C@wanadoo.fr> I have a big problem with the core graphic CGGetDisplayTransferByTable function. With MacOS 10.2, this function appears to not function properly anymore, as it was previously in 10.1.5. Even if the green chanel is very different than the red chanel (or the blue different of the red), the function return the green and blue chanels with the same values than the red chanel. It looks like a big bug. Does anybody have a solution or a tip ? The following code demonstrate the problem. It beeps always. -(void)setMagentaScreenLUT { CGDisplayErr err; CGDirectDisplayID dspys[1]; CGDisplayCount dspyCnt; float red[256]; float green[256]; float blue[256]; int sampleCount; red[0] = 0.0; red[1] = 1.0; green[0] = 0.0; green[1] = 0.5; // a green different than the red !!! (half the red) blue[0] = 0.0; blue[1] = 1.0; err = CGGetDisplaysWithPoint( CGPointMake( 1, 1), 1, dspys, &dspyCnt); if( err == CGDisplayNoErr) { err = CGSetDisplayTransferByTable( dspys[0], 2, red, green, blue); // now the screen is very magenta... } if( err == CGDisplayNoErr) { err = CGGetDisplayTransferByTable( dspys[0], 256, red, green, blue, &sampleCount); if( err == CGDisplayNoErr) { if( red[255] == green[255]) { // oh !!! // the green is normally very different than the red !!! NSBeep(); } } } -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2889 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021104/fd5aa94a/attachment.bin From rixstep000 at yahoo.co.uk Mon Nov 4 09:42:01 2002 From: rixstep000 at yahoo.co.uk (=?iso-8859-1?q?Domain=20Administrators?=) Date: Thu Nov 3 14:50:20 2005 Subject: Dag Tags Message-ID: <20021104174156.13011.qmail@web10904.mail.yahoo.com> I really wish people were more cluefull and didn't drown these listings in dag tags. A letter I just read took two folds for a single vcard. Here, if anywhere, if you don't know how to use your email client and don't understand this is a text list - get out of Dodge. Rixster __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com From scott_ribe at killerbytes.com Mon Nov 4 11:36:01 2002 From: scott_ribe at killerbytes.com (Scott Ribe) Date: Thu Nov 3 14:50:20 2005 Subject: [OT] please ditch the attachments In-Reply-To: Message-ID: > I think that he sent this out because there are occasionally others who have > attachment-signatures and so I wouldn't take it as a personal attack but > just a reminder to the whole community about things that make this easier > for everybody. I set up rules to strip attachments from all message from all lists I am subscribed to. Not only does this get rid of those annoying little vcf files, it really helps my tranquility when some doofus on a programming list attaches a dozen or more source files instead of an archive. Highly recommended, if I say so myself ;-) -- Scott Ribe scott_ribe@killerbytes.com http://www.killerbytes.com/ (303) 665-7007 voice From brock at bergdesign.com Mon Nov 4 15:05:01 2002 From: brock at bergdesign.com (Brock Brandenberg) Date: Thu Nov 3 14:50:20 2005 Subject: Writing documentation for the help menu item Message-ID: Check out these two articles on Cocoa Dev Central and Andrew Stone's site: http://www.cocoadevcentral.com/tutorials/showpage.php?show=00000051.php http://www.stone.com/The_Cocoa_Files/Help_On_The_Way_.html Brock Brandenberg ----- industrial design @ www.bergdesign.com ------ From ijeyd at mac.com Mon Nov 4 16:20:01 2002 From: ijeyd at mac.com (Morgan Redman) Date: Thu Nov 3 14:50:21 2005 Subject: Debugging Multiple Bundles In-Reply-To: <1762B41C-EED1-11D6-9755-000393658196@mac.com> Message-ID: <48368C12-F054-11D6-A06F-00039344C692@mac.com> So your saying, have each bundle in its own project, and have each project open, and then I should be able to debug it? -Morgan On Saturday, November 2, 2002, at 06:08 PM, Fabien Roy wrote: > Another way is to have all bundle project open in "ProjectBuilder". > > On Friday, Nov 1, 2002, at 14:45 US/Pacific, Morgan Redman wrote: > >> When I type the path name.. nothing seems to happen. All my source >> files are in the same directory, the project directory... I dont >> understand why it says "no source file..." > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From fabienlroy at mac.com Mon Nov 4 16:52:01 2002 From: fabienlroy at mac.com (Fabien Roy) Date: Thu Nov 3 14:50:21 2005 Subject: Debugging Multiple Bundles In-Reply-To: <48368C12-F054-11D6-A06F-00039344C692@mac.com> Message-ID: Basically yes. gdb does some remote messaging on each project instance. This is based on my debugging experience. Fabien On Monday, Nov 4, 2002, at 16:19 US/Pacific, Morgan Redman wrote: > So your saying, have each bundle in its own project, and have each > project open, and then I should be able to debug it? > > -Morgan From ijeyd at mac.com Mon Nov 4 17:08:01 2002 From: ijeyd at mac.com (Morgan Redman) Date: Thu Nov 3 14:50:21 2005 Subject: Debugging Multiple Bundles In-Reply-To: Message-ID: Ok, I tried moving one of my bundles to a separate project, but I am still getting the same results. If I put a break in the bundle, when I try to debug from the applications project window it still says no source file found.... I must be doing somthing wrong, but I cant even begin to guess what. Morgan On Monday, November 4, 2002, at 04:51 PM, Fabien Roy wrote: > Basically yes. gdb does some remote messaging on each project instance. > This is based on my debugging experience. > > Fabien > On Monday, Nov 4, 2002, at 16:19 US/Pacific, Morgan Redman wrote: > >> So your saying, have each bundle in its own project, and have each >> project open, and then I should be able to debug it? >> >> -Morgan > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From jimrockwell880 at hotmail.com Mon Nov 4 17:21:01 2002 From: jimrockwell880 at hotmail.com (Jim Rockwell) Date: Thu Nov 3 14:50:21 2005 Subject: math libraries for OSX? Message-ID: Are their math libraries for Mac OSX (whether commercial or freeware)? Specifically I need regression functions. _________________________________________________________________ Internet access plans that fit your lifestyle -- join MSN. http://resourcecenter.msn.com/access/plans/default.asp From fabienlroy at mac.com Mon Nov 4 17:24:01 2002 From: fabienlroy at mac.com (Fabien Roy) Date: Thu Nov 3 14:50:21 2005 Subject: Debugging Multiple Bundles In-Reply-To: Message-ID: <30CFD404-F05D-11D6-9EBB-000393658196@mac.com> Is it a java or else project? On Monday, Nov 4, 2002, at 17:07 US/Pacific, Morgan Redman wrote: > Ok, I tried moving one of my bundles to a separate project, but I am > still getting the same results. If I put a break in the bundle, when > I try to debug from the applications project window it still says no > source file found.... I must be doing somthing wrong, but I cant even > begin to guess what. > > Morgan From simX at mac.com Mon Nov 4 17:26:03 2002 From: simX at mac.com (Simone Manganelli) Date: Thu Nov 3 14:50:21 2005 Subject: Disabling a NSTableView? Message-ID: <6AFB290C-F05D-11D6-BC8B-000393B909BA@mac.com> Can anybody tell me how I can disable an NSTableView? I know I can use a delegate to prevent the editing of rows, but I want the TableView to show a visual notification to the user so they know it's disabled ? similar to the effect of buttons being disabled. Is this even possible? Thanks for any help. -- Simone Manganelli From shawn at freetimesw.com Mon Nov 4 17:27:01 2002 From: shawn at freetimesw.com (Shawn Erickson) Date: Thu Nov 3 14:50:21 2005 Subject: Bug in CGGetDisplayTransferByTable ? In-Reply-To: <7B1B38DC-F016-11D6-BF0C-003065CBA36C@wanadoo.fr> Message-ID: <962A6156-F05D-11D6-9DB0-0003939626AA@freetimesw.com> On Monday, November 4, 2002, at 08:57 AM, Luc Regnault wrote: > I have a big problem with the core graphic CGGetDisplayTransferByTable > function. > > With MacOS 10.2, this function appears to not function properly > anymore, as it was previously in 10.1.5. > Even if the green chanel is very different than the red chanel (or the > blue different of the red), the function return the green and blue > chanels with the same values than the red chanel. > > It looks like a big bug. Does anybody have a solution or a tip ? > > The following code demonstrate the problem. It beeps always. [snip] > red[0] = 0.0; red[1] = 1.0; > green[0] = 0.0; green[1] = 0.5; // a green different than the red !!! > (half the red) > blue[0] = 0.0; blue[1] = 1.0; [snip] > if( err == CGDisplayNoErr) { > err = CGGetDisplayTransferByTable( dspys[0], 256, > red, green, blue, &sampleCount); > if( err == CGDisplayNoErr) { > if( red[255] == green[255]) { > // oh !!! > // the green is normally very different than the red !!! > NSBeep(); > } > } What is the value returned in sampleCount? Is it 256? If not that is your problem. As I understand it you should be using the value return in sampleCount to understand how many samples actually got copied into your sample buffers. -Shawn -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2197 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021104/437948e6/attachment.bin From bob at redivi.com Mon Nov 4 17:52:01 2002 From: bob at redivi.com (Bob Ippolito) Date: Thu Nov 3 14:50:21 2005 Subject: math libraries for OSX? In-Reply-To: Message-ID: <096B98C1-F061-11D6-864F-0003938210D6@redivi.com> On Monday, Nov 4, 2002, at 20:20 America/New_York, Jim Rockwell wrote: > Are their math libraries for Mac OSX (whether commercial or freeware)? > Specifically I need regression functions. GSL - The GNU Scientific Library - http://sources.redhat.com/gsl/ Goose - http://www.gnu.org/software/goose/ ccmath - http://freshmeat.net/projects/ccmath/?topic_id=809%2C98 You can probably find others .. those came right off of freshmeat.net -bob From chergr at bigpond.com Mon Nov 4 17:54:02 2002 From: chergr at bigpond.com (Richard) Date: Thu Nov 3 14:50:21 2005 Subject: math libraries for OSX? References: Message-ID: <3DC724A6.6EA4A65B@bigpond.com> Numerical Recipes??? Which I think has a c++ version now. Jim Rockwell wrote: > Are their math libraries for Mac OSX (whether commercial or freeware)? > Specifically I need regression functions. > > _________________________________________________________________ > Internet access plans that fit your lifestyle -- join MSN. > http://resourcecenter.msn.com/access/plans/default.asp > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From chergr at bigpond.com Mon Nov 4 17:56:02 2002 From: chergr at bigpond.com (Richard) Date: Thu Nov 3 14:50:21 2005 Subject: math libraries for OSX? References: Message-ID: <3DC7251F.E6D4A111@bigpond.com> Or the R statistics scripting language, which I am working with currently. www.r-project.org. Jim Rockwell wrote: > Are their math libraries for Mac OSX (whether commercial or freeware)? > Specifically I need regression functions. > > _________________________________________________________________ > Internet access plans that fit your lifestyle -- join MSN. > http://resourcecenter.msn.com/access/plans/default.asp > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From andreas at harmless.de Mon Nov 4 19:26:00 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:21 2005 Subject: Disabling a NSTableView? In-Reply-To: <6AFB290C-F05D-11D6-BC8B-000393B909BA@mac.com> Message-ID: <2B1582E1-F06E-11D6-A0FC-00050231227A@harmless.de> Am Dienstag, 05.11.02 um 02:25 Uhr schrieb Simone Manganelli: > Can anybody tell me how I can disable an NSTableView? I know I can > use a delegate to prevent the editing of rows, but I want the > TableView to show a visual notification to the user so they know it's > disabled ? similar to the effect of buttons being disabled. You may try to set the cells of your table view to disabled (NSCell setEnabled:). If you then redraw the table view, entries should be drawn in gray. I did not try this myself though. bye. Andreas. From fabienlroy at mac.com Mon Nov 4 22:06:01 2002 From: fabienlroy at mac.com (Fabien Roy) Date: Thu Nov 3 14:50:21 2005 Subject: math libraries for OSX? In-Reply-To: <096B98C1-F061-11D6-864F-0003938210D6@redivi.com> Message-ID: <9B303CB2-F084-11D6-9EBB-000393658196@mac.com> What about an Altivec/Velocity Engine optimized math libraries? Is there some existing ones? Thanks. Fabien On Monday, Nov 4, 2002, at 17:51 US/Pacific, Bob Ippolito wrote: > On Monday, Nov 4, 2002, at 20:20 America/New_York, Jim Rockwell wrote: > >> Are their math libraries for Mac OSX (whether commercial or >> freeware)? Specifically I need regression functions. > > GSL - The GNU Scientific Library - http://sources.redhat.com/gsl/ > Goose - http://www.gnu.org/software/goose/ > ccmath - http://freshmeat.net/projects/ccmath/?topic_id=809%2C98 > > You can probably find others .. those came right off of freshmeat.net > > -bob > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From cohen at embl-grenoble.fr Tue Nov 5 01:44:00 2002 From: cohen at embl-grenoble.fr (Serge Cohen) Date: Thu Nov 3 14:50:21 2005 Subject: math libraries for OSX? In-Reply-To: <9B303CB2-F084-11D6-9EBB-000393658196@mac.com> Message-ID: <5D63542C-F0AB-11D6-B5EC-00039398A040@embl-grenoble.fr> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, AltiVec is good for linear algebra (including multi precision arythmetic), in this respect you can either use the veclib framework (/System/Library/Frameworks/vecLib.framework : go man veclib) or also the compile time optimised BLAS/LAPACK implementation from ATLAS: http://math-atlas.sf.net It is also good to make DSP like function (which indeed is some linear algebra), for that go for the vecLib framework (and check examples on the Apple site). Outside this area (which is already quite wide), I don't think it can be of much help (for example to compute an exp, log...). Hope that will help. Serge. Le mardi 5 novembre 2002, ? 07:05 , Fabien Roy a ?crit : > What about an Altivec/Velocity Engine optimized math libraries? > Is there some existing ones? > > Thanks. > > Fabien > > On Monday, Nov 4, 2002, at 17:51 US/Pacific, Bob Ippolito wrote: > >> On Monday, Nov 4, 2002, at 20:20 America/New_York, Jim Rockwell wrote: >> >>> Are their math libraries for Mac OSX (whether commercial or >>> freeware)? Specifically I need regression functions. >> >> GSL - The GNU Scientific Library - http://sources.redhat.com/gsl/ >> Goose - http://www.gnu.org/software/goose/ >> ccmath - http://freshmeat.net/projects/ccmath/?topic_id=809%2C98 >> >> You can probably find others .. those came right off of freshmeat.net >> >> -bob >> >> _______________________________________________ >> 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 > > - ---------------------------------------------------- Serge Cohen GPG Key ID: 1024D/69B1D346 - ---------------------------------------------------- -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (Darwin) iD8DBQE9x6C+Mygj1Wmx00YRAgx9AJ0UJmhDu5n5fL7duHEXqw03zm/K8ACfYuZa CNzZO3lYi1CC1Q53YdcKq4E= =e2eT -----END PGP SIGNATURE----- From eyredler at netvision.net.il Tue Nov 5 03:13:01 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release Message-ID: <5B6C07BC-F0AF-11D6-9A15-003065C9C4EE@netvision.net.il> Hi All, I've noticed that my app was spending huge amounts of time in the NSObject retain release and decided to write my own ref counting (see ERObject below). This trick seems to work OK and I see a *big* gain in speed. But I'm not sure this is "legal" and I never saw this mentioned. 1. What are the disadvantages or dangers involved in what I did? 2. Why does NSObject spend so much time doing this simple ++ or --? 3. I've read Mulle kybernetiK - Optimizing Objective-C (Learned a lot). Are there any other resources dealing with optimizing Cocoa. A tutorial on gprof would also be very nice. @interface ERObject : NSObject { unsigned _errc; } @end @implementation ERObject - (id)init { if (self = [super init]) _errc=1; return self; } - (id)retain { ++_errc; return self; } - (void)release { --_errc; if (_errc==0) [super release]; } @end Thanks, Eyal Redler From alannon at insomniaque.net Tue Nov 5 03:22:01 2002 From: alannon at insomniaque.net (Avi Cherry) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <5B6C07BC-F0AF-11D6-9A15-003065C9C4EE@netvision.net.il> References: <5B6C07BC-F0AF-11D6-9A15-003065C9C4EE@netvision.net.il> Message-ID: >- (void)release { > --_errc; > if (_errc==0) > [super release]; > } >@end Don't you mean [super dealloc] down at the bottom there? I'd also double-check to make sure that autorelease still works the way that you expect it to. From john at toastedmarshmallow.com Tue Nov 5 03:50:01 2002 From: john at toastedmarshmallow.com (=?ISO-8859-1?Q?John_H=F6rnkvist?=) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <5B6C07BC-F0AF-11D6-9A15-003065C9C4EE@netvision.net.il> Message-ID: <926A96A2-F0B4-11D6-84CE-0030654E84BA@toastedmarshmallow.com> On Tuesday, November 5, 2002, at 12:11 PM, Eyal Redler wrote: > Hi All, > > I've noticed that my app was spending huge amounts of time in the > NSObject retain release and decided to write my own ref counting (see > ERObject below). > This trick seems to work OK and I see a *big* gain in speed. But I'm > not sure this is "legal" and I never saw this mentioned. It's a very old trick. NSObject has a different space versus time tradeoff. > 1. What are the disadvantages or dangers involved in what I did? More memory is used. With NSObject, there's no memory overhead for objects with a retain count of one. > 2. Why does NSObject spend so much time doing this simple ++ or --? Memory was expensive back then... Increasing the size of NSObject would be a bit painful due > 3. I've read Mulle kybernetiK - Optimizing Objective-C (Learned a > lot). Are there any other resources dealing with optimizing Cocoa. A > tutorial on gprof would also be very nice. Optimizing Cocoa is not all that different from optimizing other things... 1) Is it fast enough? 2) Do the users really think it's too slow? 3) Measure where time is spent. 4) Does that show any correlation with what the users think? 5) Would users pay for the extra speed in those parts? 5) Optimize those parts where you spend a lot of time _and_ users think that it's too slow. Always remember Amdahl's law when you optimize. Get the low hanging fruit first --- but only if it's in a place that actually matters. Little "tricks": Use IMP caching where method dispatch overhead is a problem. Rewrite "statically" for recursive data structures and such. Write custom data structures and algorithms when you have knowledge of the data and its distrubution. Foundation collections are fine, but they are generic; a specialized collection can be much better. Sorting is an example; Foundation can't really do better than O(n ln(n)); with knowledge of the distribution O(n) average sorting is often possible. > @interface ERObject : NSObject { > unsigned _errc; > } > @end > @implementation ERObject > - (id)init { > if (self = [super init]) > _errc=1; > return self; > } > - (id)retain { > ++_errc; > return self; > } > - (void)release { > --_errc; > if (_errc==0) > [super release]; > } > @end Don't initialize _errc to 1-- which means you don't need an init method, saving an method dispatch there -- and write release like this: - (void)release { if (_errc==0) { [self dealloc]; return; } else --_errc; } That should also save a few extra cycles since the branch condition is available earlier... Depending on the branch prediction on the processor and how often you dealloc versus just decrease the retain count, you might want to reorder the if / else clauses... The last stuff will really drown in the message dispatch overhead, though. :) Regards, John Hornkvist From marco at sente.ch Tue Nov 5 04:17:01 2002 From: marco at sente.ch (Marco Scheurer) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <5B6C07BC-F0AF-11D6-9A15-003065C9C4EE@netvision.net.il> Message-ID: <62CDB966-F0B8-11D6-8177-003065F99092@sente.ch> On Tuesday, November 5, 2002, at 12:11 PM, Eyal Redler wrote: > Hi All, > > I've noticed that my app was spending huge amounts of time in the > NSObject retain release and decided to write my own ref counting (see > ERObject below). > This trick seems to work OK and I see a *big* gain in speed. But I'm > not sure this is "legal" and I never saw this mentioned. > 1. What are the disadvantages or dangers involved in what I did? It's wrong, and the *big* gain speed is unlikely to last for long as you're not deallocating your objects. A possible implementation would be: - (id) retain { _errc++; return self; } - (unsigned int) retainCount { return _errc + 1; } - (void) release { if (--_errc < 0) { [self dealloc]; } } > 2. Why does NSObject spend so much time doing this simple ++ or --? Because it is not a simple ++ or -- . NSObject does not include a retainCount ivar, mostly for historical reasons I suppose (adding an ivar to the base class is not something you do without breaking almost all existing software). The reference count of objects is maintained externally, in a hash table. Marco Scheurer Sen:te, Lausanne, Switzerland http://www.sente.ch From kirby132 at hotmail.com Tue Nov 5 04:21:01 2002 From: kirby132 at hotmail.com (Kevin Bohan) Date: Thu Nov 3 14:50:21 2005 Subject: Problem launching a process from Installer.post_install script Message-ID: Hi, I don't know if this is an Apple Installer issue or a problem with my app so I have posted this to two mailing lists. I apologise if this is not appropriate. I have a process that needs to run as a daemon. It's launched from /Library/StartupItems when the system boots. In case it's relevant, the process doesn't actually use the function call daemon(1,1) as this was causing a crash in CFRunLoop. I figured CoreFoundation doesn't like daemon, so my process now forks and exec's instead, which seems to work fine. I use the word daemon below with this process in mind eventhough it isn't strictly a daemon. I then decided to make my Apple Installer have this daemon launch as a post_install and post_upgrade shell script, so that the user would not have to reboot to have the daemon start. This is where the problems started. I noticed that the process started to get a SIGPIPE signal and was causing my signal handler to terminate the daemon for this reason. I don't see this issue if the system launches the process at bootup, or if I manually launch the process from the command line using sudo. I also noted that the although the UID is 0 when the signal is received, the EUID is non-zero, matching that of the logged in user. The process starts with a UID and EUID of 0, and yet when the signal handler function fires the EUID is non-zero. Anyone know anything about the way in which the Apple Installer calls the install scripts? What am I doing wrong? Kirby _________________________________________________________________ Unlimited Internet access for only $21.95/month.  Try MSN! http://resourcecenter.msn.com/access/plans/2monthsfree.asp From kirby132 at hotmail.com Tue Nov 5 06:31:13 2002 From: kirby132 at hotmail.com (Kevin Bohan) Date: Thu Nov 3 14:50:21 2005 Subject: Problem launching a process from Installer.post_install script Message-ID: Interestingly, before 10.2, I think it was around 10.1.2 time, I logged an issue with Apple where my daemon when started from the command line was able to launch an Apple Script, say that lauches Microsoft Word, as a somewhat ridiulous example, but one that proves a point. The same Apple Script didn't work when the daemon was started from bootup. It turned out this was something to do was "by design", or for security reasons, were the Mach kernel separates boot and non-boot processes, and doesn't allow Mach kernel messaging to cross this boundary. Seemingly there was a way around it if you really knew the Mach APIs but I don't so I left it. This would appear to be the opposite of what you are saying for 10.2, if the two are related at all. I must see the behavior I have logged has changed in light of what you have indicated. Kirby >From: Stéphane Sudre >To: "Kevin Bohan" >Subject: Re: Problem launching a process from Installer.post_install script >Date: Tue, 5 Nov 2002 14:20:58 +0100 > > >From what I'm seeing in 10.2, launching a "daemon" outside the Startup >Items process may lead to different behavior. > >For instance what I'm seeing is that if a "daemon" is launched at >boot-time, it's possible to communicate with it from another process. If >it's launched manually or by an installer after boot-time, the "daemon" is >deaf. > >Something got broken or changed in 10.2 as this behavior is not observable >on 10.1.x. _________________________________________________________________ Get a speedy connection with MSN Broadband.  Join now! http://resourcecenter.msn.com/access/plans/freeactivation.asp From kirby132 at hotmail.com Tue Nov 5 06:37:01 2002 From: kirby132 at hotmail.com (Kevin Bohan) Date: Thu Nov 3 14:50:21 2005 Subject: Problem launching a process from Installer.post_install script Message-ID: One other point I didn't mention is that my daemon uses CFUserNotificationCreate to give some popup notifications and I also launch the "wall" BSD process to notify remote users, neither of which are seen after the installer has launched my daemon. I know the process is running, and I can see logged information. Kirby >From: Stéphane Sudre >To: "Kevin Bohan" >Subject: Re: Problem launching a process from Installer.post_install script >Date: Tue, 5 Nov 2002 14:20:58 +0100 > > >On mardi, nov 5, 2002, at 13:20 Europe/Paris, Kevin Bohan wrote: > >>Hi, >> >>I don't know if this is an Apple Installer issue or a problem with my app >>so I have posted this to two mailing lists. I apologise if this is not >>appropriate. >> >>I have a process that needs to run as a daemon. It's launched from >>/Library/StartupItems when the system boots. In case it's relevant, the >>process doesn't actually use the function call daemon(1,1) as this was >>causing a crash in CFRunLoop. I figured CoreFoundation doesn't like >>daemon, so my process now forks and exec's instead, which seems to work >>fine. I use the word daemon below with this process in mind eventhough it >>isn't strictly a daemon. >> >>I then decided to make my Apple Installer have this daemon launch as a >>post_install and post_upgrade shell script, so that the user would not >>have to reboot to have the daemon start. This is where the problems >>started. > >From what I'm seeing in 10.2, launching a "daemon" outside the Startup >Items process may lead to different behavior. > >For instance what I'm seeing is that if a "daemon" is launched at >boot-time, it's possible to communicate with it from another process. If >it's launched manually or by an installer after boot-time, the "daemon" is >deaf. > >Something got broken or changed in 10.2 as this behavior is not observable >on 10.1.x. _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 From finlay at dobbie.net Tue Nov 5 08:27:20 2002 From: finlay at dobbie.net (Finlay Dobbie) Date: Thu Nov 3 14:50:21 2005 Subject: Debugging Multiple Bundles In-Reply-To: Message-ID: <4B7067B4-F0DB-11D6-B79F-000502319F17@dobbie.net> On Tuesday, November 5, 2002, at 01:07 am, Morgan Redman wrote: > Ok, I tried moving one of my bundles to a separate project, but I am > still getting the same results. If I put a break in the bundle, when > I try to debug from the applications project window it still says no > source file found.... I must be doing somthing wrong, but I cant even > begin to guess what. Perhaps you're using a build with some symbols stripped. Make sure your build style is set to "development". You don't say what the source file is, but if it's one that you don't actually have, you could have inadvertently set a breakpoint in a header of a compiled framework (I did this in NSException.h once, mystified me for a while :-)). -- Finlay From ckane at apple.com Tue Nov 5 09:58:01 2002 From: ckane at apple.com (Chris Kane) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <62CDB966-F0B8-11D6-8177-003065F99092@sente.ch> Message-ID: <11DB0252-F0E8-11D6-9466-003065E6D674@apple.com> In addition to all this, I'd add that Cocoa also does its reference counting thread-safely (or, makes provisions for...), which the code below does not. If you use these objects in multiple threads, you will find very quickly that the ref counting has to be made thread-safe, even if the object as a whole is not going to be. Chris Kane Cocoa Frameworks, Apple On Tuesday, November 5, 2002, at 04:16 AM, Marco Scheurer wrote: > On Tuesday, November 5, 2002, at 12:11 PM, Eyal Redler wrote: > >> Hi All, >> >> I've noticed that my app was spending huge amounts of time in the >> NSObject retain release and decided to write my own ref counting (see >> ERObject below). >> This trick seems to work OK and I see a *big* gain in speed. But I'm >> not sure this is "legal" and I never saw this mentioned. >> 1. What are the disadvantages or dangers involved in what I did? > > It's wrong, and the *big* gain speed is unlikely to last for long as > you're not deallocating your objects. A possible implementation would > be: > > - (id) retain > { > _errc++; > return self; > } > > > - (unsigned int) retainCount > { > return _errc + 1; > } > > > - (void) release > { > if (--_errc < 0) { > [self dealloc]; > } > } > > >> 2. Why does NSObject spend so much time doing this simple ++ or --? > > Because it is not a simple ++ or -- . NSObject does not include a > retainCount ivar, mostly for historical reasons I suppose (adding an > ivar to the base class is not something you do without breaking almost > all existing software). The reference count of objects is maintained > externally, in a hash table. > > Marco Scheurer > Sen:te, Lausanne, Switzerland http://www.sente.ch > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From brian at classicalguitar.net Tue Nov 5 10:02:01 2002 From: brian at classicalguitar.net (Brian Bergstrand) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <5B6C07BC-F0AF-11D6-9A15-003065C9C4EE@netvision.net.il> Message-ID: <27DDBE21-F0E8-11D6-A7CE-0003930A674E@classicalguitar.net> On Tuesday, November 5, 2002, at 05:11 AM, Eyal Redler wrote: > Hi All, > > I've noticed that my app was spending huge amounts of time in the > NSObject retain release and decided to write my own ref counting (see > ERObject below). > This trick seems to work OK and I see a *big* gain in speed. But I'm > not sure this is "legal" and I never saw this mentioned. > 1. What are the disadvantages or dangers involved in what I did? For one, your implementation is not thread safe. Also, it's unlikely that NSObject's retain/release is chewing up so many cycles that your users will actually notice the speed improvement. > > @interface ERObject : NSObject { > unsigned _errc; > } > @end > @implementation ERObject > - (id)init { > if (self = [super init]) > _errc=1; > return self; > } > - (id)retain { > ++_errc; > return self; > } > - (void)release { > --_errc; > if (_errc==0) > [super release]; > } > @end > > > Thanks, > > Eyal Redler > Brian Bergstrand PGP Key ID: 0xB6C7B6A2 Blessed is he who expects nothing, for he shall never be disappointed. - Jonathan Swift From jeff.szuhay at pstnet.com Tue Nov 5 10:59:01 2002 From: jeff.szuhay at pstnet.com (Jeff Szuhay) Date: Thu Nov 3 14:50:21 2005 Subject: Eudora... huh? Message-ID: I use a pre-5.0 (paid) version of Eudora and today a new version announcement popped up. I haven't yet found a compelling reason to pay _again_ for Eudora since the new features are useless to me but I keep checking, anyway. Here's a curious note in the 5.2 release notes: Disabled don't check on battery pref for OS X, since Apple doesn't give a damn Huh? What's up with that? (despite the fact that it is an amazing display of unprofessionalism). Jeff Sz. -- Jeff Szuhay Lead Macintosh Engineer voice: 412-271-5040 x 227 Psychology Software Tools From njriley at uiuc.edu Tue Nov 5 11:09:02 2002 From: njriley at uiuc.edu (Nicholas Riley) Date: Thu Nov 3 14:50:21 2005 Subject: Eudora... huh? In-Reply-To: References: Message-ID: <20021105190826.GA2065813@uiuc.edu> On Tue, Nov 05, 2002 at 01:58:35PM -0500, Jeff Szuhay wrote: > Disabled don't check on battery pref for OS X, since Apple doesn't > give a damn Probably indicating that there's no public, documented API to get information about whether an OS X machine is using the battery. Or maybe just indicating that there is very little done on OS X versus OS 9 to conserve battery power. > (despite the fact that it is an amazing display of unprofessionalism). The release notes for Eudora have always been humorous. I wish there were a bit more humor in current software products; a lot of it has been taken out of Eudora over the years. -- =Nicholas Riley | Pablo Research Group, Department of Computer Science and Medical Scholars Program, University of Illinois at Urbana-Champaign From eyredler at netvision.net.il Tue Nov 5 11:27:02 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <926A96A2-F0B4-11D6-84CE-0030654E84BA@toastedmarshmallow.com> Message-ID: <5B6305EE-F0F4-11D6-87FA-003065C9C4EE@netvision.net.il> >> I've noticed that my app was spending huge amounts of time in the >> NSObject retain release and decided to write my own ref counting (see >> ERObject below). >> This trick seems to work OK and I see a *big* gain in speed. But I'm >> not sure this is "legal" and I never saw this mentioned. > > It's a very old trick. NSObject has a different space versus time > tradeoff. > >> 1. What are the disadvantages or dangers involved in what I did? > > More memory is used. With NSObject, there's no memory overhead for > objects with a retain count of one. > >> 2. Why does NSObject spend so much time doing this simple ++ or --? > > Memory was expensive back then... Increasing the size of NSObject > would be a bit painful due painful due to... binary computability? I wonder why Apple didn't use the opportunity to add this when they moved the Next code to the Mac... >> 3. I've read Mulle kybernetiK - Optimizing Objective-C (Learned a >> lot). Are there any other resources dealing with optimizing Cocoa. A >> tutorial on gprof would also be very nice. > > Optimizing Cocoa is not all that different from optimizing other > things... > > 1) Is it fast enough? > 2) Do the users really think it's too slow? > 3) Measure where time is spent. > 4) Does that show any correlation with what the users think? > 5) Would users pay for the extra speed in those parts? > 5) Optimize those parts where you spend a lot of time _and_ users > think that it's too slow. > > Always remember Amdahl's law when you optimize. > > Get the low hanging fruit first --- but only if it's in a place that > actually matters. I did. I'm not trying to speed up some obscure filter or to make a file open in 1.45 sec instead of 1.52. I usually write my code without much regard to performance. I try to make thinks *correct* using brute force. But the process I'm trying to optimize is very interactive and I have to get response times very low to make my app "feel" right. > Rewrite "statically" for recursive data structures and such. Can you elaborate? I didn't understand... > Don't initialize _errc to 1-- which means you don't need an init > method, saving an method dispatch there -- and write release like > this: > - (void)release { > if (_errc==0) > { > [self dealloc]; > return; > } > else > --_errc; > } > Thanks. > Depending on the branch prediction on the processor and how often you > dealloc versus just decrease the retain count, you might want to > reorder the if / else clauses... Is it bad to use release instead? I was not sure I can call dealloc directly. Objects are rarely deallocated. It's something like 99.9999% of the time just a refcount increase or decrease. Thanks, Eyal Redler From clarkcox3 at mac.com Tue Nov 5 11:39:03 2002 From: clarkcox3 at mac.com (Clark S. Cox III) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <5B6305EE-F0F4-11D6-87FA-003065C9C4EE@netvision.net.il> Message-ID: <29730C96-F0F6-11D6-B73B-0050E4EE1966@mac.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday, Nov 5, 2002, at 14:25 US/Eastern, Eyal Redler wrote: >>> I've noticed that my app was spending huge amounts of time in the >>> NSObject retain release and decided to write my own ref counting >>> (see ERObject below). >>> This trick seems to work OK and I see a *big* gain in speed. But I'm >>> not sure this is "legal" and I never saw this mentioned. >> >> It's a very old trick. NSObject has a different space versus time >> tradeoff. >> >>> 1. What are the disadvantages or dangers involved in what I did? >> >> More memory is used. With NSObject, there's no memory overhead for >> objects with a retain count of one. >> >>> 2. Why does NSObject spend so much time doing this simple ++ or --? >> >> Memory was expensive back then... Increasing the size of NSObject >> would be a bit painful due > > painful due to... binary computability? Yes. > I wonder why Apple didn't use the opportunity to add this when they > moved the Next code to the Mac... Probably because the current situation is best for the general case (i.e. an object is created, then destroyed, the refCount never gets higher than 1). >> Don't initialize _errc to 1-- which means you don't need an init >> method, saving an method dispatch there -- and write release like > >> this: >> - (void)release { >> if (_errc==0) >> { >> [self dealloc]; >> return; >> } >> else >> --_errc; >> } >> > Thanks. > >> Depending on the branch prediction on the processor and how often you >> dealloc versus just decrease the retain count, you might want to >> reorder the if / else clauses... > > Is it bad to use release instead? I was not sure I can call dealloc > directly. I don't think it was being suggested that you call dealloc yourself. > Objects are rarely deallocated. It's something like 99.9999% of the > time just a refcount increase or decrease. In which case *might* be better (because it only has to branch that 0.0001% of the time). - - (void)release { if (_errc) { --_errc; } else { [self dealloc]; } } - -- http://homepage.mac.com/clarkcox3/ clarkcox3@mac.com Clark S. Cox, III -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (Darwin) iEYEARECAAYFAj3IHjsACgkQd6STocYT1xVfiwCcCk3snr48FZ+yyaObf/1l0G85 daQAn0sORuzLnZ/85DL3eSFVPUgejCUi =H0Pm -----END PGP SIGNATURE----- From marco at sente.ch Tue Nov 5 11:47:01 2002 From: marco at sente.ch (Marco Scheurer) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <11DB0252-F0E8-11D6-9466-003065E6D674@apple.com> Message-ID: <513760D1-F0F7-11D6-A8CC-003065F99092@sente.ch> On Tuesday, November 5, 2002, at 06:57 PM, Chris Kane wrote: > In addition to all this, I'd add that Cocoa also does its reference > counting thread-safely (or, makes provisions for...), which the code > below does not. If you use these objects in multiple threads, you > will find very quickly that the ref counting has to be made > thread-safe, even if the object as a whole is not going to be. > [...] >> It's wrong, and the *big* gain speed is unlikely to last for long as >> you're not deallocating your objects. A possible implementation would >> be: >> >> - (id) retain >> { >> _errc++; >> return self; >> } Right. Thread safety can easily be added to this scheme too, but at a cost that may reduce its interest. Marco Scheurer Sen:te, Lausanne, Switzerland http://www.sente.ch From eyredler at netvision.net.il Tue Nov 5 11:48:01 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <27DDBE21-F0E8-11D6-A7CE-0003930A674E@classicalguitar.net> Message-ID: <43E66260-F0F7-11D6-87FA-003065C9C4EE@netvision.net.il> >> I've noticed that my app was spending huge amounts of time in the >> NSObject retain release and decided to write my own ref counting (see >> ERObject below). >> This trick seems to work OK and I see a *big* gain in speed. But I'm >> not sure this is "legal" and I never saw this mentioned. >> 1. What are the disadvantages or dangers involved in what I did? > > For one, your implementation is not thread safe. Also, it's unlikely > that NSObject's retain/release is chewing up so many cycles that your > users will actually notice the speed improvement. Do I need to worry about that if my app is not threaded? As to the speed gain. It's very noticeable to the user since I'm optimizing an interactive process. The user is typing and he needs to see the results of the data rearrangement instantly. It could be that my design is faulty because it requires so many retain/releases but I found no other way of doing it. Eyal From timcoffman at mac.com Tue Nov 5 11:55:00 2002 From: timcoffman at mac.com (Tim Coffman) Date: Thu Nov 3 14:50:21 2005 Subject: Dev. Environvment, Starting From Scratch Message-ID: <5609598.1036526076718.JavaMail.timcoffman@mac.com> I am still experiencing inability to stop at breakpoints set via the UI and now gdb is complaining that my standard library was built with an earlier/incompatible version of the ABI. So, I am starting over. QUESTION: What do I need to erase/remove/uninstall/reformat in order to start over with a clean, fresh, reliable development environment? From eyredler at netvision.net.il Tue Nov 5 12:06:07 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <29730C96-F0F6-11D6-B73B-0050E4EE1966@mac.com> Message-ID: >> Is it bad to use release instead? I was not sure I can call dealloc >> directly. > > I don't think it was being suggested that you call dealloc yourself. I meant calling dealloc from release. My original implementation was calling release instead of dealloc when the ref count is zero. I saw the dealloc suggested in the code other people wrote... Thanks, Eyal From bmackin at mac.com Tue Nov 5 12:15:01 2002 From: bmackin at mac.com (Ben Mackin) Date: Thu Nov 3 14:50:21 2005 Subject: Anti-alias my NSImageView In-Reply-To: Message-ID: I am trying to allow anti-aliasing in my NSImageView. By default it seems not to be enabled. Displaying a PDF in my NSImageView using setImage verses opening the same PDF in Preview you can tell the difference. I found some code, but am obviously not using it correctly (as it has no visible effect): myGC = [[NSGraphicsContext alloc] graphicsContextWithWindow:myWindow]; [myGC setShouldAntialias:YES]; Has anyone gotten anti-aliasing to work like this? Thanks, Ben From brian at classicalguitar.net Tue Nov 5 12:29:02 2002 From: brian at classicalguitar.net (Brian Bergstrand) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <43E66260-F0F7-11D6-87FA-003065C9C4EE@netvision.net.il> Message-ID: On Tuesday, November 5, 2002, at 01:46 PM, Eyal Redler wrote: >>> I've noticed that my app was spending huge amounts of time in the >>> NSObject retain release and decided to write my own ref counting >>> (see ERObject below). >>> This trick seems to work OK and I see a *big* gain in speed. But I'm >>> not sure this is "legal" and I never saw this mentioned. >>> 1. What are the disadvantages or dangers involved in what I did? >> >> For one, your implementation is not thread safe. Also, it's unlikely >> that NSObject's retain/release is chewing up so many cycles that your >> users will actually notice the speed improvement. > > Do I need to worry about that if my app is not threaded? Yes, since any of the Frameworks (CF, Foundation, and AppKit) can and will spawn threads behind your back. If those threads reference one of your objects (e.g through a collection) they will retain/ release it and you will be in trouble then. In 10.2 for instance, it seems every AppKit app will eventually get a NSUIHeartBeat thread spawned. You can forgo the use of a lock by using PPC asm to implement atomic inc/dec, but you will still use extra cycles. > As to the speed gain. It's very noticeable to the user since I'm > optimizing an interactive process. The user is typing and he needs to > see the results of the data rearrangement instantly. It could be that > my design is faulty because it requires so many retain/releases but I > found no other way of doing it. > I'd say it's your design. If you are doing that many retain/releases, something is wrong. Brian Bergstrand PGP Key ID: 0xB6C7B6A2 The Shortest Windows Manual: "Turn off the power switch." From bmackin at mac.com Tue Nov 5 12:35:02 2002 From: bmackin at mac.com (Ben Mackin) Date: Thu Nov 3 14:50:21 2005 Subject: Anti-alias my NSImageView In-Reply-To: Message-ID: On 11/5/02 12:14 PM, "Ben Mackin" wrote: > I am trying to allow anti-aliasing in my NSImageView. By default it seems > not to be enabled. Displaying a PDF in my NSImageView using setImage verses > opening the same PDF in Preview you can tell the difference. > > I found some code, but am obviously not using it correctly (as it has no > visible effect): > > myGC = [[NSGraphicsContext alloc] graphicsContextWithWindow:myWindow]; > [myGC setShouldAntialias:YES]; > > Has anyone gotten anti-aliasing to work like this? Please ignore this, I found my error, it should be: myGC = [NSGraphicsContext graphicsContextWithWindow:myWindow]; [myGC setShouldAntialias:YES]; Thanks, Ben From steve at dekorte.com Tue Nov 5 13:27:13 2002 From: steve at dekorte.com (Steve Dekorte) Date: Thu Nov 3 14:50:21 2005 Subject: NSConnection to an IP address Message-ID: The connect methods for NSConnection (such a connectionWithRegisteredName:host:) appear to only accept host names and not IP addresses. For my application some of the DO servers do not have host names findable via DNS. Is there any way to connect using an IP address? Steve From ddavidso at apple.com Tue Nov 5 13:36:01 2002 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:50:21 2005 Subject: NSConnection to an IP address In-Reply-To: Message-ID: On Tuesday, November 5, 2002, at 01:24 PM, Steve Dekorte wrote: > The connect methods for NSConnection (such a > connectionWithRegisteredName:host:) appear to only accept host names > and not IP addresses. For my application some of the DO servers do not > have host names findable via DNS. Is there any way to connect using an > IP address? If you're having trouble with a convenience API, you can go to something more basic, in this case connectionWithReceivePort:sendPort:. You will need to create an NSPort of the appropriate subclass, presumably in this case NSSocketPort. The basic API is initRemoveWithProtocolFamily:socketType:protocol:address:, although initRemoteWithTCPPort:host: should take IPv4 and IPv6 addresses in Jaguar. Douglas Davidson From john at toastedmarshmallow.com Tue Nov 5 13:51:21 2002 From: john at toastedmarshmallow.com (=?ISO-8859-1?Q?John_H=F6rnkvist?=) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <5B6305EE-F0F4-11D6-87FA-003065C9C4EE@netvision.net.il> Message-ID: <104F4FDC-F0FF-11D6-84CE-0030654E84BA@toastedmarshmallow.com> On Tuesday, November 5, 2002, at 08:25 PM, Eyal Redler wrote: >>> 2. Why does NSObject spend so much time doing this simple ++ or --? >> >> Memory was expensive back then... Increasing the size of NSObject >> would be a bit painful due Oops. :) Sorry about the poor editing! > painful due to... binary computability? Yes. The Objective-C version of the fragile base class problem. But also, increasing the size of all objects inheriting from NSObject. Remember that keeping the memory footprint of Mac OS X down is important to Apple. > I wonder why Apple didn't use the opportunity to add this when they > moved the Next code to the Mac... I guess that they measured the overhead for some codes and found it unnecessary. Remember that for objects whose retain count is one you don't need to have an external count at all; the fact that the object exists is enough! It may well be that the vast majority of objects never have a retain count greater than one. Memory footprint is often much more important than other metrics of code quality. >> Rewrite "statically" for recursive data structures and such. > Can you elaborate? I didn't understand... If you have a recursive data structure, then it's likely that for a lot of operations dispatch overhead will dominate. Then it's often better to write that data structure in plain C and just provide an Objective-C interface to it. That's one reason for having class clusters. It allows you to hide an ugly procedural implementation under an object oriented shell. Since no one is supposed to subclass the concrete implementation, you can use lots of tricks without getting stuck with a particular implementation. >> Depending on the branch prediction on the processor and how often you >> dealloc versus just decrease the retain count, you might want to >> reorder the if / else clauses... > > Is it bad to use release instead? I was not sure I can call dealloc > directly. Since super's retain never gets called you might as well call dealloc directly. > Objects are rarely deallocated. It's something like 99.9999% of the > time just a refcount increase or decrease. OK. Regards, John Hornkvist From steve at dekorte.com Tue Nov 5 14:07:01 2002 From: steve at dekorte.com (Steve Dekorte) Date: Thu Nov 3 14:50:21 2005 Subject: NSConnection to an IP address In-Reply-To: Message-ID: On Tuesday, November 5, 2002, at 01:36 PM, Douglas Davidson wrote: > If you're having trouble with a convenience API, you can go to > something more basic, in this case > connectionWithReceivePort:sendPort:. You will need to create an > NSPort of the appropriate subclass, presumably in this case > NSSocketPort. The basic API is > initRemoveWithProtocolFamily:socketType:protocol:address:, although > initRemoteWithTCPPort:host: should take IPv4 and IPv6 addresses in > Jaguar. Thanks for the response. If I do that, am I forced to specify the port? I'd prefer to connect by the registered name on the machine with the specified IP. Steve From ddavidso at apple.com Tue Nov 5 14:15:02 2002 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:50:21 2005 Subject: NSConnection to an IP address In-Reply-To: Message-ID: <1B00A232-F10C-11D6-92AC-000393696394@apple.com> On Tuesday, November 5, 2002, at 02:06 PM, Steve Dekorte wrote: >> If you're having trouble with a convenience API, you can go to >> something more basic, in this case >> connectionWithReceivePort:sendPort:. You will need to create an >> NSPort of the appropriate subclass, presumably in this case >> NSSocketPort. The basic API is >> initRemoveWithProtocolFamily:socketType:protocol:address:, although >> initRemoteWithTCPPort:host: should take IPv4 and IPv6 addresses in >> Jaguar. > > Thanks for the response. If I do that, am I forced to specify the > port? I'd prefer to connect by the registered name on the machine with > the specified IP. For registered names you use an NSPortNameServer, in this case presumably NSSocketPortNameServer. It is implemented in Jaguar, using Rendezvous. See the release notes for more details; in particular, with Rendezvous, registrations are domain-wide rather than specific to a particular machine. You can specify a name for the host argument, or a dotted-quad IPv4 address, or a color-formatted IPv6 address, or nil for localhost, or "*" for any host. Douglas Davidson From eyredler at netvision.net.il Tue Nov 5 15:07:01 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <104F4FDC-F0FF-11D6-84CE-0030654E84BA@toastedmarshmallow.com> Message-ID: <26424A2E-F113-11D6-A8F7-003065C9C4EE@netvision.net.il> >>> Rewrite "statically" for recursive data structures and such. >> Can you elaborate? I didn't understand... > > If you have a recursive data structure, then it's likely that for a > lot of operations dispatch overhead will dominate. Then it's often > better to write that data structure in plain C and just provide an > Objective-C interface to it. > > That's one reason for having class clusters. It allows you to hide an > ugly procedural implementation under an object oriented shell. Since > no one is supposed to subclass the concrete implementation, you can > use lots of tricks without getting stuck with a particular > implementation. Thanks. I'm wasn't familiar with the term "recursive data structure". I guess it's what I'm having (which is basically arrays of arrays of arrays of objects. I already wrote parts of it in C. I may opt for doing even more. Many thanks, Eyal From mark at lilback.com Tue Nov 5 19:10:01 2002 From: mark at lilback.com (Mark J. Lilback) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <104F4FDC-F0FF-11D6-84CE-0030654E84BA@toastedmarshmallow.com> References: <104F4FDC-F0FF-11D6-84CE-0030654E84BA@toastedmarshmallow.com> Message-ID: At 9:42 PM +0100 11/5/2002, John H?rnkvist wrote: >It may well be that the vast majority of objects never have a retain >count greater than one. I would think that many have a retain count of 2... they start at one, increment to two when added to a collection, and then get released back to one. -- __________________________________________________________________________ "They that can give up essential liberty Mark J. Lilback to obtain a little temporary safety deserve neither liberty or safety." http://www.lilback.com/ -- Benjamin Franklin From steve at dekorte.com Tue Nov 5 19:26:01 2002 From: steve at dekorte.com (Steve Dekorte) Date: Thu Nov 3 14:50:21 2005 Subject: NSConnection to an IP address Message-ID: <6FD40789-F137-11D6-9980-000393ACB27C@dekorte.com> On Tuesday, November 5, 2002, at 02:15 PM, Douglas Davidson wrote: > For registered names you use an NSPortNameServer, in this case > presumably NSSocketPortNameServer. It is implemented in Jaguar, using > Rendezvous. See the release notes for more details; in particular, > with Rendezvous, registrations are domain-wide rather than specific to > a particular machine. You can specify a name for the host argument, > or a dotted-quad IPv4 address, or a color-formatted IPv6 address, or > nil for localhost, or "*" for any host. Are you sure NSSocketPortNameServer's portForName:host:nameServerPortNumber: method accepts an IP? That's not mentioned in the NSSocketPortNameServer docs and when I call it with a host ip or nil it returns nil even though I've registered the server and can connect using rootProxyForConnectionWithRegisteredName:host: (at least for the localhost). Steve From luc.regnault at wanadoo.fr Wed Nov 6 01:55:02 2002 From: luc.regnault at wanadoo.fr (Luc Regnault) Date: Thu Nov 3 14:50:21 2005 Subject: Bug in CGGetDisplayTransferByTable ? In-Reply-To: <7B1B38DC-F016-11D6-BF0C-003065CBA36C@wanadoo.fr> Message-ID: Shawn, You are right. Yes, "sampleCount" is 256 after the CGGetDisplayTransferByTable call. So, this function returns a linear ramp, from 0.0 to 1.0 through the 256 values. For the red chanel it is good... but not for green (or blue, same problem). You get the red chanel in the red (normal) but also the green and blue chanels ! Creating the Lut table from only two values with CGSetDisplayTransferByTable for a linear ramp appears to be possible. It is not necessary to input 256 values. But even if you do it, CGGetDisplayTransferByTable doesn't work too. It appears to be a problem of CGGetDisplayTransferByTable in OS 10.2. Luc. Le mardi, 5 nov 2002, ? 02:26 Europe/Paris, Shawn Erickson a ?crit : On Monday, November 4, 2002, at 08:57 AM, Luc Regnault wrote: > -(void)setMagentaScreenLUT > { > CGDisplayErr err; > CGDirectDisplayID dspys[1]; > CGDisplayCount dspyCnt; > float red[256]; > float green[256]; > float blue[256]; > int sampleCount; > > red[0] = 0.0; red[1] = 1.0; > green[0] = 0.0; green[1] = 0.5; // a green different than the red !!! > (half the red) > blue[0] = 0.0; blue[1] = 1.0; > > err = CGGetDisplaysWithPoint( CGPointMake( 1, 1), 1, dspys, &dspyCnt); > if( err == CGDisplayNoErr) { > err = CGSetDisplayTransferByTable( dspys[0], 2, red, green, blue); > // now the screen is very magenta... > } > > if( err == CGDisplayNoErr) { > err = CGGetDisplayTransferByTable( dspys[0], 256, > red, green, blue, &sampleCount); > if( err == CGDisplayNoErr) { > if( red[255] == green[255]) { > // oh !!! sampleCount is 256... > // the green is normally very different than the red !!! > NSBeep(); > } > } > } > What is the value returned in sampleCount? Is it 256? If not that is your problem. As I understand it you should be using the value return in sampleCount to understand how many samples actually got copied into your sample buffers. -Shawn -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 3553 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021106/ea598d59/attachment.bin From ijeyd at mac.com Wed Nov 6 10:31:32 2002 From: ijeyd at mac.com (Morgan Redman) Date: Thu Nov 3 14:50:21 2005 Subject: Debugging Multiple Bundles In-Reply-To: <4B7067B4-F0DB-11D6-B79F-000502319F17@dobbie.net> Message-ID: My build style is set to development. The source file is one that I have written that is actually in the same directory as all my other source files ( the project directory ). I build the bundle and the application from the same project using different targets. -Morgan On Tuesday, November 5, 2002, at 08:26 AM, Finlay Dobbie wrote: > > On Tuesday, November 5, 2002, at 01:07 am, Morgan Redman wrote: > >> Ok, I tried moving one of my bundles to a separate project, but I am >> still getting the same results. If I put a break in the bundle, when >> I try to debug from the applications project window it still says no >> source file found.... I must be doing somthing wrong, but I cant >> even begin to guess what. > > Perhaps you're using a build with some symbols stripped. Make sure > your build style is set to "development". > > You don't say what the source file is, but if it's one that you don't > actually have, you could have inadvertently set a breakpoint in a > header of a compiled framework (I did this in NSException.h once, > mystified me for a while :-)). > > -- Finlay > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From tritchey at mac.com Wed Nov 6 11:25:01 2002 From: tritchey at mac.com (Timothy Ritchey) Date: Thu Nov 3 14:50:21 2005 Subject: [ANN] Fraction Formatter source code Message-ID: <536B513E-F1BD-11D6-9F65-003065D60376@mac.com> For anyone interested, I have placed my Fraction Formatter code on my homepage at: http://homepage.mac.com/tritchey under the file RRFractionFormatter.dmg This class is an NSFormatter that supports the display of fractional numbers. It includes a new NSNumber class RRFractionNumber that supports conversion between decimal, fractions and string representations. Using this formatter, you can enter "1 3/4" or "1.75" in a text field and get the same fraction displayed. The disk image includes a very small screenshot showing how the numbers look (the fractional part of the number uses a smaller font, with the numbers offset and over one another). I am using for a woodworking application to general cutlists and part layouts, but it might also be useful for stock tickers, etc. Cheers, tim From ijeyd at mac.com Wed Nov 6 12:55:00 2002 From: ijeyd at mac.com (Morgan Redman) Date: Thu Nov 3 14:50:21 2005 Subject: Using Multiple Bundles ( was Debugging Multiple Bundles ) In-Reply-To: Message-ID: I now have a very interesting problem with my bundles. I found it very strange that I could not get the debugger to stop in bundles ( it complains that it does not have a source file when I set a breakpoint in a file contained in the bundle ). What I found most strange was that I was sure I could remember the debugger stopping in one of my other bundles that I has already coded. I did some testing and found that yes indeed, the debugger would stop in my older bundle, but not the one that I was currently trying to debug. This led me to go through each option in the target settings and make sure everything was configured the same. It was. I decided to start from scratch and copy all of my files over to a new project and create all my targets over again, just incase I was missing something that I had misconfigured. I ended up discovering something important. At the beginning of my program I read an xml file of the all the bundles in my application and the class names inside the bundles to instantiate. What I discovered is that only the first bundle loaded can be debugged! If I change the order around in my xml file, whatever bundle is listed first ( and thus loaded first ) can be debugged. Everything loaded after cannot be debugged. What could cause this to happen? -Morgan On Wednesday, November 6, 2002, at 10:30 AM, Morgan Redman wrote: > My build style is set to development. The source file is one that I > have written that is actually in the same directory as all my other > source files ( the project directory ). I build the bundle and the > application from the same project using different targets. > > -Morgan > > On Tuesday, November 5, 2002, at 08:26 AM, Finlay Dobbie wrote: > >> >> On Tuesday, November 5, 2002, at 01:07 am, Morgan Redman wrote: >> >>> Ok, I tried moving one of my bundles to a separate project, but I am >>> still getting the same results. If I put a break in the bundle, >>> when I try to debug from the applications project window it still >>> says no source file found.... I must be doing somthing wrong, but I >>> cant even begin to guess what. >> >> Perhaps you're using a build with some symbols stripped. Make sure >> your build style is set to "development". >> >> You don't say what the source file is, but if it's one that you don't >> actually have, you could have inadvertently set a breakpoint in a >> header of a compiled framework (I did this in NSException.h once, >> mystified me for a while :-)). >> >> -- Finlay >> >> _______________________________________________ >> 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 rixstep000 at yahoo.co.uk Wed Nov 6 13:01:04 2002 From: rixstep000 at yahoo.co.uk (=?iso-8859-1?q?Domain=20Administrators?=) Date: Thu Nov 3 14:50:21 2005 Subject: Bug in CGGetDisplayTransferByTable ? Message-ID: <20021106205449.52497.qmail@web10903.mail.yahoo.com> Please stop putting your formatted e-mail in this mailing list. Rixster __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com From rixstep000 at yahoo.co.uk Wed Nov 6 13:16:01 2002 From: rixstep000 at yahoo.co.uk (=?iso-8859-1?q?Domain=20Administrators?=) Date: Thu Nov 3 14:50:21 2005 Subject: Dragging et al. Message-ID: <20021106211532.41787.qmail@web10901.mail.yahoo.com> Hi, OK, time for my next dumb question. I've got an app that accepts drag/drop. It works fine. The only thing is, its icon in the dock will not accept a drop. I've done everything dumb no doubt - I've gone through the code for TextEdit, trying to find what it is that makes TE accept drops in the dock, but I've found nothing. It's a Cocoa application (not document-based). I just wondered if anyone had a clue. Much obliged. And OK, I might as well ask another dumb question (well...). When it comes to drag/drop, the data I get off the pasteboard is either in object format or XML format - and all I want is a full file name path. What I have seen, there is only the one "type" that works. If I ask for "data", I get the object description; if I ask for a string, I get what appears to be the same thing, but in text format as an XML "file". Within this "file", after the Apple copyright etc., there are "array" and "string" tags, so it's possible to parse for the path in between the "string" tags, but this is like dragging the horse to move the cart. On another tack, I've seen (heard) something weird with my PowerBook. When I have iTunes loaded (but paused), and when I put the machine to sleep, I get local radio on the loudspeakers! I don't have an AirPort card. Just wondering if anyone else has experienced this. Great list - I enjoy it very much. Rixster __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com From finlay at dobbie.net Wed Nov 6 13:24:01 2002 From: finlay at dobbie.net (Finlay Dobbie) Date: Thu Nov 3 14:50:21 2005 Subject: Dragging et al. In-Reply-To: <20021106211532.41787.qmail@web10901.mail.yahoo.com> Message-ID: <018BBC2F-F1CE-11D6-A3C3-000502319F17@dobbie.net> On Wednesday, November 6, 2002, at 09:15 pm, Domain Administrators wrote: > I've got an app that accepts drag/drop. It works fine. The only > thing is, its icon in the dock will not accept a drop. You need to set up the file types in your Info.plist (via the Targets tab in PB). -- Finlay From weesh at mindspring.com Wed Nov 6 13:33:01 2002 From: weesh at mindspring.com (Ken Wieschhoff) Date: Thu Nov 3 14:50:21 2005 Subject: NSLocalizedString "reverse" lookup Message-ID: I have a CFDictionary I'm using to populate some menus. When I localize, I'm using NSLocalizedString to place the localized string into a popup. I'd like to use the localized string to find the original string, is there a way to do this? ->Ken -- - -- Ken Wieschhoff (770)813-0231 *************************** From ddavidso at apple.com Wed Nov 6 13:45:00 2002 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:50:21 2005 Subject: NSLocalizedString "reverse" lookup In-Reply-To: Message-ID: <29E06188-F1D1-11D6-A103-000393696394@apple.com> On Wednesday, November 6, 2002, at 01:31 PM, Ken Wieschhoff wrote: > I have a CFDictionary I'm using to populate some menus. When I > localize, I'm using NSLocalizedString to place the localized string > into a popup. > > I'd like to use the localized string to find the original string, is > there a way to do this? Yes, possibly, but it isn't easy, or even necessarily determinate. Instead, I would recommend setting the original string as the representedObject of the relevant NSMenuItem, or in some other way associating the original string with the UI element involved. Douglas Davidson From clarkcox3 at mac.com Wed Nov 6 14:07:01 2002 From: clarkcox3 at mac.com (Clark S. Cox III) Date: Thu Nov 3 14:50:21 2005 Subject: NSLocalizedString "reverse" lookup In-Reply-To: Message-ID: <71B826EC-F1D3-11D6-8E49-0050E4EE1966@mac.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday, Nov 6, 2002, at 16:31 US/Eastern, Ken Wieschhoff wrote: > > I have a CFDictionary I'm using to populate some menus. When I > localize, I'm using NSLocalizedString to place the localized string > into a popup. > > I'd like to use the localized string to find the original string, is > there a way to do this? That suggests to me, that there is something wrong with your design. You shouldn't be relying on the text of menu items, instead, use something else to identify them (representedObject, tag, action, whatever). That being said, the easiest way would be to keep track of the mapping yourself. You could probably load your *.strings files into dictionaries, and then build another dictionary by reversing the keys and values, but that seems like more effort than necessary. - -- http://homepage.mac.com/clarkcox3/ clarkcox3@mac.com Clark S. Cox, III -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (Darwin) iEYEARECAAYFAj3JkXsACgkQd6STocYT1xXWcwCdHQ3M46s7Hun9MMiTWsR+8l+h UOoAnA99QgSsPGzkZeYtWnl1WhEUtgnl =aD9o -----END PGP SIGNATURE----- From marcel at metaobject.com Wed Nov 6 15:50:00 2002 From: marcel at metaobject.com (Marcel Weiher) Date: Thu Nov 3 14:50:21 2005 Subject: Optimizing retain and release In-Reply-To: <104F4FDC-F0FF-11D6-84CE-0030654E84BA@toastedmarshmallow.com> Message-ID: <55177BD8-F1E2-11D6-9876-00039366F3C0@metaobject.com> On Tuesday, November 5, 2002, at 09:42 Uhr, John H?rnkvist wrote: > On Tuesday, November 5, 2002, at 08:25 PM, Eyal Redler wrote: >>>> 2. Why does NSObject spend so much time doing this simple ++ or --? >>> >>> Memory was expensive back then... Increasing the size of NSObject >>> would be a bit painful due > > Oops. :) Sorry about the poor editing! > >> painful due to... binary computability? > > Yes. The Objective-C version of the fragile base class problem. Not really, since NSObject was a new hierarchy anyway. But they had to support retain/release for Object subclasses, so an external retain count mechanism was needed anyhow. > But also, increasing the size of all objects inheriting from NSObject. > > Remember that keeping the memory footprint of Mac OS X down is > important to Apple. Yes, but the reason is a bit more involved than that, because NSObject's mechanism will actually typically use more memory than keeping the refcount inline. No, as far as I can tell, virtually all NS classes do have an internal retain count. However, this is almost invariable less than a full word, tucked away next to some other count or flag bits or whatever. You can't promote this up to the super-class because that would prevent packing the retain-count in a word with other stuff that's specific to the subclass. So: it is generally a good idea to have an internal retain count for custom subclasses. MPWObject (part of MPWFoundation) provides an optimized and thread-safe internal retain-count implementation. It also provides C functions for retaining/releasing MPWObjects. It also provides for bulk retain/release. Finally there is an MPWObjectCache, which provides a ring-buffer instance-cache in order to avoid allocation overhead for temporay objects. >> I wonder why Apple didn't use the opportunity to add this when they >> moved the Next code to the Mac... > > I guess that they measured the overhead for some codes and found it > unnecessary. I think the reason was the "tucking away" of the retain-count that I mentioned above. Virtually all NS classes have them! > Remember that for objects whose retain count is one you don't need to > have an external count at all; the fact that the object exists is > enough! The problem is that the retain-count will almost invariable grow beyond 1, as soon as the object is stored in some instance varible or collection. > It may well be that the vast majority of objects never have a retain > count greater than one. I think this is not the case. > Memory footprint is often much more important than other metrics of > code quality. Yes, which is why the "hidden" internal retain-counts are probably worth the effort. Then again, if malloc() really allocates on such large boundaries.... >>> Rewrite "statically" for recursive data structures and such. >> Can you elaborate? I didn't understand... > > If you have a recursive data structure, then it's likely that for a > lot of operations dispatch overhead will dominate. Then it's often > better to write that data structure in plain C and just provide an > Objective-C interface to it. Or at least actually use an object/data-structure rather than modelling the data-structure with collections. Marcel -- Marcel Weiher Metaobject Software Technologies marcel@metaobject.com www.metaobject.com Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc. From bmackin at mac.com Wed Nov 6 16:17:01 2002 From: bmackin at mac.com (Ben Mackin) Date: Thu Nov 3 14:50:21 2005 Subject: NSImage and alpha channels In-Reply-To: <55177BD8-F1E2-11D6-9876-00039366F3C0@metaobject.com> Message-ID: What I want to do is save a tiff with no alpha channel. Currently I am doing the following to save my tiff file: NSImage *theImage; NSPDFImageRep *myPDF; [myPDF setCurrentPage:0]; theImage = [[NSImage alloc] init]; [theImage addRepresentation:myPDF]; data = [theImage TIFFRepresentation]; [theImage release]; [data writeToFile:@"/myNewTIFF.tif" atomically:YES]; But it automatically tacks on that alpha channel. I saw setAlpha in NSImageRep, but that sounds like it doesn't actually do what I want. The description says "Informs the receiver whether the image has an alpha component". Thanks for any help or nudges in the right direction, Ben From jonj at realsoftware.com Wed Nov 6 16:27:00 2002 From: jonj at realsoftware.com (Jon Johnson) Date: Thu Nov 3 14:50:21 2005 Subject: NSSplitView: moving a splitter? Message-ID: <7A40859B-F1E7-11D6-AA1B-000393677A36@realsoftware.com> I've been troubling myself with this for some time, and I did search the archives seeing incomplete results. Is it possible to move a splitter via code? I have tried resizing the subview but it just makes things draw incorrectly. The splitter fails to move when I do this. Anyone successfully done this? Thanks in advance, Jon From aglee at earthlink.net Wed Nov 6 16:52:01 2002 From: aglee at earthlink.net (Andy Lee) Date: Thu Nov 3 14:50:21 2005 Subject: NSSplitView: moving a splitter? In-Reply-To: <7A40859B-F1E7-11D6-AA1B-000393677A36@realsoftware.com> References: <7A40859B-F1E7-11D6-AA1B-000393677A36@realsoftware.com> Message-ID: At 6:25 PM -0600 11/6/02, Jon Johnson wrote: >I've been troubling myself with this for some time, and I did search >the archives seeing incomplete results. See . A bit of meta-advice: searching mamasam is more fruitful than searching official list archives. --Andy From jonj at realsoftware.com Wed Nov 6 18:09:00 2002 From: jonj at realsoftware.com (Jon Johnson) Date: Thu Nov 3 14:50:21 2005 Subject: NSSplitView: moving a splitter? In-Reply-To: Message-ID: On Wednesday, November 6, 2002, at 06:51 PM, Andy Lee wrote: > At 6:25 PM -0600 11/6/02, Jon Johnson wrote: >> I've been troubling myself with this for some time, and I did search >> the archives seeing incomplete results. > > See . > > A bit of meta-advice: searching mamasam is more fruitful than > searching official list archives. > Thanks.. that works.. almost here's my code: NSRect frame1 = [searchView frame]; NSRect frame2 = [[imageView superview] frame]; frame1.size.height+=[SearchView height]*2; frame2.size.height-=[SearchView height]*2; [searchView setFrame:frame1]; [[imageView superview] setFrame:frame2]; [splitView adjustSubviews]; [splitView setNeedsDisplay:YES]; However, as the splitter goes towards the bottom, it gradually increments less and less. Is there a more accurate way of doing this? Thanks again for both tips, Jon From jamiec at mac.com Wed Nov 6 23:52:00 2002 From: jamiec at mac.com (Jamie Cho) Date: Thu Nov 3 14:50:21 2005 Subject: Transparency in PDFs/10.2 Message-ID: I am writing an application that may create transparent objects that will be printed out. How does one generate PDFs that support transparency in 10.2? OmniGraffle 2.1 supports this functionality, but I can not find the corresponding documentation for its support in the 10.2 CoreGraphics notes. I also noticed that the PDFs generated claim to be version 1.3 even with transparency - shouldn't it be 1.4? This is unrelated, but what API is used to turn on quartz text rendering in Carbon applications? From weesh at mindspring.com Thu Nov 7 06:11:01 2002 From: weesh at mindspring.com (Ken Wieschhoff) Date: Thu Nov 3 14:50:21 2005 Subject: Localization problem Message-ID: Pulling my hair out here..... In my Localization.strings in my English.lproj folder I have a single string: "Default" = "Default test"; When I call NSLog(@"Testing entry %@ as %@", @"Default", NSLocalizedString(@"Default",@"")); I get: "2002-11-07 09:04:30.560 MyApp[4372] Testing entry Default as Default" *Not* 'Default Test' as I expected. I only have English installed on my system to save space, WTF won't this translation work? Thanks, ->Ken -- - -- Ken Wieschhoff (770)813-0231 *************************** From alexis.belhomme at free.fr Thu Nov 7 06:35:02 2002 From: alexis.belhomme at free.fr (Alexis Belhomme) Date: Thu Nov 3 14:50:21 2005 Subject: Localization problem In-Reply-To: Message-ID: <0B66A579-F25E-11D6-97ED-0003934656F6@free.fr> On Thursday, Nov 7, 2002, at 15:10 Europe/Paris, Ken Wieschhoff wrote: > Pulling my hair out here..... > > > In my Localization.strings in my English.lproj folder I have a single > string: Actually, it's "Localizable.strings", but maybe you made a typo. When NSLocalizedString do not find the localized entry, it uses the key you provided instead. I use uppercase keys to quickly track these localization problems (aka "DEFAULT" = "Default test"). > > "Default" = "Default test"; > > When I call > > NSLog(@"Testing entry %@ as %@", @"Default", > NSLocalizedString(@"Default",@"")); > > > I get: > > "2002-11-07 09:04:30.560 MyApp[4372] Testing entry Default as Default" > > > *Not* 'Default Test' as I expected. > > I only have English installed on my system to save space, WTF won't > this translation work? > > Thanks, > > ->Ken > > > > -- > - -- > Ken Wieschhoff > (770)813-0231 > *************************** > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > > -- Alexis Belhomme - alexis.belhomme@free.fr "Deux choses sont infinies : l'univers et la betise humaine, en ce qui concerne l'univers, je n'ai pas acquis la certitude absolue." -- Albert Einstein From ssudre at intego.com Thu Nov 7 06:42:03 2002 From: ssudre at intego.com (=?ISO-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:50:21 2005 Subject: Localization problem In-Reply-To: Message-ID: On jeudi, nov 7, 2002, at 15:10 Europe/Paris, Ken Wieschhoff wrote: > Pulling my hair out here..... > > > In my Localization.strings in my English.lproj folder I have a single > string: > > "Default" = "Default test"; > > When I call > > NSLog(@"Testing entry %@ as %@", @"Default", > NSLocalizedString(@"Default",@"")); > > > I get: > > "2002-11-07 09:04:30.560 MyApp[4372] Testing entry Default as Default" > > > *Not* 'Default Test' as I expected. > > I only have English installed on my system to save space, WTF won't > this translation work? Additionaly to the "Localization.strings" wrong name as stated by Alexis, maybe one ';' is missing in your .strings file. From max at seelemann.de Thu Nov 7 06:49:01 2002 From: max at seelemann.de (Max Seelemann) Date: Thu Nov 3 14:50:21 2005 Subject: NSSplitView: moving a splitter? In-Reply-To: Message-ID: <0148AB86-F260-11D6-9842-000A27B143C8@seelemann.de> > However, as the splitter goes towards the bottom, it gradually > increments less and less. Is there a more accurate way of doing this? I had exactly this problem. And I didn't stop to argue (for days)... Then I found the solution. You need to replace frame1.size.height+=[SearchView height]*2; frame2.size.height-=[SearchView height]*2; with frame1.size.height = [SearchView height]*2 - [SearchView dividerThickness]; frame2.size.height = [SearchView height]*2 - [SearchView dividerThickness]; this was the solution ;) cheers MAX From mswanson at bogwill.com Thu Nov 7 09:18:01 2002 From: mswanson at bogwill.com (Michael Swanson) Date: Thu Nov 3 14:50:21 2005 Subject: Clear Recent Items Message-ID: Hi, Does anyone know the call (or even apple script) to Clear the "Recent Items" menu for Finder? The menu I'm talking about is under the Apple Menu -> Recent Items -> Clear Menu. Thanks for any help, Michael Swanson From dustin+macosx-dev at spy.net Thu Nov 7 09:28:17 2002 From: dustin+macosx-dev at spy.net (Dustin Sallings) Date: Thu Nov 3 14:50:21 2005 Subject: Localization problem In-Reply-To: <0B66A579-F25E-11D6-97ED-0003934656F6@free.fr> Message-ID: Around 15:34 on Nov 7, 2002, Alexis Belhomme said: # Actually, it's "Localizable.strings", but maybe you made a typo. When # NSLocalizedString do not find the localized entry, it uses the key you # provided instead. I use uppercase keys to quickly track these # localization problems (aka "DEFAULT" = "Default test"). I had an additional problem with this at one point where the filename was correct, all of the strings and calls were correct, but they were still not showing up in the application. I'd somehow confused PB in such a way that it wasn't including the strings in the build. (Actually, I think I've done that again since, but I understand it better now). Go into targets, select the target for your app, then go to Bundle Resources under Build Phases. Make sure your Localizable.strings file is in there. If it's not, drag it in from files and rebuild. -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From aglee at earthlink.net Thu Nov 7 12:01:56 2002 From: aglee at earthlink.net (Andy Lee) Date: Thu Nov 3 14:50:21 2005 Subject: NSSplitView: moving a splitter? In-Reply-To: References: Message-ID: At 8:08 PM -0600 11/6/02, Jon Johnson wrote: >here's my code: > > > NSRect frame1 = [searchView frame]; > NSRect frame2 = [[imageView superview] frame]; > frame1.size.height+=[SearchView height]*2; > frame2.size.height-=[SearchView height]*2; > [searchView setFrame:frame1]; > [[imageView superview] setFrame:frame2]; > [splitView adjustSubviews]; > [splitView setNeedsDisplay:YES]; > >However, as the splitter goes towards the bottom, it gradually >increments less and less. Is there a more accurate way of doing this? I haven't fiddled with splitviews in a while, but I suspect there's some roundoff error. I've had problems at times when I grab the window's resize corner and move it around and around, one of the subviews would gradually shrink. I don't remember if/how I resolved the issue with splitviews. You might try rounding coordinates before doing arithmetic with them, something like: int delta = (int)([SearchView height]*2); frame1.size.height+=delta; frame2.size.height-=delta; This is just a guess though. --Andy From bwebster at mac.com Thu Nov 7 12:39:23 2002 From: bwebster at mac.com (Brian Webster) Date: Thu Nov 3 14:50:21 2005 Subject: v In-Reply-To: <200211072001.gA7K1ef28329@slowbro.omnigroup.com> Message-ID: On Thursday, November 7, 2002, at 02:01 PM, macosx-dev-request@omnigroup.com wrote: > Hi, > > Does anyone know the call (or even apple script) to Clear the "Recent > Items" menu for Finder? The menu I'm talking about is under the Apple > Menu -> Recent Items -> Clear Menu. [[NSDocumentController sharedDocumentController] clearRecentDocuments:nil]; -- Brian Webster bwebster@mac.com http://homepage.mac.com/bwebster From mswanson at bogwill.com Thu Nov 7 12:44:07 2002 From: mswanson at bogwill.com (Michael Swanson) Date: Thu Nov 3 14:50:21 2005 Subject: v In-Reply-To: Message-ID: <5A4E6724-F291-11D6-80E7-0003936A8134@bogwill.com> Brian, Thanks for the reply, but I've already tried that and it doesn't work. That will clear a NSDocument based application's RecentDocuments menu. Doesn't touch finder's Recent Items menu. Thanks though, Michael On Thursday, November 7, 2002, at 02:38 PM, Brian Webster wrote: > On Thursday, November 7, 2002, at 02:01 PM, > macosx-dev-request@omnigroup.com wrote: > >> Hi, >> >> Does anyone know the call (or even apple script) to Clear the "Recent >> Items" menu for Finder? The menu I'm talking about is under the Apple >> Menu -> Recent Items -> Clear Menu. > > [[NSDocumentController sharedDocumentController] > clearRecentDocuments:nil]; > > -- > Brian Webster > bwebster@mac.com > http://homepage.mac.com/bwebster > > From max at seelemann.de Thu Nov 7 13:08:01 2002 From: max at seelemann.de (Max Seelemann) Date: Thu Nov 3 14:50:21 2005 Subject: NSSplitView: moving a splitter? In-Reply-To: Message-ID: > I haven't fiddled with splitviews in a while, but I suspect there's > some roundoff error. I've had problems at times when I grab the > window's resize corner and move it around and around, one of the > subviews would gradually shrink. I don't remember if/how I resolved > the issue with splitviews. > > You might try rounding coordinates before doing arithmetic with them, > something like: > > int delta = (int)([SearchView height]*2); > frame1.size.height+=delta; > frame2.size.height-=delta; > > This is just a guess though. nope! This is the same at the end... because size.height ist a float, too... The problem is, that the divider isn't inside the calculation (look at my mail, yesterday or so) cheers MAX From fahrenba at mac.com Thu Nov 7 15:26:01 2002 From: fahrenba at mac.com (fahrenba@mac.com) Date: Thu Nov 3 14:50:21 2005 Subject: Launching another GUI app as root Message-ID: <28AF0750-F2A8-11D6-87FE-00039340986C@mac.com> I have a GUI app that needs to run as a system user every time it is launched. What I was doing was writing a wrapper app around it which would do a little hacky piping of the password into a sudo prompt which would launch the app as root. But I know that a security update disabled doing that. So my question is, is there a way to use the Security Framework to launch another application as root? I would need to have the password hardcoded so that it doesn't prompt for the password too. The setuid bit won't do it for me only because I need to be able to move the application around, from server to server and such. Main motivation is mainly to be able to use NSFileManager's file creation methods like createFileAtPath:contents:attributes: Thanks, Matt Fahrenbacher From john at positivespinmedia.com Thu Nov 7 15:44:02 2002 From: john at positivespinmedia.com (John Pannell) Date: Thu Nov 3 14:50:21 2005 Subject: [ANN] BombSquad 1.0 Message-ID: Hi all- I've gotten a lot out of these lists over the past couple years. In the spirit of giving something back, I offer BombSquad - a minesweeper knock-off for Mac OS X. It is shareware, but I'd like all list participants to "feel free to use it free". Please check the "I've paid" box on the nag screen with a clear conscience if you'd like to download it and play. http://www.positivespinmedia.com/shareware/BombSquad/ Of course, if anyone has any suggestions for improvement, I'm all ears. I hope it provides a fun break from all the coding, if you need one. Thanks for all the help and good info over the years! John P. PS - I'm sorry my site looks so "shabby" in OmniWeb, if that's your browser... I'm working on becoming a CSS stud. From samani_sanjay at yahoo.co.uk Thu Nov 7 16:43:01 2002 From: samani_sanjay at yahoo.co.uk (Sanjay Samani) Date: Thu Nov 3 14:50:21 2005 Subject: NSOutlineView shouldCollapseItem delegate Message-ID: When I click on the disclosure triangle in my NSOutlineView, it expands fine, but is not collapsing. I have implemented the following two delegate methods. The first I can see is being called through debug, so I'm confident I've got the delegate set correctly. The second one is never getting called. I have both methods in the header file, even though I know this shouldn't be necessary. // Outline view Delegate methods - (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item { return NO; } - (BOOL)outlineView:(NSOutlineView *)outlineView shouldCollapseItem:(id)item { return YES; } I am running Jaguar and associated developer tools, but I know that I was getting the same problem with 10.1 and the Dec 2001 dev tools. I presume I'm doing something dumb. Any ideas? Thanks, Sanjay -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1286 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021107/c80ffe7a/attachment.bin From steve at dekorte.com Thu Nov 7 16:59:01 2002 From: steve at dekorte.com (Steve Dekorte) Date: Thu Nov 3 14:50:21 2005 Subject: Resource forks Message-ID: <25B05A1E-F2B5-11D6-B259-000393ACB27C@dekorte.com> Can anyone point me to sample code for getting and setting resource fork info? Thanks, Steve OSX freeware and shareware: http://www.dekorte.com/downloads.html From jacobo at on.aibn.com Thu Nov 7 17:08:01 2002 From: jacobo at on.aibn.com (jacobo@on.aibn.com) Date: Thu Nov 3 14:50:21 2005 Subject: .dmg displaying license agreement when mounted Message-ID: <3DCB0E3D.2030707@on.aibn.com> Hi, Does anyone know where I can find information about how to create a .dmg file that when mounted displays a license agreement?. I have been checking the old Apple's scripts for diskcopy but none of them seem to work with the latest diskcopy version in Jaguar. thank you in advance for your help Jacobo From dunham at mac.com Thu Nov 7 18:10:01 2002 From: dunham at mac.com (David Dunham) Date: Thu Nov 3 14:50:21 2005 Subject: .dmg displaying license agreement when mounted In-Reply-To: <3DCB0E3D.2030707@on.aibn.com> Message-ID: <1C9BEC6E-F2BF-11D6-BB4F-000393AC9690@mac.com> On Thursday, Nov 7, 2002, at 17:07 US/Pacific, jacobo@on.aibn.com wrote: > Does anyone know where I can find information about how to create a > .dmg > file that when mounted displays a license agreement?. I have been > checking the old Apple's scripts for diskcopy but none of them seem > to work with the latest diskcopy version in Jaguar. I've been using DMG Maker. I'm pretty sure DropDMG will do this too. And almost certainly the new product from eSellerate/Mindvision will handle this. David Dunham Macintosh Game Developer GameHouse, Inc. david@gamehouse.com 206 442 5881 x22 http://www.gamehouse.com From dreamless at attbi.com Thu Nov 7 19:57:00 2002 From: dreamless at attbi.com (Nick Zitzmann) Date: Thu Nov 3 14:50:21 2005 Subject: Launching another GUI app as root In-Reply-To: <28AF0750-F2A8-11D6-87FE-00039340986C@mac.com> Message-ID: <00AD2A9F-F2CE-11D6-9C00-0050E410B21A@attbi.com> On Thursday, November 7, 2002, at 03:25 PM, fahrenba@mac.com wrote: > I have a GUI app that needs to run as a system user every time it is > launched. What I was doing was writing a wrapper app around it which > would do a little hacky piping of the password into a sudo prompt > which would launch the app as root. But I know that a security update > disabled doing that. So my question is, is there a way to use the > Security Framework to launch another application as root? The answer is yes. If this application you want to launch is in Mach-O format, then you'd just have the security framework launch /Path/To/Your/Application.app/Contents/MacOS/Application. If this application is in CFM format, then you'll have to make your program run the "open" command and pass the path to the application as an argument. Nick Zitzmann AIM/iChat: dragonsdontsleep Check out my software page: http://dreamless.home.attbi.com/ "La la la! I sing, too! For food, for food! La la la!" - Gabo, Dragon Warrior VII From jmdisher at student.math.uwaterloo.ca Thu Nov 7 20:36:02 2002 From: jmdisher at student.math.uwaterloo.ca (Jeff Disher) Date: Thu Nov 3 14:50:21 2005 Subject: Launching another GUI app as root In-Reply-To: <00AD2A9F-F2CE-11D6-9C00-0050E410B21A@attbi.com> Message-ID: <9CA8C0FA-F2D3-11D6-9700-000393B6A966@student.math.uwaterloo.ca> Actually, the "open" program seems to always run as the use who owns the loginwindow process. The hint given for Mach-O bundles is correct but you can't use open to launch as root. You can use LaunchCFMApp (/System/Library/Frameworks/Carbon.framework/Versions/Current/Support/ LaunchCFMApp) but for some reason you can't execute this directly with the Security framework or it will also launch processes as the user that owns loginwindow. The only way I know of to launch a CFM app as root is by invoking LaunchCFMApp with sudo (it is beyond me why this works with sudo and not with the security framework) and then feeding the password to the sudo process manually. It is for this reason, that my "Skeleton Key" program hasn't been able to launch Carbon apps since the security update last october. I am hoping that I am overlooking something that would make this easier. If anyone has a better way to launch Carbon apps as root, can you post that since I am also very interested in that. Thanks, Jeff. On Thursday, November 7, 2002, at 10:56 PM, Nick Zitzmann wrote: > > On Thursday, November 7, 2002, at 03:25 PM, fahrenba@mac.com wrote: > >> I have a GUI app that needs to run as a system user every time it is >> launched. What I was doing was writing a wrapper app around it which >> would do a little hacky piping of the password into a sudo prompt >> which would launch the app as root. But I know that a security >> update disabled doing that. So my question is, is there a way to use >> the Security Framework to launch another application as root? > > The answer is yes. If this application you want to launch is in Mach-O > format, then you'd just have the security framework launch > /Path/To/Your/Application.app/Contents/MacOS/Application. > > If this application is in CFM format, then you'll have to make your > program run the "open" command and pass the path to the application as > an argument. > > Nick Zitzmann > AIM/iChat: dragonsdontsleep > Check out my software page: http://dreamless.home.attbi.com/ > > "La la la! I sing, too! For food, for food! La la la!" - Gabo, Dragon > Warrior VII > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > > Jeff Disher President and Lead Developer of Spectral Class Spectral Class: Shedding Light on Innovation http://www.spectralclass.com/ From andrew at rwts.com.au Thu Nov 7 21:53:01 2002 From: andrew at rwts.com.au (Andrew Yager) Date: Thu Nov 3 14:50:21 2005 Subject: GCC not doing the correct thing? Message-ID: Hi, The following code snippet does not appear to function correctly. #include #define cube(x) x*x*x int main() { int x=1; int y=2; int z=3; int* ptr = &z; printf("%d\n", *ptr); printf("%d\n", ptr); printf("%d\n", cube(*ptr++)); printf("%d\n", *ptr); printf("%d\n", ptr); } -- The preprocess code outputted from cpp is: # 2 "test.c" 2 3 int main() { int x=1; int y=2; int z=3; int* ptr = &z; printf("%d\n", *ptr); printf("%d\n", ptr); printf("%d\n", *ptr++**ptr++**ptr++); printf("%d\n", *ptr); printf("%d\n", ptr); } However when compiled with ?Apple Computer, Inc. GCC version 1151, based on gcc version 3.1 20020420 (prerelease),? the following is the output: 3 -1073742488 27 -1073742484 -1073742484 You can see on examination that this should not work... At least if it does work, it shouldn?t work in this way...!!!! Sorry for the uninformative error report... Someone with more skill at these should perhaps do it... Yours, Andrew ___________________ Andrew Yager Real World Technology Solutions Real People, Real SolUtions (tm) ph: (02) 9945 2567 fax: (02) 9945 2566 mob: 0405 15 2568 http://www.rwts.com.au/ _________________________ From fahrenba at mac.com Thu Nov 7 22:29:01 2002 From: fahrenba at mac.com (Matthew Fahrenbacher) Date: Thu Nov 3 14:50:21 2005 Subject: GCC not doing the correct thing? Message-ID: <8303084.1036736929907.JavaMail.fahrenba@mac.com> On Thursday, Nov 07, 2002, at 09:50PM, Andrew Yager wrote: >Hi, > >The following code snippet does not appear to function correctly. > >#include >#define cube(x) x*x*x > >int main() >{ >int x=1; >int y=2; >int z=3; >int* ptr = &z; > >printf("%d\n", *ptr); >printf("%d\n", ptr); >printf("%d\n", cube(*ptr++)); >printf("%d\n", *ptr); >printf("%d\n", ptr); > > >} > >-- > >The preprocess code outputted from cpp is: > ># 2 "test.c" 2 3 > > >int main() >{ >int x=1; >int y=2; >int z=3; >int* ptr = &z; > >printf("%d\n", *ptr); >printf("%d\n", ptr); >printf("%d\n", *ptr++**ptr++**ptr++); >printf("%d\n", *ptr); >printf("%d\n", ptr); > > >} > >However when compiled with 3Apple Computer, Inc. GCC version 1151, based on >gcc version 3.1 20020420 (prerelease),2 the following is the output: > >3 >-1073742488 >27 >-1073742484 >-1073742484 > >You can see on examination that this should not work... At least if it does >work, it shouldn1t work in this way...!!!! > >Sorry for the uninformative error report... Someone with more skill at these >should perhaps do it... > >Yours, >Andrew What part are you suprised about? The second negative number? Doing this is asking for trouble: *ptr++ It's much cleaner to do this: (*ptr)++ Then my output is: 3 -1073742488 27 4 -1073742484 Now the only interesting thing is that *ptr doesn't get incremented until after this line: printf("%d\n", cube((*ptr)++)); That's interesting, because I believed defines simply do find-replaces and so your code becomes: printf("%d\n", ((*ptr)++)*((*ptr)++)*((*ptr)++)); If you write it out explicitely (like I have), you end up with 3*4*5, like you would expect. But instead, you don't get an increment until after the end of the line, which explains the 4. But that seems odd... it hs something to with the way that gcc deals with defines. Matt From hayne at sympatico.ca Thu Nov 7 22:41:02 2002 From: hayne at sympatico.ca (Cameron Hayne) Date: Thu Nov 3 14:50:21 2005 Subject: GCC not doing the correct thing? In-Reply-To: Message-ID: On 8/11/02 12:50 am, "Andrew Yager" wrote: > #define cube(x) x*x*x > [...] > printf("%d\n", cube(*ptr++)); The result of the macro expansion is an expression which involves more than one reference to the incremented variable. Such things have undefined behaviour. Since the standards (C & C++) say that the compiler is free to do whatever it wants with such expressions, GCC is definitely doing the "right thing" whatever it does. It might be nice if it gave you a warning message but it doesn't. By the way, this is a frequently asked question and you might like to peruse the C FAQ at: http://www.eskimo.com/~scs/C-faq/top.html Bottom line: avoid such constructions. Always assign complicated expressions to a temp variable when using a macro. Or use functions instead. -- Cameron Hayne (hayne@sympatico.ca) Hayne of Tintagel From ssudre at intego.com Fri Nov 8 02:35:01 2002 From: ssudre at intego.com (=?ISO-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:50:21 2005 Subject: GCC not doing the correct thing? In-Reply-To: Message-ID: On vendredi, nov 8, 2002, at 07:40 Europe/Paris, Cameron Hayne wrote: > On 8/11/02 12:50 am, "Andrew Yager" wrote: > >> #define cube(x) x*x*x >> [...] >> printf("%d\n", cube(*ptr++)); > > The result of the macro expansion is an expression which involves more > than > one reference to the incremented variable. Such things have undefined > behaviour. Since the standards (C & C++) say that the compiler is free > to do > whatever it wants with such expressions, GCC is definitely doing the > "right > thing" whatever it does. It might be nice if it gave you a warning > message > but it doesn't. By the way, this is a frequently asked question and you > might like to peruse the C FAQ at: > http://www.eskimo.com/~scs/C-faq/top.html Absolutely right. The behavior of this kind of code is not the same when built with Visual C++ or CodeWarrior for instance. Interesting point to take into account when porting codes from Windows to the Mac. From ssudre at intego.com Fri Nov 8 04:39:01 2002 From: ssudre at intego.com (=?ISO-8859-1?Q?St=E9phane_Sudre?=) Date: Thu Nov 3 14:50:21 2005 Subject: Filtering issue with NSOpenPanel Message-ID: I'm beginning to wonder if there's a way to correctly filter the items displayed in a NSOpenPanel. I want to only display in it Folders (Volumes included) and the file type I'm interesting in. Since I don't trust the file extension to always be there, I'm not filtering with an extension list but instead I'm using a delegate method of NSSavePanel: - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename; The problem I'm facing is that I don't find any way to filter out the Applications and bundles. I tried using the NSWorkspace API: - (BOOL)getInfoForFile:(NSString *)fullPath application:(NSString **)appName type:(NSString **)type; but it's not working or I'm not able to make it work (I've been told this API was not working in 10.1). I'm a bit afraid that there could be no solution as when I have a look at what TextEdit is doing, applications are displayed as being readable by TextEdit. The code I'm using is the following one: - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename { NSFileManager * tFileManager; tFileManager=[NSFileManager defaultManager]; if (tFileManager!=nil) { BOOL isDirectory; if ([tFileManager fileExistsAtPath:filename isDirectory:&isDirectory]==YES && isDirectory==NO) { if ([[filename pathExtension] isEqualToString:MY_ARCHIVE_EXTENSION]==NO) { if ([NSHFSTypeOfFile(filename) isEqualToString: MY_ARCHIVE_TYPE]==NO) { return NO; } } } else { // handle the directory case NSWorkspace * tWorkspace; NSString * tType; NSString * tName; tWorkspace=[NSWorkspace sharedWorkspace]; [tWorkspace getInfoForFile:filename application:&tName type:&tType]; NSLog(tType); { // I need to handle Bundles too one day or the other if ([tType isEqualToString:NSDirectoryFileType]==NSApplicationFileType) { return NO; } } } } return YES; } From jacobo at on.aibn.com Fri Nov 8 07:55:02 2002 From: jacobo at on.aibn.com (jacobo@on.aibn.com) Date: Thu Nov 3 14:50:21 2005 Subject: .dmg displaying license agreement when mounted In-Reply-To: <1C9BEC6E-F2BF-11D6-BB4F-000393AC9690@mac.com> References: <1C9BEC6E-F2BF-11D6-BB4F-000393AC9690@mac.com> Message-ID: <3DCBDE52.7040804@on.aibn.com> Thanks a lot David for the info, it is most appreciated, I will check it out. Jacobo David Dunham wrote: > On Thursday, Nov 7, 2002, at 17:07 US/Pacific, jacobo@on.aibn.com wrote: > >> Does anyone know where I can find information about how to create a .dmg >> file that when mounted displays a license agreement?. I have been >> checking the old Apple's scripts for diskcopy but none of them seem >> to work with the latest diskcopy version in Jaguar. > > > I've been using DMG Maker. I'm pretty sure DropDMG will do this too. > And almost certainly the new product from eSellerate/Mindvision will > handle this. > > David Dunham Macintosh Game Developer GameHouse, Inc. > david@gamehouse.com 206 442 5881 x22 http://www.gamehouse.com > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From rcleis at mac.com Fri Nov 8 10:46:01 2002 From: rcleis at mac.com (Richard Cleis) Date: Thu Nov 3 14:50:21 2005 Subject: GCC not doing the correct thing? In-Reply-To: Message-ID: What's undefined about the following? cube( (*ptr++) ) rac On Friday, November 8, 2002, at 03:34 AM, St?phane Sudre wrote: > > On vendredi, nov 8, 2002, at 07:40 Europe/Paris, Cameron Hayne wrote: > >> On 8/11/02 12:50 am, "Andrew Yager" wrote: >> >>> #define cube(x) x*x*x >>> [...] >>> printf("%d\n", cube(*ptr++)); >> >> The result of the macro expansion is an expression which involves >> more than >> one reference to the incremented variable. Such things have undefined >> behaviour. Since the standards (C & C++) say that the compiler is >> free to do >> whatever it wants with such expressions, GCC is definitely doing the >> "right >> thing" whatever it does. It might be nice if it gave you a warning >> message >> but it doesn't. By the way, this is a frequently asked question and >> you >> might like to peruse the C FAQ at: >> http://www.eskimo.com/~scs/C-faq/top.html > > Absolutely right. > > The behavior of this kind of code is not the same when built with > Visual C++ or CodeWarrior for instance. > > Interesting point to take into account when porting codes from Windows > to the Mac. > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From clarkcox3 at mac.com Fri Nov 8 10:53:01 2002 From: clarkcox3 at mac.com (Clark S. Cox III) Date: Thu Nov 3 14:50:21 2005 Subject: GCC not doing the correct thing? In-Reply-To: Message-ID: <2CA8D640-F34B-11D6-8E49-0050E4EE1966@mac.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, Nov 8, 2002, at 13:42 US/Eastern, Richard Cleis wrote: > > On Friday, November 8, 2002, at 03:34 AM, St?phane Sudre wrote: > >> >> On vendredi, nov 8, 2002, at 07:40 Europe/Paris, Cameron Hayne wrote: >> >>> On 8/11/02 12:50 am, "Andrew Yager" wrote: >>> >>>> #define cube(x) x*x*x >>>> [...] >>>> printf("%d\n", cube(*ptr++)); > What's undefined about the following? > > cube( (*ptr++) ) cube( (*ptr++) ) expands to (*ptr++)*(*ptr++)*(*ptr++). This is undefined behavior, because you are trying to assign to the same variable three times before the next sequence point. It is the same reason that things like the following are undefined: i = i++; - --i++; - -- http://homepage.mac.com/clarkcox3/ clarkcox3@mac.com Clark S. Cox, III -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (Darwin) iEYEARECAAYFAj3MB9oACgkQd6STocYT1xWrgACghkF4CFRYqiduiuoqSDZu99Ak t5cAnjykcI9pdLYhnKddPzyivjuy+vu6 =IWY8 -----END PGP SIGNATURE----- From rcleis at mac.com Fri Nov 8 12:40:02 2002 From: rcleis at mac.com (Richard Cleis) Date: Thu Nov 3 14:50:21 2005 Subject: GCC not doing the correct thing? In-Reply-To: <2CA8D640-F34B-11D6-8E49-0050E4EE1966@mac.com> Message-ID: <310C8F6D-F35A-11D6-8646-0003939B3C4A@mac.com> On Friday, November 8, 2002, at 11:52 AM, Clark S. Cox III wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > On Friday, Nov 8, 2002, at 13:42 US/Eastern, Richard Cleis wrote: >> >> On Friday, November 8, 2002, at 03:34 AM, St?phane Sudre wrote: >> >>> >>> On vendredi, nov 8, 2002, at 07:40 Europe/Paris, Cameron Hayne wrote: >>> >>>> On 8/11/02 12:50 am, "Andrew Yager" wrote: >>>> >>>>> #define cube(x) x*x*x >>>>> [...] >>>>> printf("%d\n", cube(*ptr++)); >> What's undefined about the following? >> >> cube( (*ptr++) ) > > > cube( (*ptr++) ) expands to (*ptr++)*(*ptr++)*(*ptr++). This is > undefined behavior, because you are trying to assign to the same > variable three times before the next sequence point. It is the same > reason that things like the following are undefined: > > i = i++; > - --i++; Thanks. My gcc *does* give a warning. Now I know why. (But this is off-topic). int main() { int a,b,c, i[16] = { 1, 2, 3, 4 }; int *pC = i; printf( "Hmmm: %d\n", (a = *pC++) * (b = *pC++) * (c =*pC++) ); printf( "Ahhh: %d %d %d %d\n", a, b, c, *pC ); } Hmmm: 1 Ahhh: 1 1 1 2 rac From rixstep000 at yahoo.co.uk Fri Nov 8 12:54:10 2002 From: rixstep000 at yahoo.co.uk (=?iso-8859-1?q?Domain=20Administrators?=) Date: Thu Nov 3 14:50:21 2005 Subject: GCC not doing the correct thing? Message-ID: <20021108205128.63856.qmail@web10902.mail.yahoo.com> Absolutely nothing. You're right. Even the order of the accesses of x in x*x*x is defined in the associativity of the language. It has to be. If GCC has problems with this, then we're in trouble. R. >What's undefined about the following? > cube( (*ptr++) ) __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com From clarkcox3 at mac.com Fri Nov 8 13:08:01 2002 From: clarkcox3 at mac.com (Clark S. Cox III) Date: Thu Nov 3 14:50:22 2005 Subject: GCC not doing the correct thing? In-Reply-To: <20021108205128.63856.qmail@web10902.mail.yahoo.com> Message-ID: <1C82F0B4-F35E-11D6-8E49-0050E4EE1966@mac.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, Nov 8, 2002, at 15:51 US/Eastern, Domain Administrators wrote: > Absolutely nothing. You're right. Even the order of the accesses of > x in x*x*x is defined in the associativity of the language. It has > to be. > > If GCC has problems with this, then we're in trouble. R. > >> What's undefined about the following? > >> cube( (*ptr++) ) Neither the order of memory fetches or the order of stores is defined. Operator precedence and associativity are irrelevant here. for example, in the following expression (x+y*z), the compiler is allowed to: fetch all three variables at once, before performing any operations fetch each individual variable as the need arises fetch them in a random order, as long as they are loaded before the actual calculation is performed In the following example (which is a perfectly legal statement): a = x++ + y++ + z++; The compiler is only required to: 1) fetch the values of the three variables 2) add them together 3) assign the result to a 4) increment each of the three variables As long as the incrementing happens after the fetching, the compiler is well within it's right to do whatever it pleases (in fact, for whatever reason, step 4 could come between 1 and 2, or between 2 and 3) However in this example (which is invokes undefined behavior): a = x++ + x++ x++; Since the C standard does not specify when the increment takes place (i.e. it only has to take place sometime after the initial value is fetched, but before the next sequence point), the compiler would be well within it's right to compile this as: a = x+x+x; x += 3; or a = (x+1)+(x+1)+(x+1) x += 3; or a = x; a += x++; a += x++; a += x++; Each of which yield different results. So the result of such an expression is "undefined" as per the standard, and in fact it is explicitly stated to be so in the standard. - -- http://homepage.mac.com/clarkcox3/ clarkcox3@mac.com Clark S. Cox, III -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (Darwin) iEYEARECAAYFAj3MJ58ACgkQd6STocYT1xUF+QCgl5k7j4K3fh+ReOI8tY6l2r7n TZsAnimyRSmzvraP7UeHbCUeZerZFQV1 =yh1e -----END PGP SIGNATURE----- From ijeyd at mac.com Fri Nov 8 15:03:01 2002 From: ijeyd at mac.com (Morgan Redman) Date: Thu Nov 3 14:50:22 2005 Subject: Using Multiple Bundles ( was Debugging Multiple Bundles ) In-Reply-To: Message-ID: <1FC83CB6-F36E-11D6-860E-00039344C692@mac.com> Doesn't anyone else have any suggestions? This problem is killing me! On Wednesday, November 6, 2002, at 12:54 PM, Morgan Redman wrote: > I now have a very interesting problem with my bundles. I found it > very strange that I could not get the debugger to stop in bundles ( it > complains that it does not have a source file when I set a breakpoint > in a file contained in the bundle ). What I found most strange was > that I was sure I could remember the debugger stopping in one of my > other bundles that I has already coded. I did some testing and found > that yes indeed, the debugger would stop in my older bundle, but not > the one that I was currently trying to debug. This led me to go > through each option in the target settings and make sure everything > was configured the same. It was. > > I decided to start from scratch and copy all of my files over to a new > project and create all my targets over again, just incase I was > missing something that I had misconfigured. I ended up discovering > something important. > > At the beginning of my program I read an xml file of the all the > bundles in my application and the class names inside the bundles to > instantiate. > What I discovered is that only the first bundle loaded can be > debugged! If I change the order around in my xml file, whatever bundle > is listed first ( and thus loaded first ) can be debugged. Everything > loaded after cannot be debugged. What could cause this to happen? > > -Morgan > > On Wednesday, November 6, 2002, at 10:30 AM, Morgan Redman wrote: > >> My build style is set to development. The source file is one that I >> have written that is actually in the same directory as all my other >> source files ( the project directory ). I build the bundle and the >> application from the same project using different targets. >> >> -Morgan >> >> On Tuesday, November 5, 2002, at 08:26 AM, Finlay Dobbie wrote: >> >>> >>> On Tuesday, November 5, 2002, at 01:07 am, Morgan Redman wrote: >>> >>>> Ok, I tried moving one of my bundles to a separate project, but I >>>> am still getting the same results. If I put a break in the bundle, >>>> when I try to debug from the applications project window it still >>>> says no source file found.... I must be doing somthing wrong, but >>>> I cant even begin to guess what. >>> >>> Perhaps you're using a build with some symbols stripped. Make sure >>> your build style is set to "development". >>> >>> You don't say what the source file is, but if it's one that you >>> don't actually have, you could have inadvertently set a breakpoint >>> in a header of a compiled framework (I did this in NSException.h >>> once, mystified me for a while :-)). >>> >>> -- Finlay >>> >>> _______________________________________________ >>> 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 jmdisher at student.math.uwaterloo.ca Fri Nov 8 19:51:01 2002 From: jmdisher at student.math.uwaterloo.ca (Jeff Disher) Date: Thu Nov 3 14:50:22 2005 Subject: OpenGL-based games and the Cocoa Framework Message-ID: <8004E872-F396-11D6-998F-000393B6A966@student.math.uwaterloo.ca> Hello, I recently wrote a little game in OpenGL using Cocoa and I want to use that approach on another idea I have but I need some help. In the previous game, I would draw a frame in the drawRect method and flush it immediately. I did this with a timer firing something like 20 times a second with a few things to do first. For example, the game board rotates, so, before telling the view it needs to be re-displayed, I would increment a rotation variable and change some other things relating to general animation of the game. Any events such as a mouse click, a mouse move, or a remote player writing data to a socket would happen whenever they needed to and were always properly addressed. I am now trying to generalize the idea into a reusable and reliable engine but I am having a few issues: -how do I guarantee the best frame rate I can get (in the previous game, I fixed it at 20/sec but future games will need it to be better)? -how can I make sure that variables I depend on will be updated in a timely fashion (for example, if I try to tell a view to re-draw as soon as it draws one frame, it is likely that timers firing to update data used in the scene will be ignored because the runloop will be active)? I figured that one way would be to have a drawing/UI thread and then a thread for variable management but I think that the locking involved may be a bit inefficient and it seems like there would be a better/cleaner way. Any suggestions are welcome. Thanks in advance, Jeff Disher President and Lead Developer of Spectral Class Spectral Class: Shedding Light on Innovation http://www.spectralclass.com/ From nat at mulle-kybernetik.com Fri Nov 8 20:23:01 2002 From: nat at mulle-kybernetik.com (Nat!) Date: Thu Nov 3 14:50:22 2005 Subject: GCC not doing the correct thing? In-Reply-To: Message-ID: Am Freitag, 08.11.02 um 06:50 Uhr schrieb Andrew Yager: > Hi, > > The following code snippet does not appear to function correctly. > > #include > #define cube(x) x*x*x > > int main() > { > int x=1; > int y=2; > int z=3; > int* ptr = &z; > > printf("%d\n", *ptr); > printf("%d\n", ptr); > printf("%d\n", cube(*ptr++)); > printf("%d\n", *ptr); > printf("%d\n", ptr); > Apart from the problem with the postdecrementing in the macro, the code assumes that the local variables are ordered on the stack in ascending addresses from last declared to earliest declared. That's not very good code either. > It's much cleaner to do this: (*ptr)++ Writing (*ptr)++ is not "much cleaner", except if you think that (a[ 3]) + (2) is also cleaner than just a[ 3] + 2. Ciao Nat! ------------------------------------------------------ When vanity and rivalry disappear, all the lines go out of your stomach and you slow down and coast slowly to a stop in the middle. -- DLR From andrew at rwts.com.au Fri Nov 8 20:29:02 2002 From: andrew at rwts.com.au (Andrew Yager) Date: Thu Nov 3 14:50:22 2005 Subject: GCC not doing the correct thing? In-Reply-To: Message-ID: Yeah... I'm not acctually claiming that this code is in any way, shape or form good... We were just playing with what the define would do with it... And as far as we could tell it should probably just overflow and die, or segfault or something... Yours, Andrew On 9/11/02 3:21 PM, "Nat!" wrote: > > Am Freitag, 08.11.02 um 06:50 Uhr schrieb Andrew Yager: > >> Hi, >> >> The following code snippet does not appear to function correctly. >> >> #include >> #define cube(x) x*x*x >> >> int main() >> { >> int x=1; >> int y=2; >> int z=3; >> int* ptr = &z; >> >> printf("%d\n", *ptr); >> printf("%d\n", ptr); >> printf("%d\n", cube(*ptr++)); >> printf("%d\n", *ptr); >> printf("%d\n", ptr); >> > > Apart from the problem with the postdecrementing in the macro, the code > assumes that the local variables are ordered on the stack in ascending > addresses from last declared to earliest declared. That's not very good > code either. > >> It's much cleaner to do this: (*ptr)++ > > Writing (*ptr)++ is not "much cleaner", except if you think that (a[ > 3]) + (2) is also cleaner than just a[ 3] + 2. > > Ciao > Nat! > ------------------------------------------------------ > When vanity and rivalry disappear, all the lines go > out of your stomach and you slow down and coast > slowly to a stop in the middle. -- DLR > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > ___________________ Andrew Yager Real World Technology Solutions Real People, Real SolUtions (tm) ph: (02) 9945 2567 fax: (02) 9945 2566 mob: 0405 15 2568 http://www.rwts.com.au/ _________________________ From tjw at omnigroup.com Fri Nov 8 23:15:01 2002 From: tjw at omnigroup.com (Timothy J. Wood) Date: Thu Nov 3 14:50:22 2005 Subject: OpenGL-based games and the Cocoa Framework In-Reply-To: <8004E872-F396-11D6-998F-000393B6A966@student.math.uwaterloo.ca> Message-ID: On Friday, November 8, 2002, at 07:51 PM, Jeff Disher wrote: > -how do I guarantee the best frame rate I can get (in the previous > game, I fixed it at 20/sec but future games will need it to be > better)? Timers can fire pretty fast w/o too much overhead -- you might try writing a little test case that just fires a timer at, say, 60fps, to see how much CPU that takes.... it probably won't be much. Still, I think threading is a better long term option for _really_ high performance games (but not because of timer overhead :) > I figured that one way would be to have a drawing/UI thread and then a > thread for variable management but I think that the locking involved > may be a bit inefficient and it seems like there would be a > better/cleaner way. One issue to consider here is the set of extensions you want to support. In particular for this question you want to look at APPLE_vertex_array_range, APPLE_vertex_object, APPLE_element_array and APPLE_fence. These allow you to asynchronously submit vertices to the GPU for rendering. Doing synchronous copies of vertices and indices to the hardware is pretty much the biggest bottleneck in most games Omni ports to the Mac. One bit of fallout from this is that to get the best asynchronous behavior, you need to allow the hardware to have time to get around to processing your vertices before you re-use a particular region in the vertex array range. This means you have to have some sort of synchronization already in your rendering loop to make the best use of the hardware. As far as game state vs. rendering, there are other reasons to decouple the update frequencies of these two. One good example is in a physics engine -- to have a reasonably accurate physics simulator you want it to update very frequently and you usually want it to have a fixed step size (although this isn't a requirement, it just make life easier). So, you may want to update your physics at 100 fps independently of your graphics frame rate (you definitely don't want your graphics frame rate to impact the accuracy of your physics simulation!) -tim From pg at powerplum.com Sat Nov 9 02:00:01 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:22 2005 Subject: Current Frame Number of an NSMovie Message-ID: Can someone reply with a little code snippet for obtaining the current frame number of an NSMovie? Here's what I've got (below). It compiles and runs and doesn't crash, but the number that NSLog prints out is definitely not a frame number. My guess is that it's printing a memory address. Here's where my Carbon skills are lacking. The QuickTime framework is properly included in the project and imported into this source file. All that kind of stuff is fine. It's my code that's not working. Any help would be greatly appreciated. ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// - (void)doit { MediaHandler mh; long * frameNum; Media theMedia; Track theTrack; long * trackID; Movie theMovie; theMovie = [[myMovieView movie] QTMovie]; theTrack = GetMovieTrack (theMovie, trackID); theMedia = GetTrackMedia (theTrack); mh = GetMediaHandler (theMedia); TCGetCurrentTimeCode(mh, frameNum, nil, nil, nil); NSLog(@"%@",[[NSNumber numberWithLong:frameNum] stringValue]); } ///////////////////////////////////////////// ///////////////////////////////////////////// ///////////////////////////////////////////// Thanks. - Philip From joachim at nettnyheter.net Sat Nov 9 05:14:01 2002 From: joachim at nettnyheter.net (=?ISO-8859-1?Q?Joachim_Haagen_B=F8e?=) Date: Thu Nov 3 14:50:22 2005 Subject: Cocoa programming Message-ID: Hi, I have a few VERY easy questions relating to Cocoa and Objective-C. FIrst off, im used to programming in Java, so I find the notation to be a bit wierd. My questions are about the notation used in Cococa. As a side note, im reading Aaron Hillegass' book "Cocoa programming for MacOS X". Question 1 - pointers I understand that * means the the variable is a pointer, and to me it seems as if ALL complex variables are pointers (im up to chapter 4 in the book). Is this the case ? And is passing a pointer as a parameter to a method the same as passing a complex variable to a method in Java ? Question 2 - @, %, %@ and %d When creating NSStrings I see a lot of these symbols. I have figured out that you specify which variables go into these symbols, but have the following question regarding the following code: outputString = [NSString stringWithFormat:@"%@ has %d letters", inputString, [inputString length]]; What is the very first @ for ? Why is the second %@, and not $d ? What is the difference between %@ and %d ? Okay, thats my main difficoulties, other than the whole [] instead of .'s in the notation. Im sorry about the very basic questions, but I'd appreciate if anyone took the time out of their busy schedual to answer some of these. Thanks is advance! Joachim -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1364 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021109/a66dcbc5/attachment.bin From jonj at realsoftware.com Sat Nov 9 05:40:01 2002 From: jonj at realsoftware.com (Jon Johnson) Date: Thu Nov 3 14:50:22 2005 Subject: Cocoa programming In-Reply-To: Message-ID: On Saturday, November 9, 2002, at 07:12 AM, Joachim Haagen B?e wrote: > Hi, I have a few VERY easy questions relating to Cocoa and Objective-C. > > FIrst off, im used to programming in Java, so I find the notation to > be a bit wierd. My questions are about the notation used in Cococa. > > As a side note, im reading Aaron Hillegass' book "Cocoa programming > for MacOS X". > I'm learning Java because K-State is making me :P... Let's see what I can do :) > Question 1 - pointers > > I understand that * means the the variable is a pointer, and to me it > seems as if ALL complex variables are pointers (im up to chapter 4 in > the book). Is this the case ? And is passing a pointer as a parameter > to a method the same as passing a complex variable to a method in Java > ? > Technically, yes they are pointers. I never think of them as pointers, yet, as subclasses of NSObject. Everything that derives from NSObject automatically needs the * notation. Structs defined in the Foundation, like NSRect, NSPoint, NSSize, etc, don't need this notation (They aren't objects, but rather just struct's). > Question 2 - @, %, %@ and %d > > When creating NSStrings I see a lot of these symbols. I have figured > out that you specify which variables go into these symbols, but have > the following question regarding the following code: > > outputString = [NSString stringWithFormat:@"%@ has %d letters", > inputString, [inputString length]]; > > What is the very first @ for ? (Basically) To tell the compiler to generate a NSString from whatever is enclosed in quotes. Since Objective-C is a superset of C, "asdf" would be turned into a regular C-String, which doesn't have the same functionality of an NSString (or a String in Java). The @ symbol is used several other places, the other most common being to flag something called a selector, which I'm sure you'll learn about soon. (Did that make sense? I just woke up) > Why is the second %@, and not $d ? > What is the difference between %@ and %d ? The value you are passing is an NSString, and it is saying to look for an NSObject afterwards. Since NSString is a subclass of NSObject, your inputString is an acceptable value. If it is another NSObject, it will do [myObject description] to get an NSString from it. The %d is specifying to look for a double value. For more information on the different allowed format strings, see: http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ ProgrammingTopics/DataFormatting/Tasks/FormatStrings.html > Okay, thats my main difficoulties, other than the whole [] instead of > .'s in the notation. I personally like it. It just feels different than other languages, and maybe that's why I like it :P > Im sorry about the very basic questions, but I'd appreciate if anyone > took the time out of their busy schedual to answer some of these. We all started out this way (or at least I did, I guess I can't speak for everyone else). Good luck, Jon From ahoesch at advanced-science.com Sat Nov 9 05:42:01 2002 From: ahoesch at advanced-science.com (=?ISO-8859-1?Q?Andreas_H=F6schler?=) Date: Thu Nov 3 14:50:22 2005 Subject: Cocoa programming In-Reply-To: Message-ID: Hi, > Question 1 - pointers > > I understand that * means the the variable is a pointer, and to me it > seems as if ALL complex variables are pointers (im up to chapter 4 in > the book). Is this the case? Yes!. If you allocate an object - e.g. NSString *string = [[NSMutableString alloc] init]; - ram space for the object is allocated (usually only a few bytes) and a pointer to this space is returned. This pointer is used to address the object. This pointer is also the target for messages, e.g. int length = [string length]. This corresponds to string.length in Java. > And is passing a pointer as a parameter to a method the same as passing > a complex variable to a method in Java ? Yes! > Question 2 - @, %, %@ and %d > > When creating NSStrings I see a lot of these symbols. I have figured > out that you specify which variables go into these symbols, but have > the following question regarding the following code: > > outputString = [NSString stringWithFormat:@"%@ has %d letters", > inputString, [inputString length]]; > > What is the very first @ for? > Why is the second %@, and not $d ? The second is %d and the first is %@, right? > What is the difference between %@ and %d ? %d is a placeholder for int, unsigned,... %@ is a placeholder for an Objective-C object. This object is automatically send the message "description" which is supposed to return an NSString. So you can pass NSNumber, NSDeciamlNumber, NSString,... (all objects that respond to description) as a parameter for a %@ placeholder. > Okay, thats my main difficoulties, other than the whole [] instead of > .'s in the notation. ... which is genial by the way. Consider the following method of NSCalendarDate. - (NSCalendarDate *)dateByAddingYears:(int)year months:(int)month days:(int)day hours:(int)hour minutes:(int)minute seconds:(int)second You call it as follows. NSCalendarDate *date; // Assume this object exists [date dateByAddingYears:0 months:3 days:15 hours:2 minutes:30 seconds:0]; Try this in Java or C++. It would look like. date.dateByAddingSomeStuffNoBodyKnowsHowToCallThisMethod(0,3,15,2,30,0); What is easier to read? > Im sorry about the very basic questions, but I'd appreciate if anyone > took the time out of their busy schedual to answer some of these. You are welcome! Regards, Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2498 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021109/26219a95/attachment.bin From fabienlroy at mac.com Sat Nov 9 08:51:01 2002 From: fabienlroy at mac.com (Fabien Roy) Date: Thu Nov 3 14:50:22 2005 Subject: Cocoa programming In-Reply-To: Message-ID: <4DCC19CE-F403-11D6-822D-000393658196@mac.com> The java advocate will tell you: date.dateByAddingSomeStuffNoBodyKnowsHowToCallThisMethod(0,3,15,2,30,0); :-) What about the following in java? [attrString appendAttributedString: [[[NSAttributedString alloc] initWithString:[NSString stringWithFormat: @"%@\n", [fsnode lastPathComponent]] attributes:[self normalFontAttributes]] autorelease]]; We are talking about the language syntax, aren't we? :-) On Saturday, Nov 9, 2002, at 05:41 US/Pacific, Andreas H?schler wrote: > ... which is genial by the way. Consider the following method of > NSCalendarDate. > > - (NSCalendarDate *)dateByAddingYears:(int)year months:(int)month > days:(int)day hours:(int)hour minutes:(int)minute seconds:(int)second > > You call it as follows. > > NSCalendarDate *date; // Assume this object exists > > [date dateByAddingYears:0 months:3 days:15 hours:2 minutes:30 > seconds:0]; > > Try this in Java or C++. It would look like. > > > date.dateByAddingSomeStuffNoBodyKnowsHowToCallThisMethod(0,3,15,2,30,0) > ; > > What is easier to read? From samani_sanjay at yahoo.co.uk Sat Nov 9 09:32:01 2002 From: samani_sanjay at yahoo.co.uk (Sanjay Samani) Date: Thu Nov 3 14:50:22 2005 Subject: Cocoa programming In-Reply-To: Message-ID: > >> What is the difference between %@ and %d ? > > %d is a placeholder for int, unsigned,... %@ is a placeholder for an > Objective-C object. This object is automatically send the message > "description" which is supposed to return an NSString. So you can pass > NSNumber, NSDeciamlNumber, NSString,... (all objects that respond to > description) as a parameter for a %@ placeholder. > The great thing about this is the you can create your own objects and have it respond to the message (method) -description which returns an NSString. You can then use it when using a formatted string. So for simple debug code you can write: NSLog (@"My Object : %@", myObject) and it will just print out the details of your object in whatever format you like and specify in the -description method. To be honest the whole % thing for printf in C took me ages to get my head around, and at work we still ask each other "How do you print an integer padded with leading zeroes to six spaces?" Also, one way to think about @"my string" is that it is shorthand for creating an NSString, that would otherwise have to be something like: [NSString stringWithCString;"my string\0"], yeuch. Sanjay -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1239 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021109/cf6f9c43/attachment.bin From rhale1 at macosx.com Sat Nov 9 12:38:01 2002 From: rhale1 at macosx.com (Ryan Z. Hale) Date: Thu Nov 3 14:50:22 2005 Subject: Making my app use FileWrappers (Document Bundles) as the file type... Message-ID: I apologize in advance if this too newbie or has been discussed before, though I did check. I am making an app that I want to use FileWrappers to store several .plist and text files in, similar to TextEdit's RTFD or the OmniWeb .htmld, but can't seem to get it working. I have changed my Document.m to "loadFileWrapperRepresentation" and "fileWrapperRepresentationOfType", along with the "File Package" setting in my target. When I save the document (currently just some text), I get a sheet and all that, but after telling it to save, I get a could not save document error. Anyone know why this is happening? Could anyone give me or point me to some simple Sample Code for this? Thanks, Ryan Hale rhale1@macosx.com From kpackard at blackfrog.com Sat Nov 9 14:12:01 2002 From: kpackard at blackfrog.com (Kevin Packard) Date: Thu Nov 3 14:50:22 2005 Subject: Project Builder questions: dependent targets and exporting makefiles In-Reply-To: <200206132128625.SM01024@skti.org> Message-ID: <33FC2FD6-F430-11D6-A66C-00039346A156@blackfrog.com> Hope this is the correct forum for Project Builder questions. I have one: Is it possible to set up a dependent target when that target resides in a different project file? Example, I want my app target to build a library target from another project file. thanks, -- Kevin Packard blackfrog software, inc. From finlay at dobbie.net Sat Nov 9 14:16:01 2002 From: finlay at dobbie.net (Finlay Dobbie) Date: Thu Nov 3 14:50:22 2005 Subject: Project Builder questions: dependent targets and exporting makefiles In-Reply-To: <33FC2FD6-F430-11D6-A66C-00039346A156@blackfrog.com> Message-ID: On Saturday, November 9, 2002, at 10:11 pm, Kevin Packard wrote: > Hope this is the correct forum for Project Builder questions. There is a pb-users list over at lists.apple.com > I have one: > > Is it possible to set up a dependent target when that target resides > in a different project file? Example, I want my app target to build a > library target from another project file. Nope. -- Finlay From kpackard at blackfrog.com Sat Nov 9 14:22:02 2002 From: kpackard at blackfrog.com (Kevin Packard) Date: Thu Nov 3 14:50:22 2005 Subject: Project Builder questions: dependent targets and exporting makefiles In-Reply-To: <33FC2FD6-F430-11D6-A66C-00039346A156@blackfrog.com> Message-ID: <8DCB1672-F431-11D6-A66C-00039346A156@blackfrog.com> I just found the appropriate list for this question (ProjectBuilder-Users). Sorry. On Saturday, November 9, 2002, at 05:11 PM, Kevin Packard wrote: > Hope this is the correct forum for Project Builder questions. -- Kevin Packard blackfrog software, inc. From chamlin at optonline.net Sat Nov 9 14:34:01 2002 From: chamlin at optonline.net (Christopher B Hamlin) Date: Thu Nov 3 14:50:22 2005 Subject: OS X Font tools (Nov. 8, 2002) Message-ID: <06084984-F433-11D6-85F7-003065F52526@optonline.net> I saw this: http://developer.apple.com/fonts/OSXTools.html but don't know how to get it. I have a free ADC membership only. Am I missing something really obvious? Thanks, Chris Hamlin From randrews at mac.com Sat Nov 9 14:59:01 2002 From: randrews at mac.com (Ritchie Andrews) Date: Thu Nov 3 14:50:22 2005 Subject: OS X Font tools (Nov. 8, 2002) In-Reply-To: <06084984-F433-11D6-85F7-003065F52526@optonline.net> Message-ID: On Sunday, Nov 10, 2002, at 07:31 Asia/Tokyo, Christopher B Hamlin wrote: > > I saw this: > > http://developer.apple.com/fonts/OSXTools.html > > but don't know how to get it. I have a free ADC > membership only. Am I missing something really > obvious? > > Thanks, > > Chris Hamlin > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > > Looks like the web page was put up before the program was actually added to the download page. Drew From skrap at mac.com Sat Nov 9 16:29:01 2002 From: skrap at mac.com (Jonah Petri) Date: Thu Nov 3 14:50:22 2005 Subject: strange behavior of NSAppleScript Message-ID: <4C9FCA13-F443-11D6-81C0-0003938AD750@mac.com> Hello All, I am seeing some very puzzling behavior of NSAppleScript, I was hoping someone could shed some light on it for me. I have a scriptable application, to which I have added a custom NSDocument subclass called "character document". I'm using Don Briggs' excellent suite modeler application, so I'm relatively sure that my scriptsuite and scriptterminology files are correct. My problem is that a script such as this works fine in Script Editor: tell application "MyApp" return count of character documents end tell However, I've recently added a UI to NSAppleScript to this application, and I'm puzzled because the exact same script will fail to compile using the NSAppleScript interface. The call to compile the script returns an error dictionary, the verbose error from which is "MyApp got an error: Can't get every document." Why would NSAppleScript get an error on compiling a simple script, when Script Editor would have no complaints, either compiling or running? I have also tried many other such simple scripts, all with similar results. Thanks, Jonah From simX at mac.com Sat Nov 9 16:57:01 2002 From: simX at mac.com (Simone Manganelli) Date: Thu Nov 3 14:50:22 2005 Subject: NSScanner difference between OS X 10.1 and Jaguar? Message-ID: I've been having a problem with my program on Mac OS X 10.1, and it's kind of bizarre. My application does some parsing of command line output, and on Mac OS X 10.2 Jaguar, it works as expected. However, under Mac OS X 10.1 (which I just tried for the first time today), the things that are displayed are totally different, and totally pointless for my application's purpose. Things that don't use an NSScanner, but just parse by splitting strings at certain characters to make arrays work and display correctly, which leads me to believe that there is a change in behavior of an NSScanner between Mac OS X 10.1 and Mac OS X 10.2 Jaguar. Does anybody know any specifics about the problem and what steps can be taken to make NSScanners work the same way on Mac OS X 10.1 and Mac OS X 10.2 Jaguar? Any help would be greatly appreciated. -- SImone Manganelli From chergr at bigpond.com Sat Nov 9 17:14:01 2002 From: chergr at bigpond.com (Richard) Date: Thu Nov 3 14:50:22 2005 Subject: Cocoa programming References: Message-ID: <3DCDB2C1.CC3B1945@bigpond.com> The pointer notation in Obj-C for objects is equivalent to the same thing in Java. Java objects are actually references which are equivalent in some respects to pointers. The % notation is taken from c with some extensions. %d means insert the characters representing a single precision integer in DECIMAL format. %ld means insert the characters representing a long (32bit integer) in DECIMAL format. %x means insert the characters representing a single precision integer in HEXADECIMAL format. %s means insert the characters of a char*. %f, %e, %E, %G ar for floating point, So by extension %@ means insert the NSString (a unicode string). Look up the c docs on printf and sprintf to get a complete list From hdiwan at mac.com Sat Nov 9 18:01:01 2002 From: hdiwan at mac.com (Hasan Diwan) Date: Thu Nov 3 14:50:22 2005 Subject: Cocoa programming In-Reply-To: Message-ID: <1A5C37B5-F450-11D6-B736-0003935B11EA@mac.com> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021109/dc917298/attachment-0001.bin From joachim at nettnyheter.net Sat Nov 9 18:13:01 2002 From: joachim at nettnyheter.net (=?ISO-8859-1?Q?Joachim_Haagen_B=F8e?=) Date: Thu Nov 3 14:50:22 2005 Subject: Cocoa programming In-Reply-To: Message-ID: Thanks for all your reply guys and girls! That was really helpful! Cheers, Joachim On Saturday, November 9, 2002, at 11:41 PM, Andreas H?schler wrote: > Hi, > >> Question 1 - pointers >> >> I understand that * means the the variable is a pointer, and to me it >> seems as if ALL complex variables are pointers (im up to chapter 4 in >> the book). Is this the case? > > Yes!. If you allocate an object - e.g. NSString *string = > [[NSMutableString alloc] init]; - ram space for the object is > allocated (usually only a few bytes) and a pointer to this space is > returned. This pointer is used to address the object. This pointer is > also the target for messages, e.g. int length = [string length]. This > corresponds to string.length in Java. > >> And is passing a pointer as a parameter to a method the same as >> passing a complex variable to a method in Java ? > > Yes! > >> Question 2 - @, %, %@ and %d >> >> When creating NSStrings I see a lot of these symbols. I have figured >> out that you specify which variables go into these symbols, but have >> the following question regarding the following code: >> >> outputString = [NSString stringWithFormat:@"%@ has %d letters", >> inputString, [inputString length]]; >> >> What is the very first @ for? >> Why is the second %@, and not $d ? > > The second is %d and the first is %@, right? > >> What is the difference between %@ and %d ? > > %d is a placeholder for int, unsigned,... %@ is a placeholder for an > Objective-C object. This object is automatically send the message > "description" which is supposed to return an NSString. So you can pass > NSNumber, NSDeciamlNumber, NSString,... (all objects that respond to > description) as a parameter for a %@ placeholder. > >> Okay, thats my main difficoulties, other than the whole [] instead of >> .'s in the notation. > > ... which is genial by the way. Consider the following method of > NSCalendarDate. > > - (NSCalendarDate *)dateByAddingYears:(int)year months:(int)month > days:(int)day hours:(int)hour minutes:(int)minute seconds:(int)second > > You call it as follows. > > NSCalendarDate *date; // Assume this object exists > > [date dateByAddingYears:0 months:3 days:15 hours:2 minutes:30 > seconds:0]; > > Try this in Java or C++. It would look like. > > > date.dateByAddingSomeStuffNoBodyKnowsHowToCallThisMethod(0,3,15,2,30,0) > ; > > What is easier to read? > >> Im sorry about the very basic questions, but I'd appreciate if anyone >> took the time out of their busy schedual to answer some of these. > > You are welcome! > > Regards, > > Andreas -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2675 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021109/72a33dac/attachment.bin From alex at unive.it Sat Nov 9 21:03:02 2002 From: alex at unive.it (Perrone Alessandro) Date: Thu Nov 3 14:50:22 2005 Subject: Is ld on macosx gnu-ld or not? In-Reply-To: <200211092001.gA9K1Tf02532@slowbro.omnigroup.com> References: <200211092001.gA9K1Tf02532@slowbro.omnigroup.com> Message-ID: Hi all I am trying to compile a program, but I have problems with the final linker. I read during my "internet trips" that "In case people arent familiar with the environment the MacOSX compiler is a derivative of gcc however the linker is Apple proprietary (not GNU ld based)" This was true with MacOsx 10.1.X and it seems true also on jaguar. I tried to compile the "gnu binutils" but there are errors on Makefile, since they have not been ported to macosx. any helps? Regards. ALEX From pinskia at physics.uc.edu Sat Nov 9 21:15:00 2002 From: pinskia at physics.uc.edu (Andrew Pinski) Date: Thu Nov 3 14:50:22 2005 Subject: Is ld on macosx gnu-ld or not? In-Reply-To: Message-ID: <53D6FB96-F46B-11D6-9D6E-000393122612@physics.uc.edu> ld is not gnu-ld but is open sourced, part of the Darwin under the cctools module. But what problem are you having with the ld. Remember that Mac OS X uses mach-o as the file format not elf or a.out (or a.outb) like most other UNIX's. Also how to load libraries and modules are different than other UNIX's. Thanks, Andrew Pinski On Saturday, Nov 9, 2002, at 20:59 US/Pacific, Perrone Alessandro wrote: > Hi all > I am trying to compile a program, but I have problems with the final > linker. > I read during my "internet trips" that "In case people arent familiar > with the environment the MacOSX compiler is a derivative of gcc > however the linker is Apple proprietary (not GNU ld based)" > This was true with MacOsx 10.1.X and it seems true also on jaguar. > I tried to compile the "gnu binutils" but there are errors on > Makefile, since they have not been ported to macosx. > any helps? > Regards. > ALEX > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > > From fahrenba at mac.com Sat Nov 9 23:11:01 2002 From: fahrenba at mac.com (Matthew Fahrenbacher) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data Message-ID: <779AA008-F47B-11D6-95C8-00039340986C@mac.com> I was working on a project where I can distribute files at certain times, but I'm running into a little snag. It's painfully easy to use NSData to archive a files data and keep its attributes in an NSDictionary to be applied later. The trick is to be able to maintain the resource fork data as well. Here's my attempt at doing it, and I was wondering if anyone could help point out what I'm doing wrong (I'm not very good with the Carbon APIs). - (NSData *)loadResourceDataForFile:(NSString *)source_path { //try to load resource data Handle handle; CFURLRef urlRef; SInt16 refNum; Str255 str; BOOL isDir; NSData *resourceData = nil; [[NSFileManager defaultManager] fileExistsAtPath:source_path isDirectory:&isDir]; //will this work if I don't escape out spaces? i.e. @"/Documents/Hello World" urlRef = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, (CFStringRef) source_path, kCFURLPOSIXPathStyle, isDir); if (urlRef != NULL) { FSRef fsRef; if (CFURLGetFSRef(urlRef, &fsRef)) { FSSpec spec; if(FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, &spec, NULL) == noErr) { if((refNum = FSpOpenResFile(&spec,fsRdPerm)) == -1) return nil; //load the resource data into memory //** SetResLoad(TRUE); LoadResource(handle); if(ResError() != noErr || handle == NULL) return nil; //we've got data! BlockMove(*handle, str, GetHandleSize(handle)); //is this the right length? resourceData = [[[NSData alloc] initWithBytes:str length:256] autorelease]; //DisposeHandle(handle); CloseResFile(refNum); //** } } CFRelease(urlRef); } return resourceData; } Everything is mostly the same for applying the resource fork data except for between the stars (and the method signature) - (void)applyResourceData:(NSData *)resourceData forFile:(NSString *)source_path //** const char *bytes = [resourceData bytes]; handle = NewHandle( bytes[0]+1 ); if (handle != NULL) { BlockMove( bytes, (* handle), bytes[0]+1 ); WriteResource(handle); DisposeHandle(handle); } //** Thanks a lot, Matt Fahrenbacher -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 4043 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021109/6c218243/attachment.bin From estebanuribe at mac.com Sun Nov 10 01:09:04 2002 From: estebanuribe at mac.com (Esteban Uribe) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <779AA008-F47B-11D6-95C8-00039340986C@mac.com> Message-ID: <085A277A-F48C-11D6-B191-003065AA3CCE@mac.com> Hi Matthew, I'm a little out of practice with my carbon skills but I'll make some observations :) On Saturday, November 9, 2002, at 11:10 PM, Matthew Fahrenbacher wrote: > //load the resource data into memory > //** > SetResLoad(TRUE); > LoadResource(handle); > > if(ResError() != noErr || handle == NULL) > return nil; > > //we've got data! > BlockMove(*handle, str, GetHandleSize(handle)); > //is this the right length? > resourceData = [[[NSData alloc] initWithBytes:str > length:256] autorelease]; > > //DisposeHandle(handle); > CloseResFile(refNum); > //** First the Resource Manager handles writing individual resources into the resource fork of a file. With this in mind, LoadResource will load the individual resource into memory for that resource's handle (which you can get from calling a function like Get1IndResource) http://developer.apple.com/techpubs/mac/MoreToolbox/MoreToolbox-56.html So in other words LoadResource will load one resource in the resource fork, and not the whole resource fork. So you're passing an empty Handle to LoadResource when its expecting a Handle to a resource. If you want to do a block read/write the resource fork I believe you can use FSOpenFork or FSpOpenRF along with FSRead and FSWrite. (Check File Manager documentation http://developer.apple.com/techpubs/mac/Files/Files-72.html) Also when you are writing the file and resource fork back make sure you create the resource fork. If i remember correctly FSpOpenRF does not automatically create the resource fork for you. You can however create one with the Resource Manager. I've never had the pleasure of writing and reading the whole resource fork. I've always found it more useful to read and write each individual resource out of and into the resource fork. You can check out my sample CICN Icon Reader class which converts a CICN resource into an NSImage at http://homepage.mac.com/estebanuribe/CIconViewer.tgz It contains sample code that shows how to read a resource fork one resource at a time. Unfortunately, I haven't gotten around to properly documenting the sample code, but if you have a question on the sample code just ask me. > > Everything is mostly the same for applying the resource fork data > except for between the stars (and the method signature) > > - (void)applyResourceData:(NSData *)resourceData forFile:(NSString > *)source_path > //** > const char *bytes = [resourceData bytes]; > > handle = NewHandle( bytes[0]+1 ); > if (handle != NULL) > { > BlockMove( bytes, (* handle), bytes[0]+1 ); > WriteResource(handle); > DisposeHandle(handle); > } > //** > > > Thanks a lot, > Matt Fahrenbacher In this snippet, I would use PtrToXHand to create a Handle from the bytes ptr So you could do something like: err = PtrToXHand([resourceData bytes], handle, [resourceData length]); Also, note that bytes[0] may not necessarily contain the total length of the char stream. You may want to take a close look at the structure of the Resource Map to determine if bytes[0] would indeed contain the total size of the resource fork/data. It probably doesn't because then the maximum resource fork/data size would be like 255 bytes. So its best to use the length provided by resourceData (of type NSData) in this case. I hope this helped. -Esteban -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 4463 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021110/21590501/attachment.bin From estebanuribe at mac.com Sun Nov 10 01:16:02 2002 From: estebanuribe at mac.com (Esteban Uribe) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <085A277A-F48C-11D6-B191-003065AA3CCE@mac.com> Message-ID: Doh just a quick correction > First the Resource Manager handles writing individual resources into > the resource fork of a file. Should read: "The Resource Manager handles reading/writing individual resources into the resource fork of a file." Everything else follows the same, sorry for the typo. -Esteban From jmdisher at student.math.uwaterloo.ca Sun Nov 10 01:56:01 2002 From: jmdisher at student.math.uwaterloo.ca (Jeff Disher) Date: Thu Nov 3 14:50:22 2005 Subject: Odd Dragging Source Problem Message-ID: Hello, I have just been refactoring some of my old code and came across a strange error. I used to have an NSImageView that held some image (in nonplanar form) and I had implemented the NSDraggingSource protocol and it seemed to behave as expected. My recent change involved migrating to a planar TIFF layout for my internal storage of images. Everything renders correctly in the view given that the images are now planar but for some reason dragging now fails. I tracked the problem to the call of "dragImage:at:offset:event:pasteboard:source:slideBack:" and here is the error I am getting: "Error setting image for drag: -108" and on the next line: "Could not create CoreDragImageSpec from NSImage" Can anyone tell me what that error means? Are their any known issues with using planar images for dragging images or have I just made a mistake somewhere when migrating my code? I will keep looking into it but I am kind of stumped. Thanks in advance, Jeff Disher President and Lead Developer of Spectral Class Spectral Class: Shedding Light on Innovation http://www.spectralclass.com/ From adrian at mindjar.com Sun Nov 10 02:22:04 2002 From: adrian at mindjar.com (Adrian) Date: Thu Nov 3 14:50:22 2005 Subject: setKeyEquivalent issue Message-ID: <296AA906-F496-11D6-809B-000393B89720@mindjar.com> Hi guys, I was wondering if you could help me. I have set some of my NSButtons key equivalents to arrow keys like so: unichar left = NSLeftArrowFunctionKey; [_rewind setKeyEquivalent:[NSString stringWithCharacters:&left length:1]]; Which works but instead sends 2 action messages. If I set the key equivalents to anything else with this method it works fine and sends the 1 action message as it should. So what am I missing here? Thanks for your help. Adrian DeWitts From marcel at metaobject.com Sun Nov 10 15:35:15 2002 From: marcel at metaobject.com (Marcel Weiher) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <779AA008-F47B-11D6-95C8-00039340986C@mac.com> Message-ID: <47083511-F4F3-11D6-A568-00039366F3C0@metaobject.com> On Sunday, November 10, 2002, at 08:10 Uhr, Matthew Fahrenbacher wrote: > I was working on a project where I can distribute files at certain > times, but I'm running into a little snag. It's painfully easy to use > NSData to archive a files data and keep its attributes in an > NSDictionary to be applied later. The trick is to be able to maintain > the resource fork data as well. Here's my attempt at doing it, and I > was wondering if anyone could help point out what I'm doing wrong (I'm > not very good with the Carbon APIs). How about just using the fact that the resource fork can be accessed via /rsrc ? This is untested (and typed straight into Mail), but I think it should work, if you really want just the raw bytes. -------- snip --- @implementation NSData(resourceIO) +(NSData*)dataWithContentsOfResourceForkOfFile:(NSString*)path { return [self dataWithContentsOfFile:[path stringByAppendingString:@"/rsrc"]]; } -(void)writeToResourceForkOfFile:(NSString*)path { [self writeToFile: path stringByAppendingString:@"/rsrc"] atomically:NO]; } @end ---- snip ------- Note 1: Not using "stringByAppendingPathComponent" because I think that is too smart about path-components. Note 2: Using atomically:NO because YES would probably create a new file, if it worked at all Marcel -- Marcel Weiher Metaobject Software Technologies marcel@metaobject.com www.metaobject.com Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc. From jim.kitchen at shaw.ca Sun Nov 10 15:36:00 2002 From: jim.kitchen at shaw.ca (jim kitchen) Date: Thu Nov 3 14:50:22 2005 Subject: Dictionary Keys and Values Message-ID: <90F59EB3-F4E1-11D6-9EFE-003065B21F64@shaw.ca> I am curious to know, if it is possible to store values that are normally associated with a dictionary key, in a separate editable tableView array? I am currently working on an application that displays a panel, activated by the user from the main application. This panel displays several textFields which are populated with individual values for a specific dictionary key. The user is able edit and save these values in the static list. I realize now, that my static list of editable textFields is extremely limited. The user would be better served if the values associated with the dictionary key, were displayed in an editable tableView array. Would anyone be able to point me in the right direction, to find information on changing the editable textFields into an editable array? Thank you in a advance, jim k From eyredler at netvision.net.il Sun Nov 10 15:37:38 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:22 2005 Subject: What is the equivalent of WaitMouseMoved in Cocoa? Message-ID: <0E01FF6C-F4DE-11D6-946C-003065C9C4EE@netvision.net.il> Hi Everybody, What is the equivalent of Carbons' WaitMouseMoved in Cocoa? If it there's none, how long should I wait to determine whether a mouse click is a drag or a selection? Thanks, Eyal Redler =================================================== RedleX Software for what's left of us www.redlers.com =================================================== From fahrenba at mac.com Sun Nov 10 15:40:27 2002 From: fahrenba at mac.com (Matthew Fahrenbacher) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <47083511-F4F3-11D6-A568-00039366F3C0@metaobject.com> Message-ID: <613964D6-F4FF-11D6-95C8-00039340986C@mac.com> On Sunday, November 10, 2002, at 03:27 PM, Marcel Weiher wrote: > > On Sunday, November 10, 2002, at 08:10 Uhr, Matthew Fahrenbacher > wrote: > >> I was working on a project where I can distribute files at certain >> times, but I'm running into a little snag. It's painfully easy to >> use NSData to archive a files data and keep its attributes in an >> NSDictionary to be applied later. The trick is to be able to >> maintain the resource fork data as well. Here's my attempt at doing >> it, and I was wondering if anyone could help point out what I'm doing >> wrong (I'm not very good with the Carbon APIs). > > How about just using the fact that the resource fork can be accessed > via /rsrc ? > > This is untested (and typed straight into Mail), but I think it should > work, if you really want just the raw bytes. > > -------- snip --- > > @implementation NSData(resourceIO) > > +(NSData*)dataWithContentsOfResourceForkOfFile:(NSString*)path > { > return [self dataWithContentsOfFile:[path > stringByAppendingString:@"/rsrc"]]; > } > > -(void)writeToResourceForkOfFile:(NSString*)path > { > [self writeToFile: path stringByAppendingString:@"/rsrc"] > atomically:NO]; > } > > @end > > ---- snip ------- I had read somewhere saying that would work, but it doesn't seem to work for me. Is there another way to access this data? I tried doing this: FSRef ref; FSSpec spec; HFSUniStr255 forkName; SInt16 refNum; SInt64 forkSize; void *buffer; if(FSPathMakeRef((const unsigned char *)[source_path fileSystemRepresentation], &ref, NULL) == -1) return; if(FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, &spec, NULL) != noErr) return; if(FSGetResourceForkName(&forkName) != noErr) return; if(FSOpenFork(&ref,forkName.length,forkName.unicode,fsRdPerm,&refNum) != noErr) return; if(FSGetForkSize(refNum,&forkSize) != noErr) { FSCloseFork(refNum); return; } buffer = malloc(forkSize); if(FSReadFork(refNum,fsAtMark,0,forkSize,buffer,NULL) != noErr) { FSCloseFork(refNum); free(buffer); return; } resourceData = [[NSData alloc] initWithBytes:buffer length:forkSize]; free(buffer); FSCloseFork(refNum); but I don't seem to be getting all the data. I get more of it than with trying the /rsrc thing (where I get nothing). Am I not malloc'ing the buffer large enough or something? Thanks, Matt -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2743 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021110/ccf86c7e/attachment.bin From marcel at metaobject.com Sun Nov 10 16:00:05 2002 From: marcel at metaobject.com (Marcel Weiher) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <613964D6-F4FF-11D6-95C8-00039340986C@mac.com> Message-ID: <172990A4-F508-11D6-A568-00039366F3C0@metaobject.com> On Sunday, November 10, 2002, at 11:54 Uhr, Matthew Fahrenbacher wrote: > On Sunday, November 10, 2002, at 03:27 PM, Marcel Weiher wrote: > >> >> On Sunday, November 10, 2002, at 08:10 Uhr, Matthew Fahrenbacher >> wrote: >> >>> I was working on a project where I can distribute files at certain >>> times, but I'm running into a little snag. It's painfully easy to >>> use NSData to archive a files data and keep its attributes in an >>> NSDictionary to be applied later. The trick is to be able to >>> maintain the resource fork data as well. Here's my attempt at doing >>> it, and I was wondering if anyone could help point out what I'm >>> doing wrong (I'm not very good with the Carbon APIs). >> >> How about just using the fact that the resource fork can be accessed >> via /rsrc ? >> >> This is untested (and typed straight into Mail), but I think it >> should work, if you really want just the raw bytes. >> >> -------- snip --- >> >> @implementation NSData(resourceIO) >> >> +(NSData*)dataWithContentsOfResourceForkOfFile:(NSString*)path >> { >> return [self dataWithContentsOfFile:[path >> stringByAppendingString:@"/rsrc"]]; >> } >> >> -(void)writeToResourceForkOfFile:(NSString*)path >> { >> [self writeToFile: path stringByAppendingString:@"/rsrc"] >> atomically:NO]; >> } >> >> @end >> >> ---- snip ------- > > I had read somewhere saying that would work, but it doesn't seem to > work for me. I just tried it out and it works fine for me (on an HFS+ filesystem, it won't work on UFS). Marcel -- Marcel Weiher Metaobject Software Technologies marcel@metaobject.com www.metaobject.com Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc. From dreamless at attbi.com Sun Nov 10 16:52:02 2002 From: dreamless at attbi.com (Nick Zitzmann) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <47083511-F4F3-11D6-A568-00039366F3C0@metaobject.com> Message-ID: <9277256E-F50F-11D6-852C-0050E410B21A@attbi.com> On Sunday, November 10, 2002, at 01:27 PM, Marcel Weiher wrote: > How about just using the fact that the resource fork can be accessed > via /rsrc ? That won't work on non-HFS file systems. On other file systems, such as UFS, you need to search for ._ instead. Nick Zitzmann AIM/iChat: dragonsdontsleep Check out my software page: http://dreamless.home.attbi.com/ "La la la! I sing, too! For food, for food! La la la!" - Gabo, Dragon Warrior VII From fahrenba at mac.com Sun Nov 10 17:09:01 2002 From: fahrenba at mac.com (Matthew Fahrenbacher) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <172990A4-F508-11D6-A568-00039366F3C0@metaobject.com> Message-ID: <24507784-F512-11D6-95C8-00039340986C@mac.com> On Sunday, November 10, 2002, at 05:56 PM, Marcel Weiher wrote: > > On Sunday, November 10, 2002, at 11:54 Uhr, Matthew Fahrenbacher > wrote: > >> On Sunday, November 10, 2002, at 03:27 PM, Marcel Weiher wrote: >> >>> >>> On Sunday, November 10, 2002, at 08:10 Uhr, Matthew Fahrenbacher >>> wrote: >>> >>>> I was working on a project where I can distribute files at certain >>>> times, but I'm running into a little snag. It's painfully easy to >>>> use NSData to archive a files data and keep its attributes in an >>>> NSDictionary to be applied later. The trick is to be able to >>>> maintain the resource fork data as well. Here's my attempt at >>>> doing it, and I was wondering if anyone could help point out what >>>> I'm doing wrong (I'm not very good with the Carbon APIs). >>> >>> How about just using the fact that the resource fork can be accessed >>> via /rsrc ? >>> >>> This is untested (and typed straight into Mail), but I think it >>> should work, if you really want just the raw bytes. >>> >>> -------- snip --- >>> >>> @implementation NSData(resourceIO) >>> >>> +(NSData*)dataWithContentsOfResourceForkOfFile:(NSString*)path >>> { >>> return [self dataWithContentsOfFile:[path >>> stringByAppendingString:@"/rsrc"]]; >>> } >>> >>> -(void)writeToResourceForkOfFile:(NSString*)path >>> { >>> [self writeToFile: path stringByAppendingString:@"/rsrc"] >>> atomically:NO]; >>> } >>> >>> @end >>> >>> ---- snip ------- >> >> I had read somewhere saying that would work, but it doesn't seem to >> work for me. > > I just tried it out and it works fine for me (on an HFS+ filesystem, > it won't work on UFS). > Writing out and reading in? I've gotten reading resources in, but I can't successfully write them out. My guess is that writeToFile:atomically: checks to see if the file is a directory (which it isn't) and so it returns false. Is there a way around this? Thanks, Matt From andreas at harmless.de Sun Nov 10 18:54:01 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:22 2005 Subject: Dictionary Keys and Values In-Reply-To: <90F59EB3-F4E1-11D6-9EFE-003065B21F64@shaw.ca> Message-ID: Am Sonntag, 10.11.02 um 20:21 Uhr schrieb jim kitchen: > The user would be better served if the values associated with the > dictionary key, were displayed in an editable tableView array. There is no such thing as a table view array. > Would anyone be able to point me in the right direction, to find > information on changing the editable textFields into an editable > array? What about ? bye. Andreas. From azarhi at mac.com Sun Nov 10 19:04:00 2002 From: azarhi at mac.com (Azarhi) Date: Thu Nov 3 14:50:22 2005 Subject: Memory Question Message-ID: <0903B691-F522-11D6-B621-0003930ECD96@mac.com> I have a, hopefully simple question on NSMutableArrays and Dictionaries. Here is a quick structure of my data... ... <------ This one here ... ... The array pointed at above contains NSStrings and I mutableCopy it to a class variable to modify it and use it in a tableview. When all is done I "setObjectForKey:..." on it to put the new copy back into the NSDictionary it came out of. So my question is this, am I going about this the wrong way and creating a memory leak or is the object that is that slot autoreleased when I put a new copy in? I am not having problems with this working in my program, I just want to be sure I'm not creating myself a headache later down the line. If what I have read in books and apple's documentation is understood correctly, I am not doing a bad thing here. But would like the experts opinion on this one. Thanks for any and all help. Jon From seth at freaksw.com Sun Nov 10 19:14:01 2002 From: seth at freaksw.com (Seth Willits) Date: Thu Nov 3 14:50:22 2005 Subject: General Cocoa Question Message-ID: Let's suppose I'm writing a document based application. I have a class which represents a document, and that class is responsible for creating and destroying the document window and all data associated with that document. Does Cocoa offer anything to aid with handling those objects? I pretty much know nothing about Cocoa, so I appologize if this is an odd question. Thanks, Seth Willits --------------------------------------------------------------------------- President and Head Developer of Freak Software - http://www.freaksw.com Q&A Columnist for REALbasic Developer Magazine - http://www.rbdeveloper.com "Black holes are where God divided by zero." -- Steven Wright --------------------------------------------------------------------------- From andreas at harmless.de Sun Nov 10 19:36:01 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:22 2005 Subject: General Cocoa Question In-Reply-To: Message-ID: Am Montag, 11.11.02 um 04:12 Uhr schrieb Seth Willits: > Does Cocoa offer anything to aid with handling those objects? http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ ProgrammingTopics/Documents/index.html > I pretty much know nothing about Cocoa, Buy a book and/or read the documentation at http://developer.apple.com/ bye. Andreas. From andreas at harmless.de Sun Nov 10 19:39:01 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:22 2005 Subject: Memory Question In-Reply-To: <0903B691-F522-11D6-B621-0003930ECD96@mac.com> Message-ID: Am Montag, 11.11.02 um 04:02 Uhr schrieb Azarhi: > So my question is this, am I going about this the wrong way and > creating a memory leak or is the object that is that slot autoreleased > when I put a new copy in? If you are replacing a object inside a container like NSMutableArray or NSMutableDictionary, the old object is released by the container object. This is nothing special. The container retains the object, so it has to release it if it's done with it. Your responsibilty is to release the object after putting it in the container (if you don't need it any more, of course). bye. Andreas. From oogje at mac.com Sun Nov 10 20:25:02 2002 From: oogje at mac.com (Brian Redman) Date: Thu Nov 3 14:50:22 2005 Subject: new bug reporter site Message-ID: <74BBFF33-F52D-11D6-A651-00039367011A@mac.com> If there was a mention in the ADC newsletter I must have skipped over it. What happened to the aardvark? And the problem count in the "Originated Problems" page? And the color scheme? The site seems subtly harsher. ber From dunham at mac.com Sun Nov 10 20:30:02 2002 From: dunham at mac.com (David Dunham) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <9277256E-F50F-11D6-852C-0050E410B21A@attbi.com> Message-ID: <57C2E352-F52E-11D6-AD46-003065C13422@mac.com> On Sunday, Nov 10, 2002, at 16:50 US/Pacific, Nick Zitzmann wrote: >> How about just using the fact that the resource fork can be accessed >> via /rsrc ? > > That won't work on non-HFS file systems. On other file systems, such > as UFS, you need to search for ._ instead. ._ isn't necessarily the resource fork -- doesn't it contain other metadata as well? David Dunham A Sharp david@a-sharp.com Voice/Fax: 206 783 7404 http://a-sharp.com Efficiency is intelligent laziness. From pg at powerplum.com Sun Nov 10 23:51:02 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:22 2005 Subject: catching titlebar clicks? Message-ID: <4713FE52-F54A-11D6-A0D0-00039306ED6C@powerplum.com> How do you catch mouseDown's and mouseUp's in the **titlebar** of an NSWindow? - Philip From you at sann.ne.jp Sun Nov 10 23:55:01 2002 From: you at sann.ne.jp (Youko Nagao) Date: Thu Nov 3 14:50:22 2005 Subject: How to control PPP connection Message-ID: <200211110754.gAB7sDN11748@falcon.nag.to> Hi, I am creating a program controlling PPP connection. It uses "PPPLib". I got "PPPLib" from Cocoa Dev Central. Now, I have a following problem. Immediately after system restart, connectPPP() is work fine. But when I disconnect PPP and change location to call connectPPP() again, PPPConnect(ref, 0) returns error "ENODEV". Why? Did I forget some process? - (int)connectPPP { int ref; int result; result = PPPInit(&ref); if(result == noErr){ result = PPPConnect(ref, 0); } if(result == noErr){ result = PPPDispose(ref); } return result; } - (int)disconnectPPP { int ref; int result; result = PPPInit(&ref); if(result == noErr){ result = PPPDisconnect(ref, 0); } if(result == noErr){ result = PPPDispose(ref); } return result; } -- Youko Nagao From estebanuribe at mac.com Mon Nov 11 00:24:01 2002 From: estebanuribe at mac.com (Esteban Uribe) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <613964D6-F4FF-11D6-95C8-00039340986C@mac.com> Message-ID: Hi Matthew, On Sunday, November 10, 2002, at 02:54 PM, Matthew Fahrenbacher wrote: > if(FSGetResourceForkName(&forkName) != noErr) > return; > > > if(FSOpenFork(&ref,forkName.length,forkName.unicode,fsRdPerm,&refNum) > != noErr) > return; > > if(FSGetForkSize(refNum,&forkSize) != noErr) > { > FSCloseFork(refNum); > return; > } > > buffer = malloc(forkSize); > if(FSReadFork(refNum,fsAtMark,0,forkSize,buffer,NULL) != noErr) > { > FSCloseFork(refNum); > free(buffer); > return; > } Note that the last parameter in FSReadFork returns the actual read count. You might want to check that it is equivalent to the forkSize, if not then call FSReadFork to read the rest of the fork until you have read all of the fork. -Esteban -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 982 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021111/165992fd/attachment.bin From nathan_day at mac.com Mon Nov 11 01:06:01 2002 From: nathan_day at mac.com (Nathan Day) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <779AA008-F47B-11D6-95C8-00039340986C@mac.com> Message-ID: I have a class for reading and writing resource fork on my iTools site http://homepage.mac.com/nathan_day/pages/source.html#NDResourceFork , also there was a discussion abut using FSSpec's on the carbon mailing list and the final conclusion was to avoid them, they have some problems with HFS+'s 255 unichar file names and so can some times fail. On Sunday, November 10, 2002, at 05:40 PM, Matthew Fahrenbacher wrote: > I was working on a project where I can distribute files at certain > times, but I'm running into a little snag. It's painfully easy to use > NSData to archive a files data and keep its attributes in an > NSDictionary to be applied later. The trick is to be able to maintain > the resource fork data as well. Here's my attempt at doing it, and I > was wondering if anyone could help point out what I'm doing wrong (I'm > not very good with the Carbon APIs). > Nathan Day http://homepage.mac.com/nathan_day/ From sanguish at digifix.com Mon Nov 11 01:10:01 2002 From: sanguish at digifix.com (Scott Anguish) Date: Thu Nov 3 14:50:22 2005 Subject: General Cocoa Question In-Reply-To: Message-ID: On Sunday, November 10, 2002, at 10:12 PM, Seth Willits wrote: > Let's suppose I'm writing a document based application. I have a class > which > represents a document, and that class is responsible for creating and > destroying the document window and all data associated with that > document. > Does Cocoa offer anything to aid with handling those objects? I pretty > much > know nothing about Cocoa, so I appologize if this is an odd question. > NSDocument and it's cohorts NSDocumentController and NSWindowController are what you're referring to. have a look at http://www.stepwise.com/Articles/HTMLEditorX for an example of how to use these.. (now with CSS goodness!) From tschnitzer at t-online.de Mon Nov 11 01:32:01 2002 From: tschnitzer at t-online.de (Thomas Schnitzer) Date: Thu Nov 3 14:50:22 2005 Subject: QT: How to install a progress function Message-ID: <54341B10-F558-11D6-9E22-000393AE3644@t-online.de> Hi all, I'm using the QuickTime image importer/exporter components to convert a bunch of tiff images to the new JPEG 2000 format. This works well. The problem is, that some of the tiffs are in a 40-50 MB range and therefore the conversion can take several seconds (here, on an iMac 800 approximately 35 seconds). In order to present a progress indicator to the user, I tried to install a progress call back function, but this function never gets called. I did the following. First, my callback looks like this: OSErr Jp2kProgressProc(short theMessage, Fixed thePercentDone, long theRefCon) { NSLog( @"Jp2kProgressProc() gets called!" ); switch( theMessage ) { case codecProgressOpen: NSLog( @"open." ); break; case codecProgressUpdatePercent: NSLog( @"update. (compl = %ld)", thePercentDone ); break; case codecProgressClose: NSLog( @"close." ); break; } return noErr; } In the init method I call _imageProgressProcUPP = NewICMProgressUPP(Jp2kProgressProc); Then I obtain the graphics exporter component and install the progress function like this: GraphicsExportComponent gexp; ICMProgressProcRecord myProcRec; myProcRec.progressProc = _imageProgressProcUPP; myProcRec.progressRefCon = (long)self; cres = GraphicsExportSetProgressProc(gexp, &myProcRec); if( cres != noErr ) NSLog( @"GraphicsExportSetProgressProc() failed. (err = %ld)", cres ); This works without an error, but my progress function never gets called! Does anybody know what's wrong with this code? Thanks in advance, Thomas -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2529 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021111/dc5535b1/attachment.bin From clarkcox3 at mac.com Mon Nov 11 07:13:01 2002 From: clarkcox3 at mac.com (Clark S. Cox III) Date: Thu Nov 3 14:50:22 2005 Subject: GCC not doing the correct thing? In-Reply-To: <27FBB4DC-F570-11D6-8943-00306568B47A@bigpond.net.au> Message-ID: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 To finally put this thing to rest, I thought it a good idea to post links to the relevant sections of the comp.lang.c FAQ: http://www.eskimo.com/~scs/C-faq/q3.1.html http://www.eskimo.com/~scs/C-faq/q3.2.html http://www.eskimo.com/~scs/C-faq/q3.3.html http://www.eskimo.com/~scs/C-faq/q3.4.html - -- http://homepage.mac.com/clarkcox3/ clarkcox3@mac.com Clark S. Cox, III -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (Darwin) iEYEARECAAYFAj3PyMkACgkQd6STocYT1xXTmQCgjH1JU2UqOziz7kzlp6I9LVon TvIAoIZHhzoHFu7RI9fw7svsXGBEarY9 =Eyh0 -----END PGP SIGNATURE----- From izidor.jerebic at siol.net Mon Nov 11 07:56:01 2002 From: izidor.jerebic at siol.net (Izidor Jerebic) Date: Thu Nov 3 14:50:22 2005 Subject: Imported DeviceGray colorspace to remain DeviceGray on output? How? Message-ID: <396FA8A0-F58E-11D6-A585-003065717ABE@siol.net> Hello! Another PDF question, maybe some helpful soul can answer me... When PDF file is read by Quartz and then subsequently written out (as PDF or EPS), all images and other marks on page in DeviceGray colorspace (black&white) are written out as stuff in CIEBasedA colorspace - this causes problems since when separated (in RIP for printing) these images are not black-white, but have also other components in CMY plates beside K plate (black), due to calibration effects. I understand that it is fine to have calibrated colors, but when images and other marks are in DEVICE space, there should be an option for them to remain there, i.e. to leave them alone... Is there any flag or option when an application would prefer imported DeviceGray (or any other Device*) stuff to stay DeviceGray on output? Thanks for any hints, izidor P.S. As far as I could see from examples, DeviceCMYK stays DeviceCMYK on output, but DeviceGray is transformed into calibrated color space. I haven't played with DeviceRGB yet... From weesh at mindspring.com Mon Nov 11 10:06:01 2002 From: weesh at mindspring.com (Ken Wieschhoff) Date: Thu Nov 3 14:50:22 2005 Subject: OpenGL image drawing example Message-ID: Forgive me for asking this here, but I'm under tremendous pressure to produce something rather quickly. Can someone share some code for drawing an offscreen GWorld into an OpenGL texture using NSOpenGLView? Thanks, ->Ken -- - -- Ken Wieschhoff (770)813-0231 *************************** From ctp at apple.com Mon Nov 11 10:49:01 2002 From: ctp at apple.com (Chris Parker) Date: Thu Nov 3 14:50:22 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <57C2E352-F52E-11D6-AD46-003065C13422@mac.com> Message-ID: <295C1175-F5A6-11D6-93F3-0003931BA04A@apple.com> On Sunday, November 10, 2002, at 08:30 PM, David Dunham wrote: > On Sunday, Nov 10, 2002, at 16:50 US/Pacific, Nick Zitzmann wrote: > >>> How about just using the fact that the resource fork can be accessed >>> via /rsrc ? >> >> That won't work on non-HFS file systems. On other file systems, such >> as UFS, you need to search for ._ instead. > > ._ isn't necessarily the resource fork -- doesn't it contain > other metadata as well? It does - so if you're looking for the resource fork you can't just blindly take the ._ data from that file and put it someplace else. There's catalog info in there as well, and I believe the resource fork information isn't -quite- how you'd expect it. You should open the desired source and destination forks using FSOpenFork, read the bytes from the source fork (FSReadFork) and write them into the destination (FSWriteFork) and then close the forks. This lets the Carbon File Manager do the work, and lets the filesystem layer take care of where it's squirreled things away on non-HFS+ filesystems - and you don't have to know anything about ._ files. :) .chris -- Chris Parker Cocoa Frameworks Engineer Apple Computer, Inc. From sryu at mac.com Mon Nov 11 12:31:00 2002 From: sryu at mac.com (Seungoh Ryu) Date: Thu Nov 3 14:50:22 2005 Subject: extracting part of a PDF image In-Reply-To: <200211112001.gABK1Zf03209@slowbro.omnigroup.com> Message-ID: Does anyone know how to extract a part (say, top quarter of the entire image) of a PDF image from an NSPDFImageRep inited with content of a PDF file? Simply drawing (or compositing) part of it onto another image seems to give just a bitmap rep from the cached image and is huge in size (100s kb opposed to 10 kb of the original PDF file in entirety!) Thanks. Seungoh From andrew at zamler-carhart.com Mon Nov 11 12:36:06 2002 From: andrew at zamler-carhart.com (Andrew Zamler-Carhart) Date: Thu Nov 3 14:50:22 2005 Subject: [ANN] iConquer 1.0, a game of world conquest Message-ID: <28A54D77-F5B5-11D6-9FF8-000A277A6C34@zamler-carhart.com> Dear list, I'm pleased to announce iConquer 1.0, a new game of world conquest for Mac OS X. Thanks to everyone on this list who has helped me out over the past few months -- I couldn't have done it without you. Enjoy, Andrew ---- Kavasoft is pleased to announce the release of iConquer 1.0, a game of world conquest for 1 to 6 players designed for Mac OS X. iConquer takes full advantage of the Aqua interface and the Quartz graphics system, displaying stunning visual effects like transparency, drop shadows, and anti-aliasing. The game is played on a detailed map made from a NASA satellite photograph. iConquer allows up to 6 players to play over the Internet. iConquer can also be played against your computer, using complex artificial intelligence algorithms to simulate ferocious adversaries. An extensive help system teaches you how to play iConquer and can detect the current state of the game to display contextual advice. iConquer is fully localized in English and French. iConquer costs US$12.99, and comes with a free 7-day trial period. You can purchase iConquer using PayPal or Kagi. U.S. dollars, Canadian dollars and other currencies are accepted. KavaSoft is based in Sunnyvale, CA, and specializes in Cocoa software for Mac OS X. Website: http://www.kavasoft.com/iConquer/ Download: http://www.kavasoft.com/iConquer.dmg -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1500 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021111/b47b8671/attachment.bin From gotow at stclairsoft.com Mon Nov 11 13:54:03 2002 From: gotow at stclairsoft.com (Jon Gotow) Date: Thu Nov 3 14:50:22 2005 Subject: Getting NSWorkspace/LaunchServices to recognize new plist info In-Reply-To: <28A54D77-F5B5-11D6-9FF8-000A277A6C34@zamler-carhart.com> References: <28A54D77-F5B5-11D6-9FF8-000A277A6C34@zamler-carhart.com> Message-ID: How does one get NSWorkspace and/or LaunchServices to reload an application's info.plist dictionary before launching it? I've got a preference pane that launches a background application - the app is contained in the prefPane bundle's Resources directory. Based on a setting in the prefs, the prefPane changes the LSUIElement plist entry in the background app's bundle so that it does or doesn't show up in the Dock. After changing the plist, the prefPane kills and restarts the background app to make the new setting take effect. However, the new LSUIElement value isn't recognized unless I quit System Preferences and start it up again. I'm assuming that the old LSUIElement value is getting cached, and that the cached value doesn't get updated until my prefPane bundle is unloaded and reloaded. Is there any way to force an update of the background app's bundle info? BTW, I'm using the following code in my prefPane to modify the app's plist: NSBundle *bundle = [NSBundle bundleForClass:[self class]]; NSString *plistPath = [NSString stringWithFormat:@"%@/%@", [bundle resourcePath], appSubPath]; NSMutableDictionary *infoPlist = [NSMutableDictionary dictionaryWithContentsOfFile:plistPath]; [infoPlist setObject:[NSString stringWithFormat:@"%d",optionIsOn ? 0 : 1] forKey:@"LSUIElement"]; [infoPlist writeToFile:plistPath atomically:NO]; I've tried re-launching the background app using both LSOpenFromURLSpec() and NSWorkspace:launchApplication. Both launch my app with the old LSUIElement setting until I quit and restart System Preferences. I've tried calling NSWorkspace:noteFileSystemChanged: with the plist's path, but that hasn't helped, nor has writing the plist atomically. Can anyone point me in the right direction, or even give me some suggestions to experiment with? Thanks - Jon -- ________________________________________________________________________ Jon Gotow gotow@stclairsoft.com St. Clair Software http://www.stclairsoft.com/ Fax (540)552-5898 ftp://ftp.stclairsoft.com/ From jcr at apple.com Mon Nov 11 16:12:01 2002 From: jcr at apple.com (John C. Randolph) Date: Thu Nov 3 14:50:22 2005 Subject: What is the equivalent of WaitMouseMoved in Cocoa? In-Reply-To: <0E01FF6C-F4DE-11D6-946C-003065C9C4EE@netvision.net.il> Message-ID: <3E9294CF-F5D3-11D6-974F-003065F32C3C@apple.com> On Sunday, November 10, 2002, at 10:56 AM, Eyal Redler wrote: > Hi Everybody, > > What is the equivalent of Carbons' WaitMouseMoved in Cocoa? > If it there's none, how long should I wait to determine whether a > mouse click is a drag or a selection? One of the big shifts from Carbon to Cocoa programming is realizing how much work you don't have to do anymore ;-) Cocoa has separate event types for mouse down and mouse dragged events. See the docs on the NSResponder and NSEvent classes for the details. For an example of code that selects a portion of an image, see: http://developer.apple.com/samplecode/Sample_Code/Cocoa/ Cropped_Image.htm -jcr John C. Randolph (408) 974-8819 Sr. Cocoa Software Engineer, Apple Worldwide Developer Relations http://developer.apple.com/cocoa/index.html From pg at powerplum.com Mon Nov 11 17:48:01 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:22 2005 Subject: quicktime callbacks (and callbacks in general) Message-ID: Ok, I give up. I've been all over the Apple docs and Google and this list server's database and I can't find an example of setting up a callback and scheduling the callback in Carbon. Please reply with a simple piece of code to demonstrate. Thanks. - Philip From eyredler at netvision.net.il Mon Nov 11 19:55:01 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:22 2005 Subject: What is the equivalent of WaitMouseMoved in Cocoa? In-Reply-To: <3E9294CF-F5D3-11D6-974F-003065F32C3C@apple.com> Message-ID: <6308CDF2-F5F2-11D6-AD3B-003065C9C4EE@netvision.net.il> Thanks, I'm afraid this is not the answer I'm seeking... my mouseDown method is handling all the interaction until the user leaves the mouse button (using periodic events) This is pretty standard Cocoa AFAIK (see Handling Mouse Events in Views in the Cocoa docs for an example) What I want to do is this: (for those not familiar with WaitNextEvent): The user clicks inside the view If the click is inside the current selection I will call startPeriodicEventsAfterDelay, if it returns before the alloted time with a mouse moved event, then I'll treat this mouse-down as a new selection. If there's no mouse moved event during that time period, I will treat it as a beginning of a drag&drop session. This is what TextEdit does. Question is, how long should I wait... In Carbon, WaitMouseMoved gives this answer... And in Cocoa? Any idea? Thanks, > > On Sunday, November 10, 2002, at 10:56 AM, Eyal Redler wrote: > >> Hi Everybody, >> >> What is the equivalent of Carbons' WaitMouseMoved in Cocoa? >> If it there's none, how long should I wait to determine whether a >> mouse click is a drag or a selection? > > One of the big shifts from Carbon to Cocoa programming is realizing > how much work you don't have to do anymore ;-) > > Cocoa has separate event types for mouse down and mouse dragged > events. See the docs on the NSResponder and NSEvent classes for the > details. > > For an example of code that selects a portion of an image, see: > > http://developer.apple.com/samplecode/Sample_Code/Cocoa/ > Cropped_Image.htm > Eyal Redler From fahrenba at mac.com Mon Nov 11 20:08:01 2002 From: fahrenba at mac.com (Matthew Fahrenbacher) Date: Thu Nov 3 14:50:22 2005 Subject: What is the equivalent of WaitMouseMoved in Cocoa? Message-ID: <792738.1037073857889.JavaMail.fahrenba@mac.com> Uhmm... why not just use mouseDragged: and mouseUp:, which NSView gets from NSResponder? BOOL mouseDidDrag = NO; - (void)mouseDragged:(NSEvent *)event { mouseDidDrag = YES; //do your business when a user has begun a drag session } - (void)mouseUp:(NSEvent *)theEvent { //clicked and released if(!mouseDidDrag) { //do your click stuff } else mouseDidDrag = NO; } If you really wanted to stick to the timing, you could create an NSTimer that fires after x amount of seconds - if it fires before mouseUp gets called, then it was just a normal click, otherwise we have a drag. HTH, Matt On Monday, Nov 11, 2002, at 07:54PM, Eyal Redler wrote: >Thanks, > >I'm afraid this is not the answer I'm seeking... >my mouseDown method is handling all the interaction until the user >leaves the mouse button (using periodic events) >This is pretty standard Cocoa AFAIK (see Handling Mouse Events in Views >in the Cocoa docs for an example) > >What I want to do is this: (for those not familiar with WaitNextEvent): >The user clicks inside the view >If the click is inside the current selection I will call >startPeriodicEventsAfterDelay, if it returns before the alloted time >with a mouse moved event, then I'll treat this mouse-down as a new >selection. If there's no mouse moved event during that time period, I >will treat it as a beginning of a drag&drop session. This is what >TextEdit does. > >Question is, how long should I wait... In Carbon, WaitMouseMoved gives >this answer... And in Cocoa? > >Any idea? > >Thanks, > >> >> On Sunday, November 10, 2002, at 10:56 AM, Eyal Redler wrote: >> >>> Hi Everybody, >>> >>> What is the equivalent of Carbons' WaitMouseMoved in Cocoa? >>> If it there's none, how long should I wait to determine whether a >>> mouse click is a drag or a selection? >> >> One of the big shifts from Carbon to Cocoa programming is realizing >> how much work you don't have to do anymore ;-) >> >> Cocoa has separate event types for mouse down and mouse dragged >> events. See the docs on the NSResponder and NSEvent classes for the >> details. >> >> For an example of code that selects a portion of an image, see: >> >> http://developer.apple.com/samplecode/Sample_Code/Cocoa/ >> Cropped_Image.htm >> >Eyal Redler > >_______________________________________________ >MacOSX-dev mailing list >MacOSX-dev@omnigroup.com >http://www.omnigroup.com/mailman/listinfo/macosx-dev > > From rosyna at unsanity.com Mon Nov 11 20:26:01 2002 From: rosyna at unsanity.com (Rosyna) Date: Thu Nov 3 14:50:22 2005 Subject: [OT] Debugging loginwindow crashes Message-ID: I installed 10.2.2 on my production machine today and now I can't log into OS X because the login window crashes. The same thing happened when I upgraded to 10.2.1 and a complete reinstall fixed it, until just now. So reinstalling isn't really an option. From the crash log it appears that the login window is trying to load something but I am not sure what. Is there anyway for me to trace this down via gdb or something similar? I can gdb into the machine, just can't launch loginwindow. Any help would be much appreciated. Date/Time: 2002-11-11 21:22:44 -0700 OS Version: 10.2.2 (Build 6F21) Host: localhost Command: loginwindow PID: 685 Exception: EXC_BREAKPOINT (0x0006) Code[0]: 0x00000001Code[1]: 0x8fe01280 Thread 0 Crashed: #0 0x8fe01280 in halt #1 0x8fe0329c in load_library_image #2 0x8fe147a0 in _dyld_NSAddImage #3 0x90015d3c in NSAddImage #4 0x9082922c in _NSSoftLinkingLoadFrameworkImage #5 0x9081fe14 in _NSSoftLinkingGetFrameworkFuncPtr #6 0x9081ad08 in _NS_FSPathMakeRef #7 0x9080dfa8 in NSHFSTypeOfFile #8 0x931c092c in -[NSImage _expandRep:] #9 0x931bce2c in -[NSImage _expand] #10 0x931bea7c in -[NSImage size] #11 0x931c6b70 in -[NSImageCell drawInteriorWithFrame:inView:] #12 0x931c72e0 in -[NSImageCell drawWithFrame:inView:] #13 0x9315c564 in -[NSControl drawRect:] #14 0x0032df78 in -[BezelView drawRect:] #15 0x9335b6c4 in -[NSView _drawRect:clip:] #16 0x9335bad4 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] #17 0x9335bc5c in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] #18 0x9335bc5c in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] #19 0x9335bd20 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisi bleRect:rectIsVisibleRectForView:topView:] #20 0x932349c0 in -[NSNextStepFrame _recursiveDisplayRectIfNeededIgnoringOpaci ty:isVisibleRect:rectIsVisibleRectForView:topView:] #21 0x9335c314 in -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVis ibleRectForView:] #22 0x9335cef8 in -[NSView displayIfNeeded] #23 0x9336a188 in -[NSWindow displayIfNeeded] #24 0x93369e8c in _handleWindowNeedsDisplay #25 0x90148b1c in __CFRunLoopDoObservers #26 0x90148e8c in __CFRunLoopRun #27 0x9018157c in CFRunLoopRunSpecific #28 0x92ba34cc in RunCurrentEventLoopInMode #29 0x92bb326c in ReceiveNextEventCommon #30 0x92bda280 in BlockUntilNextEventMatchingListInMode #31 0x93082184 in _DPSNextEvent #32 0x930ccf84 in -[NSApplication nextEventMatchingMask:untilDate:inMode:deque ue:] #33 0x930ca500 in -[NSApplication run] #34 0x00006b10 in 0x6b10 #35 0x00004b34 in 0x4b34 #36 0x000049b4 in 0x49b4 Thread 1: #0 0x90074208 in mach_msg_trap #1 0x90006550 in mach_msg #2 0x901490a8 in __CFRunLoopRun #3 0x9018157c in CFRunLoopRunSpecific #4 0x907f5a0c in -[NSRunLoop runMode:beforeDate:] #5 0x90809244 in -[NSRunLoop run] #6 0x0032a194 in -[BezelServicesTask cgsListen:] #7 0x9081cd38 in forkThreadForFunction #8 0x90021308 in _pthread_body Thread 2: #0 0x90074208 in mach_msg_trap #1 0x90006550 in mach_msg #2 0x92448fec in ucsp_client_authorizationCopyRights(unsigned, unsigned, long *, Security::SecurityServer::AuthorizationBlob, AuthorizationItemSet*, unsigned, AuthorizationItemSet*, unsigned long, AuthorizationItemSet*, unsigned, Authoriz ationItemSet*, AuthorizationItemSet**, unsigned*, AuthorizationItemSet**) #3 0x92448e18 in Security::SecurityServer::ClientSession::authCopyRights(Secu rity::SecurityServer::AuthorizationBlob const&, AuthorizationItemSet const*, Aut horizationItemSet const*, unsigned long, AuthorizationItemSet**) #4 0x92448be8 in AuthorizationCopyRights #5 0x00008e34 in 0x8e34 #6 0x00011648 in 0x11648 #7 0x9081cd38 in forkThreadForFunction #8 0x90021308 in _pthread_body PPC Thread State: srr0: 0x8fe01280 srr1: 0x0202f030 vrsave: 0x00000000 xer: 0x20000000 lr: 0x8fe0a064 ctr: 0x8fe28f78 mq: 0x00000000 r0: 0x00000004 r1: 0xbfffdd80 r2: 0x84004280 r3: 0x000000e7 r4: 0x00000000 r5: 0x000000e7 r6: 0x0000290a r7: 0x726e6f20 r8: 0x66696c65 r9: 0x00000000 r10: 0xbfffdafb r11: 0x00000026 r12: 0x8fe71b0f r13: 0x00000000 r14: 0x00000000 r15: 0x00000001 r16: 0x00000000 r17: 0xbffff7e0 r18: 0x00000000 r19: 0x00000001 r20: 0x000d11d0 r21: 0x00000000 r22: 0x000982b0 r23: 0x00000000 r24: 0xbfffdf70 r25: 0x002f3ae0 r26: 0x00000002 r27: 0x00000000 r28: 0x000982b0 r29: 0x00000000 r30: 0x8fe484d8 r31: 0x8fe09ecc -- Sincerely, Rosyna Keller Technical Support/Holy Knight/Always needs a hug Unsanity: Unsane Tools for Insanely Great People --- Please include any previous correspondence in replies, it helps me remember what we were talking about. Thanks. From jcr at apple.com Mon Nov 11 20:30:01 2002 From: jcr at apple.com (John C. Randolph) Date: Thu Nov 3 14:50:22 2005 Subject: What is the equivalent of WaitMouseMoved in Cocoa? In-Reply-To: <6308CDF2-F5F2-11D6-AD3B-003065C9C4EE@netvision.net.il> Message-ID: <60064AB8-F5F7-11D6-974F-003065F32C3C@apple.com> On Monday, November 11, 2002, at 07:54 PM, Eyal Redler wrote: > Thanks, > > I'm afraid this is not the answer I'm seeking... > my mouseDown method is handling all the interaction until the user > leaves the mouse button (using periodic events) > This is pretty standard Cocoa AFAIK (see Handling Mouse Events in > Views in the Cocoa docs for an example) Actually, while we do allow it, grabbing the whole event loop is rather poor practice in a Cocoa app and if there are examples of doing so in our documentation, then I need to file a bug against the doc. > What I want to do is this: (for those not familiar with WaitNextEvent): > The user clicks inside the view > If the click is inside the current selection I will call > startPeriodicEventsAfterDelay, if it returns before the alloted time > with a mouse moved event, then I'll treat this mouse-down as a new > selection. If there's no mouse moved event during that time period, I > will treat it as a beginning of a drag&drop session. This is what > TextEdit does. > > Question is, how long should I wait... In Carbon, WaitMouseMoved gives > this answer... And in Cocoa? I would do what you're describing with a one-shot NSTimer that tells you your waiting time has expired. Eg: - (void) mouseDown:(NSEvent *) theEvent { timeout = NO; // timeout is an ivar // take notice of location, etc. [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:0.1] // One-tenth of a second interval:0 target:self selector:@selector(timeOut) userInfo:nil repeats:NO]; // whatever else you want to do in -mouseDown: } - (void) timeOut { timeout = YES; } - (void) mouseDragged: (NSEvent *) theEvent { if (timeout) // we're dragging else // start a new selection } HTH, -jcr John C. Randolph (408) 974-8819 Sr. Cocoa Software Engineer, Apple Worldwide Developer Relations http://developer.apple.com/cocoa/index.html From dwelton at bellsouth.net Mon Nov 11 20:37:01 2002 From: dwelton at bellsouth.net (Douglas A. Welton) Date: Thu Nov 3 14:50:22 2005 Subject: quicktime callbacks (and callbacks in general) In-Reply-To: Message-ID: Check out the sample code for SimpleCocoaMovie at the ADC site. The code features a simple callback that should be enough to get you started. later, douglas on 11/11/02 8:47 PM, Philip George at pg@powerplum.com wrote: > Ok, I give up. I've been all over the Apple docs and Google and this > list server's database and I can't find an example of setting up a > callback and scheduling the callback in Carbon. > > Please reply with a simple piece of code to demonstrate. > > Thanks. > > - Philip > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From eyredler at netvision.net.il Mon Nov 11 21:05:03 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:22 2005 Subject: What is the equivalent of WaitMouseMoved in Cocoa? In-Reply-To: <60064AB8-F5F7-11D6-974F-003065F32C3C@apple.com> Message-ID: <2A0C4CBD-F5FC-11D6-AD3B-003065C9C4EE@netvision.net.il> Hi, >> I'm afraid this is not the answer I'm seeking... >> my mouseDown method is handling all the interaction until the user >> leaves the mouse button (using periodic events) >> This is pretty standard Cocoa AFAIK (see Handling Mouse Events in >> Views in the Cocoa docs for an example) > > Actually, while we do allow it, grabbing the whole event loop is > rather poor practice in a Cocoa app and if there are examples of doing > so in our documentation, then I need to file a bug against the doc. In fact, that only example for mouseDown is this one... (there's no mouseDown, mouseMoved, mouseUp example) Actually, if I remember correctly, I was doing my mouse handling with mouseDown, mouseDragged etc. but I switched to the "do it all in mouseDown" method because I needed an autoscroll to happen even if the user is not moving the mouse. Maybe Apple should add a "mouseHeld" message? Above all, I feel it's much easier since I don't have to keep the interaction state in my view, I just use local variables. I wonder what's so "bad" about it. It's not as if I'm halting the system like in the old days. >> Question is, how long should I wait... In Carbon, WaitMouseMoved >> gives this answer... And in Cocoa? > > I would do what you're describing with a one-shot NSTimer that tells > you your waiting time has expired. > Thanks, the technique is not the problem, I just needed the value for the timer (or periodic event) I thought that there was some system standard for this (like the blinker timer in Classic and etc.) I guess I'll have to "invent" some suitable value... Eyal From demarco at apple.com Mon Nov 11 21:26:01 2002 From: demarco at apple.com (Vince DeMarco) Date: Thu Nov 3 14:50:22 2005 Subject: quicktime callbacks (and callbacks in general) In-Reply-To: Message-ID: <244BE4F0-F5FF-11D6-AB96-0003930FDF98@apple.com> There is also a sample on your machine check out /Developer/Examples/InterfaceBuilder/bMoviePalette vince On Monday, November 11, 2002, at 08:33 PM, Douglas A. Welton wrote: > Check out the sample code for SimpleCocoaMovie at the ADC site. The > code > features a simple callback that should be enough to get you started. > > later, > > douglas > > on 11/11/02 8:47 PM, Philip George at pg@powerplum.com wrote: > >> Ok, I give up. I've been all over the Apple docs and Google and this >> list server's database and I can't find an example of setting up a >> callback and scheduling the callback in Carbon. >> >> Please reply with a simple piece of code to demonstrate. >> >> Thanks. >> >> - Philip >> >> _______________________________________________ >> 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 izidor.jerebic at siol.net Tue Nov 12 01:51:01 2002 From: izidor.jerebic at siol.net (Izidor Jerebic) Date: Thu Nov 3 14:50:22 2005 Subject: Editing huge text files in NSTextView Message-ID: <63846DCC-F624-11D6-9B0B-003065717ABE@siol.net> Hello! I have come across some large text (ASCII) files, which I would like to view, search and maybe change... I have tried to load one of them (40MB) into TextEdit, and on my Cube with 512MB RAM it did not work well - as soon as I wanted to search or go to the end of file, TextEdit stoppped responding. So I went to Terminal and vi and it worked... Now, since TextEdit is using NSText mechanisms, I was wondering if there is possible to configure NSTextView and friends to edit such large text files (maybe with some programmatic options set for speedup). If there is such a way, I could write a simple app myself to work with large files (or even better modify the TextEdit source and recompile it)... Any ideas? izidor From devdrvr at davis.com Tue Nov 12 03:31:00 2002 From: devdrvr at davis.com (devdrvr.net Multi-Platform SW) Date: Thu Nov 3 14:50:22 2005 Subject: ShowWindow() Not Displaying Consistently In-Reply-To: Message-ID: Found the answer to my own question regarding the below Carbon post, 11/9/02. I see why no one else got back to me. Thought I'd share in case anyone else runs into something similar. What is wrong with the below is calls like SetPortWindowPort are not thread safe. I mention below that there are 26 MacOS X threads running for this movie editing application as the main window comes up when the Draw() fragment blits to the pixmap. Sporadic behavior ensues while drawing so spot rects don't get filled. My window not appearing sometimes is due to NewCWindow and CreateNewWindow not being thread safe. And I thought about making my window from a nib as as the answer (to the latter) with Cocoa but CreateWindowFromNIB is not thread safe either. The correct answer for C++ X threads is a mutex that lets no threads lock while my non-thread safe calls gets done, then free the reservation object. I'm working on putting that into the code. In the meantime I've found workarounds that make both cases work so we can give a solid demo of the whole thing running Fri. --Perry ======== 01 (530) 400-5692 [Davis, CA USA] mailto:perry_gregg@post.harvard.edu http://www.devdrvr.net/PerryCard.html ftp://www.devdrvr.net/ On 11/9/02 6:29 PM, "devdrvr.net Multi-Platform SW" wrote: > My Show() looks like the following: > ... > SelectWindow(fWindowRef); > ShowWindow(fWindowRef); > SetPortWindowPort(fWindowRef); > > Got a digital movie editing app project I'm working on and we're getting > close to alpha. There is a weird Carbon (probably my code) drawing bug with > my main window. It is based on a new GWorld offscreen pixmap that I doctor > up for the effects and funky buttons. My problem is that the window > sometimes doesn't fully draw. Sometimes it does draw on 1st launch and > other times different random parts don't get updated. These parts tend to > be in the bottom half of the window. > > Draw(): > ... > if (fWindowRef && fGWorld) > { > GetPort(&pCGrafSave); > SetPortWindowPort(fWindowRef); > > src.left = rect.left; > src.top = rect.top; > src.right = rect.right; > src.bottom = rect.bottom; > > if (LockPixels(GetGWorldPixMap(fGWorld))) { > if (GetPortBitMapForCopyBits(GetWindowPort(fWindowRef))) > ::CopyBits (GetPortBitMapForCopyBits(fGWorld), > GetPortBitMapForCopyBits(GetWindowPort(fWindowRef)), > &src, > &src, > srcCopy+ditherCopy, > nil); > UnlockPixels(GetGWorldPixMap(fGWorld)); > } > SetPort(pCGrafSave); > } > > For alpha is there some way that I'm not thinking of to force the window to > completely re-draw. I've tried inval rect of the entire window bounds and > that doesn't always work. Maybe it is my event loop locally. Because if I > move something over the window and then away that area updates fine. So my > CopyBits of the GWorld is probably correct. Also I draw 3 other simpler > windows based on the same exact code and they never seem to have a problem. > Is there a WindowServer-ism I'm missing? Of course this app is kind of > complicated with 26 C++ spawned threads running at the same time so it is > quite possibly some other interaction bug I need to figure out between the > threads. But at the point of failure I don't have any effects running and a > movie is not loaded it is just an interesting looking offscreen GWorld > pixmap blit-ted to the window real estate (with another set of code that > maps controls over the images). > > --Perry From mark at lilback.com Tue Nov 12 04:40:01 2002 From: mark at lilback.com (Mark J. Lilback) Date: Thu Nov 3 14:50:22 2005 Subject: textStorage editedRange problem Message-ID: I've got a NSTextView delegate that is implementing textDidChange:. When I type an initial character into the field, textDidChange gets called like it should. However, the [storage editedMask] is always zero, and the editedRange.location is always 2147483647. Any ideas what's going on here? Is there something special I need to configure to get the real range that was changed? I'm doing syntax coloring via temporary attributes in the layoutManager. Should I be listening for textView:shouldChangeTextInRange:replacementString: instead? I was trying to use textDidChange: so that I don't have to muck with merging the current string and the replacementString to get a substring to pass to my tokenizer. Thanks. -- __________________________________________________________________________ "They that can give up essential liberty Mark J. Lilback to obtain a little temporary safety deserve neither liberty or safety." http://www.lilback.com/ -- Benjamin Franklin From geniusj at bluenugget.net Tue Nov 12 07:22:01 2002 From: geniusj at bluenugget.net (Jason DiCioccio) Date: Thu Nov 3 14:50:22 2005 Subject: Very strange crash when clicking on menu bar. Message-ID: <2147483647.1037096477@[10.0.0.2]> Well.. I thought I had gotten the whole nib loading/nib freeing thing working with an NSWindowController object . . I have a few methods that I am currently for this: In my main application controller: - (IBAction)showHostConfig:(id)sender { if ([self hostConfigController] == nil) { /* HostConfigController is a child class of NSWindowController */ hostConfigController = [[HostConfigController alloc] initWithWindowNibName:@"Preferences"]; [hostConfigController setODSController:self]; [self setHostConfigController:hostConfigController]; } [hostConfigController showWindow:self]; } In HostConfigController: - (void)dealloc { [tableData release]; [controller setHostConfigController:nil]; [controller release]; [self setODSController:nil]; NSLog(@"HostConfigController deallocated"); [super dealloc]; } - (void)windowWillClose:(NSNotification *)aNotification { [controller setHostConfigController:nil]; [self autorelease]; } Now all of this seems to work. I can open the pref window and close it and open it again and close it again.. However, after opening it and closing it *twice*, when I click on the menubar afterwards I get a segfault (SIGSEGV). I'm thinking that the autorelease in windowWillClose might be a problem? However it is crashing at such an odd time. Has anyone experienced a problem similar to this? Any insight would be appreciated :) A backtrace follows. Thanks in advance! -JD- -- Jason DiCioccio - jd@bluenugget.net - Useless .sig Open Domain Service - geniusj@ods.org - http://www.ods.org/ Ruby - jd@ruby-lang.org - http://www.ruby-lang.org/ PGP Fingerprint - C442 04E2 26B0 3809 8357 96AB D350 9596 0436 7C08 ********** Date/Time: 2002-11-12 10:20:11 -0500 OS Version: 10.2.2 (Build 6F21) Host: Jason-DiCioccios-Computer.local. Command: ODS Client PID: 1124 Exception: EXC_BAD_ACCESS (0x0001) Codes: KERN_INVALID_ADDRESS (0x0001) at 0x00d4bedb Thread 0 Crashed: #0 0x9068ba50 in objc_msgSend #1 0x9320f3d4 in -[NSMenu _enableItems] #2 0x9307efac in -[NSMenu(carbonMenu_Private) _recursiveEnableItems] #3 0x9307effc in -[NSMenu(carbonMenu_Private) _recursiveEnableItems] #4 0x93081160 in _NSHandleCarbonMenuEvent #5 0x930824d4 in _DPSNextEvent #6 0x930ccf84 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] #7 0x930ca500 in -[NSApplication run] #8 0x930d2598 in NSApplicationMain #9 0x00004138 in main (main.m:13) #10 0x00003eb4 in _start (crt.c:267) #11 0x00003d34 in start PPC Thread State: srr0: 0x9068ba50 srr1: 0x0200f030 vrsave: 0x00000000 xer: 0x00000000 lr: 0x9320f3d4 ctr: 0x9068ba3c mq: 0x00000000 r0: 0x9320f3d4 r1: 0xbffff3e0 r2: 0x48044442 r3: 0x001b7fd0 r4: 0x906cc394 r5: 0x00006948 r6: 0x000a9090 r7: 0x001a9860 r8: 0x00000000 r9: 0xa309f29c r10: 0x0007cbe0 r11: 0xa3072cf8 r12: 0x00d4bebb r13: 0x00000000 r14: 0x00000000 r15: 0x00000000 r16: 0x00000000 r17: 0xbffff620 r18: 0x00000000 r19: 0xffffffff r20: 0x00094a30 r21: 0xa30a201c r22: 0xa309f29c r23: 0x001a9df0 r24: 0x0000000a r25: 0x00000001 r26: 0x0008c350 r27: 0x001b7fd0 r28: 0x906dd440 r29: 0x906cc394 r30: 0x001a9860 r31: 0x9320f29c From alex at mindlube.com Tue Nov 12 08:33:11 2002 From: alex at mindlube.com (Alex Rice) Date: Thu Nov 3 14:50:22 2005 Subject: urgent dyld question Message-ID: <396C0E9E-F65C-11D6-BC5C-000393529642@mindlube.com> I have compiled the Carbon version of Emacs 21.3.50, and distributed it to users, but it seems to break on most OS X updates :-(. It broke from 10.1-10.2 and it broke on 10.2.1-10.2.2. I really really could use some help coming up with a workaround, or suggestions. I hate to have my users download another 26M package just because of this. I think it's because Carbon.framework is being updated and prebinding is being broken. Here is my feeble attempt at troubleshooting this dyld issue. (on 10.2.2) # otool -L Emacs.app/Contents/MacOS/Emacs Emacs.app/Contents/MacOS/Emacs: /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 122.0.0) /usr/lib/libncurses.5.dylib (compatibility version 5.0.0, current version 5.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 60.2.0) # open /Applications/Emacs/Emacs.app Exception: EXC_BREAKPOINT (0x0006) Code[0]: 0x00000001Code[1]: 0x8fe01280 Thread 0 Crashed: #0 0x8fe01280 in halt #1 0x8fe106b4 in link_in_need_modules #2 0x8fe014e4 in _dyld_init # export DYLD_PREBIND_DEBUG=1 # open /Applications/Emacs/Emacs.app dyld: in map_image() determined the system shared regions ARE used dyld: open: prebinding enabled dyld: /Applications/Emacs/Emacs.app/Contents/MacOS/Emacs: prebinding disabled because time stamp of library: /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon did not match dyld: 51 two-level prebound libraries used out of 51 2002-11-12 09:28:51.735 Console[5008] Exception raised during posting of notification. Ignored. exception: *** NSRunStorage, _NSBlockNumberForIndex(): index (45429) beyond array bounds (45429) # redo_prebinding Emacs.app/Contents/MacOS/Emacs dyld: in map_image() determined the system shared regions ARE used dyld: redo_prebinding: prebinding enabled redo_prebinding: file not in an order that can be processed (hints table out of place): Emacs.app/Contents/MacOS/Emacs I need a dyld expert! Alex Rice Mindlube Software http://mindlube.com/ From alex at mindlube.com Tue Nov 12 08:47:01 2002 From: alex at mindlube.com (Alex Rice) Date: Thu Nov 3 14:50:22 2005 Subject: urgent dyld question In-Reply-To: <396C0E9E-F65C-11D6-BC5C-000393529642@mindlube.com> Message-ID: <5336BE9B-F65E-11D6-BC5C-000393529642@mindlube.com> Never mind, according to a note from the Emacs developer, "Updating to Mac OS X 10.2.2 will cause a Emacs binary built on an earlier version of OS X to fail. Rebuilding Emacs will make it work again. This problem is probably caused by the interaction between prebinding and unexec." If anyone can edumacate me more about this issue, I am all ears. On Tuesday, November 12, 2002, at 09:31 AM, Alex Rice wrote: > I have compiled the Carbon version of Emacs 21.3.50, and distributed > it to users, but it seems to break on most OS X updates :-(. It broke > from 10.1-10.2 and it broke on 10.2.1-10.2.2. I really really could > use some help coming up with a workaround, or suggestions. I hate to > have my users download another 26M package just because of this. I > think it's because Carbon.framework is being updated and prebinding is > being broken. Here is my feeble attempt at troubleshooting this dyld > issue. > Alex Rice Mindlube Software http://mindlube.com/ From ddavidso at apple.com Tue Nov 12 09:18:48 2002 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:50:22 2005 Subject: textStorage editedRange problem In-Reply-To: Message-ID: On Tuesday, November 12, 2002, at 04:39 AM, Mark J. Lilback wrote: > I'm doing syntax coloring via temporary attributes in the > layoutManager. Should I be listening for > textView:shouldChangeTextInRange:replacementString: instead? I was > trying to use textDidChange: so that I don't have to muck with merging > the current string and the replacementString to get a substring to > pass to my tokenizer. You could listen for textView:shouldChangeTextInRange:replacementString:, and save enough information so that later you can determine what the change actually was when you get textDidChange:. Douglas Davidson From jerome.laurens at u-bourgogne.fr Tue Nov 12 09:21:10 2002 From: jerome.laurens at u-bourgogne.fr (=?ISO-8859-1?Q?J=E9r=F4me_Laurens?=) Date: Thu Nov 3 14:50:22 2005 Subject: Editing huge text files in NSTextView In-Reply-To: <63846DCC-F624-11D6-9B0B-003065717ABE@siol.net> Message-ID: Le mardi, 12 nov 2002, ? 10:52 Europe/Zurich, Izidor Jerebic a ?crit : > Hello! > > I have come across some large text (ASCII) files, which I would like > to view, search and maybe change... > > I have tried to load one of them (40MB) into TextEdit, and on my Cube > with 512MB RAM it did not work well - as soon as I wanted to search or > go to the end of file, TextEdit stoppped responding. So I went to > Terminal and vi and it worked... > > Now, since TextEdit is using NSText mechanisms, I was wondering if > there is possible to configure NSTextView and friends to edit such > large text files (maybe with some programmatic options set for > speedup). If there is such a way, I could write a simple app myself to > work with large files (or even better modify the TextEdit source and > recompile it)... > > Any ideas? > > Did you try to convert to text format (shift+cmd+T) before trying to edit? From ddavidso at apple.com Tue Nov 12 09:43:01 2002 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:50:22 2005 Subject: Editing huge text files in NSTextView In-Reply-To: <63846DCC-F624-11D6-9B0B-003065717ABE@siol.net> Message-ID: <4E9ECE17-F666-11D6-AFCA-000393115062@apple.com> On Tuesday, November 12, 2002, at 01:52 AM, Izidor Jerebic wrote: > I have come across some large text (ASCII) files, which I would like > to view, search and maybe change... > > I have tried to load one of them (40MB) into TextEdit, and on my Cube > with 512MB RAM it did not work well - as soon as I wanted to search or > go to the end of file, TextEdit stoppped responding. So I went to > Terminal and vi and it worked... > > Now, since TextEdit is using NSText mechanisms, I was wondering if > there is possible to configure NSTextView and friends to edit such > large text files (maybe with some programmatic options set for > speedup). If there is such a way, I could write a simple app myself to > work with large files (or even better modify the TextEdit source and > recompile it)... The Cocoa text system is not really designed as an ASCII text editor; it's a styled Unicode text editor that happens to be usable for plain ASCII text. As such, it has a certain amount of overhead that something like vi does not. For example, vi doesn't need to know global information like (to use the simplest example) how many lines are in a file, because everything it does concerns only a small window into the file at any one time. A text view, on the other hand, does need to know, if only because it needs to display a scroll bar to let you scroll through the file. The scroll bar is a convenience; conveniences have a price. For the most part, the price is well worth paying. It's only for extreme examples that it really becomes burdensome. We have been doing quite a bit of optimization in the text system, and at this point I would estimate that the usable upper limit for TextEdit is something on the order of 10M characters; that may increase in the future, as we do more work. That's pretty large for a human text; anything bigger is probably mechanically generated. I might also note that the application TextEdit replaced had a somewhat smaller size limitation. If you are trying to alter TextEdit to be more responsive for huge files, the only small alteration I can suggest would be to turn off background layout. That would be only of limited utility, however. To do this properly, you would want to use something other than an NSTextView. Writing a custom view to display monospaced ASCII text would be fairly straightforward; handling character input would be fairly easy too, if you ignored input methods. You would still, however, have some overhead beyond that of vi, if you wanted features vi does not have, such as the ability to use a scroll bar to scroll through text, or to make selections with the mouse, or to make edits that affect more than one line at a time. Douglas Davidson From fabienlroy at mac.com Tue Nov 12 09:54:09 2002 From: fabienlroy at mac.com (Fabien Roy) Date: Thu Nov 3 14:50:23 2005 Subject: Editing huge text files in NSTextView In-Reply-To: <4E9ECE17-F666-11D6-AFCA-000393115062@apple.com> Message-ID: Emacs like vi can edit very large files. You could try the Carbon version of Emacs 21.3.50. On Tuesday, Nov 12, 2002, at 09:43 US/Pacific, Douglas Davidson wrote: > > On Tuesday, November 12, 2002, at 01:52 AM, Izidor Jerebic wrote: > >> I have come across some large text (ASCII) files, which I would like >> to view, search and maybe change... >> >> I have tried to load one of them (40MB) into TextEdit, and on my Cube >> with 512MB RAM it did not work well - as soon as I wanted to search >> or go to the end of file, TextEdit stoppped responding. So I went to >> Terminal and vi and it worked... >> >> Now, since TextEdit is using NSText mechanisms, I was wondering if >> there is possible to configure NSTextView and friends to edit such >> large text files (maybe with some programmatic options set for >> speedup). If there is such a way, I could write a simple app myself >> to work with large files (or even better modify the TextEdit source >> and recompile it)... > > The Cocoa text system is not really designed as an ASCII text editor; > it's a styled Unicode text editor that happens to be usable for plain > ASCII text. As such, it has a certain amount of overhead that > something like vi does not. For example, vi doesn't need to know > global information like (to use the simplest example) how many lines > are in a file, because everything it does concerns only a small window > into the file at any one time. A text view, on the other hand, does > need to know, if only because it needs to display a scroll bar to let > you scroll through the file. > > The scroll bar is a convenience; conveniences have a price. For the > most part, the price is well worth paying. It's only for extreme > examples that it really becomes burdensome. We have been doing quite > a bit of optimization in the text system, and at this point I would > estimate that the usable upper limit for TextEdit is something on the > order of 10M characters; that may increase in the future, as we do > more work. That's pretty large for a human text; anything bigger is > probably mechanically generated. I might also note that the > application TextEdit replaced had a somewhat smaller size limitation. > > If you are trying to alter TextEdit to be more responsive for huge > files, the only small alteration I can suggest would be to turn off > background layout. That would be only of limited utility, however. > To do this properly, you would want to use something other than an > NSTextView. Writing a custom view to display monospaced ASCII text > would be fairly straightforward; handling character input would be > fairly easy too, if you ignored input methods. You would still, > however, have some overhead beyond that of vi, if you wanted features > vi does not have, such as the ability to use a scroll bar to scroll > through text, or to make selections with the mouse, or to make edits > that affect more than one line at a time. > > Douglas Davidson > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From tthomas at monarch.net Tue Nov 12 10:24:01 2002 From: tthomas at monarch.net (Todd Thomas) Date: Thu Nov 3 14:50:23 2005 Subject: spooling an already created pdf document Message-ID: Hi, Say I've already got a PDF document (previously generated) I want to send to the printer. The application has no UI but I do know the printer name I want to send it to. Is there a good way to do this (on Jag or 10.1.x)? The carbon APIs don't seem to have anything that let me spool a document I've already created. There's the command line option of using lpr. On my pre-Jag system this didn't work (with a PDF doc at least) but it does seem to work under Jaguar. On Jaguar Print Center looks like it might let me tell it to print a document from the filesystem using Applescript. Am I missing any other options or APIs? thanks in advance, todd From dustin+macosx-dev at spy.net Tue Nov 12 10:26:07 2002 From: dustin+macosx-dev at spy.net (Dustin Sallings) Date: Thu Nov 3 14:50:23 2005 Subject: Editing huge text files in NSTextView In-Reply-To: <4E9ECE17-F666-11D6-AFCA-000393115062@apple.com> Message-ID: Around 09:43 on Nov 12, 2002, Douglas Davidson said: # The Cocoa text system is not really designed as an ASCII text editor; # it's a styled Unicode text editor that happens to be usable for plain # ASCII text. As such, it has a certain amount of overhead that # something like vi does not. For example, vi doesn't need to know # global information like (to use the simplest example) how many lines Just nit-picking a bit, but you seem to have some misconceptions as to what vi is. vi does know how many lines are in a file, just type ``:set nu'' to see. While above and beyond the standard, I use vim in utf-8 mode almost exclusively. # are in a file, because everything it does concerns only a small window # into the file at any one time. A text view, on the other hand, does # need to know, if only because it needs to display a scroll bar to let # you scroll through the file. This is gvim with a 40+MB file open (43,623,700 characters, utf-8 mode, scroll bar on the right): 28704 dustin 9 0 52448 50M 3320 S 29.6 20.5 0:01 gvim # fairly easy too, if you ignored input methods. You would still, # however, have some overhead beyond that of vi, if you wanted features vi # does not have, such as the ability to use a scroll bar to scroll through # text, or to make selections with the mouse, or to make edits that affect # more than one line at a time. I quite frequently make edits that affect more than one line at a time in vi (and in vim, edits that affect more than one line of more than one file at a time). Although I usually let X take care of my selections (when I use the mouse), it does have mouse support even in an xterm (i.e. tag selection). Sorry for swaying off topic a bit, but I use vim for almost all of my software development and feel that it's one of the most powerful text management tools that exists today. It's probably fair to assume that a text display/edit widget can use at least no more memory than it does. -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From ddavidso at apple.com Tue Nov 12 11:46:03 2002 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:50:23 2005 Subject: Editing huge text files in NSTextView In-Reply-To: Message-ID: <6E8F7AA9-F677-11D6-B4A1-000393115062@apple.com> On Tuesday, November 12, 2002, at 10:19 AM, Dustin Sallings wrote: > This is gvim with a 40+MB file open (43,623,700 characters, utf-8 > mode, scroll bar on the right): > > 28704 dustin 9 0 52448 50M 3320 S 29.6 20.5 0:01 gvim The Cocoa text system is really aimed more at human text--for example, something like this (just to stick to plain text): ????? ???? ???????, ??? ???????? ?????????, ?????????? ????? ???? ?????? ??????????, ???? ??????: ????? ?' ????? ???? ??????? ???' ??????? ???????? ????????? ????????????, ?????? ???????? ????????. ??????? ???????? ?? ??? ?????? ???????? ??????? ???????????. ??? ???????? ??????? ????? ??????????, ????????? ???????! ?? ??????????? ?????? ???? ? ???? ????, ???????? ???! ?????? ?????? ?????????! ?? ??????? ??? ? ?????? ???? ???????? ?????? ????????! ???? ?? ?? ??? ? ??? ? ???? ????? ?? ??? ?? ?? ???? ? ???? ??? ???? ????? ??? ???? ????? ???? ???? ??? ? ?? ???? ?? ???? ??? ??? ? ???? ????? ? ???????? ?? ???; ??? ???? ????? ???? ???? ?? ?? ???? ??? ? ?? ?? ????? ?????? ??? ?????? ?? ???, ?? ?? ??? ???? ??? ? ???? ???? ????? ??? ???, ?? ?? ?? ??? ????? ???? ???? ???? ??? ???? ??? ? ??-?? ???? ?? ???, ?? ???? ?????? ??? ? ??-??? ?? ???? ?? ??? ?????? ?? ???? ?? ??? ?? ???? ???, ?? ???? ????? ?? ? ???? ?? ???? ???? ???? ? ??? ?????? ??? ??? ???? ?? ? ????-?? ?? ?? ???? ???? ? ????? ???? ?? ??? ?? ?? ?? ???? ??????? ????? ?? ??? ? ???? ?? ????? ? ???, ? ??? ? ???? ?? ????? ? ???, ?? ???? ??????? ??? ???? ???? ? ???????????????????????????????????????????? ???????????????????????????????????????????????????????????????? ????????????????? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 16916 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021112/bd7849f9/attachment.bin From izidor.jerebic at siol.net Tue Nov 12 13:43:01 2002 From: izidor.jerebic at siol.net (Izidor Jerebic) Date: Thu Nov 3 14:50:23 2005 Subject: Editing huge text files in NSTextView In-Reply-To: <6E8F7AA9-F677-11D6-B4A1-000393115062@apple.com> Message-ID: <05361A62-F687-11D6-9B0B-003065717ABE@siol.net> On Tuesday, Nov 12, 2002, at 20:46 Europe/Ljubljana, Douglas Davidson wrote: > > On Tuesday, November 12, 2002, at 10:19 AM, Dustin Sallings wrote: > >> This is gvim with a 40+MB file open (43,623,700 characters, utf-8 >> mode, scroll bar on the right): >> >> 28704 dustin 9 0 52448 50M 3320 S 29.6 20.5 0:01 gvim > > The Cocoa text system is really aimed more at human text--for example, > something like this (just to stick to plain text): > > Yes, I realize that. I just wanted to know whether I am missing something... BTW, Cocoa text system is really impressive... My task is really more machine than human oriented - viewing and editing large computer-generated files, which may sometimes be ASCII and sometimes even not (PDF is not ASCII). In the past I always used Edit.app for viewing anything, including binaries. It seems that vi is the best tool for this (well, it sure brings back memories)... Since this is more like hacking and occasional debugging than regular task, I guess that vi will do... Thanks for the info, izidor From adrian at mindjar.com Tue Nov 12 13:53:04 2002 From: adrian at mindjar.com (Adrian) Date: Thu Nov 3 14:50:23 2005 Subject: setKeyEquivalent issue Message-ID: Hi guys, I was wondering if you could help me. I have set some of my NSButtons key equivalents to arrow keys like so: unichar left = NSLeftArrowFunctionKey; [_rewind setKeyEquivalent:[NSString stringWithCharacters:&left length:1]]; Which works but instead sends 2 action messages. If I set the key equivalents to anything else with this method it works fine and sends the 1 action message as it should. So what am I missing here? Thanks for your help. Adrian DeWitts From dunham at mac.com Tue Nov 12 14:17:55 2002 From: dunham at mac.com (David Dunham) Date: Thu Nov 3 14:50:23 2005 Subject: Editing huge text files in NSTextView In-Reply-To: <05361A62-F687-11D6-9B0B-003065717ABE@siol.net> Message-ID: <7122643A-F68C-11D6-B7A0-000393AC9690@mac.com> On Tuesday, Nov 12, 2002, at 13:38 US/Pacific, Izidor Jerebic wrote: > In the past I always used Edit.app for viewing anything, including > binaries. Perhaps the editor from Project Builder would be more appropriate? Unlike TextEdit, it doesn't have to deal with word wrap (which is a likely cause of slowdown). David Dunham Macintosh Game Developer GameHouse, Inc. david@gamehouse.com 206 442 5881 x22 http://www.gamehouse.com From njriley at uiuc.edu Tue Nov 12 14:32:01 2002 From: njriley at uiuc.edu (Nicholas Riley) Date: Thu Nov 3 14:50:23 2005 Subject: Editing huge text files in NSTextView In-Reply-To: <7122643A-F68C-11D6-B7A0-000393AC9690@mac.com> References: <05361A62-F687-11D6-9B0B-003065717ABE@siol.net> <7122643A-F68C-11D6-B7A0-000393AC9690@mac.com> Message-ID: <20021112223058.GC2382309@uiuc.edu> On Tue, Nov 12, 2002 at 02:16:50PM -0800, David Dunham wrote: > On Tuesday, Nov 12, 2002, at 13:38 US/Pacific, Izidor Jerebic wrote: > > >In the past I always used Edit.app for viewing anything, including > >binaries. > > Perhaps the editor from Project Builder would be more appropriate? > Unlike TextEdit, it doesn't have to deal with word wrap (which is a > likely cause of slowdown). If you do, make sure you have word wrap turned off. The intelligent word wrap in Project Builder is one of my favorite features - I've never seen it in any other editor, and it is incredibly useful to not have to manually format your code. -- =Nicholas Riley | Pablo Research Group, Department of Computer Science and Medical Scholars Program, University of Illinois at Urbana-Champaign From hayne at sympatico.ca Tue Nov 12 18:02:03 2002 From: hayne at sympatico.ca (Cameron Hayne) Date: Thu Nov 3 14:50:23 2005 Subject: Editing huge text files in NSTextView In-Reply-To: <20021112223058.GC2382309@uiuc.edu> Message-ID: On 12/11/02 5:30 pm, "Nicholas Riley" wrote: >> Perhaps the editor from Project Builder would be more appropriate? >> Unlike TextEdit, it doesn't have to deal with word wrap (which is a >> likely cause of slowdown). > > If you do, make sure you have word wrap turned off. I have always used BBEdit (bbedit.com) or BBEdit Lite (free version) for looking at large files (including binaries). It is somewhat more novice-friendly than vi (which I also use, depending on my needs). -- Cameron Hayne (hayne@sympatico.ca) Hayne of Tintagel From joachim at nettnyheter.net Tue Nov 12 20:42:01 2002 From: joachim at nettnyheter.net (=?ISO-8859-1?Q?Joachim_Haagen_B=F8e?=) Date: Thu Nov 3 14:50:23 2005 Subject: NSRunAlertPanel() Message-ID: <0F2FD015-F6C2-11D6-9F8D-000393863756@nettnyheter.net> According to Aaron Hillegass' book you use a C function to show an alert panel. The declaration is int NSRunAlertPanel(NSString *title, NSString *msg, NSString *defaultButton, NSString *alternateButton, NSString *otherButton); I know that Aaron Hillegass' book isn't written for Jaguar, and wonder if Apple have implemented an Objective-C function for this instead. I know that it doesn't matter performance wise, im just curious as to why this is a C function and not an object oriented method. Regards, Joachim From jerwin at ponymail.com Tue Nov 12 21:55:01 2002 From: jerwin at ponymail.com (Jeremy Erwin) Date: Thu Nov 3 14:50:23 2005 Subject: NSRunAlertPanel() In-Reply-To: <0F2FD015-F6C2-11D6-9F8D-000393863756@nettnyheter.net> Message-ID: <770C4AD2-F6CC-11D6-A33A-003065F24232@ponymail.com> On Tuesday, November 12, 2002, at 11:40 PM, Joachim Haagen B?e wrote: > According to Aaron Hillegass' book you use a C function to show an > alert panel. The declaration is > > int NSRunAlertPanel(NSString *title, NSString *msg, NSString > *defaultButton, NSString *alternateButton, NSString *otherButton); > > I know that Aaron Hillegass' book isn't written for Jaguar, and wonder > if Apple have implemented an Objective-C function for this instead. > > "Learning Cocoa" (1st edition) uses NSBeginAlertSheet, which is still a function, but it does incorporate selectors. In that respect it's more "Cocoa-ish" than switching on the return code of NSRunAlertPanel. file:///System/Library/Frameworks/AppKit.framework/Versions/C/ Resources/English.lproj/Documentation/Reference/ObjC_classic/Functions/ AppKitFunctions.html There's also file:///Developer/Documentation/Cocoa/TasksAndConcepts/ ProgrammingTopics/WinPanel/iUsingModalWindows.html which is probably intended for far more complex situations than simple alert panels. Jeremy From eblair at mac.com Tue Nov 12 22:08:01 2002 From: eblair at mac.com (Eric Blair) Date: Thu Nov 3 14:50:23 2005 Subject: Building a Custom Framework Message-ID: I've been doing a little development in my spare time and decided to put together a framework of some common interface elements and useful functions. Currently, I've got one class in the framework and everything was working fine. Then I realized I left out a bit of functionality that I needed, so I went into the framework, adding the missing function, built the framework, and then rebuilt the app I was developing. Now, whenever I build, I get the following error: ld: Undefined symbols: .objc_class_name_EBRegistrationController where EBRegistrationController is the name of single class currently in the framework. This is an embeddable framework and it was working perfectly before. I cleaned and rebuilt both the framework and the app with no luck. I flipped through the section on custom frameworks in Cocoa Programming and I didn't see anything about dealing with this. Any guesses what I'm doing wrong? --Eric From joar at joar.com Tue Nov 12 22:13:00 2002 From: joar at joar.com (j o a r) Date: Thu Nov 3 14:50:23 2005 Subject: setKeyEquivalent issue In-Reply-To: Message-ID: Set a breakpoint in the action method and trap it in the debugger, try to see if you can find out how it's called when it's triggered. Do you have several action items with the same keyboard equivalent? For example some menu item? Could this problem be related to the time you keep the key pressed? Is the button using continous actions? j o a r On Sunday, Nov 10, 2002, at 11:21 Europe/Stockholm, Adrian wrote: > I have set some of my NSButtons key equivalents to arrow keys like so: > > unichar left = NSLeftArrowFunctionKey; > [_rewind setKeyEquivalent:[NSString stringWithCharacters:&left > length:1]]; > > Which works but instead sends 2 action messages. If I set the key > equivalents to anything else with this method it works fine and sends > the 1 action message as it should. > > So what am I missing here? From joachim at nettnyheter.net Tue Nov 12 22:18:07 2002 From: joachim at nettnyheter.net (=?ISO-8859-1?Q?Joachim_Haagen_B=F8e?=) Date: Thu Nov 3 14:50:23 2005 Subject: NSRunAlertPanel() In-Reply-To: <770C4AD2-F6CC-11D6-A33A-003065F24232@ponymail.com> Message-ID: <893CC361-F6CF-11D6-A3E8-000393863756@nettnyheter.net> So the main diffeence is that NSBeginAlertSheet creates a document sheet instead of a new Panel, and that it uses selectors to determine what happens when the user clicks the buttons ? Do you have an example of how you use an NSBeginAlertSheet ? I've looked at the API, and it tells me: void NSBeginAlertSheet(NSString *title, NSString *defaultButton, NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void *contextInfo, NSString *msg, ...) However, im not that confident in Cocoa (or C for that matter) and im not sure how to use selectors. Thanks, Joachim On Wednesday, November 13, 2002, at 03:55 PM, Jeremy Erwin wrote: > > On Tuesday, November 12, 2002, at 11:40 PM, Joachim Haagen B?e wrote: > >> According to Aaron Hillegass' book you use a C function to show an >> alert panel. The declaration is >> >> int NSRunAlertPanel(NSString *title, NSString *msg, NSString >> *defaultButton, NSString *alternateButton, NSString *otherButton); >> >> I know that Aaron Hillegass' book isn't written for Jaguar, and >> wonder if Apple have implemented an Objective-C function for this >> instead. >> >> > "Learning Cocoa" (1st edition) uses NSBeginAlertSheet, which is still > a function, but it does incorporate selectors. In that respect it's > more "Cocoa-ish" than switching on the return code of NSRunAlertPanel. > > file:///System/Library/Frameworks/AppKit.framework/Versions/C/ > Resources/English.lproj/Documentation/Reference/ObjC_classic/ > Functions/AppKitFunctions.html > > There's also > file:///Developer/Documentation/Cocoa/TasksAndConcepts/ > ProgrammingTopics/WinPanel/iUsingModalWindows.html > > which is probably intended for far more complex situations than simple > alert panels. > > Jeremy > _______________________________________________ > 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: 1993 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021112/0f895b6f/attachment.bin From jamesp at silver-future.com Tue Nov 12 22:40:00 2002 From: jamesp at silver-future.com (James Powell) Date: Thu Nov 3 14:50:23 2005 Subject: NSForm validation Message-ID: <69B7E911-F6D2-11D6-9B90-000502F719FB@silver-future.com> I've looked through the list archives to no avail. I am working with a preferences dialog which displays a handful of NSForms for the user to fill in. Q1: This code gives me a warning, "invalid conversion from 'const NSFormCell*' to 'NSCell*'" on the second line. cells[0] = [m_GridSizeForm cellAtIndex:0]; [m_GridSizeForm selectCell:cells[0]]; // warning here Besides casting the cell argument, is there a better way to select the cell? Why is casting an NSFormCell instance to NSCell invalid? Q2: NSFormatter's setMinimum and setMaximum messages take an NSDecimalNumber * argument. Is there a way to initialize an NSDecimalNumber directly using an int? In the archives, it is suggested that we use: NSDecimalNumber *foo = (NSDecimalNumber *)[NSDecimalNumber numberWithInt:1]; This works, but that downcast makes me nervous. What's up with that? Should I use it? Does anyone else agree that NSDecimalNumber should have a decimalNumberWithInt message? Q3: The user brings up my preferences dialog. It is modal, it is a sheet. NSForms are there, and they are mostly numeric in content. The user changes a field to an invalid value: below minimum, above maximum, or non-numeric. The user hits to proceed to the next field. A red error message in an NSTextField appears saying for example "The minimum value is 100." The cursor remains in the field that has an invalid value, because my control:didFailToFormatString:errorDescription: returns NO. The user closes the preferences window. An alert appears reading "There are invalid values in this form. Please correct them, or press Cancel to void all changes.". The user presses Cancel. The user re-opens the preferences window. It is exactly where she left it, with the cursor in the field with the invalid value, and the red error message evident. This is %99 of the behavior I want. The only problem is the last step. When the user reopens the preferences dialog, I want the original, valid values in all of the NSFormCells. When the prefs window is reopened I am replacing the values in all of the form cells by calling for example: cells[0] = [m_RecordingForm cellAtIndex:0]; [cells[0] setDoubleValue:[GetTask()->GetController() recordingFPS]]; This message doesn't seem to be enough to reset the state of the cell which has the invalid value in it. It seems like setDoubleValue: should override the user's edits, but it does not appear to. Is there any way to ask a cell to default back to the last known good value, or to override the editing state of a cell? Thanks much, James From adrian at mindjar.com Tue Nov 12 23:26:01 2002 From: adrian at mindjar.com (Adrian) Date: Thu Nov 3 14:50:23 2005 Subject: setKeyEquivalent issue In-Reply-To: Message-ID: <7ECD49EC-F6D7-11D6-A393-000393B89720@mindjar.com> Thanks for the reply. It runs through a normal sequence of events. It calls performKeyEquivalent: in NSWindow to NSView to NSButton, which then calls performClick in an NSButtonCell, then sendAction and so forth. It does this if I had set the key equivalent to any character, except the arrow keys which are the only ones it calls twice. I have actually set this up in a little test app and get the same problems. So no other action items are set. The problem manifests anyway without holding down the key and it has had it's setContinuous: set to NO, and it is also off in IB. If I set the key equivalents to something else, the arrow keys will beep when pressed, as they should as they don't have any key equivalents set, as any other key would. I would greatly appreciate any other suggestions. All the best. Adrian On Wednesday, November 13, 2002, at 05:12 PM, j o a r wrote: > Set a breakpoint in the action method and trap it in the debugger, try > to see if you can find out how it's called when it's triggered. > Do you have several action items with the same keyboard equivalent? > For example some menu item? Could this problem be related to the time > you keep the key pressed? Is the button using continous actions? > > j o a r > > On Sunday, Nov 10, 2002, at 11:21 Europe/Stockholm, Adrian wrote: > >> I have set some of my NSButtons key equivalents to arrow keys like so: >> >> unichar left = NSLeftArrowFunctionKey; >> [_rewind setKeyEquivalent:[NSString stringWithCharacters:&left >> length:1]]; >> >> Which works but instead sends 2 action messages. If I set the key >> equivalents to anything else with this method it works fine and sends >> the 1 action message as it should. >> >> So what am I missing here? From jamesp at silver-future.com Wed Nov 13 00:20:01 2002 From: jamesp at silver-future.com (James Powell) Date: Thu Nov 3 14:50:23 2005 Subject: [ANN] iConquer 1.0, a game of world conquest In-Reply-To: <28A54D77-F5B5-11D6-9FF8-000A277A6C34@zamler-carhart.com> Message-ID: <6867B3B8-F6E0-11D6-9B90-000502F719FB@silver-future.com> Congratulations, Andrew. iConquer is really cool. Think about giving props to the programmer of the original Risk game for the Macintosh, Tone Engel; he never made any money because it got leaked before he could make a deal to sell it to Parker Bros, and everyone ended up assuming it was freeware for some reason, so he might at least get some credit. Did you know that the original creator of Risk was French? Albert Lamorisse, film writer and director of The Lover's Wind and The Red Balloon (Le Balloon Rouge) created "La conqu?te du monde" in 1950. The network play looks sweet. We had to use Timbuktu to get multiplayer on Tone's Risk. PhoneNet AppleTalk connecting four 100-year-old apartments full of college students; ah, the good old days. Best of luck, James From blb at pobox.com Wed Nov 13 00:29:02 2002 From: blb at pobox.com (Bryan Blackburn) Date: Thu Nov 3 14:50:23 2005 Subject: setKeyEquivalent issue In-Reply-To: <7ECD49EC-F6D7-11D6-A393-000393B89720@mindjar.com> References: <7ECD49EC-F6D7-11D6-A393-000393B89720@mindjar.com> Message-ID: <20021113082833.GC28380@kosh.withay.com> Dumping [ NSApp currentEvent ] when your action fires can be very illuminating here. Specifically, it would appear that using any of the NS...FunctionKey values causes this behavior. The problem is that the button is firing on both keyDown and keyUp. Bryan On Nov 13, 2002 18:14, Adrian stated: > Thanks for the reply. It runs through a normal sequence of events. It > calls performKeyEquivalent: in NSWindow to NSView to NSButton, which > then calls performClick in an NSButtonCell, then sendAction and so > forth. It does this if I had set the key equivalent to any character, > except the arrow keys which are the only ones it calls twice. > > I have actually set this up in a little test app and get the same > problems. So no other action items are set. The problem manifests > anyway without holding down the key and it has had it's setContinuous: > set to NO, and it is also off in IB. If I set the key equivalents to > something else, the arrow keys will beep when pressed, as they should > as they don't have any key equivalents set, as any other key would. > > I would greatly appreciate any other suggestions. All the best. > > Adrian > > On Wednesday, November 13, 2002, at 05:12 PM, j o a r wrote: > > >Set a breakpoint in the action method and trap it in the debugger, try > >to see if you can find out how it's called when it's triggered. > >Do you have several action items with the same keyboard equivalent? > >For example some menu item? Could this problem be related to the time > >you keep the key pressed? Is the button using continous actions? > > > >j o a r > > > >On Sunday, Nov 10, 2002, at 11:21 Europe/Stockholm, Adrian wrote: > > > >>I have set some of my NSButtons key equivalents to arrow keys like so: > >> > >>unichar left = NSLeftArrowFunctionKey; > >>[_rewind setKeyEquivalent:[NSString stringWithCharacters:&left > >>length:1]]; > >> > >>Which works but instead sends 2 action messages. If I set the key > >>equivalents to anything else with this method it works fine and sends > >>the 1 action message as it should. > >> > >>So what am I missing here? > From ghulands at bigpond.net.au Wed Nov 13 00:38:03 2002 From: ghulands at bigpond.net.au (Greg Hulands) Date: Thu Nov 3 14:50:23 2005 Subject: Building a Custom Framework In-Reply-To: Message-ID: <4796E8B4-F6E3-11D6-B40C-0003937807BE@bigpond.net.au> Have you set the app to link against the new framework? Greg On Wednesday, November 13, 2002, at 04:06 PM, Eric Blair wrote: > I've been doing a little development in my spare time and decided to > put > together a framework of some common interface elements and useful > functions. > Currently, I've got one class in the framework and everything was > working fine. > Then I realized I left out a bit of functionality that I needed, so I > went into > the framework, adding the missing function, built the framework, and > then > rebuilt the app I was developing. Now, whenever I build, I get the > following > error: > > ld: Undefined symbols: > .objc_class_name_EBRegistrationController > > where EBRegistrationController is the name of single class currently > in the > framework. > > This is an embeddable framework and it was working perfectly before. I > cleaned > and rebuilt both the framework and the app with no luck. I flipped > through the > section on custom frameworks in Cocoa Programming and I didn't see > anything > about dealing with this. > > Any guesses what I'm doing wrong? > > --Eric > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From sanguish at digifix.com Wed Nov 13 00:41:01 2002 From: sanguish at digifix.com (Scott Anguish) Date: Thu Nov 3 14:50:23 2005 Subject: NSRunAlertPanel() In-Reply-To: <893CC361-F6CF-11D6-A3E8-000393863756@nettnyheter.net> Message-ID: <5F6E5E7A-F6E3-11D6-8375-003065C12394@digifix.com> On Wednesday, November 13, 2002, at 01:17 AM, Joachim Haagen B?e wrote: > So the main diffeence is that NSBeginAlertSheet creates a document > sheet instead of a new Panel, and that it uses selectors to determine > what happens when the user clicks the buttons ? > > Do you have an example of how you use an NSBeginAlertSheet ? I've > looked at the API, and it tells me: > > void NSBeginAlertSheet(NSString *title, NSString *defaultButton, > NSString *alternateButton, NSString *otherButton, NSWindow *docWindow, > id modalDelegate, SEL didEndSelector, SEL didDismissSelector, void > *contextInfo, NSString *msg, ...) > > However, im not that confident in Cocoa (or C for that matter) and im > not sure how to use selectors. > > It's pretty much the same... a selector is a method signature (that is the name components and the :'s without the parameters.).. when combined with a target object (which in this case is referred to as the modalDelegate) they implement a form of callback. In one of my apps, I use the following to present a warning sheet NSBeginAlertSheet(@"Error Encountered", // title @"OK", NULL, NULL, // default, alternate and other buttons [asinField window], // the window the sheet belongs to self, @selector(sheetDidEnd:returnCode:contextInfo:), nil,NULL,errorString); // no didDismissSelector is needed, // not passing any context info, or additional string parts -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1941 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021113/351fa5b8/attachment.bin From techabos at classlibrary.net Wed Nov 13 03:17:01 2002 From: techabos at classlibrary.net (erik) Date: Thu Nov 3 14:50:23 2005 Subject: Editing huge text files in NSTextView In-Reply-To: <4E9ECE17-F666-11D6-AFCA-000393115062@apple.com> Message-ID: > I might also note that the application TextEdit replaced had a > somewhat smaller size limitation. this was the reason i finally dropped hypercard in '99 :^) From wjtregaskis at students.latrobe.edu.au Wed Nov 13 06:54:27 2002 From: wjtregaskis at students.latrobe.edu.au (Wade Tregaskis) Date: Thu Nov 3 14:50:23 2005 Subject: [OFF] Reporting freezes (not crashes) to Apple? Message-ID: <499E824C-F717-11D6-B7D4-00306583D14E@students.latrobe.edu.au> How am I supposed to report system freezes to Apple? They unofficially refuse to take them, as they don't generate a panic log [for obvious reasons]. I've been through the process with them recently over this, and basically it turned into a battle of who could be bothered sending the last word...they won out...damn auto-reply bot thing. "Please send in a crash log" "There is no crash log" "Please send in a crash log" "You're not listening..." "Please send in a crash log"...ad infinum. So, what do I do? For instance, I'm narrowing down a recent recurring freeze, which seems to be the window server dying and taking absolutely everything else with it. While I understand how little help it is to submit a bug report without any sort of crash/panic log or similar, should I submit it anyway? As I said, past reports like this have generated mindless email wars with some bot (or someone who severely abuses copy and paste)... Wade Tregaskis P.S. Nothing worse than chatting with a PC friend on ICQ about how OS X has survived my best attempts at really bad programming, only to have me drop off their online list unexpectedly... :) From oogje at mac.com Wed Nov 13 08:13:01 2002 From: oogje at mac.com (Brian Redman) Date: Thu Nov 3 14:50:23 2005 Subject: [OFF] Reporting freezes (not crashes) to Apple? In-Reply-To: <499E824C-F717-11D6-B7D4-00306583D14E@students.latrobe.edu.au> Message-ID: Wade, Assuming you're talking about reporting problems via bugreporter, try to focus on a particular symptom. Once you engage someone you can start looking for the cause. Did you check the log files for messages about the time the problems start? You should report the error messages or warnings. When you talk of the window server dying do you mean the WindowServer process has exited? If so that's a problem worth reporting. If it's hung run sample(1) on it and look for clues. When the system is hung, is it really hung? Can you ping it? Can you ssh into it? If you have a top running in a window does it continue to update? If so, is there unusual process activity? Is something in a spin loop? How much free disk is there? Are you paging? Try to find something measurably wrong you can report. If the system just hangs and there are no other symptoms you can demonstrate and you can't reproduce it then you've done all you can do by reporting it. If you want to try to get it fixed in the near future then you need to open a service call. ber On Wednesday, November 13, 2002, at 09:50 AM, Wade Tregaskis wrote: > How am I supposed to report system freezes to Apple? They > unofficially refuse to take them, as they don't generate a panic log > [for obvious reasons]. I've been through the process with them > recently over this, and basically it turned into a battle of who could > be bothered sending the last word...they won out...damn auto-reply bot > thing. "Please send in a crash log" "There is no crash log" "Please > send in a crash log" "You're not listening..." "Please send in a > crash log"...ad infinum. > > So, what do I do? For instance, I'm narrowing down a recent recurring > freeze, which seems to be the window server dying and taking > absolutely everything else with it. While I understand how little > help it is to submit a bug report without any sort of crash/panic log > or similar, should I submit it anyway? As I said, past reports like > this have generated mindless email wars with some bot (or someone who > severely abuses copy and paste)... > From jamesp at silver-future.com Wed Nov 13 11:31:01 2002 From: jamesp at silver-future.com (James Powell) Date: Thu Nov 3 14:50:23 2005 Subject: NSForm validation In-Reply-To: <69B7E911-F6D2-11D6-9B90-000502F719FB@silver-future.com> Message-ID: I answered one of my own questions. [form abortEdit] resets all cell values back to the previous known good value. This preferences pane is now at %100, yahoo! I'm still curious about the casts that seem to be required for selectCell and [NSDecimalNumber numberWithInt:1]. Thanks, James From rixstep000 at yahoo.co.uk Wed Nov 13 12:36:04 2002 From: rixstep000 at yahoo.co.uk (=?iso-8859-1?q?Domain=20Administrators?=) Date: Thu Nov 3 14:50:23 2005 Subject: When Drop Can Be A Drag Message-ID: <20021113203545.43968.qmail@web10904.mail.yahoo.com> Hi, Tried this one a bit back and didn't get a murmur, so I am going to try again. When setting up a drop target for drops from the Finder, what I would really like is to get a Unix-style file name path. Unfortunately, this is not so, or to me it appears to me not so. If I want anything at all, I have to use the NSFilenamesPboardType. This seems reasonable; yet when I investigate what I get with either [[sender draggingPasteboard] dataForType: NSFilenamesPboardType] Or [[sender draggingPasteboard] stringForType: NSFilenamesPboardType] I don't get anything particularly encouraging. I've worked around this for now, but I suspect there has to be a straightforward way of getting a "real" path from the Finder on the drop. What I can see, the only possibility I have not tried is [[sender draggingPasteboard] propertyListForType: NSFilenamesPboardType] But that just calls dataForType anyway. I am aware that I can expect not one but multiple file names on a drop, yet if I try to cast the return to NSArray *, he doesn't like that either. The format of the data returned on stringForType is XML... Much obliged, R. PS. Many thanks for all of you who help out here. You're 24 karat! I hope that the rest of us will be as helpful in a year or two when we've made it that far! __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com From andreas at harmless.de Wed Nov 13 13:23:07 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:23 2005 Subject: NSForm validation In-Reply-To: Message-ID: Am Mittwoch, 13.11.02 um 20:27 Uhr schrieb James Powell: > I'm still curious about the casts that seem to be required for > selectCell and [NSDecimalNumber numberWithInt:1]. What cast? NSDecimalNumber is a subclass of NSNumber. So numberWithInt: is perfectly fine with NSDecimalNumber, too. bye. Andreas. From stupidfish23 at mac.com Wed Nov 13 14:08:02 2002 From: stupidfish23 at mac.com (=?ISO-8859-1?Q?Benj=E1min_Sal=E1nki?=) Date: Thu Nov 3 14:50:23 2005 Subject: writing to NSURL Message-ID: <4B644434-F754-11D6-9A38-003065BB04BA@mac.com> Hi everyone, I want to load the contents of a txt file that is located on a webserver into an NSTextView, edit it there, and then write it back to the file. what I do is i create an NSURL instance, appPath = [[NSURL alloc] initWithString:@"http://username:password@www.myhost.com/ somefilename.txt"]; and then I have two methods, each called by corresponding buttons being clicked: - (IBAction)readStuff:(id)sender { [theView setString:[NSString stringWithContentsOfURL:appPath]]; } which works fine, loads the contents of the URL and puts it into my little editor view, and then there is the writing method: - (IBAction)writeStuff:(id)sender { [[theView string] writeToURL:appPath atomically:NO]; } now when I call this, I get an error saying: *** malloc[3804]: error for object 0x10420c4: Non-aligned pointer being freed 2002-11-13 23:00:54.144 sampleApp[3804] CFLog (0): Usage of CFHTTPReadStreamSetRedirectsAutomatically is deprecated; call SetProperty(kCFStreamPropertyHTTPShouldAutoredirect, kCFBooleanTrue/False) instead Now I don't really know what to do. Can anyone help me out on this one? Thanks, Ben From jamesp at silver-future.com Wed Nov 13 14:09:04 2002 From: jamesp at silver-future.com (James Powell) Date: Thu Nov 3 14:50:23 2005 Subject: NSForm validation In-Reply-To: Message-ID: <17A2C576-F754-11D6-B374-000502F719FB@silver-future.com> Aha. You are correct. I am surprised, because numberWithInt returns an NSNumber * and NSDecimalNumber is a subclass of NSNumber. In C++, the compiler does not downcast automatically. It looks like the Objective C compiler accommodates downcasts. This makes sense, given the dynamic nature of Objective C. It is a leap of faith to assume that the instance returned by numberWithInt is actually an NSDecimalNumber instance, but no more than to assume that a message is defined for a class when it isn't present in the header. I am also able to answer my remaining question. I had a silly unnecessary 'const' keyword in there. The preferences controller now compiles without warnings. Yahoo! Thank you for your help. James From rew at apple.com Wed Nov 13 14:39:01 2002 From: rew at apple.com (Becky Willrich) Date: Thu Nov 3 14:50:23 2005 Subject: writing to NSURL In-Reply-To: <4B644434-F754-11D6-9A38-003065BB04BA@mac.com> Message-ID: <770125E4-F758-11D6-BB89-0003937192C6@apple.com> I'm not sure what's causing this one: > *** malloc[3804]: error for object 0x10420c4: Non-aligned pointer > being freed But this one is a known bug, and benign. Simply ignore this log. > 2002-11-13 23:00:54.144 sampleApp[3804] CFLog (0): Usage of > CFHTTPReadStreamSetRedirectsAutomatically is deprecated; call > SetProperty(kCFStreamPropertyHTTPShouldAutoredirect, > kCFBooleanTrue/False) instead REW From stupidfish23 at mac.com Wed Nov 13 15:14:23 2002 From: stupidfish23 at mac.com (=?ISO-8859-1?Q?Benj=E1min_Sal=E1nki?=) Date: Thu Nov 3 14:50:23 2005 Subject: creating screenshots - not with AppleScript Message-ID: <125A605D-F75D-11D6-9A38-003065BB04BA@mac.com> Hi, I want to create a screenshot of the screen, but not by using some AppleScript script, but by Cocoa code. Any idea where I should start? thanks, Ben From jcr at apple.com Wed Nov 13 15:21:01 2002 From: jcr at apple.com (John C. Randolph) Date: Thu Nov 3 14:50:23 2005 Subject: creating screenshots - not with AppleScript In-Reply-To: <125A605D-F75D-11D6-9A38-003065BB04BA@mac.com> Message-ID: <8E18B2B5-F75E-11D6-9B84-003065F32C3C@apple.com> On Wednesday, November 13, 2002, at 03:10 PM, Benj?min Sal?nki wrote: > Hi, > > I want to create a screenshot of the screen, but not by using some > AppleScript script, but by Cocoa code. > Any idea where I should start? I really should write up a code sample for this.. Create a borderless window with a custom, transparent contentview. Order the window to the front, -lockfocus on its contentview, and create an NSBitmapImageRep using [[NSBitmapImageRep alloc] initWithFocusedViewRect:]; -jcr John C. Randolph (408) 974-8819 Sr. Cocoa Software Engineer, Apple Worldwide Developer Relations http://developer.apple.com/cocoa/index.html From andreas at harmless.de Wed Nov 13 15:49:00 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:23 2005 Subject: NSForm validation In-Reply-To: <17A2C576-F754-11D6-B374-000502F719FB@silver-future.com> Message-ID: <6669F2D6-F762-11D6-901D-00050231227A@harmless.de> Am Mittwoch, 13.11.02 um 23:05 Uhr schrieb James Powell: > I am surprised, because numberWithInt returns an NSNumber * and > NSDecimalNumber is a subclass of NSNumber. In C++, the compiler does > not downcast automatically. It looks like the Objective C compiler > accommodates downcasts. Please, try to forget C++. numberWithInt: (the colon is part of the name) is a selector you send to an object. In this case you send it to the NSDecimalNumber class. And this class (object) will, of course, return an NSDecimalNumber. The compiler has nothing to do with this, at all. > It is a leap of faith to assume that the instance returned by > numberWithInt is actually an NSDecimalNumber instance, It's not. It's totally obvious. This is a convenience constructor, i.e. a replacement for [[[NSNumber alloc] initWithInt:] autorelease]. So [NSDecimalNumber numberWithInt:] is the same as [[[NSDecimalNumber alloc] initWithInt:] autorelease]. As you can see, this creates an NSDecimalNumber. Anything else would be just wrong. > but no more than to assume that a message is defined for a class when > it isn't present in the header. This is OOP. Any subclass inherits all instance variables and methods of its superclass(es). Nothing special about that. Get some decent class browser like AppKiDo, that will help a lot. bye. Andreas. From tormanders at mac.com Wed Nov 13 16:30:00 2002 From: tormanders at mac.com (Tor Manders) Date: Thu Nov 3 14:50:23 2005 Subject: creating screenshots - not with AppleScript In-Reply-To: <125A605D-F75D-11D6-9A38-003065BB04BA@mac.com> Message-ID: <152CBE4C-F768-11D6-B4AB-000393012C3E@mac.com> here is code that should create a screenshot and places it into the clipboard. there are other options to explore besides "-c" ... NSTask *task = [[NSTask alloc] init]; [task setLaunchPath: @"/usr/sbin/screencapture"]; [task setArguments: [NSArray arrayWithObject: @"-c"]]; [task launch]; will this do for your needs? m a s s l i g h t s o f t w a r e Tor Manders, Vice-President On Wednesday, November 13, 2002, at 06:10 PM, Benj?min Sal?nki wrote: > Hi, > > I want to create a screenshot of the screen, but not by using some > AppleScript script, but by Cocoa code. > Any idea where I should start? > > thanks, > Ben > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From hayne at sympatico.ca Wed Nov 13 16:35:01 2002 From: hayne at sympatico.ca (Cameron Hayne) Date: Thu Nov 3 14:50:23 2005 Subject: numberWithInt (was Re: NSForm validation) In-Reply-To: <6669F2D6-F762-11D6-901D-00050231227A@harmless.de> Message-ID: On 13/11/02 6:48 pm, "Andreas Mayer" wrote: >> It is a leap of faith to assume that the instance returned by >> numberWithInt is actually an NSDecimalNumber instance, > > It's not. It's totally obvious. > This is a convenience constructor, i.e. a replacement for [[[NSNumber > alloc] initWithInt:] autorelease]. So [NSDecimalNumber numberWithInt:] > is the same as [[[NSDecimalNumber alloc] initWithInt:] autorelease]. As > you can see, this creates an NSDecimalNumber. Anything else would be > just wrong. Well, I agree completely with the philosophy. I.e. this is what I would expect to be the case. But what is missing is the documentation. The behaviour seems to be an unstated convention rather than something that is necessarily true. Even using AppKiDo I fail to see anything that says that the method numberWithInt that NSDecimalNumber inherits from NSNumber returns an NSDecimalNumber. What if I created a class with a method like: + (MyWeirdClass *)objectWithInt:(int)value { return (MyWeirdClass*) [NSNumber numberWithInt: value]; } then if I created a subclass, MyVeryWeirdClass, would the expression [MyVeryWeirdClass objectWithInt:42] somehow magically be of type (MyVeryWeirdClass *) ? -- Cameron Hayne (hayne@sympatico.ca) Hayne of Tintagel From jmdisher at student.math.uwaterloo.ca Wed Nov 13 16:52:02 2002 From: jmdisher at student.math.uwaterloo.ca (Jeff Disher) Date: Thu Nov 3 14:50:23 2005 Subject: numberWithInt (was Re: NSForm validation) In-Reply-To: Message-ID: <53EF596A-F76B-11D6-98A5-000393B6A966@student.math.uwaterloo.ca> Just joining this conversation so maybe it was already mentioned but I should point out that NSNumber is an abstract class defining the behavior of a class cluster. That said, the types returned by constructors and convenience constructors are not of type NSNumber, but rather some internal sub-class. That said, you should never have to worry about that since it fully implements the NSNumber interface. As far as you are concerned, this IS an NSNumber instance. In the example you give here, the instance you get back would be of some NSNumber sub-class type. In a correctly implemented class cluster (like NSNumber) you should never actually worry about the actual type that has been instantiated for you and treat is as only an NSNumber instance. I am not totally sure what you are discussing here so I may be completely out in left field here so I apologize if this post makes no sense. Jeff. On Wednesday, November 13, 2002, at 07:34 PM, Cameron Hayne wrote: > On 13/11/02 6:48 pm, "Andreas Mayer" wrote: > >>> It is a leap of faith to assume that the instance returned by >>> numberWithInt is actually an NSDecimalNumber instance, >> >> It's not. It's totally obvious. >> This is a convenience constructor, i.e. a replacement for [[[NSNumber >> alloc] initWithInt:] autorelease]. So [NSDecimalNumber numberWithInt:] >> is the same as [[[NSDecimalNumber alloc] initWithInt:] autorelease]. >> As >> you can see, this creates an NSDecimalNumber. Anything else would be >> just wrong. > > Well, I agree completely with the philosophy. I.e. this is what I would > expect to be the case. > But what is missing is the documentation. The behaviour seems to be an > unstated convention rather than something that is necessarily true. > Even > using AppKiDo I fail to see anything that says that the method > numberWithInt > that NSDecimalNumber inherits from NSNumber returns an NSDecimalNumber. > > What if I created a class with a method like: > + (MyWeirdClass *)objectWithInt:(int)value > { > return (MyWeirdClass*) [NSNumber numberWithInt: value]; > } > then if I created a subclass, MyVeryWeirdClass, would the expression > [MyVeryWeirdClass objectWithInt:42] somehow magically be of type > (MyVeryWeirdClass *) ? > > -- > Cameron Hayne (hayne@sympatico.ca) > Hayne of Tintagel > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > > Jeff Disher President and Lead Developer of Spectral Class Spectral Class: Shedding Light on Innovation http://www.spectralclass.com/ From andreas at harmless.de Wed Nov 13 17:16:02 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:23 2005 Subject: numberWithInt (was Re: NSForm validation) In-Reply-To: Message-ID: <951287B0-F76E-11D6-901D-00050231227A@harmless.de> Am Donnerstag, 14.11.02 um 01:34 Uhr schrieb Cameron Hayne: > But what is missing is the documentation. The behaviour seems to be an > unstated convention rather than something that is necessarily true. I suppose you are right. The only thing I found was this: http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ ProgrammingTopics/MemoryMgmt/Tasks/AllocInitObjects.html "In addition, classes frequently define "factory" methods - convenience class methods - that allocate and initialize instances for the receiver." > Even > using AppKiDo I fail to see anything that says that the method > numberWithInt > that NSDecimalNumber inherits from NSNumber returns an NSDecimalNumber. Well, I already explained why it does. You can tell that it is such a 'convenience class method', simply by looking at it's name. Any method of class NSXxx named xxxWithWhatever: is a convenience constructor for that class. > What if I created a class with a method like: > + (MyWeirdClass *)objectWithInt:(int)value > { > return (MyWeirdClass*) [NSNumber numberWithInt: value]; > } > then if I created a subclass, MyVeryWeirdClass, would the expression > [MyVeryWeirdClass objectWithInt:42] somehow magically be of type > (MyVeryWeirdClass *) ? No. You explicitly created an NSNumber object; this will not magically be transformed into anything else. No problem though, since it is not named 'myWeirdWith...:'. Assuming MyWeirdClass is a subclass of NSNumber (no point in this example otherwise), for a convenience constructor you would write: + (MyWeirdClass *)myWeirdWithInt:(int)value { return [MyWeirdClass numberWithInt: value]; } Then, [MyVeryWeirdClass myWeirdWithInt:] would return a MyVeryWeirdClass object. (Of course, that example does nothing useful, since it just provides another name for an existing method.) bye. Andreas. From andreas at harmless.de Wed Nov 13 17:45:03 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:23 2005 Subject: numberWithInt (was Re: NSForm validation) In-Reply-To: <53EF596A-F76B-11D6-98A5-000393B6A966@student.math.uwaterloo.ca> Message-ID: <8D16CD3B-F772-11D6-901D-00050231227A@harmless.de> Am Donnerstag, 14.11.02 um 01:52 Uhr schrieb Jeff Disher: > Just joining this conversation so maybe it was already mentioned but I > should point out that NSNumber is an abstract class defining the > behavior of a class cluster. Uh. Now you are opening another can of worms. :-) > That said, the types returned by constructors and convenience > constructors are not of type NSNumber, but rather some internal > sub-class. This is right, but (fortunately ;-)) completely unrelated to the problem. > I am not totally sure what you are discussing here There were two seperate issues: 1. the (not very well documented) convention of convenience methods/constructors and their naming scheme 2. how subclassing and inheritance works in Objective-C Short summary: 1. A class method of class NSXxxx with the name xxxxWithWhatever: is a so-called convenience constructor. This means it's just a short hand form for [[[NSXxxx alloc] initWithWhatever:] autorelease]. 2. In Objective-C, you do not 'call methods'; you 'send selectors'. What method will be triggered, is determined by the receiving object at runtime. If you send a selector for a convenience constructor to a class, it will create and return an object of that class. It does not matter if the method is actually implemented in the class itself, or if it's inherited from a superclass. Say, you send numberWithInt: to NSDecimalNumber (the class). Assume, NSDecimalNumber does not implement numberWithInt: itself. Then the superclass' method will be used. It may look something like this: [[[self alloc] initWithInt:] autorelease]; Now, here is the interesting part: 'self', in our case, does still point to NSDecimalNumber! So you get: [[[NSDecimalNumber alloc] initWithInt:] autorelease]; Which will, obviously, create an NSDecimalNumber object. bye. Andreas. From andreas at harmless.de Wed Nov 13 17:53:02 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:23 2005 Subject: numberWithInt (was Re: NSForm validation) In-Reply-To: <951287B0-F76E-11D6-901D-00050231227A@harmless.de> Message-ID: Am Donnerstag, 14.11.02 um 02:15 Uhr schrieb Andreas Mayer: > + (MyWeirdClass *)myWeirdWithInt:(int)value > { > return [MyWeirdClass numberWithInt: value]; > } This should have been return [self numberWithInt: value]; Sorry for the confusion. bye. Andreas. From jamesp at silver-future.com Wed Nov 13 18:11:01 2002 From: jamesp at silver-future.com (James Powell) Date: Thu Nov 3 14:50:23 2005 Subject: numberWithInt (was Re: NSForm validation) In-Reply-To: <53EF596A-F76B-11D6-98A5-000393B6A966@student.math.uwaterloo.ca> Message-ID: On Wednesday, November 13, 2002, at 05:52 PM, Jeff Disher wrote: > Just joining this conversation so maybe it was already mentioned but I > should point out that NSNumber is an abstract class defining the > behavior of a class cluster. That said, the types returned by > constructors and convenience constructors are not of type NSNumber, > but rather some internal sub-class. That said, you should never have > to worry about that since it fully implements the NSNumber interface. > As far as you are concerned, this IS an NSNumber instance. This makes sense, but some Cocoa methods specify particular NSNumber subclasses. One example is NSNumberFormatter's setMinimum method. The question I guess that I feel is unanswered is how the programmer or the compiler knows that [NSDecimalNumber numberWithInt:1] will return an NSDecimalNumber *. In RTFM, I think I found the answer. The NSNumberCreation category defines an informal protocol. "Being informal, protocols declared in categories don't receive much language support. There's no type checking at compile time nor a check at runtime to see whether an object conforms to the protocol. To get these benefits, you must use a formal protocol. An informal protocol is good for times when implementing all the methods is optional, such as for a delegate." (from file:///Developer/Documentation/Cocoa/ObjectiveC/ 3objc_language_overview/Protocols_1_o_Implement.html) The framework's client can be pretty darn sure that [NSDecimalNumber numberWithInt:1] will return an NSDecimalNumber *, because as Andreas just pointed out, the allocation routine will use "self" which will be an NSDecimalNumber. The compiler doesn't know but the user can rest assured that the type is correct because the framework programmer would have to go out of their way to break the caller's code by allocating the instance using the specific class type, [[[NSNumber alloc] initWithInt:] autorelease] in this case. I'll wager that the idea of allocating the result of an xxxWithyyy method using an explicit class name instead of self is inherently ugly to seasoned Objective C programmers. James From aglee at earthlink.net Wed Nov 13 20:08:03 2002 From: aglee at earthlink.net (Andy Lee) Date: Thu Nov 3 14:50:23 2005 Subject: numberWithInt (was Re: NSForm validation) In-Reply-To: References: Message-ID: At 7:34 PM -0500 11/13/02, Cameron Hayne wrote: >what is missing is the documentation. The behaviour seems to be an >unstated convention rather than something that is necessarily true. >Even using AppKiDo I fail to see anything that says that the method >numberWithInt that NSDecimalNumber inherits from NSNumber returns an >NSDecimalNumber. I've only been skimming this thread, but for some reason when I saw AppKiDo mentioned, I found it more interesting. ;) I agree that the classes of objects returned by instantiators should be better documented, especially since they usually return id's. For example, the doc for [NSArray +arrayWithObjects:] says: Creates and returns an array containing the objects in the argument list. At the very least, they could have said Creates and returns an instance of the receiver containing the objects in the argument list. They could have gone a bit further and added: The returned array is an instance of the class object that received the message. For example, [NSMutableArray arrayWithObjects:...] returns a mutable array. Even if the convention is documented elsewhere, IMO it's worth adding these few words to the individual method docs. This discussion has inspired me to file a bug on this. The Problem ID# is 3100874. --Andy From fahrenba at mac.com Wed Nov 13 21:00:01 2002 From: fahrenba at mac.com (Matthew Fahrenbacher) Date: Thu Nov 3 14:50:23 2005 Subject: Creating NSData objects from Resource Fork Data In-Reply-To: <172990A4-F508-11D6-A568-00039366F3C0@metaobject.com> Message-ID: On Sunday, November 10, 2002, at 05:56 PM, Marcel Weiher wrote: > > On Sunday, November 10, 2002, at 11:54 Uhr, Matthew Fahrenbacher > wrote: > >> On Sunday, November 10, 2002, at 03:27 PM, Marcel Weiher wrote: >> >>> >>> On Sunday, November 10, 2002, at 08:10 Uhr, Matthew Fahrenbacher >>> wrote: >>> >>>> I was working on a project where I can distribute files at certain >>>> times, but I'm running into a little snag. It's painfully easy to >>>> use NSData to archive a files data and keep its attributes in an >>>> NSDictionary to be applied later. The trick is to be able to >>>> maintain the resource fork data as well. Here's my attempt at >>>> doing it, and I was wondering if anyone could help point out what >>>> I'm doing wrong (I'm not very good with the Carbon APIs). >>> >>> How about just using the fact that the resource fork can be accessed >>> via /rsrc ? >>> >>> This is untested (and typed straight into Mail), but I think it >>> should work, if you really want just the raw bytes. >>> >>> -------- snip --- >>> >>> @implementation NSData(resourceIO) >>> >>> +(NSData*)dataWithContentsOfResourceForkOfFile:(NSString*)path >>> { >>> return [self dataWithContentsOfFile:[path >>> stringByAppendingString:@"/rsrc"]]; >>> } >>> >>> -(void)writeToResourceForkOfFile:(NSString*)path >>> { >>> [self writeToFile: path stringByAppendingString:@"/rsrc"] >>> atomically:NO]; >>> } >>> >>> @end >>> >>> ---- snip ------- >> >> I had read somewhere saying that would work, but it doesn't seem to >> work for me. > > I just tried it out and it works fine for me (on an HFS+ filesystem, > it won't work on UFS). > > Marcel > Nevermind, this methods works. I was being a moron and in the code where I tried to write out the resource I wasn't expanding the tilde in the path. I'm still creating the Resource Fork first by using Carbon, but I don't know if it's necessary. Thanks everyone! Matt From fahrenba at mac.com Wed Nov 13 23:24:05 2002 From: fahrenba at mac.com (Matthew Fahrenbacher) Date: Thu Nov 3 14:50:23 2005 Subject: Finding (possible) IP address of mounted volumes Message-ID: <03EBC480-F796-11D6-A7E8-00039340986C@mac.com> The subject pretty much says it all - is there a way to find this information out? I want to check for some information against a mounted server and make sure that the mounted server has a certain IP address. I looked at PBHGetVolParmsSync, FSGetVolumeInfo, and PBGetVolMountInfo, but none of them seem to do what I want (one mentioned something Appletalk, but I really just wan the IP address). Anyone have an idea? Thanks, Matt From Etienne.Petitjean at loria.fr Thu Nov 14 02:42:01 2002 From: Etienne.Petitjean at loria.fr (Etienne Petitjean) Date: Thu Nov 3 14:50:23 2005 Subject: Authorization Services & OpenDirectory Message-ID: <043601c28bca$db1caf20$98075198@thelod> Hi, I'm currently developing a software that needs to use the Authentication Framework to launch root unix tools. To do this, I use the Authorization Services API (AuthorizationCreate). This works quite well. On the other hand I must also use OpenDirectory (working on NetInfo node). To do what I want to do with NetInfo, I must also identify the user with the dsDoDirNodeAuth API. The problem is that when using AuthorizationCreate, you can only make a graphical Authorization using the "kAuthorizationFlagInteractionAllowed". Doing otherwise will fail. This means that once authentification is done, you can't retrieve the user name and password entered by the user. And I need these to do the dsDoDirNodeAuth authentification. I'm stuck and I currently see no way to to that. Anyone with a nice idea ? Thanx, Etienne From arminb at mac.com Thu Nov 14 02:54:01 2002 From: arminb at mac.com (Armin Briegel) Date: Thu Nov 3 14:50:23 2005 Subject: [OFF] Reporting freezes (not crashes) to Apple? In-Reply-To: <499E824C-F717-11D6-B7D4-00306583D14E@students.latrobe.edu.au> Message-ID: <1D71F80C-F7AB-11D6-9C4D-0003936E5096@mac.com> Several different kinds of Log are generated and managed by Jaguar. Open Apple System Profiler and go to the Logs tab. There you will get several logs neatly sorted by application. Right at the bottom you will also have a kernel panic log, which is very important, because Jaguar doesn't print the information to the screen anymore (was pretty much useless anyway). Of course you can always keep console open, when you are trying to reproduce a crash in an application or tool. Armin =) On Mittwoch, Nov 13, 2002, at 15:50 Europe/Berlin, Wade Tregaskis wrote: > How am I supposed to report system freezes to Apple? They > unofficially refuse to take them, as they don't generate a panic log > [for obvious reasons]. I've been through the process with them > recently over this, and basically it turned into a battle of who could > be bothered sending the last word...they won out...damn auto-reply bot > thing. "Please send in a crash log" "There is no crash log" "Please > send in a crash log" "You're not listening..." "Please send in a > crash log"...ad infinum. > > So, what do I do? For instance, I'm narrowing down a recent recurring > freeze, which seems to be the window server dying and taking > absolutely everything else with it. While I understand how little > help it is to submit a bug report without any sort of crash/panic log > or similar, should I submit it anyway? As I said, past reports like > this have generated mindless email wars with some bot (or someone who > severely abuses copy and paste)... > -- "In theory, there is no difference between theory and practice. But in practice, there is." - Jan L.A. van de Snepscheut From andreas at harmless.de Thu Nov 14 06:49:01 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:23 2005 Subject: numberWithInt (was Re: NSForm validation) In-Reply-To: Message-ID: <1041D54A-F7E0-11D6-901D-00050231227A@harmless.de> Am Donnerstag, 14.11.02 um 05:07 Uhr schrieb Andy Lee: > They could have gone a bit further and added: > > The returned array is an instance of the class > object that received the message. For example, > [NSMutableArray arrayWithObjects:...] returns a > mutable array. In case of an array this would not be entirely correct. See discussion of class clusters before. You'll get some _subclass_ of the receiver. It's not really necessary to know which one. In fact, those subclasses are not even documented, but considered an implementation detail. See http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ ProgrammingTopics/Foundation/Concepts/ClassClusters.html bye. Andreas. From bwebster at mac.com Thu Nov 14 07:38:16 2002 From: bwebster at mac.com (Brian Webster) Date: Thu Nov 3 14:50:23 2005 Subject: When Drop Can Be A Drag In-Reply-To: <200211140212.gAE2CEf27572@slowbro.omnigroup.com> Message-ID: <6536D658-F7E6-11D6-A0E4-000393A9F2FC@mac.com> On Wednesday, November 13, 2002, at 08:12 PM, macosx-dev-request@omnigroup.com wrote: > What I can see, the only possibility I have not tried is > > [[sender draggingPasteboard] propertyListForType: > NSFilenamesPboardType] > > But that just calls dataForType anyway. > > I am aware that I can expect not one but multiple file names on a > drop, yet if I try to cast the return to NSArray *, he doesn't like > that either. The format of the data returned on stringForType is > XML.. The propertyListForType: method is the one that you should use. It should return an NSArray of NSStrings with the paths that are dropped on. Take a look at the copy + paste programming topic in the Cocoa docs for complete info on what data is stored for the standard types (looking under the data types subsection). -- Brian Webster bwebster@mac.com http://homepage.mac.com/bwebster From aglee at earthlink.net Thu Nov 14 08:30:01 2002 From: aglee at earthlink.net (Andy Lee) Date: Thu Nov 3 14:50:23 2005 Subject: numberWithInt (was Re: NSForm validation) In-Reply-To: <1041D54A-F7E0-11D6-901D-00050231227A@harmless.de> References: <1041D54A-F7E0-11D6-901D-00050231227A@harmless.de> Message-ID: At 3:47 PM +0100 11/14/02, Andreas Mayer wrote: >Am Donnerstag, 14.11.02 um 05:07 Uhr schrieb Andy Lee: > >>They could have gone a bit further and added: >> >> The returned array is an instance of the class >> object that received the message. For example, >> [NSMutableArray arrayWithObjects:...] returns a >> mutable array. > >In case of an array this would not be entirely correct. See >discussion of class clusters before. > >You'll get some _subclass_ of the receiver. With apologies to Bill Clinton, it depends on what the meaning of "is a" is, or rather "instance of." Depending on the semantics you choose for a particular discussion, an instance of a subclass can be considered an instance of the superclass. The important point is that that the returned instance has all the attributes promised by the instantiating class. For example, [NSMutableArray arrayWithObjects:...] returns a mutable array, both in the sense that it is mutable and in the sense that it satisfies isKindOfClass:[NSMutableArray class] (though not isMemberOfClass:[NSMutableArray class], but that's true for class cluster instances in general). --Andy From itinerant at mac.com Thu Nov 14 10:58:01 2002 From: itinerant at mac.com (Pete Carss) Date: Thu Nov 3 14:50:23 2005 Subject: Uneditable Nibs... Message-ID: Hello List.. I have a project with a nib which isn't "main menu". I been working on it happily for months, adding outlets/actions as needed etc. Now suddenly It has become greyed out in the classes tab in IB. Double clicking the instance brings up the custom class pane, I can add/delete actions, but not outlets, they are all greyed out. Also there is an outlet there, a reference to a custom class of NSView which doesn't appear in the header? I can't delete it, IB won't parse the header file to refresh it - nothings works. Help? Pete From andreas at harmless.de Thu Nov 14 13:17:02 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:23 2005 Subject: numberWithInt (was Re: NSForm validation) In-Reply-To: Message-ID: <57666BA0-F816-11D6-901D-00050231227A@harmless.de> Am Donnerstag, 14.11.02 um 17:29 Uhr schrieb Andy Lee: > With apologies to Bill Clinton, it depends on what the meaning of "is > a" is, or rather "instance of." Of course. Looks like I've misinterpreted your suggestion. bye. Andreas. From dreamless at attbi.com Thu Nov 14 15:51:01 2002 From: dreamless at attbi.com (Nick Zitzmann) Date: Thu Nov 3 14:50:23 2005 Subject: Some (probably stupid) Sherlock SDK questions... Message-ID: It's finally out! And I have some questions... 1. How do I write multiple channels in the same subscription? I noticed Apple has done this with their debugging channels; how did they do that? 2. How do I change the name of the channel as it appears in Sherlock from "Sherlock Channel" to something else? I can't find the name in any obvious place. 3. Is there a _good_ reference for XQuery somewhere out there? I found a reference on the W3C's site, but it was overkill for just learning about the language. Likewise, is there a listing of all Sherlock JavaScript and XQuery functions somewhere out there? Thanks for any answers... Nick Zitzmann AIM/iChat: dragonsdontsleep Check out my software page: http://dreamless.home.attbi.com/ "La la la! I sing, too! For food, for food! La la la!" - Gabo, Dragon Warrior VII From andrew at zamler-carhart.com Thu Nov 14 18:44:01 2002 From: andrew at zamler-carhart.com (Andrew Zamler-Carhart) Date: Thu Nov 3 14:50:23 2005 Subject: Optimizing Distributed Objects Message-ID: <0F1A3ADF-F844-11D6-A851-000A277A6C34@zamler-carhart.com> Dear list, I would like to optimize the network performance of my application, which uses Distributed Objects over TCP/IP. Is there a convenient way to log every time a message is sent to a remote object? I'd like to know the sending object, receiving object, and what the message was. Just a big dump to standard out would be fine. Thanks, Andrew From joe_esch at mac.com Thu Nov 14 19:38:03 2002 From: joe_esch at mac.com (Joe Esch) Date: Thu Nov 3 14:50:23 2005 Subject: NSPopUpButton removeAllItems and autorelease Message-ID: <96204722-F84B-11D6-91DA-000393BCB39C@mac.com> I have an NSPopUpButton on a panel and I want to build its menu dynamically from the contents of a folder. I had it all working OK, and then I wanted to modify it so that I could refresh the menu if the folder contents may have changed. To do this, I just sent removeAllItems to my NSPopUpButton and then added the new menu items. After I made this change, things started crashing at seemingly random times (although always while building the menu.) The symptoms look like various NSStrings that I got before calling removeAllItems (strings that were not in the menu) are being released. These are all strings that should be autoreleased. My understanding of autorelease is that unless you explicitly cause the autorelease pool to do an autorelease, your objects will get released sometime in the future, but they will stay around within the current call frame. My question is if there is any way that the removeAllObjects call could be forcing an early autorelease and thus causing my strings to go away. I fixed the problem by not using removeAllObjects and just manually removing them by calling removeItemAtIndex multiple times. I would like to understand what was going on however so that I can avoid problems like this in the future. From tjw at omnigroup.com Thu Nov 14 23:01:02 2002 From: tjw at omnigroup.com (Timothy J. Wood) Date: Thu Nov 3 14:50:23 2005 Subject: Optimizing Distributed Objects In-Reply-To: <0F1A3ADF-F844-11D6-A851-000A277A6C34@zamler-carhart.com> Message-ID: There is a private method: +[NSConnection _enableLogging:] It takes a BOOL. I don't recall what format it it prints out, but I've found it useful in the past. YMMV. Also, you could just run tcpdump on your interface :) If you haven't already, you should definitely set protocols on all your DO proxy objects via -[NSDistantObject setProtocolForProxy:]. This can be a major savings. -tim On Thursday, November 14, 2002, at 06:43 PM, Andrew Zamler-Carhart wrote: > Dear list, > > I would like to optimize the network performance of my application, > which uses Distributed Objects over TCP/IP. > > Is there a convenient way to log every time a message is sent to a > remote object? I'd like to know the sending object, receiving object, > and what the message was. Just a big dump to standard out would be > fine. > > Thanks, > Andrew > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From moetteli.bulk at bluewin.ch Fri Nov 15 04:59:00 2002 From: moetteli.bulk at bluewin.ch (=?ISO-8859-1?Q?Philip_M=F6tteli?=) Date: Thu Nov 3 14:50:23 2005 Subject: Remote Compiling with the new ProjectBuilder Message-ID: Hi Is there a way to compile a program from within ProjectBuilder on another host? With the old ProjectBuilder we could choose a host and remote compile on them. Re Phil From fablosso at yahoo.com Fri Nov 15 06:05:01 2002 From: fablosso at yahoo.com (Fabio Lossotti) Date: Thu Nov 3 14:50:23 2005 Subject: Saving NSView as a Hi-Res Image Message-ID: <20021115140450.43034.qmail@web21204.mail.yahoo.com> I've got a NSView subclass that I want to save as a 'higher' resolution image, i.e. something higher than 72 dpi. To save the 72 dpi image I create an NSImage, lock focus on it and draw to the NSImage what usually is drawn to the NSView. Is there a way to change that process so the result is a higher resolution image than 72 dpi? -Fabio __________________________________________________ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com From wjcheeseman at earthlink.net Fri Nov 15 10:12:01 2002 From: wjcheeseman at earthlink.net (Bill Cheeseman) Date: Thu Nov 3 14:50:23 2005 Subject: [ANN] Vermont Recipes published Message-ID: I received my author's copies yesterday, so it won't be long before "Cocoa Recipes for Mac OS X: The Vermont Recipes" (Peachpit Press) shows up in bookstores and starts shipping from online sources. I'll get the sample chapters and project files updated as soon as possible at www.stepwise.com/Articles/VermontRecipe. Ordering info: Peachpit Press: and click the article at the top. Amazon: . Barnes & Noble: . -- Bill Cheeseman - wjcheeseman@earthlink.net Quechee Software, Quechee, Vermont, USA http://www.quecheesoftware.com The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes Croquet Club of Vermont - http://members.valley.net/croquetvermont From soft at bdanube.com Fri Nov 15 10:28:01 2002 From: soft at bdanube.com (Michael Grant) Date: Thu Nov 3 14:50:23 2005 Subject: [ANN] Vermont Recipes published In-Reply-To: Message-ID: On 11/15/02 12:06 PM, "Bill Cheeseman" wrote: > I received my author's copies yesterday, so it won't be long before "Cocoa > Recipes for Mac OS X: The Vermont Recipes" (Peachpit Press) shows up in > bookstores and starts shipping from online sources. I'll get the sample > chapters and project files updated as soon as possible at > www.stepwise.com/Articles/VermontRecipe. Congratulations Bill! Since you're a longtime AppleScript guy too, does the book cover implementation of AS in Cocoa apps in any detail? Also, will using the links you posted to order the book earn you a referral fee? Another author told me his Amazon referral fee for selling one copy is more than his royalties for the same book. Michael -- If you think you are too small to make a difference, try sleeping in a closed room with a mosquito.... - African proverb From wjcheeseman at earthlink.net Fri Nov 15 10:57:13 2002 From: wjcheeseman at earthlink.net (Bill Cheeseman) Date: Thu Nov 3 14:50:23 2005 Subject: [ANN] Vermont Recipes published In-Reply-To: Message-ID: on 02-11-15 1:27 PM, Michael Grant at soft@bdanube.com wrote: > Since you're a longtime AppleScript guy too, does the book cover > implementation of AS in Cocoa apps in any detail? Not a word about AppleScript! Well, a word or two, but no more. That's a subject for volume II, if I ever replenish the energy I used up in writing the first volume. > Also, will using the links you posted to order the book earn you a referral > fee? Another author told me his Amazon referral fee for selling one copy is > more than his royalties for the same book. No, I won't get a penny from Amazon.com or Barnes & Noble out of the links in my email announcement. I would urge people who want to buy my book to order it through the Stepwise site. Scott Anguish should have his Amazon.com link up real soon now;. That way, he'll get some Amazon money to support the Stepwise site -- which will help Stepwise to continue to benefit all Cocoa developers. (Disclosure: I'm a Stepwise editor.) I think I might have mistyped the Stepwise URL in my announcement. Here it is, correctly: -- Bill Cheeseman - wjcheeseman@earthlink.net Quechee Software, Quechee, Vermont, USA http://www.quecheesoftware.com The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes Croquet Club of Vermont - http://members.valley.net/croquetvermont From jrepp at ingeniux.com Fri Nov 15 13:09:01 2002 From: jrepp at ingeniux.com (Jake A. Repp) Date: Thu Nov 3 14:50:23 2005 Subject: Low impact way to flush the 'idle' notification queue? Message-ID: I have an application with two threads, I am enqueing notifications on the NSNotificationQueue of the main (UI) thread using the NSPostASAP posting style. This seems to work when the application is starting up but once it has gone into a normal state the notifications are no longer processed. This is the case with NSPostWhenIdle posting style as well. I can look at the [NSRunLoop currentRunMode] and look at the main thread's notification queue (which has the correct notifications queued up). Both the run modes match. Incidentally I am using nil as the parameter to 'forModes:' so that shouldn't matter. I have found mention in older NextStep newsgroups that the application may not process these notifications right away but it seems like the idle timer should be triggering the processing of the notification. Anyone got any tips they'd like to share on this? -jake From jim at burtcom.com Fri Nov 15 14:22:01 2002 From: jim at burtcom.com (Jim Burton) Date: Thu Nov 3 14:50:23 2005 Subject: Q. for Java - Cocoa developers... In-Reply-To: Message-ID: <3707EA30-F8E5-11D6-AB58-00039398E6D8@burtcom.com> I'm a newbie to Cocoa development, and I've been dabbling in Java for a short time. Let's pretend that Java 1.4 has been released for OSX, and I've created a Cocoa-Java app that uses a Java 1.4 feature, such as regular expressions. Does the application package contain the necessary Java 1.4 classes and runtime, so that it will run on a OSX machine that has NOT upgraded to Java 1.4? Jim From njriley at uiuc.edu Fri Nov 15 14:45:00 2002 From: njriley at uiuc.edu (Nicholas Riley) Date: Thu Nov 3 14:50:23 2005 Subject: Q. for Java - Cocoa developers... In-Reply-To: <3707EA30-F8E5-11D6-AB58-00039398E6D8@burtcom.com> References: <3707EA30-F8E5-11D6-AB58-00039398E6D8@burtcom.com> Message-ID: <20021115224127.GA2508498@uiuc.edu> On Fri, Nov 15, 2002 at 02:57:20PM -0700, Jim Burton wrote: > I'm a newbie to Cocoa development, and I've been dabbling in Java for a > short time. > > Let's pretend that Java 1.4 has been released for OSX, and I've > created a Cocoa-Java app that uses a Java 1.4 feature, such as regular > expressions. > > Does the application package contain the necessary Java 1.4 classes and > runtime, so that it will run on a OSX machine that has NOT upgraded to > Java 1.4? No. Java-Cocoa apps would be gigantic if that were true. -- =Nicholas Riley | Pablo Research Group, Department of Computer Science and Medical Scholars Program, University of Illinois at Urbana-Champaign From eyredler at netvision.net.il Fri Nov 15 17:02:09 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:23 2005 Subject: NSPopUpButton removeAllItems and autorelease In-Reply-To: <96204722-F84B-11D6-91DA-000393BCB39C@mac.com> Message-ID: <96E1BB7C-F8FE-11D6-8EA1-003065C9C4EE@netvision.net.il> HI, > My understanding of autorelease is that unless you explicitly cause > the autorelease pool to do an autorelease, your objects will get > released sometime in the future, but they will stay around within the > current call frame. Not exactly. The objects in the autorelease pool will have their "release" method called sometime in the future. They don't protect the objects from being deallocated! Assuming that the strings are referenced only by the menu array. Their retain count is 1. When you call autorelease, you are just adding them to the list of objects that will have their release method called later. their retain count is still one. Then you call removeAllItems and every object is sent a release message and they're deallocated (since the retain count is going from one to zero). Then, when the autorelease pool is trying to release them, it is sending a release message to a pointer pointing at a freed object (and you're app crashes) What you should do is to *retain* the strings you want to save and then release them when you're done with them. Hope I didn't misunderstand, Eyal From wadesworld at mac.com Fri Nov 15 18:42:01 2002 From: wadesworld at mac.com (Wade Williams) Date: Thu Nov 3 14:50:23 2005 Subject: Optimizing Distributed Objects In-Reply-To: <0F1A3ADF-F844-11D6-A851-000A277A6C34@zamler-carhart.com> Message-ID: <4FDB1FAF-F857-11D6-A71A-00039357E2E8@mac.com> Actually, we just did a section on that today in Aaron Hillegass' "Core Mac OS X" programming class, at the Big Nerd Ranch (www.bignerdranch.com). I highly recommend all of their classes. But to give you a little tidbit, make sure that you set the protocol on the NSDistantObject to minimize the messages sent. Additionally, check out the delegate methods on the NSConnection - there may be one there which is called whever an object is sent. (Note however, that I'm not a guru on this stuff - just more informed than I was yesterday) Wade On Thursday, November 14, 2002, at 08:43 PM, Andrew Zamler-Carhart wrote: > Dear list, > > I would like to optimize the network performance of my application, > which uses Distributed Objects over TCP/IP. > > Is there a convenient way to log every time a message is sent to a > remote object? I'd like to know the sending object, receiving object, > and what the message was. Just a big dump to standard out would be > fine. > > Thanks, > Andrew > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From software at jasendo.ca Fri Nov 15 19:01:01 2002 From: software at jasendo.ca (Jasendo Technologies Ltd.) Date: Thu Nov 3 14:50:23 2005 Subject: [ANN]TDCBTableCells Palette v1.0 released Message-ID: <3DD5B4CA.8030105@jasendo.ca> Jasendo Technologies Ltd. is pleased to announce the release of TDCBTableCells Palette v1.0. This inexpensive collection of table cells can help Cocoa developers to configure NSTableView easily to display progress indicators, icons (displayed with different transparency values), check boxes, push, rounded bevel, radio and round buttons, combo boxes, pop-up and pull-down buttons, sliders and an inspector for NSTextField cells that helps to change font sizes, make them italic, bold, change background, text color, and many other functions. For more information please visit us at: http://www.jasendo.ca Thank you. Jasendo Technologies Ltd. From gcoffey at wmotion.com Fri Nov 15 20:45:00 2002 From: gcoffey at wmotion.com (Geoff Coffey) Date: Thu Nov 3 14:50:23 2005 Subject: Copy Files build phase with Absolute Path Message-ID: <0F4854AE-F91E-11D6-AA35-0030656C5366@wmotion.com> I'm trying to debug a prefpane easily. I added System Preferences as an executable, which seems to work well. Now I can debug my panel properly if I manually copy it to the right place in the library folder. I then added a Copy Files build phase, but it doesn't work as I would expect. I have "Absolute Path" selected, and have entered '/Users//Library/PreferencePanes/' as the path. When it builds, it creates /tmp/.dst/ and then treats my absolute path relative to this new directory. Is this what it is supposed to do? If so, is there a way to make a copy files build phase actually copy to an arbitrary absolute path? I know I can use a shell script or applescript as a workaround, I'm just wondering if I'm missing something. Even better, is there another way to get System Preferences to load my prefpane directly without installing it? That would seem a better approach. Thanks! Geoff From dunham at mac.com Fri Nov 15 21:15:01 2002 From: dunham at mac.com (David Dunham) Date: Thu Nov 3 14:50:23 2005 Subject: Q. for Java - Cocoa developers... In-Reply-To: <3707EA30-F8E5-11D6-AB58-00039398E6D8@burtcom.com> Message-ID: <57FC4162-F922-11D6-B9B3-003065C13422@mac.com> On Friday, November 15, 2002, at 01:57 PM, Jim Burton wrote: > Let's pretend that Java 1.4 has been released for OSX, and I've > created a Cocoa-Java app that uses a Java 1.4 feature, such as regular > expressions. > > Does the application package contain the necessary Java 1.4 classes > and runtime, so that it will run on a OSX machine that has NOT > upgraded to Java 1.4? No more than if it were a Swing-Java app. David Dunham A Sharp david@a-sharp.com Voice/Fax: 206 783 7404 http://a-sharp.com Efficiency is intelligent laziness. From jonhendry at mac.com Fri Nov 15 21:26:02 2002 From: jonhendry at mac.com (Jonathan Hendry) Date: Thu Nov 3 14:50:23 2005 Subject: Editing huge text files in NSTextView In-Reply-To: Message-ID: On Wednesday, Nov 13, 2002, at 00:37 America/New_York, erik wrote: > Douglas Davidson wrote: >> I might also note that the application TextEdit replaced had a >> somewhat smaller size limitation. > > this was the reason i finally dropped hypercard in '99 :^) Whoa, culture clash. I thought Douglas was referring to Edit.app, the old NeXT app. Now it occurs to me that he might have meant TeachText or similar, which had the weensy document size limit. (Which would make sense, because I remember Edit.app as being faster with large files than TextEdit.) Which do you mean, Douglas? -- Jonathan W. Hendry NeXTSTEP/OpenStep/Cocoa jonhendry@mac.com programmer in Connecticut From dunham at mac.com Fri Nov 15 21:39:54 2002 From: dunham at mac.com (David Dunham) Date: Thu Nov 3 14:50:23 2005 Subject: Editing huge text files in NSTextView In-Reply-To: Message-ID: On Friday, November 15, 2002, at 09:25 PM, Jonathan Hendry wrote: >> Douglas Davidson wrote: >>> I might also note that the application TextEdit replaced had a >>> somewhat smaller size limitation. >> >> this was the reason i finally dropped hypercard in '99 :^) > > Whoa, culture clash. > > I thought Douglas was referring to Edit.app, the old NeXT app. Now it > occurs to me that he might have meant TeachText or similar, which > had the weensy document size limit. (Which would make sense, > because I remember Edit.app as being faster with large files than > TextEdit.) To make matters worse, TextEdit is the name of the Toolbox routines which TeachText (or SimpleText) used. These were the source of the 32K limit. I'm pretty sure Hypercard used TextEdit (the routines), and that's what the non-Douglas quote above is likely referring to. David Dunham A Sharp david@a-sharp.com Voice/Fax: 206 783 7404 http://a-sharp.com Efficiency is intelligent laziness. From pg at powerplum.com Sat Nov 16 00:46:43 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:23 2005 Subject: Copy Files build phase with Absolute Path In-Reply-To: <0F4854AE-F91E-11D6-AA35-0030656C5366@wmotion.com> Message-ID: Geoff, Whew! I just spent a couple hours fighting with Project Builder trying to get this to work. Haha. I wanted to know how to do it anyway. What you did was exactly what the Project Builder Help files say to do. I tried it and it does the same thing. I think it's a bug in the new Project Builder maybe (??). But, here's what I did to get my product copied to another location on the system: Short Answer (if you know how to write a shell script) : Write a shell script that has the command: cp -R /Users///build/ /Users//Library/PreferencePanes/ and add a new "Shell Script" build phase that references it WITH AN ABSOLUTE PATH (this is what was giving me a hard time) Long Answer (if you've never written a shell script before) : [1] Create a new file in Project Builder and call it "prefpanecopier.sh" [2] Type the following two lines (filling in your info where needed): #! /bin/sh cp -R /Users///build/ /Users//Library/PreferencePanes/ [3] Open Terminal.app, cd into your project directory and type the following command: chmod 755 prefpanecopier.sh [4] In Project Builder, get rid of your Copy Files build phase and create a new Shell Script build phase. [5] Make sure this is the last build phase and then type the ABSOLUTE path to your script in the "Script:" field. [6] Build (you may need to clean first. not sure. I think I trashed the entire contents of my build directory in the Finder just in case.) Hope this helps. - Philip On Friday, November 15, 2002, at 10:44 PM, Geoff Coffey wrote: > I'm trying to debug a prefpane easily. I added System Preferences as > an executable, which seems to work well. Now I can debug my panel > properly if I manually copy it to the right place in the library > folder. I then added a Copy Files build phase, but it doesn't work as > I would expect. I have "Absolute Path" selected, and have entered > '/Users//Library/PreferencePanes/' as the path. When it builds, it > creates /tmp/.dst/ and then treats my absolute path relative > to this new directory. Is this what it is supposed to do? If so, is > there a way to make a copy files build phase actually copy to an > arbitrary absolute path? I know I can use a shell script or > applescript as a workaround, I'm just wondering if I'm missing > something. > > Even better, is there another way to get System Preferences to load my > prefpane directly without installing it? That would seem a better > approach. > > Thanks! > > Geoff > > _______________________________________________ > 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: 2800 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021116/b8f47795/attachment.bin From stupidfish23 at mac.com Sat Nov 16 02:32:01 2002 From: stupidfish23 at mac.com (=?ISO-8859-1?Q?Benj=E1min_Sal=E1nki?=) Date: Thu Nov 3 14:50:23 2005 Subject: drawing text into an NSView Message-ID: <9590BA6E-F94E-11D6-A695-003065BB04BA@mac.com> hello, I am playing around with cocoa graphics, and was looking for a way to draw text at a given point of my NSView subclass, but I couldn't find anything on this in the docs. The topic Drawing Text reads documentation forthcoming. Any help is appreciated, thanks, Ben From jonj at realsoftware.com Sat Nov 16 06:21:01 2002 From: jonj at realsoftware.com (Jon Johnson) Date: Thu Nov 3 14:50:23 2005 Subject: drawing text into an NSView In-Reply-To: <9590BA6E-F94E-11D6-A695-003065BB04BA@mac.com> Message-ID: <90B660F2-F96E-11D6-A0DD-000393677A36@realsoftware.com> Head over to stepwise.com, and look at this article http://www.stepwise.com/Articles/Technical/2001-05-05.01.html (Mining for Quartz). It is the way I learned how to draw. Hope this helps, Jon On Saturday, November 16, 2002, at 04:31 AM, Benj?min Sal?nki wrote: > hello, > > I am playing around with cocoa graphics, and was looking for a way to > draw text at a given point of my NSView subclass, but I couldn't find > anything on this in the docs. The topic Drawing Text reads > documentation forthcoming. > > Any help is appreciated, > > thanks, > > Ben > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From parmadil at earthlink.net Sat Nov 16 14:01:01 2002 From: parmadil at earthlink.net (Parmadil Istarion) Date: Thu Nov 3 14:50:23 2005 Subject: Programmatically setting icon positions Message-ID: <0739C0B6-F9AF-11D6-8276-0030657A21AC@earthlink.net> Hi, I'm trying to figure out how to set an icon's position within a window programmatically. Specifically, I want to do this within a shell script, so my application can be automatically packaged within a disk image after building. The disk image I'm using has a background which requires the file to appear at a specific location. Unfortunately /developer/tools/setfile does not appear to support this. Is there any way to do this outside of writing a Carbon tool to do it? Thanks! From jgrosjean at gooeyball.com Sat Nov 16 14:03:02 2002 From: jgrosjean at gooeyball.com (Jesse Grosjean) Date: Thu Nov 3 14:50:23 2005 Subject: search text field Message-ID: <0BE80ACC-F9AF-11D6-9779-003065994788@gooeyball.com> Hi, I'm wondering if anyone can suggest the best way to implement a Mail.app (Jaguar version) type search field... It should be rounded, have a search icon at the beginning of the field, text, and a close button at the end of the field. I think I can do it by subclassing NSView and adding some NSImageView children and an NSTextField child with a blank background, but I'm not quite sure how to draw the rounded focus highlight. Also I'm suspecting their might be an easier way to go about it, any suggestions would be helpful. Thanks, Jesse Grosjean From ploiku at earthlink.net Sat Nov 16 14:56:01 2002 From: ploiku at earthlink.net (Hsu) Date: Thu Nov 3 14:50:23 2005 Subject: gnutar question... Message-ID: <77CAD108-F9B6-11D6-9109-00039303C450@earthlink.net> Does anyone know of any bugs when dumping the compressed archive to stdout? TiBook.local.:tmp:{5}> gnutar cvzf testDir1.tgz testDir TiBook.local.:tmp:{6}> gnutar czf - testDir > testDir2.tgz TiBook.local.:tmp:{7}> ls -l drwxr-xr-x 3 karlhsu wheel 102 Nov 16 14:50 testDir/ -rw-r--r-- 1 karlhsu wheel 258637 Nov 16 14:51 testDir1.tgz -rw-r--r-- 1 karlhsu wheel 266240 Nov 16 14:51 testDir2.tgz TiBook.local.:tmp:{8}> gnutar xzf testDir1.tgz TiBook.local.:tmp:{9}> gnutar xzf testDir2.tgz gzip: stdin: decompression OK, trailing garbage ignored gnutar: Child returned status 2 gnutar: Error exit delayed from previous errors TiBook.local.:tmp:{10}> What's the deal here? Why does "gnutar czf -" produce a different file than "gnutar czf " ? Karl -- OS/2? What's that? Half of an Operating System? Homepage: http://homepage.mac.com/khsu/index.html From rbartig at hotmail.com Sat Nov 16 17:36:00 2002 From: rbartig at hotmail.com (Ryan Bartig) Date: Thu Nov 3 14:50:23 2005 Subject: newbie question about progress bars Message-ID: I created a small simple project with a button and a progress bar.  I subclassed NSObject then added an action and a outlet.  I then instantiated the new class and control dragged from the object to the progress bar to connect to create the connect for the outlet.  Then I control dragged from the button to the object to connect it to the action.  After that I created the two files (.h  & .m) in the project.  When I click the button nothing happens and am totally lost.  Attached below is the code, any help would be greatly appreciated.  Thanks in advance. /* progress_bar (.h file) */ #import @interface progress_bar : NSObject {     IBOutlet id progressView;     NSTimer *timer; } - (IBAction)pushedButton:(id)sender; @end // beginning of .m file #import "progress_bar.h" @implementation progress_bar - (void)awakeFromNib { srandom(time(NULL)); } - (IBAction)pushedButton:(id)sender { if([sender state] == 1) { NSLog(@"Starting"); timer = [[NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(checkTime:) userInfo:nil repeats:YES] retain]; } else { NSLog(@"Stopping"); [timer invalidate]; [timer release]; } } - (void) checkTime: (NSTimer *) aTimer { NSLog(@"check"); [progressView incrementBy:10]; } @end _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail From fabienlroy at mac.com Sat Nov 16 17:46:02 2002 From: fabienlroy at mac.com (Fabien Roy) Date: Thu Nov 3 14:50:23 2005 Subject: gnutar question... In-Reply-To: <77CAD108-F9B6-11D6-9109-00039303C450@earthlink.net> Message-ID: <482E62DB-F9CE-11D6-9733-000393658196@mac.com> Here is your answer: > testDir2.tgz: 266240 % 512 = 0 > testDir1.tgz: 258637 % 512 = 77 When using stdout and redirection for tar the registered file length is a multiple of the block length on the blocking device. That's why you have the message "gzip: stdin: decompression OK, trailing garbage ignored". The problem is gzip which do not understand the zero padding at the end of the file. A solution for using stdout is to pipe it with gzip explicitly: > gnutar cf - testDir | gzip -9 > testDir2.tgz With no file destination, i.e. stdout gnutar always write the output in multiple of n*512 bytes (where n = 20 on my Mac OS X file system) and pad the file with zeroes. In your case gnutar pad with zeroes the last write so it's a multiple of n*512. So your compressed file is padded with zeroes. Hope that helps. Fabien On Saturday, Nov 16, 2002, at 14:55 US/Pacific, Hsu wrote: > Does anyone know of any bugs when dumping the compressed archive to > stdout? > > TiBook.local.:tmp:{5}> gnutar cvzf testDir1.tgz testDir > TiBook.local.:tmp:{6}> gnutar czf - testDir > testDir2.tgz > TiBook.local.:tmp:{7}> ls -l > drwxr-xr-x 3 karlhsu wheel 102 Nov 16 14:50 testDir/ > -rw-r--r-- 1 karlhsu wheel 258637 Nov 16 14:51 testDir1.tgz > -rw-r--r-- 1 karlhsu wheel 266240 Nov 16 14:51 testDir2.tgz > TiBook.local.:tmp:{8}> gnutar xzf testDir1.tgz > TiBook.local.:tmp:{9}> gnutar xzf testDir2.tgz > > gzip: stdin: decompression OK, trailing garbage ignored > gnutar: Child returned status 2 > gnutar: Error exit delayed from previous errors > TiBook.local.:tmp:{10}> > > What's the deal here? Why does "gnutar czf -" produce a different file > than "gnutar czf " ? > > Karl > > -- > > OS/2? What's that? Half of an Operating System? > > Homepage: > http://homepage.mac.com/khsu/index.html > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From chergr at bigpond.com Sat Nov 16 17:59:01 2002 From: chergr at bigpond.com (Richard) Date: Thu Nov 3 14:50:23 2005 Subject: Programmatically setting icon positions References: <0739C0B6-F9AF-11D6-8276-0030657A21AC@earthlink.net> Message-ID: <3DD6F7C4.6A51C6FC@bigpond.com> Use Applescript??? Parmadil Istarion wrote: > Hi, > I'm trying to figure out how to set an icon's position within a window > programmatically. Specifically, I want to do this within a shell script, > so my application can be automatically packaged within a disk image > after building. The disk image I'm using has a background which requires > the file to appear at a specific location. > Unfortunately /developer/tools/setfile does not appear to support this. > Is there any way to do this outside of writing a Carbon tool to do it? > > Thanks! > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From sanguish at digifix.com Sat Nov 16 18:48:01 2002 From: sanguish at digifix.com (Scott Anguish) Date: Thu Nov 3 14:50:23 2005 Subject: search text field In-Reply-To: <0BE80ACC-F9AF-11D6-9779-003065994788@gooeyball.com> Message-ID: On Saturday, November 16, 2002, at 05:02 PM, Jesse Grosjean wrote: > Hi, > I'm wondering if anyone can suggest the best way to implement a > Mail.app (Jaguar version) type search field... It should be rounded, > have a search icon at the beginning of the field, text, and a close > button at the end of the field. > > I think I can do it by subclassing NSView and adding some NSImageView > children and an NSTextField child with a blank background, but I'm not > quite sure how to draw the rounded focus highlight. Also I'm > suspecting their might be an easier way to go about it, any > suggestions would be helpful. > this appears to be the way that Mail.app does it.. if you look in the app wrapper you'll find the image components... it might actually be a cell with cells within it... drawing the focus is actually kinda neat. Check this... http://cocoa.mamasam.com/COCOADEV/2002/10/2/48571.php but, in a nutshell ?? ? if ([self showsFirstResponder]) { ?? ?// showsFirstResponder is set for us by the NSControl that is drawing us. ?? ? ? ? NSRect focusRingFrame = clockRect; ?? ?focusRingFrame.size.height -= 2.0; ?? ?[NSGraphicsContext saveGraphicsState]; ?? ?NSSetFocusRingStyle(NSFocusRingOnly); ?? ?[[NSBezierPath bezierPathWithRect: NSInsetRect(focusRingFrame,4,4)] fill]; ?? ?[NSGraphicsContext restoreGraphicsState]; ?? ? } which is called from - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { From simX at mac.com Sat Nov 16 20:19:01 2002 From: simX at mac.com (Simone Manganelli) Date: Thu Nov 3 14:50:23 2005 Subject: Still having problems with NSScanner on Mac OS X 10.1.x Message-ID: Hey everyone -- I'm still having problems with an NSScanner class on Mac OS X 10.1.x. As I said before, my application uses an NSScanner class to parse some command line output into data that gets put into a table view. On Mac OS X 10.2 Jaguar, my application works as expected. However, under Mac OS X 10.1.x, any data that got parsed via an NSScanner class does not display correctly in the NSTableView ? it displays the wrong parts of the strings that should have been parsed. However, data that was parsed simply via the NSString methods do not exhibit this problem under Mac OS X 10.1.x. Only NSScanner parsed data has this problem. Is there any way to fix this problem and make my application work under both operating systems? Any help would be greatly appreciated. If there's another way to accomplish what NSScanner does, that would be acceptable too, as long as it works under both Mac OS X 10.1.x and 10.2.x Jaguar. Here's the code that I am using to parse the output of the command line: // sets the full command of the process - (void)setFullProcessName:(NSString *)n; { NSScanner *scanner; NSString *tempString = nil; [n retain]; [fullProcessName release]; fullProcessName = n; // inits the scanner with the last part of the full command of the process scanner = [[NSScanner alloc] initWithString:[[fullProcessName componentsSeparatedByString:@"/"] lastObject]]; [scanner setCaseSensitive:YES]; [scanner scanUpToString:@"console" intoString:&tempString]; // checks if the word "console" appears ? if it doesn't, searches for "psn" if ([[[fullProcessName componentsSeparatedByString:@"/"] lastObject] isEqualToString:tempString]) { [scanner setScanLocation:0]; [scanner scanUpToString:@"-psn" intoString:&tempString]; } else if (![tempString length]) { tempString = [[fullProcessName componentsSeparatedByString:@"/"] lastObject]; } else { [scanner scanString:@"console" intoString:NULL]; } // sets the process name [self setProcessName:tempString]; [scanner release]; } Thanks for any help that people can give. -- Simone Manganelli From pg at powerplum.com Sat Nov 16 20:43:01 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:23 2005 Subject: Still having problems with NSScanner on Mac OS X 10.1.x In-Reply-To: Message-ID: Simone, I had the same problem (except in reverse) with a piece of software that I wrote before the release of Jaguar. As soon as Jaguar was released, my parsing algorithm broke. Come to find out it was just that ifconfig (the command whose output I was parsing) got a little upgrade and one of the things that they changed was the format of the output. So some of the little textual "landmarks" that my algorithm was looking for were gone or placed elsewhere in the output, totally ruining my parser. This may not be the case for you, but sometimes we, as programmers, tend to overlook the simplest explanations for things. Run the same command with the same args in Terminal.app on a Jag installation and on a 10.1.x installation and compare the output. It may be slightly or even totally different, which would certainly explain why your parser is having problems. If anyone has any other NSScanner-related ideas, please don't let me kill this thread with my non-NSScanner-explanation. It was just a thought. :) - Philip On Saturday, November 16, 2002, at 10:18 PM, Simone Manganelli wrote: > Hey everyone -- > > I'm still having problems with an NSScanner class on Mac OS X 10.1.x. > > As I said before, my application uses an NSScanner class to parse some > command line output > into data that gets put into a table view. On Mac OS X 10.2 Jaguar, my > application works as expected. However, under Mac OS X 10.1.x, any > data > that got parsed via an NSScanner class does not display correctly in > the > NSTableView ? it displays the wrong parts of the strings that should > have been parsed. However, data that was parsed simply via the > NSString > methods do not exhibit this problem under Mac OS X 10.1.x. Only > NSScanner parsed data has this problem. > > Is there any way to fix this problem and make my application work under > both operating systems? Any help would be greatly appreciated. If > there's another way to accomplish what NSScanner does, that would be > acceptable too, as long as it works under both Mac OS X 10.1.x and > 10.2.x Jaguar. > > Here's the code that I am using to parse the output of the command > line: > > // sets the full command of the process > - (void)setFullProcessName:(NSString *)n; > { > NSScanner *scanner; > NSString *tempString = nil; > [n retain]; > [fullProcessName release]; > fullProcessName = n; > // inits the scanner with the last part of the full command of the > process > scanner = [[NSScanner alloc] initWithString:[[fullProcessName > componentsSeparatedByString:@"/"] lastObject]]; > [scanner setCaseSensitive:YES]; > [scanner scanUpToString:@"console" intoString:&tempString]; > // checks if the word "console" appears ? if it doesn't, searches > for "psn" > if ([[[fullProcessName componentsSeparatedByString:@"/"] > lastObject] isEqualToString:tempString]) { > [scanner setScanLocation:0]; > [scanner scanUpToString:@"-psn" intoString:&tempString]; > } else if (![tempString length]) { > tempString = [[fullProcessName > componentsSeparatedByString:@"/"] lastObject]; > } else { > [scanner scanString:@"console" intoString:NULL]; > } > // sets the process name > [self setProcessName:tempString]; > [scanner release]; > } > > Thanks for any help that people can give. > > -- Simone Manganelli > > _______________________________________________ > 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: 3522 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021116/c0adc5eb/attachment.bin From pg at powerplum.com Sat Nov 16 21:12:01 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:23 2005 Subject: Still having problems with NSScanner on Mac OS X 10.1.x In-Reply-To: Message-ID: Simone, I just tried it with "ps", which I think is the command you're parsing, although I'm not sure. They appear to be identical. I used "ps -ax" so it could be that the output changed with some other flag that you're using besides "a" or "x". Again, try it with all the flags that your app is sending it. If you find the output to be identical, then my idea is shot. It was worth a look though. So, on with the NSScanner talk. :) - Philip PS: My app uses the NSString parsing methods so I can't contribute anything to the discussion of NSScanner. I've never used it. Good luck. On Saturday, November 16, 2002, at 10:18 PM, Simone Manganelli wrote: > console From simX at mac.com Sat Nov 16 22:45:00 2002 From: simX at mac.com (Simone Manganelli) Date: Thu Nov 3 14:50:24 2005 Subject: Still having problems with NSScanner on Mac OS X 10.1.x In-Reply-To: Message-ID: Philip ? The things I'm getting in Mac OS X 10.1.x are very strange, and I don't think they could be related to the output being different ? besides, the outputs look the same anyway, as you said. As far as I know, it looks as if there hasn't been a change in the format of the output. :) -- Simone On Saturday, Nov 16, 2002, at 21:11 US/Pacific, Philip George wrote: > Simone, > > I just tried it with "ps", which I think is the command you're > parsing, although I'm not sure. They appear to be identical. I used > "ps -ax" so it could be that the output changed with some other flag > that you're using besides "a" or "x". Again, try it with all the > flags that your app is sending it. > > If you find the output to be identical, then my idea is shot. It was > worth a look though. > > So, on with the NSScanner talk. :) > > - Philip > > PS: My app uses the NSString parsing methods so I can't contribute > anything to the discussion of NSScanner. I've never used it. > > Good luck. > > > > On Saturday, November 16, 2002, at 10:18 PM, Simone Manganelli wrote: > >> console > From pg at powerplum.com Sun Nov 17 06:01:01 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? Message-ID: Does anyone know if Helvetica is 100% guaranteed to be present on ALL Mac OS X installations, no matter what language is the primary language? Say, for instance, a guy in Japan goes to the computer store and purchases a copy of OS X (Japanese edition) and installs it. Will Helvetica be installed too, just in case? I'm thinking the answer is probably yes, but I need someone to definitively answer this before I'll feel all warm and fuzzy inside. If not, what are the legal implications of including Helvetica with my shareware? Can I do that, since it comes with Mac OS X anyway? Will Adobe pounce on me? Do I have to pay someone something to be able to do that? I wrote a little piece of code that runs at applaunch that checks for Helvetica. If it's not present, it copies it from my app bundle into /Library/Fonts. I haven't knocked all the kinks out of it yet, but I wanted to ask about this before I spend any more time working on it. Thanks. - Philip From pg at powerplum.com Sun Nov 17 06:32:06 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: Message-ID: <0D94E8EA-FA39-11D6-A695-00039306ED6C@powerplum.com> Awesome. All of this has raised another curious question though... Can fonts be loaded from directly inside an app bundle? I know apps don't look there by default, because if I yank Helvetica from the entire system and put it anywhere inside the TextEdit.app bundle, it still crashes on startup. Isn't there some way to load a font given a path instead of just calling it out by name or family? - Philip On Sunday, November 17, 2002, at 08:05 AM, David Remahl wrote: >> Does anyone know if Helvetica is 100% guaranteed to be present on ALL >> Mac OS X installations, no matter what language is the primary >> language? Say, for instance, a guy in Japan goes to the computer >> store >> and purchases a copy of OS X (Japanese edition) and installs it. Will >> Helvetica be installed too, just in case? I'm thinking the answer is >> probably yes, but I need someone to definitively answer this before >> I'll feel all warm and fuzzy inside. >> >> If not, what are the legal implications of including Helvetica with my >> shareware? Can I do that, since it comes with Mac OS X anyway? Will >> Adobe pounce on me? Do I have to pay someone something to be able to >> do that? >> >> I wrote a little piece of code that runs at applaunch that checks for >> Helvetica. If it's not present, it copies it from my app bundle into >> /Library/Fonts. I haven't knocked all the kinks out of it yet, but I >> wanted to ask about this before I spend any more time working on it. >> >> Thanks. >> >> - Philip > > You can rely on that Helvetica is installed on any sane system. > > / Rgds, David > > From eyredler at netvision.net.il Sun Nov 17 10:51:01 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:24 2005 Subject: Strange exception while loading a nib Message-ID: <5F201F66-FA5D-11D6-80C1-003065C9C4EE@netvision.net.il> Hi, I've got a nib with the following contents: 1. An empty panel 2. Three views which are not contained in any window (used to provide swappable content for the panel in runtime) 3. Two of the views contain instances of a few NSPopupButton subclasses. 4. File Owner which is a subclass of NSObject with outlets for each of the views and the controls inside them 5. Some actions in the file owner are pointed to by two controls Sometimes (and only sometimes) when the nib is loaded I get an exception: *** -[ERSizePopup establishConnection]: selector not recognized Exception raised during posting of notification. Ignored. exception: *** -[ERSizePopup establishConnection]: "ERSizePopup" is one of the NSPopupButton subclasses I have in the nib. It seems that somehow, during the loading of the nib, some gets connected to the popup thinking it's a NSNibConnector. The strange thing is that this is happening only sometimes (every 5-10 runs of the program) but it fails in *exactly* the same place, every time. I've tried to recreate the nib from scratch, changing outlet names but it didn't help. Any Ideas? Where can I find more detailed information about the nib loading process? Thanks, Eyal Redler From eyredler at netvision.net.il Sun Nov 17 10:59:17 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: Message-ID: <7D4B5643-FA5E-11D6-80C1-003065C9C4EE@netvision.net.il> Hi, > Does anyone know if Helvetica is 100% guaranteed to be present on ALL > Mac OS X installations, no matter what language is the primary > language? Say, for instance, a guy in Japan goes to the computer > store and purchases a copy of OS X (Japanese edition) and installs it. > Will Helvetica be installed too, just in case? I'm thinking the > answer is probably yes, but I need someone to definitively answer this > before I'll feel all warm and fuzzy inside. AFAIK, the OS X you would buy in Japan will be the same as the one you'll buy in the US (the interface language is a Preferences option) I believe Helvetica is part of the standard OS X installation, but why should you crash if it's not present? Why not use the system font (Lucida) > If not, what are the legal implications of including Helvetica with my > shareware? Can I do that, since it comes with Mac OS X anyway? Will > Adobe pounce on me? Do I have to pay someone something to be able to > do that? I don't know what Adobe will do but it's illegal. Eyal From soft at bdanube.com Sun Nov 17 11:36:01 2002 From: soft at bdanube.com (Michael Grant) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: Message-ID: On 11/17/02 8:00 AM, "Philip George" wrote: > Say, for instance, a guy in Japan goes to the computer store > and purchases a copy of OS X (Japanese edition) and installs it. Will > Helvetica be installed too, just in case? I'm thinking the answer is > probably yes, but I need someone to definitively answer this before > I'll feel all warm and fuzzy inside. IINM, there is no "Japanese edition" per se (I would expect the packaging and getting started guide to be translated of course). Japanese is just one of the languages that can be chosen by the user as the default interface language on installation of the one universal OS. Michael -- "But I also made it clear to [Vladimir Putin] that it's important to think beyond the old days of when we had the concept that if we blew each other up, the world would be safe." ? George W. Bush, Washington, D.C., May 1, 2001 From fabienlroy at mac.com Sun Nov 17 11:44:02 2002 From: fabienlroy at mac.com (Fabien Roy) Date: Thu Nov 3 14:50:24 2005 Subject: Strange exception while loading a nib In-Reply-To: <5F201F66-FA5D-11D6-80C1-003065C9C4EE@netvision.net.il> Message-ID: You should run your application with "NSZombieEnabled = YES". How To: http://developer.apple.com/techpubs/webobjects/WebObjects_5/Topics/ ProgrammingTopics.5.html What may have happen is that one object that respond to establishConnection was deallocated and the freed memory was reallocated to an instance of ERSizePopup class. Hope that helps. Fabien On Sunday, Nov 17, 2002, at 10:49 US/Pacific, Eyal Redler wrote: > Hi, > > I've got a nib with the following contents: > 1. An empty panel > 2. Three views which are not contained in any window (used to provide > swappable content for the panel in runtime) > 3. Two of the views contain instances of a few NSPopupButton > subclasses. > 4. File Owner which is a subclass of NSObject with outlets for each of > the views and the controls inside them > 5. Some actions in the file owner are pointed to by two controls > > Sometimes (and only sometimes) when the nib is loaded I get an > exception: > *** -[ERSizePopup establishConnection]: selector not recognized > Exception raised during posting of notification. Ignored. > exception: *** -[ERSizePopup establishConnection]: > "ERSizePopup" is one of the NSPopupButton subclasses I have in the nib. > It seems that somehow, during the loading of the nib, some gets > connected to the popup thinking it's a NSNibConnector. > The strange thing is that this is happening only sometimes (every 5-10 > runs of the program) but it fails in *exactly* the same place, every > time. > I've tried to recreate the nib from scratch, changing outlet names but > it didn't help. > > Any Ideas? > Where can I find more detailed information about the nib loading > process? > > Thanks, > > Eyal Redler > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From eyredler at netvision.net.il Sun Nov 17 13:05:01 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:24 2005 Subject: Strange exception while loading a nib In-Reply-To: Message-ID: <23DBF16C-FA70-11D6-B313-003065C9C4EE@netvision.net.il> I'm unable to make this work. I did this: 1. Created a New Project (Foundation tool) 2. Pasted the code from the article: int main (int argc, const char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; id foo = [[NSDate alloc] init]; // some random class // Turn on zombie objects, so we can tell // what class a freed object was. // Note: NSZombieEnabled is declared in NSDebug.h NSZombieEnabled=YES; // throw foo into the pool [foo autorelease]; // this will free foo [foo release]; // this will try to free foo again, raising an exception [pool release]; exit(0); // insure the process exit status is 0 return 0; // ...and make main fit the ANSI spec. } I'm still getting a plain Bad Access exception without any further messages in the output. Any Idea on how to make this work? Thanks, Eyal Redler On Sunday, November 17, 2002, at 09:43 PM, Fabien Roy wrote: > You should run your application with "NSZombieEnabled = YES". > How To: > http://developer.apple.com/techpubs/webobjects/WebObjects_5/Topics/ > ProgrammingTopics.5.html > > What may have happen is that one object that respond to > establishConnection was deallocated and the freed memory was > reallocated to an instance of ERSizePopup class. > > Hope that helps. > > Fabien > On Sunday, Nov 17, 2002, at 10:49 US/Pacific, Eyal Redler wrote: > >> Hi, >> >> I've got a nib with the following contents: >> 1. An empty panel >> 2. Three views which are not contained in any window (used to provide >> swappable content for the panel in runtime) >> 3. Two of the views contain instances of a few NSPopupButton >> subclasses. >> 4. File Owner which is a subclass of NSObject with outlets for each >> of the views and the controls inside them >> 5. Some actions in the file owner are pointed to by two controls >> >> Sometimes (and only sometimes) when the nib is loaded I get an >> exception: >> *** -[ERSizePopup establishConnection]: selector not recognized >> Exception raised during posting of notification. Ignored. >> exception: *** -[ERSizePopup establishConnection]: >> "ERSizePopup" is one of the NSPopupButton subclasses I have in the >> nib. >> It seems that somehow, during the loading of the nib, some gets >> connected to the popup thinking it's a NSNibConnector. >> The strange thing is that this is happening only sometimes (every >> 5-10 runs of the program) but it fails in *exactly* the same place, >> every time. >> I've tried to recreate the nib from scratch, changing outlet names >> but it didn't help. >> >> Any Ideas? >> Where can I find more detailed information about the nib loading >> process? >> >> Thanks, >> >> Eyal Redler >> >> _______________________________________________ >> 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 jerwin at ponymail.com Sun Nov 17 15:24:01 2002 From: jerwin at ponymail.com (Jeremy Erwin) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: Message-ID: <753FA435-FA83-11D6-87CB-003065F24232@ponymail.com> On Sunday, November 17, 2002, at 09:00 AM, Philip George wrote: > If not, what are the legal implications of including Helvetica with my > shareware? Can I do that, since it comes with Mac OS X anyway? Will > Adobe pounce on me? Do I have to pay someone something to be able to > do that? Why would Adobe have a problem with this? Apple and Linotype AG own the copyright. Jeremy From rosyna at unsanity.com Sun Nov 17 15:36:01 2002 From: rosyna at unsanity.com (Rosyna) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: References: Message-ID: Ack, at 11/17/02, Philip George said: >Does anyone know if Helvetica is 100% guaranteed to be present on >ALL Mac OS X installations, no matter what language is the primary >language? Say, for instance, a guy in Japan goes to the computer >store and purchases a copy of OS X (Japanese edition) and installs >it. Will Helvetica be installed too, just in case? I'm thinking >the answer is probably yes, but I need someone to definitively >answer this before I'll feel all warm and fuzzy inside. Helvetica, Geneva, Monaco, Courier, Lucida Grande, and some other fonts are *required* to exist on OS X. If they do not, bad things happen and you can pretty much "blame" the user for it not existing. >If not, what are the legal implications of including Helvetica with >my shareware? Can I do that, since it comes with Mac OS X anyway? >Will Adobe pounce on me? Do I have to pay someone something to be >able to do that? You cannot do this, you do not have the license to redistribute it. And even if you did, each font has a unique ID, loading a font twice can be extremely bad. If you want to dynamically load a font, use ATSFontActivateFromFileSpecification in ATSFont.h or FMActivateFonts in Fonts.h just make sure to deactivate it when done. This is *not* recommended for fonts like Helvetica. ( { FontID = 21; Name = Helvetica; Style = 0; Type = true; } ) -- Sincerely, Rosyna Keller Technical Support/Holy Knight/Always needs a hug Unsanity: Unsane Tools for Insanely Great People --- Please include any previous correspondence in replies, it helps me remember what we were talking about. Thanks. From pg at powerplum.com Sun Nov 17 15:37:00 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: <753FA435-FA83-11D6-87CB-003065F24232@ponymail.com> Message-ID: <6E648B2E-FA85-11D6-ACF5-00039306ED6C@powerplum.com> So would I have to pay either of them? On Sunday, November 17, 2002, at 05:22 PM, Jeremy Erwin wrote: > > On Sunday, November 17, 2002, at 09:00 AM, Philip George wrote: >> If not, what are the legal implications of including Helvetica with >> my shareware? Can I do that, since it comes with Mac OS X anyway? >> Will Adobe pounce on me? Do I have to pay someone something to be >> able to do that? > Why would Adobe have a problem with this? Apple and Linotype AG own > the copyright. > > Jeremy > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From ggerard at mac.com Sun Nov 17 17:25:01 2002 From: ggerard at mac.com (Gregory Gerard) Date: Thu Nov 3 14:50:24 2005 Subject: What's the behavior for two categories with the same method extensions? Message-ID: Say I write a category extending NSString with -someTrivialMethod. Then, I load a plugin from a third party which does the exact same thing but who has different behavior (possibly radically). Is there a cheap way to detect this before or after the fact? What happens if I unload the plugin? Does the category defined in the plugin pop-off giving me back my original behavior? thanks, greg -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman/archive/macosx-dev/attachments/20021117/d5cd9a9c/attachment.html From jmdisher at student.math.uwaterloo.ca Sun Nov 17 17:52:01 2002 From: jmdisher at student.math.uwaterloo.ca (Jeff Disher) Date: Thu Nov 3 14:50:24 2005 Subject: Saving BMP not working Message-ID: <4FD63F23-FA98-11D6-BBFF-000393B6A966@student.math.uwaterloo.ca> Hello, I am trying to save to a Bitmap file and having some difficulties. I can successfully save to TIFF, JPEG, GIF, and PNG but for some reason I can't get BMP. For some reason, the NSBitmapRep method "representationUsingType:properties:" always returns nil for me when I ask it for the NSBMPFileType with nil properties. Can anyone help me out here? Thanks, Jeff Disher President and Lead Developer of Spectral Class Spectral Class: Shedding Light on Innovation http://www.spectralclass.com/ From ejones at uwaterloo.ca Mon Nov 18 04:36:02 2002 From: ejones at uwaterloo.ca (Evan Jones) Date: Thu Nov 3 14:50:24 2005 Subject: RowResizableTableView: An NSTableView with Resizable Row Heights Message-ID: <86D2496A-FAE3-11D6-A04E-0003938016AE@uwaterloo.ca> A question that has appeared a few times on this mailing list, and on other Cocoa lists, is how to get an NSTableView to display rows with variable heights. I encountered this problem myself, and put a few hours into creating a subclass that does exactly that. I'm also working on subclassing NSOutlineView to add the same functionality. If you are interested in a demo application, source code, or more details, see the web page at: http://www.eng.uwaterloo.ca/~ejones/software/osx-tableview.html RowResizableTableView Features * Completely compatible with NSTableView As a subclass, RowResizableTableView supports the same features and interface as NSTableView. Adding resizable rows to your program is as easy as replacing NSTableView with RowResizableTableView. * Rows automatically fit themselves to each cell's contents RowResizableTableView automatically sizes its rows to fit the contents of the cells. If the contents change, RowResizableTableView will update the row heights. * Editing text works as expected When editing text in one of the cells in the table, the row will automatically size itself to fit the wrapped text, and the text editor will resize as expect. * Unrestrictive open source licence (LGPL) You get all the source code, and can use RowResizableTableView in commercial or noncommercial projects. The only restriction is that if you make any changes to RowResizableTableView, you must make the code to those changes available. For more detail, read the actual LGPL licence itself. If these terms are too restrictive, contact me and I will be happy to negotiate an alternative with you. I would like to know if there are any other cocoa classes (commercial or noncommercial) out there that do something similar, and if there is any interest in me continuing to release improvements to this class. I would also be interested to hear from anyone who actually tries this class, if it works or not. If you have some suggestions for future improvements, I'd love to hear that too. Evan Jones -- Evan Jones: http://www.eng.uwaterloo.ca/~ejones/ "Computers are useless. They can only give answers" - Pablo Picasso From clarkcox3 at mac.com Mon Nov 18 05:26:00 2002 From: clarkcox3 at mac.com (Clark S. Cox III) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: <753FA435-FA83-11D6-87CB-003065F24232@ponymail.com> Message-ID: <2643995C-FAF9-11D6-AA5E-0050E4EE1966@mac.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday, Nov 17, 2002, at 18:22 US/Eastern, Jeremy Erwin wrote: > > On Sunday, November 17, 2002, at 09:00 AM, Philip George wrote: >> If not, what are the legal implications of including Helvetica with >> my shareware? Can I do that, since it comes with Mac OS X anyway? >> Will Adobe pounce on me? Do I have to pay someone something to be >> able to do that? > Why would Adobe have a problem with this? Apple and Linotype AG own > the copyright. Just a little nit-pick: Fonts cannot be copyrighted; their names can be trademarked, but they cannot be copyrighted. - -- http://homepage.mac.com/clarkcox3/ clarkcox3@mac.com Clark S. Cox, III -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (Darwin) iEYEARECAAYFAj3Y6j4ACgkQd6STocYT1xU1CgCfc8MMSLjJ+VrxeFjqacZz1D/o 9IsAn1LL/DQcPT+h1MmClN4667TJqgSd =25Ey -----END PGP SIGNATURE----- From pg at powerplum.com Mon Nov 18 06:17:00 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: <2643995C-FAF9-11D6-AA5E-0050E4EE1966@mac.com> Message-ID: <41BFFC2E-FB00-11D6-91FE-00039306ED6C@powerplum.com> Hmmm... I'm not so sure.... I found several places last night where there are copyright symbols next to the Helvetica font: - When you "Show Info" on "Helvetica.dfont" in the Finder - On the Apple website - On the Linotype website The only one that's in "Show Info" that I couldn't find on the respective website is Type Solutions Inc. There's no mention of Helvetica on their website, but they show partial copyright ownership in the "Show Info" window. Not sure what's up with that. I don't mean to be contrary. I'm just pointing out what I've seen so far. If I'm misunderstanding what you're trying to say, I apologize. By the way, I totally polished that code using Rosyna's suggestion for loading a font directly from a font suitcase that's not located in one of the typical font repositories (FMActivateFonts()) (and thanks, Rosyna). It works really, really well. Now my app is completely impervious to people yanking Helvetica out of their Fonts folders, which is admittedly rare, but nonetheless possible. Probably the highest probability for this would be if someone was using a font management app and disabled Helvetica temporarily for some reason. That's not so unheard of. For clarification, this app has REALLY tight margins in a few spots where the font had to be very carefully chosen/sized/positioned. Just letting any old font take its place may or may not work (usually not). That's why I'm so nervous about it not being there. And now that the code is written and streamlined, I'm finding it extra hard to comment it out. Anyway, if someone at Apple is listening in on this, please feel free to chime in. - Philip On Monday, November 18, 2002, at 07:25 AM, Clark S. Cox III wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > On Sunday, Nov 17, 2002, at 18:22 US/Eastern, Jeremy Erwin wrote: > >> >> On Sunday, November 17, 2002, at 09:00 AM, Philip George wrote: >>> If not, what are the legal implications of including Helvetica with >>> my shareware? Can I do that, since it comes with Mac OS X anyway? >>> Will Adobe pounce on me? Do I have to pay someone something to be >>> able to do that? >> Why would Adobe have a problem with this? Apple and Linotype AG own >> the copyright. > > Just a little nit-pick: Fonts cannot be copyrighted; their names can > be trademarked, but they cannot be copyrighted. > > > > - -- http://homepage.mac.com/clarkcox3/ > clarkcox3@mac.com > Clark S. Cox, III > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.7 (Darwin) > > iEYEARECAAYFAj3Y6j4ACgkQd6STocYT1xU1CgCfc8MMSLjJ+VrxeFjqacZz1D/o > 9IsAn1LL/DQcPT+h1MmClN4667TJqgSd > =25Ey > -----END PGP SIGNATURE----- > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From clarkcox3 at mac.com Mon Nov 18 06:33:06 2002 From: clarkcox3 at mac.com (Clark S. Cox III) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: <41BFFC2E-FB00-11D6-91FE-00039306ED6C@powerplum.com> Message-ID: <7F806708-FB02-11D6-AA5E-0050E4EE1966@mac.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, Nov 18, 2002, at 09:15 US/Eastern, Philip George wrote: > Hmmm... I'm not so sure.... > > I found several places last night where there are copyright symbols > next to the Helvetica font: > > - When you "Show Info" on "Helvetica.dfont" in the Finder > - On the Apple website > - On the Linotype website > > The only one that's in "Show Info" that I couldn't find on the > respective website is Type Solutions Inc. There's no mention of > Helvetica on their website, but they show partial copyright ownership > in the "Show Info" window. Not sure what's up with that. I was corrected offline by David Stevenson. While fonts themselves can't be copyrighted, font *files* can. - -- http://homepage.mac.com/clarkcox3/ clarkcox3@mac.com Clark S. Cox, III -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (Darwin) iEYEARECAAYFAj3Y+eYACgkQd6STocYT1xVJ/wCffQxQ4MkVivDrPH5hB7Nx7DUR 8NMAni4y7d2SetO4FGV4EY9G2T/x85dJ =QRN8 -----END PGP SIGNATURE----- From bob at redivi.com Mon Nov 18 06:36:02 2002 From: bob at redivi.com (Bob Ippolito) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: <41BFFC2E-FB00-11D6-91FE-00039306ED6C@powerplum.com> Message-ID: Why don't you just detect the presence of Helvetica and error out, with a user-friendly error message, if it's not present. The rare potential user that may do something ridiculous like disable Helvetica will certainly be familiar with the consequences and know how to enable the font and restart your application. On Monday, Nov 18, 2002, at 09:15 America/New_York, Philip George wrote: > > For clarification, this app has REALLY tight margins in a few spots > where the font had to be very carefully chosen/sized/positioned. Just > letting any old font take its place may or may not work (usually not). > That's why I'm so nervous about it not being there. And now that the > code is written and streamlined, I'm finding it extra hard to comment > it out. > From pg at powerplum.com Mon Nov 18 06:52:01 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: Message-ID: <336DEDBC-FB05-11D6-8428-00039306ED6C@powerplum.com> That's a valid point. I agree with it totally, but there's just something about an app that's resilient in its own right, you know? It's comforting when an app can deal with sticky situations like that transparently, without the user having to even think about it, let alone worry about it. But I see your point, and it's a solid backup if Plan A doesn't work out. :) - Philip On Monday, November 18, 2002, at 08:35 AM, Bob Ippolito wrote: > Why don't you just detect the presence of Helvetica and error out, > with a user-friendly error message, if it's not present. The rare > potential user that may do something ridiculous like disable Helvetica > will certainly be familiar with the consequences and know how to > enable the font and restart your application. > > On Monday, Nov 18, 2002, at 09:15 America/New_York, Philip George > wrote: > >> >> For clarification, this app has REALLY tight margins in a few spots >> where the font had to be very carefully chosen/sized/positioned. >> Just letting any old font take its place may or may not work (usually >> not). That's why I'm so nervous about it not being there. And now >> that the code is written and streamlined, I'm finding it extra hard >> to comment it out. >> > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From bob at redivi.com Mon Nov 18 07:01:01 2002 From: bob at redivi.com (Bob Ippolito) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: <336DEDBC-FB05-11D6-8428-00039306ED6C@powerplum.com> Message-ID: <6E1A9E78-FB06-11D6-9596-0003938210D6@redivi.com> If I were an advanced font user that intentionally disabled Helvetica (if there were ever a legitimate reason to do so), I'd probably be more confused (or even frustrated) if the app still rendered Helvetica properly rather than erroring out or doing ugly font substitution. -bob On Monday, Nov 18, 2002, at 09:51 America/New_York, Philip George wrote: > That's a valid point. I agree with it totally, but there's just > something about an app that's resilient in its own right, you know? > It's comforting when an app can deal with sticky situations like that > transparently, without the user having to even think about it, let > alone worry about it. > > But I see your point, and it's a solid backup if Plan A doesn't work > out. :) > > On Monday, November 18, 2002, at 08:35 AM, Bob Ippolito wrote: > >> Why don't you just detect the presence of Helvetica and error out, >> with a user-friendly error message, if it's not present. The rare >> potential user that may do something ridiculous like disable >> Helvetica will certainly be familiar with the consequences and know >> how to enable the font and restart your application. >> >> On Monday, Nov 18, 2002, at 09:15 America/New_York, Philip George >> wrote: >> >>> >>> For clarification, this app has REALLY tight margins in a few spots >>> where the font had to be very carefully chosen/sized/positioned. >>> Just letting any old font take its place may or may not work >>> (usually not). That's why I'm so nervous about it not being there. >>> And now that the code is written and streamlined, I'm finding it >>> extra hard to comment it out. >>> >> >> _______________________________________________ >> 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 pg at powerplum.com Mon Nov 18 07:36:00 2002 From: pg at powerplum.com (Philip George) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: <6E1A9E78-FB06-11D6-9596-0003938210D6@redivi.com> Message-ID: <535511C6-FB0B-11D6-8428-00039306ED6C@powerplum.com> True, but I would rather handle the problem transparently and then answer questions about it in an FAQ or something like that. Another thing to keep in mind is that I'm only loading the font for the use of my app (kFMLocalActivationContext). The rest of the system can't even see it. It's also unlikely that someone would be able to distinguish which font this is. It's pretty small in the context I'm using it. It looks like any one of a dozen other sanserif fonts. And again, any questions could be easily addressed in an FAQ or support article, for the extremely rare case that someone would notice, let alone be bothered by it. Thanks for the concern. At this point though, I'm probably more interested in getting advice on the copyright stuff. - Philip On Monday, November 18, 2002, at 09:00 AM, Bob Ippolito wrote: > If I were an advanced font user that intentionally disabled Helvetica > (if there were ever a legitimate reason to do so), I'd probably be > more confused (or even frustrated) if the app still rendered Helvetica > properly rather than erroring out or doing ugly font substitution. > > -bob > > On Monday, Nov 18, 2002, at 09:51 America/New_York, Philip George > wrote: > >> That's a valid point. I agree with it totally, but there's just >> something about an app that's resilient in its own right, you know? >> It's comforting when an app can deal with sticky situations like that >> transparently, without the user having to even think about it, let >> alone worry about it. >> >> But I see your point, and it's a solid backup if Plan A doesn't work >> out. :) >> >> On Monday, November 18, 2002, at 08:35 AM, Bob Ippolito wrote: >> >>> Why don't you just detect the presence of Helvetica and error out, >>> with a user-friendly error message, if it's not present. The rare >>> potential user that may do something ridiculous like disable >>> Helvetica will certainly be familiar with the consequences and know >>> how to enable the font and restart your application. >>> >>> On Monday, Nov 18, 2002, at 09:15 America/New_York, Philip George >>> wrote: >>> >>>> >>>> For clarification, this app has REALLY tight margins in a few spots >>>> where the font had to be very carefully chosen/sized/positioned. >>>> Just letting any old font take its place may or may not work >>>> (usually not). That's why I'm so nervous about it not being there. >>>> And now that the code is written and streamlined, I'm finding it >>>> extra hard to comment it out. >>>> >>> >>> _______________________________________________ >>> 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 rcerny at dataline.cz Mon Nov 18 07:38:00 2002 From: rcerny at dataline.cz (Robert Cerny) Date: Thu Nov 3 14:50:24 2005 Subject: Helvetica - International Systems? In-Reply-To: <41BFFC2E-FB00-11D6-91FE-00039306ED6C@powerplum.com> Message-ID: Ehh, you shouldn't even want to think about a possibility of buying a world-wide license for Helvetica. It would cost tousands of dollars for single weigth Robert On Monday, November 18, 2002, at 03:15 PM, Philip George wrote: > Hmmm... I'm not so sure.... > > I found several places last night where there are copyright symbols > next to the Helvetica font: > > - When you "Show Info" on "Helvetica.dfont" in the Finder > - On the Apple website > - On the Linotype website > > The only one that's in "Show Info" that I couldn't find on the > respective website is Type Solutions Inc. There's no mention of > Helvetica on their website, but they show partial copyright ownership > in the "Show Info" window. Not sure what's up with that. > > I don't mean to be contrary. I'm just pointing out what I've seen so > far. If I'm misunderstanding what you're trying to say, I apologize. > > By the way, I totally polished that code using Rosyna's suggestion for > loading a font directly from a font suitcase that's not located in one > of the typical font repositories (FMActivateFonts()) (and thanks, > Rosyna). It works really, really well. Now my app is completely > impervious to people yanking Helvetica out of their Fonts folders, > which is admittedly rare, but nonetheless possible. Probably the > highest probability for this would be if someone was using a font > management app and disabled Helvetica temporarily for some reason. > That's not so unheard of. > > For clarification, this app has REALLY tight margins in a few spots > where the font had to be very carefully chosen/sized/positioned. Just > letting any old font take its place may or may not work (usually not). > That's why I'm so nervous about it not being there. And now that the > code is written and streamlined, I'm finding it extra hard to comment > it out. > > Anyway, if someone at Apple is listening in on this, please feel free > to chime in. > > - Philip > > > > On Monday, November 18, 2002, at 07:25 AM, Clark S. Cox III wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> >> On Sunday, Nov 17, 2002, at 18:22 US/Eastern, Jeremy Erwin wrote: >> >>> >>> On Sunday, November 17, 2002, at 09:00 AM, Philip George wrote: >>>> If not, what are the legal implications of including Helvetica with >>>> my shareware? Can I do that, since it comes with Mac OS X anyway? >>>> Will Adobe pounce on me? Do I have to pay someone something to be >>>> able to do that? >>> Why would Adobe have a problem with this? Apple and Linotype AG own >>> the copyright. >> >> Just a little nit-pick: Fonts cannot be copyrighted; their names can >> be trademarked, but they cannot be copyrighted. >> >> >> >> - -- http://homepage.mac.com/clarkcox3/ >> clarkcox3@mac.com >> Clark S. Cox, III >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.0.7 (Darwin) >> >> iEYEARECAAYFAj3Y6j4ACgkQd6STocYT1xU1CgCfc8MMSLjJ+VrxeFjqacZz1D/o >> 9IsAn1LL/DQcPT+h1MmClN4667TJqgSd >> =25Ey >> -----END PGP SIGNATURE----- >> >> _______________________________________________ >> 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 stephane at sente.ch Mon Nov 18 08:49:01 2002 From: stephane at sente.ch (=?ISO-8859-1?Q?St=E9phane_Corth=E9sy?=) Date: Thu Nov 3 14:50:24 2005 Subject: Fwd: ANN: GDL2 Message-ID: <99B790F0-FB15-11D6-8577-003065DA23F6@sente.ch> This list has not yet been informed of this, unlike cocoadev, but I'm sure it will interest people here too. Begin forwarded message: > Date: Fri Nov 15, 2002 ?6:10:57 PM US/Eastern > To: "GNUstep Discuss" <> > Cc: "GNUstep Developer" <> > Subject: ANN: GDL2 > > Ciao! > > I'm pleased to announce the release of the long awaited GDL2 ! > > GDL2 is an acronym for GNUstep Database Library, an Objective-C > implementation > of the EOF framework >= v2.0 from NeXT Software, Inc. > > It consists of EOAccess and EOControl layer, EOModeler library to > support > eogenerator and a PostgreSQL adaptor. Actually there is no support for > the > interface part and the model inheritance. > > I would like to thank all the people that helped me doing this project, > in particular Manuel Guesdon, David Wetzel, Gerald Siebke and David > Ayers > that have done an excellent job improving and testing the framework. > > You can grab GDL2 from gnustep cvs, dir gnustep/dev-libs/gdl2 > > Enjoy ! > > -- > Bye, > ? Mirko > > > > _______________________________________________ > Discuss-gnustep mailing list > > http://mail.gnu.org/mailman/listinfo/discuss-gnustep -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2948 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021118/292f7934/attachment.bin From Troy.D.Goodson at jpl.nasa.gov Mon Nov 18 09:02:03 2002 From: Troy.D.Goodson at jpl.nasa.gov (Troy Goodson) Date: Thu Nov 3 14:50:24 2005 Subject: OK for apps to break hard links? Message-ID: <148B6E34-FB17-11D6-958D-000393B3C4E0@jpl.nasa.gov> Has anyone else noticed that applications like Apple's TextEdit break hard links in HFS+ and UFS? As a newbie to OS X development, I'd like to ask this list for some guidance. Should this be OK or not? If it is not OK, then I'd appreciate it if someone could explain to me what TextEdit is doing wrong and show me the right way. To see what I'm talking about, do this: In Terminal... 1. echo "original text" > hello.txt 2. ln hello.txt hello-link.txt 3. open -a textedit hello.txt 4. (in textedit) change the text "original text" to "altered text" 5. (in textedit) save & close hello.txt 6. (in terminal) cat hello-link.txt the file hello-link.txt contains "original text" !! From bob at redivi.com Mon Nov 18 09:16:05 2002 From: bob at redivi.com (Bob Ippolito) Date: Thu Nov 3 14:50:24 2005 Subject: OK for apps to break hard links? In-Reply-To: <148B6E34-FB17-11D6-958D-000393B3C4E0@jpl.nasa.gov> Message-ID: On Monday, Nov 18, 2002, at 11:59 America/New_York, Troy Goodson wrote: > Has anyone else noticed that applications like Apple's TextEdit break > hard links in HFS+ and UFS? > > As a newbie to OS X development, I'd like to ask this list for some > guidance. Should this be OK or not? > > If it is not OK, then I'd appreciate it if someone could explain to me > what TextEdit is doing wrong and show me the right way. > > To see what I'm talking about, do this: > > In Terminal... > 1. echo "original text" > hello.txt > 2. ln hello.txt hello-link.txt > 3. open -a textedit hello.txt > 4. (in textedit) change the text "original text" to "altered text" > 5. (in textedit) save & close hello.txt > 6. (in terminal) cat hello-link.txt > > the file hello-link.txt contains "original text" !! I think the way that apple stuff writes new files is something like: (a) write temp file (b) move old file out of the way (c) move temp file to old place (d) trash old file Which would certainly break any hard links.. but it's pretty much guaranteed not to trash your file -bob From stephane at sente.ch Mon Nov 18 09:46:10 2002 From: stephane at sente.ch (=?ISO-8859-1?Q?St=E9phane_Corth=E9sy?=) Date: Thu Nov 3 14:50:24 2005 Subject: GDL2 on MacOS X Message-ID: <732D1600-FB1D-11D6-8577-003065DA23F6@sente.ch> (this message has been cross-posted to macosx-dev and eof mailing lists, in order to attract Cocoa developer to gnustep-dev mailing-list; please, post your replies only on gnustep-dev mailing-list) Hi, As soon as I saw the announce of GDL2, I tried to compile it on MacOS X. I could make it compile, but it was not painless... Currently, it just compiles, but it cannot work (I haven't implemented some methods, and haven't tested anything, as I don't know the current state of gdl2). My ugly patch is available here: ftp://ftp.sente.ch/pub/beta/gdl2-macosx.patch.gz I have some questions now: - What is the current state of gdl2?? How compatible is it with EOF 2? WebObjects 4.5's EOF implementation? - Do gdl2 developers plan to support MacOS X? If they reply "no", no need to read remaining questions ;-) - Does it even compile on a GNUStep system?? I had to correct some code, independant of platform. - gdl2 depends on GNUStep-specific classes, like GCArray, etc. Can this dependency be removed? There are also references to methods not implemented in MacOS X, like subclassResponsibility:, but in these cases we could implement categories on MacOS X for GNUStep compatibility. - gdl2 is not consistent regarding retain/release and garbage collecting; sometimes macros are used for retain/release, sometimes method calls are used. How should it be done? - EOControl and EOAccess were 2 different frameworks in EOF, and EOControl had no dependency on EOAccess. In gdl2, this is no longer the case... - On MacOS X, there is now a NSClassDescription class, and categories on NSObject implementing -entityName, etc. This means that either GNUStep should implement them all (if not yet done?), or we should rewrite that part for MacOS X. Conflicting categories are no good. Finally, I suppose there are a lot of Cocoa developers willing to use EOF... erh gdl2 ;-) I suppose GNUStep people will find help among them. There are also a lot of former OpenStep/WO4 developers that could help, now that there is a concrete opensource EOF for Cocoa. So please, subscribe to that list, checkout gdl2 and give GNUStep developers needed help. I'll try to. Thanks for providing this long-awaited EOF-clone!!! St?phane -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 2285 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021118/ae13a3e1/attachment.bin From ddavidso at apple.com Mon Nov 18 10:26:03 2002 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:50:24 2005 Subject: drawing text into an NSView In-Reply-To: <9590BA6E-F94E-11D6-A695-003065BB04BA@mac.com> Message-ID: <3D002D02-FB23-11D6-A3FE-000393115062@apple.com> On Saturday, November 16, 2002, at 02:31 AM, Benj?min Sal?nki wrote: > I am playing around with cocoa graphics, and was looking for a way to > draw text at a given point of my NSView subclass, but I couldn't find > anything on this in the docs. The topic Drawing Text reads > documentation forthcoming. The AppKit has methods to do this in categories on NSString (drawAtPoint:withAttributes:, drawInRect:withAttributes:) and NSAttributedString (drawAtPoint:, drawInRect:) as defined in the header NSStringDrawing.h. These are convenience APIs intended to make it simple to draw small quantities of text; if you are going to be displaying large quantities of text, you may wish to consider other means. Douglas Davidson From Troy.D.Goodson at jpl.nasa.gov Mon Nov 18 11:44:01 2002 From: Troy.D.Goodson at jpl.nasa.gov (Troy Goodson) Date: Thu Nov 3 14:50:24 2005 Subject: OK for apps to break hard links? In-Reply-To: Message-ID: On Monday, November 18, 2002, at 09:12 AM, Bob Ippolito wrote: > On Monday, Nov 18, 2002, at 11:59 America/New_York, Troy Goodson wrote: > >> Has anyone else noticed that applications like Apple's TextEdit break >> hard links in HFS+ and UFS? >> >> As a newbie to OS X development, I'd like to ask this list for some >> guidance. Should this be OK or not? >> >> If it is not OK, then I'd appreciate it if someone could explain to >> me what TextEdit is doing wrong and show me the right way. > > I think the way that apple stuff writes new files is something like: > (a) write temp file > (b) move old file out of the way > (c) move temp file to old place > (d) trash old file > > Which would certainly break any hard links.. but it's pretty much > guaranteed not to trash your file > > -bob I see. So there's a trade-off here. And, I guess Finder aliases -don't- get broken. So, when presented with this case, should the application warn the user that a hard link (or soft link) is about to be broken? And, should it present the user with an option that will save the file, but preserve the link? From varscsak at smarthealth.com Mon Nov 18 13:32:01 2002 From: varscsak at smarthealth.com (Lon Varscsak) Date: Thu Nov 3 14:50:24 2005 Subject: Odd Paper Size and NSPrintInfo Message-ID: <000AD17A-FB3D-11D6-A256-003065ED931C@smarthealth.com> I'm having some trouble using NSPrintInfo and NSPrintPaperSize. When I do: NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo]; NSPrintOperation *printOp = nil; [printInfo setPaperSize:NSMakeSize(864, 1296)]; printOp = [NSPrintOperation printOperationWithView:self printInfo:printInfo]; [printOp runOperation]; I essentially get the smallest paper size possible and [printInfo paperSize] returns {0,0}. It appears that since this particular paper size is non-standard (12 in. x 18 in.), it freaks out ;). I've even tried manipulating the [printInfo dictionary] directly, and the result is the same. What am I missing? Thanks, Lon From demarco at apple.com Mon Nov 18 13:36:01 2002 From: demarco at apple.com (Vince DeMarco) Date: Thu Nov 3 14:50:24 2005 Subject: search text field In-Reply-To: <0BE80ACC-F9AF-11D6-9779-003065994788@gooeyball.com> Message-ID: <7FCA7D44-FB3D-11D6-AB9B-0003936726FC@apple.com> The rounded text field is already part of Cocoa, drag in a text field and set it to be rounded. It doesn't do the x to the right or the magnifying glass like in Mail. vince On Saturday, November 16, 2002, at 02:02 PM, Jesse Grosjean wrote: > Hi, > I'm wondering if anyone can suggest the best way to implement a > Mail.app (Jaguar version) type search field... It should be rounded, > have a search icon at the beginning of the field, text, and a close > button at the end of the field. > > I think I can do it by subclassing NSView and adding some NSImageView > children and an NSTextField child with a blank background, but I'm not > quite sure how to draw the rounded focus highlight. Also I'm > suspecting their might be an easier way to go about it, any > suggestions would be helpful. > > Thanks, > Jesse Grosjean > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From dtlinker at u.washington.edu Mon Nov 18 15:32:02 2002 From: dtlinker at u.washington.edu (David Linker) Date: Thu Nov 3 14:50:24 2005 Subject: random() delivers same value every time? In-Reply-To: Message-ID: <64C85C4C-FB4D-11D6-98AE-000393B8FA92@u.washington.edu> I am trying to debug some code, and every time I stop in the debugger when my code does something like: i = random(); and look at the value of i, it is the same value, even though the debugger shows the value as changed. Any ideas? Thanks, David Linker From tjw at omnigroup.com Mon Nov 18 15:37:01 2002 From: tjw at omnigroup.com (Timothy J. Wood) Date: Thu Nov 3 14:50:24 2005 Subject: GDL2 on MacOS X In-Reply-To: <732D1600-FB1D-11D6-8577-003065DA23F6@sente.ch> Message-ID: <7D598A84-FB4E-11D6-BB71-0003938E4E3C@omnigroup.com> How are you dealing with the fact that EOModel and EOEditingContext are patented (6,085,197; 5,956,728; 5,873,093)? -tim From jcr at apple.com Mon Nov 18 16:33:01 2002 From: jcr at apple.com (John C. Randolph) Date: Thu Nov 3 14:50:24 2005 Subject: What's the behavior for two categories with the same method extensions? In-Reply-To: Message-ID: <69BC5603-FB56-11D6-B162-003065F32C3C@apple.com> On Sunday, November 17, 2002, at 05:24 PM, Gregory Gerard wrote: > Say I write a category extending NSString with -someTrivialMethod. > ?Then, I load a plugin from a third party which does the exact same > thing but who has different behavior (possibly radically). > > Is there a cheap way to detect this before or after the fact? ?What > happens if I unload the plugin? ?Does the category defined in the > plugin pop-off giving me back my original behavior? The version that loads last will win. It will simply clobber the method-table entry for that name. The only way I can think of to detect such a conflict would involve reading the symbols out of the bundle you're about to load. (Tricky.) -jcr John C. Randolph (408) 974-8819 Sr. Cocoa Software Engineer, Apple Worldwide Developer Relations http://developer.apple.com/cocoa/index.html From brian at classicalguitar.net Mon Nov 18 17:12:03 2002 From: brian at classicalguitar.net (Brian Bergstrand) Date: Thu Nov 3 14:50:24 2005 Subject: Auto-scrolling text Message-ID: <63904B00-FB5B-11D6-BF5A-0003930A674E@classicalguitar.net> Anyone have any examples of auto-scrolling text using NSTextView? Kind of like what you see in about boxes all of the time. Basically you'd have to get the size of the string as drawn on screen in the current font, figure out the pagination and wrapping in the view and then calculate how much text is being displayed and how much needs to be displayed. That's a lot easier said than done, and the online doc is not much help. Plus, how do you restart the display from the beginning of the text, but about two thirds of the way down in the view (so you get the effect of continuously scrolling text)? What I really want is something just like PGP 8.0 about box. Thanks for any pointers. Brian Bergstrand PGP Key ID: 0xB6C7B6A2 Any sufficiently advanced technology is indistinguishable from magic. - Arthur C. Clarke, "Technology and the Future" From mtm26 at cornell.edu Mon Nov 18 18:04:02 2002 From: mtm26 at cornell.edu (Michael Mulligan) Date: Thu Nov 3 14:50:24 2005 Subject: Auto-scrolling text In-Reply-To: <63904B00-FB5B-11D6-BF5A-0003930A674E@classicalguitar.net> Message-ID: If I recall correctly, there's an article showing how to do this very thing on http://www.cocoadevcentral.com/ On 11/18/02 8:08 PM, "Brian Bergstrand" wrote: > Anyone have any examples of auto-scrolling text using NSTextView? Kind > of like what you see in about boxes all of the time. -m^2 __________ Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread! __________ From simX at mac.com Mon Nov 18 18:55:01 2002 From: simX at mac.com (Simone Manganelli) Date: Thu Nov 3 14:50:24 2005 Subject: More on getting NSProgressIndicators in an NSTableView Message-ID: <2E4F7ACE-FB6A-11D6-AED4-000393B909BA@mac.com> I've made a little progress on getting NSProgressIndicators to display in an NSTableView (through an NSImage), but I'm still having trouble. Here's the code I've implemented so far: - (void)setProgBarImage:(NSNumber *)memUsage withMaxValue:(NSNumber *)theMaxValue { NSProgressIndicator *theProgressIndicator; [theProgBarImage release]; theProgBarImage = [[NSImage alloc] initWithSize:NSMakeSize(60,12)]; [theProgBarImage lockFocus]; theProgressIndicator = [[NSProgressIndicator alloc] init]; [theProgressIndicator setFrame:NSMakeRect(0,0,60,12)]; [theProgressIndicator setMaxValue:[theMaxValue doubleValue]]; [theProgressIndicator setDoubleValue:[memUsage doubleValue]]; [theProgressIndicator stopAnimation:nil]; [theProgressIndicator drawRect:NSMakeRect(0,0,60,12)]; [theProgBarImage unlockFocus]; [theProgressIndicator release]; } This gets called to set the state of the NSProgressIndicator and then, theoretically, to draw it to an NSImage and store that image in this class. At startup, the column gets initialized with an NSImageCell through the awakeFromNib method like so: theTableColumn = [tableViewTotal tableColumnWithIdentifier:@"theProgBarImage"]; theDataCell = [[NSImageCell alloc] init]; [theTableColumn setDataCell:theDataCell]; [theDataCell release]; The problem is, all that displays in the column is a blank image. I'm thinking it's a problem with the first code snippit, since I added an NSLog item into the method that sends the NSImage to the NSTableView dataSource, and the method DOES get called. Any ideas? I would like to get this fixed ASAP, if anyone has any ideas. Also, any more help with the NSScanner difference on Mac OS X 10.1.x and 10.2.x would be much appreciated. -- Simone Manganelli From demarco at apple.com Mon Nov 18 19:01:10 2002 From: demarco at apple.com (Vince DeMarco) Date: Thu Nov 3 14:50:24 2005 Subject: What's the behavior for two categories with the same method extensions? In-Reply-To: Message-ID: On Sunday, November 17, 2002, at 05:24 PM, Gregory Gerard wrote: > Say I write a category extending NSString with -someTrivialMethod. > ?Then, I load a plugin from a third party which does the exact same > thing but who has different behavior (possibly radically). > > Is there a cheap way to detect this before or after the fact? ?What > happens if I unload the plugin? ?Does the category defined in the > plugin pop-off giving me back my original behavior? > The last one loaded wins. The best (well an acceptable solution) is instead of calling the category something common call it something weird like _ggerard_mac_com_someTrivialMethod vince From tritchey at mac.com Mon Nov 18 19:24:00 2002 From: tritchey at mac.com (Timothy Ritchey) Date: Thu Nov 3 14:50:24 2005 Subject: What's the behavior for two categories with the same method extensions? In-Reply-To: <69BC5603-FB56-11D6-B162-003065F32C3C@apple.com> Message-ID: <384A7F64-FB6E-11D6-BEE9-003065D60376@mac.com> >> Is there a cheap way to detect this before or after the fact? ?What >> happens if I unload the plugin? ?Does the category defined in the >> plugin pop-off giving me back my original behavior? Perhaps you could store an array of IMPs that point to your category methods. After a bundle is loaded, you could call -methodForSelector:, and compare with your stored pointers to see if any have changed. - tim From campbell at theworld.com Mon Nov 18 19:56:01 2002 From: campbell at theworld.com (Larry Campbell) Date: Thu Nov 3 14:50:24 2005 Subject: Big leak in -[NSFileHandle availableData]? Message-ID: Sure seems like it. Here's some code, kind of useless but it's about the smallest I could make the example: ////////////////////////////////////// #import #import static void doTest(void) { NSPipe *pipe = [NSPipe pipe]; NSTask *task = [[NSTask alloc] init]; NSData *d; [task setLaunchPath:@"/usr/bin/who"]; // just some random command that writes output [task setStandardOutput:pipe]; [task launch]; d = [[pipe fileHandleForReading] availableData]; NSLog(@"1 Got %u bytes", [d length]); d = [[pipe fileHandleForReading] availableData]; // this seems to leak NSLog(@"1 Got %u bytes (0x%x)", [d length], d); [task waitUntilExit]; [task release]; } int main(const int argc, const char *argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog(@"Starting..."); doTest(); doTest(); [pool release]; NSLog(@"Sleeping..."); while (1) sleep(1); } ////////////////////////////////////// If you run this under MallocDebug, you'll see that NSFileHandle is leaking an NSData object of 4096 bytes. It only leaks when you call -[NSFileHandle availableData] when there's no more data left. If you comment out the second call to -[NSFileHandle availableData], the leak goes away. It's a real leak, not some MallocDebug artifact: if you wrap this in a loop and run it for a while you'll see your process VSIZE grow and grow and grow. Anyone else run into this? Anyone know a cure? (I call doTest twice because if I only call it once there's no leak, but this does seem to be a MallocDebug artifact; even when I deliberately leak with a malloc call, MallocDebug only finds it when it's called twice.) From rhale1 at macosx.com Mon Nov 18 20:43:01 2002 From: rhale1 at macosx.com (Ryan Z. Hale) Date: Thu Nov 3 14:50:24 2005 Subject: Auto-scrolling text In-Reply-To: <63904B00-FB5B-11D6-BF5A-0003930A674E@classicalguitar.net> Message-ID: try www.cocoadevcentral.com They have what you're looking for. On Monday, November 18, 2002, at 07:08 PM, Brian Bergstrand wrote: > Anyone have any examples of auto-scrolling text using NSTextView? Kind > of like what you see in about boxes all of the time. > > Basically you'd have to get the size of the string as drawn on screen > in the current font, figure out the pagination and wrapping in the > view and then calculate how much text is being displayed and how much > needs to be displayed. > > That's a lot easier said than done, and the online doc is not much > help. Plus, how do you restart the display from the beginning of the > text, but about two thirds of the way down in the view (so you get the > effect of continuously scrolling text)? > > What I really want is something just like PGP 8.0 about box. > > Thanks for any pointers. > > Brian Bergstrand > PGP Key ID: 0xB6C7B6A2 > Any sufficiently advanced technology is indistinguishable from magic. > - Arthur C. Clarke, "Technology and the Future" > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From rhale1 at macosx.com Mon Nov 18 20:44:01 2002 From: rhale1 at macosx.com (Ryan Z. Hale) Date: Thu Nov 3 14:50:24 2005 Subject: Auto-scrolling text In-Reply-To: Message-ID: <24456468-FB79-11D6-A718-003065AFBE00@macosx.com> Someone beat me to it by a few hours. Mail wasn't getting everything for some reason... Sorry for the extra message. On Monday, November 18, 2002, at 08:03 PM, Michael Mulligan wrote: > If I recall correctly, there's an article showing how to do this very > thing > on http://www.cocoadevcentral.com/ > > On 11/18/02 8:08 PM, "Brian Bergstrand" > wrote: > >> Anyone have any examples of auto-scrolling text using NSTextView? Kind >> of like what you see in about boxes all of the time. > > > > -m^2 > > __________ > Hi! I'm a .signature virus! Copy me into your ~/.signature to help me > spread! > __________ > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From mirage at macomega.com Mon Nov 18 20:58:00 2002 From: mirage at macomega.com (Matthew Bigarani) Date: Thu Nov 3 14:50:24 2005 Subject: Application Listing, Similar to System Profiler Message-ID: <622C48D2-FB7B-11D6-9999-000393D7503A@macomega.com> Hey everyone, I'm looking to get a list of applications and their version numbers, like Apple's System Profiler does. What would be the best/fastest way to go about this? I thought about wrapping: find /Applications -name \*.app and getting the info.plist, but that wouldn't cover carbon apps. -Matt Bigarani From dreamless at attbi.com Mon Nov 18 21:37:01 2002 From: dreamless at attbi.com (Nick Zitzmann) Date: Thu Nov 3 14:50:24 2005 Subject: Application Listing, Similar to System Profiler In-Reply-To: <622C48D2-FB7B-11D6-9999-000393D7503A@macomega.com> Message-ID: On Monday, November 18, 2002, at 08:57 PM, Matthew Bigarani wrote: > Hey everyone, I'm looking to get a list of applications and their > version numbers, like Apple's System Profiler does. What would be the > best/fastest way to go about this? I thought about wrapping: > > find /Applications -name \*.app > > and getting the info.plist, but that wouldn't cover carbon apps. Your program will have to search the disk for all files named "Info.plist", scan each one to see if the CFBundlePackageType is equal to "APPL", and then get the CFBundleShortVersionString if it is equal. That will work for all packaged applications, including Mach-O Carbon apps, and CFM Carbon apps that are bundled like Mach-O apps (iMovie, MSIE, Mozilla, Palm Desktop, Maya, etc.). For unbundled CFM Carbon or Classic applications, you need to check their HFS type codes for "APPL", make sure the app's parent directory is not titled "MacOSClassic", then use Carbon to check their "vers" resource to get the version number. Nick Zitzmann AIM/iChat: dragonsdontsleep Check out my software page: http://dreamless.home.attbi.com/ "La la la! I sing, too! For food, for food! La la la!" - Gabo, Dragon Warrior VII From finlay at dobbie.net Mon Nov 18 23:45:00 2002 From: finlay at dobbie.net (Finlay Dobbie) Date: Thu Nov 3 14:50:24 2005 Subject: Application Listing, Similar to System Profiler In-Reply-To: <622C48D2-FB7B-11D6-9999-000393D7503A@macomega.com> Message-ID: On Tuesday, November 19, 2002, at 04:57 AM, Matthew Bigarani wrote: > Hey everyone, I'm looking to get a list of applications and their > version numbers, like Apple's System Profiler does. What would be the > best/fastest way to go about this? I thought about wrapping: > > find /Applications -name \*.app > > and getting the info.plist, but that wouldn't cover carbon apps. _LSCopyAllApplicationURLs or similar, but that's private. *sigh* -- Finlay From sanguish at digifix.com Tue Nov 19 00:16:01 2002 From: sanguish at digifix.com (Scott Anguish) Date: Thu Nov 3 14:50:24 2005 Subject: Application Listing, Similar to System Profiler In-Reply-To: Message-ID: <7622772C-FB96-11D6-8CAE-003065C77D64@digifix.com> this (Info.plist) wouldn't actually just give you that.. It'd also give you source code too... so you'd also need to check the type of directory they're in as well... I miss the standard of ~/Applications and such.. On Tuesday, November 19, 2002, at 12:36 AM, Nick Zitzmann wrote: > > On Monday, November 18, 2002, at 08:57 PM, Matthew Bigarani wrote: > >> Hey everyone, I'm looking to get a list of applications and their >> version numbers, like Apple's System Profiler does. What would be the >> best/fastest way to go about this? I thought about wrapping: >> >> find /Applications -name \*.app >> >> and getting the info.plist, but that wouldn't cover carbon apps. > > Your program will have to search the disk for all files named > "Info.plist", scan each one to see if the CFBundlePackageType is equal > to "APPL", and then get the CFBundleShortVersionString if it is equal. > That will work for all packaged applications, including Mach-O Carbon > apps, and CFM Carbon apps that are bundled like Mach-O apps (iMovie, > MSIE, Mozilla, Palm Desktop, Maya, etc.). From hdiwan at mac.com Tue Nov 19 00:32:01 2002 From: hdiwan at mac.com (Hasan Diwan) Date: Thu Nov 3 14:50:24 2005 Subject: random() delivers same value every time? In-Reply-To: <64C85C4C-FB4D-11D6-98AE-000393B8FA92@u.washington.edu> Message-ID: <2EAF4E1A-FB84-11D6-8F33-0003935B11EA@mac.com> srandom(time(NULL)); You don't seem to be seeding your PRNG. Let me know if adding that to your code doesn't work. On Monday, November 18, 2002, at 03:28 PM, David Linker wrote: > I am trying to debug some code, and every time I stop in the debugger > when my code does something like: > > i = random(); > > and look at the value of i, it is the same value, even though the > debugger shows the value as changed. > > Any ideas? > > Thanks, > > David Linker > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > Hasan Diwan OpenPGP KeyID: 0xBE42DCA6 Fingerprint: 1CB0 47E3 0A24 DAC1 DCCA 4225 F166 40C2 BE42 DCA6 http://www.cs.rpi.edu/~diwanh/gpg.key -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 186 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021119/d2acdade/attachment.bin From kmoeller at spinfo.uni-koeln.de Tue Nov 19 00:56:01 2002 From: kmoeller at spinfo.uni-koeln.de (=?ISO-8859-1?Q?Knud_M=F6ller?=) Date: Thu Nov 3 14:50:24 2005 Subject: random() delivers same value every time? In-Reply-To: <200211190818.gAJ8I7f09599@slowbro.omnigroup.com> Message-ID: Have you seeded the random number generator? Typically you would seed it with time, as that will be different everytime your application starts. It works like this: srandom(time(NULL)); I hope that helped. Knud Am Dienstag den, 19. November 2002, um 09:18, schrieb macosx-dev- request@omnigroup.com: > > Message: 3 > Date: Mon, 18 Nov 2002 15:28:07 -0800 > Subject: random() delivers same value every time? > From: David Linker > To: Mac Dev > > I am trying to debug some code, and every time I stop in the debugger > when my code does something like: > > i = random(); > > and look at the value of i, it is the same value, even though the > debugger shows the value as changed. > > Any ideas? > > Thanks, > > David Linker From robert.fischer at berlin.de Tue Nov 19 04:05:00 2002 From: robert.fischer at berlin.de (Robert Fischer) Date: Thu Nov 3 14:50:24 2005 Subject: OK for apps to break hard links? In-Reply-To: Message-ID: <05DDB1BF-FBB7-11D6-A1C2-003065E61D62@berlin.de> On Monday, November 18, 2002, at 08:42 PM, Troy Goodson wrote: > I see. So there's a trade-off here. And, I guess Finder aliases > -don't- get broken. So, when presented with this case, should the > application warn the user that a hard link (or soft link) is about to > be broken? ... Symbolic links will not be broken as well! So "ln -s hello.txt hello-link.txt" will work. What did you mean with "soft link"? Cheers, Robert -- --- - .-. -- -- --- / \ ---- tin:b Software .-. / \ --- .-. __o .-. (i) / \ / \ / \ _`\<,_ / \ Robert Fischer / \ / \ / \ (*)/ (*) / `--------------- / `---' `-' `-----------' From kirby132 at hotmail.com Tue Nov 19 07:38:01 2002 From: kirby132 at hotmail.com (Kevin Bohan) Date: Thu Nov 3 14:50:24 2005 Subject: Use of kCFUserNotificationIconURLKey in CFUserNotificationCreate? Message-ID: Hi, I want to use CFUserNotificationCreate to display a notification that contains an icon that I supply. I have the following code: ... CFStringRef keys[3]; CFStringRef values[3]; CFDictionaryRef tempDict = NULL; // Create dictionary for notification call keys[0] = kCFUserNotificationIconURLKey; keys[1] = kCFUserNotificationAlertHeaderKey; keys[2] = kCFUserNotificationAlertMessageKey; values[0] = NULL; values[1] = CFSTR(PRODUCT_NAME_CSTRING); values[2] = completeMessageStr; CFURLRef urlRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("myIcon"), CFSTR("icns"), NULL); if (urlRef) { CFURLRef absURLRef = CFURLCopyAbsoluteURL(urlRef); if (absURLRef) { values[0] = CFURLGetString(absURLRef); CFRetain(values[0]); CFRelease(absURLRef); } CFRelease(urlRef); } tempDict = CFDictionaryCreate(NULL, (const void **) keys, (const void **) values, DIMENSION_OF(keys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); if (tempDict) { _sUserNotificationRef = CFUserNotificationCreate(NULL, timeout, kCFUserNotificationPlainAlertLevel, NULL, tempDict); MyCFRelease((CFTypeRef *) &tempDict); } if (values[0]) { CFRelease(values[0]); } ... If I step through the code I everything seems to check out. The resource URL has the right value etc. The only problem is I never see my icon in the resulting notification. Is this working, or am I doing something wrong? I see that if I use CFUserNotificationDisplayNotice I can specify a URL for the icon and that seems to work. However, this function doesn't give me a CFUserNotificationRef. How can I get a CFUserNotificationRef and yet also show my own icon? Kirby _________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail From pcoskren at mac.com Tue Nov 19 08:30:11 2002 From: pcoskren at mac.com (Patrick Coskren) Date: Thu Nov 3 14:50:24 2005 Subject: CoreFoundation or Expat? Message-ID: <966DDB74-FBDB-11D6-9A75-000502857641@mac.com> Hi, all. I'm writing a client for a web service, and it needs to parse a potentially very long XML document. Because of the length, I'd like for the code to be able to parse the XML as it arrives, instead of having to wait until the entire document is downloaded. The Expat parser by James Clark (http://expat.sourceforge.net) can do this, as far as I can tell, but it uses icky raw C types. Ew! I'd much rather use CoreFoundation (I'm limited to C here, for political reasons), and it provides a function CFXMLParserCreateWithDataFromURL() which looks promising. However, I fear that all it does is download the XML into a CFData object first, and only when that's complete does it start parsing. Does anybody have any experience with whether this is the case? Is the CoreFoundation XML parser any good? Should I even be pursuing it, or should I just give up and go with Expat? Thanks for any advice. Best, -Patrick Coskren From eyredler at netvision.net.il Tue Nov 19 08:45:01 2002 From: eyredler at netvision.net.il (Eyal Redler) Date: Thu Nov 3 14:50:24 2005 Subject: Localized strings, when to use which macro Message-ID: <171DF7FE-FBDE-11D6-8F8D-003065C9C4EE@netvision.net.il> Hi list, I'm trying to figure out the best way to localize my app. My main problem is deciding which macro (NSLocalizedStringFromTable, NSLocalizedString etc.) to use. What happens if I have to entries with the same key? And what should I do if the translation would be different for one of them (for example the word "type" as a noun, verb etc.) When should I use NSLocalizedStringFromTable and when should I use NSLocalizedString? Thanks, Eyal From gss+osxdev at cs.brown.edu Tue Nov 19 09:32:02 2002 From: gss+osxdev at cs.brown.edu (Gregory Seidman) Date: Thu Nov 3 14:50:24 2005 Subject: CoreFoundation or Expat? In-Reply-To: <966DDB74-FBDB-11D6-9A75-000502857641@mac.com> References: <966DDB74-FBDB-11D6-9A75-000502857641@mac.com> Message-ID: <20021119172859.GA18769@cs.brown.edu> Patrick Coskren sez: } I'm writing a client for a web service, and it needs to parse a } potentially very long XML document. Because of the length, I'd like } for the code to be able to parse the XML as it arrives, instead of } having to wait until the entire document is downloaded. The Expat } parser by James Clark (http://expat.sourceforge.net) can do this, as } far as I can tell, but it uses icky raw C types. Ew! Yes, expat is a C library. Nonetheless, it is beautiful in that it is lightweight and simple. } I'd much rather use CoreFoundation (I'm limited to C here, for } political reasons), and it provides a function } CFXMLParserCreateWithDataFromURL() which looks promising. However, I } fear that all it does is download the XML into a CFData object first, } and only when that's complete does it start parsing. Are you limited to C or just not Java? I recommend Xerces-C as an excellent C++ library. } Does anybody have any experience with whether this is the case? Is } the CoreFoundation XML parser any good? Should I even be pursuing it, } or should I just give up and go with Expat? I'd go with expat, but I don't know anything about the CF parser. I like expat. } Thanks for any advice. } Best, } -Patrick Coskren --Greg From ddavidso at apple.com Tue Nov 19 09:32:58 2002 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:50:24 2005 Subject: Localized strings, when to use which macro In-Reply-To: <171DF7FE-FBDE-11D6-8F8D-003065C9C4EE@netvision.net.il> Message-ID: On Tuesday, November 19, 2002, at 08:43 AM, Eyal Redler wrote: > I'm trying to figure out the best way to localize my app. My main > problem is deciding which macro (NSLocalizedStringFromTable, > NSLocalizedString etc.) to use. > What happens if I have to entries with the same key? And what should I > do if the translation would be different for one of them (for example > the word "type" as a noun, verb etc.) > > When should I use NSLocalizedStringFromTable and when should I use > NSLocalizedString? If you have many localizable strings, and you wish to organize them into manageable subsets, then you can create multiple .strings files with different names, and use NSLocalizedStringFromTable() with the names of the particular files. Otherwise, you can simply use a single Localizable.strings file, and just use NSLocalizedString(). It's a bit like the choice of whether to use a single nib or multiple nibs for your interface. If you have two items with the same text in your development localization, and they are used in different contexts, so that they might have different translations in other localizations, and if they occur in the same .strings file (as in the preceding paragraph), then you will need to do something to disambiguate them. Either forcibly move them into separate .strings files, or else change the values of the keys. There's no requirement that the key be equal to the localized value in the development localization; that's just a matter of convenience. Some developers like to use abstract keys (e.g. @"CANCEL_BUTTON_TEXT") for everything. The problem of ambiguous translations occurs less often than you might think. In some cases it's not a problem--for example, an "OK" button should probably have the same translation everywhere it occurs. In other cases it is unlikely--many localized items are sentences or sentence fragments rather than single words, and duplication is unlikely. (In fact, it's good form for localized items to be as semantically complete as practicable, because it can be very hard to translate a single word.) Most of the rest of the cases will naturally separate into different .strings files. Douglas Davidson From ddavidso at apple.com Tue Nov 19 09:33:47 2002 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:50:24 2005 Subject: Use of kCFUserNotificationIconURLKey in CFUserNotificationCreate? Message-ID: On Tuesday, November 19, 2002, at 07:37 AM, Kevin Bohan wrote: > I want to use CFUserNotificationCreate to display a notification that > contains an icon that I supply. I have the following code: The value for the kCFUserNotificationIconURLKey should be the URL itself, not a string representing its path. Douglas Davidson From kirby132 at hotmail.com Tue Nov 19 09:53:01 2002 From: kirby132 at hotmail.com (Kevin Bohan) Date: Thu Nov 3 14:50:24 2005 Subject: Use of kCFUserNotificationIconURLKey in CFUserNotificationCreate? Message-ID: OK that worked. Thanks. I assumed I needed the path, not the URL itself, as the keys are typically assigned CFStringRef values. I have cast the URL to a CFStringRef to make the compiler happy and that worked fine. I must say it's not obvious from the documentation that this needs to be a URL rather than a CFStringRef, or maybe it should have been obvious from the fact that the name of the key contains the word URL. I suppose to be correct I should make "values" an array of "const void *" and cast the other items to CFStringRef's. Obviously it makes no real difference at the whole thing is cast to a "const void **" when passed to the notification function, and it obviously relies on the programmer to have passed the right types of parameters, or I suspect it checks the type before using the value, which would explain why it didn't crash when I incorrectly passed a CFStringRef instead of a CFURLRef. Nice example, of where the Type ID are used to good advantage I think. Thanks again, Kirby >From: Douglas Davidson >To: Kevin Bohan >CC: macosx-dev@omnigroup.com >Subject: Re: Use of kCFUserNotificationIconURLKey in >CFUserNotificationCreate? >Date: Tue, 19 Nov 2002 09:21:43 -0800 > > >On Tuesday, November 19, 2002, at 07:37 AM, Kevin Bohan wrote: > >>I want to use CFUserNotificationCreate to display a notification that >>contains an icon that I supply. I have the following code: > >The value for the kCFUserNotificationIconURLKey should be the URL itself, >not a string representing its path. > >Douglas Davidson _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail From tritchey at mac.com Tue Nov 19 09:57:01 2002 From: tritchey at mac.com (Timothy Ritchey) Date: Thu Nov 3 14:50:24 2005 Subject: CoreFoundation or Expat? In-Reply-To: <966DDB74-FBDB-11D6-9A75-000502857641@mac.com> Message-ID: <23AD7C44-FBE8-11D6-B552-003065D60376@mac.com> I am using the precompiled libxml2 and libxslt frameworks at: http://www.zveno.com/open_source/libxml2xslt.html This is an OSX build of the gnome C xml library. You can get all the information on it at: http://www.xmlsoft.org The parser has a "push" mode that allows you to set up a parser context, and then push chunks as they become available. xmlCreatePushParserCtxt(...) xmlParseChunk(...) This library includes a validating parser, xslt implementation and supports advanced XML features like xincludes, etc. These frameworks make it pretty darn easy to include in an application On Tuesday, November 19, 2002, at 11:25 AM, Patrick Coskren wrote: > Hi, all. > > I'm writing a client for a web service, and it needs to parse a > potentially very long XML document. Because of the length, I'd like > for the code to be able to parse the XML as it arrives, instead of > having to wait until the entire document is downloaded. The Expat > parser by James Clark (http://expat.sourceforge.net) can do this, as > far as I can tell, but it uses icky raw C types. Ew! > > I'd much rather use CoreFoundation (I'm limited to C here, for > political reasons), and it provides a function > CFXMLParserCreateWithDataFromURL() which looks promising. However, I > fear that all it does is download the XML into a CFData object first, > and only when that's complete does it start parsing. > > Does anybody have any experience with whether this is the case? Is > the CoreFoundation XML parser any good? Should I even be pursuing it, > or should I just give up and go with Expat? > > Thanks for any advice. > > Best, > -Patrick Coskren > > _______________________________________________ > 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: 1851 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021119/60e42817/attachment.bin From jrepp at ingeniux.com Tue Nov 19 09:58:54 2002 From: jrepp at ingeniux.com (Jake A. Repp) Date: Thu Nov 3 14:50:24 2005 Subject: CoreFoundation or Expat? Message-ID: CoreFoundation parser is pretty solid, I wrapped it with a Cocoa based DOM and find it to be stable. I am using mostly small documents and haven't analzed performance between expat and CF parser. I have used expat on projects in the past and I think that it's API is easier to handle than the CF stuff. I believe that CF parser attempts to parse DTDs and requires the entire document to be read in before it is parsed. -jake -----Original Message----- From: Patrick Coskren [mailto:pcoskren@mac.com] Sent: Tuesday, November 19, 2002 8:26 AM To: macosx-dev@omnigroup.com Subject: CoreFoundation or Expat? Hi, all. I'm writing a client for a web service, and it needs to parse a potentially very long XML document. Because of the length, I'd like for the code to be able to parse the XML as it arrives, instead of having to wait until the entire document is downloaded. The Expat parser by James Clark ( http://expat.sourceforge.net) can do this, as far as I can tell, but it uses icky raw C types. Ew! I'd much rather use CoreFoundation (I'm limited to C here, for political reasons), and it provides a function CFXMLParserCreateWithDataFromURL() which looks promising. However, I fear that all it does is download the XML into a CFData object first, and only when that's complete does it start parsing. Does anybody have any experience with whether this is the case? Is the CoreFoundation XML parser any good? Should I even be pursuing it, or should I just give up and go with Expat? Thanks for any advice. Best, -Patrick Coskren _______________________________________________ MacOSX-dev mailing list MacOSX-dev@omnigroup.com http://www.omnigroup.com/mailman/listinfo/macosx-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman/archive/macosx-dev/attachments/20021119/cea6a300/attachment.html From clarkcox3 at mac.com Tue Nov 19 10:00:47 2002 From: clarkcox3 at mac.com (Clark S. Cox III) Date: Thu Nov 3 14:50:24 2005 Subject: Localized strings, when to use which macro In-Reply-To: <171DF7FE-FBDE-11D6-8F8D-003065C9C4EE@netvision.net.il> Message-ID: <41754FCB-FBE8-11D6-8895-0050E4EE1966@mac.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday, Nov 19, 2002, at 11:43 US/Eastern, Eyal Redler wrote: > Hi list, > > I'm trying to figure out the best way to localize my app. My main > problem is deciding which macro (NSLocalizedStringFromTable, > NSLocalizedString etc.) to use. > What happens if I have to entries with the same key? And what should I > do if the translation would be different for one of them (for example > the word "type" as a noun, verb etc.) Basically, you avoid that situation. Attempting to translate individual words will not work because of differences in word order. Instead, make sure that your localized strings are sentences. For example, trying to localize "Quit Program" word for word into German, would yield "beenden Program", which is nonsense because of the word is wrong. However, if your key is "Quit Program" as a single string, the German localized version can be "Program beenden" also as a single string. That way, if two entries have the same key, they should be translated the same way. > When should I use NSLocalizedStringFromTable and when should I use > NSLocalizedString? If you need to group your localizations into different categories, etc, then use NSLocalizedStringFromTable, however I find that I rarely need that and usually stick to NSLocalizedString. - -- http://homepage.mac.com/clarkcox3/ clarkcox3@mac.com Clark S. Cox, III -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (Darwin) iEYEARECAAYFAj3ae14ACgkQd6STocYT1xWfJwCeKZCPnYLVb63MJ93O2r+RWldD UWAAoIbi/VRm1A1YWbNVh5AXTMigeBA4 =lC1n -----END PGP SIGNATURE----- From pcoskren at mac.com Tue Nov 19 10:07:35 2002 From: pcoskren at mac.com (Patrick Coskren) Date: Thu Nov 3 14:50:24 2005 Subject: CoreFoundation or Expat? In-Reply-To: Message-ID: <0E547FBF-FBE9-11D6-9A75-000502857641@mac.com> On Tuesday, November 19, 2002, at 12:51 PM, Jake A. Repp wrote: > CoreFoundation parser is pretty solid, I wrapped it with a Cocoa based > DOM and find it > to be stable. I am using mostly small documents and haven't analzed > performance between > expat and CF parser.? I have used expat on projects in the past and I > think that it's API is > easier to handle than the CF stuff. Interesting. > ? > I believe that CF parser attempts to parse DTDs and requires the > entire document to be > read in before it is parsed. Bingo; that's what I was looking for. It's not the answer I wanted, sigh, but it's the answer I thought most likely. Thanks, -Patrick -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 1339 bytes Desc: not available Url : /mailman/archive/macosx-dev/attachments/20021119/7a5f5938/attachment.bin From ctp at apple.com Tue Nov 19 10:18:12 2002 From: ctp at apple.com (Chris Parker) Date: Thu Nov 3 14:50:24 2005 Subject: CoreFoundation or Expat? In-Reply-To: <966DDB74-FBDB-11D6-9A75-000502857641@mac.com> Message-ID: Hi Patrick, On Tuesday, November 19, 2002, at 08:25 AM, Patrick Coskren wrote: > I'm writing a client for a web service, and it needs to parse a > potentially very long XML document. Because of the length, I'd like > for the code to be able to parse the XML as it arrives, instead of > having to wait until the entire document is downloaded. The Expat > parser by James Clark (http://expat.sourceforge.net) can do this, as > far as I can tell, but it uses icky raw C types. Ew! > > I'd much rather use CoreFoundation (I'm limited to C here, for > political reasons), and it provides a function > CFXMLParserCreateWithDataFromURL() which looks promising. However, I > fear that all it does is download the XML into a CFData object first, > and only when that's complete does it start parsing. > > Does anybody have any experience with whether this is the case? Yes, I do. :) It is the case that CFXML wants the whole URL into a CFData before it'll start its parse. > Is the CoreFoundation XML parser any good? Should I even be pursuing > it, or should I just give up and go with Expat? Depends on what you want to do I suppose - CFXMLParser's tree routines are nice if you need "native" Cocoa/CF types, but if your concern is the "streamy" nature of your parse, then expat may be a better choice for you, and you should wind up doing the string conversions yourself (mind the encodings!). .chris -- Chris Parker Cocoa Frameworks Engineer Apple Computer, Inc. From pcoskren at mac.com Tue Nov 19 10:33:01 2002 From: pcoskren at mac.com (Patrick Coskren) Date: Thu Nov 3 14:50:24 2005 Subject: CoreFoundation or Expat? In-Reply-To: Message-ID: <450DB4FE-FBED-11D6-9A75-000502857641@mac.com> On Tuesday, November 19, 2002, at 01:15 PM, Chris Parker wrote: >> Does anybody have any experience with whether this is the case? > > Yes, I do. :) It is the case that CFXML wants the whole URL into a > CFData before it'll start its parse. Ah, well. On the guess that would turn out to be the case, I wrote my own implementation of CFXMLParserCreateWithDataURL. I've included it at the bottom in case it comes in handy for anyone. It basically swallows errors for now; I'm working on that. >> Is the CoreFoundation XML parser any good? Should I even be pursuing >> it, or should I just give up and go with Expat? > > Depends on what you want to do I suppose - CFXMLParser's tree routines > are nice if you need "native" Cocoa/CF types, but if your concern is > the "streamy" nature of your parse, then expat may be a better choice > for you, and you should wind up doing the string conversions yourself > (mind the encodings!). Precisely what CoreFoundation let me avoid! I hate dealing with raw pointer buffers for strings and arrays. Not that I can't; it's just that it's 2002: aren't we past such things yet? Sigh... Anyway, looks like I've got me a tradeoff. I think what I'll do is stick with CF for now, but move over to expat if I really need the streaminess. Thanks, -Patrick /* * Platform-independent version of the CFXMLParserCreateWithDataFromURL function. * Latin-1 encoding is assumed, and any whitespace in the URL is escaped. */ CFXMLParserRef CFXMLParserCreateWithDataFromURL2(CFAllocatorRef allocator, CFURLRef dataSource, CFOptionFlags parseOptions, CFIndex versionOfNodes, CFXMLParserCallBacks *callBacks, CFXMLParserContext *context) { CFDataRef document; Boolean urlSuccess; SInt32 errorCode; CFDictionaryRef properties; CFArrayRef desiredProperties = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks); urlSuccess = CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, dataSource, &document, &properties, desiredProperties, &errorCode); // If we couldn't get the data, give an empty document to the parser: // let's treat it as an empty C string. if (false == urlSuccess) { UInt8 *buf = (UInt8 *)malloc(sizeof(UInt8)); buf[0] = 0; document = CFDataCreate(kCFAllocatorDefault, buf, 1); free(buf); } CFXMLParserRef result = CFXMLParserCreate(kCFAllocatorDefault, document, dataSource, parseOptions, versionOfNodes, callBacks, context); CFRelease(desiredProperties); CFRelease(document); CFRelease(properties); return result; } From brian at classicalguitar.net Tue Nov 19 10:45:05 2002 From: brian at classicalguitar.net (Brian Bergstrand) Date: Thu Nov 3 14:50:24 2005 Subject: Auto-scrolling text In-Reply-To: Message-ID: On Monday, November 18, 2002, at 08:03 PM, Michael Mulligan wrote: > If I recall correctly, there's an article showing how to do this very > thing > on http://www.cocoadevcentral.com/ > Thanks for the pointer. Google didn't turn it up on a search; must not have used the right keywords. Anyway, not to disparage free code, but whoever wrote this really doesn't know what they are doing. First off, they specify the scroll timer interval as "1/4". Well when this is converted to a float by the compiler (for [NSTimer scheduledTimerWithTimeInterval:...]) it ends up being 0, not .25 as they documented in the code. Secondly and most heinous, is the use of maxScrollHeight = [[creditsField string] length]; How in the hell is the number of chars in the string even loosely related to the # of pixels to scroll for the height? Anyway I've fixed up our original code (which, turns out used this example almost verbatim) so that it at least takes the # of lines, the line height, and the View's height into account when scrolling. I still don't know how to do the continuous scrolling thing though. Right now, when all of the text has been scrolled, it "jumps" back to the beginning, instead of continuing in a loop manner. Quite noticeable, but it works. > On 11/18/02 8:08 PM, "Brian Bergstrand" > wrote: > >> Anyone have any examples of auto-scrolling text using NSTextView? Kind >> of like what you see in about boxes all of the time. > Brian Bergstrand PGP Key ID: 0xB6C7B6A2 Oh, they have the Internet on computers now. - Homer Simpson From madbird2 at noos.fr Tue Nov 19 11:04:24 2002 From: madbird2 at noos.fr (=?ISO-8859-1?Q?J=E9r=F4me=20Seydoux?=) Date: Thu Nov 3 14:50:24 2005 Subject: Using cocoa's spelling panel in a carbon application Message-ID: <20021119190019.10378@127.0.0.1> Hi all, I'm using NSSpellChecker's API from a carbon application, but I would also like to use the cocoa spelling panel. I can open it, using [[[NSSpellChecker sharedSpellChecker] spellingPanel] makeKeyAndOrderFront:NULL], but I don't know how to catch the messages sent when the user clicks the "correct" or "find next" buttons in the panel. I tried to set an object as nextResponder or a delegate for the spelling panel, but it never receives the changeSpelling: message, and I have not found a protocol for "find next". Has anyone ever used the spelling panel with anything other than NSText? I'm also considering to reimplement this dialog in carbon, but I have not found an API to get the list of languages to put in the popup menu. Am I missing something? Jerome From hayne at sympatico.ca Tue Nov 19 11:10:05 2002 From: hayne at sympatico.ca (Cameron Hayne) Date: Thu Nov 3 14:50:24 2005 Subject: Auto-scrolling text In-Reply-To: Message-ID: On 19/11/02 1:37 pm, "Brian Bergstrand" wrote: > I still don't know how to do the continuous scrolling thing though. > Right now, when all of the text has been scrolled, it "jumps" back to > the beginning, instead of continuing in a loop manner. Quite > noticeable, but it works. One possible way would be to have all your text in a circular buffer - e.g. in an array, one line per element. Then, each time the timer fires, you move all the text elements that have scrolled off the top to the end of the array and remove them from the front of the array. There's probably a better way but that's one way to do it. -- Cameron Hayne (hayne@sympatico.ca) Hayne of Tintagel From ddavidso at apple.com Tue Nov 19 11:38:01 2002 From: ddavidso at apple.com (Douglas Davidson) Date: Thu Nov 3 14:50:24 2005 Subject: Using cocoa's spelling panel in a carbon application In-Reply-To: <20021119190019.10378@127.0.0.1> Message-ID: <8C970FA6-FBF6-11D6-9EEC-000393115062@apple.com> On Tuesday, November 19, 2002, at 11:00 AM, J?r?me Seydoux wrote: > I'm using NSSpellChecker's API from a carbon application, but I would > also like to use the cocoa spelling panel. I can open it, using > [[[NSSpellChecker sharedSpellChecker] spellingPanel] > makeKeyAndOrderFront:NULL], but I don't know how to catch the messages > sent when the user clicks the "correct" or "find next" buttons in the > panel. I tried to set an object as nextResponder or a delegate for the > spelling panel, but it never receives the changeSpelling: message, and > I > have not found a protocol for "find next". > Has anyone ever used the spelling panel with anything other than > NSText? The standard spelling submenu has three items: Spelling..., Check Spelling, and Check Spelling As You Type. These are all targeted at the first responder, typically an NSTextView, and they call the methods showGuessPanel:, checkSpelling:, and toggleContinuousSpellChecking:. NSTextView implements all three of these methods, and a custom text view could implement any or all of them. NSTextView also has machinery to enable these three menu items when appropriate--usually, whenever it is first responder. The NSTextView implementations of these methods all make use of NSSpellChecker; a custom text view could do this as well, or it could substitute some other implementation. showGuessPanel: calls checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wo rdCount: to perform one spellchecking pass, and then updateSpellingPanelWithMisspelledWord: to update the panel, and then just calls orderFront: on the spellchecker's spellingPanel. checkSpelling: does much the same thing, but without the orderFront:. toggleContinuousSpellChecking: sets some internal state in NSTextView that controls NSTextView's as-you-type spellchecking. When as-you-type spellchecking is enabled, NSTextView at certain points in typing will decide to spellcheck a certain word, and then will call the NSSpellChecker method checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wo rdCount: to do so. The single NSSpellChecker instance controls the spelling panel and performs almost all of the interaction with it. When the NSSpellChecker needs to communicate back with its client, it simply targets the first responder. There are three methods that it may send to the first responder: checkSpelling:, changeSpelling:, and ignoreSpelling:. checkSpelling: has already been covered; changeSpelling: changes the selected range in the NSTextView to [[sender selectedCell] stringValue], and ignoreSpelling: calls back into the NSSpellChecker, using the method ignoreWord:inSpellDocumentWithTag:, where the string being ignored is [sender stringValue]. The tag is maintained by the NSTextView, and it could be anything, but in practice it is usually obtained from the NSSpellChecker using uniqueSpellDocumentTag. It is simply supposed to be a unique identifier per document. So a client other than NSTextView would want to implement most or all of the following five methods: showGuessPanel:, checkSpelling: toggleContinuousSpellChecking:, changeSpelling:, and ignoreSpelling:. > I'm also considering to reimplement this dialog in carbon, but I have > not > found an API to get the list of languages to put in the popup menu. Am > I > missing something? No, you're not; this has not yet been made public. Douglas Davidson From dev at dejal.com Tue Nov 19 11:58:01 2002 From: dev at dejal.com (David Sinclair) Date: Thu Nov 3 14:50:24 2005 Subject: Auto-scrolling text In-Reply-To: Message-ID: <160E6B3C-FBF9-11D6-BB0C-000393768D9E@dejal.com> On Tuesday, Nov 19, 2002, at 10:37 US/Pacific, Brian Bergstrand wrote: > I still don't know how to do the continuous scrolling thing though. > Right now, when all of the text has been scrolled, it "jumps" back to > the beginning, instead of continuing in a loop manner. Quite > noticeable, but it works. A simple way is to have blank lines before the first text, so the first line of text is just below the bottom of the view. Similarly, have blank lines after the end of the text. Then the text will scroll into view, and when it reaches the end, the text has scrolled off the top, so when it jumps back to the top, the first line will smoothly scroll into view again. -- David Sinclair, Dejal Systems, LLC - dev@dejal.com Let Dejal Simon keep an eye on your sites for changes or failures! http://www.dejal.com/simon/ From andreas at harmless.de Tue Nov 19 12:00:02 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:24 2005 Subject: Localized strings, when to use which macro In-Reply-To: <41754FCB-FBE8-11D6-8895-0050E4EE1966@mac.com> Message-ID: <450470C3-FBF9-11D6-868D-00050231227A@harmless.de> Am Dienstag, 19.11.02 um 18:56 Uhr schrieb Clark S. Cox III: > would yield "beenden Program", which is nonsense because [...] While what you say is absolutely right, please note that the correct spelling is 'Programm', with two Ms. :} bye. Andreas. From clarkcox3 at mac.com Tue Nov 19 12:29:01 2002 From: clarkcox3 at mac.com (Clark S. Cox III) Date: Thu Nov 3 14:50:24 2005 Subject: Localized strings, when to use which macro In-Reply-To: <450470C3-FBF9-11D6-868D-00050231227A@harmless.de> Message-ID: <61908EDB-FBFD-11D6-8895-0050E4EE1966@mac.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday, Nov 19, 2002, at 14:58 US/Eastern, Andreas Mayer wrote: > > Am Dienstag, 19.11.02 um 18:56 Uhr schrieb Clark S. Cox III: > >> would yield "beenden Program", which is nonsense because [...] > > While what you say is absolutely right, please note that the correct > spelling is 'Programm', with two Ms. :} Well, then it's even more nonsense :) - -- http://homepage.mac.com/clarkcox3/ clarkcox3@mac.com Clark S. Cox, III -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (Darwin) iEYEARECAAYFAj3antEACgkQd6STocYT1xVIYACdE7vivywxW7sUxAVOwiAUG+8z 83IAn3fGyxv3eHsnYM52R8E3EljRW+Ju =86cC -----END PGP SIGNATURE----- From madbird2 at noos.fr Tue Nov 19 12:36:01 2002 From: madbird2 at noos.fr (=?ISO-8859-1?Q?J=E9r=F4me=20Seydoux?=) Date: Thu Nov 3 14:50:24 2005 Subject: Using cocoa's spelling panel in a carbon application In-Reply-To: <8C970FA6-FBF6-11D6-9EEC-000393115062@apple.com> References: <8C970FA6-FBF6-11D6-9EEC-000393115062@apple.com> Message-ID: <20021119203457.17959@127.0.0.1> Douglas Davidson wrote: >The single NSSpellChecker instance controls the spelling panel and >performs almost all of the interaction with it. When the >NSSpellChecker needs to communicate back with its client, it simply >targets the first responder. There are three methods that it may send >to the first responder: checkSpelling:, changeSpelling:, and >ignoreSpelling:. The problem is that the main window is a carbon window, so it does not have a responder chain. So I am trying to add a cocoa object in the spelling panel's responder chain, and make it communicate with the carbon window. But I don't know how to put my object in the responder chain : I tried setting my object as the spelling panel's delegate or next responder, or as the [NSApplication sharedApplication]'s delegate, but it never receives any message. So the question seems in fact not related to NSSpellChecker: how to intercept a message sent to the responder chain when the key window is a standard panel like the spelling panel, and when the main window and the rest of the application is carbon? >> I have not >> found an API to get the list of languages to put in the popup menu. Am >> I missing something? > >No, you're not; this has not yet been made public. Is there a way to find the dictionaries by scanning the library folders, or some service registry? Jerome From andreas at harmless.de Tue Nov 19 13:51:01 2002 From: andreas at harmless.de (Andreas Mayer) Date: Thu Nov 3 14:50:24 2005 Subject: Auto-scrolling text In-Reply-To: Message-ID: Am Dienstag, 19.11.02 um 19:37 Uhr schrieb Brian Bergstrand: > I still don't know how to do the continuous scrolling thing though. Suggestion: Draw the whole text into an offline buffer and copy the part you need to the visible view. When at the end, you have to copy two parts of course. bye. Andreas. From mmckinley at digimarc.com Tue Nov 19 14:15:01 2002 From: mmckinley at digimarc.com (Mike McKinley) Date: Thu Nov 3 14:50:24 2005 Subject: NSCreateObjectFileImageFromMemory() Message-ID: <6085EA3FA990FA44A0AEC80471AE9C610246D341@pdx-exchange2.corp.digimarc.com> In dyld.h, NSCreateObjectFileImageFromMemory() is listed as "not yet implemented". When I call it with a library file that works with NSCreateObjectFileImageFromFile(), the error "NSObjectFileImageFailure" (0) is reported. No message is printed to stderr. Is NSCreateObjectFileImageFromMemory() really unimplemented since 1999? If so, will it ever be implemented? If it will never be implemented, how can I duplicate its functionality? If it is part of Darwin, where does it live? Best regards, -mike From chergr at bigpond.com Tue Nov 19 14:20:05 2002 From: chergr at bigpond.com (Richard) Date: Thu Nov 3 14:50:24 2005 Subject: CoreFoundation or Expat? References: <966DDB74-FBDB-11D6-9A75-000502857641@mac.com> Message-ID: <3DDAB87C.366A5CBC@bigpond.com> The OOFile people have a c++ wrapper around expat. There are likely to be others as well as alternate event driven parsers. And maybe you could use a Java XML parser. Patrick Coskren wrote: > Hi, all. > > I'm writing