Recent Articles

Java: Refactoring Methods »

Here are the guidelines that we follow to refactor the methods in one of the legacy Java application, simplified from Martin Fowler refactoring book.

  • Rename a method to server its purpose
  • Add a parameter to the method if it is required
  • Remove a parameter if it is not required
  • Separate query from modifier and let each method does it own function
  • Parametize method to consolidate different methods into one
  • Replace parameter with method so that your don’t use parameter to determine the execution
  • Preserve whole object to pass it as parameter
  • Replace a parameter with a method
  • Introduce parameter object to group parameters together
  • Remove setter method if it is not used
  • Hide the method if it is not used
  • Replace constructor with factory method
  • Encapsulate downcast. Now with JDK 5 and above we can make use of generic features
  • Replace error code with exception.
  • Replace exception with tests.

Popularity: 2% [?]

Open Source Platform for Publishing Collections and Exhibitions »

Omeka is a web platform for publishing collections and exhibitions online. Designed for cultural institutions, enthusiasts, and educators, Omeka is easy to install and modify and facilitates community-building around collections and exhibits.

The Center for History and New Media (CHNM) is partnering with the Minnesota Historical Society (MHS) to develop Omeka as a next-generation online display platform for museums, historical societies, scholars, collectors, educators, and more.


Popularity: 1% [?]

Professional Open Source ESB »

Freedom OSS recently announced its creation of a Professionally Certified version of Servicemix ESB , called freeESB™

In addition to “Certified Bits” Freedom OSS introduces other significant enhancements with its freeESB™, such as:

  • Enhanced Security features
  • Bulk JMS Binding Component for handling large message volumes
  • JBI Compliant Hibernate Service Engine
  • SFTP Binding Component
  • JBI Compliment JBoss Rules Service Engine
  • JBI Compliant JBoss jBPM Service Engine.
  • Advanced JMS Code Samples
  • JBI Compliant CyberSource Binding Component
  • Enhanced Pop3 Binding Component

Popularity: 1% [?]

Build Your Custom Linux System »

Linux From Scratch (LFS) is a project that provides you with step-by-step instructions for building your own custom Linux system, entirely from source code.


It has the following subprojects

  • LFS :: Linux From Scratch is the main book, the base from which all other projects are derived.
  • BLFS :: Beyond Linux From Scratch helps you extend your finished LFS installation into a more customized and usable system.
  • ALFS :: Automated Linux From Scratch provides tools for automating and managing LFS and BLFS builds.
  • CLFS :: Cross Linux From Scratch provides the means to cross-compile an LFS system on many types of systems.
  • HLFS :: Hardened Linux From Scratch focuses on building an LFS system with heightened security.
  • Hints :: The Hints project is a collection of documents that explain how to enhance your LFS system in ways that are not included in the LFS or BLFS books.
  • LiveCD :: The LiveCD project provides a CD that is useful as an LFS build host or as a general rescue CD.
  • Patches :: The Patches project serves as a central repository for all patches useful to an LFS user.

Popularity: 2% [?]

Open Source Volume Rendering Engine »

Voreen is an easy to use and highly flexible volume visualization library written entirely in C++. Through the use of GPU-based state-of-the-art volume rendering techniques it allows high frame rates on off-the-shelf graphics hardware to support interactive volume exploration.

Voreen - Volume Rendering Engine


  • Direct volume rendering and isosurface shading
  • Support of different illumination models (phong shading, tone shading, ambient occlusion)
  • Interactive internal and external labeling
  • Non-photorealistic rendering techniques (sketch shading)
  • Glyph-based visualization of multimodal datasets (not yet publicly available)
  • Flexible combination of image processing operators (depth darkening, glow, chromadepth, edge detection)
  • Visualization of time-varying as well as segmented 3D datasets
  • Support of multiple views incorporating 2D and 3D visualization for an improved volume exploration
  • Stereoscopic rendering (autostereoscopic, shutter glasses) (not yet publicly available)
  • Different projection types (maximum intensity, minimum intensity, average intensity, x-ray rendering)
  • Tone mapping


  • Easy point-and-click object identification
  • Color lookup table editor
  • Up to 6 axis aligned clipping planes
  • Arbitrarily oriented clipping plane
  • Volume cutting and deformation (not yet publicly available)
  • Distance measurements (not yet publicly available)
  • Lighting and material parameter modification

Data I/O

  • Support of different file formats (DICOM, RAW, interfile, Vevo, …)
  • Preprocessing capabilities (volume cropping, gradient calculation, downscaling, filtering)
  • High-resolution screenshot and camera animation generation with anti-aliasing
  • Python scripting for offline image processing and visualization

