Recent Articles

Configure Different Database Settings for Different JVMs in iBATIS »

I have a common class which is used to create the SqlMapClient  object to access the database. The class is used by multiple Java processes.

The problem is that I want each Java process to have specific database settings, and I do not want to maintain redundant information in different SQL mapping configuration files, e.g. the references to the SQL mapping files. 

The requirements

  1. If no process specific configuration, then all Java processes use default values
  2. If I want to configure process specific information, I need to specify the properties in a file, and specify it during process startup.

Below are the iBATIS configurations I want to be specific for each Java process if needed.

<!-- OPTIONAL PROPERTIES BELOW -->
<property name="initialSize" value="5"/>
<property name="maxActive" value="100"/>
<property name="maxIdle" value="20"/>
<property name="maxWait" value="60000"/>
<property name="poolPreparedStatements" value="true"/>
<property name="validationQuery" value="select 0 from dual"/>
<property name="testOnBorrow" value="true"/>

To achieve what I want, first I need to make sure the values are retrieve from properties

<!-- OPTIONAL PROPERTIES BELOW -->
<property name="initialSize" value="${db.connection.initialSize}"/>
<property name="maxActive" value="${db.connection.maxActive}"/>
<property name="maxIdle" value="${db.connection.maxIdle}"/>
<property name="maxWait" value="${db.connection.maxWait}"/>
<property name="poolPreparedStatements" value="${db.connection.poolPreparedStatements}"/>
<property name="validationQuery" value="${db.connection.validationQuery}"/>
<property name="testOnBorrow" value="${db.connection.testOnBorrow}"/>

In the global property files database.properties, I specify the default values

# General database values
db.connection.initialSize=10
db.connection.maxActive=800
db.connection.maxIdle=100
db.connection.maxWait=6000
db.connection.poolPreparedStatements=true
db.connection.validationQuery=select 0 from dual
db.connection.testOnBorrow=true
 

In the Java code, I use the SqlMapClientBuilder.buildSqlMapClient(Reader, Properties) method to achieve this

static {
    try {
        
        SqlMapClient sqlMap = buildSqlMapClient("sqlmap-config.xml", System.getProperty("db-config"));
        .....
    } ...
}
 
/**
 * Build SQL map client and optional load additional properties if specified in the start up command line
 *
 * @param resource               SQL map file
 * @param optionalPropertiesFile Optional properties file name
 * @return A SQL map client
 * @throws Exception Any exception
 */
private static SqlMapClient buildSqlMapClient(String resource, String optionalPropertiesFile) throws Exception {
    Properties properties = new Properties();
    properties.load(Resources.getResourceAsReader("database.properties"));
    Reader reader = Resources.getResourceAsReader(resource);
    if (StringUtils.isNotBlank(optionalPropertiesFile)) {
        properties.load(Resources.getResourceAsReader(optionalPropertiesFile));
    }
    return SqlMapClientBuilder.buildSqlMapClient(reader, properties);
} 

As you can see, I can pass the customised properties file into the code using the “db-config” property which can specified during run time.

Let’s say I create the following properties file called “customised.properties”

# customized database values
db.connection.initialSize=100
db.connection.maxActive=1000
 
 

I can tell the Java process to use this file by defining the start up properties.

java -Ddb-config=customised.properties com.myapp

Popularity: 2% [?]

Using JMeter for Automated Web Application Load Test »

JMeter HTTP Proxy is used for recording HTTP requests sent to server. For HTTPS requests, BadBoy can be used. Badboy is a powerful tool designed to aid in testing and development of complex dynamic applications.

To ensure all your requests are within one session, just insert a http cookie manager. It will automatically handle the session for all the request within the threadgroup treating it like one session. Without http cookie manager, each request is a new session as no session state is kept. jsessionid is only shown for the very first request, subsequent request will not see the jsessionid. to use a variable in jmeter is ${name of variable}.

This is very useful when dealing with jsp form logins, as the first request is to login to the system and subsequent request is to do load testing on the target page. This will prevent redirection back into login page.

Popularity: 3% [?]

SOA Development Made Easy with Apache Tuscany »

Apache Tuscany simplifies the task of developing SOA solutions by providing a comprehensive infrastructure for SOA development and management that is based on Service Component Architecture (SCA) standard. With SCA as it’s foundation, Tuscany offers solution developers the following advantages.

  • Provides a model for creating composite applications by defining the services in the fabric and their relationships with one another. The services can be implemented in any technology.
  • Enables service developers to create reusable services that only contain business logic. Protocols are pushed out of business logic and are handled through pluggable bindings. This lowers development cost.
  • Applications can easily adapt to infrastructure changes without recoding since protocols are handled via pluggable bindings and quality of services (transaction, security) are handled declaratively.
  • Existing applications can work with new SCA compositions. This allows for incremental growth towards a more flexible architecture, outsourcing or pproviding services to others.

image

In addition, Tuscany is integrated with various technologies and offers:

  • a wide range of bindings (pluggable protocols)
  • various component types including and not limited to Java, C++, BPEL, Spring and scripting
  • an end to end service and data solution which includes support for Jaxb and SDO
  • a lightweight runtime that works standalone or with other application servers
  • a modular architecture that makes it easy to integrate with different technologies and to extend
  • Integration with web20 technologies

Apache Tuscany SCA is implemented in Java and C++ (referred to as Native) .

Popularity: 1% [?]

Java Web Beans »

A Web Bean is an application class that contains business logic. A Web Bean may be called directly from Java code, or it may be invoked via Unified EL. A Web Bean may access transactional resources. Dependencies between Web Beans are managed automatically by the Web Bean manager. Most Web Beans are stateful and contextual. The lifecycle of a Web Bean is always managed by the Web Bean manager.

Some good readings for Web Bean

  1. Introduction to Web Beans by Gavin King
  2. Web Beans Sneak Peek

Popularity: 1% [?]

AVS – Another Open Source SCM »

AVS is based on the main concepts provided by the most expensive source control management software available on the market place : it includes all in one, a task based file repository management system, and a full bug tracking engine.

Main features :

  • Change request management
  • Change request life cycle customisation
  • File configuration management
  • Branch per file
  • Atomic task check-in
  • File/folder move ability without history loss
  • Myers’ minimun set of differences file comparison
  • 3-way merge editor
  • Release management
  • User/Group management
  • Mail notification on change request  assignment
  • Secured communication through https

Popularity: 2% [?]

Java: Open Source SSO »

JOSSO, or Java Open Single Sign-On, is an open source J2EE and Spring-based SSO infrastructure aimed to provide a solution for centralized, platform neutral, user authentication and authorization.

Main Features

  • J2EE and Spring Transparent Single Sign-On cross domain/cross organization.
  • Pluggable Framework to allow the implementation of custom identity components using Spring or built-in IoC container.
  • “5 minutes” on-the-fly set-up and deployment through custom “enhancement” console
  • Runs in Apache Tomcat.
  • Runs in JBoss application server.
  • Runs in BEA WebLogic 9 and WebLogic 10 application server
  • Runs in Apache Geronimo application server
  • Native Apache Httpd 2.x support thus enabling transparent SSO with PHP, Python, Perl, etc. applications
  • Integrates with Spring Security for enabling fine-grained authorization.
  • Provides Identity information to Web applications and EJBs through the standard Servlet and EJB Security API respectively.
  • Supports Strong Authentication using X.509 client certificates.
  • Windows Authentication
  • LDAP support for storing user information and credentials.
  • Database support for storing user information and credentials.
  • “Remember Me” support
  • Password recovery support
  • Client API for PHP. This allows to build SSO-enabled PHP applications.
  • Client API for Microsoft ASP. This allows to build SSO-enabled ASP applications.
  • Out-of-the-box branding support
  • Compatibility with Apache Pluto Portlet Container
  • Standard Based: JAAS, Web Services/SOAP, EJB, Struts, Servlet/JSP,J2EE.
  • 100% Java

Popularity: 2% [?]

Telcom Web Services: Parlay X Simulator and Client Implementation »

Parlay X is set of Web service APIs for the telephone network (fixed and mobile.)

It enables software developers to use the capabilities of a underlying network. The APIs are deliberately high level abstractions and designed to be simple to use. An application developer can, for example, invoke a single Web Service request to get the location of a mobile device or initiate a telephone call.

The Parlay X Web services are defined jointly by ETSI, the Parlay Group, and the Third Generation Partnership Program (3GPP).

The APIs are defined using Web Service technology: interfaces are defined using WSDL 1.1 and conform with Web Services Interoperability (WS-I Basic Profile).

Useful resources for developer

  1. Java SE Components for Telecom Web Services with source code included. It is based on Parlay X.
  2. Telecom Web Services Network Emulator – It is based on Java EE technology and runs on Sun Java System Application Server (SJSAS) and on Tomcat 6. The emulator implements the features of a Parlay X gateway and can be used to test Parlay X applications without the need for a gateway. The emulator is mainly based on Parlay X

