Monday, November 05, 2007

Home... Sweet Home...

Finally got a new home for myself. Many many thanks to manas for this nice gift. :-)

URL: http://sp2hari.com/

Feed URL: http://sp2hari.com/feed/

Update your links and feed url.

Monday, October 15, 2007

Blue... ;-) ;-)

Wikipedia says
"The term blue may refer to any of a number of similar colors. The sensation of blue is made by light having a spectrum dominated by energy in the wavelength range of about 440–490 nm.
Blue is considered to be one of the three primary additive colors in the RGB system; blue light has the shortest wavelength range of the three additive primary colors. The English language commonly uses "blue" to refer to any color from navy blue to cyan."

Some strange facts ( of course i googled for them :P )
  • Blue eyes are the most sensitive to light, brown eyes the least sensitive!
  • Owls are the only birds who can see the color blue!
  • 80 percent of Americans love blue color!
  • Blue and white are the most common school colors!
  • Animal breeders in Russia once claimed to have bred sheep with blue wool!
  • A scallop has 35 blue eyes!
  • Mosquitoes are attracted to the color blue twice as much as any other!
  • Maine produces about 98-99% of all wild blueberries in the US!
  • The red traffic light contains some orange color and the green traffic light contains some blue color making it easier for people with red-green color blindness!
  • More people use blue toothbrushes, than red ones!
  • Other than humans, black lemurs are the only primates that may have blue eyes!
  • There are only two animals with blue tongues, the Black Bear and the Chow dog!
  • The blue whale can produce sounds up to about 188 decibels!
  • A blue whales heart beats nine times per minute!
  • Most elephants weigh less than the tongue of the blue whale!
  • Blue whales weigh as much as 30 elephants and are as long as 3 Greyhound buses!
  • The blood vessels of a blue whale are wide enough for an adult trout to swim through!
Well enough of facts, I'll tell you some more nice facts :P :P
  • Sudden change to blue color makes people shout "Blue Blue Blue" all the time. This syndrome can be observed around one week even before the color change occurs.
  • Any girl who works in front of computer most of the time loves blue color than anything else.
  • Though blue color wavelength is 440-490 nm, the lower bound for blue color is 1200 and the upper bound is 1500.
  • Though the hexadecimal triplet for blue is #0000FF, the actual blue you see in the websites is #6666FF. This can be checked in the css file. For example
  • /* Blue */
    .coderTextBlue, .coderTextBlue:link, .coderTextBlue:visited, .coderTextBlue:hover, .coderTextBlue:active 
    { color: #6666FF; }
Hmmmm, i wish i could write more but have to stop here :-) :-)

Thursday, September 20, 2007

Slice...

Slice notation is one of the powerful feature in python using which can be used for operations like substr, str_reverse etc etc.

The slice notation is really powerful for strings. I'm not very sure whether it can be used for other data types.

For a string, it can be used as variable_name[start:end:step]

If the start and end are equal, then a null string is returned.
If step is positive and start is greater than the end, then a null string is returned.
If step is negative and start is lesser than the end, then a null string is returned.

Ok. If you are confused about start, end, step, equal, greater. lesser, positive and negative, don't worry. Things are explained very clearly after this. :-)

First few lines about the step. If the step is positive, then the direction in which the input string is scanned is forward direction. If the step is negative, then the string is scanned in reverse direction. So now i hope you understand why start must be less than end if step is positive. For the same reason, start must be less than end if the step is negative.

Let us see a simple slice example.

>>> i = "Hello World"
>>> i[2:10:1]
'llo Worl'

So it's very clear that the basic action of the slice notation is to return a sub string.
In the above example, it returns the characters from the string whose position are equal to and greater than start and less than end.

Note :: The character at position end is not returned.
In the above example i[10] = "d" is not returned.

If the start is not specified and step is positive, then the default value is 0
If the end is not specified and step is positive, then the default value is len(string).
If the start is not specified and step is negative then the default value is len(string).
If the end is not specified and step is negative, then the default value is NOT 0, coz in this case even 0th character is returned.
If the step is not specified, then the default value is 1


So i[::] prints the entire string. In fact, in most cases the step is not specified. So i[:] returns the entire string.

>>> i = "Hello World"
>>> i[::]
'Hello World'
>>> i[:]
'Hello World'
>>>

Slice notation can also take negative values.
If the start value is negative, then the last start characters are returned.
If the end value is negative, then the last end characters are not returned.

So if both start and end values are negative, then the absolute value of start must be greater than the absolute value of end. Else a null string will be returned.

>>> i = "Hello World"
>>> i[-5:] #Start is -ve. So last 5 characters
'World'
>>> i[:-5] #End is -ve. So everything except last 5 characters
'Hello '
>>> i[-8:-3] #Start is -8. =>"lo World". In this don't include last 3 characters => "lo Wo"
'lo Wo'
>>>

