# Global Day of Coderetreat as a Facilitator

###### 10 March 2019 · 13 mins

November 2018 I had the luck to facilitate the Global Day of Coderetreat in Utrecht for my second time. Let’s walk together through the day to see how I experienced it as a Facilitator & Observer!

continue...

###### 31 December 2018 · 6 mins

I will not write a blog about my year’s resolution, since trying to motivate you is more important. No matter how your 2018 was like, we need to make sure 2019 is a better one. Here’s my tips list to do so.

continue...

# You Get what You Want

###### 29 December 2018 · 5 mins

There is a specific sequence of steps one needs to follow when it comes to achieving a goal. First, you need to realize what you want. Then ask for it and I ensure you it will never come/happen naturally/directly. There are sometimes specific circles that need to be completed before you get what you want.

continue...

# My first time as a Coderetreat Facilitator

###### 4 March 2018 · 8 mins

1. Introduction November 2017 I facilitated the Global Day of Coderetreat 2017 in Utrecht, Netherlands. In the past, I have already attended one coderetreat in Thessaloniki, Greece, but it was quite different to experience it from the facilitator’s perspective. As it was my very first time facilitating such an event, I wanted to keep the amount of people really low (20) and also recruited two co-facilitators, Joost and Patrick. Let’s see my notes during the day, while observing how teams were working on each different session.

continue...

# How to sync a fork

###### 25 February 2018 · 2 mins

1. Introduction So, you forked a repo, started working on it (or just forgot it there because you also had other stuff to take care of 😂😂️). The parent fork continued evolving and you ended up at point where you want to also update your fork with the last HEAD of the parent,

continue...

# My first time as an exhibitor

###### 30 January 2018 · 1 min

Hey, I’ll keep this post abstract, since I’m really rushing for other stuff. Today I was at the JVMCON, which was actually the very first event that I attended as an exhibitor:

continue...

# Difference between Iterable and Iterator in Java?

###### 8 January 2018 · 7 mins

0. Introduction At a very first glance, those two classes, Iterable and Iterator seem to be invented and used for the same purpose, without any crucial difference between them. However, if one dives a bit more into them, they understand the reasoning behind having two separate classes for iterating over a collection of objects.

continue...

# How to solve UnicodeDecodeError: 'ascii' codec can't decode byte

###### 6 January 2018 · 1 min

1. Problem developing greek name days tweets a got that error UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xcf in position 1: ordinal not in range(128)

continue...

# How to checkout (on a forked repo) a Pull Request coming from the main repo?

###### 11 November 2017 · 2 mins

0. Introduction By reading the related question on StackOverflow, you can get a very first understanding of today’s topic.

continue...

# Propagate latest change to all git tags?

###### 1 November 2017 · 1 min

1. Situation Sometimes you have to perform a hotfix release, which essentially means that you have to checkout a specific (old) tag and perform some changes over there. However, there is a case that there are other changes that need to be applied also, since the codebase has been updated from the time of that specific tag and there are new dependencies between classes, new external dependencies, etc.

continue...

# How to push large files to GitHub

###### 31 October 2017 · 1 min

1. Problem You’re not allowed to push files larger than 100MB to GitHub:

continue...

# How to make a day last for 26 hours

###### 19 October 2017 · 1 min

You know, it was one of these weird days that I start doing open-source and hop to hop I end up with meaningless ideas. One of these was the god-requests repo. Till now, I have only “submitted” 1 request (feel free to also contribute to this meaningless effort :-P ), which is about making a day last for 26 hours:

continue...

# Hi again

###### 15 October 2017 · 3 mins

Intro Well, it’s been a really crazy period and I’m not referring to anything else other than my thoughts regarding my blog. From Blogger to WP to Jekyll to WP to Blogger to…finally Jekyll again, it’s been a long journey.

continue...

# What about Young Java Champions?

###### 5 October 2017 · 2 mins

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

continue...

# Executing git commands on a different directory

###### 30 September 2017 · 1 min

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.

continue...

# The best way to implement a Singleton

