2007/02/28

Spotlight, LaunchServices and backup volumes

When I select a file in the Finder and right click to "Open With ->", the system pauses, my backup hard drive spins up, and I get a menu showing 5 or 6 duplicate entries for, say, VLC.app.

My backup volume is often online, so it's visible to LaunchServices and Spotlight, et al. Maybe this is the root cause of my problem. But I need to leave the backup volume online because it shares a hard drive with other volumes that I need.

What to do? Is this a problem with Spotlight? With LaunchServices? Regardless of Finder misbehavior, I don't want Spotlight indexing my backup drive; it's just a mirror of my boot volume. Time for some googling.

Spotlight Indexing



From ~stevenf: Disabling Spotlight for a Volume: To see if indexing is on for a volume:
$ sudo mdutil -s /Volumes/Backup


To get rid of the index for a volume and ensure that it is not re-indexed in future:
$ sudo mdutil -i off -E /Volumes/Backup


I've just performed these steps and will see if it works following my next backup.

I'm using SuperDuper to do periodic, full backups. Their forum says that SD will honor Spotlight indexing preferences for a target volume:
As of v2.0, when used with Tiger 10.4.3 or later... just add the volume to the Privacy tab of the Spotlight preference pane. We'll automatically ensure that that state is maintained, and all should work fine.


Of course I can't figure out how to add the volume to the Spotlight preference pane. I've tried dragging it in, but it doesn't show up in the list. Hence the above shell commands.

LaunchServices Caching



Since LaunchServices is already caching redundant references to my backed-up apps, with apparent disregard for duplicate (Unix) pathnames. So I also need to clear its cache. I've used these steps:

$ cd /Library/Caches
$ sudo rm com.apple.LaunchServices-*.plist


I've also restarted my system, since I didn't know whether it would suffice to log out and back in, or to simply kill launchd from within Activity Monitor.

Just now everything is looking good.

2007/02/26

A Breath of Fresh Air: To Fight TB, Open a Window: Scientific American

A Breath of Fresh Air: To Fight TB, Open a Window: Scientific American: "Escombe says the riskiest areas of hospitals are waiting rooms and other places where people congregate before being diagnosed. In a prior study, he and co-workers found that 30 percent of emergency department staff in a Lima hospital became infected with TB during a year."

Installing mod_python for Python 2.5 on Mac OS X

Django wants to be served from behind Apache, using mod_python. I want to use Python 2.5, but the MacPorts/DarwinPorts mod_python port wants to use Python 2.4.

I downloaded mod_python 3.3.1 from the mod_python downloads page and was able to install in a few easy steps:

$ ./configure --with-apxs=/opt/local/apache2/bin/apxs
$ make
$ sudo make install
$ sudo vi /opt/local/apache2/conf/httpd.conf
# Add this line
LoadModule python_module /opt/local/apache2/modules/mod_python.so


Then restart the web server.

All of the warnings in the mod_python README about Mac OS X 10.2.x and Python and libtool and static libraries appear not to matter for OS X 10.4.

Testing w. Django



To test the installation I set up a virtual host pointing to my Django app, following the instructions in the Django docs.

The hardest part was realizing I needed a virtual host (the IP address for which I hardwired into my /etc/hosts file). That was the easiest way to let my app continue to use its absolute URL paths; learning how to adapt to different installation "mount points" looked a bit harder.

The next hardest part was putting the subversion workspace for my project where the web server user (www) had permission to traverse to it.

Integrating MacPorts Apache 2 with System Preferences

Just returned from PyCon 2007, and wanted to try out a few of the new web frameworks tools I'd seen. To get started I needed to be running my own installation of Apache, instead of the system default installation. The latter does not AFAIK include sources, and that makes it difficult to add things like mod_fastcgi.

Install Apache 2


I used the MacPorts/DarwinPorts version of Apache 2:
$ sudo port install mod_fastcgi


Configure /etc/hostconfig


Following hints from elsewhere on the web, I tried to ensure Apache 2 would start at system boot by adding this line to /etc/hostconfig. (Haven't tested this yet.)
WEBSERVER=-NO-

APACHE2=-YES-



Fake Out System Preferences


To tell System Preferences Sharing->Personal Web Sharing to start Apache 2 rather than the system default Apache 1.3:
$ cd /usr/sbin
$ sudo mv apachectl apachectl-1.3
$ sudo ln -s /opt/local/apache2/bin/apachectl apachectl
$ pushd /opt/local/apache2/conf
$ sudo cp httpd.conf.sample httpd.conf
$ sudo vi httpd.conf
# Add this line somewhere near the DocumentRoot directive
PidFile "/private/var/run/httpd.pid"


Move Static Content and CGIs


I made sure System Preferences was able to start the new web server, and then double-checked that I actually was getting content from my new document root :) Then it was time to move static content from /Library/WebServer/DocumentRoot to /opt/local/apache2/htdocs, and cgi-bin executables from /Library/WebServer/CGI-Executables to /opt/local/apache2/cgi-bin.

Copy CGI-Bin Configuration Directives


Finally I had to copy the configuration section for my Trac projects to /opt/local/apache2/conf/httpd.conf.

All done.

Update



Oops, not quite. I want the log files to be under /var/log/httpd, where Console.app expects to find them. So CustomLog and ErrorLog need to be fixed up in all of the *.config files under /opt/local/apache2/conf/.

2007/02/04

New Scientist: Vaccine zaps allergy in record time

Vaccine zaps allergy in record time - health - 04 February 2007 - New Scientist

I've often wondered why an effective treatment for an allergy is to expose the sufferer to more of the allergen. According to the article (emph. added):

Existing vaccines for allergies involve three to five years of regular injections with increasing amounts of allergen... All the while the immune response slowly changes from a predominance of T-helper 2 (TH2) cells, immune cells responsible for triggering allergic reactions, to T-helper 1 (TH1) cells, which stimulate the production of protective antibodies.


So the trick is to make sure the vaccine contains only a small dose of the allergen -- so as not to kill the subject? And yet, as the article says,
Because nothing is directing allergens to the right place in immune cells, it takes a lot of allergen to generate a response.


The new vaccine is structured to deliver the allergens/antigens to the right places.
"[Components in the new vaccine] lower the dose needed to induce a T-cell response by a factor of about 100," says Reto Crameri of SAIF, lead author of the study.

2007/02/02

What made the 1918 flu contagious?

Pandemic flu may be only two mutations away - health - 01 February 2007 - New Scientist Space

What a virus needs to spread, the CDC team concluded, is an ability to bind 2,6 sugars, whether or not it needs this to replicate... One clue, they speculate, is that ferrets with non-contagious viruses... do not sneeze. Contagious ferrets do.

“The cells with 2,3-sialic acid receptors have been associated with the bronchial mucins,” Tumpey told New Scientist. This viscous secretion might inhibit these viruses, and prevent the irritation that causes sneezing, which “may contribute to the spread of influenza, at least in ferrets”.

...the CDC results suggest finding out what mutations make H5N1 bind to 2,6-sialic, as those could make it contagious.