July 29, 2006

String edition in bash: replacements

Many of us are used to using sed for pattern replacements in strings, but it is also possible to perform these replacements from within bash, using ${parameter#word}, ${parameter##word}, ${parameter%word}, ${parameter%%word}, ${parameter/pattern/string/}, and ${parameter//pattern/string}.

All these forms are explained in “man bash” but no example is given. Since an example is often the best way to show how things work, here are a few examples for these features. I will only give examples here, considering you can lookup for these entries in “man bash” if you want the full theorical explanation, that I find confusing.

Let us define a global variable we will be working on:


$ FQDN="foo.bar.com" # let's define a variable called FQDN for our examples
$ echo ${FQDN} # just a check
foo.bar.com

Now let’s have a look at ${parameter#word} and ${parameter##word}, which act on the beginning of the string:


$ echo ${FQDN#*.} # this removes the shortest pattern matching "*." in the beginning of $FQDN, so it removes "foo."
bar.com
$ echo ${FQDN##*.} # this removes the longest pattern matching "*." in the beginning of $FQDN, so it removes "foo.bar."
com

${parameter%word} and ${parameter%%word} achieve quite the same, but on the end of the string:


$ echo ${FQDN%.*} # this removes the shortest pattern matching ".*" in the end of $FQDN, so it removes ".com"
foo.bar
$ echo ${FQDN%%.*} # this removes the longest pattern matching ".*" in the end of FQDN, so it removes ".bar.com"
foo

Now it’ll be fairly easy to understand what ${parameter/pattern/string} and ${parameter//pattern/string} do… They are direct replacements for sed, respectively with and without the g option:

Let’s define a new string for this one:


$ TEST_STRING="foo is long and bar is long"
$ echo ${TEST_STRING} # just a check
foo is long and bar is long

and now to see what these variables do:


$ echo ${TEST_STRING/long/short} # replaces the first occurence of "long" by "short" in $TEST_STRING
foo is short and bar is long
$ echo ${TEST_STRING//long/short} # replaces all occurences of "long" by "short" in $TEST_STRING, same as using g in sed
foo is short and bar is short

Enjoy and feel free to provide more examples you’d find useful as comments :)

July 19, 2006

Christian projects on Sourceforge #1

Today I am having a look at the Christian open-source projects listed on Sourceforge.
I’ll try to list them here, taking them in order of appearance when looking at the “Religion and Philosophy” section. I won’t be listing the programs that are obviously for Windows only, since I cannot test them.

BibleTime
There’s no need to introduce BibleTime I believe. This great Bible study program for KDE is part of the Sword project, hosted by the Crosswire Bible Society. Version 1.6 is currently in development, and we’ll be happy to update it in Ubuntu when it’s ready.

openlp.org
I couldn’t find in what language this program is made… but surely not in any I know how to use on Linux, and the only binary that is given is for Windows, so I couldn’t try it… Any comments welcome.

Bibledit
This piece of software was just added in Debian not long ago, and synced in Ubuntu very lately. It is aimed at editing Bible files, mainly to allow translating the Bible. I couldn’t really test it because it segfaults in Ubuntu Edgy. I’ll have to see if anything can be done for that.

Lyricue
More and more churches use video-projectors to show the lyrics of songs on a screen. This is why lyricue exists, to allow them to use an open-source software to achieve this task. Currently, Lyricue requires a mysql DB to be set, which makes it a bit uneasy to use. Lyricue is not in Debian or Ubuntu yet, but packages exist on the website. I recently contacted the upstream developer about getting Lyricue in Ubuntu, and he said he will do that. Looking forward to uploading it :)

GnomeSword
GnomeSword is to GNOME what BibleTime is to KDE: a must. Although I prefer KDE over GNOME in general, I reckon GnomeSword is a very nice Bible study software.

GNU Bible (GBible)
GBible is a Java-based Bible study software developed using HSQLDB, Lucene and Swing. It was formelly designed to use db.linux, GTK+, Glade and C. The locale focus is Portuguese(Brazil), using “Almeida Revista e Atualizada” version. I am a bit disappointed by the fact that the Bible it uses seems somehow hardcoded… I can’t see readable source files where the Bible is read, nor a way to add another Bible version to this program. Which means : “Read the Almeida Revista e Atualizada” portuguese version of the Bible, or give up on using this program… Hope to see a broader focus and some translations on this project :)

ChurchInfo
From what I understand, ChurchInfo is the future of the PHP/MySQL version of InfoCentral, a web-based program to manage church communities. I have played a bit with it, and have found it interesting. The only thing I’m really concerned with are the menus on the top of the window: they don’t appear on my new version of Firefox, and they are not clickable on Konqueror… which makes navigating in the program simply … impossible. Otherwise I’ve heard very nice things about this app, and I plan to package it as soon as I can understand how to get the menus to work…

OpenSong
According to its author, this ruby program seems to be aimed at “managing chords and lyrics sheets (lead sheets), presenting lyrics (and custom slides) using a projector, and much more!”. However, the source tarball contains a .rb file and an xml file, and the .rb file fails to launch with ruby1.8. I didn’t try to go further. I’d be happy if the author chose to provide an installer for his program.

July 10, 2006

OpenClipart

I was searching for Christian open-source clipart today. Unfortunately I didn’t find any. All the free Christian clipart I found have restrictive - or even very restrictive - licenses :(

However, I have found one open-source clipart website - although not Christian - with very good things on it http://www.openclipart.org.

I strongly encourage all graphic developers to contribute to this project :)

July 7, 2006

Dogville : un Dieu gangster ?

Avertissement:

Cet article contient des révélations sur l’intrigue du film Dogville.

Ce film contient des scènes de violence et de nudité qui peuvent heurter. Lors des projections publiques, des personnes ont quitté les salles.

Affiche

Renversant !

Lars von Trier nous livre ici une interprétation très personnelle de l’Évangile, qui interroge et qui choque.

Quelle ne fut pas ma surprise pourtant quand, cherchant des critiques de ce film, je ne trouvai aucune mention faite au christianisme. Les critiques francophones de ce film se contentent d’y voir une mise en boite de l’Amérique rurale, dans la continuité de Dancer in the Dark, préfigurant selon ces auteurs le début d’une série d’oeuvres centrées sur les États-Unis. Ils y voient également l’influence de Berthold Brecht dans la nudité des décors et la simplicité de la mise en scène. S’il est vrai que le film a été entièrement tourné dans un hangar, avec des décors principalement tracés à la craie sur le sol, c’est visiblement pour mieux mettre le spectateur dans une position omnisciente, divine, que l’auteur fait ce choix. Et malgré tous les indices flagrant d’une inspiration chrétienne, aucun rapprochement à la foi n’est fait dans ces commentaires.

Pourtant nul n’est besoin de chercher loin pour trouver les références à la Bible dans ce film, puisque même les noms des personnages s’y réfèrent : l’héroïne, figure christique par excellence, se nomme Grâce, et le chien du village, Moïse.

C’est finalement sur un site anglophone, Christianity Today, que je trouvai une critique de ce film avec des yeux ouverts sur son message, bien que je ne partage pas totalement l’avis du critique, notamment en ce qui concerne la séparation qu’il fait entre le Dieu juge de l’Ancien Testament et le Dieu amour du Nouveau Testament.

À l’apogée de cette passion, Lars von Trier enchaîne sur une apocalypse revisitée, où la figure christique de Grâce est taxée d’arrogance, et où ce personnage souffrant par et pour tous se transforme en juge sanguinaire, héritant tous pouvoirs sur la vie de son père gangster. La scène finale a lieu dans une voiture close, rideaux tirés, seul lieu du décor fermé aux regards, conciliabule divin après la trahison et la mise à mort de Grâce, avant la passation des pouvoirs omnipotents de son père sur le peuple qui l’a oppressée.

Le film se finit sur l’image du chien Moïse. Ce personnage, tracé à la craie dans le décor depuis le début du film, et qui a vécu passivement les événements de l’intrigue sans jamais broncher, est épargné par Grâce, prenant soudain vie au milieu du village en flammes, seul à mériter le pardon divin.

Une oeuvre magistrale, qui révèle beaucoup sur les croyances de son auteur.

July 3, 2006

DADVSI est passé, un auteur exprime ses craintes sur le futur des droits d’auteurs

Dans le monde du libre, nous avons tous suivi avec inquiétude le débat autour de l’adoption du texte de loi DADVSI. Quelques jours après l’adoption du projet, Michaël Golberg fait le tour de ses conséquences désastreuses, invitant les auteurs pour qui la liberté a encore de la valeur a réagir en tentant de sauver la diversité au risque de la rentabilité.

Un texte a découvrir sur cette page.