Tuesday, November 15, 2016

France 2017 - pourquoi je vote à la primaire de la droite et du centre - #notrumpinfrance

Allons tous voter à la primaire du centre et de la droite

Note: vu les réactions, ce n'est pas clair: cet article ne parle pas de vote utile. Il ne parle pas du premier tour 2017. Il parle de se laisser un plan B acceptable pour la cohabitation entre Français, pour la démocratie, pour le climat si le premier tour ne tourne pas comme "on" le voudrait. Il viendra un tant on une action pour le premier tour sera importante, ce n'est pas encore le moment.

Des bulles de confort, silos aveuglants

Nous vivons aujourd’hui dans de petites bulles d’informations aseptisées, des silos bien compartimentés dans lesquels seules nos idées, ou des idées prochent de nos idées, ont droit de cité. Ce phénomène n’est pas nouveau, c’est même l’un des biais cognitifs le plus connus: le biais de confirmation. Il est aujourd’hui décuplé par la technologie qui filtre chaque jour un nombre grandissant de nos interactions sociales. Les algorithmes trouvent nos amis, nous posons un bâillon “silent” sur les trolls, ces individus qui ne sont pas d’accord avec nous, et qui nous sortent de notre zone de confort. Notre confort. Ce confort si agréable. Si confortable.

Et nous créons ainsi nos propres prisons d’idées, des silos en forme de chambre d’écho. Cet article décrit en détail le phénomène.

Le résultat est que nous ne voyons pas les autres silos qui ne pensent pas comme nous. Nous ne savons pas, nous ne voulont pas savoir, nous ne pouvons plus savoir qu’ils existent, ni leur taille, ni leur portée.
Et nous passons notre temps à optimiser les choix globaux de société auxquels nous sommes confrontés pour notre silo, pour l’idéal qu’il incarne en triant tous ceux qui n’y correspondent pas. Ce silo qui est notre monde. Lorsque nous sommes face à un choix imposé par un plus gros silo que le nôtre, ou qui correspond à l’optimum local d’un plus grand nombre de silo que nous, nous sommes estomaqués.

“Comment”, s’exclame-t-on dans le silo PC de 2012, “mais je ne connais PERSONNE qui vote Le Pen - comment peut-il être au second tour?”.

La France n’est pas mieux que l’Angleterre et les USA

L’élection de Trump, le “oui” au Brexit, le choix pour la primaire EELV dans une moindre mesure, nous rappelle que les résultats se fichent pas mal de ce qui fait foi dans le silo que vous fréquentez. Et cela, même s’il est aussi la chambre d’écho des médias que vous écoutez - vous les avez filtrés, évidemment. Or les Français ne sont pas plus immunisés au phénomène que ne le sont les Américains, les Anglais, les partisans de Cécile Duflot.

Dans mon silo, en 2017…

Pour 2017, je crois que j’aimerais avoir Bernie Sanders président des USA, une Europe fédérale, et peut-être Montesquieu président de la République Démocratique de France. Ou garde des Sceaux.

En tout cas, mon candidat idéal est porteur d’une idéologie politique sans intégrisme. Il propose un framework de grandes idées, de direction à suivre pour atteindre des buts (une stratégie) qu’il peut décliner en tactiques idoines pour traiter des problématiques inattendues ou spécifiques, en fonction des besoins. Il suit un cap lisible, qu’il est capable d’expliquer et de transmettre, dont découle naturellement les choix de réponse aux problématiques concrètes et complexes de notre monde. Il est capable de me parler comme à un adulte, en présentant les compromis et les alternatives, les raisons d’un choix éclairé. Et même si je ne suis pas d’accord dans tous les détails, je comprends et j’adhère à la vision globale, et à l’exécution générale. Je crains que tous ne soient pas possibles, peut-être certains n’étant que le fruit d’optimum local à mes silos fréquentés.

Tout pour préserver la civilisation

En imaginant que Montesquieu ne soit pas libre en mai prochain, ou ne passe pas le premier tour, je pense qu’il faut tout faire pour empêcher l’arrivée au pouvoir d’un homme (ou d’une femme) politique à même de libérer, crédibiliser et valider les plus bas instincts égoïstes de l’humain, racisme et haine en tête (mais toute destruction ou appropriation du Bien Publique pas loin derrière). Les exemples du Brexit et de Trump sont des mises en garde poignante qui rappelle que la civilisation ne tient que par le bon vouloir de milliers de gens. Dites-nous qu’il est normal d’insulter son prochain, et le chaos suit. La stratégie de l’échec, qui vise à démontrer le problème en poussant à l’erreur, ne fonctionne pas sur une échelle de temps raisonnable lorsqu’une moitié de la population est persuadée que ce n’est pas un échec ! Et le risque de catastrophe irrémédiable pour une ou plusieurs générations est trop grand pour valoir la joie du “je vous l’avais bien dit.”
Bref.

Posez-vous la question suivante: votre candidat idéal est Y. Jadot, EELV. Gentil, humain, contre le réchauffement climatique, tout ça. Pas de bol, il échoue à 22 points du second tour. Vous préférez avoir à choisir entre Marine Le Pen et Sarkozy, ou plutôt entre Marine Le Pen et Juppé ? Entre Fillon et Valls, ou plutôt Fillon (je rappelle qu’il trouve que la Convention Européenne des Droits de L’Homme est une contrainte dont on doit sortir) et Macron ? Entre Le Maire et Copé, ou entre Le Maire et NKM?

