## Friday, December 26

### Hacker spaces

I just found out about hacker spaces. For a nice example of a hack space, see The Metalab. Such places seem quite suitable for work on individual public projects and for growing teams by sorting out the wheat from the chaff.

It's a pity there are no hacker spaces east of Vienna. I wonder if one could be set up in Vilnius. There probably are enough people around. but quite a bit of organising work (see Hackerspace Design Patterns [PDF]) needs to be done to establish a hacker space. I would do it, but I am overbooked as it is. Any takers?

## Thursday, December 4

### Python 3.0

Python 3.0 (also known as Python 3000) has been released yesterday, so I thought I'd give it a try. It turns out that a recent release candidate is in official Ubuntu 8.10 (intrepid) repositories, so I did not even need to compile anything: apt-get install python3.0 and we're done. You may want to read the summary of changes from Python 2 beforehand.

Here's a quick demo of unicode identifiers:

>>> 二 = 2
>>> 四 = 二 + 二
>>> 四
4
>>> import math
>>> π = math.pi
>>> α = π/3
>>> math.sin(α)
0.8660254037844386


This isn't quite APL yet, but we are getting closer!

## Friday, November 28

### Silly translations

Since I do some work on software translation, I have seen my fair share of silly translations (in my case from English to Lithuanian). Here's my latest find: in Gmail there is a choice of chat list for every person in the address book, and there are four options: Auto, Always, Never, and Block. The Lithuanian translation of the option "Auto" is ... "Automobiliai" which means "Cars". Took me a while to figure out what happened the first time I saw it. This ranks right next to the already classic wizzard button translation "Kitas", "Kitas", "Suomių" for "Next", "Next", "Finish" (translated back to English that would be "Next", "Next", "Finnish" – as the language of Finns) and my personal favourite: Finnish translated as "Finikiečių" (Phoenician).

FWIW I tried to apply for access to Gmail translations (there are many more inconsistencies, mistakes and screwups in there), but it seems that Google is not interested. I wonder if they have any translation quality control at all.

## Friday, November 21

### Computer-generated music

EMI (Experiments in Musical Intelligence) by David Cope changed my mind on the state of computer music generation software. I had come across numerous "music generation" programs, but it would have been a long stretch to call their results "music". They would produce, at best, strange patterns of beeps. I had heard of a live "jazz improvisation gig partner" machine (probably this one), but EMI is on a completely different level – just listen to the MP3 samples. Sure, in the end it is mostly splicing and rehashing of existing pieces, but Cope claims that in blind tests even experienced listeners would sometimes confuse an original piece by a composer and a composition by EMI. In other words, EMI passed the equivalent of a Turing test for music generation software. If that is not impressive, I do not know what is.

Unfortunately David Cope's site is skimpy on the details of how EMI works, even though there is an extensive bibliography (note the time span: 20 years!). At least some information can be gathered from the webpages of his numerous books.

## Thursday, November 20

### Book meme

I am a bit of a bookworm, so I could not resist this meme:

• Grab the nearest book.
• Open it to page 56.
• Find the fifth sentence.
• Post the text of the sentence in your journal along with these instructions.
• Don't dig for your favorite book, the cool book, or the intellectual one: pick the CLOSEST.

The book is actually a Lithuanian translation, but I'll translate the sentence into English for you:

After entering the palace, he seduced the king's wife, killed the king with her help and seized his throne.

Can you guess which book the sentence is from?

## Friday, November 14

### Non-native LCD resolutions

Now that LCD monitors have spread, I keep noticing one thing: lots of public places with computers have the resolution set to some non-native value. Blur in cafes, libraries, everywhere! It seems that people just do not notice the blurriness, and I do not really blame them – how could they know that there's a better resolution? This makes me think that it would be a good idea to warn the user on the desktop environment configuration level about reduced quality whenever the screen is an LCD and they are trying to switch to a non-native resolution. A non-intrusive, but informative message could do the trick, I think.

## Saturday, September 13

### Python syntax highlighting in LaTeX

