Friday, August 20, 2010

The costly whistles

Benjamin Franklin recalls an interesting childhood experience that he had.

When he was seven years old, his friends/family filled his pocket with coppers. He went to a toy shop where he got charmed by the sound of a whistle. Later on they way back he found a similar whistle in the hands of another boy to whom he gave all his coppers in exchange of the whistle. He came back home and happily whistled all over the place in excitement. When his siblings came to know about the bargain, they told poor little Ben that he has paid four times more for the whistle than what it was worth. On this Ben's thoughts shifted focus from the excitement of possessing the whistle to what other good things he would have bought with the rest of the money.

A grown up Benjamin Franklin writes "As I grew up, came into the world, and observed the actions of men, I thought I met with many, very many, who gave too much for the whistle."

All of us have the experience of having paid too much for our whistles. In personal relationships, professional careers, business transactions and personal beliefs. All of us possess whistles which were very exciting initially but turned out to be too costly later.

Monday, July 26, 2010

DCI Architecture

DCI (Data Context Interaction) is a concept that could help us model our business solutions better. Proposed by Trygve Reenskaug (the creator of MVC), and Jim Coplien (well known expert on OOP and patterns).

DCI aims to have a simplified and more commonsense approach to "Object-Oriented Design". The key observation made is that most object-oriented approaches captures the structural aspects of systems well, they are not so good at effectively handling the behavioral and interaction aspects.

DCI stands for: D: Data, C: Context, I: Interaction.

Most software systems has these three aspects. The structural aspects (Data), Interacts with each other in well defined Contexts.

The main article by Jim Coplien could be found here.
A presentation and interview by Jim Coplien.

Tuesday, June 22, 2010

Ten Principles of Good Design: Dieter Rams

The ten principles of good design from the famous German designer Dieter Rams. They are generic and makes sense in any industry or product:-
  1. Good design is innovative.
  2. Good design makes a product useful.
  3. Good design is aesthetic.
  4. Good design makes a product understandable.
  5. Good design is unobtrusive.
  6. Good design is honest.
  7. Good design is long-lasting.
  8. Good design is thorough down to the last detail.
  9. Good design is environmentally friendly.
  10. Good design is as little design as possible.

More details about Dieter Rams & the principles here.

Thursday, May 13, 2010

Embedded Jetty Server

A simple utility class to embed Jetty web server:
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.FilterMapping;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;

public enum WebContainer {
private Server server;

public void startServer(String resourceBase, String contextPath, int port) {
try {
server = new Server(port);
ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS);
// add servlet context init params using the following
// handler.getServletContext().setInitParameter(, );

// add event listeners using
// handler.addEventListener();

// add filters using
// handler.addFilter(, , );
// add servlets using
// handler.addServlet(, );
} catch(Exception e) {

public void stopServer() {
try {
} catch(Exception e) {

Use WebContainer.INSTANCE.startServer(...); and WebContainer.INSTANCE.stopServer(); to start and stop the server respectively.

Thursday, April 29, 2010

Implementing a simple deterministic rule engine

The following is my experience of implementing a simple deterministic rule engine (if at all it can be called such) in JavaScript using Mozilla Rhino. This was part of the enterprise platform we are building in our company. We tried using Rete based JBoss Drools earlier but felt that a simpler deterministic rule engine would better suit our purpose.

The need for such a thing was due to various reasons:-
i) Rete based stateful rule engine was an overkill for our use case
ii) The non deterministic and asynchronous nature of Rete based rule engines makes debugging and testing very difficult (as pointed out by Martin Fowler)
iii) Most of the rules in our case were of the nature of validations or calculations which makes Rete an overkill
iv) A tailor made custom rule engine gives more flexibility and power
v) Our consumers (product developers) were not at ease with the programming style of traditional rule based approach

The approach went something like this:-
i) Enable server side scripting in JavaScript using Mozilla's Rhino engine
ii) Capture rules as metadata in the form of JavaScript statements (majority of them will be of the form if condition then action)
iii) Expose domain objects and other relevant APIs into the rule scripts at well defined lifecycle phases of entities (CREATE, UPDATE, DELETE, etc.)
iv) Execute the rule scripts within the context of domain objects and relevant APIs during the life cycle of domain objects (typically CRUD phases)
v) We also support a MANUAL context wherein developers can set relevant domain objects explicitly and invoke the rule engine

The beauty of LISP (and Clojure)

A couple of years ago, I accidentally came across the strange word Clojure, which I later came to know as a LISP style programming language on the JVM. At that point I was a total newbie to functional programming (and LISP), having spend most of my programming time on C, C++, Java, etc.

The first impression I had when looking at a medium size Clojure program was that of a mess of parenthesis. Why in the world would anybody want to write programs of this sort?

As many others, it took a while for me to truly appreciate the simplicity, elegance and beauty of functional programming in general and LISP in particular.

Clojure might have a popular future due to its clean way of handling concurrency and light weight threads (through Software Transactional Memories aka STM)

Hats off to John McCarthy for creating LISP and Rich Hickey for creating Clojure.

Handling Spring ApplicationContext events in Spring DM based OSGi environment

Listening for and handling Spring ApplicationContext events in a Spring DM setup needs needs two steps:

1) Implement a class for the interface org.springframework.osgi.context.event.OsgiBundleApplicationContextListener
import org.osgi.framework.Bundle;
import org.springframework.context.ApplicationContext;
import org.springframework.osgi.context.event.OsgiBundleApplicationContextEvent;
import org.springframework.osgi.context.event.OsgiBundleApplicationContextListener;
import org.springframework.osgi.context.event.OsgiBundleContextClosedEvent;
import org.springframework.osgi.context.event.OsgiBundleContextRefreshedEvent;

