Thursday, December 20, 2007

Enabling the CVS Id Tag for SVN

The CVS Id tag which adds file information on the file itself upon commit is enabled by default on CVS but not on SVN. To have it enabled you need to add/modify the following on your local SVN configuration file (on UN*X: <HOME>/.subversion/config):

[...]
enable-auto-props = yes

[...]
[auto-props]
[...]
*.java = svn:keywords=Author Date Id Revision;svn:eol-style=native

Complete list of keywords: Author, Date, Header, Id, Log, Locker, Name, RCSFile, Revision, Source, State.

Of course, you need to add a line for every file type you want to configure for a fine grained control over that. Otherwise use *.

This works for all files committed from now on. If you already have files in the repository, you need to tell SVN to add them too:
# Make sure that everything is up to date
> svn up
# Add keywords and commit
> svn propset svn:keywords "Author Date Id Rev" file_name
> svn commit -m "Adding Id and Rev property to all files"

Friday, November 16, 2007

SVN Java Project With Eclipse

If you have your source code in a SVN repository and want to set up a Java project in Eclipse (tested on the Helios release), you cannot simply do a New --> Project --> SVN --> Checkout projects from SVN.
The resulting project will not be a Java project and you won't be able, for example, to set up the build path with all its implications...

This is the way to go:
  1. Choose Window --> Open perspective --> SVN repository exploring, configure the repository.
  2. Open it and choose the trunk, a tag or a branch.
  3. Do a right-click and do a Find/Checkout As (e.g. as a Java project)

Monday, October 08, 2007

JSTL Taglib Declaration

This post is related to web application development with Spring 1.x, JSTL and Tomcat v5.5.x.
Be sure to have this configuration to be able to use JSTL:

web.xml header (remove space after <):

< ?xml version="1.0" encoding="ISO-8859-1"?>

< xmlns="http://java.sun.com/xml/ns/j2ee"
xsi="http://www.w3.org/2001/XMLSchema-instance"
schemalocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">


Taglib declaration:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

Thursday, August 23, 2007

Tomcat: Redirect all requests to port 80 on port 8080

... the IPTables way! (there are other solutions)
Configure the iptables behavior in file /etc/sysconfig/iptables-config to save the new rules

IPTABLES_SAVE_ON_STOP="yes"
IPTABLES_SAVE_ON_RESTART="yes"
IPTABLES_SAVE_COUNTER="yes"

Manually add the following rules:

> iptables -t nat -A OUTPUT -d localhost -p tcp --dport 80
-j REDIRECT --to-ports 8080
> iptables -t nat -A OUTPUT -d <your_ip> -p tcp --dport 80
-j REDIRECT --to-ports 8080
> iptables -t nat -A PREROUTING -d <your_ip> -p tcp --dport 80
-j REDIRECT --to-ports 8080


Save and restart the service:

> /etc/init.d/iptables save
> /etc/init.d/iptables restart

Thursday, June 14, 2007

Certified Procedure for Unsubscribing From a Mailing List

I recently had the following problem: I wanted to remove from a mailing list I previously subscribed to but using the unsubscribe link they provided ended up to be useless. It seemed to work but in the end I kept receiving their emails.
I never thought of writing them to be removed since in my experience it's a total waste of time.
The good news is there are other solutions!
These services always offer you the possibility to update your personal info and included with that you can change your email address. I mean, they cannot loose a "valued customer" if he decides to change his email so that update link will work!
Given that, what you can do is use one of those incredible services like Mailinator to have a one time email you can put as your new email address. Of course you will be able to answer to their confirmation request by reading the only email you will get at that address, and after that forget about the whole thing!

Thursday, May 24, 2007

Configuring Thunderbird Reply Header

The default reply header can be customized if you create the file user.js in the profile directory of your Thunderbird home (if you have Windoz, look inside the Doc&Settings/AppData/Thunderbird or something like that) and fill it with the following:

// Change the reply header
// 0 - No Reply-Text
// 1 - "[Author] wrote:"
// 2 - "On [date] [author] wrote:"
// 3 - User-defined reply header. Use the prefs below in conjunction with this:
user_pref("mailnews.reply_header_type", 3);

// If you set 3 for the pref above then you may set the following prefs.
user_pref("mailnews.reply_header_authorwrote", "%s said the following");
user_pref("mailnews.reply_header_ondate", "on %s");
user_pref("mailnews.reply_header_separator", " ");
user_pref("mailnews.reply_header_colon", ":");
// The end result will be [authorwrote][separator][ondate][colon]

Thursday, March 22, 2007

Using Apache Commons Logging and Log4j

It's as easy as this:
  1. Download the latest and the greatest from Log4J.
  2. Download the latest and the greatest from Apache Commons Logging.
  3. Add the libraries to the $CLASSPATH.
  4. Write a Log4J properties file called log4j.properties and place it in a directory in the $CLASSPATH.
  5. You can now start logging in a class simply obtaining a logger with:
    1. private static final Log log = LogFactory.getLog(YourClass.class);
  6. and using it:
    1. log.info("your logging comment");

Thursday, January 04, 2007

Converting to PDF from Openoffice (Linux)

There are basically 2 options to convert an Openoffice doc into PDF:
  1. Use File --> Export to PDF
  2. Print to file using File --> Print, which gives you a Postscript version of the doc. Then use ps2pdf to convert to PDF.
Well, what I've seen is that method 2 gives a much better result graphically speaking (with method 1, you sometimes get mingled/not correctly spaced characters), and smaller files. So, I'd really suggest you use that for the task.

Converting to PDF Under Windoz

First you need to get your doc into Postscript (PS) format. One way is to print to file using any PS printer (I use the HP Color Laserjet 8550-PS). Of course you don’t need to have it!

Install Ghostscript and Ghostview.

Open a PS file with Ghostview to be able to make the initial configuration. Choose from the menu: File –> Convert.

Select:

Device: pdfwrite

Resolution: 720

Options: -dMaxSubsetPct=100 -dCompatibilityLevel=1.2 -dSubsetFonts=true -dEmbedAllFonts=true

You’re set!

Reference: Creating PDF Files in Unix and Windows

Brand New Start!

I was about to move to another blog service because I really wanted some features (like labels) which Blogger didn't have and I had no hint they were working on them when... a brand new Blogger... with labels!
That's why I'm back ;-)
This time though it will be a whole different blog. Don't have much time to write now. But I'll occasionally blog about... anything. What there will be for sure are some computer-related tips.
Zeeya!