I/O Ideas

Thursday, August 11, 2016

The following is an account of my personal experience in bringing my motorcycle from Portugal to the Netherlands. I detail each step and the associated costs.

First, some context information: I moved from Portugal to the Netherlands in April to grab a job opportunity. I rented a house, opened a local bank account, registered myself as a resident (got my BSN number) and started working.

The motorcycle is a BMW K1300R from 2011.

By the end of April I decided to bring my motorcycle over, so I asked my wife to ship it. Here is what happened:

1 - Ship the bike

After careful selection I went with Agility. I contacted Helder Marques, the director, who was very helpful, gave me a good price and handled the transportation beautifully.
I gave him a copy of my ID card for pick-up reference.

Cost: EUR 420,00

2 - Collect the bike

Easy peasy! I went to Oosterhout, Showed my ID card and picked up the bike:

VAN WANROOY TRANS & LOGISTIEK
KOOPVARDIJWEG 3 A
NL-4906 OOSTERHOUT

Cost: EUR 0,0

3 - Apply for exemption for vehicle import tax

Since the motorcycle was mine already and I am just moving it from Portugal to the Netherlands, I do not need to pay vehicle import tax - BPM. So the first thing to do, after the motorcycle arrives in Holland is ask for this exemption.

Go to the appropriate Tax Authorities web page, print out the PDF, fill it in, sign it and send it by post to:

Tax Office PO Box 4 6400 AA HeerlenThe PDF is in Dutch and there is no English version. You can get most of it with Google Translate and the bits that you don't understand, ask a friend who speaks the language.Here is an example of a filled in form.You only have to pay the postage:

Cost: EUR 3,00

4 - Receive the exemption grant from the Tax Authorities

About a week after you sent your request for exemption you should get a response by post - A letter from the Tax Authorities saying that they accept your request and are exempt from paying the BPM.

They will also send two forms which you will need to fill in: BPM_013 and BPM_014 to calculate the amount of BPM corresponding to you motorcycle (Even though you have exemption, you will have to pay the BPM if you sell your motorcycle in the first year).

Calculating the BPM can be a pain the butt, but fortunately there are a few guidelines that you can find online.

You have to base the calculation on the net price of the Motorcycle at the time is was first registered. What I did was call the BMW motorcycle dealer in the Netherlands and ask them how much was the net price (before BPM and VAT) of my motorcycle in 2011 here in the Netherlands.
Put this net price on the PDF form and it will calculate the gross BPM automatically.
Now, because the bike is from 2011, there will be a discount one the gross BPM, and thus you arrive at the "historical BPM". This is what you would have to pay. Here is how you can calculate it.

Do your calculation, fill in these two forms and keep them together with the exemption grant. Sign and include the papers you used to justify your calculation.

Cost: EUR 0,0

5 - Set an appointment for the Inspection of the motorcycle

The inspection is the first step to getting Dutch license plates for the motorcycle. This is done by the RDW. They will verify that your motorcycle is in conformity with European regulations and they will also send the current motorcycle registration papers back to the country of origin so that the current license plates are canceled.

Go to the appropriate RDW web page to setup an inspection appointment.
Follow the steps to complete your inspection appointment.

You will not pay anything at this moment, but you will see how much you will have to pay on the day of the inspection. In my case it was EUR 104,91

Cost: EUR 0,0

6 - Take the motorcycle for inspection

On the day of the inspection bring with you your ID card, the motorcycle registration document and any other documents pertaining to the motorcycle, like the motorcycle user manual and the service book and, if you can, the CoC of the motorcycle. Also bring the BPM exemption grant from the tax authorities and the other BPM forms and papers you gathered in step 4.

In my case, I did not have the CoC of my motorcycle, but the inspector was kind enough to look it up online.

After the inspection is done, you pay and you receive a paper certifying the motorcycle from the RDW. Next put the following documents in an envelope for the tax authorities:

Motorcycle certificate from the RDW (you just got)

Exemption Grant from the tax authorities

BPM_013

BPM_014

Aditional papers you used to calculate your Historical BPM.

The RDW inspection center has envelopes and an internal post box specifically for this, so you don't have to go anywhere or pay anything extra for this.

Cost: EUR 104,91

7 - Receive your new motorcycle registration

You will receive a letter from the RDW with your new registration and license plate number

Cost: EUR 0,0

8 - Have a new license plate made for the motorcycle

Choose a license plate maker from one of the officially approved by RDW. Here a list.

I had the license plate made and also bought the plastic support to attach to the bike.

Monday, November 3, 2014

FX Serials allows your traditional Java Beans to play in the new JavaFX scene.

Why?

JavaFX 2.0 introduced the JavaFX Beans specification that adds properties support to Java objects through the help of the properties classes from the JavaFX 2.0 properties and bindings framework. This allows the JavaFX GUI to bind its controls with the data model without the need for extra binding frameworks.
Although properties support has been long awaited in Java, the adoption of the new JavaFX2 Beans by enterprise application developers faces two challenges:

For new applications, there is the questionable need for binding or observing a property on the server side, together with the additional dependencies and performance overhead needed to handle the extended domain model (see James Denvir's One Bean to Bind Them All post);

For existing applications, there is the need to re-code the domain model in order to accommodate the new specification.

On the one hand, It would help the decision for new applications if there were some successful case studies. And on the other hand, facilitating the move for existing applications would help create some of those case studies.

How about a solution where you have traditional java beans on the server side which are "automagically" transformed into JavaFX2 Beans on the client side? - The concerns in 1 would be mute and there would be no need to re-code the domain model. Cool!

I implemented a first approach to this solution in my latest project: FXSerials. I hope you find it cool too :)

Version 1.0.1 is out and you can add it as a maven dependency with the following coordinates:

Monday, October 13, 2014

Developers of systems for Enterprise Integration often need to interact with a message broker in order to view messages or send messages to queues or topics. The problem is, a client application which does that is not always readily available.

Now there is one!

You can now use the MQConsole client application (at least for Apache ActiveMQ and HornetQ). MQConsole is an open source application that I started to develop using a maven multi-module project. Each broker support in developed as a maven module and shares the same user interface with the others. The source code is available on Github (here) and the binary distributions for Windows and Mac are available on Bintray (here).

main window - broker destinations

The main window shows a table with information about the queues and topics found in the message broker. There are a number of actions available if you right-click on any queue or topic:

See the list of messages in a queue or topic

View the details of a specific message

Send a new message to a queue or topic

Subscribe to a queue or topic and display messages as they arrive there.

send a new message window

When sending a new message, you can opt for a request/response scheme by ticking the "Has Response" box. In this case, the application will wait for a response and displays the reply message in the "Response" tab.

Window displaying a received message

When you subscribe to a channel or topic in the main window, a window displaying one message pops up every time a new message arrives.

This window can also be opened to view the details of a message in a message list.

The message details displayed are the message headers and its payload as long as its non binary.

Please download from Bintray and see the Github site to create an issue with your improvement suggestions

Monday, October 6, 2014

How to use webstart-maven-plugin to pack a JavaFX 2 client in a web application and launch it using Java Web Start (JNLP)

How to use Tyrus, a java websocket client implementation, for client server websocket communication

The source code referenced here is part of a fully functioning application which can be downloaded and tested from the websocket-test repository at Github. Please read the README file there for pre-requisites and instructions on building and testing.

Project structure:

Maven project called websocket-test (packaging: pom) with two modules:

websocket-client - JavaFX 2 application (packaging: jar)

websocket-server - Spring framework web application (packaging: war)

Project packaging

The websocket-server module is packed with the depicted structure. The webstart folder contains the jar file generated by the websocket-client module and it's transient dependency jars. It also contains the websocket-client.jnlp descriptor file

I - Using webstart-maven-plugin to pack a JavaFX 2 client in a web application and launch it using Java Web Start (JNLP)

On the websocket-server module, configure the webstart-maven-plugin as follows:

Notice the build timestamp passed to the JNLP file. this will allow java web start to detect wether a cached application needs to be refreshed.
The details pertaining to the user certificate in the <sign> section are defined in the maven settings.xml file, so they remain private.

You must also provide a velocity template for the JNLP file, like the following:

This template contains variables. Some of them will be substituted at build time (ex: ${buildTS}) and some will be substituted by the JnlpDownloadServlet at download time (Ex: $$context)

Notice the parameter definition on line 28 (<fx:param name="server-url" value="$$context"/>). This will be passed to the JavaFX2 application and will tell it where to connect the client websocket.

II - Using Tyrus for client server websocket communication

Tyrus is the websocket reference implementation in java therefore it made sense to build this test project using Tyrus, although any other implementation could be used.

The application is going to establish a websocket connection to the server and the address of the server is calculated based on the value of the server-url parameter in the JNLP file:

Starting the Tyrus client manager will create a separate process with several execution threads to control communication between the client and the server. We need to tell the application that the security permissions bestowed by the java web start configuration are needed to launch the Tyrus client, otherwise an "access denied" exception will be thrown. We do this by starting the Tyrus client in a privileged block:

Please download the source code for all the details (git clone https://github.com/cemartins/websocket-test.git) and leave a comment here or raise an issue at Github if you have any thoughts or suggestions you'd like to share.

Thursday, March 20, 2014

Spring introduced support for WebSocket-style messaging in version 4.0, but how about spring 3.x?
- Can applications using spring framework 3.x have websocket endpoints integrated with spring's
application context?

- Yes, they can.

I developed a small proof-of-concept application to demonstrate this.

This application sets up a websocket server endpoint with uri `/wstest` which will use a `@Autowired` spring bean to select a greeting word and reply to a websocket message.
The websocket connection is initiated and messages sent by an html page (`index.html`) running in a browser that supports websockets.

The Servlet container's scan for WebSocket endpoints is avoided by not using the `@ServerEndpoint` annotation and instead
implementing a ServerEndpointConfig and adding it to the server container upon servlet context initialization.
This way, the endpoint instance will be provided by SpringConfigurator, which means it can itself be a spring bean and/or it
can have spring dependencies automatically injected with the `@Autowired` annotation.