public class BundleApplicationContextTracker implements OsgiBundleApplicationContextListener {
public void onOsgiApplicationEvent(OsgiBundleApplicationContextEvent event) {
if(event instanceof OsgiBundleContextRefreshedEvent) {
// handle bundle start
} else if(event instanceof OsgiBundleContextClosedEvent) {
// handle bundle close

2) Expose the above class as an OSGi service by putting the following entries in Spring beans-config.xml

<beans:bean id="bundleContextTracker" class="org.mypackage.BundleApplicationContextTracker" scope="singleton"/>
<osgi:service id="bundleContextTrackerOSGi" ref="bundleContextTracker" interface="org.springframework.osgi.context.event.OsgiBundleApplicationContextListener"/>

Capitalism and environmental damage

One of the general principles on which Capitalist economy and market (particularly the corporate world), works is "produce more, sell more; buy more, consume more". This is inevitable as increased revenue/profit is the yardstick by which all corporates measure their performance. In the long run this can happen only if the seller produce MORE and the buyer consumes MORE. Advertisements do a fairly good job of making consumers believe that they are lesser if they don't have certain goods (even when they really don't need it).

MORE seams to be the war cry of the majority of us living under Capitalism (both producer and consumer). But where is the MORE coming from, what is its source? Clearly it cannot come out of thin air. No doubt, we keep on improving our business models , processes and technology . But they alone can't create this MORE. There is something more fundamental than our technical innovation, free market and global economy that makes this possible. What does it cost for this so called MORE to be produced and consumed? The short answer is NATURE.

Most of the gains of modern human societies comes at the cost of NATURE. Scientists estimate that the environmental damage done over the past few centuries by our industrial modes of production is almost irreparable. Most of our energy hungry economies today cannot function without adding more CO2 to the atmosphere or by putting more holes in "Ozone Layer".

The Capitalist cry for MORE will continue to increase the damage.It forces individuals and societies to push nature to its limits. Day after day we as groups and individuals ask more and more from nature. Our bore-wells and oil wells gets deeper, our forests gets thinner, species of flora & fona gets fewer in number. Nature though pushed to its limits, somehow meets our demands. But, how far will it go on?

A day may come when NATURE turns back on us and tells , "I have given all that I could, I have nothing more to give". Many environmentalists feel that such a day may only be a few decades or a few centuries down the line.

Is this (the greed for MORE) a fundamental contradiction within Capitalism, a contradiction much more severe than the "Class conflict/contradiction" of Marxist analysis? This problem raises more questions. Will our greed for MORE stop at some limit? Do we need to look for alternative political systems? If not Capitalism, what?

Though very young, Capitalism has been by far the most stable and most successful political structure in the history of mankind. Thanks to the scientific revolution that developed almost in parallel with itself, Capitalism has made life better for a large number of people. It has fed and clothed more people than any other political system.

Communism/Marxism offered an alternate system that promised to overcome the inherent faults of Capitalism. But living in a time after the collapse of USSR and the other Communist giant China getting capitalized more and more, we can definitely say that Capitalism is the only major political system in the world today. (Exceptions like Communist Cuba, Dictatorships, Kingdoms, etc. could be very well ignored.)

Whatever be its demerits, Capitalism has one virtue that almost all other political systems in History lacked. It has a self corrective factor within itself. And that is what has made it the most successful of all political systems. The solution for environmental crisis and other problems due to human greed cannot be alternate political systems (be it economic/fascist/theocratic) or revolutions. Any sensible solution has to be more practical and pragmatic.

Though an over simplification, we could very well say that Capitalism like any other human enterprise is a tool that we created for ourselves. Its not an uncontrollable giant that controls our fate (as the historicist would see it). And any tool could be wisely used or abused. More than a change of tools, what we may need is to learn the tools wisely.

The long term solution would be DISCIPLINE. We need to learn as individuals, societies and nations to restrain our GREED.

Wednesday, March 24, 2010

The "lyre & harmony" analogy of Simmias

The scene is from Plato's dialogue "Phaedo". Phaedo who was present with Socrates on the day of his execution, narrates the events of that day to his friend Echechrates.

Socrates is condemned by the Athenian to be poisoned to death, on the false charges brought by the trio Anytus, Meletus & Lycon. But, Socrates is not at all worried about death, and converses calmly with his friends on various topics. The conversation inevitably moves onto topics like death, life after death, soul, etc.

Seeing that his friends are surprised at his calmness, Socrates says that "...he, who has the spirit of philosophy, will be willing to die; but he will not take his own life." Death is preferable to life because the true state of man is his soul, and his body and the soul's attachment to the body is only a temporary corrupted state. A man is not supposed to take his own life because, his life is not his own property but that of the gods. The philosopher prefers the true knowledge and wisdom of the uncorrupted soul to the illusions and sufferings of the body.

Having given the Soul a higher plane of existence than the Body, Socrates proceeds to clear the confusion of his friend Cebes that the Soul may perish along with the Body, by giving a set of arguments to prove the immortality of the Soul:

i) Cyclical Argument:
Like asleep-awake, hot-cold, odd-even, etc. opposites generally have a tendency to follow each other. Death & Life being opposites follow each other. From life to death and death to life runs the cycle.

ii) Recollection Argument: Many times one kind of information or knowledge may indirectly trigger the recollection of other kinds of information or knowledge. Also people tend to have knowledge about topics which they were unaware of before being questioned about (a priori knowledge). This kind of knowledge is nothing more than recollection, which is possible only due the fact that the knowledge was there in the Soul beforehand.The Soul is not a clean slate (Tabula Rasa) at birth, but has knowledge from its previous births, which could be recollected.

iii) Affinity Argument:
The soul resembles that which is invisible, immortal and divine, and the body resembles that which is visible, mortal and earthly. The soul is related to the divine whereas the body is related to the corporeal. Hence the soul and its existence is not limited to the body to which it is temporarily attached.

iv) Absolute Form Argument:
Every phenomenon on Earth is an corrupted subset of an absolute and perfect form of itself. The beautiful is a limited representation of the divine absolute beauty, worldly knowledge is a limited representation of divine absolute knowledge, etc. Similarly, the physical life of the body is a limited representation of the "Absolute Form of Life" the soul. Hence soul is immortal.

Everyone around are captivated by the logic of these arguments. But two people Simmias and Cebes are doubtful. Their objections are as follows:
Simmias:- The harmony (music) of the lyre perishes before the lyre itself. How can the soul (the harmony) continue to exist when the body(the lyre) is destroyed?
Cebes:- The Soul may not perish with the body, but that doesn't mean its immortal. A weaver may weave many coats and outlive most of them, but the last coat he weaves shortly before his death outlives the weaver. Similarly, the soul may outlive many bodies, but can get gradually worn out and finally its last body will outlive the soul.

The listeners are dumbstruck. Both are powerful objections in front of which the earlier arguments of Socrates looks invalid. However Socrates takes the arguments one by one and defends the immortality of the Soul.

Before going into the details of Socrates' defense of the Soul's immortality, it may be worthwhile to understand the exact nature in which Socrates understood the term "Soul". Socrates had a materialistic view of the Soul. For him and for most people of those times, heaven and supernatural were physical places. The soul was a material entity just like the body, the only difference being that it has a higher plane of existence, is divine, and immortal.

The following were the arguments Socrates brought forth against Simmias:
i) In case of lyre and harmony, the lyre always influences the harmony and its never the other way around, but the soul influences the body through its thought and will. Hence the analogy is not valid. The body follows the soul but the lyre never follows the harmony, hence lyre-harmony is not analogous to body-soul.
ii) There are different degrees of harmony. A harmony can be lesser or greater in degree than others, whereas there is no such distinction for the soul.
iii) Harmony is a compound composed of the sum of its constituent elements. The soul a single entity and is not a compound.

The argument of Simmias has much relevance today. It turns out the empirical evidence and modern Science favors Simmias than Socrates. Benjamin Libet (1916-2007) has shown that conscious volitional acts start with the body and not the mind. The brain activity leading to a thought impulse happens a split second before we actually become aware of it. If so the lyre-harmony analogy of Simmias holds, and Socrates was wrong in saying that the soul leads the body.

Modern science has irrefutably shown the material basis (in the brain) of mental activities like memory, learning, recollection, etc. Hence, most of the faculties of soul that Socrates identified with (like recollecting, correlating, etc.) are dependent on the material brain. Once again it looks like Simmias was right and Socrates was wrong.

Monday, March 22, 2010

Swamis, Gurus, Godmen

The "Swami Nithyananda Sex Scandal" is a major news item now-a-days. The poor Swamiji was unfortunate enough to have his LILA (divine play) with an actress captured on video, and watched by the public.

He is only the latest among a string of unfortunate Gurus and Swamis to get caught recently.

The newspapers as usual celebrate such sensational news. The responses are varied. The Guru's followers & well wishers would see it as a conspiracy by the enemies of truth. A few others who follow some other Guru or Mata would consider the culprit Swami as a fake Guru (their own Guru being the true one). The hard core atheist will consider it as another example of the evil called Religion.

But behind any fraud/crime by the so called Gurus or Babas,; what happens is nothing more than the act of a normal human being expressing his or her basal natures (be it lust, selfishness, greed, narcissism, or egoism). In that way the Gurus are no more evil than any average person. The real fault is not on the Guru who claimed to be enlightened or superhuman or divine, but with the followers who believed it.

What applies to Hindu Swamis would very well apply to many Christian faith healers, and to a lesser extent to some Muslim apologists and faith healers.

The number of such Gurus and Godmen all over India is staggering and would easily run into thousands. Only the most successful come on TVs and create web sites.

Does a Swami, Guru, Baba, Godman, Amma, or Faith Healer have to do something very seriously bad (like a sex scandal, murder, etc.) before we realize that they are nothing more than ordinary human beings (whatever be the spiritual state they claim, or whatever be the extra asanas they teach, or whatever direct contact they claim to have with God)?

Monday, March 8, 2010

The Early Church Fathers

The average Christian of today more or less takes it for granted that all that he/she believes in and all that is part of the Church today were there from the beginning of Christianity. But history shows that many of the core Christian ideas that we take for granted today, have an evolutionary history of their own. And The Early Church Fathers had a major role in that.

Understanding the ideas and times of the Early Fathers can give us a better view of why Christian theology is the way it is now. And without these great men, the history of Christianity and the World would have been very different.

Some of the important ones are:

