Thursday, August 23, 2007

Crap mail client

At work we're blessed with a wonderful mail client which we are suppose to use, by policy. And most people do. I try not to. Maybe you've seen this signature in some peoples' mail:
A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?
and indeed they are right. This particular mail client encourages top posting by doing two things. The first one is that when you hit reply it formats the new mail in this manner: <cursor here> <your signature> ------<other persons name> wrote:------ <other persons mail body indented> ... where the irritating thing is that it places your signature above the other persons mail. The second thing is that all mails are in HTML, and the client has some limitations in that regard: The text from the mail you're replying to gets indented in a way where you can't inline your replies without having your text indented too. The interesting stuff happens when people in my organization think of how to workaround these limitations. Some use top posting, and forgets to reply to half of the message. The others use a feature that comes with HTML, coloring! That is, the common way to reply is that you pick a previously not used color in that mail, and color your inlining with that. When the mail gets replied for the seventh time there is indeed eight different colors used, and everything is indented seven steps. Yay.... Naturally there is no "standardization" of which color to pick next, so each conversation is colored in a different way. It can get quite tricky to follow. Also, after a while it gets hard to pick a color that is sufficiently different from other colors. Luckily I'm not color blind. Just to make you realize how bad this really is, imagine this with your favorite indention sensitive programming language: In your editor;
  • You can't indent.
  • When you hit the tab key you just get the color for the current indention level.
  • The mapping of "intention level" to color is different for each source file.
A very interesting thought. The first person to implement this in the editor of their choice will get a postcard from Göteborg, by yours truly.

Friday, June 1, 2007

Code vs. Coder

I read a blog this morning, which got a few thoughts started (oh noes, not again!). Rich Skrenta argued that code is our enemy while Jeff Atwood replied that the code itself isn't the problem, but that the real problem is what you see in the mirror. This reminded me of the good professor John Hughes (who taught me Haskell 5 years ago!), who has along with Koen Classen and others, been writing on QuickCheck the past years. It has been rewritten a number of times, each time with more features but fewer LOCs (lines of codes). Bearing in mind that counting LOCs is regarded as a measurement of productivity, Hughes asks,
Have we had negative productivity? We do more with less code!
Another example would be in the newly released xmonad 0.2 where Don (dons) Stewart recently blogged about how he with fewer lines of code did more by moving some of the logic into the data structures. He used a technique called zipper (references in the end of his blog entry) and could thus merge two data structures into one, eliminating the problem of keeping them concise. Easier to write the code and less risk of writing bugs. Did he have negative productivity too? I would have to say no. Written code has to be maintained by someone, depending on what it was written to do. When GHC 6.6 was released the Gentoo Haskell Herd got busy as roughly half of the Haskell packages only compiled with GHC 6.4.2 (about 16 broken out of 40). Naturally we wanted them to work with GHC 6.6 too. It is hard to foresee what will change, no matter how you write the code, thus giving Skrenta a point. Code is the enemy. Reason for the broken packages (2) mostly was (in no particular order)
  • deprecated modules and classes
  • functionality moved to other modules
  • changed type signatures
  • changes in the type system?
  • changes in the build system
  • UTF8 trouble
All this makes me extra jumpy when Erik Hellman, a Java Consultant in Göteborg, blogs about when a 1400 lines game written in 50 min (in Swedish) which was later presented at the JavaOne conference. 500 lines are auto generated getters/setters, along with 900 manually written lines. Assuming writing the manual lines took 40 min, he wrote a line about every three seconds non-stop. I hardly think though that I even could write 900 lines in 40 min even by heart. He agrees, and notes that this is not possible without an IDE, in which case he recommends IntelliJ IDEA 6.0. Maybe Hellman is an extremely talented hacker and that his tools indeed are excellent, thus it's not possible to write the code in less than 1400 lines (in Java) and that it really should have taken some other programmer the whole day. Possibly the job has been solved and no one has to touch the code ever again. Personally though, I would be more interested to see how the game would evolve in 50 hours, days, or weeks. I guess it depends on what you want your app to do. Still impressive to write a game like that in 50 min, but 1400 LOCs? Hellman replies by saying that we are on the same track, and that we should see the other guy's code. How much logic can you write in 40 min? The resulting massive amount of code does not seem to be a problem. I guess that we just have different backgrounds. I have not yet had a look at the code, which recently was put online, but I do hope that the IDE will help to debug and maintain it. This raises the question of how many lines it would be in Haskell, given the corresponding libraries exists. Anyone want to give it a try?

Thursday, April 19, 2007


