Notes by Dr. Xi
Displaying notes 1 - 10
Created by Dr. Xi on February 01, 2012 12:55:28
Last update: February 01, 2012 12:55:28
You can define environment variables in the Tomcat context.xml file like this:
<?xml version="1.0" encoding="UTF-8"?>
<Context...
which is equivalent to the following in web.xml :
<env-entry>
<env-entry-name>varName</env-entr...
In Java code, the variable can be looked up like this:
// import javax.naming.Context;
// import javax...
Created by Dr. Xi on January 20, 2012 15:05:14
Last update: January 20, 2012 15:06:15
Tomcat documentation states:
If the web application is packaged as a WAR then /META-INF/context.xml will be copied to $CATALINA_BASE/conf/ [enginename] / [hostname] / and renamed to match the application's context path .
For a Maven project, put context.xml in src/main/webapp/META-INF/ .
Created by Dr. Xi on January 17, 2012 11:58:16
Last update: January 17, 2012 11:58:16
Steps to configure JavaMail resource for Tomcat 6 & 7:
Install JavaMail jar: download the JavaMail API , unzip the archive and copy mail.jar to $CATALINA_HOME/lib .
Add JavaMail resource to $CATALINA_BASE/conf/context.xml :
<?xml version="1.0"?>
<Context>
.
...
Add resource-ref for the JavaMail resource to your webapp WEB-INF/web.xml :
<?xml version="1.0" encoding="UTF-8"?>
<web-app...
Use the JavaMail resource in your webapp:
// import javax.naming.*;
// import javax.mail....
Created by Dr. Xi on January 09, 2012 09:13:38
Last update: January 09, 2012 09:14:18
Unlike CVS, svn does not have a tag command, you create a new tag with copy :
$ svn copy http://svn.example.com/repos/calc/trunk...
The -r flag may be used to create a tag from an earlier revision:
-r [--revision] ARG : ARG (some commands al...
Created by Dr. Xi on January 06, 2012 14:02:09
Last update: January 06, 2012 14:02:09
In Java, the OS temporary directory is identified by the system property java.io.tmpdir :
public class TmpDir {
public static void ma...
Created by Dr. Xi on January 06, 2012 13:44:55
Last update: January 06, 2012 13:44:55
To exclude CVS directories:
grep -R -l --exclude-dir=CVS 'string_to_find‘ src
...
To exclude .svn directories:
grep -R -l --exclude-dir=.svn 'string_to_find‘ src...
Created by Dr. Xi on January 04, 2012 16:28:27
Last update: January 04, 2012 16:28:27
Steps to enable SSI (Server Side Include) in Apache HTTPD:
Enable mod_include .
In httpd.conf , update directive:
AllowOverride Options FileInfo
In .htaccess :
Options +Includes
AddType text/html .shtml
A...
Files with extension .shtml will be processed with SSI.
You may want to enable mod_cgi to include output from CGI programs:
<!--#include virtual="/cgi-bin/counter.pl" -->
To control caching :
Use the XBitHack Full configuration. This tells Apache to determine the last modified date by looking only at the date of the originally requested file, ignoring the modification date of any included files.
Use the directives provided by mod_expires to set an explicit expiration time on your files, thereby letting browsers and proxies know that it is acceptable to cache them.
Created by Dr. Xi on December 07, 2011 13:51:13
Last update: December 07, 2011 13:51:13
To list all changed files under the current directory:
$ svn st
To list all changed files since revision 732:
$ svn diff -r 732:HEAD --summarize
To list all changed files since Dec 07, 2011:
$ svn diff -r {'2011-12-07'}:HEAD --summarize
To list all files changed after Dec 07, 2011 4:00pm:
$ svn diff -r {'2011-12-07 16:00:00'}:HEAD --summa...
To list all files changed since Dec 07, 2011 under the directory src :
$ svn diff src -r {'2011-12-07'}:HEAD --summarize
Created by Dr. Xi on December 07, 2011 13:41:15
Last update: December 07, 2011 13:41:15
To view change history of the current directory:
$ svn log
To view change history of README.txt :
$ svn log some/path/README.txt
To view change history of README.txt since revision 733:
$ svn log README.txt -r 733:HEAD
To view change history of README.txt since revision Dec 07, 2011:
$ svn log README.txt -r {'2011-12-07'}:HEAD
Created by Dr. Xi on November 11, 2011 13:59:46
Last update: November 11, 2011 13:59:46
This is an example to replace a Java string with case insensitive match.
Code:
public class ReplaceTest {
public static vo...
Output:
Done TEST tEst tESt Test
Test TEST tEst tESt Te...