Tertullian, (ca. 155–230)
He introduced the term Trinity the way it is accepted by the Church today. He defined the concept of Trinity with the term Consubstantiality (Tres Personae, Una Substantia - Three Persons, One Substance). Unlike the modern Christian belief, he held that all people (Christians & non-Christians) will be in harmony with God ultimately (the greek term is Apokatastasis).

St. Irenaeus (2nd Century)
A disciple of Polycarp, one of his major influences was his idealogical battle against Gnosticism.

Clement of Alexandria (ca. 150 - ca.216)
With his emphasis on the importance of both knowledge and faith, he had a great impact on later Fathers like Origen, St. Jerome, etc. Like Tertullian, he believed in the Apokatastasis principle.

Origen (185–ca. 254)
A mystic and philosopher. His writings were perhaps the first intellectual attempt to describe and defend Christian principles. He mixed Platonism and Stoic philosphy with Christian principles, to give faith an intellectual basis. He too held the Apokatastasis principle of salvation for all irrespective of their religion.

Athanasius of Alexandria (293 – 373)
A contemporary of Arius. His defense of the official dogma against that of Arius and his followers, was the beginning of a long conflict with Arianism. Famous for the Athanasian Creed that rejected Arianism, Nestorianism, Monophysitism, and Macedonianism.

Basil of Caesarea (ca. 329 - 379)
Famous for his idealogical battles against Arianism and other heresies. He is well known for his charitable works as well.

Saint Ambrose, Bishop of Milan (ca.337 – 397)
Played the decisive role in suppressing Arianism and pushing Roman paganism to the background, which would have had a phenomenal impact on the future of Christianity.

St. Jerome (ca. 342 - 419)
Translation of the entire Bible into Latin (Vulgate). The Vulgate was to have a major impact on the faith, art & culture of Christian Europe for more than 1000 years. Some scholars even hold that it had an important role in the development of many European languages.

Saint Augustine, Bishop of Hippo (354 – 430)
An intellectual and philosophical giant both for Christianity and Western thought. And perhaps the most important person for Christianity after Jesus and Paul. Many of the popular Christian concepts today were either propounded or clarified by him. He expounded the concept of Original Sin as accepted by all major Churches today. Another important principle that came from him was the theory of Just War (fighting for a just cause), as opposed to the traditional "Turn the Other Cheek" principle. He also held that the Bible should be interpreted symbolically and not literally.

Gregory the Great (c. 540 – 604)
He had a major role in transforming the Papacy to a seat of real power.

Sunday, March 7, 2010

Eric Brewer's CAP Theorem & Eventual Consistency

CAP theorem and the concept of "Eventually Consistent" has gained prominence over the last few years. The extreme scalability requirements for massive social networking and content sites has been one of the main driving factors for this.

Brewer's CAP Theorem: There are three core system requirements for designing and deploying data centric applications in a distributed environment; Consistency (C), Availability (A), and Partition Tolerance (P). At a given time a distributed system can guarantee only two of them, an not all the three.

In traditional RDBMS systems, transactional consistency is guaranteed by going for Consistency (C) and Availability (A) at the exclusion of Partition Tolerance (P).
In many non-RDBMS persistence mechanisms (particularly the highly scalable NoSQL variants like CouchDB, Voldemort, MongoDB, etc.), Availability (A) and Partition Tolerance (P) is guaranteed at the cost of Consistency (C).

ACID vs Eventually Consistent:
Traditional RDBMS systems can guarantee ACID (Atomicity, Consistency, Integrity, Durability), and in effect tries to ensure that the data is consistent at any given instant. But for most business systems instantaneous consistency is not a real requirement, and most of them can tolerate some time delay for data consistency.

The concept of being "Eventually Consistent", doesn't try to make the data instantaneously consistent but can guarantee that the data will be consistent eventually after a deterministic period of time.

This acceptable relaxation in consistency allows persistence systems like NoSQL to get the benefit of extreme scalability by going for A & P and relaxing the C in CAP.

Eric Brewer's Original Presentation can be found here.
A fairly detailed explanation of CAP by Julian Browne.

Simple, God fearing, Aristocratic Family & MNC

- He/she is simple, God fearing
- We hail from an aristocratic family from XXXX place
- Working in one of the top MNCs
- He/She excels in everything he/she does

Yes these are from matrimonial ads (Circumstantial pressures force me to see many of them as of recent).

"Simple, God fearing, Aristocratic Family & MNC". Are all of these words compatible with each other?

If a person is simple and God fearing (unless that means God Himself fears the person in question) why the claim of aristocratic (a meaningless term with roots in society's feudal past) and MNC (quite a nonsense in today's world of outsourcing, considering the maintainence type work and and the not so great salaries in most of the so called MNCs)?

Thursday, February 25, 2010

Controlling setup order for Spring DM applications

A quick and easy way to control the order in which Spring DM applications come up is using cardinality property in service imports.

Assume we have two applications app1 and app2 running in a single OSGi container and using Spring DM. Suppose we want app2 wait till app1 is initialized by Spring DM, we could do the following.
i) Export a service with appropriate interfaces / filters from app1.
For example:-
<osgi:service id="dependencyOSGi" ref="applicationDependency" interface="com.test.ApplicationDependency">
<osgi:service-properties><<entry key="application" value="app1-"/></osgi:service-properties>

ii) Imported the above service in app2 with a cardinality 1..1. The cardinality marks the service dependency as mandatory and causes Spring DM to delay the setup of app2 till the dependency is met (i.e. app1 is up an running).

<osgi:reference id="dependencyApp1OSGi" interface="com.test.ApplicationDependency" filter="(application=app1-" cardinality="1..1"/>

"Hello World" in different languages

An interesting collection of the standard "Hello World" program in a number of languages.

A life after CARGO

In his brilliant book (and the subsequent documentary) Guns, Germs and Steel; Jared Diamond recalls the question asked to him by one of the natives of Papua New Guinea. A person named Yali whom Diamond met on a New Guinean beach. Perplexed by the huge economic inequality between the white Europeans the the local New Guineans, Yali asks Diamond an interesting question, "Why you white man has so much CARGO, and we New Guineans have so little?".

CARGO was Yali's simple way of identifying all material goods that the Europeans possessed and brought with them.

Jared Diamond's answer to that question required many years of research and came out in the form of the masterpiece book "Guns, Germs, and Steel".

The perplexing question that Yali asked was relevant to the gross inequality between nations, races & communities, and particulary the Old World (Much of Europe and Asia) and the New World (Americas, Papua New Guinea, Aborginal Australia, most of Africa, etc.). But the same would apply between we individuals in our daily lives.

When bogged down by the problems of life and seeing many other around us who don't have such problems, most of us ask ourselves the basic question.

"Why is his/her life so easy and my life so tough (or screwed up)?"

The reason could be many; accidents of birth, random events of life, luck, our own abilities and disabilities, etc. But whatever the exact reason be, gross inequality between people remains one of the hard facts of life. And that inequality need not be just on a material or monetary basis.

For the vast majority us, its "a life after CARGO", and the perpetual rat-race to have the CARGO we lack, or lament about the CARGO that we may never have. And perplexed at the ever present inequality, we keep on repeating Yali's question.

Bit manipulation techniques

Some simple bit manipulation techniques
Set a bit: x |= (1 << position);
Clear a bit: x &= ~(1 << position);
Toggle a bit: x ^= (1 << position);
Test a bit: ((x >> position) & 1) != 0)
Test if power of two: ((x & (x - 1)) == 0)
Divide 'x' by 2 'n' times: x = x >> n;
Multiple 'x' by 2 'n' times: x = x << n;
Swap two numbers:
void swap(int& a, int& b)
a ^= b;
b ^= a;
a ^= b;

Fundamentals of Marxism

Marxism (however right or wrong its basic assumptions are) is a huge and multifarious system that is worth understanding. Though mostly connected with "Political Economy", Marxism is not limited to that but offers a full philosophical system and world view of its own.

To understand the environment under which Marxism was formed, it helps to have a glimpse of the trends in 17th to 19th century European intellectual circles in general and trends political intelligentsia in particular. Also important is the "post French revolution" decline of Monarchy/Feudalism (the land owners) and rise of the Capitalists (the one who controls the Capital, often called the Bourgeoisie).

