Monday, April 28, 2008

SVN recover deleted files

Two steps

1) svn log --verbose
2) svn up -r 123457 file.txt

where 123457 is any revision that you want to get the file from.

References:

http://seamlesstrust.org/trustwiki/index.php/SVN_Recover_Deleted_Files

Wednesday, April 23, 2008

Configure the JDK Logging

If you have code in your application, for example from third party libraries that uses the standard JDK logging, then you should be able to create a logging.properties file and pass it as a system property as in:


java -Djava.util.logging.config.file=logging.properties


Let us take a look at a sample logging.properties.


handlers= java.util.logging.ConsoleHandler.level= INFO
java.util.logging.ConsoleHandler.level = FINER
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
org.something.something = FINER
org.apache.tomcat.catalina = FINER

Sunday, April 13, 2008

firewire to USB adapter

Many times your mac software works mainly with firewire enabled externals. Example, you want to boot from an external firewire enabled disk. Unfortunately, your external drive supports USB. There is no firewire support.

You look for a Firewire to USB adapter. Unfortunately due to the incompatibilities of the specifications, such an adapter does not exist. What a shame. :(

Thursday, April 03, 2008

Tomcat shutdown.sh shuts down all tomcat instances

If you are running tomcat instances on multi-homed machines, then by default, the shut down scripts will kill all tomcat instances on the box. What you need to do is change the shutdown port in conf/server.xml


<Server port="8011" shutdown="SHUTDOWN">


The default port that is present here is 8005.

Wednesday, April 02, 2008

How To: Debug Web Applications on Tomcat with JPDA

Suppose you want to debug a servlet in eclipse.

WINDOWS:-

Step 1: Change your catalina.bat with the following changes


if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
set JPDA_TRANSPORT=dt_socket
:gotJpdaTransport
if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
set JPDA_ADDRESS=8787


Step 2: Start Tomcat with

catalina start jpda


Step 3: Open your debug dialog in Eclipse. Add a remote java application with port "8787".

UNIX/LINUX:
No change really needed.

$>./catalina.sh jpda start
$>./catalina.sh jpda stop

Eclipse needs to have a remote java application with port "8000"

Where is Tomcat endorsed directory?

If you are haunted by this question, then for Tomcat 5.x, the folder is tomcat/common/endorsed. For Tomcat 6.x, create a endorsed directory under tomcat. tomcat is basically where the CATALINA_HOME is pointing to.

Under endorsed dir, you should have the following jars (and any other jars needed):

asaldhana~/apache-tomcat-6.0.16/endorsed>ls
resolver.jar serializer.jar xalan.jar xercesImpl.jar xml-apis.jar