Categories
Tech

Standard Swap problem

public class SwapVariables
{
public static void main(String args[])
{
int a=5;
int b= 6;

System.out.println(“Before Swap :”+a+” “+b);

a=a+b;
b=a-b;
a=a-b;

System.out.println(“After Swap :”+a+” “+b);

}
}

Categories
Tech

FizzBuzz Problem

Found about FizzBuzz problem here

I wrote Java program for it in 6 minutes including testing and debugging. [ Yes 🙁 I didn’t get it correct , first time ]

However, here is my solution:


public class FizzBuzz
{
public static void main(String args[])
{
for(int i=1;i<101;i++){

if(i%15==0)
System.out.println("FizzBuzz");
else if(i%5==0)
System.out.println("Buzz");
else if(i%3==0)
System.out.println("Fizz");
else
System.out.println(i);
}
}
}

Categories
Thoughts

One of my favorite quotes from Theodore Roosevelt

“It is not the critic who counts, not the man who points out how the strong man stumbles or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood, who strives valiantly, who errs and comes up short again and again. Because there is no effort without error and shortcomings, he who knows the great devotion, who spends himself in a worthy cause, who at the best knows in the end the high achievement of triumph and who at worst, if he fails while daring greatly, knows his place shall never be with those timid and cold souls who know neither victory nor defeat”.

Categories
Thoughts

The Law of the Garbage Truck

“Many people are like garbage trucks. They run around full of garbage, full of frustration, full of anger, and full of disappointment. As their garbage piles up, they need a place to dump it. And if you let them, they’ll dump it on you. When someone wants to dump on you, don’t take it personally. You just smile, wave, wish them well, and move on. You’ll be happy you did.”

Courtesy: One of my fellow blogger in my company.

Categories
Thoughts

Risk your Life to Live your Life

The following piece of text is produced as it is from one of my company blogs.I am very thankful to its presenter.

To laugh is to risk appearing the fool. To weep is to risk being called sentimental. To reach out to another is to risk involvement. To expose feelings is to risk showing your true self. To place your ideas and your dreams before them is to risk being called naive. To love is to risk not being loved in return. To live is to risk dying. To hope is to risk despair, and to try is to risk failure.

But risks must be taken, because the greatest hazard in life is to risk nothing. The person who risks nothing, does nothing, has nothing, is nothing and becomes nothing. He [or she] may avoid suffering and sorrow, but he simply cannot learn and feel and change and grow and love and live. Chained by his certitudes, he is a slave, he’s forfeited his freedom.

Only the person who risks is truly free.”

~Dr. Leo Buscaglia

Categories
Tech

Java Environmental Variable Settings

Till date, I installed Java software hundreds of times.Even then I have to spend sometime(though very few minutes) troubleshooting and I don’t get it correct at first time.So decided to write down basic settings in this blog so that I can just refer this if at all I forget next time!

JAVA_HOME = C:\Program Files\Java\jdk1.5.0_14\ [ to let know other apps like Tomcat, where Java is ]
CLASSPATH = . [ to look for class file in current directory ]
PATH = JAVA_HOME\bin [ to find tools like javac, java etc ]

Categories
Thoughts

Worst, Ok and now hopefully Good

This didnt seem to be a good idea counting all the experiences we had in the past 7 months of our stay.True that it is an improvement over the previous one but still it is not the good one. If I had to rate the last 2 , it would be “worst” and “OK”. That is why we decided to head for “good” from April.