Sunday, December 31, 2006

tail -f 2006

ah! end of the year 2006. Well, hmmm! another year, a good year. over all for me its been a very good year. Right now I am in India with my family due to some medical issues, thank god all is fine now. So I am celebrating this new year as a happy guy and with my family, only thing I miss is my son. He is back in Male' with his mom. If he was here it would have been so complete. Anyway no one gets it all ey? Just hope I'd be with him on the next new year.

Next year (2007) might be a bit of tough year. Seems I have to be on medication for one year (taking an injection every week). Ouch! Next thing would be I can't spend as much time at office as this year (all thanks to the doctors again). Besides that I don't think much will change. It will be just work, loads of sleep. And yeah no resolutions, yep none. Guess only major change will be I would try to move away from totally devoting my time at office and try to do something on my own too. Don't really know what or how yet. Just have some slight idea, but no real plans. I don't think living on USD 900 a month is good enough anymore. I guess its time a lot of us give it a thought and try harder. Fight back if needed. Anyway, lets see.

Since this is my last post of the year, would like to post about me :) and this is my blog! Firstly I would like to thank my family for the support they always give me and standing by me. Without them I can't be the me I am, be it bad or good. I love them. My close friends who's always been a good company and from whom I learn so much. Some people always have stood by me, no matter what. Thank you so much. What I have learned and known is no one knows it all. No one. And there is always someone out there, who is better than you and from whom you can always learn. They maybe elder to you or even younger. Always learn from them and give back what you can. If anyone ever says "I am the best", Its "simply not true". Or if anyone thinks in that attitude its not the right attitude. Last one year I've met some amazing people, and hope to work with some of them a bit longer. Its really good to be part of an amazing team at work. Ah and before I forget; I should thank my wife for keeping up with me and always making me smile and laugh.

Hopefully next year will be a good start. I was really happy to see the mail from IOSN inviting me to participate in the Asia Source II camp in Sukabumi, Indonesia, between 22nd and 30th of January 2007. I don't know if I can make it or not. But I sure hope so. Best part is its all fully sponsored. I would be honored to be representing Maldives and the Maldivian Linux Users Group if I can make it. Anyway I don't have much hopes since I am already on leave now and to get another leave the same month, I know I have to put up a major fight. But lets hope I can.

Finally I think I've decided on my carrier path. geee! took me long. I guess I love the part of my job which involves product development in the mobile sector. I guess VAS (value added services) is where I wanna move on. Hopefully I'd be able to learn more on it and gain more experience there. Its kinda fun area and involves a lot of stuff which makes it really interesting. Best part I love about it is the integration of different technologies for our requirements. There is always something new to learn and do. I hate to do the same routing stuff everyday. I'd rather commit suicide then that. I don't know how some people can do it. Its amazing.

Today is the last day of the year and I met someone who's helped me a few years back and whom I respect so much. Today again I've had the pleasure of having a chat with him for an hour or so. Thanks to him I am more convinced with certain things and have helped me to clear something better. We all have our own issues and problems, facing them and over coming them is the challenge in life. Some times we are lost, we don't know where we should head to or do. Its good to stop and analyze things and if possible share it with people who can help or care. Then follow the advise of these people. It really helps. Some times it also happens that you are aware of somethings and understand things, but you might find it hard to accept those things and act on them. Again at these times its good to stop and do the same. Might not apply for everyone, but for me it sure does help. So to rap up, I thank everyone who's been a part of my life in anyway and wish them a very happy new year. Damn I got to run. Happy new year again!

Saturday, December 23, 2006

Malé the most congested, maybe..?

It is very likely that Malé is the most congested in the world. It is estimated that around 48,007 citizens per square kilometer live in Malé. The closest rival is Cairo, hmmm! a close connection some where maybe ?. This has and will cause a lot of problems in the long run, unless some people acted on it. Problems like health issues, crime and other social issues are on the rise. Hardly anyone addresses these issues and measures are taken.

One of the biggest reasons why Malé is so populated is almost everything is centered in Malé. Good education compared to others islands, health and job opportunities. Most people are forced to leave their homes in the islands and live in Malé. Here some times 5 or 7 people share the same room or even worse. The rents are up so high. An average one room apartment costs MRf 5,000 (USD 389) per month, when the average salary is about MRf 2,500. This is amazing. Its hard to imagine how most people survive in Malé. Yet we see a country blooming, at least thats what we are told.

It is said that the quality of education has badly gone down over the last few years. I don't know how true this is but its been a widely talked subject. The increasing number of vehicles is the other problem. Hardly you can find a parking spot, if you own a car its even worse.

There is nothing much anyone can do in Malé. Except of-course the usual coffee sessions and burning of fuel unnecessarily. The new means of entertainment is politics for the grownups and brown sugar for the young.

Thursday, December 21, 2006

IM's and IMPS

IM's or Instant Messaging is nothing new to us. We all use it now, as a means of communication. Over the PC's we use MSN Messenger, Yahoo, Google Talk and ICQ, etc. These have been around for sometime. Now they are on our mobiles as well. We can use them almost anywhere anytime. Things have changed a lot. So whats that we lack? One major draw back is that these IM's are not able to communicate with each other (mostly). Recently MSN and Yahoo have made this possible. We still lack one unified messaging solution.

This is where IMPS comes in. IMPS stands for instant messaging and presence system. It is an instant messaging standard initiated by Wireless Village Forum which is primarily supported by Ericsson, Nokia and Motorola. This standardization aims is to bring and to have one single instant messaging system regardless the media and the client. This client is not only designed for PC but also for normal handset. It creates the communication standard between different IM servers and also communication standard between client and IMPS server. We can find the sample of IMPS client in Sony Ericsson handset in “My friends” menu or in “My Presence” menu in Nokia handset. We are free to connect to any IMPS server in the internet.

We do have things like Agile Messenger and GAIM, but what actually happens inside them is they have different clients inside these applications for each of the protocol or IM server.

Monday, December 11, 2006

postscript to html (ps2html)

