Ruben Laguna's blog

Jan 13, 2010 - 4 minute read - Comments - beans beansbinding binding database db java jtable lazy loading pagination swing

JTable bound to a database with lazy loading

I’ve been doing experiments with JTables bound to database tables in the past. But I was not satisfied with the result to be honest. The pagination helps but there is still noticeable pauses each time a database query has to be issued. So I started looking into other possibilities. I come up with the idea of doing lazy loading and presenting some fake data until the data is really retrieved from the database, I did a small proof of concept and seems to work ok.

Jan 3, 2010 - 2 minute read - Comments - blinklist bookmarks comma separated values csv delicious html migrating migration ruby script tab

Migrating from Blinklist to CSV to HTML

Apparently blinklist doesn’t export bookmarks to JSON format any longer and delicious has changed authentication scheme for its delicious API for new accounts (now it forces new users to use the OAuth / Yahoo ID). So the solutions described in this old post of mine doesn’t work. So given the current state of affairs the only way to get your bookmarks out of Blinklist is CSV (actually tab-separated) and the only easy way to import them to delicious is to use the HTML import.

Nov 16, 2009 - 1 minute read - Comments - netbeans

Two netbeans bugs at the same time

It seems that source attachement for Library Wrapper Modules in Netbeans 6.8 Beta doesn’t work properly. I opened a bug report here and it seems that in the process I also spotted that “Swing Layout Extensions” library definition that comes with NB 6.8 it’s also wrong (see

Nov 15, 2009 - 4 minute read - Comments - block flying flyingsaucer java replacedelementfactory sauce xhtmlrenderer

How to handle custom tags using Flying Saucer

If you have a customized xhtml variant, like evernote ENML format and you want to render it with Flying Saucer R8 you must first make sure that the extra element (in ENML case, en-media) is defined as a block-level element. To do that you create your own NamespaceHandler and you make sure that you return "display: block;" for en-media in the implementation of NamespaceHandler.getNonCssStyling. (See below) .... XHTMLPanel panel = new XHTMLPanel(); panel.

Nov 1, 2009 - 1 minute read - Comments - encode incorrect itunes lame length mp3 reencode wrong

Incorrect track length in iTunes

iTunes was reporting a incorrect track time length for an audiobook that I created concatenating several mp3 together. I had to reencode the whole thing again to make iTunes recognize propertly the track lenght. I could’t reencode the concatenated file itself as that ended up with a Segmentation fault in lame cat *.mp3 |lame --mp3input - - >resultfile.mp3 cat *Night.mp3 |lame --mp3input - down.mp3 ID3v2 found. Be aware that the ID3 tag is currently lost when transcoding.

Oct 25, 2009 - 1 minute read - Comments - disable dom dtd java load parser validation xerces xml

Disable DOM DTD validation

setValidating(false) will not prevent DTD validation, but you can set feature to false. I think is a Xerces-only feature, though, it may not be recognized by other parsers. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); //factory.setFeature("", false); // it doesn't work factory.setFeature("", false); DocumentBuilder parser = factory.newDocumentBuilder(); Document doc = parser.parse(getClass().getResourceAsStream("ennote.xml")); Typical DTD not found exception stacktrace /Users/ecerulm/NetBeansProjects/en4j/NBPlatformApp/DTD/xhtml1-strict.dtd (No such file or directory) at Method) at<init>( at java.

Oct 1, 2009 - 1 minute read - Comments - build build.xml classes classpath compile jaxb netbeans project schema target taskdef xjc xml

Netbeans: Compile schemas into JAXB classes with XJC task

To add a XJC task to a Netbeans build.xml you need to add a -pre-compile target to your build.xml. If it’s a netbeans module build.xml then you need to make compile depend on -pre-compile and projectized-common.compile (see example below). For regular Java Applications just define the -pre-compile target as the standard build.xml will call -pre-compile before compile. Then it’s just a matter of defining the <taskdef> with the proper classpath to the jaxb’s jars.

Sep 28, 2009 - 1 minute read - Comments - cce classcastexception java jaxb jaxbcontext netbeans parser woodstox

Netbeans & woodstox: ClassCastException: JAXBContextImpl cannot be cast to JAXBContext

Are you getting a ClassCastException in a Netbeans Platform Application, when you are you sure that the class can be casted? Then check This is most likely the result of the the classes being loaded by different classloaders. So JAXBContextImpl cannot be cast to JAXBContext because that JAXBContext is from Classloader “A” and JAXBContextImplcan only be cast to JAXBContextfrom Classloader “B”. SEVERE [global] java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to javax.