Friday, November 22, 2013

General elections 2014

I usually don't tend to write about politics. But this time around it has started effecting me. I have been reading news paper since early days and have been much aware of the previous elections. But this time around I am shocked and feel utter disgraced to witness such cheap politics which all the parties are playing for upcoming general elections. I don't know whom to blame, politicians, media, people or myself but everything around looks so gloomy.
There is not a single candidate whom I have utter respect for or a single source of media whose information can be trusted. The ruling party has brought a candidate who feels that poverty is a state of mind while opposition's prime ministerial candidate is an extremist with glorious past. Then there are smaller outfits who cannot lead the country yet.
The media be it TV , print or internet have fallen down to just being a marketing tools for these over manipulative politicians. Each news piece comes up like an Axe advertisement or the ads which we saw during coke vs Pepsi marketing war in early 2000s.
The entire scenario makes me feel that this is the generation of shows like big boss because each speech of the politicians reminds me of the same. Where are the days when elections were won on strong propaganda of development?
More I retrospect the more I regret not taking the easy path of MS in USA and then easy life in states. Then the love for the country and people stopped me, now I realize love is just an over hyped word.

Wednesday, November 6, 2013

Leaf at peace

Leaf on breeze circles around the lamppost,
Un aware of the honking and traffic below.
So peacefully it floats and swims,
Un aware of the running and barking below,
So engrossed in its rhythm creating a music,
Unaware of the beggars fighting below.
I so wish to be free like the leaf,
Unaware of the worldly desires and expectations.
But the leaf is dead, and I am not yet.

Wednesday, October 9, 2013

Time

Fountain meets river, river meets ocean,
And ocean meets sky.
Every thing that starts has an end,
And it's only time that fly.

Money is cycled, it can be earned,
Energy is conserved, it's form is only changed,
Time is motion, it's never the same.

Past is over,
Present is forever,
And future is never.
So mythical yet so mystical,
Such dynamic yet so monotonous,
So wasteful yet so crucial,
Can be one's time.

Monday, September 9, 2013

The end!

Goodbyes, hugs and tears,
Just makes my heart shiver with fear.
I always wonder, if its at all needed,
Maybe the remembrance of togetherness,
Can be better celebrated.
With the essence of love,
And unspoken promise of reliving the moments in thoughts and in person.
So never say goodbye, let it always be see you soon/again!

Monday, September 2, 2013

Rain

Walking in the rain, to free my soul of all pain.

Let me shed a tear, without any fear.
The screeching and honking, takes my mind off the screaming inside.

All I ever wanted was life so simple, but on every turn this journey makes me a cripple.
Dreams and desires broken and taper, is it time to float them like boats of paper.
Streams of mud gushing out of drain, just like emotions and feeling which I should refrain.

Confusion and dullness surrounds, is this world merrier than what I see all around?
Vehicles are dragged by people, fighting for inches on the road. Who believe life is a race, to live peacefully with a straight face.

Couple dancing, seeing the sky cry.
Photographer takes pride in the frames of poverty,
Media advertising the wrongs of nobility,
People praying to the fuckstrated man,
so i wish not being part this dubious clan.

Walking in the rain, wont free me of any pain, just let my energy drain.

Saturday, May 4, 2013

How to convert a Java Object List into csv.

Wrote a general method to convert a List into a CSV file.



package com.biplav.utils



import java.lang.reflect.Field;

import java.lang.reflect.Modifier;

import java.util.ArrayList;

import java.util.List;



import org.apache.log4j.Logger;



public class ObjectListToCSV {



private static final Logger logger = Logger.getLogger(ObjectListToCSV.class);

private static final String CSV_SEPARATOR = ",";



public static  String convertListToCSV(List objectList) {
  if(objectList.size() < 1) {
   logger.info("No data in the list to convert to CDR!");
   return "";
  }
  String csv = "";
  T t = objectList.get(0);
  Field[] declaredFields = t.getClass().getDeclaredFields();
  ArrayList useableFields = getUseableFields(declaredFields);
  csv = getCSVHeader(csv, useableFields,null);
  csv=csv.concat("\n");
  for(T object : objectList) {
   csv = addObjectValue(csv, useableFields, object);
   csv=csv.concat("\n");
  }
  return csv;
 }

 private static  String addObjectValue(String csv,
   ArrayList useableFields, T object) {
  for(Field field : useableFields) {
   try {
    if(canFieldUsedDirectly(field)) {
     if(object != null) {
      field.setAccessible(true);
      Object value = field.get(object);
      csv=csv.concat(value +"");
      field.setAccessible(false);
     }
    } else {
     if(object != null) {
      field.setAccessible(true);
      Object value = field.get(object);
      field.setAccessible(false);
      csv = addObjectValue(csv, getUseableFields(field.getType().getDeclaredFields()), value);
     }
    }
   } catch (IllegalArgumentException e) {
    logger.error(e);
   } catch (SecurityException e) {
    logger.error(e);
   } catch (IllegalAccessException e) {
    logger.error(e);
   }
   csv=csv.concat(CSV_SEPARATOR);
  }
  return csv;
 }

