Monthly Archive for March, 2011

Firefox Awesome Bar Auto Complete

The Awesome Bar of Firefox is too good. However, when compared to Google Chrome’s bar it lacks in one aspect. Search for single keywords.

I always use the location bar to search. Say I wanted to lookup the techcrunch webpage. In Chrome all I have to do is to type techcrunch and hit enter. The Google search shows me the result. In Firefox the same does not happen. Instead, Firefox interprets the single keyword as http://techcrunch/ and then goes on to display an error page. Shucks!  They force me to either break up the keyword into two, for example; as tech crunch, or else open google.com and then search for the single keyword.

That is when I stumbled across a plugin for Firefox which does the instant search thing. Good though it was, I decided to get rid of it after just an hour. The reason? Well, it required me to type g every time if I wanted google search. And habits are not easily changed.

But after removing it, I noticed that my Awesome Bar wasn’t showing me the drop down option bar as it used to earlier. Upon googling, I found that the config can be corrected by going to the about:config and searching for the keyword browser.urlbar.

I noticed one another config option that was turned off by default: browser.urlbar.autoFill. Turn this on, and Firefox will try to auto-complete the search string using the best option from the Awesome Bar, mimicking Chrome’s behavior.

Awesome Bar just got more Awesome!

Popularity: 8% [?]

Playlist at Le Rock >>> Purple Haze

I do not know if this is the norm or rather an exception, but I enjoyed more at Le Rock than Purple Haze, both at Bangalore. Asked for an opinion, I would definitely prefer Le Rock to the other. The reason – playlist.

At Le Rock, the DJ played lots of rock songs and as the stipulated closing time drew nearer the songs kept getting better and better. We knew every song that was being played and enjoyed it by singing out loud. It was not just us, every table around us had people standing, swaying and head banging to the classic songs.

Purple Haze on the other hand played metal for most part. Had they stuck with heavy metal I wouldn’t have complained, but very quickly the genre changed to death metal. Amon Amarth was followed by Arch Enemy. Next was Children of Bodom. Then came Cradle of Filth. After that I did not know any of the songs that were being played. It was the same across every table. Only towards the end, the last half hour did the DJ play Pink Floyd and Led Zeppelin.

Le Rock scores more in every aspect in my opinion. Though nothing even comes close to the time I had at Hard Rock Cafe!

Popularity: 4% [?]

Google’s Collateral Damage

Click on the image to enlarge it.

Google's Collateral Damage.

Infographic by SEO Book

Popularity: 2% [?]

TOW I Preferred Facebook Messages To Gmail !

I needed to contact Amit Tiwary immediately. He wasn’t online. I called him. No answer – probably busy in a meeting or something. What to do? What to do?

Facebook Messages to the rescue.

Facebook -> Messages -> New Message.

To: Amit Tiwary

<the message>

Check the box on the lower right corner to send the message to mobile as well.

A few minutes later, I get a reply from Amit. He replied to my message, which was sent to him as an sms, and the reply was updated in the messages thread and simultaneously sms’ed to me. Work done!

What I liked about this system is that, as a person sending a message you should not fuss about the medium of delivery. It is Facebook’s responsibility to ensure that the other guy gets your message, be it chat, mail or sms. And the other person should conveniently be able to reply to the message.

This is something Gmail lacks right now. They could perhaps let a Gmail user select a subset of contacts whose mail notifications be sms’ed if the user is not online on Gtalk or if the Gmail session is not active. And this should not be something difficult to implement.

Popularity: 2% [?]

Partition Function

The problem is to enumerate all the ways in which a given number can be written as sum of two or more positive integers. For example 5 can be written as [4, 1], [3, 1, 1], [2, 1, 1, 1], [1, 1, 1, 1, 1], [2, 2, 1] and [3, 2].

I used a recursion to solve the problem. The recursion works like this. Write 5 as 4 + 1. Recurse for 4. 5 can also be written as 3 + 2. Recurse for 3. We are done!

Below is a piece of code written in Java to do the same. I use a map to store pre-computed values. Using the code, I have found the answer for 60. It takes a minute though.

There is this problem on project euler – Problem 76 – which requires one to find the number of ways 100 can be partitioned. Using the above code, I get a heap space error for 100. I suppose instead of enumerating all the ways, to solve the project euler problem, I should try to just count all the possibilities. This might me much quicker.