Popularity: 2% [?]

Linux: Partition Rescue with PING »

PING is a live Linux ISO, based on the excellent Linux From Scratch (LFS) documentation. It can be burnt on a CD and booted, or integrated into a PXE / RISenvironment.

Several tools have been added and written, so to make this ISO the perfect choice to backup and restore whole partitions, an easy way. It sounds like Symantec Ghost(tm), but has even better features, and is totally free.

Features include:

  • Probably the best available Linux toolbox for rescuing a system;
  • Backup and Restore partitions or files locally or to the network (MS Network Shared directory, NFS, FTP or SSHFS);
  • Backup and Restore the BIOS data as well;
  • Either burn a bootable CD / DVD, either integrate within a PXE / RIS environment;
  • Possibility to Blank local admin’s password;
  • Create your own restoration bootable DVD (see the Howto Documentation);
  • Partition and Format a disk before installing Windows (so to make sure your unattended Windows installation will happen on the right partition);
  • Specific advantages PING brings you over DOS and Ghost :
    • Most network cards automatically recognized by the Kernel (unlike DOS);
    • Most CD/DVD readers automatically recognized by the Kernel (unlike DOS);
    • You don’t have to run a Ghostcast server to receive images over the network;
    • More supported filesystems;
    • You can store an image on several CD/DVD (CD/DVD-spanning);
    • You can backup and restore BIOS settings too;
    • Much much smaller than WinPE / BartPE;

Popularity: 2% [?]

WordPress Revolution Themes are Open Source Now »

WordPress Revolution themes which used to be commercial are now open source now.

There are a number of professionally designed themes which are worth a look.

Popularity: 1% [?]

SOA Using Open Source Software »

Here is a interesting presentation on how to build a SOA platform using open source technologies for an educational institution.

You can download the presentation from here.

The architecture snapshot.


Popularity: 2% [?]

Java: Favor Generic Methods If Possible »

Instead of this,

   1: /**
   2:    * General select statement which allows you to pass in
   3:    * arbitrary parameter object
   4:    *
   5:    * @param obj      Parameter object
   6:    * @param sqlQuery SQL statement
   7:    * @return The desired return type
   8:    * @throws DaoException Database exception
   9:    */
  10:   protected Object select(Object obj, String sqlQuery) throws DaoException {
  11:       try {
  12:           Object result = sqlMapClient.queryForObject(sqlQuery, obj);
  13:           return result;
  14:       } catch (SQLException e) {
  15:           throw new DaoException("Error running SQL statement: " + sqlQuery +
  16:                   ". Error message is " + e.getMessage(), e);
  17:       } catch (SqlMapException sqlMapEx) {
  18:           throw new DaoException("Error running SQL statement: " + sqlQuery +
  19:                   ". Error message is " + sqlMapEx.getMessage(), sqlMapEx);
  20:       }
  21:   }

You should try to use generic method starting JDK 5.

   1: /**
   2:     * General select statement which allows you to pass in
   3:     * arbitrary parameter object
   4:     *
   5:     * @param obj      Parameter object
   6:     * @param sqlQuery SQL statement
   7:     * @return The desired return type
   8:     * @throws DaoException Database exception
   9:     */
  10:    protected <E, F> F select(E obj, String sqlQuery) throws DaoException {
  11:        try {
  12:            Object result = sqlMapClient.queryForObject(sqlQuery, obj);
  13:            return (F) result;
  14:        } catch (SQLException e) {
  15:            throw new DaoException("Error running SQL statement: " + sqlQuery +
  16:                    ". Error message is " + e.getMessage(), e);
  17:        } catch (SqlMapException sqlMapEx) {
  18:            throw new DaoException("Error running SQL statement: " + sqlQuery +
  19:                    ". Error message is " + sqlMapEx.getMessage(), sqlMapEx);
  20:        }
  21:    }

Popularity: 1% [?]

Java: JSF Comparison Matrix »

Interesting comparison matrix available at


Popularity: 1% [?]

Java: Refactoring If-Then-Else using Enum »

Download the code here

One thing good about object oriented language is that now we can reduce the conditional statements typically found in procedural language, which in turn can make our code more maintainable.

In Java, normally if we want to refactor a long conditional statements, we use polymorphism, which results in a lot of classes.

Another way to do it is to use Enum.

