JDBC Resources and Connection Pool : Explain

JDBC Resources A JDBC resource (data source) provides applications with a means of connecting to a database. Typically, the administrator creates a JDBC resource for each database accessed by the applications deployed in a domain. (However, more than one JDBC resource can be created for a database.)   JDBC Resources To store, organize, and retrieve [...]

Explain JIT

Just-In-Time Compilers The simplest tool used to increase the performance of your application is the Just-In-Time (JIT) compiler. A JIT is a code generator that converts Java bytecode into native machine code. Java programs invoked with a JIT generally run much faster than when the bytecode is executed by the interpreter. The Java Hotspot VM [...]

How Synchronization impacts performance

Avoid synchronization where possible. ArrayList is faster than Vector Only List and Map have efficient thread-safe implementations: the Vector and Hashtable classes respectively. Synchronized methods are slower than the identical non-synchronized one. Consider using non-synchronized classes and synchronized-wrappers. FastVector is faster than Vector by making the elementData field public, thus avoiding (synchronized) calls to elementAt(). [...]

How to improve Servlet performance

Use the servlet init() method to cache static data, and release them in the destroy() method. Use StringBuffer rather than using + operator when you concatenate multiple strings. Use the print() method rather than the println() method. Use a ServletOutputStream rather than a PrintWriter to send binary data. Initialize the PrintWriter with the optimal size [...]

How to Improve JSP Page performance

Use the jspInit() method to cache static data, and release them in the jspDestroy() method. Use the jspInit() method to cache static data. Use StringBuffer rather than using + operator when you concatenate multiple strings. Use the print() method rather than the println() method. Use a ServletOutputStream rather than a PrintWriter to send binary data. [...]

Design Patterns : Performance

use the flyweight pattern to reduce object creation [The flyweight pattern uses a factory instead of 'new' to reuse objects rather than always create new ones]. The Singleton pattern and the Flyweight (object factory) pattern are useful to limit numbers of objects of various types and to assist with object reuse and reduce garbage collection. [...]

How to Improve the Java JDBC Performance

Use prepared statements. Use parametrized SQL. Tune the SQL to minimize the data returned (e.g. not ‘SELECT *’). Minimize transaction conflicts (e.g. locked rows). Use connection pooling. Try to combine queries and batch updates. Use stored procedures. Cache data to avoid repeated queries. Close resources (Connections, Statements, ResultSets) when finished with. Select the fastest JDBC [...]

dojo Charts: addSeries()

