wordgroupz development news

For some time now, I have been working on wordgroupz. Since version 0.2, I have added some new features.

The new features include dictionary support: online webster dictionary from dict.org and offline wordnet. For implementing the online dictionary support, I used the server interface of dict.org. For offline, I used the dictionary databases of the wordnet application and the python-nltk library.

I also included wiktionary support this time. I used to find it tedious opening a notebook, browser to search wikipedia/wiktionary, copy-paste notes. That’s why I decided to get them all together under one hood – wordgroupz. I include a gtkNotebook : 1st page for showing, editing details of the selected word and the 2nd page for browsing through wiktionary and downloading pronunciations if available. I had to study urllib2, BeautifulStone, pywebkitgtk for the purpose.

I also worked on the new interface, added some custom buttons to the interface. I studied gtkNotebook, gtkToolbar, gtkStockImage, etc. I also improved some logic for the interface. Now, wordgroupz allows to add words without any groups and such words are put in an “no-category” group. Now, there is a “details” field for group-words. Groups can be deleted. I have to write the code to move the words to the ‘no-category’ group once its parent group is deleted.

I released wordgroupz version 0.3b today. I have to work on machine generated pronunciation for words whose wiktionary pronunciation are not available. I have to design the games and quizzes for wordgroupz. Lots of stuff to do.

Please feel free to try wordgroupz and suggest any improvements to be done.

Details of how to get wordgroupz was given on my previous post.

Advertisements

An introduction to Linux Device Drivers – #1

Today we’ll be discussing a basic c code, the famous hello.c, which will be loaded as a kernel module and discuss some of the basic aspects related to it.

#include <linux/init.h>

#include <linux/module.h>

MODULE_LICENSE (“GPL”); // included in module.h, tells about the license the code is having.

static int __init hello_init (void)

{

printk (KERN_ALERT “Hello, world\n”);

return 0;

}

static void __exit hello_exit (void)

{

printk (KERN_ALERT “Goodbye\n”);

}

module_init (hello_init);     // hello_init is the initialization function

module_exit (hello_exit);     //hello_exit is the exit function

The header <linux/init.h> contain various declarations and definitions related to the loading and cleaning up of modules. The macros module_init and module_exit are declared in the <linux/init.h>. The argument functions passed to module_init( ) and module_exit( ) are executed at the loading and unloading times respectively of a module. The initialization function, basically, sets up the device to be used later. The exit function cleans up the device ( opposite to initialization).

Now coming to the __init and __exit terms used in the code. The __init in static int __init hello_init (void) specifies that the hello_init function is executed only at module load time. The module loader drops the initialization function for other uses once the module is loaded. The initialization function better be static since they are not meant to be visible outside the specific file ( not mandatory though). Similar explanation goes for __exit. This makes the exit function executed only at exit time.

The printk function, at a first glance, might look identical to printf of <stdio.h>, but printk lets you set priority levels for the message, like KERN_ALERT, KERN_INFO, etc. We’ll discuss about them later.

How to compile the code and execute it. Let us assume that you named the source file above as hello.c. Use any suitable text editor to write a Makefile as below :

obj-m    += hello.o

all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
rm -f *~

I hope you have the kernel source in your system. If not you can get the kernel source from kernel.org. If you are using Fedora, you can do:

# yum install kernel-devel

To compile, in the current directory ( where there is hello.c and the Makefile) do :

$ make

Then change to super user by : $su <enter>

and do : # insmod ./hello.ko

If you do : # tail -f /var/log/messages (You can open this in a separate terminal to view the system logs)

then you will be able to see a line saying “Hello, world”. This is what your hello_init( ) was supposed to do at module load time. You can also see the module name “hello” among the list of loaded modules doing lsmod. Now you can unload the module do :

# rmmod hello

Now in /var/log/messages, you will see “Goodbye”. This is due to hello_exit( ).

continued …

An introduction to Linux Device Drivers – #0

I’ll be honest, I am neither a kernel hacker nor a device driver writer, but I want to be one. I am studying the Linux Device Drivers 3, the LDD 3. It is an effort from my end to document what I have understood from reading the LDD 3. There might be some errors or misinterpretation on my part and I will be glad if anyone corrects me. I will be trying to keep the things as correct as possible.

First visit to West Bengal State University, Barasat …

