Tuesday, October 13, 2009

JavaScript Call Stack

This post explains how to get JavaScript Calls stack in Mozilla extension. You can also use jsdI interface hooks to get JS call stack. Pls refer jsdIDebuggerService on MDC.

You need to call the function callstack( ) to get the JSCall stack. From where to call this function is depend on need of user.  You can call this function wherever you want to get JS call stack.

function callstack( ){
/* stackFrameStrings holds entire JS calls stack in string format */

var stackFrameStrings = new Error().stack.split('\n');

/* remove first two stack frames because they are frames of callstack() and error() functions */
stackFrameStrings.splice(0,2);

  for (var i in stackFrameStrings) {
      /*
        A stack frame string split into parts. (example of stack frame string is:
        href("http://www.comp.nus.edu.sg")@:0)   Note 0 indicates native function call in Mozilla firefox, and 1 is for onclick, onmouseover functions, ie. JS event functions, otherwise the number is line number in source file and contains URL of source file. Anothe rexample of stack frame string is :
 onclick([object MouseEvent])@file:///home/patilkr/Desktop/Html%20Test/js_http_test.html:1
      */
      var stackFrame = stackFrameStrings[i].split('@');

    if (stackFrame && stackFrame.length == 2) {
                dump("\n stackFrame[0]=" + stackFrame[0] + " stackFrame[1]=" + stackFrame[1] );
   } // end of if loop

 }//end of for loop
} //end of callstack function
 

Wednesday, October 7, 2009

Mozilla Firefox about:config Tweaks

Accessing your about:config page
In your Firefox, type about:config in the address bar.

Disable Delay Time When Installing Add-on 

Config name: security.dialog_enable_delay
Default: 2000 (in msec)
Modified value:
  • 0 – start installation immediately 
  • any other value (in msec) 
View Source in Your Favorite Editor 
There are two configuration need to be made:
Config name: view_source.editor.external
Default: False
Modified value: True ( enable view source using external text editor)

Config name: view_source.editor.path
Default: blank
Modified value: insert the file path to your editor here.

Autohide Toolbar in Fullscreen mode  
Config name: browser.fullscreen.autohide
Default: True (always autohide)
Modified value: False (always show the toolbar)




 

Friday, October 2, 2009

90/10 and Self assement Principals

This is a non-technical post. It is about, how to improve yourself. How to improve your thinking and your life. Principals describe here, if you applied in your life then, they will surely help you to feel satisfaction.

First principal is 90/10 Rule:
What is 90/10 Principal? Well, it is very simple. 10% of life is made of what happens to you and 90% of life is decided by how you react to things happens in your day to day life.

Let me explain this in more detail:
We really have NO control over 10% of incidences that happens to us.
For example, We cannot stop plane from arriving late, we cannot stop mechanical devices from breaking down.  We cannot control this 10% of incidences happens to us, However, over the 90% of incidences we have control and our reaction to the situation is the key factor which plays an important role in deciding 90% of our life.

If someone says something negative about you,  do not be a sponge or do not lose your tamper.
Let the attack roll off like water on glass. You do not have to let the negative comments affect you.

React properly and it will not ruin your day. A wrong reaction could result in losing a friend, or getting stressed out.

Remember the 90/10 Principle and don’t worry about life.

You are told you lost your job. Why lose sleep and get irritated?  It will work out.

Use your worrying energy and time to find a new job.

Millions of people are suffering from stress,  problems and headaches.

We all must understand and apply the 90/10 Principle.
It can change your life! You will lose nothing if you apply it.


Second Principal is Self Assessment:
Self assessment means do a regular review of your daily activity/reaction/behavior  at the end of day.  It helps to make judgment about our own actions.

If you apply this two principals in your life, you will surely be get benefited from it, without lossing anything. You will observe its good effect in you life by yourself.