Wednesday, February 24, 2010

mysql - adding one year quickly

I don't want to forget how to add one year (or any interval) so I'm making a note.

DATE_ADD functions in MySQL always seem to get me since Sybase seems so different (but probably isn't that much). Plus, I was being very smart and keep trying to put a + instead of a ,. Silly Rabbit!

Here it is: SELECT DATE_ADD(NOW(),INTERVAL 1 YEAR)

An update to set expiration date 1 year into the future:

UPDATE mytable SET exp_timestamp = DATE_ADD(NOW(), INTERVAL 1 YEAR)

Monday, February 1, 2010

Quick way to disable table header in JTable

Last week was Java week. It involved quickly adding a new tab to an existing Java applet application. The layout has a nice larger table header section and allows for the table itself to have a sub-header.

That is pretty slick. Until you don't need a sub-header :). After a bit of searching I found a pretty Perl-ish way to disable table headers in Java's JTable.
myTable.setTableHeader(null); 
I kept looking for a disableTableHeader method.

This week its off to Excel, Web Posts and VBA again... yikes.