Today, 13th July, 2009, we ( me , i.e., Ratnadeep Debnath aka rtnpro, Kishan Goyal, Meejanur Rahaman, Harsh Verma, Chandana Boral) led by Indranil Das Gupta and Stephanie Das Gupta, went to West Bengal State University at Barasat, Kolkata. We started at around 10:30 AM from Ruby Hospital, and after a long journey ( changing two buses, then riding on a van, with  a few drizzles  on the way), we finally reached Barasat University at around 12:30 PM.

We were then taken to the server room of Barasat University. Indradg got us introduced to the wiring and connections in the server room,  the big UPS, the batteries being charged by the UPS, the mechanism for providing back up during power cuts, switching between the two ACs periodically and finally the HP Blade Server.

The UPS is a Liebert GXT-MT 6KVA UPS with a OpenComms Web Card. The OpenComms Web Card delivers SNMP (Simple Network Management Protocol) and Web support to the UPS in which it is installed. Then we were acquainted with the network configuration of the University Network ( wifi + lined connection).

Next job was to download the Fedora 11 repository. We brought in another computer, placed it in place of the server and installed Fedora 10 in it and started working. We were given the required bandwidth and my job was to start the rsync. But it didn’t go well with me. I was confused with how and where to start. I did rsync locally in earlier instances and not over the internet. I started with the man page. Then googled about “rsync”. Found some good documentation at http://fedoraproject.org/wiki/Infrastructure/Mirroring. It mainly dealt with setting up Fedora mirrors and how to enable rsync in them. But what I needed was just use rsync to pull Fedora 11 repository. It was quite some time, I was still stuck. Got some suggestions on configuring rsyncd.conf file, I was again redirected to the above link. Then we had some lunch and break.

I again sat working on it. Again went through the rsync man page. I found that,

$rsync [options]

gives a directory listing of the source directory. Chose rsync://ftp.riken.jp/fedora as the source. Found its directory structure using

$rsync -auvr rsync://ftp.riken.jp/fedora

I created the directory structure in my current folder ( here it was /home/$USER/f11_repo/). Now I started pulling Fedora 11 i386 release packages in the following way

$rsync -auvr rsync://ftp.riken.jp/linux/fedora/releases/11/Everything/i386/os/ /home/$USER/f11_repo/linux/fedora/releases/11/Everything/i386/os/

and it started syncing the source and destination directories.

Then we also started downloading the rpmfusion_free repositories for Fedora 11 using wget. Indradg wrote a shell script to automate the download of rpmfusion/free repository using wget. We also used screen to run the two processes in different screens so that they can be monitored remotely.

$screen -R [screen name]

In the mean time, others prepared some “Do not disturb, work in progress” labels and put them on the running computer, the server room door, etc. to make sure that no one messes with the running computer.

It was around 5:30 PM that we finally packed up. We got into the University Bus and reached Ruby Hospital at around 7:30 PM.

It was a long long day :).

Install Windows Games in Linux with PlayOnLinux …

Hi all… I have a Dell XPS M1530 running on Fedora 10. It has got a 2 GHz Intel Centrino Duo processor, 2GB RAM, 256 MB Nvidia GeForce 8600M GT, quite a configuration for decent gaming. But till today I had to boot in Windows Vista to play games. So I have been trying to install and run Windows games in Fedora. There are a few tools for this purpose. The famous and proprietory and non-free Transgaming Cedega, Codeweavers Crossover Games and the all free PlayOnLinux. All these use wine which is a free software for running Windows applications in Linux. Though paid, Cedega and Crossover Games don’t support as many applications as PlayOnLinux. And when you are not sure that whether your games are going to run or not in Linux, wine and PlayOnLinux is the free and good option to stick to.

PlayOnLinux has got a lot of .pol scripts to automate the installation of games, but they require that the game’s installation source is in a cd/DVD ROM. I tried installing from the game ISO mounted or from any local folder, but failed till yesterday. I did a bit google and tried to read the .pol file and found that games can be installed from a source folder of the game without it being on a cdrom. Here’s how to do it:

1. Open playonlinux, its better if you open it from the terminal, it gives many useful information :

$playonlinux

2. Select Install.

3. Then select “Install a .pol package or an unsupported application“.

4. If you don’t have any custom .pol package select “Manual installation” and click “Next” .

5. Do as directed, then under “What do you want to do?” select “Install a program in a new prefix”  in case you are installing the application for the first time. Select “Edit an application already installed” if you have to update your installed application like patching it to a newer version, or installing mods, or other packs, or may be other support softwares like DirectX, etc.

Select “Delete a prefix” if you want to delete an already installed application (wineprefix)

6. Do as directed.

7. “Do you want to confiure your prefix before installing your application?”

