Wednesday, November 24, 2010

Boost multi-index container quirks

I recently had the need to use a container that supports both fast search access and sequential (insert-order) access. The boost::multi_index_container was just that. It is an amazing piece of code. To use the container itself, however, is a bit quirky. First, let's see how we can use it.

Suppose your requirement is to define a map (for fast search) with an int KEY and some satellite data struct DATA, and you still want to access the whole list of (KEY, DATA) pairs in the same order as you inserted them. The way to define a multi_index_container for this is as follows:

#include "boost/multi_index_container.hpp"
#include "boost/multi_index/indexed_by.hpp"
#include "boost/multi_index/seqeunced_index.hpp"
#include "boost/multi_index/ordered_index.hpp"
#include "boost/multi_index/identity.hpp"
#include "boost/multi_index/member.hpp"

typedef std::pair<int,DATA> DataPair;

typedef boost::multi_index_container<datapair,
boost::multi_index::indexed_by <
boost::multi_index::sequenced<>,
boost::multi_index::ordered_unique <
boost::multi_index::member<DataPair,>
>
>
> DataContainer;

enum IndexType {
     kIndexSequential, // = zero (the first index is the sequenced index)
     kIndexSearchable // = one (the second index is the ordered index on the first member of the pair)
};

typedef DataContainer::nth_index<kIndexSequential> SequentialAccessIndex;
typedef DataContainer::nth_index<kIndexSearchable> SearchableAccessIndex;


// To declare a container
DataContainer myContainer;

....

// to insert content
myContainer.push_back(std::make_pair(12, someDATAInstance));
myContainer.push_back(std::make_pair(13, someOtherDATAInstance));
....


// to search for the content
SearchableAccessIndex& srchIdx = myContainer.get<kIndexSearchable>();
SearchableAccessIndex::iterator idx = srchIndex.find(12);
if (idx != srchIdx.end()) {
// ... use it..
}

// to sequentially access (e.g. iterate over the content, or add it to a list)
std::list sequentialDataList;
SequentialAccessIndex& seqIdx = myContainer.get<kIndexSequential>();
std::transform (seqIdx.begin(), seqIdx.end(), std::back_inserter(sequentialDataList),
std::tr1::bind(&DataPair::second, std::tr1::placeholders::_1));


So where are the quirks? Some hint in the last operation we did.. the sequentialDataList had to be declared as a list of const Data. This is the key issue. The multi_index_container does NOT allow changing the data in-place (that's not entirely true).

The container is not (and probably cannot be) programmed to be smart enough to know that only a part of the data is to be modified in-situ, while the indexes will remain intact. So, how does it allow updates? There are two distinct ways:

i) Using replace( ) which is an exception-safe way to do it. It takes the iterator to the element to be replaced, and a new object (which implicitly means your object needs to be copy-constructible).
// replace
SearchableAccessIndex& srchIdx = myContainer.get();
SearchableAccessIndex::iterator idx = srchIndex.find(12);
if (idx != srchIdx.end()) {
DataPair pair = *idx; // copy constructed
pair.second = someNewDATAInstance;
srchIdx.replace (idx, pair);
}

ii) The second, more sophisticated, way is to use modify which takes as its second parameter, a functor. This functor is passed a reference to the object being modified, and is responsible for modifying it as required. So,

// using modify()

struct ModificationFunctor {
ModificationFunctor(const DATA& someDataRef):m_Data(someDataRef)
{
}
void operator()(DataPair& dataPair)
{
dataPair.DATA = m_Data;
}

private:
const DATA& m_Data;
};


...
// actual modify
SearchableAccessIndex& srchIdx = myContainer.get();
SearchableAccessIndex::iterator idx = srchIndex.find(12);
if (idx != srchIdx.end()) {
srchIdx.modify(idx, ModificationFunctor(someNewDataInstance));
}

