Blog Pseudoaccidentale

2009-06-28

FreeBSD doc-el picking up speed

As pleasures go, it is a strange yet somewhat refined one to see a project one has started pick up speed. My fellow translators at the Greek documentation team of FreeBSD have been busy lately, and the result of our collective work is a fairly large number of commits to the “doc-el” repository.

There are now at least four translators actively working on a chapter of their own: Manolis Kiagias, Vaggelis Typaldos, Kyriakos Kentrotis and me. Changesets flow between our repository clones almost every day, and I often find myself pulling patches from two or three places at the same time.

This morning I picked up patches from both Kyriakos and Manolis. Manolis had already integrated with Vaggelis, so pulling from him I also got the translations of Vaggelis. In the meantime, my nightly cron job had finished importing a new snapshot from the official CVS tree, so today’s history graph looks scary:

Greek FreeBSD Translations: Commit History of 28 June 2009

The “surface complexity” of a change history like this may seem scary, but to me it is nothing of the sort. It is, in fact, quite the opposite: something to be proud and happy about, because it shows a lively team, working steadily towards our common goal—a fully translated doc/ tree with a translated, accessible version of the FreeBSD Handbook for Greek users.

It really makes me very happy to see an effort started several years ago gain momentum. My own personal commits are far less than those of the other translators now, and I often find myself in the role of a “patch integrator” instead of actively translating new text. But this is ok, because now we have more people working on the translations so we still get many improvements every day :-)

2009-06-15

Apparently Elephants and FreeBSD are Quite Popular

Looking at the search terms that people used to reach this weblog, I noticed that one of the most popular posts of all time is the “Contributing to FreeBSD” post of Feb 2009.

Search terms for this weblog

This is fantastic! I didn’t realize readers of this weblog would like the particular post so much, but I am extremely pleased you did!

Puzzle: Student grades and other amusements

Filed under: Misc — keramida @ 02:51:19
Tags:

An interesting problem was described to me by a friend last night.

Let us assume that there is a semi-fictional school, where a number of students start studying every year. The number of new students ranges between 70 and 150 every year.

The students can pick more than the strictly required number of classes during their few final terms. They get rated in all their optional classes, and just before graduating the students have the option of keeping some of the optional classes and aborting others.

Each time they pick or drop one of the optional classes, there is a system in place that immediatelly replies with their placement in the graduation list, depending on their final score in the selected set of classes.

The school now uses a very peculiar algorithm for selecting a number of the graduating students to cover some of the prestiguous positions for teaching assistants. There are 5 types of positions: A, B, C, D and E. The academic prestige, future options and monetary gains from each type of position are very well-defined, and there is a clear order of preference: A > B > C > D > E.

The peculiar algorithm for picking graduating students for each type of these teaching assistant positions is:

  • After all students have picked a set of class grades, and their graduation placement has been fixed, a ballot is drawn between the numbers 15, 16, 17, 18, 29 and 20.
  • The number N drawn from the ballot is used to split the graduating students in teams of N members, starting from the one with the highest grades as student #1, the second as #2, … the N-th as the last member of the first team, the (N+1)-th as the first member of the second team, and so on.
  • Then the first five students of each team are chosen for the five job position types: the first team member for an A position, the second for a B position, etc.

This is a very strange algorithm for selecting students for the five types teaching assistant positions. At first glance someone may be tempted to say that it is `fair’, because of the ballot. My intuition says this isn’t true, however. So the questions this discussion triggered were:

  • How “fair” is this selection algorithm?
  • Are there positions in the graduation order of all students that are favored a lot by this sort of selection process?
  • If there are positions that do have an advantage, how many are they and what is their overall distribution in the range of [1..150] students of each year?

I spent a bit of time last night trying to work this out, and I think I have an answer now. Before I post how I tried to answer, what are your thoughts? How would you approach this ‘problem’?

2009-06-05

query-replace-regexp or “making movies enjoyable”

One of the movies I recently watched came with subtitles in a separate *.srt file. The subtitles had 99% correct timing information, a pretty amazing feat. They had a minor glitch though. Many instances of lowercase ‘el’ had been replaced with uppercase ‘i’.

I noticed this tiny glitch in the first few lines of text, and then discovered that it was a buglet that occured far too often. My OCD side started feeling bad about the movie, because all the bogus capital ‘i’ letters were distracting me from the “real” fun of watching the actual movie.

So I stopped watching, and I fired up GNU Emacs on the srt file.

After 1-2 minutes of work, and a lot of fun with query-replace-regexp I found a nice replacement pattern to interactively fix all the broken ‘i’ instances:

M-x query-replace-regexp RET
    \([^I ]*\)\(I+\)\([^I ]*\) RET
    \1\,(replace-regexp-in-string "i" "l" (downcase \2))\3 RET

This had quite a few false positives, but it did 95% of the work, so I manually fixed the 5-10 instances it didn’t catch, and I was finally able to enjoy the movie.

Note: The perceptive reader who is also a fan of regular expressions will probably notice very quickly that part of the third line is Lisp code. This is an amazing feature of regexp replacement in Emacs. When the special pattern \, appears in the replacement text it evaluates the following expression as Emacs Lisp. An arbitrarily complex Lisp expression can be used after \, and its return value is used as the replacement text.

I’m positively thrilled that Emacs saved the day… again :-)

2009-06-04

Dear Santa…

Filed under: Computers, Mercurial, Programming, Software — keramida @ 08:25:03
Tags: , , ,

I know it’s a bit early for 2010, but can you please grant me a wish today and count it as one of the 2010 ones?

For 2010 (and the rest of 2009) I wish I can keep up today’s pace of reading code, hacking at it, running tests and then committing; and be able to do that almost every day:

$ hg  log --template '{date|isodate} {author|user}\n' | \
    fgrep 'keramida' | awk '{print $1,$4}' | sort | uniq -c | tail -2
  10 2009-06-01 keramida
  26 2009-06-04 keramida

Oh, and yeah… I’ll be a good boy ;-)

2009-06-02

Η Αποκρουστέα Μυθολογία

Filed under: Γλωσσικά — keramida @ 04:22:56
Tags:

Με μια μικρή καθυστέρηση, διάβασα σήμερα το εξαιρετικό άρθρο “Η Αποκρουστέα Μυθολογία” του Δημήτρη Σαραντάκου:

http://www.emprosnet.gr/Opinions/articles/?EntityID=8aafe47e-40b1-4ad8-ad5d-cea9aa138eb8

Υπέροχο, πραγματικά, το άρθρο. Αντάξιο της γραφής στην οποία μας έχει συνηθίσει ένας εξίσου υπέροχος άνθρωπος.

Blog at WordPress.com.