Sunday, June 6, 2010

Personality Development

When the earth celebrated it's 2010 th birthday, my dad gave presented me a set of six books. All the books were authored by the immortal soul, Swami Vivekananda. The essence of those six books was "How should youth develop their personality".

Vivekanada urges all the youth of India, to spend quality time in improving their personality. Here personality doesn't mean looking smart, handsome alone. He takes a holistic approach on defining personality. He states, a youth should be physically fit, mentally fit and spiritually fit. Of course, most know what physically fit means. I will be writing more on the mental and spiritual part.

Staying mentally fit means being without worries. Worry is like a rocking chair. It will keep you occupied but will take you nowhere. Worry clouds your thinking and the grosser effect of it is very less concentration on the job you are doing at present. Eg. When I open a book, I start reading it with full concentration for 5 mins, then it starts slowly to decline. At some point of time, my eyes will be rolling over the text, but my thoughts and concentration will be somewhere. These are the grosser effects of some things that are subtly wrong within our selves. To go into the exact subtler causes will take up a lot of space for me. (to be contd.....)


Saturday, March 6, 2010

Removing Spaces from file names

Recently I came across an interesting problem. I had photos of a recent trip in the directory pictures. The name of the files were as follows.

Image DSCN 10101
Image DSCN 10102
Image DSCN 10103
Image DSCN 10104

All the images were of the .JPG format. The size of each image was around 2.0 MB. Since I wanted it to upload it on the net, I decided to increase the compression level of the jpeg image using the convert command. I had around 70 files to be changed. I wrote a simple shell script to do this.


#!/bin/bash
for file in `ls -1`
do
convert -quality 50 $file new-$file
echo $file
done

I wrote this loop to iterate over all the file inside the pictures directory. I was taken by suprise when I ran this shell script. I got numerous errors. I found out that the variable file uses space as a de-limiter. Since the file name contains spaces, the complete name of the file was not in the $file variable. So first I had to remove the spaces in the file names of the pictures. I googled around and came across this handy command called rename.

The rename command is used to rename a file according to a perl kind of regular expression. To tackle my problem, the command used was,

$rename 's/ *//g' *.JPG

The above command searches for any white spaces in the file names. If present, it replaces it by null string. The syntax is similar to the search and replace syntax used in vi.

Wednesday, May 21, 2008

Looking at life Differently

I am continuing my blog after a long gap...It's ten past twelve and dead silence prevails in my room except the sound of the fan..This blog is about looking life differently. For many Life is Happy when only they have no problems.They look problems as obstacles which hinder their growth.If you are in this trap , you can't experience the beauty of nature and the thrills of life..People should know to live life wisely."The greatest game to be played in Life is, playing the game of life wisely".

Many are hurt by incidents.Their whole life goes in sorrow,jealousy and don't experience happiness.When you operate from these things you miss many rich things that should be enjoyed and cherished.Think yourself as an empty pot.All your hurt,sorrow are like holes in the pot.Though happiness and Divine energy flows through you, it will leak through those holes. So you have to be with no sorrows and worries to cherish each and every moment in Life.

Actually if looked closely, the problems and situations in life doesn't create sorrow and hurt.It is your interpretation in your mind that is hurting you.Just reflect on this story. A monk was giving lecture to a group of people.The lecture was for a long time.One of the men seated in the last row fell asleep.So the monk asked the man, who slept to come and sit in the first row.There were really lot of people in the crowd and the man who fell asleep was so popular and a rich man. The man said to the monk that, you had hurt me.The monk replied with innocence, "How did I hurt you...?". The man said, you have ashamed me in front of a crowd.Actually it was not the words of the monk that hurt him.It was his interpretation in the mind. His interpretation in the mind was, I am such a popular and a rich person, How come this monk hurt me in front of such a crowd.After some time, this happened the monk asked another person to come and sit in the first row..That man said to the monk that, I am really happy as you had asked me to come and sit in the first row.The man was happy because in this mind the interpretation was as I was listening the lecture very attentively , seeing my interest the monk has called me in the front.The monk used the same words.But it was the interpretation of the minds of both people.Reflect on this story very closely.