The real fun is when even step is negative.
If the start is greater than the end, then the step must be -ve, which makes the string to be returned as reverse.

So consider this example.
>>> i = "Hello World"
>>> i[8:4:-1]
'roW '
>>>

In the above example, i[8:4] part refers to i[8] and i[4] positions and since the step is negative, now it returns characters at i[8], i[7], i[6], i[5]. Note that even here i[4] is not returned.

Finally, if step is something other than 1, then every stepth character is returned. For example
>>> i = "Hello World"
>>> i[::2]
'HloWrd'
>>> i[::-2]
'drWolH'
>>>

Any idea why i wrote this post.

Saw this small snippet for string reverse in python

>>> a = "Hello World"
>>> print a[::-1]
dlroW olleH
>>>

Sweet and cute na. ;-)

To know more about slice notation you refer to the python python doc.

Sunday, September 09, 2007

Potato Guy ...


I wasn't sure why people celebrate shutdown day and all. The whole idea looked stupid. :P But it was not so.

Our college network was shutdown yesterday. No Gmail. No Orkut. No Spider. No Delta. Nothing :P
All i had was 2 or 3 computers with Linux and Windows :). Many many thanks to all the Gnome and KDE games, the day wasn't that boring. In fact, i don't mind having shutdown day once in a week :) :) :)
The good thing about shutdown day is that even if you want to work, you can't. :-). So you don't feel bad or guilty about not working for one whole day. :-) :-) :-)

Some of the nice games which are worth playing are
1. Attax
2. KAtomic (Even those who don't like chemistry might end up playing this for hours :) )
3. Kolf
4. Potato Guy
5. Iagno

Sunday, August 26, 2007

Firefox 3 is amazing :)

Working on any product which is not yet released and developed by hackers all over the world ;) gives you sweet surprises every now and then ;).

I have already mentioned how the form elements are made better in FF3.0 in http://sp2hari.blogspot.com/2007/06/firefox-3-ui-rocks.html

The next surprise is Bookmarks ,FTP browsing and Downloads window :-) :).

Check out the screenshot for yourself


The favicon for the ftp is cute :-).

Next one is the way bookmarks are added. Just like starring a mail in Gmail.
Check this screenshot. You can see a star there right in the Location bar right?

Click that once and the link is bookmarked :).

Next time you click it, you get bookmark options :)

Finally, the downloads window is more colorful now, with some new images :)


The search in the downloads is a cool feature :)

Hmmm, these are some of the features which i could notice while testing firefox. Not sure how much more is there :-). Really firefox 3 is going to rock :)

Saturday, August 25, 2007

Recording your screen in solaris :)

Recording your screen in Solaris works right out of the box. All you need to install is vncserver and vnc2swf.

A simple HOW TO about recording your screen in Solaris. :)

First you need to install Vncserver. Solaris by default doesn't come with a VNC. The easiest way to install VNC is through pkg-get

root@home# pkg-get -i vncserver

Before running that command, configure your pkg-get to get the packages from blastwave.org. Check http://www.blastwave.org/howto.html to get more details about setting up the repo.
That should install vncserver. :)

Next step it to install vnc2swf.
Download the C version of vnc2swf from http://www.unixuser.org/%7Eeuske/vnc2swf/index.html.
Extract the tar ball

hari@home:~$cd vnc2swf
hari@home:~$./configure
hari@home:~$make
root@home#make install

The commands mentioned above will install vnc2swf . :)

All you need to do to use vnc2swf is to start a vncserver. vnc2swf just needs the output file name to be passed as command line argument when started. Pressing F8 gives the options to start, stop, pause and clear the reocrding.

Some of the issues i faced are :)

1. When the same user tries to start a gnome-session in the vnc, an error message saying gnome-session is already running is given. So the best bet is to create a new user and start the vncserver of that user.

2. The icons are not displayed properly if you login into the new user's account using GNOME. Use Common Desktop Environment (CDE) to login and start a vncserver.

3. By default, the new user won't have a .vnc folder. So start a vnc and kill that. Now you will have .vnc folder with a xstartup file. Modify the file so that gnome-session runs in the vnc instead of the default twm. The xstartup file should look like

#!/bin/sh

/usr/openwin/bin/xrdb $HOME/.Xresources
/usr/openwin/bin/xsetroot -solid grey
/usr/openwin/bin/xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#/usr/openwin/bin/twm &
gnome-session &


And yeah, what i recorded can be viewed at http://download.freedesktop.org/ldtp/movies/screen2.html. Nice right ;-)

My Tinderbox is working...

Yes, you heard it right. My tinderbox is working. Even now i don't know why i was trying to setup a tinderbox after both Emily and Nags asked me to concentrate on Firefox automation. I felt it was almost done and just few more steps, i will be able to set it up. And that's what finally happened :)

