David Madore's WebLog: 2008-09

Vous êtes sur le blog de David Madore, qui, comme le reste de ce site web, parle de tout et de n'importe quoi (surtout de n'importe quoi, en fait), des maths à la moto et ma vie quotidienne, en passant par les langues, la politique, la philo de comptoir, la géographie, et beaucoup de râleries sur le fait que les ordinateurs ne marchent pas, ainsi que d'occasionnels rappels du fait que je préfère les garçons, et des petites fictions volontairement fragmentaires que je publie sous le nom collectif de fragments littéraires gratuits. • Ce blog eut été bilingue à ses débuts (certaines entrées étaient en anglais, d'autres en français, et quelques unes traduites dans les deux langues) ; il est maintenant presque exclusivement en français, mais je ne m'interdis pas d'écrire en anglais à l'occasion. • Pour naviguer, sachez que les entrées sont listées par ordre chronologique inverse (i.e., la plus récente est en haut). Cette page-ci rassemble les entrées publiées en septembre 2008 : il y a aussi un tableau par mois à la fin de cette page, et un index de toutes les entrées. Certaines de mes entrées sont rangées dans une ou plusieurs « catégories » (indiqués à la fin de l'entrée elle-même), mais ce système de rangement n'est pas très cohérent. Le permalien de chaque entrée est dans la date, et il est aussi rappelé avant et après le texte de l'entrée elle-même.

You are on David Madore's blog which, like the rest of this web site, is about everything and anything (mostly anything, really), from math to motorcycling and my daily life, but also languages, politics, amateur(ish) philosophy, geography, lots of ranting about the fact that computers don't work, occasional reminders of the fact that I prefer men, and some voluntarily fragmentary fictions that I publish under the collective name of gratuitous literary fragments. • This blog used to be bilingual at its beginning (some entries were in English, others in French, and a few translated in both languages); it is now almost exclusively in French, but I'm not ruling out writing English blog entries in the future. • To navigate, note that the entries are listed in reverse chronological order (i.e., the most recent is on top). This page lists the entries published in September 2008: there is also a table of months at the end of this page, and an index of all entries. Some entries are classified into one or more “categories” (indicated at the end of the entry itself), but this organization isn't very coherent. The permalink of each entry is in its date, and it is also reproduced before and after the text of the entry itself.

[Index of all entries / Index de toutes les entréesLatest entries / Dernières entréesXML (RSS 1.0) • Recent comments / Commentaires récents]

Entries published in September 2008 / Entrées publiées en septembre 2008:

↓Entry #1570 [older| permalink|newer] / ↓Entrée #1570 [précédente| permalien|suivante] ↓

(Friday)

How to add a personal menu to Firefox

(I'm too busy to blog right now, so I'm just posting something I had written previously and was hoping to improve but didn't have the time to. I figured it was better to publish it as such—and rough at the edges—than to postpone indefinitely.)

Here's a quick HOWTO on how to add a personal menu to Firefox. The point, here, is not to publish a Firefox extension (there's already abundant doc on this subject) but, rather, to modify one's profile to personalize the menu system in a quick and (relatively) easy way. What follows should work on every operating system supported by Firefox, although I've only tested it on Unix; also, I will assume Firefox 3. I assume the reader has some basic knowledge of XML, and, of course, if you want to do anything useful in your menu you must know some JavaScript.

First, create a directory in which the menu files will reside. I suggest something like ~/firefox/mymenu/ and I will assume that name in what follows. It will be an easy thing to copy the content of this directory to other machines to distribute the menu extension on them; also, it will be relatively easy to turn this working directory into a bona fide (i.e., .xpi) Firefox extension, although I won't cover this here.

Next, create a file called install.rdf inside the menu's working directory (so, ~/firefox/mymenu/install.rdf). Model it as follows:

<?xml version="1.0" encoding="utf-8"?>
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
         xmlns:NS1="http://www.mozilla.org/2004/em-rdf#">
  <RDF:Description RDF:about="urn:mozilla:install-manifest">
    <NS1:id>mymenu@local</NS1:id>
    <NS1:name>My Local Menu Extension</NS1:name>
    <NS1:version>0.0.0.0.0.1</NS1:version>
    <NS1:creator>John Doe User</NS1:creator>
    <NS1:description>A local menu loaded with goodies!</NS1:description>
    <NS1:targetApplication>
      <RDF:Description>
        <NS1:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</NS1:id> <!-- firefox -->
        <NS1:minVersion>3.0</NS1:minVersion>
        <NS1:maxVersion>3.0.*</NS1:maxVersion>
      </RDF:Description>
    </NS1:targetApplication>
  </RDF:Description>
