Monthly ArchiveJune 2007
Personal Adrastos on 29 Jun 2007
The Barrelman
The ocean rolled onward in all directions, disappearing under itself in the distance. The sun pushed forcibly on the barrelman’s shoulders, threatening him with the daunting fall from the crow’s nest.
His eyes were tired. The light flashing off of the waves had filled them with dull purple, and when he did occasionally glance at his maps and the tools in his hands, the lines he had drawn only moments ago were lost to his vision. “I wonder what they’d do if I told them we’re lost”, he said aloud to himself, but quietly.
Personal Adrastos on 15 Jun 2007
I know Regex.
So far while working on the Azureus codebase, this is the most fun thing I’ve done: Learning a bit of regular expression syntax in order to use Sed. I was trying to get a diff of the classes between BitTyrant and the Azureus 2.5.0.0 source on which it is based. Here’s what I did:
1. Extract the source .tar.gz files into a directory.
2. The BitTyrant codebase includes a lot of “CVS” folders which will show up in the diff, and I don’t want them or need them. Find cannot remove directories with ‘find -delete’, and rm can’t do search. So here’s what I did:
adrian@kashra:~/Projects/BitTyrant/diff$ find ./ -name "CVS" > cvsfolders.txt
adrian@kashra:~/Projects/BitTyrant/diff$ sed -i 's/^/rm -rf /' cvsfolders.txt
adrian@kashra:~/Projects/BitTyrant/diff$ bash ./cvsfolders.txt
By the way, sed’s ‘-i’ option tells it to edit the file in place. ’s/^/rm -rf /’ tells it to insert at the very beginning of each line “rm -rf “.
3. Then we run our diff:
diff -iEbwBqrN Azureus BitTyrant > difffiles.txt
quick explanation of the options at the beginning:
iEbwB: All for ignoring whitespaces in different context. I’m pretty sure not all of this is necessary, but I did all of them.
q: Output filenames only.
r: Recurse on directories.
N: Treat absent files as empty (meaning display that difference).
4. Now each line in the file difffiles.txt looks like this:
Files Azureus/com/aelitis/azureus/core/dht/db/impl/DHTDBImpl.java and BitTyrant/com/aelitis/azureus/core/dht/db/impl/DHTDBImpl.java differ
so for our eyeballs’ sake, we run the following:
adrian@kashra:~/Projects/BitTyrant/diff$ sed -i 's/Files\(.*\) and BitTyrant\///' difffiles.txt
adrian@kashra:~/Projects/BitTyrant/diff$ sed -i 's/ differ//' difffiles.txt
adrian@kashra:~/Projects/BitTyrant/diff$ sed -i 's/\//./g' difffiles.txt
adrian@kashra:~/Projects/BitTyrant/diff$ sed -i '/.java/!d' difffiles.txt
adrian@kashra:~/Projects/BitTyrant/diff$ sed -i 's/.java//' difffiles.txt
These are, in order:
- Remove everything up to the first subdirectory under BitTyrant (in this case “com” or “org”)
- Remove that last word ” differ”
- Replace all “/” with “.” so that it’s similar to eclipse names
- Selectively delete any line not containing “.java”
- Remove .java from the remaining lines.
Now each line will look like:
com.aelitis.azureus.core.dht.db.impl.DHTDBImpl
Yay! And it’s only… 46 files! Remove the UI business and i now only have to look at 31 files!
I realize this is not the most complicated use of Regex, but given that I haven’t looked at its syntax since Algorithms (and I barely looked at it then), I feel pretty good about myself.
Geekdom & Personal Adrastos on 12 Jun 2007
The Bittersweet Hypothesis
Bittersweet Symphony
A song by The Verve, with a fairly large sample from an orchestral song by the Rolling Stones, this song was in the end the Verve’s downfall, as they can no longer play it without the Mick Jagger’s permission.
The song is most notable for the Bittersweet Hypothesis, outlined below. The phenomenon was noted by the University of Awesome’s own Professor Adrian during his research on Jesus’ iPod
The Bittersweet Hypothesis
The hypothesis states that, for all music players, as the time of ownership of said music player increases, the probability of that player containing The Verve’s Bittersweet Symphony approaches one.

Exhibit A: Topical graph outlining the basis of the hypothesis
Supporting Evidence
- If you have a music playing device, take it out.
- Turn it on and look for Bittersweet Symphony.
- If it’s there, I told you so.
- If it isn’t, it’ll probably be there soon. Also, you’re an outlying data point.
Consequences
The consequences of the Bittersweet Hypothesis are dire. The most important one is that this song may cause severe clogging of the tubes.
There are over 7 billion people in the world. if one in 20 people have portable music devices, that makes 350 million such devices. Each one will in all probability eventually cause a download of Bittersweet Symphony, which is approximately 4 MB, or megabytes, or million bytes. This turns into 1.4 Billion megabytes, or 1400 Terabytes of the same song repeated over and over. Now, remember that for most portable devices, the song is also repeated on a personal computer, doubling the number to 2800 TB of the Bittersweet Symphony.
Just for good measure, that number is roughly 2,800,000,000,000,000 Bytes, which are 8 bits each, 11,200,000,000,000,000 bits (Eleven thousand two hundred million bajillion infinity).
Solutions
Several solutions have been proposed to resolve this issue. One is to create a central data center to store a single copy of the 4 MB file, and then every music playing device would have to stream it from there, but unfortunately this does not resolve the problem of clogging the tubes, it only reduces the places it ends up stored.
According to Joshua, the supercomputer from War Games, it is “an interesting game. The only winning move is not to play.†It has been suggested that the song be banned from the tubes in order to protect them from this magnitude of clogging.
