Monday, December 6, 2010
Popular Ajax libraries(Ajax Frameworks) -JQuery,YUI Library,DOJO
here you can get in to the best ajax libraries ,which are ruling the Web Applications now a days and also these libraries are open source (No Cost for ur project)
1.JQuery
this libary is used by most of the struts developers as source says.
Struts2 provides a plugin for this library for easy way to implement in ur project.
Home link :
http://jquery.com/
and here you can get some of the useful stuffs related for Struts2+JQuery
http://www.weinfreund.de/struts2-jquery-showcase/index.action
2.YUI Library:
in this Library you can get all the things as like as JQuery there is some slight difference to implement the both the libraries and Struts2 provides a plugin for this library too.........
Home Link: Here u go
http://developer.yahoo.com/yui/
Here u can get the demo for all in YUI:
http://developer.yahoo.com/yui/3/examples/
3.DOJO:
This library is also used by most of the web Application developers.
Home Link: Here u go
http://www.dojotoolkit.org/
Struts2 provides the plugin for this too.........
All these frameworks supports most of the popular browsers like (IE,FireFox,Chrome etc.,)......
Thanks
A.T.J
Wednesday, September 23, 2009
SQL Best Practices for Query Performance
LINE2: FROM ISPFOLIO, ISCUST, FUND
LINE3: WHERE ----
LINE4: AND BRANCHCODE = ‘020’ -- Condition Returns 2016 Records
LINE5: AND ISCUST.ISACCOUNTNO BETWEEN '570' AND '670' -- Condition Returns 724 records
LINE6: AND ARMCODE = 'RHITUP' -- Condition Returns 1166 Records
LINE7: AND FUND.FUNDCODE = ISPFOLIO.FUNDCODE -- Merge returns a maximum of 320
LINE8: ISCUST.ISACCOUNTNO = ISPFOLIO.ISACCOUNTNO -- Merge returns a maximum of 2524
Number of records in each table:
ISPFOLIO - 4983 Records ISCUST - 2524 Records FUND - 320 Records
Indexes on each table:
ISPFOLIO - PKISPFOLIO (ISACCOUNTNO, FUNDCODE)
ISCUST - PKISCUST (ISACCOUNTNO)
- IDX_ISCUST_1 (ISACCOUNTNO, BRANCHCODE, ARMCODE, CHANNELCODE)
FUND - PKFUND (FUNDCODE)
- IDX_FUND_1 (NAME)
1. The Join conditions should always be at the left of the predicate and then followed by other predicates, as then only, records, which are selected, are merged. Otherwise all the tables are first merged and then the predicates are applied to this full merged table.
2. The join condition which returns the maximum number of rows should be the left, most the predicate to further reduce the number of records being merged between the tables.
3. In a Join condition put the table which has less number of records as the outer table. The reason for this is that, the optimizer does a table scan on the outer table to get the records which satisfy the given predicates and then the records which satisfy these selected rows in the outer table are directly picked up from the inner table using an index scan
4. Arrange the predicates in a query in such a manner that the predicate, which returns the least rows, comes towards the right of the query. Then move to the left of the query with the other predicates using the same rule.
5. Break down the query where ever possible and make it simpler to avoid the optimizer doing the same
6. Arrange the predicates in a query in such a manner that non-equal predicates come before the equality predicates in the query, so that the equality predicates are used first during execution. The reason being that non-equality predicates require range scans unlike equality predicates, which can go straight to the row if an index scan is used. Also when the optimizer tries to retrieve records using the non-equality predicate, it would scan only the records fetched by the equality predicate and not the full table.
7. Ensure that all columns are referenced with table name/alias, as this will prevent the optimizer from looking into the system tables to find which table a column belongs to.
So, the above query can be rewritten as:
LINE1: SELECT ISPFOLIO.ISACCOUNTNO, ISPFOLIO.FUNDCODE, FUND.NAME, ISPFOLIO.NOOFUNITS, ISPFOLIO.LIENAMT, ISCUST.ISACCOUNTNAME
LINE2: FROM ISPFOLIO, ISCUST, FUND
LINE3: WHERE
LINE7: AND ISPFOLIO.FUNDCODE = FUND.FUNDCODE
LINE8: ISPFOLIO.ISACCOUNTNO = ISCUST.ISACCOUNTNO
LINE4: AND ISCUST.BRANCHCODE = ‘020’
LINE6: AND ISCUST.ARMCODE = 'RHITUP'
LINE5: AND (ISCUST.ISACCOUNTNO >= '570' AND ISCUST.ISACCOUNTNO <= '670')
8. Specify the “Order By “clause only when absolutely required because this will cause the sorting of all records in a table before any predicate is applied. This sort will involve the use of considerable resources in terms of time and memory.
Thanks
A.T.J
Tuesday, September 8, 2009
Session Invalidation in WebSphere
- The application calls the invalidate() method on the session object.
- The session is not accessed for a period that is longer than the specified session timeout
- A session is eligible for invalidation if it has not been accessed for a period that is longer than the specified session timeout (MaxInactiveInterval) . The session manager has an invalidation process thread that runs every X seconds to invalidate sessions that are eligible for invalidation.
- The session manager uses a formula to determine the value of X. The value of X is calculated based on MaxInactiveInterval specified in the session manager and is referred to as the ReaperInterval.
- if maximum inactive interval of <15 minutes, the ReaperInterval (value of X) is approximately 60 to 90 seconds and if the a maximum inactive interval of >15 minutes the ReaperInterval (value of X) is approximately 300 to 360 seconds.
- As a result, a session might not be invalidated for MaxInactiveInterval + ReaperInterval seconds .
- Sessions are eligible for invalidation as soon as their maximum inactive interval expires, but are not actually invalidated until the reaper runs, which might be up to 6 minutes later. You can use this property to force the reaper to run more often, like every 60 seconds.
- Note that the more often the reaper runs, the more overhead it takes, so it can negatively impact performance. Values less than 60 seconds are not recommended.
Java Best Practice:Place Constants on the Left Side of Comparisons
Case1:
if ( something — 1){...)
if ( x = 0 ) {...}Compiles fine but very difficult to find the bugs Case 2:
if (1 - something ){...)
if ( 0 = x ) {...} * // Throws Compile time Exception
Seems to be both cases are equivalent, at least on first inspection, the code on the easel compiles and the code on the case2 does not. Why?
Because the second if statement Isnl doing a comparison, it's doing assignment - you can't assign a new value to a constant value such as 0.
By placing constants on the left side of comparisons you achieve the same effect and the compiler will catch it if you accidentally use assignment instead of compansion.
String Constant:
When you placing the String Constant on left on side we can avoid the NuliPointerException at RunTime
public class MyTestStringClass {
public final static String DEFAULT_START_VALUE="test":
public static void main(String[] args) {
String test=null;
System.out.println(DEFAULT_START_VALUE.equolsttest));//returnsfalse System.out.pnntln(test.equals(DEFAULT_START_VALUE));//throw null pointer Exception
}
}
A.T.J
Tuesday, August 25, 2009
Significance of ConnectionlOTimeOut parameter in WebSphere Application Server
java.net.SocketTimeOutException: Read Timed Out. (in SystemOut.log or activity.log).
Possible Root Cause:
A slow network connection between the client and the server causes this problem. In such cases, the HTTP socket might time out before the server completely reads the SOAP request. Sudden increase in overall network activity can also cause this problem The problem can also occur when the client is accessing the service from the server in a slow network connection and in situations where the amount of data in the SOAP request is large.
Possible solution:
Setting an appropriate value in the ConnectionlOTimeOut parameter might help to resolve the above issue. This parameter is configured under Web Container HTTP Transport (e.g 9080).
The default value is 5 seconds for the ConnectionlOTimeOut parameter for your Web container HTTP transport .
Thanks
A.T.J
Sunday, August 23, 2009
Type safe collections in J2SE5.0
To make an ArrayList of Strings, we use
ArrayList myList = new ArrayList();
Or, the polymorphic equivalent:
List myList = new ArrayList();
There was no syntax that let you specify that myList will take Strings and only Strings. And with no way to specify a type for the ArrayList, the compiler couldn't enforce that you put only things of the specified type into the list.
The Legacy Way to Do Collections
Here's a review of a pre-Java 5 ArrayList intended to hold Strings.
List myList = new ArrayList(); // can't declare a type
myList.add("Fred"); // OK. it will hold Strings
myList. add(new Customer()); // and it will hold other objects too
myList.add(new lnteger(42)); //and Integers....
A non-generic collection can hold any kind of object; it also holds anything that is NOT a primitive. And since a pre-Java 5 collection could hold anything, the methods that get objects out of the collection could have only one kind of return type—java.lang.Object. That meant that getting a String back out of our only-Strings-intended list required a cast:
String s = (String) myList.get(0);
And since you couldn't guarantee that what was coming out really was a String (since you were allowed to put anything in the list), the cast could fail at runtime.
Java 5 Generics
Java 5 generics takes care of both ends (the putting in and getting out) by enforcing the type of your collections. Let's update the String list:
List
myList.add("Fred"); // OK. it will hold Strings
myList.add(new Customer()); // compiler error!'.
By using generics syntax—which means putting the type in angle brackets
String s = (String) myList.get(0); //pre-generics. when a String wasn't guaranteed
We can now just say
String s = myList.get(0);
Advantages of Generics
- Type casting is automatic. The user can now get the object from a collection without bothering to type cast the object into the target class.
- Since the validation of the types happen at compile time, run lime exceptions like Class cast exceptions are avoided.
A.T.J