My Thoughts: January 2012

Sunday, January 22

Tricks of "Google - I'm Feeling Lucky"


Who doesnt aware of Google...!! :) Everyone knows about it .

But there are tricks that most of the people are not aware of. We all know the use of "I'm feeling Lucky" button. basically it will take to us to the first search result page. But there are some crazy / funny things are here . Let me reveal it :)

Goto Google.com and

1. type "Google Gravity" and click on "I'm feeling Lucky" button .

2. type "elgooG" and click on "I'm feeling Lucky" button .

3. type "Google Sphere" and click on "I'm feeling Lucky" button .

4. type "who is the cutest" and click on "I'm feeling Lucky" button .

5. type "Google Loco" and click on "I'm feeling Lucky" button .

6. type "LOL Limewire" and click on "I'm feeling Lucky" button .

7. type "Epic Google" and click on "I'm feeling Lucky" button .

8. type "Rainbow  Google " and click on "I'm feeling Lucky" button .

9. type "Annoying  Google " and click on "I'm feeling Lucky" button .

10. type " Google Magic" and click on "I'm feeling Lucky" button .

11.type "Google Heart page" and click on "I'm feeling Lucky" button .

12. type "epic box" and click on "I'm feeling Lucky" button .

13.type "Weenie Google" and click on "I'm feeling Lucky" button .

14.type "Sexy Snape" and click on "I'm feeling Lucky" button .

15.type "Who's Awesome" and click on "I'm feeling Lucky" button .

16.type "Google pacman" and click on "I'm feeling Lucky" button .

See you in next post :)

Wednesday, January 18

Protest against SOPA & PIPA using your Wordpress Blog


You know even you can be part of  SOPA & PIPA protest using your wordpress blog. Not kidding ..!! :)

Here is how you can do

1.Goto your Wordpressblog
Dashboard >> Settings>> Protest SOPA / PIPA
2.There you will find three options.Choose one and protest against  SOPA & PIPA . If you want to be silent then select third option. :)


a.Full Blackout and Ribbon: Display a protest ribbon on every page of my site until January 24, 2012 and black out every page on my site in protest of SOPA/PIPA on January 18, 2012 between 8AM and 8PM EST. Here is the preview


b.Ribbon: Display a protest ribbon on every page of my site until January 24, 2012. Here is the preview

c.None: Do not protest SOPA/PIPA on my site.
I dont think you go for c...!! :)

Online Protest against SOPA & PIPA



Hey , how was your web surfing today ?? I know its bad :)
Today ,  Jan 18th , 2011 (Wednesday) most of the websites have joined the protest against SOPA & PIPA 


Here are the screen shots of what they have done  ..!!


 Google



 Wikipedia
Microsoft
Wordpress



Thursday, January 12

Wrong India Map in "YouTube Analytics"



Recently India came to know that "India Map" has been shown wrongly in US. But this is the same even with YouTube.

Hopefully  very soon YouTube will show the India Map correctly.



Saturday, January 7

If you really love someone let them go where they want...!!

Recently I have finished reading a book "Eleven Minutes-- by Paulo Coelho " .

Eleven Minutes is a story of young pretty girl.I found a small story in this book which is worth posting. I know you love it...!! Here you go.. :)

Once upon a time , there was a bird.He was adorned with two perfect wings and with glossy, colorful, marvellous feathers.In short, he was a creature made to fly about freely in the sky , bringing joy to everyone who saw him.


One day, a woman saw this bird and fell in love with him.She watched his flight, her mouth wide in amazement , her heart pounding , her eyes shining with excitement.She invited the bird to fly with her , and the two travelled across the sky in perfect harmony.She admired and venerated and celebrated that bird.


But then she thought : He might want to visit far-off mountains! And she was afraid, afraid that she would never feel the same way about any other bird.And she felt envy,envy for the bird's ability to fly.


And she felt alone.


And she thought : "I'm going to set a trap.The next time the bird appears, he will never leave again."



The bird, who was alone in love , returned the following day, fell into the trap and was put in a cage.


She looked at the bird everyday.There he was, the object of her passion,and she showed him to her friends , who said :"Now you have everything you could possibly want". However a strange transformation began to take place: now that she had the bird and no longer needed to woo him, she began to lose interest.The bird , unable to fly and express the true meaning of his life, began to waste away and his feathers to lose their gloss, he grew ugly and the woman no longer paid him any  attention, except by feeding him and cleaning out his cage.


One day, the bird died.The woman felt terribly sad and spent all her time thinking about him.But she did not remember the cage, she thought only of the day when she had seen him for the first time, flying contentedly amongst the clouds.


If she had more looked deeply into herself, she would have realised that what had thrilled her about the bird was his freedom, the energy of his wings in motion , not his physical body.


Without the bird, her life too lost all meaning , and Death came knocking at her door . "Why have you come?" she asked Death."So that you can fly once more with him across the sky, " Death replied."If you had allowed him to come and go , you would have loved and admired him even more , alas , you now need me in order  to find him again."


If you really love someone let them go and set them free.If they really Love you then they will
be back.If they are not back then dont worry , God might have already set a Best one for you .
Believe in god , he know where you will be happy.

"Maintain your Perspective" - A nice story from "Who will cry when you die?"

Today I have started reading book "Who will cry when you die ? - By Robin Sharma" .

The moment I started reading the book , my mind asked me a quick question .

"Hey , before started reading tell me 'Who will cry when you die?' " . And my sincere answer is

"Of-course my family .It will take good amount of time for them to come back to this world again. The time might be one month , one year may one complete life time. And all of my colleagues and friends will recover soon .Some might be with in hours and some within days and weeks. People are always busy to get to their own work" .

I am going to share a nice story from that book. And here it is ..!!  :)

"A man with a serious illness was wheeled into a hospital room where another patient was resting on a bed next to the window.As the two became friends, the one next to the window would look out of and then spend the next few hours delighting his bedridden companion with vivid descriptions of thw world outside.some days he would describe the beauty of the trees in the park across from the hospital and how the leaves danced in the wind.On other days, he would entertain his friend with step-by-step replays of the things people were doing as they walked by the hospital.However, as the time went on, the bedridden man grew frustrated at his inability to observe the wonders his friend described.Eventually he grew to dislike him and then to hate him intensely.



           One night, during a particularly bad coughing fit , the patient next to the window stopped breathing.Rather than pressing the button for help, the other man chose to do nothing.The next morning the patient who had given his friend so much happiness by recounting the sights outside the window was pronounced dead and wheeled out of the hospital room.The other man quickly asked that his bed to be placed next to the window, a request that was complied with by attending nurse.But as he looked out of window, he discovered something that made hime shake:the window faced a stark brick wall.His former roommate had conjured up the incredible sights that he described in his imaginations as a loving gesture to make the world of his friend a little bit better during a difficult time.He had acted  out of selfless love."

We will come to know the value of people only when they are not with us. Please make sure you won't fall into this category. Know your neighbour value.Accept  love from all whether it is samll or big.(Can we measure love like small or big ??)

So please love your neighbour :)




Thursday, January 5

Connecting to DataBase using WebDriver


Our scripts are not just clicking on links we will do more.Yes , of course more :) and one of that "more" is "checking DB".
But Web Driver cannot directly connect to Database. You can only interact with your Browser using Web Driver.SO if you want to connect to Database then you need to write piece of code which will let you to connect to Database to perform further actions(insertion, deletion, updation).

For this we use JDBC("Java Database Connectivity").The JDBC API is a Java API for accessing virtually any kind of tabular data.The value of the JDBC API is that an application can access virtually any data source and run on any platform with a Java Virtual Machine.

In simplest terms, a JDBC technology-based driver ("JDBC driver") makes it possible to do three things:

1.Establish a connection with a data source
2.Send queries and update statements to the data source
3.Process the results

1.Establish a connection with a data source
The traditional way to establish a connection with a database is to call the method
DriverManager.getConnection(URL,  "myLogin", "myPassword" )
URL :   jdbc:<subprotocol>:<subname>
<subprotocol>-the name of the driver or the name of a database connectivity mechanism
<subname> - The point of a subname is to give enough information to locate the data source .(Includes IP address , Port number and exact name of DataSource)

For connecting to MYSQL URL will be
jdbc:mysql:<<subname>>

2.Send queries and update statements to the data source
A Statement object is used to send SQL statements to a database over the created connection in Step 1.
Statement-created by the Connection.createStatement methods. A Statement object is used for sending SQL statements with no parameters.
PreparedStatement-created by the Connection.prepareStatement methods. A PreparedStatement object is used for precompiled SQL statements. These can take one or more parameters as input arguments (IN parameters).
CallableStatement-created by the Connection.prepareCall methods. CallableStatement objects are used to execute SQL stored procedures
In Short
createStatement methods-for a simple SQL statement (no parameters)
prepareStatement methods-for an SQL statement that is executed frequently
prepareCall methods-for a call to a stored procedure

3.Process the results
A ResultSet is a Java object that contains the results of executing an SQL query.We will have separate post on it.The JDBC API provides three interfaces for sending SQL statements to the database

Here is the code for it.

//Load the mysql driver dynamically
Class.forName("com.mysql.jdbc.Driver");
//Establish connection
Connection con = DriverManager.getConnection("jdbc:mysql:wombat", "myLogin", "myPassword");
//Create statement Object
Statement stmt = con.createStatement();
//Execute the query and store the results in the ResultSet object
ResultSet rs = stmt.executeQuery("SELECT id, name, salary FROM employee");
//Printing the column values of ResultSet
while (rs.next()) {
 int x = rs.getInt("id");
 String s = rs.getString("name");
 float f = rs.getFloat("salary");
}