Aristotle & Science.

I’d never really come across classical philosophy until partway through my Education degree. We did a philosophy of education subject, and around the same time I happened across Stephen Jay Gould’s books. And I realised how some historical figures - most notably Freud & Aristotle have shaped our ideas of the world. And in some cases held back the progress of science by decades, or even centuries. The most obvious examples are the elements, and the planets. Aristotle pushed for the acceptance of the 4 Elements theory - Earth / Air / Fire / Water, and it took centuries for more reasonable theories to take over. Four of anything is usually pretty neat - especially if you can pair them up on axes at right angles to one another and have a continuum. And having four elements means you can associate them with your four humours. Now there’s a classical mistake that cost countless lives! The furore over planetary gravitation is another cause of concern. The most worrying thing is that there were Classical Greek scholars who decided that the Earth orbited the Sun. But not Aristotle. Think of where we might be now if we’d figured this one out 2000 years ago. Freud and his fixation on sex held back psychology decades. And his work was all based on half a dozen patients. Nothing like a small (non-random) sample size to skew results. I think I could formulate a coherent theory of mental illness related to facial hair with a dozen or less carefully chosen subjects. And now I read (and realize) we have more than 5 senses. And the whole sight-sound-touch-taste-smell gimmick is down to the big A. I mean, it’s obvious to anyone who’s had a cold that taste and smell aren’t independant. And you can ‘feel’ when you are in a changing gravitational field, like an accellerating elevator. And there are others I hadn’t even thought of. We sense when we are hungry, or need to urinate. We know where our limbs are. NewScientist had an article naming 21. But my favourite is the Circadian Rhythm. Knowing when to get up. I think mine is broken.

Ratings on the Fly

So far, the program I’ve written does this: Monitor the current track, and how much of it has been played. Wait for a click on the Next (»|) button, and when it occurs, rate the song up or down according to the modifier: abs((amount played / song length) * 15) - 5 Thus, when a song is skipped immediately, it loses 5 rating points, songs that are clicked at the end receive a +10 modifier. The only problem is that this is only triggered when this program wants the next track. I need a robust method of…I’ve just thought of something. I’m getting close to getting this to work - when the song is changed, the track id is used to find the song in the library, and the last known rating modifier will be applied to the song’s rating. It just doesn’t do that yet!

AutoRater

