Sunday, May 31, 2009

Vote For Party or Vote For Candidate


Many times, I have seen people voting for a person, because, the contestant is a good person. This is fine in Corporation, Municipality, and Panchayat elections. But, this is a not a good criteria in Assembly or Parliament elections. In Assembly and Parliament elections, the criteria should be how good the top 5 controllers of the party, and not the contestant.

All the members of Parliament (Loksabha as well as Rajya sabha) are supposed to join any ministry of their choice, and come up with policies that will improve their ministry area. Every MP gets some money for improving their constituency (For Loksabha) or area (For Rajyasabha). They are expected to raise the bigger issues related to their consituency/area or which impacts other constituencies/areas.

The duty of MLA and MLC is also similar to Loksabha and Rajya Sabha MPs respectively. But, unfortunately, most of them have degraded to very low level. MLA is not expected to solve the problem of water connection, street roads or other smaller issues. Local corporator/Councillor/Surpanch is supposed to solve those. If they cannot solve, then they should go to chairperson/Mayor. But, the present MLAs degraded to very low level problems and started taking commissions in every small thing.

Many people say that, I never saw MLA, and he never bothers about my problems, so, I am not going to vote for that person. That is not correct. For their small problems, they are electing councillors and chairman. It is their responsibility to solve. MLA will come into picture, only if the problem is very big. MLA's responsibilities include high level issues which impact the entire constituency/state, and not one family.

In most of the parties, the top 5 controllers control the entire Country/State. So, electing one person from a party as a MLA or MP, is nothing but supporting the top 5 people of that party. Even if the candidate is very good, if the leader of the party is very bad, then the state/country will suffer by that. If we vote for a bad candidate under the leadership of very good leader, then the state/country will prosper. Corporator/councillor/Surpanch are supposed to solve the individual's problems, so in that elections, we should vote for the person and never for the party.

Unfortunately many people do not know the difference between these two, and not electing properly.

Thursday, May 28, 2009

Drivers - Timings


It is disheartening that 5 Infosys employees were killed in a bus accident.

What I observed is, most of the time, people miss very basic things. In many fields, people work more than the required no.of hours in their job. Eventhough productivity goes down by working more than enough, still the managers make them to work more. The same thing is happening even with drivers.

I know three accidents of my acquaintances, out of which two are of car, and one case is of two wheeler. In both the cases of car accidents, the driver did not have enough sleep. Due to functions, they needed more time of the driver, and in both the cases, the driver had to work for more than 12 hours. When I asked them, why did not they get another driver for few days, their reply was, it was difficult and tedious to get a driver for few days. They talked as if, it was unnecessary to get a new driver or take a car for rent just for few days. But, the price they paid was very high for the savings. In those cases, they did not even wear seat belts. Had they wore seat belts, the impact would have been lesser. In the case of two wheeler, had the person wore a helmet, he would have been saved.

Most of the accidents and injuries would be reduced significantly, if everyone takes two precautions. The driver should not drive, if the he does not have enough rest. All the passengers should wear seat belts/helmets. These two simple things will save many lives and injuries. I request everyone to follow atleast these two basic points.

Monday, May 25, 2009

Did Loksatta split votes of TDP or TDP split votes of Loksatta?


For the last few days, TDP has been saying that, it lost because of the votes split by Loksatta. It is well known that, most of the people who voted for Loksatta has TDP as the second preference. That's why TDP is saying like that. But, I would say, Loksatta lost because of TDP. Because, many people voted for TDP eventhough they wanted to vote for Loksatta, with the only reason that, they did not want Congress to come back to power. Due to some external reasons, many votes went to TDP from Loksatta. That's why, I would say, TDP has split the votes of Loksatta, and not the other way.

Sunday, May 24, 2009

Finalists in IPL 2010

Yes. You read it correct. This is not about finalists in IPL 2009. It is about finalists in 2010.

In 2007 ODI World cup, both India and Pakistan left in the first round itself, and they reached the finals in 2007 T20 World cup.

In 2008 IPL, Bangalore and Hyderabad were the last two teams, and in 2009 IPL, both reached the finals.

Similarly, can we expect Mumbai and Kolkata (the last two teams in 2009 IPL) to play in the finals of 2010 IPL?

Let's wait and see!!!!!

