January 31, 2017
Learning Maven
A colleague at work (hi Clemens! :)) has shown me the wonders of Maven, it’s a really cool tool to standardise the way Java projects are compiled, tested, packaged and distributed and also provides a great way to standardise which libraries and versions are used and downloads them automatically for you.

As everything with my blog, this is more for my future self-reference than to teach anybody anything, as I’m learning it as I go myself. Here’s what I’ve done
- Installing Java
- sudo apt-get install python-software-properties
- sudo add-apt-repository ppa:webupd8team/java
- sudo apt-get update
- sudo apt-get install oracle-java7-installer
- create $JAVA_HOME environment variable
- get path to java
- sudo update-alternatives –config java
- remove the trailing /jre/bin/java, for example if update-alternatives returns:
/usr/lib/jvm/java-7-oracle/jre/bin/java, then the path for JAVA_HOME is /usr/lib/jvm/java-7-oracle/
- add JAVA_HOME=”YOUR_PATH” to /etc/evironment
- source /etc/environment to reload the file
- java -version should now work
- Installing maven:
- wget http://www-us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
- tar -zxvf apache-maven-3.3.9-bin.tar.gz
- add the apache-maven-3.3.9/bin directory to the PATH environment variable by editing /etc/environment
- source /etc/environment to reload the file
- mvn -v should now work
- Creating a test maven project using an archetype. An archetype is just a template to create the folders structure and the default pom.xls file
- mkdir testmaven1
- cd testmaven1
- mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
- this will create a folders structure and a pom.xml file
- Adapting the pom.xml file
- The pom.xml defines what maven will do, through the following configurations
- These variables define your application
- <groupId>com.mycompany.app
<artifactId>my-app
<packaging>jar <version>1.0-SNAPSHOT
<name>my-app
<url>http://maven.apache.org
- To define the modules and versions that will be used, use the block
- <dependencies>
<dependency>
<groupId>junit
<artifactId>junit
<version>3.8.1
<scope>test
- In order to find the details of the dependency you can use mvnrepository.com, for example to figure out the details for the apache POI library you can visit: https://mvnrepository.com/artifact/org.apache.poi/poi/3.15
- Maven has a lot of plugins. Plugins are Mojos (Like Pojos, but Maven plain Old Java Object) which can be executed when running different goals.
- <build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
</plugins>
</build>
- Executing different steps in the Build Lifecycle
- If you want to compile, test and package your java project for example, it’s as easy as running mvn package.
- validate – validate the project is correct and all necessary information is available
- compile – compile the source code of the project
- test – test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
- package – take the compiled code and package it in its distributable format, such as a JAR.
- verify – run any checks on results of integration tests to ensure quality criteria are met
- install – install the package into the local repository, for use as a dependency in other projects locally
- deploy – done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.
Posted by Roge at
12:31 AM
|
Comments (0)
January 28, 2017
Puzzle building and management
My son Pelayo loves building puzzles.
He is almost three, so he’s managing to put together 6 to 12 piece puzzles. Observing him struggle with the frustrations of the problem at hand, I see some parallelisms with my day-to-day as a Financial IT manager:
1. Sometimes he has a piece in his hand that still cannot be put. His narrow view does not allow him to understand that that piece still can’t be put, so he tries to fit it until either he succeeds in hammering it into the wrong place, or by chance he drops it or loses focus on it and takes another piece which can be placed. Things take time. Sometimes it’s not the right time to put a certain piece in place. We can hammer it in place or we can take a step back and drop that piece for later.
2. Sometimes he is trying to put the piece in the right place, but since he has previously hammered the wrong piece into another place, he can’t put the piece where it should go. This confuses him: “But this is surely the cat’s tail! This must go here!”. He does not have the vision to know that there is another piece which is in his way. He tries things until by chance he takes out the wrong piece out of the way. Sometimes there is something blocking in another area which impedes us to progress, until this is fixed, we won’t be able to progress.
3. Since there is only one way all the pieces fit, and the puzzle gives immediate feedback on whether things are going well or not. If he does not lose his patience, he always ends up finishing the puzzle without needing for my help. It’s just a matter of time. Eventually things will be delivered.

Posted by Roge at
12:49 PM
|
Comments (0)
January 26, 2017
My ETH Wallet is empty!
It’s a good thing I don’t have my retirement savings in my ethereum wallet, right now as I write this, my wallet which should show ETH 205 is showing ETH 0!