But if you are the old school, novice programmer that I am, you'd like direct access to the struct DATA, which after all is the only thing you wish to modify. Why can't you just let me have it? Why not?? :(

The answer is to use a const_cast. This is not necessarily the best way to do things, but it works, provided that the DATA you inserted into the pair is never really a constant. The way to do that is as follows:

SearchableAccessIndex& srchIdx = myContainer.get<kIndexSearchable>();
SearchableAccessIndex::iterator idx = srchIndex.find(12);
DATA& data = *(const_cast<DATA*>(&(idx.second)));

and then modify data as usual

data.whatever = whatever;





Monday, October 11, 2010

std::tr1::bind the hard way

I'll probably move this to a tech blog when I start one..

Usually, I'd just go up to my colleague (Mr. Skarpio, a.k.a. DirkGently) when in trouble with the STL. This time he's on leave, and I had to figure it out on my own. The thing in question is tr1::bind, a function template available in C++ for binding values to parameters in functions, and functors. It is supposed to be easier to use than the older std::bind1st and std::bind2nd. But, I'm new to STL, and of course to the "functional" way of life. So, I had a real hard time to get this right. So how do you use it...

Here's how :


Example 1: Using it with regular functions

void foo(int bar1, int bar2)
{
std::cout << bar1 << bar2 << std::endl;
}

And then some where in your code, if you use..

std::tr1::bind(foo, 10, std::tr1::placeholders::_1)(20)

What this does is of course useless (mostly). The list of arguments after "foo" above has one of the following two things (actually, it can have more, but for now two will suffice):

1. a value
2. a placeholder

So the expression above is equivalent to calling foo(10, 20);

If you do it the other way around, i.e.
std::tr1::bind(foo, std::tr1::placeholders::_1, 10)(20);
then that's equivalent to calling foo(20, 10);.

If you specify placeholders for both, i.e.
std::tr1::bind(foo, std::tr1::placeholders::_1, std::tr1::placeholders::_1)(20); ,
then both parameters are taken from the actual list of parameters, i.e. it is equivalent to calling foo(20,20);.

Example 2: Using it with function objects (functors). This is where I got stuck and then read the documentation here carefully to discover this
In the general case, the return type of the generated function object's operator() has to be specified explicitly (without a typeof operator the return type cannot be inferred):
So, for example, here is a simple rendition of the same function "foo" as a functor:

struct foo_object {
void operator()(int x, int y) {
std::cout << x << "," << y << std::endl;
}
};

Now, using std::tr1::bind(foo_object(), 10, std::tr1::placeholders::_1)(20); does not work. So, basically, the struct has to be modified to add a new result_type typedef. That is,

struct foo_object {
typedef void result_type;
void operator()(int x, int y) {
std::cout << x << "," << y << std::endl;
}
};

Now we can use this, std::tr1::bind(foo_object(), 10, std::tr1::placeholders::_1)(20); , and it is indeed equivalent to calling foo_object()(10, 20).


Now for the actual utility of it... of Mr. tr1::bind :

Binding is used for clever "functional"-type programming in C++. For example,
  • suppose you have a std::vector<std::string> strings;
  • and a function std::string get_suffix(const std::string& str, long suffix_len); which gives you a suffix of the string that is suffix_len in length,
  • and now you want to extract out all suffixes of length 2 and length 4 from the list of strings and store them into distinct vectors std::vector<std::string> suffix_2, and suffix_4.
The regular way to do this is to use a for-loop that looks like this:
std::vector<std::string>::const_iterator iter = strings.begin(), iterEnd = strings.end();
for (; iter != iterEnd; ++iter) {
suffix_2.push_back(get_suffix(*iter, 2));
suffix_4.push_back(get_suffix(*iter, 4));
}
But, the STL way to do this is:
std::transform(strings.begin(), strings.end(), std::back_inserter(suffix_2),
std::tr1::bind(get_suffix, std::tr1::placeholders::_1, 2));
std::transform(strings.begin(), strings.end(), std::back_inserter(suffix_4),
std::tr1::bind(get_suffix, std::tr1::placeholders::_1, 4));

Of course, if Mr. Skarpio ever saw this, I'd be in for some rebuke, because he'd probably use some compositional stuff and do it in a single expression.






Sunday, July 18, 2010

Programs I love - Today's program - jQuery

Just so that I don't forget, I've decided to blog about programs that I really use and love. It's not important if anybody reads it ('cause this is basically my web "log" :D)