###### 27 September 2017 · 1 min

OWH. MY. GOD. The more I study about OCPJP, the more I make clear how stranger I am to this language. Guys, herewith I share with you the code-snippet:

continue...

# Passing null to overloaded methods

###### 25 February 2017 · 1 min

Assume we have an overloaded method that looks like this:

continue...

# GitHub bug

###### 24 January 2017 · 1 min

Situation Today, on a Windows machine, I was about to create a new issue in GitHub.

continue...

# How to call a JavaScript function recursively

###### 12 January 2017 · 1 min

Situation So I have developed math.js, a small npm-package (still WIP), which contains very simple functions, in a format like below:

continue...

# div styled spans

###### 17 November 2016 · 1 min

Situation Someone is totally amateur to front-end stuff, but likes a lot this totally new process of learning. I am in React and I wanna create a small header-like thingy, without using any table tag. So, only divs, but wouldn’t it be better just for readability purposes to use a span for every header itself and then wrap them all together around a div ?

continue...

# Import same-named classes from different libraries

###### 24 October 2016 · 2 mins

The problem Import same named classes from differenet modules Use case Someone was investigating the already existing solutions for bar graphs, so, at some point, he wanted to test in the same page two different bar chart components, let’s say from react-svg-chart and recharts libraries.

continue...

# What to avoid when time presses

###### 24 July 2016 · 1 min

The answer to the title’s question is just one line: Never do anything with a way that you never tried before, when time presses.

continue...

# Open source contribution on DevIT site

###### 28 March 2016 · 7 mins

1. Preface Well, it’s been a while since my last blog post and honestly, many things changed.

continue...

# My path through OCAJP

###### 1 February 2016 · 11 mins

Hey,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".

continue...

# Happy New 2016!

###### 5 January 2016 · 3 mins

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.

continue...

# The first global day of coderetreat in Thessaloniki

###### 22 November 2015 · 11 mins

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).

continue...

# JAXB Unmarshalling Example

###### 5 July 2015 · 6 mins

1. Introduction1.1 ApologiesHey!It's been a loooong time since my last post, so, first of all, let me apologize for this absenceThe 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 conceptWhat 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 ExampleWe '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.7Eclipse LunaI'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 fileAs I said, we 'll here deal with a smartphones list, so, just for demonstration purposes, two smartphones are here listed:smartphones.xml Samsung Galaxy Ace 2.2 Motorola Moto G 2014 5.0.1 2.2 The BeansEach smartphone can be described with a DTO class, so here it is:Smartphone.javapackage com.toubou91.jaxb.example;import javax.xml.bind.annotation.XmlAccessType;import javax.xml.bind.annotation.XmlAccessorType;import javax.xml.bind.annotation.XmlRootElement;@XmlAccessorType(XmlAccessType.FIELD)@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; } @Override 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 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:Smartphones.javapackage 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;@XmlAccessorType(XmlAccessType.FIELD)@XmlRootElement(name = "smartphones")public class Smartphones { @XmlElement(name = "smartphone", type = Smartphone.class) private List smartphones = new ArrayList(); public Smartphones() {} public Smartphones(List smartphones) { this.smartphones = smartphones; } public void setSmartphones(List smartphones) { this.smartphones = smartphones; } public List getSmartphones() { return smartphones; }}2.3 The Helper classLet's create a helper class to easily unmarshalla requested XML file. JAXBXMLController.javapackage com.toubou91.jaxb.example;import java.io.File;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 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 DemoFinally, let's test what we just created! Demo.javapackage com.toubou91.jaxb.example;import java.io.File;import java.util.List;import javax.xml.bind.JAXBException;public class Demo { public static void main(String[] args) { List smartphones = null; try { smartphones = JAXBXMLController.unmarshal(new File("src/smartphones.xml")); } catch (JAXBException e) { e.printStackTrace(); } System.out.println(smartphones); }}3. Git repoYou can also find the corresponding source code in this github repo.

continue...

# How to change the default installation directory in Windows

###### 11 April 2015 · 1 min