Socialist and communist ideas in Europe were an inevitable consequence of the social changes brought in by the industrial revolution and the rise of Capitalism. The tilt in the balance of political power in favor of the merchant class, the emergence of the Proletariat (factory worker) as a major social group, gave rise to a new set of socio-political problems.

Practical attempts to solve socio-political problems through socialism started with Robert Owen (1771-1858) in England. Most of his ideas were Utopian in nature and thus failed inevitably. Socialist ideas slowly emerged as a major feature in European intellectual circles, and gradually gave rise to a group of socialist thinkers and system builders (mostly Utopian). Some of the notable names among them are Pierre Proudhun of France; Alexander Herzen, Mikhail Bakunin of Russia,; Eugen Karl Duhring of Germany ...

Pre-Marxist socialism was mostly Utopian and impractical. Inspired by the philosophy of Willhem Hegel & Ludwig Feurbach and influenced by the emerging materialist world view of the mid 19th century (thanks to Darwin and the rise of naturalism) and backed by a rigorous analysis of history, philosophy and political economy; Marx turned the Utopian socialist ideas of his predecessors into a workable system.

If at all we can single out one principle that is most important to Marxism it is Materialism. And the two fundamental theories of Marxist ideology ends with the word "materialism":

1. Dialectical Materialism:-

Marx gave great significance to the fact that the world is always in motion and is always changing. Taking note that change is the force that drives development and progress in all spheres, and applying it specifically to the social sphere, Marx borrowed Wilhelm Hegel's (1770-1831) metaphysical concept of dialectics and gave it a materialistic interpretation

Marx agreed with Hegel on the triad of dialectical development namely thesis, anti-thesis and synthesis. A thesis is an intellectual proposition/idea/concept, will inherently imply or cause its own negation or very opposite the anti-thesis; whereas the synthesis solves the conflict/contradiction between the thesis and anti-thesis by reconciling their common truths, thus forming a new proposition. The synthesis once a proposition forms a new thesis, which in turn creates its own anti-thesis and synthesis, and so on.

Each cycle of thesis, anti-thesis, synthesis marks progresses, but the shape of the progress is never linear (always improvement) nor circular (always coming back to the starting point) but is spiral in nature. This is called "Law of negation of negation". This implies that though history does repeat itself in some way or the other, history can never be a perfect repetition and there is always some new ground be broken and real progress being made.

Marx disagree with Hegel on a vital aspect. For Hegel the driving force for progress was always ideas, whereas for Marx its the Material (particularly the means of economic production) that determines the progress.

2. Historical Materialism:-

This principle could be considered as the core of Marxist ideology. The main points are as follows:
  • The "means of production" or the way humans work on nature to make their subsistence is the basis of human society and social relations.
  • Labor is the force that enables humans to exploit nature for subsistence.
  • Under favorable circumstances, property ownership and division of labor allows some people in society to live on the labor of others.
  • The level of development of the productive forces determines the "mode of production".
  • For a given mode of production based on what factors of production are dominant, there will be a dominant class who will control and exploit other classes in society.
  • Society progresses dialectically in stages wherein each dominant class is replaced by another in successive epochs based on the mode of production. The "mode of production" which determines the dominant class is the basis /foundation of human society. The basis in turn gives rise to superstructures like religion, culture, arts, etc. Both the basis and superstructure in a given epoch in history, reflects the interests of the dominant class of that period.
  • Class divisions and domination of a particular class, inevitably leads to class struggles.
  • Every dominant class has a tendency to bring in its own downfall partially due to its own inner contradictions, and mainly due to the changing "modes of production"
  • When the domination class becomes sufficiently weak, a new class overthrows it and makes self the new dominant class.
  • Any society with class divisions inevitably leads to class conflicts and is unstable. So was the case for feudalism & monarchy; and so will be the case for capitalism which manufactures own contradiction by creating a large working class population (proletariat) whose interests are in conflict with that of the capitalists.
  • Scientific socialism/communism being classless (only workers) is the only stable social structure. All social systems will inevitably lead to a classless society and communism.

Marx's Analysis of Capital:

"Dialectical Materialism" and "Historical Materialism" forms the intellectual and philosophical basis of Marxism. But the well known work of Marx Das Capital, has very less to do with philosophy but deals more with a rigorous analysis of Capital and its consequences, and is an economic theory based on Marxist philosophical ideas.

Marx starts Capital with an analysis of "Commodity Production and Consumption", which is the cheif economic activity in a capitalist society. Following earlier economists, Marx introduces two concepts "Use Value" and "Exchange Value". "Use Value" determines the usefulness of an item to a person or group, whereas "Exchange Value" determines the price a person or group is willing to pay for an item/commodity. The "Use Value" for breathing air is infinite for human beings, but its "Exchange Value" is zero, as its freely available for everyone. Similarly, the "Use Value" of diamonds for humans is negligible but their "Exchange Value" is high due to their scarcity.

Commodities are produced under capitalism using the "basic factors of production" namely Land, Labor, Capital, and Organization/Management. Profit is the driving factor for capitalist production. In a typical capitalist production process, factors of production having a monetary value of M1 undergoes production process to produce a commodity having a monetary value of M2. And under normal conditions of profit M2 - M1 > zero = surplus value / profit.

Borrowing Labor Theory of Value (LTV) of earlier economists, Marx agrees that the source of surplus value or profit is nothing but human labor. But Marx differs from most of his predecessors in claiming that the surplus value is not due to some creative power of labor but due to the fact that labor is underpaid by the capitalist. The capitalist never pays the laborer in full. In short, the exploitation of the laborer is the source of the capitalist's profit. And the capitalist is able to exploit the laborer because the capitalist through his control of Capital controls/owns the "means of production" that includes the raw materials, factory, machinery, control of management, etc.

Under capitalist system, private ownership of property inevitably leads to the control of Capital by a minority, which in turn leads to the exploitation of the working class. Hence, Marx concludes that "private property" the the main evil in Capitalism.

Law of diminishing profits
Critics of Marx

Wednesday, February 24, 2010



Man's mind, stretched to a new idea, never goes back to its original dimension.
-Oliver Wendell Holmes

Once you label me, you negate me.
-Soren Kierkegaard

I saw all things I feared, and which feared me had nothing good or bad in them save insofar as the mind was affected by them.

People and things do not upset us, rather we upset ourselves by believing that they can upset us.
-Albert Ellis

Nothing is more powerful than an idea whose time has come.
-Victor Hugo

Our truest life is when we are in our dreams awake.
-Henry David Thoreau

For all your days prepare,
And meet them ever alike.
When you are the anvil, bear-
When you are the hammer, strike.
-Edwin Markham

Most of the shadows of this life are caused by standing in one's own sunshine.
-Ralph Waldo Emerson

Not for one single day
Can I discern the way,
But this I surely know-
Who gives the day
Will surely show the way,
So I securely go.
-John Oxenham

The night and storm look as if they would last forever; but the calm and the morning cannot be stayed; the storm in its very nature is transient. The effort of nature, as that of the human heart, ever is to return to its repose, for God is peace.
-George MacDonald

When you fill a swamp with stones, a hundred loads may disappear under the water before a stone appears on the surface, but all of them are necessary.
-Frank C. Laubach

Finish everyday and be done with it. You have done what you could.
-Ralph Waldo Emerson

Everyday is the best of all.One of the illusions of life is that the present hour is not the critical, decisive hour. Write it on your heart that everyday is the best day of the year.
-Ralph Waldo Emerson

Death is not extinguishing the light; it is only putting out the lamp because the Dawn has come.
-Rabindranath Tagore

Only that day dawns to which we are awake.
-Henry David Thoreau

Love everyday. Each one is so short and they are so few.
-John Burroughs

Keep yours fears to yourself, but share your courage with others.
-Robert Louis Stevenson

He is the happiest man who thinks the most interesting thoughts.
-William Lyon Phelps

Do not take life too seriously, you will never get out of it alive.
-Elbert Hubbard

It is better to rise from life as from a banquet, neither thirsty nor drunken.

