Latest Publications

Linux: start new X with WM

Tried to keep the title short. In this article I’ll be trying to explain how to start a new X screen with some WM in it.

I wanted to use it to launch a new X screen for gaming purposes.

The code

In a nutshell, this is code that resembles the most basic functionality of startx (without the use of xinitrc of course). I found a serious lack of documentation about this… Although it is far from hard :)

Xorg :1 -ac -config xorg-game.conf &
DISPLAY=:1 openbox

This is actually really basic. It basically tells Xorg to start a new screen. Instead of :0 (standard), this will launch on :1 -> next we only need to make a wm (in this case openbox) start in that screen.

The script will take you directly at the new screen. Getting back at your first requires ctrl+alt+f7, your new one is at ctrl+alt+f8, and the next would be at ctrl+alt+f9, and so on.

PySM: sending IQ stuff

So, using sleekxmpp to send IQ set / get is quite simple, but requires some manual labor…

This is what I came up with, it’s all quite arbitrary, and can be put in a function easily. But at least now I finally figured out how to send IQ stuff. Receiving some might prove harder…

# Because the backbone works with this... >.>
from xml.etree import cElementTree as cET
[...]
iq = self.makeIqSet()
iq.attrib['from'] = self.fulljid
iq.attrib['to'] = 'test@localhost/bla'
query = self.makeIqQuery(iq, "pysm:iq:shutdown")
shutdown = cET.Element('shutdown')
query.append(shutdown)
shutdown.attrib['when'] = 'now'
self.send(iq)

The shutdown stuff is nothing at the moment, it doesn’t really do anything. The current server just displays the received xml…

Theme day 6: pySM + archer startpage

The 6th day is already nearly finished, and I haven’t really posted anything about it yet :o

So, as the title says I’ll be (have been) working on pySM and the archer startpage

Startpage

The startpage is now finally finished for as far as I wanted it. However, it’s possible that I’ll be adjusting the theme to a darker one.

The html entities are decoded, so everything in the feeds will be displayed properly in the pages. Links are clickable like they were for archlinux, titles are clickable to go to the original page, etc…

If there’s any comments on the layout, hit me at the forums

PySM

There’s little work been done this morning. However, a lot of work will be done on this from now.

Although I consider this version of the XMPP server complete enough to function in a simple environment, a lot of work will be required to get it at least scaled to a presentable result. Also, currently, I have no idea on how to make 2 clients communicate, so I won’t be able to patch through the most essential things at the moment. But since I can now connect, and test clients, I’ll be focussing on getting clients connected, and having clients send through valid iq requests. This shouldn’t be hard, but since I’d like to go on with sleekxmpp it might require some adjustments to their code to make that easier.

After that, I should still have some time to focus on module management. Since I’d like to have a sort of eventhandler in the server, those events will be linked to a module, which in return will be loaded and maintained by a module manager. So perhaps it’s not really the most difficult part, but it should work good, and be quite pluggable.

When that’s done, I hope to have some time left to figure out some way to have 2 clients communicate through the server. Patching through messages and iq requests and responses.

Anyhow, a lot of work needs to be done, and it’s not going to work itself, so I’ll be starting now :)

PySM: XMPP server connection established!

I’m totally surprised :) I managed to get my XMPP server implementation to a level that I’m capable of connecting with an XMPP client written in sleekxmpp!

The current result:

4841 cpf@phoenix % wc -cmlLw server.py
273   680 10520 10520    82 server.py

Translated:

  • 273 newlines
  • 680 words
  • 10520 bytes (and thus 10520 characters)
  • Maximum line length of 82 (which is not optimal, it should be 79…)

I feel quite satisfied. But I’m directly moving on. I’m going to see if I can scale sleekxmpp to send iq requests easily. Because that’s what our servers will probably do most of the time :)

After that, I’ll be looking into creating a class to manage, maintain and load modules dynamically and such. Will keep y’all posted :)

Archer startpages

So, in reaction to a post on the archlinux forums I created a small page on codercpf.be which hosted some static files best compared to an “archlinux startpage” at arch.codercpf.be

Now, because I wanted to create a startpage with the news updates and package updates too, I created such app in Django. It’s hosted at archer.codercpf.be

It was pretty easy to create, practical to start off, but damn. I hate django’s deploy stuff. I HATE IT. Constantly having problems with the media stuff.

Anyhow, now’s not the time to rant about it. I know the django devs are working hard to make django better and better, and I really like it.

So, the source is released in the public domain here: archer.codercpf.be/stuff/archer.tar.bz2 there’s not really a license, the code is simple enough :)

Theme days 3, 4 and 5

So, theme days… Lots of themes I forgot to post (more like I didn’t really have the time)

Theme for day 3

So, day 3 was another cleaning day. It wasn’t really intended to be a cleaning day, but since my mom really wanted to get my desk out of the house and replace it with a different setup, I kind of was pushed into cleaning…

The result is estounding though, lots and lots of work has been put in it, but right now, my desk is bigger, cleaner and all around me, I have more space. That + I now have greater freedom, and movement makes me feel a lot more productive (It’s the feeling that counts ^^)

Theme for day 4

Day 4 was kind of a cleaning aftermath + pySM day. Since the cleaning we had a lot of stuff to throw away (because they were absolete), and it’s still an ongoing process of course.

