Recent Notes
Displaying keyword search results 81 - 90
Created by nogeek on December 31, 2010 13:13:54
Last update: December 31, 2010 13:14:45
When a bean is deployed into the JBoss Microcontainer, it goes through these states: NOT_INSTALLED - the deployment descriptor containing the bean has been parsed along with any annotations on the bean itself. DESCRIBED - any dependencies created by AOP have been added to the bean and custom annotations have been processed. INSTANTIATED - an instance of the bean has been created. CONFIGURED - properties have been injected into the bean along with any references to other beans. CREATE - the create method, if defined on the bean, has been called. START - the start method, if defined on the bean, has been called. INSTALLED - any custom install actions that were defined in the deployment descriptor have been executed and the bean is ready...
Created by voodoo on November 25, 2010 00:03:53
Last update: November 25, 2010 00:03:53
It seems that the JDBC standard way to create a BLOB is to call Connection.createBlob . However, this does not work for PostgreSQL (as of version 9.0-801 jdbc4):
Exception in thread "main" org.postgresql.util.PSQ...
The workaround is to call a PostgreSQL function to create the Blob, then use JDBC to update it:
Connection conn = jdbcTemplate.getDataSource().get...
Oracle Note: the Oracle way function to create an empty BLOB is EMPTY_BLOB() .
stmt.execute ("INSERT INTO my_blob_table VALUES ('...
Created by nogeek on November 11, 2010 00:26:08
Last update: November 11, 2010 00:29:43
This one is even more weird: it worked on Windows but failed on Linux, using default tools JDK1.6.0_20 on both. The exception thrown was:
java.lang.RuntimeException: Invalid conversion fro...
And the stack trace:
java.lang.RuntimeException: Invalid conversion fro...
This was the XSL used:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
The problem was , DateUtil.java had two getDate methods, one taking long parameter, the other taking a String parameter. And Java's XSLT get confused about which one to use:
import java.util.Date;
import java.text.SimpleD...
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 nogeek on November 04, 2010 20:55:31
Last update: November 05, 2010 14:36:09
Following part 1 , change to stylesheet to:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
The XSLT output becomes:
java Xslt test.xml test.xsl
Transformer Fac...
Parameter is not passed!
The Xalan version that comes with JDK 1.6 processed this correctly:
java -Djavax.xml.transform.TransformerFactory=com....
Created by nogeek on November 04, 2010 23:25:57
Last update: November 04, 2010 23:26:59
With this XML file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ev...
and this XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
The output of XSLT is:
A test event
Timestamp: 12886515008...
You may not want the title string in the output. There are two ways to do this:
Limit the apply-templates action with a select attribute:
<xsl:template match="/">
<xsl:apply-templat...
Suppress default text node output with an empty template:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
Reference: http://www.dpawson.co.uk/xsl/sect2/defaultrule.html
Created by nogeek on November 04, 2010 20:08:02
Last update: November 04, 2010 20:45:25
Use the <xsl:with-param> and <xsl:param> tags to apply parameters to XSL stylesheets:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
Created by nogeek on November 04, 2010 20:24:32
Last update: November 04, 2010 20:24:55
XSLT by default writes namespace declarations in the output. Most of the time it's spurious, sometimes outright wrong.
Take this XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ev...
And this XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
where DateUtil.java is:
import java.util.Date;
public class DateUti...
The output is (with JDK1.6):
Title: <br xmlns:java="http://xml.apache.org/x...
The namespace declaration went to the <br> element, not the timestamp where it belongs.
To remove the namespace info, add exclude-result-prefixes to the XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs...
Created by James on October 26, 2010 21:43:52
Last update: October 26, 2010 21:44:37
Use the unbind method to unbind an event. The following example unbinds three events: mouseenter , mouseleave and click .
$('#control')
.find('a')
.css('cursor', 'def...
Created by James on October 25, 2010 04:45:59
Last update: October 25, 2010 04:45:59
The test method for JavaScript regular expression tests if a string matches the regular expression. Below are some examples:
/son/i.test('Jack Jake Jason'); // true
/ja/.te...