Toxic Elephant

Don't bury it in your back yard!

How to compile TV output into the latest X.org ati drivers on Ubuntu

Posted by matijs 21/06/2007 at 12h58

The Problem

You have built a home server slash PVR that you want to hook up to your twenty-year-old television. You have gone to several shops to buy a graphics card that actually has open-source drivers for its TV output functionality (i.e., the ATI Radeon A9250). You have dodged salesmen trying to sell you something else (“No, but here is its successor the NVidia so-and-so.” “Uhm, no thanks.”). You finally succeeded by ordering it over the Interweb (and probably should have done that in the first place). Now you want to patch the driver shipped by Ubuntu to actually get TV output working.

Tags , 11 comments no trackbacks

Subversion and tagging

Posted by matijs 18/06/2007 at 14h50

I’ve been using svk for a while now, but I keep bumping into problems with the whole concept of tags being just copies.

The problem is this: In my mind, a tag should be a symbolic name for a particular revision on a particular branch. In subversion (and hence, svk), it’s not. To use a tag in place of a revision, you first have to do svn info to find the corresponding revision number, and then use that in your svn diff or svn merge or whatever.

Subversion should have had a smarter client from the start, one that emulates tags and branches and hides the implementation detail that they are ‘really the same thing’ from the user.

As it stands, subversion has no tagging.

It’s all very annoying.

Tags 1 comment 1 trackback

A DSL for making SQL-like DSLs

Posted by matijs 14/04/2007 at 14h42

Setting the stage

Some time ago, I came across SQLDSL, a DSL for building SQL queries. The benefit of using a DSL over plain old string concatenation is that syntax is checked before the database server is hit. Unfortunately, SQLDSL does not deliver. It will happily accept

q = Insert.into[“frot”][“zop”][“blob”].values(“kng”).values[“kgn”]

resulting in

` q.to_sql

=> “insert into ‘frot’ (zop) (blob) values (‘kng’) values () (kgn)”

`

which is hardly acceptable SQL.

Tags no comments no trackbacks

crontab -r

Posted by matijs 20/03/2007 at 18h27

I don’t use the crontab command on my own machines (I just put files in /etc/cron*), but recent experience on another machine made me wonder why crontab has the following options (this is from crontab --help):

    -e      (edit user's crontab)
    -l      (list user's crontab)
    -r      (delete user's crontab)

Right. E is for edit, L is for list, R is for delete. Makes sense. And as a bonus, it is easier to accidentally delete your crontab when you want to edit it.

Brilliant.

Tags 2 comments no trackbacks

Dream

Posted by matijs 13/02/2007 at 09h43

Last night, I had a dream. There was a gathering of people for dinner. It was probably not my house. I mean, it didn’t look like my actual house, but in my dream it was also not my house. We sat at a table with a thick rough wooden top. The light was soft, coming mostly from the simple lamp hanging over the table. The floor was also wooden, as were the low shelves lining the walls at the other side of the room.

I was sitting at the head of the table. I’m not that tall, so I was looking slightly up at the other people at the table. On the second chair to my left sat a young man who was somehow connected to Microsoft. Probably he worked there. He was very enthousiastic about Vista.

At some point he said something that really upset me. I think it was about how something could not be fixed, and users just had to either live with it, or buy something new. I told him, how can he say that when there are people how have to get by on very little money, and can’t afford to buy the shiney new stuff, and that Bill Gates is really out of touch with reality. I don’t remember the exact words, but I was clearly very angry. The young man decided this animosity was too much for him, and left.

Afterwards, I was standing on the other side of the room, shaking so badly that I dropped two glasses that I was trying to drink from to calm down on the floor.

Tags , no comments no trackbacks

I Want Cells-GTK for Ruby

Posted by matijs 22/01/2007 at 13h21

For some applications, a spreadsheet is the perfect development environment. The UI is a no-brainer, while the relations between the different values is clearly visible, and changes are automatically propagated from what could be called properties to derived values.

The problem is, of course, that you’re missing out on the features a programming language could offer. Macros are basically a dead end, unless you like to solve user issues like ‘It doesn’t work because I disabled all macros.’

What I want is something that gives me this easy linking within a model and between model and UI, but from withing Ruby. It is my prefered solution to the Gnome on Rails problem.

Cells for Common Lisp promises to take care of the automatic propagation and dependencies between cells:

Cells is a mature, stable extension to CLOS that allows you to create classes, the instances of which have slots whose values are determined by a formula. Think of the slots as cells in a spreadsheet (get it?), and you’ve got the right idea. You can use any arbitrary Common Lisp expression to specify the value of a cell. The Cells system takes care of tracking dependencies among cells, and propagating values.

That seems to take care of the automatic updating of derived values. The second part is the no-brain-UI. What’s needed for that is a dead-simple way to link settable values to input widgets (text boxes, spin buttons, etc.), and to link derived cell values to labels. By dead-simple I mean that it should be done in at most one line per widget/value pair.

It seems for that part, the solution would be to use cells-gtk:

Cells transparently link GUI elements with each other and the application model to greatly simplify development of rich interfaces. Cells also automate how Lisp GUI instances drive their GTK+ counterparts.

Sounds great!

The problem (for me at least) is that this is all in Lisp, and I don’t know Lisp yet. So, I want this, but in Ruby (since that’s the language I like to use most right now). Some basic ingredients are already there: We can use blocks as formulas for the derived values, and there’s the Observable module. Also, Ruby has bindings for Gtk+.

I have some more wishes, but they’re mostly about Gtk+, so I leave those till later.

Tags no comments no trackbacks

Skipping Python for Ruby

Posted by matijs 18/01/2007 at 18h59

Without an e writes

Well, ruby just isn’t that much better than python. If I’m going to relearn everything, why would I bother with ruby? Why not just jump straight to lisp?

I can really appreciate this argument, since it resonates with my reasons for not learning Python: I knew Perl, and was doing most of my programming in it, making nicely structured, readable, object-oriented programs. To me, Python didn’t seem like such a big step forward: It’s like a Perl with enforced readability.

And then came Ruby.

My introduction to Ruby was not through Rails, but through reading the online version of the Pickaxe Book. After reading the first chapter, I was sold. Here was a language that truly embraced object-orientation, and gave access to all kinds of interesting abstractions that I had only vaguely heard of (such as coroutines). There also was a pleasant lack of boilerplate.

So to me, Ruby is that much better than Perl, whereas Python is not. I wouldn’t know if I agree that Ruby is not that much better than Python, but at least I can understand the argument. Ruby is certainly no Lisp, although it comes close.

So what’s next? Lisp’s features certainly look appealing, giving basically the pinnacle of power of abstraction, in exchange for slightly unappealing syntax. I believe the syntax can be overcome, so my next language to learn may well be a Lisp. Which Lisp is still an open question. On the other hand, there are interesting languages like Erlang, ML and the like.

[Incidentally, Without an e is the creator of Scarlet Lambda, which is roughly a web framework written in, or at least used with, a functional style of programming in Python, with a Lisp-like syntax. Wow.]

Tags no comments no trackbacks

How to write software

Posted by matijs 18/10/2006 at 10h29

Peter Armstrong hits it right on the head:

People Need Gaudy Shit

Instead of having a loose set of things that work, that are generally or even just sometimes good, that we mix and match according to the circumstances, we get everything put together in a box with a nice bow on top. Then, if you don’t use everything in the box, you’re an infidel.

I remember the first time I came across Extreme Programming (XP). I was at a bookshop looking to buy Design Patterns. This was some time ago, but there already were lots of books on XP. Most titles sounded like “XP explained yet again in a different way”. Marketing, indeed.

The thing is, talking a lot to your customers and pair programming have nothing to do with each other. Nothing at all. Both can be good ideas, depending on the circumstances.

When I write software at home, for myself, of course I can’t do pair programming. When I write something that only I will use, there’s no point in talking to my customers. I almost always use unit testing and version control. Using that for a one-off script written in ten minutes is insane.

I could make my own list of what works here, but Robert Fuller has done a pretty good job.

Tags 1 comment 1 trackback

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

Abstractions

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
code.

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