Archive for September, 2006

why "how are you?" is pointless

September 16th, 2006

Some people who barely know me greet me with "how are you?". Now it's not that "how are you?" is a bad phrase, or a bad thing to say. Just that it's a filler for a situation that requires a sentence, without giving it any thought as to what you are saying. It's fine to say "how are you?" if you mean it. But otherwise it's pointless. And if you ask this person the same question "and you?", they won't say "oh today I'm excited cause I'm doing this" or "today I'm a little depressed cause I gotta do this". They just say "fine". So what's the point? Every time you ask the question, no matter how the person actually is, they will say "fine".

On the other hand, "what's up?" is just a little less pointless. The answer to "what's up?" is usually "oh nothing much", but there's a greater chance a person will tell you what they're doing than how they feel, because the latter is more personal. In fact, some people answer "what's up?" very sincerely, they will actually tell you.

Da Vinci Code: worth the wait

September 16th, 2006

I don't recall seeing one positive review of The Da Vinci Code. Which is why I didn't insist on seeing it as soon as it got out either. People have been trashing the story left and right, but I have to say I love this movie. The story (for the purpose of a movie anyway) is 'good enough', but beyond that it's such a cool theme, cool effects, lots of French and Latin, not too many obvious revelations. And Sophie, elle est trés sympa ;)

da_vinci_code.jpg

I had this imagine in my head of what the movie would be, and it isn't that at all. I can't quite say what it is that draws me to it, but watching it I felt like I was in a very special atmosphere, thoroughly enjoying the events rather than wanting to pick them apart. What I also found satisfying in the plot was that there literally was noone trustworthy, which makes a lot of sense. The historical references were cool and well placed.

Not forgetting the one very important factor contributing to this wonderful experience - the score. I've already heard it forwards and backwards basically, but to hear it in the movie is greatly satisfying, especially in the culmination point where we are treated to Chevaliers de Sangreal, a masterpiece. :star:

with time to spare

September 15th, 2006

Tennis is a funny sport. I've started playing recently, after a long, long break. I've never actually 'played it' in the proper sense of the term, never belonged to a club or anything like that. I used to play semi-regularly for a while as a kid, and it was fun. But tennis not being a popular sport in Norway (to put it mildly), I never took it any further. I guess I could have, but I preferred football and basketball. So now I live in Utrecht, there are plenty of courts in the student sports club and it's affordable.

But not having played for half a decade shows very well, I'm very awkward with tennis these days. The weirdest thing is having too much time. When there's a rather weak ball coming across, I have all the time in the world. I can chill for a while before I have to move into position. My technique, of course, is horrible, I need practice. But this period of 'free time' is very unsettling, it throws me off the rhythm. Just a moment ago I was in action hitting the ball, now I'm taking a break before the ball comes back. It's totally the kind of situation where I don't know if I should walk or run, I'm sorta on the fence about that decision. Tennis can be very dynamic, but it can also be very slow. And when you're not playing well, it's mostly slow. So I'm taking my time, I'm not rushing and I'm not getting the practice for using my time well. So when a fast ball comes at me, I can't cope with it, suddenly it's too fast. Not because I *couldn't* have reached it, but because I don't have the proper rhythm to react fast enough.

Interestingly, I don't play well under pressure. And in tennis there is no reward for a good performance overall, only the last ball counts. So even if I have a good exchange, I usually mess up the last ball and lose the point. Today I was taken to the cleaners, 6-0, 6-0. :D I didn't really feel up to playing a match, I'd rather just get more practice. Practice was going much better, much higher play to wait ratio. But sometimes you have to accommodate people.

Still, the biggest problem is finding people to play with. My tennis partner put up an ad to attract players and I responded to it. And apparently the other handful of people who did had no clue what they were doing, much worse than me even.

I would like to get a regular schedule going, but at the end of the day I'm still wondering if tennis is dynamic enough for me.

On the way home I stopped by these people who advertised they wanted to get rid of some tennis balls. Good lord did they hook me up, 4 boxes, 2 never even opened. Not only that, they wanted to give me a plastic bag full of old balls. All for just €3.5, which is a pretty damn good deal. I took the boxes, already a lot more balls than I need. They also had lots more golf balls, but I don't play golf. Super nice people too, Pakistani would be my guess. Apparently the husband used to play, but now they have a baby, so there's no time.

irregardless

September 13th, 2006

I love this word. I don't even remember where I saw it (it may have been some blog discussing language), but I feel a strong urge to use it. And I haven't found a context in which it would apply yet, but it's a wonderfully confusing word. It also sounds wonderful. Say it out loud to yourself, slowly, to really appreciate its elegance. :proud:

I received a letter today which contained the word irrespective and it immediately reminded me of a word I saw some time ago and wanted to use. It took me a while to remember irregardless, but now that I've blogged it, it's unlikely to escape me again. :cool:

