Sunday, April 10, 2011

Hit by the procrastination bug

Last few months I had been severely hit by the procrastination bug. A lot of important personal things have been put to the back burner.  I wanted to write a hundred and one things on the blog, but didn't even post a single post for the last four months, wanted to start something never started it, wanted to learn something never learnt it, wanted to go to a certain place never went, wanted to do a certain thing never did and the list keeps on growing.

I felt it was the bug, but as usual the mind lived in denial. It took so long to realize, but I am at least happy that I realized, at least late is better than never. Given myself ten days to make a recovery. Hopefully after month or two, I will be in a position to come up with a post on how to cure this bug, assuming I recover :D. Since I realized a lot of others are also infected by it.

Sunday, November 14, 2010

MongoDB for a MySQL user

Over the past few years NO SQL has become very popular, specially with a capability to boast about an illustrious reference list like twitter, facebook and foursquare.

Being a MySQL user I was curious to explore into this and see what it has and what it offers. Certainly there are plenty of NO SQL implementations, first wanted to check casandra but the first few lines of its documentation sounded like a no go zone, hence decided to try Mongo DB. Going through it I realized that there were alot of similarities. So listed them here for quick reference.

Type of database
On Linux you need to go through a certain amount of steps like user creation, permission setting, creating the data directory
Pretty stright forward create the the data directory at the default location /data/db. It was pretty simpler than MySQL
Starting Up
starting up using safe_mysqld (techincally it invokes mysqld)
pretty straight forward run mongod for a basic start up
Using SQL

Need to execute create statements
ex. When you wanted to create a table with columns x, y
you need to do the following.
1. Create database mine;
2. create table a(x int, name varchar(50))engine = MyISAM;
3. Then seperately do an insert
insert into a values(10, "hiii");
No create statements for DBs, collections, etc
Updated and created as and when needed(lazy loading), so to do the same we need to,
db.mine.insert({x: 10, y: "hiii"})
similarly you have functions for update, save, remove, find

if you want to select data; we can select * from a;
On MongoDB its,
Storage Engines
A lot of Storage Engines to choose from
Upto now a single storage engine implementation
Operations/ Transactions
When you fire a query to the MySQL server the client needs to wait till the MySQL server returns the result.
In contrast Mongo DB uses 'Fire and forget'. So technically speaking client is not aware whether the query executed successfully or not. It doesn’t return OK.
For system where you need safe operations immediately following the query getLastError command is issued and the exception handled.
For Requirements like analytics , status message updates, pics comments this fire and forget is perfect. Anyhow for Financial type of system we need to use the work around.

storage engine like INNODB supprts transactions and has ACID compliance
Not typically made for transactional systems
Supports mutiple types of indexes. For optimzation EXPLAIN is used with the select statements
Very similar to MySQL indexing.
For optimzation similar to MySQL this has the EXPLAIN statement and another statement called as hint
Main difference is that you can define the order of indexing for composite indexes. Which gives more control to the query definition Eg. db.mine.ensureIndex({"x" : 1}) 1 indicates the direction
Geo Spatial Indexing
MyISAM storage engine supports geo spatial indexing.
Is created by passing "2d" instead of passing 1 or -1 to the ensureIndex  function.
Pretty handy stuff with  straight forward support for querying nerarest locations, find entries within a shape and find distances.
Compound geo spatial indexing also supported, this will be handy for finding nearest ATM etc. I think this is a must check for people developing location based systems
Back Up
MySQL back up is more complex, specific to the storage engines.
Snapshot based back ups on LVM2 volumes is similar to the fsync command in mongo
supports fsync command which is a warm back up with point of time support.
Supports mongodump - which does a hot back up but without point of time support

Mode of Replication

Replication is based on Binary log - which has all the writes
Replication is based on OpLog, similar to the binary log but has idompotent operations.
Which basically means if the same statement is executed mutiple times it will not make the date inconsistant .
Anyhow the statements shoule be executed in order

set up is straight forward after having a master and slave in place
quiet similar - at start up itself the server can be specified as slave in the start up line,
./mongod --dbpath ~/data/slave --port 10001 --slave --source localhost:10000

supports complex replication set ups, like two way replication, circular replication, etc
does not support replication from the slave
Replica Set
MySQL cluster supports Replica sets- anyhow MySQL cluster replica sets has synchrous replication
Similarly for HA support MondoDB supports replica sets - which is a master slave cluster with automatic failover.
Similar to MySQL cluster in the replica sets. There are arbiter nodes which decide on the primary and secondary node election in case of failures
MySQL doesn’t have inbuilt sharding support. Sharding is usually handled at application or ORM level for MySQL
sharding support is given - mongos is a process that will interface multiple mongods which will have the data distributed.
Very good feature for scalability

For those who want to try out mongodb check this book,

Next up I want to try Couch DB, which is another No SQL database and implemented on Erlang!

Sunday, August 29, 2010

Viyapari Moolai as seen by the outsider

veera pathirar kovil in viyaaparimoolai
Viyapari moolai is small village close to point pedro in the Jaffna Peninsula. Incidentally its also my paternal ancestral village. Anyhow I don't think that I can claim that as my village, for that matter I cannot call any place as my village, so usually when people ask me where are you from ... My answer has always been, born in Jaffna and living in Kandy :)  So probably you can look at this as an outsiders view of Viyaparimoolai.

erincha amman kovil, viyapari moolai - let me confirm the name
If I am not mistaken the place got its name due to the fact that alot of people from the village were businessmen and had established their businesses right through out the country.Even my grand father and alot of relatives were into business in someway or the other. I'm told that there was a time where people from viyaparimoolai laid claim to atleast 50% of the business establishments in the upper part of Colombo Street in Kandy. Believe me the people from there are very passionate about the village and its heritage. In an era where they believe that half the viyaaparimoolai is outside the country they have taken the initiative to establish the connections on the cyberspace, they do have . Plus a facebook group!/group.php?gid=81291907500&v=wall

The old thoola kinaru (well) in front of pillayar kovil

Yours truly made a return to this village after 20 years. Yes 20 years! The circumstances never gave me a chance, my last visit was when I was 7 years old. Before that we used to go there every school holiday and spend time with our grand parents and relatives. All this time I could remember the place only in patches, I could remember the grand parents house in parts, the living room, the varendah, the small water tank ( as kids we referred that as the swimming pool), the mango tree, the wedding of my aunt, the wall over which Indian Army would peep to check the people at home,  the house of my aunt and then of course the kannae kalai mannae song.

village children fishing in the sea with a polythene bag 
When I walked into the house this time, it just stuck to me that I can remember more than this, the house, which in all my memories was a place filled with joy, people and life, suddenly looked so quiet, worn out and uninhabited. The places looked as if it has shrinked in size, the walkway that took 20 steps of mine earlier now took about 5 steps. Then I realized that the time has rolled. I am no longer the child who visited the place 20 years back and cannot expect things to be as it was at that time.

an exit of an old house
Later in the evening while taking stroll in the village it just clicked to me that this place should have once been a very prosperous village. Looking at the architecture of the houses I could not just stop thinking the fact that these houses were built atleast 40 years back and what sort of prosperity the place would have had at that time. Walking through it also the occurred to me the clear absence of a generation in the village. The scars the war has left on the livelihood of the people was so obvious.

view from the cremation place in village

The best part is the fact that, even in the current state, the village has a sense of tranquility,  being far away from the pollution, the noise and the life styles of industrialization. It gave me alot of fresh air allowed me to be in a zen state.

The attachment the people have on religion is very obviously apparent, while all the houses are in shambles they had made sure that the temples were all polished and maintained in top state.

Finally I liked the place, for that matter the whole of Jaffna, for one more reason, the bata slipper is considered decent enough even to be worn even to weddings and  its perfectly natural to go around in vetti or sarong even without a shirt. :D

Sunday, July 25, 2010

Interesting Applications

Among all the activities at the mBillionth  the 1st Ever  South Asian Mobile Content conference, hSenid launched its cloud enabled developer platform with Etisalat. It was a very important thing for us, as we had been doing this outside and not at the place where we call it home. I find that alot of people cannot still figure out how and why the apps we are talking about are different. Unlike other mobile application stores which rely entirely on the device capabilities this application developer platform that we launched focuses on utlizing the operator network capabilities like SMS, MMS, LBS, etc. Let me come back to a description of this on a separate blog on a later date( hopefully). 

On the day of the mBillionth I was actually living in parallel worlds, where I had to attend the Developer event and also the Jury of the mBillionth. Thanks to the good hearted people at the mBillionth they gave me an hour time to attend the developer event and play whatever little part I could. So I attended the appzone launch for an hour and then I did the vanishing act from the event to make it in time for the Jury Proceedings.

