Wednesday, September 23, 2009

SQL Best Practices for Query Performance

Query performance is not a one-time consideration. You should consider it throughout the design, development, and production phases of the application development life cycle.

Query Coding General Guidelines:

Example:
LINE1: SELECT ISPFOLIO.ISACCOUNTNO, ISPFOLIO.FUNDCODE, FUND.NAME, ISCUST.ISACCOUNTNAME
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


HTTP Sessions are invalidated one of two ways:

  •      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

            (MaxInactiveInterval) in the WebSphere® Application Server session manager.
 
How does the WebSphere Application Server session manager invalidate sessions?


  •     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 .            

Can the Reaper Interval be controlled?
You can specify custom value for Reaper Interval using a Java™ virtual machine (JVM™) system property.
For WebSphere Application Server V3.5.6 or higher and V4.0.2 or higher:
-DSessionReaperInterval= (in seconds)
For all releases of WebSphere Application Server V5.0:
                       -DHttpSessionReaperPollInterval= (in 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

Numeric Constant
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

}

}


Thanks

A.T.J

Tuesday, August 25, 2009

Significance of ConnectionlOTimeOut parameter in WebSphere Application Server

When hosting the Enterprise Application on WebSphere Application Server, sometimes its possible to receive the following exception:

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

Arrays in Java have always been type safe—an array declared as type String (Stringfl) can't accept Integers (or ints). or anything other than Strings. But before Java 5 there was no syntax for declaring a type safe collection.

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 = new ArrayList();
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 , we're telling the compiler that this collection can hold only String objects. So, now that what you put IN is guaranteed, you can also guarantee what comes OUT, and that means you can gel rid of the cast when you get something from the collection. Instead of

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.
Thanks
A.T.J

Key Difference Between STRUTS 1 & STRUTS 2

The following table will differentiate the struts 1 & 2 clearly:


Pls click the above image and see it fully.......

Thanks
A.T.J

Some J2EE Rules / Best Practices

Do Not Call System Exit: Web applications should not call System.exitQ, since only the web container or the application server should stop the JVM.

Static EJB Field Should Be Final: According to the J2EE specification, an EJB should not have any static fields with write access. However, static read only fields are allowed. This ensures proper behavior especially when instances are distributed by the container on several JREs.

Do Not Use Threads: The J2EE specification explicitly forbid use of threads.

Use Proper Class Loader: In J2EE getClassLoader() might not work as expected. Use Thread.currentThread().getContextClassloader() instead.

Close connections: Most Java programmers close a connection with the database directly—without closing the ResultSet or Statement. But not all JDBC drivers clean themselves up. To be safe, remember to close everything explicitly in reverse order, i.e. in the order of ResultSet, PreparedStatement, Connection.

Use appropriate transaction attribute: Avoid transaction overhead for non-transactional methods of session beans by declaring 'NotSupported' or 'Never' transaction attributes that avoid further propagation of transactions.

Thanks
A.T.J

When to use Ajax and Flex?

Use AJAX:
  • To make incremental usability enhancements to an existing Web site
  • For building "widgets" that require the work of a small team of developers
  • When you have existing, internal JavaScript and HTML expertise
Some examples of AJAX-appropriate uses could be navigational elements, simple calculators and client-side validated forms.

Use Flex:
  • When you need to develop applications that require a robust, scalable rich Internet application
  • Where you require sophisticated and interactive data visualization
  • When video and audio playback or Web camera and/or a microphone capture is a requirement
  • Where you require complex animation or bitmap manipulation
  • When the graphic design is core critical to your business needs
Flex would be the right choice for product configurations, workflow/process/inventory management applications, video conferencing, playback and editing, immersive or entertaining experiences, data visualizations and management dashboards. Additionally, in real-world use. Flex typically requires less coding to build the same or better functionality. The learning curve is somewhat steeper, but the development times are significantly lower.

Thanks
A.T.J

NFS Tips & Tricks

  • The usual issue found with the NFS mount points is the performance issue faced when a NFS mount is used. The system stalls even when a 'Is' command is issued inside the NFS mount point. This is because, the NFS is hard mounted, which is usually done with the default settings.
  • NFS, by default, does not permit the files owned by root user/group to be owned by root user/group in the NFS client mount. This can be fixed by using the no_root_squash option in the /etc/exports file in the NFS server.
Considering the above two cases, a better situation can be arrived at if it is soft mounted using the below options.

NFS Server side configurations:

In the file /etc/exports use the below entry format

In the file /etc/sysconfig/nfs provide the below entry RPCNFSDCOUNT=64

"The above value 64 can be decreased for a lower Hardware and network bandwidth. It can be changed based on the project requirements.

NFS Client side configurations:

: nfs soft,intr,proto=tcp,timeo=14,retry=3,bg,rsize=65536,wsize=65536 0 0
  • NFS usually maps the uids/gids owned by the files or folders in the NFS server to a user or a group that has the same uid or gid in the client box. Hence whenever NFS mount points are used, the user using the files or folders that are created in the NFS share, should have the same uid in all the boxes [the NFS client boxes and NFS server] that share the files or folders through NFS.
Similarly, the group too must have the same gid, in all the boxes.
  • In NFS4, when starting the NFS service in the NFS server, if you face an error saying RPC.IDMAPD not found, add the below entries in the /etc/fstab in the NFS server to avoid such error and improve performance and run the command mount -a as root.


nfsd /proc/fs/nfsd nfsd defaults,noatime 1 1
rpc_pipefs /var/lib/nfs/rpc_pipefs rpc_pipefs defaults 0 0

Thanks
A.T.J

Some tips for MQSeries using MQSC commands in troubleshooting

Here i m going to explain with the two Q managers A & B

Assume two Queue Managers A and B which are having communication problems

Stepl: Check the dead letter Queue

dis q(Dead letter Qname) curdepth

Step 2: Check the transmit Queue

dis ql(transmition Qname) curdepth

If the curdepth is 0 then, check the date and time of the last msg sent by the sender channel

dis chs(A.B) Istmsgda Istmsgti

where A.B is the Sender channel from Queue Manager A to B

1)If the date/time is recent then it means, messages are being transmitted.

2)If the transmit queue depth is 0 and your channel does not show a recent send date & time, and your messages are not in the dead letter queue, you most likely have an application problem.

3)If the depth is greater than 0, you most likely have a problem with the sender channel.

Step 3: Check the status of your sender channel

dis chs(A.B)

If the status is STOPPED, try to determine why it is stopped.
If the status is RETRYING, then identify the reason for Retrying.

- The reason can be found by examining the Queue Manager Error Logs for that specific Channel in question.

Thanks
A.T.J

Saturday, August 22, 2009

ASPECT ORIENTED PROGRAMMING

Try the New Tech.....:
AOP is a new technology for separating crosscutting concerns into single units called aspects. An aspect is a modular unit of crosscutting implementation. It encapsulates behaviors that affect multiple classes into reusable modules. With AOP. we start by implementing our project using our OO language (for example, Java), and then we deal separately with crosscutting concerns in our code by implementing aspects. Finally, both the code and aspects are combined into a final executable form using an aspect weaver. As a result, a single aspect can contribute to the implementation of a number of methods, modules, or objects, increasing both reusability and maintainability of the code.



The code that is executed when aspect is invoked is called Advice. It contains own set of rules as to when it is to be invoked in the relation to join points. Join points are simply specific point within the application that may or may not call the advice. Pointcuts are encapsulates the decision making logic that is evaluated to decide if particular piece of advice got invoked when joint is encountered.

Output:
before calling method 1
Inside method
Note:
In Example,
Red
: Joinpoint
Pink: Advice
Green: pointcut

Thanks
A.T.J

Wednesday, August 19, 2009

Autoboxing in J2SE5.0

JUST GO THRO' it:
In general, collections can hold Objects but not primitives. Prior to Java 5. a very common use for the wrapper classes was to provide a way to get a primitive into a collection. Prior to Java 5. you had to wrap a primitive by hand before you could put it into a collection. With Java 5, primitives still have to be wrapped, but autoboxing takes care of it for you.
here i m going to show this technique with three examples..........

Example1:
List mylnts = new ArrayList(); // pre Java 5 declaration
mylnts.add(new lnteger(42)); // had to wrap an int

in this example, we are still adding an Integer object to mylnts(not an int primitive) at autoboxing handles the wrapping for us.

As of Java 5 we can say
mylnts.add(42); //autoboxinghandles it!

Example2:
Integer var1=10; // pre Java 5 equivalent is int var1=10;
Integer var2=var1+15; // pre Java 5 equivalent is int var2=var1+15:
System.out.println(var2); //prints 25

Example3:
import java.util.*;
public class WordCounl {
public static void main(String[] args) {
Map m = new TreeMap();
for (String word : args) {
Integer wordCnt = m.get(word);
m.put(word. (wordCnt == null ? 1 : wordCnt + 1));
}
System.out.println(m);
}
}

What is really happening is this: In order to add 1 to wordCnt, it is automatically unboxed, resulting in an expression of type int Since both of the alternative expressions in the conditional expression are of type int, so too is the conditional expression itself. In order to put this int value into the map. it is automatically boxed into an Integer.

Thanks
A.T.J

Tuesday, August 18, 2009

Using CSS sprites: Improve Web Performance

