Tuesday, April 28, 2009

Postfix relay messages to different port

A frequent occurrence in applications is to send out emails. In order to test that behavior sufficiently during development, I usually use one of two options. On Windows you can use Mailster (preferred) or you can use postfix etc. on Mac/Linux (Have not been able to get Mailster going on my Mac)

So far on my Mac until recently it was as easy as to simply do: sudo postfix start and I was good to go. Unfortunately, my domain hoster does not accept mail on port 25 anymore. And the simple relay stopped working.

As it turns out though, you can easily relay to a different port (My hoster accepts port 26):

sudo vi /etc/postfix/main.cf
I added a line (near # INTERNET OR INTRANET):

relayhost = myHost.com:26

And finally I reloaded my postfix configuration using sudo postfix reload and I was back in business once again.

Wednesday, April 1, 2009

Woes with Oracle's Jdbc Driver and BigDecimal

As other people before me noticed, Oracle seems to have issues with BigDecimals. Well, I hit one of those issues today:
  • BigDecimal.valueOf(0.000000548) became 0.000000538 in the database
  • new BigDecimal("0.000000548") became 0.000000538 in the database
  • persisting a plain String "0.000000548" worked fine however
  • new BigDecimal("0.000000458") became 0.000000448 in the database
The table column, to which the values were saved, had plenty of "scale'n'precision".
The issue occurred in Oracle's JDBC driver version Luckily, after upgrading the drivers to version the problems went away.

This is by itself an amazing issue - Just imagine, you were running a larger financial app. You may not even notice this subtle issue until your app is long in production. Oh well...