</RDF:RDF>

RDF is a bit arcane (see here if you want to learn more about it), but you don't need to understand it in order to write this: basically, what matters is that this files specifies a number of important properties of the extension we are defining (yes, we are defining a Firefox extension, albeit one which might remain purely local). The most important such property is NS1:id (actually the property's name is really http://www.mozilla.org/2004/em-rdf#id, but that doesn't matter here), which specifies a unique identifier for the extension: here I am calling it mymenu@local, which is fine if you don't expect it to ever become public—if you do, it's probably better to call it something like mymenu@mydomain.example.tld where mydomain.example.tld is some domain you own. Another possibility is to use a UUID such as {da0bfd29-39a2-44d5-8b58-8e9badbbec7a} (you can use the uuidgen program to create one; remember to enclose it in curly braces, as shown here), although UUIDs are obviously more difficult to type and remember. Other properties required in install.rdf are NS1:name (the human-readable name of the extension, as it will appear in the extension list) and NS1:version (the extension's version number; there are sophisticated rules to compare version numbers, but I suggest sticking to something very simple, i.e., a period-separated list of numbers which will be ordered component by component). The NS1:creator (creator's name) and NS1:description (one-line description of the extension) properties are optional, but I suggest filling them in anyway. Finally, NS1:targetApplication indicates which programs the extension is made to work with: here, {ec8030f7-c20a-464f-9b0e-13a3a9e97384} means Firefox, and the NS1:minVersion and NS1:maxVersion specify the minimal and maximal accepted versions of Firefox, here anything in the form 3.0 or 3.0.something will match (I suggest leaving it as such, and increasing NS1:maxVersion after testing with 3.1 when it comes out). If you mean to make your menu also work for Thunderbird, add another NS1:targetApplication block (don't reuse the previous one!) and specify {3550f703-e582-4d05-9a08-453d09bdfdc6} as NS1:id. For more information about what can go in the install.rdf file, see here on developer.mozilla.org and here on mozillazine.org.

After you've written the install.rdf file, the other important file which needs to be created is chrome.manifest (details about it here). Create it in the same directory (so ~/firefox/mymenu/chrome.manifest) and model it as follows:

content mymenu chrome/content/
overlay chrome://browser/content/browser.xul chrome://mymenu/content/mymenu.xul

What we're saying here is:

  • The chrome://mymenu/content/ URL shall now refer to the files in the chrome/content/ subdirectory (i.e., ~/firefox/mymenu/chrome/content/). This is important, because residing in the chrome:// URL scheme gives the files extra privileges (the JavaScript they contain can freely access all Mozilla components, for example). If you want to be able to access the files with their chrome:// URL by typing it directly in the URL box (or linking to them, or such things), you need to add contentaccessible=yes at the end of the first line.
  • The chrome://browser/content/browser.xul file shall be modified by the overlay found in chrome://mymenu/content/mymenu.xul (and which, according to the previous line, will reside in ~/firefox/mymenu/chrome/content/mymenu.xul). This is important, because chrome://browser/content/browser.xul is the master URL for the Firefox browser (in a way, it is the browser), so to define a new menu you need to modify it by overlaying it. If you need to similarly overlay Thunderbird, the master URL is chrome://messenger/content/messenger.xul. (More details about overlays can be found here and here.)

Now we need to create the ~/firefox/mymenu/chrome/content/mymenu.xul file with the actual menu. Here is a template for it:

<?xml version="1.0" encoding="utf-8"?>
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml">
<script type="application/javascript">
// <![CDATA[
function StupidAlert() {
    alert("This is a stupid alert!");
}
// ]]>
</script>
<menubar id="main-menubar">
  <menu id="mymenu-menu" label="My Menu" accesskey="M">
    <menupopup>
      <menuitem label="Nop" accesskey="N" />
      <menuitem label="Stupid alert" accesskey="S" oncommand="StupidAlert()" />
    </menupopup>
  </menu>
</menubar>
</overlay>

This is, of course, an utterly stupid example, merely intended to demonstrate how the file can be written: here, we overlay the Firefox main menubar (the main-menubar is the key, here) with a new menu which is labeled My Menu (the first ‘M’ will be underlined and will serve as access key), which pops up with two items: the first is labeled Nop and does absolutely nothing, and the second is labeled Stupid alert and runs the JavaScript function StupidAlert() defined above (this is contrary to Mozilla good practice which demands that JavaScript code be separated from the XUL structure, and also that user-readable labels be separated so they can be i13zed, but when defining a personal menu one typically does not care about such practices).

