Sunday, June 24, 2007

HashMap sorted based on values...

Just wrote a simple HashMap class to have entries sorted based on values...i.e. the keySet() method will return the keys based on sorted order of their corresponding values...

Here it goes...

import java.util.*;
import java.util.*;

* HashMap with entries sorted based on Values. (keySet() method will return keys sorted based on values.)
* @author Sumedh Inamdar
public class ValueSortedHashMap extends HashMap {
  public Set keySet() {
    TreeSet s = new TreeSet(new MapValueComparator(this));
    return s;
   * Comparator class for comparing keys based on values. Assumes that values are 'Comparable'.
  class MapValueComparator implements Comparator {
    MapValueComparator(Map m) {
      map = m;
   public int compare(Object k1, Object k2) {
     if(!(map.get(k1) instanceof Comparable)) {
       System.out.println("ERROR...ValueSortedHashMap could not compare the values...");
       return 0;
     return ((Comparable)map.get(k1)).compareTo(map.get(k2));
   Map map;

By the way...does any one know a quick way to post formatted code on site? This was pain in a$$...Blogger just removes my spaces after I do some editing...and for even adding spaces, I had to hack it like this :(

Friday, June 15, 2007

India Tech Startup scene - Social Networking

For last few weeks, I was following indian tech startup scene...started by reading some excellent articles by Paul Graham and Guy particularly interested after reading a detailed report in Business Today (3rd June issue)...VC investments in India shot up from $17 million to $166 million in 2006...the scene is certainly red hot...

Here is a brief summary of web 2.0 (or just web...hell with this 2.0 or 3.0 crap :) companies...I will cover it categorywise…

Social Networking: MingleBox would of course be the first name coming on top...especially getting that sumptuous sum of $7 million from Sequoia. Then there is yaari, Jhoom, Fropper, DesiMartini, Indyarocks and not sure how many more…everyone is ‘Web 2.0’ with all the latest features of sharing photos, videos, blogging, yada yada yada. Find Amit Ranjan’s (of take here. There are some who are trying to find a niche. for cricket fans, or saffronconnect for music for example. It will be interesting to see who wins…there should not be more than 2 or 3 players in general category when war is over. Minglebox is tapping into the college campuses, by creating readymade college campus groups…really smart move...that will make the new generation stick on Minglebox after we all being taken by Orkut...
Orkut looks so passe with these agile newcomers…I wonder why on earth orkut was successful in India, in spite being nowhere in US...It will be interesting to see how the newcomers use mobile connectivity to a good effect. That can prove a main driver for people to switch from orkut…right now, the only reason I am active on orkut is that I have my friends there…the fundamental reason behind the term ‘critical mass’.

Don’t know if there are clones of variants like Fanpop (fan-following-social-network) or twitter (find-what-I–am-doing – the original purpose of weblog) in india…may be some people are working on those already…it doesn’t take long to have such clones these days, with internet minimizing geographical distances and spreading knowledge unbelievably fast…one more innovative venture is Ning…by Marc Andersson of Netscape fame…it allows you to create your own social network… of course it won't be much better than creating groups inside a normal social network as of now…you won't be able to really edit it the way you like...beyond adding a few widgets...but they will evolve…Facebook application platform is the latest buzz in this space, and is attracting huge crowd within very few days.

By the way, Marc Andersson is a fantastic read for people like me (startup aspirants)...a series of articles on life-of-startups here. There are 6 excellent articles in this series so far.

Wednesday, June 13, 2007

Internet Advertising Economics

With web 2.0 startups popping up everywhere like mushrooms these is getting difficult to distinguish real diamonds from the fake ones. Everyone is offering a great free, consumer friendly, lightweight, AJAXified, ultra modern Web 2.0 service, and expecting to make it big with Advertising revenues.

Total indian Advertising industry would be a minuscle 100million$ as compared to app. 16 billion $ market of US. Find an interesting discussion here. Moreover, it's not only about advertising. Advertising is a mirror of industry depth. For example, a business model like RearDen, a company focusing on business travel, would be useless in a country like India as of now, as we are far from being habitual in using internet for day-to-day needs. Moreover, we can afford to hire a person as a secretary, which Rearden tries to get away with. So, the complexity and depth of industry, especially the industry that heavily relies on internet is nowhere near US.

Even among current internet userbase of 20 million, it would be very interesting to know what is the amount of money being spent per person on internet, on e-shopping, or ticket booking. Of course, the internet awareness will increase very fast. Today's college goers are very net savy, even in small towns. They are tomorrow's earners and comsumers. So, picture after 10 years might really be radically different.
Quite a few startups have come up in online ad networks space.
Tyroo sold their stake to Yahoo very recently. They also have an Ad agency, Quesar media, under the same umbrella (Smiler interactive group). So, it might be their key USP.
Komli, is another one, started by Amar Goel, an ex-microsoft. They, I believe, are focusing on optimization of delivery, using behavioral targeting as their key USP. But, statistical methods and optimizations would be helpful when one already has a big portfolio of media and advertisers available. Google can show extremely relevant ads, based on geography and content type, only because it has a huge footprint among advertisers, as they say, 'the long tail' or 'bottom of the pyramid'. By the way, does anyone know what this name, 'Komli' means? :)
There is one more, called Ozone media, but not sure what they are upto.