<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet title="XSL formatting" type="text/xsl" href="/atom.xsl" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
<title>Mathieu Gueydan</title>
<link rel="self" type="application/atom+xml" href="https://mathieugueydan.blogs.centraliens-marseille.fr/atom.xml"/>
<link rel="alternate" type="text/html" href="https://mathieugueydan.blogs.centraliens-marseille.fr/" />
<subtitle>Mathieu Gueydan</subtitle>
<updated>2026-05-08T05:03:13+02:00</updated>
<rights>All Rights Reserved blogSpirit</rights>
<generator uri="http://blogs.centraliens-marseille.fr/admin/" version="6.0">blogs.centraliens-marseille.fr</generator>
<id>https://mathieugueydan.blogs.centraliens-marseille.fr/</id>
<entry>
<author>
<name>mathieu.gueydan</name>
<uri>https://mathieugueydan.blogs.centraliens-marseille.fr/about.html</uri>
</author>
<title>Css. z-index doesn't work the way I want.</title>
<link rel="alternate" type="text/html" href="https://mathieugueydan.blogs.centraliens-marseille.fr/archive/2016/10/19/css-do-not-use-position-fixed-with-z-index-1628826.html" />
<id>tag:mathieugueydan.blogs.centraliens-marseille.fr,2016-10-19:1628826</id>
<updated>2016-10-19T14:07:58+02:00</updated>
<published>2016-10-19T13:46:00+02:00</published>
<summary> Stacking contexts are a nightmare.  Most of the time what you do want is...</summary>
<content type="html" xml:base="https://mathieugueydan.blogs.centraliens-marseille.fr/">
Stacking contexts are a nightmare.&lt;br /&gt;&lt;br /&gt;Most of the time what you do want is a single stacking context for the wole page.&lt;br /&gt;Unfortunately, &lt;strong&gt;most of the time, you generate new stacking contexts without knowing it&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;An element may generate a context :&lt;br /&gt;- because it has a &quot;position: fixed&quot; (on firefox, on chrome/ium it depends of flag #fixed-position-creates-stacking-context)&lt;br /&gt;- because it has a &quot;position: absolute&quot; or &quot;relative&quot; and a &quot;z-index&quot;&lt;br /&gt;- because it has an opacity &lt; 1&lt;br /&gt;- ... at least 8 other not-fully identified possibilities (see links above)&lt;br /&gt;&lt;br /&gt;Additionally to this context generation issue, the tricky parts for me are :&lt;br /&gt;- &lt;strong&gt;an element generates a stacking for its childs. Not for himself&lt;/strong&gt;&lt;br /&gt;- &lt;strong&gt;there are almost no relationship between element tree and contexts&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;I'll sum-up all of this with this graph : &lt;br /&gt;&lt;img src=&quot;https://mathieugueydan.blogs.centraliens-marseille.fr/media/02/01/2799704397.png&quot; id=&quot;media-239959&quot; title=&quot;&quot; alt=&quot;tempcss.png&quot; style=&quot;margin: 0.7em 0;&quot; /&gt;&lt;br /&gt;What Mozilla says about that (which definitely was the easier to understand for me) : &lt;br /&gt;https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context&lt;br /&gt;https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Stacking_context_example_1&lt;br /&gt;https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Stacking_context_example_2&lt;br /&gt;https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Stacking_context_example_3&lt;br /&gt;&lt;br /&gt;What Chrome says about that :&lt;br /&gt;(Using chrome :) chrome://flags/#fixed-position-creates-stacking-context&lt;br /&gt;https://developers.google.com/web/updates/2012/09/Stacking-Changes-Coming-to-position-fixed-elements&lt;br /&gt;&lt;br /&gt;What W3c says about it (but's it's fuzzy) : &lt;br /&gt;https://www.w3.org/TR/CSS22/visuren.html#propdef-z-index&lt;br /&gt;&lt;br /&gt;An explanation attempts from various guys : &lt;br /&gt;https://philipwalton.com/articles/what-no-one-told-you-about-z-index/ (this one was a good start, but in the end it doesn't give the right key)&lt;br /&gt;https://webdesign.tutsplus.com/articles/what-you-may-not-know-about-the-z-index-property--webdesign-16892&lt;br /&gt;
</content>
</entry>
<entry>
<author>
<name>mathieu.gueydan</name>
<uri>https://mathieugueydan.blogs.centraliens-marseille.fr/about.html</uri>
</author>
<title>Rechargement Navigo depuis Ubuntu (2016/06)</title>
<link rel="alternate" type="text/html" href="https://mathieugueydan.blogs.centraliens-marseille.fr/archive/2016/07/01/rechargement-navigo-depuis-ubuntu-2016-06-1628783.html" />
<id>tag:mathieugueydan.blogs.centraliens-marseille.fr,2016-07-01:1628783</id>
<updated>2016-07-01T03:13:14+02:00</updated>
<published>2016-07-01T01:51:00+02:00</published>
<summary>Bonjour,   J'ai beaucoup luté ce soir pour recharger mon navigo depuis ma...</summary>
<content type="html" xml:base="https://mathieugueydan.blogs.centraliens-marseille.fr/">
Bonjour, &lt;br /&gt;&lt;br /&gt;J'ai beaucoup luté ce soir pour recharger mon navigo depuis ma Ubuntu.&lt;br /&gt;Voici quelques pistes pour ceux qui auraient à faire ça un jour (moi inclus).&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Première étape : installation des drivers.&lt;/u&gt;&lt;br /&gt;Source1 : http://blog.freepeople.fr/bazar/recharger-le-passe-navigo-sous-linux/&lt;br /&gt;Source2 : http://www.blogouillage.net/2012/11/rechargement-du-passe-navigo-sous-linux.html&lt;br /&gt;&lt;br /&gt;Il s'avère que dans mon cas, les packetages suivants ont été nécessaires : &lt;br /&gt;* pcscd&lt;br /&gt;* libpcsclite1&lt;br /&gt;* pcsc-tools : peut-être, mais sans certitude, car je ne sais pas quelle partie aurait été utilisée et je ne m'en suis pas servi directement&lt;br /&gt;&lt;br /&gt;Le résultat est immédiat:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&gt;:~$ pcsc_scan&lt;br /&gt;PC/SC device scanner&lt;br /&gt;V 1.4.22 (c) 2001-2011, Ludovic Rousseau &lt;ludovic.rousseau@free.fr&gt;&lt;br /&gt;Compiled with PC/SC lite version: 1.8.10&lt;br /&gt;Using reader plug'n play mechanism&lt;br /&gt;Scanning present readers...&lt;br /&gt;0: Alcor Micro AU9520 00 00&lt;br /&gt;&lt;br /&gt;Fri Jul  1 01:27:33 2016&lt;br /&gt;Reader 0: Alcor Micro AU9520 00 00&lt;br /&gt;  Card state: Card inserted, &lt;br /&gt;...&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Parti comme ça, on se dit que ça va bien se passer.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Seconde étape : Maquiller son user-agent pour ne pas que le site détecte un OS Linux&lt;/u&gt;&lt;br /&gt;Source1 : http://blog.freepeople.fr/bazar/recharger-le-passe-navigo-sous-linux/&lt;br /&gt;Source2 : http://www.useragentstring.com/Chrome41.0.2227.1_id_19830.php&lt;br /&gt;&lt;br /&gt;Le site navigo.fr vérifie le user-agent qu'il reçoit de votre Browser, et si cela ne correspond pas à ce qu'il connaît (c'est à dire windows / mac pour l'OS), il refuse carrément d'envoyer l'applet. Plutôt que de risquer que cela échoue, ils préfèrent ne pas tenter.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://mathieugueydan.blogs.centraliens-marseille.fr/media/00/02/1536515595.png&quot; id=&quot;media-239957&quot; title=&quot;&quot; alt=&quot;error_please_change_os.png&quot; style=&quot;margin: 0.7em 0;&quot; /&gt;&lt;/p&gt;&lt;br /&gt;On appréciera en particulier la remarque finale qui sous-entend que vous allez changer de système (pour passer à un système payant) et revenir ensuite sur le site de navigo pour terminer votre opération.&lt;br /&gt;&lt;br /&gt;Du coup, il faut envoyer un user-agent correspondant à l'un des cas connus.&lt;br /&gt;&lt;br /&gt;La source 1 indique d'utiliser le plug-in de Firefo &quot;user agent switcher&quot; pour cette fin, c'est ce que j'ai fait. Par contre les informations qu'il donne sur le user-agent sont un peu anciennes.&lt;br /&gt;La source 2 m'a permis de trouver les derniers users-agents. Le site navigo.fr est assez sympa pour nous corriger quand on lui donne une version qu'il n'aime pas.&lt;br /&gt;&lt;br /&gt;Par exemple quand je lui ai fourni le user-agent de chrome 37.0.2062.124, il m'a gentiment répondu &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Votre navigateur Internet ou sa version Google Chrome 37.0 n'est pas compatible avec le service de rechargement/lecture de passe.&lt;br /&gt;Le service de rechargement/lecture de passe est optimisé pour les versions de Google Chrome 40.0 et ultérieures :&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Note : Je suis resté sur un OS Mac, en me disant qu'il y avait moins de chance que les effets de bords soient graves sur un Mac-&gt;Debian que sur un Windows-&gt;Debian. Après tout, on est en boite noire, on n'a aucune idée de ce que le site peut faire de cette info, si ça se trouve l'applet java chargée n'est pas la même en fonction des user-agent, et il y a plus de chance que l'applet développée pour Mac fonctionne sur une Debian, que l'applet développée pour Windows.&lt;br /&gt;&lt;br /&gt;Au final, j'ai utilisé la conf suivante : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Description : Mac&lt;br /&gt;User Agent : Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36&lt;br /&gt;App Code Name : Mozilla&lt;br /&gt;App Name : Netscape&lt;br /&gt;App Version : 5.0 (X11)&lt;br /&gt;Platform : Macintosh Intel Mac OS X 10_6_8&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Les résultats sont très engageants : le site accepte d'envoyer l'applet, l'applet voie le lecteur de carte et la carte, on peut même consulter le contenu de sa carte via le site.&lt;br /&gt;Yohoo !&lt;br /&gt;&lt;br /&gt;&lt;p style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;https://mathieugueydan.blogs.centraliens-marseille.fr/media/00/02/2238822489.png&quot; id=&quot;media-239958&quot; title=&quot;&quot; alt=&quot;overview.png&quot; style=&quot;margin: 0.7em 0;&quot; /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Non pas Yohoo.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Troisième étape : La conf de java&lt;/u&gt;&lt;br /&gt;Source1 : https://doc.ubuntu-fr.org/java&lt;br /&gt;Source2 : https://www.java.com/fr/download/help/linux_install.xml&lt;br /&gt;Source3 : http://stackoverflow.com/questions/14491322/how-to-add-java-plugin-for-firefox-on-linux&lt;br /&gt;Source4 : http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/&lt;br /&gt;&lt;br /&gt;Il s'avère que pour recharger un navigo, il ne suffit pas que l'applet voie le lecteur de carte Navigo et la carte Navigo, il faut aussi qu'elle puisse opérer un paiement par carte-bleue auprès d'une banque.&lt;br /&gt;&lt;br /&gt;Or il s'avère qu'OpenJDK 7 (installé par défaut, de même que IceTea-7 sur ma Ubuntu) est (ou du moins semble) incompatible avec l'applet de Navigo. Le symptôme est le suivant : au moment où l'on devrait saisir les informations de paiement, on reçoit le message : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Paiement refusé !&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Il m'a donc fallu installer le jdk d'Oracle.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;cd /usr/local/&lt;br /&gt;sudo mkdir java&lt;br /&gt;sudo mv /home/pouet/Downloads/jdk-8u91-linux-x64.tar.gz ./java/ &lt;br /&gt;cd java&lt;br /&gt;sudo tar zxvf jdk-8u91-linux-x64.tar.gz &lt;br /&gt;sudo update-alternatives --install /usr/local/java java&lt;br /&gt;sudo update-alternatives --install /usr/bin/java java /usr/local/java/jdk1.8.0_91/bin/java&lt;br /&gt;sudo update-alternatives --install /usr/bin/java java /usr/local/java/jdk1.8.0_91/bin/java 1&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Logiquement, rendu à ce point, on devrait être amené à utiliser update-alternatives, pour choisir laquelle des versions de java est utilisée par défaut : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;sudo update-alternatives --config java&lt;br /&gt;sudo update-alternatives --config javac&lt;br /&gt;sudo update-alternatives --config javaws&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Mais je n'ai pas eu à le faire car j'ai préalablement désinstallé OpenJDK, ce que je regrette a posteriori.&lt;br /&gt;Le mois prochain peut-être j'essaierais de le réinstaller et de faire fonctionner les deux en alternés.&lt;br /&gt;&lt;br /&gt;Une fois java installé , il est reconnu par le système : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&gt;:~$ which java&lt;br /&gt;/usr/bin/java&lt;br /&gt;&gt;:~$ ls -l /usr/bin/java&lt;br /&gt;lrwxrwxrwx 1 root root 22 juil.  1 00:00 /usr/bin/java -&gt; /etc/alternatives/java&lt;br /&gt;&gt;:~$ update-alternatives --config java&lt;br /&gt;There is only one alternative in link group java (providing /usr/bin/java): /usr/local/java/jdk1.8.0_91/bin/java&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Enfin, j'ai mis les JAVA_HOME dans mes exports, en recourant à un&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;sudo emacs /etc/bash.bashrc &lt;br /&gt;source /etc/bash.bashrc &lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;et en ajoutant les lignes suivantes au bashrc : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;export JAVA_HOME=/usr/local/java/jdk1.8.0_91/bin/java&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;La conséquence directe de tout ça est un java à la sauce Oracle qui fonctionne en ligne de commande: &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&gt;:~$ java -version&lt;br /&gt;java version &quot;1.8.0_91&quot;&lt;br /&gt;Java(TM) SE Runtime Environment (build 1.8.0_91-b14)&lt;br /&gt;Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Quatrième étape : faire en sorte que firefox voie ce nouveau java&lt;/u&gt;&lt;br /&gt;Source1: https://www.java.com/fr/download/help/linux_install.xml&lt;br /&gt;&lt;br /&gt;Pour OpenJDK, on pouvait compter sur iced-tea pour faire le lien Firefox java, mais pour Oracle-jdk il faut le faire à la main via un lien symbolique.&lt;br /&gt;&lt;br /&gt;Comme cela change d'une version à l'autre et d'une distro à l'autre, il vaut mieux ne pas faire confiance aux chemins qu'on peut trouver dans les tutoriaux ou dans les forums et retrouver soi-même sa librairie libnpjp2.so : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;sudo updatedb&lt;br /&gt;sudo locate libnpjp2.so&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Ce qui m'a permit d'écrire : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;ln -s /usr/local/java/jdk1.8.0_91/jre/lib/amd64/libnpjp2.so /usr/lib/firefox-addons/plugins/libnpjp2.so&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Suite à ça, la vérification de la version de java sur le site d'Oracle (https://www.java.com/en/download/installed.jsp) fonctionne depuis Firefox&lt;br /&gt;&lt;br /&gt;Et là on pourrait croire qu'on a fini&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Cinquième étape : faire en sorte que le java d'oracle trouve le lecteur de carte&lt;/u&gt;&lt;br /&gt;Source1 : https://doc.ubuntu-fr.org/smartcards&lt;br /&gt;Source2 : http://www.blogouillage.net/2012/11/rechargement-du-passe-navigo-sous-linux.html&lt;br /&gt;&lt;br /&gt;Et non, ce n'est pas fini, car, surprise, en changeant de JDK, on a perdu le lecteur de cartes. Pourquoi, comment .... je ne sais pas, internet fourmille de détails sur un bug connu d'emplacement des libs... mais j'ai eu beau essayer de faire des liens symboliques dans tous les répertoires possibles et imaginables vers la lib de libpcsclite1, rien n'y fit.&lt;br /&gt;&lt;br /&gt;Pour tester, je suis passé par le petit programme de la source 1 qui teste libpcsc.&lt;br /&gt;Les commandes suivantes permettent respectivement de compiler le code fourni par cette source, et d'exécuter le &quot;binaire&quot;&lt;br /&gt;produit &lt;blockquote&gt;&lt;br /&gt;&gt; javac TestSmartCardIO.java&lt;br /&gt;&gt; java TestSmartCardIO&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;et cela donne, en première approche : &lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;Terminals count: 0&lt;br /&gt;Terminals: []&lt;br /&gt;java.lang.IndexOutOfBoundsException: Index: 0&lt;br /&gt;at java.util.Collections$EmptyList.get(Collections.java:4454)&lt;br /&gt;at TestSmartCardIO.main(TestSmartCardIO.java:25)&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Je n'ai donc pas réussi, par le biais d'un lien symbolique à faire fonctionner le PCSC avec le Jdk de Oracle.&lt;br /&gt;&lt;br /&gt;En revanche, en précisant à java où trouver la librairie, ça fonctionne :&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&gt;:~$ java -Dsun.security.smartcardio.library=/lib/x86_64-linux-gnu/libpcsclite.so.1 TestSmartCardIO&lt;br /&gt;Picked up JAVA_TOOL_OPTIONS: &lt;br /&gt;Terminals count: 1&lt;br /&gt;Terminals: [PC/SC terminal Alcor Micro AU9520 00 00]&lt;br /&gt;Card: PC/SC card in Alcor Micro AU9520 00 00, protocol T=0, state OK&lt;br /&gt;...&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Ok, logiquement avec tout ça on doit être bon là.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Sixième étape : faire en sorte que l'applet java s'initialise avec les bons paramètres&lt;/u&gt;&lt;br /&gt;Source1 : http://stackoverflow.com/questions/28327620/difference-between-java-options-java-tool-options-and-java-opts&lt;br /&gt;&lt;br /&gt;Non, on est toujours pas bons, parce que quoi que je mette dans mes exports, je n'arrivais pas à faire en sorte que cette option soit passée à l'applet Navigo.&lt;br /&gt;&lt;br /&gt;Jusqu'à ce que je tombe sur cette question stackOverFlow très détaillée, qui m'indique pourquoi il ne faut utiliser ni JAVA_OPTS, ni _JAVA_OPTIONS (comme le disent la plupart des forums), mais bel et bien JAVA_TOOL_OPTIONS.&lt;br /&gt;&lt;br /&gt;Du coup, j'ai mis dans mon bashrc (comme précédemment) la ligne suivante : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;export JAVA_TOOL_OPTIONS=&quot;-Dsun.security.smartcardio.library=/lib/x86_64-linux-gnu/libpcsclite.so.1&quot;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;(attention à penser à le &quot;sourcer&quot; comme plus haut, de manière à ce que l'export soit valide tout de suite)&lt;br /&gt;Attention aussi à démarrer Firefox depuis la console de manière à ce qu'il tienne compte de ce source.&lt;br /&gt;&lt;br /&gt;J'ai enfin pu acheter mon ticket. Et voilà comment j'ai perdu la moitié de ma nuit pour éviter de faire 10' de queue demain matin.&lt;br /&gt;Bon après, si j'ai de la chance, le mois prochain ça devrait être plus rapide.&lt;br /&gt;&lt;br /&gt;Yohoo !!&lt;br /&gt;&lt;br /&gt;---------&lt;br /&gt;Pour la petite anecdote, les mois précédents (depuis plusieurs années en fait), j'utilisais un machine Windows pour recharger mon badge. Mais : &lt;br /&gt;1. Trois fois sur quatre je passais plusieurs heures à réinstaller des drivers et des versions de Java&lt;br /&gt;2. Aujourd'hui, elle ne boote plus, parce qu'elle a décidé, de son propre chef, de changer d'OS au profit de Windows 10.&lt;br /&gt;&lt;br /&gt;Ce que j'espère finalement, c'est que, malgré ce démarrage un peu rugueux, Ubuntu m'apportera la robustesse qui fait défaut à Windows.&lt;br /&gt;&lt;br /&gt;---------&lt;br /&gt;Ah, et sinon, le prochain candidat en entretien qui me cite la portabilité comme atout de Java sur d'autres langage ferait bien d'avoir lu ce post auparavant.
</content>
</entry>
<entry>
<author>
<name>mathieu.gueydan</name>
<uri>https://mathieugueydan.blogs.centraliens-marseille.fr/about.html</uri>
</author>
<title>Argparse (Note pour moi-même)</title>
<link rel="alternate" type="text/html" href="https://mathieugueydan.blogs.centraliens-marseille.fr/archive/2016/01/04/argparse-note-pour-moi-meme-1628651.html" />
<id>tag:mathieugueydan.blogs.centraliens-marseille.fr,2016-01-04:1628651</id>
<updated>2016-01-04T10:51:01+01:00</updated>
<published>2016-01-04T10:51:01+01:00</published>
<summary> - Parce que je n'ai jamais réussi à apprendre par coeur les noms des...</summary>
<content type="html" xml:base="https://mathieugueydan.blogs.centraliens-marseille.fr/">
- Parce que je n'ai jamais réussi à apprendre par coeur les noms des méthodes de argparse,&lt;br&gt;- Parce que j'ai toujours pratiquement les mêmes cas d'utlisation, &lt;br&gt;- Parce que ces cas ne ressortent pas vraiment dans l'aide d'argparse,&lt;br&gt;Je note ces cas ici :&lt;br&gt;&lt;br&gt;&lt;pre&gt;parser = argparse.ArgumentParser(description=&quot;What I do&quot;)parser.add_argument(&quot;astFile&quot;, help=&quot;the path where to find source ast&quot;)parser.add_argument(&quot;resultPath&quot;, help=&quot;the path where to write results&quot;)args = parser.parse_args()&lt;/pre&gt;&lt;br&gt;et&lt;br&gt;&lt;br&gt;&lt;pre&gt;parser = argparse.ArgumentParser(description=&quot;What I do&quot;)subparsers = parser.add_subparsers(title=&quot;commands&quot;, dest=&quot;action&quot;)subparsers.add_parser(&quot;start&quot;, help=&quot;start everything&quot;)subparsers.add_parser(&quot;stop&quot;, help=&quot;stop everything&quot;)subparsers.add_parser(&quot;status&quot;, help=&quot;get status&quot;)args = parser.parse_args()&lt;/pre&gt;
</content>
</entry>
<entry>
<author>
<name>mathieu.gueydan</name>
<uri>https://mathieugueydan.blogs.centraliens-marseille.fr/about.html</uri>
</author>
<title>Postfix / Sasl via Courier  / cannot connect to Courier authdaemond</title>
<link rel="alternate" type="text/html" href="https://mathieugueydan.blogs.centraliens-marseille.fr/archive/2015/07/14/postfix-sasl-via-courier-cannot-connect-to-courier-authdaemo-1628567.html" />
<id>tag:mathieugueydan.blogs.centraliens-marseille.fr,2015-07-14:1628567</id>
<updated>2015-07-14T21:57:48+02:00</updated>
<published>2015-07-14T21:57:48+02:00</published>
<summary> Hello,   This small note just to remind me, what just happened as I...</summary>
<content type="html" xml:base="https://mathieugueydan.blogs.centraliens-marseille.fr/">
Hello, &lt;br /&gt;&lt;br /&gt;This small note just to remind me, what just happened as I upgrade a debian with an installed postfix using courier as SASL authentifiaction (for smtp)&lt;br /&gt;&lt;br /&gt;&lt;u&gt;1. First, the smtp daemon had no access to the courier socket.&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;Symptom : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;tail /var/log/mail.info&lt;br /&gt;SASL authentication failure: cannot connect to Courier authdaemond: &lt;strong&gt;Connection refused&lt;/strong&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Explanation :&lt;br /&gt;&lt;br /&gt;For some reason, the smtp daemon is chrooted again. There maybe is a solution to allow him to access to courier socket even if it is chrooted, but I didn't find any (played some time with symbolic links but unsuccessfully. Tried to ask courier to put its socket in postfix chroot jail, but didn't work either)&lt;br /&gt;&lt;br /&gt;So I choosed to unchroot it : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;sudo emacs /etc/postfix/master.cf&lt;br /&gt;smtp      inet  n       -      &lt;strong&gt;n&lt;/strong&gt;       -       -       smtpd&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;And then restart postfix of course.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;2. Then, the smtp daemon had no right anymore to read the courier socket.&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;Symptom : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;tail /var/log/mail.info&lt;br /&gt;SASL authentication failure: cannot connect to Courier authdaemond: &lt;strong&gt;Permission denied&lt;/strong&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Explanation :&lt;br /&gt;The rights on the socket &lt;strong&gt;folder&lt;/strong&gt; went wrong. Be carefull, the rights on the socket itself where good.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;ls -l /var/run/courier/authdaemon/socket&lt;br /&gt;ls: cannot access /var/run/courier/authdaemon/socket: Permission denied&lt;br /&gt;&lt;br /&gt;sudo ls -l /var/run/courier/authdaemon/socket&lt;br /&gt;srwxrwxrwx 1 root root 0 Jul 14 21:31 /var/run/courier/authdaemon/socket&lt;br /&gt;&lt;br /&gt;sudo ls -l /var/run/courier/&lt;br /&gt;drwxr-x--- 2 daemon daemon 100 Jul 14 21:31 authdaemon&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;I choosed to add postfix in the daemon group : &lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;sudo usermod -a -G daemon postfix&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;
</content>
</entry>
<entry>
<author>
<name>mathieu.gueydan</name>
<uri>https://mathieugueydan.blogs.centraliens-marseille.fr/about.html</uri>
</author>
<title>Ubuntu - NVidia - OpenGl - Unity - Compiz disappear</title>
<link rel="alternate" type="text/html" href="https://mathieugueydan.blogs.centraliens-marseille.fr/archive/2015/03/16/nvidia-1628489.html" />
<id>tag:mathieugueydan.blogs.centraliens-marseille.fr,2015-03-16:1628489</id>
<updated>2015-03-16T22:30:26+01:00</updated>
<published>2015-03-16T22:28:00+01:00</published>
<summary> You may find multiple topics on various internet forums describing the very...</summary>
<content type="html" xml:base="https://mathieugueydan.blogs.centraliens-marseille.fr/">
You may find multiple topics on various internet forums describing the very same symptom:&lt;br /&gt;&lt;br /&gt;On Ubuntu with old Nvidia cards, at some point, generally after an apt-get update or new video driver installation : compiz disappear.&lt;br /&gt;&lt;br /&gt;There are a lot of &quot;fixes&quot; answered on those forums. None of them concerns the case I encountered multiple times on my laptop.&lt;br /&gt;&lt;br /&gt;I put the description of my problem here. Hope it will be useful. At least it will be a reminder for myself :&lt;br /&gt;&lt;br /&gt;Here is the log describing the error :&lt;br /&gt;&gt; sudo grep &quot;(EE)&quot; /var/log/Xorg.0.log&lt;br /&gt;[   693.341] (EE) Failed to load /usr/lib/x86_64-linux-gnu/xorg/extra-modules/x86_64-linux-gnu_xorg_extra_modules/x86_64-linux-gnu_xorg_extra_modules/...&lt;br /&gt;[   693.341] (EE) Failed to load module &quot;glx&quot; (loader failed, 7)&lt;br /&gt;&lt;br /&gt;Here are some strange resulted commands : &lt;br /&gt;&gt; ls -l /etc/alternatives/x86_64-linux-gnu_xorg_extra_modules&lt;br /&gt;/etc/alternatives/x86_64-linux-gnu_xorg_extra_modules -&gt; /usr/lib/x86_64-linux-gnu/xorg/extra-modules&lt;br /&gt;&gt; ls -l /usr/lib/x86_64-linux-gnu/xorg/extra-modules&lt;br /&gt;/usr/lib/x86_64-linux-gnu/xorg/extra-modules -&gt; /etc/alternatives/x86_64-linux-gnu_xorg_extra_modules&lt;br /&gt;&lt;br /&gt;Here is how I &quot;solved&quot; it : &lt;br /&gt;&gt; sudo rm /usr/lib/x86_64-linux-gnu/xorg/extra-modules&lt;br /&gt;
</content>
</entry>
<entry>
<author>
<name>mathieu.gueydan</name>
<uri>https://mathieugueydan.blogs.centraliens-marseille.fr/about.html</uri>
</author>
<title>First : make it work. Then : refactor</title>
<link rel="alternate" type="text/html" href="https://mathieugueydan.blogs.centraliens-marseille.fr/archive/2015/02/02/first-make-it-work-then-refactor.html" />
<id>tag:mathieugueydan.blogs.centraliens-marseille.fr,2015-02-02:1628476</id>
<updated>2015-03-16T21:37:13+01:00</updated>
<published>2015-02-03T12:16:00+01:00</published>
<summary>Here are 6 mottoes I believe in : - First : Make it work. Then : Refactor -...</summary>
<content type="html" xml:base="https://mathieugueydan.blogs.centraliens-marseille.fr/">
Here are 6 mottoes I believe in :&lt;br /&gt;- First : Make it work. Then : Refactor - &lt;em&gt;Anonymous&lt;/em&gt;&lt;br /&gt;- To lead people, walk behind them - &lt;em&gt;老子&lt;/em&gt;&lt;br /&gt;- &lt;a href=&quot;http://www.gotw.ca/publications/c++cs.htm&quot; target=&quot;_blank&quot;&gt;Inherit, not to reuse, but to be reused&lt;/a&gt; - &lt;em&gt;Sutter / Alexandrescu&lt;/em&gt;&lt;br /&gt;- Quality is not an act, it is a habit - &lt;em&gt;Aristotle&lt;/em&gt;&lt;br /&gt;- &lt;a href=&quot;http://www.antlr.org/&quot; target=&quot;_blank&quot;&gt;Why programm by hand in five days what you can spend five years of your life automating&lt;/a&gt; - &lt;em&gt;Terence Parr&lt;/em&gt;&lt;br /&gt;- Cease dependence on mass inspection to achieve quality - &lt;em&gt;W.E. Deming&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://mathieugueydan.blogs.centraliens-marseille.fr/media/01/01/4126285108.png&quot; alt=&quot;cards.png&quot; style=&quot;float: left; margin: 0.2em 1.4em 0.7em 0;&quot; /&gt;Collecting them has been proven to be very useful. It allows me to display clear messages to my bosses, customers, co-workers... I use to write them on walls or whiteboards in my workspace and even printed them on my business cards&lt;br /&gt;&lt;br /&gt;I'm not sure I'm smart enough to say something new and useful on Sutter's and Alexandrescu's work or on Lǎo zǐ's thinking, but what I will try to do in this post is to explain what's hidden behind the very first one :&lt;br /&gt;&lt;br /&gt;&lt;p style=&quot;text-align: center&quot;&gt;First : make it work. Then : refactor&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;Basically, this is a procedure on how to build something new, especially software.&lt;br /&gt;&lt;br /&gt;Let's look what one may want to do, when before build something new (a new feature, a new product...):&lt;br /&gt;&lt;br /&gt;1. spend a lot of time thinking about what should be done and then writing specifications. These thinkings and specifications of course include technical details like configuration files, protocols used etc.&lt;br /&gt;&lt;br /&gt;2. spend a lot of time building everything that will be used by the application. Among them: environment, unitary-tests, nice object model, tools and components like loggers, rpc ...&lt;br /&gt;&lt;br /&gt;Of course you want all of theses. Going on without any unitary test or without a good logger is a waste of time. Everybody knows it. I know it.&lt;br /&gt;&lt;br /&gt;What this motto means, is that before all of this, you want to do a PoC. A fast-coded prototype that will demonstrate the main feature of your software, and only the main feature. And you want your customer to have this in hands very early.&lt;br /&gt;&lt;br /&gt;There are at least 3 reasons why you want this are : &lt;br /&gt;&lt;br /&gt;1. Because you're not sure of the feasibility of what you want to do. Most of the time, even after a very careful thinking and a nice specification, coding it make new issues appear you was not able to anticipate.&lt;br /&gt;&lt;br /&gt;2. Because you want to provide something concrete to your user/customer. Your user/customer will have something to focus on very early. Every discussion that takes places after that may be done with concrete demonstrations. It drastically reduce the customer/coder misunderstandings.&lt;br /&gt;&lt;br /&gt;3. Because it make you shine. When your competitors need 2 weeks to provide something, you will come back to your client in 2 days. Of course, in the end you may not be faster. But what will stay in mind is that you came back with something in 2 days.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I don't spend too much words on the second part : &quot;Then refactor&quot;, it's pretty obvious. You wrote some bad-code in order to provide a PoC. You don't want this code to stay in your final application. You need refactoring.
</content>
</entry>
<entry>
<author>
<name>mathieu.gueydan</name>
<uri>https://mathieugueydan.blogs.centraliens-marseille.fr/about.html</uri>
</author>
<title>Project Euler (again).</title>
<link rel="alternate" type="text/html" href="https://mathieugueydan.blogs.centraliens-marseille.fr/archive/2015/01/16/project-euler-again.html" />
<id>tag:mathieugueydan.blogs.centraliens-marseille.fr,2015-01-16:1628470</id>
<updated>2015-01-16T18:55:48+01:00</updated>
<published>2015-01-16T18:55:48+01:00</published>
<summary>  I'm just sharing here my happiness, as I received today the centurion award...</summary>
<content type="html" xml:base="https://mathieugueydan.blogs.centraliens-marseille.fr/">
&lt;img src=&quot;https://mathieugueydan.blogs.centraliens-marseille.fr/media/00/01/303565086.png&quot; id=&quot;media-239946&quot; title=&quot;&quot; alt=&quot;award_04.png&quot; style=&quot;float: left; margin: 0.2em 1.4em 0.7em 0;&quot; /&gt;I'm just sharing here my happiness, as I received today the centurion award in Project Euler. Of course, it's not as shiny as the one related &lt;a href=&quot;https://mathieugueydan.blogs.centraliens-marseille.fr/archive/2012/09/11/project-euler.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;, but I'm proud anyway.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If you're wanting to train your algorithm programming abilities, Project Euler is a good place to go. If you're new to this, let me advise you some basic tips : &lt;br /&gt;&lt;br /&gt;1. Don't try to rush high level problems&lt;br /&gt;&lt;br /&gt;Problems often are related to previous problems. Skipping some of them may force you to spend time trying to solve problems you don't have tools for.&lt;br /&gt;&lt;br /&gt;2. Think about complexity first&lt;br /&gt;&lt;br /&gt;Most of the problems ask you to iterate on things. Generally, they are several elements you may choose to iterate on. You may always want to choose the lesser complexity for your algorithm, which means, the fewer and the fastest iterations.&lt;br /&gt;&lt;br /&gt;As you design your algorithm (in you head or on paper), you may want to shortly evaluate the number of iterations you will need to full-fill the calculation. If it's to high, you're solution is wrong.&lt;br /&gt;&lt;br /&gt;3. Think &quot;out of the box&quot;&lt;br /&gt;&lt;br /&gt;If you think you are tackling the problem from the right angle but it doesn't work, it's probably that you don't have the right angle. Most of the time, there is another way to watch the problem you didn't figured out at the moment.&lt;br /&gt;Don't spend time in small optimisation and lesser algorithms improvement (I know, this is fun to do). Generally, if you're wrong, it's not about 10% it's about a factor 1000.&lt;br /&gt;&lt;br /&gt;One slight note of caution : be aware that a few number of the first 100 problems may need you to use specific mathematical theories (often linked to Euler's work). For those ones, you may search long hours without any chance to find a solution (as it would ask you to re-invent the mathematical theory, which is not what you are trying to do). So if you are stuck on a problem for a very long time, you may want to search for associate mathematical theory. Which is not very easy without cheating.&lt;br /&gt;&lt;br /&gt;4. Keep your programs (and keep them clean)&lt;br /&gt;&lt;br /&gt;As each problem ask you a single answer and nobody will comes after you to read your application, you may want to write disposable code in order to spare time. Here's why I see it as a bad idea.&lt;br /&gt;&lt;br /&gt;You will spend more time troubleshooting : involved concepts are pretty hard to understand, there is a good chance that you will miss things. And if you do, finding them in a messy code will take you a lot of time.&lt;br /&gt;&lt;br /&gt;You will not be able to reuse things : as told before, some problems are linked to previous one. So you will often have to go back to a previous problem's solution to re-use not the code, but the way of thinking. If you coded it cleanly the first time, this will be easier.&lt;br /&gt;&lt;br /&gt;5. Use assertions&lt;br /&gt;&lt;br /&gt;I often suggest co-workers to make no assumption in their code (check everything always - let's keep this topic for another post).&lt;br /&gt;Project Euler is a good illustration of that. I use a large amount of assertions in my code despite the low number of lines (about 50 a problem), in order to catch unpredicted cases. The algorithms you will develop are complex, and it's pretty easy to miss one spot. Your own code is the best place to check every assumption you made.&lt;br /&gt;&lt;br /&gt;6. Don't cheat and Enjoy&lt;br /&gt;&lt;br /&gt;So far I resisted the temptation to cheat (with the few frustrating consequences explained before when specific mathematical theories are involved in the solution). Almost every answers are available just here on internet, but the only meaning of this exercise is to improve your algorithm skills not your google search abilities.&lt;br /&gt;&lt;br /&gt;I still can remember the joy I felt, by solving the 393th problem, after days of unsuccessful tries. It worth it.
</content>
</entry>
</feed>