Solipsism Gradient

Rainer Brockerhoff’s blog

Browsing Posts published in April, 2009

Also, yikes. 26 days without posting! I plead temporary insanity brought on by tax filing time, and Twitter – the latter being a more convenient outlet for short links and thoughts.

Anyway, taxes are filed and we’re now having a short working vacation in the hills of Petrópolis, an old town north of Rio de Janeiro. Dorinha is taking a short English immersion course (excellent BTW), and I’m coding again, yay!

I’m patching up some loose ends in Klicko in preparation to cloning its preference panel for the next version of Quay, as I’ve mentioned before. While doing that, I’m also trying to refactor my code into a tighter and more readable form. Some of that might be interesting…

For instance, the automatic update checker has a dialog button to “Open System Preferences” and this should go to the Klicko preference panel. Now, System Preferences may already be running but with another panel selected; in any event, the Klicko panel should be opened and ready for the user to see update details. There are several ways to accomplish this.

Most people probably will consider, at first, writing an AppleScript to open System Preferences and then select the Klicko preferences panel. This is unnecessarily complex, and I’ve looked at several solutions. The simplest one-liner to do so from Cocoa would be:

[[NSWorkspace sharedWorkspace] openFile:@"/full/path/to/my.prefPane"];

There’s a non-obvious down-side to that: NSPreferencePane is generic and may be implemented by other apps for their preference plug-ins. Someone’s application might use it and declare .prefPane in its Info.plist. This would in my opinion be a mistake, in that double-clicking or running the code above might (or not) open that other app instead of System Preferences!

The solution I finally hit upon uses Launch Services to open the correct application with the preference panel, like this:

FSRef ref;
if (LSFindApplicationForInfo(0, CFSTR("com.apple.systempreferences"), NULL, &ref, NULL)==noErr) {
   LSApplicationParameters parms = {0,kLSLaunchDefaults,&ref,NULL,NULL,NULL,NULL};
   NSArray* args = [NSArray arrayWithObject:[NSURL fileURLWithPath:@"/full/path/to/my.prefPane"]];
   if (LSOpenURLsWithRole((CFArrayRef)args, kLSRolesAll, NULL, &parms, NULL, 0)==noErr) {
      // success!
   }
}

This code first finds the System Preferences app by its bundle ID, and makes a FSRef for it. The FSRef is then pointed to from the LSApplicationParameters structure, and passed to LSOpenURLsWithRole; this will run System Preferences if it’s not already running, and tell it to open the panel.

It’s tempting to pass the panel’s path as an argument inside of LSApplicationParameters. This does indeed work if System Preferences is not already running, but unfortunately it’s ignored if it is.

This just in:

Virtual fungus is the new threat to computers

Scientists confirmed the existence of a new type of virtual plague, which is neither a virus nor a Trojan Horse. U. S. Computer Science researchers are calling their discovery a “computer fungus”. The lead researcher is Antonio de Marco, associate professor at West California University.

Just like fungi and mold, which attack photos and cassette tapes from past century, the virtual fungus degrades image, sound, and video files stored on computers. “The problem occurs even with backup files that are rarely accessed”, says de Marco. Scientists found out an average quality loss of about 7% a year for JPEG images, 15% a year for TIFF images and 4% a year for MP3 files. Other infected files are QuickTime videos, followed by AVI files, with 9% a year.

Arjun Radhakrishnan, Ph.D. in Applied Computer Science at Stanford, explains that this virtual fungus has not yet been detected because its effects are gradual and insidious. “The typical PC user never thinks about this, because performance loss of the operating system itself is trivial”. According to him, people consider it understandable that pirated music from Napster in 2000 sounds a little bit degraded with time, as well as porn images downloaded from the web get smaller and fuzzy. Photoshop files are opened with unexplainable wrong colors, get dark and fade. Movies open in progressively tinier windows. Even texts may deteriorate, having their accented characters mixed up.

These would be some symptoms of the digital fungus. The effects are visible when comparing a digital photo to its printed copy from when it was brand new. “There was a progressive degradation of almost all these materials, and many may not resist until the next decade”, says Radhakrishnan.

Transmission of the disease does not appear to be caused by hackers. Environmental factors may be involved. Houses with more than one computer also have more chances. Using cell phones or having plasma TVs and air conditioning may also be risk factors.

While there is no commercial software solution to it, the researchers recommend making daily backups of your files and keeping them on older and durable medias, like CD-R or floppy disks; transcribe ripped videos from DVD to VHS; send all photos to a lab to be printed on paper. “This is the only way to ensure longevity of your digital data”, points out de Marco.

Thanks to the folks at geek.com.br and MAC+.

Update: original text was translated from Portuguese by Julio Cesar Silva Santos (jcsantos@me.com), at first I thought it was a group effort. Thanks Julio!

WWDC 2009

No comments

At first I thought I wouldn’t make it, but now I’m very happy to announce that I’m going to WWDC 2009.

I’ll arrive in San Francisco around noon on June 4th (Thursday), and will leave, also around noon, on June 16th (Tuesday). I’ll be glad to meet with anyone who’s interested…

More as it happens!

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