Ever needed to convert postscript (ps) files to html? I had to. I needed to convert a batch of ps files to html. I looked around a lot, but failed. Could not find a good tool to get this done. Next choice was to write one. I worked on it over the week end, but failed. Got too lazy at a point. I was able to convert the text to html, but when it came to the formating it was a pain. The tool worked fine when I needed to export just the text, but with the formating; it was a pain. So I looked for other alternative solutions. The best choice was to use 2 simple tools that came with most *nix's. ps2pdf and pdftohtml. The first one converted the file to pdf the next from pdf to html. I could not find any good tools to directly convert from ps to html. The only issue I found with pdftohtml is that it does not convert Unicode characters well. Some how that is messed up, besides that no issues.
ps2pdf file.ps
pdftohtml -c -noframes -zoom 5 -i file.pdf
Thats all you need. file.ps is the file you need to convert. the result will be file.html

Sunday, December 10, 2006

e-mail to SMS (email2SMS )

We talked about how to set up a simple SMS based service before using free and open software. Next we'd look how we can use this in to more practical use. In this example I will try to demonstrate how to develop a simple e-mail to SMS solution. It is assumed that the mail server is an internal server on the local LAN (example the intranet server).

Here again we will use Linux but this can even be applied on FreeBSD and alike. We will use Kannel as the SMS gateway, postfix as the MTA. As for a MDA (mail deliver agent) we will use procmail. You need to install all of this on your system before we start. Also we will be again using Perl as the scripting language. The diagram below illustrates the simple over view of how the system works.

The system is designed to send sms using the internal mail system. The sender needs to be a predefined user of the mail system to use this system. A set number of sms recipients is set. Example send to 10 people (customers) with a single mail. Logs of emails sent will be kept on the system. System will also sent the sms to a given list of numbers; for each email (system usage).

To start off we first setup postfix. The default configuration of postfix is used. Please insert the following line to the postfix configuration file fount at /etc/postfix/. Append the line below to the file main.cf, to edit this file login as root and use a text editor like vim.

mailbox_command = /usr/bin/procmail

Explanation:
The mailbox_command parameter specifies the optional external command to use instead of mailbox delivery. The command is run as the recipient with proper HOME, SHELL and LOGNAME environment settings. Exception: delivery for root is done as $default_user. Other environment variables of interest: USER (recipient username), EXTENSION (address extension), DOMAIN (domain part of address), and LOCAL (the address localpart). Unlike other Postfix configuration parameters, the mailbox_command parameter is not subjected to $parameter substitutions.
- from the man pages -

IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.

To overcome the above issue please edit the fie aliases in /etc. Append the following line to the bottom of the page.

root: sms

also add the following line to file virtual at /etc/postfix.

@intranet.ourcompany.com sms

This will make the system to catch all mails to the sms user account.

Also add(modify) the following 2 line to the main.cf file.

myhostname = intranet.ourcompany.com
mydomain = ourcompany.com

Procmail configuration

create a file named .procmailrc in the /home/sms folder. Add the following line to the file and save the file.

TO=`formail -xTo:`
SUBJECT=`formail -xSubject: \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
SENDER=`formail -xFrom: \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
BODY= `formail -I "" \
| expand | sed -e '1,/^$/ d' -e '1,/^$/ d'`
BODY=`formail -I "" `
SENDER=`formail -rtzxTo:`
:0
| perl /home/sms/massms/newsms.pl $SENDER $TO $SUBJECT $BODY >> /home/sms/massms/maillog.txt

The above configuration sets up variables for each required filed and then passes these as parameters to a scrip called newsms.pl located at /home/sms/massms/

The script (newsms.pl)
use POSIX qw(strtod);
use LWP::Simple;

#if ($#ARGV !=1) {
# print "usage :sendsms \n";
# exit;
#}

$from = $ARGV[0];
$number = $ARGV[1];
$subject = $ARGV[2];
$text = $ARGV[3];
$maxsend = 10;

print 'params: ' .$from . ' ' . $number . ' ' . $subject . ' '. $text . "\n";

sub getnum {
my $str = shift;
$str =~ s/^\s+//;
$str =~ s/\s+$//;
$! = 0;
my($num, $unparsed) = strtod($str);
if (($str eq '') || ($unparsed != 0) || $!) {
return;
} else {
return $num;
}
}

sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}

my @orinum = split('@', $number);
print 'orinum: '. $orinum[0] . "\n";
$orinum[0] =~ s/^;
$orinum[0] = trim($orinum[0]);

$words = @ARGV;

$text= "";
for ($r=3;$r<=$words;$r++){
$text = $text . " " . $ARGV[$r];
}
$text = trim($text);
print 'text: '. $text . "\n";
#$text =~ s/<(.*?)>//gi;
# $orinum[0]=~ s/\D//gi;
#print $text;

@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
@weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
$year = 1900 + $yearOffset;
$theTime = "$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$month] $dayOfMonth, $year";
print 'time: ' . $theTime;

sub authuser {
my ($fromuser) = @_;
print 'in function ' . $fromuser . "\n";
$okuser = 0;
my @user = split('@', $fromuser);
print 'passed to authuser as @: ' . @_ . "\n";
print 'the user:'. $user[0] ."\n";
open (CHECKBOOK, "/home/sms/massms/access.list") || die "couldn't open the access list file!";
print "file open \n";
while ($record = ) {
if (lc(trim($record)) eq lc(trim($user[0]))) {
$okuser = 1;
}
print lc(trim($record)) . " <> " . lc(trim($user[0])) . "\n";
}

close(CHECKBOOK);

return $okuser;
}

sub sendEmail
{
my ($eto, $efrom, $esubject, $emessage) = @_;
my $sendmail = '/usr/lib/sendmail';
open(MAIL, "|$sendmail -oi -t");
print MAIL "From: $efrom\n";
print MAIL "To: $eto\n";
print MAIL "Subject: $esubject\n\n";
print MAIL "$emessage\n";
close(MAIL);
}

