A notch above a monkey

Telemarketing scum

I’ve spent yesterday on Vienna, which was very cold and very snow-less. As it always happens, I get most phone calls when I have the least time for them and they cost me the most.

One of them was from telemarketing scum. Do you know what they thought I’ve been really missing?

A course on how to use computers.

Look ma', HTML too

This is a second post in hopefully a very short series dedicated to javascript internationalization. If you want, you can read the first one here .

We left off with two supporting functions for striping whitespace and a simple function for translation lookup. Today I added another two functions, one for translating HTML elements and the other for resolving a problem with HTML entities. You can find new javascript here and a demo here .

translateNodes searches for elements with class name i18n, picks up their text content and translates it, if it can find it in translation dictionary. Sometimes it can’t, because what javascript actually sees is a real utf-8 encoded string, where X/HTML entities have been replaced with characters they represent. If this is not true also for source string in dictionary, then there’s a mismatch.

That’s why there’s toEntity function which translates all non-ASCII characters in given string to their entity representation. When translateNodes fails to find translation, it uses toEntity to get a possibly different representation and tries again.

This way you can use entities, which are the only real cross-browser way to describe non-ASCII chars and translations still work. There’s a downside though. Your translation source string must either have all non-ASII characters represented as HTML entities or none of them. Otherwise translation will fail for obvious reasons.

There are planned limitations (like building a system that handles only utf-8 text) and unplanned ones. I still don’t do anything special for strings with significant whitespace (like content of a pre tag) and probably should.

Do nothing = I break it.

It would be nice, if I started to pack this functionality in a more sensible form and build tools that make handling of the whole thing easier.

Next week, which starts in an hour or so, seems perfect time for that.

Update: Follow up here .

Google's bias

Have you ever asked yourself, what’s the purpose of Google’s long living cookie?

Well, others did . I’m not quite as paranoid as some of them, but judging by recent experience it’s definitely used for more than just preferences. I was helping my wife and was looking for term “conventions and scope” , when I’ve noticed that I get completely different answers than she does.

I don’t know about you, but my results are obviously aimed at programmers unlike those of my wife. Google therefore clearly uses their cookie to learn from stuff I searched for about stuff I might in future.

I have no problem with this provided my profile is anonymous. My problem with Google was different. How do I get rid of its bias that normally works in my favor, but every now and then doesn’t?

I know I can turn cookie support off in my browser and that would solve my problem. However, I’m doubtful that many users know this. Should web application offer a way to turn off such bias and if yes, how? Should they reveal it in the first place?

I think they should, but I understand it can be difficult to do so without looking intrusive. That’s why they usually bury it in documents that nobody reads, like terms of use or privacy statements.