The language in which this file is written is an instance of XML called XUL: to learn more about XUL you can start with this excellent tutorial, but you can also learn it the quick-and-dirty way by trying to imitate the Firefox XUL itself, which you can find in a file called browser.jar (you can extract it with unzip) somewhere in your Firefox installation directories (a typical directory under Linux would be /usr/share/firefox/chrome/browser.jar, but YMMV). Similarly, if you want your menu to do something useful, you need some JavaScript, and, more probably, you need some Mozilla-specific JavaScript: you'll find many examples of that here (you might also find this page useful if you need to access Firefox windows or their content).

But before you start coding away, there is one last thing that needs to be done: now that a basic menu has been created in ~/firefox/mymenu/, you still need to tell Firefox about its existence! To do that, stop all running Firefoxen, then go in the extensions/ subdirectory inside your profile directory (on Unix, that would typically be ~/.mozilla/firefox/*.default/extensions/), and create a file called mymenu@local (use the same name as the NS1:id of your extension, even if that means using curly braces around a UUID) which just contains one line:

~/firefox/mymenu

i.e., name of the directory in which your extension (and importantly, the install.rdf and chrome.manifest files) resides. When Firefox is next launched, it should tell you that a new extension has been installed and the menu should be visible. After that, whenever you modify something in the ~/firefox/mymenu/ directory, increment the version number in install.rdf and restart Firefox (while this is not always strictly necessary, it is definitely good practice to avoid confusion).

↑Entry #1570 [older| permalink|newer] / ↑Entrée #1570 [précédente| permalien|suivante] ↑

↓Entry #1569 [older| permalink|newer] / ↓Entrée #1569 [précédente| permalien|suivante] ↓

(vendredi)

Péripéties médicales avec une Klebsiella

Acte I

Mercredi matin il y a neuf jours (le 2008-08-27, donc), alors que j'étais de passage chez mes parents à Orsay, je me suis réveillé tôt avec un mal au ventre, qui n'a cessé d'empirer, évoluant vers une sensation de brûlure à l'estomac, accompagnée de nausées, puis de vomissements (si ce n'est que je n'avais pas grand-chose à vomir). J'ai passé la journée, une bouillotte sur le ventre, à me shooter au paracétamol. Le soir j'ai cru que j'allais un peu mieux et j'ai pris un léger bouillon et un fruit, mais mon état s'est de nouveau détériorié, mes vomissements se sont intensifiés, j'ai fait de la fièvre (38.6°C malgré le paracétamol) avec des frissons, et j'ai eu un énorme mal de tête (comme l'impression que ma tête était une grosse cloche et que mon pouls donnait des coups dedans à 100 battements par minute).

Je suis tout sauf héroïque face à la douleur (on le sait déjà), donc j'ai persuadé mon père de me conduire — vers 2h du matin le 28 — aux urgences de l'hôpital d'Orsay (je voulais initialement appeler SOS médecins, mais apparemment ça n'existe pas aussi loin qu'Orsay). Là j'ai été très bien reçu par une infirmière et un externe pas trop débordés et très gentils, on m'a mis sous perfusion pour me réhydrater et m'injecter du Primpéran et plus de paracétamol (et encore autre chose que j'oublie) et on a lancé quelques analyses. Les premiers résultats étaient normaux et je me sentais mieux, donc on m'a fait sortir vers 4h30 et je suis rentré chez moi avec une ordonnance symptomatique (sans antibiotiques, car a priori il se semblait agir d'une gastro-entérite virale). J'ai passé encore une journée peu agréable jeudi, et j'ai pu manger un peu le soir ; vendredi j'étais toujours un peu barbouillé, mais rapidement je me suis estimé guéri (et je suis rentré chez moi à Paris).

Acte II

Lundi 1er dans l'après-midi (alors que j'allais désormais parfaitement bien, et c'est toujours le cas) je reçois un coup de fil du service des urgences d'Orsay où je m'étais présenté, m'avertissant qu'une des hémocultures qu'on m'avait faites (c'est-à-dire des prélèvements sanguins qu'on met en culture pour détecter des bactéries) était retournée positive : on m'a trouvé une bactérie du genre Klebsiella dans le sang. (Enfin, je donne le nom, mais pour réussir à décoder ce que j'ai entendu par téléphone, il m'a fallu du temps à Googlifier des choses comme clef de ciel.) On me demande donc de revenir à l'hôpital pour analyses complémentaires — et éventuellement pour être mis sous antibiotiques. J'explique que je vais bien et que je n'ai pas vraiment envie de revenir à Orsay pour ça : on me suggère alors de me présenter aux urgences de l'hôpital le plus proche de chez moi, auquel ils faxeront le dossier.

Les urgences de la Pitié, vers 18h, si on n'est pas in articulo mortis, ça doit vouloir dire trois heures d'attente au bas mot avant d'avoir la moindre chance de voir un médecin. Je me suis donc dit que, pour épargner mon temps comme celui du personnel, je pourrais y revenir à une heure plus creuse : je m'y suis donc pointé à 3h du matin (le mardi 2 septembre, si vous suivez bien), et effectivement il n'y avait plus personne. Là, on m'a fait savoir, en gros, que je n'avais rien à y faire : que mon cas n'était pas urgent puisque visiblement je n'étais pas malade, qu'on ne pouvait rien pour moi sans les résultats des analyses, que ce n'était pas à eux de demander celles-ci à l'hôpital d'Orsay et que d'ailleurs à 3h du matin ce serait impossible (j'ai rétorqué que c'était un service d'urgences et qu'il tournait 24h/24h, labo compris, mais on ne m'a pas écouté), bref, que je n'avais pas à être là. J'ai répondu que, d'accord, j'étais désolé de faire perdre du temps à tout le monde parce qu'on m'avait expressément recommandé d'aller aux urgences de l'hôpital le plus proche, et que je voulais bien, moi, me présenter en médecine de ville ou bien à un autre service de l'hôpital, juste qu'on me dise quoi faire. On m'a alors renvoyé sur le service des maladies infectieuses (…parasitaires, tropicales et de santé publique), service du professeur Bricaire, dans le même hôpital.

Le lendemain (enfin, toujours le mardi 2), j'ai pris rendez-vous auprès du service en question : le plus tôt possible étant le vendredi 5 au matin — soit. Je demande le numéro de fax du service, qui fut apparemment difficile à retrouver, mais que j'ai obtenu. J'ai ensuite appelé l'hôpital d'Orsay pour leur demander d'envoyer les résultats des analyses au service des maladies infectieuses de la Pitié, à l'attention du médecin dont on m'avait donné le nom pour le rendez-vous.

Acte III

Ce matin j'arrive au rendez-vous (pile à l'heure) et voilà, évidemment, que personne n'a entendu parler de moi au service des maladies infectieuses. J'imagine que ce qui s'est passé est que la difficulté à trouver le numéro de fax a fait oublier le rendez-vous lui-même à la personne qui devait l'inscrire dans les registres, ou quelque chose comme ça. J'offre comme indice de ma bonne foi le fait que je connaisse le nom du médecin qui devait me recevoir. On finit par ajouter mon nom sur les listes et par me faire patienter. Heureusement, les fax de l'hôpital d'Orsay, eux, étaient bien arrivés.

Le médecin que j'ai enfin pu voir, et à laquelle j'ai fait subir le récit de mes aventures jusqu'à présent, m'a concédé que c'était une drôle d'histoire. D'après elle, normalement, une infection bactérienne de ce genre ne se guérit pas toute seule, donc il est bizarre que j'aille bien. J'ai demandé si un faux positif était possible, mais elle ne semblait pas y croire. Et elle prétend que l'hôpital d'Orsay n'aurait pas dû me laisser sortir. Bref, elle m'a mis sous antibiotiques : comme j'ai déjà fait par le passé une allergie à l'amoxicilline, elle m'a prescrit de la ciprofloxacine (j'ai de la chance, d'après l'antibiogramme réalisé à Orsay, la bactérie est sensible à tous les antibiotiques testés), à des doses néanmoins diminuées puisque je n'ai pas de symptômes. Et je dois reprendre rendez-vous une fois le traitement fini pour faire des nouvelles analyses (y compris pour contrôler la glycémie, qui était apparemment trop élevée dans les premières analyses, même si je n'étais pas vraiment à jeun), puis une troisième fois pour l'analyse des résultats.

À suivre, donc…

↑Entry #1569 [older| permalink|newer] / ↑Entrée #1569 [précédente| permalien|suivante] ↑

Continue to older entries. / Continuer à lire les entrées plus anciennes.


Entries by month / Entrées par mois:

2024 Jan 2024 Feb 2024 Mar 2024
2023 Jan 2023 Feb 2023 Mar 2023 Apr 2023 May 2023 Jun 2023 Jul 2023 Aug 2023 Sep 2023 Oct 2023 Nov 2023 Dec 2023
2022 Jan 2022 Feb 2022 Mar 2022 Apr 2022 May 2022 Jun 2022 Jul 2022 Aug 2022 Sep 2022 Oct 2022 Nov 2022 Dec 2022
2021 Jan 2021 Feb 2021 Mar 2021 Apr 2021 May 2021 Jun 2021 Jul 2021 Aug 2021 Sep 2021 Oct 2021 Nov 2021 Dec 2021
2020 Jan 2020 Feb 2020 Mar 2020 Apr 2020 May 2020 Jun 2020 Jul 2020 Aug 2020 Sep 2020 Oct 2020 Nov 2020 Dec 2020
2019 Jan 2019 Feb 2019 Mar 2019 Apr 2019 May 2019 Jun 2019 Jul 2019 Aug 2019 Sep 2019 Oct 2019 Nov 2019 Dec 2019
2018 Jan 2018 Feb 2018 Mar 2018 Apr 2018 May 2018 Jun 2018 Jul 2018 Aug 2018 Sep 2018 Oct 2018 Nov 2018 Dec 2018
2017 Jan 2017 Feb 2017 Mar 2017 Apr 2017 May 2017 Jun 2017 Jul 2017 Aug 2017 Sep 2017 Oct 2017 Nov 2017 Dec 2017
2016 Jan 2016 Feb 2016 Mar 2016 Apr 2016 May 2016 Jun 2016 Jul 2016 Aug 2016 Sep 2016 Oct 2016 Nov 2016 Dec 2016
2015 Jan 2015 Feb 2015 Mar 2015 Apr 2015 May 2015 Jun 2015 Jul 2015 Aug 2015 Sep 2015 Oct 2015 Nov 2015 Dec 2015
2014 Jan 2014 Feb 2014 Mar 2014 Apr 2014 May 2014 Jun 2014 Jul 2014 Aug 2014 Sep 2014 Oct 2014 Nov 2014 Dec 2014
2013 Jan 2013 Feb 2013 Mar 2013 Apr 2013 May 2013 Jun 2013 Jul 2013 Aug 2013 Sep 2013 Oct 2013 Nov 2013 Dec 2013
2012 Jan 2012 Feb 2012 Mar 2012 Apr 2012 May 2012 Jun 2012 Jul 2012 Aug 2012 Sep 2012 Oct 2012 Nov 2012 Dec 2012
2011 Jan 2011 Feb 2011 Mar 2011 Apr 2011 May 2011 Jun 2011 Jul 2011 Aug 2011 Sep 2011 Oct 2011 Nov 2011 Dec 2011
2010 Jan 2010 Feb 2010 Mar 2010 Apr 2010 May 2010 Jun 2010 Jul 2010 Aug 2010 Sep 2010 Oct 2010 Nov 2010 Dec 2010
2009 Jan 2009 Feb 2009 Mar 2009 Apr 2009 May 2009 Jun 2009 Jul 2009 Aug 2009 Sep 2009 Oct 2009 Nov 2009 Dec 2009
2008 Jan 2008 Feb 2008 Mar 2008 Apr 2008 May 2008 Jun 2008 Jul 2008 Aug 2008 Sep 2008 Oct 2008 Nov 2008 Dec 2008
2007 Jan 2007 Feb 2007 Mar 2007 Apr 2007 May 2007 Jun 2007 Jul 2007 Aug 2007 Sep 2007 Oct 2007 Nov 2007 Dec 2007
2006 Jan 2006 Feb 2006 Mar 2006 Apr 2006 May 2006 Jun 2006 Jul 2006 Aug 2006 Sep 2006 Oct 2006 Nov 2006 Dec 2006
2005 Jan 2005 Feb 2005 Mar 2005 Apr 2005 May 2005 Jun 2005 Jul 2005 Aug 2005 Sep 2005 Oct 2005 Nov 2005 Dec 2005
2004 Jan 2004 Feb 2004 Mar 2004 Apr 2004 May 2004 Jun 2004 Jul 2004 Aug 2004 Sep 2004 Oct 2004 Nov 2004 Dec 2004
2003 May 2003 Jun 2003 Jul 2003 Aug 2003 Sep 2003 Oct 2003 Nov 2003 Dec 2003

[Index of all entries / Index de toutes les entréesLatest entries / Dernières entréesXML (RSS 1.0) • Recent comments / Commentaires récents]