Recent Notes

Displaying keyword search results 1 - 4
Created by alfa on July 01, 2011 13:16:12    Last update: July 01, 2011 13:16:12
This is a simple doclet that prints all public methods and their parameter names and types. Code import com.sun.javadoc.*; public class List... Compile javac -cp $JAVA_HOME/lib/tools.jar:. ListMethodsDo... Use javadoc -doclet ListMethodsDoclet -sourcepath /pat...
Created by alfa on June 03, 2011 09:41:03    Last update: June 03, 2011 09:41:03
Dynamic proxy can be used to eliminate the need to stub out unused interface methods. This is an example for a simple SAX content handler for XML parsing. The org.xml.sax.ContentHandler interface requires 11 methods be implemented but we only need three: import java.io.IOException; import java.util.Ar... With a dynamic proxy, we don't need the empty blocks for the unused methods: import java.io.IOException; import java.util.Ar... Equivalently (with anonymous inner class): import java.io.IOException; import java.util.Ar... demo.xml : <breakfast-menu> <food> <name>Belgian W...
Created by Dr. Xi on October 26, 2010 04:47:37    Last update: January 11, 2011 20:00:36
The code presented here is a simple implementation of a tab set. It is used to demo how a tab set could be implemented. The code is stand alone and does not depend on any JavaScript libraries. Multiple tab sets within the same page is supported. The HTML markup is fairly simple: Tabs sets are contained within a DIV element with class name "tabsContainer". Define a UL list for the tabs. Follow the UL list with equal number of DIVs for the tab contents. The Nifty Corners Cube technique is used to draw the rounded corners (original form, not the enhanced JavaScript form). HTML, CSS and JavaScript: <!doctype html> <html> <head> <style typ...
Created by Dr. Xi on November 19, 2008 00:22:27    Last update: January 07, 2010 23:00:36
There is a open source project named [ini4j] for processing Windows .ini configuration files. However, I found it an overkill for my purposes. So here is my simple implementation of a .ini parser. It mimics the standard java.util.Properties class with enhancements to get and set properties by section name. There are only a few simple rules: Leading and trailing spaces are trimmed from section names, property names and property values. Section names are enclosed between [ and ] . Properties following a section header belong to that section Properties defined before the appearance of any section headers are considered global properties and should be set and get with no section names. You can use either equal sign ( = ) or colon ( : )...