Javascript Gotchas

In most of the scenario we are looking for jquery plugin or 3rd party library for even simple stuffs that can easily be done using javascript. In this post, I will list down the simple javascript ways to do the stuffs so that we don't need to overload our applications with so many plugins.

JSON to Pretty Print JSON string

var emp = {name:'Anurag Gandhi', 'email':'foo@bar.com', age: 30, address:{ line1: '1st  street', city:'bangalore', 'country': 'India'}};
var str = JSON.stringify(obj, undefined, 4); // indentation level = 2

 

Biggest Achievement

Every one in this world is born with ambition. Everyone has his own expectaions and goals in their life based on which they consider what they achieved in their life.

One day, I was attending a training and the trainer, Venket, asked a question from the class… 
What is the biggest achievement in your life?

He got a lot of answers… A lot of stories….

Everyone was answering this question with their own feelings and set of minds.

After a while Venket asked, "Would that achievement be possible if you would not have born in this world?" 
The answer was "No".

He asked again, "Would that achievement be possible if your mother did not took care of your self when you were too small to even cry?" 
The answer was again "No".

He again asked, "If the hospital nurse would not have cared for you in those days, could you achieve whatever you consider as your achievement?" 
Again the silence and the answer was "No".

Whatever you consider as your biggest achievement, your biggest achievement is something else in reality. Be thankful to all the entities in the world because of which you are able to achieve your biggest achievement.

Promise Yourself

I really like the following lines from the Christian D., so wanted to share with you.

Promise Yourself

To be so strong that nothing
can disturb your peace of mind.
To talk health, happiness, and prosperity
to every person you meet.

To make all your friends feel
that there is something in them
To look at the sunny side of everything
and make your optimism come true.

To think only the best, to work only for the best,
and to expect only the best.
To be just as enthusiastic about the success of others
as you are about your own.

To forget the mistakes of the past
and press on to the greater achievements of the future.
To wear a cheerful countenance at all times
and give every living creature you meet a smile.

To give so much time to the improvement of yourself
that you have no time to criticize others.
To be too large for worry, too noble for anger, too strong for fear,
and too happy to permit the presence of trouble.

To think well of yourself and to proclaim this fact to the world,
not in loud words but great deeds.
To live in faith that the whole world is on your side
so long as you are true to the best that is in you.

– Larsen, Christian D.

Contact

Whereever you are standing, there is always a chance to go a step ahead. Your feedback will provide me the means to go ahead. I will be grateful to you for your kind comments/suggestions/feedbacks. If you would like to contact me for any reason, i.e, for feedback, query, suggestion, improvement(s) please drop a note here.

If you would like to contact me personally, please drop me an email to: soft.gandhi@gmail.com. I will try to respond you as soon as possible.