Arindam’s Weblog

Entries categorized as ‘Programming’

Update 101: “The magic has begun”

May 30, 2008 · 5 Comments

All these days i was continuously working setting up the infrastructure ready, doing custom setups and testing things for the i18n of openstreetmap, more precisely setting up internationalization in rails which will comprise a major chunk of my gsoc project.

I started off by setting up an osm local install on my desktop earlier this month. That was something because there different set of things to look after and configure each of them properly. I got little stuck with the mod_tile thingy…the configs. I just couldn’t find where was some hard-coded paths renderd daemon was trying to access. Thanks to TomH & Alex, for mentioning about gen_tile.cpp. I thought all of these paths should be placed in render_config.h and even made a patch of it (to ease my work) but later learnt and/or realized that they are meant to serve some greater purpose like module options actually.

So, crossing all this, when rails together with mapnik powered on for the first time i was awestruck. I just wanted to laugh…whew!! Then after some discussions with my mentor Mikel Maron, we looked up at the different options available. He gave me a comparative study of different ways to internationalize rails. I kinda liked two amongst them namely, globalize-rails and ruby-gettext (which i had proposed earlier). So as planned, I somewhat did some quick hacky test setups to test both of them. Though they weren’t free of problems, but as of now, i simply like the robustness of globalize combined with click-to-globalize plugin. Also the the fact that globalize currently supports more languages give it a plus. Sven Fuchs has written some really cool tutorials….thanks to him because i don’t know for some reason whatsoever i’m not getting the www.globalize-rails.org. Anyway, the current state is i’m trying to setup globalize in the rails_port of osm now. Its’ bound to have lots’ of problem…need to fix them. Another concern is that about the translators’ accounts. Whether it will be wiki-like so that anyone can put up translations or the traditional translation groups somewhat moderated. Though this will come at a later stage.

In the meantime, i actually upgraded my desktop to an E8200 2.66 GHz proc. + DG33FB motherboard + 2 GB combination and its’ showing some real power. So, another ordeal that came up of nowhere was shifting the entire setup to the new hdd. It made me remember of the osm vmware image that Milo van der Linden talked about in the early stages of the project. There was some real hike in the rendering speed compared to my 5-yrs old celeron 1.7 GHz mobo.

But now, my 6th semester exams are scheduled from 3rd-13th of June and i’m really getting low working hours now :( I will also put up a wikipage regarding i18n sooner than later. Loads of work still left…

Among other news, my activity oriented tutorials are up on the edu.kde.org …lots of thanks to Anne Marie (annma) for putting them up. I just love the logo guy pointing to the tutorials. Hopefully, i’ll try to put more of them. And more recently Debayan from NIT-DGP has put up the 3rd ntp pool server for India (with my WBUT starting the spur as always). I can now three ntp servers in http://www.pool.ntp.org/zone/in.

Update: Also as a matter of fact, globalize-rails now supports much more languages compared to ruby-gettext. And when combined with click-to-globalize plugin, i can see that we can even actually chip in translations from a WebUI….which is pretty cool :)

Categories: FOSS · GSoC · KDE · Linux · OpenStreetMap · Programming

i18n in OpenStreetMap

April 23, 2008 · 2 Comments

Yesterday, as an interesting twist of events my Google SoC proposal for OSM was accepted. Its’ about “Internationalization setup of osm web pages and map tiles“. Thanks to my mentor Mikel Maron and the entire OSM community. Its’ going to be a rocking summer :)

Internationalization of openstreetmap have diverse aspects hidden in it ranging from web pages localization, rendering localized map tiles including rendering of complex Indic scripts. And we will take up a phased approach and see what’s possible within the stipulated timeframe.

Categories: FOSS · GSoC · Linux · OpenStreetMap · Programming

Insight into KGeography

December 26, 2007 · 8 Comments

KGeography is a geography learning tool integrated with KDE-Edu. It helps a student to learn geography in a playful way. But it still doesn’t has all the maps as yet. How to add them? For adding a new map in KGeography, we need two things. One, the map (say in a file called mapname.png) and secondly, a kgm file (whose name should be mapname.kgm) to integrate the map with kgeography. Once we have them we can easily add them in its’ home directory (default: /usr/share/apps/kgeography). Now, what kgeography does is an image-processing. It distinguishes a division of the map by its’ RGB values. Then it identifies the division by Name, Capital, Flag etc parameters given in the kgm file for that division.

So, for adding a map we need to do following things:

1. First, create the map using GIMP, Kolourpaint or any other picture editors. Getting a political outline will be the best idea. I couldn’t get one atleast for India. So a good idea will be superimpose a blank outline map over a descriptive political map (in two layers to be precise). Assign separate colours for every division. Care should be taken that no two regions should have same colours. Ofcourse, handdrawn & scanned political outline maps may be an option and there is no real restriction on the scale of the maps.

