Recent Notes

Displaying keyword search results 1 - 7
Created by Fang on March 30, 2012 10:07:25    Last update: March 08, 2013 13:41:57
After a user resets a password, I want to force the user to change the password before she gets access to secured content. This is usually done with a servlet filter. But with Spring MVC, you can also use a HandlerInterceptor . According to Spring JavaDoc: HandlerInterceptor is basically similar to a Servlet 2.3 Filter, but in contrast to the latter it just allows custom pre-processing with the option of prohibiting the execution of the handler itself, and custom post-processing. Filters are more powerful, for example they allow for exchanging the request and response objects that are handed down the chain. Note that a filter gets configured in web.xml, a HandlerInterceptor in the application context. As a basic guideline, fine-grained handler-related preprocessing tasks are candidates...
Created by Fang on November 10, 2011 09:26:12    Last update: November 10, 2011 09:26:12
Syntax highlighted XML schema for JSF 2.0 Application Configuration Resource File ( faces-config.xml ). Almost 3000 lines! <?xml version="1.0" encoding="UTF-8"?> <xsd:sch...
Created by Dr. Xi on August 11, 2007 15:56:47    Last update: July 19, 2011 08:15:55
Here's a list of common TCP ports. You can find a more complete list here: http://www.gasmi.net/docs/tcp.html . Port Number Service Description 21 FTP File Transfer Protocol 22 SSH Secure Shell 23 Telnet Telnet remote login 25 SMTP Simple Mail Transfer Protocol 70 gopher Gopher 79 finger Finger 80 HTTP Hyper Text Transfer Protocol (WWW) 88 Kerberos Kerberos authentication 94 tivoli Tivoli Object Dispatcher 110 pop3 Post Office Protocol Version 3 123 ntp Network Time Protocol 137 netbios NetBIOS Name Service 138 netbios NetBIOS Datagram 139 netbios NetBIOS Session 143 imap Internet Message Access Protocol 161 snmp Simple Network Management Protocol 162 snmptrap SNMP trap 194 irc Internet Relay Chat Protocol 389 ldap Lightweight Directory Access Protocol 443 https Secure HTTP 445 SMB MS Server Message...
Created by Dr. Xi on April 20, 2011 21:44:15    Last update: May 02, 2011 20:56:58
The String.format() method provides versatile formatting capabilities. This tutorial tries to present these capabilities in a accessible manner. The format string A format string can contain zero, one, or more format specifiers . The general form of a format specifier is: %[argument_index$] [flags] [width] [.precision]co... where things in square brackets are optional, and conversion is a character indicating the conversion to be applied to the corresponding variable value. The only required characters in the format specifier is the percent sign % and the conversion character. A simple example: public static void simpleFormat() { System.out... The Argument index The argument index is specified by a number, terminated by the dollar sign $ . The same argument may be repeated multiple times in a format string. Unindexed...
Created by Dr. Xi on July 29, 2010 18:46:57    Last update: July 29, 2010 18:48:15
This is an example of using java.beans.XMLEncoder and java.beans.XMLDecoder to serialize/deserialize Java objects to XML. Java code TestXMLEncoder.java: import java.io.*; import java.beans.XMLEncoder;... SimpleBean.java: public class SimpleBean { private String na... CompositeBean.java: public class CompositeBean { private Simple... NotABean.java: public class NotABean { private String name... Test Output By default, only Java beans can be serialized using XMLEncoder . Exception occurs when you try to deserialize an object which is not a Java bean. Errors actually occur when you try to serialize, but they are ignored. As a result, an XML file is generated by the serialization but the file is useless! Console output: C:\>java TestXMLEncoder Testing simple bean ... simplebean.xml: <?xml version="1.0" encoding="UTF-8"?> <java v... compositebean.xml: <?xml version="1.0" encoding="UTF-8"?> <java v... nodefault.xml: <?xml version="1.0" encoding="UTF-8"?> <java v......
Created by Dr. Xi on October 30, 2008 03:39:50    Last update: October 30, 2008 03:40:51
-- define types CREATE OR REPLACE TYPE pers...
Created by Dr. Xi on October 06, 2008 20:23:49    Last update: October 06, 2008 20:26:45
The __doc__ string on an object provides documentation for the object, which is available from an interactive Python session: $ python Python 2.5.1 (r251:54863, Mar 7 2008,...