Notes by Dr. Xi
Displaying notes 61 - 70
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...
Created by Dr. Xi on November 11, 2011 10:05:22
Last update: November 11, 2011 10:12:01
This is an HTML image tag filter using Java regex. It takes a string, finds the img tags, replaces the src attribute with one provided by the filter, then adds a class name to the class attribute.
import java.util.regex.*;
import java.io.*;
...
Test file:
<div id="HTML snippet">
<img src="img/big/txt-m...
Created by Dr. Xi on February 12, 2010 22:52:27
Last update: November 08, 2011 19:48:09
For Tomcat 6, there's no default manager username and password. You do have to set it up yourself, though it's pretty straightforward. The Tomcat manager webapp is restricted to users with a role named manager . So you'll need to create a user and assign the manager role to it.
Edit $CATALINA_BASE/conf/tomcat-users.xml to read:
<?xml version='1.0' encoding='utf-8'?>
<!--
...
For tomcat 7:
<tomcat-users>
<role rolename="manager"/>
...
Created by Dr. Xi on October 22, 2011 14:34:17
Last update: October 22, 2011 14:34:33
JDK version and corresponding class version numbers:
JDK Version Class Version
1.0 45.3
1.1 45.3
1.2 46.0
1.3 47.0
1.4 48.0
1.5 49.0
1.6 50.0
Created by Dr. Xi on September 30, 2011 15:34:47
Last update: September 30, 2011 15:34:47
A naive try would be something like this:
$ nc -l 8082 | nc remote_host 80 Yes, it does forward the request from local port 8082 to remote_host:80 , but the response is dumped to stdout , not routed back to the client as expected. Using a named pipe makes it work: $ mkfifo backpipe $ nc -l 8082 0<backpipe | nc ... Use tee to get a glimpse of the response through the pipe (I wasn't able to find a way to dump the request): $ nc -k -l 8082 0<backpipe | nc localhost 80 | tee... The GNU netcat has a different syntax than the stock nc . It also supports different switches. To listen to port 1234: $ netcat -l -p 1234...
Created by Dr. Xi on September 24, 2011 20:59:16
Last update: September 24, 2011 21:00:20
To import source from my-project into the svn repository:
$ svn import my-project/ file:///home/drxi/work/sv...
List the contents of the repository:
$ svn ls file:///home/drxi/work/svn-repository/
...
List the contents of the newly imported project:
$ svn ls file:///home/drxi/work/svn-repository/my-...
Created by Dr. Xi on September 24, 2011 20:45:14
Last update: September 24, 2011 20:52:48
Use the svnadmin command to create a new svn repository:
$ svnadmin create ~/work/svn-repository
$ ls sv...
There's no need to do " mkdir ~/work/svn-repository ", svnadmin will create it if it doesn't exist.