2008-11-21

OutOfMemoryError und MappedByteBuffer in Java6

Für die Referenzimplementierung des OSMBin-Dateiformates habe ich
mich der Eifnachheit halber dazu entschlossen, die Dateien einfach per
FileChannel und MappedByteBuffer in den Speicher zu mappen.

Ergebniss: Bei Dateigrößen über 50MB gibt es einen OutOfMemoryError.

Warum? Anscheinend hat Sun ein verstecktes Limit von 64MB für MappedByteBuffer eingebaut.
Dieses läßt sich mit der nicht dokumentierten Option -XX:MaxDirectMemorySize=???M
erhöhen.
Weiterhin werden MappedByteBuffer nicht immer anständig garbage-collected, so daß man vorher manuell System.gc() aufrufen muss.

Fazit: Funktioniert etwas besser aber noch nicht ganz.

Für das Mappen von einmal 220 und einmal 154MB reicht ein Limit von 3 GIGABYTE nicht mehr aus. Mehr als 3GB gehen aber auf einem Atom N270 nicht, da dieser ja nur 3GB Adressraum hat. PECH. :(

Also: Alles neu programmieren ohne MappedByteBuffer. :( Für Datenbanken ist dieses Verfahren untauglich, wobei gerade diese die Parade-Disziplin sein könnten.

2008-11-18

Pago-Plugin für jGnucash veröffentlicht

Hallo

und wieder ist ein neues Plugin unter der GPL3 veröffentlicht um weitere, langweilige
Buchhaltungs-Aufgaben zu automatisieren.
Ein Plugin für Pago ist für jGnucashLib veröffentlicht:

https://apps.sourceforge.net/mediawiki/jgnucashlib/index.php?title=PagoPlugin

https://apps.sourceforge.net/mediawiki/jgnucashlib/index.php?title=Main_Page

Es kann automatisch alle noch nicht heruntergeladenen Abrechnungen
und Zusammenfassungen herunterladen für Kreditkarten-Akzeptanz via
Pago von der passwort-geschützten Website herunterladen
* Dann diese PDF-Dateien in Text konvertieren.
* Den Text parsen und die Disagio-Splits aus existierenden Transaktionen
überprüfen und bei Bedarf korrigieren. (z.B. wenn man beim Buchen noch nicht
wusste ob es Visa oder Mastercard ist mit ihren unterschiedlichen Disagio-Sätzen waren.)
* Jedes "TODO: Disagio" wird bei diesen Transaktionen aus dem Kommentar entfernt.
* Neue Dummy-Transaktionen mit dem korrekten Saldo für das Assets:..:Pago -Konto und das
Konto mit den Sicherheiten werden angelegt um auf einen Blick zu sehen ob alles stimmig ist.
* Diese Dummy-Buchung sagt auch ob alle Transaktionen der PDF gefunden wurden und welche fehlen.
* Und sie sagt wie weit das Saldo in Gnucash vom korrekten Wert entfernt ist. (Um schnell die fehlende oder
falsche Transaktion zu finden statt alles mühsam von Hand am Monatsende abzugleichen.)
* Die heruntergeladenen PDF-Dateien werden natürlich lokal archiviert.

Voraussetzungen:
* Funktioniert so natürlich nur für Gnucash-Nutzer, die ihre Kreditkarten-Akzeptanz über Pago machen,
kann aber als Vorlage zum Automatisieren ähnlicher Fälle dienen.
* Der Code hat nicht ganz die Qualität der HBCI-, Paypal,- und CSV-Plugins, da leider noch ein paar Konto-GUIIDs
für die Umsatzsteuer fest eincompiliert sind. Ist aber trivial an den eigenen Fall anzupassen.
* Ich habe leider mit etlichen Java-PDF-Bibliotheken (incl. dem Adobe PDF-Bean) kein Glück gehabt und musste
/usr/bin/pdftotext hardcoden. Sorry, der Rest lieferte einfach nur weiße Seiten oder Fehler.

Marcus Wolschon

Released Pago-Plugin for jGnucash

Hello everyone.

And again we have a major step in automating these boring finance-tasks...
Today I releases the Pago-plugin for jGnucashEditor under the terms of the GPL3:

https://apps.sourceforge.net/mediawiki/jgnucashlib/index.php?title=PagoPlugin

https://apps.sourceforge.net/mediawiki/jgnucashlib/

It can automatically download all not yet downloaded
account-statements and clearing-statements
for Pago credit-card acceptance from the password-protected website.
* Then it extracts these pdf-files and converts them to text.
* The text is then parsed and the transaction-splits for
disagio-values of existing transactions are checked and corrected if
needed.
* Any "TODO: Disagio" is removed from the comment of these transactions.
* new dummy-transactions are added showing the saldo for the received
payments and the security-deposit
* they also show if all stated transactions have been identified and
how many are missing
* they also show by how much the saldo in gnucash is off to make it
easy to find the missing or wrong transaction
* the pdf-files are archived in a local directory

Requirements:
* Obvisiously you need to have your credit-card-acceptance with Pago
but the code can easily be adapted to automate other, similar
situations.
* This code has not the same quality-level as the other plugins have.
There are some hardcoded-account-IDs that need changing (in the code
correcting the sales-tax on a disagio).
* I tried numerous java-pdf-libraries including the pdf-bean by Adobe
itself but none of them could properly parse the pdf-files
generated by Pago, so this code has /usr/bin/pdftotext hardcoded.
Sorry guys, first of all I needed this to work when I wrote it. Being
elegant and
clean was secondary to that.

Marcus Wolschon

2008-11-16

Traveling Salesman as GPSD for Windows

I was frustrated to not find a GPSD for Windows.
So I added a feature to Traveling Salesman to make
it act as a minimal GPSD-Server for JOSM.

The feature part of the SVN-Version. A new release
will follow soon.

https://sourceforge.net/svn/?group_id=203597

Usage:
* Checkout and compile libosm, osmnavigation and traveling salesman.
* start Traveling Salesman (the traveling_salesman.jar is executable)
* open "preferences"->"navigation"
* make sure "Port for gpsd-emulatio" is set to 2947
* set "get position from" to JGPSProvider (o GPXFileProvider for testing)
* for JGPSProvider set "JGPS com-port description" to
"COM5,19200,8,1,N" or similar.
* start JOSM and let LiveGPS connect.

Currently there is an "open in josm" -button in Traveling Salesman, to download
the latest josm (if not yet present) and open the currently visible area in it.
A new button "survey roads" that downloads and starts josm inclusing liveGPS
and Surveyor may follow soon.
This way you can start surveying with one click if you see a missing street
while navigating from A to B.

Marcus Wolschon

2008-11-09

Added Paypal-Importer as plugin for jGnucashLib

The financial automation -framework jGnucashLib is intended as a
companion for Gnucash
to handle bulk import and synchronization -tasks.
For this purpose it features a rich plugin-API and advanced scripting
abilities in all languages
supported by JSR223 (defaults to javascript but there are dozen other
languages to choose from).

The new release 2.0.8 now features a paypal-importer that synchronizes
an existing
gnucash-account with the transactions found in a paypal-account.
* existing, correct transactions are not touched
* existing transactions that are one or two days off are silently moved
* non-existing transactions are first checked with all existing
scripts if one exists to handle this kind
* if none is found the user may choose to either book this to a
default-account or open a
script-editor that already shows an easy to understand
example-script for the usual tasks and
offers to dry-run, save or cancel.

http://apps.sourceforge.net/mediawiki/jgnucashlib/index.php?title=Main_Page

The editor already includes a similar importer for your online-banking
via HBCI or FinTS
and an example-CSV-plugin. The wiki contains constantly growing
documentation for
writing scripts and plugins to automate your own, boring and
time-consuming accounting-tasks.
...it's all just electronic numbers anyway.

Marcus