Wednesday, December 02, 2009

Reduce CO2 emissions

Google exposes some of the indicators nicely in charts based on the data exposed by worldbank

I have checked few indicators across few countries. Here are the links of couple of charts.

CO2 emissions - USA, India, and China

Electric Power Consumption - USA, India, and China

Seeing all, Actually USA and the developed nations has to contribute a lot to save the environment.

Check out the other indicators either through the worldbank datafinder or Google Publicdata charts or develope your own way of rendering the data using the worldbank API

Sunday, October 25, 2009

Bangalore Traffic and Circles

Bangalore traffic is going bad day by day. But, I don't see much improvement on the infrastructures. All the government is trying to do is widen the roads and build circles without signals. I hate the circles concept. You expect the bangalore traffic to flow automatically without any signals from any direction to any direction. In bangalore, only the Hebbal flyover is up to the mark in the standards to have a free flow. Recently, they opened the circle near freedom park. Automobiles coming from any direction can circle around and take any direction out. Someone comes from the right end and wants to take the left road, and Someone else comes from the left and wants to take the right road. Both crosses each other and the traffic piles up. At least they would have made some layers of road which exits to different roads. Each and every civil engineer studies about the bridges and fly overs that aids the free flow of traffic. But, In reality they don't implement it quite often as they have constraints on the space, time, budget, and politics.

Saturday, October 17, 2009

Sea Biscuit(2003)

Sea Biscuit(2003) is an amazing movie.
Have seen it few times and won't be bored to see many more times.
Well written by Laura Hillenbrand and nicely screen played by Gary Ross.
I liked the four main characters, Tom smith (played by Chris Cooper),
Red (played by Michael Angarano),
sea Biscuit and Charles Howard (played by Jeff Bridges)
Loved their expressions, especially Tom Smith's facial expressions at times for the dialogs of Charles Howard.

The story line was awesome, it clearly shows the mix of right people with greate attitude put together can achieve anything even if they lack in some way. Small Horse, Tall Jockey, Old Trainer and the Owner. Small Horse had the spirit to win the well built horses. Tall jockey had the attitude to understand and mingle with it and beat all the right sized(short) jockeys. Old Trainer could clearly judge the horses, train them, and correct the jockeys mistakes. The Owner had picked the right trainer and he was there whenever they need or any one of them fail.

Few of best dialogs that i liked from this movie are

"You know,you don't throw a whole life away...
just 'cause he's banged up a little."

"Brick by brick my citizens, brick by brick." - by The Roman Emperor, Hadrian

It ain'tjust the speed. It's the heart.

Friday, September 11, 2009

Selenium - Testing AJAX Web Applications

In AJAX applications, we do not reload the whole page, instead we update part of the page based on the response. To test these applications we cannot use wait_for_page_to_load() or wait_for_frame_to_load() or alert_is().

In these cases, we have to use the wait_for_condition() selenium API.
Key thing to observe here is that the code that you write in the condition is in javascript.
In the following example, I am waiting for the alert for 60000 milliseconds. This alert is poped up after updating the page based on the AJAX response.

my $cond = "try{ if(selenium.getAlert().indexOf('Package successfully deployed') > -1){true;} } catch(ex) {}";
$Common::sel->wait_for_condition($cond, 60000);

Wednesday, September 09, 2009

Selenium - alert and confirm in the page's onload() event

Selenium does NOT support _javascript_ alerts that are generated in a page's onload() event handler. Selenium does NOT support _javascript_ confirmations that are generated in a page's onload() event handler.

You may have some alert in the login page to display some alert on invalid username and password. When you want to automate the test cases on those pages, you need to add some javascript code on those pages before displaying the alert or confirm. These following lines makes the selenium to capture the alert or confirm messages.
var browserbot = parent.selenium.browserbot;
if (browserbot) {
browserbot.modifyWindowToRecordPopUpDialogs(window, browserbot);
}
alert("Alert message after those selenium workaround js snippet");

Sunday, September 06, 2009

Selenium - How to check the disabled button?

If you are using the Selenium IDE, you cannot record a test to check the disabled button. Instead of recording you can use the selenium perl driver API and code the test.
If I am testing the disabled state of a button with an id="pingBtn" in the HTML page, use the is_editable API and check the disabled state.
API doc:
$sel->is_editable($locator)
Determines whether the specified input element is editable, ie hasn't been disabled.This method will fail if the specified element isn't an input element.

$locator is an element locator
Returns true if the input element is editable, false otherwise
Compare the return value to false (0) to check the disabled state and add a comment which will be printed on the test console.
ok($sel->is_editable("pingBtn") == 0, "is_not_editable, pingBtn");

Wednesday, July 29, 2009

Brief Introduction about web development

I was explaining about the web development to one of my friend who is very good in C and Unix, but new to web development. Just thought of sharing the same notes in my blog.
Image export of mind map is here:


HTML export of mind map is here:

Web Dev

  • HTML

    • Structure of the web page, which is rendered by browser
    • Static pages

      • Navigation is linked by anchor/href tag
    • Dynamic pages

      • HTML Content is generated based on the database content
      • Actions are through buttons, which will submit the form

        • server is responsible to handle the request and respond back
  • JavaScript

    • Client side scripting

      • to avoid the load on the server

    • Used for client side validation
    • used for AJAX

      • Used to generate the dynamic web page
  • CSS

    • used for the styling of the web pages

      • Browser applies the CSS while rendering the web page

    • for common style across the application

    • helps to keep the HTML code clean

      • Improves maintainability

      • Improves readability

  • Server Side Scripting


    • executed at the server side to generate the dynamic HTML content

      Example: JSP, ASP, Velocity, DJango, etc

      Scriplet and HTML are placed in the same file and
      scriplet is executed just before server sends the HTML response
  • AJAX


    • Instead of form submit, a XMLHTTP call is made to the server and
      based on the result, part of the HTML page is rendered.
      In Traditional web dev, the response replaces whole HTML page,
      but in AJAX, part of the HTML can be updated based on the XMLHTTP response
      can make syncronous or asynchronous XMLHTTP calls

Tuesday, January 13, 2009

Path Ways Design


Recently, our office shifted to new location. The floor area in each floor is quite big and number of people in a floor is little high, so the frequency to the rest room is little high. The path ways are not designed in a conventional way, which does not suit well for a high frequency. They would have designed little better to avoid the crossing of the people who are going in and people who are coming out. I have drawn my thought on the better design of the path ways.