iPod fragmentation; a cautionary tale.

On the way out the door from work today, I put in my earphones and fired up my iPod so I could rock out on the train home. To my frustration, the opening riff of my chosen song stopped abruptly and after nearly a full second, picked up where it left off only to be interrupted again every few seconds for the rest of the song. This behaviour itself was not new, it had happened a few times before, and was confined to a few songs and a much lower frequency. The afflicted songs were promptly re-ripped which seemed to solve the problem, but not today. As I skipped to the next song, it too choked and cut out, as did the next one, and the next one….

Exasperated, I stuffed my iPod back in my bag and resolved to resolve this at home. Staring out the train window I had a feeling that it might be worth defragging the poor thing. Over the last two weeks it had become a beast of burden, carrying gigs of digital goodies from my bittorrent download folder at home to my DVD burner at work. Low and behold:

Volume fragmentation
Total fragmentation = 6 %
File fragmentation = 13 %
Free space fragmentation = 0 %

Fragmentation is bad for iPods.

After a long slow defragmentation it now plays without a hiccup. Yay!

Advertisements

But I don’t feel retro…

Lately I have had a hankering to play some of the classic video games I remember from my childhood. I have many fond memories of playing metal gear with Aaron and my Dad, and of working my way through Super Mario 3 and Zelda during cookie fueled sleep overs with my friend John King. Funny how these things stick with you. Well I am happy to report that you too can satisfy the urge to revisit your childhood thanks to the thriving retro gaming community on the web. All you need is an emulator like Nestopia and a few ROMS.

Ninja Gaiden 2

Some of my favorites are Super Mario 2 and 3, Ninja Gaiden 2, Zelda and, strangely, Duck tales. You can find just about anything else you might want on Rom nation.
I am struggling to remember some of my other favorites. There was one with a special tank thing that you had to jump around like a character and a few others that are on the tip of my brain.

As a bonus you can also get the original controllers tricked out with USB connectors for the hardcore among you.

Legend of Zelda

Rockbox and Battery bench.

As cool as it is that I can get my iPod to play Doom and stuff, all that comes with a price; battery life. Noticing that it seems to go through batteries pretty quickly I thought I would take a look at the battery usage of my iPod with a cool little utility included with Rockbox called Battery Bench.

What I did was turn off the backlight and set the player to shuffle play a massive playlist until the battery dies. Battery Bench logs the voltage and whatnot into a textfile in the root directory of the iPod so you can figure out what your player is doing. The result? 5 hours 40 minutes and 42 seconds of playback.

Battery bench results

I am not sure how that compares with other iPod video players but it seems kind of short to me. I have seen people posting results of 10+ hours for other players. Even that time is cut pretty dramatically if I start doing a stuff that involves backlight (i.e. Doom or Arknoid). Ultimately the longevity of the battery is not that big a deal for me. If it gets me to work they I am happy but I am hoping that future versions can improve that a bit (or alot). As Rockbox evolves I will run more of these bench tests and post the results.

Netstat

Netstat is one of those programs that most computer people use but very few understand. Because I am one of those people, I decided to write this to change that. Netstat displays a listing of network connections that and their status which can be very useful for anyone concerned with the security of their machine. Not only does it tell you who your machine is talking to currently but it also tells you if there are programs listening to accept connections from foreign computers. Typically the output of the command is pretty alarming because of the startling number of connections and pretty arcane descriptions that go with them:

C:\>netstat -ano

Active Connections

Proto Local Address Foreign Address State PID
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1104
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:1025 0.0.0.0:0 LISTENING 1336
TCP 0.0.0.0:2996 0.0.0.0:0 LISTENING 2912
TCP 0.0.0.0:3172 0.0.0.0:0 LISTENING 2912
TCP 0.0.0.0:3173 0.0.0.0:0 LISTENING 2912
TCP 0.0.0.0:5000 0.0.0.0:0 LISTENING 1672
TCP 74.104.77.xxx:139 0.0.0.0:0 LISTENING 4
TCP 74.104.77.xxx:3071 12.120.5.14:80 TIME_WAIT 0
TCP 74.104.77.xxx:3172 72.14.207.99:443 CLOSE_WAIT 2912
TCP 74.104.77.xxx:3173 72.14.205.83:443 CLOSE_WAIT 2912
TCP 127.0.0.1:2995 0.0.0.0:0 LISTENING 2912
TCP 127.0.0.1:2995 127.0.0.1:2996 ESTABLISHED 2912
TCP 127.0.0.1:2996 127.0.0.1:2995 ESTABLISHED 2912

Probably the most confusing column is the local address column. Your computer always has at least two (and sometimes more) IP addresses that it will answer to. The above example shows that the computer will answer to 74.104.77.xxx and 127.0.0.1 (the computers equivalent of “me”). The three addresses shown have different and special meanings.

127.0.0.1:port#programs listening on this address will accept connections originating from only the local computer.

74.104.77.xxx:port#programs listening on this address will accept connections originating from computers on the network/internet.

