Google+ Sandeepa On Life: May 2011

Pages

Search this blog

Tuesday, May 31, 2011

How to generate a random string in java

Want to generate a random alpha-numeric string in Java? Here's how you can do it.
If you are into coding, sooner or later you will run into this!

There are many ways to do it. Here's the one I used recently in my code.

import java.security.SecureRandom;
import java.math.BigInteger;

SecureRandom srandom = new SecureRandom();
String rand = new BigInteger(176, srandom).toString(32);
/* and you have your random string in 'rand' */

What random libraries/functions do you use?
Write in comments.

Wednesday, May 25, 2011

How to display Ads on your blog using Google AdSense


You might have heard about people making money by displaying ads on their blogs using services like Google AdSense.

If you have a Blogger blog, setting up AdSense is fairly simple. Just follow these steps.

Step 1:
          Sign up for Google AdSense. The approval may take anywhere between few hours to many days. 

Step 2: Once you have an activated AdSense account,
  • Login to Blogger.
  • Goto Monetize tab of your blog by clicking on Montize from your blogger dashboard.
  • Monetize link in Dashboard
    In 'Adsense overview' tab, configure how and where you want the ads to appear.
Configure ads
  • Choose/login to your adsense account that you created in step 1.
  • And you are done! Now you track the ad statistics from this tab! Congrats :)
Track your earnings!
P.S: I just did this to my blog.

Monday, May 2, 2011

Facebook addiction : Too Much


If you are on Facebook, I am sure you will find this hilarious 


The 76-year-old woman walked down the hallway of Clearview Addictions Clinic, searching for the right department. She passed signs for the "Heroin Addiction Department (HAD)," the "Smoking Addiction Department (SAD)" and the "Bingo Addiction Department (BAD)." Then she spotted the department she was looking for: "Facebook Addiction Department (FAD)."

It was the busiest department in the clinic, with about three dozen people filling the waiting room, most of them staring blankly into their Blackberries and iPhones. A middle-aged man with unkempt hair was pacing the room, muttering,"I need to milk my cows. I need to milk my cows."

A twenty-something man was prone on the floor, his face buried in his hands, while a curly-haired woman comforted him.

"Don't worry. It'll be all right."

"I just don't understand it. I thought my update was LOL-worthy, but none of my friends even clicked the 'like' button."

"How long has it been?"

"Almost five minutes. That's like five months in the real world."

The 76-year-old woman waited until her name was called, then followed the receptionist into the office of Alfred Zulu, Facebook Addiction Counselor.

"Please have a seat, Edna," he said with a warm smile. "And tell me how it all started."

"Well, it's all my grandson's fault. He sent me an invitation to join Facebook. I had never heard of Facebook before, but I thought it was something for me, because I usually have my face in a book."

"How soon were you hooked?"

"Faster than you can say 'create a profile.' I found myself on Facebook at least eight times each day -- and more times at night. Sometimes I'd wake up in the middle of the night to check it, just in case there was an update from one of my new friends in India . My husband didn't like that. He said that friendship is a precious thing and should never be outsourced."

"What do you like most about Facebook?"

"It makes me feel like I have a life. In the real world, I have only five or six friends, but on Facebook, I have 674. I'm even friends with Juan Carlos Montoya."

"Who's he?"

"I don't know, but he's got 4,000 friends, so he must be famous."

"Facebook has helped you make some connections, I see."

"Oh yes. I've even connected with some of the gals from high school -- I still call them 'gals.' I hadn't heard from some of them in ages, so it was exciting to look at their profiles and figure out who's retired, who's still working, and who's had some work done. I love browsing their photos and reading their updates. I know where they've been on vacation, which movies they've watched, and whether they hang their toilet paper over or under. I've also been playing a game with some of them."

"Let me guess. Farmville?"

"No, Mafia Wars. I'm a Hitman. No one messes with Edna."

"Wouldn't you rather meet some of your friends in person?"

"No, not really. It's so much easier on Facebook. We don't need to gussy ourselves up. We don't need to take baths or wear perfume or use mouthwash. That's the best thing about Facebook -- you can't smell anyone. Everyone is attractive, because everyone has picked a good profile pic. One of the gals is using a profile pic that was taken, I'm pretty certain, during the Eisenhower Administration. "

"What pic are you using?"

"Well, I spent five hours searching for a profile pic, but couldn't find one I really liked. So I decided to visit the local beauty salon."

"To make yourself look prettier?"

"No, to take a pic of one of the young ladies there. That's what I'm using."

"Didn't your friends notice that you look different?"

"Some of them did, but I just told them I've been doing lots of yoga."

"When did you realize that your Facebooking might be a problem?"

"I realized it last Sunday night, when I was on Facebook and saw a message on my wall from my husband: 'I moved out of the house five days ago. Just thought you should know.'"

"What did you do?"

"What else? I unfriended him of course!"
--
P.S: Got it from a friend in email. Thought this forward email is worth sharing here.