Archive for March, 2007

  • – changing IMAP prefix in Mail.app (1)

Pondering about a prime lens for my camera – a scientific approach

Tuesday, March 27th, 2007

I recently got caught up in a discussion about getting a prime lens (== a fixed focal length lens) or another zoom lens for my camera. It seems that I will not be getting a lens anytime soon, but I wrote a cool perl script, which I want to share here ;-)

I decided I should analyze what focal lengths I used while taking my photos so that I can take a more conscious decision. After some trials and errors, what I came up with was:

find . -exec exiftool {} \; | perl -ne ‘/^Focal Length.*equivalent:(.*)\)/ && print “$1\n”;’ | sort | uniq -c

which runs `exiftool` on all my photos, extracts the 35mm equivalent length (I took my photos with at least 2 different cameras) sorts them and generates a pseudo-histogram.

I thought I was done, but I then realized that something must have been wrong with the data as some of the focal length ranges were well beyond what any of my camera has. I investigated a little and found out that some of the photos from my G3 have an incorrectly calculated 35mm equivalent. This means that such a simple script will not do.

Here is my second try:

find . -exec exiftool {} \; | perl -ne ‘
if (/^ExifTool/) { $camera = “”; $lens=0; };
if (/^Camera Model Name.*: (.*)/) { $camera = $1; };
if (/^Focal Length.*: (.*)mm/) { $lens = $1; print “\”$camera\” $lens\n”; }; ‘ > photos-lengths.ssv

Now I have a text file with something like:

“Canon PowerShot G3″ 7.2
“Canon EOS 350D DIGITAL” 38.0

This file can be conveniently read into R so that I can plot a real histogram:

lengths <- read.table(“photos-lengths.ssv”)
lengths_camera <- split(lengths, lengths$V1)
num_cameras <- length(lengths_camera)
old_par <- par(mfrow = c(floor(sqrt(num_cameras)), ceiling(num_cameras / floor(sqrt(num_cameras)))))
# one chart for each camera.
for (c in names(lengths_camera)) {
l <- lengths_camera[[c]]$V2
# filter likely corrupted data.
l_filt <- l [ (5 < l) & ( l < 100) ]
hist(l_filt, xlab=”focal length [mm]“, ylab=”#photos”, main=c, breaks = 30);
}
par(old_par);

This little script produces a nice matrix charts with histograms of focal lengths for all the camera. So the conclusions is that I could get a 30mm prime lens, but also a 10-20mm lens would not be a bad idea ;-)

Avoiding temporary files on desktop on OS X

Sunday, March 4th, 2007

While working with OS X I found it immensly annoying that Firefox saves every single PDF/PPT/DOC file I ever looked at on my desktop. I am a messy person to begin with (and so is me desktop), so I don’t want any application to place random files there on top of that ;-)

What I did first was to change Preferences>Main>Save Downloaded files To and it did change the __location of downloaded files__, but, surprise, surprise, not the __automatically downloaded ones__. Having looked for help on the web I found the solution:

1. Change the actual location of the temporary files __in Safari__, which in turn changes where Firefox stores its temporary files! Surprisingly the option in Safari called “Save downloaded files to” affects both the downloads and the temporary files, and the one in Firefox, called “Save files to”, affects only the files explicitly downloaded.
2. Make Firefox delete downloaded files on exit. To do this you need to go to `about:config` and create a new variable called
`app.helperApps.deleteTempFileOnExit` and set it to `true`. I think it only works in FF2.0

I used both solutions: (1) (don’t want to have temp files on my desktop in any case) and (2) (if I want to keep a PDF I probably save it somewhere else). It works great now!