Participate in the Future of Java - Coimbra JUG - 2DEZ2015

Data: Quarta-feira, 2 de Dezembro de 2015
Hora: 18:15

O 11º encontro do Coimbra JUG marca o 2º aniversário!

Irá estar presente um orador internacional: a Heather VanCura da Oracle.

Learn how to take part in Java technology evolution. You can participate as an individual, corporation, or nonprofit such as a Java user group (JUG). This session gives you step-by-step instructions on how to participate in the JCP Program. You will also learn about the global
Adopt-a-JSR program and how you can participate in the Adopt-a-JSR program and Adopt OpenJDK programs. We will discuss details such as how to run hack days, collaborate with other JUG leads on Adopt-a-JSR activities, and review use cases from other JUGs around the world contributing to the Java EE 7 and Java SE 8 JSRs. Currently there are new JSRs being submitted and developed for the Java EE 8 and Java SE 9 platforms. Find out how you have contribute to the future editions of the Java Standard and Java Enterprise Editions.

About Heather VanCura (@heathervc):

Heather VanCura leads the JCP Community and Program Office. In her role she is responsible for the day-to-day nurturing, support, and leadership of the community. Heather oversees the web site, JSR management, community building, events, marketing, communications, and growth of the
membership. She is also a contributor and leader of the community driven Adopt-a-JSR programs. In 2014, Heather became Spec Lead for JSR 364, Broadening JCP Membership, as part of the ongoing JCP.Next effort. Heather is passionate about Java and developer communities. She enjoys trying new sports and fitness activities in her free time and speaking at conferences, such as FOSDEM, Devoxx, GeeCon, JFokus, Java Zone, OSCON and the JavaOne Conferences. You can find her on Twitter @jcp_org and @heathervc.

Toda a informação sobre o evento em

Distributed Computing with Hazelcast - Coimbra JUG - 9DEZ2015

Data: Quarta-feira, 9 de Dezembro de 2015
Hora: 18:15

O 12º encontro do Coimbra JUG marca também o 2º aniversário! Para comemorar a ocasião algumas surpresas irão haver neste evento.

Irá estar presente um orador internacional: o Christoph Engelbert da Hazelcast.

Nowadays collected amounts of data growing exponentially. More than 75% of all stored data were collected in the last 5 to 6 years. To store and D those always fast growing pile of data we have to go new ways. The Scale-Up approach starts to break apart. Partitioning data and parallelize processing and analyzing are the new way.
Our interactive journey will give a short introduction into Distributed Computing and In-Memory Computing with Hazelcast. A few slides and lots of live-coding and hopefully lots of discussions and questions.

About Christoph Engelbert (@noctarius2k):

Christoph Engelbert is Technical Evangelist at Hazelcast. He is a passionated Java developer with a deep commitment for Open Source software. He mostly is interested in Performance Optimizations and understanding the internals of the JVM and the Garbage Collector. He loves to bring software to it's limits by looking into profilers and finding problems inside of the codebase.

Toda a informação sobre o evento em

Book - High-Performance Java Persistence

About the book

This book is a journey into Java data access performance tuning. From connection management, to batch updates, fetch sizes and concurrency control mechanisms, it unravels the inner workings of the most common Java data access frameworks.
The first part aims to reduce the gap between application developers and database administrators. For this reason, it covers both JDBC and the database fundamentals that are of paramount importance when reducing transaction response times.
The second part demonstrates how you can take advantage of JPA and Hibernate without compromising application performance.
The third part is dedicated to jOOQ and its powerful type-safe querying capabilities, like window functions or common table expressions.

More information in:

Web Article - Spring JMS Example

Java Messaging Service (JMS) is a standard messaging API used to send and receive messages.

Spring simplifies the use of JMS API by providing another layer around the JMS layer.

This layer provides convenience methods for sending and receiving messages, as well as manages the creation and release of resources like the connection object.

