Thursday, 4 December 2008

The Good the Bad and the Funny

Credit where credit is due. Vladimir Putin may be a despisable person, but, damn, he's so Russian, he sweats Vodka:

French media had quoted Putin as saying in a heated conversation with French President Nicolas Sarkozy in Moscow on August 12 that Saakashvili should be "hung by his balls" for starting the war which was roundly condemned by the West.
Source: Reuters

The Russian soul is an intrepid one. They like their unbashed, dauntlessly honest attitude, they sell it as a feature, where some might consider it outright rude. Can't say I blame them for that. Hearing one of the most "important" persons on the world talking like that does find favor with me. That's probably my Slavic side, or maybe even the faint Mongolic or Thrakian genes, so I don't expect you westerners to understand that. It's great, because it's stupid, but it's manly, which is even more stupid, and that in turn, makes it great again.

He goes on:

"Seriously speaking, both me and you know about tragic events in another region of the world, in Iraq, invaded by American troops due to a concocted pretext of searching for weapons of mass destruction," said Putin.

"They found no weapons, but hanged the head of state, albeit on other charges ... " said Putin, referring to the 2006 execution of former Iraqi President Saddam Hussein.

"I believe it is up to Georgia's people to decide what kind of responsibility must be borne by those politicians who led to these harshest and tragic consequences," he said.

No matter what you may think about Mr. Putin, it does take quite some self-confidence to accuse the Americans so openly of wrongdoing. Demanding to hang the Georgian president by his balls for attacking another country under "false" premises is indirectly asking to do the same thing to George. Bush. Jr. Not that I would mind.

And I'd like to take that as an opportunity to remind everybody that, despite these brutish words, Putin is a man of extreme subtlety, and no doubt even those words were duly prepared and carefully placed (…or maybe I overestimate him?) I still think he's one of the most dangerous people on this planet (known to me, anyway) and I'm watching the current political "developments" in Russia with great unease.

Thursday, 20 November 2008

Tough Questions

Apparently, it's been "Philosopher Day" recently. Not that I noticed. BBC took it as an excuse to feature an article on "Four Philosophical Questions that will Make Your Brain Hurt." So far, my brain feels fine, and I'm only slightly amused. Let's consider them in turn.

Should we kill healthy people for their organs?

I first misread that as "Should we kill wealthy people for their organs" and thought to myself: "My, what a good idea! that's no hard question at all." Unfortunately, on second glance, the question turns out to be the same old utilitarian vs. moralistic clash. And mind you, that's not strict philosophy, it's more like ethics.

You cannot justify utilitarian reasoning with moral doctrine. But you can doubt the utilitarian thought on other grounds: Since there is no way of predicting the future, utilitarian maximes will always be based on assumptions and guesswork. See the world as a system of interdependent states. Killing someone is quite an action on this system, and can have unpredictable consequences. Letting someone die of natural cause might be seen as part of the system, and will have the usual consequences.

Trying to answer this question without having a look at the big picture isn't sensible, but that's what they're doing here. And that's stupid. The big picture doesn't care about one person or five. WWII eradicated the same amount in Millions, per year. Humanity recovered. The human race is such that it can compensate for the loss of individuals. The current human (Western) society is such that it cannot (easily) compensate for the (open) loss of individual values. On the other hand, doing such things implicitly, is perfectly valid, even in the most "civilized" of nations. Or when did you last flush your fecal matter down the toilet, while children in other parts of the world die because of the lack of (clean) water.

Are you the same person who started reading this article?

Ugh. Not again that ol' "Who am I?" question. Heraklit (sortof) says: "You cannot go into the same river twice, since the river always changes." The question is the definition of "same." Ergo, the definition of individuality. If you like to think of time as nothing more than another dimension, you'll just say, it's me, over there. A state change does not indicate a change in kind. Or does it? Anyway, this doesn't make my brain hurt, it merely provides a nice distraction best discussed with friends over some pints of beer.

Is that really a computer screen in front of you?

Solipsism. How boring. For all I know, yes it is. It is safe to assume it is. If I'm mistaken, so be it. Conventionalism is the keyword here. Yes, senses can be fooled, but, what isn't perceived isn't there. What isn't perceived by me, isn't there for me. Since I call it a computer screen, and you call it a computer screen, it is a computer screen. If it turns out to be a sentient life form, disguising itself as something useful, I'd probably still call it a computer screen, at least until I find a better name and use for it.

