Ruby weekend

I had a really great weekend. We had lights, and because of the rains I couldn’t really go anywhere. So I stayed at home and programmed.

I’ve been working on a forum server lately. My idea is to create a forum application that does not run in the browser. Well, point of correction: you can (or will be able to) a front-end that runs in a browser. But, as my friends know, I really don’t like applications that run in a document reader. So I intend to write a client in Qt4.

So far the server allows you to manage members and forums. It also does session management. You can’t create threads or write posts quite yet, but I’m getting there. I’m currently using XML-RPC for client/server communication and PostgreSQL as the database backend. Once the server is working I can think about abstracting the database layer.

One other thing I’ve been working on for quite some time now is a project I’ve simply called “Source Lab”. As most programmers, I’ve written a large number of small programs, or maybe I should call them code snippets, usually to test new features. Since I always used to keep these snippets in obscure directories under ~/tmp, they tend to get lost everytime I do a major clean-up.

I wanted to make sure all my small programs and snippets don’t get lost, so I created Source Lab. My first and currently only Source Lab is the Ruby Source Lab. It’s started off a just a collection of Ruby scripts organized in directories. Then I got the idea to have a system for navigation through the mess. So I started creating HTML documents.

But, being lazy, all the typing quickly got on my nerves. So I wrote some more Ruby, this time to help me manage my documents. I wanted to insert my Ruby scripts in the HTML pages I created, and of course I wanted them to be syntax highlighted and line-numbered. I also wanted to be able to capture the output of running the programs, and stick that in the pages as well. In many cases the programs are interactive, that is, the program will prompt the user to enter some information.

Thanks to Ruby, and various other tools, such as GNU source-highlight, this turned out to be a breeze. For interactive scripts I just use Ruby’s PTY module, and I managed to create a generic script that seems to work well so far. Now all I have to do is create a small HTML skeleton, with macros at the places where I want to insert a Ruby script or command output, and the make utility will generate all the pages for me.

One other thing I managed to do this weekend was to compile the Qt4 bindings for Ruby. Haven’t had a chance to play around with them much yet, but at least the samples ran well. Hopefully, I’ll get some time during the week to start tinkering with Qt4 in Ruby!

Published in: on 2006.09.11 at 08:02  Leave a Comment  

The URI to TrackBack this entry is:

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: