EN4J 1.0M2 released - Evernote Java Client

I finally decided to release the project I was working on the last year: A java desktop client for the Evernote service. The distributions for Mac OS X, Linux and Windows can be found on the downloads page. And the source code can be accesses and forked from the git repository on github. The README for EN4J-1.0M2 EN4J What is it? ----------- EN4J is a client to the Evernote services written in Java. It designed to become a replacement to the Evernote client for Windows & Mac. Although currently EN4J is a read-only client and cannot fully replace the official Evernote client. Features -------- * Fast search based on Lucene * Indexing of word documents, zip files, etc. All doc types supported by Apache Tika * Based on Netbeans Platform, runs on Windows, Mac OS X and Linux * Open source TO DO ----- * Editable notes * tags * Keyring api * Rich-text clipboard copy * Ignore diacritical marks during search Bugs ---- If you find any write a bug report on http://github.com/ecerulm/en4j/issues How to build and install ------------------------ First, grab the source from github git clone git://github.com/ecerulm/en4j.git Then proceed to the main directory cd en4j/NBPlatformApp to build the windows zip distribution do ant build-zip to build the mac os x distribution do ant build-mac Then take the output file in NBPlatformApp/dist Contribute ---------- Just fork the project from http://github.com/ecerulm/en4j and send me a pull request with the changes. Licensing --------- Please see the file called LICENSE. Credits ------- Netbeans team for the Netbeans Plaform and Netbeans IDE icons: Tango Icon Library http://tango.freedesktop.org/Tango_Icon_Library icons: Nuvola http://www.icon-king.com/projects/nuvola/ icons: Crystal project http://www.everaldo.com/crystal/ icons: Addictive Flavour. Designed by Mirjami Manninen (http://www.mirkku.com). www.smashingmagazine.com icons: Bunch of Cool Bluish ICONS http://mebaze.com/ GlazedLists: http://publicobject.com/glazedlists/ Apache Thrift: http://incubator.apache.org/thrift/ TimingFramework: https://timingframework.dev.java.net/ Flying Saucer: https://xhtmlrenderer.dev.java.net/ Apache Tika: http://tika.apache.org/ Apache Commons Collections: http://commons.apache.org/collections/ Apache Commons IO: http://commons.apache.org/io/ Apache Commons Math: http://commons.apache.org/math/ Evernote API: http://www.evernote.com/about/developer/api/ Joda Time library: http://joda-time.sourceforge.net/ NekoHTML: http://nekohtml.sourceforge.net/ renderpack: https://renderpack.dev.java.net/ SLF4J: http://www.slf4j.org Woodstox: http://woodstox.codehaus.org/

July 27, 2010

Getting rid of the grey empty area on your Netbeans Platform Application (RCP)

The short answer is that the gray area that you are seeing in lower bottom of the window is actually the editor area (aka document area) and you can hide it by adding run.args.extra=-J-Dnetbeans.winsys.hideEmptyDocArea=true to your platform.properties file. Or by calling System.setProperty("netbeans.winsys.hideEmptyDocArea", "true"); from one of your module’s Installers. That’s all you need to know but if you are interested on getting some details and references continue reading. If you create a new Netbeans RCP application and only add TopComponents to modes other than editor (modes which kind=“view”) then you will end up with an empty document area (could be at the bottom, top, left, right or in between TopComponents depending which modes you placed the TCs on). But first, you ask, how do I assign TopComponents to modes? Well you do that in the new Window wizard for example ...

July 3, 2010

NullPointerException when using hideEmptyDocArea

When I put run.args.extra=-J-Dnetbeans.winsys.hideEmptyDocArea=true in my project.properties I got a NullPointerException (NPE) at startup. I though it was a bug and I reported it but then I realized that I got the NPE because I had removed/hidden also the editor.wsmode in my layer.xml ... ... <folder name="Windows2"> <folder name="Modes"> <folder name="editor_hidden"/> <file name="editor.wsmode_hidden"/> </folder> </folder> ... ... As soon as I removed those entries from the layer.xml hideEmptyDocAre worked perfectly.

July 3, 2010

Lucene 2.9.0/3.0.1 memory leaks

If you are experiencing high memory comsumption with Lucene 2.9.0/3.0.1 it could be due… ... to a recently reported and fixed bug in StandardTokenizer where JFlex generated code was expanding a buffer (zzBuffer) and never trimming it down Uploaded with plasq's Skitch! ... to another recently reported and fixed bug where IndexWriter held references to Readers used in your Fields, (and if you have apache tika's reader, those can take up a lot of space) Uploaded with plasq's Skitch!

April 10, 2010

Building Apache Tika 0.6 fails if the locale is not en_US

