Category: Coding

07/25/05

Working on a little bot: HangBot

I'm working on a new Jabber bot: HangBot. It should be able to let the user play small text-based games. Atm, playing Hangman (which is the game the bot is named after) and some other basic functions work. The next task on the list is making the menu-class more flexible so other games can be added easily.

The hangman game is finished (it works as it should), but I still need to find a good dictionary for the game to pick words from. 'Ikke' proposed some files in /usr/share/dict/, but those are too difficult, and they're in English (I'm looking for both English and Dutch dictionaries). If anyone knows where to find a fitting dictionary (rather short, simple words), please comment it.

Permalink . RealNitro . 20:25:01 . 130 Words . Coding . Email . 340 views

07/19/05

Yesterday, I uploaded a new index page for realnitro.be. It's a small page, just to have something that refers to this blog, to some sites I made and to my e-mail adress. (I might add my JID too.) I don't know if the page is working in IE as it should, but I might look into that later today.

Having passed my exams in july, I have a lot of free time (three months minus some vacation work), so I'll probably be able to post some more interesting stuff on this blog for the months to come. (I might adjust mabber.py a bit to make it work again on eduserv, and I should finish that little glade/gstreamer-experiment too some day.)

Permalink . RealNitro . 16:20:23 . 146 Words . Webdesign, Life, Coding . Email . 411 views

03/18/05

Some time ago, I wrote a small python script that notified me with a jabber message whenever a new e-mail has arrived on my UGent-account. I already was using a similar script, but I wanted to create one myself. And now it's time to publish it. :-)

What does it do: it notifies you with a jabber message when a new e-mail has arived
What do I need: a jabber account for yourself and for the bot, access to procmail filters, python support on the procmail server, a jabber client and my scipt.
How: first, a procmail filter forwards the e-mail headers to mabber.py. Mabber analyses the headers, extracts the needed info and formats it. Then, using xmpppy and a dummy jabber-account, a the little bot pops online and sends you a 'headline' message.
Where do I get it: download mabber.py here
Note: similar scripts/progs exist in Perl and Java.

How to set it up on eduserv:
1) Download the mabber.tar.gz file to your computer. Use an SCP client (like WinSCP on windows) to log in on eduserv with your own login and password. Make sure the right side is selected and upload the mabber.tar.gz file to your home-directory.

2) Using an SSH client (like Putty for windows), log on to eduserv again. First, the mabber.tar.gz file has to be extracted. To do this, enter:

tar xvpfz mabber.tar.gz

The console should output a list of extracted files. Now enter the command

cd mabber

to enter the created mabber directory. Execute the script for the first time with

chmod 700 mabber.py
./mabber.py

It will tell you there was no configfile found, and a dummy-one was created. To adjust this dummy file, go back to the previous directory and open the dummy file :

cd ..
pico -w .mabber

Change the values for 'jid', 'password' and 'tojid' to the JID of your bot, its password and your own JID respectively. Remove the '#' in front of 'jid', 'password' and 'tojid', save with 'CTRL+O' and exit with 'CTRL+X'.

Note:In order to keep your password hidden from other users, mabber.py creates your file with '600' permissions (only you are able to read it and adjust it). If you descide to create the file yourself, do not forget to execute

chmod 600 .mabber

3) Now its time to add a procmail filter. More info here. First execute (while still in the folder of .mabber -- your home folder)

pico -w .forward

In this file, add one line:

"|IFS=' '&&exec /usr/local/bin/procmail -f-||exit 75 #USERNAME"

in which you change USERNAME to your own username. Save with 'CTRL+O', exit with 'CTRL+X'. Now its time to define the filter. Again we use pico to create/adjust a text file:

pico -w .procmailrc

and add:

PATH=$HOME/bin:usr/bin:/usr/local/bin
MAILDIR=$HOME/mail
DEFAULT=/var/mail/USERNAME
LOGFILE=$MAILDIR/from
LOCKFILE=$HOME/.lockmail

#mabber
:0 hc
| $HOME/mabber/mabber.py

Again, change USERNAME into your own username, save with 'CTRL+O' and exit with 'CTRL+X'.

That's it! Try sending yourself an e-mail. A few seconds later (could be half a minute) you should receive a jabber-message containing the sender, the subject and the date. Be sure to check if you really received the mail. If not, doublecheck your .procmailrc file! If you have any questions about the installation or use of this file, feel free to comment. I'll answer asap.

Permalink . RealNitro . 11:48:44 . 717 Words . Coding . Email . 813 views

03/01/05

Php gotcha, mail, FOSDEM

It has been a while since I have posted here, for two reasons: I didn't have much to say, and last week was very busy. I did a rewrite of the gotcha php-code that is used for the Home I live in. It took me a while to decypher the old code (amazingly complex), and eventually it took me 4 evenings to finish the job. However, the gotcha that's going on atm still uses the old code. :-( There was no time to test the new version thorougly, and just before the start of the gotcha (22h. last sunday), I discovered a little bug too. But I'm looking at it from the bright side: now I have the opportunity to fine tune my code, check it for weaknesses in its security, add new features, maybe add a fully featured admin-page, give it some new html code... If anyone (that is: anyone I know and trust ;-) ) wants to see my code running, just let me know. Btw, does anyone know of a way to check if an e-mail that should have been sent with the php code has really been sent? I'm asking this because last sunday the old php code did not start at first (I had to try 3 times!), and apparently some people didn't receive their passwords (which sould have been sent with the php mail function). :-/

Two days ago (sunday) I went to FOSDEM. The overall 'experience' was better than had I expected it to be. None of the presentations I attended were too technical (except the one about nautilus ;-) ). The one I enjoyed the most was the one about FAI, followed closely by XFCE. I think I liked the one about FAI the most because we might use it in stead of Fedora Stateless. (the speaker was very good too)

There ya go. Not much more to say. I have a big, unpublished post here at this blog about 'mabber.py'. But I will not publish it before I tested the installation instructions, and I still need to choose a license (or invent one).

Permalink . RealNitro . 14:19:14 . 373 Words . Webdesign, Linux, Coding . Email . 821 views

<< Previous Page ::