I've been thinking (oh noes!)... Peppers are hollow, but what's actually inside? Is it simply air or perhaps some gas secreted while growing? Assume it is air, is it then air from where the pepper is grown, or from a more recent location? If the "filling" is indeed from where it's grown - let's say Croatia (I've got reliable intelligence that the best tasting vegetables are grown there): If I'm lucky, I might just manage to carefully make a couple of holes in the pepper, breath in, and get a small breath of this mysterious gas. That's a mini vacation right there!

Vårt svenska språk

Only in Swedish... Fick en fråga av en kollega: Varför heter det att man "ligger i lumpen", "sitter i fängelse" och "går i skolan"? Nästan Anders och Måns-kvalitet på den. Men hur kommer det sig? Ligga i lumpen; motiverat med allitteration... Sitta i fängelse; man kommer ingen vart? Sitt still! Går i skolan; det går framåt? Err.. Hm..

Asking for a day off?

Hittade en lapp på jobbet som förklarar varför man inte kan få ledigt om man ber om det...
Vet du vad du egentligen begär? Året har 365 dagar, men du arbetar ju inte varje dag. Under årets 52 veckor har du ledigt 2 dagar varje vecka. Då återstår 261 dagar. Du är ledig 16 timmar varje dag, det blir sammanlagt 170 dagar. Då återstår 91 dagar som du kan arbeta. Varje dag tar du lunch 1 timme, det blir sammanlagt 48 dagar. Nu återstår 43 dagar. Du behöver inte arbeta 6 röda dagar under året. Det blir 37 dagar kvar. Varje dag tar du kafferast 10 minuter, det blir totalt 11 dagar. Kvar finns 26 arbetsdagar. Sedan har du 25 dagars semester. Då återstår bara en dag. Och den förstår du väl att du inte kan få ledigt.
Which (loosely) translates into: I found a note at work why I can't have the day off. (Notice that this is is with Swedish vacation, 5 weeks each year).
Do you even know what you're asking? Each year has 365 days, but you're not working all of them. For each of the year's 52 weeks, you've got 2 free days, leaving 261 days. Being free 16 hours a day adds up to 170 days. 91 days left to work. Add up 1 hour lunch each day, that's 48 days. 43 days remains to work. You don't have to work the 6 holiday-days, 37 days remains. 10 minutes coffee break each day adds up to 11 days. Left is 26 days to work. Then you have 25 days vacation. Only one single day to work. Now you must understand you can't get that day off?
I don't really get the numbers to add up, but hey! :D

Monday, April 16, 2007

RIP rydis

Martin "rydis" Rydström disappeared the 24th February earlier this year. His body was found last week in the water outside of Göteborg. Martin was a fellow lisper, which I only met irl one single time. I regret I didn't get to know you better. We will remember you, friend.

Thursday, April 12, 2007

Fun at work

Imagine my face when I walked into the kitchen at work and saw a keyboard with dirt all over it, well wrapped in plastic film. Is it supposed to be there? What happened and who did it? While taking another cup of tea, I recalled an old prank I've seen circulate the net. Ah! Five days later, it had progressed nicely... Looked like a green carpet. Nicely set-up. Guess if he was surprised? What would you say if your office looked like that after the easter holiday? Oh yeah. All you need is an old keyboard, some dirt or cotton, and seeds of something easy growing. Childish humour can be an asset too. Complete instructions on the other site. This is yet a reason why I choose to write the report of my thesis at work instead of at home :D Now back to work!

Monday, April 2, 2007


If you've followed #haskell@freenode the last month, you've had to try hard to not hear about heard about xmonad. It's a lightweight window manager, a clone of dwm, similar to ion, ratpoison, wmii and larswm. To be more precise it's a tiling window manager which means that it makes sure that no windows are overlapping. It can take a while to get used to, but it's well worth the effort. While xmonad still is relatively easy to learn, the Ion manifest still applies. It will help you to put down the mouse. The impressive part is that while one of dwm's goals is to be <2000 lines of C, xmonad has similar features in <400 lines of Haskell. It also does a couple of things dwm doesn't, namely automated testing of the internal window manager properties (with QuickCheck) and support for xinerama. (The lack of xinerama is, otoh, listed as a feature of dwm). See a screenshot here. It's not yet released, so you'll have to "darcs get" the sources, instructions on the homepage. Unless you're running Gentoo Linux with the haskell overlay, in which case a "emerge xmonad-darcs" will do. Give it a try and give feedback on #haskell!

Wednesday, February 7, 2007

Fish out of water

I've been forced out of my safe zone and into Windows. It came with the job... Now, 6 months later, I've collected a few tools that makes the daily headake set a little later in the afternoon. True X-Mouse: The first thing I missed was beeing able to copy and paste simply by selecting and clicking. Fortunately, True X-Mouse solves that. Open Command Window Here: Part of the Microsoft PowerToys for Windows XP. Right click on any folder and select "Open Command Window Here" and you'll have a cmd.exe with CWD as that folder. Must have saved me hours of typing... Perfect if you use darcs as version control system and need to type a few commands. GnuWin32: Don't like the Windows Search function? Neither do I. I miss my bash shell, and the coreutils :/ Imagine my smiling face when I found a port of many common GNU tools. You can get far with the coreutils and grep package. Virtual Dimension: Another thing that's hard to live without is virtual desktops. I use them all the time on my linux boxes, and constantly hit the keys to switch desktop even on windows machines. This tool makes a pretty good job at faking virtual desktops, but you do notice that it's not real virtual desktops. If (when!) a program hangs, it will appear on all desktops, and if you're unlucky you're stuck on your current desktop for a while. Still a great tool, I'd probably miss this one the most of them all. Vim: You don't get very far with notepad or wordpad. Using vim in cmd.exe is just weird as cmd.exe is far to crappy. GVim works perfectly though. Emacs is available too if you're into that kind of thing. Putty: Putty is your new SSH client. Nice! Winrar: Opens your .tar.gz and .tar.bz2 (and a bunch of other) files, yay! Daemon tools: Mount your CD images as virtual cdrom drives. Browsers: Same same... I use both Firefox and Opera. With a few of these tools your Windows experiense won't be as frightening, and you might even get some work done instead of just being frustrated. Bonus: All these tools are free (as in beer). Although I hope that none of you ever need to use these tools, I wish you good luck!