Monday 26 November 2007

Nohup and sqlplus for long oracle batch jobs

To run a batch job in oracle. You want to use nohup, redirect the nohup.log etc.

nohup sqlplus [user]/[pwd] @[script] / -print > [logfile] &

note that the "-print >" is not to be changed

The spooling doesn't work due to the fact that the spool buffer seems to be flushed at the end of the script

Wednesday 29 August 2007

Using headers in GWT FlexTable

I'm a moron. I've been dicking around with headers in GWT FlexTable for a while. I simply added rows and used a different styleset for the headers. Then I had to subtract and add for each table operation....

The solution is (of course) to insert table headers with the DOM-class in GWT.


/**
* Initializes the table with header rows. The headers are defined by the headerModel
* This adds the header rows directly to the table, using the DOM-class. The current FlexTable implemenetation
* doesn't have headers. This uses the normal html ... syntax
*/
private void initTable() {

Element thead = DOM.createTHead();

DOM.insertChild(table.getElement(), thead, 0);

for (int row = 0; row <>

Element tr = DOM.createTR();
DOM.appendChild(thead, tr);
for (int col = 0; col <>

Element th = DOM.createTH();
DOM.appendChild(tr, th);

// NB!!!! camelback on attributes for IE or despair
DOM.setElementAttribute(th, "colSpan", String.valueOf(headerModel.getHeaderSpan(row, col)));
DOM.setElementAttribute(th, "align", "left");
DOM.setElementAttribute(th, "border", "1");

//set header text
DOM.setInnerText(th, headerModel.getHeaderText(row, col));
}
}

}

Now the number of rows, clear etc works fine. FlexTable uses "correct". The camel back IE "feature" took me a while though.

Saturday 11 August 2007

Printing protected PDF files

Once every year, I need to print a protected PDF-file. Of course I forget what I did in between. The main problem is that you can't print a protected file from the Adobe Reader even if you have the password. They want you to buy the full Adobe product
  1. Download pdfbox from sourceforge. The latest version does not work but version 0.7.0 works fine.
  2. Unzip it and go to the bin directory. Run: Decrypt.exe . And the file is printable!!
While Googling, I found the PDFCrack utility (also on sourceforge), which is used to crack pdf files. It's now running in the background. This may also work

Friday 27 July 2007

Debug on Ant/Maven

When you run (for example) jetty from ant (or maven) and want to debug. Then you'll notice that jetty is not in its own process but in the actual ant/maven process. You can set all the jvmargs you want it will still not work. I'm here talking about the mortbay´s maven-jetty-plugin. This also contains the ant task.

The workaround is:
Ant:
execute ant with the setting "--execdebug" (ant runJetty --execdebug) . This will print the command to the console. Copy/paste/edit to a script (add the debug parameters -XDebug ...). Start this particular command from this script when you want to debug.


Maven:
Whenever you want to debug. set "export MAVEN_OPTS=", to enable debug. Do this on the command line or a script that starts the shell.


Obviously we are are now debugging entire maven/ant. If anyone has a better idea, let me know.

Tuesday 24 July 2007

First post

This blog is more or less for personal use. I will post things that I should remember and I work with. I'll try to write it as informative as possible but I suppose there will be nothing real ly interesting . However if anyone find any useable, feel free to read. Also if you have some improvements, let me know by commenting!!

Huskeliste means "list with things to remember" in Norwegian.