(Français) Le vacarme des bombes et le silence de la Gauche

Sorry, this entry is only available in French.

Posted in Politics & society | 1 Comment

Download rtmp flash video from Linux

To watch a streaming flash video (rtmp streaming) from a tv website without the flash plugin, you can download the video to your computer like this :

  1. Open the web page with firefox. Right click and view the source of the page.
  2. Look for the “<embed>” markup of the video, such as <embed src=”http://site.tv/player.swf?admin=false&amp;autoPlay=true&amp;videorefFileUrl=http%3A%2F%2Fsite.tv%2Fvideos%2FmyFilm%2Cvideo.xml” […]>
  3. The URL of the XML file (in red here) contains the real reference to the video. So let’s copy it into the browser’s address bar, and replace the escaped characters by their values : http://site.tv/videos/myFilm,video.xml
  4. The XML file is now displayed in firefox. Look for the video itself (there might be more than one, for example SD or HD) and get its url. For example rtmp://site.tv/365/2744?lg=en
  5. Install flvstreamer (apt-get install flvstreamer in Ubuntu, urpmi flvstreamer in Mandriva and so on…)
  6. Run it with the rtmp URL : flvstreamer -o outputFile.flv -r “rtmp://site.tv/365/2744?lg=en
  7. If the download is not complete and you get the message ERROR: ReadPacket, failed to read RTMP packet header
    Download may be incomplete (downloaded about 57.20%), try resuming
    Just resume the download with the same command, plus the -e option :
    flvstreamer -e -o outputFile.flv -r “rtmp://site.tv/365/2744?lg=en”
  8. Repeat that last command as long as the file is not complete.
  9. Read the file with mplayer or vlc !
Posted in TechTips | Leave a comment

Automatic Synchronization between two backup NAS devices


You have two NAS devices, for example two network hard drives (in my case Iomega StorCenter ix2). You want your users (Windows/Mac OS X/Linux) to be able to backup their data to one of them, and have a mirror of the backups on the second one (off-site backup). The setup does not need to be very secure, as this works on an internal network, so a password stored in clear text in a script is not a big deal.

Daily Synchronization by a Linux computer


Each user has an account and associated directory on Disk1. On Disk2, there is only one “Backups” directory. Windows share/CIFS/SMB is activated in both disks.
Here, both disks have DNS names “Disk1” and “Disk2”. You can use the IP address of the disks instead.
A backupUser user is declared on both disks, with reading rights only on all Disk1 directories, and all rights on Disk2 Backups directory.
On the Linux computer,  the directories /mnt/serv1 and /mnt/serv2 must be created.

Backup script

First, let’s make a small perl script backupNAS.pl to perform the backup :

#!/usr/bin/perl -w
# You need : - a backupUser with - all reading rights on all Disk1 directories
#                                                   - writing rights in Disk2/Backups
#           - the  Disk2/Backups directory must contain a file named AutoBackup

# Mounting Disk2 in /mnt/serv2
`umount /mnt/serv2; mount -t cifs -o user=backupUser,password="MyBackupPassword",iocharset=utf8,file_mode=0777,dir_mode=0777 //Disk2/Backups /mnt/serv2/`;
$err1 = $?;