After that we did pySM for a long-long time… Tim came by and we were going forward on our respective parts. We had long and hard discussions on how to deal with some of the problems we were facing. A lot of progress was made, especially in the area where we discussed a lot of stuff ^^

Another problem pySM seems to face is our third developer. We haven’t really heard much of him, and we constantly need to remind him to continue developing. We gave him a part of the project that is equally important as our two, but less hard (mostly data storage, comparison and retrieval).
Granted, he wasn’t (and still isn’t) really up to speed with python, and it’s been a lot to process on his part these past few weeks. However, seeing _no_ progress at all isn’t really positive. He keeps telling us he’s trying to figure things out, and he’s trying to build testcases. Which we’d love to believe, but we don’t see any proof + he doesn’t seem to commit to svn. I’ll be bugging him later to commit more.

Theme day 5

I guess when my count is correct, that should be today.

So todays theme is mostly about pySM. I’ve been making great progress on the XMPP server, although it’s currently only static progress. The server isn’t really dynamic at all. It just responds conditioned to certain requests. When those things work properly, I’ll be working on making things more dynamic, pluggable since we’ll be needing modular more than static. However, progress is progress, and especially in understanding the protocol the progress is huge.

Aside from that, when reading the archlinux forums I found a post about a start page for archlinux. Kind like the firefox startpage, but with searchoptions for google, archlinux forums and archlinux wiki.
So that really intrigued me and I set up that page at http://arch.codercpf.be/ because I already have a home page (speed dial) on firefox.
Like this, I still have the functionality featured by the start page, and the speed dial.

So, I cleaned up the code some and I’m thinking about putting a small rss reader and small database in there written in django. It would be great to polish my django skills on a small project. I’m just going to figure out how to deal with the rss reading. Since my host supplies a simple cron interface, I assume it’ll run like that.

So, I got something to play with, and y’all are thanked for the great support recently!

Theme day two: Cleaning

More specifically, I’m going to clean my desk. It really needs cleaning, saying it’s a dump would be an understatement!

I’m all set op for some hours of cleaning. Music loud enough (but not too loud, wouldn’t want to have police at my door…)

After cleaning (perhaps in between, when I get sick of it) I’m going to do some french. And some more french, because I need to make up for lost time of yesterday. I forgot to do my french that day :o

On the bright side, I did wake up at a more decent time. I wanted to wake up at 8 o’clock local time. It was ~8.30 when I got my ass out of my bed. So that’s actually quite acceptable.

Wish me lots of cleaning luck :)

PySM: creating language files

Creating language files in a project has been proven _very_ simple in our pySM project.

How the files are stored are not really the issue. The issue is how to most easily create the link between the display (strings) and the language.

For sake of demonstration:

lang_en = {'no_such_server': "No such server",
    'unavailable': "unavailable",
    'extra_blabla': "some more shizzle", }
language = lang_en
print("%(no_such_server)s" % language)

Now, this is for a so called “english” language array. But if said array were to be translated to another language (e.g. dutch):

lang_nl = {'no_such_server': "Server bestaat niet",
    'unavailable': "Niet beschikbaar",
    'extra_blabla': "Wat extra zever", }
language = lang_nl
print("%(no_such_server)s" % language)

So. Python proves his power _again_ in using this simple feature in everyones advantage!

# update:

It has been noted by my loyal friend that language files might be empty or be non-existent. Which is indeed quite correct.

The solution for that would be to create a standard “english” (since most people understand that) dictionary, and have another dictionary “merge” into the default dict.

The advantage of such approach is that when there’s an update, not all language files / dictionaries should update immediatelly. They can remain outdated, in a way. Because the merge would only replace the already existing keys in the old dict with the new values from the new dict.

Example:

# using above lang_en and lang_nl
language = lang_en # establish default, lang_en would then be hardcoded
language.update(lang_nl) # merge both dictionaries
print("%(no_such_server)s" % language) # Server bestaat niet

If at any chance an update is established and a key doesn’t exist in lang_nl, the default value in lang_en would be used.

Thanks @Tim for helping me here :)

PySM: SASL communication

So, as announced earlier, I’m working on PySM this entire day (with of course the exception of couple of relax hours etc…)

As I’m going, I’m learning a lot… It’s amazing how hard simple things can be.

Currently, I nearly have my SASL communication part of the server done… I’m actually excited, because that’s how far I wanted to get for the day. Seems I’ll be getting a bit further (since I don’t want to stop now)
Who knows, I might even be capable of setting up the more advanced stuff soon.

I’ll try to scan for other XMPP servers in the LAN subnet when I’m through with the basic XMPP server implementation. The idea is that every system server will try to see whether or not there’s an XMPP server running. If not, it should start one and connect to that. If there’s already an XMPP server in the network, it’ll simply connect.
I hope this makes it capable of scalability. I also hope this doesn’t go on and conflict too much when all the system servers are being started at the same time. I might have to provide a protocol for that (continuous scanning perhaps)
Also, it might prove a bitch to have multiple subnets/networks. Because those servers won’t be able to find each other (unless I start scanning a lot more than I’m supposed to). I guess not everything can be working out of the box… Can it?

It will prove quite the learning experience trying to solve scalability problems. But at the moment, I’m just trying to figure out basic stuff, so the challenge here is not to over-engineer this right here, but to build basic blocks, and go from there :)

Thanks for reading, the psychology is improving here :D

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