0.0.0.0:port#programs listening on this address will accept connections from anywhere, local or remote, sent to any of the addresses the computer will answer to (in this case 127.0.0.1 and 74.104.77.xxx).

The State column refers to the state of the TCP connection. You won’t see this for UDP connections because the don’t have state like TCP does. Here is the list of options (plagiarised from some site I don’t remember):

LISTEN – represents waiting for a connection request from any remote TCP and port.

SYN-SENT – represents waiting for a matching connection request after having sent a connection request.

SYN-RECEIVED – represents waiting for a confirming connection request acknowledgment after having both received and sent a connection request.

ESTABLISHED – represents an open connection, data received can be delivered to the user. The normal state for the data transfer phase of the connection.

FIN-WAIT-1 – represents waiting for a connection termination request from the remote TCP, or an acknowledgment of the connection termination request previously sent.

FIN-WAIT-2 – represents waiting for a connection termination request from the remote TCP.

CLOSE-WAIT represents waiting for a connection termination request from the local user.

CLOSING – represents waiting for a connection termination request acknowledgment from the remote TCP.

LAST-ACK – represents waiting for an acknowledgment of the connection termination request previously sent to the remote TCP (which includes an acknowledgment of its connection termination request).

TIME-WAIT – represents waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its connection termination request.

CLOSED – represents no connection state at all.

Hopefully that will help make sense of the output netstat gives. It helped me at least :)

The man behind the mess.

While working for General Motors in 1921, Tomas Midgley Jr (then 32) discovered that adding tetra-ethyl lead to gasoline would stop “engine knock”, and leaded gasoline was born. On February 1, 1923, Dupont, Standard Oil and GM started selling tetra-ethyl lead (TEL) through a Corporation called the Ethyl Gasoline Corporation. It still exists today under the name “Ethyl Corporation“.

Of course lead is highly toxic and working with it is very dangerous. Ethyl Gasoline Corporation employees suffered a rash of deaths and dementia which the company, and Midgley himself (in spite of having a lead poisoning incident of his own), tried their darnedest to cover up. Thanks to the atmospheric lead produced by burning Midgley’s leaded gasoline, you and I have 625 times more lead in our blood than people before 1923[1].

Tomas Midgley Jr.

In 1930 Midgley then turned is unique talents to finding a safer gas that could be used in cooling systems such as refrigerators. What he came up with was Chlorofluorocarbons (CFCs) which were promptly added to everything from hairspray to air conditioners. We now know that a single kilogram of CFC’s can destroy 70,000 kilograms of ozone[1].

In 1940 Tomas Midgley was stricken with polio and, bedridden, invented a system of ropes and pulleys to help him move around. In a karmic twist Midgley became entangled in the ropes and was found strangled to death in 1944, long before he could learn that his second invention was doing to the world what his third invention did to him.

[1] Bryson, Bill. A Short History of Nearly Everything. (2003) Broadway Books, USA. ISBN 0385660049

Rockbox lives up to its name!

As cool looking as it is, the iPod is just a screen and a thumb wheel mounted on a laptop hard drive. With that in mind why can’t I use it as a hard drive? I could just drag and drop my music on my iPod without ever needing to install iTunes. If my computer died I could copy the music from my iPod back to my new computer without batting an eye.

While we are at it how about the ability to play music formats I want (Ogg Vorbis, Flac etc) to use rather than the 4 Apple approves of and the restrictions that come with them? Don’t get me wrong, Apple is a first rate industrial design company, but it feels a little like the RIAA has been talking to their development team.

The real problem is that in spite of all that, the iPod hardware is so much nicer than anything else and I still want one. Fortunately there is a resolution to this cognitive dissonance: Rockbox. Installing it on your iPod instantly gives you gapless playback, UMS (Making your device operate like a USB harddrive), support for replaygain and lossless audio formats as well as Ogg Vorbis and just about every other format I can think of.

rockbox

I stumbled upon the Rockbox project about a year ago and have been watching with interest as it steadily added support for more players. When it finally added support for the iPod, I began seriously looking at getting one. Finally, Last time we were at Costco, Jenn suggested that since the price was good and there was a nice return policy in case the Rockbox thing did not work out, that I might want to take my birthday present a little early. As it happens she and my Mum and Dad had decided to split on one for me! YAY!

The first part of the installation involves finding the iPod backing up the Apple firmware and installing a boot loader that will allow you load rockbox instead of the Apple firmware. Once the bootloader is in you just need to drop the files from the appropriate build into the root directory of your iPod and then reboot it.

I have been playing with Rockbox for a few days now and am thrilled with it. It still has some rough edges in the interface and the video playback is not there yet but when the speakers are shoved directly into your ear as they are with headphones you really appreciate the quality of the Ogg Vorbis and lossless Flac files. It can even play Doom! Needless to say, it does not appear that I will be needing that return policy. To all the developers working on the Rockbox project, great job, rock on!

rockdoom

Thanks to Jenn and Mum and Dad for the awesome, and somewhat early, gift!