STaX: OutOfMemoryError when parsing big files

Java 6 includes STaX , when I tried to parse a Evernote backup file with it, I got a OOME error. java.lang.OutOfMemoryError: Java heap space at com.sun.org.apache.xerces.internal.util.XMLStringBuffer.append(XMLStringBuffer.java:205) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.refresh(XMLDocumentScannerImpl.java:1520) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.invokeListeners(XMLEntityScanner.java:2070) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.peekChar(XMLEntityScanner.java:486) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2679) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140) at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:548) at Googling a bit I found a bug report 6536111. It says that this should be fixed in 1.6.0_14. But I tried Sun 1.6.0_16 and no luck. I got the exact same thing. ...

August 25, 2009

Adding support for opening dot files to GraphBrowser

I spent some time on GraphBrowser, starting off the project, the first step has been to add basic support for opeining Graphviz DOT files. There are already some pages on the net talking about how to add open file support for new file types in NetBeans. File Type Integration Tutorial So there is no need to explain how to do it in a detailed way. The first main step is to invoke New File Type wizard on the module (in my case MainModule) to add the basic files to support the file type. ...

July 22, 2009

Example of XBee API frames

Some examples of XBee API Frames. Modem status frame 7E 00 02 8A 06 6F 7E : API Frame 00 02 : Length 8A : Modem status 06 : Coordinator started 6F : checksum FF – ((8A +06) & FF) = 6F AT Command API Frame: MY 7e 00 04 08 52 4D 59 FF 7E : API Frame 00 02 : Length 08 : AT Command Frame id 52 : Frame id 4d 59 : MY (4d 59) (4d ⇒ M, 59 ⇒ Y) Get the 16-bit network address of the module. FF : checksum ff = ff – ((08+52+4d+59) & ff) AT Command Response: MY 7e 00 07 88 52 4d 59 00 00 00 7f 7E : API Frame 00 07 : Length 88 : AT Command Response API Identifier 52 : Frame id 4d 59 : MY (4d 59) (4d ⇒ M, 59 ⇒ Y) Get the 16-bit network address of the module. 00 : Status 0=OK 00 00 : MY value, 00 000 not set 7f : checksum ff = ff – ((08+52+4d+59) & ff) Explicit Addressing Zigbee Command Frame: 7E 00 1D 11 01 00 13 A2 00 40 3E 25 75 00 00 01 01 04 02 01 04 00 00 18 01 01 00 00 00 29 63 CE 9F 7E : Start frame 00 1D : Length (29 bytes) 11 : explicit addressing transmit 01 : Frame id 00 13 A2 00 40 3E 25 75 : 64 bit address 00 00 : 16 bit address 01 : source endpoint 01 : destination endpoint 04 02 : cluster id (temperature measurement cluster id/ Measurement and sensing functional domain) 01 04 : profile id (home automation profile) 00 : broadcast radius 00 : options 18 01 01 00 00 00 29 63 CE : payload 9F : checksum Let’s analyze the payload ...

March 12, 2009

How to hide/remove the Save, Undo and Redo buttons on the Toolbar (Netbeans Platform)

The default Netbeans Platform Application generated by the Netbeans IDE wizard has the Save, Undo and Redo button showing up in the toolbar by default. Since my applications doesn’t have anything to save I decided to hide those buttons. I turns out that remove them is really simple, I knew that I had to fiddle with the layer.xml file and hide something but I didn’t know exactly what. At the end I found the solution buried in this A NetBeans Platform Sample and Tutorial. ...

March 8, 2009

Google maps is easy

I decided to give a try to Google Maps API and I found it pretty easy. Currently I’m looking for a jiu-jitsu school near Madrid so I decided to pinpoint all jiu-jitsu schools in a google map. I’ve got the school addresses in this page and put those directly in the page using the geocoder api. Here’s the result, you can see all the code using View Source in the browser menu it’s all embedded javascript.

September 4, 2006