Without theory, practice is but routine born of habit.
-Louis Pasteur

Service increases our power as it lessens our pride.
-Christian Bernard

Mishaps are like knifes, that either serve us or cut us, as we grasp them by the blade or the handle.
-James Russell Lowell

Silence is the element in which great things fashion themselves.
-Thomas Carlyle

To maintain a fault known is a double fault.
-John Jewel

A failure establishes only this, that our determination to succeed was not strong enough.

Perhaps the greatest comfort in this world is "I am not alone". When you know this for yourself, your fears will lose their hold upon you.
-Norman Vincent Peale

Nurture your mind with great thoughts for you will never go any higher than you think.
-Benjamin Disraeli

Difficulty attracts the man of character because it is in embracing it that he realizes himself
-Charles de Gaulle

The deepest drive in human nature is the desire to be appreciated.
-William James

Your best friend is he who brings out the best that is within you.
-Henry Ford

A man is what he thinks about all day long.
-Ralph Waldo Emerson

Man is a piece of the universe made alive.
-Ralph Waldo Emerson

Every man is a volume, if you know how to read him.
-William Ellery Channing

We lie loudest when we lie to ourselves.
-Eric Hoffer

To know that we know what we know, and that we do not know what we do not know, that is true knowledge.
-Henry David Thoreau

Know thyself.

I am not ashamed to confess that I am ignorant of that I do not know.

Everybody lives and acts partly according to his own, partly according to other people's ideas.
-Leo Tolstoy

The best way out of a difficulty is through it.

Society prepares the crime; the criminal commits it.

The greatest remedy for anger is delay.

How is it possible to expect that mankind will take advise, when they will not so much as take warning?
-Jonathan Swift

He who has confidence in him will lead the rest.

Whenever you see a successful business, someone once made a courageous decision.
-Peter F. Drucker

You cannot run away from a weakness; you must sometime fight it out or perish. And if that be so, why not now, and where you stand.
-Robert Louis Stevenson

Never answer a critic, unless he's right.
-Bernard M. Baruch

We only acknowledge small faults in order to make it appear that we are free from great ones.
-Francois de La Rochefoucauld

No man really becomes a fool until he stops asking questions.
-Charles P. Steinmetz

Nothing will ever be attempted, if all possible objections must be first overcome.
-Samuel Johnson

Success is failure kicked to pieces by hard work.
-Jimmy Lyons

Perhaps the most valuable result of all education is the ability to make yourself to do the thing you have to do, when it ought to be done, whether you like it or not.
-Thomas Henry Huxley

There is only one real failure in life that is possible, and that is, not to be true to the best one knows.

There is nothing so useless as doing efficiently that which should not be done at all.
-Peter F. Drucker

People hate those who make them feel their own inferiority.
-Lord Chesterfield

Like the greatest virtue and the worst dogs, the fiercest hatred is silent.

If things go wrong don't go with them.
-Roger W. Barson

Fame has also this great drawback, that if we pursue it we must direct lives in such a way as to please the fancy of men, avoiding what they dislike and seeking what is pleasing to them.
-Baruch Spinoza

Do not wait for the last judgement, it takes place everyday.
-Albert Camus

It is necessary to be a fox to recognize the snares, and a lion to terrorize the wolves.
-Niccolo Machiavelli

There is only one success - to be able to spend your life in your own way.
-Christopher Morley

Something attempted, something done, Has earned a night's repose:
-Henry Wadsworth Longfellow

What deep wounds ever closed without a scar
-Lord Byron

When a man's knowledge is not in order, the more of it he has the greater will be his confusion.
-Herbert Spencer

I attribute the little I know to my not been ashamed to ask for information and to my rule of conversing with all descriptions of men on those topics that form their own peculiar professions and pursuits.
-John Locke

It is no use saying, "we are doing our best." You have got to succeed in doing what is necessary.
-Winston Churchill

There are only two classes - first class and no class.
-David O. Selznick

Be pleasant until ten o' clock in the morning and the rest of the day will take care of itself.
-Elbert Hubbard

It is never too late to be what you might have been.
-George Eliot

A man watches his pear tree day after day, impatient for the ripening of the fruit. Let him attempt to force the process, and he may spoil both fruit and tree. But let him patiently wait, and the ripe fruit at length falls into his lap.
-Abraham Lincoln

A man can do his best only by confidently seeking (and perpetually missing) an unattainable perfection.
-Ralph Barton Perry

Do what you can, with what you have, where you are.
-Theodore Roosevelt

He that has truth in his heart need never fear the want of persuasion on his tongue.
-John Ruskin

I do not know what I may appear to the world, but to myself I seem to have been only like a boy playing on the seashore, and diverting myself in now and then finding a smoother pebble or a prettier shell than ordinary, whilst the great ocean of truth lay all undiscovered before me.
-Isaac Newton

If all the year were playing holidays, To sport would be as tedious as to work.

Only he deserves power who everyday justifies it.
-Dag Hammarskjold

O, it is excellent
To have a giant's strength, but it is tyrannous
To use it like a giant.

Praise, like gold and diamonds, owes its value to its scarcity.
-Samuel Johnson

He who praises you for what you lack wishes to take from you what you have.
-Juan Manuel

People ask you for criticism but they only want praise.
-Somerset Maugham

Men take only their needs into considerations - never their abilities.
-Napoleon Bonaparte

Some people will never learn anything, for this reason, because they understand too soon.
-Alexander Pope

Slumber not in the tents of your fathers. The world is advancing. Advance with it.
-Giuseppe Mazzini

Fortune does not change men; it unmasks them.
-Mme Necker

If I take care of my character, my reputation will take care of itself.
-D. L. Moody

If A equals success, then the formula is A equals X plus Y plus Z. X is work. Y is play. Z is keep your mouth shut.
-Albert Einstein

The secret of success is this: there is no secret of success.
-Elbert Hubbard

The life of every man is a diary in which he means to write one story, and writes another, and his humblest hour is when he compares the volume as it is with what he vowed to make it.
-J. M. Barrie

All men are ordinary men; the extraordinary men are those who know it.
-G. K. Chesterton

Win hearts, and you have all men's hands and purses.
-William Cecil Burliegh

Good is not good, where better is expected.
-Thomas Fuller

He that talketh what he knoweth will also talk what he knoweth not.
-Francis Bacon

Some men succeed by what they know; some by what they do; and a few by what they are.
-Elbert Hubbard

Where all men think alike, no one thinks very much.
-Walter Lippmann

The most fluent talkers or the most plausible reasoners are not always the justest thinkers.
-William Hazzlit

He who will not reason, is a bigot; he who cannot is a fool; and he who dares not is a slave.
-Sir William Drummond

Few people think more than two or three times a year. I have made an international reputation for myself by thinking only once or twice a week.
-George Bernard Shaw

If any man wishes to write a clear style, let him first be clear in his thoughts.
-Johann W. von Goethe

Mark this well, ye proud men of action! Ye are, after all, nothing but unconscious instruments of the men of thought.
-Heinrich Heine

Whoever is in a hurry shows that the thing he is about is too big for him.
-Lord Chesterfield

Lost, somewhere between sunrise and sunset, sixty golden minutes. Each set with sixty diamond seconds. No reward is offered, for they are gone forever.
-Horace Mann

When we do not find peace of mind in ourselves it is useless to look for it elsewhere.
-La Rochefoucauld

Our hope of immortality does not come from any religion, but nearly all religions come from that hope.

It is not selfish to think for oneself. A man who does not think for himself does not think at all.
-Oscar Wilde

Most men are like eggs, too full of themselves to hold anything else.
-Josh Billing

Make the most of your regrets. To regret deeply is to live afresh.
-Henry David Thoreau

A man is rich in proportion to the number of things he can afford to let alone.
-Henry David Thoreau

Nothing is so hard for those who abound in riches as to conceive how others can be in want.
-Jonathan Swift

It will never rain roses; when we want. To have more roses we must plant more trees.
-George Eliot

The secret of the man who is universally interesting is that he is universally interested.
-William Dean Howells

The same people who can deny others everything are famous for refusing themselves nothing.
-Leigh Hunt

