File upload from a Nuxt.js client to an AdonisJS RESTful API server using axios

Preamble AdonisJs documentation shows how to upload files to the server using the HTML5 <form> element. But there are cases where axios comes more handy. So let us see how to upload files from a Nuxt.js client application to an AdonisJS RESTful API server with axios. I shared this project on my Github profile. Project setup In my demo, the client and server code are set apart. My client application is handled by Nuxt. [Read More]

Linux commands

Preamble This article is going to be updated and become longer as the time goes on. I am listing some of the commands I rarely use but I do not want to forget. Of course, I gleaned most of them on the web, sorry for not being able to mention the resources for each listed one below. Emacs Git Fast copy data 1. Emacs Set JS indentation to 2 in Vue. [Read More]

Nuxt.js deployment on Gitlab

How to deploy your Nuxt.js application on Gitlab for continuous integration? First create a Gitlab CI YAML file and name it .gitlab-ci.yml with the following commands: image: node before_script: - npm install cache: paths: - node_modules/ pages: script: - npm run generate artifacts: paths: - public only: - master Then in nuxt.config.js, add these configuration lines: /** * Gitlab */ router: { base: '/whatEverName/', }, generate: { dir: 'public', }, After running the CI job, and on the project’s repository, go to Settings then Pages and click on https://namespace. [Read More]

PHP unit testing

These are the steps to install and set the necessary tools to run unit tests in PHP projects: Installing Composer on Ubuntu 16.04 LTS: curl -sS | php sudo mv composer.phar /usr/local/bin/composer Installing PHPUnittest: { "require-dev": { "phpunit/phpunit": "^7" } } Install xdebug on Ubuntu 16.04 LTS. Run the tests: ./vendor/bin/phpunit --bootstrap vendor/autoload.php tests/EmailTest.php Run the code coverage: ./vendor/bin/phpunit --coverage-html . tests/EmailTest.php Setting phpunit.xml file I created the phpunit. [Read More]

A slightly improved version of bubble sort algorithm

My wicked brain gave birth to an improved version of the classic bubble sort algorithm. Here it is. This document is not about explaining the bubble sort algorithm as it already exists a good literature out there about it, and it is a classic algorithm studied and known by all CS students all over the world. There are, obviously, two improved versions of bubble sort algorithm; and thanks to a question asked the Code Review website regarding the first one of them which is: [Read More]

How to install OpenCV 4.0 for Python3.6.5 on Ubuntu 18.04 LTS

I know OpenCV 4.0.0 will rather be released on July 2018, but the installation procedure I describe here will not change. In fact, I already I installed and tested OpenCV 4.0.0-pre on Ubuntu 18.04 (to be continued soon) I want to share my own experience regarding this procedure. Whenever I tried this or that tutorial related to installing a recent OpenCV version for Python3.x, I stumble on errors which are not recovered by those tutorials. [Read More]

Python decorators

What are the origins and goals of Python decorators? How to implement them and why are they useful? Introduction Even when dealing with scientific and technical subjects, your subjectivity rules over you. I mean, each person has her own style in learning and explaining ideas. This subjective aspect is shaped not only by your intellectual capacities but more importantly by your personality. By personality, I mean how you see and interpret things. [Read More]

Cryptojacking: cryptography in service of the Devil

A new revenue stream has been implemented by the end of the last year. Maybe cryptojacking did not get yet the hype it deserves but it has been already widely used. Most Internet consumers are not aware of it though its intentions are far from being innocent. It may also generate inequalities among Internet users. Definition Cryptojacking is about using the user’s device processor, with or without his consent, to mine cryptocurrency when visiting a given webpage which is not necessarily compromised but can do that on purpose. [Read More]

Vigenère cipher simplified implementation

This is not an other dissertation on Vigenère cipher. This encryption algorithm is profusely discussed in cryptography literature. Here is rather a simplified yet efficient implementation of it. The goal of this article is not to about debating the theory of Vigenère cipher. I rather just want to focus on its implementation after I have seen several awkward ways of proceeding to it on different online programming forums. This question on Code Review website is an example of such implementations where code duplication is obvious but which the pre-existing answers did not address. [Read More]

Installing Selenium drivers on Ubuntu

Here is a common exception raised when trying to invoke selenium’s webriver component for browser automation launching. Here is how to fix it. For a professional need, I installed selenium testing framework on Ubuntu 17.04 LTS within a virtual environment I created using the recommended method I found on the documentation: pip install selenium Chrome I then tried to launch my website on Chrome: from selenium import webdriver driver = webdriver. [Read More]