Archive for November, 2009

Checking and Reading Contents of a Directory in Java

Many applications require to check if the file being accessed is really a file or a directory. Also if it is a directory then you would need to traverse through the contents of directory. Here is the code snippet that shows how to do it. In addition to this you may have to handle exceptions. [...]

Java

Read A Property File in Java 6

Almost all applications are reading something from the file system. All of them have some kind of properties stored outside the application Java code, so that it can be changed without having to recompile entire code. These properties can be initial configuration properties, database connection properties, or even exception messages. You can find many ‘.properties’ [...]

Java

Append A File in Java 6

In this article we append to a text file using Java 6. Again we go to java.io package. Following points you need to consider while doing this.

Close the file in finally block. You can set the BufferWriter to null also.
FileWriter constructor has two input values. First is the file, and second whether to create [...]

Java

Reading Text File Line by Line in Java 6

Here is code you will need in Java 6 to read a file on the machine. It uses BufferReader through FileReader. Some of the things you should remember are -

Close the BufferReader in finally block so that it is closed any case.
In BufferReader.close you can opt to ignore exception.
Check the size of file you are [...]

Java

Revised Jsp Best Practices

JSPs are an integral part of a web application. If jsps are not coded properly, then it becomes a most unorganized piece of code. You must have seen huge jsps, which end up as a source of defects, and asking you to change them many times. Maintaining such code becomes a very expensive activity. Also [...]

Jsp

Automating JUnit TestCases Using TestSuite and Ant

Unit testing is now a days an integrated part of any development process. It saves considerable effort when we write repeatable unit test classes, instead of relying on manual unit testing. JUnit can be called leader in Java unit testing. This framework provides many commonly needed features, which make unit testing really effortless. JUnit also [...]

JUnit

Checklist to Maitain a Wordpress Based Site

Over past one year, I have been playing around with my Wordpress based site. This involved primarily two activities. First and most important is adding and improving contents of the site. This is publishing new interesting articles. It is bit challenging activity, cause you have to have good contents that will pull visitors continuously. But [...]

Featured

What is a WSDL?

WSDL, webservice description language, is the contract definition of any webservice. This XML document is used to tell the world what is going to be the definition/structure of the webservice, what that webservice has to offer. Here is an example webservice document explained using inline comments. We are not taking any complex example here. But [...]

JEE, Tech Notes

Interface Based Polymorphic Programming in Java

Polymorphism, i.e. runtime type determination, is very important in Java. Polymorphic programming is generic programming. Here we are not calling methods of concrete classes at the time of coding, instead we are writing generic code, that can allow us to assign desired concrete instances at runtime. Let us take an example-
java.util.List interface represents all lists [...]

Java

Performance Testing Web Service Using SoapUI

Performance testing is a critical step in the life cycle of any project. This step checks if the application is capable of handling expected load within desired response time limits in given environment resources. Web services are not free from the performance requirements. Generally, web services involve remote access by many clients, hence web services [...]

Featured, Tech Notes