Latest Publications

Launching: theme days

As it is vacation for me (great, great vacation) and I have a lot of stuff to catch up to (mostly school stuff), I’m going to change my life by doing some theme days.

The idea is simple: Every day will have a theme. In which I try to do as much as possible around that theme. It’ll be from working on PySM to cleaning up my desk (which is really necessary too)
In doing so, I hope to get myself up to speed again. A lot of things need work!

Now, I’m actually a lazy bum, don’t really do much… I sleep most of the time of the day. Which is something I’m going to change too :)

Everything in a nutshell: I’m going to change a lot around myself. So, 14 days of theme-working. ^^

Next to the theme every day, I’m also obligating myself some required work. Like one hour of french every day (because I don’t want to fail the exams and stuff), and some more pleasant stuff too (I’ve got a weak bow, and the bow can’t always be strained, as we say in Belgium)

Wish me luck :D

Todays theme: PySM

I’ll keep everyone updated. But today I’ll be working on PySM, more specifically on the server part (system), I’ll be continuing to write a (as-close-as-possible) XMPP server in python.
So, I’ll keep you guys updated :D

Xmonad screenshot

Keeping things fresh… Can be quite hard.

This is a screen of my current xmonad setup. Gotta love it!

I’d like to thank McManiaC @ archlinux forums for his config, and brief help.

25032009

I’m hero

No worries, I’m the great four eyed accountant!!

I’m here to save you from your financial crisis misery… (Or not quite)

The great four eyed accountant

The great four eyed accountant

Too sad that I’m both not good with money, and an ICT geek… Funny to become an accountant :)

Create your own hero at: the hero factory

More, more, more!

As it is, the time is constantly more limited. I need more time, lots and lots of more time (and I need to stay away from the stargate episodes ^^)

In the PySM story, I’ve been assigned with developing the system core on the system. That core will (or should) organize the processes, system resources, communication between other cores, etc… I’ve thought some things through, but as it is, I’m stuck. Writing this might open op some items (and spice up this boring blog)

Communication!

For starters. The entire PySM packet will be designed from the ground up to be decentralized and preferably 100% scalable. Albeit the scalability isn’t the easy, nor the hard part. Thanks to the decentralization, scalability will rise bunch already.

So with decentalization comes communication, otherwise the different parts would be nothing more but meaningless pieces of code fooling other parts :D

After a little while of thinking, we decided to go with XMPP for communication. We know it’s not meant to be a protocol for managing _anything_, but the stanza system works in our advantage, and being capable of seeing “who” is online would get the front-end to see whether or not certain systems are online, etc… Basically, it gets a bunch of the work (thinking-wize) of the grid.

Downside is that we want (or would like to) create a 100% python project. The clients (which would reside in all cores) have got libraries in sleekxmpp, pyxmpp, etc… Choice all the same, and a choice we will make.
The server however we don’t have any libraries that we know of. So we figured we’d create one of our own ^^

Long live insanity

So, bottomline, that server would reside in the part I’m assigned with. It’ll basically become very hard. And I hope I’m up to the challenge :)

Starting to write an XMPP server is not simple. Although there’s a lot of projects online, I figured I’d stay away from that code as much as possible (most of it seems to be C and Java anyway) Working up from the RFC seems to be the best option imho.
I rather call myself idiot and insane for doing so, but I can’t help myself.

Basics

To start, we don’t want to create an entire XMPP server to start with. We only need a server to suffice our needs, being (for starters) basic query / response communication, as well as presence stanza capability. It’s going to be really cool, but identifying users will be yet another story. Perhaps we’ll go configure those systems a bit.

Not that I want to explain the entire XMPP protocol, but since it works the way it does, I’m thinking of using a simple [program_name]@[ip]/[configured_string] , I figured that would identify every program to be an ip, and the string can be used to tie rights, possibilities, etc… to users. To enable more scalability, we shouldn’t be using ip’s, because those can change, and when they do, there should not be a need for reconfiguration. The only configuration should be when the system is deployed, and even then configs should be dummy-size easy :)

Therapy

And to close in totally unrelated matters. I find blogging like this really relaxing. Gets my thoughts together by putting them randomly on a post (and the best thing is I won’t ever lose those thoughts… Ever…)

So, thanks for the session, and I’ll come over on a more regular meeting preferably :)

pySM

In light of a school project, we (me, Tim and Michel) decided to undertake a python project called the Python Server Managment.

The pySM goal

In pySM we aim to achieve a robust, easy-to-use and easy-to-deploy server management application. Our goals are nicely summed up as:

  • Easy to maintain
  • Modular
  • Free and Open Source
  • At least similar functionality as plesk (And better!)
  • File based configuration (vs the database way)

We also intend to give the community (that’s all you guys out there) full support and modules interfaces. We want to unleash the true potential of online server management. To keep things fowing.

Why?

Why we would want to do that will take us back some time. When a lot of annoyances started building up in another (commercial) server management software called plesk.

  1. In plesk, the actual server admin does not have the rights to add services on their own, and try to get plesk support for it. This is something we intend to break!
  2. In the same plesk issues, when changing configuration of any plesk-supported service, without going through plesk, will nullify that change. Which is rediculous at best! We will use a file configuration system, instead of the database system plesk uses.
  3. Needless to say, the fact that plesk is (in our eyes) limited. We intend to get our system the true unlimited key to this world. We intend to make the core, and module API so that people won’t need too much skills to configure basic to intermediate services. For that, we would love your help! :)

