September 6, 2009

Hello World Arduino !

I got my arduino board today. If you don't know what arduino is, "Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments". (from

I have written sort of hello world of Arduino !. Blinking LED. Follow the excellent tutorials from

Similar Boards.
At first I was confused between freeduino, sanguino, seeduino etc. These are all clones of arduino (There are many more. Checkout wiki).Although arduino hardware and software references are available opensource, the name "Arduino" should not be used in the derived works. So these boards often uses a name that ends with "duino". Often you find freeduino and sanguino. There is no difference between freeduino and arduino. Sanguino is a more powerful varient of arduino. You can find the difference between arduino, sanguino and arduino mega here.

Where to buy ?.

The board I got is from makershed. There are lot of starter kits available. Before buying any of these check out comparison of these boards here.

If you are in India then you don't have much options. Makershed is shifting the boards to India but the shipping cost is 25$. You can find freeduino and sanguino board from Bhasha e-store. It is Pune based company. The price of these boards is very less Rs 1000 (20$) and you can get useful components (including 16x2 lcd, breadboard and few more components) for about Rs500 (10$). This is the cheapest of all.

Useful links.

August 8, 2009

Disassembling Inspiron Laptop

On a weekend (2 months back I guess) I didn't know what to do :) and I decided to disassemble my laptop. Here is the guide. Mine is Dell Inspiron 1420.

First remove the battery pack from the system.

Before disassembling, identify the important parts of the system.
1. Battery
2. CPU Fan

3. RAM
4. Hard disk
The nice thing here is that if we want to upgrade one specific part, we can do it without touching other parts. For example, if we want to upgrade the hard disk we can just remove screws shown in part 4.
We have to start disassembling from front side. First time I started from backside and I couldn't continue further. As shown in figure, pull the highlighted part and you can able to remove the entire frame (including the frame that has power button).

The next step is to remove the keyboard.
Be careful while removing the keyboard. Back side there will be a connection to mother board.
After removing the screws, pull it up and remove the connection to the motherboard.

Remove this connector and keyboard will be disconnected from the rest of the system.

Next step is to remove the monitor. First remove the supported cups (1 and 2 in figure). Just pull them off by holding the thick edge.

Remove the connection to monitor (4 in above figure)

Now the hard part comes. Remove the wifi cables. Be patient while remvoing. Here, reassembling takes more time than disassembling.
We have removed all the connections to the monitor.

Now remove the rest of screws and you are set.

August 1, 2009

Appengine Task Queue API & Gotchas

I recently added a new feature for Appsd. It shows the recent iphone related news from twitter. For this we search twitter every 10 minutes and gather all links. It shows the highest tweeted links. I used task queue api and cron for crawling. Here are things I learned from task queue api.
  1. As of now Task queue api is in experimental state. So you have to import it from google.appengine.api.labs.taskqueue. When it got stabilized you have to import it from google.appengine.api.taskqueue. So proper way of importing is, first try to import from google.appengine.api.taskqueue. If it fails then import it from labs.

  2. If the response of the request is not HTTP 200 OK then appengine tries to reexecute the task after some time. This is a big problem. It has two side effects. Task might have failed because of some temporal problem or because of some bug or exception. If it is the second case, reexecuting the task after some time won't solve the problem. Second problem is, it basically exhausts your 10000 quota limit.

  3. Now there is no way to increase the quota of tasks from 10000 requests. So if each task is not taking more time then pack more tasks into single task. For instance I process multiple urls in single task.

  4. If you change schema, don't forget to support the old schema. (Refer 2nd point)

  5. when you change something from post to get then do support get request and return nothing otherwise task will fail. (Again refer 2nd point)
Update: Task queue uses exponential backoff scheme to prevent single error exhausting your quota. see this post.

June 11, 2009

Startup City

Last Saturday i attended Startup city at Nimhans convention centre. It was second time i attended. These were few companies that i found interesting.

MedFlo Telematics: They Develop telemedicine kiosks. This project is already started and they deployed few kiosks in rural areas of Kerala.
Vidteq: They show driving directions. Instead of showing just maps they show actual video directions. Among the companies that participated in conference, this is the only service i used before. Though this is a very good thought, i find streaming a bit sluggish. They should provide even more options like controlling the stream speed etc to make it more usable. This is simplified version of Google street maps.
Iken Solutions: They developed recommendation engine for different domains.
Latlong: Its a location based service. You can get the results by SMSing or by installing their custom software. Since GPS devices are not prevalent in India they maped tower information to location.
Ennovasys: Provides supply chain management solutions. Companies can directly track their inventory directly using their software and it is integrated with Google maps.
Panini: They developed Indian language keypad for mobiles. They did statical language modeling to predict the word you are typing. Accordingly they change the characters in the keypad. So you can type faster. You can send the text throughSMS and they even compress the text while sending. So you can send many characters in one SMS. The main disadvantage with this software is, the same software should present on other mobile to read.

May 29, 2009

Market oriented programming

Apart from CS , the other subject I like the most is Economics . Why economics ? The interesting aspect of economics is, we convert each and every problem into problem of 2 variables namely supply and demand . Thus the complexity of analyzing more variables is reduced to that of 2. I liked the simplicity of this kind of analysis.

Basic principles of economics can be applied to any subject that deals with analyzing the interaction between limited set of resources and players. Economics' analysis explains why certain behavior is happening and how it ought to have happened etc. If the behavior is not what it ought to have been then we change the rules to bring it back to intended one.

Examples of where economics have been applied ( from Wiki ), Economic analysis is applied throughout society, in business, finance and government, but also in crime, education, the family, health, law, politics, religion, social institutions, war, and science.

