Recent Notes

Displaying keyword search results 31 - 40
Created by voodoo on July 21, 2010 16:10:47    Last update: July 21, 2010 16:10:47
Google news RSS does not like curl: C:\> curl --dump-header - -o NUL http://news.googl... Switch the agent to HotJava with the -A option: C:\> curl -A "HotJava/1.1.2 FCS" --dump-header - -...
Created by Dr. Xi on June 20, 2010 14:35:17    Last update: June 20, 2010 14:35:17
This XML signature validator comes from the Apache XML Security project. It validates the signature according to the core validation processing rules . It does not verify that the key used to generate the signature is a trusted key. You can override the KeySelector class to make sure that the signing key is from a trusted store. import javax.xml.crypto.*; import javax.xml.cry...
Created by Dr. Xi on June 19, 2010 04:34:01    Last update: June 19, 2010 04:39:13
Java SE 6 contains built-in utilities to generate XML signatures. This is an example that generates XML signatures using a Java keystore. It has options to generate signature for the whole document, for an element with a specific ID, or for elements matched by an XPATH expression. The XML document used to test is taken from Getting Started with XML Security : <?xml version="1.0"?> <PatientRecord> ... This is the Java code: import java.io.FileInputStream; import java.io.... However, it looks like the XPATH transform is not working. The digest generated with XPATH filter is exactly the same as that without it (i.e., the whole document)! Another reference: Programming With the Java XML Digital Signature API
Created by Fang on April 01, 2010 22:24:58    Last update: April 02, 2010 02:49:38
In this note I'll show you how to create and package a JSP custom tag. The purpose of this tag is to display a random splash image for a home page, among a set of images. We should be able to add or delete candidate splash images from the WAR archive without the need to change the JSP. This is the intended use of the tag: <%@ taglib uri="http://custom.tag.com/demo" prefix... In the above example you provide a set of images named splash*.png (e.g., splash1.png, spalsh2.png, ...), and the tag will pick a random one to display when the JSP is rendered. Let's get started. I'll use Maven for this purpose. Create the standard Maven directory structure ./pom.xml ./src ./src/main ./src/main/jav... pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0"... SplashTag.java package tagdemo; import java.util.ArrayList......
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 February 01, 2010 23:56:25    Last update: February 01, 2010 23:56:25
This simple class demonstrates the use of java.text.SimpleDateFormat . The strict option can be used to validate a date string. The lenient option takes all kinds of junk and is not suitable for validating date strings. import java.util.*; import java.text.*; ...
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...
Previous  1 2 3 4 5 Next