Recent Notes

Displaying keyword search results 61 - 70
Created by Dr. Xi on November 29, 2010 13:08:05    Last update: November 30, 2010 08:51:34
This sample code sets up a server socket on a specified address and port. I use it to test port binding conflicts. import*; public class SocketBind ... Note: " netstat -ano " also gives you information on active TCP connections, including listening ports. But there are cases where netstat reports nothing and bind still fails.
Created by voodoo on November 24, 2010 23:43:29    Last update: November 24, 2010 23:43:29
Two of the three PreparedStatement.setBinaryStream methods are not implemented as of version 9.0-801 of the PostgreSQL JDBC driver. Test program: import*; import java.sql.*; pub... Also note that setBinaryStream only works on a bytea column.
Created by nogeek on November 04, 2010 20:00:15    Last update: November 05, 2010 14:38:43
Following are some bugs in the Xalan jar shipped with JBoss 5.1.0 GA and JBoss 6.0. The Xalan jar file is located in jboss-5.1.0.GA/lib/endorsed ( %JBOSS_HOME%/common/lib for JBoss 6.0). Test xml: <?xml version="1.0" encoding="ISO-8859-1"?> ... Test xsl: <?xml version="1.0" encoding="ISO-8859-1"?> <xs... XSLT Java code: import org.w3c.dom.*; import javax.xml.parsers.... import java.util.Date; public class DateUti... XSLT output: Transformer Factory class: class org.apache.xalan.... Apparently, the output is wrong. The string "A test event" should not have been displayed.
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*; import java.util.*; pu...
Created by Dr. Xi on August 03, 2010 16:23:55    Last update: October 22, 2010 15:35:20
According to Java documentation: The Java compiler and other Java tools can only process files which contain Latin-1 and/or Unicode-encoded (\udddd notation) characters. This utility converts a utf-8 encoded file to ascii with unicode escape strings for non-ascii characters. import*; /** * Reads file in U... It is equivalent to: native2ascii -encoding utf-8 using the standard Java native2ascii utility.
Created by Dr. Xi on August 27, 2010 22:35:53    Last update: August 27, 2010 22:35:53
This example decompresses a gzip compressed file with . The input is assumed to be Base64 encoded after being gzipped (such would be the case when binary data is transmitted within an XML file). You don't need the Base64InputStream if the data is not Base64 encoded. import*; import
Created by Dr. Xi on August 24, 2010 21:59:22    Last update: August 24, 2010 21:59:22
This class decodes a Base64 encoded file with the Apache commons codec package: import*; import org.apache.commons.cod...
Created by Fang on August 23, 2010 22:55:58    Last update: August 24, 2010 15:45:04
The tags XML flow control tags are exactly the same as their Core flow control equivalents, except that the test condition with a boolean EL expression is replaced by the select condition with an XPath expression. In the case of the forEach tag, the items attribute is replaced with the select attribute. In a test condition, the XPath expression is evaluated to a boolean value by the rules of the XPath boolean() function, which converts its argument to a boolean as follows: a number is true if and only if it is neither positive or negative zero nor NaN. a node-set is true if and only if it is non-empty. a string is true if and only if its length is non-zero. an object of...
Created by Fang on August 17, 2010 19:27:32    Last update: August 17, 2010 19:27:32
Get the length of a collection The length function returns the size of a collection. It can be applied to any object supported by the JSTL core tag <c:forEach> , namely: Arrays Implementation of java.util.Collection Implementation of java.util.Iterator Implementation of java.util.Enumeration Implementation of java.util.Map String When used on String , it returns the number of characters in the string. Test it Make these additions to the expanded test application : Create a new Java class LengthFunction : package jstl.demo.handler; import java.... Create a new JSP ( lengthfunction.jsp ) under webapp : <%@ taglib uri=" Compile and package the WAR with: mvn package Deploy the WAR to a servlet container of your choice (for example, Tomcat or JBoss). Test the page with this URL...
Created by nogeek on August 05, 2010 15:13:24    Last update: August 05, 2010 15:13:24
Read from stdio and print out rot13: import; import The ROT13 translated Fourth Amendment reads: Gur evtug bs gur crbcyr gb or frpher va gurve crefbaf, ubhfrf, cncref, naq rssrpgf, ntnvafg haernfbanoyr frnepurf naq frvmherf, funyy abg or ivbyngrq, naq ab Jneenagf funyy vffhr, ohg hcba cebonoyr pnhfr, fhccbegrq ol Bngu be nssvezngvba, naq cnegvphyneyl qrfpevovat gur cynpr gb or frnepurq, naq gur crefbaf be guvatf gb or frvmrq.
Previous  2 3 4 5 6 7 8 9 10 11 Next