OK, on est d’accord, vous préféreriez voir Jadot gagner. Mais dans l’hypothèse où ça n’arriverait pas… Qui serait le moins pire (oui oui, je suis père de jeunes enfants) ? Instinctivement, je suis sûr que vous avez des choix qui semblaient plus faciles. Moins de chance que NKM explose le climat et revienne sur l’ensemble des propositions de la COP 21 que Copé. Ou que l’élection de Juppé fasse que l’ensemble des groupuscules néonazi se sentent les coudées franches et aillent casser de l’immigrant.

Pas de plan B pour le second tour n’est pas une option

Il est donc primordial d’essayer de prévoir un plan B, au cas où Montesquieu ou Jadot n’arriveraient pas à devenir présidents. Ce plan B se prépare dès aujourd’hui en sélectionnant des candidats plus acceptables que le dernier extrémiste venu. Pour ça, la droite, et peut-être la gauche (ou pas. Ou peut-être. Ou on verra. C’est compliqué) nous donne la possibilité de sélectionner son candidat. Et c’est important. Surtout si vous n’êtes pas habituellement de droite. Si vous avez lu jusque là, c’est que vous êtes pour l’alternance Hollande-quelqu’un-d’autre, que vous êtes pour la république, et vous êtes sûrement pour le redressement de la France. Qui ne voudrait pas d’une France bien droite, n’est-ce pas? Bref, vous êtes qualifiés pour aller voter à la primaire du centre et de la droite.

Voter ? Mais pour qui ? Mon framework de décision

Aujourd’hui, mon candidat idéal n’a pas l’air de pointer le bout de son nez. Aussi, je me limite pour l’instant à trois simples critères dont le but est simple:

  1. préserver la civilisation,
  2. préserver la possibilité de la République Démocratique,
  3. préserver la possibilité d’un futur pour les générations à venir.

[1] Contre l’incitation à la haine entre groupes démographiques

La civilisation ne tient qu’à un fil, et la moindre exploitation de la peur, de la colère ou de la haine d’un groupe démographique contre un autre risque de faire boule neige (mode avalanche). Le Brexit, l’élection de Trump en sont de tristes exemples.
Évidemment, tout candidat à tendances racistes (ou qui banalise ce phénomène) est éliminé. Mais c’est aussi valable pour l’incitation à la haine envers tout groupe démographique arbitrairement défini. Les jeunes. Les lesbiennes. Les ruraux. Les élites. Les riches. Les immigrants.
Par exemple, lorsque Macron propose un contrat “jeunes”, il perd des points ici: il stigmatise un groupe démographique contre d’autres, incitant à la colère et la haine là où nous avons besoin de coopération et de solidarité.
De civilisation.

[2] Pour la séparation des pouvoirs, contre l’autoritarisme et le “surveillance capitalism”

Ce trait est primordial, car il est le garant de la possibilité d’avoir une élection suivante. Ou une République d’après, sans passer par la case dictature-révolution-coupons-quelques-têtes.
Le gouvernent de Hollande et Valls restera sûrement dans l’histoire comme le gouvernement qui a le plus préparé à des dérives autoritaires: état d’urgence perpétuel, fichiers en tout genre, lois sécuritaires, légalisation de l’espionnage de masse… Ajoutez à tout ceci l’avènement du “surveillance capitalism”, et nous sommes en train de donner tous les outils au prochain dictateur en herbe pour exercer ses ambitions efficacement.
Il est de notre devoir d’infléchir cette tendance.
Tout candidat qui semble vouloir réduire la séparation stricte des trois pouvoirs de gestion de la nation, ou qui amenuise, voir ridiculise les plus hauts organes juridiques garants de l’état de droit (comme cela se voit en Angleterre en ce moment), est dangereux pour la liberté et la démocratie.

[3] Pour la préservation de notre écosystème, la Terre

Enfin, tout ceci n’a pas le moindre sens si demain, nous n’avons plus de Terre. Le climat est évidemment le principal élément du sujet, mais de façon plus générale, la Terre est un Bien Commun dont nous oublions trop facilement le prix titanesque. Et aujourd’hui, nous courons à la catastrophe. Sans action violente, rapide, concertée de nations très décidées - et il va falloir l’être pour les USA, nos enfants n’auront pas à se préoccuper de savoir si leur système politique est bien.

La primaire du centre et de la droite

Peuple de France, allez voter dimanche 20 et 27 novembre.
Personnellement, ma lecture au crible de la grille d’évaluation présentée des différents candidats entraine l’élimination de Sarkozy, Copé, Fillon, Poisson et Le Maire, en ne comptant que ceux qui ont eu trois smileys tristes (notation mode maternelle: smiley triste - smilley neutre - smiley content).

Reste Juppé et NKM. Comme disent mes enfants, il y a toujours une solution moins pire que les autres.

Votez ! Faites-vous entendre !

Monday, July 27, 2015

Enlightenment (e19) not starting after closing session - hangs on loading

Seems some time, I have, sometime, a really annoying behaviour with Enlightenent (E19). It happens on Archlinux (e0.19.5.1 at the time of writting), but I think it is not related with the distribution.
At the same time, it happens that new screen detection goes wrong, so it may be due to some bad driver. I'm using Intel driver (i915).