The JmsTemplate class is the main class which we will be using often to work with the JMS API.



Read full atricle here.

Install Intel Virtualization Technology

When you try install Intel Virtualization Technology located in 

you can get following error

The first solution are:
  • VT-x and VT-d turned on in BIOS
  • Don't have Hyper-V enabled on
But the error may continue to appear, the other solution is

If you have avast antivirus installed this can be the problem.
I uninstalled Avast and rebooted. 
Then I was able to install HAXM.
After the installation of HAXM i reinstalled avast.

This solved my problem.

Web Article - Android: Boost up the Android emulator speed up to 400% on Intel based architecture

Okay, it is slow. Then what can we do about it?

Let us go through steps to solve the slowness problem of Android emulator;
  1. First, let us delegate the rendering process to host GPU instead of overhead our CPU by this process, it will make it happy. Do it by checking "Use Host GPU" checkbox in AVD’s edit window.
    The screen should now look better and be more responsive. That is because the CPU is happy to not dealing with the tedious work of doing rendering anymore. However, that is still not fast enough.
  2. Second we need to download Intel Atom (x86) system image for each Android version you need to use for testing.
  3. Third, download Intel x86 Emulator Accelerator (HAXM, for Mac and Windows only). This will enable virtual machine acceleration capabilities of the Intel CPU, from Android SDK manager –> tools. Or install it from Intel site.
  4. The SDK only copies the Intel HAXM executable on your machine, and it is up to you to install the executable.
    To install the Intel HAXM executable, search your hard drive for IntelHaxm.exe (or IntelHAXM.dmg on Mac OS X). If you left everything to default, it should be located at%Android_HOME%\sdk\extras\Intel\Hardware_Accelerated_Execution_Manager\IntelHaxm.exe.
    Intel HAXM only works in combination with one of the Intel® Atom™ processor x86 system images.
  5. In order to be able to install the Intel HAXM, you need to have Intel VT-x enabled in your BIOS, otherwise you will get an error like this during install.

    Enabling Intel VT (Virtualization Technology)

    How do I enable Intel VT in your machine BIOS?
    1. Boot into BIOS.
    2. Select "Config".
    3. Select "CPU".
    4. Press enter at "Intel Virtualization Technology".
    5. Select "Disable".
    6. Press F10 and select Yes.
    7. Boot into Windows then shutdown the system.
    8. Boot into BIOS again.
    9. Select "Enable" – Intel Virtualization Technology.
    10. Press F10 and select Yes.
  6. After installation goes successful, edit your AVD and chose Intel® Atom (x86).
  7. Finally Hit okay, then lunch your cake and definitely enjoy the speed.
VIP Note:
You could say that this level of speed should be sufficient. That may be true, but an issue with the Intel x86 images is that you do not get Google Apps, they only come with ARM images. This is important if you are testing an app that usesGMaps, or Google Play Services.


LXXIII Encontro da Comunidade SQLPort - Coimbra - 22SET2015

Realiza-se no dia 22 de Setembro de 2015, terça-feira, o LXIII Encontro da comunidade SQLPort, que tem como objectivo a partilha de experiências e conhecimento entre os profissionais e entusiastas de SQL Server em Portugal. O evento vai ser realizado nas instalações da Critical Software, pelas 18:30, sendo a entrada livre para todos os inscritos.

Morada: Parque Industrial de Taveiro, lote 49, 3045-504, Coimbra


18:30 Abertura e recepção
19:00 "Query Store in SQL Server 2016" - André Batista (DBA - CrossJoin)
20:10 Intervalo
20:30 "Azure Databases e Database Elastic Pools" - Virgilio Esteves (Azure MVP, CTO & Owner - Broadscope)
21:40 Sorteio
22:00 Jantar livre

Hibernate ORM 5.0 has gone Final!

