From dunham at mac.com Fri Feb 1 17:27:33 2008 From: dunham at mac.com (David Dunham) Date: Fri Feb 1 17:27:39 2008 Subject: Position window title offscreen Message-ID: <061A8F29-E985-4CE8-97CC-9EF3942A9577@mac.com> In a Carbon app, I can switch monitor resolution to "full screen," hide the menu bar, and then position my window such that its top pixel of content as at the top of the screen. (This requires setting kWindowNoConstrainAttribute.) I don't seem to be able to do the same in Cocoa. No matter what, the title bar remains entirely visible. (I've even tried getting the Carbon WindowRef and using Carbon calls to move the window -- I'm not sure this works at all.) I tried subclassing NSWindow and overriding - constrainFrameRect:toScreen:, but I don't really think this is relevant (nor did it help). I'd greatly prefer not deleting and recreating my NSWindow. David Dunham Voice/Fax: 206 783 7404 http://www.pensee.com/dunham/ Imagination is more important than knowledge. -- Albert Einstein From dunham at mac.com Fri Feb 1 21:16:22 2008 From: dunham at mac.com (David Dunham) Date: Fri Feb 1 21:16:27 2008 Subject: OmniObjectMeter and Obj-C++ and/or Leopard Message-ID: <5FF41E78-9A8B-4A8A-AA6C-5BF0E01D0DB4@mac.com> Last time I used OOM was under 10.4.x and with an Objective-C app. Today I tried it under 10.5.1 and with Objective-C++ code. When I clicked on an object, it didn't give the greatest stack trace (it shows much of it being in OpenGL code -- my app does happen to use it, but not where I was looking). And the object I was especially interested in had a history where the refcount went negative. Oh, the other change is I'm now compiling with Xcode 3.0. But I'm not using Objective-C 2.0. Does OOM work in this environment? David Dunham Voice/Fax: 206 783 7404 http://www.pensee.com/dunham/ Imagination is more important than knowledge. -- Albert Einstein From joshua.brickner at mac.com Fri Feb 1 21:59:16 2008 From: joshua.brickner at mac.com (Joshua Brickner) Date: Fri Feb 1 21:59:20 2008 Subject: Getting Started with OWF for FTP Message-ID: <31CC70D5-0117-1000-9294-96DAE4ACE133-Webmail-10022@mac.com> I realize there is no documentation for OmniGroup's OWF, but does anyone have a suggestion on how to get started? I'm writing an app in which I need to download, upload, and delete files with FTP. Any pointers would be greatly appreciated. -Josh From sstevenson at mac.com Fri Feb 1 23:38:00 2008 From: sstevenson at mac.com (Scott Stevenson) Date: Fri Feb 1 23:38:06 2008 Subject: Position window title offscreen In-Reply-To: <061A8F29-E985-4CE8-97CC-9EF3942A9577@mac.com> References: <061A8F29-E985-4CE8-97CC-9EF3942A9577@mac.com> Message-ID: <2BB4B361-FEAB-42DD-A6D9-9011438740E9@mac.com> On Feb 1, 2008, at 5:27 PM, David Dunham wrote: > I don't seem to be able to do the same in Cocoa. No matter what, the > title bar remains entirely visible. (I've even tried getting the > Carbon WindowRef and using Carbon calls to move the window -- I'm > not sure this works at all.) Leopard has built-in full screen abilities: NSView -enterFullScreenMode:withOptions: -exitFullScreenModeWithOptions:; -isInFullScreenMode; Can you use those? If not, try this: - Scott From dunham at mac.com Sat Feb 2 10:33:23 2008 From: dunham at mac.com (David Dunham) Date: Sat Feb 2 10:33:28 2008 Subject: Position window title offscreen In-Reply-To: <2BB4B361-FEAB-42DD-A6D9-9011438740E9@mac.com> References: <061A8F29-E985-4CE8-97CC-9EF3942A9577@mac.com> <2BB4B361-FEAB-42DD-A6D9-9011438740E9@mac.com> Message-ID: On 1 Feb 2008, at 23:38, Scott Stevenson wrote: >> I don't seem to be able to do the same in Cocoa. No matter what, >> the title bar remains entirely visible. (I've even tried getting >> the Carbon WindowRef and using Carbon calls to move the window -- >> I'm not sure this works at all.) > > Leopard has built-in full screen abilities: 10.3.9 doesn't. > > I'd seen this, but it requires making separate windows depending on whether you're in fullscreen or not. Carbon doesn't. David Dunham Voice/Fax: 206 783 7404 http://www.pensee.com/dunham/ Imagination is more important than knowledge. -- Albert Einstein From stephen at commongrnd.com Sun Feb 3 11:03:02 2008 From: stephen at commongrnd.com (Stephen Caine) Date: Sun Feb 3 11:03:06 2008 Subject: Programmer Message-ID: List members, I am posting a message to this list in hopes that interested parties may be helpful to us. If this is the wrong list or that some find this message inappropriate or offense, let me apologize up front. We are a small company in search of a part-time programmer to enhance and help maintain our software product. It is written in Objective C and Java and runs on Mac OS X. If you are interested, please e-mail me off-list. Thank you, Stephen Caine stephen@commongrnd.com From leeg at thaesofereode.info Mon Feb 4 09:01:22 2008 From: leeg at thaesofereode.info (leeg@thaesofereode.info) Date: Mon Feb 4 09:08:38 2008 Subject: Cocoa Bindings, custom view and repetition Message-ID: <48989.208.97.187.133.1202144482.squirrel@mail.thaesofereode.info> Hi all, I'm trying to understand how I'd design something like a WebObjects WORepetition in Cocoa Bindings. I've got an array and an array controller, and a "MyListView" which is bound to that array controller, as "[array controller].arrangedObjects.foo". Then for the @count objects in the array, I want @count "MyView" subviews, each bound to the "foo" key on the 0..n-1th object, more or less as "[array controller].objectAtIndex:i.foo". Is there a key on the NSArrayController which allows that? Note that I'm not trying to bind to the selection, instead I want to bind each object in the view to each object in the model. I _could_ bind the MyListView instance to "[array controller].arrangedObjects" then maintain the views manually, but I thought there must be a neater way of doing this. Thanks, Graham. From tjw at omnigroup.com Mon Feb 4 12:19:05 2008 From: tjw at omnigroup.com (Timothy J. Wood) Date: Mon Feb 4 12:19:19 2008 Subject: Omni seeking senior coder Message-ID: We finally have room to hire, now that we are in our nifty new building! -tim From dunham at mac.com Mon Feb 4 16:35:15 2008 From: dunham at mac.com (David Dunham) Date: Mon Feb 4 16:35:24 2008 Subject: OmniObjectMeter and Obj-C++ and/or Leopard In-Reply-To: <5FF41E78-9A8B-4A8A-AA6C-5BF0E01D0DB4@mac.com> References: <5FF41E78-9A8B-4A8A-AA6C-5BF0E01D0DB4@mac.com> Message-ID: On 1 Feb 2008, at 21:16, David Dunham wrote: > Last time I used OOM was under 10.4.x and with an Objective-C app. > Today I tried it under 10.5.1 and with Objective-C++ code. When I > clicked on an object, it didn't give the greatest stack trace (it > shows much of it being in OpenGL code -- my app does happen to use > it, but not where I was looking). And the object I was especially > interested in had a history where the refcount went negative. I tried under 10.4.11 (on a PowerPC, but I used an Intel successfully before). The Event list looks correct here (it was largely useless on my 10.5.2 machine). So has anyone had luck with OOM and Leopard? (I'm running 2.5 and it claims no update is available.) David Dunham Voice/Fax: 206 783 7404 http://www.pensee.com/dunham/ Imagination is more important than knowledge. -- Albert Einstein From dunham at mac.com Tue Feb 5 11:05:12 2008 From: dunham at mac.com (David Dunham) Date: Tue Feb 5 11:05:18 2008 Subject: Non-document app's NSWindow keeps getting retained Message-ID: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> I've got a Cocoa app that manually creates an NSWindow (it's an easier fit for a cross-platform engine). From my debugging, it appears that every time I click another app's window, the retain count on my NSWindow goes up by 2 (I have a windowDidResignKey delegate which prints the retain count). I don't make an NSWindowController. If I override -[NSApplication windows] and return an empty array, the regain count doesn't keep climbing. This seems kind of odd. The behavior is happening on 10.4.11 and 10.5.1. I suspect I must be doing something wrong, but can't figure out what. David Dunham Voice/Fax: 206 783 7404 http://www.pensee.com/dunham/ Imagination is more important than knowledge. -- Albert Einstein From dunham at mac.com Tue Feb 5 13:12:39 2008 From: dunham at mac.com (David Dunham) Date: Tue Feb 5 13:12:58 2008 Subject: Non-document app's NSWindow keeps getting retained In-Reply-To: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> References: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> Message-ID: On 5 Feb 2008, at 11:05, David Dunham wrote: > I've got a Cocoa app that manually creates an NSWindow (it's an > easier fit for a cross-platform engine). From my debugging, it > appears that every time I click another app's window, the retain > count on my NSWindow goes up by 2 (I have a windowDidResignKey > delegate which prints the retain count). I don't make an > NSWindowController. > > If I override -[NSApplication windows] and return an empty array, > the regain count doesn't keep climbing. This seems kind of odd. I tried making the window in a .nib, and get the same results. The windows retainCount keeps increasing. (Only time it doesn't is when the window loses key due to clicking on the Dock.) David Dunham Voice/Fax: 206 783 7404 http://www.pensee.com/dunham/ Imagination is more important than knowledge. -- Albert Einstein From sstevenson at mac.com Tue Feb 5 14:04:58 2008 From: sstevenson at mac.com (Scott Stevenson) Date: Tue Feb 5 14:05:08 2008 Subject: Non-document app's NSWindow keeps getting retained In-Reply-To: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> References: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> Message-ID: On Feb 5, 2008, at 11:05 AM, David Dunham wrote: > I've got a Cocoa app that manually creates an NSWindow (it's an > easier fit for a cross-platform engine). From my debugging, it > appears that every time I click another app's window, the retain > count on my NSWindow goes up by 2 (I have a windowDidResignKey > delegate which prints the retain count). I don't make an > NSWindowController. High retain counts are not necessarily a problem. Sometimes the frameworks may do things like that for reasons that are not obvious on the surface. Are you actually seeing memory leaks after your window has been closed and you have released it? If so, then you may want to file a bug. - Scott From joar at joar.com Tue Feb 5 15:28:44 2008 From: joar at joar.com (j o a r) Date: Tue Feb 5 15:28:49 2008 Subject: Non-document app's NSWindow keeps getting retained In-Reply-To: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> References: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> Message-ID: On Feb 5, 2008, at 11:05 AM, David Dunham wrote: > I've got a Cocoa app that manually creates an NSWindow (it's an > easier fit for a cross-platform engine). From my debugging, it > appears that every time I click another app's window, the retain > count on my NSWindow goes up by 2 (I have a windowDidResignKey > delegate which prints the retain count). I don't make an > NSWindowController. > > If I override -[NSApplication windows] and return an empty array, > the regain count doesn't keep climbing. This seems kind of odd. > > The behavior is happening on 10.4.11 and 10.5.1. > > I suspect I must be doing something wrong, but can't figure out what. I suspect that you started to peek at the retain count of this window for some specific reason? Why? Like Scott suggests, tracking retain count is typically not an effective way to troubleshoot memory management problems. On Leopard you can use the Object Allocations instrument in Instruments to track down where it is retained (On Tiger you can do the same thing with the ObjectAlloc standalone app). j o a r From dunham at mac.com Tue Feb 5 19:57:39 2008 From: dunham at mac.com (David Dunham) Date: Tue Feb 5 19:57:51 2008 Subject: Non-document app's NSWindow keeps getting retained In-Reply-To: References: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> Message-ID: <18A54239-6E6A-49E0-8373-87AA847D3F94@mac.com> On 5 Feb 2008, at 14:04, Scott Stevenson wrote: >> From my debugging, it appears that every time I click another app's >> window, the retain count on my NSWindow goes up by 2 (I have a >> windowDidResignKey delegate which prints the retain count). I don't >> make an NSWindowController. > > High retain counts are not necessarily a problem. Sometimes the > frameworks may do things like that for reasons that are not obvious > on the surface. True. Though continually increasing reference counts are almost always bad. > Are you actually seeing memory leaks after your window has been > closed and you have released it? If so, then you may want to file a > bug. Yes, though it's a little difficult to isolate into a bug report. I'm ending up solving the overall problem a slightly different way, so I probably never will get to the bottom of this... David Dunham Voice/Fax: 206 783 7404 http://www.pensee.com/dunham/ Imagination is more important than knowledge. -- Albert Einstein From clarkcox3 at gmail.com Tue Feb 5 21:27:37 2008 From: clarkcox3 at gmail.com (Clark Cox) Date: Tue Feb 5 21:27:40 2008 Subject: Non-document app's NSWindow keeps getting retained In-Reply-To: <18A54239-6E6A-49E0-8373-87AA847D3F94@mac.com> References: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> <18A54239-6E6A-49E0-8373-87AA847D3F94@mac.com> Message-ID: On Feb 5, 2008 7:57 PM, David Dunham wrote: > On 5 Feb 2008, at 14:04, Scott Stevenson wrote: > > >> From my debugging, it appears that every time I click another app's > >> window, the retain count on my NSWindow goes up by 2 (I have a > >> windowDidResignKey delegate which prints the retain count). I don't > >> make an NSWindowController. > > > > High retain counts are not necessarily a problem. Sometimes the > > frameworks may do things like that for reasons that are not obvious > > on the surface. > > True. Though continually increasing reference counts are almost always > bad. > > > Are you actually seeing memory leaks after your window has been > > closed and you have released it? If so, then you may want to file a > > bug. > > > Yes, though it's a little difficult to isolate into a bug report. > > I'm ending up solving the overall problem a slightly different way, so > I probably never will get to the bottom of this... One thing you could do to track this down: 1) Create a subclass of NSWindow and override -retain and -release: @interface MyWindow : NSWindow @end @implementation MyWindow -(id)retain { return [super retain]; } -(void)release { [super release]; @end 2) Debug your program. 3) In gdb, execute the following commands: b -[MyWindow retain] commands bt 10 cont end b -[MyWindow release] commands bt 10 cont end This will print a lot (potentially *quite* a lot) of stack traces, each of which is a call to retain or release. 4) Scan through the list of stacktraces and look for ones that don't match up (i.e. find the retains that don't have a corresponding release). There's a good chance that these unbalanced retains are in your code somewhere. -- Clark S. Cox III clarkcox3@gmail.com From dunham at mac.com Tue Feb 5 23:10:10 2008 From: dunham at mac.com (David Dunham) Date: Tue Feb 5 23:10:17 2008 Subject: Non-document app's NSWindow keeps getting retained In-Reply-To: References: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> <18A54239-6E6A-49E0-8373-87AA847D3F94@mac.com> Message-ID: On 5 Feb 2008, at 21:27, Clark Cox wrote: > 3) In gdb, execute the following commands: > > b -[MyWindow retain] > commands > bt 10 > cont > end That's the part I should learn... > 4) Scan through the list of stacktraces and look for ones that don't > match up (i.e. find the retains that don't have a corresponding > release). There's a good chance that these unbalanced retains are in > your code somewhere. What I actually did was use OmniObjectMeter, which (at least under Tiger) does much the same. And the unbalanced retains didn't seem to be in my code anywhere. I couldn't really figure out where they were, other than that (by count) it pointed to -[NSApplication windows]. And overriding that method could get rid of the climbing retain count. David Dunham Voice/Fax: 206 783 7404 http://www.pensee.com/dunham/ Imagination is more important than knowledge. -- Albert Einstein From sstevenson at mac.com Tue Feb 5 23:45:01 2008 From: sstevenson at mac.com (Scott Stevenson) Date: Tue Feb 5 23:45:07 2008 Subject: Non-document app's NSWindow keeps getting retained In-Reply-To: <18A54239-6E6A-49E0-8373-87AA847D3F94@mac.com> References: <039DFA56-D5B8-4933-82E8-380496D0D9A5@mac.com> <18A54239-6E6A-49E0-8373-87AA847D3F94@mac.com> Message-ID: On Feb 5, 2008, at 7:57 PM, David Dunham wrote: >> High retain counts are not necessarily a problem. Sometimes the >> frameworks may do things like that for reasons that are not obvious >> on the surface. > > True. Though continually increasing reference counts are almost > always bad. That's usually true for application code, but the frameworks have a different set of priorities to manage, so all bets are off. For what it's worth, it's still not clear to me from this thread of you're actually seeing leaks after the window is closed and you have released it, or if the retain counts just seem high. - Scott From gotow at stclairsoft.com Wed Feb 6 08:30:41 2008 From: gotow at stclairsoft.com (Jon Gotow) Date: Wed Feb 6 08:37:31 2008 Subject: How to tell when app will run in 64-bit mode? Message-ID: Is there a way to determine when an 'obese-binary' application will launch in 64-bit mode? I'm aware of Apple's CheckExecutableArchitecture sample code http://developer.apple.com/samplecode/CheckExecutableArchitecture/ but that only distinguishes between Intel and PPC. My attempts to extend the code to check the cputype flag for x86_64 have been unsuccessful, so I'm wondering if someone's aware of a better way (please?) - Jon -- ________________________________________________________________________ Jon Gotow gotow@stclairsoft.com St. Clair Software http://www.stclairsoft.com/ Fax (540)552-5898 ftp://ftp.stclairsoft.com/ From benski at winamp.com Wed Feb 6 09:01:35 2008 From: benski at winamp.com (Ben Allison) Date: Wed Feb 6 09:01:41 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: References: Message-ID: <47A9E7EF.2060609@winamp.com> #ifdef __LP64__ bool in_64bit = true; #else bool in_64bit = false; #endif More importantly, if you have code that differs between 32bit and 64bit, it is better to conditionally compile than it is to check during runtime. Remember that an 'obese-binary' is basically 4 copies of your program. -benski Jon Gotow wrote: > Is there a way to determine when an 'obese-binary' application will > launch in 64-bit mode? I'm aware of Apple's CheckExecutableArchitecture > sample code > > http://developer.apple.com/samplecode/CheckExecutableArchitecture/ > > but that only distinguishes between Intel and PPC. My attempts to > extend the code to check the cputype flag for x86_64 have been > unsuccessful, so I'm wondering if someone's aware of a better way (please?) > > - Jon > From benski at winamp.com Wed Feb 6 09:12:24 2008 From: benski at winamp.com (Ben Allison) Date: Wed Feb 6 09:12:30 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: References: Message-ID: <47A9EA78.6010505@winamp.com> You can use the cpusubtype member of the fat_arch struct in the Mach-O header to determine the CPU type for a particular section. man arch enumerates the CPU types; in particular, you would look for CPU_SUBTYPE_POWERPC64_ALL and CPU_SUBTYPE_X86_64_ALL. Jon Gotow wrote: > Is there a way to determine when an 'obese-binary' application will > launch in 64-bit mode? I'm aware of Apple's CheckExecutableArchitecture > sample code > > http://developer.apple.com/samplecode/CheckExecutableArchitecture/ > > but that only distinguishes between Intel and PPC. My attempts to > extend the code to check the cputype flag for x86_64 have been > unsuccessful, so I'm wondering if someone's aware of a better way (please?) > > - Jon > From gotow at stclairsoft.com Wed Feb 6 09:20:30 2008 From: gotow at stclairsoft.com (Jon Gotow) Date: Wed Feb 6 09:20:38 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: <47A9E7EF.2060609@winamp.com> References: <47A9E7EF.2060609@winamp.com> Message-ID: At 12:01 PM -0500 2/6/08, Ben Allison wrote: >#ifdef __LP64__ >bool in_64bit = true; >#else >bool in_64bit = false; >#endif Sorry - I should have been clearer. I know how to make my own obese binaries and check to see whether _I'm_ in 64-bit mode (I've been doing that for a while). The issue is that I want to look at another running application - or the application bundle on disk - and determine whether it will run in 64-bit mode or not. And to further clarify, I know how to look at the bundle on disk and determine which executable architectures exist in the obese binary, so I know whether an app is _capable_ of running 64-bit. The question is whether it will on the machine I'm currently running on. The crux of the matter is really that NXGetLocalArchInfo() returns a cputype of CPU_TYPE_X86 on both Core Duo and Core 2 Duo machines. Shouldn't it return CPU_TYPE_X86_64 on Core 2 Duo? Is this a bug? Is there another way to determine this? Dang - I just realized I haven't even tried calling Gestalt() for this - though that'd be an odd mix of API's... - Jon -- ________________________________________________________________________ Jon Gotow gotow@stclairsoft.com St. Clair Software http://www.stclairsoft.com/ Fax (540)552-5898 ftp://ftp.stclairsoft.com/ From gotow at stclairsoft.com Wed Feb 6 09:25:25 2008 From: gotow at stclairsoft.com (Jon Gotow) Date: Wed Feb 6 09:25:33 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: <47A9EA78.6010505@winamp.com> References: <47A9EA78.6010505@winamp.com> Message-ID: At 12:12 PM -0500 2/6/08, Ben Allison wrote: >You can use the cpusubtype member of the fat_arch struct in the >Mach-O header to determine the CPU type for a particular section. >man arch enumerates the CPU types; in particular, you would look for >CPU_SUBTYPE_POWERPC64_ALL and CPU_SUBTYPE_X86_64_ALL. Heh - I was busy answering your last post. NXGetLocalArchInfo() gives me a cputype of CPU_TYPE_X86 and a cputsubtype of CPU_SUBTYPE_486 on both my Core Duo and Core 2 Duo machines, so that doesn't appear to be any help. How does the loader determine which binary to run? It doesn't appear to be using NXFindBestFatArch() with the results of NXGetLocalArchInfo(), because when I do that, it always gives me the 32-bit section. - Jon -- ________________________________________________________________________ Jon Gotow gotow@stclairsoft.com St. Clair Software http://www.stclairsoft.com/ Fax (540)552-5898 ftp://ftp.stclairsoft.com/ From benski at winamp.com Wed Feb 6 09:40:20 2008 From: benski at winamp.com (Ben Allison) Date: Wed Feb 6 09:40:26 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: References: <47A9EA78.6010505@winamp.com> Message-ID: <47A9F104.7090101@winamp.com> Jon - Sorry about the confusion earlier. The docs for arch(1) suggest a rather convoluted methodology for determining which one to choose, including alteration via environment variables and plist files in known locations. That still doesn't help the fact that NXGetLocalArchInfo() is saying that you have a 486. You could at least make an educated guess that if you wrote a fat, universal binary, that another fat, universal binary will load with the same architecture as the one you're currently running on. If you intend to use this from some scripting environment or a plugin to another application that you don't have control over, you could write a simple commandline app which just returns a value representing CPU type (using #ifdef __ppc64__ kind of stuff). Jon Gotow wrote: > At 12:12 PM -0500 2/6/08, Ben Allison wrote: >> You can use the cpusubtype member of the fat_arch struct in the Mach-O >> header to determine the CPU type for a particular section. man arch >> enumerates the CPU types; in particular, you would look for >> CPU_SUBTYPE_POWERPC64_ALL and CPU_SUBTYPE_X86_64_ALL. > > Heh - I was busy answering your last post. NXGetLocalArchInfo() gives > me a cputype of CPU_TYPE_X86 and a cputsubtype of CPU_SUBTYPE_486 on > both my Core Duo and Core 2 Duo machines, so that doesn't appear to be > any help. > > How does the loader determine which binary to run? It doesn't appear to > be using NXFindBestFatArch() with the results of NXGetLocalArchInfo(), > because when I do that, it always gives me the 32-bit section. > > - Jon > From gotow at stclairsoft.com Wed Feb 6 09:48:52 2008 From: gotow at stclairsoft.com (Jon Gotow) Date: Wed Feb 6 09:49:09 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: <47A9F104.7090101@winamp.com> References: <47A9EA78.6010505@winamp.com> <47A9F104.7090101@winamp.com> Message-ID: At 12:40 PM -0500 2/6/08, Ben Allison wrote: >The docs for arch(1) suggest a rather convoluted methodology for >determining which one to choose, including alteration via >environment variables and plist files in known locations. > >That still doesn't help the fact that NXGetLocalArchInfo() is saying >that you have a 486. > >You could at least make an educated guess that if you wrote a fat, >universal binary, that another fat, universal binary will load with >the same architecture as the one you're currently running on. Yeah - it looks like that's the approach I need to take. Create a simple obese universal binary that will load in whatever mode dyld deigns to be 'best' with its convoluted logic - then I'll know which section of other apps it'll choose when they run. Ick. Thanks a bunch for the help! - Jon -- ________________________________________________________________________ Jon Gotow gotow@stclairsoft.com St. Clair Software http://www.stclairsoft.com/ Fax (540)552-5898 ftp://ftp.stclairsoft.com/ From benski at winamp.com Wed Feb 6 09:03:10 2008 From: benski at winamp.com (Ben Allison) Date: Wed Feb 6 11:29:39 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: <47A9E7EF.2060609@winamp.com> References: <47A9E7EF.2060609@winamp.com> Message-ID: <47A9E84E.2050507@winamp.com> Woops, sorry I misunderstood your question, ignore me :) You are looking for a way to tell if some arbitrary binary other than yours is going to run in 64bit mode. Ben Allison wrote: > #ifdef __LP64__ > bool in_64bit = true; > #else > bool in_64bit = false; > #endif > > More importantly, if you have code that differs between 32bit and 64bit, > it is better to conditionally compile than it is to check during > runtime. Remember that an 'obese-binary' is basically 4 copies of your > program. > > -benski > > Jon Gotow wrote: >> Is there a way to determine when an 'obese-binary' application will >> launch in 64-bit mode? I'm aware of Apple's >> CheckExecutableArchitecture sample code >> >> http://developer.apple.com/samplecode/CheckExecutableArchitecture/ >> >> but that only distinguishes between Intel and PPC. My attempts to >> extend the code to check the cputype flag for x86_64 have been >> unsuccessful, so I'm wondering if someone's aware of a better way >> (please?) >> >> - Jon >> > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From gotow at stclairsoft.com Wed Feb 6 11:41:09 2008 From: gotow at stclairsoft.com (Jon Gotow) Date: Wed Feb 6 11:41:30 2008 Subject: Solved: How to tell when app will run in 64-bit mode? In-Reply-To: References: <47A9E7EF.2060609@winamp.com> Message-ID: At 12:20 PM -0500 2/6/08, Jon Gotow wrote: >The crux of the matter is really that NXGetLocalArchInfo() returns a >cputype of CPU_TYPE_X86 on both Core Duo and Core 2 Duo machines. >Shouldn't it return CPU_TYPE_X86_64 on Core 2 Duo? As is often the case, discussing the problem with you smart folks here (thanks Ben :-) led me to reassess what I was doing. Given that NXGetLocalArchInfo() wasn't giving me what I thought it should, I looked for a different way to do the same thing. Digging through some darwin code, I found the "sysctl.proc_cputype" sysctl token. THAT gives the right results. On my Core 2 Duo, when I check a running process, I now get a cpu type of: cpu_type = (CPU_TYPE_X86 | CPU_ARCH_ABI64) if the process is running in 64 bit mode. - Jon For those that can benefit from it, here's the code, which uses the sysctlbyname_with_pid() function in Apple's Universal Binary Programming Guidelines: cpu_type_t GetProcessArchitecture(pid_t pid) { cpu_type_t cputype; size_t cpusz = sizeof(cputype); // Default values #if __i386__ cputype = CPU_TYPE_X86; #else cputype = CPU_TYPE_POWERPC; #endif if (sysctlbyname_with_pid("sysctl.proc_cputype", pid, &cputype, &cpusz, NULL, 0) == -1) { fprintf(stderr, "proc_cputype: sysctlbyname_with_pid failed:" "%s\n", strerror(errno)); } return cputype; } -- ________________________________________________________________________ Jon Gotow gotow@stclairsoft.com St. Clair Software http://www.stclairsoft.com/ Fax (540)552-5898 ftp://ftp.stclairsoft.com/ From gotow at stclairsoft.com Wed Feb 6 12:26:00 2008 From: gotow at stclairsoft.com (Jon Gotow) Date: Wed Feb 6 12:26:09 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: <47A9E7EF.2060609@winamp.com> References: <47A9E7EF.2060609@winamp.com> Message-ID: At 12:01 PM -0500 2/6/08, Ben Allison wrote: >#ifdef __LP64__ >bool in_64bit = true; >#else >bool in_64bit = false; >#endif > >More importantly, if you have code that differs between 32bit and >64bit, it is better to conditionally compile than it is to check >during runtime. Remember that an 'obese-binary' is basically 4 >copies of your program. Yes, of course - that was going to be my approach by writing a little obese helper app - different code would run depending on which architecture and ABI got loaded. But if you want to do something different to someone else's app depending on whether it's 64 bit or not, you have to go poke at it :-) - Jon -- ________________________________________________________________________ Jon Gotow gotow@stclairsoft.com St. Clair Software http://www.stclairsoft.com/ Fax (540)552-5898 ftp://ftp.stclairsoft.com/ From ddavidso at apple.com Wed Feb 6 12:34:34 2008 From: ddavidso at apple.com (Douglas Davidson) Date: Wed Feb 6 12:34:40 2008 Subject: Solved: How to tell when app will run in 64-bit mode? In-Reply-To: References: <47A9E7EF.2060609@winamp.com> Message-ID: On Feb 6, 2008, at 11:41 AM, Jon Gotow wrote: > Digging through some darwin code, I found the "sysctl.proc_cputype" > sysctl token. THAT gives the right results. On my Core 2 Duo, when > I check a running process, I now get a cpu type of: > > cpu_type = (CPU_TYPE_X86 | CPU_ARCH_ABI64) > > if the process is running in 64 bit mode. I believe there is also a "hw.cpu64bit_capable" sysctl if you want to determine specifically what the hardware can do. Douglas Davidson From mah at jump-ing.de Wed Feb 6 13:04:38 2008 From: mah at jump-ing.de (Markus Hitter) Date: Wed Feb 6 13:04:45 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: References: <47A9E7EF.2060609@winamp.com> Message-ID: Am 06.02.2008 um 21:26 schrieb Jon Gotow: > But if you want to do something different to someone else's app > depending on whether it's 64 bit or not, you have to go poke at it :-) Would the "file" tool help you? file /path/to/binary | grep x86 or similar. Markus - - - - - - - - - - - - - - - - - - - Dipl. Ing. Markus Hitter http://www.jump-ing.de/ From dunham at mac.com Wed Feb 6 16:00:14 2008 From: dunham at mac.com (David Dunham) Date: Wed Feb 6 16:00:20 2008 Subject: Making Window Menu in Interface Builder 3 In-Reply-To: <81C109CF-9CF3-421C-81C3-8D8A4C1FA8E4@pobox.com> References: <1BD9D91C-6ED9-4D0F-AD98-B4C7E2364A51@mac.com> <81C109CF-9CF3-421C-81C3-8D8A4C1FA8E4@pobox.com> Message-ID: On 6 Feb 2008, at 15:22, Jim Correia wrote: > In IB 2.x, there is a set of radio buttons for a menu (or root menu > items) in the inspector that lets you set if it is one of the > special menus. The window menu was one of these. Bingo! I added a Windows Menu Item from the Library, saved in 2.x format, and opened with the old Interface Builder. The menu I copied from a good application had the disabled "Windows menu" radio button set. The menu I made from the Library didn't have any radio buttons set. I don't know how to change this manually, at least in the old format. David Dunham Voice/Fax: 206 783 7404 http://www.pensee.com/dunham/ Imagination is more important than knowledge. -- Albert Einstein From helge.hess at skyrix.com Wed Feb 6 16:39:39 2008 From: helge.hess at skyrix.com (Helge Hess) Date: Wed Feb 6 17:11:25 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: References: <47A9E7EF.2060609@winamp.com> Message-ID: On 06.02.2008, at 22:04, Markus Hitter wrote: > Am 06.02.2008 um 21:26 schrieb Jon Gotow: >> But if you want to do something different to someone else's app >> depending on whether it's 64 bit or not, you have to go poke at >> it :-) > > Would the "file" tool help you? > file /path/to/binary | grep x86 > or similar. How would that help? It just contains the architectures included in the FAT, but not in which architecture the binary will get executed/ loaded by the system? Helge -- http://www.helgehess.eu/ From gotow at stclairsoft.com Thu Feb 7 07:17:37 2008 From: gotow at stclairsoft.com (Jon Gotow) Date: Thu Feb 7 07:18:38 2008 Subject: How to tell when app will run in 64-bit mode? In-Reply-To: References: <47A9E7EF.2060609@winamp.com> Message-ID: At 1:39 AM +0100 2/7/08, Helge Hess wrote: >> Would the "file" tool help you? >> file /path/to/binary | grep x86 >> or similar. > > >How would that help? It just contains the architectures included in >the FAT, but not in which architecture the binary will get >executed/loaded by the system? Correct. And trying to predict what the system will or should do with it, even if you do know the processor type, isn't a particularly great approach either. That's why using sysctl turned out to be the best approach in my case. - Jon -- ________________________________________________________________________ Jon Gotow gotow@stclairsoft.com St. Clair Software http://www.stclairsoft.com/ Fax (540)552-5898 ftp://ftp.stclairsoft.com/ From bob at apple.com Tue Feb 12 07:14:20 2008 From: bob at apple.com (Bob Frank) Date: Tue Feb 12 07:14:44 2008 Subject: MEETING: Chicago CocoaHeads / CAWUG - Eclipse & WO Message-ID: <8375E30D-5EDB-4B85-A1C4-FFB9B947E129@apple.com> IMPORTANT NOTES: Our meetings are permanently starting at ** 7:00 ** instead of 6:00 We have a new mailing list URL: http://groups.google.com/group/cawug Email Address: cawug@googlegroups.com You can email here to subscribe immediately: cawug-subscribe@googlegroups.com ---------------- Hi all, Just a quick reminder. The Chicago CocoaHeads / Chicago Cocoa and WebObjects User Group (CAWUG) is holding our next meeting tonight, Tuesday, February 12th, at 7:00 PM at the Apple Store on Michigan Ave. Agenda: - Introductions & Announcements - Bob on WebObjects development with WOLips & Eclipse - adjournment to O'Toole's When: Tuesday, February 12th, 7:00 PM Where: Apple Store Michigan Avenue 679 North Michigan Ave. (at the corner of Huron & Michigan Ave.) Chicago, IL 60611 http://maps.yahoo.com/maps_result? ed=gYbE5Op_0Tokf_p7h61dwjbWtjC2r1YehzWw&csz=60611 http://tinyurl.com/26z5nb (in case long URL gets cut) - Bob on WebObjects development with WOLips & Eclipse I will give a introduction to getting started with WebObjects development using WOLips with Eclipse and discus best practices and available resources out on the web. If you are still using Tiger and/ or XCode, the transition can seem huge, but for Java development Eclipse is one of the leading IDE's and has really taken off in the WebObjects developer community. - O'Tooles We will continue the discussion at our local watering hold Timothy O'Toole's at 622 Fairbanks (2 blocks east of the store). We also wish to thank the folks who run the theater space at the Apple store for letting us have our meetings there, and Jonathan 'Wolf' Rentzsch for hosting the new and revived CAWUG web site. Thanks all. Also, 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 and you can talk at a future meeting or would like a book to review we would welcome that too. Future meetings dates and tentative topics: 3/11/08, 4/8/08 March - TBD if the iPhone SDK is out, we hope to talk about it., if not topic TBD April - TBD CAWUG Resources Mail list: http://groups.google.com/group/cawug Google Site: http://groups.google.com/group/cawug Web Site: http://www.cawug.org/ RSS feed: http://www.cawug.org/rss.xml iCal: http://ical.mac.com/chicagobob/ Chicago-CocoaHeads-CAWUG (view on the web) iCal: webcal://ical.mac.com/chicagobob/Chicago-CocoaHeads-CAWUG.ics (subscribe to in iCal) Cocoa Heads web site: http://cocoaheads.org/us/ChicagoIllinois/index.html Hope to see you at the meeting. From morph at growler.net Tue Feb 12 15:07:57 2008 From: morph at growler.net (John Chandler) Date: Tue Feb 12 15:08:08 2008 Subject: How to provide an HFS+ interface Message-ID: I've seen a fair amount of doc on how to interface an app to an HFS+ filesystem, and _Mac OS Internals_ has what looks like a pretty thorough treatment of how HFS+ is implemented physically. What I haven't found is an interface definition, which would allow me to at least assess providing an HFS+ view of a collection of files which reside in a non-HFS+ environment. Can someone clue me in? -jmc From avi at drissman.com Tue Feb 12 15:13:10 2008 From: avi at drissman.com (Avi Drissman) Date: Tue Feb 12 15:13:15 2008 Subject: How to provide an HFS+ interface In-Reply-To: References: Message-ID: <2013cf3e0802121513s157278b7pcee569e6901c6e26@mail.gmail.com> I'm not sure I understand what you mean by "an HFS+ view". Do you mean a filesystem view for non-filesystem data? (MacFUSEis the answer I'd give for that.) Avi On Feb 12, 2008 6:07 PM, John Chandler wrote: > I've seen a fair amount of doc on how to interface an app to an HFS+ > filesystem, > and _Mac OS Internals_ has what looks like a pretty thorough > treatment of how > HFS+ is implemented physically. What I haven't found is an interface > definition, > which would allow me to at least assess providing an HFS+ view of a > collection > of files which reside in a non-HFS+ environment. > > Can someone clue me in? > > -jmc > > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From morph at growler.net Tue Feb 12 16:42:00 2008 From: morph at growler.net (John Chandler) Date: Tue Feb 12 16:42:12 2008 Subject: How to provide an HFS+ interface In-Reply-To: <2013cf3e0802121513s157278b7pcee569e6901c6e26@mail.gmail.com> References: <2013cf3e0802121513s157278b7pcee569e6901c6e26@mail.gmail.com> Message-ID: <48B58301-064B-4427-BDAB-1391D563446D@growler.net> MacFUSE might work, but I'm not sure. Let me refine the question. Time Machine requires some kind of repository. I believe I am correct that it is sufficient but may not be necessary that the repository be an HFS+ filesystem. So I guess the question becomes, does anyone know how the requirements of TM relate to what is provided by a MacFUSE filesystem, even in rough Venn-diagram terms? -jmc On Feb 12, 2008, at 6:13 PM, Avi Drissman wrote: > I'm not sure I understand what you mean by "an HFS+ view". Do you > mean a filesystem view for non-filesystem data? (MacFUSE is the > answer I'd give for that.) > > Avi > > On Feb 12, 2008 6:07 PM, John Chandler wrote: > I've seen a fair amount of doc on how to interface an app to > an HFS+ filesystem, and _Mac OS Internals_ has what looks > like a pretty thorough treatment of how HFS+ is implemented > physically. What I haven't found is an interface > definition, which would allow me to at least assess > providing an HFS+ view of a collection of files which reside > in a non-HFS+ environment. > > Can someone clue me in? > > -jmc > > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From ishan at gatewaytechnolabs.com Wed Feb 13 02:19:36 2008 From: ishan at gatewaytechnolabs.com (Ishan Mehta) Date: Wed Feb 13 02:41:18 2008 Subject: Help required for start up of a daemon on user login Message-ID: <005701c86e29$ef282840$3a07000a@gateway.local> Hi, I am new to this community and also new to MAC world. I am working on a project in which I am supposed to develop a daemon process. The daemon process - as such - does not have any problem, it is running fine. But, this daemon is not a system process, it is a user specific process. The daemon is targeted for a Mac workstation. As soon as a user logs in, the daemon should start. And, as soon as a user logs out, the daemon should exit. Based on my primitive Linux background, I tried to start the daemon in the /etc/profile, but it only starts when a user opens up a 'Terminal' window. And not as soon as the user logs in and he is just on the main GUI showing Finder. It should run for any user (all the users) who logs into the console. Also, the daemon is dependent on the environment variables (e.g. variables available using getenv() function). So, the Daemon process' owner should be the logged in user and not the system (UID should not be 0 when we do a ps -Al). I tried putting it in /Library/StartupItems. But this did not have access to the environment variables as the daemon was run with the system user's environment and not the logged in user's. Thanks for the comments in advance. Regards, Ishan. From finlay.dobbie at gmail.com Wed Feb 13 09:15:09 2008 From: finlay.dobbie at gmail.com (Finlay Dobbie) Date: Wed Feb 13 09:15:12 2008 Subject: Help required for start up of a daemon on user login In-Reply-To: <005701c86e29$ef282840$3a07000a@gateway.local> References: <005701c86e29$ef282840$3a07000a@gateway.local> Message-ID: On Feb 13, 2008 10:19 AM, Ishan Mehta wrote: > Hi, > I am new to this community and also new to MAC world. I am working on a project in which I am supposed to develop a daemon process. > > The daemon process - as such - does not have any problem, it is running fine. > > But, this daemon is not a system process, it is a user specific process. The daemon is targeted for a Mac workstation. As soon as a user logs in, the daemon should start. And, as soon as a user logs out, the daemon should exit. > > Based on my primitive Linux background, I tried to start the daemon in the /etc/profile, but it only starts when a user opens up a 'Terminal' window. And not as soon as the user logs in and he is just on the main GUI showing Finder. This area is very different from the world of Linux. See . On Leopard, you almost certainly want a LaunchAgent. -- Finlay From ishan at gatewaytechnolabs.com Wed Feb 13 21:16:36 2008 From: ishan at gatewaytechnolabs.com (Ishan Mehta) Date: Wed Feb 13 21:08:17 2008 Subject: Help required for start up of a daemon on user login References: <005701c86e29$ef282840$3a07000a@gateway.local> Message-ID: <008801c86ec8$c5e828a0$3a07000a@gateway.local> Hi Mike, David, Finlay, Thank you very much for the responses. Hi All, I have looked in to the LaunchAgents and LaunchDaemons yesterday. I have put my daemon's plist file in /Library/LaunchAgents (since my daemon should run per-user and it would be set by the administrator). In the plist file, I have put the RunAtLoad property with value 'true'. So, my daemon starts up automatically when a user logs in to the system. However, the daemon does not receive SIGTERM when the user logs out. I am now trying to catch all the signals in a for loop to check if any other kind of signal is sent by launchd or not. But, currently, my daemon does not shutdown when the user logs out. Is there any way to get notified when user logs out? The same workstation may have other users logging in at different times. The 'other' user when logs in, a new process of /sbin/launchd is launched for that user. It then tries to launch my daemon's second instance - but this is not possible as it must listen on a fixed port - which is already bound by the first instance. Also, it is necessary that the first instance of my daemon should terminate when the user logs out. In my process, I have also checked for the Parent Process ID (using getppid()). My daemon self terminates, if its parent process terminates (in which case the getppid will return 1. But since the launchd of the first user himself does not terminate, my daemon's parent process id always remains the same (that of its launchd) - and so it never terminates. Also, launchd and launchctl - if introduced in 10.4 (tiger) - I will still have to find a way to do the same in 10.3 (panther) as well (as my project requires the daemon to be run in panther, tiger and leopard - though the daemon itself should not have any changes - only the package would have some differences). Thanks in advance. Regards, Ishan. ----- Original Message ----- From: Finlay Dobbie To: Ishan Mehta Cc: macosx-dev@omnigroup.com Sent: Wednesday, February 13, 2008 22:45 Subject: Re: Help required for start up of a daemon on user login On Feb 13, 2008 10:19 AM, Ishan Mehta wrote: > Hi, > I am new to this community and also new to MAC world. I am working on a project in which I am supposed to develop a daemon process. > > The daemon process - as such - does not have any problem, it is running fine. > > But, this daemon is not a system process, it is a user specific process. The daemon is targeted for a Mac workstation. As soon as a user logs in, the daemon should start. And, as soon as a user logs out, the daemon should exit. > > Based on my primitive Linux background, I tried to start the daemon in the /etc/profile, but it only starts when a user opens up a 'Terminal' window. And not as soon as the user logs in and he is just on the main GUI showing Finder. This area is very different from the world of Linux. See . On Leopard, you almost certainly want a LaunchAgent. -- Finlay From hamish.allan at gold.ac.uk Thu Feb 14 15:15:28 2008 From: hamish.allan at gold.ac.uk (Hamish Allan) Date: Thu Feb 14 16:20:55 2008 Subject: Help required for start up of a daemon on user login In-Reply-To: <20080214200010.E6774C7098@forums.omnigroup.com> References: <20080214200010.E6774C7098@forums.omnigroup.com> Message-ID: <74451ED2-CA13-40B5-9205-7D574BBFB282@gold.ac.uk> On Thu, 14 Feb 2008 10:46:36 +0530, "Ishan Mehta" wrote: > The same workstation may have other users logging in at different > times. It's worse than you think -- Fast User Switching means that more than one user may be logged in at the same time (TN2083 mentions this). If you need to listen on a fixed port to perform a task relating to the console user, you probably need a daemon and an agent; the daemon to listen on the port and the agent to listen for messages from the daemon. Hamish From johnmusbach1 at gmail.com Thu Feb 14 17:43:24 2008 From: johnmusbach1 at gmail.com (John Musbach) Date: Thu Feb 14 17:43:28 2008 Subject: Looking for a developer as passionate as me (or who can otherwise do a quality job cloning) about Moire Message-ID: <17c8e29e0802141743l5ede2bb7nc9e4d165d0465a8a@mail.gmail.com> Hello, I am the person who has previously provided the funds to make a opensource clone of Moire (http://www.tucows.com/preview/204435) for Mac OS X possible via the Moire X project: http://sourceforge.net/projects/moirex . However, I felt then and continue to feel that the clone currently available does not provide the same feeling and quality as the original because the programmer had never before experienced Moire and was simply going from observation. I am looking for a developer who knows Moire and knows what makes it so intriguing a screensaver and I would like that programmer to then turn that knowledge into reality in the form of a Mac OS X (preferably Tiger and Leopard compatible, universal binary) screensaver with all features excluding the run on shutdown feature. I can pay via PayPal and credit card, please provide me with estimates if you feel you are qualified for this job. Thanks! :) -- Best Regards, John Musbach From ishan at gatewaytechnolabs.com Thu Feb 14 21:43:20 2008 From: ishan at gatewaytechnolabs.com (Ishan Mehta) Date: Thu Feb 14 21:34:40 2008 Subject: Help required for start up of a daemon on user login References: <20080214200010.E6774C7098@forums.omnigroup.com> <74451ED2-CA13-40B5-9205-7D574BBFB282@gold.ac.uk> Message-ID: <004b01c86f95$ac56d080$3a07000a@gateway.local> Hi Hamish & All, Thanks for the response. A daemon and an agent - both also will not solve the purpose. Because, if a system daemon listens on a single port and keeps on listening for the requests, and since launchd itself does not terminate for a logging out user - also it does not terminate my daemon - there would be multiple user specific daemons running on the system. I.e. System starts up. User x logs in - launchd starts - my daemon starts User x logs out - neither launchd nor my daemon shut down User y logs in - new launchd starts for this user - my daemon does not start because it is listening on the same port. - Suppose, we still start it by listening on a unique port (or may be using IPC / File communication can be used). And also have a separate system daemon which listens on a fixed port for the requests from outside. Upon receiving the request from the outside user, the request would not have any data to determine which 'user specific daemon' to communicate with. As such, the daemon does not require any kind of request. Upon connection from the client, it only sends back the response based on the current user's login and some other related properties from environment and the system. My daemon would function properly only if on logout some how it gets a notification to self terminate. Since launchd itself does not terminate, or send out the SIGTERM signal on logout, my daemon does not know of the fact that the user has logged out. Some interesting things also happened yesterday. I also tried the LogoutHook. The script attached to LogoutHook used to send the SIGTERM signal to my daemon (using killall). This worked Ok for once. But, when I logged in to the system with the same user, since the launchd for this user was already running at this time, it did not start my daemon on login (my daemon is having RunAtLoad set to true). My daemon would only start on startup of the launchd itself. When user logs out - launchd does not terminate, so when the same user logs in again, 'RunAtLoad' would not be considered. Another thing that I tried was putting "killall -u $USER launchd" in the LogoutHook script. This works a bit strange. Here are my findings: System starts User X logs in - launchd starts - my daemon starts User X logs out - launchd is killed - my daemon terminates (because I have checked internally for the parent process id - which would be launchd's) User Y logs in - launchd starts - *my daemon does not start* - don't know why User Y logs out - launchd is killed User X logs in - launchd starts - my daemon starts User X logs out - launchd is killed - my daemon terminates User Y logs in - launchd starts - my daemon starts User Y logs out - launchd is killed - my daemon terminates ..... Works perfectly ever after User root logs in - the system's launchd is used (already started) - my daemon starts User root logs out - killall tries to kill system's launchd - system hangs - If I will check for the $USER to be root before killing the launchd and then kill my daemon for root. My daemon wouldn't start the next time root logs in again. On first user switch - my daemon is not able to start. But consecutive user switches are able to start my daemon. Another scenario in which User X logs in and logs out and then again User X logs in - in this case, *my daemon is able to start* after all the logins. I also tried using the LoginHook. But, the problem in this case is - when my daemon starts - it is not able to get the user's environment variables (e.g. getenv("LOGNAME") / getenv("USER") wouldn't return proper values). This could be my mistake as well, I still have to check whether environment variable USER is available or not. Earlier I was trying with LOGNAME - which was only available in some cases, then I shifted to using USER env variable for more availability. Sorry to keep on troubling you all. Thanks in advance. Regards, Ishan. ----- Original Message ----- From: Hamish Allan To: Ishan Mehta Cc: macosx-dev@omnigroup.com Sent: Friday, February 15, 2008 04:45 Subject: Re: Help required for start up of a daemon on user login On Thu, 14 Feb 2008 10:46:36 +0530, "Ishan Mehta" wrote: The same workstation may have other users logging in at different times. It's worse than you think -- Fast User Switching means that more than one user may be logged in at the same time (TN2083 mentions this). If you need to listen on a fixed port to perform a task relating to the console user, you probably need a daemon and an agent; the daemon to listen on the port and the agent to listen for messages from the daemon. Hamish From cmhofman at gmail.com Fri Feb 15 04:31:26 2008 From: cmhofman at gmail.com (Christiaan Hofman) Date: Fri Feb 15 04:31:33 2008 Subject: Customizing PDFView print panel Message-ID: <6ADD1E22-A67E-4A50-95A9-43FBACB91D6E@physics.rutgers.edu> I'd like to print a PDF in a PDFView using the built-in print support like -[PDFView printWithInfo:autoRotate:]. However I would also like the user to choose the autoRitate setting in an accesory view for the print panel. But this method runs its own print job and panel, and I cannot find a method to access the print panel and/or print job. Somehow Preview on Leopard gets it done to insert its own accessory view for this in the print panel. So is there a way to do this while still using PDFView's built-in print support, or am I forced to do all the printing myself and create a custom print view (something I really want to avoid). thanks, Christiaan From shawnce at gmail.com Fri Feb 15 09:45:43 2008 From: shawnce at gmail.com (Shawn Erickson) Date: Fri Feb 15 09:45:47 2008 Subject: Help required for start up of a daemon on user login In-Reply-To: <004b01c86f95$ac56d080$3a07000a@gateway.local> References: <20080214200010.E6774C7098@forums.omnigroup.com> <74451ED2-CA13-40B5-9205-7D574BBFB282@gold.ac.uk> <004b01c86f95$ac56d080$3a07000a@gateway.local> Message-ID: On Thu, Feb 14, 2008 at 9:43 PM, Ishan Mehta wrote: > Hi Hamish & All, > Thanks for the response. > > A daemon and an agent - both also will not solve the purpose. > > Because, if a system daemon listens on a single port and keeps on listening for the requests, and since launchd itself does not terminate for a logging out user - also it does not terminate my daemon - there would be multiple user specific daemons running on the system. You need to inform Launchd what life cycle you want for your launch agent. It sounds like you want to limit it to "Aqua" sessions so that your agent only lives as long as the aqua session is active. -Shawn From hamish.allan at gold.ac.uk Fri Feb 15 12:52:14 2008 From: hamish.allan at gold.ac.uk (Hamish Allan) Date: Fri Feb 15 12:54:21 2008 Subject: Help required for start up of a daemon on user login In-Reply-To: <004b01c86f95$ac56d080$3a07000a@gateway.local> References: <20080214200010.E6774C7098@forums.omnigroup.com> <74451ED2-CA13-40B5-9205-7D574BBFB282@gold.ac.uk> <004b01c86f95$ac56d080$3a07000a@gateway.local> Message-ID: <7EB471F1-BB23-4F37-9CD0-1634B6BA31B8@gold.ac.uk> Hi Ishan, On 15 Feb 2008, at 05:43, Ishan Mehta wrote: > A daemon and an agent - both also will not solve the purpose. > > Because, if a system daemon listens on a single port and keeps on > listening for the requests, and since launchd itself does not > terminate for a logging out user - also it does not terminate my > daemon - there would be multiple user specific daemons running on > the system. Firstly, let's stick to Mac OS X terminology. A daemon is a background process not tied to any particular user (could be running as root, nobody, _www, etc.); an agent is a background process running on behalf of a particular user. Your main problem is that your agent doesn't terminate. Maybe you're running 10.4, in which launchd didn't put everything in the right bootstrap namespace. Anyway, if you need to support 10.3 you'll need to use startup and login items on 10.3 and you can do so on 10.4 too (on 10.5, launchd largely works properly). > - Suppose, we still start it by listening on a unique port (or may > be using IPC / File communication can be used). And also have a > separate system daemon which listens on a fixed port for the > requests from outside. Yes. > Upon receiving the request from the outside user, the request would > not have any data to determine which 'user specific daemon' to > communicate with. Read TN2083 again, paying particular attention to "bootstrap namespaces". It's worth reading TN2083 several times :) > As such, the daemon does not require any kind of request. Upon > connection from the client, it only sends back the response based on > the current user's login and some other related properties from > environment and the system. I'm not sure I understand what you mean by this. > My daemon would function properly only if on logout some how it gets > a notification to self terminate. Since launchd itself does not > terminate, or send out the SIGTERM signal on logout, my daemon does > not know of the fact that the user has logged out. There are other ways, e.g. if your agent has a connection to the window server, it should receive a kAEQuitApplication Apple Event. > Some interesting things also happened yesterday. > > I also tried the LogoutHook. The script attached to LogoutHook used > to send the SIGTERM signal to my daemon (using killall). This > worked Ok for once. But, when I logged in to the system with the > same user, since the launchd for this user was already running at > this time, it did not start my daemon on login (my daemon is having > RunAtLoad set to true). My daemon would only start on startup of > the launchd itself. When user logs out - launchd does not > terminate, so when the same user logs in again, 'RunAtLoad' would > not be considered. As Shawn mentioned, your agent should be running in the Aqua context. It's probably running in the "Background" context (per-user, not per- login). > Another thing that I tried was putting "killall -u $USER launchd" in > the LogoutHook script. This works a bit strange. You shouldn't kill launchd in the normal course of things. See if changing the context works, and see how you get on with login items pre-Leopard. > Sorry to keep on troubling you all. Not at all. Best wishes, Hamish From tjones at acworld.com Sat Feb 16 13:07:15 2008 From: tjones at acworld.com (Tom Jones) Date: Sat Feb 16 13:31:56 2008 Subject: Obj-C and Background/Daemon Application Question Message-ID: <6D73C794-C1CB-4E22-AAAC-6B07050C82C8@acworld.com> Hello, I'm looking for more information on how to create a Background/Daemon application. I've been learning Obj-C and I really like it. I have bought what books I can on the subject but none of them really cover this subject. I have written a few tools for myself but now I want to step it up and develop a Background/Daemon tool which should run when the system boot til it shuts down. I have looked at Apple's dev site and at the examples but it feels like this is a subject area that they do not cover. So any info sites, example code or what every that could help would be great. Thanks, tom From edward.patel at memention.com Sat Feb 16 13:40:52 2008 From: edward.patel at memention.com (Edward Patel) Date: Sat Feb 16 13:51:15 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: <6D73C794-C1CB-4E22-AAAC-6B07050C82C8@acworld.com> References: <6D73C794-C1CB-4E22-AAAC-6B07050C82C8@acworld.com> Message-ID: These might help http://developer.apple.com/macosx/launchd.html http://www.codepoetry.net/products/launchdeditor /Edward On 16 feb 2008, at 22.07, Tom Jones wrote: > Hello, > I'm looking for more information on how to create a Background/ > Daemon application. I've been learning Obj-C and I really like it. I > have bought what books I can on the subject but none of them really > cover this subject. > > I have written a few tools for myself but now I want to step it up > and develop a Background/Daemon tool which should run when the > system boot til it shuts down. > > I have looked at Apple's dev site and at the examples but it feels > like this is a subject area that they do not cover. So any info > sites, example code or what every that could help would be great. > > Thanks, > tom > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From sstevenson at mac.com Sat Feb 16 14:36:22 2008 From: sstevenson at mac.com (Scott Stevenson) Date: Sat Feb 16 14:36:26 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: <6D73C794-C1CB-4E22-AAAC-6B07050C82C8@acworld.com> References: <6D73C794-C1CB-4E22-AAAC-6B07050C82C8@acworld.com> Message-ID: <1AB55A17-875F-4F8B-93DE-390E74575168@mac.com> On Feb 16, 2008, at 1:07 PM, Tom Jones wrote: > I'm looking for more information on how to create a Background/ > Daemon application. I've been learning Obj-C and I really like it. I > have bought what books I can on the subject but none of them really > cover this subject. "Advanced Mac OS X Programming" does, though I'm not sure how much things have changed in Leopard for the launchd stuff: http://bignerdranch.com/products.shtml - Scott From j.p.dann at gmail.com Sat Feb 16 14:54:02 2008 From: j.p.dann at gmail.com (Jonathan Dann) Date: Sat Feb 16 14:54:09 2008 Subject: Is NSDocument's Saving Message Flow Threaded? Message-ID: Hi Guys, I've overridden - canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: to display a custom NSAlert if any of the text files that my NSDocument subclass manages are not saved. The problem is, if the user tries to close the window and very quickly presses return to select the default response of "Save All Files" the app crashes when [self close] is called. If they wait a second or two then no crash happens. The "saveAllFiles" method writes the text files to the disk and then saves the NSDocument model, which holds all the file references. From my logs I can see that the [self close] causes the document to be dealloc'd before -dataOfType:error: can be called. With NSZombie enabled I get the following log output 2008-02-16 16:57:25.803 Scribbler[697:10b] *** -[ESDocument _saveDocumentWithDelegate:didSaveSelector:contextInfo:]: message sent to deallocated instance 0xea625c0 Where the instance 0xea625c0 is the ESDocument that is being saved, then closed. Could this be a threading issue with the way NSDocument saves itself, even though I haven't put any threaded code in my app at all? I ask this as the time interval between hitting command-W and return seems to matter. Here's the relevant code from my NSDocument: - (IBAction)saveAllFiles:(id)sender; { NSLog(@"%p %s",self,__func__); for (ESNode *node in self.projectFiles) { if (node.isEdited) { NSError *writeError; if (![node writeBodyToFileError:&writeError]) { NSLog(@"%p %s %@",self,__func__,writeError); [self presentError:writeError]; } } } [self saveDocument:nil]; } - (void)unsavedFilesAlertDidEnd:(NSAlert *)alert returnCode: (NSUInteger)returnCode contextInfo:(void *)contextInfo; { [alert release]; if (returnCode == NSAlertSecondButtonReturn) return; if (returnCode == NSAlertFirstButtonReturn) { [self saveAllFiles:nil]; [self close]; // THIS IS THE CULPRIT } if (returnCode == NSAlertThirdButtonReturn) [self close]; // close without saving } - (void)canCloseDocumentWithDelegate:(id)delegate shouldCloseSelector: (SEL)shouldCloseSelector contextInfo:(void *)contextInfo; { NSLog(@"%p %s",self,__func__); BOOL canClose = YES; for (ESNode *node in self.projectFiles) { if (node.isEdited) { canClose = NO; break; } } if (!canClose) { NSAlert *alert = [[NSAlert alloc] init]; // released in didEndSelector [alert setMessageText:NSLocalizedString(@"ThereAreUnsavedFiles",@"")]; [alert setInformativeText:NSLocalizedString (@"ThereAreUnsavedFileExplanation",@"")]; [alert addButtonWithTitle:NSLocalizedString(@"SaveAll",@"")]; [alert addButtonWithTitle:NSLocalizedString(@"Cancel",@"")]; [alert addButtonWithTitle:NSLocalizedString(@"DontSave",@"")]; [alert beginSheetModalForWindow:[self windowForSheet] modalDelegate:self didEndSelector :@selector(unsavedFilesAlertDidEnd:returnCode:contextInfo:) contextInfo:nil]; } objc_msgSend(delegate,shouldCloseSelector,self,canClose,contextInfo); } Thanks in advance, this has got be stumped. Jon From sstevenson at mac.com Sat Feb 16 17:20:45 2008 From: sstevenson at mac.com (Scott Stevenson) Date: Sat Feb 16 17:20:49 2008 Subject: Is NSDocument's Saving Message Flow Threaded? In-Reply-To: References: Message-ID: On Feb 16, 2008, at 2:54 PM, Jonathan Dann wrote: > Could this be a threading issue with the way NSDocument saves > itself, even though I haven't put any threaded code in my app at > all? I ask this as the time interval between hitting command-W and > return seems to matter. > > Here's the relevant code from my NSDocument: > > - (IBAction)saveAllFiles:(id)sender; > { > .... > [self saveDocument:nil]; > } One wild guess is that the "guts" of -saveDocument: actually happens in a delayed manner. Meaning it would get called after the end of the current user event. Some of the action methods tend to work this way. This seems to be reinforced by the error message you're getting. If you can, you should try to just let NSDocument do the "unsaved documents" thing itself, since it has built-in functionality for that. If you need to do it yourself for some reason, you might have more luck with calling -writeToURL:ofType:error: on the document instead of -saveDocument:, though I'm not sure how the details of that would fit together. - Scott From j.p.dann at gmail.com Sun Feb 17 05:02:16 2008 From: j.p.dann at gmail.com (Jonathan Dann) Date: Sun Feb 17 05:02:24 2008 Subject: Is NSDocument's Saving Message Flow Threaded? In-Reply-To: References: Message-ID: [forgot to post to the list] On 17 Feb 2008, at 01:20, Scott Stevenson wrote: > One wild guess is that the "guts" of -saveDocument: actually happens > in a delayed manner. Meaning it would get called after the end of > the current user event. Some of the action methods tend to work this > way. This seems to be reinforced by the error message you're getting. You're right, a quick log above and below this show that it get called and then my -dataOfType:error: gets called some time after. So does it delay by spawning a new thread then? > If you can, you should try to just let NSDocument do the "unsaved > documents" thing itself, since it has built-in functionality for > that. If you need to do it yourself for some reason, you might have > more luck with calling -writeToURL:ofType:error: on the document > instead of -saveDocument:, though I'm not sure how the details of > that would fit together. The problem is I have to alter the alter dialog and get all the text file to write their own contents to the disk. I have an app that works a little like XCode, so the NSDocument itself just holds references (and the structure) of the "project" the user has made. The "body" of each text file is read and written using NSString's writing methods. The default alert that show up relates to the NSDocument itself and I need it to say that there are "unsaved files in the project", its really the way the user will be thinking about using the app. They will be thinking that each of the references in the source list is an actual file, and that they can be opening a bunch of projects, each with different content, much like how we don't think about saving the .xcodeproj file itself. Just tried -writeToURL:ofType:error: and it doesn't delay its call! Thanks for the fix. So do many other actions work in a delayed manner, and is it documented? Would I have missed this somewhere? Thanks again for your time Scott, Jon From Hoff at HoffmanLabs.Com Sun Feb 17 13:11:22 2008 From: Hoff at HoffmanLabs.Com (Stephen Hoffman) Date: Sun Feb 17 13:18:08 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: <20080217200006.43EE6CF044@forums.omnigroup.com> References: <20080217200006.43EE6CF044@forums.omnigroup.com> Message-ID: <47B8A2FA.50005@HoffmanLabs.Com> > From: Tom Jones > > I'm looking for more information on how to create a Background/Daemon > application. I've been learning Obj-C and I really like it. I have > bought what books I can on the subject but none of them really cover > this subject. > The following Daemons and Agents technical note might provide you with a starting point: http://developer.apple.com/technotes/tn2005/tn2083.html Objective C and Cocoa stuff usually doesn't run as an agent; Cocoa isn't considered appropriate. You can see Cocoa used to build a UI tool to control the daemon or agent. From slackmoehrle at gmail.com Sun Feb 17 11:18:58 2008 From: slackmoehrle at gmail.com (J. Todd Slack) Date: Sun Feb 17 13:42:29 2008 Subject: Creating an Itunes Plug-n...Visual or none visual? Message-ID: <366B1491-B2E6-4769-A382-B78AAC3AB509@jasonandannette.us> Hello All, OS X 10.5.2 iTunes 7.6 I need to create a non visual iTunes plugin that works with ring tones and I don't see in Xcode where to setup the project. Or should I be using the visualizer? Also, is there an SDK, I don't see anything but a "visual iTunes SDK" on developer.apple.com. Does anyone have an example? Does anyone have an article on creating iTunes and iPhoto Plugins? Thanks! -Jason From dunham at mac.com Sun Feb 17 13:50:06 2008 From: dunham at mac.com (David Dunham) Date: Sun Feb 17 13:50:13 2008 Subject: Is NSDocument's Saving Message Flow Threaded? In-Reply-To: References: Message-ID: On 17 Feb 2008, at 05:02, Jonathan Dann wrote: >> One wild guess is that the "guts" of -saveDocument: actually >> happens in a delayed manner. Meaning it would get called after the >> end of the current user event. Some of the action methods tend to >> work this way. This seems to be reinforced by the error message >> you're getting. > > You're right, a quick log above and below this show that it get > called and then my -dataOfType:error: gets called some time after. > So does it delay by spawning a new thread then? Doubtful. That could introduce all sorts of threading issues, and the delayed action is probably intended to let things settle down (i.e. have all processing completed) before it happens. It's probably just performSelector:withObject:afterDelay:. > So do many other actions work in a delayed manner, and is it > documented? Would I have missed this somewhere? FWIW, this is likely an implementation detail that you can't rely on. I know there were some things that changed between Tiger and Leopard, with respect to being delayed or not (e.g. updateChangeCount:). David Dunham A Sharp, LLC Voice/Fax: 206 783 7404 http://a-sharp.com Efficiency is intelligent laziness. From vip at avatar.com.au Sun Feb 17 14:02:55 2008 From: vip at avatar.com.au (DavidW) Date: Sun Feb 17 15:04:58 2008 Subject: any update on 10.5.2 update? Message-ID: Hello all, This email is addresses to anyone on and intel MacBook Pro whose upgrade from 10.5 to 10.5.1 was a disaster, as mine was, requiring me to completely rebuild from the 10.5 DVD Can anyone who had that prob. report success or otherwise with the new 10.5.2 upgrade? I'm simply not prepared to try until I hear of some successes. Also, is it normal behaviour for an apple upgrade to overwrite /usr/ local? thanks for your FB, David ________________________________________________ David Worrall. - Experimental Polymedia: www.avatar.com.au - Education for Financial Independence: www.mindthemarkets.com.au Australian research affiliations: - Capital Markets Cooperative Research Centre: www.cmcrc.com - Sonic Communications Research Group: creative.canberra.edu.au/scrg From pelorus at mac.com Sun Feb 17 15:10:36 2008 From: pelorus at mac.com (Matt Johnston) Date: Sun Feb 17 15:10:45 2008 Subject: any update on 10.5.2 update? In-Reply-To: References: Message-ID: <91766D6D-7FCC-4FDF-90EB-E88D9BE7CA22@mac.com> On 17 Feb 2008, at 22:02, DavidW wrote: > Can anyone who had that prob. report success or otherwise with the > new 10.5.2 upgrade? I'm simply not prepared to try until I hear of > some successes. 4 Intel Macs at home and about 10 at work all fine. Updates SOMETIMES cause problems. Usually the issues are present beforehand and just tickled by the update. It's been a while since I've had to do a COMPLETE rebuild on any machines. From finlay.dobbie at gmail.com Mon Feb 18 01:12:05 2008 From: finlay.dobbie at gmail.com (Finlay Dobbie) Date: Mon Feb 18 01:12:10 2008 Subject: Help required for start up of a daemon on user login In-Reply-To: <004b01c86f95$ac56d080$3a07000a@gateway.local> References: <20080214200010.E6774C7098@forums.omnigroup.com> <74451ED2-CA13-40B5-9205-7D574BBFB282@gold.ac.uk> <004b01c86f95$ac56d080$3a07000a@gateway.local> Message-ID: On Feb 15, 2008 5:43 AM, Ishan Mehta wrote: > Hi Hamish & All, > Thanks for the response. > > A daemon and an agent - both also will not solve the purpose. > > Because, if a system daemon listens on a single port and keeps on listening for the requests, and since launchd itself does not terminate for a logging out user - also it does not terminate my daemon - there would be multiple user specific daemons running on the system. No, there would be one daemon and multiple user-specific agents. System starts, your daemon starts and starts listening on port. User logs in, agent starts (as a login item in pre-Leopard) and starts listening for events from daemon. User logs out, agent quits. Of course you'd still need to decide what you're going to do in the case of multiple concurrent user sessions. -- Finlay From finlay.dobbie at gmail.com Mon Feb 18 01:18:31 2008 From: finlay.dobbie at gmail.com (Finlay Dobbie) Date: Mon Feb 18 01:18:33 2008 Subject: Creating an Itunes Plug-n...Visual or none visual? In-Reply-To: <366B1491-B2E6-4769-A382-B78AAC3AB509@jasonandannette.us> References: <366B1491-B2E6-4769-A382-B78AAC3AB509@jasonandannette.us> Message-ID: On Feb 17, 2008 7:18 PM, J. Todd Slack wrote: > I need to create a non visual iTunes plugin that works with ring tones and I > don't see in Xcode where > to setup the project. Or should I be using the visualizer? Non-visualiser iTunes plug-ins are not supported. > Also, is there an SDK, I don't see anything but a "visual iTunes SDK" on > developer.apple.com. > > Does anyone have an example? Nope. Apple doesn't want third parties interfacing with iTunes in this way. I believe there was at one point a "device" SDK for letting iTunes talk to third-party MP3 players, but it was not publicly available (and IIRC someone created an interface for downloading from other people's iTunes shared libraries over the network using it, resulting in legal sabre-rattling on Apple's part). > Does anyone have an article on creating iTunes and iPhoto Plugins? They're not supported, so unless you want to get involved with some lowish-level hackery I'd advise steering clear. -- Finlay From psarge at gmail.com Mon Feb 18 02:30:55 2008 From: psarge at gmail.com (Paul Sargent) Date: Mon Feb 18 02:31:03 2008 Subject: any update on 10.5.2 update? In-Reply-To: References: Message-ID: On 17 Feb 2008, at 22:02, DavidW wrote: > Also, is it normal behaviour for an apple upgrade to overwrite /usr/ > local? Shouldn't happen. /usr/local/ is the domain of the local administrator. If /usr/local/ stuff isn't running after an update, check your environment. Something might change there. From cmhofman at gmail.com Mon Feb 18 02:50:11 2008 From: cmhofman at gmail.com (Christiaan Hofman) Date: Mon Feb 18 02:50:18 2008 Subject: any update on 10.5.2 update? In-Reply-To: References: Message-ID: On 17 Feb 2008, at 11:02 PM, DavidW wrote: > Hello all, > > This email is addresses to anyone on and intel MacBook Pro whose > upgrade from 10.5 to 10.5.1 was a disaster, as mine was, requiring > me to completely rebuild from the 10.5 DVD > > Can anyone who had that prob. report success or otherwise with the > new 10.5.2 upgrade? I'm simply not prepared to try until I hear of > some successes. > > Also, is it normal behaviour for an apple upgrade to overwrite /usr/ > local? > > thanks for your FB, > > David It was removed on my machine after I first installed Leopard using archive + install. I think that's normal. though I'm not really sure about that, as e.g. my /sw directory from Fink was restored. For minor version updates like 10.5.2 this should definitely not happen. Christiaan From ishan at gatewaytechnolabs.com Mon Feb 18 03:16:10 2008 From: ishan at gatewaytechnolabs.com (Ishan Mehta) Date: Mon Feb 18 03:10:20 2008 Subject: Help required for start up of a daemon on user login References: <20080214200010.E6774C7098@forums.omnigroup.com> <74451ED2-CA13-40B5-9205-7D574BBFB282@gold.ac.uk> <004b01c86f95$ac56d080$3a07000a@gateway.local> <7EB471F1-BB23-4F37-9CD0-1634B6BA31B8@gold.ac.uk> Message-ID: <015801c87220$18743cd0$3a07000a@gateway.local> Hi Hamish, Shawn & Finlay, Thanks for the responses. Yes, Shawn. This could be the problem. I am testing it on 10.4 and it does not support "LimitLoadToSessionType" parameter yet. So, this would be useful only in 10.5. But, I have gone thru the Tech Note tn2083. The startup items that I had tried earlier would be the only solution in 10.3 and 10.4 (probably this would also work for me in 10.5 - but launchd would be better). As I had posted earlier, that I do not get the required environment variables when I put my agent as LoginHook. I checked that the LoginHook does get the username as a PROGRAM ARGUMENT - and not in the env (i.e. 'USER' or 'LOGNAME' env vars are not available). The process' EUID also remains 0 (root). But, I have changed my agent slightly by accepting the username as the program argument and only searching for the env variable if that argument is not passed - and all seems to work fine for me. Earlier, I was just executing my agent without any parameters. Now, I am passing $* to my agent from the LoginHook shell script, so I am getting the username in argv[1]. In the LogoutHook, the script simply sends the SIGTERM to my agent - and I have handled it in my agent to self shutdown gracefully. So, I think - this option would work for me. Thank you all for the support. Hamish, some points/clarifications have also been put in your original mail below. Also, Hamish & Finlay, thanks for pointing out the 'multiple console users' / 'Fast user switching' being present. Due to the odd requirement of the agent, I think this can be ignored. Have confirmed that it would be a single user workstation (single user at a time). Once the first user logs out of the console (internally the agent would terminate) and then only another user can use the same machine (internally, the agent would run again for this same/different user). Effectively, a single user being logged in on the console at a time. Thanks. Will put something again here, if I find some difficulty in 10.5. But, mostly - it should work fine with the proper session type. Best Regards, Ishan. ----- Original Message ----- From: Hamish Allan To: Ishan Mehta Cc: macosx-dev@omnigroup.com Sent: Saturday, February 16, 2008 02:22 Subject: Re: Help required for start up of a daemon on user login Hi Ishan, On 15 Feb 2008, at 05:43, Ishan Mehta wrote: > A daemon and an agent - both also will not solve the purpose. > > Because, if a system daemon listens on a single port and keeps on > listening for the requests, and since launchd itself does not > terminate for a logging out user - also it does not terminate my > daemon - there would be multiple user specific daemons running on > the system. Firstly, let's stick to Mac OS X terminology. A daemon is a background process not tied to any particular user (could be running as root, nobody, _www, etc.); an agent is a background process running on behalf of a particular user. Your main problem is that your agent doesn't terminate. Maybe you're running 10.4, in which launchd didn't put everything in the right bootstrap namespace. Anyway, if you need to support 10.3 you'll need to use startup and login items on 10.3 and you can do so on 10.4 too (on 10.5, launchd largely works properly). [Ishan: Sorry. Yes, mine would be considered an Agent & not a Daemon. The termination in 10.4 has been handled using the LogoutHook (& startup is also being done using LoginHook) on com.apple.loginwindow domain. I have yet to check if the same would work in 10.5 as well. Otherwise, with the LimitLoadToSessionType property set in the plist (which is only there in 10.5), my agent should terminate properly upon Logout.] > - Suppose, we still start it by listening on a unique port (or may > be using IPC / File communication can be used). And also have a > separate system daemon which listens on a fixed port for the > requests from outside. Yes. > Upon receiving the request from the outside user, the request would > not have any data to determine which 'user specific daemon' to > communicate with. Read TN2083 again, paying particular attention to "bootstrap namespaces". It's worth reading TN2083 several times :) [Ishan: Thanks. TN2083 has helped a lot :)] > As such, the daemon does not require any kind of request. Upon > connection from the client, it only sends back the response based on > the current user's login and some other related properties from > environment and the system. I'm not sure I understand what you mean by this. [Ishan: Sorry for being a bit confusing statement. Actually, I just wanted to put forward the problem of my agent being run multiple times for each user. And also having a controlling Daemon that is listening on a fixed port - and forwarding the request to one of the agents. As such, the request would be blank. I.e. simply a "\r\n" E.g. telnet xx.xx.xx.xx yyyy I.e., in the Daemon, I would not be able to know based on the request - that the request should be forwarded to agent of which particular user. Hence, the idea of having a single Daemon and multiple agents would not work - since the daemon - upon receiving the request - would not be able to determine - which agent the request needs to be forwarded to.] > My daemon would function properly only if on logout some how it gets > a notification to self terminate. Since launchd itself does not > terminate, or send out the SIGTERM signal on logout, my daemon does > not know of the fact that the user has logged out. There are other ways, e.g. if your agent has a connection to the window server, it should receive a kAEQuitApplication Apple Event. [Ishan: This could be an option. How ever, I have tried not to use ANY external events/frameworks/etc anything in my agent's code. The same Agent is also working in the Linux environment). So, the functionality remains the same for this agent - only the start/stop control needs to be given to the OS (or should be OS specific). And of course the compiled binary :)] > Some interesting things also happened yesterday. > > I also tried the LogoutHook. The script attached to LogoutHook used > to send the SIGTERM signal to my daemon (using killall). This > worked Ok for once. But, when I logged in to the system with the > same user, since the launchd for this user was already running at > this time, it did not start my daemon on login (my daemon is having > RunAtLoad set to true). My daemon would only start on startup of > the launchd itself. When user logs out - launchd does not > terminate, so when the same user logs in again, 'RunAtLoad' would > not be considered. As Shawn mentioned, your agent should be running in the Aqua context. It's probably running in the "Background" context (per-user, not per- login). [Ishan: Yes, Thank you for pointing it out. This would definitely work in 10.5. But, I think for 10.3 and 10.4 - LoginHook and LogoutHook is the only option.] > Another thing that I tried was putting "killall -u $USER launchd" in > the LogoutHook script. This works a bit strange. You shouldn't kill launchd in the normal course of things. See if changing the context works, and see how you get on with login items pre-Leopard. [Ishan: Yep :) I also thought so - but it seemed to be working. And I also thought that launchd itself not being terminated upon Logout was a mis-behaviour in itself. So, I killed it :) But, in 10.5, setting the property LimitLoadToSessionType to 'Aqua' should solve the problem.] > Sorry to keep on troubling you all. Not at all. [Ishan: Thanks :)] Best wishes, Hamish From hengist.podd at virgin.net Mon Feb 18 03:24:18 2008 From: hengist.podd at virgin.net (has) Date: Mon Feb 18 03:48:56 2008 Subject: Creating an Itunes Plug-n...Visual or none visual? In-Reply-To: <20080218111023.3032CD03DE@forums.omnigroup.com> References: <20080218111023.3032CD03DE@forums.omnigroup.com> Message-ID: J. Todd Slack" wrote: > I need to create a non visual iTunes plugin that works with ring > tones and I > don't see in Xcode where > to setup the project. Or should I be using the visualizer? This was already replied to on Cocoa-dev: http://lists.apple.com/archives/Cocoa-dev/2008/Feb/msg01345.html http://lists.apple.com/archives/Cocoa-dev/2008/Feb/msg01353.html http://lists.apple.com/archives/Cocoa-dev/2008/Feb/msg01362.html has -- http://appscript.sourceforge.net http://rb-appscript.rubyforge.org From sstevenson at mac.com Mon Feb 18 14:27:25 2008 From: sstevenson at mac.com (Scott Stevenson) Date: Mon Feb 18 14:27:33 2008 Subject: Is NSDocument's Saving Message Flow Threaded? In-Reply-To: References: Message-ID: On Feb 17, 2008, at 5:02 AM, Jonathan Dann wrote: > So do many other actions work in a delayed manner, and is it > documented? Would I have missed this somewhere? I'm not sure if it's on paper somewhere, but as David Dunham says, it's probably not something you should rely on. For the most part, action methods (IBActions) are meant to be used by user interface controls. It might work out by using them in code too, but often there's a better method to call. - Scott From j.p.dann at gmail.com Mon Feb 18 15:17:50 2008 From: j.p.dann at gmail.com (Jonathan Dann) Date: Mon Feb 18 15:17:59 2008 Subject: Is NSDocument's Saving Message Flow Threaded? In-Reply-To: References: Message-ID: On 18 Feb 2008, at 22:27, Scott Stevenson wrote: > > On Feb 17, 2008, at 5:02 AM, Jonathan Dann wrote: > >> So do many other actions work in a delayed manner, and is it >> documented? Would I have missed this somewhere? > > I'm not sure if it's on paper somewhere, but as David Dunham says, > it's probably not something you should rely on. > > For the most part, action methods (IBActions) are meant to be used > by user interface controls. It might work out by using them in code > too, but often there's a better method to call. Won't do it again then! Thanks for the info guys. Jon From mailinglists at jasonandannette.us Tue Feb 19 11:11:31 2008 From: mailinglists at jasonandannette.us (J. Todd Slack) Date: Tue Feb 19 11:11:41 2008 Subject: Visual iTunes Plugins Questions Message-ID: Hi, I see that one can create ?visual? iTunes plug-ins. So this means that the user has to have their Visualizer turned on and select the plugin that I write for it to work. My question is: 1. Can you create a UI inside of the visualizer? Use Open GL? I need the user to have a form presented to them to make choices about what should happen. Can anybody provide some insight? Thanks, -Jason From publicity2005 at adhocconference.com Wed Feb 20 08:37:02 2008 From: publicity2005 at adhocconference.com (Michael Dautermann) Date: Wed Feb 20 08:42:43 2008 Subject: Visual iTunes Plugins Questions In-Reply-To: <20080219200011.826BED3306@forums.omnigroup.com> References: <20080219200011.826BED3306@forums.omnigroup.com> Message-ID: <310A868A-A207-46B9-83E4-214B64B16A0D@adhocconference.com> > > Date: Tue, 19 Feb 2008 11:11:31 -0800 > From: "J. Todd Slack" > Subject: Visual iTunes Plugins Questions > > I see that one can create ?visual? iTunes plug-ins. > > So this means that the user has to have their Visualizer turned on and > select the plugin that I write for it to work. > > My question is: > 1. Can you create a UI inside of the visualizer? Use Open GL? I need > the > user to have a form presented to them to make choices about what > should > happen. > > Can anybody provide some insight? Hi Jason, I'm looking at doing a iTunes plugin also. What kind of user interface do you really need to have in your plugin? I don't believe visualizers are meant to have any UI beyond what you can put into the "options" or "configuration" panel. For my own plugin, I'm trying to figure out how to add a new menu to the iTunes plugin. I've seen it done in other plugins (e.g. "JewelCase"), but there doesn't appear to be any obvious API to do this, nor can I call [[ NSApplication sharedApplicaton ] mainMenu ] from within my test plugin to get at the iTunes menu bar. michael From cmhofman at gmail.com Sat Feb 23 15:38:59 2008 From: cmhofman at gmail.com (Christiaan Hofman) Date: Sat Feb 23 15:39:06 2008 Subject: Omni frameworks cross development Message-ID: In our app we would like to cross develop using the 10.5 SDK, but with a 10.4 deployment target. We also use the basic Omni framework (OmniBase, OmniFoundation, and OmniAppKit). Unfortunately, the current release of these frameworks don't allow building with these settings, they only appear to build when the min and max deployment target are either both 10.4 or both 10.5, not when targeting a range. So my first request is to the Omni developers: please fix this and provide source code for the frameworks that support cross development. The second is a question to the community: did anyone encounter this and found a way to fix it? The compiler errors I get are all coming from the sections in the #if's that compare MAC_OS_X_VERSION_10_5, so actually the part that should allow cross development. It seems that something was done wrong there, because it actually prevents cross development for the settings we require. My educated guess is that this macro should be compared to MAC_OS_X_VERSION_MAX_ALLOWED rather than MAC_OS_X_VERSION_MIN_REQUIRED (which is done everywhere). Could someone confirm this? And would it work if I just replaced these macros everywhere in these frameworks, or should that only be done in some places? Thanks, Christiaan From chad+macosx at objectwerks.com Sun Feb 24 07:58:38 2008 From: chad+macosx at objectwerks.com (objectwerks inc) Date: Sun Feb 24 07:58:41 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: <47B8A2FA.50005@HoffmanLabs.Com> References: <20080217200006.43EE6CF044@forums.omnigroup.com> <47B8A2FA.50005@HoffmanLabs.Com> Message-ID: On Feb 17, 2008, at 2:11 PM, Stephen Hoffman wrote: > >> From: Tom Jones >> >> I'm looking for more information on how to create a Background/ >> Daemon application. I've been learning Obj-C and I really like it. >> I have bought what books I can on the subject but none of them >> really cover this subject. >> > The following Daemons and Agents technical note might provide you > with a starting point: > > http://developer.apple.com/technotes/tn2005/tn2083.html > > Objective C and Cocoa stuff usually doesn't run as an agent; Cocoa > isn't considered appropriate. > Why is that? I have done plenty of things in Cocoa (no AppKit) that run as daemons or background tasks. What is inappropriate about it? Chad > You can see Cocoa used to build a UI tool to control the daemon or > agent. From cmhofman at gmail.com Sun Feb 24 09:16:18 2008 From: cmhofman at gmail.com (Christiaan Hofman) Date: Sun Feb 24 09:16:24 2008 Subject: Omni frameworks cross development In-Reply-To: References: Message-ID: <20166d560802240916p52b0a4fcja911c6ca6a158658@mail.gmail.com> On Sun, Feb 24, 2008 at 12:38 AM, Christiaan Hofman wrote: > In our app we would like to cross develop using the 10.5 SDK, but with > a 10.4 deployment target. We also use the basic Omni framework > (OmniBase, OmniFoundation, and OmniAppKit). Unfortunately, the current > release of these frameworks don't allow building with these settings, > they only appear to build when the min and max deployment target are > either both 10.4 or both 10.5, not when targeting a range. > > So my first request is to the Omni developers: please fix this and > provide source code for the frameworks that support cross development. > > The second is a question to the community: did anyone encounter this > and found a way to fix it? > > The compiler errors I get are all coming from the sections in the > #if's that compare MAC_OS_X_VERSION_10_5, so actually the part that > should allow cross development. It seems that something was done wrong > there, because it actually prevents cross development for the settings > we require. My educated guess is that this macro should be compared to > MAC_OS_X_VERSION_MAX_ALLOWED rather than MAC_OS_X_VERSION_MIN_REQUIRED > (which is done everywhere). Could someone confirm this? And would it > work if I just replaced these macros everywhere in these frameworks, > or should that only be done in some places? > > Thanks, > Christiaan > > Sorry to reply to my own question, but I looked more into the OmniBase framework, and I got a bit worried. The solution I proposed above seems to be wrong, unfortunately. In fact, I think the current Omni frameworks currently are buggy when not used for 10.5 only development. For example, take the 10.5-only runtime function object_getClass, and how it apparently is defined with different deployment compiler settings (same is true for some other 10.5 only runtime functions): SDK=10.5, deployment target=10.5: object_getClass defined in SDK SDK=10.5, deployment target=10.4: object_getClass defined in SDK object_getClass re-defined in OmniBase/objc.h (compiler error!) SDK=10.4u, deployment target=10.4: object_getClass not defined in SDK object_getClass defined in OmniBase/objc.h The 10.5-only case is A OK. The full compatibility settings are immediately wrong, as they don't even compile. The 10.4 only setting (which is the factory default setting!) seems OK at the first sight. However, if I run this on 10.5, it redefines the system version of object_getClass. That sounds like something you shouldn't do. It seems to me that a redefinition of object_getClass should depend on a runtime condition, not a compile time condition. Am I right? Also changing the compile time condition to depend on MAC_OS_X_MAX_ALLOWED would not help, because whether these functions should be defined depends on the run-time configuration. So my question now is: is it actually safe to use the current Omni frameworks when I want to target Tiger and Leopard? Christiaan From joar at joar.com Sun Feb 24 09:32:11 2008 From: joar at joar.com (j o a r) Date: Sun Feb 24 09:32:16 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: References: <20080217200006.43EE6CF044@forums.omnigroup.com> <47B8A2FA.50005@HoffmanLabs.Com> Message-ID: On Feb 24, 2008, at 4:58 PM, objectwerks inc wrote: > Why is that? I have done plenty of things in Cocoa (no AppKit) that > run as daemons or background tasks. What is inappropriate about it? That's explained in that technote, see: "Living Dangerously". j o a r From mah at jump-ing.de Sun Feb 24 09:48:53 2008 From: mah at jump-ing.de (Markus Hitter) Date: Sun Feb 24 09:49:00 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: References: <20080217200006.43EE6CF044@forums.omnigroup.com> <47B8A2FA.50005@HoffmanLabs.Com> Message-ID: <984EF834-FE03-476A-9668-F3322ABAE1F9@jump-ing.de> Am 24.02.2008 um 18:32 schrieb j o a r: > On Feb 24, 2008, at 4:58 PM, objectwerks inc wrote: > >> Why is that? I have done plenty of things in Cocoa (no AppKit) >> that run as daemons or background tasks. What is inappropriate >> about it? > > That's explained in that technote, see: "Living Dangerously". Foundation is explicitely marked as "daemon-safe" there. Markus - - - - - - - - - - - - - - - - - - - Dipl. Ing. Markus Hitter http://www.jump-ing.de/ From chad+macosx at objectwerks.com Sun Feb 24 13:22:59 2008 From: chad+macosx at objectwerks.com (objectwerks inc) Date: Sun Feb 24 13:23:08 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: References: <20080217200006.43EE6CF044@forums.omnigroup.com> <47B8A2FA.50005@HoffmanLabs.Com> Message-ID: <374D05C9-4206-459C-A9BE-19C6E4B20F39@objectwerks.com> On Feb 24, 2008, at 10:32 AM, j o a r wrote: > > On Feb 24, 2008, at 4:58 PM, objectwerks inc wrote: > >> Why is that? I have done plenty of things in Cocoa (no AppKit) >> that run as daemons or background tasks. What is inappropriate >> about it? > > > That's explained in that technote, see: "Living Dangerously". I read "Living Dangerously" and don't recall any blanket prohibition except connecting to the Window Server Chad From joar at joar.com Sun Feb 24 13:36:18 2008 From: joar at joar.com (j o a r) Date: Sun Feb 24 13:36:25 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: <374D05C9-4206-459C-A9BE-19C6E4B20F39@objectwerks.com> References: <20080217200006.43EE6CF044@forums.omnigroup.com> <47B8A2FA.50005@HoffmanLabs.Com> <374D05C9-4206-459C-A9BE-19C6E4B20F39@objectwerks.com> Message-ID: <7415EEBB-3B04-4162-80B2-035471FC5C07@joar.com> On Feb 24, 2008, at 10:22 PM, objectwerks inc wrote: > I read "Living Dangerously" and don't recall any blanket prohibition > except connecting to the Window Server If you feel that the technote is unclear, or otherwise needs to be improved, I suggest that you file an enhancement request! Cheers, j o a r From chad+macosx at objectwerks.com Sun Feb 24 14:06:33 2008 From: chad+macosx at objectwerks.com (objectwerks inc) Date: Sun Feb 24 14:07:22 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: <374D05C9-4206-459C-A9BE-19C6E4B20F39@objectwerks.com> References: <20080217200006.43EE6CF044@forums.omnigroup.com> <47B8A2FA.50005@HoffmanLabs.Com> <374D05C9-4206-459C-A9BE-19C6E4B20F39@objectwerks.com> Message-ID: On Feb 24, 2008, at 2:22 PM, objectwerks inc wrote: > > On Feb 24, 2008, at 10:32 AM, j o a r wrote: > >> >> On Feb 24, 2008, at 4:58 PM, objectwerks inc wrote: >> >>> Why is that? I have done plenty of things in Cocoa (no AppKit) >>> that run as daemons or background tasks. What is inappropriate >>> about it? >> >> >> That's explained in that technote, see: "Living Dangerously". > > > I read "Living Dangerously" and don't recall any blanket prohibition > except connecting to the Window Server In reality, a bunch of frameworks not listed as safe (from any language, not just ObjC) but the common denominator for most of them seems to be "connecting to the WindowServer" [see the comment on java] There is no prohibition on using Objective-C at all, just frameworks that use UI or manipulate graphics, and most of which connect to the WindowServer Chad From rainer at brockerhoff.net Sun Feb 24 14:09:47 2008 From: rainer at brockerhoff.net (Rainer Brockerhoff) Date: Sun Feb 24 14:43:57 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: <20080224200004.D318ADD185@forums.omnigroup.com> References: <20080224200004.D318ADD185@forums.omnigroup.com> Message-ID: At 12:00 -0800 24/02/08, macosx-dev-request@omnigroup.com wrote: >Date: Sun, 24 Feb 2008 18:48:53 +0100 >From: Markus Hitter >Message-ID: <984EF834-FE03-476A-9668-F3322ABAE1F9@jump-ing.de> > > >Am 24.02.2008 um 18:32 schrieb j o a r: > > On Feb 24, 2008, at 4:58 PM, objectwerks inc wrote: >> >>> Why is that? I have done plenty of things in Cocoa (no AppKit) >>> that run as daemons or background tasks. What is inappropriate >>> about it? >> >> That's explained in that technote, see: "Living Dangerously". > >Foundation is explicitely marked as "daemon-safe" there. Also, a per-user launch agent running in an "Aqua" session can be a standard Cocoa app with no problems. -- Rainer Brockerhoff Belo Horizonte, Brazil "In the affairs of others even fools are wise In their own business even sages err." Weblog: http://www.brockerhoff.net/bb/viewtopic.php From cmhofman at gmail.com Wed Feb 27 10:17:30 2008 From: cmhofman at gmail.com (Christiaan Hofman) Date: Wed Feb 27 10:17:40 2008 Subject: Building on Leopard with Tiger compatibility breaks linked libiconv.2.dylib Message-ID: <5472864F-0F59-4FF2-B6F4-1F919667255A@gmail.com> We are trying to build our app on Leopard, but it should be compatible with 10.4. So we use 10.4 as the deployment target for all our targets. However the app won't run on 10.4, it crashes on an incompatible version of libiconv.2.dylib. Leopard has version 7.0.0, and Tiger has version 5.0.0, according to the crash report. The particular library is used in a framework included in the app. I tried just using the 10.4u SDK for this framework (while still using the 10.5 SDK for the main app target, but that shouldn't matter, right?). But that did not help. So what build settings should I use to make this work? I hope I do not have to go back to using the 10.4u SDK for my app. This is the relevant part of a crash report on Tiger (crossing out some irrelevant info): dyld: Library not loaded: /usr/lib/libiconv.2.dylib Referenced from: /Applications/MyApp.app/Contents/MacOS/../ Frameworks/MyFramework.framework/Versions/A/MyFramework Reason: Incompatible library version: MyFramework requires version 7.0.0 or later, but libiconv.2.dylib provides version 5.0.0 Feb 26 18:30:00 xxxxx crashdump[20018]: MyApp crashed Feb 26 18:30:00 xxxxx crashdump[20018]: crash report written to: / Users/xxxxx/Library/Logs/CrashReporter/MyApp.crash.log Thanks, Christiaan From vip at avatar.com.au Wed Feb 27 20:22:05 2008 From: vip at avatar.com.au (DavidW) Date: Wed Feb 27 20:22:36 2008 Subject: any update on 10.5.2 update? In-Reply-To: <91766D6D-7FCC-4FDF-90EB-E88D9BE7CA22@mac.com> References: <91766D6D-7FCC-4FDF-90EB-E88D9BE7CA22@mac.com> Message-ID: <5151770A-61B8-4863-9B4C-2FA357CFAC07@avatar.com.au> Thanks to everyone who replied - seems like the problems people are having are not major. Much appreciated, D. ________________________________________________ David Worrall. - Experimental Polymedia: www.avatar.com.au - Education for Financial Independence: www.mindthemarkets.com.au Australian research affiliations: - Capital Markets Cooperative Research Centre: www.cmcrc.com - Sonic Communications Research Group: creative.canberra.edu.au/scrg From tjones at acworld.com Thu Feb 28 22:52:14 2008 From: tjones at acworld.com (Tom Jones) Date: Thu Feb 28 22:52:18 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: References: <20080224200004.D318ADD185@forums.omnigroup.com> Message-ID: Thanks, I read the Technote and I have to agree I see nothing wrong with using Obj-C, as long as there is no window server interaction. I did get a copy of "Advanced Mac OS X Programming" and that has been a very interesting read. From someone really learning Obj-C, I was expecting more Obj-C and more explanations. Well in some round about way my question was answered, I will stick to using C code since the examples and documentation are much more plentiful. I really have yet to find a really good examples and docs on doing it with Obj-C. Thanks again, tom On Feb 24, 2008, at 2:09 PM, Rainer Brockerhoff wrote: > At 12:00 -0800 24/02/08, macosx-dev-request@omnigroup.com wrote: >> Date: Sun, 24 Feb 2008 18:48:53 +0100 >> From: Markus Hitter >> Message-ID: <984EF834-FE03-476A-9668-F3322ABAE1F9@jump-ing.de> >> >> >> Am 24.02.2008 um 18:32 schrieb j o a r: >>> On Feb 24, 2008, at 4:58 PM, objectwerks inc wrote: >>> >>>> Why is that? I have done plenty of things in Cocoa (no AppKit) >>>> that run as daemons or background tasks. What is inappropriate >>>> about it? >>> >>> That's explained in that technote, see: "Living Dangerously". >> >> Foundation is explicitely marked as "daemon-safe" there. > > Also, a per-user launch agent running in an "Aqua" session can be a > standard Cocoa app with no problems. > > -- > Rainer Brockerhoff > Belo Horizonte, Brazil > "In the affairs of others even fools are wise > In their own business even sages err." > Weblog: http://www.brockerhoff.net/bb/viewtopic.php > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From chad+macosx at objectwerks.com Thu Feb 28 23:24:36 2008 From: chad+macosx at objectwerks.com (objectwerks inc) Date: Thu Feb 28 23:24:42 2008 Subject: Obj-C and Background/Daemon Application Question In-Reply-To: References: <20080224200004.D318ADD185@forums.omnigroup.com> Message-ID: <7EC22D3F-44AD-40E4-88B4-5D4B2202FFA8@objectwerks.com> On Feb 28, 2008, at 11:52 PM, Tom Jones wrote: > Thanks, I read the Technote and I have to agree I see nothing wrong > with using Obj-C, as long as there is no window server interaction. > I did get a copy of "Advanced Mac OS X Programming" and that has > been a very interesting read. From someone really learning Obj-C, I > was expecting more Obj-C and more explanations. > > Well in some round about way my question was answered, I will stick > to using C code since the examples and documentation are much more > plentiful. I really have yet to find a really good examples and docs > on doing it with Obj-C. Remember, Obj-C *is* C with objects. So, you can do things like sockets and other stuff using standard C calls if you want, but you can still do things like your collections and other data manipulations using Obj-C if you want. At a startup (which shall remain nameless for the offchance 1 of you was involved or had heard of it -- except for those involved it was a nameless startup) I was at back in 98 I used Obj-C using OPENSTEP 4.2 on windows, as well as on mach based OpenStep 4.2 OS and later on Rhapsody, to make a shared library (DLL) that visual basic and visual C were linking to on Windows and normal apps used on OpenStep 4.2 / Rhapsody. This DLL / shared lib did some socket level inter-system communications but did so in an application specific way (ie, the apps called routines that made sense to them and my shared lib / DLL encapsulated the data and sent it over the wire). I made extensive use of Foundations collections and other nifty objects to make it work. Chad > > > Thanks again, > tom > > > On Feb 24, 2008, at 2:09 PM, Rainer Brockerhoff wrote: > >> At 12:00 -0800 24/02/08, macosx-dev-request@omnigroup.com wrote: >>> Date: Sun, 24 Feb 2008 18:48:53 +0100 >>> From: Markus Hitter >>> Message-ID: <984EF834-FE03-476A-9668-F3322ABAE1F9@jump-ing.de> >>> >>> >>> Am 24.02.2008 um 18:32 schrieb j o a r: >>>> On Feb 24, 2008, at 4:58 PM, objectwerks inc wrote: >>>> >>>>> Why is that? I have done plenty of things in Cocoa (no AppKit) >>>>> that run as daemons or background tasks. What is inappropriate >>>>> about it? >>>> >>>> That's explained in that technote, see: "Living Dangerously". >>> >>> Foundation is explicitely marked as "daemon-safe" there. >> >> Also, a per-user launch agent running in an "Aqua" session can be a >> standard Cocoa app with no problems. >> >> -- >> Rainer Brockerhoff >> Belo Horizonte, Brazil >> "In the affairs of others even fools are wise >> In their own business even sages err." >> Weblog: http://www.brockerhoff.net/bb/viewtopic.php >> _______________________________________________ >> 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 mikevann at gmail.com Fri Feb 29 11:41:50 2008 From: mikevann at gmail.com (mikevann) Date: Fri Feb 29 11:42:01 2008 Subject: Application badge on dock windows Message-ID: Is there a way to tag minimized windows in the dock with the application's icon pre 10.5? I know about NSDockTile's setShowsApplicationBadge: but looking for a 10.4 compatible way to do this. From dunham at mac.com Fri Feb 29 12:13:32 2008 From: dunham at mac.com (David Dunham) Date: Fri Feb 29 12:13:39 2008 Subject: Application badge on dock windows In-Reply-To: References: Message-ID: <9508F1BD-1F1E-466E-AC1E-8BC13954FD99@mac.com> On 29 Feb 2008, at 11:41, mikevann wrote: > Is there a way to tag minimized windows in the dock with the > application's icon pre 10.5? I know about NSDockTile's > setShowsApplicationBadge: but looking for a 10.4 compatible way to > do this. Um, my Cocoa app gets this for free in 10.4. David Dunham A Sharp, LLC Voice/Fax: 206 783 7404 http://a-sharp.com Efficiency is intelligent laziness. From mikevann at gmail.com Fri Feb 29 12:18:45 2008 From: mikevann at gmail.com (mikevann) Date: Fri Feb 29 12:19:00 2008 Subject: Application badge on dock windows In-Reply-To: <9508F1BD-1F1E-466E-AC1E-8BC13954FD99@mac.com> References: <9508F1BD-1F1E-466E-AC1E-8BC13954FD99@mac.com> Message-ID: <9BBFAA28-87E8-46A8-82BF-F02F403ADC33@gmail.com> My windows are not getting one on leopard, linked to 10.4U SDK. On Feb 29, 2008, at 1:13 PM, David Dunham wrote: > Um, my Cocoa app gets this for free in 10.4. From gweston at mac.com Fri Feb 29 12:54:00 2008 From: gweston at mac.com (Gregory Weston) Date: Fri Feb 29 12:54:06 2008 Subject: Application badge on dock windows In-Reply-To: <20080229200005.A45ECE7FB6@forums.omnigroup.com> References: <20080229200005.A45ECE7FB6@forums.omnigroup.com> Message-ID: <90D0949B-1172-481A-A249-49C5142B5CD6@mac.com> mikevann wrote: > Is there a way to tag minimized windows in the dock with the > application's icon pre 10.5? I know about NSDockTile's > setShowsApplicationBadge: but looking for a 10.4 compatible way to do > this. It should just happen. Every app I've got on this 10.4 machine seems to do it, including a goofy little experiment I threw together yesterday that makes no active effort to do so. From dunham at mac.com Fri Feb 29 13:54:18 2008 From: dunham at mac.com (David Dunham) Date: Fri Feb 29 13:54:24 2008 Subject: Application badge on dock windows In-Reply-To: <9BBFAA28-87E8-46A8-82BF-F02F403ADC33@gmail.com> References: <9508F1BD-1F1E-466E-AC1E-8BC13954FD99@mac.com> <9BBFAA28-87E8-46A8-82BF-F02F403ADC33@gmail.com> Message-ID: <62E42220-A867-4A5E-A54B-516154465DBF@mac.com> On 29 Feb 2008, at 12:18, mikevann wrote: > My windows are not getting one on leopard, linked to 10.4U SDK. Maybe you should let us know what you're doing. Perhaps you're not using NSDocument like I am, or are drawing your own Dock icon? David Dunham A Sharp, LLC Voice/Fax: 206 783 7404 http://a-sharp.com "People seem to misinterpret complexity as sophistication" -- Niklaus Wirth