Notes by Dr. Xi

Displaying notes 111 - 120
Created by Dr. Xi on February 09, 2011 12:29:51    Last update: February 09, 2011 12:29:51
Perl package variables are accessed with the expression: $PackageName::variableName (for scalar, similarly for vector etc), not PackageName::$VariableName . Example: C:\>perl use CGI; print $CGI::VERSION; ^Z...
Created by Dr. Xi on February 08, 2011 14:45:13    Last update: February 08, 2011 14:45:50
The ECMAScript defines these single character escape sequences: Escape Sequence Code Unit Value Name Symbol \b \u0008 backspace <BS> \t \u0009 horizontal tab <HT> \n \u000A line feed (new line) <LF> \v \u000B vertical tab <VT> \f \u000C form feed <FF> \r \u000D carriage return <CR> \" \u0022 double quote " \' \u0027 single quote ' \\ \u005C backslash \ Escape sequences can also be: \0 (backspash zero): the <NUL> character. \xdd (x followed by two hexadecimal digits): a Latin-1 character whose code unit value is the value of the hexadecimal number. \udddd (u followed by 4 hexadecimal digits): A Unicode character whose code unit value equals the value of the hexadecimal number. \ddd (backslash followed by 3 octal digits): a Latin-1 character specified as...
Created by Dr. Xi on January 29, 2009 00:01:02    Last update: February 04, 2011 14:57:40
Generate key valid for 10 years (3650 days). Since no -keystore option is given, the key is stored in the default keystore $HOME/.keystore . C:\tmp>keytool -genkey -keyalg rsa -alias myke... Create the applet jar: jar -cf myapplet.jar com/my/applet Sign jar: C:\tmp>jarsigner myapplet.jar mykey Enter Passp... Verify signature: C:\tmp>jarsigner -verify -verbose -certs myapplet....
Created by Dr. Xi on February 03, 2011 13:47:22    Last update: February 03, 2011 13:47:22
Read a directory and sort files by modified date (oldest to newest): $dirname = "."; opendir(DIR, $dirname) or die $... Same, but with glob (note that the output is a bit different): $dirname = "."; @files = sort { -M $b <=> -M $... Switch the places of $a and $b to order from newest to oldest.
Created by Dr. Xi on February 01, 2011 14:38:55    Last update: February 01, 2011 14:40:59
Create the stuff you want to manufacture with the factory: package tc.demo; public class Junk { ... Create the factory: package tc.demo; import java.util.Enumerati... Tell Tomcat to use your factory. Create file context.xml and put it under the directory META-INF of your web application: <Context> <Resource name="/find/junk/here" ... Note that beside name , type and factory , you can put any arbitrary attribute in the Resource element. Access the thing with JNDI: <%@page language="java" import="javax.naming.*,tc.... The server side log looked like this: INFO: jndiName: here INFO: name: scope, value: ... Also note that, in contrast to Tomcat documentation , resource-ref is not needed in web.xml .
Created by Dr. Xi on February 01, 2011 14:36:04    Last update: February 01, 2011 14:37:09
Tomcat JDBC connection pool can be configured with META-INF/context.xml . This is the example given in the Tomcat doc : <Context> <Resource name="jdbc/EmployeeDB" ... To use the DataSource in your Java code: Context initCtx = new InitialContext(); DataSou... In contrast to Tomcat documentation, there's no need to declare resource-ref in web.xml . The above example uses Tomcat's standard DataSource resource factory: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory . If you are using a third party DataSource factory, the configuration may be different. For example, if you are using HA-JDBC , context.xml may look like: <Context> <!-- ... --> <Resource name="j...
Created by Dr. Xi on January 31, 2011 16:24:31    Last update: January 31, 2011 16:24:58
Perl file test operators are unary operators that takes one argument, which can be a file name, a filehandle, or dirhandle. If the argument is omitted, it tests $_ , except for -t , which tests STDIN. Syntax: -X FILEHANDLE -X EXPR -X DIRHANDLE -X where X is: Operator Meaning -r File is readable by effective uid/gid. -w File is writable by effective uid/gid. -x File is executable by effective uid/gid. -o File is owned by effective uid. -R File is readable by real uid/gid. -W File is writable by real uid/gid. -X File is executable by real uid/gid. -O File is owned by real uid. -e File exists. -z File has zero size (is empty). -s File has nonzero size (returns size in bytes)....
Created by Dr. Xi on January 31, 2011 16:14:06    Last update: January 31, 2011 16:14:06
Sometimes ClassCastException happens when apprently a class is casted to the same class or a parent class. The exception looks like this: java.lang.ClassCastException: X cannot be cast to ... where Y may be the same as X , or a parent class of X . The cause of this error is that X and Y are loaded by different class loaders. You can use the FindClass utility to find all occurances of X and Y in the deployment tree. If there's no duplication of X and Y in the deployment tree, JNDI lookups may be the culprit. Suppose X is loaded by class loader LX and registered under name jndi/Resource . In the context of another loader LY , your code may be looking up...
Created by Dr. Xi on January 29, 2009 23:27:46    Last update: January 30, 2011 14:53:17
Both document.body.onload and window.onload worked for IE7. Firefox 3 doesn't recognize document.body.onload . <!doctype html> <html> <body> <h1... <!doctype html> <html> <body> <h1...
Created by Dr. Xi on January 27, 2011 16:27:25    Last update: January 27, 2011 16:27:25
The easiest way to undeploy a web application in Tomcat is probably to simply delete the WAR file while Tomcat is running . Tomcat will do the cleanup after the WAR is deleted. If you deleted the WAR (or the application directory) when Tomcat is not running, Tomcat will try to deploy the deleted application at startup and will fail.
Previous  7 8 9 10 11 12 13 14 15 16 Next