Did you really choose to read this article?

Quoth the article:
Suppose that Fred existed shortly after the Big Bang. He had unlimited intelligence and memory, and knew all the scientific laws governing the universe and all the properties of every particle that then existed. Thus equipped, billions of years ago, he could have worked out that, eventually, planet Earth would come to exist, that you would too, and that right now you would be reading this article.

Ever heard of quantum physics? This scenario is as absurd as it is impossible, because there is no way of knowing all state in the universe. Even if you did, there is no way of predicting how that state would evolve.
But I like the idea of calling god 'Fred.'

TeX on Blogger

It's done! After about an hour of desperately trying to set it up using various approaches, I finally came across Sounds very Web2.0, but it works!

\mathbf{Proof.\mbox{ }}\mathrm{ By\mbox{ }example:} \sum_{n\in\mathbm{N}} p. \mbox{ }\Box
Now that was one one-liner! Two problems remain: in-line (in-text) LaTeX symbols (this script requires the use of <pre> tags, which, by definition, open a new line) and the fact that I have to first publish the post, before I see the results.

I had hoped to take Blogspot's lacking LaTeX support as an excuse to roll out my own server and CMS. Meh, now I'll have to find another reason.

Like, nicer fonts in the equations, using my favorite font package. Yes, that's it!


Reading the source code, it may be possible to do in-line \LaTeX{} after all. Yeah. Just use the <code> tags instead.

Now you can expect to see several posts that have been rotting in my drafts section for a while due to lack of formula support. Let's just hope I don't promis you too much.

Wednesday, 19 November 2008

Overheard in Tübingen

"Ja, es gibt ja halt Zahlen."
"Und mit denen kannst Du dann rechnen."
"Und damit kannst Du dann halt so Daten verschlüsseln."

Saturday, 11 October 2008

(defun perspective (person) ( … ))

Dan Bikel has written a nice statistical CYK parser for Java, and it reads and writes Lisp syntax, namely Sexps. While I was coding on a project today, I was being watched and supported by a colleague. When I used Dan Bikel's Sexp class, hilarity ensued.
I countered her chuckles with an explanation of basic Lisp syntax. This prompted a curious reply of hers:
The inventors must have been lonely people.
Well, contracting 'symbolic expressions' to a word reminiscent of what computer freaks stereotypically lack may seem an awkward coincidence to some, but drawing a connection may seem like a stretch to others. Sadly, there probably is a grain of truth in such… assumptions.
Upon demonstrating to her some real world examples of Lisp code, and after the inevitable "all those parens!", she uttered
The inventors really must have been lonely people. And bored ones at that.
Poor Lisp. Is that what people think of you today?
Lisp is old. Very old. But just as Prolog, it is still around, and that alone justifies its use. In fact, most of what people use XML for nowadays should rather be done in Lisp syntax.

Wednesday, 8 October 2008

Thou Shalt not Forget Those Who Are Afraid of Upgrades

