Solipsism Gradient

Rainer Brockerhoff’s blog

Browsing Posts published in May, 2009


No comments

Well, the nice folks at MacMagazine (thanks Rafael!) have republished a slightly updated version of an interview I gave a few years ago. It’s mostly about the 1985 Unitron Mac512, the very first Mac clone.

It’s in Portuguese, so here’s a translated-by-Google sort-of-English version. Rafael has hunted down some good pictures of an early prototype; I regret not having taken any myself.

Hold on

No comments

Well, since I last wrote, a reasonably definite version of Klicko has been published (1.1.1 build 207) and I deemed the supporting code to be mature enough to serve as basis for the next version of Quay. So, since then, I’ve been busy on that.

On June 4th I’ll be arriving in San Francisco – WWDC starts on June 8 – and hopefully by then I’ll have an early alpha version of Quay 1.2 (or maybe 2? II?), and of the Quay Plugin Developer Kit as well. Stay tuned.

Posted by 0xced:

Rainer Brockerhoff wrote:

   [task launch]; 
   [NSApp terminate:nil];

No need to pass the calling program’s process identifier, and it works from Tiger (10.4) on up.

Although unlikely, the task may be faster to execute than [NSApp terminate:] and the relaunch process would thus fail. By listening to the termination of the calling process, you are guaranteed to always relaunch.
Edit: I’m wrong, Rainer just pointed to me that the task can’t terminate since its first line is a read on the input pipe and it will block there.

Cédric Luthi has posted another take on the mechanics of reopening a System Preferences pane (or is it panel?). Worth a read; however, I would propose a shorter piece of code for his relaunch snippet, combining two of my recent posts:

int main(int argc, char **argv) { 
   char dummy; 
   read(STDIN_FILENO, &dummy, 1); 
   CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (UInt8*)argv[1], strlen(argv[1]), FALSE); 
   CFArrayRef aurl = CFArrayCreate(kCFAllocatorDefault, (const void**)&url, 1, NULL);
   FSRef ref;
   if (LSFindApplicationForInfo(0, CFSTR(""), NULL, &ref, NULL)==noErr) {
      LSApplicationParameters parms = {0,kLSLaunchDefaults,&ref,NULL,NULL,NULL,NULL};
      LSOpenURLsWithRole(aurl, kLSRolesAll, NULL, &parms, NULL, 0);

and the code to launch this tool (from within the preference panel itself) is:

   NSTask* task = [[NSTask alloc] init]; 
   [task setLaunchPath:@"/path/to/tool"]; 
   [task setArguments:[NSArray arrayWithObject:[[NSBundle bundleForClass:[self class]] bundlePath]]]; 
   [task setStandardInput:[NSPipe pipe]]; 
   [task launch]; 
   [NSApp terminate:nil];

No need to pass the calling program’s process identifier, and it works from Tiger (10.4) on up.

Photos licensed by Creative Commons license. Unless otherwise noted, content © 2002-2024 by Rainer Brockerhoff. Iravan child theme by Rainer Brockerhoff, based on Arjuna-X, a WordPress Theme by SRS Solutions. jQuery UI based on Aristo.