Skip to main content

Posts

Showing posts from 2013

Happy New Year!!!!!!!!!!

Peace and Love :)

SoapUI - Part 1

Starting from today I want to share part of my knowledge about SoapUI (as promised at the end of the post http://googlielmo.blogspot.ie/2013/12/dance-into-groovy.html ). I used this tool for some years in order to perform load testing and integration testing and I found it really helpful. SoapUI is a tool that allows any kind of functional and not functional testing. Despite its name it is not limited to the SOAP protocol and to web services only: you can perform tests for different protocols (HTTP/S, REST, JDBC, AMF, etc.) and application layers. It was born to be used for SOAP web services testing, but then it evolved to be a general purpose testing tool. It comes in two editions, Open Source and Pro. The first one is free to use and you can modifiy the source code too, according to the LGPL license. The second one is commercial and closed source. In this post and the following I will refer to the Open Source edition. The companies I worked for in the last years didn't want to ...

Living logging maid

Since I started my first job in the IT (a looong time ago) I have noticed that every 6 months there are some buzz words that suddenly become trendy and everyone goes crazy for them. This happened for many things (languages, framework, methodologies, OSs, technologies, best practices, etc.) but it never happened for logging (or at least not yet). The importance of logging (and log analysis) for applications and systems today is still something of secondary importance in many environments. Logging is important and it should be done following some best practices: a good logging can give a lot of useful info about the behaviour of an application at runtime and can speed the identification of problems or potencial problems; a bad logging can affect the performances of a system and can lead people in the wrong direction resulting in a loss of time (and money) to find a solution to the wrong problem. In this post I want to show you a list of best practices to follow in application logging. Th...

Dance into the Groovy

Groovy ( http://groovy.codehaus.org/ ) is an Object Oriented scripting language for the Java platform. It is dinamically compiled to bytecode for the Java Virtual Machine. It can use and interoperate with any Java class and library (any, not only the ones provided by the JDK) and it has a Java-like syntax: this way its learning curve for a Java depeloper is almost close to zero. Groovy is very powerful and can help in different areas: in some future post I will show and explain better its benefits. In this one I want to show you just a concrete example of use from me in the past. Many times we had to deal with the move of hundreds of Oracle schemas from an envirnoment to another (dev, test, QA, production) or to migrate them from an Oracle release to another. Every time the DBAs regularly forgot to set up the DB links for the new environment. This generated errors that couldn't often be identified quickly. In order to avoid this I wrote a set of Groovy scripts to check the sanity o...

Final article on Axon framework

During the last months a lot of changes happened in my life and couldn't update this blog as usual. I will be back soon. In the meanwhile I want to inform you that I have published the final article ( http://tinyurl.com/p5u5kpa ) about Axon framework for the July/August issue of Mokabyte magazine ( www.mokabyte.it ). The column on the right of the article shows you the links to read my previous articles about Axon and CQRS. The article is in Italian language only, but please feel free to contact me for any kind of info in English about it. Enjoy it.

Inspect code with FindBugs

Today I'd like to introduce an Open Source software we use for three years at least to perform code review and identify potential bugs in our Java code. Its name is FindBugs. It works performing static analysis of the Java bytecode. It covers different categories of bugs, including those related to the web applications security (this was the main reason we started to use it, but later we begun to use it for different categories of bugs). The software is distributed as a standalone GUI application or as plug-in available for the most famous IDEs. In this post I will refer to the plugin for Eclipse Indigo. You can download FindBugs from the the official website http://findbugs.sourceforge.net/ If you plan to use FindBugs as Eclipse plug-in you don’t need to download and install the standalone application too. The plug-in requires the Eclipse release 3.3 or later and the JDK release 1.5 or later. The installation of the plug-in is very simple: In Eclipse, click on Help ...

Last article about Axon framework

It's on line now the May issue of Mokabyte magazine ( www.mokabyte.it ). It contains the last article ( http://tinyurl.com/o8kyygq ) of the series  wrote by me about the Axon framework ( http://www.axonframework.org/ ), a Java implementation of the CQRS (Command Query Responsibility Segregation) pattern. The column on the right of the article shows you the links to read my previous articles about Axon and CQRS. The article is in Italian language only, but please feel free to ask me any kind of info in English about it. I'd like to know also your impressions about CQRS or Axon if you already had applied them to any of your projects.

ArrayDescriptor and Oracle 11g JDBC driver

This month I have a lot of things to post about GAE, jOOQ, GWT, MVPP, but so little time to write them. In the meantime I want to share a little tip about a strange error message we had last year during the migration of a large number of J2EE web applications from Oracle 9i to 11g (well, the project context was bigger than a mere database migration, but the error occurred was due to the migration only). Part of these applications used to invoke PL/SQL functions and stored procedures on Oracle databases. Oracle JDBC for 11g introduced an important difference from the 9i release in the oracle.sql.ArrayDescriptor usage. Every time you need to pass an Array of data from a Java web application to an Oracle stored procedure you have to use an oracle.sql.ARRAY object. In order to create it, before you have to create an instance of oracle.sql.ArrayDescriptor this way: ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("CUSTOM_TYPE_ARRAY", conn); were CUSTOM_TYPE_A...

Who's afraid of Open Source in 2013?

Recently I have read this article ( http://tinyurl.com/d3lnxns ) and the related comments on ComputerWeekly.com and then I asked myself (for the billionth time):"Why the hell in 2013 are there still people frightened by Open Source?". Some governments and big organizations are discovering belatedly the advantages of Open Source software adoption, after wasting a lot of money on license purchasing and above all on maintenance, bug fixing, support and customization (wasting a lot of time too (and time is more precious than money)) . It's sad to see that in some cases the choice of Open Source is just because someone thinks that it's cheaper than proprietary: Open Source means also the possibility to reduce the learning curve of a software, to quickly discover and fix possible bugs, to find a way to improve or extend the code (no lock-ins as for the proprietary), to have a large community to share tips and suggestions, to improve your personal knowledge and to find often...

Google Cloud Endpoints short tutorial - part 1

Here a short tutorial on Google Cloud Endpoints (briefly presented in the previous post ( http://googlielmo.blogspot.it/2013/04/google-cloud-endpoints.html )). For this tutorial I am referring to Eclipse Indigo and the Google Eclipse Plugin with the App Engine SDK 1.7.6. A little knowledge of the Google Plugin and the Google App Engine is required to better understand this tutorial. Project creation Open Eclipse and then create a new Web Application Project through the Google Plugin button. Select a name and the default package for the project and uncheck the GWT usage: we don't need a front end. The project name chosen for this tutorial is endpointtutorial . Coding Suppose you have this simple entity: public class MyEntity { public String entityName; public String entityDescr; } and the business logic to access this kind of object: public class MyBusinessClass { public MyEntity getMyEntity() { MyEntity myEntity = new MyEntity(); myEntity.entityName = ...

Google Cloud Endpoints

Saturday March 23rd I attended an interactive Google Lab @ Codemotion 2013 in Rome held by Alfredo Morresi about the Google Cloud Endpoints. This is a new feature for Google App Engine (GAE). It consists of tools, libraries and capabilities that allow you to generate Endpoints and client libraries from an App Engine backend to simplify client access to that web app. Endpoints makes it easier to create a web backend for web clients and mobile clients such as Android or Apple's iOS. Mobile developers will spare a lot of time and work while developing shared backends for their apps and benefit from all the services and features provided by the GAE infrastructure. The figure below shows the basic Endpoints architecture: The backend is an App Engine application that performs business logic and other functions for Android and iOS clients, as well as JavaScript web clients. The functionality of the backend is made available to clients through Endpoints, which exposes an API that clien...

Very late modernization

Last week, during my Easter holidays, I received the usual ServerSide.com newsletter containing the following article: " How Italy's Ministry of Education boosted agility, innovation, cut costs " From the title I was enthusiastic about the effort of the Ministry, but... ...in the short article I read that they relied on a mainframe server since the 1980's and only in 2012 they " realized that they needed more flexibillity to handle the reorganization of its administration ". For this reason the new goals of the Ministry were the following: Increase investments in innovation Improve agility/continuity And reduce costs. and finally, thanks to God, they realized that a mainframe system could't satisfy these new requirements anymore. In the attached video (you can watch it at the following link http://h20621.www2.hp.com/video-gallery/us/en/4fd7619f9d740e518dc8fe0cb11a5ff445f879f4/r/video ) Paolo de Santis, the Applications and Security Manager of...

Facebook4j definitely!

I think that the best library to connect to and interact with Facebook from a Java web application is Facebook4j ( http://facebook4j.org/en/index.html ). I am not a big fan of Facebook, but I needed to interact with the most popular social network and had to search for a solution to this requirement. Facebook4j is an high level Java library for the Facebook Graph API. It doesn't require additional dependencies, it's Open Source and released under the Apache License 2.0 and it has built-in OAuth support. The learning curve is very low and you need just few lines of code to perform any kind of interaction with Facebook. Before moving to Facebook4j I tried also other APIs (among them RestFB and the now deprecated java-facebook-api) and Spring Social. At the end Facebook4j was the best, the most well documented and the easiest to use. I had to discard Spring Social because the application I am working on is not Spring based. This application is hosted on Google App Engine and I eas...

Localization in GWT UiBinder howto

In GWT the localization process is more complex using the UiBinder declarative layout than the Java layout and the official documentation is lacking. In this post I will shortly describe the steps to follow to localize your UiBinder views. First of all you have to add the local properties to your GWT XML module file: <inherits name="com.google.gwt.i18n.I18N"/> <extend-property name="locale" values="en"/> <extend-property name="locale" values="it"/> In this example I am considering English and Italian as possible languages. Then you have to add the locale namespaces to any of the *.ui.xml file of your project: <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"  ui:generateFormat="com.google.gwt.i18n.rebind.format.PropertiesFormat"        ui:generateKeys="com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator"  ...

New article about Axon framework

It's on line now the March issue of Mokabyte magazine ( www.mokabyte.it ). It contains a new article ( http://www2.mokabyte.it/cms/article.run?articleId=8NU-7JY-S5U-KM4_7f000001_26089272_3efb3042 ) wrote by me about the Axon framework ( http://www.axonframework.org/ ), a Java implementation of the CQRS (Command Query Responsibility Segregation) pattern. This article is the third of four. The column on the right shows you the links to read my other articles about Axon and CQRS. The article is in Italian language only, but please feel free to ask me any kind of info in English about it. I'd like to know also your impressions about CQRS or Axon if you already had applied them to any of your projects.

Model View Presenter pattern

Model View Presenter (MVP) is a software design pattern that brings a lot of benefits developing web applications having GWT as frontend framework. I am going to do a brief description of this pattern. I am currently applying it on a project I am working on and I have noticed that for people coming from MVC (Model View Controller) sometimes it's hard to understand the benefits of MVP (and how to implement it): so I decided to share my experience explaining this pattern from scratch. MVP is a derivative of the MVC pattern and it's used mainly for building user interfaces. As well as the MVC pattern, MVP decouples the model from the views and the views from the logic that controls them. This way you really have the separation of concerns for the presentation logic. The three actors of this pattern are: Model: an interface defining the data to be displayed. View: a passive interface that displays the data of a model and routes user commands (typically events) to the presente...

jOOQ: code generation in Eclipse

jOOQ allows code generation from a database schema through ANT tasks, Maven and shell command tools. But if you're working with Eclipse it's easier to create a new Run Configuration to perform this operation. First of all you have to write the usual XML configuration file for the code generation starting from the database: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-2.0.4.xsd">   <jdbc>     <driver>oracle.jdbc.driver.OracleDriver</driver>     <url>jdbc:oracle:thin:@dbhost:1700:DBSID</url>     <user>DB_FTRS</user>     <password>password</password>   </jdbc>   <generator>     <name>org.jooq.util.DefaultGenerator</name>     <database>       <name>org.jooq.util.oracle.OracleDatabase</name>     ...

SuggestBox in GWT UiBuinder

I am currently working also on a project hosted on Google App Engine ( http://appspot.com ) and I want to share some tips about some of the frameworks offered by the GAE environment. Today I want to talk about a problem we had using the GWT SuggestBox component while making UiBinder layouts. The class  com.google.gwt.user.client.ui.SuggestBox is  a text box or text area which displays a pre-configured set of selections that match the user's input.  Each SuggestBox  is associated with a single  com.google.gwt.user.client.ui.SuggestOracle . The SuggestOracle  is used to provide a set of selections given a specific query string. Our application provides a method to retrieve suggestions from the backend while a user writes into the SuggestBox. This worked fine with a GWT Java layout, but moving to UiBinder layout we faced the following problem. We added a SuggestBox to a view through the GWT designer. The code generated was the following: View.ui.xml: ...

Apache Camel rocks!

Yesterday I attended a meeting of the JBoss User Group @ Red Hat in Rome. One of the two topics of this meeting was an introduction to Apache Camel ( http://camel.apache.org/ ). Last summer Red Hat acquired Fuse Source and now they are promoting Apache Camel. It is a powerful Open Source integration framework based on the most used Enterprise Integration Patterns (EIPs,  http://www.eaipatterns.com/toc.html ).  Camel allows you to define routing and mediation rules in a lot of domain-specific languages, including Java, Spring, XML and Scala DSL. It provides more than 120 components and so it's possible to work directly with any kind of  transport or messaging model. The following image taken from the official website shows the Camel architecture: Camel brings a lot of benefits. How many times it would have been useful in some past projects! But it's never too late to start with it.

Using jOOQ with Spring

Today a brief tutorial on how to integrate jOOQ ( http://www.jooq.org/ ) with Spring. It covers the basic integration that could be easily applied to any web application. For this tutorial I am referring to Spring 3.2.0 and jOOQ 2.6.1. I'm referring to Oracle because the applications I am working on use this database, but all the considerations done here are valid for each database vendor supported by jOOQ. Suppose you have a web application Spring based and want to integrate jOOQ with the most popular Inversion of Control container. First of all you have to put the jOOQ libraries in the WEB-INF/lib folder of  your application. The required jOOQ libraries are the following: jooq-2.6.1.jar jooq-codegen-2.6.1.jar jooq-meta-2.6.1.jar If you use the jOOQ code generation feature you need to add to the classpath also the jooq-codegen-2.6.1.jar library. Then you have to put in the WEB-INF/lib folder also the jOOQ dependencies: log4j-1.2.16.jar persistence-api-1...

jOOQ

jOOQ (Java Object Oriented Querying,  http://www.jooq.org/ ) is an Open Source library that provides a DSL to use SQL as it were natively supported by Java and treated in a object oriented way.  A SQL statement like this: SELECT * FROM BOOK WHERE PUBLISHED_IN = 2011 ORDER BY TITLE in jOOQ DSL becomes: create . selectFrom ( BOOK ) . where ( PUBLISHED_IN . equal ( 2011 )) . orderBy ( TITLE ) But jOOQ isn't just a DSL. It provides also other important features: Code Generation Active records Typesafe SQL SQL standard Vendor-specific feature support and supports the latest versions of the major database vendors.  jOOQ could be a powerful option to Hibernate or JPA. Tomorrow I am going to publish a post about the integration between Spring and jOOQ. Stay tuned!

Foundation 3 POC

Currently working on a POC of Foundation 3 ( http://foundation.zurb.com/ ) and its possible integration with another frontend framework. The official website of Foundation 3 declares:"Foundation: the most advanced responsive front-end framework in the world." Is this true? My first impressions are positive, but I could be more accurate in the next weeks.

Axon framework

It's on line now the February issue of Mokabyte magazine ( www.mokabyte.it ). It contains an article ( http://www2.mokabyte.it/cms/article.run?articleId=F79-K2B-PYN-G2N_7f000001_26089272_9f04d42c ) wrote by me about the Axon framework ( http://www.axonframework.org/ ). This article is the second of four. The column on the right shows you the links to read my other articles about Axon and the CQRS pattern. The article is in Italian language only, but please feel free to ask me any kind of info in English about it.

First post here!

Dear all, I am moving here from my previous blog location ( http://wicketeer.myblog.it/ ), but keeping the same spirit. The old blog is still online and it's still possible to read the older posts. If you want to make a comment on them please refer to this new blog. Stay tuned! Cheers :)