Notes by Dr. Xi
Displaying keyword search results 1 - 10
Created by Dr. Xi on March 13, 2012 08:46:57
Last update: March 13, 2012 08:46:57
This trick sets HTML base to the root context path of the current webapp:
The short version:
<!DOCTYPE html>
<%@ taglib uri="http://java.sun...
The long version:
<!DOCTYPE html>
<%@ taglib uri="http://java.sun...
Created by Dr. Xi on March 08, 2012 09:16:02
Last update: March 08, 2012 09:16:02
In my JSP there's a link like this:
<a href="/path/${part1}/${part2}">the link</a>
where part1 and part2 may contain characters that need to be URL encoded (such as '#').
JSP JSTL does not provide such facility out of the box. But there's a hack using <c:url> , or you can use <spring:url> :
JSTL hack:
<c:url value="/path" var="theUrl">
<c:param...
Using Spring url tag:
<spring:url value="/path/{part1}/{part2}" var="enc...
Created by Dr. Xi on February 24, 2012 12:42:09
Last update: February 24, 2012 12:43:00
Use the copy command to restore a deleted file:
$ svn copy http://svn.example.com/path/to/svn/repo...
@revision must be a revision number before the file was deleted.
You can use the info command to view the info before restoring:
$ svn info http://svn.example.com/path/to/svn/repo...
Created by Dr. Xi on February 23, 2012 14:07:40
Last update: February 23, 2012 14:07:40
The command " svn info " prints information about the current directory:
$ svn info Path: . URL: http://svn.example.c... where: Revision: is the last syncup (update) revision of the current TARGET (artifact/file/directory, whatever you call). This number bumps up to that of the current project revision number after you do an update. Last Changed Rev: is the revision number of the latest change for the current TARGET . If TARGET is a directory, it is the revision number of the latest change within the directory, including all subdirectories. However , this number is not accurate after you do a check in without a following update. The revision number for the file or directory you checked in will have higher revision number than its parent/ancestor. To...
Created by Dr. Xi on February 07, 2012 15:40:11
Last update: February 07, 2012 15:40:11
An alias defined in .profile does not work when you open a bash window from the desktop. Simply put, alias should be put in .bashrc ; PATH should be put in .profile . These are the facts: .profile is executed by the login shell, i.e., when you login. .bashrc is executed whenever a bash shell is opened - login or non-login. When you open a new bash window from the desktop, a non-login shell is created, it will execute .bashrc , not .profile . When you ssh to a remote system interactively, a login shell is created. When you ssh to a remote system and run a command directly, a non-login shell is created. PATH modifications should be put in .profile since it is usually...
Created by Dr. Xi on February 06, 2012 08:42:21
Last update: February 06, 2012 08:42:21
Here are some ways to add shared libraries to the Linux loader search path:
Copy the library to one of the standard paths (for example, /usr/lib ), then run ldconfig
Add the path to /etc/ld.so.conf , then run ldconfig (for details, man ldconfig ).
Use the environment variable LD_LIBRARY_PATH .
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 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 June 20, 2011 15:18:06
Last update: June 20, 2011 15:18:06
Perl does not have built-in functions to get the base name or dir name from a file path. But on the Unix platforms we can rely on the executables basename and dirname .
#!/usr/bin/perl
$f = '/A path with/space "/file...
The quotes, escapes, and chomp are necessary:
# This fails when there's a space in $f
$base =...
Created by Dr. Xi on June 16, 2011 13:51:53
Last update: June 16, 2011 14:02:10
With an absolute path to a file, this is the way to construct a URL :
URL url = new URL("file:///absolute/path/to/file.e...
What if I want a URL for a file relative to the current working directory?
URL url = new URL("file:///./file.ext"); // this ...
Or, you can use the File class to help you out:
URL url = new URL(String.format("file:///%s/file.e...