Provision an OpenStack instance with Terraform

A quick way to create an instance on OpenStack is to use Terraform, an open-source Infrastructure-as-Code (IaC) tool developed by HashiCorp. Here is my environment, quickly drawn 😉 : This instance will be provisioned with Linux CirrOS. The Terraform plan that i used : The provider to use to interact with OpenStack is terraform-provider-openstack : … Read more

Installing OpenStack on Ubuntu

Here are the steps to install OpenStack with DevStack on Ubuntu 20.04.3 LTS. DevStack really simplifies the installation of OpenStack. I followed the steps described here : https://docs.openstack.org/devstack/latest/ 1) First you need to create the user “stack” : sudo useradd -s /bin/bash -d /opt/stack -m stack 2) That user should have no password and have … Read more

Spring boot and Graylog

Graylog is a platform (free and enterprise) that is useful for log management of aggregated data. It is based on Elasticsearch, MongoDB and Scala. It can display messages and histograms. To send data to a graylog server through an HTTP appender with log4J2, i used the GELF layout with the following configuration : I had … Read more

Add UML diagrams to the JavaDoc

It is possible to add UML diagrams to the JavaDoc generated during the build phase. The first thing to do is to install Graphviz which is an open source graph visualization software. After installation, add the bin folder (D:\Graphviz\bin for instance) to the PATH environment variable. Then configure the pom.xml : Here i chose to … Read more

Modularity and plug-ability features in Servlet 3.0 specification with Tomcat 9

Modularity and plug-ability features in Servlet 3.0 specification is also called web fragments. The JSR 315 (Java Servlet 3.0 specification) is already 9 years old. The final release dates back to december 10, 2009. https://jcp.org/en/jsr/detail?id=315 Web fragments are one of the main features of this JSR. A web fragment is an XML file named web-fragment.xml … Read more

Variable which is “effectively final” in Java 8

Java 8 has an interesting feature that I learnt recently. A variable can become “effectively final”. Very useful. For instance, the following class would not compile in Java 1.7. It would return the following error : “Cannot refer to the non-final local variable myVocabulary defined in an enclosing scope”. It would require to add the … Read more

How is the cyclomatic complexity of an algorithm calculated ?

When checking the issues detected by Sonar, i noticed a few issues related to cyclomatic complexity. The usual message is clear : The Cyclomatic Complexity of this method “checkSomething” is 22 which is greater than 12 authorized. Indeed, the method checkSomething has way too many if conditions : Question : how is the cyclomatic complexity … Read more

Proxy setting in Docker Toolbox

If you are behind a corporate proxy, you might end with a connection error while running this command : Here is how to set up Docker so that it works behind a corporate proxy: 1) Edit the Docker VM /var/lib/boot2docker/profile 2) Add these lines at the end of the file : 3) Finally, restart Docker … Read more

JMS with Weblogic Server and EJB MDB

Here is a complete and short example of asynchronous development using JMS and a Message-Driven Bean (MDB). First the procedure to configure inside Weblogic Server a JMS server in order to create a queue, then the code for the producer/sender of a message to the queue and then the code for a consumer (MDB). 1) … Read more

Prevent Weblogic Server from wrapping data types

By default, Weblogic Server wraps data types such as Struct, Blob, Array, Clob, etc. For instance, oracle.sql.STRUCT becomes weblogic.jdbc.wrapper.Struct_oracle_sql_STRUCT. That can become a problem if for instance you’re expecting a data type : This would raise the following error : To avoid it, one can simply disable that wrapping in the Weblogic administration console : … Read more

Persistence.xml and the Oracle hint FIRST_ROWS

I found out that it is important to specify the exact version of Oracle in the persistence.xml file. I am currently using EclipseLink as the persistence framework provider. Oracle hints were introduced to speed up/optimize SQL queries. Starting with Oracle 10, some of them have become almost unecessary because the optimizer was greatly improved. Also, … Read more

[GWT] How to print a widget or a page

To print a widget or an entire page with GWT, you can use JSNI and the JavaScript print function. A good practice is to put all the content you want to print inside a DIV tag, for instance : An id is assigned to that DIV tag (line 10) and a button is added to … Read more