Sunday, 17 April 2016

Docker memo

Install Docker on Ubuntu 14.04 LTS


First update your packages:
> apt-get update

@Deprecated
Install docker-io package:
> apt-get -y install docker.io
> ln -sf /usr/bin/docker.io /usr/local/bin/docker

Configure the Docker service to run when the OS boots:
> update-rc.d docker.io defaults

You're done !
You can alternativly use Vagrant Docker provisionner.
Now you can install Docker-compose
 
> sudo apt-get -y install python-pip
> sudo pip install docker-compose
 

Remove old containers:

> docker ps -a | grep 'weeks ago' | awk '{print $1}' \
        | xargs --no-run-if-empty docker rm 
 

Add an insecure docker registry:

add the following line to /etc/default/docker:
DOCKER_OPTS="--insecure-registry  dregistry.myinsecreg.com"

Thursday, 19 November 2015

Spring Vs Vanilla JEE (e.g. Wildfly)

A good "battle" around this topic:
https://news.ycombinator.com/item?id=9519773

Wednesday, 7 October 2015

JBoss port conflict

Running more than one JBoss instance in the same machine leads to port conflict. You can solve this problem by running the second instance by adding this parameter :
-Djboss.service.binding.set=ports-01

See more: http://www.eeblog.org/index.php/jboss-run-2-instances-in-the-same-environment-and-avoid-port-conflicts/

Tuesday, 4 August 2015

How to encrypt your Maven password (for Nexus access)

http://www.objis.com/formation-java/tutoriel-maven-securite-login-mot-de-passe-security-settings-xml.html

Wednesday, 14 January 2015

Java Memo

Initialise a list:

Immutable

List<String> people = Arrays.asList("me", "you");
 

Mutable

ArrayList<String> people = new ArrayList<>(Arrays.asList("me", "you"));

or use the double brace initialization:
 
ArrayList<String> people = new ArrayList<String>() {{
    add("Me");
    add("You");
}} 
 

Friday, 7 November 2014

Performance test tools

Gatling: http://gatling.io/

To benchmark HTTP servers:
http://httpd.apache.org/docs/2.2/programs/ab.html
 

Thursday, 30 October 2014

First start of MySQL with Wamp

After checking the listening port in my.ini file, read this:
http://www.commentcamarche.net/faq/12341-phpmyadmin-1045-access-denied-for-user-root-localhost

Friday, 10 October 2014

Changer le port d'écoute sur un serveur Apache (httpd)

Aller dans le répertoire d'installation de votre serveur Apache
Ouvrir le fichier (mon serveur est sur c:)
C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf
Changer la ligne "Listen 80" pour correspondre au port entrant (ouvert ?) que vous voulez.

Exemple: changer le port en "83"

Extrait du fichier httpd.conf
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:83
Listen 0.0.0.0:83
Listen [::0]:83

Tuesday, 1 July 2014

Créer un projet maven, importer dans eclipse et lancer les tests

Commencer par installer Maven 3.2.2
Configurer le PATH si vous êtes sous windows.

Créer un nouveau projet Maven:
    mvn archetype:generate -DgroupId=projet1 -DartifactId=projet1  -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Générer les fichier necessaire à un import dans Eclipse (.project)
    mvn eclipse:eclipse

Lancer les tests uniquement (sans passer par les phase de compilation, packaging ...)
    mvn surefire:test

Wednesday, 14 May 2014

You use ClearCase let's learn Git and vice-versa

I found a great presentation on the differences between CC and Git:
https://www.open.collab.net/media/pdfs/ClearCase-and-the-journey-to-Git.pdf

Tuesday, 22 April 2014

Comment créer un processus de delivry