I don't know how often I will have to curse about type erasure in the Java HotSpot VM. It is a pain in the… EVERYTHING. And the only reason for it is, of course, our sacred backward compatibility.
Some core library functionalities are utterly broken. How can a parameterized ArrayList's .toArray() return Object[]?
All because of type erasure. class Foo {{T[] = new T[42]; }} is illegal, because the runtime would have no clue as to what constructor to call for the array (it doesn't know its type). It boils down to: you cannot instantiate Generics. OK, you say, it wouldn't make too much of a sense anyway, but you see, it has side effects. Ever bothered to read the code of ArrayList and other parameterized standard collection types that use an array as a back end? Don't, if you want to retain your sanity. The heart of it is a lot of dirty casting, made necessary because of the way Generics are implemented (oh, the irony.)
One of the proposed features for Java 7 are Reified Generics, but somehow I doubt they'll make it into the language anytime soon. There's just still too many people around using a 1.4 VM (YES, Apple, we're looking at YOU) and introducing another substantial change to the way Generics work would make them even more complex than they already are (Yes, that PDF has more than 500 pages. Yes, it's mostly about Generics.) So, probably we'll have to just keep up with that crap. Microsoft did it right in .NET. Pity it's a closed platform.

</rant> [1] You have to first create an Array of your Type T (a literal type, not a Generic one) and then pass it to the overloaded .toArray(T[]).

Tuesday, 19 August 2008

Luv Github

You gotta love github at least for their error messages: I know whom I have to blame that I can't but think about tentacle rape porn now...

Sunday, 10 August 2008

What Do You Want To Live For?

There he is, the mid-twen, contemplating the meaning of life. Take care of your career, or go farming the fields? Why not do both? Why live at all?
You're not asking yourself these questions?

You should.
And then some more.
It seems MediaStorm is an invaluable resource of doubt. Doubt every breath you dare to take, every word you write. Doubt them as being privileges you haven't done jack for.

"What are you complaining about? That's the best system we have, and don't tell me it's not working fine!" Being equally ignorant as the feudal ruling class, people fail to see what's happening outside their parks, castles and palaces.
Only the dimensions have shifted. It's a global village now, The West being an enormous castle of nescience, feeding on everybody else.

But what do I do for it? Nothing. Yet?

Saturday, 26 July 2008

The Power of ASP.NET

To all you web admins and coders of web servers: please make sure to fail gracefully. What does that mean? Well, you shouldn't present your potential readers with such hilarious demonstrations of your own incompetence:
HTTP/1.1 404 Connection: close Date: Sat, 26 Jul 2008 13:35:29 GMT 
    Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET 
What's that? A decent 404 message? No! A decent 404 message should include at least an excuse, a clear description of the problem, (not everyone knows how to make sense of something like HTTP/1.1 404 Connection: closed.) and probably a sitemap or search resource to find the content the user came to your web page for in the first place!

Friday, 25 July 2008

Safer startx

Many people claim one should be using a display manager for starting one's X session. One oft cited reason to do so is that when you use startx to fire it up, a malicious person could just circumvent any lock you may have put on your X-session by [ctrl]-[alt]-[←]'ing the server and then being dropped to the console.
However, you can just use the following command:

This will exit your session once startx exits. Since X traps all signals, switching to the tty and trying to suspend it won't work.
There's one catch though: my default shell (zsh) will warn you about programs you may still have running in the same shell before exiting and thus prevent the exit command from actually doing its job. So you should be careful about this, or just alias startx so that it first turns off the offending shell option.
This is, of course, also handy for safely giving away restricted prompts to other users (su someuser comes to my mind).

If someone knows a reason this is not safe, please tell me :-)

Edit: I initially thought the pun in this post's title would work only in German, but it appears to be OK for English, too. Thanks to ke for pointing this out.


I'm such a jerk. Just use the shell's built-in exec. Sheesh.

Wednesday, 23 July 2008

About the Inertia of Programmers

The Adoption Formula

Over at the Arc Language Blog, there's a nice post trying to give a reason why cool new technologies like Haskell don't catch on nowadays - and why cool old technologies like Lisp didn't catch on some years ago. I'd toss in some Prolog, too - although one reason for Prolog not to be adopted was surely that it was a pain to run on olden days machines.

What they say, basically, is that languages like Lisp or Haskell (or Prolog) are solutions in search of a problem. Not that they're not cool. They are. But who needs higher order functions in programming?
The basic problem is a relation between a certain user's crisis (set of problems, if you so prefer) and the pain of adoption. Let's face it: programmers are a lazy bunch. We'll try not to deviate from the known path any more than we absolutely have to. We remember what a pain it was getting here in the first place. So we have to have a big crisis and some solution that can easily solve this crisis by offering us a way to approach our problems that feels similar to what we already know. Since Haskell, Lisp and Prolog all offer solutions to a set of problems most programmers are not even aware they have (and therefore probably don't really have in the first place), not many people bother picking them up. If they offered solutions to problems programmers know they have, they would see a wider range of adoption.

To make it a bit more clear, take Linux as an example. When Linux saw the light of day, there was an operating system crisis of some sort: Windows dominated the markets and UNIX-based solutions for home PCs weren't cheap or viable (or at all available). BSD was closed source, the HURD was the same vapor it's today. Linux offered UNIX-geeks an easy way out: an operating system that's the same in many aspects, except for those that weren't good about the old one. So that's why Linux got big in geek-world.
But on the desktop market, where grandma and all those pathetic stereotypical example PEBKACs can't tell the difference between a browser and a mail application, Linux is still largely unheard of. Why? Well, Linux solves problems grandma doesn't even know how to spell, nevermind realise having them. Free software? DRM? Hardware support? Stability? Security? Who cares?
Spinning 3D cube? Oooooh, shiny!

