Friday, October 24, 2008

Hourglass (Wait) cursor on page load

This is another pearl that was figured at work today. There are instances where we might want to turn the cursor into a hourglass symbolizing that the user needs to wait as the page is getting loaded. There are more than one way to achieve this. There are two that comes to my mind (please feel free to add more)

1. Using AJAX - UpdateProgress Extender that displays a wait modal popup extender when the page is getting loaded and ready
2. A simpler approach is to use JavaScript that does exactly this

We are going to see the second approach at work -
function doWait()
{ = 'wait';
body onbeforeunload="doWait();" onunload="doWait();">
Notice the events onbeforeunload() and onunload() events. The reason we use two events is that these events are browser dependent and so to behave well with different browsers, we do this!

Both Mozilla FireFox and Internet Explorer implements onbeforeunload() DOM events.

Another useful function of onbeforeunload() is to alert the user when he leaves the webpage. Read here to know more about this DOM event.

Tuesday, October 14, 2008

Capitializing first letter of every word

The ToTitleCase method in .NET is not a part of String class but of TextInfo class that resides in System.Globalization namespace. This method converts the first character of every word into upper case. Here's how to use it,

String sHelpText = "aN eXamPle tEXT";
System.Globalization.CultureInfo oCInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Globalization.TextInfo oTextInfo = oCInfo.TextInfo;


Note: The .ToLower() Method is used to explicitly convert the string into lower case. According to MSDN - the title casing converts the first character into upper case, except for a word that is upper case in entirety. Read more on this here.

Friday, October 10, 2008

Faster Firefox 3.0

While you were thinking about giving up FireFox due to its speed and memory bloats, Mozilla came out with 3.0 - a relatively faster successor.

Now, is it possible to tweak FireFox 3.0's default settings and make it work at lightening speed? Here are some of FF 3.0 browser tweaks.

For the uninitiated - you don't want to see all the gruesome details of application settings, but still want to experience the speed? Rush ahead to, install the add-on. From my experience, there is a consistent 30-40% increase in the browser's rendering speed for the web pages. Go on! Try it.

For those of you, who would like to know the nuts and bolts of everything - read on!

HTTP is the application-layer protocol that web pages are transferred with. In HTTP 1.1, multiple requests can be sent before any responses are received. This is known as pipelining. Pipelining reduces page loading times.

1. Open FireFox
2. Type about:config in the address bar and press Enter
3. In the filter bar type network.http.pipelining. Double-click to set it to true
4. Return to the filter bar and type network.http.pipelining.maxrequests. Double-click this option and set its value to 8.
5. Go to the filter bar and type network.http.proxy.pipelining. Once it opens double-click it to set it to true.
6. Right-click Preference Name and create a new Integer value. Enter content.notify.backoffcount in the New integer value pop-up window and click OK.
7. Right-click Preference Name and create a new Boolean value. Enter plugin.expose_full_path in the New boolean value pop-up window and click OK.
8. Right-click Preference Name and create a new Integer value. Enter ui.submenuDelay in the New integer value pop-up window and click OK.

These all the common settings for everyone. Check out below for specifics:

Note: A faster computer means - >513 MB Memory and 1.5 Ghz and a Faster Connection means - DSL/Cable (not dialup)