Popularity: 4% [?]

Buildr: Another Java Build System »

Buildr is a build system for Java applications.

buildr

Features

  • A simple way to specify projects, and build large projects out of smaller sub-projects.
  • Pre-canned tasks that require the least amount of configuration, keeping the build script DRY and simple.
  • Compiling, copying and filtering resources, JUnit/TestNG test cases, APT source code generation, Javadoc and more.
  • A dependency mechanism that only builds what has changed since the last release.
  • A drop-in replacement for Maven 2.0, Buildr uses the same file layout, artifact specifications, local and remote repositories.
  • All your Ant tasks belong to us! Anything you can do with Ant, you can do with Buildr.
  • No overhead for building “plugins” or configuration. Just write new tasks or functions.
  • Buildr is Ruby all the way down. No one-off task is too demanding when you write code using variables, functions and objects.
  • Simple way to upgrade to new versions.
  • Did we mention fast?

Popularity: 1% [?]

Automating Windows GUI for Software Deployment »

AutoIt  is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages (e.g. VBScript and SendKeys). AutoIt is also very small, self-contained and will run on all versions of Windows out-of-the-box with no annoying “runtimes” required!

AutoIt was initially designed for PC “roll out” situations to reliably automate and configure thousands of PCs. Over time it has become a powerful language that supports complex expressions, user functions, loops and everything else that veteran scripters would expect.

gui_eg1

Features:

  • Easy to learn BASIC-like syntax
  • Simulate keystrokes and mouse movements
  • Manipulate windows and processes
  • Interact with all standard windows controls
  • Scripts can be compiled into standalone executables
  • Create Graphical User Interfaces (GUIs)
  • COM support
  • Regular expressions
  • Directly call external DLL and Windows API functions
  • Scriptable RunAs functions
  • Detailed helpfile and large community-based support forums
  • Compatible with Windows 95 / 98 / ME / NT4 / 2000 / XP / 2003 / Vista / 2008
  • Unicode and x64 support
  • Digitally signed for peace of mind
  • Works with Windows Vista’s User Account Control (UAC)

AutoIt has been designed to be as small as possible and stand-alone with no external .dll files or registry entries required making it safe to use on Servers. Scripts can be compiled into stand-alone executables with Aut2Exe.

Also supplied is a combined COM and DLL version of AutoIt called AutoItX that allows you to add the unique features of AutoIt to your own favourite scripting or programming languages!

Popularity: 2% [?]

Automatic Software Update Monitor »

SUMo, which stands for Software Update Monitor. Using SUMo you’ll be able to keep your PC up-to-date by using the most recent version of your favorite software ! Unlike build-in auto update features, SUMo tells you if updates are available before you need to use your software.

SUMo_screen

Features

  • Automatic detection of installed software
  • Detects required updates / patchs for your software
  • Filter / authorize Beta versions (user setting)
  • Ignore list : only tracks software YOU want to track
  • More compatibility and less false positive than others Update Monitors (according to users feedback)
  • Internationalization support.

Popularity: 2% [?]

Convert BIN, MDF, PDI, CDI, NRG, B5I, IMG CD/DVD-ROM Images to ISO »

AnyToISO Converter converts BIN, MDF, PDI, CDI, NRG, B5I, IMG CD/DVD-ROM images to ISO. It is free.

Popularity: 2% [?]

Open Source Java JMX »

MX4J is a project to build an Open Source implementation of the Java(TM) Management Extensions (JMX) and of the JMX Remote API (JSR 160) specifications, and to build tools relating to JMX.

JMX is an optional package for J2SE that provides a standard way to manage applications. It can also be used to wrap legacy systems and provide a standard interface to the outside world, enabling the development of web services. JMX allows developers to write more modular and loosely coupled system components and reduce the complexity of large, interoperating systems.

The MX4J project has these primary goals:

  • Closely adhere to the JMX specification.
  • Develop a highly robust codebase.
  • Be 100% compatible with the reference implementations.

Projects using MX4J includes Jetty, Apache Tomcat ObjectWeb JOnAS, Apache Geronimo, WebOS, MC4J, jPOS and many others.

Popularity: 1% [?]

Light J2EE Application Server »

JFox is designed to be a lightweight Java EE Application Server support EJB3 & JPA, to ensure application based on Java EE/EJB can be developed rapidly and simply. It based on IoC micro kernel, allow different components and framework to be work together.