As an example, consider the following code.

   1: package twit88.procedural;
   3: import org.apache.commons.lang.StringUtils;
   5: public class IfThenElse {
   8:     public void invoke(String operationName) {
   9:         if (StringUtils.equals(operationName, "operation1")) {
  10:             operation1();
  11:         } else if (StringUtils.equals(operationName, "operation2")) {
  12:             operation2();
  13:         } else if (StringUtils.equals(operationName, "operation3")) {
  14:             operation3();
  15:         }
  17:     }
  19:     public void operation1() {
  20:         System.out.println("operation 1");
  21:     }
  23:     public void operation2() {
  24:         System.out.println("operation 2");
  25:     }
  27:     public void operation3() {
  28:         System.out.println("operation 3");
  29:     }
  32:     public static void main(String[] args) {
  33:         IfThenElse obj = new IfThenElse();
  34:         obj.invoke("operation2");
  35:     }
  37: }

As you can see, there if then else code is ugly and make the code difficult to maintain.

Here is a new version using Enum

   1: package twit88.refactor;
   3: import java.util.HashMap;
   4: import java.util.Map;
   7: public class NewIfThenElse {
   9:     private interface IOperation {
  10:         void apply(String name);
  11:     }
  13:     private enum Operation implements IOperation {
  15:         OPERATION_1("operation1") {
  16:             public void apply(String name) {
  17:                 System.out.println("operation 1");
  18:             }
  19:         },
  20:         OPERATION_2("operation2") {
  21:             public void apply(String name) {
  22:                 System.out.println("operation 2");
  23:             }
  24:         },
  25:         OPERATION_3("operation3") {
  26:             public void apply(String name) {
  27:                 System.out.println("operation 3");
  28:             }
  29:         };
  32:         private static Map<String, Operation> requestLookup;
  34:         static {
  35:             requestLookup = new HashMap<String, Operation>(3);
  36:             requestLookup.put(OPERATION_1.getName(), OPERATION_1);
  37:             requestLookup.put(OPERATION_2.getName(), OPERATION_2);
  38:             requestLookup.put(OPERATION_3.getName(), OPERATION_3);
  39:         }
  41:         private final String name;
  43:         private Operation(String name) {
  44:    = name;
  45:         }
  47:         public String getName() {
  48:             return name;
  49:         }
  51:         @Override
  52:         public String toString() {
  53:             return "Operation{" + "name='" + name + '\'' + '}';
  54:         }
  56:         public static Operation getOperationByName(String name) {
  57:             return requestLookup.get(name);
  58:         }
  59:     }
  61:     public void invoke(String operationName) {
  62:         Operation operation = Operation.getOperationByName(operationName);
  63:         if (operation != null) {
  64:             operation.apply(operationName);
  65:         }
  66:     }
  68:     public static void main(String[] args) {
  69:         NewIfThenElse obj = new NewIfThenElse();
  70:         obj.invoke("operation1");
  71:     }
  72: }

Popularity: 2% [?]

Java: Debug Commons Digester Exception »

This is a exception produced by Commons Digester. After spending few hours to find out the root cause, including studying the source code, I found that I make a silly mistake.

   1: java.lang.NullPointerException
   2:     at org.apache.commons.digester.Digester.createSAXException(
   3:     at org.apache.commons.digester.Digester.createSAXException(
   4:     at org.apache.commons.digester.Digester.startElement(
   5:     at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
   6:     at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
   7:     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
   8:     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
   9:     at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
  10:     at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
  11:     at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
  12:     at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
  13:     at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
  14:     at org.apache.commons.digester.Digester.parse(

One thing to take note is that whenever you have error with any of the commons libraries, do remember to turn on the debugging mode.

   1: <logger name="org.apache" additivity="true">
   2:       <level value="DEBUG"/>
   3: </logger>

And it helps a lot for troubleshooting.

Popularity: 2% [?]

Free Ebook: A Practical Theory of Programming »

This is another good book for general reading.


Download Link

Popularity: 2% [?]

Free EBook: C# HandBook »

This document covers many aspects of programming with C#, from naming, structural and formatting conventions to best practices for using existing and developing new code.

It’s the manual developed at Encodo Systems AG for developing with C# and .NET, but many of the concepts and ideas can be applied to any programming language. The intent of this document is not to codify current practice at Encodo as it stands at the time of writing; instead, this handbook has the following aims:

  • To maximize readability and maintainability by prescribing a unified style.
  • To maximize efficiency with logical, easy-to-understand and justifiable rules that balance code safety with ease-of-use.
  • To maximize the usefulness of code-completion tools and accommodate IDE- or framework-generated code.
  • To prevent errors and bugs (especially hard-to-find ones) by minimizing complexity and applying proven design principles.
  • To improve performance and reliability with a list of best practices.

Wherever possible, however, the guidelines include a specific justification for each design choice. Unjustified guidelines must be either justified or removed.

Whereas the Encodo Handbook draws mostly on in-house programming experience, it also includes ideas from Microsoft’s Internal Coding Guidelines and Design Guidelines for Developing Class Libraries and benefits as well from both the IDesign and Philips coding styles as corroborative sources.

Download Link

Popularity: 3% [?]

Java: Generate UI Components for Business Objects »

Metawidget is a ‘smart User Interface widget’ that populates itself, at runtime, with UI components to match the properties of your business objects.

Metawidget does this without introducing new technologies. It inspects your existing back-end architecture (such as JavaBeans, existing annotations, existing XML configuration files) and creates widgets native to your existing front-end framework (such as Swing, Java Server Faces, Struts, Android).

Metawidget does not replace or hide your existing UI framework and guarantees that your investment in its technology and knowledge is as valid as always. The LGPL Open Source license allows the use of Metawidget in open source and commercial projects.


Front End

Metawidget has a native component for each of these

  • Android
  • Google Web Toolkit (GWT)
  • Java Server Faces (JSF)
    • Facelets
    • RichFaces
  • Java Server Pages (JSP)
  • Spring Web MVC
  • Struts
  • Swing
    • Beans Binding (JSR 295)
    • Commons BeanUtils


Back End

Metawidget can read business object information from all of these

  • Annotations
  • Commons JEXL
  • Groovy
  • Hibernate
  • Hibernate Validator
  • JavaBeans
  • Java Persistence Architecture (JPA)
  • Javassist
  • JBoss jBPM
  • Swing AppFramework

Popularity: 1% [?]

Java Spring Based Integration Framework »

Apache Camel is a Spring based Integration Framework which implements the Enterprise Integration Patterns with powerful Bean Integration.


Camel lets you create the Enterprise Integration Patterns to implement routing and mediation rules in either a Java based Domain Specific Language (or Fluent API), via Spring based Xml Configuration files or via the Scala DSL. This means you get smart completion of routing rules in your IDE whether in your Java, Scala or XML editor.

Apache Camel uses URIs so that it can easily work directly with any kind of Transport or messaging model such as HTTP, ActiveMQ, JMS, JBI, SCA, MINA or CXF Bus API together with working with pluggable Data Format options. Apache Camel is a small library which has minimal dependencies for easy embedding in any Java application.

Apache Camel can be used as a routing and mediation engine for the following projects:

  • Apache ActiveMQ which is the most popular and powerful open source message broker
  • Apache CXF which is a smart web services suite (JAX-WS)
  • Apache MINA a networking framework
  • Apache ServiceMix which is the most popular and powerful distributed open source ESB and JBI container

Popularity: 2% [?]

Java: Document Oriented Database »

 Apache CouchDB is a distributed, fault-tolerant and schema-free document-oriented database accessible via a RESTful HTTP/JSON API.

It is

  • A document database server, accessible via a RESTful JSON API.
  • Ad-hoc and schema-free with a flat address space.
  • Distributed, featuring robust, incremental replication with bi-directional conflict detection and management.
  • Query-able and index-able, featuring a table oriented reporting engine that uses Javascript as a query language.

It is not

  • A relational database.
  • A replacement for relational databases.
  • An object-oriented database. Or more specifically, meant to function as a seamless persistence layer for an OO programming language.


Popularity: 1% [?]

Scalable Cross Language Services Development »

Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk, and OCaml.

Originally developed at Facebook, Thrift was open sourced in April 2007 and entered the Apache Incubator in May, 2008.

Thrift allows you to define data types and service interfaces in a simple definition file. Taking that file as input, the compiler generates code to be used to easily build RPC clients and servers that communicate seamlessly across programming languages.

Popularity: 1% [?]

Open Source Alternative for Microsoft OneNote »

Basket Note Pads helps you to

  • Easily take all sort of notes
  • Collect research results and share them
  • Centralize your project data and reuse it
  • Quickly organize your thoughts in idea boxes
  • Keep track of your information in a smart way
  • Make intelligent To Do lists
  • And a lot more…


Popularity: 3% [?]

Aggregating Log Data from Multiple Servers using Scribe »

Scribe is a server for aggregating log data streamed in real time from a large number of servers. It is designed to be scalable, extensible without client-side modification, and robust to failure of the network or any specific machine. Scribe was developed at Facebook and released as open source.

Scribe is implemented as a thrift service using the non-blocking C++ server. The installation at Facebook runs on thousands of machines and reliably delivers tens of billions of messages a day. If you use the site, you’ve used Scribe.


Popularity: 2% [?]