JUST GO THRO'it:

CSS sprites group multiple images into one composite image and display them using CSS background positioning. You can save a significant amount of HTTP requests by consolidating your images into one or more composite sprites and using CSS to selectively display parts of the sprite within your web page. Some of the busiest sites on the Web use CSS sprites to save HTTP requests.

Brief HowTo:
The idea behind CSS sprites is to consolidate multiple images into one sprite and then selectively display portions of this sprite with positioning.
The steps are as follows:


1. Group multiple images together (usually icons) into one sprite


2. Evenly space these images, aligned into one or more lines


3. Set this sprite to the background image of an element (usually a list)


4. Position the sprite to display the appropriate image by shifting the X or Y position by a multiple of the spacing


Case in Point: Yahoo!
Yahoo uses CSS sprites on its home page to improve performance. The first set of icons is displayed in the "Check your mail status" section on the right of Yahoo!

The #patabs li .icon rule loads the composite background sprite.
#patabs li .icon{
display:block;
z-index:10;
padding:8px 0 9px 40px;
background:url(pa-icons.gif) 5px 3px no-repeat;
}
The background position is changed to show only the icon that matches the tab ID (in this case #messenger).
#patabs #messenger .icon{
padding-left:31px;
background-position:Xpx Ypx;
}

Thanks
A.T.J

Sunday, August 16, 2009

Crystal Report - Tips

TIPS HERE :

  • Don't use tables directly in Database Expert instead use 'Add Command' Option in Database Expert since it will improve the performance of the report.
  • To pass a parameter in a query, use '{?parameterName}' and add the same parameter in "insert parameter" dialog box.
  • When exporting a report that contains strings encoded in a particular character set (for example, German) to Text format on a system using a different code page than that set (for example, Japanese, or simplified Chinese), the export can enter into an infinite loop. The cause was that some characters were misinterpreted as the lead byte of a double byte character. This would result in the export to loop on the character following the misinterpreted one. Hence to avoid this, enable UNICODE instead of ASCII during the installation of Database and Crystal Reports server.
Thanks
A.T.J

Wednesday, July 29, 2009

Linux Tips using tar

TIPS:
tar is an archiving utility.it can also be used to create pr decompress gzip or bzip2 files.

1.(Using the tar command to create a ".tar.gz" file or folder/stuff)
$ tar -czvf stuff.tar.gz stuff

2.(Using the tar command to create a ".tar.bz2" file or folder/stuff)
$ tar -cjvf stuff.tar.bz2 stuff

3.(list the files in the archive of gzip)
$ tar -tzvf stuff.tar.gz

4.(list the files in the archive of bzip2)
$ tar -tjvf stuff.tar.bz2

5.To extract only one file from archive
$ tar -xvf stuff.tar Example.txt
the above command will only get the Example file from the archive

6.To extract a '.tar.gz' file
$ tar -zxvf stuff.tar.gz

7.To extract a '.tar.bz2' file
$ tar -jxvf stuff.tar.bz2


JSON with example

GO THRO' IT:

JSON (JavaScript Object Notation):
- A lightweight data-interchange format.

- Easy for humans to read and write.

- Easy for machines to parse and generate

JSON is built on two data structures:
- A collection of name/value pairs (unordered structure).

- An ordered list of values.
JSON's basic types:
  • Number (integer, real, or floating point)
  • String (double-quoted Unicode with backslash escaping)
  • Boolean (true and false)
  • Array (an ordered sequence of values, comma-separated and enclosed in square brackets)
  • Hashtable or Map (collection of key: value pairs, comma-separated and enclosed in curly braces)
  • null
Sample JSON Format:

{

“firstname”:”John”,
“lastname”:”Smith”,
“address”:{

“streetaddress”:”21,2nd Street”,
“city”:”Chennai”,
“state”:”TN”,
“postalcode”:”600090”
},
“phonenumbers”:[

“044-22772299”,
“044-28888888”]

}

>>The above example explain the JSON representation of an object that describes a person. The object has string fields for first name and last name, contains an object representing the person's address, and contains a list of phone numbers (an array).
>>It is based on a subset of the JavaScript Programming Language,ECMA-262 3rd Edition - December 1999.

Thanks
A.T.J

Friday, July 24, 2009

JDK and JRE File Structure

Development Files and Directories:
>>This tip provides an introductory overview of the JDK directories and the files they contain. Note that the file structure of the JRE is identical to that of the JDK's jre directory.
>>This section describes the most important files and directories required to develop
         jdk1.6.0
___________|_________________
| | |
bin lib jre
| | ________|__________
java* tools.jar | |
javac* dt.jar bin lib