Then commenced the Jury proceedings which was a battle in its own right. 14 Members of the grand jury from four countries, putting all their heads together and going into the wee hours at Taj Samudra category by category debating, discussing, voting and of course selecting winners.

There were some non - commercial mobile applications that caught my attention and of course at most times, the attention of the other Jurors too.


Its a J2ME application for a cause. Its an innovation which is capable of converting the mobile into a Simple yet effective instrument to fight auto driver scams. The idea itself of boldly using the mobile to fight a common mans daily war is commendable. The icing on the cake of the solution is that it provides a feature to lodge a police compliant via an SMS.

SMS Based Automated Registration of Admission Test

Shahjalal University of Science & Technology Bangladesh has launched its SMS based registration for admission test. It is a solution which takes out the entire hassle of the admission test registration flow and includes the following steps.

1. Registration for the admission test
2. Verification of the SMS request with the exam board
3. Confirmation of eligibility
4. The payment for the admission test deducted from the mobile account
5. Confirmation of the registration process

Who wouldn't want their universities to also take out the entire hassle of the registration process and of  if possible the hassle of the exams too ;) What next? Mobile SMS exams?

Nepal Wireless

Started as a project to provide wireless access to the remote Nepal and now seems to be converting it into a project for building a broadband information highway across Nepal . A project I guess started about 8 to 10 years back and today has covered and connected many villages, communities and schools, which otherwise would have been totally disconnected from the rest of the world.

I personally has had a fascination for the geographies of Nepal and hearing about the project has just added fuel to my curiosity. Don't be surprised if I decide to get lost in the wilderness of Nepal for a few days any time soon. :D

I wrote this post a few weeks back and it has been in my drafts for a long time. I didn't want to let the cat out of the bag about the winners of the mBillionth. Anyhow I guess its safe to publish it now since the award ceremony was during the course of this week and I hear that it was a resounding success.

Monday, May 17, 2010

A leaf from the Software Engineering text Book for the country

The software Engineering best practices prescribes that even when a small bug is deemed to be resolved by a developer,  the resolution should not be accepted at face value, specially without a a root cause analysis and appropriate test cases implemented to make sure that such scenarios are captured. The main concern is that they don't want the bug to be re-opened. Re-opened bugs are supposed to be frowned upon and any PM will usually make a big fuss of a re-opened bug.

When such care is taken in the software world for a bug, which is not life threatening at most times. I was wondering whether anyone is doing that to our own local issue.

Its been an year since the war has ended.  On the positive side we no longer shed blood in mass scale. Bombs(at times even human bombs) doesn't any longer go off in Colombo, fighter jets no longer does carpet bombings in its own country, people no longer die without knowing which sides bullet they were killed by. Its indeed a very positive change in that sense.I honestly wish the current status quo continues forever.More than that wish that just wishing could make sure that this will continue.

I see that as a nation we had become lethargic about the larger issue at hand and almost concluded that the absence of war as the end of all the problems. During the course of the year we were pre occupied with election tamashas, political soap operas and then of course all the cricket, pushing actions of national reconciliation out of limelight.  We have forgot that this is a conflict that has been going on for decades and thousands of Sri Lankan youth thought that it was a cause, noble enough, to pay the ultimate price for whichever side they believed in. Most importantly end of war I dont think has solved the underlying concerns.

I know some of you out there should be wondering that this guy is trying to create an issue out of no where. Just let me take a simple case to show that the divide is still there.

Usually news papers try to position the stories to please their reader base. The bottom line is that the news paper is a business entity and in order for it to be successful it should supply to the demand. So in a sense the pulse of the society is usually reflected in how the newspapers position the stories. On any typical day take Sri Lankan news papers of all three languages and just by checking the first page itself the completely contradicting voices between the Tamil and the other two language papers would become clearly evident.

I will take the most recent Sunday news papers and show you how divided we are,

 Sunday Times [English Weekly] - Headline item 

Sunday Observer [State run English Weekly] - Head line Item

Virakesari [Tamil Daily] - Headline Item

Uthayan [ Tamil Daily - A regional newspaper for North and East ] - I think this was the headline

Just Check how varied the perspectives are and funnily what appears as headlines in the English newspaper is not even in the foot note of the Tamil papers and vice versa. Just imagine how the difference will be if we take into consideration the Sinhala news papers too.

Now this doesn't mean that we need to impose restrictions and bring back censor, instead we should do a root cause analysis and fix the issues. So that these issues are never re-opened again.

Tuesday, April 13, 2010

Reversing the market

I have this strange feeling that web has missed the trick on creating a different type of business model. I think probably it is appropriate to call this as “reversing the market”.

When someone wants to sell stuff they probably start a shop and sell whatever they want. So in that case the buyer had to approach the seller and do the buying.   I know that what I’ve said there is not rocket science , that’s what  has been happening for years, that’s the very reason we have millions or billions I don’t know what ever number of shops after doing the marketing of their goods and services playing the waiting game for the buyers to come.       

Then with the advent of internet we have seen that people building a web front to enable their sales, it has gone a bit more and we also see the existence of portals like ebay , where many sellers who list their items and play the waiting game.

When I try to compare these web portals with the traditional way of doing business, the usual ecommerce site selling items of a single merchant is similar to the shops/store fronts and then a place like ebay is similar to a traditional market place, where multiple sellers get together and sell stuff.  All in all, as i see it, by the introduction of the web, we have achieved an innovation in introducing another channel for sales, however we have not changed the status quo of the fundamental model, where the seller lists/keeps the items, does the marketing and waits for the seller.  

Customer is the King

Very often I am told that the customer is the king, but in reality with this business model I see the customer to be more like the prey. When thinking about this waiting game, I cannot stop imagining a big crocodile keeping is mouth open for the pray to come and sit inside it.

Just imagine a world in which, when you wanted to buy a camera you go and write a note and hang it on your own door and wait for the sales people to come and present the options and the customer like a real king looks at the options and picks the best one. I know probably you have already started to wonder, is this guy out of his mind? Can the sales people just go around checking each house? You would think that whats the amount of land to be covered, and how long can a buyer wait, blaa blaa

Now because of these arguments, it true that this model is not practical in the traditional way of sales. Quite understandably the model is not practiced in the sales of usual commodities unless the buyer is buying things of great value.

But in the world of web it’s quite a practical thing, imagine a site where you go and publish whatever you want to buy and then the sales people come and give the offers and you make the decision to buy based on that.
It is very handy for stuff like buying a SIM; getting a bank loan, getting an insurance package …you name it.  Obviously for the SIM agent or bank loan executive or the insurance agent, the place where people are listing their need for the service is a heaven and they will automatically come to the site and make the offer to get their sales commissions, so these stuff can be the starting point for this “reversed model” and I am pretty sure later on others will follow suit and come to the party.

It’s actually reversing the market, in a traditional world it’s like going to a market place and you put up a board with your shopping list and expect the sellers to come and sell you the stuff. In the old school of thought its stupid, but in modern times its practical. It will be absolute buyer power and the customer becomes the real king!

So the need is to have a portal where the requirement listings are done and get the sales agent to join the party. I am just fascinated by this model and I can see an unbelievable potential in it. Anyone interested in a start up? This is one for you! Let me know your thoughts on it. Would love to hear!

Sunday, March 7, 2010

Holy Noise

I live in a country which is very ‘religious’ to the core. People are pretty confused about the difference between religion and culture/customs. There is always a lot of comparison between religions; naturally this has led to competition too. The people who assume that that they are practicing different religions have drawn up some funny competition parameters. These people have assumed that placing statues at all the corners and increasing the volume of the loud speakers from the places of worship to be a way of showing the power of religion.

Loud speaker volume game gets even more ‘interesting’ when you have two rival religious places next to each other. You can observe the noise being increased to unbearable levels from both ends at the same time. Best part of it is when some of this actually continues throughout the day. Funnily as a kid I used to think that the preaching’s being done live and the clergy doing it should be very tired. Later I got to know that I was wrong, even those who have put up the noise find some cotton wool and stick it into their ears and happily asleep, while the people in the neighborhood suffer.

This is one of the logics very hard for me to understand, has any of these religions in their scriptures asked people to use loudspeakers and boom this noise? Why cannot the followers just tell others that this is nuisance? Is it a religious treachery if you talk about this in public?

I for one being a Hindu, with whatever little knowledge that I have about Hinduism is sure that getting into this trap of competition with other religions is actually causing more harm than any good. I see it as a deep disrespect that we can do to the religion of ours. For god sake, if you have a personal score to settle with the others use something else and leave out the name of the religion!