Friday, March 30, 2007

Planning for Sabbatical

I am currently working for MAQSoftware and will be taking a sabbatical from next month for concentrated (hopefully J) study before my M.S. in Computer Science. Before leaving my company, I wanted to do have a concrete plan about what I am going to do for next couple of months. People around me were skeptical about this step as I was doing great at my job (I recently got a big raise and was placed on good project). So I decided to jot down the purpose and plan for the sabbatical.

Duration: 3 months


1. To improve my vocabulary.

2. To prepare myself for research.

3. To improve my programming skills.

4. To improve my health.

5. To enjoy life …


Purpose number

My plan


1. Listen to audio of wordlist whenever I take rest (daily).

2. Give test – Big Book (daily).

3. Read my mind map book of words (weekly).


1. Read computer science topics and research papers and prepare mind maps.

2. Brainstorm the mind maps, use lateral thinking (ask questions – Why, How. Don’t neglect seemingly illogical conclusions).

3. Document every crazy ideas and reserve some time every month to think about them.

4. Watch technical videos and create mind maps.

5. Maintain a bibliography and document every reference (use notations) in your mind map.


1. Create a mind map (one for each programming language you know) that encapsulates every language constructs.

2. Maintain an online programming cookbook (best practices, code snippets, coding styles, design patterns, components, etc).

3. Also, create mind maps for standard library for each language and try to correlate them.


1. Yoga, Meditation (daily – 1 hour (morning)).

2. Exercise (daily – 1 hour (evening)).


1. Movie or hangout with friends (weekly).

2. One Trip (Goa – 10-15 days).

3. Spend more time with family.

Some important points:

1. “Preparing for research”?

2. What to do when I am bored?

· Watch technical videos.

· Go for a walk.

· Listen to music.

· Have a constructive discussion with someone (Use yahoo or telephone if the person stays far away).

· Go for a movie.

3. Work hard and follow strict discipline. I may not be the smartest or the most hard-working person, but I know one thing about myself – “I don’t give up regardless of what other people say”. I will keep on trying until I succeed. I will be defined by my work and not by my resume. It doesn’t matter if I am in the best college or if I am in the worst college.

4. We all have what Einstein had during his time - access to all patents (, 24 hours a day and a human brain. In fact, we have much more information available and also better tools to organize it than what he had. So, ideally if we all organize our information more efficiently and think more clearly and more constructively, we can better even Einstein.

Monday, March 26, 2007

What is difference between span and div tag?

Recently, when I was asked to take interview, I asked a simple question that none could answer :-(
"What is difference between span and div tag?"

This prompted me to write this post.

<span> and <div> tags both allow a Web designer to style text and add other formatting attributes to their Web page.

The <span> and <div> tags are very useful when dealing with Cascading Style Sheets.

Because the <center> tag has been deprecated in HTML 4.0, it is a good idea to start using
<div style="text-align: center;">
to center the content inside your div.

<div> tags are block elements. This means they can "hold" other HTML elements, and they can be positioned anywhere on the screen. For this reason, <div> tags can be used for replacing table-based Web designs.

Unlike <div> tags, <span> tags cannot hold other HTML tags. They should only be used for inline styling of text. Consider the following code:

<span >

<p>This is some text sized at 14 pixels.</p>


This code will probably render OK in most browsers, but it is actually incorrect. Remember, since the <span> tag is not a block-level element, it cannot contain other HTML tags. The correct way to write this code would be:

<p><span >

This is some text sized at 14 pixels.


Since <div> tags are block elements, they create line breaks. This is the same effect as a <p> tag. <span> tags do not create line breaks, which makes them perfect for styling text in the middle of a sentence.

There are far more possible values for the display property than block and inline — in fact, the CSS 2.1 specification lists 17 different possible values. Ten of these values are related to tables and correspond to the way the various HTML table elements act.

However, IE 6/7 doesnot support "display: table"

So, simple code to display a table is rendered differently in IE and Firefox


<div style="display:table">

<div style="display:table-row ;">

<div style="display:table-cell;background: #ccc;">

Cell 1


<div style="display:table-cell;background: #aaa;">

Cell 2



<div style="display:table-row;">

<div style="display:table-cell;background: #ccc;">

Cell 3


<div style="display:table-cell;background: #aaa;">

Cell 4






IE 7 renders it as:

Firefox renders it as:

Your browser will display above code as:

Cell 1

Cell 2

Cell 3

Cell 4

(Refer for comparison between <table> and <div>tags for displaying tabular data

and for compatibility of browsers for display property).

Wednesday, March 14, 2007

Issues with javascript:void(0)

There are plenty of occasions when coding JavaScript events where you simply need to call a function, for which an entire event registration model is too lengthy. The most commonly used method is to bind your event to an anchor link. The user clicks and the onclick event is fired, calling a reference to a function.

Because the user isn’t actually visiting a URL, something has to be done with the href attribute.
There are 2 options:
  • Use href="#"

Not finding a name (anchor link) after the pound, the browser “kicks” the user to the top of the current page, losing the location in the document.

  • Use href="javascript:void(0);"

Lets go with second option:

<a onclick="someMethod('userControlName')" href="javascript:void(0);">Click Here</a>

I tried to load user control in someMethod('userControlName'). It was working in IE7 and Firefox but not on IE6.

After investing into it a little bit, I found out a simple solution:

><a onclick="someMethod('userControlName'); return false;" href="javascript:void(0);">Click Here</a>

“return false” stops any other action after the person has finished the onClick action. This prevented event bubbling action (For excellent article on Event bubbling, see )