Thursday, June 06, 2019

Display Javascript console logs with jsfiddle

Jsfiddle is mainly made to test javascript code in a web context (aka with HTML and CSS). But, if you just want to use is to test backend code, you probably want to see results in the console. This can be done by adding the following library to your project :

You can also take a look at this example :

Friday, May 17, 2019

Install Microsoft Visual Studio Code on a chromebook

My chromebook is fantastic! As it supports Linux integration feature, I can open a terminal and install every Debian based packages I want such as Microsoft Visual Studio Code. Let's go!

Step 1 - Import the Microsoft GPG key :
curl -sSL | sudo apt-key add -

Step 2 - Add the Visual Studio Code repository :
sudo add-apt-repository "deb [arch=amd64] stable main"

Step 3 - Install the latest version of Visual Studio Code
sudo apt update
sudo apt install code
That's all!

Install Node.js on a chromebook

If you have a chromebook which supports Linux experimental integration feature (look for this in your global parameters), then you can open a bash terminal. The Linux behind the scene seems to be Debian based.

So, to install Node.js, forget the classic way with sudo apt-get install nodejs because you will get an old release. Instead of that, you can to this :

Step 1 – Add Node.js PPA
sudo apt-get install curl software-properties-common
curl -sL | sudo bash -
Step 2 – Install Node.js
sudo apt-get install nodejs
That's all!

(source :

Sunday, May 12, 2019

Self upgrade of npm and node.js

Even I'm an old Java developer, I'm a newbie on node and npm and it's a new playground for me.

My project is to product some JS code (maybe TypeScript). As every software architect, my first question was : how to structure, package and deliver my project. This is done with npm (the package manager from node.js).

I've got npm on my laptop (installed with a classic sudo apt-get install npm) but I realized it's an old release.

Hopefully, node.js echosystem is great and everything can be self upgraded. Thus, you don't need any new debian package.  Great! Let's'do this :

# Let's upgrade node.js to the last stable release 
sudo npm cache clean -f
sudo npm install -g n
sudo n stable

# Then, we upgrade npm
sudo npm install npm@latest -g

# If your npm -v doesn't return the new version, you sould have multiple npm executable in your path
# On my Ubuntu, I changed the symbolic link
sudo ln -sf /usr/local/bin/npm /usr/bin/npm

That's all!

Monday, February 18, 2019

Remove ugly bash (shell) directory highlight colors

Tired of green over blue colors in default Ubuntu shell for directories ?

Just type this from your shell console to update your bash profile :

echo -e "\nLS_COLORS=\$LS_COLORS:'ow=1;33' ; export LS_COLORS\n" >> ~/.bashrc


Friday, November 30, 2018

How to remove "Quick Access" in Explorer on Microsoft Windows 10

Just make Control + R and execute regedit.

right side new DWORD (32 Bit) with name: HubMode
double click and value = 1
restart explorer

Enjoy :)

(Source :

Tuesday, September 25, 2018

How to secure your REST API with Java Spring Security

Here is the best article I read on how to secure REST API and even make a full stateless architecture by using JWT token to store all user details.

Great, great, great work by Jerome Loisel from Octo Technologies.

Enjoy the simplicity of this article. Jerome succeded to make something complex understandable.

Wednesday, September 12, 2018

Avoid select min/max with Oracle

I hate select max clauses with Oracle. My company used to write subqueries which such expressions. It's slow and unreadable. Conditions in subquery with upper table create deep dependencies and awfull links between table. It doesn't allow to reuse code.

That's why I investigate on a performant solution to avoid select max/min. A solution is "dense_rank first". It will help you to retreive only one line per group. It's difficult to explain. So, I made a sample on SQL Fiddle.

Schema is :

CREATE TABLE test (student, year, status, program) AS
SELECT 'john', 2010, 'passed', 'bba' FROM DUAL
UNION ALL SELECT 'john', 2011, 'passed', 'bba' FROM DUAL
UNION ALL SELECT 'john', 2012, 'passed', 'bba' FROM DUAL
UNION ALL SELECT 'john', 2013, 'failed', 'bba' FROM DUAL
UNION ALL SELECT 'john', 2014, 'unknown', 'bba' FROM DUAL
UNION ALL SELECT 'clara', 2011, 'failed', 'mstf' FROM DUAL
UNION ALL SELECT 'clara', 2012, 'passed', 'msmmd' FROM DUAL;

Sample request is :

min(year) keep (dense_rank FIRST ORDER BY YEAR desc) year,
min(status) keep (dense_rank FIRST ORDER BY YEAR desc) status,
min(program) keep (dense_rank FIRST ORDER BY YEAR desc) program
FROM test
GROUP BY student

And the result is :

clara   |2012 |passed  |msmmd   |
john    |2014 |unknown |bba     |

How to write request ?

This is the most important part of this post. In this sample, we want to get the status and program for the most recent academic year for each student. So, first of all, we have to GROUP BY student. Once we have partionned our data by student, we want to keep that contains the most recent academic year. That's why we make a keep (dense_rank FIRST ORDER BY YEAR desc).

So, don't forget :

  1. Group your data by a criteria 
  2. In each group, you will keep only the first row. That's why you have to define a order criteria
  3. Of course, your "group by" criteria can not be used as "order" criteria

You can try it by yourself :!4/ba828/1/0


Display Javascript console logs with jsfiddle

Jsfiddle is mainly made to test javascript code in a web context (aka with HTML and CSS). But, if you just want to use is to test backend c...