No man, would listen to you talk if he didn't know it was his turn next.
-E. W. Hosea

A teacher affects eternity, he can never tell where his influence stops.
-Henry Adams

Time goes, you say? Ah no!
Alas, time stays, we go.
-Austin Dobson

A man can succeed at almost anything for which he has unlimited enthusiasm.
-Charles Schwab

Nothing in the world will take the place of 'persistence'. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination alone are omnipotent. The slogan 'Press on!' has solved and always will solve the problems of the human race.
-Calvin Coolidge

Teach me neither to cry for the moon nor over spilt milk.

Take care to get what you like or you will be forced to like what you get.
-George Bernard Shaw

An angry man is always full of poison.

The best way to prepare for tomorrow is to concentrate with all your intelligence, all your enthusiasm, on doing today's work superbly today.
-Sir William Ostler

A man's life is what his thoughts make of it.
-Marcus Aurelius

Be willing to have it so. Acceptance of what has happened is the first step to overcoming the consequence of any misfortune.
-William James

Vulgar people take huge delight in the faults and follies of great men.

Do the very best you can: and then put up your old umbrella and keep the rain of criticism from running down the back of your neck.
-Dale Carnegie

The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.
-Robert Frost

You can fool all the people some of the time, and some of the people all the time, but you cannot fool all the people all the time.
-Abraham Lincoln

Let no man pull him so low as to make you hate him.
-Booker T. Washington

The shape of the world today does not permit us the luxury of soft-mindedness. Tough-mindedness without tender-heartedness is cold and detached, leaving one's life in a perpetual winter devoid of the warmth of spring and the gentle-heart of summer.
-Martin Luther King

If a man can write a better book, preach a better sermon, or make a better mouse-trap than his neighbor, though he build his house in the woods, the world will make a beaten path to his door.
-Ralph Waldo Emerson

How strange it is, our little procession of life! The child says 'When I am a big boy.' But what is that? The big boy says: 'When I grow up.' And then, grown up he says: 'When I get married', what is it after all? The thought changes to 'When I'm able to retire.' And then, when retirement comes, he looks back over the landscape traversed; a cold wind seems to sweep over it; somehow he has missed it all; and it is gone. Life, we learn too late, is in the living, in the tissue of every day and hour.
-Stephen Leacock

Reading maketh a full man; conference a ready man; and writing an exact man.
-Francis Bacon

All the world is a stage,
And all the men and women merely players.

Man is born free and everywhere he is in chains.
-Jean Jacques Rousseau

The trouble with the world is that the stupid are cocksure and the intelligent full of doubt.
-Bertrand Russell

Superstition is the religion of feeble minds.
-Edmund Burke

Cowards die many times before their death;
The valiant never taste death but once.

There is only one way to happiness and that is to cease worrying about things which are beyond the power of our will.

God grant me the serenity,
To accept the things I cannot change,
The courage to change the things I can,
And the wisdom to know the difference.
-Dr. Reinhold Niebuhr

You and I will last longer, and enjoy smoother riding, if we learn to absorb the shocks and jolts along the rocky road of life.
-Dale Carnegie

When I can't handle events, I let them handle themselves.
-Henry Ford

Nobody ever mastered any skill except through intensive, persistent and intelligent practice.
-Norman Vincent Peale

Throw your heart over the bar, and your body will follow.

Obviously, circumstances alone do not make us happy or unhappy. It is the way we react to circumstances that determines our feelings.
-Dale Carnegie

The most important thing in life is not to capitalize on your gains. Any fool can do that. The really important thing is to profit from your losses. That requires intelligence; and it makes the difference between a man of sense and a fool.
-William Bolitho

Genius is one percent inspiration and ninety-nine percent perspiration.
-Thomas Alva Edison

The true art of memory is the art of attention.
-Samuel Johnson

Great things are accomplished not by strength, speed or physical dexterity but by ... force of character, will and judgement.

True eloquence comprises saying all that needs to be said, and only that.
-La Rouchefoucauld

Where there is no will there is no way.
-George Bernard Shaw

Our bodies are our gardens to which our minds and wills are gardeners; ... either to have it sterile or manured with industry.

Difficulties are things that show what men are.

The winds and waves are always on the side of the ablest navigators.
-E. Gibbon

Knowledge may give weight, but accomplishments give lustre and many more people see than weigh.
-Lord Chesterfield

The descent into hell is easy, but to recall your steps, And to re-ascend to the upper air, this is labour, this is work.

If we are too weak to accomplish our goals we are still strong enough to work on it as best we can.
-Romain Rolland

Anyone can become angry - that is easy. But to be angry with the right person, to the right degree, at the right time, for the right purpose, and in the right way - that is not easy.

Life is a narrow vale between the cold and barren peaks of two eternities. We strive in vain to look beyond the heights. We cry aloud, and the only answer is the echo of our wailing cry. From the voiceless lips of the dead there comes no word; but in the night of death hope sees a star, and listening love can hear the rustle of a wing.
-Robert Greene Ingersoll

I have but one lamp by which my feet are guided; and that is the lamp of experience. I know of no way of judging the future but by the past.
-Patrick Henry

Two men looked through prison bars-
One saw mud, the other stars.

O Lord, thou givest us everything, at the price of an effort.
-Leonardo da Vinci

It is a shameful thing for the soul to faint while the body still perseveres.
-Marcus Aurelius

I cannot say, and I will not say
That he is dead. He is just away.
-James Whitcomb Riley

The best preparation for the night is to work diligently while the day lasts. The best preparation for death is life.
-George Macdonald

He who has a thousand friends has not a friend to spare, he who has one enemy shall meet him everywhere.
-Ali Ben Abu Taleb

Very little is needed to make a happy life. It is all within yourself, in your way of thinking.
-Marcus Aurelius

Life is real! Life is earnest!
And the grave is not its goal;
Dust thou art, to dust returnest,
Was not spoken of the soul.
-Henry Wadsworth Longfellow

Anyone can carry his burden, however hard, until nightfall. Anyone can do his work, however hard, for one day. Anyone can live sweetly, patiently, lovingly, purely, till the sun goes down. And this is all that life really means
-Robert Louis Stevenson

Happy the man, and happy he alone,
He, who can call today his own,
He who, secure within, can say:
"Tomorrow, do thy worst, for I have lived today."
-Horace (Roman poet)

Gratitude is a fruit of great cultivation. You do not find it among gross people.
-Samuel Johnson

Quarrel not at all. No man resolved to make the most of himself can spare time for personal contention. Still less he can afford to take all the consequences, including vitiating of his temper and loss of self-control.
-Abraham Lincoln

The secret of being miserable is to have the leisure to bother about whether you are happy or not.
-George Bernard Shaw

I live everyday as if it is the first day I had ever seen and the last I was going to see.
-William Lyon Phelps

We ourselves feel that what we are doing is just a drop in the ocean. But if that drop was not in the ocean, I think the ocean will be less because of that missing drop.
-Mother Teresa

Progress is the law of life.
-Robert Browning

All achievements, all earned riches, have their beginning in an idea.
-Andrew Carnegie

I am the master of my fate,
I am the captain of my soul.

The people who really do great things in this world, are those who drive past the first layer of fatigue.
-William James

Take care of your thoughts. You can do what you will with them.

Whenever I hear anyone arguing for slavery, I feel a strong impulse to see it tried on him personally.
-Abraham Lincoln

The law cannot make an employer love me, but it can keep him from refusing to hire me because of the color of my skin.
-Martin Luther King

Bravery is a volcano; the seed of wavering does not grow on its crater.
-Kahlil Gibran

Shut the iron doors on the past and future. Live in day-tight compartments.
-Sir William Ostler

What is in a name? That which we call a rose
By any other name would smell as sweet.

We shall not cease from exploration, and the end of our exploring will be to arrive where we started, and know the place for the first time
- T. S. Eliot

A bad beginning makes a bad ending.

A bad workman always blames his tools.

A body seriously out of equilibrium, either with itself or with its environment, perishes outright. Not so a mind. Madness and suffering can set themselves no limit.
-George Santayana

