tag:blogger.com,1999:blog-48092002803675887082024-02-22T14:08:55.704+01:00Fanf's blogPersonal stuff. Obviously. Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.comBlogger57125tag:blogger.com,1999:blog-4809200280367588708.post-1979563392596267542016-11-15T03:42:00.000+01:002016-11-25T15:04:31.286+01:00France 2017 - pourquoi je vote à la primaire de la droite et du centre - #notrumpinfrance<h1>
</h1>
<div style="text-align: center;">
<span style="font-size: large;"><b>Allons tous voter à la primaire du centre et de la droite</b></span></div>
<br />
<div style="text-align: justify;">
<blockquote class="tr_bq">
<i>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. </i></blockquote>
</div>
<h2>
Des bulles de confort, silos aveuglants</h2>
<div style="text-align: justify;">
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: <a href="https://fr.wikipedia.org/wiki/Biais_de_confirmation">le biais de confirmation</a>.
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.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Et nous créons ainsi nos propres prisons d’idées, des silos en forme de chambre d’écho.<a href="http://www.numerama.com/tech/207428-bulles-de-filtrage-il-y-a-58-millions-delecteurs-pro-trump-et-je-nen-ai-vu-aucun.html?utm_content=buffer884ce&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer"> Cet article</a> décrit en détail le phénomène.
</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
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.</div>
<div style="text-align: justify;">
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.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>“Comment”</b>, s’exclame-t-on dans le silo PC de 2012, <b>“mais je ne connais PERSONNE qui vote Le Pen - comment peut-il être au second tour?”</b>.</div>
<h2 style="text-align: justify;">
La France n’est pas mieux que l’Angleterre et les USA</h2>
<div style="text-align: justify;">
L’élection de Trump, le <i>“oui”</i> 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.
</div>
<h2 style="text-align: justify;">
Dans mon silo, en 2017…</h2>
<div style="text-align: justify;">
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.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
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.
</div>
<h2 style="text-align: justify;">
Tout pour préserver la civilisation</h2>
<div style="text-align: justify;">
En imaginant que Montesquieu ne soit pas libre en mai prochain, ou ne passe pas le premier tour, je pense qu’<b>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</b>, 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. <b>La stratégie de l’échec</b>, qui vise à démontrer le problème en poussant à l’erreur, <b>ne fonctionne pas</b>
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.”</div>
<div style="text-align: justify;">
Bref.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
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?</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
OK, on est d’accord, vous préféreriez voir Jadot gagner. Mais dans l’hypothèse où ça n’arriverait pas… Qui serait <b>le moins pire</b>
(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.</div>
<h2 style="text-align: justify;">
Pas de plan B pour le second tour n’est pas une option</h2>
<div style="text-align: justify;">
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.</div>
<h2 style="text-align: justify;">
Voter ? Mais pour qui ? Mon framework de décision</h2>
<div style="text-align: justify;">
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:</div>
<b>
</b>
<br />
<ol style="text-align: justify;">
<li><b>préserver la civilisation,</b></li>
<li><b>préserver la possibilité de la République Démocratique,</b></li>
<li><b>préserver la possibilité d’un futur pour les générations à venir.</b></li>
</ol>
<h3 style="text-align: justify;">
[1] Contre l’incitation à la haine entre groupes démographiques</h3>
<div style="text-align: justify;">
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.</div>
<div style="text-align: justify;">
É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.</div>
<div style="text-align: justify;">
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é.</div>
<div style="text-align: justify;">
De civilisation.</div>
<h3 style="text-align: justify;">
[2] Pour la séparation des pouvoirs, contre l’autoritarisme et le “surveillance capitalism”</h3>
<div style="text-align: justify;">
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.</div>
<div style="text-align: justify;">
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 <a href="https://ar.al/notes/the-nature-of-the-self-in-the-digital-age/">“surveillance capitalism”</a>, et nous sommes en train de donner tous les outils au prochain dictateur en herbe pour exercer ses ambitions efficacement.</div>
<div style="text-align: justify;">
Il est de notre devoir d’infléchir cette tendance.</div>
<div style="text-align: justify;">
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.</div>
<h3 style="text-align: justify;">
[3] Pour la préservation de notre écosystème, la Terre</h3>
<div style="text-align: justify;">
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.</div>
<h2 style="text-align: justify;">
La primaire du centre et de la droite</h2>
<div style="text-align: justify;">
Peuple de France, allez voter dimanche 20 et 27 novembre.</div>
<div style="text-align: justify;">
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). </div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>Reste Juppé et NKM.</b> Comme disent mes
enfants, il y a toujours une solution moins pire que les autres.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Votez ! Faites-vous entendre !</div>
Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com2tag:blogger.com,1999:blog-4809200280367588708.post-5026056228649584522015-07-27T01:58:00.001+02:002015-07-27T01:59:11.805+02:00Enlightenment (e19) not starting after closing session - hangs on loadingSeems some time, I have, sometime, a <b>really </b>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.<br />
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).<br />
<br />
So, when it happens, the symptoms are:<br />
<ul>
<li>from the login page (I'm using lightdm, but again, not sure it plays any role), I try to log</li>
<li>the E19 loading screen seems to want to appear, but nothing happen</li>
<li>if I switch on tty 1, <span style="font-family: "Courier New",Courier,monospace;"><b>ps aux | grep enligh</b> <span style="font-family: inherit;">gives </span></span> /usr/bin/enlightenment_start and /usr/bin/enlightenment</li>
<li>I can kill /usr/bin/enlightenment_start but the other need a kill -9</li>
<li>if I try <span style="font-family: "Courier New",Courier,monospace;"><b>env DISPLAY=:0 enlightenment_remote -restart</b></span> , the command hangs</li>
<li><span style="font-family: "Courier New",Courier,monospace;"><b>env DISPLAY=:0 xrandr</b></span> gives strange "current value" for screen 0: my screen is 1600x900, and when the bug happens, I get things like "3520x994" </li>
<ul>
<li>I get the same value on .xsession-errors, first line: <span style="font-family: "Courier New",Courier,monospace;"><b>zone 0x31cdfc0: 0 0 3520x994</b></span></li>
</ul>
</ul>
<br />
And until now, the only solution I had to make it start again was to remove my E19 profile (~/.e) - quite frustrating.<br />
<br />
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.<br />
<br />
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):<br />
<ul>
<li><b><span style="font-size: large;">rm .e/e/config/standard/e_randr.*</span></b></li>
<b><span style="font-size: large;">
</span></b>
<li><b><span style="font-size: large;">rm .e/e/config/default/e_randr.*</span></b></li>
</ul>
<br />
The name "default" or "standard" may vary (for example, I remember that when I used to use BodhiLinux, it was bodhi or something alike). <br />
<br />
<br />
And that's all ! Hope it helps other and my future me when I'll forget how to get out of that situation.<br />
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-34322913317061377372014-08-25T17:19:00.001+02:002014-08-25T17:19:20.890+02:00Upgrading to Ubuntu 14.04: "Error: Timeout was reached", "Segmentation fault (core dumped)" with APT and other stranges errors<br />
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.<br />
<br />
<br />
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.<br />
<br />
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.<br />
<h2>
Symptoms</h2>
<h3>
Segmentation fault (core dumped) with apt-get and python3 related scripts</h3>
<br />This appears especially when trying to install/install -f "update-notifier-common" software, for example (sorry for the French):<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">% sudo apt-get install -f<br />Lecture des listes de paquets... Fait<br />Construction de l'arbre des dépendances <br />Lecture des informations d'état... Fait<br />0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.<br />1 partiellement installés ou enlevés.<br />Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.<br />Paramétrage de update-notifier-common (0.154.1) ...<br />Segmentation fault (core dumped)<br />dpkg: error processing package update-notifier-common (--configure):<br /> le sous-processus script post-installation installé a retourné une erreur de sortie d'état 139<br />Des erreurs ont été rencontrées pendant l'exécution :<br /> update-notifier-common<br />Error: Timeout was reached<br />E: Sub-process /usr/bin/dpkg returned an error code (1)</span><br />
<br />
<br />
The other aspect of that problem was that any Python3 related errors lead to a stack trace like that:<br />
<span style="font-family: "Courier New",Courier,monospace;"><br /></span>
<span style="font-family: "Courier New",Courier,monospace;">% python3<br />Python 3.4.0 (default, Apr 11 2014, 13:05:11) <br />[GCC 4.8.2] on linux<br />Type "help", "copyright", "credits" or "license" for more information.<br />>>> foo <br />Traceback (most recent call last):<br /> File "<stdin>", line 1, in <module><br />NameError: name 'foo' is not defined<br />Error in sys.excepthook:<br />Traceback (most recent call last):<br /> File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook<br /> from apport.fileutils import likely_packaged, get_recent_crashes<br /> File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module><br /> from apport.report import Report<br /> File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module><br /> import apport.fileutils<br /> File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module><br /> from apport.packaging_impl import impl as packaging<br /> File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 20, in <module><br /> import apt<br /> File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module><br /> import apt_pkg<br />ImportError: /usr/lib/python3/dist-packages/apt_pkg.cpython-34m-x86_64-linux-gnu.so: undefined symbol: _ZN13pkgTagSectionC1Ev<br /><br />Original exception was:<br />Traceback (most recent call last):<br /> File "<stdin>", line 1, in <module><br />NameError: name 'foo' is not defined</module></stdin></module></module></module></module></module></module></stdin></span><br />
<br />
<br />
<h3>
Error: Timeout was reached</h3>
The second main symptom was that when using apt-* tools, I was getting an error message <b>"Error: Timeout was reached"</b> just at the end of the process. Nonetheless, everything seemed to be correctly installed/removed/etc. <br />
<br />
<br />
<h2>
Bug tracking, short version</h2>
<br />
That led me to some bug about a timeout to short for packagekit:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">/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 <b>--timeout 4</b> --method org.freedesktop.PackageKit.StateHasChanged cache-update</span><br /><br />
So I tested with a really big number, and got:<br />
<span style="font-family: "Courier New",Courier,monospace;"><br /></span>
<span style="font-family: "Courier New",Courier,monospace;">/usr/bin/gdbus call --system --dest org.freedesktop.PackageKit --object-path /org/freedesktop/PackageKit --timeout 300 --method org.freedesktop.PackageKit.StateHasChanged cache-update<br /><br />Error: GDBus.Error:org.freedesktop.DBus.Error.TimedOut: Activation of org.freedesktop.PackageKit timed out</span><br />
<br />
What lead to testing packagkit itself:<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">% sudo /usr/lib/packagekit/packagekitd --verbose<br />11:12:57 PackageKit Verbose debugging enabled (on console 1)<br />11:12:57 PackageKit keep_environment: 0<br />11:12:57 PackageKit using config file '/etc/PackageKit/PackageKit.conf'<br />11:12:57 PackageKit syslog fucntionality disabled<br />11:12:57 PackageKit Log all transactions: 1<br />11:12:57 PackageKit daemon shutdown set to 300 seconds<br />11:12:57 PackageKit clearing download cache at /var/cache/PackageKit/downloads<br />11:12:57 PackageKit destination eth0 is valid<br />11:12:57 PackageKit setting config file watch on /etc/PackageKit/PackageKit.conf<br />11:12:57 PackageKit ProxyHTTP read error: Key file does not have key 'ProxyHTTP'<br />11:12:57 PackageKit searching for plugins in /usr/lib/x86_64-linux-gnu/packagekit-plugins<br />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<br />11:12:57 PackageKit opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-clear-firmware-requests.so: Clears firmware requests<br />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<br />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<br />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<br />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<br />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<br />11:12:57 PackageKit opened plugin /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin_scripts.so: Runs external scrips<br />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<br />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<br />11:12:57 PackageKit finished pk_plugin_initialize<br />11:12:57 PackageKit run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-scan-desktop-files.so<br />11:12:57 PackageKit finished pk_plugin_initialize<br />11:12:57 PackageKit run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-check-processes.so<br />11:12:57 PackageKit finished pk_plugin_initialize<br />11:12:57 PackageKit run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-no-update-process.so<br />11:12:57 PackageKit finished pk_plugin_initialize<br />11:12:57 PackageKit run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-package-cache.so<br />11:12:57 PackageKit finished pk_plugin_initialize<br />11:12:57 PackageKit run pk_plugin_initialize on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-require-restart.so<br />11:12:57 PackageKit finished pk_plugin_initialize<br />11:12:57 PackageKit Trying to load : aptcc<br /><b>11:12:57 PackageKit dlopening '/usr/lib/x86_64-linux-gnu/packagekit-backend/libpk_backend_aptcc.so'<br />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</b><br />11:12:57 PackageKit finished pk_plugin_destroy<br />11:12:57 PackageKit run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-scan-desktop-files.so<br />11:12:57 PackageKit finished pk_plugin_destroy<br />11:12:57 PackageKit run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-check-processes.so<br />11:12:57 PackageKit finished pk_plugin_destroy<br />11:12:57 PackageKit run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-no-update-process.so<br />11:12:57 PackageKit finished pk_plugin_destroy<br />11:12:57 PackageKit run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-update-package-cache.so<br />11:12:57 PackageKit finished pk_plugin_destroy<br />11:12:57 PackageKit run pk_plugin_destroy on /usr/lib/x86_64-linux-gnu/packagekit-plugins/libpk_plugin-require-restart.so<br />11:12:57 PackageKit finished pk_plugin_destroy<br />11:12:57 PackageKit already closed (nonfatal)<br />11:12:57 PackageKit parent_class->finalize</span><br /><br />
HooooOOoo... What about Aptitude ?<br />
<br />
<br /><span style="font-family: "Courier New",Courier,monospace;">% aptitude<br />aptitude: symbol lookup error: aptitude: undefined symbol: _ZN3APT11CacheFilter39PackageArchitectureMatchesSpecificationC1ERKSsb</span><br />
<br />
<br />
<h2>
Solution </h2>
The problem was that somehow, I get a bad version of <b>libapt-pkg4.12</b>. So anything related to apt in some way had a chance to end badly.<br />
<br />
Reinstalling the correct version of them (the one provided with my distribution) corrected all the problems:<br />
<br />
<b>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</b><br />
<br />
<br />
Hope it helps !<br />
<br />
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-64234192190388075262014-04-01T14:43:00.005+02:002014-04-01T15:02:50.277+02:00Where 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: <a href="http://www.normation.com/">http://www.normation.com/</a> ) and of course Rudder (<a href="http://www.rudder-project.org/">http://www.rudder-project.org/</a>).<br />
<br />
I'm still doing a ton of Scala, and you can find some articles on our company blog (<a href="http://blog.normation.com/">http://blog.normation.com/</a>) or slides about presentation I gave, like the one on Scala + ZeroMQ for Scala.IO 2013. It's on slideshoare: <a href="http://fr.slideshare.net/normation/">http://fr.slideshare.net/normation/</a><br />
<br />
And of course, there is my Github page: <a href="https://github.com/fanf/">https://github.com/fanf/</a> or twitter: <a href="https://twitter.com/fanf42">https://twitter.com/fanf42</a><br />
<br />
Hope to see you on these other media!Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-31921455274982086442011-11-17T17:45:00.000+01:002011-11-17T17:45:00.985+01:00Make firefox remember "autocomplete=off" password fieldsSome 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...).<br />
<br />
If, like me, you are finding that behaviour as irrespectuous of your browsing experience as, say pop-ups, there is a trick:<br />
<br />
<ul>
<li>install <a href="https://addons.mozilla.org/fr/firefox/addon/firebug/">Firebug </a></li>
<li>on the page with the faulty password field, open Firebug.</li>
<li>use the blue mouse pointer in Firebug toolbar to select the password field</li>
<li>on the Firebug HTML tab, you should have a <<span class="nodeLabelBox repTarget " role="treeitem"><span class="nodeTag ">input</span><span class="nodeAttr editGroup "> </span><span class="nodeAttr editGroup "> <span class="nodeName editable ">type</span>="<span class="nodeValue editable ">password</span>"</span><span class="nodeAttr editGroup "> </span><span class="nodeAttr editGroup "><span class="nodeName editable ">autocomplete</span>="<span class="nodeValue editable ">off</span>"</span><span class="nodeAttr editGroup "></span>....> field selected</span></li>
<li><span class="nodeLabelBox repTarget " role="treeitem">double-click on "off" to edit the value and change it to "on". </span></li>
<li><span class="nodeLabelBox repTarget " role="treeitem">Now, enter you login/password as usual in the page form</span></li>
<li><span class="nodeLabelBox repTarget " role="treeitem">when you hit "submit", Firefox should display the notification pop-up that allows to remember the login/password for that site. </span></li>
</ul>
<span class="nodeLabelBox repTarget " role="treeitem"> Now, each time you are going to go on that page, firefox will autocomplete the login/password as usual. </span><br />
<span class="nodeLabelBox repTarget " role="treeitem"><br /></span><br />
<span class="nodeLabelBox repTarget " role="treeitem"><br />Hop it will help other !</span>Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com2tag:blogger.com,1999:blog-4809200280367588708.post-70825459214203322552011-02-06T00:37:00.000+01:002011-02-06T00:37:35.078+01:00Installing ZeroMQ and Java bindings on Ubunu 10.10For some times now, I'm following the slow evolution of <a href="http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol">AMQP</a> 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: <a href="http://www.zeromq.org/">ZeroMQ</a> 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.<br />
<br />
So the first part was to install ZeroMQ and its <a href="http://www.zeromq.org/bindings:java">Java binding</a> 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 :)<br />
<br />
<span style="font-size: large;">Step 1: install recent ZeroMQ libraries</span><br />
<br />
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 <a href="https://launchpad.net/%7Echris-lea/+archive/zeromq">PPA repository</a> for them:<br />
<br />
<pre>% sudo add-apt-repository ppa:chris-lea/zeromq</pre>
<pre>% sudo aptitude install libzmq-dev</pre>
<br />
That should install libzmq-dev (header files needed for the Java bindings) and the libzmq0 package - the core messaging system itself.<br />
<br />
<span style="font-size: large;">Step 2: get ZeroMQ binding</span><br />
<br />
For that, you will have to clone <a href="https://github.com/zeromq/jzmq/">the github repository</a> of the project<br />
<br />
<pre>% git clone https://github.com/zeromq/jzmq.git</pre>
<br />
And with that, you have a new jzmq directory with everything needed to build the Java bindings.<br />
<br />
<span style="font-size: large;">Step 3: build and install jzmq package</span><br />
<br />
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.<br />
In the former jzmq directory, just do:<br />
<br />
<pre>% ./autogen.sh</pre>
<pre>% dpkg-buildpackage -rfakeroot</pre>
<br />
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:<br />
<br />
<pre>% dpkg -i jzmq_[some-version]_i386.deb</pre>
<br />
And now, you can use ZQM from you Java code.<br />
<br />
<span style="font-size: large;">Some last notes</span><br />
<br />
* don't forget to add the JNI library path in you JVM command line: use <b>-Djava.library.path=/usr/lib</b><br />
(/usr/lib should contains libjzmq.so, you can see it with <b>dpkg -L jzmq</b>)<br />
If you the JAVA_HOME environment variable was correctly set when you buit the package,you may not have to add that parameter.
<br />
* libjzmq.jar is in <b>/usr/share/java/</b><br />* you will find some Java examples <a href="https://github.com/imatix/zguide/tree/master/examples/Java">here</a>.<br />
<br />
That's it! Enjoy a world of easy message distribution.Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com2tag:blogger.com,1999:blog-4809200280367588708.post-74682602638631862762011-01-31T10:45:00.000+01:002011-01-31T10:45:11.411+01:00Martin 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 <a href="http://scala-lang.org/">Scala</a>, fera une présentation au <a href="https://groups.google.com/group/paris-scala-user-group/about?hl=en&noredirect=true">Paris Scala User Group</a>, ce lundi 31 janvier. Plus de détails sont disponibles <a href="http://blog.xebia.fr/2011/01/21/martin-odersky-invite-du-psug/">ici</a> et <a href="https://groups.google.com/d/topic/paris-scala-user-group/ws2ozp-MTjU/discussion">ici</a>.<br />
<br />
J'en profite pour relayer l'information du <a href="http://www.scala-lang.org/node/8579">financement à hauteur de 2.3 Million d'Euros sur 5 ans de Scala par l'Europe</a>, ce qui devrait permettre de lever les dernières incertitudes quant à la pérénité du langage.<br />
<br />
<br />
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-26207277335870154712010-11-09T20:19:00.000+01:002010-11-09T20:19:59.337+01:00Scala 2.8.1 is out!After a far shorter development cycle than for 2.8.0, <a href="http://www.scala-lang.org/node/8102">Scala 2.8.1</a> reach us today.<br />
<br />
More than 100 bugs were corrected, some of them really old (<a href="http://lampsvn.epfl.ch/trac/scala/ticket/36">#36</a> !).<br />
<br />
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 <a href="http://scalasolutions.com/">Scala Solution</a> company, it seems to be really good insights toward Scala industrialization in the coming years.<br />
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-67914702094672987762010-07-27T17:03:00.000+02:002010-07-27T17:03:41.916+02:00Set-up Eclipse workspace in RAMI 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 <a href="http://blog.normation.com/2010/05/24/optimizing-eclipse-performances/">"Eclipse perfomance optimisation article</a>", and now it's here: <a href="http://blog.normation.com/2010/07/27/set-up-eclipse-workspace-in-ram/">http://blog.normation.com/2010/07/27/set-up-eclipse-workspace-in-ram/</a><br />
<br />
And like last time, any information about Eclipse optimization is much appreciated !Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-22693056273680586592010-07-18T19:49:00.000+02:002010-07-18T19:49:07.957+02:00Java LDAP SDK for SyncRepl replication showcase<span style="font-size: large;"><span style="font-size: small;">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: </span></span><br />
<span style="font-size: large;"><span style="font-size: small;"><br /></span></span><br />
<span style="font-size: large;"><span style="font-size: small;"><a href="http://blog.normation.com/2010/07/18/java-ldap-sdk-for-syncrepl-replication-showcase/">http://blog.normation.com/2010/07/18/java-ldap-sdk-for-syncrepl-replication-showcase/</a></span></span><br />
<br />
<span style="font-size: large;"><span style="font-size: small;">SyncRepl is a replication protocol for LDAP, normalized in RFC 4533. </span></span><br />
<br />
<span style="font-size: large;"><span style="font-size: small;">The demonstration is done with a showcase web application that display in real time modification done in an LDAP server. </span></span><br />
<span style="font-size: large;"><span style="font-size: small;">The application, named Syweno, was
developed in Scala, thanks to Liftweb and it's amazing Comet. It looks like:</span></span> <br />
<br /><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVZ6l6sZCb2oiT_pDKXEU0FqLlov9KVArRZY-ZYJwHIskR5fHM8amqZ3WxcIIr_hCHB3rKWVak4hCJjHMhwPeUiAkSVCSWCHJ9vL0PKWAcJCuBb-HIRoBu8-TZLzwwD3rdaxGkFe9O3d20/s1600/syweno-main.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="435" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVZ6l6sZCb2oiT_pDKXEU0FqLlov9KVArRZY-ZYJwHIskR5fHM8amqZ3WxcIIr_hCHB3rKWVak4hCJjHMhwPeUiAkSVCSWCHJ9vL0PKWAcJCuBb-HIRoBu8-TZLzwwD3rdaxGkFe9O3d20/s640/syweno-main.png" width="640" /></a></div>
<br />
<br />
<span style="font-size: large;"><span style="font-size: small;">Of course, update are synchronized
thank to SyncRepl, and are propagated to the web page in real time
thanks to Comet updates. </span></span><br />
<br />
The code source is available on github here: <a href="http://github.com/fanf/syweno">http://github.com/fanf/syweno</a><br />
<br />
Enjoy !<br />
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-35947807828010515972010-07-14T21:07:00.000+02:002010-07-14T21:07:18.664+02:00Scala 2.8.0 is outThe most awaited Scala version of all time (ok, it's easy for now...) is out, at last !<br />
<br />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 !<br />
<br />
The official link: <br />
<a href="http://www.scala-lang.org/node/7009">http://www.scala-lang.org/node/7009</a><br />
<br />
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-31263281472161744692010-07-01T18:23:00.000+02:002010-07-01T18:23:23.524+02:00Scala dreaded underscore @ PSUG(orignal content from <a href="http://blog.normation.com/2010/07/01/scala-dreaded-underscore-psug/">http://blog.normation.com/2010/07/01/scala-dreaded-underscore-psug</a> )<br />
<br />
On the evening of June 30th 2010, the <a href="http://groups.google.com/group/paris-scala-user-group">Paris Scala User Group</a> organized its second event.<br />
This time, there were two presentations:<br />
<ul>
<li>in the first one, Alexis Agahi, our kind user group leader, made a feedback after one year of scala experience. It’s <a href="http://tinyurl.com/3xckpyf">available here</a>.</li>
<li>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.<br />
It’s <a href="http://www.slideshare.net/normation/scala-dreaded">available here</a>.</li>
</ul>
See you next time on PSUG!Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-84476290025424520952010-05-24T13:24:00.000+02:002010-05-24T13:24:10.723+02:00Optimizing Eclipse performancesI just published an article about Eclipse perfomance optimisation, especially with the Scala IDE plugin, here : <a href="http://blog.normation.com/2010/05/24/optimizing-eclipse-performances/">http://blog.normation.com/2010/05/24/optimizing-eclipse-performances/</a><br />
<br />
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.<br />
<br />
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...).<br />
<br />
Of course, any information about Eclipse optimization is much appreciated !Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-55382870552950356452010-05-18T16:24:00.002+02:002010-05-18T16:36:04.144+02:00Maven2 bootstrap pom.xml for Scala with SLF4J and no-commons-loggingFollowing an <a href="http://fanf42.blogspot.com/2009/11/maven2-bootstrap-pomxml-for-slf4j-and.html">older post</a>, this is the pom I use as a starting point for Scala project which uses maven.<br />
<pre class="sh_xml">
<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>
</pre>
<br />
<br />
<br />
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-61935875285664970962010-04-19T16:17:00.001+02:002010-04-20T15:15:47.644+02:00Summary of my Scala Days 2010<span style="font-size: x-large;">A great reception...</span><br />
<br />
<div style="margin-bottom: 0cm;">
I had the immense luck to go to the
First <a href="http://days2010.scala-lang.org/">ScalaDays</a> event organized by EPFL in Lausanne on 15/16 of April 2010.</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
</div>
<div style="margin-bottom: 0cm;">
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. </div>
<div style="margin-bottom: 0cm;">
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. </div>
<div style="margin-bottom: 0cm;">
<br />
<span style="font-size: x-large;">... with great talks ...</span><br />
<br /></div>
<div style="margin-bottom: 0cm;">
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.<br />
<br />
<a href="http://akkasource.org/"> Akka</a> 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 <a href="http://en.wikipedia.org/wiki/Open_Telecom_Platform_%28OTP%29">Erlang OTP</a>, 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. </div>
<div style="margin-bottom: 0cm;">
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.
</div>
<div style="margin-bottom: 0cm;">
<br />
<span style="font-size: x-large;">... and a bright future in sight for Scala</span><br />
<br />
<div style="margin-bottom: 0cm;">
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 !).
<br />
<div style="margin-bottom: 0cm;">
But I believe that it was more than just that. Today, I'm pretty confident that Scala is here to stay and growth.<br />
<br />
The most "symptomatic" announcement of that evolution of the language organization from the research sphere to a broader audience is the <a href="http://twitter.com/#search?q=%23scaladays%20foundation">announcement that a Scala Foundation will be created</a> to manage it. </div>
</div>
<br /></div>
<div style="margin-bottom: 0cm;">
<br />
So, that was a really wonderful event, and long life to Scala ! <br />
<br /></div>
<div style="margin-bottom: 0cm;">
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 :)</div>
<div style="margin-bottom: 0cm;">
<br />
<br />
<span style="font-size: x-large;">Presentations seen</span><br />
<br /></div>
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.<br />
<div style="margin-bottom: 0cm;">
<br />
<b>April, 15</b><br />
<br />
<b><span style="font-size: small;">15 morning - opening talk</span></b></div>
<div style="margin-bottom: 0cm;">
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. <br />
<br />
<br />
<b>15, morning</b><br />
<br />
<br />
<div style="margin-bottom: 0cm;">
<b>PEGEX by Kota Mizushima</b></div>
<div style="margin-bottom: 0cm;">
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.<br />
<br />
<b>Scala Parallel collections by
Aleksander Prokopec</b><br />
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.<br />
<div style="margin-bottom: 0cm;">
<br />
<br />
<div style="margin-bottom: 0cm;">
<b>Developing the Scala bindings to
the Fly Object Space by Channing Walton, Nigel Warren, Simon Kent</b></div>
<div style="margin-bottom: 0cm;">
I miss a part of the beginning, but for what I saw, Fly Object Space seems to be a powerful framework for
distributed computing.
</div>
</div>
<br /></div>
</div>
<div style="margin-bottom: 0cm;">
<br />
<b>15, afternoon, part 1</b></div>
<div style="margin-bottom: 0cm;">
<br />
<div style="margin-bottom: 0cm;">
<b>CCSTM: A library based STM for
Scala by Nathan Bronson, Hasaan Chafi, Kunle Olukotun</b></div>
<div style="margin-bottom: 0cm;">
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.</div>
<br />
<div style="margin-bottom: 0cm;">
<b>Lightweight language support for
type-based, concurrent event processing by Phillip Hadler</b></div>
</div>
<div style="margin-bottom: 0cm;">
Really nice technical presentation about how type information can leads to massive performance optimization in pattern matching. <br />
<br />
<div style="margin-bottom: 0cm;">
<b>Named and default argument in
Scala by Luka Rytz</b></div>
<div style="margin-bottom: 0cm;">
To me, this feature is one of the best of
Scala 2.8. It was nice to see how the implementation was done.
</div>
<br />
<br />
<b>15, afternoon, part 2</b><br />
<br />
<div style="margin-bottom: 0cm;">
<b>Specialization in Scala by Iulian
Dragos</b></div>
<div style="margin-bottom: 0cm;">
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.
</div>
<br />
<div style="margin-bottom: 0cm;">
<b>Leaky Monads – an experiment
with automatic resources management by Josh Suereth</b></div>
<div style="margin-bottom: 0cm;">
Or how to cleanly manage resources in Scala with a little bit of monad, but only when we need them.<br />
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.<br />
<br />
<div style="margin-bottom: 0cm;">
<b>Type-safe SQL embedded in Scala by
Christoph Wulfz</b></div>
<div style="margin-bottom: 0cm;">
Cool stuff to make SQL a first class
citizen in Scala, as XML is.<br />
<br />
<b>April, 16 </b></div>
</div>
<br />
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 :)<br />
<br /></div>
<div style="margin-bottom: 0cm;">
<b>16, morning keynotes</b></div>
<div style="margin-bottom: 0cm;">
<br />
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.
</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<b>16, morning</b></div>
<div style="margin-bottom: 0cm;">
<br />
<b>Scala @ Linkedin : distributed
computed with Norbert by Chris Conrad</b><br />
<div style="margin-bottom: 0cm;">
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 ;).<br />
<br />
<div style="margin-bottom: 0cm;">
<b>Akka: Simpler scalabitity,
fault-tolerance, concurrency & remoting throught actors by Jonas
Boner, Victor Klang</b></div>
<div style="margin-bottom: 0cm;">
As I already said, Akka is more and
more looking like the killer app on Scala. Kudo to Jonas ans Akka
team.
</div>
<br />
<div style="margin-bottom: 0cm;">
<b>Scala IDE for Eclipse : retrospect
and prospect for 2.8 by Miles Sabin</b></div>
<div style="margin-bottom: 0cm;">
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.
</div>
<br /></div>
</div>
<div style="margin-bottom: 0cm;">
<b>16, afternoon, part 1
</b><br />
<br />
<div style="margin-bottom: 0cm;">
<b>sbt: design and implementation by
Mark Harrah
</b></div>
<div style="margin-bottom: 0cm;">
SBT, the build system that will save
all of us from Maven – thanks Mark, and congrats for the work</div>
</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0cm;">
<b>Scala Modules: a Scala DSL to ease
OSGi development by Heiko Seeberger</b></div>
<div style="margin-bottom: 0cm;">
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)</div>
</div>
<div style="margin-bottom: 0cm;">
<br /></div>
<div style="margin-bottom: 0cm;">
<div style="margin-bottom: 0cm;">
<b>Sneaking Scala into your
organization by David Copeland</b></div>
<div style="margin-bottom: 0cm;">
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 :)</div>
<br />
<b>16, afternoon, part 2</b><br />
<br />
<b>
</b><br />
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 !<br />
<br />
And that's all, until next year (in U.S ?) !<br />
<div style="margin-bottom: 0cm;">
<br /></div>
</div>Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com2tag:blogger.com,1999:blog-4809200280367588708.post-23196595876590901452010-04-14T14:47:00.000+02:002010-04-14T14:47:29.840+02:00Scala Days tomorrow !In a few hours, I'm going to take the TGV for Lausanne, to attend first <a href="http://days2010.scala-lang.org/">Scala Days</a> !<br />
<br />
There seems to be a lots of really <a href="http://days2010.scala-lang.org/program">good conferences</a>, and it will be the opportunity to finally met a lot of irc/mailing list names !<br />
<br />
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com1tag:blogger.com,1999:blog-4809200280367588708.post-51168042991029126522010-04-10T19:15:00.000+02:002010-04-10T19:15:34.803+02:00Embed OpenDS in your applicationI just created a github project that shows what one has to do to configure and start <a href="https://www.opends.org/">OpenDS</a> LDAP directory from a Java application, for example to run unit tests. <br />
<br />
Most of the code is a direct transcription of information found on OpenDS wiki[1].<br />
<br />
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.<br />
<br />
The source code is here: <a href="http://github.com/fanf/opends-simple-config">http://github.com/fanf/opends-simple-config</a><br />
<br />
Feel free to remove even more unused configuration, or propose things to make OpenDS start time even faster.<br />
<br />
Enjoy !<br />
<br />
<br />[1] <a href="https://www.opends.org/wiki/page/CreatingAnOpenDSInstanceForEmbeddedUse">https://www.opends.org/wiki/page/CreatingAnOpenDSInstanceForEmbeddedUse</a><br />
<a href="https://www.opends.org/wiki/page/ControllingOpenDSFromAnotherApplication">https://www.opends.org/wiki/page/ControllingOpenDSFromAnotherApplication</a>Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com3tag:blogger.com,1999:blog-4809200280367588708.post-60802054034357494432010-03-17T23:43:00.000+01:002010-03-17T23:43:48.327+01:00Scala Unix file permissions DSLScala 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<br />
<br />
Only user", "group" and "other" permission are managed - so no setuid, setgid or sticky bit.
<br />
<h3>Perm objects</h3>
They are simple immutable permission objects with a nice toString and an octal representation:
<pre class="sh_scala">
scala> val p:Perm = wx
scala> w.toString // "-wx"
scala> w.octal // 3
</pre>
You can combine permission to obtain new permissions:
<pre class="sh_scala">
scala> w+r // rw-
scala> rwx-w // r-w
</pre>
<h3>FilePerms objects</h3>
They keep a group of three mutable permissions.
You can create a new File permission object from octal values:
<pre class="sh_scala">
scala> val perms = FilePerms(777)
</pre>
<br />
Or from Perm object:
<pre class="sh_scala">
scala> val perms = FilePerms(rw,rw,r)
</pre>
Like Perm, they have nice string and octal representation:
<pre class="sh_scala">
scala> val perms = FilePerms(777)
scala> perms.toString //rwxrwxrwx
scala> perms.octal // 777
</pre>
<br />
Missing values are initialized to "no permission":
<pre class="sh_scala">
scala> val perms = FilePerms(77) //rwxrwx---
scala> val perms = FilePerms(rw) //rw-------
</pre>
<br />
And of course, you can change permissions:
<pre class="sh_scala">
scala> val perms = FilePerms(77) //rwxrwx---
scala> perms.g-wx // rwxr----
scala> perms.ugo+x // rwxr-x--x
scala> perms.a-wx // r--r-----
</pre>
The binding of theses objects with Java IO with the goal to actually set file permissions is let as an exercise for the reader ;)
<br />
It's available on gist here: <a href="http://gist.github.com/335791">http://gist.github.com/335791</a>. 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:
<pre class="sh_scala">
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--)
</pre>
<br />
Enjoy !
<br/><br/>
<br/>
PS: if you have an idea about how to mimic chown, I would appreciate. For now, all I get is:
<pre>
chmod( ug(_)+rw, filePerms)
</pre>
Not really nice.Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com2tag:blogger.com,1999:blog-4809200280367588708.post-30567148871090820032010-01-27T17:48:00.002+01:002010-01-27T17:51:06.797+01:00Scala 2.8 Beta 1 is out !Today, the first official "Scala 2.8 Beta" was released. It was awaited, and for really good reasons !<br />
Just look at the announcement summary to see all the goodness available: <a href="http://www.scala-lang.org/node/4587">http://www.scala-lang.org/node/4587</a><a href="http://old.nabble.com/-scala--Scala-2.8.0-Beta-1-td27339970.html"></a><br />
<br />
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 :)<br />
<br />
Downloads are available here:<a href="http://www.scala-lang.org/downloads"> http://www.scala-lang.org/downloads</a><br />
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com0tag:blogger.com,1999:blog-4809200280367588708.post-54420200616510532302010-01-20T09:36:00.005+01:002010-01-20T14:57:53.272+01:00Scala and Spring 3 JavaConfig<span style="font-size: x-large;">Scala, Spring 3, Actor, REST, IoC configuration by code...</span><br />
<span style="font-size: small;">... and well, I should be able to put some other buzz words in that title, perhaps agile and Scrum ?</span><br />
<br />
I wanted to test <a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/">Spring 3</a> <a href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/new-in-3.html#new-java-configuration">"configuration via code"</a> new feature, and especially how well it works with Scala.<br />
<br />
As a <a href="http://tapestry.apache.org/tapestry5.1/tapestry-ioc/">Tapestry 5</a> (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.<br />
<br />
<span style="font-size: large;">The application</span><br />
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.<br />
I also used maven, and Slf4j with NoCommonsLogging to be able to use Slf4j with Spring. <br />
<br />
What exactly does the application:<br />
- wait uploads on a REST endpoint URL;<br />
- when an upload comes, save it into a temporary file;<br />
- 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.<br />
<br />
<span style="font-size: large;">Results</span><br />
Everything comes along really well, and the result is available on <a href="http://github.com/fanf/scala-spring3-upload/fast_forward">github</a>.<br />
<br />
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)<br />
<pre style="font-family: "Courier New",Courier,monospace;">% git clone git://github.com/fanf/scala-spring3-upload.git</pre>
<pre style="font-family: "Courier New",Courier,monospace;">% cd scala-spring3-upload</pre>
<pre><span style="font-family: "Courier New",Courier,monospace;">% mvn jetty:run</span>
</pre>
You should have a Jetty server up and running on localhost.<br />
Now, you can upload a file to <b>http://localhost:8080/upload</b>, 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.<br />
On Linux, you can use Curl to post files:<br />
<span style="font-family: "Courier New",Courier,monospace;"></span><br />
<pre><span style="font-family: "Courier New",Courier,monospace;">% curl -F FileToUploadName=@/path/to/the/file/to/upload http://localhost:8080/upload/</span></pre>
<span style="font-family: "Courier New",Courier,monospace;"></span><br />
<br />
<span style="font-size: large;">Details about the project</span><br />
Here comes the different files and their purpose:<br />
<br />
<b>src/main/webapp/WEB-INF/</b><br />
<br />
It contains usual servlet configuration files, in XML :<br />
- <span style="font-family: "Courier New",Courier,monospace;">web.xml</span> : standard Java servlet config file<strike>, nothing to see here.</strike> with a reference to the annotation based context loader and the AppConfig.scala file.<strike><br /></strike><br />
<strike>- <span style="font-family: "Courier New",Courier,monospace;">upload-servlet.xml</span><i> </i>: 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</strike><br />
<strike><br /></strike><br />
<strike>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. <br /></strike><br />
<br />
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. <br />
<br />
<b>src/main/scala/org/test/upload</b> <br />
<br />
That package contains the code to receive file (<span style="font-family: "Courier New",Courier,monospace;">UploadEndpoint.scala</span>) and process them (<span style="font-family: "Courier New",Courier,monospace;">FileProcessor.scala</span>).<br />
As you can see, there is very little code, and most of it is self-explanatory. <br />
<br />
<b>src/main/scala/</b><b>org/test/upload/config</b><br />
<br />
That last package only contains the <span style="font-family: "Courier New",Courier,monospace;">AppConfig.scala</span> file, the place where Spring IoC configuration is done.<br />
I really like the cleaness of that file, compared to what may have been the equivalent XML one.<br />
The default sleepTime value is especially cool, typically a things hard to do when you only have XML<br />
<br />
<span style="font-size: large;">Conclusion</span><br />
This little project could be a good starting-point if you want to use Spring 3 with Scala, or Slf4j with Spring.<br />
I'm also rather impressed by how much little code is needed with Spring 3 to configured the REST endpoint.<br />
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 <a href="http://akkasource.org/">AKKA</a>). <br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com6tag:blogger.com,1999:blog-4809200280367588708.post-21642381045923538442010-01-09T18:43:00.000+01:002010-01-09T18:43:52.901+01:00Happy new year 2010For me, year 2010 will be a big switch in my life... hopefully for the best !<br />
So, I wish you all the best things for this last year of the first third millennium's decade !<br />
<br />
Happy new year !<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com1tag:blogger.com,1999:blog-4809200280367588708.post-5043528216412027072009-11-12T11:41:00.001+01:002009-11-12T11:43:10.979+01:00Bootstrap GWT2 with maven, UiBinder and i18nI'm setting up a boostrap project for GWT 2 witch would use maven 2, UiBinder and i18n.<br />
The idea is to centralize resources about UiBinder and test GWT 2, the result being used as a template project for real GWT 2 projects.<br />
<br />
I'm quite new to GWT (2 days old...), so it is also a learning project. If it could be of any use for you, don't hesitate to use it - or enhance it, or make comments :)<br />
<br />
For now, it's based on GWT 2.0.0-ms2, and some configuration may be specific to my environment (Linux&Firefox 3.5).<br />
<br />
It's available here: <a href="http://github.com/fanf/gwt2-mvn-bootstrap">http://github.com/fanf/gwt2-mvn-bootstrap</a><br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com1tag:blogger.com,1999:blog-4809200280367588708.post-45549369959348346082009-11-10T14:44:00.003+01:002009-11-10T14:51:32.335+01:00Maven2 bootstrap pom.xml for SLF4J and no-commons-loggingEach time I start a new Java project with Maven 2, I need to write the same dependencies again and again: SLF4J and no commons-logging because it's evil (and SpringFramework seems to want to keep it), Joda Time by default, some properties, etc. <br />
<br />
So, that's the template pom.xml I use for the bootstrap, if it may help anybody here (it uses logback for logging, as it's more efficient than Log4j with SLF4J, but feel free to use what you want):<br />
<br/>
<pre class="sh_xml">
<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>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<properties>
<!-- UTF-8 for everyone -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j-version>1.5.8</slf4j-version>
<logback-version>0.9.17</logback-version>
</properties>
<description>Template for project without Commons-logging</description>
<repositories>
<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>
</pluginRepositories>
<build>
<plugins>
</plugins>
</build>
<dependencies>
<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. Never.
And framework we depend on won't bring commons-loggin nether (I'm looking at
you, stringframework).
-->
<!-- 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>
<!-- slf4j commons-logging replacement -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j-version}</version>
</dependency>
<!-- 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>
</pre>Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com2tag:blogger.com,1999:blog-4809200280367588708.post-33818059055290375132009-10-24T18:32:00.000+02:002009-10-24T18:32:40.871+02:00Clone objects with arguments override in Scala 2.8: best practices ?I'm actively looking for best practices and patterns about how to create clone objects in Scala, with the possibility to change some values of the cloned object along the way.<br />
<br />
I have the usual concern of the Java world on that topic: I would like to avoid Java "clone", I want to be able to use the pattern in a class hierarchy, I want to have the minimum amount of code (or at least, the simplest possible) to write in domain class to support my cloning API.<br />
And as I'm in Scala, I want to deal with both vars and vals, if possible in the same consistent way.<br />
<br />
Actually, I want to provide to my libraries consumer an effective way to do things like that (where *Child* extends *Parent* class):<br />
<br />
<br />
<br />
<pre class="sh_scala"> val p = new Parent("some value")
// simple cloning
val p2 = p.copy
//clone, and change a val and a var along the way
val p3 = p.copy(p_val1 = "new value for val", p_var1 = "new value for var")
//and same things apply for children of Parent:
val c = new Child("some parent value", "some child value")
//override child val/var and/or parent val/var in the same fashion
val c1 = c.copy(p_val1 = "new value for val defined in Parent class",
c_val1 = "new value for val defined in Child class",
p_var1 = "new value for var defined in Parent class",
c_var1 = "new value for var defined in Child class" )
</pre>
<br />
<br />
As Scala 2.8 is advertised with "default and named arguments", such things should possible (well, hopefully easy too ;).
I came with this solution:<br />
<br />
<br />
<br />
<pre class="sh_scala">class A(val val_a:String) {
var var_a = ""
}
object A {
def merge[T](t:T)
(
var_a : String
) : T = {
t match {
case x:A => x.var_a = var_a
case _ => error("")
}
t
}
def copy(source:A)
(
val_a : String = source.val_a,
var_a : String = source.var_a
) : A = merge(new A(val_a))(var_a)
}
class B(override val val_a:String, val val_b : Int) extends A(val_a) {
var var_b = 0
}
object B {
def merge[T](t:T)
(
var_a : String,
var_b : Int
) : T = {
A.merge(t)(var_a) match {
case x:B => x.var_b = var_b
case _ => error("")
}
t
}
def copy(source:B)
(
val_a : String = source.val_a,
var_a : String = source.var_a,
val_b : Int = source.val_b,
var_b : Int = source.var_b
) : B = merge(new B(val_a,val_b))(var_a,var_b)
}
class C(override val val_a : String) extends A(val_a)
// *****************
// Example of use
// *****************
object TestCloning {
def main(args:Array[String]) {
val a1 = new A("la_init")
a1.var_a = "ra_init"
val b1 = new B("lb_init",1)
b1.var_a = "rb_init"
b1.var_b = 10
//example with A
val a2 = A.copy(a1)()
assert(!(a1 eq a2))
assert(a2.var_a == a1.var_a)
assert(a2.val_a == a1.val_a)
val a3 = A.copy(a1)(val_a = "la_mod")
assert(a3.var_a == a1.var_a)
assert(a3.val_a == "la_mod")
val a4 = A.copy(a1)(val_a = "la_mod", var_a = "ra_mod")
assert(a4.val_a == "la_mod")
assert(a4.var_a == "ra_mod")
val a5 = A.copy(new C("foo"))()
assert(a5.var_a == "")
assert(a5.val_a == "foo")
val a6 = A.copy(b1)()
assert(a6.val_a == "lb_init")
assert(a6.var_a == "rb_init")
//with B
val b2 = B.copy(b1)()
assert(b2.val_a == "lb_init")
assert(b2.var_a == "rb_init")
assert(b2.val_b == 1)
assert(b2.var_b == 10)
val b3 = B.copy(b1)(var_b = 5, val_a = "lb_mod")
assert(b3.val_a == "lb_mod")
assert(b3.var_a == "rb_init")
assert(b3.val_b == 1)
assert(b3.var_b == 5)
}
</pre>
<br />
That solution seems to work, and allows to do the kind of use case I wanted to build.<br />
But it seems not satisfactory at all for (at least) these reasons:<br />
1/ - the trailing "()" in real clone without override is mandatory and doesn't look right;<br />
2/ - it seems to be a lot of tedious code to write in each class, and so seems to be really error prone;<br />
3/ - I'm not at ease with the merge method, but I can't say why exactly;<br />
4/ - I don't like to much the factory approach.<br />
<br />
1/ could be easily addressed if in place of only a copy(source:X)(.....) we define a couple of method :
<br />
<pre class="sh_scala"> def copyWith(source:A)( ... ) : A = merge(...)(...)
def copy(source:A) = copyWith(source)()
</pre>
3/ and 4/ are just feelings, and so could be shut up for now.<br />
<br />
But 2/ is a real concern, and I would like to find a way to externalize more code in traits, so that domain classes have only simple, short code to write to provide a clone API.<br />
<br />
So Scalazy, what are your best practices about the cloning topic in Scala ?
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com3tag:blogger.com,1999:blog-4809200280367588708.post-7329881959609109912009-10-12T21:42:00.004+02:002009-10-14T22:31:20.979+02:00ActiveLDAP in Scala : LDAP on the JVM, in a shell !<i>Update: typos only</i><br />
<br />
Until a really recent time, LDAP in the JVM, trougth JNDI API, was a nightmare of usability. Just connecting to an LDAP directory with a simple login/pass was worth a dozen lines of really unatural code (and <a href="http://java.sun.com/products/jndi/tutorial/ldap/connect/create.html">I'm almost not exagering</a>)<br />
<br />
Hopefully, the situation is evolving, and there is several projects willing to provide a better LDAP SDK on the JVM. <br />
<br />
Among them, there is <a href="http://www.unboundid.com/products/ldapsdk/">UnboundId's one</a>. I started to play with it, and it's quite delighting to be able to use a good API to do your work !<br />
<br />
So it gives me an idea : how this SDK could be pimped thanks to Scala to be used in command lines, in a ruby <a href="http://ruby-activeldap.rubyforge.org/doc/">ActiveLDAP</a> fashion ?<br />
<br />
And things are coming along really well. It's just a start, but this is an example of a Scala REPL session with my version of Scala ActiveLDAP :<br />
<br />
<br />
<pre class="sh_scala">scala> import test.activeldap._
import test.activeldap._
scala> import LdapFilter._
import LdapFilter._
scala> val p = new SimpleAuthLCP(baseDn = "dc=example,dc=org",authDn =
"cn=admin", authPw = "secret pass")
p: test.activeldap.SimpleAuthLCP = [cn=admin@localhost:389 (base:
dc=example,dc=org) by password authentication]
scala> val users = new MetaActiveEntry(prefix = "ou=people",
rdn = "uid" , classes = Set("top","person","organizationalPerson","inetOrgPerson"),
provider = p )
users: test.activeldap.MetaActiveEntry = test.activeldap.MetaActiveEntry@c85a33
scala> val user = users.find()(0)
user: test.activeldap.ActiveEntry = uid=42,ou=people,dc=example,dc=org
scala> user.details
res28: java.lang.String = Entry(dn='uid=42,ou=people,dc=example,dc=org',
attributes={Attribute(name=objectClass, values={'inetOrgPerson',
'organizationalPerson', 'person', 'top'}),
Attribute(name=sn, values={'Bar'}), Attribute(name=cn, values={'Foo'}),
Attribute(name=mail, values={'foo@bar.com'}), Attribute(name=uid, values={'42'})})
scala> user("uid") = "43"
scala> user.save
scala> users.find()
res31: Seq[test.activeldap.ActiveEntry] = ArrayBuffer(uid=42,ou=people,dc=example,dc=org,
uid=43,ou=people,dc=example,dc=org)
scala> user("mail") = Seq("foo@bar.com","foo_bar@bar.com")
scala> user.save
scala> users.find(EQ("uid","43"))(0).details
res34: java.lang.String = Entry(dn='uid=43,ou=people,dc=example,dc=org',
attributes={Attribute(name=objectClass, values={'inetOrgPerson',
'organizationalPerson', 'person', 'top'}), Attribute(name=sn, values={'Bar'}),
Attribute(name=cn, values={'Foo'}), Attribute(name=mail, values={'foo@bar.com',
'foo_bar@bar.com'}), Attribute(name=uid, values={'43'})})
scala> user.delete
scala> users.find(EQ("uid","43"))
res36: Seq[test.activeldap.ActiveEntry] = ArrayBuffer()
scala>
</pre>
<br />
There is a really nice feature brought by Scala 2.8 for this kind of API: named and default parameters. I used it in the previous sessions to define the connection: host and port were not provided (default to localhost:389), but you can specify them if you need :<br />
<br />
<pre class="sh_scala"> scala> val p = new SimpleAuthLCP(
| authDn = "cn=manager",
| authPw = "secret password",
| host = "an.other.host.com",
| port = "1389",
| baseDn = "dc=company,dc=com"
| )
</pre>
<br />
It's just a begining, and there is a lot of other nice features from Ruby ActiveLDAP that could be added...<br />
<br />Fanfhttp://www.blogger.com/profile/10948445494945956846noreply@blogger.com3