So in this post, i am going to mention about all issues i faced in setting up a tinderbox and steps to fix them.

Note :: If you are ever setting up a tinderbox, be prepared to see huge log files. Like once my compilation ran for few hours and produced a log file of size 15MB. And if you are stuck up, DON'T send the entire file. A tail of that file should do. In fact, you should be in a position to find out from while line the exact error starts.

Yeah before you start reading this
http://sp2hari.blogspot.com/2007/06/conquered-solaris.html and
http://sp2hari.blogspot.com/2007/06/tinderbox.html has instructions about how to setup Tinderbox in Solaris environment.

Ok the first error i got was

Building deps for jsinterp.c
cc -o jsinterp.o -c -DOSTYPE=\"SunOS5\" -DOSARCH=SunOS -DEXPORT_JS_API -DJS_USE_SAFE_ARENA -I../../dist/include -I../../dist/include/js -I../../dist/include/nspr -DMOZ_PNG_READ -DMOZ_PNG_WRITE -I../../dist/sdk/include -I. -KPIC -xlibmil -xstrconst -xbuiltin=%all -mt -DNDEBUG -DTRIMMED -xO4 -DMOZILLA_VERSION=\"1.9a7pre\" -DMOZILLA_VERSION_U=1.9a7pre -DSOLARIS=1 -DNSCAP_DISABLE_DEBUG_PTR_TYPES=1 -DD_INO=d_ino -DSTDC_HEADERS=1 -DHAVE_ST_BLKSIZE=1 -DHAVE_SIGINFO_T=1 -DHAVE_INT16_T=1 -DHAVE_INT32_T=1 -DHAVE_INT64_T=1 -DHAVE_UINT=1 -DHAVE_UINT_T=1 -DHAVE_UINT16_T=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_BYTEORDER_H=1 -DHAVE_GETOPT_H=1 -DHAVE_MEMORY_H=1 -DHAVE_UNISTD_H=1 -DHAVE_NL_TYPES_H=1 -DHAVE_MALLOC_H=1 -DHAVE_X11_XKBLIB_H=1 -DHAVE_SYS_STATVFS_H=1 -DHAVE_SYS_STATFS_H=1 -DHAVE_LIBM=1 -DHAVE_LIBDL=1 -DHAVE_LIBSOCKET=1 -DFUNCPROTO=15 -DHAVE_XSHM=1 -D_REENTRANT=1 -DHAVE_RANDOM=1 -DHAVE_STRERROR=1 -DHAVE_LCHOWN=1 -DHAVE_FCHMOD=1 -DHAVE_SNPRINTF=1 -DHAVE_MEMMOVE=1 -DHAVE_RINT=1 -DHAVE_STAT64=1 -DHAVE_LSTAT64=1 -DHAVE_FLOCKFILE=1 -DHAVE_LOCALTIME_R=1 -DHAVE_STRTOK_R=1 -DHAVE_LANGINFO_CODESET=1 -DVA_COPY=va_copy -DHAVE_VA_COPY=1 -DHAVE_I18N_LC_MESSAGES=1 -DMOZ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CESSIBILITY_ATK=1 -DATK_MAJOR_VERSION=1 -DATK_MINOR_VERSION=12 -DATK_REV_VERSION=3 -DMOZILLA_LOCALE_VERSION=\"1.9a1\" -DMOZILLA_REGION_VERSION=\"1.9a1\" -DMOZILLA_SKIN_VERSION=\"1.8\" -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT jsinterp.c
ube: error: Assert has been violated at '/set/venus/builds.intel-S2/nightly.Thu/intel-S2/lang/ube/graphs/src/scregion.c 305'.
cc: ube failed for jsinterp.c
gmake[4]: *** [jsinterp.o] Error 2

Dave from Sun china asked me use a patch for Sun Studio 11 Compiler C. I don't have the link to the patch now but the patch id is 121016-05. I remember getting it from the sun website. So searching there should give you the link. The above patch was dependent on patch 120759-06. So installed patch 120759-06 first and then install the patch 121016-05.

Steps to add a patch in Solaris are given below. The commands are for patch 121016-05. Change the id according to the patch you are installing.

1. Download 121016-05.zip and extract the contents in your current directory
2. Login as root
3. root@home# patchadd 121016-05
Note :: If the above command doesn't work, then try
root@home# patchadd . 121016-05


The above steps should install the patch in your system. To check whether the patch is installed properly, check the folder /var/sadm/patch/. You should see seperate directories for each patch you have installed. In my system here, the /var/sdm/patch is like
# cd /var/sadm/patch/
# ls
120759-06 121016-05

That fixed the above problem :).

The next error i got was

jsinterp.c
ir2hf: error: Ran out of memory
cc: ir2hf failed for jsinterp.c

