Toxic Elephant

Don't bury it in your back yard!

New Language Features in .NET

Posted by matijs 06/09/2006 at 16h36

One of the reasons I have a dislike for both Java and the main .NET langauges, VB.NET and C#, is the ridiculous verbosity involved in creating and filling an object variable. Typically, what you get is something like:

Some.Deep.Namespace.Structure.SomeClass foo = new Some.Deep.Namespace.Structure.SomeClass();

The repitition of the class name makes the horrid namespace nesting twice as bad. And no, this is not about typing, this most definitely is about reading.

So, you can imagine my pleasant suprise when, belatedly, I came across a discussion of var. Basically, var is a new keyword in the upcoming C# 3.0 that allows you to do this:

var foo = new Some.Deep.Namespace.Structure.SomeClass();

And then, and this is the good part, the C# compiler will infer that foo is a variable of type Some.[..].SomeClass and will complain if you try to store anything else in it1.

Same type safety with half the reading. Excellent.

Now, that’s not all. It turns out there’s a lot more interesting stuff coming in C# 3.0, making it more concise and powerful.

1 Yes, I’m aware that ML does this and even more.

Tags no comments no trackbacks


Posted by matijs 01/09/2006 at 16h31

One of the reasons I enjoyed learning Ruby is that it allowed me to
understand and then use new abstractions. Not all of these are absent from
other languages, but Ruby made them comprehensible for me, so they became
part of my toolbox, if you will.

What this means is that I can write code that does the same thing in fewer
lines, and this in turn makes it easier to keep an overview of all of that

At the same time, there is a whole group of programmers who completely
seem to have missed the abstractions train, or even the abstractions
road. They’re plowing along in the fields, barely able to divide their code
into subroutines beyond the ones forced upon them by their IDEs. These are
the people who write (whitespace added for clarity):

do\_d do\_a do\_b do\_c do\_e do\_a do\_b do\_c do\_f

If the same five things need to be done a hundred times in a given source
file, that’s five hundred lines right there. The abstraction of the
subroutine is not an automatism for them.

So what does it matter whether people get taught programming in Java or in
Ruby, if no-one stops them from creating thousand-line subroutines? I really
wouldn’t know.

Tags no comments no trackbacks

Safe Passwords

Posted by matijs 03/08/2006 at 11h19

In the have-we-learned-nothing category, the New York Times refuses my extra-safe password, saying:

Password can only contain letters [a-z], numbers [0-9], periods [.], underscores [_], and hyphens [-].

That’s almost as stupid as godaddy’s registration page choking on my attempts to use an ampersand in a password.

I wonder if “only letters [a-z]” really means they should all be lower case. Let’s try… No, upper case is allowed. So, it’s stupid and wrong.

Tags no comments no trackbacks

How to Trim Spaces in TeX

Posted by matijs 20/07/2006 at 19h27

The problem

You created a macro package for LaTeX and promised that people could write either

\synttree[a label]


\synttree[a label]

and the result would be the same. Now your buggy macro for trimming spaces stands in the way of a much needed bug fix.

In short, you need a macro \trim that will trim (The name says it all, doesn’t it?) spaces off of its argument’s beginning and end.

Tags , no comments no trackbacks

Resolution Evaluation

Posted by matijs 15/07/2006 at 15h13

We’re now more than halfway through the year 2006, so it’s about time to evaluate the status of our new year’s resolutions. Now I realize many people give up on them by the time februari comes around. This is because they think a resolution should be followed all year, instead of being something to strive for all year. That way lies failure, clearly. And it’s also a kind of lazyness: “Oh, it’s now the second of januari, and I’ve already smoked a cigarette/forgot to call my mother/killed a kitten, might as well smoke/not call my mother/kill kittens all year.” If that’s your attitude, resolutions are dead cheap. Lazy bastards.

Anyway, on to my resolutions. Let’s see:

  • Answer all relevant e-mail within a reasonable time.

Well, that’s going pretty badly. Friend requests from cute orkutians, praise for msgconvert, ex-colleages who want to keep in touch, they all go unanswered. Of course I’ve been busy, but that’s really no excuse. My humblest apologies to you all.

  • Find out what I really want to be doing, and do that.

More luck here. I quit my job, after it had turned from just an ok way to make money into a constant source of frustration. So, as of June 1st, I am a self-employed software developer, IT consultant and web designer, which gives me the freedom and tranquility to think thoroughly on where I want to go and how to get there. Where I want to go would probably be somewhere where there is a nice PhD position in computational linguistics or computer science.

  • Post to my blog more regularly. I’m going to try mondays, but don’t hold your breath.

Well, you can all see how that’s going.

Tags 1 comment no trackbacks

I Got Married!

Posted by matijs 29/06/2006 at 23h22

On June 16 and 17, Naoko and I got married. On the 16th we had our civil wedding, while our church wedding was on the 17th.

This is a photo from the first day, made by Thomer Gil:

Jim Forest has some pictures of the second day on flickr.

Tags 1 comment no trackbacks

Amazon S3 versus rsync

Posted by matijs 08/06/2006 at 11h15

JungleDisk is a new tool that uses
Amazon’s S3 as a storage device but appears to the user as just another
disk. It is a closed source, open standard application, seen locally as a
WebDAV server, so it interfaces with most desktop file managers.

I can’t get it for my Linux-on-iBook system, but I suppose if JungleDisk
catches on, someone will come along and do a Free reimplementation (source
code for retrieving files can already be downloaded from JungleDisk’s
The question then becomes: Do I want to use it?

I myself use rsync to backup my files to a friend’s machine on the other
side of the ocean. JungleDisk doesn’t do rsync. It’s just a disk, so you
have to consciously copy your files there. That’s fine if you just want to
store some files on-line. For backups, on the other hand, I want an
automated solution.

The following scheme might work: Store md5 and/or sha-1 hashes of all the
files sent to S3. The files sent there are simply indexed by hash, and we
store a mapping of hashes to directory nodes. This way also, when we move a
file, it doesn’t have to be uploaded again. The mapping has to be uploaded
to S3 as well, of course. For more fine-grained upload control, files can
even be divided into equal-sized blocks, and only changed blocks will have
to be re-uploaded.

As an aside, I wonder if S3 allows you to check md5 or sha-1 hashes of the files
stored there, or if there is some other way to check the files there are
the same as the files here.

Tags no comments no trackbacks

One Seat

Posted by matijs 28/05/2006 at 12h16

There’s a petition going on to get the European Parliament to only have one seat. Currently, € 200 million is wasted each year just because people and papers have to be moved around from Brussels to Strasbourg and back. Contrast this with the € 3 million the EU just promised to help the victims of the earthquake on Java.

Tags no comments no trackbacks

Mark is back

Posted by matijs 27/05/2006 at 14h47

One of the first blogs I ever read, dive into mark, is back.

In 2004, Mark Pilgrim declared it was time to find a new hobby.

Preferably one that doesn’t involve angle brackets. Or computers. Or electricity.

Now he’s looking for ways to backup the 100GB of data he plans to generate every year for the next 50 years. Clearly, he has changed his mind.

(Actually, I noticed Mark’s return via a post on another interesting subject.)

Tags no comments no trackbacks

Finland wins

Posted by matijs 21/05/2006 at 23h19

Wow. It’s been almost 24 hours, and I’m still amazed: Finland has won the Eurovision song contest. For the first time in fifty years. With a hard rock band. Cool.

When I saw them in the semi-finals, I was, for the first time ever, actually tempted to take part in the televoting.

Tags no comments no trackbacks