$orimail = 'smsdemon@intranet.ourcompany.com';
print 'da user is: '. $from . "\n";
$isitoktosend = authuser($from);
my $sent = 0;
if ($isitoktosend eq 1) {
#if user is authorised to send sms
print "auth ok \n";
my @sendlist = split (',',$subject);
my $listcount = @sendlist;
print $listcount . ' > ' . $maxsend . "\n";
if ($listcount <= $maxsend) {
#send list cannot exceed more then maxsend if only less
print "in if list and max\n";
my $longnumbers = 'sms sent to ';
foreach (@sendlist) {
$ournumber = $_ ;
if ($ournumber =~ /^9609/i) { # all numbers should have 9609
my $url = 'http://127.0.0.1:5034/cgi-bin/sendsms?username=usr&password=password&from=' . $orinum[0] .'&to=' . $_ . '&text='. $text ;
$html = getprint ($url); # ok shoot to kannel to send sms
$lognumbers = $lognumbers . ',' . $_ ;
$sent = 1;
}
}
if ($sent eq 1) {
$lognumbers = $lognumbers . ' with the message : ' . $text;
sendEmail ($from, $orimail , 'sent sms status' , 'sms sent to ' . $lognumbers);
open(FILE,">>/home/sms/massms/log/sent.log") or die "cannot create file";
print FILE $theTime . ' ' . 'from:' . $from . ' ' . ' sent through: '. $number . ' >' . $lognumbers . "\n";
close(FILE);

# enable to send every time to follwing numbers the sms for control
my $alwayssendlist ='9609620001,9609620002'; #change as needed
my @loopsend = split(',',$alwayssendlist);
foreach (@loopsend) {
my $url = 'http://127.0.0.1:5034/cgi-bin/sendsms?username=user&password=password&from=' . $orinum[0] .'&to=' . $_ . '&text='. $text ;
$html = getprint ($url); # ok shoot to kannel to send sms
}

print "sent";
}
} else {
sendEmail ($from, $orimail , 'sent sms status' , 'error : cannot send to more then ' . $maxsend . ' numbers');
print "send list exceed err:";
}
} else {
# sendEmail ($from, $orimail , 'sent sms status' , 'error: sorry you do not have authorization to use this service');
print "cannot send";
}

A close look at the code. I've designed it to have some security levels. You can modify as you need. The control measures are that there is an access list. You need to have your email address in the access file for you to send the SMS. Next I have implemented a control to copy all SMS to a given list of numbers. These can be taken off the script as you wish. But the basic thing is there.

This demonstrates how simple and easy it is to get these sort of things done. Maybe next time I'd try to post about how to do the reverse. SMS2email. With little effort the script can be changed together with the system to bring better improvements.

Saturday, December 09, 2006

1980's, 1990's, 2000...


Been a long time... long long time. I remember my first Sinclair ZX Spectrum. I wrote my very first programs on it. BASIC was the language. When I needed to save them or load games, I had to connect it to our cassette player. I used the normal audio tapes. It did not come with a VDU. So I had to connect it to our TV. I never owned it, but was able to borrow it from a friend (who did not find any use of it), in exchange with my Atari 2600 game console.

We have come a long way since then. Today, we have access to almost everything. The internet is here, latest gadgets is in local shops, etc. Parents try to educate the kids about all this stuff, they teach computers with our "ABC". How have we changed? Better gamers? What has changed, what improvements have we seen or will see? The kids who had access to nothing but casio programmable calculators or the kids of today? Will the access to new improved hardware and information only enough? "Too much games"? Too much information? What can be the issue?. I have all these questions now. Are we improving; will we have a good generation of kids who will make us proud? Are they being directed in the right direction? Are they being motivated enough? Do they have a proper educational system? Back then, we did not have all these facilities and stuff, and it was too expensive. Not any kid was able to afford a computer. Things has changed now, but has it improved? Are the talented kids recognized and taken care of? I don't know. Yeah sure, we do get kids coming in after graduating. Make their parents happy and all. Make us all proud, but do they have enough skill or the talent? After they come back, or identified are they given the right opportunities to develop further?. I had a chat with a guy who's back from his studies after doing computing and the job he got was to work for a companies "HR" department. I know a real talented guy who's won first place in his class for his diploma and higher diploma from Singapore; who prints t-shirts for living. Is it just me who thinks something is wrong? Maybe.. I don't know, but this is how I feel about it. A few months back, I was looking for local programmers and system admins. Sad to say I was so frustrated not to find good people. I hope these will change and it will improve. At the same time I have been amazed at some kids skills, and talents.. I hope it does not go wasted too. Seen too many of that. The system and the lack of recognition is to blame? A stupid thought maybe...

The Island

Usually I spend all of my week ends at office. This Friday I thought I would take a break. Went out for a walk all around the island (Hulhumale'). Its mostly empty; except for a small area where people live, there is not much vegetation, since its all a man made island. Anyway I took some pictures and thought I'd share them. I don't own a camera; so just took them using my phone.

Road Flower

Badi Magoo & Bon'bigadu

What do you call them?

The road to Male'

Wednesday, December 06, 2006

Motivation or not Demotivating?

I was doing some research and came across an interesting article about why your employees are losing motivation by David Sirota, Louis A. Mischkind, and Michael Irwin Meltzer. In their opinion it is not about motivating employees, but about not demotivating them.

In the article they talk about the following three goals of employees:
* Equity: To be respected and to be treated fairly in areas such as pay, benefits, and job security.
* Achievement: To be proud of one's job, accomplishments, and employer.
* Camaraderie: To have good, productive relationships with fellow employees.
What shocked me was that according to this it saying that this is not strictly a top-down process and if the company doesn’t work that way you simply have no chance of achieving these goals for your employees. According to the article individual managers can make a difference for their employees, either for the better or worse. - The fact itself is not a big surprise, but having this statement in this article really surprised me.

I guess a lot of companies have these issues; but are often ignored. In the end its not the employees who loose, its the companies. I guess its high time for most of them to give more attention to HR issues. Productivity often is directly related to these factors. These are good things to study and learn from. Who knows might come in handy at a point in life.

what the f**k is Web 2.0 ?

We hear and talk about Web 2.0 so often now. Ask most of the web designers what is it? Hardly anyone is able to answer straight. Same went with me; I am not a web guy at all. But just want to be kept informed about these stuff that goes around us.

Anyway whats the big deal about this Web 2.0? The new world wide web? hmmm! now I don't think anyone should look at it that way. I guess for most people Web 2.0 means a combination of technologies implemented on to a web site, like namely AJAX, DHTML,RSS,CSS and a few. More to add to those, sites which are more interactive and open socially. Also I guess no longer we have simple web pages, mostly its small applications and systems. These systems should work inside a web browser ; without having to launch external applications.

I guess the biggest contributor to this vibe was and is google. But I guess nothing new has come up in reality or there is not much major new stuff, compared to the so called "Web 1.0". Its just the same stuff; with new names and with improvements. Yeah sure; there is new stuff, but maybe just based on the same old techniques and concepts. You throw out; ActiveX and Applets and bring in AJAX, etc. But over all the web has developed and maybe we call these new developments the "Web 2.0" era. For me the biggest change was things becoming more platform in depended. Also the fact that data is made more available and easy accessible.

As for us Maldivian and our sites, we need to improve too. Mostly the web sites are very static and too much focused on hard core graphics. Too much useless content and images. Yeah! the travel sites. They do have loads of content and pictures, but how informative and easy its to access them and locate what you are looking for. Simple things like that is ignored. We do see some improvements slowly, but I guess mostly the developers don't care much about web standards or any such issues. But I do sure hope and wanna see better stuff coming up.

Maybe I am not the right person to talk about web development and standards, so guys out there who are more experienced in this field would like to shed some light on this? What can we do to improve the looks and functionalities, what do we need to stop doing, etc.

Tuesday, December 05, 2006

wooo hoo!

my new toy.

Sunday, December 03, 2006

ripping web sites with perl

I was working on a small project, and thought I'd share part of its code. A lot of web sites like www.haveeru.mv and some travel web sites, like to display the local weather. Very often this is taken from global weather web sites, etc. I thought since we do have the local met department web sites; we could use it. All you need to do is modify the script to be more presentable for web pages.

Also this is an example which demonstrates how easy it is to rip data off external web sites using perl.


#!/usr/bin/perl 
use LWP::Simple;
use HTML::TreeBuilder;
use XML::Simple;

my $url = 'http://www.meteorology.gov.mv/?PD=WEATHER&ID=2';
my $page = get($url) or die $!;
my $p = HTML::TreeBuilder->new_from_content( $page );
my @links = $p->look_down(
_tag => 'table',
width => '656'
);
for my $row (@links) {
my @cells = $row->look_down( _tag => 'td' );
$text = join ( "\n", map { $_->as_trimmed_text( ) } @cells )."\n";
@lines = split(/\n/, $text);
}

$p = $p->delete; # don't need it anymore
print "\nWeather Forecast for Maldives\n";
for ($r=0;$r<6;$r+=2){
print $lines[$r] ." : " . $lines[$r+1]."\n";
}

$xml = new XML::Simple;
$raw = get('http://www.meteorology.gov.mv/xml.asp');
$data = $xml->XMLin($raw);

foreach my $ST ("HANIMAADHOO","MALE","KADHDHOO","KAADEDHDHOO","GAN") {
print "\n";
print ('Temp. for '.$ST .': '. $data->{STATIONS}->{$ST}->{TEMPERATURE}->{CELSIUS} .' . '
.'Wind speed: '. $data->{STATIONS}->{$ST}->{WIND}. ' . '.'Sun Rise: ' .$data->{STATIONS}->{$ST}->{SUN}->{RISE}
.' and set: '. $data->{STATIONS}->{$ST}->{SUN}->{SET} .' . '.'Rain Fall: '. $data->{STATIONS}->{$ST}->{RAINFALL}.'
. '
.'Humidity: '. $data->{STATIONS}->{$ST}->{HUMIDITY});

print "\n";
}


Friday, December 01, 2006

TVM , fahimagu ?

I don't watch TV much; specially the local TV. A few reason behind it; which rather not be discussed. Anyway I've seen parts of a few program called “fahimagu”. Its been around for sometimes now. The program is about computers and IT. A local presentation. One of my x student and a friend of mine presents it. Its good to see them on TV. Anyway the producers need to improve this program. I am really sorry to say its really bad; in term of content. I feel the program being a local presentation; it lacks local content a lot. Not much focus is given to the local IT or vibes. Yes; they do cover all major events; so does the news. But seriously if anyone knows the producers of this program they need to be told about this.

There is a lot they can cover and focus on; which I feel hardly they even know. IT is growing in the Maldives and we have new things everyday. Why not cover them, or try to make it more informative to the locals. I agree they do pick on local stuff every now and then, but I feel they can do better. End of the program the views should learn something new or get some information out of it. Whats the point in telling that MS Word is a word processor. We all know that. Educate us, enlighten us and entertain us. Maybe my expectations are too high?

So; what can they do to make a change. Well thats what they need to figure out. One suggestion I can think of is make people aware about current events and vibes. Talk about them discuss about them. Example www.mvblogs.org. There is so many out there who use it and so many bloggers now. But at the same time there is a lot of people who don't know what is blogging. The power of blogs and what it can do, etc. Simple things like these can be looked into. Recent events like www.dhivehin.net and other online communities and their contributions. WiFi networks in male', the forums,irc,etc. These are all good topics. Things like IT jobs in male', what the employers are looking for. Things like that. Other stuff like ; “will the marine fiber give me more speed, etc”? These are all areas that can be covered and which is good topics.

But then again; I wonder too. Do they really want the general public to know about these things? Internet already has caused so much problems (for some people) socially and politically. This might be a factor too, to keeping somethings closed and untouched. Again, I maybe wrong. I am told the country is in reform and more transparency is being introduced. Maybe soon we will see all this. Who knows?

Thursday, November 30, 2006

Writing a SMS Service with Free Software

So what we will do is set up a simple SMS based service using Kannel and Linux. Kannel is a famous, powerful, open source and free SMS gateway and WAP gateway. You can use it to connect to a mobile operator's SMS center (SMSC), or using a GSM mobile phone or GSM modem as a virtual SMS center. Kannel can handle multiple SMS centers and virtual SMS centers.

Kannel supports the use of AT-capable mobile phones as virtual SMS centers. Most GSM mobile phones are capable to work with AT commands these days. A small list of mobile phones and GSM modems that are known to work as virtual SMS centers with Kannel is available on its web site.

The SMSC access protocols supported by Kannel include SMPP, CIMD, UCP / EMI and SMS2000 / OIS. In addition, Kannel has an HTTP / HTTPS interface that you can use to send and receive SMS messages.

I use Fedora Core 6 as my OS (desktop). A few methods to setup kannel using FC is, log in as root. Then execute the following command on your console

yum -y install kannel

or download the tarball from Kannel web site and compile it

This will get kannel installed on your box. Next is if you are using a GSM mobile, you need to make it work with your linux box. One easy way is setup the mobile as a GSM modem, via bluetooth. In my case I use the Bluez library for bluetooth connectivity. If you don't have it get it installed. All from FC3 up come preconfigured with Bluez libraries and all. In case you are using other distributions please get Bluez libraries and install them. On FC do the following. In any case your box needs to have bluetooth support.

yum -y install bluez-libs bluez-pin bluez-utils bluez-hcidump bluez-utils-cup

That should get you all fixed up. If you are using a bluetooth USB dongle you need to do the following

modprobe hci_usb

then

modprobe usb-uhci

If all goes well, type the following

hciconfig

then your output should be something like the following

hci0: Type: USB
BD Address: 00:0F:B3:90:86:46 ACL MTU: 192:8 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:5159 acl:5 sco:0 events:129 errors:0
TX bytes:1599 acl:5 sco:0 commands:83 errors:0

This means youe bluetooth device is all set to go. Now you just need to configure it. To test if your bluetooth is working, you can do a simple scan of all devices as follows. type

hcitool scan

which should give you an output simmiler to

Scanning ...
00:0F:B3:90:7B:6E WTM--LAP-07
00:0E:6D:CC:04:7F Dark
00:10:C6:82:A8:6F WTM-ITLAP-03

Anyway, the configuration is very simple and straight forward. If you want to bind to your mobile you need to configure Bluez.The configuration of blues will be located in /etc/bluetooth/ edit the following files and do medications as per your requirements. Add the following lines to rfcomm.conf

rfcomm0 {
bind yes;
device 00:00:0E:6D:CC:04:7F
channel 1;
comment "darkumoonu";
}

here 00:00:0E:6D:CC:04:7F is the mac address of my mobile. You need to change that accordingly . When you do a “hcitool scan” you'd get all the devices that your box finds. To make sure you are able to reach it you can even ping the device. Type l2ping mac; example

[root@darkmoon bluetooth]# l2ping 00:0E:6D:CC:04:7F
Ping: 00:0E:6D:CC:04:7F from 00:0F:B3:90:86:46 (data size 44) ...
0 bytes from 00:0E:6D:CC:04:7F id 0 time 58.93ms
0 bytes from 00:0E:6D:CC:04:7F id 1 time 17.34ms
0 bytes from 00:0E:6D:CC:04:7F id 2 time 17.31ms
0 bytes from 00:0E:6D:CC:04:7F id 3 time 16.31ms
4 sent, 4 received, 0% loss
Next you need to start the service. Do the following, type “etc/rc.d/init.d/bluetooth restart” or simply “servic bluetooth restart”

Now to talk the mobiles modem, type the following command.

rfcomm bind 00:0E:6D:CC:04:7F 1

This will essentially bind the Phones Modem to /dev/rfcomm0. Now we can check by issuing rfcomm.

[root@darkmoon bluetooth]# rfcomm
rfcomm0: 00:00:0E:6D:CC:04 channel 1 clean

You should get something like that. Ok, that about all you need to do to get your GSM device working with Linux. There is other configurations that you need to do if needed.

Ok, lets get back to Kannel. The Kannel configuration file will be localed in /etc/ edit /etc/kannel.conf

remove all the lines in the file and add the following

group = core
admin-port = 13000
smsbox-port = 13001
admin-password = bar
log-file = "/tmp/kannel.log"
log-level = 0

group = smsbox
bearerbox-host = 127.0.0.1
sendsms-port = 13013
global-sender = 13013
sendsms-chars = "0123456789 +-"
log-file = "/tmp/smsbox.log"
log-level = 0
access-log = "/tmp/smsaccess.log"


group = sendsms-user
username = tester
password = foobar

#Nokia Modem

# SMSC GSM
group = smsc
smsc = at
smsc-id = nokia_smsc
modemtype = nokiaphone
device = /dev/rfcomm0
speed = 9600
pin = BlueZ


group = modems
id = nokiaphone
name = "Nokia Phone"
detect-string = "Nokia Mobile Phone"
init-string = "AT+CNMI=1,2,0,0,0"
speed = 115200
enable-hwhs = "AT+IFC=2,2"
need-sleep = false
no-pin = true
no-smsc = false
sendline-sleep = 100
keepalive-cmd = "AT+CBC;+CSQ"
broken = true
message-storage = "ME"
enable-mms = true

Now do the following

[root@darkmoon etc]# service kannel start
Starting kannel bearer box: [ OK ]
Starting kannel sms box: [ OK ]

That will get Kannel started as a service. If you fail look into the logs at /tmp/ /tmp/kannel.log and tmp/smsbox.log. That will help you to get started to debug and solve the problem.

Ok, So now if kannel is working you should be able to send SMS using the kannel web interface. Example

http://127.0.0.1:13013/cgi-bin/sendsms?username=tester&password=foobar&to=&text=hello from kannel

Type that in your browser. Again. If it gives any problems get back to logs and if needed google around. There is not much help for kannel out on the web, except the kannel documentation and the mailing list. But its easy to figure out most of the issues.

If you have access to a SMSC (if you are a telecom operator) you will need the following to connect to the SMSC. Add the lines to the kannel.conf and bring the needed changes.

group = smsc
smsc = smpp
smsc-id="change"
denied-smsc-id="change"
host = "ip of your SMSC"
port = "port"
receive-port = "port"
smsc-username = "change"
smsc-password = "change"
system-type = ""
address-range = ""
interface-version = 33
source-addr-ton = 1
source-addr-npi = 1

You will need to have routes added to access the SMSC from your network. In my case, I have a FC5 box setup a SMSGW running Kannel and using SMPP to communicate to the SMSC.

So what do we do next. A simple service we can setup is one like Dhiraagu has to offer. Example the Haveeru news service. If someone sends you a SMS with the text “haveeru” we want to SMS him/her the new headlines. To do this we need to write a simple script to fatch the news from haveeru. For this perl is a good choice. So you need to have perl installed on your system. You would also need a cpan library to read the RSS feeds. Execute the following command first

cpan install XML::RSS

This will get the library installed. Next create a perl script called haveeru.pl with the following lines.

#!/usr/bin/perl

# import packages
use XML::RSS;
use LWP::Simple;
use LWP::UserAgent;


# initialize object
$rss = new XML::RSS();

# get RSS data
$raw = get('http://www.haveeru.com.mv/xml/index.php');

# parse RSS feed
$rss->parse($raw);
my $news='(*) ';

foreach my $item (@{$rss->{'items'}}) {
$title = $item->{'title'};
$url = $item->{'link'};
$news = $news . $title .' (*) ';
print("$title\n"); # we will only display the news titles
}


So now to add the service, you will need to add the following lines to the kannel.conf file.

group = sms-service
keyword = haveeru
exec = "/usr/bin/perl /home/darkmoon/perl/haveeru.pl"
accepted-smsc="change as needed"

When the subscriber sends a SMS to a set short code, with the text "haveeru", it will execute the script we have. Then the output will be sent back to the subscriber. So there you go. Now you have a SMS based service up and running. There is a lot more you can do with kannel and others; just play around. Simple and easy.

Tuesday, November 28, 2006

New iPOD addons

A new iPOD addon which is being marketed by a friend of mine. Interesting stuff ey!

Sunday, November 26, 2006

digg the dhivehi way?

I came across this web site (http://www.dhivehin.net/), I'd have to say this is something I really like. Maybe there is not much as of now, but might turn out good (I hope). What I would really like to see is a platform for IT guys to discuss and share stuff. Where people can openly ask questions, share the experiences, etc.

We have been very closed in terms of sharing the knowledge and knowhow. When IT started off in Maldives (back in late 80's and early 90's) not many were willing to share. It was very much a closed platform. Even people did not want to share the softwares they had or even explain how things work or are done ("complicated stuff, they told you"). This I guess really staled a lot during those days, and I guess we never developed enough as we should have. Even now simple things are made to look as big deals. Those days we use to have a gang of "foxpro" lovers; who competed among themselves for projects. Most of these people never evolved (most). I guess mostly the reason was there was not much knowledge sharing and R&D works. No one was really interested all, what mattered was making money out of what you just learned. Maybe this was good for the individuals. As a community I guess we did not benefit much from the pioneers of IT in Maldives. Maybe I might be wrong. I am sorry if I am being too general.

The closed source model as I would put it, is really bad for a community like us. We don't have good universities or even companies who do R&D work or even invest in technology. This I feel results in us being left behind compared to the rest of the world. Example; even if we look at Sir Lanka , they have got institutions, individuals and even communities who are doing so much contribution to technology. Sri Lanka have been contributing to projects like apache(which is the most famous web server) and other projects. Recently Google has given the Lanka Software Foundation USD 25,000 to drive open source software projects locally. So what can we do to improve? Well; I guess it all depends on individuals. Rather then us always telling "what are they doing about that". We hardly say "what can I do about this". Simple if you don't wanna be part of such contribution, just ignore such things (stop even commenting). One good starting point can be the schools. I guess the education system now "sucks"; even if you agree with me or not. Something that can be changed is to try and educate our kids more, lead them in the right directions. Now some kids finish school after doing Computing, without even writing a single line of a program. Its a problem with the system; they don't encourage such things at all. Even the teachers we bring in to teach these kids are not really good enough or have the knowledge. Anyway I don't think these things will change in a near future.

Even though this is the case, I am happy to say there is real talent in Maldives. Hardly people notice these kids and individuals. If anyone would identify these individuals and help them to improve and give them more opportunities, it would really make a difference. If people and companies would set aside the immediate commercial factors and invest on them, it sure would be a good contribution. Simple things like even a word of encouragement is a lot. Anyway I always hope to see a change. I am seeing things change and people developing. The best part of such developments is you get to share what you have learned and also learn from them.

Wednesday, November 22, 2006

The Virtual Employees

The concept might not be new, but I've heard of this term and seen it in a totally different concept. Around a year ago, my boss explained me that "I am looking for virtual staff", who will not be hired by the company and NOT work on our payroll. But will be working for us, in our premises and paid by another company. So the catch is, we pay another company a big amount (yearly) for this service.

Now I don't know how effective that will make things, but sure is being done. I hope to learn from this. So example is; if you have an IT infrastructure , and you need to give support and maintain the network. So what do you do?. Yeah! you hire another company who gives you this service. They will give support and provide you with all the needed help and work. You just relax and your employees are happy too. Why? cos they won't need to do much. They just need to get to the requirements, then pass em on to the virtual employees. So the result is "happy staff", who will not have much stress or load. Plus, you don't need to train your staff too or employee skilled people. cool ey? And yeah you still have to pay the employees and also keep the numbers same. Nothing is changed here. I hope you got the concept.


So this might be just a start, who knows in future we might get companies who will have virtual CEO's, CTO's and even HR Mangers. Even now I know some companies do this. The difference is you keep your staff as they are (with the titles), pay them and hire others to do the work. Neat! Well, I don't know much about management concepts but I am learning. Someday I'd know the advantages and the reasons. As of now I am not "experienced" enough to understand and know the "concepts and reasons"

Saturday, November 18, 2006

Lights, Camera. And.. Action

Seems we are almost connected to the rest of the world via marine fiber cables. WARF Telecom International hit the land first ( a joint venture between Wataniya, Focus Infocom, and Reliance Infocom of India ). The second cable which is owned by Dhiraagu and SLT (Sir Lanka Telecom) has also made it to the shores. This means we should get a lot of bandwidth? Well, lets hope so.

Whole of Male' is a big fiber network now. 2 companies (3 networks) already have their own fiber networks (Cable TV operators). The government owns its own network in Male' as well, and there is talk of another big investment for digital eyes (again utilizing another optical fiber network).

My guess the government will take a share of the Dhiraagu-SLT cable, example take charge of the ".MV" domain, etc (they deserve it anyway). At this point its hard to say. NCIT of Maldives, has been very quite and inactive. They have setup a building with loads of cameras (hmm! the new trend) and a lot of talk about the government network has been around for few years. Although I would like to think that, there is no proper infrastructure plan. But most likely it is goona be a good entertainment network. You'd be able to share your "prison break", mp3's and other stuff with your friends in other offices. And yeah with good network speeds (hopefully). So thats good news for all you government employees, yeah with good internet speeds (again hopefully, depending on how good your local Network is). As for the digital eyes on the roads, it will be good for the people who own them. A warning to the rest of the guys; "don't bother picking on a girl of men in blue". They'd find out. :) Also it will be good entertainment for them to monitor and watch the birds as they walk by. If you are a girl, who is hooked up with one of them. an aah! you will be so busted on that evening rides. So yeah! its a lot of entertainment on the way. The digital media age is here. Welcome the lights!

Binux

OMG! read this Micro$oft CEO says Linux "uses our intellectual property". Come on Mr. Ballmer, have you run out of things to say? or were you addressing a bunch of stupid people?. I just can't understand why this guy would say that. I mean he is the CEO of Micro$oft. hmmm! maybe thats why he said so. If you really think about the facts, he does not make any sense. I don't get it at all. So did he mean Winbows and rest of M$ code was on the public domain and the OSS community just used the code into Linux? If we really think about the whole thing, its M$ who has been using other peoples intellectual property. Yes from the very start, they have had a history of steeling code. Starting from DOS. Now they wanna claim that Linux belongs to them? This really is a good joke.

Ok I can understand if they are talking of patent. Then its the totally different case. But if M$ tries to show to the rest of the world that Linux uses or copied M$ code, then that is hilarious. Linux was a multitasking and a network OS way before Winbows. Linux has always been far ahead of Winbows and still is.

Ok Ballmer, show us the stuff (code) which was taken off M$... and yeah PROVE it. I make a promise I'd take off Linux, off my System and switch to Winbows. From what I can see, M$ knows they have lost the war. Now they are just trying to be part of the OSS world and trying to change the history. Maybe they want to rewrite it as; when Gates was in University of Washington he started a project which later become "Linux". hmmm! or maybe "Binux". Might just be true. They are on the track now. Novell owns the rights to UNIX, and a key player of the Linux world, M$ is trying to buy over them now? (who knows).

Wednesday, November 15, 2006

Finally, FOSS Java!

I think its worth a note that Sun has decided that Java will be open sourced. Its really a good news for the open source movement and for Java developers. Since Java's introduction 11 years ago, it has been leading in the middleware space. Maybe the openness of Sun, has been one of the key factors of the success of Java. The recent move to open source Java will likely bring Java to more platforms and better performance.

The way I see it, the dot Net and Java war is not over. It just started off. A lot of enterprise platforms are dominated by *nix and Micro$oft has already made its move to tap in, by supporting Novell. This move by M$, could be a step to push dot Net to the Linux world (maybe by supporting the mono project?). Lets see what happens next.

Google Reader

Yapee! Just tried the Google Reader, its really a cool service. Now I can read my favorite blogs and news from one single site. There has been any RSS readers and tools, but I guess Google always does thing better them most. Best part I like about such tools is the minimization of navigation. Example, I don't need to go into www.mvblogs.org and browse through the list and jump to each blog. I can create a list of all my favorite blogs and read everything from one spot. Plus it works some what like an email client. You are able to distinguish between unread posts and post that you have already read. Ah, so all thanks to Google.

Tuesday, November 14, 2006

good deal!

June 19, 2006

Pro-whaling countries within the International Whaling Commission celebrated yesterday after a resolution was passed which stated that the commission's 20-year moratorium on commercial whaling is "no longer necessary" and which went on to blame whales for depleting fish stocks. 33 countries voted in favour of the resolution, with 32 voting against, and China abstaining. The vote is considered a victory for Japan, which has long argued for a return to commercial whaling, and has been 'recruiting' sympathetic nations to join the IWC in order to bolster its vote.

The vote does not directly enable a return to commercial whaling, as that would require a three quarters majority, but is significant in being the first time that a major vote at the IWC has sided with the pro-whaling nations in two decades.
also...
June 20, 2006

New Zealand Prime Minister Helen Clark has accused Japan of creating a rift between Pacific Countries. She accuses Japan of influencing the voting of some member nations of the Pacific Island Forum at the International Whaling Commission by supplying vast amounts of aid to certain small pacific nations.

New Zealand provides a total of $23 million a year in aid to three of the six Pacific nations – Kiribati, the Solomons, and Tuvalu. Japan pledged approximately 45 billion yen (NZ $633 million) in aid for all Pacific nations. New Zealand's annual budget for aiding pacific nations on the other hand totals merely NZ $173 million.

Miss Clark is quoted as saying "One would hope that over time Japan might reflect on the damage this is doing to [its] relationships around the world" and that it "sprayed a lot of money around" to garner support.

The Prime Minister has ruled out any retaliation against the islands, saying it would not affect any future aid funding.

source
http://en.wikinews.org/wiki/IWC_passes_pro-whaling_resolution_after_close_vote
http://en.wikinews.org/wiki/New_Zealand_PM_faults_Japan_over_Whaling_Commission_vote

Friday, November 10, 2006

Linux at homes?

I needed an OS that could work for humans! meaning it should be able to watch movies, surf the net, chat, word process and lucky no games much (not windows) . So I decided to move to Ubuntu, only problem was the Dhiraagu ADSL usb modem was giving problems. Then I decided anyway since I too use my notebook at home, I'd dump the USB ADSL modem and go for a wifi router. That way everyone can share the net. So finally I got a D-Link DSL G604T. And installed ubuntu on my wifes notebook (yeah migrated her from windows to linux. pls note that , she did not have a choice here) . Works like a charm. And even my notebook which runs on fedora works cool. No complains thus far. So I am assuming ubuntu lives up to its name, linux for humans.

Anyway, so you'd say I am a freak and I installed ubuntu at my home. No one else would. Well, no I know a few more guys who do use nothing but linux. But the point now I wanna make is, Linux is at your homes, maybe without you knowing it. yeah! Like in my case I got down this ADSL router. This is a common device for the offices and homes now. The chance is, if you own one then you are having linux at your home/office (like it or not). Yeah this baby run on linux and acts as your firewall/gateway and AP. Its got an easy to use web interface for you to set things up and works good. If you wanna play around more you can telnet to the box, and can do a lot more.




If you do a version check on the device it should get you something like this.
Linux version 2.4.17_mvl21-malta-mips_fp_le (lily@products.adsl) (gcc version 2.95.3 20010315 (release/MontaVista)) #60 Wed Nov 10 09:49:30 CST 2004

new template

I kinda been blogging for like 3 years now. Mostly my templates been very static for long. I am not much of a visual designer. Anyway a lot of the guys think its too dark and it needs a change? daaa? ok. so a change, from black to white. :) Someone help me with this CSS shit, I hate em'.

Wednesday, November 08, 2006

dhivehi version 1.6.1a?

its amazing; the dhivehi language. It really is. Anyway its not about how rich the language or how poor and stupid it is. This is about the dhievhi version 1.6.1a, which is the bangaalhee version of dhivehi. I don't know from where it came or who invented it. Seems its is there. No one knows the origins, they talk in that language and we to them. Take for example you want to ask a bangalhee if he has had lunch or dinner, etc.
you would say " ކަލޭ ކާވައްތަރު ހުއްނަނީ؟ " , which kinda means are you edible? or close to that. but in reality when said this to a bangaalhee or any other foreigner, it means have you had food? (lunch, dinner, etc). I some times wonder, why we use this method of communication when it comes to talking with foreigners using dhivehi? common answer might be "our language is too complex and if we talk normally they won't understand" ? WOW ? is it that complex ? I don't know the answer. But it sure is funny to listen to these conversations.

Tuesday, November 07, 2006

compiz and swing

FC6 rocks, thats the first thing that i'd have to say about FC6. All most everything worked fine for me, except my IDE did not work. I use NetBeans 5.5 for some of my development work. Since FC6 came with the compiz and it had some good eye candy options, I had it enabled.

My other Java based applications (desktop apps) did not work as well. I did not get any errors. Just that The display was f*cked up. So next I installed KDE (I don't know why), and gave it a try. Seemed it was working fine with KDE. hmmm! So after a little look up, I realized that it was a problem with Java Swing when run under compiz wm. Or its a problem with compiz? I don't think thats the case. But it does not work, unless you have the desktop effects disabled. So no more eye candy. I am not sure if this is the same with XGL, my my guess is it will be.

Likely its related to the some problem with the Swing/AWT? Not so sure. But I am sure there will be workarounds to fix this problem.

Friday, November 03, 2006

...And the headlines..


* Dogs and cats are sleeping together
* Pat Robertson simultaneously converts to Judaism and Islam.
* Osama gets laid, changes his mind about destroying world.
* Scientists discover smoking is good for you.
* Microsoft is supporting Suse Linux.


-- From http://linux.slashdot.org/linux/06/11/02/1957252.shtml --

Wednesday, November 01, 2006

M$ Zend?

Zend the PHP development frame work have stuck a partnership with Microsoft. For me this looks like a move by Microsofts to dominate the WEB Server market. As PHP runs on around 22 million Web sites and is used inside 15,000 companies. Why Zend ?, Zend is a key promoter and developer of of PHP.

A lot of development of PHP based web sites is done by individuals; but mostly when it comes to hosting maybe 90% of them host them on Linux or BSD based servers. One major reason being the performance. Also there is few hosting companies and people who recommend PHP based sites to be hosted on Windows Servers. How ever this is not a news which will be very welcomed by the open source community. There will be others who might take this as a positive move too. Maybe the road to PHP#? :P So next will be mySQL? Maybe Microsoft has finally started to realize that ASP sucks ? and that they can't beat the OSS community and its best to join them, if they can't beat them? Who knows. Its a well known fact that Microsoft has used code from the open source communities. Example a lot of the network layer of initial Windows 2000 code used BSD code. Also the new vista has been working hard to mimic the look and feel of Gnome, KDE and even Mac OS X. And yeah the "power shell"? a replacement for the weak CLI in windows. Anyway thats a totally different story, which will lead no where. The best answer is stick to something which you are confabulate and easy with. Thats the best choice for you. Be it Windows, Mac, Linux or daaa! a PS3 (woo, Linux again)?

This move might be something good for most M$ Maldivian developers, who really are used to the M$ stuff. Lately PHP has also gained a lot of popularity as a web development language. We do have a few ASP guys too, but I would say most people still prefer PHP over ASP. I remember a time back in early 1990's foxpro was the thing here. Back then if you tell them about a language like VB they will joke at you. Late 90's that changed and by mid 2005 its now M$ dot NET. Even the government want to move to .NET platform and M$ SQL? People hardly look into other options like Java and Java based frameworks. Same goes for even PHP, I only know a few developers who have worked with PHP frameworks, like Cake and seagull. But these are good options to look into if you are into PHP, makes your life a lot easier. Also there is other alternatives people can look into like Ruby on Rails and Python with Zope. Personally I don't have much experience when it comes to web development, so I don't wanna comment more on the topic. But my guess is the reason why most hardcore developments with PHP is based on *nix hosting is beyond performance issues. There is a lot of advantages that you get on *nix over windows, when it comes to servers.