May 2, 2016

Common Ubuntu Packages Commands

Update list of packages.

sudo apt-get update

Install package.

sudo apt-get install PACKAGE

Uninstall package and configuration.

sudo apt-get purge PACKAGE

Search packages.

sudo apt-cache search STRING

Show package info.

sudo apt-cache show PACKAGE

List all installed packages.

dpkg --list

Reference:

https://help.ubuntu.com/community/SwitchingToUbuntu/FromLinux/RedHatEnterpriseLinuxAndFedora#Command_Line_Tools

April 3, 2016

Ubuntu 15.10 Eclipse Failed to Transfer Plugin

If you are fresh on Ubuntu 15.10 and fail to compile projects in Eclipse, verify that you can build with maven from command line, if not see my previous blog Cannot Run Maven On Ubuntu 15.10 .

Then in Eclipse: Right click the project->Maven->Update Project->Check checkbox "Force Update of Snapshots/Releases". Click OK.

Cannot Run Maven On Ubuntu 15.10

Just installed Ubuntu 15.10, OpenJDK 8 and Maven 3.3.3 and run 'mvn clean install' on an existing project and receives

The problem is that the Java trusted list of CA certificates is not generated properly. You need to run.

April 2, 2016

Install SSH (SSHD) in Ubuntu 14.04

Installation

Configuration

Start|Stop|Status|Restart

March 29, 2016

Asynchronous Support in Java EE 6

Introduction

Java EE 6 comes with two ready to use asynchronous technique:

  • EJB
  • Servlet

EJB

Example

Oracle Java EE 6 Tutorial: Asynchronous Method Invocation

Oracle Java EE 6 Tutorial: Using Alternatives in CDI Applications

Servlet

This asynchronous feature is less documented, but could be used for example a servlet that generates a PDF or some other heavy computing.

Example

Containers for Java Microservices

In the recent years there has been a lot of talks about microservices. There is not a clear definitions of what a microservice is and maybe more important how to build one.

But there are some clear characteristics for one:
  • Loosely coupled
  • Doing a small task/single-purpose
  • Clear API and preferably language-agnostic API
  • Etc.
But this microservice need to run in some container/server. You could of course always write everything from scratch, but that would be reinventing the wheel for some common problems like:
  • Pooling
  • Transaction (you want your business code to run in one transaction, e.g. 1. select (does object exists or fetch data), 2. insert, 3. maybe more insert for complex object insert)
  • Operation & Management
  • And maybe you need Security or Asynchronous behaviour
So what are the most popular containers? Two are
You could google comparison between them, but one good is http://www.schibsted.pl/2015/07/spring-boot-and-dropwizard-in-microservices-development/.

But how fast are these containers? To really answer this question you should of course performance test them. But a quick test would be to merely compare boot up time on my slow laptop.

Spring Boot. Followed Hello World example https://docs.spring.io/spring-boot/docs/current/reference/html/getting-started-first-application.html.

Started Example in 3.959 seconds

Dropwizard. Followed Hello World example http://www.dropwizard.io/0.9.2/docs/getting-started.html.

Started @2504ms

JBoss EAP 6.4. Created a simple Hello World example with JAX-RS.

JBoss EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21) started in 3987ms

So dropwizard started really fast, but not amazingly fast compared with JBoss, so the question arise how much better are these alternative container compared with classical Java EE container? And also be aware you are locking your code into a specific framework stack.



How to Install Jad (Java decompiler) in Eclipse

  1. Download jadclipse from https://sourceforge.net/projects/jadclipse/.
  2. Put the JadClipse JAR file into the plugins folder of your Eclipse installation.
  3. Restart Eclipse (eclipse -clean).
  4. Download Jad from http://varaneckas.com/jad/ and make it executable.
  5. Configure the path to the Jad executable in Eclipse: Window --> Preferences --> Java --> JadClipse --> Path to Decompiler.
  6. In Eclipse go to Window --> Preferences --> General --> Editors --> File Associations and make sure that the JadClipse Class File Viewer has the default file association for *.class files.
Enjoy!