Tuesday, March 27, 2007

Creating multithreaded tests for JUnit

Sometimes (I hope) you discover code you've written that was not as thread safe as you thought it was. Testing this can be quite a painful experience. I just found this article on Java World describing ways to create JUnit tests in a multithreaded environment. Looking at the date it was published, the article is quite old, so I was wondering if maybe there are better techniques than those described in the article.

Monday, March 26, 2007

Remove copy protection from PDF documents

This is probably illegal, so use it at your own risk.
Some PDFs on the internet have a copy protection to make sure you cannot copy-paste any content from the PDF into a document you're writing. To circumvent this protection there are several tools available on the internet. I haven't tried any of them, because they're not free ;)
There is however a procedure that will enable you to circumvent the copy protection using free tools. The trick is to convert the PDF to a PS (PostScript) document first and then convert it back into a PDF.
So, download Ghostview en Ghostscript from: http://www.cs.wisc.edu/~ghost/.
Next, open your PDF in Ghostview.
Next, from the "File" menu, select "Convert" (a dialog will pop up)
Press "Ok"
Fill in the name of the "converted" file.
Press "Save"
Tada, you can now copy content from your newly created PDF ;)