this keyword in javascript

August 30, 2010

This page neatly explains about “this” keyword
http://www.quirksmode.org/js/this.html

From javascript object oriented programming concepts – http://www.sitepoint.com/oriented-programming-1-2/

The this keyword inside a constructor function refers to the object that’s being created.

Quoting below example from SitePoint.com

function myFunc(StringValue){  <br>
this.StringValue = StringValue;  <br>
}  <br>
<br>
var myObject = new myFunc("This is myObject's string");  <br>
var myObject2 = new myFunc("This is a String");  <br>
alert(myObject.StringValue); // displays "This is myObject's string"  <br>
alert(myObject2.StringValue); // displays "This is a String"


Apache mod_rewrite NE|noescape

August 27, 2010

I faced an issue where the URL for example /saved/ was getting rewritten to %2Fsaved%2F, which caused the web application to give 404 error because it expects the URL without escaped/encoded characters.

I found this Stack Overflow thread related to this problem which gave the solution,

http://stackoverflow.com/questions/2443115/apache-mod-rewrite-tomcat-encoding-26-and

Add NE flag to prevent escaping –

http://httpd.apache.org/docs/2.2/rewrite/rewrite_flags.html#flag_ne


Setting up an SSH tunnel with PuTTY

August 23, 2010

Setting up an SSH tunnel with PuTTY

This is useful when the server has firewall blocking access of the port from your network.


Browser Cross Domain Communication

August 18, 2010

While building Mashup or building Portals this may be a common development problem. There are 2 ways to solve this
1) Through JSON
2) Through iframe hack – http://www.julienlecomte.net/blog/2007/11/31/ — This uses YUI

JQuery plugin for the solution number 2 – http://code.google.com/p/jquery-crossframe/

HTML5 supports this through postMessage – see Ajaxian post here – http://ajaxian.com/archives/cross-window-messaging-with-html-5-postmessage


Sun rises in the east

August 4, 2010

Recently I read a slashdot article – http://it.slashdot.org/story/10/07/28/2121259/Oracles-Java-Company-Change-Breaks-Eclipse about Java 1.6.0_21 release crashing Eclipse IDE because the IDE has code which checks for “Sun Microsystems” in the JVM company field property. This made me think about whether we should write code to handle these rare scenarios or things we take for granted that they will not change. In my opinion if we know or can predict that something like this will happen then handle it in code, else deal with it when it comes.