Wednesday, November 10, 2010

Journey to Beijing!

It began with work transitioning from the China office to the newly opened center in Bangalore. People started talking about getting the Visa's done and arranging for flight tickets. Our's being more of a startup, all travel arrangements have been outsourced to AMEX. They did a proficient job of getting the Visa and the tickets (although at a good premium :-) ), and off we were to the land of Dragons... I landed in Beijing with little expectations of what I got to see.

The first was the Airport terminus. It was HUGE!! We had to catch a mini train to reach our baggage handling area and that was not the end of it. I heard that there are 3 monsters of similar size, which make up the terminus. China has done a tremendous job of Infrastructure planning and execution. They have built a city based on modern and old values, which is by far the best and seemingly biggest I have seem so far in the so-called "developing nations" category.

Out of the airport, you do not find any touts or people trying to mishandle you. There is order there. You have a elevator, which takes you either to the Taxi stand (marked all the way in English), or the Subway (the underground metropolitian railway line). Here also, you will find a lot of interesting infrastructure. The Airport line is a bit expensive (25 Yuan, compared with 2 Yuan for anywhere in the city), but it delivers you to a destination on the main lines of the Subway. From here, if you have prepared yourself well and know where to go, you catch the appropriate line (much like the london underground) and reach your destination. I decided to take the taxi, as I had not done the above. :-)

The roads are - smooth and spacious. (although most would not agree on the spacious part, if they arrive on Saturday/Sunday) They have a 8-10 lane infrasturcture of roadways running from the airport to the city (with a additional service lane and an emergency lane). The population is courteous enough and do not bother with you on the Subway or otherwise (not a single beggar to be seen). The main hurdle being communication and trying to make the people understand you. First rule I learnt: Talk with a lot of hand gestures and communicate in a syllable by syllable manner, not in mouthfuls, as we usually do.

The air in Beijing is clean and you will find mostly cars (high end ones) or motor powered bicycles. Around our Hotel, it was more of the student crowd which we faced. The hotel was located (on-campus) near the Beijing Aviation University (which was a misnomer, as they taught more than just aviation). Maybe due to the excellent public network (of taxi's, buses and Subway combined), there did not exist a diverse vehicular traffic. Although that scenario changes, when all try to take their cars out in the weekend, when there is no restrictions imposed on the vehicle numbers out on the street (got to know that there is a restriction each weekday on what last digit vehicle can ply the roads, but it is lifted on weekends).

Thursday, October 21, 2010

गग्नीत सिंह

Bangalore RTO and other Government Agencies have started insisting on getting your name in Hindi! So, here it is ... with a little help from Blogger and Google :-)

Sunday, December 27, 2009

Coping with Issues using Selenium

Have been trying to work with some real Selenium projects using Java as the programming language. It is interesting to work on this and have been trying to come up to terms with a  new language for use with Selenium. The main was the use of Eclipse as a IDE to build the test suite has been a great learning experience.

So the basic thing to do is to record the actions of the web application using the Selenium IDE, then convert the test case into Java/JUnit test case. Copy the code from the Selenium IDE window to the Eclipse IDE. Make some changes so that the code looks beautiful, and Eclipse gives some great pointers to correct your mistakes. And Voila! you have a test case written in Java and ready to be run with/as a JUnit component :-)

A generalized code is given below:

/**
 * @author: gagneet
 *
 */

package com.cookie.selenium; //this can be made on your own as a package into which you place all your code. Java requirement.


// some library functions that I am making use in my code.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

// The Selenium packages from ThoughtWorks
import com.thoughtworks.selenium.*;

// The test case class. The name of the class has to be the same as the file name with .java
// You do need to extend the SeleneseTestCase base class.
public class ReadURL extends SeleneseTestCase {

    /**
     * To open the first instance of the browser and initialize the same.
     */
    public void setUp() throws Exception {
        setUp("http://www.yahoo.com/", "*chrome");
    }
   
    /**
     * @param args
     */   
    public static void main(String args[]) {
       
        Selenium selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://ad1318.rm.sp1.yahoo.com");
        selenium.start();
        selenium.setTimeout("30000000");
       
        try {
            BufferedReader inputfile = new BufferedReader(new FileReader("C:\\out.txt"));
            BufferedWriter cookiefile = new BufferedWriter(new FileWriter("C:\\cookie.txt"));
           
            String str;
            // I am trying to read a file which has multiple lines, one line at a time.
            while ((str = inputfile.readLine()) != null) {
                selenium.createCookie("ABCdefGHI",""); // creating a cookie which will be sent along with the browser open
                selenium.open( str );
                selenium.waitForPageToLoad("120000");
                String urlcookie = selenium.getCookie();
                System.out.println( "URL  :" + str );
                System.out.println( "Cookie  :" + urlcookie );
                cookiefile.write( urlcookie );
                cookiefile.newLine();
            }
            inputfile.close();
            selenium.stop();
        } catch (IOException e) {
        }

    }
}

In the above code, I am trying to read a file, which has multiple URL's. I read each line and then open the same in a browser window. Once it opens, I store the cookie value for that page into a file and also display it in the Eclipse log window (or the Standard Out - STDOUT).

Thursday, July 23, 2009

Education and Literacy

Why do we think that Education and Literacy are the one and the same thing? I have added a few of my thoughts to this topic, based on what I personally think and feel.
http://gagneet.wordpress.com/2009/07/26/education-and-literacy/

Monday, April 6, 2009

Dad's Thoughts on the Election Manifesto

Dad sat down one day after he got a request to review the Election Manifesto of one of the contesting parties. These are what his thoughts and expressions hold:

"I received a copy of Congress Manifesto for the coming elections with an invitation to participate in interaction on it with their coordinator. Given below is my reply to him." - Dad

Dear Mr. XXX XXX [don't want to put names :-)],

Congress Manifesto is very well written. It enlightens those who are young and uninitiated, but is a repetition for quite a number of us who have lived through these Sixty-One Years, experienced the happenings and borne the hard times, the troubled times, initially the humiliating and then morale boosting costly wars, the reform oriented policies and their outcome, the growing uncertainty of security, insurgency, communalism rather than secularism, leading to frustrated terrorism at the culmination stage.

I am not into politics but am an educated, literate, aware and a practical, logically thinking person.

Whatever history you may quote, till now it belies a Stabilised, Sustained Policy on Governance. To generate any confidence in our class of people, you have to come out with a Strong Governance Policy and abide by it, based on a schedule to implement and to be announced to public.

A lot of populism has gone on for all these Sixty-One Years which has led to fragmentation of society on aggravated religious and resultant communal basis. Unity in diversity is suspect and based on more opportunism rather than confidence – confidence of justice and conscience.

Criminality and criminals are the ones to have become national leaders – with consequential lack of perceptive ideas resulting in degenerative and self oriented, corrupt, irresponsible and unaccountable government machinery. They only serve themselves.

The bureaucracy, by and large, is on its own, is manipulative, self aggrandizing, uncommitted to their responsibilities towards the State, without any control by the so called leaders.

This is the type of leadership, less some exceptions, which has been nurtured by the party, longest in power. Others had this as the IDEAL to follow, as and when they came to power.

Manifesto should have a NATIONAL Agenda and a Political Agenda. Both should be Prioritised, with a worked out implementation schedule. Only then can a Party get down to brass-tacks and later at the end of its term , claim any successes. Delayed justice, they say, is justice denied; therefore whatever you project as achievements, are of no value if they have not come in time.

We have inherited colonial ideas which are being fanned by the powers that be. We disbanded over Six- hundred states (Rajwaras) with lot of aplomb, but over these Sixty-one years, have re-energised them in a changed mode. All these years, has any effort been made to update the Governing Rules of Administration, Judicial, Army, Police, other National Organisations?

A very comprehensive National Reforms Commission under Justice Sachar has still to see daylight . A pragmatic National Policy would have resurrected and implemented it in these last over forty years from its languishing archival shelf. Why is the Education Policy still State based? Why isn’t there a National Police force? Why should the IAS be still State Cadre based and yet be called Indian Administrative Service? These are just a few examples of lethargy and self interest in governance. Nobody is thinking national. Why is the Water control still with states? By now, in our predominantly monsoon based agriculture, why have we not connected the rivers in a national grid to conserve, redirect and utilize water in a more effective manner?
National Health Insurance is only in the Metros; what happens to the rural folks? Did it have to take these Sixty – one years to think of them? Isn’t it a fact that our so called leaders used them as ‘bonded estate’ for building and enlarging their own interests?

Lofty ideas and high sounding words are NOT essential for Governance. Practicality and enforced implementation is what is required. Incentives and penalties are required. Responsibility and accountability are required. Action is required. Timely Results are required.

If your Manifesto can be simply worded:
To do, By When, How, Through whom, Fix Responsibility, Get timed feedback, Review and Respond, then you will be clear and be able to get the right votes.


Hope the above puts some things in perspective and our Party's start actually implementing what they say and not just making a show of things.