So, as you all might’ve noticed, plesk will be our measurement of success. If we come near plesk in the field of technical capabilities, we’re already happy. We’re not trying to break records though… Needless to say, we’ll attempt to test our efforts using plesk, and we _will_ run the software ourselves when we’ve got decent binaries. Thereby we’re telling you we want to give a good product, not only because we have to for school, but because we intend to use it ourselves.

Now, I have jabbled enough, I’m going to code some, I hope to announce more soon! :)

Stop eu software patents

This is a call to everyone out there! As it is, software patents are limiting the development (and quite honestly, all patents in my eyes, but that’s another issue…)

Innovation is being blocked, every open source project will eventually have some patent infrigements out there.

Therefore, stop the eu software patents, it’s innovations only hope in the forseeable future, sign the petition now!

stopsoftwarepatents.eu petition banner

The big I’m going to fosdem post!

And, yes, undoubtedly, I’m going to fosdem next year (2009).

Therefore, the next banner will be present on the website during all that time.

I'm going to FOSDEM, the Free and Open Source Software Developers' European Meeting

Be there, or stop visiting codercpf.be!

PHP – dynamic vars in classes

As I’m all about python, and pythonic is the way I speak any coding language, I had a challenge in finding a way to dynamically implement new variables in a class.

Unlike python, in which this is very simply done by:

class MyClass:
    def __init__(self):
        self.newvar = 'value'
        self.newvar2 = 'bla'

It’s quite the challenge doing something similar in PHP. In fact, even after finding a partial solution, it’s plain _impossible_…
One way, though, to make it seem like you succeeded in that fact, is by using the __get and __set function definitions in PHP. Quite similar to __getitem__ and __setitem__ in python. Especially in its implementation.

The solution

Now, as to explain whatever I was brabbling earlier into clear, simple code, and testing code:

class MyExplainerClass {
    private $data;

    public function MyExplainerClass() {
        $this -> data = array(); // Initialization
    }

    public __get($name) {
        if (array_key_exists($name, $this -> data))
            return $this -> data[$name];
        // Here you can put debugging, error showing, etc...
    }

    public __set($name, $value) {
        $this -> data[$name] = $value;
    }
}

$myTester = new MyExplainerClass();
$myTester -> newvar = 'value';
echo $myTester -> newvar; // value

Now, that’s about everything here to explain. I think it’s clear enough for even the simpelest out there.

MySQLdb insert queries not working?

So, you’re here on some quest to solve an issue where you do any amount of insert queries through MySQLdb but it doesn’t appear in the database?

Well, I had exactly that issue. Took me ages to figure out why after moving an app to another server (with by design the same database, except for a small difference explained later), the app didn’t insert anything (!!), but didn’t give any errors either.
Thinking to myself: “Weird stuff, can’t be happening!”

So, I went on that quest myself.

Solution is quite simple:

import MySQLdb
db = MySQLdb.connect([...])
c = db.cursor()
[ Couple of insert statements ]
db.commit()

This commit is the key. The reason you’re having the issue is probably because you’re using innoDB as the database engine…

trac + apache + mod_fastcgi

So, as the title says, we’re going to install trac on apache using mod_fastcgi.
Now, before we get off, some explanation on why I write this:

As it is, I tried to follow the documentation on the official trac website. But it was unclear, and made me very confused. In the end, someone had to tell me how simple it was before I wanted to believe it in the first place…

In this small post, I’ll assume you have a trac environment configured.

Two steps

Yes indeed, just two steps are required. In here, I’m going to assume you either have a website running already, or you are going to create a virtualhost for trac.

In the end, I’ll post my own virtualhost, so that everyone can reference on that.

Step one

First, you have to “deploy” the trac environment. This is done with the following command:

trac-admin /path/to/env deploy /path/to/apache/htdocs

Now, one thing to really keep in mind is that you cannot deploy in the env directory (or by my experience anywhere near it) It’s best to simply use the /var/www/htdocs most apache setups use.

Step two

Now, we configure apache. In the virtualhost section you want trac to run in, you add the following:

ScriptAlias /trac /path/to/apache/www/cgi-bin/trac.fcgi/

The trailing slash is really important, otherwise the cgi app won’t see the page as argument!

Also, you can alias straight to / if you want, it will work too (if you don’t share this virtualhost with another app)

Note: If you’re running (or going to run) multiple trac instances through apache, you should go to /path/to/apache/htdocs/cgi-bin/ and edit trac.fcgi to change TRAC_ENV to TRAC_ENV_PARENT_DIR:

os.environ['TRAC_ENV'] -> os.environ['TRAC_ENV_PARENT_DIR']

Test it

Albeit this is not the third step (there is no third step), it’s best to take a look and test. But you should see the trac pages coming up pretty quickly, and you should be pleased, for it is the simpelest thing to configure.

As I promised, this is my own virtualhost, just to make sure people might learn from it:

<VirtualHost *:80>
        FastCGIExternalServer /home/user/project/fcgi.fcgi -socket /home/user/project/scgi.sock
        ServerName project.com
        DocumentRoot /home/user/project/
        Alias /media /home/user/project/media/
        ScriptAlias /trac /var/www/htdocs/cgi-bin/trac.fcgi/
        RewriteEngine On
        RewriteRule ^/(media.*)$ /$1 [QSA,L,PT]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_URI} !^/trac.*$
        RewriteRule ^/(.*)$ /fcgi.fcgi/$1 [QSA,L]
</VirtualHost>

Note that this virtualhost is also hosting a django config, and I have added a RewriteRule to make sure /trac isn’t handled by it. Which was a huge stumble point before, and therefore I thank the great people at the #trac channel on irc.freenode.net !

As always, any comments, improvements, or even thanks are welcomed!