They say, a programmer can only be known by his work. So is the case with John Resig (http://ejohn.org/). His program - jQuery (http://jquery.com/), the write less and do more library that he wrote is a beautiful Javascript program. Beautiful, because it really works and is really small. So what is it?

jQuery's a Javascript program library that allows you to write your own Javascript code in a compact fashion. One common task in Javascript programs is to access specific elements on a page (for example, a div with an id="something"). jQuery provides easy (and new) ways to access them using what are called Selectors. These selectors are the same that are used in CSS for styling. So for example, if you styled a div by giving its class="someClass" attribute, jQuery allows you to access this element using jQuery(".someClass") . But that's not all - the object returned by jQuery(".someClass") is actually a wrapper over the page DOM object, and exposes a number of functions of its own. For example, it provides a click( ) function which takes in as argument, a handler function (basically, the functional programming approach) which gets called whenever the element is clicked.

Another important thing that jQuery does to compact the code is to use chaining of objects. So, if you've written jQuery(".someClass").click(function() {...}) , and you would like to do some more things to the same object, then you basically add a dot and continue jQuery(".someClass).click(function() {...}).hide( ) for example.

jQuery also provides a number of plug-ins that make a programmer's life easy. CSS is often used to style elements on a web page. jQuery provides easy ways to create good looking UI elements. For example, the Accordion navigator which is very useful for showing many categories of links in a compact manner, can be very easily built on a web page using jQuery(...).accordion( ). It only requires that the content be laid out as a hierarchical list (<ul>) tags. The good thing about it is that if for any reason (like if the browser doesn't support Javascript), jQuery doesn't work, the page still looks okay, because, it is still just an unordered list on the page.

All these things make jQuery a very handy program for creating web pages. The best thing, however, about jQuery is that it is cross-browser. This is very very important for web applications and pages that need to render on different browser, the likes of IE6, and Safari, and Opera, etc. jQuery just works.

Behind the scenes, when jQuery uses another library called the sizzleJS library which provides the basic selector functionality.

Oh! and one doesn't really have to write jQuery(...) everywhere.. One can simply use $(...) everywhere instead.

Friday, June 25, 2010

Proving the Cone volume formula without Calculus

High school students would probably do it in a jiffy. I've been baffled for a long time now about proving the cone volume formula of PI*R^2*H/3 .. Just haven't figured it out till date (i.e. a good solution). It's amazing that the volume formula has existed for such a long time and was invented before calculus came into being. My last attempt was basically cheating on the idea of a limiting value to determine the radius of an infinitesimal height disc that constitutes a cone.

Yesterday, however, I thought I found a better answer - not nearly close to an elegant solution - because it still uses the volume of a cylinder (which is slightly easier to explain), but a calculus-free solution nevertheless. The idea came ironically from a book on calculus (one I purchased recently). The second theorem of Pappus which states that the volume of revolution of a planar lamina about an external axis is equal to the surface area of the lamina times the distance travelled by the center of gravity of the lamina, plays the central statement in the solution. ("Central" sounds like there're too many things about it, but really there's just a little more).

So, now imagine a cylinder (volume = PI*R^2*H) with radius R and height H. Also imagine a right triangular lamina with its back (the perpendicular) resting on the cylinder. The lamina's dimensions height=h=H, base width = r. If you rotate this triangle about the cylinder's central axis you'd get a section of the cone. If you reduce the radius of the internal cylinder to zero, you'd get a perfect right-circular cone.

The volume of the cone can therefore determined as the volume of the rotation volume of this circular lamina.

Incidentially :) the position of the centroid is at (r/3, h/3) from the right vertex. Thus, the distance travelled by the center of gravity is (2*PI*r/3).

