Wednesday, October 17, 2007

Regular Expression for IP-Format

Here is the Regular Expression for the IP-Format. I used it for grepping different IPs from Apaches access.log

[0-9]*[0-9]*[0-9][.][0-9]*[0-9]*[0-9][.][0-9]*[0-9]*[0-9][.][0-9]*[0-9]*[0-9]

The only limitation is, that it's not delimited to 255.255.255.255 --> IP 999.999.999.999 will also be found :-)

Monday, October 15, 2007

Maven Plugin for Eclipse 2

On September 17th the new Version 0.0.11 of m2eclipse was released. This Version DOES fix the bug mentioned on August 16th
Goal "site" now works within Eclipse.

Monday, October 01, 2007

OnMouseOver Tooltip Popup with CSS

Found a real good Article on how to use CSS for a OnMouseOver Tooltip on Websites http://www.hot-elle.de/2007-02-21/css-onmouseover-tooltippopup/

Thursday, August 16, 2007

Maven Plugin for Eclipse

After migrating my whole Project to maven 2.0 I experienced the following problem with the m2eclipse plugin (latest stable relase 0.0.10):
By running goal "site" I got the following error

Failed to configure plugin parameters for: org.apache.maven.plugins:maven-javadoc-plugin:2.3

on the command line, specify: '-DdocletArtifact=VALUE'

Cause: Class name which was explicitly given in configuration using 'implementation' attribute: 'org.apache.maven.plugin.javadoc.options.DocletArtifact' cannot be loaded

First I thought, I did something wrong with my POM. After googling around and trying some different configuration I found out, that the error occurs only when called from within Eclipse. The command Line call worked perfect.
Seemingly this bug is fixed with version 0.0.11. Because Version 0.0.11 is still a Development Version and the Command Line Call works fine, I will NOT validate this statement. I only wrote this Posting, because when googling for the error message I got no help (except a Chinese Site where I got some translational Problems)

Tuesday, July 31, 2007

Change Default Page of Tomcat

In Tomcat 5.5 you have to add the following line INSIDE your HOST element in ther server.xml

<Context path="" docBase="myApp" debug="0"/>

This is better than copying your application in the ROOT directory.
When googling around for this problem I also found the following solution (which works, but is real stupid):
The default Application, which is situated in the ROOT directory is precompiled so they recommended to uncomment the following in .../ROOT/WEB-INF/web.xml:

<!--
<servlet>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<servlet-class>org.apache.jsp.index_jsp</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>org.apache.jsp.index_jsp</servlet-name>
<url-pattern>/index.jsp</url-pattern>
</servlet-mapping>
-->


to remove the precompilation. When you now edit the index.jsp it takes effect. So you only have to add a redirect in the index.jsp and voila :-)

Friday, July 13, 2007

Install JadClipse

You need it seldom, but it's nice to have one: a Decompiler.
JadClipse is a plugin for eclipse to implement jad into the Eclipse-IDE
First you need to downlod jad (1.5.8g) and JadClipse (i took JadClipse 3.2.4 for Eclipse 3.2).
Extract the downloaded jad*.zip to your preffered location.
Copy the downloaded net.sf.jadclipse_3.2.4.jar to your eclipse plugins directory and restart Eclipse with the -clean parameter (on windows: eclipse.exe -clean).
Go to Windows --> Preferences --> Java --> JadClipse and check the "Path to decompiler" that it points to the Jad-Executable (on windows: jad.exe)
Next check the File Association of *.class files under Windows --> Preferences --> General --> File Associations that they point to JadClipse.
Have Phun :-)

Monday, July 09, 2007

Automated FTP-Put in Shell-Script

If you want to make an automated FTP-Put just use the next few lines in your Shell-Script.

#!/bin/sh
echo -e "open ftp.example.com\nuser ftpuser ftppasswd\nbin\ncd toDirectory\nput file.example" |ftp -n

Wednesday, June 20, 2007

SvnAnt Recipe

When you want to use SvnAnt, you have to put svnant.jar, svnClientAdapter.jar and svnjavahl.jar (if you have not explicitly set javahl="false" in your svn-call) in your ANT_HOME directory.
Next is to announce the usage of svn in your Ant-File:

<taskdef resource="svntask.properties">

But this all doesn't work, if you haven't put your subversion bin directory to your PATH Variable.
When you have forgotten this you get the error-Message:
"Cannot use javahl nor command line svn client"

Usage of the svn task is then for example:

<svn username="user" password="secret" javahl="false">
<checkout url="https://checkout.com" destpath="//destPath"/>
</checkout>

Monday, June 11, 2007

Subversion & Ant