That's All Folks... is it?

I'd argue that there is one more aspect to it: if technologies like Lisp or Prolog didn't get adopted, why are they not forgotten? Heck, even COBOL is still around and COBOL is everything but cool. There's an easy answer: those languages found a niche. Lisp has always been big in AI development. COBOL, who knows. Prolog has always had a nice and warm room in the basement of universities - and is now catching on in NLP. In those niches, people come from a different background. They have a different notion of pain. For me, managing pointers, malloc() calls and machine code are a pain. I can deal with the first, don't really understand much about the second and have an allergy to the third. But higher order functions? I've had dreams which happened in intensional logic (that was after reading a paper by Groenendijk & Stokhof, I think)! That was a weird feeling waking up, I can tell you.

Also, our crises are different: we need to interface with inferencing tools, and translate logic and mathematical formulae directly into machine instructions. Doing this in C is a pain. I have nothing but admiration for the people behind prover9/mace4, but I'd argue that Haskell is more suitable for that task. A solution that is less of a pain for us is Prolog. You can program almost the same way you write things down in theory (and quickly see where your theory is failing. Damn). You can then go on debugging your theory and back again to punching it in. To a person doing work in IT business, Prolog will look like a complete disaster. What, no unit tests?. Well, no. But you have guitracer/0 :-).

So, I don't think that Prolog has to catch on. It's good enough if it stays around. Haskell is more suitable for an even wider range of tasks (basically everything), but probably even more of a pain to get started with. But it seems that recently many people got interested in Haskell. The Programming Reddit is full of Haskell lately. And there is now a haskell-beginners list and it seems that introductory CS courses at Tübingen University are being taught in Scheme. Functional programming has received a lot of attention lately - let's see what comes out of it.

Meanwhile, I don't care. As long as Haskell and Prolog continue to be developed and used by a certain niche population, I'm happy. I'll be using them happily. They solve some crises I have, they are not a big pain to adopt if you come with a strong background in logics and sorted type theory. And every time I cuss at Prolog, I have to remember: would it be any better doing this in Java? Probably not.

Oh, and by the way: if you happen to wonder what good books there are on learning logic: Read Gamut's Introduction to Logic and also Volume 2, Introduction to Intensional Logic. Some of the best books I've ever had the pleasure to read. Somewhere next to Camus' Stranger, Dostojewski's Idiot and Nietzsche's Zarathustra.

Friday, 18 July 2008

Advertent Curt

Wohoo, I handed in my BA thesis topic today:

From Questions to Queries

Enhancing the Curt System by a Theory and Implementation of Embedded WH-Questions

The Curt System is implemented in Prolog and presented in the last chapter of Blackurn & Bos (2005), a brilliant book about Vincent, who loves Mia, every owner of a hash bar and foot massages. Oh, and computational semantics. And boxers.

Curt is short for Clever use of reasoning tools. Blackburn & Bos use external inferencing tools, a DCG grammar and an emulation of λ-Calculus in Prolog to put together a nice system that is able to parse sentences according to a toy grammar, construct (discourse) models and logic representations of the discourse. They use inferencing to check the discourse for satisfiability and validity.

They develop several variants of the Curt System throughout that chapter, gradually introducing external inferencing, satisfiability checks, validity checks, model building, world and situational knowledge, ontologies and, last but not least, a way to interpret questions in their framework. The last version of the system is codenamed "Helpful Curt" - it can answer basic direct WH-questions by substituting the WH-phrase for an existential quantification over an uninstantiated variable and running a bit of inferencing magic on it in order to find a result.

Advertent Curt

