Mar 09 2010

The clean code of the soul

Published by Amir under Thoughts

I like to take pride in the code that I write. I like order and efficiency in general, and specifically in what I create and use. It therefore bothers me to see messy code, which usually includes layers upon layers of patches, each an attempt to fix / work around / cover up bugs in previously written lines of code. My approach is that you should write with the forward vision of changes to come. Any future features / bug fixes should be easy to implement and add, because the code was originally written to be easy to read and easy to understand and was planned to be modifiable and maintainable.

Most importantly, if you reach a point where the existing code does not allow you to do this (either because it was written badly or because the new features require unforeseen overhauls), then scrap it and re-write with your new vision. It will save you much frustration now, as opposed to trying to debug ugly patches, and later on when you encounter the need for even more features and bug fixes.

Naturally (for me, anyway) I expected to use this approach with regards to myself. My attitude towards my own mental processes was that if something isn’t working properly then I should fix it. If this meant learning new behaviour I expected to delete the old behaviour as part of that process. I’ve lately been taught that humans just don’t work that way.

A physiological example is in the development of the nervous system. Babies are born with certain reflexes, for example, which seem to disappear in later age. In fact the ‘circuits’ for these original reflexes aren’t removed, but newer so-called ‘circuits’ (patches in the code) grow and / or mature, which overpower the originals, and effect a new and different behaviour of the system. Again, the original mechanism is still there, underneath the patches. Certain neurological trauma may even disable the overpowering mechanism, exposing the original response as exhibited by newborns.

Our mental faculties are similar.

As children we’re more prone to react immediately to our urges, disregarding or even unaware of the needs of anyone around us or of the limitations of our current environment. Growing up we learn to take into account all of the factors around us and restrain ourselves as necessary. We learn that some urges can be satisfied here and now, some can be satisfied somewhere else and now, some will wait for later, and some will not be satisfied at all. We also learn to differentiate between these cases. In fact it seems that this learning fills up most of growing up.

It’s easy to know this, but not always easy to achieve it (How many adults have you seen behaving like children only today?). The thing is that I had expected this process to include the writing off of the childish urges. I had expected to delete their code and replace it with the clean and efficient code of adult behaviour. But it doesn’t work like that. The urges stay. You just have to write really good patches.

No responses yet

Jul 12 2009

Let me tell you something about air conditioners

Published by Amir under Rants

It’s hot in Israel. Really hot. On the coastal area (Tel Aviv, Netanya, etc.) it’s also very humid (usually above 75% humidity). This is not even the peak of the season yet, and we suffer outside.

Still, I almost daily find myself shivering from it being too cold in the office. I go to the air conditioner controls and find them set at 18 degrees Celsius. This is so stupid and it just boggles my mind at how people, especially my coworkers, who are electronics engineers, have no idea how air conditioners work.

So here’s the low-down:

Air conditioners have no way of controlling the strength of their operation.

The only thing they control is the compressor: they can turn it on or off. It doesn’t matter how low you set the thermostat – they won’t cool the air faster. It will simply cause the air conditioner to try and reach an even lower temperature, meaning that the compressor will work for a longer time. If you want the room temperature to be 25 degrees Celsius you can set the thermostat to 25 or to 16 – it will still reach 25 just as fast. The only difference is that when set to 25 it will stop the compressor there, but when set to 16 it will keep it on until reaching 16 degrees (which is very hard to achieve and will probably never occur).

Now in my office the thermostat is pretty uncalibrated, so a reasonable setting is 21. Fine, set it to 21! Why 18?!

The only other thing that you can set on air conditioners is the fan speed. This, in fact, will probably cool the room faster if set higher, for obvious reasons. But this is rarely used in practice – only the let’s-freeze-Amir’s-ass setting.

No responses yet

Jul 05 2009

iPod Classic (160GB) Review

Published by Amir under Consumer Review

A few years ago a friend of mine told me triumphantly that he had (finally) figured out how to get along great with Windows. He said: “Just don’t try to fight it. If it wants you to put your music in ‘My Music’ – put it there. Same thing for My Photos, My Documents, etc.” As ridiculous as that may sound, he was dead serious. Recent experience with a new iPod are repeatedly reminding me of his advice.

I was (and still am, actually) a proud owner of an iriver H340. It was an awesome music player to begin with (not to mention video), with a keen user community, even. But it got exponentially better with the introduction of Rockbox – one of those amazing open source projects where users take control of the product and make it a gazillion times better. I didn’t mind people gawking at the size of it (most of them didn’t even realize that for 40GB you need a much bigger player than their nano-knockoffs).

However, more and more the 40GB capacity of the H340 was a limiting factor. With over 100GB of music at home, I was simply forced to travel with only a fraction of my music. For most people I guess this is not an issue. They seem to get along fine with those tiny 4GB players. But I have my own preferences and the main one about music is that I want to have any song that I like (and have) immediately available to me on the go.

So I checked my options: Replacing the drive on the H340 is possible, but limited. The other option is to buy a new player.

There are other choices on the market, but eventually I settled for the iPod Classic 160GB. It’s not even made anymore, so I bought it second-hand, but that made the deal sweeter – came pretty cheap, when compared to a new device. I knew that Apple’s products are very limiting, but I figured that I’d figure out a way to work around this. After all, 160GB in such a small sexy package is worth it, no?