Today I experienced a little Problem with Subversion and my own Ant build.xml.
Subclipse added my WEB-INF/classes directory to the repository and my build.xml deleted this directory before building it new. Therefore also the .svn directory was deleted and I always got the error message:
Working copy not locked; this is probably a bug, please report
When googling around I found some newsgroup entries, saying I shall retrieve my old .svn directory
...
...
...
Very funny.
The only way to restore my workspace was to synchronize my latest changes step by step, then delete the whole Project in workspace, remove the class directory DIRECTLY from the SVN-Repository and checkout the Project again.

Tuesday, June 05, 2007

Java Property-Files

Things I learned for today:
  • When using a .property file, be careful to use exactly the same key than in code.
  • When using a .property file, don't forget to remove quotes from your copied String.

Java Obfuscator

... don't know if I need an Obfuscator sometimes, but here is a Link for all possible open-source and commercial Ofcuscators ...

Tuesday, May 29, 2007

Network Problems with Eclipse Software-Updater

After a successful installation of some plugins in Eclipse 3.2 I tried to install some additional Plugins. After "Help --> Software Updates --> Find and Install --> Search for new features to install" and pressing "Finish" after selecting a Plugin Site i got the following Error Message:
"Network connection problems encountered during search"
when I switched to Detail-View I got: "Unable to access http://..."

Neither restarting Eclipse nor restarting my computer had any effects on this error.
When I selected: "Windows --> Preferences --> Install / Update" and did ANY change there, the Update Process was working again.
My decision: Eclipse stores the selected mirror anywhere in the .metadata and does this WRONG. After applying any change in the Install/Update properties, the mirror-link is lost and the installer works again

Monday, March 05, 2007

Eclipse Startup-Parameter

eclipse.exe -clean -vmargs -Xms240m -Xmx240m
-clean --> Enables clean registration of plug-in (some plug-ins do not always register themselves properly after a restart)

-vmargs --> Allows you to pass in standard VM arguments
  • Xms --> Minimum VM-Memory
  • Xmx --> Maximum VM-Memory

Wednesday, January 10, 2007

OutOfMemoryException with large Ant JUnit TestSuite

With large TestSuites Ant sometimes runs out of memory.
You can prevent this by increasing the Ant Memory. Simply type:
"export ANT_OPTS=-Xmx512M" on your console

Tuesday, August 22, 2006

Blackdown Java vs. Sun Java

Found an interesting "bug" (it isn't a real bug, but choose yourself): If you have a Date (no matter if java.sql.Date or java.util.Date) in Daylight-saving Time before 1981 Blackdown chooses the historical way (no Daylight saving Time between 1948 and 1980) and Sun does ignore this historical point.
This isn't a real problem until you mix up the two distributions (eg. client-server application)

Wednesday, May 03, 2006

Problems with keep-together.within-page="always" for preventing Page-Breaks

I know this Blog has more to do with xsl:fo than with Java but I had another Problem with my Stylesheet.
I wanted to add keep-together.within-column="always" to a <fo:table> tag but it did'nt keep the block together. So I googled and found out , that you have to add
keep-with-next="always" to your <fo:table-row> tag
For example :
<fo:table-row keep-with-next="always">

Thursday, March 30, 2006

db2 - SQL Tutorial

In search for a "group-by" howto I found a nice german
db2 - SQL-Tutorial

Edited 07.03.07:new Link db2 SQL Tutorial

Monday, March 27, 2006

Eclipse Shortcuts

I don't know, what a single PDF has lost on sourceforge, but it is real great!
http://eclipse-tools.sourceforge.net/shortcuts.html

Wednesday, March 22, 2006

Page XX of XX with xsl-fo

If you want the Page-number in a XSL you use <fo:page-number>
but what if you want the pagenumber followed by the total pagenumber ?
the trick is to add <fo:page-number-citation ref-id="endofdoc"/> with the tag
<fo:block id="endofdoc"/> at the end of the stylesheet.

Tuesday, March 21, 2006

Prevent Pagebreak with xsl-fo

If you want to prevent Pagebreak within a fo:table-row you have to add the following attribute to your row:
<fo:table-row column="always">
Other possible values than "always" are:
  • auto ... no restrictions for page break
  • Integer-Values ... e.g. 3. No Pagebreak if there is no other, stronger pagebreak requirement
keep-together. can also be used with
  • within-column for pagebreak in one line
  • within-page for pagebreak in one page
the Attribute can be added to
  • fo:basic-link
  • fo:block
  • fo:block-container
  • fo:inline
  • fo:inline-container
  • fo:list-block
  • fo:list-item
  • fo:list-item-body
  • fo:list-item-label
  • fo:table
  • fo:table-and-caption
  • fo:table-caption
  • fo:table-row