If you want to configure wine before installtion, select “Yes”, otherwise “No”

8. “Browse the file to execute”

Browse the setup.exe (or whatever for your game) in the game source folder, and select Forward.

9. Then follow the onscree instructions and finish the installation, and allow creating shortcuts (if you want…)

10. Now you will be able to see the installed game in Playonlinux window. Select the game, and choose “Configure this application“. Use the “Use advanced wine configuration plugin” to do some wine tweaks. You get the options of configuring

  • DirectDrawRenderer
  • UseGLSL
  • VideoMemorySize
  • OffscreenRenderingMode
  • RenderTargetLockMode
  • Multisampling
  • MouseWarpOverride

After configuring these based on the hardware abilities on your system, you are almost done.

11. But still we don’t have DirectX installed and without these, the DirectX requiring games will fail to run. You can either Install DirectX manually via PlayOnLinux and choose the concerned prefix of the game which you want to update.

Or you can just copy some dll files from the Windows/System32 folder if you have Windows installed in your system, or you can get from your friend’s computer running Windows and having DirectX 9.

Playonlinux has got a lot of supported games, and you always have the option of adding new games to the list.

DGPLUG Fedora Activity Day … Day 1, 14 May 2009

The Linux Users’ Group of Durgapur, i.e, DGPLUG conducted a Fedora Activity Day in Dr. B. C. Roy Engineering College, Durgapur. Though it was planned to be a 1 day FAD, it got extended to one more day, i.e, 15th May 2009. The people working for this FAD to happen are Harsh Verma, Kishan Goyal, me , i.e, Ratnadeep Debnath (rtnpro), Subhodip Biswas, Arindam Ghosh, Meejanur Rahaman, Dibyanshu Jaiswal. Also, we had Rangeen Basu Roy Chowdhury with us. And also Arpita, Amrita, Debashree were there to talk on Inkscape. There was also with us Sunny Sharma, another FOSS enthusiast.

The event began at 12:00 PM in the Computer Science Department Lab No. 207 of BCREC. Projector and other necessary things were arranged beforehand by the DGPLUG volunteers working for the event. The Lab computers ran on Live Fedora Electronic Lab DVD, and a few ran on FEL Live USB. Around 25 students from various Departments like CSE, IT and ECE participated in the event. The event began with Arindam Ghosh talking on the Fedora Project. It was followed by Kishan Goyal speaking on “Myths about Linux busted with Fedora”. In between, whenever needed, Subhodip Biswas elucidated some of the topics being discussed. This was followed by a presentation on Inkscape by Amrita, Arpita and Debashree and a hands-on session on Inkscape. This was followed by me, Rangeen and Sunny giving a demo of KDE to the participants. It was around 2:10 that the 1st session ended. Then there was a break.

It was around 3:00 PM that we resumed the session. Rangeen then started with the introduction of IRC to the participants and soon Arindam and Subhodip joined the discussion. An Airtel Mobile Office Connection was arranged for the purpose. Since Airtel does not allow IRC clients like ChatZilla, X-Chat, etc. we had to use http://www.mibbit.com for the purpose. The participants were shown how to use the IRC. Shrink (Shreyank Gupta), Roshan08, mbuf (Shakthi Kannan) were online that time and took part in the live demo of IRC. The particiapnts were told about IRC ettiquetes.

It was followed by Rangeen’s session on Fedora Electronic Lab. Rangeen prepared some cool slides for the purpose which made the students interested in the topic. He showed them various cool FEL tools and did some small exercises on them with the students. The session was great except for the unepected power cuts that disturbed the session. Finally the FAD Day 1 was wrapped up at 4:30 PM. The participants were very enthusiastic. It was announced that the 15th May is going to be a day long session on Programming ( c, java, etc.) using FOSS tools.

After the session enden, Rangeen left for Bankura. We went back to our mess happy and exhausted.

Pictures of today’s eventw will be uploaded soon.

How to make a custom Fedora Linux Distribution

The following is a nice tutorial on how to create a custom Linux Distribution .

IconPCPlus has a tutorial on building your own Linux distribution with the customizations you want, derived from Fedora, using the graphical interface called Revisor. “We’re used to thinking of Linux distributions being set in stone. They’re either KDE or Gnome, use a certain kernel and bundle certain applications. But this doesn’t have to be the case. If you find yourself making the same adjustments each time you install a new distribution, it’s worth creating your own customised version. Revisor is a tool that lets you do just this, and in this tutorial, we’ll show you how.”