March 3, 2013
Flame Challenge
I've entered the Flame Challenge. The challenge, specifically, is to answer the following question, scientifically (i.e. not poetically), for an 11 year old, in 300 words or less or as a graphic or video entry. The entries will be judged by 4th-6th graders in schools in the USA. It was too much of a challenge for me to resist, and now that the deadline has passed I can reveal my answer:
What is time?
Imagine looking at every slice of a loaf of bread, one by one, starting with the crust at one end and progressing towards the other. First you'd see the crust, then you'd see all the slices from the middle of the bread. If the loaf had an air bubble inside, then you'd see a hole in some of the slices. The slice from right at the edge of the bubble would have a small hole, and the ones which were cut right through the middle of the bubble would have bigger holes. On your way through the slices, you'd see a small hole first, then a bigger one, then another smaller one, then no hole at all.
The passing of time from moment to moment is like moving from one slice to another. Many things stay the same, just like every slice of a loaf of bread looks roughly the same, but some things change --- like the sizes of the holes in the bread slices. Things that change quickly, like an explosion, look very different from one "slice" to the next. Things that aren't changing at all look exactly the same in every slice. Something that's moving, like a car, changes its position from one slice to another.
When you think of time this way, you see that the passage of time is quite similar to moving along in distance. This is actually how scientists often think about it, too. Have you heard of Einstein's Theory of Relativity? That's based on treating space and time as very similar things. The main difference is that we have no choice but to move forwards in time. You can choose to stop moving through the slices of bread and spend longer looking at a particular slice, but you can't stand still in time!
My approach was to make the link between the dimension of time and the dimensions of space by using a familiar household object. There's so much more that I could've added with a longer word limit, like how things can be measured in time and space by creating an object that changes its appearance regularly along the dimension of interest. A ruler is just a stick which looks slightly different as you move along its length (the numbers go up), and a clock is just an object which looks slightly different as you move through time (the hands go round). You can even extend the concept of a crystal to dimensions of time as well, making a space-time crystal. What I find most interesting of all is how our perception of time is linked to its physical reality: exactly why are we compelled to advance through time, while having apparent free will concerning our movements in other dimensions? Is it all in our heads? Perhaps somehow related to the second law of thermodynamics applied to the physical and chemical processes in our brains?
The winners will be announced at the World Science Festival in June this year. In the unlikely event that I win a trip to NYC at that time, I'll be flying in a highly sleep-deprived state from an experiment at the Linac Coherent Light Source.
November 27, 2012
Ten years of Sylpheed
A whole decade later, I'm still using Sylpheed almost every single day. In all that time, text editors, web browsers, version control systems, desktop environments, IRC clients, IM clients, window managers and even types of input device have all come and gone from my computing environment. Sylpheed simply never gave me any reason to replace it. In ten years, I think I can remember it crashing a single digit number of times. It's always one of the first things I install on a new machine - and my current laptop is my third such new machine since then. That's not including two work machines, where it was also the first thing I installed.
Discounting things like the kernel, SSH, the X server and so on, the only other program that's achieved this is GKrellM, and that's only because the Sylpheed email prompted me to think about and remember it. In fact, not even the X server has survived these ten years: in 2002, it was XFree86.
An impressive feat, and a mark of true software quality. If anything I produce lasts ten years on even one person's screen, I'll be very happy indeed!
Which programs, if any, survived the last ten years on your desktop?
August 9, 2012
Reproducible random ordering from "sort -R"
So, if you need to get the same random order of lines each time, as I did for a test script, you need to provide your own source of "random" numbers. Any old binary file will do, for example:
$ sort -R --random-source=/bin/ls
March 2, 2012
Remote control repair
Anyway, in case anyone's interested, the model was a Panasonic SC-HT520 and the replacement part I used was a Vishay TSOP 1838 (example , but the photo shows the wrong thing) which uses a 950 nm wavelength and a 38 kHz carrier. The pin assignments are exactly the same as the original one from the player, so you just have do undo some screws (hint: take the grey panel off the front of the DVD tray before disconnecting the power), desolder the old one and solder the replacement. The tracks on the PCB are nice and large, so it's dead easy. Total cost: €1.55, and about half an hour (plus many hours of research and figuring out what would be suitable, but that doesn't count).
I remember reading somewhere that the receivers on certain Panasonic units often seem to go bad, so if anyone is interested and needs more guidance than the above, post a comment here and I'll put some photos up.
October 4, 2011
Project X
For the last few months I've been working on a new non-work project as well, which I'm not going to say too much about just yet - let's call it Project X for now. It's a piece of major "itch scratching" for me, but I have a feeling that many other scientists who use Linux will love it. Perhaps many other people besides. Watch this space...
July 6, 2011
Command line weight loss
$ sudo setweight --bmi=21It'd be nice if it were that simple. But it almost is!
Scales of Truth is a command line implementation of The Hacker's Diet. The basic principle is to lose (or gain, I guess, theoretically at least) weight by taking an engineering approach to your body's energy requirements. There are quite a few implementations of this or similar things (e.g. The Hacker's Diet Online and Physics Diet), and an important feature is that the required day-to-day administration, i.e. typing in your weight, is not very time-consuming. Less than five minutes a day? Well opening a website, logging in, typing a value in and so on seems like a lot of work to me. With Scales of Truth, you simply click over to one of the many terminals you no doubt have open, and type:
$ sot XXXWhere "XXX" is your current scale reading (in your choice of unit). Scales of Truth does all the necessary calculations, backs up your readings using Git (because losing months of figures would really suck), and displays some interesting statistics:
Current mass estimate: XXX kg (instantaneous BMI XX.X kg/m^2)
7-day change: -.42 kg (-1757.2 kJ or -419.9 kcal per day)
30-day change: -2.77 kg (-2704.2 kJ or -646.3 kcal per day)If you happen to miss a few readings, it interpolates the missing values automatically so your running average stays up to date. For the average reader of this site, the whole procedure probably takes slightly less than two seconds. That is, assuming you can resist taking a look at your progress using "sot --graph":
You can download Scales of Truth right here. Simply download the file, open it in a text editor, satisfy yourself that it's not going to do anything evil to your computer, then follow the instructions.
October 31, 2010
The T Word
A criminal does not become a terrorist because of which country they came from, because they choose to attack aeroplanes, because they are religiously or politically motivated or because they use bombs. They become a terrorist because we respond with fear and define them as such. Well, we can choose not to do that.
Everyone should remember that the perpetrators of the recent cargo plane bombing, the Times Square bombing, the underpants bombing, the liquid bomb plots, the 2007 London and Glasgow attacks and countless others (at least in the "Western world") did not succeed.
September 13, 2010
Trackball Configuration
Option "Buttons" "9"
Option "EmulateWheel" "on"
Option "EmulateWheelButton" "9"
Option "ButtonMapping" "3 8 1 4 5 6 7 2 9"
That worked until the business of HAL for X input configuration came along. Then I put something like this in /etc/hal/fdi/policy/trackball.fdi:
<deviceinfo version="0.2">
<device>
<match key="info.product" string="Logitech USB Trackball">
<merge key="input.x11_driver" type="string">mouse</merge>
<merge key="input.x11_options.Buttons" type="string">5</merge>
<merge key="input.x11_options.EmulateWheel" type="string">true</merge>
<merge key="input.x11_options.EmulateWheelButton" type="string">9</merge>
<merge key="input.x11_options.ZaxisMapping" type="string">4 5</merge>
<merge key="input.x11_options.ButtonMapping" type="string">3 2 1 4 5 6 7 8 9</merge>
<merge key="input.x11_options.MinSpeed" type="string">0.40</merge>
<merge key="input.x11_options.MaxSpeed" type="string">0.60</merge>
<merge key="input.x11_options.AccelFactor" type="string">0.010</merge>
</match>
</device>
</deviceinfo>
That worked, but never quite satisfactorily. In some versions, the trackball would only work properly if plugged in after I'd booted up and logged in. In later versions (notably Fedora 12 and 13) it would never work correctly at all. In Fedora 13, the HAL method was deprecated and replaced with a method via files under /etc/X11/xorg.conf.d/. I added a file called "01-trackball.conf" containing:
Section "InputClass"
Identifier "trackball"
MatchProduct "Logitech USB Trackball"
Option "Buttons" "9"
Option "EmulateWheel" "on"
Option "EmulateWheelButton" "9"
Option "ButtonMapping" "3 8 1 4 5 6 7 2 9"
EndSection
Section "InputClass"
Identifier "trackpad"
MatchProduct "SynPS/2 Synaptics TouchPad"
Option "ButtonMapping" "1 2 3"
EndSection
These lines define the exact button configuration for both the trackball and the trackpad, and the combination of InputClass and MatchProduct means that the rule works even if the trackball isn't present when X starts.
But it still didn't quite work. It seemed that the settings always got overridden by Gnome's central mouse options, left or right handed but not my strange mixture. The main buttons (left and right click) on the trackball had to be the same as the trackpad because Gnome couldn't understand the idea of having the two configured differently.
With a little clear thought, it's probably already obvious what was going wrong, though it was infuriating for a long time. Gnome (specifically gnome-settings-daemon) does indeed override your nicely thought out X config. Fortunately, besides "left handed" and "right handed" modes, it also has an extra mode called "don't screw with my damn setup you piece of ****". It just takes a little more surgery to enable:
$ gconftool-2 -s /apps/gnome_settings_daemon/plugins/mouse/active --type bool false
With Gnome's mouse config stuff safely (and permanently) anaesthetised, you're clear to configure things your way again.
August 22, 2010
Thinkpad DVD Noise
One problem I've been experiencing with my new(ish) Thinkpad T500 is the large amount of noise made by the DVD drive. It's loud enough to be distracting when watching a film - not quite enough to drown it out, but enough to be clearly heard over even the louder parts until your mind starts filtering it out. The tray rattles against the casing, which makes it much worse. I found the noise could be reduced significantly by squashing one or two bits of folded tissue between then tray and the casing above, but that's a nasty solution.
Of course, there's a proper fix for this. Just go into the BIOS config (press the blue ThinkVantage button when the BIOS boot screen shows up, hold it down until the message goes away, then follow the instructions), and find the options for the CD drive, and set it to "Silent". Problem solved - the drive becomes almost inaudible, and it doesn't seem to have any adverse effect on the playback of DVDs.
June 30, 2010
iAudio X5 Tagging
It does, however, have a particular weirdness when handling Ogg/Vorbis files. Its tag parser is extremely basic, and apparently just skips one character (the equals sign) after finding the letters "ARTIST" in the tags. But most recent ripping software adds an extra field, called ARTISTSORT. The X5 often finds that instead of ARTIST, and thinks the name of the artist is something like "ORT=Haza, Ofra" instead of "Ofra Haza".
So, I wrote a little script to remove the ARTISTSORT tags altogether. It's a cheap solution - it'd probably be better just to move that tag to the end (possibly the start, I didn't really test) of the tags field, but this field isn't used for sorting on the X5 anyway.
Here's the script ("
ogg-retag"). It's really simple:#!/bin/sh
if [ -e ogg.tags ]; then
echo "ogg.tags file exists. Please remove it first."
exit 1
fi
for FILENAME in "$@"; do
echo "Processing "$FILENAME
# Dump tags to file, removing ARTISTSORT tag
vorbiscomment -l "$FILENAME" | grep -v "ARTISTSORT=" \
> ogg.tags
# Write tags back
vorbiscomment -w -c ogg.tags "$FILENAME"
done
rm -f ogg.tags
To run, simply "cd" into the folder containing the problematic Ogg/Vorbis files, then run "ogg-retag *.ogg" or similar.
Recent Comments