2. Next, comes the integration part or the kgm file. So lemme show the basic structure of the .kgm file:

<map>

<mapFile>mapname.png</mapFile>
<name>MapName</name>
<division>

<name>DivisionName</name>
<flag>flagname.png</flag>
<capital>CapitalName</capital>
<color>

<red>255</red>
<green>255</green>
<blue>255</blue>

</color>

</division>
………………………….
//Other divisions
………………………….

</map>

A kgm file begins with <map> and ends with </map>. Inside of those tags there are:

  • <mapFile> and </mapFile>: the name of the file (without any path) containing the map image, e.g. “india.png”.
  • <name> and </name>: the name of map, e.g. “India”.
  • A <division> and </division> for each division in the map.

Now, each division has these tags:

  • <name> and </name>: the name of the division, e.g. “West Bengal”.
  • <capital> and </capital>: the name of the capital of the division, e.g. “Kolkata”.
  • <ignore> and </ignore>: can be set to yes, allowClickMode and no. If this tag is set to yes then the division will be ignored when asking for divisions in that map. It is then as if this division does not exist in KGeography quiz modes. If this tag is set to allowClickMode then KGeography will ask for the division in the Click Division in Map… mode but not in other quiz modes. Setting this tag to no means the division will appear in all modes (browse and quizzes). This tag is optional and when there is no <ignore> tag that means as it is set to no. For example “Egypt” has this tag set to yes in the “Asia” map which means that “Egypt” will not be part of any quiz in the “Asia” map. Also this tag is set to yes for frontiers or oceans.

<division>

<name>Not a Nation</name>
<ignore>yes</ignore>
<color>

.........................................

</color>

</division>

  • <flag> and </flag>: the file (without any path) containing the flag of the division, e.g. “india.png” in asia map. This tag is optional. Not needed for the divisions whose <ignore> tag is set to yes.
  • <color> and </color>: the color the division has in the map.

The color is defined using three tags:

  • <red> and </red>: red component of the color. Valid values are between 0 and 255.
  • <green> and </green>: green component of the color. Valid values are between 0 and 255.
  • <blue> and </blue>: blue component of the color. Valid values are between 0 and 255.

All names should be in english. But when number of divisions are too much it will be better to automate the task of creating kgm file with a bash script (will post lil’bit later). I checked out the helper tool in kgeography handbook which wasn’t effective enough even on the existing maps.

Update: Now, this post may not be enough to dive into this work. So, I created a sort of presentation concentrating on how to add the map of India. It’s still unfinished. But you can have the first cut from here: [http://makghosh.googlepages.com/addmaps.pdf]. The best way to see it is as a presentation in kpdf.

Well, I divided the task in 3 days:

  1. Day 1: Create the political map of India (done)
  2. Day 2: Color the divisions of the map (done)
  3. Day 3: Create the .kgm file (not completed)

Have fun!! And do post any comments or improvements :)

Categories: KDE · Linux · Programming · Tutorials

Problem with ltspinfo!!

September 3, 2007 · No Comments

Lately I was trying to create a shutdown/reboot module for Fl_TeacherTool. I recently talked with its developer Robert Arkiletian and realised that “ltspinfo” can be accessed by non-root users even. The shutdown/reboot module is a cool feature for fl_teachertool but would create a problem if non-root users gain access and shutdown terminals at their will. But this problem has to solved. So, I am analyzing the code of ltsp-ltspinfod and may make changes in it as required to curb this problem.

Categories: LTSP · Programming

Shutdown module in Fl_TeacherTool

August 29, 2007 · 1 Comment

In the recent implementation of LTSP for Bijra School Project (in the ambience of WBUT LIbrary) we have used Fl_TeacherTool for global control over all the terminals. Now I found that in Fl_TeacherTool we can do everything except Shudown/Reboot the terminals. These two things we have to run from command line using #ltspinfo (ltspinfo) which is a module that comes with the LTSP iso. But for people over there in the school (even for the teachers over there) it is a difficult job to run ltspinfo from shell. So i thought of designing a good UI for this and integrate it with the Fl_TeacherTool. I am writing down a shutdown module for Fl_TeacherTool in Qt. The core thing is that I will insert a Shutdown/Reboot button in Fl_TeacherTool and that in turn will open a GUI. A screenshot is given as follows:

Shutdown Module!!

This is just the basic structure of the module. Now, I will work on the following things:

  1. Replace the text box based input with a dropdown menu in which we can select one out of the currently logged in terminals. But, this will be done only after the text box-based one works fine.
  2. Add Shutdown/Reboot button in Fl_TeacherTool. The dialog can work independently quite well. But its integration with Fl_TeacherTool needs lots of work.
  3. Link all the events properly.
  4. Also work on the look and feel of the GUI.

Last but not the least, I chose Qt for this because it can do cross-platform jobs efficiently.

Categories: FOSS · LTSP · Linux · Programming