Sep 18

Using Google’s “I’m feeling lucky” for custom searches in Alfred

One of the most used apps on my Mac is Alfred, a quick-launcher swiss-knife do-anything-you-want-with-the-keyboard type of app (loosely based on the venerable Quicksilver).

Among it’s gazillion features are custom web searchers. For example, to search movie information on IMDB.com, I just bring up the Alfred window, type “imdb MyCoolMovie” and the search result will open up in IMDB.com. You can create your own custom searches as long as the search URL is well defined, which is often the case. The one I use most these days is a custom search for LEO, the biggest German dictionary site for German to English, Spanish, French and more languages.

In some cases, however, sites do not give you well-formed search URLs, such as AppData.com, which I need a lot for work.

But there is a simple work-around using Google’s “I’m feeling lucky”. Example: to get the Appdata info on “Farmville”, entering “appdata farmville” into Goole will sure as hell return the corresponding page on Appdata.com. So hitting “I’m feeling lucky” will bring me there directly.

So here’s how to create a custom search for that in Alfred:

That’s it. Now every time I need to look up on Appdata, I bring up Alfred, type

apd GameName

and Alfred will bring me to the most likely search result page. In some rare cases (e.g. very generic game names like “slots”), Google can’t decide properly on the one best case but that’s ok, since in this case the standard Google search result page will come up where I can choose myself.

Sep 02

Time Machine and Dropbox

Time Machine can really be a life saver and nothing is simpler than using it via Time Capsule or a compatible NAS.

By default, Time Machine backs up your entire Mac, including all Applications, Cache files and folders and, yes, even your Trash. Personally, I don’t need that. There are a couple of good recommendations out their for folders than can safely be excluded, such as /Applications or ~/.Trash.

But even though I did that, Time Machine was still regularly backing up several hundred Megabytes each time it started - practically each hour. That might not be annoying on a new, fast Mac and a hard disk connected via USB. But via WiFi, this can be a real pain.

Turns out that Dropbox was the one to blame. I already excluded Dropbox from the folders to be backed up. But Dropbox keeps its own hidden cache. Moreover, one that is not located in /Library/Cache or ~/Library/Cache. Instead, it’s located in the users home folder: ~/.dropbox/. In my case, that folder is almost 400 MB large. What’s worse, the two biggest single files, filecache.db and sigstore.db apparently change each time just one file in the Dropbox folder changes.

Even if I were to back up all files in Dropbox with Time Machine, I’d still put ~/.dropbox/ on the list of folders to be excluded from the backup just to stop Time Machine from clogging up my Macbook.

Aug 30

Cargo Cult Science

In 1974 Richard Feynman gave a memorable speech to the newbies at Caltech, establishing an interesting term called “Cargo Cult Science”. In a nutshell, it boils down to the finding that many scientists (if not whole disciplines), apparently “do science”, use all the correct scientific methods and tools without actually ever getting any real conclusions out of it. Despite the fact that his speech — and warnings — are from the 1970ies, not much has changed. In fact, it’s probably gone downhill since then, not the least because of the ever-increasing pressure of publishing more and more peer-reviewed articles.

One perfect example for “cargo cult” is statistical analysis, in particular the cult around “statistical significance”. As it goes, some methods of statistical analysis have become so widespread and commonplace that the reasons behind using the in the first place is no longer questioned. I spent hours explaining how statistical significance is not scientific significance. Much worse, in many cases these statistical analyses are just applied plain wrong or the wrong conclusions are drawn from them. Being a physicist myself, I was quite surprised to find this, mostly because these methods are rarely used in physics [1].

Since I’ve recently come across such types of “Cargo Cult Science” in Food Science and I think it´s worth highlighting a couple of the effects this has had on the research. I’ll highlight three symptoms. If you come across them, chance is that you are dealing with bad case of Cargo Cult Science:

So what’s one to do when he/she comes across those symptoms? First, always think for yourself. It’s scary to see so many people just following bad example without even considering it. Second, don’t give in too lightly, argue for what’s right and against what’s plain wrong. Naturally, a student will follow what the boss wants and I wouldn’t recommend going against that unless you want to have a decent degree. But that doesn’t mean that you should do the same when you write your paper or do your science. Third, learn to live with it and respect others even when you are convinced they are wrong.

[1] They are used of course but only when there is a necessary or sufficient reason to do so.

Aug 26

How to create secure passwords you can actually remember

I hate having to select passwords. It’s always tedious to think up something that

  1. is secure enough and
  2. can actually be remembered.

For most web sites, I have already switched over to 1Password, which also allow me to quickly generate random passwords on the fly directly on the fly in the web browser. It syncs with my iPhone too, so even the nastiest 30-character random passwords are with me all the time.

Another simple way of “creating” a relatively secure password is using the first letters of a well know phrase, e.g. the chorus of your favorite song. That way “Every breath you take and every move you make” becomes the relatively secure password “ebytaemym”. Easy. I have been using that method for really important passwords for a long time now, with the added twist of including equations from physics that I know by heart. But I realize that this might be too geeky for most :).

Finally, I just recently realized that there is another dead simple way of creating very long random passwords: hashes. That should be obvious to anyone with a little programming experience, but I have to admit that I didn’t even think about that until recently. (Caveat: Windows users need to get some software for that).

On Mac or Linux, just open a terminal window and type in

echo “hellworld” | md5

This will create the following hash: d73b04b0e696b0945283defa3eee4538, which makes in itself a nice password. And more importantly: it’s dead easy for me to remember the word I am using to create the hash. Any word or phrase you put will create a unique hash that you can nicely use as a password. The important thing to remember is that each word creates a unique hash. So it doesn’t matter on what system I create the hash, the hash function will always create the same hash value.

Some important tips for that method:

I tend to use this method now whenever I need to create passwords on the command line, e.g. sever passwords. It also works great for creating safe WiFi passwords.

Jun 11

Exporting playlists from iTunes to Synology Diskstations

I have a nice D211j “Diskstation” NAS, which essentially stores all music, photos and videos in a central place. Besides being a storage device, Synology builds in a nice MediaServer that streams this music, photos and videos to streaming clients around my place (including iTunes via the iTunes Media Server).

The built in “AudioStation” is essentially a iTunes-esque library that shows all the music that you’ve copied into the /music folder on the Synology NAS. So far so good. However, I have tons of music and while copying the files from iTunes to the NAS was easy, it does not transfer any ratings, play counts or playlists. So if I want to play any specific song on, say, the PS3, I need to click through tons of folders to hunt down the file manually. However, at least for the latter there is a relatviely simple way. This assumes that you’ve copied everything that was under

~/Music/iTunes/iTunes Media/Music

into the root of the /music volume on your Diskstation.

First, export any playlist you want to have on the Diskstation from iTunes into a file. In iTunes, just click on the playlist and then go to File / Library / Export Library:

Make sure to save the file in “M3U" format.

Now fire up your favorite text editor and open the file. M3U files are simple text files that contain the location of the song file. iTunes exports those as an absolute path, so we need to correct that. Search and replace the string (changing “Username” for your username of course)

/Users/Username/Music/iTunes/iTunes Media/Music/

and replace it simply with


Save the fie and copy it to the folder /music/playlists (create it if it doesn’t exist yet).

The AudioStation will recognize the file as a playlist.

Nice side-effect: AudioStation also allows you to download the files of that playlist from the NAS in one go.

Jun 04

Installing ImageMagick on the Mac

ImageMagick is a pretty useful little tool for editing photos, typically used from the command line. I use it quite often to batch resize photos right from the command line.

On the Mac, by far the simplest way to install ImageMagick is using Homebrew. Homebrew is a simple, Ruby-based package manager for the Mac (and people still using MacPorts or Fink should definitely give it a try!). So if you don’t have Homebrew installed, first follow the simple installation instructions given here and and install ImageMagick using

brew install imagemagick

(Note that you need XCode installed on your system so that your Mac knows how to compile the sources.)

Homebrew will now grab the source code make and build the software and that’s it.