Indentation Hell

I'm currently working on a Python application that has about 1500 lines of code. The whole stuff was in one file and it was a pain maintaining it in this form so I decided to make separate files per classes. At the same time a class browser would really skyrocket my productivity, I thought. Throughout the development I used mcedit, later Emacs, then Kwrite and my last choice is eric3, a fascinating Python IDE with class browser and lots of goodies. The only thing I don't like in it is the Qt GUI, but user interface inconsistency probably won't kill me.

My switch from mcedit to Emacs is not hard to understand I guess considering its features and the fact that I love it. But my next switch from Emacs to Kwrite doesn't make much sense, right? I can justify my decision with one word: Indentation.

When I moved to Emacs and visited the original source file, I observed that the lines are incorrectly indented in it. When I changed several of them, Python immediately reported the indentation errors as soon as I executed the script. At that time I just wanted to get over the whole thing, tried Kwrite and it handled the indentation correctly. After that when the code has grown bigger and I needed eric3, the same problem happened and I had no choice then. I had to investigate this problem.

After some time, I realized that a lot of *nix editors (like mcedit) uses half-tabs. That's an evil concept. It's basically the most stupid way one can encode indentation.

In the simplest case, there were only tabs or spaces. In a more complex case, there were both tabs and spaces and tabs had a fixed size. And finally in the braindead case, there were half-tabs. I've written spacify.py that solves this problem by converting half-tabs to spaces.

Update: In the meantime I've realized that the GNU expand utility does the same thing and is much more mature than my spacify script, so you should probably use expand.

Prolog Suckiness

I had to write a simple Pascal parser in Prolog for my programming course of this semester. The rough specification: print the names and line numbers of the procedures and functions found in the Pascal code to be parsed.

Prolog is a nightmare if you wanna write imperative code. I've came up with the following mess (also available on GitHub):

You shouldn't see anything like this in your future life.

Operational Research Demo

I've written another application. Unlike the previous one, it's a GUI application which i've made for the operational research course of the university. It features an incremental UI. I mean on this a kind of UI which the user can incrementally fill out as he/she gives more and more information during the input rather than having to handle tons of pop-ups throughout the process. I think it's a much more usable interaction model.

See it for yourself:

opres-demo

Operational Research Demo is written in Python using PyGTK and you're free to download it.

initng

I've been dreaming for a long time about a well designed, parallelized init system and finally it seems my dream has come true. I hadn't have the time to check it out, but the boot charts seem very promising.

Comments Disabled

I've just disabled the comments and pings in every of my posts because I got massively spammed by various WordPress worms. On the other hand it's not a real pain for me, because my blog is not really popular. Honestly I don't mind it all, since I write mainly to summarize my thoughts and make a diary of my journeys.

My Choice of OS

J. Scott Edwards OS geek has written a nice article on OSNews about his ideal operating system. A lot of his ideas feel familiar to me (except from the 3D UI which I think is totally braindead and useless).

When he talks about the global object store as I would call it, I can really feel his pain. Let's take a short break... it's object store because it's a layer above the filesystem (ideally without a file system, but because backward compatibility it makes sense today using the Unix VFS API) that lets one define and create his/her own objects and relate them together. And it's global, because it not only stores which is accessible but it also stores which is inaccessible (off the disk - archived to CDs, DVDs, ...). So it's a 2 in 1 solution. I've been very concerned with archivation and sturctural storage problems in the last few months (years?).

Storage promised to implement this long-awaited architectural piece, but seeing how it progresses I'm not sure it's ever gonna ready.

When he talks about continuity, he thinks of orthogonal global persistence featured in the EROS OS.

I think another extremely important trait of a future OS is strong interprocess communication and code reuse. Applications are rather monolithical because of the diverse APIs and languages. Maybe language oriented programming really has a place because laguages are long term while APIs are rather short term. Ideally an OS is a set of strongly interconnected state machines with no multiplied, only reused code.

