(You can choose or or both)

Wednesday, January 31, 2007

Detect bad encoding javascript html utf-8t

(Encore du technique, merci pour votre patience).

(More technical stuff, thanks for your understanding).

Problem: you have a page that has accented characters, that is supposed to be opening in utf-8 charset encoding, but sometimes doesn't (maybe I'm the only person that ever had this problem..., in my case it was the HTML editor Xinha, opened in a popup).

How to at least warn your users that there is a problem? Can javascript detect the encoding of the page in which it is placed?

Well, no, and yes.

This is the solution I found, which is rather elegant (I feel):
if ('é'.length==2) alert('Houston, we have a problem');

How does it work?

I may be wrong, but as I understand it, 'normal' text takes up one byte per character. Unicode takes up two bytes per character. UTF-8 takes up one byte, except for 'problem' characters, for which it users two bytes.

So if a utf-8 encoded page is badly intepreted as being 'normal', an 'é' character (which takes up two bytes), will be interpreted as two one-byte characters.

Conversely, if the browser thinks the page is utf-8, it will interpret the 'é' combination as one character.

So if javascript tells you the length is two, you know that you're not in UTF-8.

(Last detail, and here I'm in unknown territory - contrary to the postscript in my previous post about utf-8, you shouldn't save web pages as UTF-8, but normal files, but with the charset meta tag set tu utf-8. I think I'm right about that, but no idea why...)

Tuesday, January 30, 2007

Dire rear ... Vidange


C'est pas la top forme chez nous ces jours - Kalia est malade depuis la fin de la semaine passée, et j'étais à la maison aujourd'hui complètement KO et en train de faire un purge involontaire.

Pour l'instant, Mamma n'a pas succombé, et tant mieux, deux malades à la fois c'est déjà assez !


Not on the top of our form here right now. Kalia's beek 'ick since last week, and I was off work today with fever, dia...wotsit etc..

Fortunately, Mamma isn't ill yet - hope it stays that way - two at a time is already plenty!

Friday, January 26, 2007

Before & after ... Avant & Après


Ils sont venus enlever la vieille moquette et remettre en état le parquet qui était en dessous. Seulement que lorsqu'ils ont enlevé la moquette, ils ont découvert pourquoi elle avait été mise - un gros bout de parquet manquant était remplacé par une planche de contre-plaqué.

Du coup ils ont du poser du laminé par dessus.

Mais ce n'est pas plus mal, c'est plus clair.

Last week the chappy came to rip up the old carpet in the hall and do up the parquet whic was underneath. But when he took the carpet up, he discovered the reason why they put it there - there was a large chunk of parquet missing - replaced with some plywood.

So in the end they covered it over with another layer of pre-fabricated parquet.

It's lighter than the other parquet would have been, so we're quite pleased - now just got to do up all the paintwork and put the furniture back!

Sunday, January 21, 2007

Kid's games ... jeux pour tout-petits


Voilà un site avec tout plein de liens sympas sur des jeux internet pour des petits, ces temps-ci avec Kalia on est en train d'apprendre l'alphabet - avec un accent américain...

Here's a site with tons of links to baby- and toddler-level internet computer games. At the moment we're working our way through the alphabet with Kalia - albeit with an american accent.

Thursday, January 18, 2007

Exile


(Photo prise par une amie qui était ici quelques jours en vacances)

Nous serons exilés jusqu'à samedi matin.

Demain matin il y a des ouvriers qui viendront pour enlever la moquette dans le hall, et remettre en état le parquet qui est dessous. A cause des produits chimiques c'est conseillé de rester loin pendant quelques temps.

Heureusement qu'on a des amis sympas qui acceptent des squatters !

(Photo taken by a friend who was here a few days on holiday)

We're being exiled from tomorrow morning till Saturday. Workmen are coming to rip up the carpet in the hall and do up the parquet which is underneath. Because of the fumes given off by the varnish we've been advised to keep clear for a night at least.

Fortunately we have friends who are prepared to put up with us squatting at their place.

Monday, January 15, 2007

DOM Inspector CSS Style Rules broken (bug/problem/empty)

(Le service normal reprendra bientôt).

Cet article est le plus visité de tout mon blog, je ne sais pas s'il faut en être fier ou non ! Pour info, d'après ce que je constate, vous devrez refaire cette manip à chaque mise à jour de Firefox.

Bonjour, si vous êtes arrivés ici pour des problèmes de DOMInspector qui n'affiche plus rien dans la partie CSS Style Rules, voilà la solution:

1. Fermer Firefox
2. Trouver le fichier xpti.dat (pour Windows en anglais, c'est c:\Documents and
Settings\username\Application
Data\Mozilla\Firefox\Profiles\xxxxxxxx.default\xpti.dat)
3. Ouvrir avec un éditeur texte comme Notepad, Notepad2, UltraEdit ou CrimsonEdit
4. Trouver la ligne qui contient le texte : inIDOMUtils
5. Remplacer la partie suivant cette texte avec : {78fd16c2-bdfb-4b1d-8738-d536d0a8f430},0,-1,1
6. Sauvegarder le fichier, fermer, et ouvrir Firefox

(La page où j'ai trouvé cette information est ici)

(Normal service will resume shortly)

This is the most visited page on my blog, not sure whether that is a compliment or not! Further info based on my experience is that you wil have to repeat this procedure after every update/upgrade.

If you've come here from Google looking for a solution to your empty CSS Style Rules in the Dom Inspector, here is the solution:

1. Close Firefox
2. Locate this file: xpti.dat (in Windows, it's something like c:\Documents and
Settings\username\Application
Data\Mozilla\Firefox\Profiles\xxxxxxxx.default\xpti.dat)
3. Open with a text editor such as Notepad, Notepad2, UltraEdit ou CrimsonEdit
4. Fine the line with the following text: inIDOMUtils
5. Replace the part after inIDOMUtils with: {78fd16c2-bdfb-4b1d-8738-d536d0a8f430},0,-1,1
6. Save the file, close it, and open Firefox

(The page where I found this info is here)

Saturday, January 13, 2007

Bending the chain ... Plier la chaîne

Peine à télécharger les photos ce soir, je commence déjà à écrire et on verra bien si à la fin la photo arrivera !

Ce soir, une révélation scientifique inouïe - une première mondiale (non, je n'ai pas vérifié)

Est-ce que vous vous rappelez quand on vous a appris à aller sur une balançoire ? Il faut plier les jambes dans un sens, puis les étendre dans l'autre. Puis vous avez essayer et rien ne se passait, jusqu'à ce qu'au moment donné, quelque chose s'est passé et vous avez pigé le truc - ou plutôt c'est votre corps qui a compris.

Et maintenant si vous devez apprendre à quelqu'un d'autre, vous leur diriez aussi qu'il faut commencer par plier les jambes.

Après une longue analyse de cette question (j'ai largement le temps, une fois que Kalia est installée sur sa balançoire, elle ne décolle plus - et non, elle n'a pas encore appris, d'où ma réflexion), je suis arrivé à la conclusion que les jambes et les genoux n'ont rien à voir, ce qui importe c'est de plier la chaîne (ou la corde). C'est ça qui fait bouger la balançoire.

Dire qu'il y a des universitaires qui font des thèses pour prouver des choses d'une pareille importance, et je vous le livre ici, gratuitement...

There seem to be problems with uploading photos this evening...

Do you remember learning how to swing on a swing? Someone told you to stretch your legs to go forward, and bend them to go back. And you tried. And nothing happened. Then eventually your 'got it' (or your body did), and it worked.

And now, if you were to teach someone else, you'd tell them to start by bending their legs.

Having analysed this question for a long time (I have plenty of time to do this when Kalia is on the swings - once she's on she doesn't budge! And in case you wondered, no she hasn't learnt yet, which is why I think about it), I have come to the conclusion that legs and knees don't have anything to do with it. What counts is bending the chain (or the rope). That's what makes the swing move.

Given that people do doctorates to prove this kind of thing, I think you should be greatful that I choose to reveal the results of my research with you for free, here on my blog...

Wednesday, January 10, 2007

Sleeping rough ... SDF ?


Je vous promets qu'elle a commencé sur le matelas !

Si notre fille n'est pas somnambule, elle est au moins une dormeuse gymnaste, et on peut souvent la retrouver la tête en bas du lit, ou vers la Mecque (sur les genoux avec les fesses en l'air !)

Je regrette de vous avoir délaissé ces temps. Ce n'est pas que je n'ai pas d'idées, mais comme j'ai dit la dernière fois, je me pose la question d'un deuxième blog. S'il y a en a parmi vous qui aurait une bonne idée pour un 'url' de deuxième blog (de la forme quelquechose.blogspot.com) qui n'est pas déjà pris, je suis preneur.

Pour ceux qui savent l'anglais, et qui ne sont pas trop sensible aux gros mots, il y a ici un article à la fois drôle est sérieux (satirique?) intitulé "7 raisons que le 21ème siècle vous rend déprimé"

She did start out on the mattress, I promise!

Our daughter may not be a sleep walker, but she is definitely a gymnastic sleeper. It's not unusual to find her in all sorts of funny places or positions - with the head at the bottom of the bed, or pointing towards Mecca (on her knees with her bum in the air!).

I'm sorry that I've not been very prolific of late. As I said in my previous posts, it's not for lack of ideas, just not knowing where to put them. If you can think of a decent url (in the form something.blogspot.com) which isn't already taken, let me know. Or maybe I should bite the bullet and buy my own domain?

If you are not too sensitive to strong language, here is an excellently-written article titled "7 reason the 21st century is making your miserable". It's both funny and serious - I think they call it satire...

Thursday, January 04, 2007

Money laundering ... argent propre


(Photo de Kalia qui essaie les lunettes de sa mère).

La Suisse a une petite réputation pour le blanchiment d'argent. Je peux dorénavant confirmer que l'argent suisse peut effectivement être lavé sans le moindre problème.

Il se trouve que j'avais laissé mon cadeau de Noël (des sous) dans la poche de mon pantalon, qui est passé aujourd'hui à la machine à laver - et aussi au séchoir il me semble.

Malgré une petite frayeur (tempérée par des "ce n'est que de l'argent après tout" à moitié convaincus), les billets en sont sortis indemnes, même si un peu humides.

(Ah oui, j'allais oublier - bonne année !)

(Kalia trying on Mama's glasses)

Switzerland has a not-entirely-unjustified reputation for cleaning up dirty money. I can now confirm that swiss money can effectively be laundered with no undesirable side-effects.

It so happens that I left my Christmas money in the back pocket of my trousers - said trousers were washed and tumble-dried today.

Despite a moment of mild panic (accompanied by a half-convinced "after all, it's only money"), the notes came out fine, if a trifle damp.

(Happy New Year, by the way)