Irregardless, one must do what one must, mustn't one?

fixing greedy emoticon matching in kopete

September 13th, 2006

I have a lot of admiration for the KDE project. The way that things come together and integrate into a common desktop with KDE is quite extraordinary. And all the time there are people interested in improving just about every bit of it. Now, of course, it's all about KDE4, the long awaited upgrade will come at some point in 2006, I guess the date hasn't been set yet.

Anyway, the beauty of free software is that if there's a bug that gets to you, you can fix it yourself. And one such bug irks me in Kopete. I've been testing the xtorg emoticon theme and with a fairly rich set of emoticons (82 images, 117 replacement strings), it's quite a good testset and exposes certain problems. The emoticon theme comes with a file called test_suite.txt, which just lists all the emoticon replacement strings, so that you can paste them into a chat client and see if they come up correctly. The special thing about the xtorg theme is that I've made sure to include the most common Msn Messenger strings, so that Windows people can reuse the ones they're used to already. In Kopete 0.12.2, using the test suite gives this result.

kopete_bugged.png

So evidently, Kopete's parsing of emoticons is not as good as it could be. I have examined the issue and found that the problem lies in non-greedy matching. This means that if : s and : s t a r : are both defined as emoticon strings, and : s just happens to appear before : s t a r : in Kopete's internal list of emoticons, : s t a r : will be parsed as [: s] t a r :, not as [: s t a r :]. This is not what the user expects, having defined a list of replacement strings, the user expects all of them to work.

This is not the kind of bug that will affect a lot of users, because the average user does not use big emoticon styles like this one (and will probably never encounter the error). Thus if I were to report the bug, it's not likely to be very high priority. Meanwhile it does bother *me*, so I thought I would try and fix it myself. So after a little hacking, I wrote a patch for Kopete, and it now does this.

kopete_fixed.png

I've reported this on KDE Bugzilla and Kopete developers willing, the fix will find itself into Kopete at some point. In the meantime, the patch is attached below.

diff -Naur kopete-0.12.2/kopete/libkopete/private/kopeteemoticons.cpp kopete-changed/kopete/libkopete/private/kopeteemoticons.cpp
--- kopete-0.12.2/kopete/libkopete/private/kopeteemoticons.cpp	2006-08-12 02:51:47.000000000 +0200
+++ kopete-changed/kopete/libkopete/private/kopeteemoticons.cpp	2006-09-13 07:20:28.000000000 +0200
@@ -48,6 +48,8 @@
 struct Emoticons::Emoticon
 {
 	Emoticon(){}
+	/* sort by longest to shortest matchText */
+	bool operator< (const Emoticon &e){ return matchText.length() > e.matchText.length(); }
 	QString matchText;
 	QString matchTextEscaped;
 	QString	picPath;
@@ -424,6 +426,7 @@
 		node = node.nextSibling();
 	}
 	mapFile.close();
+	sortEmoticons();
 }
 
 
@@ -492,9 +495,24 @@
 		node = node.nextSibling();
 	}
 	mapFile.close();
+	sortEmoticons();
 }
 
 
+void Emoticons::sortEmoticons()
+{
+	/* sort strings in order of longest to shortest to provide convenient input for
+		greedy matching in the tokenizer */
+	QValueList<QChar> keys = d->emoticonMap.keys();
+	for ( QValueList<QChar>::const_iterator it = keys.begin(); it != keys.end(); ++it )
+	{
+		QChar key = (*it);
+		QValueList<Emoticon> keyValues = d->emoticonMap[key];
+ 		qHeapSort(keyValues.begin(), keyValues.end());
+ 		d->emoticonMap[key] = keyValues;
+	}
+}
+
 
 
 
diff -Naur kopete-0.12.2/kopete/libkopete/private/kopeteemoticons.h kopete-changed/kopete/libkopete/private/kopeteemoticons.h
--- kopete-0.12.2/kopete/libkopete/private/kopeteemoticons.h	2006-08-12 02:51:47.000000000 +0200
+++ kopete-changed/kopete/libkopete/private/kopeteemoticons.h	2006-09-13 07:19:17.000000000 +0200
@@ -156,6 +156,12 @@
 	 * @see initEmoticons
 	 */
 	void initEmoticon_JEP0038( const QString & filename);
+	
+	/**
+	 * sorts emoticons for convenient parsing, which yields greedy matching on
+	 * matchText
+	 */
+	void sortEmoticons();
 
 
 	struct Emoticon;

EDIT: The original conclusion of this entry was that Gaim has parsing bugs too. This seems to be incorrect. A fresh new screenshot shows that Gaim handles the xtorg theme just fine.

gaim_emoticons.png

UPDATE: The patch was accepted verbatim into kopete svn, so the next release (kde-3.5.5), whenever it will be, should have this problem fixed. :)