I like the philosophy of the Unununium OS. On the main page you can see Hans Reiser's quote: "The utility of an operating system is more proportional to the number of connections possible between its components than it is to the number of those components." I cannot tell in words how much I feel this statement true.

This guy even started his own project implemting this stuff in Eiffel among other languages. It seems to me like yet another idealistic never-will-be-ready project. Good luck dude! Anyone knows Eiffel by the way?

Imagemapmaker

I don't like C++. In my opinion it's a hack, an OOP layer above C. I'm not alone, of course. I've just written an application in it. It was a prerequisite for a job and I had no choice in language, that's why I've used it. The task of the application was to create image maps and the related (X)HTML document from image files contained in a set of directories. It's a CLI application. I've used gd which is a C library so the mixed C, C++ code is ugly like shit and I sucked a lot with some segfaults too as expected and stdstream bugs (less expected), but it works pretty well by this time. However several things left that I couldn't figure out completely. I wanna clean up the code and completely get it.  Here's how it looks like:

imagemapmaker

Apart from the hack feeling of C++, the separate definition (.h) - implemetation (.cpp) layout makes me mad. It's so disturbing editing dozens of these stupid files separately.

Amarok

Amarok doesn't seem to be yet another winamp clone. I like its unique features and design. Especially the song playing statistics, the CD cover preview, its fancy visualization and the advanced playlist. It's worth reading the OSNews interview with the Amarok developers. Gstreamer is probably very flexible also. If everything goes well, I'll test it within a short time.

Evil Firewall Policy

I couldn't blog this week. This was because one of the sysadmins at the university computer science department blocked the server which hosts my home page. This server hosts thousands of other sites too which are full of warez and some students here regulary download all those shit which causes massive bandwidth consumption which costs a lot of money to the university. I came up with various alternative solutions:

1) Monitor user traffic. If the traffic exceeds a well-chosen limit per user, fall back to a lower bandwidth. The problem is that there are huge pages on the web with full of fancy shit. If someone surfs the web for some hours on these sites, (s)he can easily generate hundreds of megabytes of traffic. There are other downloading activities also which don't incorporate any warez. Moreover there are a bunch of technical difficulties implementing this idea. For example the LDAP server and the firewall don't communicate well with each other.

2) Scan FTP and HTTP URIs for multimedia file suffixes and track them per user. This would require a few dedicated hosts because of the 1 gigabit bandwidth. It's a pretty computationally and I/O intensive task. The other problem is that most warez is compressed in various different formats so the file suffix tells nothing about the content this way.

3) Kick the asses of all the warez folks. This would be the most easier and gratifying job to do. Unfortunately this option depends either on 2) or 3).

I don't know what to do in a situation like this, but this evil policy makes me mad. If nothing's gonna change I'll probably only blog on the weekends which is not that huge tragedy after all.

Homework

I've made a Mono advertisement postscript graphics for my computer graphics course of this semester. Here is how it looks like:

mono-graphics

News

A few developers were talking in the past about reducing the boot time by using parallelized process execution. This is on my current wishlist so it sounds like a beautiful project.

Fork benchmark

Fork benchmark is a primitive benchmark that provides a way to measure the time that is required to fork, exec and destroy x processes, where you can define x as the command line argument. I was wondering why init is so slow. Hint: It's not because forks slow, but but because init runs the services scripts sequantially, not in parallel. Fork benchmark is a C utility.

Some skins and themes I created

Even though I'm not a graphics artist I created some skins and themes in the past that I'd like to share with you. I've made these available both on Gnome-Look.org and on GitHub.

Unix-clear XMMS skin

This is my first skin and quite frankly, I'm not impressed but I share this with you anyways because it's part of the history of humanity. :-)

xmms-unix-clear-skin

m7c XMMS skin

A lot better based on my opinion and others' comments. I personally like it.

xmms-m7c-skin

Explicit Flatness XMMS skin

I'm pretty satisfied with this piece of skin and decided that I won't make any more.

xmms-explicit-flatness-skin

Explicit Flatness Metacity theme

This theme is based on the XMMS skin of the related name.

metacity-explicit-flatness-theme