Here is the java code for the above recursion.

 

    /**
     * Find all the ways of writing a given number as sum of positive integers
     *
     * @param n the number whose partitions are to be found
     * @return the set of all the partitions of the number
     */
    public static List<List<Integer>> partitionFunction(int n) {
        return NumberRepresentations.partitionFunction(n, 1, new HashMap<Integer, Map<Integer, List<List<Integer>>>>());
    }

    /**
     * Find all the ways of writing a given number as sum of positive integers
     *
     * @param number the number whose partitions are to be found
     * @param minValue the minimum value of any partition number
     * @return the set of all the partitions of the number
     */
    private static List<List<Integer>> partitionFunction(int number, int minValue,
            Map<Integer, Map<Integer, List<List<Integer>>>> preComputedValues) {
        if (preComputedValues.containsKey(number)) {
            List<List<Integer>> prePartitions = preComputedValues.get(number).get(minValue);
            if (prePartitions != null) return prePartitions;
        }

        List<List<Integer>> partitions = new ArrayList<List<Integer>>();
        partitions.add(Arrays.asList(number));
        if (number == 1) return partitions;

        int rightVal;
        for (int leftVal = number - 1; leftVal >= (rightVal = number - leftVal); leftVal--) {
            if (rightVal < minValue) continue;
            for (List<Integer> leftNumbers : NumberRepresentations.partitionFunction(leftVal, rightVal,
                    preComputedValues)) {
                List<Integer> tempList = new ArrayList<Integer>(leftNumbers);
                tempList.add(number - leftVal);
                partitions.add(tempList);
            }
        }

        Map<Integer, List<List<Integer>>> prePartitions = preComputedValues.get(number);
        if (prePartitions == null) preComputedValues.put(number,
                prePartitions = new HashMap<Integer, List<List<Integer>>>());
        prePartitions.put(minValue, partitions);

        return partitions;
    }

Popularity: 7% [?]

I Want A Torres Jersey

Torres Jersey
Torres Jersey

I have waited so long to buy a Chelsea jersey, and now that Torres is here, I want one! So this weekend I went to the nearest Adidas showroom – the one at Koramangala, near Sony World. They have had one on display for a long time now. But the originals always come without any name printed. I asked the guy if he could get it customized for me. Even though he was reluctant at first, he agreed. He called up the Brigade road showroom to inquire about the possibility. The reply – they do not have the font for printing! I have been told to wait some 10-15 days after which they might have the fonts – which ships from Delhi apparently.

I suppose I’ll give them 10 days time after which I’ll buy the jersey – customized or not.

 

Popularity: 3% [?]

IRCTC Is Being Ridiculous Now

It’s 8 in the morning and I need to book a tatkal ticket. I have my computer connected to a 4 mbps connection and the minute it shows 8 in my clock, I fire up the browser and hit the irctc url. The page loads up, I enter my password and hit enter. After an agonising wait, the home screen loads up. I have done my homework well and have noted down the train number and the station code so that I do not have to search for the these using the crappy irctc interface. The left hand sidebar has an option for quick book.  I hit the quick book option as I have always done in the past. But what do I see? Instead of the quick book form coming up, I get an error screen telling me that quick book has been disabled for the 0800 – 0900 hours time interval! WTH!

When you make excuses like millions of people trying to access a page at the same time being the reason for the service to be slow, it is understandable and bearable. But when policy changes such as these are made, one can only look at the screen in exasperation and wonder what survey led to such a policy proposal. How dumb must have the people been who allowed the change to happen. Let me try and explain why I am so pissed off at irctc.

Booking a tatkal ticket is like going to war. If you fail to complete the transaction by 0810, there’s a very good chance that all the tickets have already been booked. So I use the quick book for that. There is no need to search for the train. You can do it earlier and make a note of the train number and station code. In the quick book for, just enter these in the respective forms, fill up passenger information and you are good to go. Enter the card details and ticket has been booked. The only problem in the whole process is that of the server being overloaded due to which pages fail to load sometimes.

Now what irctc has done is to  disable the quick book option during the first hour of tatkal booking. So now I have to waste my time searching for the train whose number I already know, get the availability information which I did not want to in the first, and only then proceed with passenger information. I  now have to do 2 extra post queries and wait for the responses from the server which takes an eternity.

I have been taught to always optimize the process, reduce the number of steps required to get any work done and minimize the inconvenience caused to customers. Perhaps the clever busy bodies at irctc have been taught another definition of customer experience and satisfaction. I seriously hope they be able to think like normal intelligent human beings.

Popularity: 14% [?]