Monday, November 19, 2012

Captcha for Java

       A CAPTCHA is a program that protects websites against bots by generating and grading tests that humans can pass but current computer programs cannot. For example, humans can read distorted text as the one shown on image, but current computer programs can't.
       The term CAPTCHA (for Completely Automated Public Turing Test To Tell Computers and Humans Apart) was coined in 2000 by Luis von Ahn, Manuel Blum, Nicholas Hopper and John Langford of Carnegie Mellon University.
       When u create web project sometimes u need captcha with colors of your site. That cases u can create captcha yourself as following:

Sunday, November 4, 2012

Parse XML and Properties config files

       .xml(Extensible Markup Language) and .properties is a file extension for files mainly used in Java related technologies to store the configurable parameters of an application.(.properties files can also be used for storing strings for Internationalization and localization - these are known as Property Resource Bundles.)

       Let's first start with XML config files. There are many XML parser technologies, but I will show how u can use Apache Commons Configuration library to parse and use XML config files.

       The Commons Configuration software library provides a generic configuration interface which enables a Java application to read configuration data from a variety of sources: