Archive for February, 2008

Maven: JAR/WAR Final Name, Excluding JAR Files from WAR »

Maven is a good build tool but sometimes it is quite confusing to use. I have encountered the followings JAR/WAR file Final Name By default the final JAR or WAR file generated is <project-name>-<version-number>.jar/war. At first to change it I used the following. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.2</version> <configuration> <finalName>myname</finalName> <configuration> </plugin> It works for JAR […]

.NET: Create MSDN Style Documentation using Sandcastle »

Before this, I normally used either NDoc or Doxygen to generate my help or documentation file from my source code. NDoc looks like not in active development anymore, and Doxygen cannot generate MSDN style documentation as what I wanted. So I stumbled upon Sandcastle. As quoted from the website, Sandcastle produces accurate, MSDN style, comprehensive […]

Unix: A C++ Configuration Reader »

Download Code This a C++ configuration reader I wrote long time back to read a properties file. Some one asked me for some code recently. So I posted the source code here. You can see the functions from the header file. class ConfigReader : public std::map<std::string, std::string> { public: // Constructor ConfigReader(const std::string& initFileName); // […]

Create Software Installer using NSIS and HM NIS Edit »

NSIS (Nullsoft Scriptable Install System) should be no stranger for everyone. It is my number 1 choice when I want to create software installer. NSIS (Nullsoft Scriptable Install System) is a professional open source system to create Windows installers. It is designed to be as small and flexible as possible and is therefore very suitable […]

EasyEclipse: Customized Eclipse for Developer »

I like Eclipse but one thing I find troublesome is that whenever I need certain features, I need to search for the plugin and install it. I used Eclipse for Java and PHP development and for this I would need to install plugins for PHPEclipse, Maven, CheckStyle, FindBugs, etc… Here come EasyEclipse. EasyEclipse packages together […]

Java: Useful Tools for Programming – Part I »

Here are some useful programming tools I used frequently Checkstyle As quoted from the website, Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects […]

Open Source jQuery UI Components »

I am looking at jQuery recently since it is getting more and more popular. I am using YUI and Ext and jQuery is the next Javascript library I am really interested to look at. Here are the 2 jQuery interface components that I am currently trying jQuery UI As quoted from the website, jQuery UI […]

Maven: Build RMI Stub Using Ant RMIC Task »

Oops, it is Maven again. This time I need to build RMI server and client stub classes using Maven. To do this I used the Maven Ant Run plugin. In my pom.xml

Unix: Shell Script to build CLASSPATH Dynamically »

This is the script I used before for my legacy Java applications running on non-JDK 1.6 platform. In JDK1.6+, we can use a wildcard to include all jars in a directory. E.g. java -classpath C:\jar_dir\* #!/bin/sh buildClassPath() { jar_dir=$1 if [ $# -ne 1 ]; then echo “Jar directory must be specified.” exit 1 fi […]

Maven: Adding Custom Attributes and Build Timestamp to Manifest »

Here is how I add custom attributes and build time stamp to my manifest file. Reference is made to the Maven CookBook. First, in src/main/resources/META-INF/MANIFEST.MF, I added the following entries Specification-Title: App Name Specification-Version: ${pom.version} – ${build.time} Specification-Vendor: Company Name Implementation-Title: App Name Implementation-Version: ${pom.version} – ${build.time} Implementation-Vendor: Company Name Built-By: ${user.name} Build-Jdk: ${java.version} Build-Time: […]

Design Pattern Sample Application – Part I »

This is one of the applications that I developed some time back and I am going to use it to demonstrate some of the design patterns. Basically this is a simplied share trading system. You can have a look at the E-R diagram here. The MySQL script can be downloaded here. MySQL Script Using this […]

Design Pattern in .NET 101 – Abstract Factory Pattern (Creational Pattern) »

Download Sample Code Abstract Factory pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes. E.g. I have a DocumentFactory class that either returns DefaultDocumentFactory or CustomDocumentFactory dependening on the environment variable. using System; using System.Collections.Generic; using System.Text; namespace AbstractFactory { abstract class DocumentFactory { public static DocumentFactory […]

PHP: Writing a Console Program in CakePHP »

I have written my web application in PHP using CakePHP framework, and I need to reuse part of the code in a scheduled job for data extraction. To avoid coding in other language, I was trying to see if it is possible for me to use PHP and CakePHP to run a scheduled job. To […]

Java – Develop Network Applications with Apache MINA »

To develop clients for FTP, Telnet, SMTP, POP3, etc, I normally use Apache Commons Net, and to develop HTTP based client I use Commons HttpClient, and to develop network servers in various protocols I used Apache MINA. As quoted from the web site, Apache MINA is a network application framework which helps users develop high […]

PHP: Frameworks That I Used »

There are many open source PHP frameworks for rapid development. Each one has its own advocates and for beginner PHP developers it is really time consuming to learn and choose the frameworks that they are comfortable with. IMHO, they are really no best frameworks. Every developer has his/her own preferences. Many may favor over one […]

Java – Performance of File Reading »

Download Sample Code Here is a simple program that I wrote to prove that file reading using buffered stream is indeed performing better, especially when you are reading large binary file. import java.io.*; public class FilePerformance { protected static String LARGE_BINARY_FILE_NAME = “c:/temp/large.bin”; protected static String LARGE_TEXT_FILE_NAME = “c:/temp/large.txt”; public void createLargeBinaryFile() throws Exception { […]

Java – Signal Handling »

Download Sample Code In my earlier article, I talked about how to do a graceful shutdown your of Java application when Ctr-C, or the termination signal is intercepted. Now I am going to roughly show you how to do it using Java signal handling. JVM signal handling is slightly different across different platforms, e.g. across […]

PHP: Write a Web Page Scraper »

Download Sample Code I have not done many PHP projects but I always think that PHP is really good for web programming even though I mostly program in Java and .NET. I am not a good PHP programmer, but to write a simple web page scraper in PHP is very straightforward. First, I defined my […]

Oracle: Oops, my spfile is corrupted !! »

I was trying to restart my Oracle 10g database server. Oops, the database server can be be started because the spfile is corrupted. Someone must have edited it using a text editor… I cannnot use the alter system command to regenerate the spfile since the database is not running. What can I do ?? After […]