A lot of development has gone into 5.0. Here are the big points:
New bootstrap API
Spatial/GIS support
Java 8 support
Expanded AUTO id generation support
Naming strategy split
Attribute Converter support
Better "bulk id table" support
Transaction management
Schema Tooling
Typed Session API
Improved OSGi support
Improved bytecode enhancement capabilities
Work on documentation

How to get it
See for the complete list of changes.
The release tag is available at

Security for Microservices with Spring and OAuth2

OAuth 2 Developers Guide

This is the user guide for the support for OAuth 2.0. For OAuth 1.0, everything is different, so see its user guide. This user guide is divided into two parts, the first for the OAuth 2.0 provider, the second for the OAuth 2.0 client. For both the provider and the client, the best source of sample code is the integration tests and sample apps.

CDI How do I ?

Apresentação de António Gonçalves no Coimbra JUG no dia 10 de Julho de 2015

CDI How do I ? - Coimbra JUG - 9JUL2015

  • Quinta-feira, 9 de Julho de 2015

  • Departamento de Engenharia Informática - Faculdade de Ciências e Tecnologia

    Universidade de Coimbra Pólo II - Pinhal de Marrocos,Coimbra (mapa)
  • Nesta sessão teremos o prazer de contar com o António Gonçalves que nos irá fazer uma apresentação sobre CDI (Contexts & Dependency Injection).

    Abstract : "CDI How do I ?"
    In this session I'll present CDI (Context & Dependency Injection), explain most of its concepts (injection, producers, alternatives, interceptors, decorators, events...), and also show you why CDI has become the leading Java EE specification. All this with a soft blend of slides and demos (demos that work of course). CDI 2.0 being in the starting blocks, I'll end the session by giving you the roadmap of this new version.

JDK 8 Massive Open and Online Course: Lambdas and Streams Introduction

  • 14-JUL-2015 03:00:00 PM GMT
  • 4-AUG-2015 07:00:00 PM GMT
  • Java SE 8 (JDK 8) introduced a fundamentally new way of programming in Java with the introduction of Lambda expressions.
    Lambda provides a simple way to pass functionality as an argument to another method, such as what action should be taken when someone clicks a button, or how to sort a set of names. Lambda expressions enable you to do this, to treat functionality as a method argument, or code as data.
    You may have heard about Lambda expressions, and are curious what impact it will have on you as a Java developer.
    This course is designed to answer your questions and more.
    Have you ever wondered what Lambda expressions are in Java?
    Have you ever wanted to write parallel code in Java without worrying about threads and locking?
    Have you ever wanted to process collections of data without using loops?
    Have you ever wanted to do functional programming in Java?
    All of these questions will be answered in this practical hands-on MOOC. This course introduces two major new changes to the Java platform: Lambda expressions and the Stream API.
  • Free!
  • 3 weeks
  • Unlike a traditional instructor-led event, the course is delivered on-line.
    Take this course when you want, where you want, and at your own pace.
    Interact with your peers and the instructor panel through the forum.
    Each week we will post a new set of course materials:
    • A series of short, pre-recorded videos provide the "lecture" portion of the course.
    • A homework project is linked to the video material, and applies what you have learned by working with Lambdas and Streams.
    • A graded quiz evaluates how well you have grasped the materials and the homework.
  • 3 - 4 hours weekly
  • Based on successfully completing the course quizzes, you will receive a course completion award, suitable for printing and framing!
  • English
    • Apply Lambdas to everyday problems
    • Convert anonymous classes to Lambda expressions
    • Apply the Streams API to solve problems of sorting, identifying the most and least, and reducing duplicates
    • Determine when to apply Lambdas (and when not to!)
    • Use Collectors
    • Improve performance with parallel streams
    • Debug Lambda expressions

Sublime Text - Editor de Texto para Programadores

Sublime Text is a sophisticated text editor for code, markup and prose.
You'll love the slick user interface, extraordinary features and amazing performance.

Logging - Tinylog

Ease of use