 private static boolean canFieldUsedDirectly(Field field) {
  return !field.getType().toString().contains("biplav");
 }

 private static ArrayList getUseableFields(Field[] declaredFields) {
  ArrayList useableFields = new ArrayList();
  for(Field field: declaredFields) {
   if(!Modifier.isStatic(field.getModifiers())) {
     useableFields.add(field);
   }
  }
  return useableFields;
 }

 private static String getCSVHeader(String csv, ArrayList useableFields,String prefix) {
  prefix = (prefix == null) ?  "": prefix;
  for(Field field : useableFields) {
   if(canFieldUsedDirectly(field)) {
    csv=csv.concat(prefix+field.getName());
    csv=csv.concat(CSV_SEPARATOR);
   } else {
    csv = getCSVHeader(csv, getUseableFields(field.getType().getDeclaredFields()),field.getName()+"_");
   }
  }
  return csv;
 }
}

Wednesday, March 27, 2013

When you find poetry in coding!

I always believed coding and poetry and two most rhythmic for of art. And when yesterday i was shown this I was excited as hell.

To view the pythonic philosophy just type import this and press enter on the python interactive shell and be prepared to be amazed like me.


The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Thursday, March 21, 2013

Office

Empty cubicles, left or right!!
creating a halo over my seat is a tubelight..
makes me feel why am I so bright?
when others complete their work so fast...
 still I am stuck till the very last!!!


what a day has come,
when ppl like when I say I am a bum!


Shayari..

armaano ko kuchalke aage badhta gaya mein,
mujhe kya pata tha zanzeeron mein fanshta gaya mein!
bahduri aage badhne mein nahin, zamaane se ladne mein thi,
 bewkoof tha mein sama banata reh gaya, jabki samajhdari sama jalane mein thi!

Monday, March 18, 2013

Poem with two titles

Write, Sing, Code, Dance, Ride, Read and ..
or

Things we do...

Sometimes you feel like to write,
when things you know are not right.
You know you should fight,
but destination is no where in sight.

Sometimes you feel like to sing,
when life adds that musical ping,
Everything around is like a jingle,
And you don't mind to mingle.

Sometimes you feel like to draw,
to capture the imaginations that are still so raw.
You know you should go digital,
but you still love the old charcoal.

Sometimes you feel like to code,
when ideas are abode.
You know you should act fast,
because things are not going to last.

Sometimes you feel like to dance,
Because you know this might be your only chance.
You wanna live it to the fullest,
Or atleast remain the coolest!

Sometimes you feel like to space out,
Because you wanna recollect those memories fading out.
Or to be with yourself,
because he is the one who take the worlds' all pelt.

Simetimes you feel like to ride,
Because its your bike in which you take all pride,
It moves your soul,
and care the least about rest all.

Sometimes you feel like to read,
When you know you wanna be feed,
the authors intellect and vivid imagination,
and get lost in his creation.

Monday, January 28, 2013

Storms in ocean

Feels like stopping,
Desires to start a new journey.
Fears mirror,
Searches for answers.
Confusion prevail,
Desires to run faster
Storms in ocean, steering is tough.

Stops, looks around, sees no one.
Looks behind finds no one.
Takes the new road, meets no one.
Finds answer, gives no peace.
Runs faster, reaches nowhere.
Still,
Confusion prevails,
Questions arises,
Mirror scares,
And desires stays.
Storms in ocean, steering is tough.

Tuesday, January 8, 2013

Marwari Dinner Ritual

This one is little offbeat for the topics of this blog, but I wanted to document this somewhere because people reading this can get real virtue behind fer Marwari traditions.

Last evening I was having a coffee cup discussion with a friend on emancipation of woman and the narrow outlook of the Indian Society. In midst of the discussion he suddenly quoted the famous Dinner Ritual that is followed in Marwari and many Indian societies, that a woman eats only after all man in the family have eaten. He used this to justify that the Indian man, looks down at woman and don't give the equal rights to woman even at home.

At first, the argument seemed very logical, but then I just looked back at my own house and what i have seen in my own family and what the very similar tradition taught me. At my place, my mom being a housewife, always use to eat last in the house after making sure that everyone have eaten. She still does that, and takes pride in doing that. Her total attitude towards this is like she own the "house kitchen" and she is the King over there and its her duty to take care of her subjects, fellow family members. I never got the feeling of my dad looking down on her, although initially as a kid i use to take advantage of the situation and throw tantrums but as I grew up I realized the over all idea behind it.

On the similar analogy, whenever we use to visit dad's office, I use to see the role's have reversed. In office, Dad use to make sure all of us got comfortable first and make sure we got served with our favorite snacks and cold-drinks before running with his errands. The feeling I always got there is that here he is the King and following his duty of taking care of his subjects.

Just the same ritual, but different perspective around the same thing. As our society have changed these old rituals have lost its meaning as immature people like me as a kid had started taking advantage of them and trying to change the meaning around it. What we need is to "Grow up"!