<html > <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><title>Untitled 1</title><script type=”text/javascript” src= “../js/dojo/dojo/dojo.js” djConfig=”isDebug: true”></script><script type=”text/javascript”>dojo.require(“dojox.charting.Chart2D”);makeCharts = function(){var chart1 = new dojox.charting.Chart2D(“simplechart”);chart1.addPlot(“default”, {type: “Lines”});chart1.addPlot(“other”, {type: “Areas”, hAxis: “other x”, vAxis: “other y”});chart1.addPlot(“Grid”, {type: “Grid”, hAxis: “other x”,    vAxis: “other y”,hMajorLines: true,    hMinorLines: false,    vMajorLines: true,    vMinorLines: false});chart1.addAxis(“x”, {     labels: [{value: 1, text: "Jan"}, {value: 2, text: "Feb"}, [...]

dojo Charts: Add Grids

<html > <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><title>Untitled 1</title><script type=”text/javascript” src= “../js/dojo/dojo/dojo.js” djConfig=”isDebug: true”></script><script type=”text/javascript”>dojo.require(“dojox.charting.Chart2D”);makeCharts = function(){var chart1 = new dojox.charting.Chart2D(“simplechart”);chart1.addPlot(“default”, {type: “Lines”});chart1.addPlot(“other”, {type: “Areas”, hAxis: “other x”, vAxis: “other y”});chart1.addPlot(“Grid”, {type: “Grid”, hAxis: “other x”,    vAxis: “other y”,hMajorLines: true,    hMinorLines: false,    vMajorLines: true,    vMinorLines: false});chart1.addAxis(“y”, {vertical: true});chart1.addAxis(“other x”, {leftBottom: false});chart1.addAxis(“other y”, {vertical: true,     leftBottom: false, [...]

dojo Charts: Coloring Axis

<html> <head runat=”server”><meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><title>Untitled 1</title><script type=”text/javascript” src= “../js/dojo/dojo/dojo.js” djConfig=”isDebug: true”></script><script type=”text/javascript”>dojo.require(“dojox.charting.Chart2D”);makeCharts = function(){var chart1 = new dojox.charting.Chart2D(“simplechart”);chart1.addPlot(“default”, {type: “Lines”});chart1.addPlot(“other”, {type: “Areas”, hAxis: “other x”, vAxis: “other y”});chart1.addAxis(“x”);chart1.addAxis(“y”, {vertical: true});chart1.addAxis(“other x”, {leftBottom: false});chart1.addAxis(“other y”, {vertical: true,     leftBottom: false,     max: 7,    stroke: “green”,    font: “normal normal bold 14pt Tahoma”,     fontColor: “red”,    majorTick: [...]

dojo Charts: addAxis()

<html> <head runat=”server”><meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><title>Untitled 1</title><script type=”text/javascript” src= “../js/dojo/dojo/dojo.js” djConfig=”isDebug: true”></script><script type=”text/javascript”>dojo.require(“dojox.charting.Chart2D”);makeCharts = function(){var chart1 = new dojox.charting.Chart2D(“simplechart”);chart1.addPlot(“default”, {type: “Lines”});chart1.addPlot(“other”, {type: “Areas”, hAxis: “other x”, vAxis: “other y”});chart1.addAxis(“x”);chart1.addAxis(“y”, {vertical: true});chart1.addAxis(“other x”, {leftBottom: false});chart1.addAxis(“other y”, {vertical: true, leftBottom: false});chart1.addSeries(“Series 1″, [1, 2, 2, 3, 4, 5, 5, 7]);chart1.addSeries(“Series 2″, [1, 1, 4, 2, 1, 6, [...]

dojo Charts: Multiple Plots

<html> <head runat=”server”><meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><title>Untitled 1</title><script type=”text/javascript” src= “../js/dojo/dojo/dojo.js” djConfig=”isDebug: true”></script><script type=”text/javascript”>dojo.require(“dojox.charting.Chart2D”);makeCharts = function(){    var chart1 = new dojox.charting.Chart2D(“simplechart”);chart1.addPlot(“default”, {type: “Lines”});chart1.addPlot(“other”, {type: “Areas”});chart1.addAxis(“x”);chart1.addAxis(“y”, {vertical: true});chart1.addSeries(“Series 1″, [1, 2, 2, 3, 4, 5, 5, 7]);chart1.addSeries(“Series 2″, [1, 1, 4, 2, 1, 6, 4, 3], {plot: “other”, stroke: {color:”blue”}, fill: “lightblue”});chart1.render(); };dojo.addOnLoad(makeCharts);</script></head><body><div id=”simplechart” style=”width: 250px; height: [...]

dojo Charts: Advanced Line Chart

<html> <head runat=”server”><meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><title>Untitled 1</title><script type=”text/javascript” src= “../js/dojo/dojo/dojo.js” djConfig=”isDebug: true”></script><script type=”text/javascript”>dojo.require(“dojox.charting.Chart2D”);makeCharts = function(){    var chart1 = new dojox.charting.Chart2D(“simplechart”);    chart1.addPlot(“default”, {type: “Lines”, markers: true, tension:3, shadows: {dx: 2, dy: 2, dw: 2}});    chart1.addAxis(“x”);    chart1.addAxis(“y”, {vertical: true});    chart1.addSeries(“Series 1″, [1, 2, 2, 3, 4, 5, 5, 7]);    chart1.render();};dojo.addOnLoad(makeCharts);</script></head><body><div id=”simplechart” style=”width: 250px; height: 150px;”></div></body></html> Output:

dojo Charts: Area Chart

<html> <head runat=”server”><meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><title>Untitled 1</title><script type=”text/javascript” src= “../js/dojo/dojo/dojo.js” djConfig=”isDebug: true”></script><script type=”text/javascript”>dojo.require(“dojox.charting.Chart2D”);makeCharts = function(){    var chart1 = new dojox.charting.Chart2D(“simplechart”);    chart1.addPlot(“default”, {type: “Areas”});    chart1.addAxis(“x”);    chart1.addAxis(“y”, {vertical: true});    chart1.addSeries(“Series 1″, [1, 2, 2, 3, 4, 5, 5, 7]);    chart1.render();};dojo.addOnLoad(makeCharts);</script></head><body><div id=”simplechart” style=”width: 250px; height: 150px;”></div></body></html> output:

dojo Charts: Line Chart

  <html> <head runat=”server”><meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><title>Untitled 1</title><script type=”text/javascript” src= “../js/dojo/dojo/dojo.js” djConfig=”isDebug: true”></script><script type=”text/javascript”>dojo.require(“dojox.charting.Chart2D”);makeCharts = function(){    var chart1 = new dojox.charting.Chart2D(“simplechart”);    chart1.addPlot(“default”, {type: “Lines”});    chart1.addAxis(“x”);    chart1.addAxis(“y”, {vertical: true});    chart1.addSeries(“Series 1″, [1, 2, 2, 3, 4, 5, 5, 7]);    chart1.render();};dojo.addOnLoad(makeCharts);</script></head><body><div id=”simplechart” style=”width: 250px; height: 150px;”></div></body></html>   Output:  

Web Page Performance : How To Improve it

Make Fewer HTTP Requests Use a Content Delivery Network Add an Expires or a Cache-Control Header Gzip Components Put Stylesheets at the Top Put Scripts at the Bottom Avoid CSS Expressions Make JavaScript and CSS External Reduce DNS Lookups Minify JavaScript and CSS Avoid Redirects Remove Duplicate Scripts Configure ETags Make Ajax Cacheable Flush the [...]

Code Reviews : Different Types

Automated Reviews Automate the review where possible. A review conducted by a computer has several benefits: Reduced manual cost of code reviews Fast, consistent, and repeatable Removes emotion from the reviews: pride, ego, and ownership need to be constantly recognized when conducting a review. When offering a critique you should take care to not to [...]

Code Reviews : Purpose

Adherence to coding standards Writing to standards has several benefits, such as a shared vocabulary, which makes the code easier to reuse and maintain. One of the primary focuses of a code review is to ensure abidance with these norms. As you’ll see later, this benefit of a review is best derived in an automated [...]

Code Reviews : How To

Ask questions rather than make statements. A statement is accusatory. “You didn’t follow the standard here” is an attack—whether intentional or not. The question, “What was the reasoning behind the approached you used?” is seeking more information. Obviously, that question can’t be said with a sarcastic or condescending tone; but, done correctly, it can often [...]

dojo : Debugging

  1. Use Firebug or Firebug Lite Firebug, an open source debugging extension for Firefox, is essential for JavaScript, HTML and CSS debugging. You can download it from the Firebug web site. 2. Logging In Dojo logging, you can associate messages with severity, just like in log4j. The following code illustrates the five severity levels: [...]

dojo: Send Data by POST

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN”     “http://www.w3.org/TR/html4/strict.dtd”><html>    <head>        <title>Dojo</title>        <!– load the dojo toolkit base –>    <script type=”text/javascript” src= “dojo/dojo/dojo.js”        djConfig=”parseOnLoad:true, isDebug:true”></script>    <script type=”text/javascript”>       // Load Dojo’s code relating to the Button widget       dojo.require(“dijit.form.Button”);    </script> <script>       function helloCallback(data,ioArgs) {          alert(data);       }              function helloError(data, ioArgs) {          alert(‘Error when retrieving data from the server!’);       [...]

dojo: Send Data to the Server using Get (Query String)

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN”     “http://www.w3.org/TR/html4/strict.dtd”><html>    <head>        <title>Dojo</title>        <!– load the dojo toolkit base –>    <script type=”text/javascript” src= “dojo/dojo/dojo.js”        djConfig=”parseOnLoad:true, isDebug:true”></script>    <script type=”text/javascript”>       // Load Dojo’s code relating to the Button widget       dojo.require(“dijit.form.Button”);    </script> <script>       function helloCallback(data,ioArgs) {          alert(data);       }              function helloError(data, ioArgs) {          alert(‘Error when retrieving data from the server!’);       [...]

dojo: Read Data from Server using GET

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN”     “http://www.w3.org/TR/html4/strict.dtd”><html>    <head>        <title>Dojo</title>        <!– load the dojo toolkit base –>    <script type=”text/javascript” src= “dojo/dojo/dojo.js”        djConfig=”parseOnLoad:true, isDebug:true”></script>    <script type=”text/javascript”>       // Load Dojo’s code relating to the Button widget       dojo.require(“dijit.form.Button”);    </script> <script>       function helloCallback(data,ioArgs) {          alert(data);       }              function helloError(data, ioArgs) {          alert(‘Error when retrieving data from the server!’);       [...]

dojo: Connecting an Event to the Widget

  <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN”     “http://www.w3.org/TR/html4/strict.dtd”><html>    <head>        <title>Dojo</title>        <!– load the dojo toolkit base –>    <script type=”text/javascript” src= “dojo/dojo/dojo.js”        djConfig=”parseOnLoad:true, isDebug:true”></script>    <script type=”text/javascript”>       // Load Dojo’s code relating to the Button widget       dojo.require(“dijit.form.Button”);    </script> <button dojoType=”dijit.form.Button” id=”helloButton”>        Hello World!        <script type=”dojo/method” event=”onClick”>           alert(‘You pressed the button’);        </script>    </button>    <style type=”text/css”>    /* [...]

Follow

Get every new post delivered to your Inbox.