Similarly, in our life incidents and situations doesn't hurt.It's your interpretation in your mind that hurts.While reading on apply this to your life.Only then it becomes a wisdom rather than knowledge.Please understand that in life nobody can hurt you.Only you hurt yourself by the interpretation in your mind.Problems will be there in Life.But don't look at problems as problems.Because the problem is not the problem.The problem is that, when problem comes, the interpretation in your mind is the problem.

Learn to look at problems differently.I 'll narrate another story to look at problems differently. All parents send their kids to their school at the age of 3.The child cries out when he goes to school.For that child it seems as an act of cruelity at that time. But the child will later realize the value he/she had gained by going to school. The child will realize using his/her experience that,parents had sent him/her to the school to make him better and better.Similarly God gives problems for you to make you better and better but not bitter and bitter. It's an act of extreme love by God.A child while looking at a surgeon doing surgery will say it as a cruel act.But later he/she will realize the use of it.Similar are problems in life.They are divine surgeries.It doesn't mean that while problems come you should be hurt and sorrow.It means that problems are there and it is your wish whether to suffer in that or not.

Once Buddha was scolded by a person in public.Buddha din't over react to that situation by again scolding him.He kept silent and replied to the man who was scolding that, though you are words are fiery, they don't hurt me.It's like throwing fire into a moving stream.As soon as the fire touches the river, it gets put off.Similar is my internal state of mind said Buddha.If you had deveoped this art, problems will not be solved but problems will be dissolved.For being in this state of mind, you should be void of hurt,worries and sorrow and the Divine should flow through you.As this seems blogs seems to go longer and longer, I end by here now.Still there are lots of things to say about problems and there are beautifull stories to reflect upon.It will come in my next blog.Live life wisely and enjoy the thrills of life.Every moment is a gift of god.God knows what is the best for you at that moment.

Tuesday, February 19, 2008

Algorthm Design

Algorithms is one of my favorite subjects in my life which I love so much. There are many Algortithm design techniques available.It's good for students who have taken computer science as the majors to have a deep knowledge about algorithms and it's various design techniques.

Most of the time when a programming puzzle is given most of the students try to Brute force for the solution.Although this is also a technique to find the solution to the problem,don't resort to it always.Resort to Brute force when you have no other way to solve the problem.And if you are going to brute force you are assured of a solution but the time taken to execute is very large for very big inputs.

There are various algorithm design techniques like Divide and Conquer,Dynamic Programming,Greedy algorithms,Branch and Bound,Linear Programming,Backtracking etc.It's very important to know what each design technique means and try to analyze and compare the various design techniques.To be more confident on these design techniques try to solve the programming problems at www.topcoder.com .

I will give you a simple problem in probability.Try to solve this.I am writing this problem because it cannot be solved using brute force method.Think very smart and different to find the solution.

A redundant storage system can survive a certain number of hard drive failures without losing any data. You are doing some analysis to determine the risk of various numbers of drives failing during one week. Your task is complicated by the fact that the drives in this system have different failure rates. You will be given a double[] containing n elements that describe the probability of each drive failing during a week. Return a double[] containing n + 1 elements, where element i is the probability that exactly i drives will fail during a week. Assume that drive failures are independent events.

Examples

0)

{1.0, 0.25, 0.0}
Returns: {0.0, 0.75, 0.25, 0.0 }
The first drive is guaranteed to fail, the second has a 25% chance of failing, and the third is guaranteed not to fail. So there is a 25% of two failures and a 75% chance of only one failure.
1)

{0.4, 0.7}
Returns: {0.18000000000000002, 0.54, 0.27999999999999997 }
There is a probability of 0.4 x 0.7 = 0.28 that both drives will fail. The chance that only the first will fail is 0.12 and that only the second will fail is 0.42, for a total probability of 0.54 that exactly one drive will fail. This leaves a probability of 0.18 that no drives will fail.
2)

{0.2, 0.3, 0.0, 1.0, 0.8, 0.9}
Returns:
{0.0, 0.011199999999999993, 0.15319999999999995, 0.5031999999999999, 0.2892, 0.0432, 0.0 }

If you could solve the problem,write the code in the comments.