JFox can be embedded in any Web Server to enable EJB3 component support. It enables application development with build-in MVC Framework. It supports multi module based application development model, support directly EJB publish as Web Service.

JFox is small and very fast.

Popularity: 2% [?]

Google Blog Converters »

Google Blog Converters provides Python libraries and runnable scripts that convert between the export formats of Blogger, LiveJournal, MovableType, and WordPress.

Popularity: 1% [?]

Java: Ensure Code Quality with Open Source Tools »

There are many tools available for Java to check and ensure different aspects of your code, e.g. code coverage, coding standard, duplicate code, etc.

However, each of these tools, e.g. FindBugs, PMD, Simian, JavaNCSS, Cobertura, etc are only checking certain aspects of your code.

Below are some open source tools that integrate all these tools together to give you a unified view on different aspects of your code.

QALab

QA Tools like checkstyle, pmd, pmd-cpd, findbugs, cobertura (cobertura-branch and cobertura-line) and simian are great build tools but they only take a snapshot of the state of your project. You do not get a sense of the trend of your project.

QALab collects and consolidates data from several QA tools and keeps track of them overtime. This allows developers, architects and project managers alike to be presented with a trend of the QA statistics of their project.

The following tools are currently supported:

  • Checkstyle: code style validation and design checks. QALab keeps track of number of violations per file and overall.
  • PMD: Code checks (possible bugs, dead code, sub-optimal code, etc). QALab keeps track of number of violations per file and overall.
  • PMD CPD: Duplicate code (always a bad idea) detection. QALab keeps track of number of the overall number of duplicated lines.
  • FindBugs: fantastic tool to detect potential bugs (really!). QALab keeps track of number of violations per file and overall.
  • Cobertura: Coverage tool. QALab keeps track of percentage of branch and line coverage.
  • Simian: excellent duplicate code detection (non-open source). QALab keeps track of number of the overall number of duplicated lines.

QALab can be used via ant or Maven. There are three main steps to using QALab:

  1. Collect Data from QA Tools into a generic qalab.xml format. This is a necessary step to consolidate data. Refer to the documentation from Checkstyle, PMD, PMD CPD (Copy Paste Detector), FindBugs, Cobertura and Simian in order to generate the xml reports.
  2. Generate Charts from qalab.xml for each file; these will show the trends over time for each file and the overall project.
  3. Generate a summary xml and html pages with the files that have seen a change in their QA statistics over the last n days. This is particularly useful for developers who can see the impact of the latest code checked in.

Sonar

SONAR is a code quality management platform, dedicated to continuously analyze and measure technical quality, from the projects portfolio to the class method.

It leverages well-known tools such as Checkstyle, PMD, Findbugs, Cobertura, Clover and JavaNCSS to provide an integrated and easy to use quality management platform.

Panotipcode

Panotipcode is a project dedicated to making code metrics so widely understood, valuable, and simple that their use becomes ubiquitous, thus raising the quality of software across the industry. It provides a set of open source tools for gathering, correlating, and displaying code metrics.

It packages

  • Emma – Unit test code coverage. By changing one line in your build file this can be switched to Cobertura.
  • CheckStyle – Validates that your code follows Sun’s standards for Java. If you want to use a different set of rules you only need to change one parameter in your build file.
  • JDepend – Sophisticated OO quality metrics and package dependency checking.
  • JavaNCSS – Cyclomatic Complexity and size (NCSS) metrics.
  • Volatility – Measure change within your projects. Currently this only works with Subversion, but support for other SCM repositories is planned.
  • Duplicate Code – Using Simian.
  • Panopticode Aggregator – Generates an XML file that integrates ALL of the information gathered above
  • Panopticode Reports
    • Powerful visualizations, such as TreeMaps, that allow you to see the overall picture and an amazing amount of detail in a single view.
    • Metric Correlation
    • Historic Data

Popularity: 1% [?]

Useful Hosts File for Ad Blocking »

Every day, millions of people browse the web. They think they are doing so in private. They aren’t. What advertisers don’t want you to know, I will tell you. You are being tracked as you surf the web, right now. Not by me, but by some of the advertisers.

They think they have a right to track your surfing habits, under the veil of providing a “better” browsing experience. They claim that, by knowing everything that you look at while you are surfing, they can give you “better” ads.

What they don’t tell you is that they also sell information about your habits to third-parties. What they don’t tell you is that they could easily match your browsing profile with your identity. What they don’t tell you, in essence, is that they are violating your privacy.

What they don’t tell you, is that you can do something about it. Use the Hosts file!

Popularity: 2% [?]

Java: Open Source MMS Library »

jMmsLib is Java implementation of binary Multimedia Messaging Services (MMS) encoding/decoding.

It supports creation and encoding of send_request messages and decoding of send_conf responses. To see jMmsLib in action look at SendMMS. This is a working simple MMS client that builds messages from texts and images, encode them, and deliver them to a MMSC via a WAP connection.

Popularity: 2% [?]

Web Service Basic »

REST

The Representational State Transfer (REST) is a web architectural style presented by Roy Fielding back in 2000 in his doctoral thesis.

  • The basic idea of REST is the full exploitation of the HTTP protocol, in particular:
    It focuses on Resources, that is, each service should be designed as an action
    on a resource.
  • It takes full advantage of all HTTP verbs (not just GET and POST, but also
    PUT and DELETE)

Below are the HTTP Verb

  • POST – CREATE (Save new resources)
  • GET -  READ (Read resources)
  • PUT -  UPDATE (Modify existing resources)
  • DELETE – DELETE (Delete resources)

Rules

  • The State can be modified by verbs POST, PUT, and DELETE.
  • The State should never change as a consequence of a GET verb.
  • The verb POST should be used to add resources to the State.
  • The verb PUT should be used to alter resources into the State.
  • The verb DELETE should be used to remove resources from the State.
  • The communication protocol should be stateless, that is, a call should not
    depend on the previous ones.

SOAP

The Simple Object Access Protocol (SOAP) is a web service standard communication protocol defined by the W3C. It basically defines the structure of  the exchanged message, which is composed of an “envelope” with a “header” and a “body”.

  • Automatic generation of classes involved in the communication process
  • Automatic generation of the web service descriptor (WSDL)
  • Automatic generation of client classes starting from the service WSDL
  • Ability to be used with network protocols other than HTTP (for example, SMTP or JMS)
  • Ability to encapsulate authentication mechanisms
  • Ability to establish a stateful conversation

Binding style

  • RPC / literal
  • Document / literal (bare or unwrapped)
  • Document / literal wrapped

Remote Procedure Call (RPC) is a generic mechanism throughout which is a procedure that resides on a computer (or a virtual machine) can be called by a program running on a different computer (or virtual machine). This paradigm has been around for decades and was implemented by several technologies, among which, the most popular are CORBA, DCOM, and RMI.

An RPC call is always characterized by:

  • A remote address
  • A method (or operation) name
  • A sequence of parameters
  • A synchronous response

Document / Literal unwrapped requires one child in the document and you may need to wrap your parameters in one single object.

Document / Literal wrapped is the default for most SOAP implementations. It does not impose the constraint of one single child in the document.

Major SOAP implementations

  • JAX-WS2 available starting JDK 6.
  • AXIS 2
  • Spring WS
  • CXF

Others interesting modules

  • Kandula – implements WS-Coordination, WS-AtomicTransaction and WS-BusinessActivity protocols based on Apache Axis and Axis2.
  • Rampart – WS-Security module for Axis 2
  • Sandesha – WS-ReliableMessaging implementations for Axis and Axis2
  • Muse – an implementation of the WS-ResourceFramework (WSRF), WS-BaseNotification (WSN), and WS-DistributedManagement (WSDM) specifications.
  • jUDDI – an implementation of the Universal Description, Discovery, and Integration (UDDI) specification.

Popularity: 1% [?]

Open Source Audio Software »

Audacity is free, open source software for recording and editing sounds. It is available for Mac OS X, Microsoft Windows, GNU/Linux, and other operating systems.

You can use Audacity to:

  • Record live audio.
  • Convert tapes and records into digital recordings or CDs.
  • Edit Ogg Vorbis, MP3, WAV or AIFF sound files.
  • Cut, copy, splice or mix sounds together.
  • Change the speed or pitch of a recording.

audacity-linux-small

Popularity: 1% [?]

Open Source Genealogy Software »

PhpGedView is a revolutionary genealogy program which allows you to view and edit your genealogy on your website. PhpGedView has full editing capabilities, full privacy functions, can import from GEDCOM files, and supports multimedia like photos and document images. PhpGedView also simplifies the process of collaborating with others working on your family tree. Your latest genealogy information is always on your website and available for others to see.

Popularity: 2% [?]