When I was doing my masters I had given talk on Market Oriented Programming. I am sharing the slides. In this talk I had taken few examples where economic analysis had been applied to computer science problems. As I said earlier, economic analysis is best suited for analyzing Resource allocation problems. We face this problem quite often in computer science. For example,

1. How to allocate the storage space to users. (You can say fixed, but is it really good ?. There are many who are not using any allocated spaces and others who always wants more space. How to draw the line here ?)
2. Load balancing
3. Adsense. Perhaps this is the best example of how the theory of economics can be applied to a CS problem.
4. Facebook is planning a feature where you will buy some credits and give that credits to friends notifications and posts. More on it


I haven't explained about it in my slides. But I wanted to give overview of it. The problem for Google is ( Here we are taking Google as an example and its true with any other search engine), what kind of Ads it has to show on a page ?. What ever Google do should satisfy three entities, 1. User, 2. Advertiser and 3. Google themselves. So, it has to achieve the following objectives.
  1. It should show relevant Ads to user. If it is not showing relevant ads then users find it less interesting and nobody look at them and it leads to Ad Blindness. Eventually users won't follow ads.
  2. It should satisfy the advertiser. Advertiser should get as many users as possible to their site through the Ads. This is possible only when it's Ad is shown at right place and at right time. For this, each advertiser bids for certain ad terms (Its like describing what Ad they are going to show ) and pays amount to Google based on users visiting the advertisers page. (i.e how many users actually clicked the Ad) Potentially there will be many advertisers, to maximize their chance of showing the ad they have to bid more.
  3. Google should maximize its revenue from above transactions.

How Google achieved these objectives ?
  • 1 and 2 are of related and assumed Google did its best to show relevant Ads. :)
  • 3. Google should maximize its revenue from advertisers. This is done by introducing competition among advertisers. Google uses a variant of vickrey auction (In vickrey auction, highest bidder wins, but the price paid by him is the second-highest bid). Since there will be few Ad places Google should find a way to choose few from these advertisers. ( For example, if you search in google, in your right hand side at the most google shows 8 Ads. So here we have only 8 Ad places or slots )

Whatever mechanism Google chooses,it should not have any side effects. For example, lets assume that Google chooses the advertisers based on the bid amount. What is the problem with this approach ?. Lets see whether it achieves our objectives.
  1. Users should get relevant Ads: This objective may or may not be achieved and it depends on honesty of advertisers. For example, when a user is searching for BMW cars, he should not get advertisements about Ferrari, Toyota cars. This is possible if Ferrari and Toyota bids for BMW keyword. So advertisers may lie and Google should consider it. Second reason why advertisers can lie is, remember they pay only on number of clicks, so advertisers may bid for many irrelevant terms for high price. They do this to increase the brand awareness. Since they are bidding high, their Ads will always show up and users will not click these Ads because these are irrelevant Ads and eventually advertisers will not pay money to Google. The Advantage advertisers get is they show their Ads on lot of pages by paying little money. If Google is not showing relevant Ads, as discussed, it will increase the Ad revenue.
  2. Advertisers should get users to their page: Again this may or may not be achieved for the same above reasons.
  3. Google should maximize its revenue: At the first glance it appears that google got maximum revenue but its not true. Since it may not be showing relevant Ads, it increases the Ad Blindness and looses its revenue. It may be good for short term and definitely not good for long term. Yahoo used the above approach for long time and eBay exploited it. (I got this info from Prabhakar Raghavan's Talk)
Actually Google uses combination of Quality score and Bid amount. Quality score is again combination of CTR (Click through ratio and it is ratio of number of clicks of Ad to number of times they showed the ad), Relevance and Landing page quality. See below YouTube video to know more about Google Ad auction. By using Quality score google eliminates the above problems and still making lot of money :) .

In economics Mechanism design is the study of designing rules of a game or system to achieve a specific outcome, even though each agent may be self-interested. These systems are formally analyzed using Game theory.


Introduction to the Google Ad Auction ( )
Example of how bittorrent client uses mechanism design to improve file sharing.


April 7, 2009


As we know, one of the great innovations of IPhone is Appstore . It really made finding and installing apps easier. As of now there are more than 30,000 (Its 30444 while i am writing this article) iphone apps available in appstore. Installing an app is just a click away. Problem is finding apps. They solved this problem partially, by grouping the apps into categories or you can search for an app (IPhone search is getting improved greatly. It is definitely far better than couple of months back.) Both of these have some difficult. Lets say, some how you find an app and before buying the app you wanted to compare the similar apps. Now there is no straight forward way to do it. With appsd we tried to solve this problem.

The problem I faced frequently is, whenever I wanted to buy an app, I wanted to know the feedback and alternative applications to try out. Also whether there is any free version of that app available and other such information. I can read the comments for feedback but i find misleading many times.

Appsd tries to solve these problems. From last couple of months i have been working on the this project. (I work mostly an hour or two hours on this. That's the maximum time i can devote :) ) Appsd is a tool that lets you find related iphone applications and related articles. It achieves this by grouping all the similar applications together. The similarity between the apps is found by comparing the title and description. (designed as vector space model)

Related articles are found by using Yahoo boss API. We do normal search for that application and then we filter the results based on website. We maintain list of 45 websites and we show reveiws only from these websites. We do filter some of the results from these sites if we think they are not appropriate.

Site is hosted in Google Appengine. The main drawbacks is search. Appengine doesn't have sophisticated support for search. Now only games are present. I will upload rest of the apps in a week time. The name appsd came from apps + deamon.

References (Excellent book) (It can easily increase python speed by 7x)

February 13, 2009

1234567890 .....

Today unix epoch time is going to cross 1234567890 !!. Track it in