Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Tuesday, November 23, 2010

Client (Web) Tier Performance Improvement

I don't want to repeat the same what is been discussed in below.. http://developer.yahoo.com/performance/rules.html

Highlights are,

Compression, Remove duplicate JS, etc..

Wednesday, November 17, 2010

Javascript Obuscation

Imagine a website without Javascript? Why not? (no debates, only one scenario.. keep guessing). This is not something what i am going to write.

Security and bandwidth are the primary concerns for any web application that too if its exposed to public rather intranet. There are few open source tools which is available for overcoming this by size reduction, obfuscation, compression, minification etc. There are subtle difference between each of these but it addresses our concern.

There were so many online and offline tools available for doing the job, but as known fact that during this process something should not go wrong. Considering these aspects only very few popular ones were listed below.

Google Labs Closure Compiler - http://code.google.com/closure/compiler
Yahoo Yui Compressor - http://developer.yahoo.com/yui/compressor
Dojo ShrinkSafe - http://o.dojotoolkit.org/docs/shrinksafe
JS Min - http://crockford.com/javascript/jsmin

Some of the links out of scope for this topic are..

http://compressorrater.thruhere.net/
http://blog.creonfx.com/javascript/mootools-vs-jquery-vs-prototype-vs-yui-vs-dojo-comparison-revised
Java implementation

Tuesday, November 16, 2010

Desktop Timestamp

Any web based application especially working with date and time (ie. ordering, scheduling, reports) requires to show in their local timezone rather than GMT time or deployed application server time.

Javascript Date object method Date.getTimezoneOffset() helps to find client timezone, This may not give direct timezones like Standard Time (IST), Eastern Standard Time (EST) etc.

Example can be found @ http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp

If our requirement to do the conversion process in business tier rather than client tier the below Java snippet helps.

Date date = new Date();
System.out.println("Now (Local) :" + date);
DateFormat outdfm = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss a zzz");
outdfm.setTimeZone(TimeZone.getTimeZone("IST"));
System.out.println("IST Time :" + outdfm.format(date));

outdfm.setTimeZone(TimeZone.getTimeZone("EST"));
System.out.println("EST Time :" +outdfm.format(date));

Output :

Now (Local) :Wed Nov 17 10:27:27 IST 2010
IST Time :2010-11-17 10:27:27 AM IST
EST Time :2010-11-16 11:57:27 PM EST

An article http://www.odi.ch/prog/design/datetime.php might give more details of how these api works.

Running Jobs as application user in Cloudera hadoop distribution

When an Hadoop cluster is not enabled with Kerberos authentication, Internally triggered jobs would be running as an 'yarn' user ra...