Recent Notes

Displaying keyword search results 1 - 11
Created by James on August 01, 2012 14:26:53    Last update: August 01, 2012 14:26:53
The jQuery size() function returns the number of elements in the jQuery object. According to jQuery doc: The .size() method is functionally equivalent to the .length property; however, the .length property is preferred because it does not have the overhead of a function call.
Created by Dr. Xi on July 14, 2011 09:28:57    Last update: July 14, 2011 09:28:57
Java arrays are fixed size, so you have to make a new array with smaller size and copy the data. For JDK6 and above: // import java.util.Arrays; newArray = Arrays.c... Before that (using Object as example): Object[] newArray = new Object [newSize] ; Syst...
Created by alfa on May 20, 2011 15:54:23    Last update: May 20, 2011 15:54:23
From Oracle : The simplest and most reliable way to achieve short garbage collection times over the lifetime of a production server is to use a fixed heap size with the default collector and the parallel young generation collector, restricting the new generation size to at most one third of the overall heap. The following example JVM settings are recommended for most engine tier servers: -server -XX:MaxPermSize=128m -XX:+UseParNewGC -XX:... If the engine tier server enables caching for call state data, the example settings are: -server -XX:MaxPermSize=128m -XX:+UseParNewGC -XX:... For replica servers, use the example settings: -server -XX:MaxPermSize=128m -XX:+UseParNewGC -XX:... The above options have the following effect: -XX:+UseTLAB - Uses thread-local object allocation blocks. This improves concurrency by reducing contention on the shared heap lock. -XX:+UseParNewGC...
Created by zettersten on February 05, 2011 10:39:15    Last update: February 05, 2011 10:39:15
or you can pass your object through the ${fn:(----object here---)}
Created by Fang on July 26, 2010 19:18:28    Last update: August 18, 2010 19:13:02
The tags <c:import> The <c:import> tag imports the contents of a URL and expose that in one of three ways: Import contents from a URL and write it out to the page (url may be relative or absolute): <c:import url="theUrl" /> Import contents from a URL and save it to a scoped variable string named by the var attribute. Use the scope attribute to define the scope of the exported variable. <c:import url="theUrl" var="importTest" scope="ses... Import a URL and expose to a Reader object named by the varReader attribute. The scope attribute does not apply. The varReader scoped variable can only be accessed within the body of <c:import> . <c:import url="theUrl" varReader="theReader"/> <c:url> The <c:url> tag constructs a URL and writes it out to the...
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 James on June 22, 2010 19:09:07    Last update: June 22, 2010 19:09:50
The first form iterates over a jQuery object and executes a function for each matched element. This is an example from jQuery documentation: <!DOCTYPE html> <html> <head> <style> ... The second form iterates over a general collection (examples from jQuery documentation): $.each([52, 97], function(index, value) { al...
Created by Dr. Xi on June 20, 2010 14:35:17    Last update: June 20, 2010 14:35:17
This XML signature validator comes from the Apache XML Security project. It validates the signature according to the core validation processing rules . It does not verify that the key used to generate the signature is a trusted key. You can override the KeySelector class to make sure that the signing key is from a trusted store. import javax.xml.crypto.*; import javax.xml.cry...
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,...
Created by Dr. Xi on December 12, 2007 20:30:01    Last update: December 12, 2007 20:32:23
This is a script to tail a log file through the web browser. It uses AJAX, apache web server, mod_python, UNIX utilities tail (requires the --lines switch) and wc . The log file may reside on the web server or any other host accessible from the web server through SSH. Although it's written in python, it should be easy to port to other languages such as Perl. Apache httpd.conf : LoadModule python_module modules/mod_python.so ... Python script: import time, os from os.path import basename ...
Created by Dr. Xi on August 27, 2007 02:13:50    Last update: November 24, 2007 22:08:48
To convert array to list: // import java.util.Arrays; String[] stoogi... To convert List to array: Object[] stoogies = l.toArray(); // or, downcas...