Recent Notes
Displaying keyword search results 81 - 90
Created by Dr. Xi on October 07, 2010 19:20:55
Last update: January 11, 2011 19:59:17
Like the string trim function, Firefox provides a native implementation for array map, IE doesn't. So we have to create our own map function for Array :
if(typeof Array.prototype.map !== 'function') {
...
Test page:
<html>
<head>
<title>Array Map</...
Created by Dr. Xi on September 11, 2008 22:55:01
Last update: January 11, 2011 19:48:19
<html>
<head>
<script language="JavaScript">...
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 java.net.*;
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 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 voodoo on November 01, 2010 22:26:00
Last update: November 01, 2010 22:26:00
Some weirdness observed while updating BLOB with PostgreSQL JDBC driver: LOB position offset starts at 1 (not 0 as in IO input stream). When you call setBinaryStream(long pos) , pos must be greater than 0. I think this is JDBC standard behavior. When you write to a BLOB output stream, new contents overwrite existing contents. Old contents are not automatically truncated. If new content length is shorter than old contents, the old contents will remain after the position where new content ended. You can call Blob.truncate(long len) to truncate existing contents. However , there seems to be an discrepancy between the JDBC doc and PostgreSQL JDBC driver. The JDBC JavaDoc states that: Truncates the BLOB value that this Blob object represents to be len bytes...
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-8
using the standard Java native2ascii utility.
Created by James on September 27, 2010 23:14:51
Last update: September 27, 2010 23:15:12
Use the length attribute. Length would be zero if the matched set is empty. For example:
$('.module-selector:first').siblings('div.log-data...
Created by James on September 10, 2010 23:01:14
Last update: September 10, 2010 23:01:14
By default, heights for jQuery UI tab panels expand or contract depending on the height of each tab. The code snippet here sets the height of all tabs to be equal to that of the container.
<!DOCTYPE html>
<html>
<head>
<title>jQu...