A critic is a man who knows the way but can't drive the car.
-Kenneth Tynan

Laws are like cobwebs, which may catch small flies, but let wasps and hornets break through.
-Jonathan Swift

A cynic is a man who, when he smells flowers, looks around for a coffin.
- L. Mencken

It is only the poor who pay cash, and that not from virtue, but because they are refused credit.
-Anatole France

A desperate disease requires a dangerous remedy.
-Guy Fawkes

A friendship founded on business is better than a business founded on friendship.
-John D. Rockefeller

My candle burns at both ends;
It will not last the night;
But ah, my foes, and oh, my friends—
It gives a lovely light!
-Edna St. Vincent Millay

He has an oar in every man's boat, and a finger in every pie.
-Miguel de Cervantes

The future is like heaven—everyone exalts it but no one wants to go there now.
-James Baldwin

But there comes a moment in everybody's life when he must decide whether he'll live among human beings or not—a fool among fools or a fool alone.
-Thornton Wilder

I must begin with a good body of facts and not from a principle (in which I always suspect some fallacy) and then as much deduction as you please.
-Charles Robert Darwin

How far that little candle throws his beams!
So shines a good deed in a naughty world.
-William Shakespeare

A good memory is needed after one has lied.
-Pierre Corneille

A good novel tells us the truth about its hero; but a bad novel tells us the truth about its author.
-G. K. Chesterton

I am about to take my last voyage, a great leap in the dark.
-Thomas Hobbes 1679. Last words.

A hen is only an egg's way of making another egg.
-Samuel Butler

Man is not a solitary animal, and so long as social life survives, self-realization cannot be the supreme principle of ethics.
-Bertrand Russell

A hungry stomach has no ears.
-Jean de La Fontaine

With malice toward none; with charity for all; with firmness in the right, as God gives us to see the right, let us strive on to finish the work we are in: to bind up the nation's wounds; to care for him who shall have borne the battle, and for his widow and his orphan, to do all which may achieve and cherish a just and lasting peace among ourselves, and with all nations.
-Abraham Lincoln

Of two evils, the lesser is always to be chosen.
-Thomas à Kempis

A king is a thing men have made for their own sakes, for quietness' sake. Just as if in a family one man is appointed to buy the meat.
-John Selden

The human face is indeed, like the face of the God of some Oriental theogony, a whole cluster of faces, crowded together but on different surfaces so that one does not see them all at once.
-Marcel Proust

The chess-board is the world; the pieces are the phenomena of the universe; the rules of the game are what we call the laws of Nature. The player on the other side is hidden from us. We know that his play is always fair, just, and patient. But also we know, to our cost, that he never overlooks a mistake, or makes the smallest allowance for ignorance.
-T. H. Huxley

That a lie which is all a lie may be met and fought with outright,
But a lie which is part a truth is a harder matter to fight.
-Alfred Lord Tennyson

A little learning is a dangerous thing;
Drink deep, or taste not the Pierian spring:
There shallow draughts intoxicate the brain,
And drinking largely sobers us again.
-Alexander Pope

If a little knowledge is dangerous, where is the man who has so much as to be out of danger?
-T. H. Huxley

A little neglect may breed mischief,...for want of a nail, the shoe was lost; for want of a shoe the horse was lost; and for want of a horse the rider was lost.
-Benjamin Franklin

A man's respect for law and order exists in precise relationship to the size of his paycheck.
-Adam Clayton Powell, Jr.

Like as the waves make towards the pebbled shore,
So do our minutes hasten to their end.
-William Shakespeare

So little done, so much to do.
-Cecil Rhodes

Television is an invention that permits you to be entertained in your living room by people you wouldn't have in your home.
-David Frost

If God hadn't rested on Sunday, He would have had time to finish the world.
-Gabriel García Márquez

First you take a drink, then the drink takes a drink, then the drink takes you.
-Attributed to: F. Scott Fitzgerald

My work is done. Why wait?
-George Eastman, Suicide note (1932).

Even in the valley of the shadow of death, two and two do not make six.
- Leo Tolstoy (1828–1910), Russian writer. Refusing to reconcile himself with the Russian Orthodox Church as he lay dying. (November 1910).

The problem is not that there are problems. The problem is expecting otherwise
and thinking that having problems is a problem.
- Theodore Rubin

Ideas that enter the mind under fire remain there securely and for ever.
- Leon Trotsky

If we had had more time for discussion we should probably have made a great many more mistakes.
- Leon Trotsky

Life is not an easy matter... You cannot live through it without falling into frustration and cynicism unless you have before you a great idea which raises you above personal misery, above weakness, above all kinds of perfidy and baseness.
- Leon Trotsky

The end may justify the means as long as there is something that justifies the end.
- Leon Trotsky

It is better to die on your feet than to live on your knees.
- Emiliano Zapata

Every man dies. Not every man really lives.
- William Wallace

My country, right or wrong; if right, to be kept right; and if wrong, to be set right.
- Carl Schurz

Is life so dear or peace so sweet as to be purchased at the price of chains and slavery? Forbid it, Almighty God! I know not what course others may take, but as for me, give me liberty, or give me death!
- Patrick Henry

People go to church for the same reasons they go to a tavern: to stupefy themselves, to forget their misery, to imagine themselves, for a few minutes anyway, free and happy.
- Mikhail Bakunin

The first revolt is against the supreme tyranny of theology, of the phantom of God. As long as we have a master in heaven, we will be slaves on earth.
- Mikhail Bakunin

Where the state begins, individual liberty ceases, and vice versa.
- Mikhail Bakunin

A Boss in Heaven is the best excuse for a boss on earth, therefore If God did exist, he would have to be abolished.
- Mikhail Bakunin

By striving to do the impossible, man has always achieved what is possible. Those who have cautiously done no more than they believed possible have never taken a single step forward.
- Mikhail Bakunin

Freedom, morality, and the human dignity of the individual consists precisely in this; that he does good not because he is forced to do so, but because he freely conceives it, wants it, and loves it.
- Mikhail Bakunin

From each according to his faculties; to each according to his needs.
- Mikhail Bakunin

From the naturalistic point of view, all men are equal. There are only two exceptions to this rule of naturalistic equality: geniuses and idiots.
- Mikhail Bakunin

Judgement comes from experience, and experience comes from bad judgement.
- Simon Bolivar

Whenever death may surprise us, let it be welcome if our battle cry has reached even one receptive ear and another hand reaches out to take up our arms.
- Che Guevara

I don't care if I fall as long as someone else picks up my gun and keeps on shooting.
- Che Guevara

When the pain is great enough, we will let anyone be doctor.
- Mignon McLaughlin, The Neurotic's Notebook, 1960

A thousand men can't undress a naked man.
- Greek Proverb

Our greatest pretenses are built up not to hide the evil and the ugly in us, but our emptiness.  The hardest thing to hide is something that is not there.
- Eric Hoffer, Passionate State of Mind, 1955

Who is more foolish, the child afraid of the dark or the man afraid of the light?
- Maurice Freehill

Because they know the name of what I am looking for, they think they know what I am looking for!
- Antonio Porchia

The charm of history and its enigmatic lesson consist in the fact that, from age to age, nothing changes and yet everything is completely different.
- Aldous Huxley

Will localizes us; thought universalizes us.
- Henri Frederic Amiel

Genuine tragedies in the world are not conflicts between right and wrong.  They are conflicts between two rights.
- Georg Hegel

In this, the late afternoon of my life, I wonder: am I casting a longer shadow or is my shadow casting a shorter me?
- Robert Brault

In general people experience their present naively, as it were, without being able to form an estimate of its contents; they have first to put themselves at a distance from it - the present, that is to say, must have become the past - before it can yield points of vantage from which to judge the future.
- Sigmund Freud, The Future of an Illusion

The only Zen you can find on the tops of mountains is the Zen you bring up there.
- Robert M. Pirsig

When you look into an abyss, the abyss also looks into you.
- Friedrich Nietzche

What you discover in a democracy is that it is difficult to build a house when each nail has an opinion.
- Robert Brault

I am a part of all that I have met.
- Alfred Lord Tennyson