Now this is a strange problem and which can be fixed without much issue. You need more RAM. My system had 768MB (512+256) RAM, but you need 1GB RAM to fix this issue. So next day i got 1GB RAM and never got this error back.

After that, i got many compilation errors. This happened because of some issue in the mozilla code. This generally never happens. I got errors in lines having inline. Anyway now i am not getting the error anymore. So i think the mozilla code is fixed now. :)

Finally i got an error saying,

gmake[3]: Leaving directory `/export/home/hari/tinderbox
/SunOS_5.11_Depend/mozilla'
gmake[2]: Leaving directory `/export/home/hari/tinderbox/SunOS_5.11_Depend/mozilla'
make[1]: Leaving directory `/export/home/hari/tinderbox/SunOS_5.11_Depend/mozilla'
firefox-bin built successfully.
firefox-bin built successfully.
firefox-bin binary exists, build successful.
Unable to find path to Talkback client. Proceeding as if Talkback was not installed.


Running regxpcom test ...
Timeout = 120 seconds.
Begin: Fri Aug 24 08:08:37 2007
cmd = /export/home/hari/tinderbox/SunOS_5.11_Depend/mozilla//dist/bin/firefox-bin -register
End: Fri Aug 24 08:08:38 2007
----------- Output from regxpcom -------------
----------- End Output from regxpcom ---------
regxpcom: test failed
No profile found, creating profile.
Begin: Fri Aug 24 08:08:38 2007
cmd = /export/home/hari/tinderbox/SunOS_5.11_Depend/mozilla//dist/bin/firefox-bin -CreateProfile default
End: Fri Aug 24 08:08:39 2007
----------- Output from Profile Creation -------------
Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified


(firefox-bin:6432): Gtk-WARNING **: cannot open display:
----------- End Output from Profile Creation ---------
ERROR: profile /export/home/hari/tinderbox/SunOS_5.11_Depend/.mozilla/firefox/ does not exist
no pref file found

The solution for the above bug was to allow connections to X server. This is done by executing the following command before starting a tinderbox compilation. Remember the user who is running the tinderbox should execute the command.

hari@home:~$/usr/openwin/bin/xhost +
access control disabled, clients can connect from any host

Few other things to note while trying to compile firefox under tinderbox are
1. Never ever run two instances of tinderbox at the same time. Make sure the first one is killed before starting a new one.
2. Delete the SunOS_5.11_Depend folder when you are facing any compilation errors.
3. Use -XO3 for CFLAGS and CXXFLAGS
4. Make sure your mozconfig file has these lines
ac_add_options --disable-freetype2
ac_add_options --disable-debug
ac_add_options --disable-tests

Wednesday, August 22, 2007

SOC ....

Updates about SOC.
30 test scripts are working fine without any issue :). My target is to write 50 test cases and i will try to reach that this weekend :) :).

The scripts can be downloaded from here.

Things to be modified when you run your script in your environment are.
1. In the file firefox.xml, change the value of <filepath> for so that it points the file called index.html in the folder called data in your scripts directory.

Let me give a detailed HOW TO for running these scripts.

1. First, LDTP must be installed in your system.
The CVS page in ldtp.freedesktop.org provides the instructions for getting the LDTP code through CVS.

Note : I had a small issue compiling the code which i got from CVS.
While using ./configure it gave me an error saying

./configure: line 3998: syntax error near unexpected token `LIBXML2,'
./configure: line 3998: `PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.0.0)'

The above error is because autoconf and pkg-conf are installed at two different locations. For more details check http://lists.freedesktop.org/pipermail/xserver/2003-December/000573.html

So i used this package which compiled without any issue :).
For more details on how to install, check here.

2. Enable Accessibility from gnome-control-center

3. Download and start Firefox3.0a*pre from here ( Any FF3.0 alpha release should work, though with FF3.0a8pre, it is tested throughly.
Note :: When you start firefox, make sure you don't have any other instance of firefox running.

4.Run the command

hari@home:~/soc/tinderbox$ ldtprunner run.xml


If you have set LDTP_DEBUG=1 in your shell, then it will show lots of output. Don't get scared. It only means things are working fine :)
Note :: You can also work with LDTP_DEBUG unset, if you want a "clean" output.

Once that command is executed, then it will run the test cases provided in the run.xml.

A file called log.xml gives the details about the test cases run. The last three lines in the log file should be like this if the test case ran properly for all the 30 test cases provided.

<groupsstatus total="30" pass="30" fail="0"/>
</group>
</ldtp>

The screen record video on Solaris 11 is given can be viewed from here.
http://download.freedesktop.org/ldtp/movies/screen2.html

The current status of the test cases can be viewed from here.
http://ldtp.freedesktop.org/wiki/Firefox_Test_Cases