Wednesday, February 20, 2008

BeanComparator

Sometimes you just have the requirement to sort java collections...In that case the BeanComparator from Jakarta Commons is quite handy:

ArrayList sortFields = new ArrayList();
sortFields.add(new BeanComparator("lastName"));
sortFields.add(new BeanComparator("firstName"));
ComparatorChain multiSort = new ComparatorChain(sortFields);
java.util.Collections.sort(rows,multiSort);

Friday, February 15, 2008

Email Aliases on a Linux Box

It is actually dead-simple:

vi /etc/aliases

Add your aliases like:

contact: somebody@somewhere.com

(Multiple email addresses are separated using a comma)

Afterwards run the command newaliases so that the made changes take effect.

Thus, if your server's domain is foobar.com, then any email sent to contact@foobar.com goes to somebody@somewhere.com

That's it.