We are all but recent leaves on the same old tree of life and if this life has adapted itself to new functions and conditions, it uses the same old basic principles over and over again.  There is no real difference between the grass and the man who mows it.
- Albert Szent-Györgyi

Oh, Heaven, it is mysterious, it is awful to consider that we not only carry a future Ghost within us; but are, in very deed, Ghosts!
- Thomas Carlyle

It requires a great deal of faith for a man to be cured by his own placebos.
- John L. McClenahan

Philosophy is life's dry-nurse, who can take care of us - but not suckle us.
- Soren Kierkegaard

Alice came to a fork in the road.  "Which road do I take?" she asked.
"Where do you want to go?" responded the Cheshire cat.
"I don't know," Alice answered.
"Then," said the cat, "it doesn't matter."
- Lewis Carroll, Alice in Wonderland

Each forward step we take we leave some phantom of ourselves behind.
- John Lancaster Spalding

The map is not the territory.
- Alfred Korzybski

No matter where you go or what you do, you live your entire life within the confines of your head.
- Terry Josephson

If you chase two rabbits, you will not catch either one.
- Russian Proverb

The observer, when he seems to himself to be observing a stone, is really, if physics is to be believed, observing the effects of the stone upon himself.
- Bertrand Russell

Among creatures born into chaos, a majority will imagine an order, a minority will question the order, and the rest will be pronounced insane.
- Robert Brault

You can't reason someone out of a position they didn't reason themselves into.
- Anonymous

Man is the only animal who enjoys the consolation of believing in a next life; all other animals enjoy the consolation of not worrying about it.
- Robert Brault

Talk sense to a fool and he calls you foolish

It is, I think, particularly in periods of acknowledged crisis that scientists have turned to philosophical analysis as a device for unlocking the riddles of their field. Scientists have not generally needed or wanted to be philosophers.
- Thomas Kuhn

The safest general characterization of the European philosophical tradition is that it consists of a series of footnotes to Plato.
- Alfred North Whitehead

There is but one truly serious philosophical problem and that is suicide.
- Albert Camus

Historical Validity of the Bible As God's Word

The inerrancy and perfectness of the Bible has been a central aspect of faith for most Christian sects. And this has been the cause (atleast indirectly) of some major tussles between the medieval church and science. But whether we like it or not there are many parts of the Bible which doesn't agree perfectly with known scientific, historic and logical facts.

I feel, its totally unecessary for Christians to claim that every book, verse, word in the Bible is perfect. The simple reason being, we have a lot of contrary evidence.

Also for the believer, Christianity need not stand or fall on the reliability of the Bible. The following are a few notable points.
1) The Bible was written by human beings.
2) Unlike Quran, we don't have any documentary evidence of God or any other divine source dictating the contents of what is to be the Bible. There are no such claims in the Bible itself.
3) The exact choice of the Books to be in the Bible was decided by councils and synods and not by God or angels.

The history of early Christianity is also the story of a number of various heresies and doctrinal differences. The choice of the contents of the Bible would have been definitely influenced by the numerous councils and synods in early Christian period, which were setup to reconcile the differences. A few notable ones being,
-> Council of Jerusalem 50 AD
-> The First Council of Niceae 325 AD
-> The Synod of Laodicea 364 AD
-> The Council of Constantinople 381 AD
-> The Synod of Hippo 393 AD

The role of politics and power too cannot be overridden.

The point is that, if we check history, we see that what is to be the Bible was not given apriori. Early Christianity didn't spring up from an entirely Biblical source. Its more like the Bible evolved over a few centuries during the early Christian period to be what it is now. i.e. The Bible as we know today didn't exist until atleast Christianity reached a certain level. The Bible was not the single source that created early Christianity, rather it evolved with it.

The real "Alcoholics Anonymous"

Most of us know "Alcoholics Anonymous" as an organization helping people to stay away from alcohol.

But isn't the name a misnomer?

The name would be more appropriate to describe the ones who consume alcohol anonymously or secretly; without the knowledge of their families in particular. There is no scarcity of such people around us, and many of us ourselves are part of the group.

May be they are the real "Alcoholics Anonymous".

Customozing Spring's Routing Datasource

Changing the data source of your application dynamically at runtime is a very desirable feature for complex enterprise applications and frameworks. If you are using Spring, one of the viable options is Spring's AbstractRoutingDataSource, which allows dynamic data sources based on a lookup key. It uses the well known Decorator pattern to provide a javax.sql.DataSource instance dynamically.

The following article by Mark Fisher from Spring team clearly explains how to go about it:

The default usage of Spring's AbstractRoutingDataSource is something as follows:
i) You have a set of data sources among which you want to switch dynamically.
ii) You have a well known dynamic key that can pick the right data source for you.

But what if you want to change the set of data sources themselves dynamically? The default usage of AbstractRoutingDataSource won't allow this. After digging into Spring code for some time I found that the following piece of code can do the job.

public class RoutingDataSource extends AbstractRoutingDataSource {
private Map targetDataSources = new HashMap();
public void setTargetDataSources(Map targetDataSources) {
this.targetDataSources = targetDataSources;

protected DataSource determineTargetDataSource() {
Object lookupKey = determineCurrentLookupKey();
DataSource dataSource = (DataSource)this.targetDataSources.get(lookupKey);
if (dataSource == null) {
throw new IllegalStateException("Cannot determine target DataSource for lookup key [" + lookupKey + "]");
return dataSource;

protected Object determineCurrentLookupKey() {
return /*a lookup key that can pick the actual datasource from the Map*/;

public void afterPropertiesSet() {
// do nothing
// overridden to avoid datasource validation error by Spring

Sunday, February 21, 2010

Some JavaScript utility functions

* Trim a string
function trim(str) {
str = str + '';
return str.replace(/^\s+|\s+$/g, '');

* Merge two JSONs, with controllable overwrite.
function mergeJson(target, source, overwrite) {
for (var item in source) {
if (target[item] && typeof source[item] === 'object') {
this.mergeJson(target[item], source[item]);
} else if (!target[item] || overwrite === true) {
target[item] = source[item];
return target;

* Check if an array contains a given elements.
function arrayContainsElement(arr, ele) {
var contains = false;
if (arr) {
for (var i = 0; i < arr.length; i++) {
if (this.trim(arr[i]) === this.trim(ele)) {
contains = true;
return contains;

Wednesday, January 13, 2010

The Private Language Argument

"What can be said at all can be said clearly, and what we cannot talk about we must pass over in silence"
- Ludwig Wittgenstein

These words beautifully explain the concept behind the so called "Private Language Argument", one of the most important topics of 20th century philosophy. The seeds of this thought were immanent in the ideas of John Locke(1632-1704) and Gottlob Frege(1848-1925), but was fully developed by Ludwig Wittgenstein(1889-1952), perhaps the greatest 20th century philosopher.

In the simplest words, the "argument" is that "the concept of a private language is improbable". By "private language" what is meant is "a language that is private to an individual and hence understandable by nobody else".

This simple looking argument has deep philosophical consequences. On the surface level, the immediate implication is that all language is socially constructed and can never be a subjective or private phenomenon. But the more important consequence is deeper, and has been explained in two different ways.

The first and more popular of the two, popularized initially by Rudolf Carnap(1891-1970) is that, the "argument" invalidates or at least looks with great suspicion, the validity of the "fully subjective nature of consciousness" (often called in philosophical terms as qualia). And this in turn has major implications for the "Mind-Body Problem" in philosophy, and hence religion and spirituality. As a result non-objective and non-empirical sources of language and thought as well as most of metaphysics is considered invalid.

With regard to "Mind-Body Problem", Carnap's interpretation of "Private Language Argument" shifts the advantage to the empirical/materialistic side. In other words the "argument" supports the primality of the "body" with respect to "mind", and more or less rejects metaphysics and mysticism as valid sources of knowledge.

The second interpretation, which seems to be the one favored by Wittgenstein himself, is that, "Private Language Argument", doesn't invalidate metaphysics and subjectivity, rather it enforces a limit on the "natural sciences" and particularly rationalism. Wittgenstein believed that philosophy should start where "natural sciences" end.