But I found that a bit ad-hoc. Basically, all of the system is a tad ad-hoc (they use Keller Storage for it still!) and it could use some work in order to become really awesome (although it's already quite awesome!). I'd like to show in my thesis that it's possible to introduce a formal account of question semantics into the system. I'll be following Groenendijk & Stokhof's analyses for the most part, also arguing about Karttunen's earlier approach. The main reason for me choosing G&K over Karttunen was that the former use Ty2 to describe their system, whereas Karttunen stays in traditional Montague IL, which would be harder to transfer into the Prolog world.

Ideally, the system should be able to handle the following types of questions:

(1) Vincent knows whether Mia loves Marcellus
(2) Marcellus believes Mia loves Vincent
(3) Every owner of a hash bar knows who likes hash

But why embedded questions?

Almost all accounts of formal question semantics (I know of) treat direct questions as a subtype of embedded questions (Well, except Hamblin, but that's obvious[ly not adequate here]). Once we solve embedded questions, implementing a few transformation steps to translate (4a) into (4b) should pose no problem.

(4 a.) Tell me who owns a hash bar.
(4 b.) Who owns a hash bar?

In this regard I'm taking the very opposite of the more pragmatic approach by Blackburn & Bos, which explicitly handles direct questions only.

I will try to keep the blog up-to-date with progress and ideas :-)

Saturday, 12 July 2008

Anachronism isn't what it Used to Be...

I'm not an English native speaker - and sometimes I find myself in a situation where I need to look up a word from the dictionary in order to find more graceful-sounding synonyms, et cetera. But the dictionary is not always very helpful. Consider the following query in a thesaurus:

Synonyms for begin: … inaugurate …
Well - using to inaugurate right away would lead to strange results, because it's not really used for anything besides politics nowadays.

Concordance and Collocation

This means that sometimes you'll have to not only search for the translation or synonyms of a word, but also for usage examples. A good Dictionary typically provides you with some, but is also usually limited in the amount of examples it can display. This is why looking at occurrances of a word in real text together with their immidiate context is sometimes unaviodable (and in fact the way dictionaries are made). Linguists call that concordance, for grammatical agreement (e.g. using the right temporal form or aspect or the right preposition) and collocation for statistic relatedness (two or more words that form a phrase or a certain reoccurring pattern in language). What linguists now do to find out how a word is used, is, they search for the word in corpora and then classify its context - and patterns thereof.

A Poor Man's Corpus-engine: Google

But such corpora are usually hard to get or expensive, since virtually every accumulation of a non-trivial amount of text will contain copyrighted material (and it's often not easy (read: expensive) to enhance the signal-to-noise ratio). So, as a poor man, one has to resort to Google or equivalent search machines. Searching for a particular word or phrase in Google will often give satisfactory results for its most typical usage patterns. Phrase queries often help to narrow the scope of possible collocations.

… and while doing a bit of research I discovered the following: A word is archaic if the first two pages of Google hits for it return only results from dictionaries. Try searching for advertent (heck, it's not even in vim's default word file on Debian anymore…) as an example...

At Night, Alone with the Computer...

My favorite Prolog dialog

?- true. true.

A lonesome bungalow in the forest; a man; his computer. A conversation arises.



This is probably just a temporary location, 'till I find some other place on the Net. My blog used to be hosted at Baywords, but they seem to have screwed up something.

So long, have fun.

Saturday, 7 June 2008

Folding in VIM

Code Folding in VIM

Vim is arguably one of the most awesome editors around. I use it exclusively, extending it with many plugins. As of version 6.0 Vim supports code folding, a nice way to hide blocks you don't need to see and thus reduce the visible complexity of the code you're editing.

Vim accomplishes this using a foldmethod which can guess where to fold the code based on syntactic hints (defined in the syntax file of the FileType you're using), indentation and other methods, including manual mark-up of foldable regions. It then calls a function stored in foldtext that computes a text to display instead of the text region folded away. You can see vim's default foldtext in action here:

Here used to be a screenshot showing some code blocks in VIM, but think it's funny to molest people into not using their service, rather than just telling them...
I'll try to replace it soon.
Here used to be a screenshot showing VIM's default code folding routine in action, but think it's funny to molest people into not using their service, rather than just telling them...
I'll try to replace it soon.

Rolling your own

I find Vim's default foldtext a bit hideous. Most importantly it messes up indentation and I'm very religious abuot indentation, given I'm a horizontal reader and use 8 spaces (one traditional tab) for indentation. So I tried to came up with something minimalistic that would preserve indentation on collapsed folds, using my traditional fold method syntax. I failed, but Heptite I met in #vim on helped me out with this code:

set foldtext=MyFoldText()   " Folds preserving indentation and without clutter function! MyFoldText() let i = indent(v:foldstart) return repeat(' ', i) . substitute(getline(v:foldstart), '^\s\+', '', '') endfunction   " Reload folding nmap <F3> :syn sync fromstart

The function MyFoldText() was his idea of approaching the problem. I had some trouble coming up with one myself because getline(v:foldstart) seems to include a leading indent which messed up the folding when a syntax element triggering folding (as defined in the syntax file) would be split across more than one line (like a bloated method declaration featuring many throws or arguments). I really think that this is a bug in Vim's folding method and eliminating leading spaces with a substitute command is just a workaround, but it works quite well for now and gives very pleasing results:

Here used to be a screenshot showing my current code folding routine in action, but think it's funny to molest people into not using their service, rather than just telling them...
I'll try to replace it soon.

A look at a Tagger with code folding enabled.

Friday, 6 June 2008

Shit happens.

... only to you and when you'd need to get stuff done as quickly as possible
Here used to be a screenshot showing one of IBM's documentation resources about UIMA down, but think it's funny to molest people into not using their service, rather than just telling them...
Ah well, I'll need to remember that docs myself now. That'll teach me to sync documentation offline. BTW. Another great example why creating a dark-net to store something as harmless as documentation and/or howtos is braindead. If they hadn't forced me to sign up for their service, I could've used The Internet Archive or the Google cache.

Sunday, 25 May 2008

Uncanny Rattles at Night Time: Johansson Sings Waits

So I decided to write something up about this new album I recently downloaded after hearing about it from people at kaioo.

I've been a huge Waits fan ever since I listened to Frank's Wild Years for the first time. His exotic grumpiness, his vocals, lax and stern at the same time have fascinated me from the beginning. The music is alsways a bit chaotic, most of the time the instruments provide only a thin layer, every one is just covering its own spot, its own frequency, while Waits' voice paints the songs in melancholy and wisdom. For me, Waits is like a father I never had, he feels like someone able to teach you about the miserable aspects of life, about pubs, prostitutes and alcohol. And music.

I've never really heard much about Johansson before; I knew she was some kind of Hollywood celebrity, but I never really was into Hollywood nor celebrities. Only after investigating a bit I realized I had seen a movie starring her: Lost in Translation. I didn't really like the flick though, it felt mediocre.

So, a mediocre (by my standards) actress starts singing Waits songs? This could either be a complete catastrophy or really interesting. Anyways I had to give the album a try, so I went out to get it. But I was afraid to touch it for another two days.

I had expected a bubblegum pop album. Or a really really good album. Or something entirely mediocre and trivial. It was neither.

The album still feels entirely strange to me. I can't really open my mind. Do I like it? I don't know. I don't hate it. But I expected something different and hence I'm completely disoriented. I must say that I can see Lost in Translation in this album. But, actually, the good parts of it. The waiting, the to-no-avail-ity, a lot of its melancholy. It starts completey soundtrack-esque, with an instrumental intro. The first bits of her voice in Town with No Cheer, are preceded by caribbean-sounding steel drums - and manage to surprise you. I expected her to sing better. After all, she had all the money of the world to let all sorts of machines sing instead of her. But, as someone posted in her shoutbox at - They didn't even try to pretend she can sing. They just let her go away with slight mistakes in pitch and a pretty monotonous voice. A voice not without charisma, but also with a lack of talent. She'll have to make up on it with character and innovations in future releases. I'll let it slip for this one, but I won't for the next.

All songs are covers, except for #6, Song for Jo, my favorite. This tune and Green Grass, #7, are the greatest songs on this album.

The atmosphere is very post-y, very melancholic. In contrast to Waits' instrumentation, the album feels a bit over-produced, too much reverb, to many stray notes wandering in a sound scape that feels very impressionistic overall - whereas Waits feels more like an expressionist. Instead of the contured, sharp tone of Waits, Johansson and Sitek deliver blurred and fuzzy sounds, sometimes even drone like. Her voice feels like Karaoke on some tracks, especially on I don't wanna grow up, a ... Disco tune! She appears to be a girl next door, taking huge sips from the 90's trash cocktail, while casually mentioning that she'll "drink you under the table" in I Wish I was in New Orleans, the only of Waits' earlier tracks on here. Unfortunately, she (or someone else) decided to pick mostly Waits' later works, which I'm not that familiar with.

Overall, this album feels strange and new. It's like soundtrack meets Waits meets that cute lost little girl in Japan, that's actually Danish, but an American actress. I tagged it drone-pop and post-waits since that's what it feels like for me.

I think I like it.
It would be hilarious if Johansson started a nice alternative/experimental music career frome here. But somehow I think she won't.

Saturday, 24 May 2008

Use the Cluebat, Luke!

Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal.
F. Nietzsche

Sometimes us programmers are faced with what I would call the most ridiculous and humiliating aspect of our work:

You come across a problem. You start thinking about it. You find it ever more complicated, but you go on and on. Actually, this is only one of the obstactles in your way to achieving your original goal, it's probably not even got something to do with what you were trying to accomplish in the first place...

Finally you come up with a solution. It took you 2000 lines of code, it reduced your app's performance by 40%, true, it still may have some bugs you don't know of - along with a couple of bugs you know but have no idea how to solve and hence try to sell as features; but, hey! the problem was complicated, after all! And you solved it. Yay!

The glistening, glaring enlightenment strikes you once you're presented with a comment such as

"Why didn't you just use random one-liner-solution X?"
on your work.

Of course, your immidiate response goes "Huh?". Your brain feels like it's shrinking. No words available, they're all gone, along with your self-esteem, your thinking your're intelligent and all your coding skills. You've just spent a week's worth of coding time in vain. Everything you did was ugly and totally uncalled for. You take the blame.

This happened to me yesterday, and the apathy and fear of code is still here, hampering my productivity and just about everything. If it wasn't for the great music pumping out of my speakers, I would even not feel competent enough to blog about it... Here's what I did.

I'm currently working on porting a second-language-acqusition-aiding-system (Think taaaanks! We need a nice buzz-word for this, pronto!) from mod_python to Java & Servlets (in Tomcat), utilizing the Apache/IBM UIMA-architecture. The program fetches remote web sites and performs (not-so-)random input enhancement on them. The problem was displaying remote websites properly on my own server, just like Google Translation does. Long story short, I went to considerable lengths to replace all relative paths in a given page with absolute ones to get the source adresses for extra content right. It worked. Sort of.

Then I went to my advisor, and, whoops... Ever heard of the HTML <base> tag? Me neither. It's not even ONE line, replacing all of my crafty and barely readable regular expressions. My conscience faded. Good thing I didn't drop dead right on spot, though I surely wanted to.

Now I have to gather focus on performing the serious tasks at hand. Fortunately that's something I should know better - really, I think this sort of mistakes happens because you hit a spot in your app where you have to perform a task you don't know shit about. You don't know the libs people use there, you don't even know how to approach the problem. I asked people on #tomcat and #java on, but they couldn't help me either. They were all programmers, I should've asked some web designer. But I didn't... I went all finite state on it, bombarding the poor thing with hideous regexps, wasting my time on a problem that didn't really have to exist in the first place.

Oh well, 'tis one of the moments, where I just tend to pessimism, reminding myself about this great quote I came along in Nietzsche's "Menschliches, allzu Menschliches". Strangley, pessimism, like doom metal makes me go optimistic.

Nothing lives which would be worthy
of your striving, and the earth deserves not a sigh.
Pain and boredom is our being and the world is excrement,
—nothing else.
Calm yourself.
G. Leopardi

There it goes. People screw up stuff all over the place. This time it had to be you. You're not even special in failing. Go on, dipshit.

Saturday, 26 April 2008

Where Sun Don't Shine

Sun are a big company. Really big. They created some of the most reliable server workstations, some of the fastest processors, some of the most stable OSs in the world. And they created the as of now most-used programming language, Java. Java is sort of nice. It's dumbed-down C++ with some enhancements, it's not feature rich, but nobody in their right minds wants a programming language to be feature rich. I'm a big advocate of "the right tool for the right job" and feature rich languages seem to contradict to that credo. Java is the right tool for many jobs: GUI creation in Swing is easy and straight forward, networking closs platform is painless and portability is one of Java's main selling points - because it's really easy. The only thing you have to keep track of is the JVM and source version and there you go.

I guess if we lived in milk-and-honey-land, that would make Java a perfect programming language. But it isn't, and milk-and-honey-land is far off. Java was supposed to bring interactive web pages to the clients more than ten years ago (note that JavaScript has nothing to do with Java). It failed. And miserably so, I must say. There's nothing that turns me off more than a page using a Java applet. They are ugly, they are slow to load, memory hogs, and they are buggy.

But I don't care about applets. Servlets are a much better technology anyways, and I found Java to be really useful for Web programming. But this rant is really about Java on the Desktop and about Java for the programmer. Over the years, I've come about some rather annoying misfeatures, bugs and Sun's stubborn way of not wanting to address bugs that have been known - literally - for years.

  • Swing sucks, after all. It's ugly. It's slow. It's bloated. It lacks a set of really useful and easy-to-customize stuff in the library. Heck I remember hacking Delphi used to be more fun than Swing. At least you didn't have to call.thatMethod().somewhere().InAnInnerClass(WayDown.theCamelCase.objectHierarchy()); But see below
  • Swing sucks even more. Ever tried to run a Swing app on X using a window manager that is not one of {Compiz,Metacity,Kwin}? Well, good luck. <3 grey boxes. This has been a bug for a long time, Sun claim it's fixed. It ain't. It's fixed for Compiz, everything else still has problems. This is because some mind-bogglingly stupid intern at Sun had to hardcode the goddamn fucking names of Window Managers into .equals() checks of the kluges used for circumventing the original bug. The result? My favorite window manager, XMonad, displays Protege like this.
  • Many people seem to argue against 8-space indentation on the basis of Java code exhausting horizontal screen space even on 1900xX resolutions. That shouldn't be the case. typedefs, operator overloading, sane object names (SomethingBadHappenedButIReallyDontKnowWhatExactlySoHeresAnException, anyone?) and more modern stuff like partial hiding/importing/exporting (like in Haskell) could greatly improve on the situation.
  • Inexplicable syntactic difference between dynamic and static arrays. Yeah, I know, it's just syntactic sugar. Go write your stuff in ASM, then, if you don't like that.
  • No way to generalize a static array. If T is a generic type, T[] stuff = new T[x]; is illegal. But a function header like void some_function(T[] stuff) isn't. This means that you actually can have static arrays of generalized types, but you have to work your way around like T[] stuff = (T[])Object[x](); This is ugly, and, moreover, it's dangerous. It's also a restriction that hits the language quite hard. Don't believe me? Read on...
  • Not only that, but you are not allowed to create arrays of inner classes of parameterized classes. That's right. No, I know it's stupid, but it's the way it is.
    public class General<T extends Something> { InnerClass[] ic = new InnerClass[10]; private class InnerClass { int data; } }
    This will not compile. It fails with the oh-so-descriptive-and-helpful error message "generic array creation". There you go, the inner class doesn't even use that freaking parameter type. It's enough for it to be a subclass of a paramaeterized type. This is especially annoying when you have to create, say a tree class that is to store all sorts of interesting different types. That would be what them Generics are good for in the first place, right? Well, if you want the tree to have, say, 4 children per node, you'd love to do that using a static array, right? And inner classes are usually the best approach for making a specialized Node class... But in Java, you have to suffer compiler warnings and unsafe typecasts to do that.
  • You can't pass functions as arguments. That's because there are no function pointers. Meh. That makes NLP systems and natural language processing (especially computational semantics) unreasonably complex, because you'll have wrap it all up into classes. But this may fall under the right tool for the right job clause. I've long since wanted to switch to Prolog, C++ and, lately, Haskell for natural language processing. They're way batter at that than Java.
  • This isn't even as much as I expected it to be, but there's more that I've missed for now. Jamie Zawinskie has a lot more on this, but I do not share all his views. Maybe it's that I'm just no C programmer and therefore I have a whole different set of expectations. Maybe I just don't understand all of his points, but I couldn't agree more with most of the stuff he describes. When you google for "why java sucks", you will find a whole bunch of pages. About 3000, for the phrase query. That's a lot for a phrase query.

    I don't say Java sucks in general; it's an OK language for quite a number of tasks. And it's probably even the language I know best. But it has deficiencies, and quite some and then some more. I'll be moving on to greener pastures from now. Prolog sounds nice, it's well suited for what I'm currently doing. Haskell sounds even nicer, and I spend every free minute I can find with monads and similar stuff. I'll probably blog about it, too, when I'm good enough at it. ;-)