So, when it happens, the symptoms are:

  • from the login page (I'm using lightdm, but again, not sure it plays any role), I try to log
  • the E19 loading screen seems to want to appear, but nothing happen
  • if I switch on tty 1, ps aux | grep enligh gives  /usr/bin/enlightenment_start and /usr/bin/enlightenment
  • I can kill /usr/bin/enlightenment_start but the other need a kill -9
  • if I try  env DISPLAY=:0 enlightenment_remote -restart , the command hangs
  • env DISPLAY=:0 xrandr gives strange "current value" for screen 0: my screen is 1600x900, and when the bug happens, I get things like "3520x994" 
    • I get the same value on .xsession-errors, first line: zone 0x31cdfc0: 0 0   3520x994

 And until now, the only solution I had to make it start again was to remove my E19 profile (~/.e) - quite frustrating.

So, it happens that the problem is with "e_randr" module, the Enlightenment module in charge to manage xrandr for E. Somehow it's configuration get corrupted, and completely block any new sessions.

The solution is to simply remove e_randr cache files in .e/e/config when no enlightenment process runs (so kill them before if needed):
  • rm .e/e/config/standard/e_randr.*
  • rm .e/e/config/default/e_randr.*

The name "default" or "standard" may vary (for example, I remember that when I used to use BodhiLinux, it was bodhi or something alike).


And that's all ! Hope it helps other and my future me when I'll forget how to get out of that situation.

Monday, August 25, 2014

Upgrading to Ubuntu 14.04: "Error: Timeout was reached", "Segmentation fault (core dumped)" with APT and other stranges errors


This last weed-end, I tried to upgrade my old Bodhi Linux 2.4 based on Ubuntu 12.04 LTS to Bodhi 3.0 based on Ubuntu 14.04 LTS.


At some point something goes wrong with the update of the 1500 or so packages. I'm not sure about what happenned, but I started to see stranges errors, especially when trying to install/remove/correct package, but also in other part, for example when running some Python3 scripts.

Finally, everything was looking like working, but just almost working. Google fails on me on that, and I spend quite some time this week-end trying to go to the bottom of that problem, so I let a testimonial here, if it can help other people.

Symptoms

Segmentation fault (core dumped) with apt-get and python3 related scripts


This appears especially when trying to install/install -f "update-notifier-common" software, for example (sorry for the French):

% sudo apt-get install -f
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances      
Lecture des informations d'état... Fait
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
1 partiellement installés ou enlevés.
Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.
Paramétrage de update-notifier-common (0.154.1) ...
Segmentation fault (core dumped)
dpkg: error processing package update-notifier-common (--configure):
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 139
Des erreurs ont été rencontrées pendant l'exécution :
 update-notifier-common
Error: Timeout was reached
E: Sub-process /usr/bin/dpkg returned an error code (1)



The other aspect of that problem was that any Python3 related errors lead to a stack trace like that:

% python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> foo                                                                                                                                                                                                     
Traceback (most recent call last):
  File "", line 1, in
NameError: name 'foo' is not defined
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 20, in
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in
    import apt_pkg
ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-34m-x86_64-linux-gnu.so: undefined symbol: _ZN13pkgTagSectionC1Ev

Original exception was:
Traceback (most recent call last):
  File "", line 1, in
NameError: name 'foo' is not defined



Error: Timeout was reached

The second main symptom was that when using apt-* tools, I was getting an error message "Error: Timeout was reached" just at the end of the process. Nonetheless, everything seemed to be correctly installed/removed/etc.


Bug tracking, short version


That led me to some bug about a timeout to short for packagekit:

/usr/bin/test -e /usr/share/dbus-1/system-services/org.freedesktop.PackageKit.service && /usr/bin/test -S /var/run/dbus/system_bus_socket && /usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 4 --method org.freedesktop.PackageKit.StateHasChanged cache-update

So I tested with a really big number, and got:

/usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 300 --method org.freedesktop.PackageKit.StateHasChanged cache-update

Error: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Activation of org.freedesktop.PackageKit timed out


What lead to testing packagkit itself:

% sudo /usr/lib/packagekit/packagekitd --verbose
11:12:57        PackageKit          Verbose debugging enabled (on console 1)
11:12:57        PackageKit          keep_environment: 0
11:12:57        PackageKit          using config file '/etc/PackageKit/PackageKit.conf'
11:12:57        PackageKit          syslog fucntionality disabled
11:12:57        PackageKit          Log all transactions: 1
11:12:57        PackageKit          daemon shutdown set to 300 seconds
11:12:57        PackageKit          clearing download cache at /var/cache/PackageKit/downloads
11:12:57        PackageKit          destination eth0 is valid
11:12:57        PackageKit          setting config file watch on /etc/PackageKit/PackageKit.conf
11:12:57        PackageKit          ProxyHTTP read error: Key file does not have key 'ProxyHTTP'
11:12:57        PackageKit          searching for plugins in /usr/lib/x86_64-linux-gnu/packagekit-plugins
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-systemd-updates.so: A plugin to write the prepared-updates file
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-clear-firmware-requests.so: Clears firmware requests
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-check-shared-libraries-in-use.so: checks for any shared libraries in use after a security update
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-scan-desktop-files.so: Scans desktop files on refresh and adds them to a database
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-check-processes.so: Checks for running processes during update for session restarts
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-no-update-process.so: Updates the package lists after refresh
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-package-cache.so: Maintains a database of all packages for fast read-only access to package information
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin_scripts.so: Runs external scrips
11:12:57        PackageKit          opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-require-restart.so: A dummy plugin that doesn't do anything
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-check-shared-libraries-in-use.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-scan-desktop-files.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-check-processes.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-no-update-process.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-package-cache.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-require-restart.so
11:12:57        PackageKit          finished pk_plugin_initialize
11:12:57        PackageKit          Trying to load : aptcc
11:12:57        PackageKit          dlopening '/usr/lib/x86_64-linux-gnu/packagekit-backend/libpk_backend_aptcc.so'
Failed to load the backend: opening module aptcc failed : /usr/lib/x86_64-linux-gnu/packagekit-backend/libpk_backend_aptcc.so: undefined symbol: _ZN13pkgTagSectionC1Ev11:12:57 PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-check-shared-libraries-in-use.so

11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-scan-desktop-files.so
11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-check-processes.so
11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-no-update-process.so
11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-package-cache.so
11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-require-restart.so
11:12:57        PackageKit          finished pk_plugin_destroy
11:12:57        PackageKit          already closed (nonfatal)
11:12:57        PackageKit          parent_class->finalize


HooooOOoo... What about Aptitude ?


% aptitude
aptitude: symbol lookup error: aptitude: undefined symbol: _ZN3APT11CacheFilter39PackageArchitectureMatchesSpecificationC1ERKSsb



Solution

The problem was that somehow, I get a bad version of libapt-pkg4.12. So anything related to apt in some way had a chance to end badly.

Reinstalling the correct version of them (the one provided with my distribution) corrected all the problems:

sudo apt-get install libapt-pkg4.12=1.1.1bodhi1 apt=1.1.1bodhi1 apt-transport-https=1.1.1bodhi1 apt-utils=1.1.1bodhi1


Hope it helps !


Tuesday, April 1, 2014

Where all the activity went?

As you can see, the activity on that blog has been non existant for several years now. For the two visitor wondering, my main focus switch to my familly (2 sons, one other on its way), Normation (my company about devops, config management, etc: http://www.normation.com/ ) and of course Rudder (http://www.rudder-project.org/).

I'm still doing a ton of Scala, and you can find some articles on our company blog (http://blog.normation.com/) or slides about presentation I gave, like the one on Scala + ZeroMQ for Scala.IO 2013. It's on slideshoare: http://fr.slideshare.net/normation/

And of course, there is my Github page: https://github.com/fanf/ or twitter: https://twitter.com/fanf42

Hope to see you on these other media!

Thursday, November 17, 2011

Make firefox remember "autocomplete=off" password fields

Some site thinks that they better know than us what is security. For example, they want to prevent us to make firefox remember the login/password for them, and in the sametime, they don't allow to use a 30 char passphrase (because it does not contain a symbol, but six "!" is ok...).

If, like me, you are finding that behaviour as irrespectuous of your browsing experience as, say pop-ups, there is a trick:

  • install Firebug
  • on the page with the faulty password field, open Firebug.
  • use the blue mouse pointer in Firebug toolbar to select the password field
  • on the Firebug HTML tab, you should have a <input  type="password" autocomplete="off"....> field selected
  • double-click on "off" to edit the value and change it to "on". 
  • Now, enter you login/password as usual in the page form
  • when you hit "submit", Firefox should display the notification pop-up that allows to remember the login/password for that site. 
 Now, each time you are going to go on that page, firefox will autocomplete  the login/password as usual. 



Hop it will help other !

Sunday, February 6, 2011

Installing ZeroMQ and Java bindings on Ubunu 10.10

For some times now, I'm following the slow evolution of AMQP toward it's 1.0 release. In the trip, one traveler decided that the road was far too long, and complex, and choosed to take its independence: ZeroMQ is living its own adventure for some times now. And their choices are intersting, really focused and sharp, so I needed to see what can be done with that message system, and a bit of Scala.

So the first part was to install ZeroMQ and its Java binding into my computer, a Linux Ubuntu 10.10. It was quite easy, but as I didn't find a single post for the whole thing, I write that one as a memo, when in some days I will try to do it again and won't be able to remind the precise steps :)

Step 1: install recent ZeroMQ libraries

Before playing with some code, you need to install ZeroMQ libraries on your system. That library is on Ubuntu 10.10, but a more recent version seems to be needed for Java bindings. That's not a problem as some good will has made a PPA repository for them:

% sudo add-apt-repository ppa:chris-lea/zeromq
% sudo aptitude install libzmq-dev

That should install libzmq-dev (header files needed for the Java bindings) and the libzmq0 package - the core messaging system itself.

Step 2: get ZeroMQ binding

For that, you will have to clone the github repository of the project

% git clone https://github.com/zeromq/jzmq.git

And with that, you have a new jzmq directory with everything needed to build the Java bindings.

Step 3: build and install jzmq package

We are on a Debian based distribution, and ZeroMQ guys have the good taste to provide all what is needed to build a .deb for JZMQ, so let's just use the good work.
In the former jzmq directory, just do:

% ./autogen.sh
% dpkg-buildpackage -rfakeroot

And that's it. If all goes well, you should have a "jzmq_[some-version]_i386.deb" package on the parent directory of the one you are in. Just install it as usual:

% dpkg -i jzmq_[some-version]_i386.deb

And now, you can use ZQM from you Java code.

Some last notes

* don't forget to add the JNI library path in you JVM command line: use -Djava.library.path=/usr/lib
(/usr/lib should contains libjzmq.so, you can see it with dpkg -L jzmq)
If you the JAVA_HOME environment variable was correctly set when you buit the package,you may not have to add that parameter. 
* libjzmq.jar is in /usr/share/java/
* you will find some Java examples here.

That's it! Enjoy a world of easy message distribution.

Monday, January 31, 2011

Martin Odersky au Paris Scala User Group le 31 janvier

 Après pas mal de temps en sommeil, je réveille ce blog pour faire suivre cette annonce: Martin Odersky, le papa de Scala, fera une présentation au Paris Scala User Group, ce lundi 31 janvier. Plus de détails sont disponibles ici et ici.

J'en profite pour relayer l'information du financement à hauteur de 2.3 Million d'Euros sur 5 ans de Scala par l'Europe, ce qui devrait permettre de lever les dernières incertitudes quant à la pérénité du langage.



Tuesday, November 9, 2010

Scala 2.8.1 is out!

After a far shorter development cycle than for 2.8.0, Scala 2.8.1 reach us today.

More than 100 bugs were corrected, some of them really old (#36 !).

The great thing with that release is that for the first time ever, it is fully binary compatible with the previous one, Scala 2.8.0. With that and the creation of Scala Solution company, it seems to be really good insights toward Scala industrialization in the coming years.

Tuesday, July 27, 2010

Set-up Eclipse workspace in RAM

I just published an article about how to set-up your Eclipse workspace in RAM to make I/O (almost) instantaneous. It was promised in the "Eclipse perfomance optimisation article", and now it's here: http://blog.normation.com/2010/07/27/set-up-eclipse-workspace-in-ram/

And like last time, any information about Eclipse optimization is much appreciated !

Sunday, July 18, 2010

Java LDAP SDK for SyncRepl replication showcase

I just published a post on my company blog about how to implement a SyncRepl client using two different Java LDAP SDK, Apache DS and UnboundID: 


http://blog.normation.com/2010/07/18/java-ldap-sdk-for-syncrepl-replication-showcase/

SyncRepl is a replication protocol for LDAP, normalized in RFC 4533.  

The demonstration is done with a showcase web application that display in real time modification done in an LDAP server. 
The application, named Syweno, was developed in Scala, thanks to Liftweb and it's amazing Comet. It looks like:



Of course, update are synchronized thank to SyncRepl, and are propagated to the web page in real time thanks to Comet updates. 

The code source is available on github here: http://github.com/fanf/syweno

Enjoy !

Wednesday, July 14, 2010

Scala 2.8.0 is out

The most awaited Scala version of all time (ok, it's easy for now...) is out, at last !

Congratulation to every body who contributed to make it happens, and long life to Scala post-2.8.0. After a brilliant childhood, perhaps it is time for the unruly teenager to quieten down a little and conquer the industrial world !

The official link:
http://www.scala-lang.org/node/7009


Thursday, July 1, 2010

Scala dreaded underscore @ PSUG

(orignal content from http://blog.normation.com/2010/07/01/scala-dreaded-underscore-psug  )

On the evening of June 30th 2010, the Paris Scala User Group organized its second event.
This time, there were two presentations:

  • in the first one, Alexis Agahi, our kind user group leader, made a feedback after one year of scala experience. It’s available here.
  • the second one was given by your servitor, and deals with each and every use case of underscores in the Scala language – I hope I didn’t miss any.
    It’s available here.
See you next time on PSUG!

Monday, May 24, 2010

Optimizing Eclipse performances

I just published an article about Eclipse perfomance optimisation, especially with the Scala IDE plugin, here : http://blog.normation.com/2010/05/24/optimizing-eclipse-performances/

This article mostly talk about generalities and gives some reference links about JVM tunning. It also contains some eclipse.ini examples, and point to reference topic on that subject.

A second, more involved article in which I will explain how to put your workspace into ram (and keep it synchronizes to disk, of course) will follow in a couple of days (ok, perhaps packed in weeks, depending of my work...).

Of course, any information about Eclipse optimization is much appreciated !

Tuesday, May 18, 2010

Maven2 bootstrap pom.xml for Scala with SLF4J and no-commons-logging

Following an older post, this is the pom I use as a starting point for Scala project which uses maven.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 <modelVersion>4.0.0</modelVersion>
 <groupId>org.test</groupId>
 <artifactId>test</artifactId>
 <packaging>jar</packaging>
 
 <version>0.1-SNAPSHOT</version>

 <properties>
  <!-- UTF-8 for everyone -->
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

  <!-- Other general properties -->
  <slf4j-version>1.6.0</slf4j-version>
  <logback-version>0.9.20</logback-version>
  <scala-version>2.8.0.RC2</scala-version>
  <scala-maven-plugin-version>2.13.1</scala-maven-plugin-version>
  </properties>

 <description>
  Starting pom
 </description>

 <repositories>
  <repository>
   <id>scala-tools.org</id>
   <name>Scala-tools Maven2 Repository</name>
   <url>http://scala-tools.org/repo-releases</url>
  </repository>
  <repository>
   <id>scala-snapshots.org</id>
   <name>Scala-tools Maven2 Repository snapshots</name>
   <url>http://scala-tools.org/repo-snapshots</url>
  </repository>

  <repository>
   <id>no-commons-logging</id>
   <name>No-commons-logging Maven Repository</name>
   <layout>default</layout>
   <url>http://no-commons-logging.zapto.org/mvn2</url>
   <snapshots><enabled>false</enabled></snapshots>
  </repository>

 </repositories>

 <pluginRepositories>
  <pluginRepository>
   <id>scala-tools.org</id>
   <name>Scala-tools Maven2 Repository</name>
   <url>http://scala-tools.org/repo-releases</url>
   <snapshots><enabled>false</enabled></snapshots>
  </pluginRepository>
  <pluginRepository>
   <id>scala-snapshots.org</id>
   <name>Scala-tools Maven2 Repository snapshots</name>
   <url>http://scala-tools.org/repo-snapshots</url>
  </pluginRepository>
 </pluginRepositories>

 <build>
  <sourceDirectory>src/main/scala</sourceDirectory>
  <testSourceDirectory>src/test/scala</testSourceDirectory>
  <plugins>
   <plugin>
    <groupId>org.scala-tools</groupId>
    <artifactId>maven-scala-plugin</artifactId>
    <version>${scala-maven-plugin-version}</version> 
    <executions>
     <execution>
      <goals>
       <goal>compile</goal>
       <goal>testCompile</goal>
      </goals>
     </execution>
    </executions>
    <configuration>
     <args>
      <arg>-target:jvm-1.5</arg>
      <arg>-make:transitivenocp</arg>
      <arg>-dependencyfile</arg>
      <arg>${project.build.directory}/.scala_dependencies</arg>
     </args>
     <jvmArgs>
      <jvmArg>-client</jvmArg>
      <jvmArg>-Xmx1G</jvmArg>
     </jvmArgs>
    </configuration>
   </plugin>
   <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.1</version>
    <configuration>
    <source>1.6</source>
    </configuration>
   </plugin>
   
  </plugins>
 </build>

 <dependencies>
  <dependency>
   <groupId>org.scala-lang</groupId>
   <artifactId>scala-library</artifactId>
   <version>${scala-version}</version>
  </dependency>
  <dependency>
   <groupId>joda-time</groupId>
   <artifactId>joda-time</artifactId>
   <version>1.6</version>
  </dependency>
  <!--  test -->
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>4.7</version>
   <scope>test</scope>
  </dependency>

  
  <!--
   All the following is related to our will to NOT use Commong-logging
  -->
  <!-- use no-commons-logging -->
  <dependency>
   <groupId>commons-logging</groupId>
   <artifactId>commons-logging</artifactId>
   <version>99.0-does-not-exist</version>
  </dependency>
  <!-- no-commons-logging-api, if you need it -->
  <dependency>
   <groupId>commons-logging</groupId>
   <artifactId>commons-logging-api</artifactId>
   <version>99.0-does-not-exist</version>
  </dependency>
  <!-- the slf4j commons-logging replacement -->
  <dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>jcl-over-slf4j</artifactId>
   <version>${slf4j-version}</version>
  </dependency>
  <!-- the other slf4j jars -->
  <dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>slf4j-api</artifactId>
   <version>${slf4j-version}</version>
  </dependency>
  <!-- using slf4j native backend -->
  <dependency>
   <groupId>ch.qos.logback</groupId>
   <artifactId>logback-core</artifactId>
   <version>${logback-version}</version>
  </dependency>
  <dependency>
   <groupId>ch.qos.logback</groupId>
   <artifactId>logback-classic</artifactId>
   <version>${logback-version}</version>
  </dependency>
 </dependencies>
</project>




Monday, April 19, 2010

Summary of my Scala Days 2010

A great reception...

I had the immense luck to go to the First ScalaDays event organized by EPFL in Lausanne on 15/16 of April 2010.

It was an immense luck, because the event was simply fabulous. And so, to begin, I really want to thanks the Scala team, and especially Antonio Cunei for their amazing work of organization: the welcome with the little kit with the little goodies and T-Shirt was a nice introduction, the food was really good, the boat trip and dinner on first day evening a really top-level dinner.
Safe for a volcanic eruption in Iceland which disrupted flights all around Europe and so impacted a lot of attendees, it could have been near perfection.

... with great talks ...

And that is just for the organization: presentations were at the same level. Most of them were really good, and the choice between two sessions not always easy. Fortunately, presentation were recorded, and so should soon become available in line (I listed presentation I went to at the end). One little reproach: some of them would have deserve more time than allowed here, but that is near to nothing.

Akka presentation was somehow special. Jonas Boner and the Akka team did an amazing work in no more than a year, from “just an other actor implementation” to a full feature actor framework à la Erlang OTP, with actor supervision and management, persistent data structures, distribution, Software Transactional Memory (STM) integration, and all of that under the common umbrella of actor paradigm. 
To me, Akka is more and more looking like the Killer App for Scala, a middle layer framework which will be more or less in all Scala applications in a near future, a little like Spring is for the Java world. It brings so much power with so little boilerplate... So, if you don't know Akka, just go looking for it right now.

... and a bright future in sight for Scala

All along the event, there was a felling of “taking part of the starting point of something great”, perhaps a little like what were firsts Java one. Perhaps it was partly du to the fact that meeting about 155 Scala enthusiasts from Europe, US, Japan, Australia and so on was a great moment - it was really good to finally put faces on mailing lists and IRC names (hello Miles, Josh, Timothy and all the others !).
But I believe that it was more than just that. Today, I'm pretty confident that Scala is here to stay and growth.

The most "symptomatic" announcement of that evolution of the language organization from the research sphere to a broader audience is the announcement that a Scala Foundation will be created to manage it. 


So, that was a really wonderful event, and long life to Scala !

Ho – and I get my “Programming in Scala” dedicated by Martin, it's the little thing that is making that event even more special to me :)


Presentations seen

So, that's the list of presentations I attended, with a (really) brief description of them. Video of talks should me made available in a near future.

April, 15

15 morning - opening talk
A cool Opening Talk by Martin Odersky, focused on all the goodness brought by Scala 2.8, how it evolves from "just a little refactoring of Collection API" to a "3.0 without the name". Great.


15, morning


PEGEX by Kota Mizushima
or how to have combinator parser which looks like regexp. Interesting project, but a I think a little young for now... Keep an eye on it.

Scala Parallel collections by Aleksander Prokopec
Presentation of parallel collections arriving in Scala 2.8.1... It seems that it will be really great stuff, with good integration in existing collection API.


Developing the Scala bindings to the Fly Object Space by Channing Walton, Nigel Warren, Simon Kent
I miss a part of the beginning, but for what I saw,  Fly Object Space seems to be a powerful framework for distributed computing. 


15, afternoon, part 1

CCSTM: A library based STM for Scala by Nathan Bronson, Hasaan Chafi, Kunle Olukotun
A talk about what  Software Transactional Memory (STM) implementation can be achieve with Scala from an ideal STM, really nice stuff – STM seems to be a hot topic, it is cool that what is one of the most interesting feature of Clojure is winning interest in Scala.

Lightweight language support for type-based, concurrent event processing by Phillip Hadler
Really nice technical presentation about how type information can leads to massive performance optimization in pattern matching.

Named and default argument in Scala by Luka Rytz
To me, this feature is one of the best of Scala 2.8. It was nice to see how the implementation was done.


15, afternoon, part 2

Specialization in Scala by Iulian Dragos
Specialization finally comes to Scala 2.8 ! For the first time, Scala has the opportunity to be able to do things faster than Java, namely automatically specializing method to native JVM type to remove unnecessary boxing/unboxing logic. Great stuff, even if it's just a beginning.

Leaky Monads – an experiment with automatic resources management by Josh Suereth
Or how to cleanly manage resources in Scala with a little bit of monad, but only when we need them.
Great presentation by Josh, with a lot of “déjà vu” feeling for me – most of the problem he talk about and the solution he found was alike whose I encountered when I did my monadic resource management of LDAP connections.

Type-safe SQL embedded in Scala by Christoph Wulfz
Cool stuff to make SQL a first class citizen in Scala, as XML is.

April, 16

The next day seems to have again raise the level of the event. For me, it was a fabulous set of presentations. All were really top level one, and all subjects were great - well, or at least, I was the perfect target for them :)

16, morning keynotes

A really interesting keynote by Kunle Olukotun, the man behind the heavily-multi-core Niagara processor. He shows how to deeply embed polymorphic DSL in Scala, and it was kind of amazing. The Parallel and concurrent future seems to be bright in Scala world.

16, morning

Scala @ Linkedin : distributed computed with Norbert by Chris Conrad
Really cool to see what Linkedin did with Scala, and their scaling and distribution problem are really nice ones (in the way a hard maths theorem is nice to prove ;).

Akka: Simpler scalabitity, fault-tolerance, concurrency & remoting throught actors by Jonas Boner, Victor Klang
As I already said, Akka is more and more looking like the killer app on Scala. Kudo to Jonas ans Akka team.

Scala IDE for Eclipse : retrospect and prospect for 2.8 by Miles Sabin
After years of purgatory (for users ;), Scala Eclipse IDE seems to finally be interesting again, thanks to Miles and all the hard work. A really bad point for Eclipse foundation and its autism regarding JDT evolution.

16, afternoon, part 1

sbt: design and implementation by Mark Harrah
SBT, the build system that will save all of us from Maven – thanks Mark, and congrats for the work

Scala Modules: a Scala DSL to ease OSGi development by Heiko Seeberger
A “small” library to make OSGi use more user-friendly, and a lot of interest toward it. Sometime, syntax and cleanness IS important (subliminal message to all Java coders who don't see the problems with Java boilerplate)

Sneaking Scala into your organization by David Copeland
Even if I don't have that problem – in my company of four people, all the two developers are Scala experts ;), the talk was really interesting and well thought. Hope that a lot of people will follow these advices :)

16, afternoon, part 2


Their was no presentation in the last afternoon, but a workshop in which attendees were able to summarize their thought about Scala - what is missing, what has to be done, etc. Unfortunately, I had to leave before than the restitution was done, and missed it. So, for that, I'm like all of you: waiting for blog/video to know what happened !

And that's all, until next year (in U.S ?) !

Wednesday, April 14, 2010

Scala Days tomorrow !

In a few hours, I'm going to take the TGV for Lausanne, to attend first Scala Days !

There seems to be a lots of really good conferences, and it will be the opportunity to finally met a lot of irc/mailing list names !


Saturday, April 10, 2010

Embed OpenDS in your application

I just created a github project that shows what one has to do to configure and start OpenDS LDAP directory from a Java application, for example to run unit tests.

Most of the code is a direct transcription of information found on OpenDS wiki[1].

Along the commits, I tried to remove most of the unused configuration for the proposed goal, and I ended to replace the Berkeley DB backend by a memory one.

The source code is here: http://github.com/fanf/opends-simple-config

Feel free to remove even more unused configuration, or propose things to make OpenDS start time even faster.

Enjoy !


[1] https://www.opends.org/wiki/page/CreatingAnOpenDSInstanceForEmbeddedUse
https://www.opends.org/wiki/page/ControllingOpenDSFromAnotherApplication

Wednesday, March 17, 2010

Scala Unix file permissions DSL

Scala native DSL capabilities are astonishing. I just created some Scala object to mimic Unix file permission representation and "chmod" interaction, and I'm rather pleased of the result

Only user", "group" and "other" permission are managed - so no setuid, setgid or sticky bit.

Perm objects

They are simple immutable permission objects with a nice toString and an octal representation:
scala> val p:Perm = wx
scala> w.toString // "-wx"
scala> w.octal // 3
You can combine permission to obtain new permissions:
scala> w+r  // rw-
scala> rwx-w // r-w

FilePerms objects

They keep a group of three mutable permissions. You can create a new File permission object from octal values:
scala> val perms = FilePerms(777)

Or from Perm object:
scala> val perms = FilePerms(rw,rw,r)
Like Perm, they have nice string and octal representation:
scala> val perms = FilePerms(777)
scala> perms.toString //rwxrwxrwx
scala> perms.octal // 777

Missing values are initialized to "no permission":
scala> val perms = FilePerms(77) //rwxrwx---
scala> val perms = FilePerms(rw) //rw-------

And of course, you can change permissions:
scala> val perms = FilePerms(77) //rwxrwx---
scala> perms.g-wx  // rwxr----
scala> perms.ugo+x // rwxr-x--x
scala> perms.a-wx  // r--r-----
The binding of theses objects with Java IO with the goal to actually set file permissions is let as an exercise for the reader ;)
It's available on gist here: http://gist.github.com/335791. To test it, simply copy the file content, fire a Scala REPL, start an object declaration, past the content of the file, close you object, import its content, and play:
scala> object p { [enter]
  | [here, past the content of the file]
  .....
  | }
defined module p

scala> import p._
import p._

scala> FilePerms(644)
res0: Option[p.FilePerms] = Some(rw-r--r--)

Enjoy !


PS: if you have an idea about how to mimic chown, I would appreciate. For now, all I get is:
chmod( ug(_)+rw, filePerms)
Not really nice.

Wednesday, January 27, 2010

Scala 2.8 Beta 1 is out !

Today, the first official "Scala 2.8 Beta" was released. It was awaited, and for really good reasons !
Just look at the announcement summary to see all the goodness available: http://www.scala-lang.org/node/4587

I would like to thanks all the people at EPFL and all other contributors around the world to provide us with such a good language and awesome libraries/tools for our daily work - both production ready thanks to Java existing ecosystem and Start-up friendly (ok, no argument here, I just like that language :)

Downloads are available here: http://www.scala-lang.org/downloads

Wednesday, January 20, 2010

Scala and Spring 3 JavaConfig

Scala, Spring 3, Actor, REST, IoC configuration by code...
... and well, I should be able to put some other buzz words in that title, perhaps agile and Scrum ?

I wanted to test Spring 3 "configuration via code" new feature, and especially how well it works with Scala.

As a Tapestry 5 (former) user, I'm a great fan of IoC configuration done in Java (or Scala). From a developer point of view, it's so much more easy and robust (especially refactoring prone) to have access to a real, type safe language in place of an ersatz like XML... and most of the time, it's also much less verbose.

The application
I needed a pretext and decided to build a trivial web application that allows to upload files to some URL, and post-process them - a rather usual need in a web-application. That will allow to test Spring 3 new "REST" features, a bit of Expression Language, and put in a little Scala Actor to let the (long) processing be done asynchronously.
I also used maven, and Slf4j with NoCommonsLogging to be able to use Slf4j with Spring.

What exactly does the application:
- wait uploads on a REST endpoint URL;
- when an upload comes, save it into a temporary file;
- signal the file's availability to a "file processor". That processing may take a looooooong time to process (for example, it's a big XML report, with a lot of parsing, input validation, graphs generation, etc), and so, the processing should be done in a side process.

Results
Everything comes along really well, and the result is available on github.

To test it, you will need a JVM and Maven (if you haven't done it yet and are not limited by production constrains, just go download the last 1.6 JVM (1.6.0_18), the performances improvements with the last two releases are impressive)

% git clone git://github.com/fanf/scala-spring3-upload.git
% cd scala-spring3-upload
% mvn jetty:run
You should have a Jetty server up and running on localhost.
Now, you can upload a file to http://localhost:8080/upload, and see that the upload is processed and HTTP code returned, and then an asynchronous process is launched to process the file - well, actually it just waits 10 seconds and delete it.
On Linux, you can use Curl to post files:

% curl -F FileToUploadName=@/path/to/the/file/to/upload http://localhost:8080/upload/


Details about the project
Here comes the different files and their purpose:

src/main/webapp/WEB-INF/

It contains usual servlet configuration files, in XML :
- web.xml : standard Java servlet config file, nothing to see here. with a reference to the annotation based context loader and the AppConfig.scala file.

- upload-servlet.xml : Spring servlet config file. It's this one that is Spring default enter point, and it contains an entry point to the Scala file used for bean configuration, and to the prope


I just don't understand why this last file is needed. It's where you feel that JavaConfig was an afterthought in Spring... Couldn't have we a convention in place of that ? Something like "put your master configuration code in that package" ? All in all, it's small pain to have to write that file, but it also bring really little information. 


UPDATE: as Chris Beams shows me, I should have RTFM more carefully. It's now possible (I do believed it wasn't in first RCs), and I updated the sources to have a full ScalaBased configuration.

src/main/scala/org/test/upload

That package contains the code to receive file (UploadEndpoint.scala) and process them (FileProcessor.scala).
As you can see, there is very little code, and most of it is self-explanatory.

src/main/scala/org/test/upload/config

That last package only contains the AppConfig.scala file, the place where Spring IoC configuration is done.
I really like the cleaness of that file, compared to what may have been the equivalent XML one.
The default sleepTime value is especially cool, typically a things hard to do when you only have XML

Conclusion
This little project could be a good starting-point if you want to use Spring 3 with Scala, or Slf4j with Spring.
I'm also rather impressed by how much little code is needed with Spring 3 to configured the REST endpoint.
And building little asynchronous services thanks to actor is just too simple (OK, here it's a toy, but if you want serious business with actor, look at AKKA).

  © Blogger template 'Minimalist G' by Ourblogtemplates.com 2008

Back to TOP