Link an AWS server with a domain name

Website hosting as became simple and affordable, so much so that you don’t even need to purchase a website hosting anymore, but instead, for few $$$ per month, use a platform such as WordPress , you will be ready to publish content nearly immediately, after some time spent in achieving the look you need.

However, how do you host multiple projects that each requires particular technologies that aren’t bundled by default in common hosting providers? The solution is to purchase a private server that will let you have full control to allow you any required dependencies.

There’s multiple providers of virtual private server (VPS), which are all becoming cheaper and more powerful with time. In this article, we will look at purchasing an Ubuntu server from Amazon Web Services (AWS) as LightSail image. AWS was selected as it is currently the market leader for such services, and we choose the LgihtSail which comes as monthly flat-fee to avoid exponential costs. Finally, Ubuntu is the operating system of choice to allow portability to other cloud providers if we ever wish to switch. Continue reading “Link an AWS server with a domain name”

Introduction to Machine Learning

AI is a long game. What is there right now is good enough, but in a couple of years, it will be very good. In about five years, it will be excellent. And in ten years, it will be impossible to work without it.

There’s no turn back, Artificial Intelligence (AI) will be part of our future. From resolving simple day-to-day pain points, such as house choirs or laundry and clothes folding, to more existential problems such as the cleaning of our oceans and the preservation of our environments, to the exploration of new worlds, it will shape the future of our society.

But what is AI and what does it means and how does it fits with the other buzzwords? This article will review the most commons subfields related to this topic to attempt to clarify how all work together. Continue reading “Introduction to Machine Learning”

Access MariaDB (MySQL) from Python code

On the host machine, it is required to install the driver to connect to the database from the Python code.

On Ubuntu or Debian-based Linux systems:

apt-get install python-mysql.connector

On Redhat or CentOS Linux systems:

yum install python-mysql.connector

Connect to the database server using the command line client, then  the database to connect to:

CREATE DATABASE flask DEFAULT CHARACTER SET utf8 DEFAULT collate utf8_bin;

GRANT ALL PRIVILEGES ON flask.* to flaskuser@'%' IDENTIFIED BY 'flaskuser';
GRANT ALL PRIVILEGES ON flask.* to flaskuser@'localhost' IDENTIFIED BY 'flaskuser';

SET PASSWORD FOR 'flaskuser'@'localhost' = PASSWORD('<PASSWORD>!');

Finally, from the Python script, import the connector, connect to the database, and start querying the records:

#!/usr/bin/env python

import mysql.connector as mariadb

mariadb_connection = mariadb.connect(user='flaskuser', password='<PASSWORD>', database='flask')
cursor = mariadb_connection.cursor()