Re: Accuracy of timers?

2009-04-22 Thread Jeremy W. Sherman
Timers can only fire when your app is running in the run loop mode that they are part of. You can investigate alarm(3) and setitimer(3), but I don't know how much more accurate they will be. Mac OS X is not a real-time OS. —Jeremy On Thu, Apr 23, 2009 at 12:31 AM, M Pulis wrote: > Expect the sa

Re: NSProgressIndicator

2009-04-22 Thread Jeremy W. Sherman
> > And finally: > > . . . > [myIndicator setMaxValue:0]; > [myIndicator setMinValue:0]; > [myIndicator setDoubleValue:0]; > This looks to be your problem. Your max and min values are identical following your first run. Unless you're reasserting the correct values before redisplaying, they'll be st

Re: MDItemCopyAttribute and kMDItemFinderComment

2009-04-21 Thread Jeremy W. Sherman
ance problem or not. However, a background app without a connection to the UI server cannot use high-level events, anyway, since it does not have a process serial number. —Jeremy On Wed, Apr 22, 2009 at 12:09 AM, Adam R. Maxwell wrote: > > On Apr 21, 2009, at 8:30 PM, Jeremy W. Sherman

Re: Time since Login?

2009-04-21 Thread Jeremy W. Sherman
How about just nice(1)-ing the process doing the intense processing to be lower-priority, and letting the scheduler sort it all out? If you really want to try and schedule yourself, you can check out how uptime does it in the Darwin sourcecode and do it that way. Running nm on uptime will point yo

Re: code behind NSRunAlertPanel

2009-04-21 Thread Jeremy W. Sherman
> > Incidentally I was mistakenly under the impression that -runModalForWindow: > was deprecated. > You were likely thinking of -[NSApplication runModalForWindow:relativeToWindow:], which has been superseded by -beginSheet:modalForWindow:…. -runModalForWindow: is used to display an application-moda

Re: MDItemCopyAttribute and kMDItemFinderComment

2009-04-21 Thread Jeremy W. Sherman
getxattr(2) will directly access the current on-disk attribute value. Why not just use it as Alastair suggested? —Jeremy On Tue, Apr 21, 2009 at 8:16 PM, Chris Idou wrote: > > > I don't really want to be sending apple events to the finder since this is > a background app, and it could be callin

Re: SQLite 3 crash report - debugging help needed

2009-04-20 Thread Jeremy W. Sherman
> > I haven't been able to track this down to anything specific - it doesn't > happen with any regularity or frequency, nor does it occur anywhere on my > development machine that will allow me to track it down. > How did you come by this crash log? From the 0x48, it looks like it's attempting to d

Re: SQLite 3 crash report - debugging help needed

2009-04-19 Thread Jeremy W. Sherman
See TN2124: Mac OS X Debugging Magic ( http://developer.apple.com/technotes/tn2004/tn2124.html), specifically, the section titled "Architecture Considerations". You'll know what types to expect for each argument to the function by looking at the sqlite3 source code. —Jeremy On Sat, Apr 18, 2009 a

Re: Cocoa program without xib file

2009-04-16 Thread Jeremy W. Sherman
Jeff Johnson has written a series of articles exploring a nibless Cocoa app. You will find them at http://lapcatsoftware.com/blog/?s=%22working+without+a+nib%22. If you simply want to use Foundation without a nib, that's as easy as can be. If you want to use AppKit, good luck, and read Jeff's arti

Re: Importing Word doc in Carbon app via Cocoa

2009-04-16 Thread Jeremy W. Sherman
Foundation memory management for CoreFoundation programmers, in brief: * the Create rule becomes the "you own all references returned by a method beginning with new, copy, or alloc" * the Get rule becomes "you do not own any references returned by a method beginning with anything else" * C

Fwd: Setting up an auxiliary task for use with Distributed Objects

2009-04-16 Thread Jeremy W. Sherman
Apologies for the multiple-send. Keep forgetting to reply to all. Looking to see if I can set that as default or just have to start slapping myself for negative reinforcement instead. -- Forwarded message -- From: Jeremy W. Sherman Date: Thu, Apr 16, 2009 at 9:26 AM Subject: Re

Re: Setting up an auxiliary task for use with Distributed Objects

2009-04-16 Thread Jeremy W. Sherman
On Thu, Apr 16, 2009 at 5:01 AM, Oleg Krupnov wrote: > I'm looking for the right way of setting up the auxiliary NSTask from > within the main task. The aux task vends some Distributed Objects, and > the main task uses them. > > The auxiliary task does this: > > NSAutoreleasePool* pool = [[NSAutor

Re: Combing Bindings with Target-Action

2009-04-15 Thread Jeremy W. Sherman
> I am relying on the binding messages to complete before the > target-action message - is this an OK idea? It sounds like you already know the answer to that. It's likely not worth the trouble of trying to straighten out the race condition, when you can just dodge the problem entirely and use KVO

Fwd: C: treated as a path component

2009-04-15 Thread Jeremy W. Sherman
You could also use basename(3) instead of Cocoa/CF calls. Since it could modify the passed-in string, you'll need to either use -[NSString getFileSystemRepresentation:maxLength:] or copy the string returned by -[NSString fileSystemRepresentation]. Of course, if you're worried about the path separat

Re: KVC and "@" as key

2009-04-14 Thread Jeremy W. Sherman
Hi Micha, -[NSDictionary objectForKey:] has no such problems. You can use that to grab the values of keys beginning with an at sign instead of -valueForKey:. —Jeremy On Wed, Apr 15, 2009 at 12:19 AM, Micha Fuhrmann wrote: > Hi there, > > I'm bumping against KVC, indirectly. I've got a dictionar

Re: stopping an application

2009-04-13 Thread Jeremy W. Sherman
A caveat: typeApplicationBundleID just picks whichever target if there is more than one instance of an app with the same bundle id running. This can be the case if, for example, you're running both the current version of PowerPoint and an older version. typeProcessSerialNumber will always target th

Re: Need to find out why I get Cocoa error 256 . . .

2009-04-13 Thread Jeremy W. Sherman
Hi Michael, You'll find the error defined in : NSFileReadUnknownError = 256, // Read error (reason unknown) —Jeremy On Mon, Apr 13, 2009 at 10:25 AM, Michael A. Crawford wrote: > Where can I find detail on the following error code?  Or, can someone point > me to in