1. The problemI'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 solutionIn order to change the default installation directory for a Windows machine, we have to modify its registry: Start -> Run, type %systemroot%\syswow64\regedit and hit OK.  Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion and change the highlighted variables (right-click -> Modify) with the desired ones: Enjoy!

continue...

# How to solve Failed to execute 'send' on 'XMLHttpRequest': Failed to load [filename]

###### 22 March 2015 · 2 mins

So, the other day I was writing my AngularJS Routing Example for the WCG community and I suddenly got in a kind of trouble: I couldn't seem to get it working!!!My app's critical point was that I was trying to deploy an app that included ng-view, to a browser.By default, a browser doesn't allow AJAX requests to files located on your local file system. This happens for security reasons. But, ng-view uses an AJAX request to load templates, so the options are:Configuring your browser in order to allow local files access; (this link explains how to implement this action in Google Chrome)Run your app in a local web server.The first option is quite straightforward, so I'll stick with the second one. I recommend users that don't have locally a web-server, to go for an open-source solution, like http-server, which can be configured very easily.I'm a Java lover and I have installed one distribution of Tomcat in all of my working instances, so the following demonstration is about running an Angular app to Tomcat:Copy or move your app's folder to Tomcat's /webapps folder and execute:Navigate to Tomcat's /bin folder and execute the startup script:Verify that Tomcat deployed your app:Access your app from Tomcat, you should have a clear console now:Cheers!

continue...

continue...

# Test markdown

###### 28 February 2015 · 2 mins

You can write regular markdown here and Jekyll will automatically convert it to a nice webpage. I strongly encourage you to take 5 minutes to learn how to write in markdown - it’ll teach you how to transform regular text into bold/italics/headings/tables/etc. Here is some bold text Here is a secondary heading Here’s a useless table: Number Next number Previous number :

continue...

# Flake it till you make it

###### 26 February 2015 · 3 mins

Under what circumstances should we step off a path? When is it essential that we finish what we start? If I bought a bag of peanuts and had an allergic reaction, no one would fault me if I threw it out. If I ended a relationship with a woman who hit me, no one would say that I had a commitment problem. But if I walk away from a seemingly secure route because my soul has other ideas, I am a flake? The truth is that no one else can definitively know the path we are here to walk. It’s tempting to listen—many of us long for the omnipotent other—but unless they are genuine psychic intuitives, they can’t know. All others can know is their own truth, and if they’ve actually done the work to excavate it, they will have the good sense to know that they cannot genuinely know anyone else’s. Only soul knows the path it is here to walk. Since you are the only one living in your temple, only you can know its scriptures and interpretive structure. At the heart of the struggle are two very different ideas of success—survival-driven and soul-driven. For survivalists, success is security, pragmatism, power over others. Success is the absence of material suffering, the nourishing of the soul be damned. It is an odd and ironic thing that most of the material power in our world often resides in the hands of younger souls. Still working in the egoic and material realms, they love the sensations of power and focus most of their energy on accumulation. Older souls tend not to be as materially driven. They have already played the worldly game in previous lives and they search for more subtle shades of meaning in this one—authentication rather than accumulation. They are often ignored by the culture at large, although they really are the truest warriors. A soulful notion of success rests on the actualization of our innate image. Success is simply the completion of a soul step, however unsightly it may be. We have finished what we started when the lesson is learned. What a fear-based culture calls a wonderful opportunity may be fruitless and misguided for the soul. Staying in a passionless relationship may satisfy our need for comfort, but it may stifle the soul. Becoming a famous lawyer is only worthwhile if the soul demands it. It is an essential failure if you are called to be a monastic this time around. If you need to explore and abandon ten careers in order to stretch your soul toward its innate image, then so be it. Flake it till you make it.

continue...

# Create your own movie database easily with SmartMovieDB!

###### 14 January 2015 · 5 mins

You can directly jump to the git repository that hosts this project :)There's a pretty nice source over the internet, regarding the creation of your own movie database.You can read in detail its usage and functionality over the fore-mentioned link, but, generally, the following schematic explains how it works:That is, you give as an input a text file that contains the desired movies' names and with the help of the perl scrapper, you get an output of an sql format with all the sql commands that need to be done to your database.This means of course some extra effort, so why don't we go for an automatic process? What about an sql script runner, which takes as an input an SQL file, connects to the specified database and runs the generated from the scrapper script, queries?  It would be nice if we could stick with Perl, but I didn't had the luxury to waste a lot of time on Perl-MySQL connection, so I chose the easy way, which is Java and fortunately, there is an easy way to do it, again with the support of an open source project (we 'll here need only one part of it, as you noticed, too).I'm choosing to start with the Java project, which is responsible for reading an sql file and executing the included queries to a given database connection:DatabaseConnection.java defines a valid database connection.ScriptRunner.java is responsible for the convertion of sql statements into databse queries.MainClass.java coordinates the game, as the script runner's instance needs a connection argument, which is actually passed by calling the getConnection() static method of DatabaseConnection.java. And that's is! We 're good to go with the script runner's part.What is left now, is to find a way to connect the script runner (that takes an sql file and executes the existing queries into a db) with the perl scrapper.According to the scrapper's part, I'd firstly like to introduce a small parenthesis: I support open source software, so I'm here using the OMDB Api, instead of the iMDB's API, so, together with some updates that had to be done to the scrapper script, here is the updated version of getMovieData.pl:#!/usr/bin/perl -wuse strict; use XML::Simple;use Data::Dumper;my $xml = new XML::Simple;die "Please make that you the movie title is provided into quotes!\n" if(!@ARGV);my$movie = shift;$movie =~ s/\s/+/g;my$cmd = "curl http://www.omdbapi.com/?t=$movie&y=&plot=short&r=xml";my$movieData = $cmd;my$data = $xml->XMLin($movieData );my $released = escapeSingleQuote($data->{movie}->{released});my $rating = escapeSingleQuote($data->{movie}->{imdbRating});my $director = escapeSingleQuote($data->{movie}->{director});my $genre = escapeSingleQuote($data->{movie}->{genre});my $writer = escapeSingleQuote($data->{movie}->{writer});my $runtime = escapeSingleQuote($data->{movie}->{runtime});my $plot = escapeSingleQuote($data->{movie}->{plot});my $imdb = escapeSingleQuote($data->{movie}->{imdbID});my $title = escapeSingleQuote($data->{movie}->{title});my $votes = escapeSingleQuote($data->{movie}->{imdbVotes});my $poster = escapeSingleQuote($data->{movie}->{poster});my $year = escapeSingleQuote($data->{movie}->{year});my $rated = escapeSingleQuote($data->{movie}->{rated});my $actors = escapeSingleQuote($data->{movie}->{actors});my $tstamp = time();print "INSERT INTO movie_collection VALUES (NULL , '$title', '$year', ";print "'$rated', '$released', '$genre', '$director', '$writer', '$actors', '$plot', ";print "'$poster', '$runtime', '$rating', '$votes', '$imdb', '$tstamp');\n";sub escapeSingleQuote { my $str = shift;$str =~ s/\'/\\'/g; return $str;}Once the sql file creation is done , we 'll make a system call from Perl to run the exported jar file of our Java project. This means that we need to add the following line in the end of the batch.pl script: #!/usr/bin/perlwhile(){ my$cmd = "perl getMovieData.pl \"$_\""; system($cmd);}system "java -jar absolute/path/to/the/exported/jar/file.jar"Finally, everything is fired up from command line, so, keeping in mind the exact locations of the required files (movies list, jar and generates sql's file), execute the following command: perl batch.pl movielist.txt > sqlInserts.sqlFor more details, there's also a git repository that hosts this project :)

continue...

continue...

# How to install Perl and cURL on Windows

###### 30 November 2014 · 2 mins

Hello!Perhaps you 'll never need Perl, but when you are about to do it, you obviously don't want to mess with cygwin and stuff like that.I actually found a simple solution to get it up and running in about 5 minutes, together with cURL installation, without configuring anything on your environment, but only running the .msi installers.If you don't actually know it, Strawberry Perl is the most stable version for Windows, so:Visit Strawberry Perl site.Download the version that matches your system (I'm on a 64-bit machine):Run the installer.The installer automatically places the Perl directory under the correspong Program Files folder (so, for me, it is under "Program Files", but if you selected the 32-bit version of it, it should place it under "Program Files (x86)".It also adds the perl executables to your system path, by default.Validate the successful installation of Perl, to your system: I suppose the only reason for someone to start using Perl in 2014, is related to web technology, i.e transfering data by using different protocols. An easy way to do that, is by using the cURL tool.While on my investigation to do this without having to use cygwin or my cmd, I found this site, that also provides an .msi installer in a reliable way, like the one we 've used for Perl (the highlighted version is what worked for me):So, when the installation is finished, you just have to validate that you 're good to go:Cheers!

continue...

# How to install MongoDB on Windows

###### 28 October 2014 · 2 mins

After all, a new post!The other day, I found myself messing around with MongoDB and I was wondering if I could find some time to write a blog post about it; this one isn't anything  special, but I hope it 'll be the start for a bunch of MongoDB tutorials.The goal of this post is not to demonstrate the functionality/usage/advantages of MongoDB, so, if you need further assistance, you should refer to the official docs.You can download both server and client for MongoDB from a single .msi file, from the official downloads page. For my case, I chose the 64-bit version of it:The installer, by default creates a new directory named MongoDB [version] Standard  under the Program Files directory.As with MySQL, we first have to start the server application; what we 're looking for is a similar to mysqld.exe executable; the location where we should search for it is pretty obvious, under the \bin subdirectory of the fore-mentioned, newly created directory:After ensuring the existence of it, you can open a command prompt and after locating the working directory of it to the specified path of mongod.exe, start the service:I marked with pink dots the two main points of the service start:MongoDB runs at port 27017.There are initially 0 active connections.Let's connect from a client to it:As you noticed, too, it auto-connects to a database, named test.I saw a blue indicator filling my left tab (this is my MongoDB started server), after giving the connection command, so let's see what's new:Ok, connection was successful!Now, let's go back to our client and see a single object, that exists in the things collection of test database:And that was it!For more details about the last command and its results, stay tunned!

continue...

# How to create a working set in Eclipse

###### 9 August 2014 · 2 mins

So, the amount of imported projects that your eclipse IDE has, seems like turning it into a mess? Have you already thought of a way to separating them into smaller sets, according to the project/concept that they rely on? Here is an example of mine, when I wanted to split some of the projects, regarding the JCG community.1) Near the "Package Explorer", click the drowdown button (the corresponding tooltip names it "View Menu") :2) From the options provided, click on Select Working Set:3) Select th Java as the Working set type:4) Create a new Window Working Set:5) Give a name to the working set and after selecting the projects that you want to be added to it, click "Finish":6) After creating the working set, a window pops up, prompting you to declare the working sets that you currently want to work with, so just check them and click "OK":7) Obviously, now the Package Explorer is set up according to the projects included in the selected working set:Alternative PathsYou can edit the existing projects of a working set by selecting Edit Active Working Set from the "View Menu" dropdown (this option is visible if there is at least one working set in your Eclipse environment).You can deselect a working set in order to get the Package Explorer to its initial state (displaying all existing projects in the workspace that Eclipse runs on) by clicking Deselect Working Set from the "View Menu" dropdown.

continue...

continue...

# How to convert tabs to spaces in Notepad++

###### 22 July 2014 · 1 min

So, the very first project that I was exposed on, as a professional, included, among others, YAML and as you obviously know YAML has a strict syntax.Notepad++ is till now, my favourite editor, but it comes without something that is very useful to the case that we 're investigating today, a "Tabs to Spaces" plugin/feature (I found that the one provided under the Edit -> Blank Operations menu was missing basic functionality). There is a solution, though, come along! First of all, we have to download the plugin.We then copy the CLRTabsToSpaces.dll from the .zip file that we just downloaded into \path\to\Notepad++\installation\plugins folder.If Notepad++ is open, we have to close it and restart it again, in order to let the software track the changes.Navigating to the "Plugins" menu, we should see something like below:That is, we have set properly our plugin, so to get it working, we just follow the above screenshot, to get the tab characters be converted into spaces.Note: it's better to edit such code snippets, having enabled the "Show all characters" button: And a small example (sample code from here ):Before applying the plugin.After applying the plugin.Cheers!

continue...

# How to solve Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V in Android

###### 9 July 2014 · 1 min

So today, while writing an example for the JCG community, I came across the following exception, while trying to add an EditText element to my application: Exception raised during rendering: java.lang.System.arraycopy([CI[CII)VDespite the fact that I selected Android 4.4 (API 19) for my application, I noticed that the selected Android API in the Graphical Layout of my XML code was actually wrong: So, the easy way, I clicked the dropdown to select again my initial option: Note: the Wear versions don't support EditText elements and that's why we got the exception. And of course, everything was fine after that: Cheers!

continue...

# How to generate random UUID in Java

###### 3 July 2014 · 1 min

Hi there! Generating a random UUID is much more easier than you could ever imagine! I use the following block of code, whenever I’m in a need of more than ten: <pre class="brush:java">for(int i = 0; i < 30; i++) { System.out.println(UUID.randomUUID());}</pre> If things get difficult and time passes, working with UUIDs, you ‘ll probably get lost, if the way you chose to generate your UUID was “a bunch at a time”, like above, so you could either visit a site, like this or modify your program like below: <pre class="brush:java"> System.out.println(UUID.randomUUID());</pre> Cheers!

continue...

# How to create a MySQL database with default encoding and collation

###### 30 June 2014 · 1 min

Hi there, pretty much time since my last post (and I 'll apologise in a future post)! During the project that I was exposed to, to the company I work for, the last months' google searches resulted finding myself with the difficulty to reach a solution for creating a database with default encoding/character set and collation, so I decided to write this post, when finding some free time. Assuming that we want to create a MySQL database from command line, with default encoding and collation, the command should look something like this, in a generic format: CREATE DATABASE [preferred_database_name] DEFAULT CHARACTER SET [preferred_encoding] DEFAULT COLLATE [preferred_collation];More specifically, if I would like to create a database named test_db, with the default encoding of utf8 and default collation of utf8_general_ci, the generic format, easily converts into: CREATE DATABASE test_db DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; Pretty easy, huh?! Have a nice week!

continue...

# Git: Hot to solve fatal: unable to access [url]

###### 21 April 2014 · 1 min

So today, while trying to push the latest commit for my last JSF tutorial here, I got an error like this:fatal: unable to access 'https://github.com/toubou91/JavaCodeGeeks_examples.git/': SSL read: error:00000000:lib(0):func( 0):reason(0), errno 10054After a small investigation, I found myself reading this thread but the question persisted, as I knew that I had configured properly both my local repo's .git and git's .config file, so I tried pinging my remote repo from a browser.I noticed that I was prompted to insert my account's credentials (so the reason was that I have been logged out from my remote repo and the local push couldn't match the destination).After signing-in again, git push succeeded!Cheers!

continue...

# PanelGrid Example in JSF 2.2

###### 20 April 2014 · 1 min

Hi there.So, yesterday, I had some time to write another small tutorial for the JCG community.You can find the full tutorial here; I also uploaded the source code to my GitHub account.Have a nice week!

continue...

# How to avoid console errors in older browsers

###### 16 April 2014 · 1 min

if (!window.console) window.console = {}; if (!window.console.log) window.console.log = function() { }; if (!window.console.debug) window.console.debug = function() { };

continue...

# How to add a single file to an existed GitHub repository

###### 9 March 2014 · 1 min

So today, after finishing the required editing about my forthcoming published tutorial on JCG, I wanted to push the final compressed project in the corresponding GitHub repository.Here is a full guide of how he do something like this:Firstly, locate Git Shell to the directory of the local repositoryEnsure that you have the right "version" of the remote repository by pulling it: git pullAdd the file that you wish to push: git add [filename]Commit changes (it is recommended to also submit a commit message, something that can be done with the -m parameter): git commit -m "your commit message"Push changes to the remote repository: git pushAnd here's a full screenshot of my effort - yes, you did make it clear; I made a mistake (tried to push without having my repo pulled first) just to demonstrate how helpful is the error handling provided from the shell.And a personal statement: Finally, I have to admit that learning Git wasn't a pain at all.

continue...

# How to fix Java heap space error in Maven

###### 7 March 2014 · 1 min

So you want to build a maven project but you 're getting an error like this : java.lang.OutOfMemoryError: PermGen space.What the output says is that you have to define a MAVEN_OPTS environment variable, where you can place your -Xmx and -XX:MaxPermSize memory parameters.What are you staring at? Go for it!Right click on My Computer and select PropertiesClick Advanced System Settings on the leftGo to the Advanced tab, click the Environment VariablesCreate a New user variable, under the name of to MAVEN_OPTS and set the Variable value to what the error specified or whatever you need to get it build successfully.Here's a sample configuration :

continue...

# JSF projects available on GitHub

###### 6 March 2014 · 1 min

I found myself today having a lot of desire to contribute to community, although I needed a lot of rest, so here is my latest commit to my github account : JSF 2.2 projects .I know, all of us would prefer the full sources of it, but keeping in mind my full schedule this period, it's the best I could do.

continue...

# How to export Eclipse project as a .zip file

###### 6 March 2014 · 1 min

Hi there!After a pretty exhausting day at work, I thought why not updating a little bit my blog with a post that someone could find useful?I got inspiration while writing my last tutorial for Java Code Geeks, which I scheduled for tomorrow (and yes, you guessed it right, I'm gonna talk again about a tutorial of mine hah).So, most of you that ended up to this post, possibly found yourself in the same position as I did, a long time ago: while working on an eclipse project, you simply thought about zipping the whole project and yes, it would be cool if there was a way to implement it not by hand.Here are the steps:Right-click on the project and navigate to Export :Select Archive File and click Next : Select which folders/files you wish to exclude from the final .zip (I excluded the target folder, as you see), give a name to the compressed file and hit Finish : And a final note : target  folder is what comes out from maven execution, so we obviously don't need it in a .zip file or in a project that we plan to upload to github, for example.Hope you found it interesting,Cheers!

continue...

# Multiple Selection ListBox Tutorial in JSF 2.2

###### 23 February 2014 · 1 min

Hi there!I know I didn't do what I really promised in my last post, but there's really no time, so today that I found some time for editing, I published my new JSF tutorial.It has to do with multiple selection listboxes in JSF 2.2 and you can find the full tutorial under this link.Have a nice week everybody, hope to see you soon with better stuff!

continue...

# Just Thoughts

###### 15 February 2014 · 1 min

Hello World!It's been a long time, since I uploaded my last post, but I had exams! Finally, I got rid of them yesterday, so I found sometime for myself, too; I decided to watch a movie that would make me think after the end, so I ended up with The Wolf of Wall Street (it's going for Oscar).So today, this post, as you already realised, will just express some thoughts.The reason that I started with the movie, is that I just wanted to mention that we all make our choices and probably are responsible for them. A simple one, but I believe everyone who saw the movie, will understand.The other thing is that I started a new tutorial for the Java Code Geeks community, which will probably be published tomorrow - it has to do about listboxes in JSF 2.0 .Finally, I'm planning to upload to my github account -probably tomorrow- 2 examples that deal with simple GUI applications in Visual Basic.NET; it was about a year ago, when a friend of mine asked me for help, in order to implement some programming assignments for a required for his studies course.That's all for now, have a nice and proactive day!

continue...

# New JSF 2.2 Tutorial

###### 8 February 2014 · 1 min

Hello World, exhausting day today; I'm always a night guy and it's only 9:35pm, but I'm saying it, 'cause I found 1 hour after my meal to have my shoulders workout done! I prefer working out late at night, but it was Saturday, so I didn't have many choices.Usually, after evening workout, I'm very tired and I can't do anything in the rest of the day, but today, thank God, I achieved concentration. Here's my today's "CheckBox Example with JSF 2.0" published tutorial.And a closing tought :I don't know the exact duration of this blog's ugly layout-design, but I really don't have any time; I also want sometime to improve it.Have a nice Saturday night.

continue...

# New Published JSF 2.0 Tutorial

###### 5 February 2014 · 1 min

Although during exams everything else, is very difficult to deal with, I yesterday decided to take a break from studying, by writing an example about RadioButtons integration with JSF 2.0, for the JCG community. At this point, I'm very happy that this time wasn't wasted from studying, mainly for two reasons: I got some serious troubleshooting during the tutorial's development, which I'm going to display in a new post, in order to help others that may face same problems, sometime Despite this wasn't the first time that a product of mine was accepted from the wider community of Java, today I was more like happier, as a Java's twitter account, twitted the fore-mentioned example; a tweet that was favorited from Reza Rahman, a multi-dimensional professional and a Java Evangelist, working for Oracle, a person that I personally admire and respect a lot.Obviously, the above two-point-list isn't "catchy" for anyone, but encourages me to continue contributing to the software community.Time to study, have a nice evening.

continue...

# How to remove the border of a JFrame

###### 31 January 2014 · 1 min

Assuming that you 're developing an application, in which the default look-and-feel doesn't match, at all.To be more specific, imagine the following example: I sometime wanted to develop a real-time clock JAVA application. It would be a bit ugly for the application's purpose to have the annoying border around its JFrame.Indeed, there is a way to implement this: you just need to set the frame's undecorated method to true:   frame.setUndecorated(true);Keep in mind that the above code has to be placed before frame's setVisible() method. Otherwise, it's like initializing the frame and then telling it to be undecorated, sth that doesn't make sense. So, you first customise the frame as you wish (undecorization, etc) and then you enable its visibility.The full application that supports this post is related here.

continue...

continue...

# How to configure Primefaces 5.1 and JSF 2.2 in Eclipse IDE

###### 29 January 2014 · 1 min

Hi there!Today I will show you how to configure Primefaces 4.0 with JSF 2.2 in the Eclipse Kepler IDE (v4.3).If you don't have any idea of what we 're talking about or it's the first time that you 're facing J2EE, you may find interesting my first two articles about JSF 2.0 and Eclipse integration, in JCG community : JSF 2.0 Eclipse IDE SupportHello World Example with JSF 2.0Now that you 're enough experienced, let's link Primefaces with JSF and Eclipse, too. There are two main actions that we need to no, in order to implement this:We first need to add the following dependency, in the pom.xml file: org.primefaces primefaces 5.1We 're pretty ready! Naaah, don't be in a rush. As you might found out by yourself, Primefaces deals with the visual components of our websites, so obviously, the xhtml reference that we provided (in the fore-mentioned links/articles) isn't enough; we need to add two more references, in order to get the Primefaces up and running:<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui" >That was it. You 're ready to start developing your awesome look-and-feel web applications with JSF and Primefaces.I also created a simple gist for the purpose of this configuration. </h4></div></div>Cheers!</div>

continue...

# Hello World!

###### 28 January 2014 · 1 min

That's my very first post, so...Hello World!I won't introduce myself in detail, as you 'll find out many information about me in my social netoworking profiles; the only thing that I would like to express as a first feeling is to just excuse me about whatever you may not like and is related to the current blog's layout and "look & feel" - I'm a newbie blogger, so be patient about it, please!I just want to mention, that the purpose of this blog is mostly to share programming and software related information that I find interesting (and to get feedback, of course) ; something tha cannot be done through social networking (except GitHub).To sum up, my second post will be related to Primefaces 4.0 + JSF 2.2 configuration in Eclipse Kepler (v4.3).So, stay tuned!

continue...