Solving the JAXB “unexpected element” problem

Monday 2015-06-08

-1If you are using JAXB in a maven/java project to unmarshal an XML document and you get:

javax.xml.bind.UnmarshalException: unexpected element (uri:”urn:iso:std:somestuff:xsd:somestuff”, local:”Document”). Expected elements are (none)

Or if you are using JAXB to marshal an XML document and you get:

com.sun.istack.internal.SAXException2: unable to marshal type “generated.somestuff.Document” as an element because it is missing an @XmlRootElement annotation

You have probably fallen victim of the fact that JAXB does not do “Simple Binding” by default. If your project is a maven project and you generated classes based on an xsd file, this is how you fix it (without changing the xsd file):

Read the rest of this entry »


Import/export an Oracle Schema using JDBC

Friday 2015-01-02

Everybody gets a database!When doing integration testing or fixing a bug in a piece of Java code that uses Oracle as a database, being able to do quick exports and imports of your schema can be a big help. Sometimes just calling Oracle’s imp/exp commandline tools from your code can be of help, but I was looking for something a bit more portable and less demanding on my local development machine. I found that Oracle’s datapump functionality can be called from stored procedures, which in turn can be called from a normal JDBC statement.

Read the rest of this entry »


Arduino and the QVGA 2.2″ TFT SPI screen

Monday 2014-11-17

QVGA SPI 2.2" 320x240 screenI went through all the struggles everybody else seems to be going through to get this screen connected to my Arduino Nano. I had the 5V to 3.3V voltage conversion problem, and the “only works with software interrupts” problem which makes the display run slow. The solutions are not complicated but not very wel documented. Until now.

Read the rest of this entry »


Open a port in OSX Mavericks’ Firewall

Saturday 2014-05-10

FirewallThe new firewall in Mavericks is great. For the common user. For a developer, not so much. If you are a Java developer like me, and you just need to open one port (say, 8080) so that the web application you’re working on is accessable from another computer, you can’t. I disabled the Firewall altogether for a few days, but it didn’t feel right.

I googled around and to make a long story short, here’s how to open port 8080 on any interface to any application on your OSX Mavericks installation in 3 steps:

sudo vim /etc/pf.conf

Then add the following lines at the end of the file:

# Open port 8080 for TCP on all interfaces
pass in proto tcp from any to any port 8080

Test (and, according to the documentation, load) your edits with:

sudo pfctl -vnf /etc/pf.conf

Reboot.

(I have found at least 5 pieces of voodoo to make the Firewall restart and reload, but none of them seemed to work reliably, so pardon the reboot)

You can close it by commenting out the lines in pf.conf and reboot again. If anybody knows of an easier way to do this, preferably in one terminal command, and without rebooting, let me know.

Hope this helps.


There’s life without Google. Or iCloud. Or Facebook.

Saturday 2014-03-08

Threema, the secure Whatsapp alternativeRegular readers of this blog already know that I am not using dropbox, and I was an Evernote user, but recently decided it became to dangerous and replaced it with my own scripts. I had an interesting discussion on Twitter which made me decide to show you how I run my digital life without the help of Google, Facebook, Dropbox, Whatsapp or iCloud, and still be able to have all the functionality these services offer.

The search was hard and sometimes I need to reconsider some of the choices, but the last few years the selection of products was very stable and the setup has worked flawlessly. Searching for a secure replacement for Whatsapp or Google? It’s in here.
Read the rest of this entry »


Replace Evernote with Spidernote

Sunday 2014-03-02

Resistance is futile

In the past I have used Evernote extensively, it really helped me in my research for this blog and keeping track of meeting notes, todo lists and even making pictures of whiteboards at work searchable. As a product, there is no note taking app that can beat Evernote. But there is a little problem that has become a deal breaker for me, and that is basically the NSA and the way Americans, and particularly the American government seems to think about people’s privacy and online security.

Evernote is an American company, which sadly has to comply with whatever ridiculous request by the U.S. government to turn over data of innocent people all over the world (yes, even outside the U.S. border, I know, it’s amazing). This, combined with the fact that Evernote clearly can not use zero-knowledge encryption because of the services it provides, makes that all the data you and I put into Evernote are at NSA’s fingertips at all times. If you find that as scary as I do, and you have a Mac, there is a way to solve this. Read the rest of this entry »


From the Finder to the Shell (and back)

Friday 2013-12-20

A quick tip for OSX users out there who frequently need to open a Terminal window for the current location in the finder, or the other way around:

Go2Shell and Back

Install the free application from the App Store: Go2Shell. It will give you an icon on the toolbar of your Finder, and pressing it will open a Terminal window and automatically change it’s directory to match the Finder’s location.

The other way around is easier; you can already do that on any Mac. Simply type “open .” (that’s the word “open”, followed by a space and a period). This command will open a Finder window for the directory location your Terminal window is in.

Bonus tip: Also check the “open -t [filename]” command, it will open your system’s default text editor with the given file.


Follow

Get every new post delivered to your Inbox.

Join 34 other followers