Yenya's World

Tue, 24 May 2011

Mysterious Source Code

About a month ago, I have spotted a two-page listing of source code in our printer room/kitchenette. I have glanced over it briefly, and during subsequent visits to the room, I became more and more fascinated by it. Finally, about a week ago, I have grabbed it for myself, because nobody seemed to care about it anymore. So here it is, in all its glory:

source code page 1 source code page 2

Click the thumbnails for full-size images. Sorry for not providing a plain text version, and sorry for the Czech language in the comments. I have two reasons for which I find it really fascinating:

  1. There are two pages of source code, which does literally nothing. It only wraps an existing class with a new one with marginally different API (two exceptions joined into one exception, and retrying in case of failure). Nobody sane would write these two pages by hand, so I expect the code has been at least partially generated by some IDE. Obviously nobody can expect the code to be read by a human (actually, not read, but carefully examined for traces of some non-trivial application logic, should there be any). So I wonder what the present meaning of "the source code" phrase is, when it is no longer written nor readable by humans.
  2. The only real "application logic" is the for-cycle near the end of the second page. And even this has been totally destroyed by the "every block should have only one exit point" mantra of the programming theoreticians. Adding a simple return statement when the message sending finally succeeds would save them the following:
    • a boolean variable
    • a complicated condition in the for-cycle
    • an if statement when the maximum number of tries is reached

I can only hope this is some kind of a silly example and not a real assignment given to the students of the Programming in Java course. I think the students have to be taught that mid-layers are root of all evil, and not some highly theoretical (read: impractical) rules like "goto is evil" or "a single exit point only".

Section: /computers (RSS feed) | Permanent link | 4 writebacks

Mon, 23 May 2011

Lost GUI features

Contemporary GUI applications have several problems which, if I remember correctly, previous systems did not have. I wonder whether somebody else also considers it being a problem:

Creating a new file
Almost every TUI text editor (like vim) happily accepts a non-existent file as a command-line argument, and the straightforward interpretation is "user wants to start working with a new file". On the other hand, most GUI applications simply complain that the file does not exist, and some‒like OO.org‒exit after that message. Other GUI apps, like Gnumeric, present a warning, but then open a new work with the default file name (Book1.gnumeric in the case of Gnumeric) instead.
Working directory
The file open/save dialog of contemporary GUI apps does not offer by default the working directory from which the application has been started, and uses some silly default (such as ~/Documents in case of OpenOffice.org). Even gThumb needs to be explicitly told that the user wants to browse the current directory with the "gthumb ." command line.
Iconified applications
Once upon a time, in a stone age of GUI computing, there was a twm window manager. When the application window was not needed on the screen, twm could be used to iconify the application. All applications, and all instances of them, could be iconified and then restored back the same way. Then Windows 95 happened, and it started to minimize the applications to the bottom panel instead of iconifying them to any place in the desktop. It also reused the desktop icons as application shortcuts instead of representing the minimized running applications. Unfortunately, the panel was too small for so many running minimized applications. Users stopped expecting to be able to restore the application after minimizing it. The applications which required to be minimized and restored back frequently (music players etc), developed their own means of minimizing, the notification icon area. So we have the iconification back, only not usable from all applications, and with each application implementing it in its own crappy way.

So what other important features of the "desktop of the past" do you consider missing from the present GUI systems?

Update - Mon, 23 May 2011: Iconified Apps

I have just discovered that XFCE4 in Fedora 15 allows the desktop icons to be switched between the Application launchers/shortcuts and Minimzed applications modes. Yay!

Section: /computers/desktops (RSS feed) | Permanent link | 8 writebacks

Fri, 20 May 2011

GNOME 3

After installing Fedora 15 in a virtual machine, I have decided to give GNOME 3 a try. Firstly, it is really slow over VNC. While GNOME 2 has been pretty usable for testing various new applications in a virtual machine, under GNOME 3 it is almost impossible. Here is a screenshot on which I will demonstrate my problems with GNOME 3:

GNOME 3 on Fedora 15

Firstly about the file manager. I use mostly command line for managing my files, but using a file manager is sometimes handy nevertheless. One of the features I often use is the "Places" list. In GNOME 3, it is presented differently in the Places menu and in the file manager itself, which is a clear usability bug. When I wanted to add another directory there (I often use ~/tmp as my sandbox), it took me at least 10 minutes to discover that "Bookmarks" is what I probably want. And even then, the newly added bookmark is added to a submenu instead of the main Places menu. Also, I did not found any way how to remove those useless predefined directories like Videos, Music, etc. from the left sidebar. Even when I have deleted them from my home directory, they still remain in the sidebar.

Another ugliness is that the new window manager does not decorate the windows properly, and instead relies on the applications themselves to provide things like resizing handle in the lower right corner (see the gnome-terminal window). Not only it looks ugly as hell, it also obscures the space the application expects to be visible. I will probably file this as a bug report when F15 is officially released, but I expect in a truly GNOME-ish fasion it to be solved by removing the "scrollbar on the left side" option :-/.

Anyway, it seems that XFCE+Sawfish combo works as expected, so I am definitely leaving GNOME when I install F15 on my workstations.

Section: /computers/desktops (RSS feed) | Permanent link | 6 writebacks

Tue, 03 May 2011

Rethinking Cron

cron(8) is one of the oldest tools in UNIX. Despite of that, I think cron is not something to be proud of. In my opinion, it falls to the unfixable designs category. The recent attempts to fix it (factoring out atd(8), a dirty hack that is anacron(8), etc.) show some of the problems of cron. My recent experience confirms it:

Cronserver load average

This is the load average graph from our server, which runs periodical jobs of IS MU. Around 2 pm, I have rewritten the main crontab joining several similar tasks to one line, and adding several seconds delay between their startup. The groups of tasks are now started by a simple Perl script which handles redirecting STDOUT and STDERR, and handling the return code. The Perl script is started using exec in the crontab line, saving one more process.

This way, I have managed to get the number of jobs which are simultaneously started in the peak minutes of an hour from 155 to 13. The system does exactly the same amount of work as before, but most of the work is evenly distributed across the whole timeframe, not started in parallel the first second of a minute. This is one of the big weaknesses of cron. I think the future cron will need to support the following use cases:

What periodical and semi-periodical tasks scheduler do you use? Will systemd be the answer to these problems?

Section: /computers (RSS feed) | Permanent link | 2 writebacks

About:

Yenya's World: Linux and beyond - Yenya's blog.

Links:

RSS feed

Jan "Yenya" Kasprzak

The main page of this blog

Categories:

Archive:

Blog roll:

alphabetically :-)