Done! iTunes AutoRater runs in the background, monitoring the currently playing song in iTunes. When the song changes, it up- or down-rates it according to how long the song played for. What I will(may?) do is merge this code with that for iTunesRater, so that you can rate songs, and it will also Auto-Rate them. Maybe I won’t do this, since these two are separate tasks. I wonder if the current ratings are a little aggressive: -5/+10 seems like a big change. I’ll take feedback, and in a future version (perhaps I’ll make this a preferences panel, where you can choose the maximum rating changes. Anyway, version 0.1 is available. Caveat User! (Back up your iTunes Library regularly!)

SMB devices disconnect on sleep.

That title pretty much sums it up. If you have an SMB server mounted, and you put the Mac to sleep, then the server is no longer mounted when you wake it up. Windows XP does not have this problem. Windows XP also mounts all servers it can find, removing the need for hacks like creating a mount script and putting it into your LoginItems.

iTunes Auto-Rater

One of the comments to my MacOSXHints.com hint about rating iTunes songs with ratings other than the simple 0-5 stars gave me an idea for a program. Basically, it’s a daemon/controller for iTunes, that sits there and monitors the currently playing track. The rationale is that if you listen to the whole track, you like the song and want to increase the rating, and if you skip it, you are getting a bit sick of it, so you want to reduce the rating. Since there is no way to determine when a track changes, you have to continually poll iTunes for the track info. What you could do is when a new song is discovered, store the track length in a variable. Then, keep track of the amount of time that that track remains playing, and if it is close to the full track length (say, 95%?) then increase the rating. If you only listened to a small part of it, then reduce the rating. You could even have it so the rating is increased/reduced by 1 for every 5% of the song either side of 50% that you listen to. Or, you could just have it so it either increases (by 10?) or reduces (by 5) at a certain threshold. Writing this program as an AppleScript Studio program should be quite simple. UPDATE: Visit AutoRater for details on the first working version.

iTunes Consolidate Library

The iTunes menu item ‘Consolidate Library’ gathers all music & files in the library, and copies them to the library folder if they aren’t already. However, if you have multiple users with a shared library folder, to reduce space usage, and both users consolidate to a new location, iTunes will create 2 copies of each track. What I’ll need to do now is delete the second copy of each track (seems simple, since all 2nd copies end in 1, but some songs also end in a 1!), and then find a way to ’re-attach’ the missing tracks to the file they should correspond to. To delete files:

1
2
$ cd <Music Folder>
$ find . -name "* 1.m??" -newer <file of correct age> -exec rm {} \;

To reattach:

1
2
3
4
5
6
tell application "iTunes"
    --if song location is unknown then 
    --attach file according to 
    --it's track_number, title, 
    --artist and album details
end tell

Coding on Palm

I don’t write too many blog entries on my Zire (thanks to Jason, I’m not game to call it my Palm), and I just remembered why. It takes ages to enter data, and the error rate is too high. I was just trying to write a program in python (to run at home - I need to reinstall it on my Zire) and writing commas in particular is quite difficult. I might get around to buying a keyboard, or maybe just a laptop! I kind of like graffiti, but I wonder what the Palms with a keyboard are like. Using a retractable pen with the tip up is more comfy than the stylus.

Transferrence (iTunes Library Migration)

I’m putting my whole iTunes Library, and all of my iPhoto pictures, and the various movies I’ve collected onto my NSLU2. To shift the iTunes library, I just changed the library location in the Advanced Preferences, and then Consolidated the Library. I’m hoping I’ll be able to do exactly the same with Jaq’s and it won’t actually have to copy the files across, as they will already be there. It will be interesting to see how clever it is. It takes a couple of hours to transfer the many gigabytes of music I’ve encoded, so hopefully it won’t have to be completely redone. Either way, it will keep all of my ratings, and so forth. My tip for sharing songs from a library between multiple users - just point all of the iTuneses at the same location for storing the files, and make sure all of them are set up the same in terms of organising. When one person adds songs, the others just need to drag the folder/disk onto the iTunes Library icon in iTunes, and only the new files will be added. There are occasionally issues when someone changes an album or track name, but iTunes seems to cope pretty well most of the time.

NSLU2 on MacOS X

The instructions for installing an NSLU2 are designed for using a Windows box - but it’s easy enough to set it up using any OS. Just use the web server built in, and use an address of 192.168.1.77 and username/password of admin/admin. Following the NSLU2-Linux instructions on unslinging is easy too, except I didn’t know what to do after unslinging and rebooting - ie I cannot telnet back into the box! What you need to do is change the password after connecting the disk but before rebooting: # passwd [enter new password twice] # cp /etc/passwd /share/hdd/conf/passwd # ln -sf /share/hdd/conf/passwd /etc/passwd Then you need to reboot (or maybe you don’t, I did just to test the password stuck!), re-enable telnet login, and you can begin to install packages.

iTunesRater 0.1

As much as I like to bitch and moan about AppleScript, AppleScriptStudio isn’t too bad for creating simple applications. In a couple of hours, I just wrote a simple stand-alone application that monitors the current song playing in iTunes, and allows rating to occur, independent of the iTunes window. It also allows for a larger range of values as the rating, rather than the iTunes 0-5 stars. The tick marks are on the slider so you can see what the current rating will be in terms of the iTunes display. Features:

  • Automatically updates display from iTunes when song changes
  • Automatically updates iTunes rating whenever it’s changed
  • Allows for more flexible rating than basic iTunes, and most other programs capable of changing ratings.
  • Unobtrusive, can sit in the corner of the screen while working.

Limitations:

  • Ugly icon

I take no responsibility if this toasts your iTunes library - I use it with mine, but your mileage may vary. Here’s a little screenshot, and the archive is iTunes Rater. (Only Version 0.2 is still available!) Itunesrater The AppleScript code is IMHO interesting: