Thursday, October 5, 2017

What about Young Java Champions?

1. Introduction

So, I guess all of us are aware of the Java Champion term.

2. The Problem

However, I personally find it a bit unmotivating for the youngsters.
To my understanding, it's like that someone has to invest his whole life until they receive recognition.

3. My Suggestion

On the other hand, if we also introduced a "junior" edition of it, it would be much more motivating for everybody to continue contributing to the community.

Personally, I don't believe in the term "Senior", since, during my small experience till now, here are a few findings:

  • I have seen "juniors" that are more senior that "seniors"
  • this job is all about learning and evolving every single day
  • based on the above, the more exposure you have (especially including the out-of-work invested time), the more senior you are becoming day by day
  • however, the latter requires a lot of pain and effort and sometimes you might wonder "is it right? is it worth it? Am I doing it properly?", which is actually logical, since we are talking about private sector/industry and in industry it is hard to survive
I guess there are quite a few Java Engineers that are really Senior before their 30s, so, I am herewith suggesting to introduce a "below 30" Java Champions programme, so that, younger Engineers also get the chance for recognition from the community and they help themselves to stay on the correct track.

I know, one might argue that recognition comes with the followers and etc., but I strongly believe that we have to establish this programme, since in the end, it's not harming anyone and on the other hand, it also attracts more and more people to Software Development.


Saturday, September 30, 2017

Executing git commands on a different directory

1. The problem

So, you are on a specific directory, but would like to execute a git command on a different one.
I don't know whyl for me, it's just only that I'm lazy.

2. The solution

Here is your command's format git -C [directory] [git_command]

And here is a screenshot to make things more clear:

3. The reference

Further reference:


Monday, February 1, 2016

My path through OCAJP


it is about 9 months since I got OCAJP certified, but the desire to write a post just only for this single experience is still the same. Thing is I didn't keep the promise to myself (posting about the experience as a whole) just after it finished, but I lately see that more and more people reach me only for this one, so, it was a matter "if not now, then never". That is, in this post I will try to depict as better as I can my general experience and give some tips to anyone who thinks of getting certified.

1. Exam Topics
The OCAJP (1Z0-803) exam topics, are listed below:

  • Java Basics
  • Working With Java Data Types
  • Using Operators and Decision Constructs  
  • Creating and Using Arrays
  • Using Loop Constructs
  • Working with Methods and Encapsulation
  • Working with Inheritance
  • Handling Exceptions

2. Time Required
In my case, it was 2,5 full weeks, but I wasn't employed in a full-time post, at that time, so, I could apply my own reading pace/tempo, which works better at night, so, the time I chose to get this certification was the best one, for my case, but one thing I would completely do in a different way, if I took this one from the beginning, is writing more sample programs/applications to get the understanding of what I was reading, instead of rereading the specified topic/paragraph/concept.

In general, I won't provide any exact detail according to this, as it really depends on the experience. Ah, by experience, I don't mean "years of experience":

Figure 1. Years of experience nailed
The majority of people generally give an estimation range 240 - 320 hours. My position is that time isn't a proper metric, as there is only one way to understand you 're ready for the exam and is mentioned in Mock Exams section of this post), but for your information, there is also an online time estimator, for that case.

3. Online Sources
For the above, one may still have unanswered questions going directly with a book, so, you will probably find yourself in a position that he needs more information. For this reason, the following links are considered a good idea:
  • Java API documentation
  • Coderanch Forum - good thing here is that usually the (certification) book authors are also members of the forum, so, it's a good chance to learn from them. In addition, I believe this is the best place to ask a relative question, no matter how strange you think it is.

4. Recommended books
I found myself in a position that an in depth explanation book was required, as I was (still am :) ) newbie to the language, so, I went for OCA Java SE 7 Programmer I Certification Guide: Prepare for the 1ZO-803 exam, as it's well-written. It also covers all exam topics (so, by default, one could only go with this) including funny images and pictorial diagrams that help the candidate better understand the concept he's going through, quizzes at the end of each chapter to better master the concept and two mock exams to let you know of your preparation level.

Moreover, there is also another side that believes Oracle's OCA Java SE 7 Programmer I Study Guide (Exam 1Z0-803) is the best solution for succeeding, but I would only recommend this to more experienced candidates, not to juniors. as it contains a lot of errata, typos and even incorrect information, so you may go out the correct path. Thing is, I wouldn't go for this one, even if I was a senior. The reason? It's sure that I would spend some time to make clear that a specific topic was analysed wrong or the output of an example was wrong or a specification according to language was wrong, which means that I would need twice the initial time it would require me to understand what I was reading. Calculations are easy to make for a combination of the fore-mentioned errors and I don't believe one would like to spend a life preparing for this certification, as it's just the hall/prerequisite to others (and this is the only advantage I'm finding on this specific book: it covers both OCAJP and OCPJP) :

Figure 2. Java certification path

5. Notes
No matter of the book/books you're gonna give a try to, always remember to take down your own notes as you make your path to the certification, as you 'll also notice by yourself that even after two or three times of reading a specific feature of the language, you either do not understand it or you have to reread it in order to refresh your mind. This is just usual, as we all may think that we know Java, but when it comes to certification, even the seniors may face language aspects for whoms existence they were never aware of. So, keep your own notes. Specifically, only the ones you find hard to memorize/understand at a first glance, as you are the final candidate and you will take the best notes for yourself. What I mean, is that you 'll obviously find several notes from individuals around the net, just like mine, but the fact these helped me, doesn't mean that will also help you. Everyone writes down what he thinks is the best for him to remember/memorize; one could be good in concurrency for example (ok, foul, this is an ocpjp topic :-) ), and will not even have to write something down, but my very first reading about it was in the book I chose to be prepared for the certification with, so I have to keep somewhere the important from my perspective points.

6. Mock Exams
Many claim that due to the exam style, one can only be ready, after having gone through many mock exams. You may also hear that what here stands for the experienced ones, is just getting some good mock exams (and by good, I mean, solutions that explain in-depth each one of the possible answers of a question, even the correct one, as the candidate have to make clear why each one of the wrong ones is actually wrong, in order to avoid common mistakes and to also understand the correct one).

There are two solutions, one for those who prefer reading @ their pc and the other for the book-lovers. Fortunately, both will cost you no more than 13€.

When it comes to the software solution, the majority of people only proposes Enthuware's solution, no matter of the exam. Same stands for the OCAJP. But, for the book recommendation, the solution hears to a title like OCAJP Oracle Certified Associate Java SE 7 Programmer Practice Exams, from Hanumant Deshmukh and I can verify that this product is the best for the OCAJP exam, as it provides five full mock exams with an in-depth approach to all the possible answers and the reason each one of them was right/wrong.

My advice through this one :
  • Always read all of the possible answers' explanation, as you 'll find yourself like being in a position of unlocking new aspects of the language.
  • On the other hand and in conjunction with the above point, repetition on failing tests will help you enhance the memorization required.
  • Don't go through to the next exam if you didn't get a passing score in the current one; that is, the exam is long enough (take+review) to forget many things, so, there is also a case that you 'll fail more than once.
  • Getting scores on the border line is a good sign for this book, as it's considered more hard than the actual exam, so if you don't care about your final score itself and just want to get the certification, book an exam taking, when on border line!

7. Examination
You first have to book an exam through PearsonVue. Nowadays, the word is so spread that when I was in the same position, I even found 3 supporting test centres in Thessaloniki, Greece and one of them offered this exam once every two days, so, I wasn't worried about the booking, but you obviously have to make an investigation first, to see what's going on, according to your location and to decide whether or not should you care about the booking.

Exam fee is 230€ and you have to reach the examination center 30' earlier, for the required identification process.

During the exam you are given a piece of plastic whiteboard (about 30cm x 25 cm) with a black highlighter. (debugging, etc.). If there's anything you want to ask (non-technical - bathroom, etc.), you can raise up your hand and the responsible person from the training center will enter the examination room, ready to help. That is, there is a camera in the examination room.

A final and more related to the technical part of the exam point is that you are informed from the examination system that there are 2-3 questions that will not be countered to the results, but you don't actually know which one of them.

Good luck!

Tuesday, January 5, 2016

Happy New 2016!

Hey, 2015 is over.

Did you notice that or you just started a new year just like it was an ordinary day?

Truth is: I was planning a few additional posts for 2015, but I found myself in the need of some rest from the ordinary things I like doing, after having had a hard time combining my daily job duties with my thesis implementation (yes, I finally graduated), which means that I lately got used to reading about front-end stuff.

Second truth is, I don't know anything about it, as javascript evolves very fast. Keywords here for 2016, are:
So, in continuation of my Angular.js examples, I lately got myself exposed to some jQuery stuff, through the percircle project, but I there noticed I also need CSS for many reasons.

Generally, everyone says "basic skills in js and css are a must, no matter of his/her duties", but one can hardly ever understand his lack of knowledge, without exposure to real world problems. Thing is, that both of the above are just baby steps on the front-e, so, Santa, please make my days last 26 hours, in order to extend my knowledge on front-end technologies.

In addition, please make sure the following ones will be accomplished on 2016:
  • deeper knowledge on Java Core
  • better time management and problem approach 
They say "better problem approach comes with experience". I believe that better time management makes experience.

Ok, things seem to get worse day by day for us, here in Greece, but we 're not the only ones that are facing poverty (and I'm not talking for the disability to buy an iPhone). Let's try and help poor people on streets, either by money or by food. For us, the cost would be like a coffee with a friend, but for them, sth like 2€ is many times the one and only daily meal.

I was about to close this post here, but I found the above image, while only searching for the "poverty" term, so, I couldn't leave unemployment out of y wishes, according to my country. It's a shame for this country watching so many guys leaving it and going abroad for a job, for a better job, for a better living, for a better future for themselves and their families. 

Hey Santa, also bring some employment and better working conditions to your sunny Greece, I'm sure you 're the only one who can do it.

Happy New 2016 :)

Sunday, November 22, 2015

The first global day of coderetreat in Thessaloniki

Hi there,

feels like a Sunday afternoon, having had one night with friends from far away, that joined me for the weekend, in order to celebrate my graduation (ok, that's a separate post, so let's leave it for now).

Getting to know the event itself

Traveling back in time, I can remember myself reading a tweet from Patroklos about the 1st global coderetreat event in Thessaloniki. That time, I was in a rush preparing my thesis for October's presentations, so I just put it in my TODOs list. Unfortunately, the fore-mentioned "rush" was an overkill for the last 3 months (I was trying to combine my thesis implementation progress, together with my daily job - did I just say that I will leave the "studies" part out of this post?!), so at that time, my TODOs list maintained greek software management's attitude. Hopefully, some days after, I noticed that there were some cancellations, so, keeping in mind that I had never been in such an event, I'd surely go; I didn't read much about it, I just liked the concept as a whole, so this one would be a new experience (ok, having completed about a year on industry, almost everything that you get exposed on is new) for me.

Reaching the event's place

The event was planned for the 14th of November (Saturday?), so, keeping in my mind that it was a hard week for myself and I, I had to sacrifice Friday's outing for rest. Woke up on time, I reached coho, about 9:20, so I had some time to get my breakfast and get awake.


Patroklos and Nikos were the event organizers. The problem introduced was Conway's Game of Life, which had to be approached, regarding the event's concept, following the rules below:
  • For each session, you have to pair with a different partner.
  • At the end of each session the code has to be deleted (, so, for each new session, a completely new project/code template has to be created).
  • Each pair must only use 1 pc.
  • Each session lasts for 45 minutes; that is, the development process is only 45' minutes.

The Sessions

After the introduction of the game, the rules definition and the event's concept, we were said that there were going to be six different sessions, with the first and the last to have a free character, whereas in general, each session would have an increased difficulty level, compared to the previous one. The difficulty level generally depends on the session's restrictions set initially.

Session 1

A fair introduction to the problem from my partner and some trials to adjust the working environment according to the nearest IDE/language preferences that we had in common. Time seemed to be passing by very quickly on this session and that's why I believe it had no challenging character, just an introductory one to the event.

Session 2

Hmmm...restrictions started: "Solve the problem using TDD's ping-pong approach". One writes the test and the other only tries to get the tests to pass. Obviously, both of them have to refactor when appropriate.

I haven't had prior experience on TDD and I really liked this one; it helps so much for writing cleaner code. 

Session 3

Ok, seems like we 're getting into the meat. What's the next restriction? "Your methods must contain no more than 4 lines of code". Oooh, that one hurt. Or not? After explaining my approach to my partner, it seemed like we had an agreement for this one, but I was still wondering how we could fulfill the requirement. Hopefully, he knew Java 8 and our methods didn't exceed 2 lines.

At this point, let me state the following thought: I have also attended an Oracle's free course for Java 8 lambdas and streams, but this one displayed the difference of using them in production, too. So, I'll surely have to sometime get deeper into it, even for a sample project.

Session 4

"No try/catch, no if/else statements". By default, this one seemed enough challenging, but a big part of the session spent on environment setup and language definitions, as both of us didn't have enough experience with pure PHP. Having had a small amount of time to approach the problem following the restriction set, this one was the hardest one, I would say, as you were obliged to break your code into smaller and smaller functions.

That is, it seemed hard, as we got used to just solving the problem and obviously, the fore-mentioned phrase does not contain keywords like "effectively" or "cleanly".
Many of you, readers/devs, would instantly blame your team leaders or software management team and its roots and I wouldn't completely disagree, if the conversation was about project/delivery management or software architecture, but now, it's all about code; it's not a common phenomenon when a supervisor of yours will tell you how to actually write your code, especially here in Greece.

Nevertheless, we 're still in software and indeed, there is a workaround, for this one, too: for the next time you 're gonna get into some refactoring, if you notice something that would be better changed/written in another way, don't leave it after the upcoming delivery or for tomorrow. Don't try to persuade yourself that you don't currently have enough time for this. Breaking a method to smaller ones, creating a separate package for some common classes or providing some documentation won't last more than 5'.

And by this you 're not only saving time for yourself (that is, there are many times, that even returning to a code block of yours, written 1 month ago, the "wtf" counter starts incrementign surprisingly), but for the rest ones that will read your code in the future.

Imagine what would happen if you applied this simple practice in your daily job and if you also persuaded your colleagues to do so:

  • long-term time saving
  • readable and maintainable code
  • less future refactoring

So, from yesterday, you should start thinking about it, I should start thinking about it, we should start thinking about it, as serious software is a result of good teams and good teams are based not only to team leaders (Figure 1), but on good developers, too.
Figure 1. Boss or Leader?

Session 5

"No mouse". After hearing this restriction, we simply started laughing, but my initial thought was sth like "how on earth would you benefit of writing cleaner code, from this one?". Ok, it may not be one of the direct "clean code" practices, but it's worth following it while writing code (especially on an IDE), for productivity purposes.

I consider myself knowing enough keyboard shortcuts and I feel lucky for this one, as I had the chance to work closely with guys who liked using them for development. so initially, this one didn't seem as a threat, but when it came to switch to browser, things got difficult enough :).

Session 6

The last session was on the same line as the first one, keeping the character of a free session, but we were also encouraged to apply what whe learned during the day.


Ok, it was an exhausting day, in conjuction with an exhausting week, too, but in the end of the day, what only matters, are the feelings for it and my feelings according to the event were great. These feelings were also enchanced from the retrospectives that followed each individual session, where we discussed our approaches and how each one them could be better developed.

First off all, I had the chance to come back to social life (after spending the whole summer for the development of my thesis project, in parallel with my daily job), which means meeting new people who have same interests.

Second of all, I believe that all of us leveled up our experience on time management (depending always on the experience of each one), as the event itself pushes you to make the best out of your communication skills, in order to handle team decision making for each session. I'm also grateful that some of my pairs were js guys, as I lately see myself very keen on reading about JavaScript and front-end, in general.

The good thing is that I saw practices that I have never worked with, like TDD: I was really amazed of the way the ping-pong approach works. In addition, seems like Java 8 is here to reduce lines of code for common problems and increase productivity.

Finishing this part and the post itself, I noticed some technical weaknesses of mine, but I won't blame myself for this; instead I will keep them in mind, as points where more practice is required, 'cause I have a way to go as a developer.


Sunday, July 5, 2015

JAXB Unmarshalling Example

1. Introduction

1.1 Apologies


It's been a loooong time since my last post, so, first of all, let me apologize for this absence

The reasons:
  • The tiny OCAJP badge that you see in the right side of the blog (I will refer to this tin a forthcoming post).
  • I currently have limited time available.

1.2 Example's concept

What we 're gonna see today is how to convert an XML document to a Java Object. This (and the reverse - Java object to XML transformation) usually occurs when a software deals with Web Services.

2. The Example

We 'll here demonstrate how to convert an xml list of objects to a Java object. This can be easier using the JAXB Technology. JAXB stands for Java Architecture for XML Binding. It is used to convert XML to Java objects and vice-versa.

Environment used:
  • JDK 1.7
  • Eclipse Luna

I've the environment that I used, as from JDK versions 1.6 and later, the JAXB dependency is bundled into the JDK, in contrast with previous JDK versions, where you had to at least include the following dependencies onto your classpath: “jaxb-api.jar” and “jaxb-impl.jar”.

That is, we here don't have to include nothing at all.

Here is the project structure of this sample, a simple one as you can see, too:

2.1 The XML file

As I said, we 'll here deal with a smartphones list, so, just for demonstration purposes, two smartphones are here listed:

<?xml version="1.0" encoding="UTF-8"?>
  <model>Galaxy Ace</model>
  <model>Moto G 2014</model>

2.2 The Beans

Each smartphone can be described with a DTO class, so here it is:
package com.toubou91.jaxb.example;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "smartphone")
public class Smartphone {

 private String make;
 private String model;
 private String androidVersion;
 // Getters and setters.
 public String getMake() {
  return make;
 public void setMake(String make) {
  this.make = make;
 public String getModel() {
  return model;
 public void setModel(String model) {
  this.model = model;
 public String getAndroidVersion() {
  return androidVersion;
 public void setAndroidVersion(String androidVersion) {
  this.androidVersion = androidVersion;
 public String toString() {
  return "Smartphone [make: " + getMake() + ", model: " + getModel() + ", android version: "
     + getAndroidVersion() + "]" ;

This is about a bean class containing JAXB annotations, in order to easily handle the properties we want to be traversed from/to XML. According to this When a top level class is annotated with @XmlRootElement maps a class or an enum type to an XML element (in our case,  the <smartphone> tag).

 @XmlAccessorType controls default serialization of fields and properties. That is, it allows us to configure the use of fields or properties to access the data in our domain object (Smartphone object). This is specified as an XmlAccessType (PUBLIC_MEMBER, PROPERTY, FIELD, or NONE) via the  @XmlAccessorType annotation. We use access type FIELD to cause JAXB implementations to create bindings for fields and annotated properties. So in our case all fields (make, model, androidVersion) are marshalled/unmarshalled by JAXB.

The toString() method has to be overrided in order to get a human-readable output format. Otherwise, for each object that will be manipulated, the output will be something like Smartphone@4bbc148 .

We obviously need a second class that holds a list of Smartphone objects:
package com.toubou91.jaxb.example;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "smartphones")
public class Smartphones {
 @XmlElement(name = "smartphone", type = Smartphone.class)
 private List<smartphones> smartphones = new ArrayList<smartphones>();
 public Smartphones() {}
 public Smartphones(List<smartphones> smartphones) {
  this.smartphones = smartphones;
 public void setSmartphones(List<smartphones> smartphones) {
  this.smartphones = smartphones;
 public List<smartphones> getSmartphones() {
  return smartphones;

2.3 The Helper class

Let's create a helper class to easily unmarshalla requested XML file.
package com.toubou91.jaxb.example;

import java.util.List;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

public class JAXBXMLController {

 public static List<smartphones> unmarshal(File file) throws JAXBException {
  Smartphones smartphones = new Smartphones();
  JAXBContext jaxbContext = JAXBContext.newInstance(Smartphones.class);
   Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
  smartphones = (Smartphones) jaxbUnmarshaller.unmarshal(file);
  return smartphones.getSmartphones();

2.4 The Demo

Finally, let's test what we just created!
package com.toubou91.jaxb.example;

import java.util.List;

import javax.xml.bind.JAXBException;

public class Demo {

	public static void main(String[] args) {

		List<smartphones> smartphones = null;
		try {
			smartphones = JAXBXMLController.unmarshal(new File("src/smartphones.xml"));
		} catch (JAXBException e) {

3. Git repo

You can also find the corresponding source code in this github repo.

Saturday, April 11, 2015

How to change the default installation directory in Windows

1. The problem

I've got a partitioned ultrabook, where OS is installed in the C:\ drive. That is, my C:\ drive has a small amount of available GBs, so, each time I want to install a new software, I have to manually change the setup wizard's default directory ( C:\Program Files\ ) to my D:\ drive.

2. The solution

In order to change the default installation directory for a Windows machine, we have to modify its registry:
  • Start -> Run, type
    and hit OK.

  •  Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion and change the highlighted variables (right-click -> Modify) with the desired ones: