Friday, June 04, 2010

Sleep Vs Quality Sleep

Normally I hear people saying "You should have quality sleep". I didn't actually feel and experience that until last week. Few months back, I replaced my zero watts bulb (Apparently it is 12 watts bulb, check out here). Earlier I had Blue colored one, But I got the plain colored one as a replacement. I replaced the bulb and everything was fine. I normally switch on that bulb during the night and sleep. Initially I didn't realize any change, But in the later days, I realized that even if I sleep for 8+ hours, my eyes were straining during the day time. I thought it may be due to the tiredness of work, travel on Bangalore roads etc. One day I suddenly realized that long long ago, someone told me that my eyes are open slightly during my sleep. I started thinking on those lines and realized the plain colored zero watt bulb provides more light during the night. As I normally open my eyes slightly during sleep, I guess I strained my eyes during the sleep by closing it forcefully to avoid the light, which is the root cause. Then, I switched off the zero watt bulb and slept for few days, the quality of sleep improved a lot and now I sleep at least by 1 hour less than what I used to sleep before, get up early without alarm and my eyes doesn't strain during the day time. So, I really felt the quality sleep :)

Now, I started researching about further improving the quality of my sleep by thinking and discussing with friends. Following mind map conveys all about getting quality sleep.

Monday, May 17, 2010

Microsoft Word shortcut keys

If you use certain tools/software frequently, it is good to know useful shortcuts. This will help you save much time and enables you to prepare the artifacts very quickly if you are aware of the content ofcourse.

As we use word quite often, It is good to know the shortcuts at Microsoft word shortcuts

Monday, April 12, 2010

HTML Select - Does not scale well ? Optimize it to Scale.

I had huge data in some scenario and ended up displaying 25000 options in HTML select. It was really slow to render the HTML select, especially in IE. Ideal way to resolve this issue to redesign the screen to avoid huge data in select element. Considering the release cycle, changes at multiple places, test coverage, user documentation change, etc, I tried to analyze the root cause of the issue. When you create each Option object and add it to Select element in java script for such a large number of options, browser spends lot of time doing the string concatenation underneath. Especially IE is very poor in performing such tasks. Even while clearing the 25000 options, it takes quite some time. To improve the performance, I re-wrote the code as mentioned below:

Normal way but non-performing code:
    var selectedValue;
    var selectElement;
    selectElement.length = 0; // clear the options
    var len = 0;   
    for (i=0; i<=25000; i++)
    {
         selectElement.options[len] = new Option(i, i);
       
         if ( selectedValue != null && i == selectedValue)
         {
             selectElement.options[len].selected = true;
         }
         len++;
    } 
Optimized code:

Monday, February 01, 2010

Selenium - wait_for_condition - timeout

$sel->wait_for_condition($script, $timeout)  is not working correctly if the timeout is more than 180 seconds (180000 milliseconds). The timeout is not passed to the LWP::UserAgent object. By default the user agent times out for 180 seconds. If you are waiting for any time consuming AJAX operations, uger agent times out at 180 seconds even if you pass higher timeout value (say 300000 milliseconds = 300 seconds) to the wait_for_condition selenium API.
I was getting the following error:

Error requesting http://localhost:4444/selenium-server/driver/:
500 read timeout

 
I and my colleague Mahesh checked the Selenium perl library code. It is not passing the timeout to the user agent, which is the issue. Normally people does not wait more than 3 minutes (180 seconds), so this issue might not have come to visibility. Anyhow, I have made a temporary fix locally only for the WaitForCondition command and it is working for higher timeout values.

Code changes in Selenium.pm are
   $command = uri_escape($command);
    my $fullurl = "http://$self->{host}:$self->{port}/selenium-server/driver/";
    my $content = "cmd=$command";
    my $tmp_timeout = 180;
    if ($command eq 'waitForCondition') {
        $tmp_timeout = $args[1]/1000;
    }
and
 my $ua = LWP::UserAgent->new;
 my $header = HTTP::Headers->new( Content_Type => 'application/x-www-form-urlencoded; charset=utf-8' );
 if ($command eq 'waitForCondition') {
        $ua->timeout($tmp_timeout);
 }
I am not sure about other commands that require this fix, this fix just handle the timeout issue in $sel->wait_for_condition() API.

Saturday, January 30, 2010

Blogging

As the Blogging is out there for few years now, More people are becoming habitual to blog these days, I see many people are becoming a regular blogger and more people are creating new blogs daily. Time for the google, wordpress, and other blog sites to scale their clouds. I think, already they are doing it well :)
They are also enhancing the features. I recently changed my layout which stretches automatically based on my screen width. They are also commercializing well to monetize the blog to make win win situations for the blogger and the blog company. Amazon recently integrated with blogger to advertise the contents based on the blog context.

Kinds of blogging that I observe through my network:
1) Few people blog related to their profession. One of my friend write about his management experiences at  http://managewell.net These kind of blog really helps him to share the experiences from his vast experience and enables him get feedback from specific people who are interested in the particular topic. Also, if you are really, really good in your profession, it will take you to the right place that you deserve if you are not already there. For the readers, the blog posts are too valuable information and thoughts.

2) Few people write about their hobbies such as Travel, Fitness, etc. Even I have few separate blogs dedicated for travel, fitness, where I post related blog entries from by experiences.

3) Few people write about their daily activities or kind of web diary. If you are writing these kind of blog, you need to be really careful before publishing the post. Once you post, it is visible over the net. You just think whether you really want to share the post to whole public and will it have any consequences any time later in your life. On the other end, you can create blogs wherein you can set the security so that only the approved contacts can read all the posts in your blog site. You can form a closed circle of friends or family, so that you can share the blog entries only within them. In google blogger, go to settings -> Permissions, you can see the options for the same.

So, You think about the purpose of your blog, the intended audience of your blog, which will help you and the blog readers.

Friday, January 29, 2010

Sunlight after Eclipse

When you have some uncertainty, your mind sometimes goes crazy. Whether the uncertainty is at work or personal, the mind, which is more than super computer, keeps thinking about the same and sometimes it goes to a deadlock. It takes sometime to break that deadlock and come to a clarity. But, once you get the clarity after removing the uncertainty, you feel fresh like server is rebooted. That feels like getting sunlight after a long eclipse in the day.

Tuesday, January 12, 2010

Firefox - Event handling issue

In the recent firefox releases 3.0 and 3.5, I see an issue in the event firing. In the ajax exvironment, it sometimes misfires.
In my scenario, for an anchor element, I kept the href attribute as "#" and added an onclick event for a clean solution.
aElem.href = "#";
aElem.onclick = function() {
//do the action
};

It is working fine in IE browser, but this event is not fired correctly in firefox browser.
When I click on the anchor element, firefox fires that action, but immediately after that it fires an event equivalent to refresh frame on which the anchor element was present.
To overcome this, I called the javascript function through the href attribute itself.
aElem.href="javascript:doMyAction();";

function doMyAction() {
// do the action
}

This is not a clean solution. But, this works both in firefox and IE.