In order to synchronize the time on your debian machine you can use ntp. (apt-get install ntp) This will install ntp and the ntp daemon. Edit your configuration found in /etc/ntp.conf and add some ntp servers close to your current location.
I added some ntp servers for the Netherlands.
# pool.ntp.org maps to more than 300 low-stratum NTP servers.
# Your server will pick a different set every time it starts up.
# *** Please consider joining the pool! ***
# *** <http://www.pool.ntp.org/join.html> ***
server 0.nl.pool.ntp.org
server 1.nl.pool.ntp.org
server 2.nl.pool.ntp.org
server 3.nl.pool.ntp.org
# server 0.debian.pool.ntp.org iburst
# server 1.debian.pool.ntp.org iburst
# server 2.debian.pool.ntp.org iburst
# server 3.debian.pool.ntp.org iburst
Test afterwards by calling the ntptime command (run as root). It should look like this:
ntp_gettime() returns code 0 (OK)
time cc5e6a21.5f5d5000 Tue, Aug 26 2008 13:40:17.372, (.372518),
maximum error 1299815 us, estimated error 646 us
ntp_adjtime() returns code 0 (OK)
modes 0x0 (),
offset -141.000 us, frequency -36.781 ppm, interval 1 s,
maximum error 1299815 us, estimated error 646 us,
status 0x1 (PLL),
time constant 6, precision 1.000 us, tolerance 512 ppm,
You can verify that your system clock was set ok now by calling the date command.
I was going to write a whole lot of howto here. But why do that when you can just link to the Tomcat Wiki?
The wiki that shows you how to enable remote debugging is found here.
Here is a guide to building ejb3 applications with maven2 (from scratch). We will not be using any maven archetypes/templates but do it by hand to get a project that is as clean as possible.
First create a directory that will contain all the modules the ear file consists of. It will contain all the basic info the other projects/modules need to inherit from.
Create the pom.xml file in the directory and update it with something like the following:
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>your.group.id</groupId>
<artifactId>your-artifact-name</artifactId>
<packaging>pom</packaging>
<name />
<version>0.0.1-SNAPSHOT</version>
<description />
<modules>
<module>ear</module>
<module>war</module>
<module>ejb-jar</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Then create the subdirectories ( I named them ear, war and ejb-jar in this case ) for the modules.
ejb-jar pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>ejb-sample</artifactId>
<groupId>your.group.id</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>your.group.id</groupId>
<artifactId>ejb-jar</artifactId>
<name />
<version>0.0.1-SNAPSHOT</version>
<packaging>ejb</packaging>
<description />
<dependencies>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb</artifactId>
<version>3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<configuration>
<ejbVersion>3.0</ejbVersion>
</configuration>
</plugin>
</plugins>
</build>
</project>
war pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>ejb-sample</artifactId>
<groupId>your.group.id</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>your.group.id</groupId>
<artifactId>war</artifactId>
<packaging>war</packaging>
<name />
<version>0.0.1-SNAPSHOT</version>
<description />
<dependencies>
<dependency>
<groupId>your.group.id</groupId>
<artifactId>ejb-jar</artifactId>
<type>ejb</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>yourWarName</finalName>
</build>
</project>
ear pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>ejb-sample</artifactId>
<groupId>your.group.id</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>your.group.id</groupId>
<artifactId>ear</artifactId>
<packaging>ear</packaging>
<name />
<version>0.0.1-SNAPSHOT</version>
<description />
<dependencies>
<dependency>
<groupId>your.group.id</groupId>
<artifactId>ejb-jar</artifactId>
<type>ejb</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>your.group.id</groupId>
<artifactId>war</artifactId>
<type>war</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>codehaus snapshot repository</id>
<url>http://snapshots.repository.codehaus.org/</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>your-ear-name</finalName>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<modules>
<ejbModule>
<groupId>your.group.id</groupId>
<artifactId>ejb-jar</artifactId>
</ejbModule>
<webModule>
<groupId>your.group.id</groupId>
<artifactId>war</artifactId>
</webModule>
</modules>
<jboss>
<version>4</version>
<loader-repository>your.group:archive=your-ear-name.ear</loader-repository>
</jboss>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>0.3-SNAPSHOT</version>
<configuration>
<container>
<containerId>jboss4x</containerId>
<type>remote</type>
</container>
</configuration>
</plugin>
</plugins>
</build>
</project>
This is basically the project structure. I hope to create a downloadable archetype of this structure so you can start with this by running the mvn archetype plugin for easy use.
1. Follow the basic guide posted here.
2. Be sure to install python-mysqldb package.
3. Create MySQL database and user for trac.
CREATE DATABASE trac;
CREATE user trac IDENTIFIED BY 'trac';
GRANT ALL privileges ON trac.* TO 'trac'@'%';
4. Run the following command:
trac-admin <Your project dir> initenv
5. When asked for the MySQL connection url enter something like the following:
#form: db-type://username:password@mysql-host:mysql-port/databasename
mysql://trac:trac@localhost:3306/trac
6. Configuring Apache2 (Make sure you have mod_python)
<Location /trac/test>
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /var/trac/test
PythonOption TracUriRoot /trac/test
</Location>
<LocationMatch "/trac/[^/]+/login">
AuthType Basic
AuthName "Trac"
AuthUserFile /var/trac/trac.htpasswd
Require valid-user
</LocationMatch>
7. Add admin login data
htpasswd -c /var/trac/trac.htpasswd admin
8. Grant TRAC_ADMIN to admin user
trac-admin /var/trac/test permission add admin TRAC_ADMIN
Well here we are once again. This time to conquer the pile of paper laying besides, on and under your desk. My girlfriend went nuts by the sheer load of paper laying around everywhere. I’m kind of messy but when I start to organize things I’m kind of a perfectionist. So here I went and put all the papers in one big pile.
After going through the pile I realized that there were a lot of papers worth trowing away but at the same time we’re worth keeping. A dilemma. So I had a good cold beer and started thinking about the situation. The beer worked like oil on the brains and I came up with a good solution. ‘Let’s scan this pile of toiletpaper!’ and so I provided my HP 7310 with some juice and put all the paperwork on the automatic paper input of the device. I inserted an empty SD-Card and started gaming while the HP started to do what it was made for.
After a few hours ( well actually the scanner was long done before that… plz don’t tell my girlfriend
) the scans were complete and I put the files on my debian server. So far so good. Now at least I had a backup of all the paper versions. After that I was rather satisfied and threw away a large pile of paper I no longer needed as I had a digital backup now.
But a real geek doesn’t stop here. What I wanted next was to be able to search through my digital paperwork fast and get the papers that I need. So I had a look and found that there is a great open source ocr package called tesseract. I downloaded some packages and started trying out some things. I found out that it was only capable of handling tiff images at this point and that it was best to avoid color in the images. To get the required images I installed ImageMagick to do the converting from jpg to grayscale uncompressed tiffs.
So far so good. This will result in a txt file containing the text in the file. Pretty neat. Now I can use grep to look for any string matches and then open the matching jpg. Easy as 1,2,3.
After this I created the following script that will parse any new images automatically with the ocr software.
#!/bin/bash
basedir="/share/downloads/Scans"
# Parses a scan if not already processed
# $1 = JPG file
parse_scan(){
jpg_file=$1
base_name=${jpg_file:0:(${#jpg_file}-4)}
tif_file=$base_name.TIF
txt_file=$base_name.txt
# If tiff file does not exist, use imagemagick to convert
if [ ! -e $txt_file ]; then
echo "Converting: $jpg_file into $tif_file"
# echo $base_name
# echo $tif_file
# echo $txt_file
# Convert jpg into tiff file
convert $jpg_file -format tiff -colorspace gray -depth 8 -compress none $tif_file &> /dev/null
# Use tesseract for ocr on tiff file
tesseract $tif_file $base_name -l nld &> /dev/null
# Remove tiff file
rm $tif_file &> /dev/null
fi
}
for file in $basedir/*; do
filename=$file
length=${#filename}
if echo $filename | grep -q '.jpg$'; then
# Create TIF filename
parse_scan $filename
elif echo $filename | grep -q '.JPG$'; then
# Create TIF filename
parse_scan $filename
fi
done
You can of course make the basedir an argument which can be passed into the shell script. But that is a personal choice. Now you can get rid of your pile of paper too. Let’s start recycling that pile of paper.
In our project we are using BlazeDS in conjunction with Spring 2 and Hibernate 3. When we send Hibernate objects accross we sometimes get that proxied objects get sent as ‘ClassName$$EnhancerByCGLIB’.
This results in coercion errors on the flex end when the sent objects are being converted into the bound flex objects. To fix this I found the solution on the following page:
Adobe Forums
We use the first solution there:
package com.famvdploeg.util.blazeds;
import flex.messaging.io.BeanProxy;
import flex.messaging.io.PropertyProxyRegistry;
import org.hibernate.proxy.HibernateProxy;
/**
* This class makes BlazeDS uses the real entity classname instead of the hibernate proxy classname,
* this is needed so the entity can be used as a value object (RemoteClass) in flex,
* else flex will give a type coercion error because the classname mismatches.
*
* See the following thread on the BlazeDS forum for more information:
* http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=72&catid=667&threadid=1335887&enterthread=y
*
* @author Steven De Kock
*/
public class HibernatePropertyProxy extends BeanProxy{
private static final long serialVersionUID = 1612371743382649972L;
/**
* Registers this class with BlazeDS to handle HibernateProxy instances
*/
public HibernatePropertyProxy() {
super();
PropertyProxyRegistry.getRegistry().register(HibernateProxy.class, this);
}
/**
* Get actual name instead of cglib class name with $$enhancerByCglib in it.
*/
protected String getClassName(Object o) {
if (o instanceof HibernateProxy) {
HibernateProxy object = (HibernateProxy) o;
return object.getHibernateLazyInitializer().getEntityName();
}
else {
return super.getClassName(o);
}
}
}
Although the referenced site states that we should be wary of any lazy initialization exceptions I don’t think that is a problem. This is because the serialization process is taking place behind an opened Hibernate session in our current setup and the proxied objects are still attached to the session. So using this fix works for us.
Oh yeah, don’t forget to load the bean from your spring context. 
Put in the following line of xml in your spring context xml.
<!-- Initialize the hibernatePropertyProxy handler so flex gets actual class name instead of $$enhancerbycglib -->
<bean id="hibernatePropertyProxy" class="com.famvdploeg.util.blazeds.HibernatePropertyProxy"/>