I tried to build Apache Tika 0.6 yesterday and I couldn’t build it because the tests failed. The failing tests were testExcelParserFormatting(org.apache.tika.parser.microsoft.ExcelParserTest) testExcelFormats(org.apache.tika.parser.microsoft.ooxml.OOXMLParserTest) and the failure had to to with the fact that the locale was “es_ES” and the numbering format differs ("1.599,99" and not “1,599.99”) $ mvn -version Apache Maven 2.2.0 (r788681; 2009-06-26 15:04:01+0200) Java version: 1.6.0_17 Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home Default locale: es_ES, platform encoding: MacRoman OS name: "mac os x" version: "10.6.2" arch: "x86_64" Family: "mac"@ I changed the locale temporarily to be able to build ...

March 10, 2010

Cancellable tasks and progress indicators [Netbeans Platform]

Progress indicator (indeterminate mode) which allows to cancel the task The easiest way of having a cancellable progress indicator (Progress API) for a task in Netbeans Platform Application is the one below but it’s only worth for tasks that don’t update the progress indicator (indeterminate mode) until the task is finished. If you want to update the progress indicator (ProgressHandle) inside the task itself look at the second example. ...

January 18, 2010

OpenJPA, HSQLDB and proper shutdown

I’m starting to get tired of OpenJPA/HSQLDB setup that I’ve trying: it seems to give more problems than it solves. Now I discovered that the HSQL db wasn’t been properly shutdown and for reasons that I’m investigating, if the HSQL db is not propertly closed (SHUTDOWN command) it’s impossible to reopen it again. It fails with a IndexOutOfBoundsException. Caused by: org.hsqldb.HsqlException: error in script file line: 33 java.io.IOException: java.lang.IndexOutOfBoundsException in statement [SET TABLE PUBLIC.NOTES INDEX '2883070'] at org.hsqldb.Error.error(Error.java:111) at org.hsqldb.scriptio.ScriptReaderText.readDDL(ScriptReaderText.java:132) at org.hsqldb.scriptio.ScriptReaderBase.readAll(ScriptReaderBase.java:88) at org.hsqldb.persist.Log.processScript(Log.java:721) at org.hsqldb.persist.Log.open(Log.java:187) at org.hsqldb.persist.Logger.openPersistence(Logger.java:209) at org.hsqldb.Database.reopen(Database.java:265) at org.hsqldb.Database.open(Database.java:235) at org.hsqldb.DatabaseManager.getDatabase(DatabaseManager.java:222) at org.hsqldb.DatabaseManager.newSession(DatabaseManager.java:145) at org.hsqldb.jdbc.JDBCConnection.<init>(JDBCConnection.java:3219) ... 59 more Annoying. This is not OpenJPA fault, but it gets complicated to actually solve it. ...

January 14, 2010

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. ...

January 13, 2010

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 ENMLNamespaceHandler.java below) .... XHTMLPanel panel = new XHTMLPanel(); panel.setDocument(doc,"",new ENMLNamespaceHandler(new XhtmlNamespaceHandler())); .... class ENMLNamespaceHandler implements NamespaceHandler { .... public String getNonCssStyling(Element e) { String toReturn = delegate.getNonCssStyling(e); if ("en-media".equalsIgnoreCase(e.getNodeName())) { toReturn = "display: block;"; } return toReturn; } .... } With that you ensure that xhtmlrenderer will call ReplacedElementFactory.createReplacedElement for en-media. Now you must supply a ReplacedElementFactory that it’s able to process en-media. Usually the implementation of the createReplacedElement() involves creating a Swing JComponent, wrapping it in a SwingReplacedElement and adding it to the LayoutContext.getCanvas(). ...

November 15, 2009

Disable DOM DTD validation

setValidating(false) will not prevent DTD validation, but you can set http://apache.org/xml/features/nonvalidating/load-external-dtd 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("http://xml.org/sax/features/external-parameter-entities", false); // it doesn't work factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); DocumentBuilder parser = factory.newDocumentBuilder(); Document doc = parser.parse(getClass().getResourceAsStream("ennote.xml")); Typical DTD not found exception stacktrace java.io.FileNotFoundException: /Users/ecerulm/NetBeansProjects/en4j/NBPlatformApp/DTD/xhtml1-strict.dtd (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:653) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1315) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1282) at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:283) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1193) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1090) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1003) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124) at com.rubenlaguna.en4j.NoteContentViewModule.NoteContentViewTopComponent.resultChanged(NoteContentViewTopComponent.java:141) ... ... http://xerces.apache.org/xerces2-j/features.html#nonvalidating.load-external-dtd http://xerces.apache.org/xerces2-j/features.html#external-parameter-entities http://forums.sun.com/thread.jspa?threadID=284209&forumID=34 http://lists.xml.org/archives/xml-dev/200101/msg01055.html

October 25, 2009