Well, no, not so much.

I found that the iPod is limiting as hell. Apple’s system for managing music, which they force down our throats, is narrow-minded: You have songs, which are sorted into artists, and then sorted into albums. This system can’t even properly handle the simple idea of several artists issuing albums by the same name (a good example of this is projects, such as Another Late Night, or Back To Mine, or DJ Kicks). Just like when I select an artist and see what albums they have, in this case I want to start off with the album name and then have a list of artists. No can do.

And that’s not even the major management issue. When you have over 10GB of music, not to mention 40, or 80, or 140GB, you can’t simply scan through a list of artists or albums looking for what you want. Such a straight list is too cumbersome to scan manually. And I’d bet you’ve probably already organized this heap of music into something more accessible, such as into folders. For example, I had these main subdivisions:

  • Albums – for complete music albums (sorted into a subdirectory per artist)
  • Mixes – for albums that play through as one seamless mix (DJ sets, etc.)
  • Misc – for scraps of stuff, singles, etc. (I also put tracks from albums for which I didn’t want to have the entire album)
  • New – anything new (to me), which I keep for as long as I want until I move to one of the other three (no rules for it)

Now under these I even had further subdirectories, which I won’t go into here. The point is: I simply cannot do any of this with iTunes / iPod.

So I’m left with a device that forces me to take my friend’s advice: Don’t fight it, work with it like it expects you to.

iPod’s cool features

  • It’s beautiful. Sexy, even
  • The design is very minimal (I really like minimal) and the interface is very simple. Many times when strangers picked up my iriver they had no idea what to press to simply get it to play or to stop playing. I imagine there would be no such trouble with the ipod.
  • Instant on. Since it (apparently) never really turns off, and has no need to scan your drive (since iTunes stores everything directly into its database), it’s ready to go as soon as you press any button to turn it on.
  • Pretty good sound quality (this is the iPod Classic, reportedly earlier players were not so good)

iPod’s shortcomings:

  • You must use special software to load it with content. iTunes is recommended (yes, even by me) since it’s the most stable, reliable (this is really important), and feature-loaded (!)
  • It’s buggy. But then again who’s perfect?
  • It doesn’t support the “Group compilations when browsing” feature of itunes. So what’s the point of marking songs as “Part of a compilation”?
  • You can’t (as far as I know – will this ever change?) replace the firmware with something _good_, such as Rockbox, since Apple have somehow encrypted the system
  • Doesn’t remember what I was playing after being plugged into the computer

iTunes shortcomings:

  • Unless you tell it otherwise it will create its own library of all of your music
  • Unless you tell it otherwise it will automatically sync your iPod to your library, and manage everything on its own
  • It’s very touchy and will reset all view settings (which columns I want to see when I view my library) on a whim, such as after upgrading to a new itunes version or if, God forbid, you used another software to modify you iPod’s library
  • It’s oriented at working on your library, not your ipod. I use my iPod at work, but I have no intention of loading my work computer with all of my music – no reason to, either. But iTunes can’t do some of its tricks on the iPod’s music, only on the library. For example: iTunes DJ
  • It’s buggy. But then who’s perfect?

iPod + iTunes combined shortcomings:

  • Your _files_ are organized in an obfuscated structure, losing any filenames, directory names, and organization that you may have had (I had a lot!)
  • You cannot organize things the way you want to. You have to use their idea of organization, which is limited to Name -> Artist -> Album. What if I want to put a group of files together, as my own private compilation, but don’t want to run-over the album names? You might say: easy – playlists, but that’s simply not good enough:
  1. They’re unstable (see above)
  2. The files still show up in the general Artist/Album lists. And no, tagging the files as “Part of a Compilation” doesn’t work: It only groups the artists, not the albums, and even that only happens on itunes – the ipod still gets cluttered (160GB!). Additionally you might suggest using the Sorting Album field, which seems to solve the album issue (really, why do I have to work so hard for something that simple filesystem directories would have solved?), but that doesn’t work well, either: It only groups the files on itunes (on the ipod I see an “album” entry for each of the 500+ files I have grouped as “Misc”), and both on itunes and on ipod I don’t see the Sorting Album name in the album list – I see the album name from the file’s tag!
  3. You can’t remove files from the ipod by viewing the playlist – this interface only allows removing files from the playlist, but they will remain on the ipod.

What I miss about my iriver H340 + Rockbox:

  • Organizing my stuff the way I want to
  • Crossfading playback
  • Ogg vorbis support
  • Lots and lots of customization options

So, to summarize, I’m not truly pleased. I wish I had the time and equipment to reverse engineer the thing in order to be able to put Rockbox on it, but I don’t. I’m staying with the iPod since I don’t have any better choice at the moment, besides maybe getting an iPod 5.5, replacing the hard drive with a 160GB (from the Classic?) and putting Rockbox on that.

7 responses so far

Jun 15 2009

Hello (again) World!

Published by Amir under General

So… I started writing a little blog. But then I realized that a lot of the stuff that I want to write about are global, not local (to Israel). Couple that with my little fantasy of being read, I put two and two together and concluded that I would get much more exposure if I wrote in English. So this is it.

If you’re actually reading this – have fun, comment, flame, whatever. I promise to approve any non-spam comments.

:-) Amir

No responses yet