And the area of the right triangle is (r * h)/2 = (r * H/2)

Therefore, the volume of rotation (or the volume of the cone) is 2*PI*r/3 * (r * H/2) = (PI * r^2 * H) /3 which is what we set out to prove... It was so simple ..

Please don't ask me to prove Pappus's theorem without calculus..

Monday, November 23, 2009

iBOS - the Internet Browsing Operating System

Oh well! Sometimes, when some smart people come up with an idea that you've already had, and sort of done something... It's a nice feeling. That's what I felt when I first read about the Chrome OS. It was practically the same idea that we (Anuj, Amit and me) had back in college. We wanted to do an operating system that's a web browser - for low-end machines - the likes of kiosks in a library, etc. We did it.. sort of.. We started out writing a new kernel... and ended up (mostly feeling stupid) writing a text-based web browser (that's right, we only had about 3 months and we didn't even know how to write Makefiles :D). But yes, we wrote a browser that read some HTML, filtered out the rest (and the Javascript), and we made it the default shell of a stripped-down RedHat 8 distribution. It was extremely basic (meaning crude, I even remember putting in a SIGSEGV handler towards the end of the term) with a vim-like dual mode (edit and browse) interface. But it was fast. Coupled with a filtering proxy which we mostly used to filter out unwanted (spelled unhandled) HTML markup and JS code, and to make the actual HTTP calls to the servers, we had a couple of systems running as kiosks in our lab. And guess which page we used to demo.. that's right www.google.com :D Oh! and the search worked, because we added support for GET/POST form submission in the last month of our term.

I guess, it does take a bunch of really smart people to do it on a really usable scale. But it does feel nice to boast about these things once in a while - that you were once nearly right there amongst the smart ones. Now I'd have wanted to put a link to the documentation and source code, but alas... Yahoo shut down their geocities (philanthropy) where we'd put it. So, all that remains of it now is on my machine, and a thick volume of documentation that my friend Anuj made me write (I still curse him for it).