Update: Deccan Chargers (Hyderabad) which was in last position in 2008 won in 2009, and Royal Challengers (Bangalore) which was in second last position in 2008 got second place in 2009.

Wednesday, May 20, 2009

Quote of the Day

If you want your wife to listen and pay strict attention to every word you say, talk in your sleep.

Friday, May 15, 2009

Using Twitter for Status Messages

I started using twitter for my gmail status messages. They are also available on my blog.

URL for my twitter account is http://twitter.com/tnsatish

RSS Feed is http://twitter.com/statuses/user_timeline/38406967.rss

Tomorrow, I will try to use it to the maximum extent (for election results). :)

Saturday, May 09, 2009

A Programmer dies and goes to heaven.


He reaches the pearly gates and is amazed to see a happy crowd all waving banners and chanting his name.

After a few minutes St. Peter comes running across and says, "I'm sorry I wasn't here to greet you personally. God is looking forward to meeting such a remarkable man as yourself."

The programmer is perplexed. "I've tried to lead a good life, but I am overwhelmed by your welcome," he tells St. Peter.

"It's the least we can do for someone as special as you are. Imagine, living to the age of 160 and still looking so young," says St. Peter.

The man looks even more dumbfounded and replies, "160? I don't know what you mean. I'm only 40."

St. Peter replies, "But that can't be right - we've seen your time sheets!"

Source: Funtoosh

Wednesday, May 06, 2009

Abusing Properties in C#


C# properties allows one to access data similar to variables instead of methods. Internally, the implementation might be same. But, by looking at the code which uses properties, one thinks that, it is using variables. If we don't use properties, then, we have to use methods to get the same.

I wanted to get the data from sharepoint list, and wrote the following code. (list is a sharepoint list SPList).

for (int rowIndex = 0; rowIndex < rows; rowIndex++)
{
    for (int colIndex = 0; colIndex < columns; colIndex++)
    {
        Console.WriteLine(list.Items[rowIndex][columnNames[colIndex]]);
    }
}

The list contains around 3000 items, and each item contains around 40 columns. For this, the above code took around 17 hours. It is not a feasible option for me. So, I tried various things, and finally changed the code to below.

SPListItemCollection listItems = list.Items;
foreach (SPListItem listItem in listItems)
{
    for (int colIndex = 0; colIndex < columns; colIndex++)
    {
        Console.WriteLine(listItem[columnNames[colIndex]]);
    }
}

How much time do you think the above code would take?

It took 2 minutes.


For the people who know only C# and no other language, probably, it may not be a surprise. But, for those who have good knowledge in other languages, it does not make sense. Many developers (those who worked in other languages) think properties similar to variables. It is not intuitive to cache the value from the properties.

If there is lot of computation to be done, then they should use methods. If the data is ready and no computation/retrieval is required, then they can use properties.

While optimizing the performance for the above code, few non-developers in my team insisted me to use profiler to find out the problem in the above code. But, I did not run any profiler on the code. One non-developer ran the profiler on that code and got the results, and other non-developers insisted me to take those results. If you are a developer and know that sharepoint is a proprietary software, then I don't need to explain anything on this.

Sunday, May 03, 2009

Google Reader in Offline Mode From Different System


By using Google Gears, Google Reader can be used in Offline Mode. In this, if we go to offline mode, then we can read feeds without connecting to internet. But, this is possible only from the same browser from which we went to offline mode.

Whenever I don't have internet at home, I wanted to store the feeds in my pen drive, and read it from home. For that, I have done the following.

Install sqlite db from http://www.sqlite.org/download.html.
Add sqlite folder to the path.
Get the googlereader.vim from http://www.tnsatish.com/software/googlereader.vim.

The google reader database is in a single file and is located at C:\Documents and Settings\<username>\Local Settings\Application Data\Mozilla\Firefox\Profiles\<somestring>.default\Google Gears for Firefox\www.google.com\http_80. The filename would be something like GR-379e715a5932e600#database.

Copy both database file and vim script to a folder, and run the following commands from that folder.

c:\> sqlite3 GR-379e715a5932e600#database
sqlite> .output reader.html
sqlite> .dump
sqlite> .quit

c:\> vim -s googlereader.vim reader.html

After the above commands, reader.html will contain all the unread feeds. If you want all the feeds including read feeds, then in the vim script, remove the fourth line :g/state.com.google.read",/d.