# Check : There must be an "AutoBackup" file in the directory if the disk in mounted correctly
if ((not -e '/mnt/serv2/AutoBackup') or $err1 != 0){
	die "ERROR : cannot mount Disk2 !\n";

# Get the list of user directories in Disk1
@shareList1 = `smbclient -N -L //Disk1`;

# Filtering the list to get only the shared directories. Lines should look like 
# "        username        Disk  "
@reps1 = ();
print "Disk 1\n";
foreach $share1(@shareList1){
	chomp $share1;
	if ($share1 =~ /^\s+(\S+)\s+Disk\s+/){
		($name,) = $share1 =~ /^\s+(\S+)\s+Disk\s+/;
		push (@reps1, $name);

# Each directory will be mounted then unmounted
foreach $rep1(@reps1){
	`umount /mnt/serv1`;
	`mount -t cifs -o user=backupUser,password="MyBackupPassword",ro,iocharset=utf8,file_mode=0444,dir_mode=0555,noperm //Disk1/$rep1 /mnt/serv1/`;
	if ($? != 0){
		print "ERROR : Directory //Disk1/$rep1 mount failed !\n";
	print "SYNCHRO rsync /mnt/serv1/ /mnt/serv2/$rep1\n";
	print `rsync -rltpv --stats  /mnt/serv1/ /mnt/serv2/$rep1`; # --del if deleted files must be removed on Disk2 too
`umount /mnt/serv1`;
print "SERVER 1 : backup to DISK 2 is done !\n";

Cron script

Now, let’s create a small script that will call this one daily and log the results. Edit /etc/cron.daily/backupNAScall :

echo >> /var/log/backupServers.log
echo >> /var/log/backupServers.log
echo "-------------------------------------------------" >> /var/log/backupServers.log
echo "Beginning BACKUP -> Launching backupNAS.pl" >> /var/log/backupServers.log
date -R >> /var/log/backupServers.log
perl /pathToScript/backupNAS.pl >> /var/log/backupServers.log

echo "BACKUP FINISHED" >> /var/log/backupServers.log
date -R >> /var/log/backupServers.log
echo "**************************************************" >> /var/log/backupServers.log

Now each day, the backup will start and detailled logs (including the date and time) will be stored in /var/log/backupServers.log !

From the NAS (in progress…)

Next step would be to remove the need for the linux computer entirely and execute this on the small linux system of the NAS disk. The following is specific to the NAS device (Iomega StorCenter ix2).
A ssh server can be activated on the NAS by going to the page https://myDiskAddress/support.html, then activating the access option.
When the disk has rebooted, you can connect to it with ssh root@myDiskAddress. The password is “soho” followed by the admin account password that was set up to access the web interface. With this, you have access to a small system (without perl or bash, just sh or ash – the previous code won’t work on this device “as is”. rsync is there, though).

In /etc/crontabs/root there is a warning :

# DO NOT SCHEDULE TASKS HERE (use sohoProcs.xml to schedule tasks)
The file /usr/local/cfg/sohoProcs.xml seems to be the right place for scheduled tasks. In it, we find commands like this :

<Program Name=”reportquota” Path=”/bin/sh”>
<SysOption Days=”1″ Scheduled=”1″ StartTime=”01:00″/>

I did not try to add a custom command yet, but this should be the way to go…

This wiki might be helpful : http://ix2-200.wikidot.com/

Posted in TechTips | Leave a comment

PyVotons foundations

Incomplete translation

This text presents the main ideas that led to the creation of the PyVotons! project. It was written in february 2009, long before the first real move towards PyVotons.

The goal was to propose software tools for a group (at the time, a political party) in order to encourage initiatives and go towards collective propositions and decision-making.

DECISION software


  • An wiki-like ID such as FirstnameLasname and a password
  • Optional personnal information
  • e-mail/phone/mobile : a way to get in touch
  • Usual availability dates for meetings (days of the week, time slots)

Polling software

This program will be used to choose a meeting date or to quickly take a simple decision in a small group, with a public voting system (anyone can see who votes for what).

  • doodle-like system
  • A user enter the question he/she wants to ask to a user groupe (When should we have this meeting ?)
  • he/she lists possible answers (12/02 5pm, 12/02 6pm, 17/02 8pm)
  • he/she sends a link to the poll page.
  • The programme creates a web page dispaying the question followed by possible answers. Each user enters its name then checks suitable answers.
  • At the end date, counting the number of checks gives the result of the poll
  • This can be extended to a larger variety of polls (select one from a list of answers, rate each possible answer…). It should still be very easy to use (not all users are familiar with the web); the user that wants to create a poll should see a list of typical polls and just choose the type he/she wants.

Messaging software

  • This allows to automatically (or not) send an e-mail following events on the site (poll newly opened, new proposition, opening of a vote, reminding the closing date of a vote, vote results published).
  • Having the option to send SMS (texts on mobile) would be a useful feature for those without computer or e-mail access, so that they are aware of the events on the site  (is there a free service that works with all phone providers ?)
  • It should be possible to opt out by message type, or to group messages (one per day, one per week).

Vote software

Submit one or more questions/propositions/candidates to a full-fledge vote or election.à un ou plusieurs tours

This must allow experimenting with multiple voting systems (ordering candidates by preference, rating propositions or just select he best one) using one or more rounds, anonymous or not (transparency for elected representative versus freedom of the vote with no supervision).

When creating a new election or a referendum, it must be possible to select one or more voting systems (if people are motivated enoiugh, we could compare the results of the vote according to the voting system).

Idea market software

Le but ici est que chacun puisse lancer une proposition et que la sélection et les amendements de ces propositions se fassent par un processus collectif.

  • Proposer une proposition P
  • Commenter une P existante : critiquer ou au contraire aller dans le sens de la proposition
  • Noter une P (sur 20 par exemple)
  • Lier deux propositions (elles sont identiques, apparentées, l’une s’inspire de l’autre, ou c’est une nouvelle version de l’autre…)
  • Permettre la discussion (avec par exemple un forum lié à la P) pour faire évoluer une proposition et en créer une nouvelle intégrant le résultat de la discussion
  • Définir des thèmes et des mots-clés pour classer un peu les propositions
  • Pour chaque proposition, synthèse des arguments pour et contre
  • Moteur de recherche des propositions (éviter de proposer 10 fois la même, en trouver une apparentée). A ce niveau-là, ça devrait fonctionner un peu comme bugzilla
  • Amender ou fusionner des propositions : étiqueter comme anciennes les propositions obsolètes et en écrire une nouvelle liées aux anciennes
  • On peut éliminer les propositions anciennes (en les gardant dans un historique) quand elles sont remplacées par des propositions plus récentes
  • Une synthèse des propositions les mieux notées doit être générée périodiquement.
  • Les propositions qui sont remontées au-dessus d’un certain seuil (note + nombre de personnes ayant noté) doivent être soumises périodiquement au vote de tous avec l’application Vote
  • Les propositions soumises au vote seront étiquetées « rejetée » ou « acceptée » avec une référence au vote correspondant

Wiki de synthèse

Ce wiki doit être le lieu de synthèse de l’ensemble des propositions retenues. Elles doivent être listées et permettre d’élaborer des textes cohérents pour les articuler. (Inclusion de mediaWiki, ou MoinMoinWiki)

Base de connaissances Wiki

  • références à des livres, articles, réflexions
  • Le but est d’aider à comprendre le monde et d’avoir des arguments pour soutenir les discussions sur les propositions
  • (Inclusion de mediaWiki, ou MoinMoinWiki)

Forum et Discussion en ligne (« chat », IRC)

  • Le forum permet de discuter en ligne même quand les interlocuteurs n’ont pas de plages horaires communes disponibles : chacun écrit et lit quand il le souhaite, et les archives sont disponibles. (intégration de PhpBB par exemple…)
  • L’IRC permet de remplacer les réunions téléphoniques ou simplement de discuter en direct en mode texte. Les discussions peuvent être archivées. (serveur IRC quelconque).

Quelques remarques

Attention, tout ceci n’a pas pour but de supprimer les réunions et les contacts humains, mais de permettre au maximum de gens de proposer et de participer à la prise de décision, grâce aux technologies récentes. Pas de société des experts, autrement dit…

Les humains restant des humains il faudra trouver des méthodes de régulation pour éviter le spam, les guerres d’édition dans les wikis et le pouvoir trop important des modérateurs.

En gros, l’élaboration du programme devrait venir de propositions venues de tous, discutées sur les forums de discussion, par IRC et en réunion classique, notées, puis passées au vote, et enfin ajoutées dans le wiki de synthèse.

Posted in Documentation | Leave a comment

Unconditional basic income : debate notes

Translation in progress (questions are not translated yet)

Here are detailed notes I took during a presentation and debate about unconditional basic income, organized in Grenoble, France by les Alternatifs and la Fase on october 13, 2010. Continue reading

Posted in Politics & society | Leave a comment

Asus EEE 1005PX audio output

After installing Ubuntu 10.04 on a Asus EEE 1005PX netbook, the audio output jack did not work. When headphones were plugged in, the netbook speakers were cut off, but there was no sound at all in the headphones.

The solution was to add a line at the end of file /etc/modprobe.d/alsa-base.conf :
options snd-hda-intel model=lifebook

After the next reboot, the headphones worked perfectly.

Posted in TechTips | 4 Comments

General meeting for renewal : the Liberation forum in Grenoble

In the last three days, a convention was organized by the newspaper Liberation in Grenoble, combining conferences, debates and meetings between associations, French political figures, journalists and the public.

I went to a few conferences and a day of debate on the theme of democracy. The conferences were mildly interesting, especially because the number of questions was limited and the themes were not fully explored.

For example, the conference about democracy and Internet was just an hour-long talk between two European deputies, a sociologist and a communication coach for politicians. I was expecting a presentation of the role of Internet in the renewal of democracy, mostly in our western democracies.

For example, in 2005 a large debate opened about the European constitution referendum that was organized by citizen mostly outside political parties. The role of blogs, forums, wikis to summarize for/against arguments, all those new tools that allowed the citizen to get involved in the referendum.

Instead of that, most of the conference was dedicated to the use of Facebook and Twitter by politicians, how it could help them not loose contact with their electorate, in fact, the way these tools allow a new form of political communication and advertising.

There was a short mention of the role of Internet in the political contests in Tunisia and Egypt that lead to Ben Ali living the Tunisia.

Elected representatives feel often threatened by (and therefore, often block) the implication of citizens in decision-making processes. This was a theme discussed during the debate with interesting practical experiments by a mayor of a small city, and about a less satisfying experience in Grenoble linked to the “not in my backyard”.

The representativity of local citizen councils was also discussed, as most inhabitants going there are mostly retired and sometimes only the vocal opponents considering their local problems but not the larger picture.

A lot to think about !

Unfortunately, the last day was, for a “renewal” forum, a bit ironic : the conclusion was done by a group of old, white males. Journalists, politicians that have been ruling this country for years, speaking about renewal of the society !

Once more, the political parties, the main media are at not at the forefront, developing new ideas in the field of democracy, economy… This comes from associations, citizens, researchers.

Posted in Politics & society | Leave a comment

USA : a bill to use approval voting

Interesting article on Slashdot about a bill in the USA that, if adopted, would change the voting system in New Hampshire to Approval Voting, using a variant that is included in PyVotons (classical version for now).

In the discussion, after mostly positive comments, a comment advocates the Schulze Method which is an interesting pick, has a lot of advantages and a big drawback : it is hard for voters to understand how the result in computed.

It should anyhow be included in PyVotons! supported voting systems.

Posted in Politics & society | 2 Comments

Client-Server communication protocol

First try for a client-server communication protocol.


The client sends requests to the server (including a request ID) and receives an answer (with the same ID). Each request is a JSON object, in fact a python dictionary  : {‘type’:’RequestType’, ‘data’:myParameters}

Request Types

List of possible client-server request types (first version) :

  1. ‘Auth’:user authentication
  2. ‘CreateUser’: create a new user
  3. ‘CreateScrutin’: creation a new poll,
  4. ‘GetScrutin’: get the data about a poll (date, questions…),
  5. ‘UpdateScrutin’: update the data of an existing poll,
  6. ‘GetVoteTemplate’: get poll data and the questions with possible answers to display a “vote” page,
  7. ‘CheckAndRegisterVote’: check if a vote is valid and register it,
  8. ‘GetResults’: get the results of a poll,
  9. ‘ListScrutins’: list all available polls for the current user (current, closed…),
  10. ‘UserGroupManagement’: Management of users and group rights

Parameters for each request type

– Auth :

data = {‘login’:login,  ‘pass’:password}

WARNING : a salt must be used during a new user registration; login, salt, and the SHA/MD5 hash of the combination (password + salt) must be saved in the database. Continue reading

Posted in Development | Leave a comment

PyVotons! : A polling software prototype

  1. Introduction

    PyVotons! is a free software to organize polls (online voting system).

    It is part of a larger project (Propositions) which aims to bring the tools to work together, elaborate propositions, debate and for collective decision-making.

    Developing a software for voting was needed to experiment alternative voting methods.

    As I had neither qualification nor interest in web interface development using AJAX technologies, I wrote a simple prototype for a polling software to elect candidates to an election. This classical version of PyVotons! must be used in a polling station (installed on a local voting computer), it is incomplete but usable.

The next version of PyVotons! will be a web version. All voters will be able to vote on a website where PyVotons! will be installed.

The technology used will be python/pyjamas for the user interface (code is written in python, and compiled to javascript/html/css), a SQL database on the server, and a server software in python (or another language depending on the server).

  1. PyVotons! main goals

    • demonstrate that a web voting system system is a realistic way of implementing direct democracy for use in an association or political party.
    • experiment voting systems that represent the opinion of voters better than those in use in our democracies.

    The web version is not functional yet. UI elements, a database structure were developed. A GIT repository is used to keep track of the development. It is not available online at the moment. Any volunteer is welcomed to contact us to help.

    Some pages show the graphical elements here.

  3. Older versions

    Only the source code is available (no package, no binary).

    The software should run on Linux, Windows and MacOS, but was tested only on Linux.

    To use it, a working version of Qt 4, PyQt 4 and Python is necessary.

    Download the last local version of PyVotons!, extract it in a directory.

    You can run CreerScrutin.py, Vote.py, and CalculResultatsDialog.py to start a poll, register votes and compute the results. For more details, please refer to the documentation (french).

  4. Documentation

    User Documentation

    Developer Documentation

  5. Tools, license and copyright

    This software uses these outstanding free software tools :

    • Python language;
    • Qt toolkit by Trolltech (now Nokia) for the UI of the local version
    • PyQt to use Qt with Python, by Riverbank computing
    • Pyjamas for the web version.

    PyVotons! is a free software written in 2009, 2010 and 2011 by Manik Bhattacharjee (manik-listes at altern.org), distributed under GNU GPL license version 3 (for local version) and Affero GPL version 3 (web version)

    GPL v3

  6. Todo list

    • Server-side software to store votes, communication protocol with voting server.
    • Add other voting methods
    • Try to use english in the code to ease international use and development.
    • Multi-language support.

Software of interest :

Glasnost, debian voting system, STV

Posted in Documentation | Leave a comment