Monday, November 19, 2007

Thoughts and mind

It's ten past twelve,early in the morning.Everybody dozing and my brain is so active now.I am continuing my same philosophical stuff.It's about human mind and thoughts.Whenever pleasant thoughts come to our mind we live with it or take part in it and our mind is happy about the situation.Then why not do the same thing for the negative thoughts .Whenever you think you are praised and you imagine everybody is appreciating,you live with the thought.

Suppose if some lusty thoughts or bad thoughts come to your mind,you try to forget it.Why not accept that also...? It's also a thought.Why to differentiate thoughts...? The age 14-17 is the most crucial stage in one's life.It's because that's the stage when you transform.You begin to develop views on girls,sex,drugs and all other stuffs.It's important to cross that stage with proper care.

When ever negative thoughts come to your mind,don't try to resist it.Just accept it.The more you try to resist,the more power it gains and attacks you with more power.Don't always war with your mind.Stop your war inside,every war outside will stop automatically and people 'll come to you.People will be attracted to you for no reason.People 'll start to like you and you feel connectedness with everybody around you.

Suppose your mind remainds you of some situation in which you were jealous or selfish,and if that thought comes again and again.The mind might try to say to you that you are jealous.Why reject that...? You accept when your mind says sweet and soothing things to you alone.Accept this also.When you do this,your mind will never remind you of thoughts about jealousy.To give a better understanding of the mind,will say you a story.

Human mind is like a child.A child will always demand for it's needs irrespective of the place where it is.If the child feels thirsty or hungry,the child cries.It does not sees who is around him/her.
Consider a child is coming and asking you to buy something from a shop.The child will not allow you to do anything until you buy that for the child.Similarly human mind always tries to convey some message to you through the thoughts.You just accept the thought.If you resist,it's like not buying the child the required thing.The child becomes angry and will start to cry and you will begin to feel embarrassed .Similarly human thoughts come strongly and attack you the next time whenever you don't accept the thoughts.

Saturday, October 27, 2007

Possessiveness and Love

I like philosophy so much and have great faith in god.I am basically a person who believes that god exists.But I don't believe in idol worship. I would like to share my views on Love and Possessiveness.Human mind is like a monkey.Whenever you see beautiful things in your life you get atrracted to it and want to possess it(Ofcourse everybody should have this.Be trurhful to your mind).

Suppose you want to buy a brand new MobilePhone.You will be so much interseted in it until you get the gadget.You will be so eager to get that.But once you possess it and after a period of two or three months you loose interest upon that gadget and have a just a gadget attitude towards it.You will not have the same joy which you had when you bought your new mobile phone.

The same is with beauty.When you look at beauty something in you happens.A thrill,joy!Then you want to possess that!You see a nice girl,or a nice boy,somebody good-looking with beautiful hair,beautiful nose,beautiful looks,beautiful eyes and something shakes up in you.You feel so good.The next thing will be to possess that beauty.The momoent you want to possess that beauty you make it ugly.As time passes by,when you see an another beautiful girl or boy you go behind them again.Then you go onto another and your whole life is like a run after such a mirage.

I have seen guys speaking to their girlfriends the whole night(Girls also).They will be always be hanging with them.Even in the classroom they start to think about them.All these kind of love is not true and real love.It's mere possession.I would like to give you an example.Everybody love their mom and dad so much.Do you think about them the whole day,whole night or whole week ? Do you think about them in the whole classroom ? You don't.That's real love and bondage.You may be evn be very far from them,but still mere words aren't needed for expressing your love to your parents.You both understand each other.You never keep on saying to your parent that I miss you so muchThat's true love..I miss you somuch,I cant be without you are some of the dialogues of committed people.All these are only temporary.These sorts of relationship will not lsat for ever.Never get commited in college.Because all committed cases in college will be of sort which I mentioned above.


The last thing which I would like to say is be very bonded and attached to your parents.Take the dust of your parent's feet daily.They are the two people who are always concerned about you.They are the ones who love you always.Take care of them when they become old.Always have the blessings and warmth of your parent.And be a good parent to your child.

Life is Love.God is fun and Love.Enjoy life to de max.
hit counter