Posts Tagged ‘Best Practices’

 

 

 

 

Use Windows Grep is to search the contents of one or more files on your PC for occurrences of text strings you specify and display the results. Once found, it can replace matches with other strings.

http://www.wingrep.com/download.htm

 

 

 

http://www.barebonescoder.com/2010/06/mstest-vs-nunit-with-visual-studio-2010-tdd/

http://www.barebonescoder.com/2011/03/mstest-vs-nunit-with-visual-studio-2010-tdd-redux/

http://osherove.com/blog/2010/3/5/nunit-vs-mstest-nunit-wins-for-unit-testing.html

http://www.blaze.io/mobile/http-pipelining-big-in-mobile/

http://www.brianp.net/2011/07/19/will-http-pipelining-help-a-study-based-on-the-httparchive-org-data-set/

Refer following links in your web pages to get latest version of JQuery files from CDN …

http://code.jquery.com/jquery-latest.js
http://code.jquery.com/jquery-latest.min.js

Do you know how to use Firebug’s console effectively?

Execute jQuery/javascript statement at the console, with your page loaded in the browser, and you will instantly see the array of matching elements that are returned. If that result set isn’t correct, press the up-arrow key to retrieve the last command entered, refine the statement, and test it again

It works in conjunction with Firebug’s debugger. When execution is paused, switching to the console tab allows you to interrogate and manipulate the state of the DOM as it was at the time execution was halted. As you step through JavaScript code in the debugger, the execution context of the console remains in sync with the debugger’s.

// Global Variables – Version 1 : Should not use as the variable names may clash with other libraries that we refer in the page
var words = [‘a1’, ‘b1’, ‘c1’];
var getWord1 = function (n) {
return words[n];
};
alert(getWord1(1));

// Global Variables – Version 2 (better version ): but it is slow due to the fact that words array is recreated everytime we call getWord2 function
var getWord2 = function (n) {
var words = [‘a2’, ‘b2’, ‘c2’];
// Everytime getWord2 is called words array gets recreated, for testing you can have alert below and see that alert will be displayed on every getWord2 method call
alert(“getWord2”);

return words[n];
};
alert(getWord2(0));
alert(getWord2(1));

// Global Variables – Version 3 (best version) : using Closure
var getWord3 = function () {
var words = [‘a3’, ‘b3’, ‘c3’];
// Everytime getWord3 is called words array will not be recreated, for testing you can have alert below and see that alert will not be displayed on every getWord3 method call
alert(“getWord3”);

return function (n) {
return words[n];
};
} ();
alert(getWord3(0));
alert(getWord3(1));