Recent Notes

Displaying keyword search results 1 - 10
Created by Dr. Xi on January 14, 2010 00:28:27    Last update: March 30, 2011 15:37:44
A task that a Java developer does so frequently is to find out where a certain class can be found - to resolve compilation errors, classpath issues, or version conflicts of the same class introduced by multiple class loaders. A long while back I wrote a simple Perl script to perform the task. Later I was informed that there are Swing based Jar Browser and Jars Browser . Then, there are a couple of shell one-liners: # one liner 1 find -name "*.jar" -print0 | xarg... But all of them share the same problem: if a class is in a jar nested in another jar, it cannot be found. Such is the case for a class inside a jar under the WEB-INF/lib directory of a...
Created by Dr. Xi on October 26, 2010 16:07:40    Last update: October 26, 2010 16:07:40
This is a more generic version, which can be expanded to accommodate additional file signatures. import java.io.*; import java.util.*; pu...
Created by Dr. Xi on January 07, 2010 23:40:28    Last update: February 09, 2010 03:24:35
This is a utility to generate SQL insert statements for Oracle for one table, or a set of tables. It doesn't cover all possibilities but should be good enough for most cases. import java.io.*; import java.sql.*; import ... To generate insert statements for multiple tables, simply put the table names in a file, one per line, and use the -f switch.
Created by Dr. Xi on January 29, 2010 22:07:44    Last update: January 29, 2010 22:07:44
This class demonstrates how to read a binary file in Java. This is the Java version of cat , probably one of the first programs you ever use on a *NIX platform. import java.io.*; public class JavaCat { ...
Created by Dr. Xi on January 29, 2010 21:08:43    Last update: January 29, 2010 21:08:43
This class reads a text file line by line and echos the contents to standard out. import java.io.*; public class ReadTextFile...
Created by Dr. Xi on January 07, 2010 23:56:00    Last update: January 07, 2010 23:56:00
This is a utility that generates a script to grant privileges for an existing schema for Oracle. import java.io.*; import java.sql.*; pub...
Created by Dr. Xi on January 07, 2010 23:51:44    Last update: January 07, 2010 23:53:57
This is a utility to generate a "create synonym" script for Oracle for an existing schema. import java.io.*; import java.sql.*; pub...
Created by Dr. Xi on January 07, 2010 23:47:36    Last update: January 07, 2010 23:47:36
This is a utility to generate a "create role" script for Oracle for an existing schema. import java.io.*; import java.sql.*; pub...
Created by Dr. Xi on October 09, 2009 02:56:44    Last update: October 09, 2009 02:56:44
The Luhn algorithm is used to validate credit card numbers. This class provides two methods: one to validate that a number passes the Luhn algorithm validation, the other to generate a check digit that makes a number pass the Luhn validation. public class Luhn { public static void main...
Created by Dr. Xi on October 16, 2008 23:09:28    Last update: October 17, 2008 03:30:38
import java.io.*; public class TestMSOffice...