Thursday, February 5, 2009

9 JavaScript Tips You May Not Know

9 JavaScript Tips You May Not Know

Excellent javascript tips every javascript developer should know. Very well explained and a very pleasing website.

JavaScript is a fully-featured Object-Oriented programming language, on the surface, it shares syntactical similarities with Java and C, but the mentality is quite different, at its core, JavaScript is more similar to functional languages. Inside is a list of JavaScript tips, some offer techniques to simulate features found in C-like languages (such as assertions or static variables), others are meant to improve performance and explore some of the more obscure parts of the web scripting language.

1. Arrays as Multipurpose Data Structures
2. String Concatenation vs. Array.join
3. Binding Methods To Objects
4. Sorting With a Custom Comparison Function
5. Assertion
6. Static Local Variables
7. null, undefined, and delete
8. Deep Nesting of Objects
9. Using FireBug

Make Firefox Faster.

This is a very simple trick , No software required.

* Mozilla uses more memory space.
* It becomes slow when i open more tabs
* Page cannot be found error makes the whole browser hang
* It crashes sometimes and restore session is the only resort to regain

The above complaints are very common about mozilla. But still i like mozilla :)

But there are some hidden truths regarding mozilla’s configuration. The Basic or Default configuration of mozilla is for Dial-up-connection.

You can go on with your default mozilla if you are using a dial-up connection. If you have a Broadband Internet Connection, you can make your mozilla more powerful than usual.

Do the following things:

  1. Open a new tab in your mozilla.
  2. Type about:config in your address bar and press Enter

This is the configuration page for mozilla. Dont edit all the fields .

For reducing memory usage of firefox do this:

Right click on the resulting window, New > Boolean

It prompt for “Enter the preference name”

Type config.trim_on_minimize and press ok. Select true value after that

For adding more speed for browsing and downloading:

On the about:config page , find the string network.http.pipelining (you can use the filter given for easy searching)

Change its value from false to true (Just double click on the line, it will toggle the true/ false values, or right click and click toggle)

Also change network.http.proxy.pipelining value true.

Now you have to change network.http.pipelining.maxrequests value . (Double click or right click and modify)

By default it will be 5 . Set its value from 10 to 30 depending on your internet connection speed.

Final Step: Right click on that window (about:config) and Click New > Integer and type: nglayout.initialpaint.delay and set its value to 0 (zero)

Done, restart your mozilla. Now you will get faster mozilla, faster internet. Happy Browsing.

If you want to know more regarding mozilla configuration, see this link: http://kb.mozillazine.org/Firefox_:_FAQs_:_About:config_Entries

Interesting Tip:

like http:// or ftp:// prompts you saw about: prompt. about:blank is a very familiar prompt right ? So another prompt here ; it is chrome://

Type: chrome://browser/content/browser.xul in your browsers address bar to see your mozilla browser inside itself.

If you're using a broadband connection you'll load pages MUCH faster now!

Interesting !!!