import org.pmw.tinylog.Logger;
public class Application {
   public static void main(String[] args) {"Hello World!");

JBoss Forge - how to use it and extend the functionality

Instalation in Eclipse: Search for "JBoss Tools (Luna)" in Eclipse via:
Help > Eclipse Marketplace...

After instalation open Forge Console and you can create new project with:
[no project] workspace $ new-project --named my-forge-app --topLevelPackage

create webapp
[my-forge-app] my-forge-app $ scaffold setup
[my-forge-app] my-forge-app $ persistence setup --provider HIBERNATE --container JBOSS_AS7
[my-forge-app] my-forge-app $ entity --named Person
[my-forge-app] $ field string --named firstName
[my-forge-app] $ field string --named lastName
[my-forge-app] $ field int --named age
[my-forge-app] $ scaffold from-entity

This will generate the CRUD pages for your model:
scaffold from-entity ~.model.* --scaffoldType faces --overwrite; 

More information in or JBoss Forge tutorial

Instalation in NetBeans


Web Article - JDBC Batch Update Example

Approach 1: Jdbc Batch Update using Statement object

Approach 2: Jdbc Batch Update using PreparedStatement

Testes de Integração com Arquillian - Coimbra JUG - 16ABR2015

Testes de Integração com Arquillian

Quinta-feira, 16 de Abril de 2015 - 18:15

Departamento de Engenharia Informática - Faculdade de Ciências e Tecnologia
Universidade de Coimbra Pólo II - Pinhal de Marrocos,Coimbra (mapa)


A apresentação centra-se na utilização da framework de testes de integracao Arquillian ( ). 

Esta ferramenta executa testes reais, num servidor aplicacional real, não recorre `a utilização de mocks. Desta forma, permite simular o comportamento da aplicacao num ambiente muito próximo do que pode ser encontrado nos ambientes de produção. 

Para demonstrar das suas potencialidades, será criada uma aplicação simples, em poucos minutos, usando Weblogic, Jboss Forge e Arquillian.

Web Article - Quartz HelloWorld Example



package com.javacodegeeks.snippets.enterprise.quartzexample;

import org.quartz.CronScheduleBuilder;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SimpleScheduleBuilder;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;

import com.javacodegeeks.snippets.enterprise.quartzexample.job.ByeJob;
import com.javacodegeeks.snippets.enterprise.quartzexample.job.HelloJob;

public class MyApp {

 public static void main(String[] args) {
  try {
   JobDetail job1 = JobBuilder.newJob(HelloJob.class).withIdentity("helloJob", "group1").build();

   Trigger trigger1 = TriggerBuilder.newTrigger().withIdentity("simpleTrigger", "group1")
   Scheduler scheduler1 = new StdSchedulerFactory().getScheduler(); 
   scheduler1.scheduleJob(job1, trigger1); 
   JobDetail job2 = JobBuilder.newJob(ByeJob.class).withIdentity("byeJob", "group2").build();
   Trigger trigger2 = TriggerBuilder.newTrigger().withIdentity("cronTrigger", "group2")
     .withSchedule(CronScheduleBuilder.cronSchedule("0/5 * * * * ?")).build();
   Scheduler scheduler2 = new StdSchedulerFactory().getScheduler();
   scheduler2.scheduleJob(job2, trigger2); 
  catch(Exception e){ 


Source: javacodegeeks

Web Article - Tomcat DataSource JNDI Example


< Resource auth="Container" 
maxActive="100"  maxIdle="30" maxWait="10000"
name="jdbc/TestDB" type="javax.sql.DataSource" 
username="username"  password="password" />

MySQL Datasource example 
package com.javacodegeeks.examples;

import java.sql.Connection;
import java.sql.SQLException;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

 * @author Chandan Singh
public class DBConnection
 public static Connection getConnection() throws SQLException, ClassNotFoundException, NamingException
  Context ctx = new InitialContext();
  DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
  Connection connection = ds.getConnection();

  return connection;


Powered by Blogger