Sunday, May 20, 2007

Human rights

I received the latest issue of Amnesty's Danish member magazine. A horrible and moving reading as usual. Hit by a cluestick: hey, there's a world around you!

The theme this time was Iraqi refugees. It didn't even go into much detail about the two million people who have left the country (two million people!), but instead explained how the Danish authorities are detaining the 519 who have come to Denmark in 2006. 47 of them have been let through and can restart their life.

The remaining are left in limbo. They have nothing to do, they are not allowed to get a job and do some meaningful work, their food is prepared to them so they can't choose what to eat, clothes and other personal stuff is only available at a local shop that operates by giving each refugee a number of points they are allowed to spend. According to one of them who has been living in the camp through her teenage years it's like living on a train station. Imagine growing up on a train station with nothing to do.

Meanwhile Sweden is letting 80% pass through. And Sweden didn't start the war.

The problem in Denmark appears to be the rule set. Imagine trying to codify compassion. It's a human trait, and an important one as well, maybe the one that makes us so successful compared to other species. But what is compassion anyway? How do you explain it in terms that a bureaucrat can understand and manage?

Apparently, the rule set the Danish authorities apply for accepting refugees requires that there is a personal element of prosecution. If your house has just collapsed from an American bomb and there are fightings in the street, is that personal? Maybe not. Do you have to move? Yes. And if you have the responsibility of taking care of others, if you have children, then you have a damn obligation to get away as fast as possible.

So the system is rotten. There are some hints for fixes in the magazine. The Danish association of doctors wants to examine the people living the in the camps. If they are getting provably ill in a medical sense, then they can declare the camps medically irresponsible.

Fixing the system itself is unfortunately not going to happen soon. That requires going to the politicians in charge - which in turns with the current aliens-generally-smell-rob-our-homes-and-rape-our-children political climate requires that the people starts changing it's collective mind. Appealing to the politicians themselves is not going to work.

So how do you change the mind of the people? I think the standard news stuff like "bomb in Iraq, 40 people killed" and then you see a smashed ruin covered with dust is part of the problem rather than of the solution because it gets people used to the sufferings. They start thinking, 40 persons killed, that's not so bad, it happened yesterday too.

I think we need more documentaries and even fictional movies about how it's like to having your house bombed and then come to Denmark and live at a train station with no freedom and lots of spare time for 5 years.

Oh, I almost forgot. The magazine also had an interview with Hans Blix, the former chief of the UN's weapons inspectors in Iraq. The US federal government wanted the war so badly that they even fabricated evidence (or let evidence be fabricated) about the famous non-existing weapons of mass destruction to convince people... Now two million Iraqi people have fled their homes and country.

Imagine being responsible for that. Of course the issue is more complex than that, but still. Two million people!

Monday, May 7, 2007

Algorithms

Just today I implemented bubble sort in Javascript to speed up the inner loop of a search algorithm. I think that's the first time I've actually implemented a sorting algorithm for real in spite of having read pages and pages about them. It's just one of the things that all real programming environments solved long before my time.

Of course, right after having implemented the bubble sort thing, I read on Wikipedia that it's actually considered inferior to insertion sort. So I then switched to insertion sort (I'm only sorting short sequences so asymptotic performance is irrelevant). It's my lucky day, two classic algorithms in such a short span of time...

The simple optimisation work did improve the running time by more than 400%, so that's cool.

When I think of algorithms I invariably come to think of the Knuth–Morris–Pratt algorithm, an algorithm for searching for occurrences of a search phrase in a larger text. A very famous string searching algorithm because it seems clever in theory and with toy examples. Your standard text book on algorithms probably does not mention this, but in practice it is not really an improvement over the simplest possible algorithm, because the issue it is trying to optimise, repeated examinations of the same character, almost never occurs when searching in natural language texts.

I found this out as an undergraduate when we were curious how KMP and the Boyer-Moore algorithm would stack up in practice. We discovered that KMP was only a 1% improvement in the number of characters compared, compared to the simple algorithm.

It's probably a great algorithm for searching DNA strings, though.

I added a note to the Wikipedia page. If I should die tomorrow, please consider it my contribution to the field of computer science.

Update

Long time, no post. I finished reading Naked Economics, it didn't take me more than a week. I still highly recommend it. It did have lots of interesting points on globalisation.

One is the notion of human capital. From a macro-economic point of view, one of the best thing a country can do is to invest in its people - education, health-care and the like. The return of investment as measured in cold cash is worth it.

One example of this is the fact that countries that are rich in natural resources don't fare particularly well in the long run - because they haven't had to invest in human capital. Another example is a research facility of well-educated engineers and scientists that has to close down. A local disaster in the short run, but the engineers and scientists are highly motivated individuals that soon find something else to do. If the facility is not simply bought by a large corporation that has no other interest in the facility than its human capital.

Another point concerns one of the dark sides of capitalism. Creative destruction - those who cannot compete cannot survive. Instead of fighting this built-in ground rule, the author suggests that the transition period be made less severe by retraining the involved workers and support from the authorities. Focusing on the future instead of the past.

From the point of view of the Far East sweatshops, the author notes that the people working in these shops would not be there if it weren't for the fact that they are better than the alternatives. I think that's simplifying things (*ahem*, did anyone mention the word "exploitation"?), but nevertheless an interesting point to ponder.

In other news, I upgraded to the new Ubuntu version at work. More incremental improvements, as always.