Googling around I see there are others which are having the same issue, it seems to have relationship with not having a synchronised blockchain. So I’m synchronising it to see if this fixes the issue.

I am not really concerned with having lost the funds, since I can see them in etherscan.io, so let’s see what needs to be done to get them back into my wallet 🙂

I wanted to access my ETH to exchange it with XMR (Monero), the promising new cryptocurrency which addresses some privacy concerns which bitcoin has. Since I don’t know when I’ll be able to access my ETH, I’ve decided to use half my Bitcoin (XBT) balance to buy some Monero.

UPDATE: After two hours updating the local copy of the ethereum blockchain, my wallet is now showing the correct balance 🙂

Posted by Roge at
09:38 PM
|
Comments (0)
Monero is on fire
https://www.wired.com/2017/01/monero-drug-dealers-cryptocurrency-choice-fire
This alternative to bitcoin looks exciting.. it corrects the flaw that bitcoin has regarding anonymity.
“If I pay my rent in Bitcoin, it wouldn’t be that hard for the landlord to figure out how much money I earned if I don’t take extra precautions,”
On My to-do for the next month, figure out how to swap half my bitcoins into Monero. 😉
Posted by Roge at
11:29 AM
|
Comments (0)
January 16, 2017
Setting up a git server
In order to progress with my development projects, I needed to use a source control software, the best one for this is Git so I installed a Git server in one of my machines. I ran across some issues which I detail in the below steps list:
- Install Git in the server machine
- sudo apt-get install git
- Add a new user for git in the server.
- sudo useradd git
- passwd git
- Make sure to grant this user ssh access by editing /etc/ssh/sshd_config to add the line AllowUsers git
- sudo vi /etc/ssh/sshd_config
- sudo service sshd restart
- Test that you can ssh into the server with the user git from the client machine
- ssh git@server.name
- create repository in server
- sudo su git
- mkdir $HOME/gittestrepository1.git
- cd $HOME/gittestrepository1.git
- git init –bare
- create repository in client and add some files which simulate the code you wish to store in the git repository
- mkdir testgitclientrepo1
- cd testgitclientrepo1
- echo this is code>codefile1.txt
- git init
- git add .
- git commit -m “comitting code” -a
- Push the changes to the server
- git remote add origin ssh://git@katana.fritz.box/home/git/gittestrepository1.git/
- git push origin master
- Anybody who wishes to download the code can do so with the following command
- git clone git@katana.fritz.box:/home/git/gittestrepository1.git
- After they modify the code, if they want to push it into git, they must identify themselves at least the first time.
- git config –global user.email “rogemadrid@gmail.com”
- git config –global user.name “Roge Retropie”
- git commit -m “modification from retropie” -a
- git push origin master
- When working in a distributed team, when you want to update your local codebase in the morning with the changes done by your colleagues, run
- git pull origin master
- If you have done changes to your local code which you wish to discard and overwrite your local copy with the latest server copy
- git checkout — .
- git pull origin master

Posted by Roge at
12:05 AM
|
Comments (1)
January 11, 2017
The golden age of Spanish Software
Between 1983 and 1992, there was a golden age of videogame development in Spain, games developed by teams of 3-4 friends for the sinclair spectrum, msx, amstrad or commodore platforms. I was fortunate to be born in the right time to enjoy these games with my friends, I still remember fresh in my mind titles like “Livingstone Supongo”, “Navy Moves”, “Goody”, “La abadia del crimen” or “La aventura Original”
Thanks to my raspberry pi, I have found them again! 😀 Below the starting screen of “Goody”

Posted by Roge at
11:45 PM
|
Comments (0)
January 9, 2017
Old school gaming with retropie
I love old videogames, they take me back to my youth, when I spent countless afternoons playing with my friends. With my raspberry pi I’ve set up a retro-gaming station very easily by installing retropie, a raspbian distribution specifically geared to do this. This has cost me less than 2 hours and around €200
The components are:
- Raspberry pi 3 model b starter kit (€68)
- Heat dissipators (optional € 3,99)
- 7″ tft touchscreen (optional €71,95)
- Case to hold it all together (optional €19,90)
- 2 super nintendo-like gamepads (€18 each)
- Retropi (free)
- Game roms (free)

Fun times! 😀
Posted by Roge at
08:12 PM
|
Comments (0)