Displaying keyword search results 61 - 70
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 java.io.*; 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....DateUtil.java
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 java.io.*; 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 java.io.*; /** * Reads file in U...It is equivalent to:
native2ascii -encoding utf-8using 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 java.util.zip.GZIPInputStream . 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 java.io.*; import java.util.zip.GZIPInpu...
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 java.io.*; 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="http://java.sun.com/jsp/jstl/c...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 java.io.BufferedReader; import java.io.I...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.
Created by Dr. Xi on August 03, 2010 16:29:35 Last update: August 03, 2010 16:36:50
This utility converts unicode escape strings in a file to UTF-8 encoded. Suppose you received a properties file with contents like:
# @(#)codepoint_zh_CN.properties 1.4 05/09/27 #...You can use this utility to convert it to UTF-8 and view or edit.
import java.io.*; /** * Reads file with...This utility is equivalent to:
native2ascii -reverse -encoding utf-8using the standard Java native2ascii utility.