I hope someday we all get together again as a team and maybe write something to compete with Chrome OS (Day dreaming... well it's night time around here anyway.)

Tuesday, July 7, 2009

एक और बजट पर्यावरण के लिए

यदि ऐसा अधिनियम किसी दिन हमारे संसद में प्रस्तुत हो तो कैसा रहेगा?
वाहनों के विषय में: -
१ किसी भी व्यक्ति के पास यदि एक से अधिक ईंधन-चलित वाहन हो तो उससे अतिरिक्त कर लिया जाए।
२ यदि कोई भी ५० वर्ष से कम आयु का व्यक्ति किसी ४-पहिया वाहन में अकेला दीख पडे तो उससे कर लिया जाए।
यदि किसी को कोई साथी न मिले अपनी गाड़ी के लिए तो वह सार्वजनिक वाहनों का उपयोग करे।
३ यदि कोई ५० वर्ष से कम आयु का व्यक्ति किसी वाहन चालक को अपनी सेवा में रखे तो उससे अतिरिक्त कर लिया जाए।
४ सरकार इस वर्ष से हर मार्ग पर कम से कम २० विद्युत-चलित बसें चलाएगी।

विद्युत संरक्षण हेतु: -
१ किसी भी घर में एक से अधिक वातानुकूलन यन्त्र न हो। यदि किसी के घर में वृद्ध लोग हों जिन्हें उनकी आवश्यकता हो तो वे अपने किसी एक कमरे में ऐसे यन्त्र का प्रयोग कर सकते हैं।
२ रात में १२ बजे के बाद सब विद्युत उपकरण (पंखे एवं ऐसी को छोड़ कर) बंद कर दें।
३ घर में एक से अधिक फ्रीज या वाशिंग मशीन होने पर अतिरिक्त शुल्क लगेगा।
४ प्रातः ८ बजे से सांय ५ बजे तक कोई भी प्रकाश देने वाले उपकरण उपयोग करने पर अतिरिक्त विद्युत शुल्क लगेगा

जल संरक्षण हेतु: -
१ प्रति व्यक्ति हर घर में पानी की व्यवस्था कुछ इस प्रकार होगी -
नहाने के लिए ३ लीटर
पीने के लिए ५ लीटर
शौच के लिए ३ लीटर
अर्थात प्रति व्यक्ति, एक दिन में ११ लीटर से अधिक पानी नही उपयोग कर सकेगा।
२ किसी भी घर में टुल्लू अथवा पम्प का प्रयोग निषेध होगा।
३ वर्षा ऋतू में वर्षा का पानी एकत्रित कर अपने ११ लीटर के कोटे से कम पानी प्रयोग करने वाले सभी नागरिकों को पुरस्कृत किया जाएगा।

अभी बस इतना ही। शेष वचन फ़िर कभी।

Thursday, February 12, 2009

Kolkata: A Weekend

The city, like every other Indian city reflects images of the past, and of the future. Here are a few shots from my phone (hence the low resolution) of a day in Kolkata - the city of joy (Mukherjee?)
The order is completely random (well not really!)



The new symbol of the city (the second bridge over the Hooghly river).
The massive engineering feat reflects progress in the state. Or does it?














A republic day celebration at a locality
What does a republic day mean to a rickshaw puller?
























The city has loads of glimpses of the British empire. Many have been preserved to date for their beauty. Or have we still not gotten over our rulers?









Morning Breakfast. National integration at this level - Puri Bhaji (a typical northern dish) is savored by many in Kolkata.






The many modes of transport in the city.



Tuesday, November 11, 2008

Lazy me

Indulgence enters into one's life in disguise. It first tempts you to take a break from the good old hard work you've been doing. It then shows you ways of comfort and luxury. Finally, it takes over your mind and controls your actions. Later still, you start justifying it.

Here are few things lazy about me:

1. Sometimes, I use the car to get to office. My justification for it - I'm too tired, or I'm ill, or I'm late and the buses would be too crowded. That's all crap! Completely trivial!

2. I've stopped washing my own clothes. Why? Because I caught a flu two weeks ago.

3. I've stopped studying stuff and reading. My justification - where's the time? I've got all the time in the world, and yet little motivation to study. All of this time, I'm merely dreaming or thinking about some issues in my life. Where's the space to understand others' problems.

4. I've stopped calling or writing to friends. Why? No particular reason! I can't even justify it.

5. I don't pay my bills on time. Again, sheer laziness!

6. I've stopped blogging and even thinking about India. Got to change this! Now!

Wednesday, September 17, 2008

10 things about my nation I wish to change

There are many things that my nation needs to change. But of those, here are 10 that I strongly believe can and should be brought in. What I personally can do for these is another question, the answer to which would probably reveal the inherent inactivity and cowardice of my nature.

1. Changing the religious atmosphere:
Public houses of worship of all sorts (except those with tourist value) be converted to schools of Indian values. Teach people about their language (Sanskrit and Urdu), about ancient wisdom, about Indian medicine, about Indian values of satyanugrah, salaah, sangharsh and jihad against the atrocities of life itself, about the Indian way of life, and about purusharth. Make them think about what is good in other cultures and what isn't - what is worth adopting and what is to be warded off. Teach them to be thrifty in spending and buying only what they *need*.

2. Changing the roads:
Only electric and mechanical vehicles on the roads of my country. No use of diesel/petrol.

3. Changing the way of recreation:
No big budget entertainment. Cut the pays of actors and cricketers who are eating into the government's budgets. Take a stance on concerts and plays rather than movies. Let cricket be a sport and be treated like a sport. Only people passionate about it should be in it - not people who think advertising is the way to go.

4. Changing the government's way of spending money.
Absolute transparency in government budget allotment and use. Here's one possible solution. Create a new agency called the Tax Bank. All tax payers' money goes into their own individual accounts (that's about a 25M accounts). Government agencies pick up money from these accounts as and when they need it. Each time they do so, they file an application to do so, stating their purpose and their expected expenses. The people can then monitor what project their money is going into, and have the right to question the Government on the same.

5. Changing the Politicians:
All (aspiring and existing) politicians to give up all their property holdings and money to the government. All (possibly only male) politicians be required to serve in the army for at least 1 year. All politicians be required to work in public service departments of one or the other

6. Changing the way of law enforcement.
More authority and better pay to law enforcers. Keep them motivated to serve the country. Anybody found engaging in bribery of any sort should be executed, not sent to jail.

7. Changing the economic outlook.
No further selling of agricultural land to property builders. Stop all property projects and concentrate on getting food and medicine for the underfed and the sick. Stop cutting trees and creating new houses. All big houses should be broken down and several small houses should be created - enough for everybody to live in - a simple two room flat is good enough for a family of 4. Permit bigger houses only for joint families - that too be strictly commensurate to the number of people dwelling in the house.

8. Changing the rivers of my country
Spend a lot of resources on finding good ways for waste disposal. Then spend energies in cleaning the rivers of this country. Let the water of the rivers be drinkable again. (This would be perhaps the last thing on the Government's minds). But it is so important that this happens.

9. Changing the face of scientific research in our country
We are lagging behind the rest of the world in scientific research because we are racing them in their own way. Why are we even trying to catch up with everything that the US does? People there only know and use the "what"s and "HowTo"s of science. We should have research done in a manner that considers consequences of direction (like why am I developing this new program compiler?), trying to answer the "Why"s and "What for"s of science. Not every discovery or invention, is useful, though it can make money. Throw away all such inventions to selling them to the westerners (they love them!).

10. Changing people like me
I am an example of a person with some ideas, little validation and no action. If I changed into a being that acts on his thoughts, I may bring about changes I think are good. If the people of this nation changed their mode from thinking and speaking to doing... it sure will be a different world.

Tuesday, September 9, 2008

Sorry! But we're Indians

Is it a thing to be sorry about? To be an Indian... Not really! Though, the day doesn't seem too far away. We have managed to pick up so much from the western culture, and yet here are a few questions:

> We've managed to learn to respect people wearing shirts and suits, while we haven't still caught up with the stop-at-red-lights culture.
What is it about us that wants to make us unruly on the roads? Why can't we peacefully stop when the lights turn red? Is it that hard? Why can't we drive in a single lane? Why do we take pride in driving faster than other drivers?

> We've managed to learn how to build good roads, and yet lost the honesty involved in building them (look at the sorry state of the roads in my country...). Why are the roads always broken when there's rain? Why are some roads never repaired? Does our government have no money? Or no time?

> We've learnt to accept the rock culture (and gay parades...), and yet we don't have enough tolerance towards the different religions that color the people of our nation. Why don't we abolish all such religious practices that create friction between fellow earthlings? Why doesn't our government ban public religious activities altogether? Did Gautam Buddha acquire enlightenment in a crowd? Did any rshi or any sant ever find God or Allah in a temple or in a mosque? I say, break all the temples and all the mosques in this country and create houses for the poor and food for the underfed! Let God be in our hearts and not in some buildings of grandeur.

> We've learnt English as our medium of communication - a good thing since it links us with the world. But why have we lost touch with Sanskrit, Farsi and Urdu? Why have we forgotten these languages that define our culture? Why should all the authoritative books on Sanskrit and Urdu come from people of foreign origin when this is the land of their genesis?

> We've learnt how to make money (or have we?). But why are we headed in the same capitalist way that the US did? Why do we ever believe that their economic stances are superior to those taken by our ancients? At this time, I remember one small piece that our beloved martyr Bhagat Singh wrote: The light burns dim in the lamps of the needy, and in such light a thousand revolutions thrive!

Thursday, September 4, 2008

India's Dependence on the US economy

It is sometimes disheartening to know that the once glorious nation, the gold reserves of which drew raiders and plunderers from around the world, and the culture of which inspired million, is so dependent on the economy of a nation built on the principals of debts, mortgaging and capitalism, and with no culture of its own. So much so that when the dollar falls with respect to the rupee, all is lost for foreign trade and exports; and when it rises, the purchasing power of the country's masses goes down. What's up?

Why is this dependence so deep? Let us try to analyze. India exports services and goods to the US. A chunk of India's GDP comes from selling these things, and a major chunk of this chunk is in trade with the US. As a result, if things don't go well within the US and people stop buying things, India's exports are hit. Now when the dollar falls against the rupee, Indian stuff in the US becomes expensive, and so the returns are fewer. What about selling to other countries? Well, they don't have that many needs (because, quite frankly, none of the other countries are as consumerists as the US). And as a matter of fact, the other countries don't have the means to import too much.

And when the Indian rupee falls against the dollar, obviously, the people can buy less. So how can we break this vicious circle of dependence?

Sunday, August 31, 2008

Bicycles Inc.

I keep getting a lot of crazy ideas. Here's one! Why doesn't everybody start using bicycles for short distances? Here are a few obvious things to gain from using them:
1. Obviously no pollution. Gain in carbon credits for the country.
2. Less pressure on the country's fuel requirements.
3. Good health of the people - cycling is a good exercise.
4. Fewer accidents - how many times have you seen hoards of cyclists hurting each other.

And then some of the more obscure things:
5. Better roads - lesser abrasion of road materials.
6. Lesser power requirements in companies - people would have to start early in the morning and leave early in the evening - for which sunlight could directly be used to lighten the buildings.
7. Lifestyle of rickshaw pullers gets a boost.
8. Bicycles mean not only healthier people but more alertness for them, more athleticism, and less of the oh so prevalent cut-throat mindset.
9. Lesser spending on fuel, cars and accidental repairs means better lifestyle for the people.
10. World peace - people would have lesser time for fighting with each other - since they'd be too busy cycling to their workplace.

Of course, there could be some people who'd be unhappy with this development:
1. Car dealers - what would they do? How about selling cycles?
2. Car manufacturers - Oh don't they have enough money? They could start manufacturing bicycles. After all where they'd be selling a single car - they would sell 3/4 bicycles in a family. The profits would admittedly be low - but what the hell! That's a small price for the country's overall happiness. We will get back to this issue in some other post and analyze what can be done for car manufacturers!
3. India Inc. - this thing does not really exist! It is only a virtual image of things that the developed world has created for our country. It does not really capture the aspirations and nature of problems of the Indian masses.
4. The developed world. Well they've had their time.

So! What say?

Saturday, August 30, 2008

Economic Growth of India

The intellectuals are all worried about the dipping economic growth of India. The newspaper is buzzing with news of the poor quarterly growth of our nation and the weakening GDP numbers. What I began to wonder was this - how should the growth of a nation be really measured? Does the GDP really reflect the gross happiness of the people of the country?

Well I personally think that the economists of our age are a bunch of loony mathematicians who think that human life can be judged and measured in numbers! No computation in this universe can ever capture the number of dimensions to the ground reality of the economics of this country. Here are a few points worth pondering about:

1. Industrial growth leads to progress of the country in some sense. At the same time, it kills opportunities for some farmers. At the same time it gives jobs to millions of people. And so should we assign weights w1 and w2 the happiness of the newly employed ones and the unhappy farmers and determine their gross happiness together as h1w1 - h2w2. Does it really work that way? Should a 100 lives be thrown into oblivion so that 10000 get a good life?

2. Jobs in IT companies have given a lot of Indian people a lot of money. This has raised their "standard" of living, and the cash flow in the market, and the consequent boost to the economy. Let me ask one question - before the IT boom happened, weren't people living well enough? Were the sudden NEEDs of having a super market (and the resultant overspending), or buying an iPod, or eating at Pizza Hut (which thanks to the stuffed pockets of people can put exorbitant price tags on their products) always a part of this country. I think not! It all looks like a conspiracy. Don't think so - check out this website http://www.storyofstuff.com and you'll know what the third world meant to the US and what India is fast transforming into. The point to be pondered upon is whether having all that more money went into "really" helping India, or did it turn the naturally satisfied average Indian, into ever hungry, ever mkore materialistic creatures.

3. Can there be no economy without contributing significantly to the "consumption" face of things? Can economic growth not be tied up to making people understand that they need less, and on the core value of self-sustenance? I thought, the great Indian culture had all the answers. That's what I was made to believe in my younger years. Who then carries the knowledge of how to make people happy without them wanting more and more pieces of cake made from the very flesh of their fellow planet-mates? Can there be no respite?

Sunday, August 24, 2008

Kashmir

The oft quoted quote for this beautiful land says "If there's heaven on earth, it is here, it's here, it's here...". What happened to this land of Sufis and Rishis? The news around the world have reported of the "freedom struggle" of the Kashmiris. The cities and towns are burning. The Hindus are unrelenting, the Muslims ready to break off another piece of land. The Indian government is pushing the people with way too much pressure. Pakistan with its own democracy in shambles is encouraging the fire. And the diaspora of the nation all talking about a possible separation.

Sometimes, I wonder if the partition was really inevitable. Was the India-Pakistan and the India-Bangladesh partition an unavoidable thing? Had the people of Lahore, Peshawar and Rawalpindi, who had risen together to fight the British out of this country, suddenly decided that India was too pro-Hindu to be together with? Wasn't the greatest Indian martyr (Bhagat Singh) born and executed in what is now Pakistan? Then why all this blood? Why the need for separation?


If there is a need for anything, it's change of rulers. So far the pro-Gandhian people ruled this nation with as much as dexterity as the Roman Caesars did! They all knew what the vastly uneducated (not necessarily illiterate), and the middle-class majority of this country wanted. And that's true for both India and Pakistan. One nation calls itself Secular, the other, Free! And governments of neither conform to any of their idealism. A really secular government would have done anything and everything to have saved Kashmir from falling into the separatists' traps, who by all measures know how to spark a rebellion only too well.


And what I am absolutely shocked about is the fact that media is completely underplaying this whole issue of Kashmir. There're hardly and news reports, any fora for the people of Kashmir, and no features voicing the Indian youth about this issue, in the media. All they care for right now is a bloody bronze medal in the olympics. Oh heart! heart! heart! Oh the bleeding drops of red! Since when has the cricket match, the newly released movies, the olympics medals, and other so many trivia become more important than the whole idea of the nation breaking up again! Are we still sleeping? Why isn't there a mass movement in the country to save this situation? Is the Government the only body in the universe which can do anything about it? Can we do nothing? Except, writing such blogs... (I wish I were a still born!)

Our most beloved ex-President, Dr. Kalam asked us all to dream. I dream of a Kashmir that is the next Silicon Valley - it is the only place that can be it. I dream of India, Pakistan and Bangladesh as one nation again - at least in spirit. I dream of the world where people stop fighting for a piece of land - because the land is there to stay - but the people aren't.

Sunday, August 10, 2008

Non-performing Cricketers

There have been lots of controversies about players being Gods, and the same players being inconsistent, and the critics favoring or bashing them.

Are the cricketers really to blame if, without being consistent players, they lay claim to being part of the national teams on grounds like seniority. What active option do they have if they are to leave the national team? None, I guess. The only thing they can resort to is Advertising...

Maybe, having the team structures revamped to a level where other than the national leagues, players who are or have been part of the national squad form a separate league of their own, can help. Let there be two national teams, an A and a B. The A team handles all the tough international teams, while the B gets to play the easier ones (spelt Bangladesh, Kenya, etc.)

What that means is that if a player like Sachin Tendulkar, or Virender Sehwag does not perform consistently, they can be removed from the national team without too much heartburn or creating a public issue. These players can continue to play in the new "league" of players which play the slightly easier international teams (Bangladesh et al) and get sufficient money. This way, if and when they regain form, they can be brought back into the mainstream play. If they don't perform there either, they can be rested (spelt thrown out).

Just a thought...

Followers

Blog Archive

About me

A soul possessed forever...