LaTeX provides a listings package to typeset code. The standard output is great for black-and-white printouts, but not for beamer presentations, where a more dynamic color scheme would be suitable. Having recently worked on slides with Python code, I have prepared a file that you can include to get nice colourful code that looks good on a presentation:

My code is based on a snippet found on Ubuntu forums. I added some more keywords and tweaked the color scheme to correspond to the one that IDLE uses (that color scheme is not ideal, but my audience uses IDLE for coding and I wanted some consistency).

To use the package, copy the file to the same folder as your document and include it in the header:

\include{pythonlisting}


Then, to render code, use python sections:

\begin{python}
def foo():
print "bar"
\end{python}


Note that if you want to use this in a beamer frame, you will have to mark the frame that contains Python code as fragile, like this:

\begin{frame}[fragile]{Some Python code}

\begin{python}
def foo():
print "bar"
\end{python}

\end{frame}


### Better Russian-English dictionaries

A reader called Kuno notes that there are now some good Russian-English dict-format dictionaries available online. They are very likely better than the ones I extracted a couple years ago. The dictionary files suggested by Kuno can be downloaded directly, fetched with rsync (rsync rsync://dictd.xdsl.by/dicts/) or the server can be queried with a dict client (try "dict -h dictd.xdsl.by -D" for a list of available dictionaries).

## Monday, August 18

### Buffalo buffalo

"Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo" is a gramatically correct sentence! See Wikipedia for an explanation.

## Friday, May 30

### IronPython on Ubuntu

After reading on Jimmy Schementi's weblog that IronPython, the .NET implementation of Python, is just an apt-get install ironpython away, I thought I'd give it a whirl. Here's what I got.

Huh? Maybe Microsoft took that "significant whitespace" thing a little too literally...

It turns out that IronPython really wants you to use a dark background (bug report).

Ah, so that's why the background of Jimmy's blog is black!

As you can see from the screenshot, it's also a bit difficult to quit from the Ubuntu version of IronPython. That weird symbol is a result of pressing Ctrl+D. Even Ctrl+\, which usually helps in such cases, only produces a nasty .NET CLR traceback with no ill effects to the interpreter.

On the bright side, this is a good start. IronPython seems to be more or less functional, with speed comparable to CPython, even though the example code included in Debian looks a little "heavy" (see /usr/share/doc/ironpython/Tutorial).

## Wednesday, May 7

### Europanto

This made my day! Here's an excerpt if you're too lazy to click on the link:

"Als humanos, tambien nations, after seine geborn, become bambinos und grow adult. Aber als humanos, sommige nations never become adult und necessite psychiatrico help", dixit once Sigmund Freud aan Herr Kanzelier Otto Von Bismarck attemptante de le convince que Germania eine tumultuosa puberty was traversante.
Otto Von Bismarck ignored die wise parolas des fader des psychanalyse und wat happened aan Germania next, wir know mucho well.
Die freudiana diagnose noch todag applicable und validissima est, by exemplo, por wat Grosse Britannia betreft. Eine nation die encore play mit kleine soldatos und make carnaval parades out des season, mature est suremente nicht.
Wat pushe flegmaticos aged britannicos de dresse in hooliganicos costumes und parade mit tambouros und trompettes in der nordirlandico landscape? Sicheremente eine mucho neglected mentale desease.
Eine people waar hombres can wel dress in skirts, waar animals habe more rights dann mensen, waar man drive op de wronge side des strada, must echtemente seriose problemas van personnality habe. Eine people die nicht only play cricket und darts, aber les regarde tambien op TV, bastante insane must definitamente esse.
(...)

There are more texts in this, er, language, on the Europanto main site.

## Saturday, April 19

### Calibrating the keyboard autorepeat setting

The default keyboard autorepeat setting on most systems is boringly slow. Even worse, the delay before autorepeat kicks in is so long. This is great for novice users, but we programmers deserve better. Here's a calibration procedure that I use:

• The autorepeat delay should be as short as possible, but a concentrated, damp but short keypress should not cause multiple keypress events.
• To determine the most suitable autorepeat rate, test your accuracy. Open an editor and try to enter multiple lines of about 50 characters using the autorepeat feature. Pick the highest setting with which you can consistently get the line length within 2-3 characters of the target. (The 2-3 character margin comes from the practice of releasing the autorepeated key a little early and entering the remaining 1-3 characters, if any, with separate keystrokes.)

For me an autorepeat delay of ~250ms and 80 char/s rate works well. To get your numbers, you can use the command xset q | grep 'repeat rate' .

This tweak make the standard direction keys (and particularly the backspace & delete keys) much more useful: you can frequently get away without using special editor commands or, say, having to select things to delete them and thus resetting the X buffer. It makes things a little faster and more responsive. Try reverting to the standard setting after a few weeks of fast repeat to feel the difference.

## Sunday, April 13

### Perl program 'design'

Acme::Eyedrops allows you to 'design' your Perl programs (if you have any; you'd better not). Basically, given a Perl program and a "shape" file, it produces a perl program that visually resembles the given shape and behaves like the former program. Here's my favorite example:

    ''=~(        '(?{'        .(''        |'%')        .('['        ^'-')
.(''        |'!')        .(''        |',')        .'"'.        '\\$' .'==' .('[' ^'+') .('' |'/') .('[' ^'+') .'||' .(';' &'=') .(';' &'=') .';-' .'-'. '\\$'        .'=;'        .('['        ^'(')
.('['        ^'.')        .(''        |'"')        .('!'        ^'+')
.'_\\{'      .'(\\$' .';=('. '\\$=|'      ."\|".(      ''^'.'
).(('')|    '/').').'    .'\\"'.+(    '{'^'[').    (''|'"')    .(''|'/'
).('['^'/')  .('['^'/').  (''|',').(  ''|('%')).  '\\".\\"'.(  '['^('(')).
'\\"'.('['^  '#').'!!--'  .'\\$=.\\"' .('{'^'['). (''|'/').( ''|"\&").( '{'^"\[").( ''|"\"").( ''|"\%").( ''|"\%").( '['^(')')). '\\").\\"'. ('{'^'[').( ''|"\/").( ''|"\.").( '{'^"\[").( '['^"\/").( ''|"$$").( ''|"\%").( '{'^"\[").( '['^"\,").( ''|"\!").( ''|"\,").( ''|(',')). '\\"\\}'.+( '['^"\+").( '['^"$$").( ''|"\)").( ''|"\.").( '['^('/')). '+_,\\",'.( '{'^('[')). ('\\$;!').(  '!'^"\+").(  '{'^"\/").(  ''|"\!").(
''|"\+").(  ''|"\%").(  '{'^"\[").(  ''|"\/").(  ''|"\.").(  ''|"\%").(
'{'^"\[").(  ''|"\$").( ''|"\/").( '['^"\,").( ''|('.')). ','.(('{')^ '[').("\["^ '+').("\"| '!').("\["^ '(').("\["^ '(').("\{"^ '[').("\"| ')').("\["^ '/').("\{"^ '[').("\"| '!').("\["^ ')').("\"| '/').("\["^ '.').("\"| '.').("\"| '$')."\,".(  '!'^('+')).  '\\",_,\\"'  .'!'.("\!"^
'+').("\!"^  '+').'\\"'.  ('['^',').(  ''|"$$").( ''|"$$").(  ''|"\,").(
''|('%')).  '++\\$="})' );$:=('.')^  '~';$~='@'| '(';$^=')'^  '[';\$/='';


## Saturday, April 5

### The meaning of code

I had an "Aha!" moment today when I came to a Wittgensteinian realization that while the sense of a piece of code corresponds to the formal behaviour of that code, the meaning of the snippet is the set of possible contexts where this code could be used. This idea has changed my view of teaching programming (I have been teaching Python in a local school for a couple months now).

This attitude is nothing new, but for some reason I have not come across it, or rather, I have never seen it applied. (The fashionable problem-based learning thing has some similarities, but isn't quite it.) Having an idea to start from, it was not hard to find good articles expanding the idea. I especially liked Robert Strandh's short writeup on idioms and Elliot Soloway's Learning To Program = Learning To Construct Mechanisms And Explanations (1986). Experienced programmers will not learn much, but anyone dealing with CS education, teachers and students alike, ought to have a look.

The moral is that emphasis should be placed on reading exemplary code ("experienced programmers do X this way") rather than definitions ("function Y does Z"). Programming seems to be closer to language use than to mathematics, and teaching methods should reflect that.

## Saturday, March 29

### "Home" toolbar button on Firefox 3

The "Home" toolbar button seems to have been removed from the default configuration of Firefox 3. Moreover, it not trivial to get it back as it is not available in the "Customize toolbar" list of optional buttons either. It turns out that to add it you have to drag it from the bookmarks instead.

## Tuesday, March 25

### Reverting to packaged translations on Launchpad

It turns out that I did a poor job of looking for information on how to revert to packaged translations on Launchpad Translations. There is a bug report (#107737) on the very same issue with some useful information. Interestingly, the German team which reported the problem was even contemplating reverting all local Launchpad translations.

Furthermore, there is already a high-priority Launchpad blueprint for reverting translations of whole packages. There is no news on its implementation, but at least the idea is there.

## Saturday, March 22

### Pianofiles

pianofiles.com, a sheet music exchange site which I had mentioned two years ago, has gotten a nice facelift. It used to be very slow and neither very pretty nor convenient. Most of these shortcomings have now been corrected. It's a great place to look particularly for modern tunes which, unlike classical works (which are usually public domain anyway), do not have a canonical version, but heaps of arrangements and transcriptions of live performances. Quality of course varies, but point is that you can get your hands on many versions and compare them. Typical latency of requests is about a day. For example, just yesterday I fired off a few emails, and today I have got three versions of "Nardis" by Bill Evans. Feel free to ask for any sheets I've got.

## Friday, March 21

I am trying to add some order to the mess that is the Launchpad translation repository. Problem is, strings translated just once through Launchpad stick around forever, even if you change them in upstream later. In effect, a lot of translation bugfixes were not reaching Ubuntu users. I thought I had that covered. Unfortunately it's not the case.

I just noticed that in the Launchpad package list sorting by changed strings only sorts the first page! Initially I had noticed random package names and mistakenly thought that the whole package list was sorted. The whole list (~1500 packages, shown in 75 package chunks) is sorted by "importance", so it's basically random. Good luck finding modified packages in that haystack.

Seeking computer-literate monkeys.
Earn up to five bananas per hour!
Must be able to use mouse.

Unless... how about increasing the batch size? Turns out that in Launchpad the batch size is not capped, so by changing a URL parameter you can just set it to a high number, wait a few short moments, and get the complete list of packages. Sort that by changed strings and we're done, right?

We're done finding the local translations, but not fixing (reverting) them. The new, larger list reveals that there are more than a few of those with quite more than a few strings that should in 99% of the cases be reverted to packaged versions. Here's how that works:

Monkey operator instruction manual

1. Click on 'Packaged' radio button for all 10 entries on page (no batch size modifications allowed here...)
2. Click 'save'
3. Repeat until the page says 'No more translations'
4. Done. Not! When you click the 'Save button', the starting offset is changed for the next page. However, the translations you just marked are removed from the list at the same time. So, if you were looking at translations 1-10, after pressing 'Save & Continue' you will actually be looking at translations 21-30, not 11-20! To get to the 'lost' translations, you have to retrieve the list from the start again. So, load the initial page and go to step #1 to fix the remaining half of translations. Next time you reach this step, half of those will be left. Next time, half of half of those. Isn't that fun!

A brute force solution could be to write a script. That could save some bananas. Not that we could run out of them as this whole thing is pretty much bananas. That does not look like a clean solution though. Does anyone know if there there is a better way?

## Thursday, March 20

### Trickle the userspace traffic limiter

trickle (available in a package repository near you) is a neat little tool to limit network bandwidth of a particular app. It's very useful for those situations where you don't want your connection gobbled up, but the application in question does not implement traffic limiting. For example, to run a dist-upgrade capped at 30 KB/s, run this:

trickle -s -d 30 apt-get dist-upgrade

(Care to guess what I'm doing now?)

Note that trickle does not seem to work across the sudo boundary: don't do trickle -s -d 30 sudo foo, do sudo trickle -s -d 30 foo` .