Monday, August 3, 2009

A Sample Process Calling Example

I used gnokii to send sms. So I need to execute the command from my code.

/usr/bin/gnokii --sendsms 8801712273933

So at first, I installed gnokii in my Ubuntu 9.04. Then
I copied the gnokiirc file from /etc to my home folder and renamed it to .gnokiirc
I opened the file and did some change to it. I was using my Siemens SK65 with a data cable.
I did some tweaking to my .gnokiirc file. All # signs indicate comments. I removed hash sign from some lines. Those lines are:


port = /dev/ttyUSB0
model = AT
initlength = default
connection = serial

As my model isn't supported officially by Gnokii so I added a hash sign before the "model = " line.
Then
I run this command in my console.

gnokii --identify


The output is something like this:
GNOKII Version 0.6.26
IMEI : 354784000367194
Manufacturer : SIEMENS
Model : Gipsy Soft Protocolstack
Product name : Gipsy Soft Protocolstack
Revision : 50,"OFFICIAL","2005

Then I wrothe C file sample.c












When I run this file, a new process is opened and gnokii --sendsms command is executed.After sending the SMS the process gonna close. The phone number in the code is the receiver of the message.
For more info, log into www.gnokii.com

Courtesy : Burhan Uddin


Algorithmic Aspects of Shadhinota (English to Bengali Dictionary)



The most crucial part of building a dictionary is to make an efficient searching technology. There are several ways to keep the words ….May be SQL database, XML data or simple text file. I prefered the text files to keep my data. I want to build a simple desktop utility for general users. I don't expect a general user should install a database software in order to use my dictionary. I aint very good at XML stuffs. So one way is open for me, that is to use text files.

But the main problem of using text file is to maintain the efficient algorithm. I used a simple concept for searching the desired words. Here we go now....

At first I used 26 directories for 26 letters of English alphabet. Every directory has some text files...suppose ab.txt, ac.txt,a.txt......etc. Here ab.txt has the words a, absent,abstract.... every words having the prefix of “ab". Now when I enter a word in my dictionary, at first it goes to the corresponding directory according to the first letter and next it goes to the corresponding text file. Now the second problem arises. One word can be used more than one time in a text file. For example:

The pattern of the text file may be like this
Word Meanings

Country Homeland,Motherland,Home..........

…....
…....
…....

Home House, Place of Accomodation ....

My dictionary searches the word and if it finds the word in the file then print the consecutive words and stop printing when it finds new line. But if same word is used more than once the total process get messed. So I need to distinguish the searched words from others. They need to be unique. I simply added a numeric character before every searched word. Now the text file will be like this

Word
Meanings
2Country Homeland,Motherland,Home..........
…....
…....
…....
2Home House, Place of Accomodation ....

Now every searched word has a unique identity. There could be approximate 26*25 files in 26 directories. A tree like hierarchy will be made and searching the words will be done via the traversing the file hierarchy.