«  La recette est simple. Il faut analyser les projets performants et identifier les facteurs déterminants. Isoler et tester ces pratiques puis les « pousser à l’extrême » et faire le bilan. Enfin les généraliser en communiquant sur leurs avantages et en les déployant. »
 Kent Beck (source: http://fr.wikipedia.org/wiki/Kent_Beck)

Monday, 14 April 2014

Thursday, 27 February 2014

Eclipse Install new software fails



If you try to add new features from an update site and you get the following strange error:

Cannot complete the install because one or more required items could not be found.
  Software currently installed: Shared profile 1.0.0.1385682248052 (SharedProfile_SDKProfile 1.0.0.1385682248052)
  Missing requirement: Shared profile 1.0.0.1385682248052 (SharedProfile_SDKProfile 1.0.0.1385682248052) requires 'toolingwin32.win32.x86org.eclipse.equinox.p2.reconciler.dropins [3.6.2.M20110210-1200]' but it could not be found


Restart you eclipse as administrator and you problem will be solved.
It fails since you don't have write access to the folder where your eclipse is installed.

Monday, 17 February 2014

Git: creating and importing patches

A useful command when you need to contribute to open source projects:
1. Create a patch from your last commit (-n for the n latest commits). The following command will create a <myKillerPatch>.patch file in the current directory
   git format-patch -1
2.  Test the patch
   git apply --check <myKillerPatch>.patch
3. Finalyy import it
   git am <myKillerPatch>.patch

Tuesday, 26 March 2013

TDD ? why ?

I have met some developpers that are still relectant to work within a TDD approach. So my guess is that they don't see exactly what are the clear benefits from using this approach. So here are the most powerful to my mind:
When using a TDD approach (by the way TDD means Test First and refactoring)

1.You have a clear and formal specification of what you have designed and implemented. Not only a piece of comments, that by the way will pe deprecated after a while. This is really useful for maintenance (bug fixes, regression, evolution)
2.You have a MAXIMUM code coverage and NO DEAD CODE
3. You have methods in your test that express your test intentions and not a test method per method in the class under test.

The process:
    0. Create a todo list from a specification
    1. Create a test case automatically with the IDE
    2. Add 1 new test from the todo list
    3. This test shouldn't compile. Add the minimum code to compile.
    4. execute and get the red bar (Junit Eclipse plugin)
    5. Add minimal code to pass the test (the green bar)
    6. Refactor
    7. goto2

Some resources on how TDD helps in reducing the software development costs:
- http://codebetter.com/darrellnorton/2003/12/03/what-is-the-zero-defects-mindset/

Sunday, 24 March 2013

Scala Collection framework

I'm really impressed by the elegance of the collection operations of Scala. For example the following code

       val l = List(1,2,3)
        val (l1, l2) = l partition (_>1)
        println("l1 = " + l1)
        println("l2 = " + l2)

will produce:
l1 = List(2, 3)
l2 = List(1)

We can also do that with one line of code:
val (l1, l2)  = List(1,2,3) partition (_>1)

Beautyfull !

Friday, 22 March 2013

Gestion des variables d'environement

Sous windows la gestion des variables d’environnement se fait comme suit :

Variables système

Pour modifier une variable d'environnement, vous devez être administrateur. Les variables d'environnement sont définies par Windows et s'appliquent à tous les utilisateurs. Les modifications apportées à l'environnement système sont écrites dans le registre, et nécessitent le redémarrage de l'ordinateur pour prendre effet.

Variables utilisateur pour nom_utilisateur

Tout utilisateur peut ajouter, modifier ou supprimer une variable d'environnement utilisateur. Ces variables sont définies par le programme d'installation de Windows XP, par certains programmes et par les utilisateurs. Les modifications sont écrites dans le registre et, en général, prennent effet immédiatement. Cependant, une fois qu'une modification est apportée aux variables d'environnement utilisateur, tous les logiciels en cours d'utilisation doivent être redémarrés pour les forcer à lire les nouvelles valeurs du registre. La principale raison à l'ajout de variables est de fournir des données nécessaires à des variables que vous voulez utiliser dans des scripts. 

 Source: http://support.microsoft.com/kb/310519/fr

Wednesday, 20 March 2013

Domain Driven Design: a new book

I've discovered the new book on DDD, and the interview of its author:
http://www.informit.com/articles/article.aspx?p=2023702

It seems more easy to read an implement than Eric Evans....