javap* | ________ ___|___ _________ ________ _______
javah* java* | | | | | |
javadoc* rt.jar ext security sparc applet fonts
charsets.jar | / \
localedata.jar server client




Assuming the JDK software is installed at /jdk1.6.0, here are some of the most important directories:
/jdk1.6.0
Root directory of the JDK software installation. Contains copyright, license, and README files. Also contains src.zip, the archive of source code for the Java platform.
/jdk1.6.0/bin
Executables for all the development tools contained in the JDK. The PATH environment variable should contain an entry for this directory. For more information on the tools, see JDK Tools.
/jdk1.6.0/lib
Files used by the development tools. Includes tools.jar, which contains non-core classes for support of the tools and utilities in the JDK. Also includes dt.jar, the DesignTime archive of BeanInfo files that tell interactive development environments (IDE's) how to display the Java components and how to let the developer customize them for an application.
/jdk1.6.0/jre
Root directory of the Java runtime environment used by the JDK development tools. The runtime environment is an implementation of the Java platform. This is the directory referred to by the java.home system property.
/jdk1.6.0/jre/bin
Executable files for tools and libraries used by the Java platform. The executable files are identical to files in /jdk1.6.0/bin. The java launcher tool serves as an application launcher (and replaced the old jre tool that shipped with 1.1 versions of the JDK). This directory does not need to be in the PATH environment variable.
/jdk1.6.0/jre/lib
Code libraries, property settings, and resource files used by the Java runtime environment. For example:
>>rt.jar -- the bootstrap classes (the RunTime classes that comprise the Java platform's core API).
>>charsets.jar -- character-conversion classes.
Aside from the ext subdirectory (described below) there are several additional resource subdirectories not described here.
/jdk1.6.0/jre/lib/ext
Default installation directory for Extensions to the Java platform. This is where the JavaHelp jar file goes when it is installed, for example.

>>localedata.jar -- locale data for java.text and java.util.
/jdk1.6.0/jre/lib/security
Contains files used for security management. These include the security policy (java.policy) and security properties (java.security) files.
/jdk1.6.0/jre/lib/sparc
Contains the .so (shared object) files used by the Solaris version of the Java platform.
/jdk1.6.0/jre/lib/sparc/client
Contains the .so file used by the Java HotSpotTM Client Virtual Machine, which is implemented with Java HotSpotTM technology. This is the default VM.
/jdk1.6.0/jre/lib/sparc/server
Contains the .so file used by the Java HotSpotTM Server Virtual Machine.
/jdk1.6.0/jre/lib/applet
Jar files containing support classes for applets can be placed in the lib/applet/ directory. This reduces startup time for large applets by allowing applet classes to be pre-loaded from the local file system by the applet class loader, providing the same protections as if they had been downloaded over the net.
/jdk1.6.0/jre/lib/fonts
Font files for use by platform.
These things i got from sun.com..........its really very help full for u to understand the file structures in java.
Thanks
A.T.J

Thursday, July 23, 2009

vi Editor Tips

TIPS:
vi - is a programmers text editor.

The editor can be used to create scripts or any type of file in Linux.

To try the below options, open a sample file.

$ vi samplefile.txt

Following are the short cuts used in vi editor:


Command :Result
Yy:to copy the current line
y3 and down arrow:to copy 3 lines below the current line
Dd:to cut/delete the current line
d3 and down arrow:to delete 3 lines below the current line
P:to paste the copied line
U:Undo last change
R:Redo last change
X:Delete character
Dw:Delete word
Q!:Quit without saving file
Ctrl f:Move forward one page
Ctrl b:Move backward one page

Thanks
A.T.J

100 Shortcuts using keyboard

CHECKOUT THIS:
CTRL+C ::::::(Copy)
CTRL+X ::::::(Cut)
CTRL+V ::::::(Paste)
CTRL+Z ::::::(Undo)
DELETE ::::::(Delete)
SHIFT+DELETE::: :::(Delete the selected item permanently without placing the item inthe Recycle Bin)
CTRL while dragging an item :::(Copy the selected item)
CTRL+SHIFT while dragging an item :::(Create a shortcut to the selected item)
F2 key ::::::(Rename the selected item)
CTRL+RIGHT ARROW ::::::(Move the insertion point to the beginning of the nextword)CTRL+LEFT ARROW ::::::(Move the insertion point to the beginning of the previousword)CTRL+DOWN ARROW::: :::(Move the insertion point to the beginning of the nextparagraph)CTRL+UP ARROW ::::::(Move the insertion point to the beginning of the previousparagraph)CTRL+SHIFT with any of the arrow keys :::(Highlight a block of text)
SHIFT with any of the arrow keys :::(Select more than one item in a window or on thedesktop, or select text in a document)
CTRL+A ::::::(Select all)
F3 key ::::::(Search for a file or a folder)
ALT+ENTER::: :::(View the properties for the selected item)
ALT+F4 ::::::(Close the active item, or quit the active program)
ALT+ENTER::: :::(Display the properties of the selected object)
ALT+SPACEBAR::: :::(Open the shortcut menu for the active window)
CTRL+F4 ::::::(Close the active document in programs that enable you to have multipledocuments open simultaneously)
ALT+TAB :::(Switch between the open items)
ALT+ESC :::(Cycle through items in the order that they had been opened)
F6 key :::(Cycle through the screen elements in a window or on the desktop)
F4 key :::(Display the Address bar list in My Computer or Windows Explorer)
SHIFT+F10 :::(Display the shortcut menu for the selected item)
ALT+SPACEBAR :::(Display the System menu for the active window)
CTRL+ESC :::(Display the Start menu)
ALT+Underlined letter in a menu name :::(Display the corresponding menu)
Underlined letter in a command name on an open menu :::(Perform the correspondingcommand)F10 key :::(Activate the menu bar in the active program)
RIGHT ARROW :::(Open the next menu to the right, or open a submenu)
LEFT ARROW :::(Open the next menu to the left, or close a submenu)
F5 key :::(Update the active window)
BACKSPACE :::(View the folder one level up in My Computer or Windows Explorer)
ESC :::(Cancel the current task)
SHIFT when you insert a CD-ROM into the CD-ROM drive :::(Prevent the CD-ROMfrom automatically playing)
Dialog Box Keyboard ShortcutsCTRL+TAB :::(Move forward through the tabs)CTRL+SHIFT+TAB :::(Move backward through the tabs)
TAB :::(Move forward through the options)
SHIFT+TAB :::(Move backward through the options)
ALT+Underlined letter :::(Perform the corresponding command or select thecorresponding option)
ENTER :::(Perform the command for the active option or button)
SPACEBAR :::(Select or clear the check box if the active option is a check box)
Arrow keys :::(Select a button if the active option is a group of option buttons)
F1 key :::(Display Help)
F4 key :::(Display the items in the active list)
BACKSPACE :::(Open a folder one level up if a folder is selected in the Save As orOpen dialog box)
m*cro$oft Natural Keyboard ShortcutsWindows Logo :::(Display or hide the Start menu)Windows Logo+BREAK :::(Display the System Properties dialog box)
Windows Logo+D :::(Display the desktop)
Windows Logo+M :::(Minimize all of the windows)
Windows Logo+SHIFT+M :::(Restore the minimized windows)
Windows Logo+E :::(Open My Computer)
Windows Logo+F :::(Search for a file or a folder)
CTRL+Windows Logo+F :::(Search for computers)
Windows Logo+F1 :::(Display Windows Help)
Windows Logo+ L :::(Lock the keyboard)
Windows Logo+R :::(Open the Run dialog box)
Windows Logo+U :::(Open Utility Manager)
Accessibility Keyboard ShortcutsRight SHIFT for eight seconds :::(Switch FilterKeys either on or off)
Left ALT+left SHIFT+PRINT SCREEN :::(Switch High Contrast either on or off)
Left ALT+left SHIFT+NUM LOCK :::(Switch the MouseKeys either on or off)
SHIFT five times :::(Switch the StickyKeys either on or off)
NUM LOCK for five seconds :::(Switch the ToggleKeys either on or off)
Windows Logo +U :::(Open Utility Manager)
Windows Explorer Keyboard ShortcutsEND :::(Display the bottom of the active window)HOME :::(Display the top of the active window)
NUM LOCK+Asterisk sign :::(*) :::(Display all of the subfolders that are under theselected folder)
NUM LOCK+Plus sign :::(+) :::(Display the contents of the selected folder)
NUM LOCK+Minus sign :::(-) :::(Collapse the selected folder)
LEFT ARROW :::(Collapse the current selection if it is expanded, or select the parentfolder)RIGHT ARROW :::(Display the current selection if it is collapsed, or select the firstsubfolder)Shortcut Keys for Character MapAfter you double-click a character on the grid of characters, you can move through thegrid by using the keyboard shortcuts:
RIGHT ARROW :::(Move to the right or to the beginning of the next line)
LEFT ARROW :::(Move to the left or to the end of the previous line)
UP ARROW :::(Move up one row)
DOWN ARROW :::(Move down one row)
PAGE UP :::(Move up one screen at a time)
PAGE DOWN :::(Move down one screen at a time)
HOME :::(Move to the beginning of the line)
END :::(Move to the end of the line)
CTRL+HOME :::(Move to the first character)
CTRL+END :::(Move to the last character)
SPACEBAR :::(Switch between Enlarged and Normal mode when a character isselected)m*cro$oft Management Console :::(MMC)
Main Window Keyboard ShortcutsCTRL+O :::(Open a saved console)
CTRL+N :::(Open a new console)
CTRL+S :::(Save the open console)
CTRL+M :::(Add or remove a console item)
CTRL+W :::(Open a new window)
F5 key :::(Update the content of all console windows)
ALT+SPACEBAR :::(Display the MMC window menu)
ALT+F4 :::(Close the console)
ALT+A :::(Display the Action menu)
ALT+V :::(Display the View menu)
ALT+F :::(Display the File menu)
ALT+O :::(Display the Favorites menu)
MMC Console Window Keyboard ShortcutsCTRL+P :::(Print the current page or active pane)ALT+Minus sign :::(-) :::(Display the window menu for the active console window)SHIFT+F10 :::(Display the Action shortcut menu for the selected item)
F1 key :::(Open the Help topic, if any, for the selected item)
F5 key :::(Update the content of all console windows)
CTRL+F10 :::(Maximize the active console window)
CTRL+F5 :::(Restore the active console window)
ALT+ENTER :::(Display the Properties dialog box, if any, for the selected item)
F2 key :::(Rename the selected item)
CTRL+F4 :::(Close the active console window. When a console has only one consolewindow, this shortcut closes the console)
Remote Desktop Connection NavigationCTRL+ALT+END :::(Open the m*cro$oft Windows NT Security dialog box)
ALT+PAGE UP :::(Switch between programs from left to right)
ALT+PAGE DOWN :::(Switch between programs from right to left)
ALT+INSERT :::(Cycle through the programs in most recently used order)
ALT+HOME :::(Display the Start menu)
CTRL+ALT+BREAK :::(Switch the client computer between a window and a fullscreen)ALT+DELETE :::(Display the Windows menu)
CTRL+ALT+Minus sign :::(-) :::(Place a snapshot of the active window in the client onthe Terminal server clipboard and provide the same functionality as pressing PRINTSCREEN on a local computer.)
CTRL+ALT+Plus sign :::(+) :::(Place a snapshot of the entire client window area on theTerminal server clipboard and provide the same functionality as pressing ALT+PRINTSCREEN on a local computer.)
m*cro$oft Internet Explorer NavigationCTRL+B :::(Open the Organize Favorites dialog box)CTRL+E :::(Open the Search bar)
CTRL+F :::(Start the Find utility)
CTRL+H :::(Open the History bar)
CTRL+I :::(Open the Favorites bar)
CTRL+L :::(Open the Open dialog box)
CTRL+N :::(Start another instance of the browser with the same Web address)
CTRL+O :::(Open the Open dialog box, the same as CTRL+L)
CTRL+P :::(Open the Print dialog box)
CTRL+R :::(Update the current Web page)
CTRL+W :::(Close the current window)
Thanks
A.T.J

Wednesday, July 22, 2009

JavaScript Code for filtering Non Numeric Value

CODE:


function filterNonNumeric(field) {
var result = new String();
var numbers = "0123456789";
var chars = field.value.split(""); // create array
for (i = 0; i < value =" result;">

......The above code filter the non numeric value .........i.e, when ever user enter the value other than numeric it wont allow you to enter it accepts only the numeric value
.....the input for the above java script function is property/ name from the Textbox in Jsp

for ex..from jsp (please ignore the starting symbol(--) in tag


<--input type=text name="units">

the above name units is given to that function.
having doubt on this .......leave .....a..comment
Thanks
A.T.J


Saturday, July 18, 2009

Solution for-ORA-00034:cannot string in current PL/SQL session

REASON:

In a session if you disabled the COMMIT/ROLLBACK. In this scenario if you try to issue a COMMIT/ROLLBACK through any of the PL/SQL objects like(procedure, function, package).

SOLUTION:
If you enable the commit in current session it will get rectified
else
don issue the COMMIT/ROLLBACK in the current session.

Solution for-ORA-00054:resource busy and acquire with NOWAIT specified

REASON:

When ever you are trying to access the table for DML oprartion in the database.you will get this error.


SOLUTION:

better execute the COMMIT statement for this and try it

Ex:

Sql>COMMIT;

Thanks
A.T.J

Solution for-ORA-00904:string: invalid identifier

REASON:

if you entered a invalid column name in SELECT,UPDATE queries you will get this error
So you have to check the below conditions.

SOLUTION :
1.please enter the valid column name from the table.
2.Column name criterias:
a.Column name should not be reserved words.
b.Column name must begin with a letter.
c.Column name should be <=30 Characters and consist of alpha numeric char.. and Special char.. like #,_ and $. Thanks
A.T.J

Solution for-ORA-12154:TNS:could not resolve the connect identifier specified

SOLUTION:

The reason for this error is connection identifier is not specified in the connection descriptor list so the connect identifier could not be resolved For Ex.if i use the type of connection identifier service name is BUSINESS if this name is not specified/configured in the namings list you will get this error.

Basically naming configured in three ways :
1.Directory naming.
2.Local naming(TNSNAMES.ORA file).
3. Easy connect naming.

SOLUTION IF YOU ARE USING Directory Naming:

>Check whether "LDAP" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
>Check whether the BUSINESS service name or database name used as the connect identifier is configured in the directory.
>Check whether the LDAP directory server is up and that it is accessible.
>Check whether the default context being used is correct by specifying a fully qualified BUSINESS service name or a full LDAP DN as the connect identifier.

SOLUTION IF YOU ARE USING Local naming(TNSNAMES.ORA file):
>First thing you have to confirm whether the TNSNAMES.ORA file exists and is in the proper directory and is accessible.
>Check that the BUSINESS service name used as the connect identifier exists in the TNSNAMES.ORA file.
>Basically the TNSNAMES.ORA is in the ADMIN folder under the ORACLE folder if if the ADMIN folder is not created while installing the oracle please create the ADMIN folder and paste the TNSNAMES.ORA file(refer the first point).
>Make sure that "TNSNAMES" is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
>check whether there is any syntax errors in the TNSNAMES.ORA mainly focus the paranthesis is correctly closed or not if there is any errors in the file and that line is not referred.

SOLUTION IF YOU ARE USING Easy connect naming:
>check whether the host, port and service name specified are correct or not.
>check that "EZCONNECT" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
> enclosing the connect identifier in quote marks thats will be better.

Thanks
A.T.J

Thursday, July 16, 2009

Solution for-ORA-00001:unique constraint (string.string) violated

SOLUTION:
This Error will Throw when you violate the unique constraint on the table .because if you created the unique constraint for the table it wont allow you to insert/update the duplicate values into the table.

the following example explains how this error happen.

Employee
------------------------------------------------------------------
NAME AGE DEPT EMP_NO
------------------------------------------------------------------
PIETER 25 SALES 10
JOHN 30 ACCOUNTS 11
RITCHIE 30 SALES 12

The above Employee table contains 3 records and if i create the unique constraint for this Employee table on EMP_NO column or if the unique constraint is already created .......

SYNTAX FOR CREATE UNIQUE CONSTRAINT:

ALTER TABLE table_name add CONSTRAINT constraint_name UNIQUE (column1, column2, ... column_n);

FOR THE ABOVE EXAMPLE CONSTRAINT IS :

ALTER TABLE Employee add CONSTRAINT EmpNo_unique UNIQUE (EMP_NO);

Note:

Here EmpNo_unique is the constraint name

in this Scenario if we insert/update the duplicate values in to the table

For Insert:Insert into Employee(NAME,AGE ,DEPT, EMP_NO)values('JOLIE',25,'SALES',10);

For Update:Update Employee set EMP_NO=12 where EMP_NO=11

For the above two Scenario it will throw the Error as

ORA-00001:unique constraint (Db_Name.EmpNo_unique ) violated

So if you want to overcome with this Error in 2 ways.
1.don't insert/update the duplicate the values in to the table
2.Else Drop the unique constraint

Syntax for Drop the unique Constraint:

ALTER TABLE table_name drop CONSTRAINT constraint_name;

Example:

ALTER TABLE Employee drop CONSTRAINT EmpNo_unique;


Thanks
A.T.J





Wednesday, July 15, 2009

Make Textbox hidden/visible based on the DropDown selection using JavaScript

SOLUTION:

the following function will help you to solve this ......


function hideTextBox(dropDown1){
var valFromDropDown = dropDown1.value;
if(valFromDropDown == 'WRITE'){
document.forms[0].textBox1.style.visibility = "";
} else{
document.forms[0].textBox1.style.visibility = "hidden";
}
}


in the above example hideTextBox is the function name .....
and the input for this function is dropDown value selected......
in this example we are hiding the the text box if the drop down value is 'WRITE' else it will show the textbox......



the following Example.jsp page will clearly explain you how to implement this and please ignore this Symobl(--)inside the every tag Starting. i put this (--) for displaying html tags only kindly ignore that symbol

Example.jsp(please ignore this(--)symbol and try it it will surely work
--------------------------------------------------------------------
<--%@taglib uri="/includes/struts-html.tld" prefix="html"%>
<--%@taglib uri="/includes/struts-bean.tld" prefix="bean"%>
<--%@taglib uri="/includes/struts-logic.tld" prefix="logic"%>



<--script language="javascript">

function hideTextBox(dropDown1){
var valFromDropDown = dropDown1.value;
if(valFromDropDown == 'WRITE'){
document.forms[0].textBox1.style.visibility = "";
} else{
document.forms[0].textBox1.style.visibility = "hidden";
}
}

<--/script>




<--table width="100%" border="0" cellspacing="0" cellpadding="0">

<--tr>
<--td width="20%">SelectProcess:
<--td width="30%">
<--html:select property="dropDown1" onchange="javascript:hideTextBox(this)">
<--html:option value="READ">Read
<--html:option value="WRITE">Write
<--html:option value="OVERWRITE">OverWrite
<--/html:select>
<--td width="20%">
<--td width="30%">
<--/tr>

<--tr>
<--td width="20%">TextBox1:
<--td width="30%">
<--td width="30%"><--html:text property="textBox1" maxlength="10" size="10">
<--/td>
<--td width="20%">
<--td width="30%">

<--/table>

<--/html:html>
--------------------------------------------------------------------------------------
from the above Example.jsp you can clearly understood how the function is implemented

note:

you have to declare these property in the form bean this is the example used in struts Frame work.

if you still having doubts write a comment on this.

Thanks
A.T.J

How to create a .bat file for eclipse


SOLUTION:
the reason for create the .bat file for eclipse is you can give the different versions of java like java 1.4.2 ......java 1.5.0 ...etc..but you can able to give only one version of java at a time.

using this .bat file you can double click it and run the eclipse on desktop.

steps to create the .bat file

1.open a notepad and paste the following things.

start eclipse -vm C:\java\jdk1.4.2\jre\bin\javaw -vmargs -Xmx256M
startup
exit

2.finally save the file name as eclipse.bat and the file type as AllFiles and the location is where the eclipse.exe is located and create the the shortcut for that .bat file just by right click it and select the option CreateShortcut.


Note:
you have to mention the java folder path where its actually located and the exact javaw.exe path
in our example the path is C:\java\jdk1.4.2\jre\bin\javaw


finally the shortcut .bat file will be look like this


Thanks
A.T.J

How to get the duplicate values from table using sql

SOLUTION :

SELECT * from TABLE_NAME a where rowid not in (select max(rowid) from TABLE_NAME b
where a.COLUMN_NAME=b.COLUMN_NAME)

above query retrieves the duplicated values from the table now we can see with the example

BOOK
---------------------------------------------
BOOK_NAME PRICE AUTHOR
--------------------------------------------
JAVA 200 XXXX
LEARNING C 100 YYYY
JAVA 150 ZZZZ
C# 180 AAAA
C++ 200 BBBB
JAVA 200 XXXX
C# 150 RRRR
ORACLE 300 UUUU
PHP 100 EEEE

in the above BOOK table BOOK_NAME is column name here the JAVA and C# gets duplicated .
from this if you want to get duplicated value based on the column name .use the following query

SELECT * from BOOK a where rowid not in (select max(rowid) from BOOK b
where a.BOOK_NAME=b.BOOK_NAME)

after execute this query you will get the following values ,which is the highest of records from duplicated values.

---------------------------------------------
BOOK_NAME PRICE AUTHOR
---------------------------------------------
JAVA 200 XXXX
JAVA 150 ZZZZ
C# 180 AAAA

thanks...
A.T.J

Monday, July 13, 2009

Solution for-ORA-01427:single-row subquery returns more than one row

SOLUTION 1:
the main reason for this error is records get duplicated on the table .So the inner query returns the duplicated values.to rectify this use the following query and this problem get resolved.
here is the solution if and only if you want to delete the duplicate records from the table


DELETE FROM TABLE_NAME A where rowid not in (select max(rowid) from TABLE_NAME B
where A.COLUMN_NAME=B.COLUMN_NAME)

In This QUERY you will replace the TABLE_NAME in to your table name and the COLUMN_NAME into your column name ,where the column datas gets repeated.

SOLUTION 2:
if the inner query returns the duplicated value if you group it on the outer query using the follwing keywords it will rectified.

KEWORDS:ANY, ALL, IN, or NOT IN

Example:

1.SELECT book_name FROM library WHERE book_name IN (SELECT book_name from stores where author_name='dennis ritchie')

2.SELECT book_name FROM library WHERE book_name = ANY (SELECT book_name from stores where author_name='dennis ritchie')

3.SELECT book_name FROM library WHERE book_name = ALL (SELECT book_name from stores where author_name='dennis ritchie')

4.SELECT book_name FROM library WHERE book_name NOT IN (SELECT book_name from stores where author_name='dennis ritchie')


thanks,
A.T.J