Since 2003, I’ve been maintaining a forum. It was constantly growing, from 60 users to 1800 at the time of writing. As the forum was growing, the demand for moderation work was growing as well. I recruited moderators from the most active and trustworthy users. It helped maintain the order on the forum, but the load on the moderators was constantly increasing.
While learning about the new Web 2.0 services, I got an idea of finding a forum engine with tags. I found a mod for phpBB, which adds tags, but I must confess that I don’t particularily like phpBB and want to move out of it.
Continue reading “Forum with tags”
After few days of building a database browsing tool with Django, I must say: Django is brilliant!
I have set up browsing for all the major database entities: hospitals, surgeons, patients, operations and factors (a factor is a disease, procedure, etc). The database browsing website is intensively interlinked. Every hospital, surgeon, factor, etc is linked, so you can click it and follow to information about it.
Almost everything was done using the generic views, which means that I didn’t have to write the views myself. I decided to migrate the data instead of using the legacy tables directly. It required a bit of work with migrating the data, but I wanted to have pure Django-generated tables. Besides reading the Django documentation, what I have done was:
- Write models for my data: Hospital, Surgeon, Patient, Operation, Factor
- Move the data from the old tables to Django tables
- Generate slugs for nice URLs (slug-is-this-king-of-string)
- Design URLs (/hospitals/, /hospital/CODE/, etc)
- Write templates (hospital_list.html, hospital_detail.html, etc)
The next major task will be creating the “related factors” view. It seems like I’ll have to write a custom SQL query for that. The question is: having a given factor (tag), what else factors are associated with patients with my given factor?
I decided to revive my idea of the database exploration tool. It won’t be static HTML files generator, it’ll be a mod_python based web service. Sometimes I wonder, why such tool wasn’t developed before. Now, since I’m starting to make the analysis, I’m becoming a real database user, not an administrator.
Despite I try to create a general tool for the data analysis, I can’t avoid looking at the data directly. I need to examine the data in many ways, and it’s often necessary to look at the specific patient histories to find out, if a special combination of factors was an data entry error, special case or a kind of case that wasn’t considered before.
I want to have trendy URLs, like:
First thought was the mod_python and all custom code, but after some research, I decided to try Django. Its homepage says:
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
The tutorial showed how to get a simple poll service in no time. It deals with the database structure as well. I’ll need to build a Django model for my database and port the data, and then I’ll be able to build a browsing interface very fast. And I’ll have my trendy URLs.
I had to create a customized GNOME menu for all users in the system. At first, the concept of .desktop files was a bit mysterious to me, as they represent more abstract way of dealing with the desktop menus. Then I found Smeg, the GNOME menu editor. I created a menu, but then I couldn’t find where Smeg has placed the files. Then I found the Desktop Menu Specification, which is implemented in GNOME 2.12. Reading it on, I learned also about the XDG Base Directory Specification, which helped me to find out, where does Smeg put created menu entries.
The idea was: create a Debian (Ubuntu, more precisely) package which places some files in the system. The expected result is a new menu visible for all users. I found out how to create a new menu which would contain my menu and include the original system menu. The problem was how to create a system-wide environmental variables. In Slackware, I would create a file in /etc/profile.d with appropriate entry. Unfortunately, Ubuntu does not have such directory. There is a file called /etc/environment that by default contains language settings. It can be used to set system wide environmental variables.
Finally, I created entries with Smeg, copied files to public readable directory and set two variables (XDG_CONFIG_HOME and XDG_DATA_HOME) to point at appropriate directories. Result: system wide menu contained in separate package. The only problem is to edit the /etc/environment file. I would prefer to do the task by only placing files, without any editing. With file editing, the package has to contain scripts that insert the entry on install, modify on package update and remove the entry on package delete. With files, the package manager does this task.
Ubuntu guys, please introduce the /etc/profile.d directory.
UPDATE: Since this post is becoming popular among people who search for how to create a custom menu, here’s a recipe for you. Please note that the current-user menu editing is trivial, Smeg does everything. This is about how to create a system-wide custom GNOME menu.
- Run Smeg (install it first, perhaps) and create your menus.
- Examine the files:
- Move the files from ~/.config/menus to a system-wide accessible directory, for example /opt/mymenu, so you get /opt/mymenu/config/menus
- Move the files from ~/.local/share/applications and ~/.local/share/desktop-directories to a system-wide accessible directory, for example /opt/mymenu/share, so you get /opt/mymenu/share/desktop-applications and /opt/mymenu/share/applications.
- Set a system-wide environment variables. In Ubuntu, you can use /etc/environment for this. In Slackware, you can use /etc/profile. In Gentoo, you can place a new file in /etc/env.d (I like it the most: just place a file, is all). The file should set two environment variables:XDG_CONFIG_HOME=/opt/mymenu/config
- Restart the computer so the new environment variables start to be visible system-wide.
Those menus should appear in KDE as well.
If you like this HOWTO, please digg it!