November 14, 2009

Wave Bible Bot

After a month of using Google Wave, I finally made my first Wave bot. My initial idea was to make a Bible bot using the sword API, but I couldn't find an easy way of doing that in python, and I am very reluctant to use Java. So instead, I did a python bot which parses BibleGateway.com to retrieve the results. Later, I added modules to deal with other translations, such as ESV, NET and specific French versions such as Colombe, TOB or NBS.


What does it do?



Flammard is a Bible bot for Google Wave. You can add it to a wave, and it will replace some specific patterns with other content.

Currently, it recognizes two kinds of patterns:

  • <verse verseReference [from Version]> is replaced by the verse. The version is optional. Examples: <verse Gen 1:1 from NIV> or <verse Acts 3:5-15>
  • <verselink verseReference [from Version]> is replaced by a link to the verse on another website. The version is optional. Examples: <verselink Gen 1:1 from NIV> or <verselink Acts 3:5-15>



Known versions



The Bible bot uses several resources in order to support as many Bible versions as possible.

The versions currently supported are:



In all cases, the version is optional. When possible, the bot will try to find the right version for your blip depending on the language you have typed in the context of the tag.



Example








Live demo



Here is a video demo of the bot working (as of today's functionalities):




How can I add this bot to a wavelet ?



Simply add flammard@appspot.com as a participant to your wavelet.


Where can I find the source code?



The project is hosted on Launchpad: https://launchpad.net/wavebiblebot. You are welcome to report bugs and wishes, or to send patches.

October 12, 2009

Dynamic presentations with Jessyink

Some time ago, I attended a presentation made with Prezi and I was pretty impressed. As I looked into it, a few things bugged me though:

  • it's in flash

  • I can't really share my presentations with anyone

  • I have to design my slides online, or use an offline app (paid) which will connect online

  • There is no good support for full screen presentations in Linux

  • It doesn't use a portable format




From looking at the features, I really couldn't see why it couldn't be implemented using SVG (except for the flash movies embedded in the presentation maybe...), so I began to search for a project that would do the same, using SVG, and I found Jessyink.

Jessyink is exactly what I was searching for. It's a plugin for Inkscape which adds the possibility to design slides from an SVG, and ships a javascript library inside the resulting SVG for execution. The result is that:

  • It's portable: apps that understands SVG and javascript can play it (e.g. Firefox, on any platform. Arora did fine too, but Konqueror wouldn't work)

  • It's an open format, with open standards: I can send the svg to someone, and they can edit it with inkscape using the Jessyink plugin

  • The possibilities are endless: I'm not limited to styles and fonts found on prezi.com, I can choose whatever font I want, whatever style I want

  • It's open-source!

  • It not only supports prezi-like effects inside slides, but also traditional slides, that can each behave like prezi-like presentations



Jessyink is harder to use than prezi.com though, but if you know how to use Inkscape, you will soon be able to do what you want with it.


Here is a quick & dirty example I made with Jessyink. Some tips:

  • Use the arrows to navigate through the presentation

  • Use the 'i' key to get an index of the slides (two slides in that case)

  • Use the 'd' key to draw on the presentation as you go through it!

  • See this page for more tips!

October 9, 2009

Authentication on both PostgreSQL and LDAP in Gforge

I am currently working on migrating a Gforge platform from authenticating on the local PostgreSQL to a centralized LDAP server.

Apart from setting up PAM-LDAP (Martin Owens can tell you all about the mess it is), the fun thing was to have some users authenticate on PostgreSQL and others on LDAP during the time of the migration.

Using a modified version of the LDAP plugin for Gforge, users are prompted for their LDAP login and password when they log in, and we fill a plugin_ldapextauth_users table with the Gforge IDs of the migrated users. Then comes the fun part. Users that are not yet migrated have to be able to log in using their Gforge login, but not their LDAP login. Users that are migrated have to be able to use their LDAP login, but their Gforge login should fail.

Note: This post is not a tutorial on how to set up libnss-pgsql2 or libnss-ldap. I won't be explaining these.

This is the solution I've come to. The machines are running on Debian Etch.

In /etc/nsswitch.conf



passwd: compat pgsql ldap
group: compat pgsql ldap
shadow: compat pgsql ldap


PostgreSQL is tried before ldap, but must fail when the user has been migrated.


In /etc/nss-pgsql.conf and /etc/nss-pgsql-root.conf



#getpwnam = SELECT login AS username,passwd,gecos,('/var/lib/gforge/chroot/home/users/' || login) AS homedir,shell,uid,gid FROM nss_passwd WHERE login = $1
getpwnam = SELECT nss.login AS username,nss.passwd,nss.gecos,('/var/lib/gforge/chroot/home/users/' || login) AS homedir,nss.shell,nss.uid,nss.gid FROM nss_passwd nss JOIN users ON users.user_name=nss.login LEFT JOIN plugin_ldapextauth_users ldap ON users.user_id=ldap.user_id WHERE ldap.user_id IS NULL AND login = $1;



#shadowbyname = SELECT login AS shadow_name, passwd AS shadow_passwd, 14087 AS shadow_lstchg, 0 AS shadow_min, 99999 AS shadow_max, 7 AS shadow_warn, '' AS shadow_inact, '' AS shadow_expire, '' AS shadow_flag FROM nss_passwd WHERE login = $1 AND ldap = 0
shadowbyname = SELECT nss.login AS shadow_name,nss.passwd AS shadow_passwd,14087 AS shadow_lstchg, 0 AS shadow_min, 99999 AS shadow_max, 7AS shadow_warn, '' AS shadow_inact, '' AS shadow_expire, '' AS shadow_flag FROM nss_passwd nss JOIN users ON users.user_name=nss.login LEFT JOIN plugin_ldapextauth_users ldap ON users.user_id=ldap.user_id WHERE ldap.user_id IS NULL AND login = $1;


This requires to GRANT SELECT access to tables users and plugin_ldapextauth_users to user gforge_nss. As a result, the request fails if the user id is found in the plugin_ldapextauth_users table, so it goes to try LDAP instead.


In /etc/pam.d/common-auth



# pam_unix fails permanently when users are migrated
auth sufficient pam_unix.so nullok_secure
# Filter accounts that are not migrated
# Since pam_unix fails for migrated accounts,
# uid then comes from ldap
auth required pam_succeed_if.so uid > 60000
# Note: try_first_pass will prompt for LDAP password
# if provided password failed
auth required pam_ldap.so try_first_pass


This is the only thing I needed to modify in /etc/pam.d. Gforge accounts use the 20xxx uid range, while our LDAP uses 60xxx, hence the pam_succeed_if.so condition to filter LDAP accounts only. This works because the uid that is returned by "getent passwd $user" corresponds to the one in the LDAP when a user is migrated, since the PostgreSQL query fails in that case (see /etc/nss-pgsql*.conf).


Chowning homes



When migrating users, uids change, and sometimes even login names. I've chosen to use inotify (incron) to fix that issue. When a user is migrated in the web interface, it drops a file in /var/lib/gforge/ldap_users named after the Gforge user name, which contains the LDAP user name.

Incron watches /var/lib/gforge/ldap_users with the following conf:
/var/lib/gforge/ldap_users IN_CREATE /usr/lib/gforge-dop-pamldap/chown_home.sh $# $@

The chown_home.sh script then achieves the following tasks:

  • Symlink the new home directory (/home/$ldap_user) to the old one (/var/lib/gforge/chroot/home/users/$gforge_user)

  • Chown the directory with the new user (chown $ldap_user. $home)




Remaining issues



The main remaining issue is groups. The Gforge database uses the login to map users to groups, instead of the Gforge id, so when the Gforge login is different from the LDAP login, migrated users currently lose their groups. The easiest option is probably to change all occurrences of the login with the LDAP login in all group tables, but it's a bit violent...

June 10, 2009

Speedtest

From home...







and from work



May 27, 2009

Chernobyl - the third angel

I'm not too much into the book of Revelations, the end times and trying to guess which prophecy applies to which recent events, but today, I stumbled upon something I found very interesting.

I was reading about the Chernobyl area on Elena Filatova's website and there she mentioned Revelations 8.10-11. I went to look this passage up, and this is what it says (KJV) :


And the third angel sounded, and there fell a great star from heaven, burning as it were a lamp, and it fell upon the third part of the rivers, and upon the fountains of waters;

And the name of the star is called Wormwood: and the third part of the waters became wormwood; and many men died of the waters, because they were made bitter.



OK, this is a prophecy about the end times from the book of Revelations. Now, what does it have to do with Chernobyl? In the Ukrainian language, "chernobyl" means "wormwood" or "absinth". A coïncidence? Let's look a bit further.


The name Chernobyl



The little town of Chernobyl in Ukraine was probably named this way because it is located in an area that is full of absinth forests. Now that nature has taken back its right in this region after the incident of 1986, Elena Filatova reports that the wormwood forests are growing a lot around Chernobyl.

Maybe you don't remember what happened in Chernobyl in 1986, so let me refresh your mind. On the 25th of April 1986, one of the reactors of the nuclear plant in Chernobyl, Ukraine, exploded, freeing into the air tons of radioactive particles that were carried all throughout Europe in the weeks that followed. I recommend watching this movie if you want to learn more about this.


Bitter waters



The word "wormwood" is used quite a few times in the Bible, mostly in the Old Testament. It is often used to picture bitterness or poison, especially associated with water.

What happened in Chernobyl has to do with both. If you watched the movie linked above, you know that the nuclear plant in Chernobyl was built on the border of a small lake, and the river Pripyat', which then flows into the Dniepper, which in turn flows into the Black Sea. After the explosion of the reactor, the radioactive magma found itself dripping under the plant towards the water. As a result, the water was poisoned by the radioactive particles, which were then carried by the river.

Another effect was due to the radioactive cloud that resulted from the explosion. Tons of radioactive particles were released into the air and were taken all throughout Europe by the winds. When these particles fell on the ground again, they infected sources and rivers, making them bitter, so to say.


A burning lamp



In the movie linked above, you could look at time index 1:50, which gives an idea of how the whole thing looked. This is obviously not an original document, but it is likely to have been made from people's testimonies. The technician talking right after this passage explains that it was very beautiful, like a glowing rainbow. The image that we see at time index 1:50 resembles a huge burning lamp.



Like I said, I'm not much into prophecies, but I find that all this is very accurate. This is all too likely to not call my attention to it.

May 20, 2009

Diathica Bible bot

I have begun to do microblogging again, this time on identi.ca. As I wanted to play a bit with the API, I coded a Bible bot using diatheke and Net::Identica.

The source is on Launchpad and the bot is currently running on one of my machines, with the @votd account on identi.ca. Have a try! You can look at the replies of the @votd account to have an idea of what you can ask it to do.

April 28, 2009

Two years, two weeks

Like the two little tickers on the right side of my blog show, today is a special day for us. Jimena and I are celebrating our two years of marriage, and we also celebrate the two weeks of our daughter Dinah Salomé!

So today is the day of twos: two anniversaries, one for two years, one for two weeks :-)