Sunday, April 10, 2011
Hit by the procrastination bug
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
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.
Criteria | MySQL | MongoDB |
Type of database | Relational | Document |
Installation | 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 |
Queries | Using SQL | No 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, db.mine.find() | |
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 | |
Indexing | 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 |
Replication | ||
Mode of Replication | asynchorouns | asynchronous |
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 |
Sharding | 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, http://oreilly.com/catalog/0636920001096
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 |
erincha amman kovil, viyapari moolai - let me confirm the name |
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 |
an exit of an old house |
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
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.
Suruk http://suruk.com/
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 http://www.sust.edu/~admission/
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 http://www.nepalwireless.net/
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
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
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!