Programming & Scripting

Introduction to MariaDB and MySQL triggers

Objective Understanding and learning to use MariaDB and MySQL triggers. Requirements No particular requirements needed Difficulty EASY Conventions # - requires given linux command to be executed with root privileges either directly as a root user or by use of sudo command $ - given linux command to be executed as a regular non-privileged user Introduction MySQL/MariaDB triggers are stored programs associated with a table in a database, and used to automatically perform some actions when an...
Read More...

PostgreSQL performance tuning for faster query execution

Objective Our objective is to make a dummy query execution run faster on PostgreSQL database using only the built in tools available in the database. Operating System and Software Versions Operating System: Red Hat Enterprise Linux 7.5 Software: PostgreSQL server 9.2 Requirements PostgreSQL server base install up and running. Access to the command line tool psql and ownership of the example database. Difficulty EASY Conventions # - requires given linux commands to be executed with root...
Read More...

Introduction to database joins with mariadb and mysql join examples

Objective Learn to know the different type of joins and how to use them working with mysql or mariadb databases Requirements No particular requirements Difficulty EASY Conventions # - requires given linux command to be executed with root privileges either directly as a root user or by use of sudo command $ - given linux command to be executed as a regular non-privileged user Introduction In a relational database system the data is organized in tables, composed by rows and columns. Each row is...
Read More...

Advanced Python Concepts

This tutorial covers advanced python concepts such as Python classes, constructors, encapsulation, inheritance, polymorphism and creating Python packages and modules. Therefore, if you do not have any prior Python knowledge we refer you to our Python Fundamentals Tutorial. Python Classes Python Constructors Python Encapsulation Python Inheritance Python Polymorphism Python Packages and Modules
Read More...

Check Python Version

Objective The following artcile will provide you with the information on how to check Python version on your operating system. Difficulty EASY Conventions
Read More...

Introduction to the Doctrine ORM and data mapper pattern in php

Objective Learn the basic concepts of Doctrine ORM, implementing the Data Mapper pattern with php. Requirements Composer (php package manager) A working lamp setup Understanding the basic object oriented programming and php Understanding the basic database concepts Difficulty MEDIUM Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ - requires given linux commands to be executed as a regular...
Read More...

How to check Bash version

Objective This article will provide you with the information on how to check bash version on your operating system. Operating System and Software Versions Operating System: - Distribution Agnostic Requirements No special prerequisites are required is required. Difficulty EASY Conventions
Read More...

Bash Scripting Tutorial for Beginners

Bash Shell Scripting Definition Bash Bash is a command language interpreter. It is widely available on various operating systems and is a default command interpreter on most GNU/Linux systems. The name is an acronym for the ‘ B ourne- A gain SH ell’. Shell Shell is a macro processor which allows for an interactive or non-interactive command execution. Scripting Scripting allows for an automatic commands execution that would otherwise be executed interactively one-by-one. Bash Shell Script...
Read More...

How to use argparse to parse python scripts parameters

Objective Learn to use the argparse module to easily parse python scripts parameters Requirements Basic knowledge of python and object oriented concepts Difficulty EASY Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ - requires given linux commands to be executed as a regular non-privileged user Introduction In a previous article we have seen how to parse command line arguments using getopts in the...
Read More...

How to Play Audio With VLC In Python

Objective Play audio with VLC in Python. Distributions This will work on any Linux distribution Requirements A working Linux install with Python and VLC. Difficulty Easy Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ - requires given linux commands to be executed as a regular non-privileged user Introduction There are plenty of ways to play audio files with Python. It really depends on your...
Read More...

How to Use JSON API Data In Python

Objective Consume a JSON API in Python. Distributions This will work on any Linux distribution. Requirements A working Linux install with Python. Difficulty Easy Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ - requires given linux commands to be executed as a regular non-privileged user Introduction One of the main reasons that you'd like to work with JSON in Python is consuming APIs. There are...
Read More...

How to Parse Data From JSON Into Python

Objective Parse JSON data in Python. Distributions This will work on any Linux distribution. Requirements A working Linux install with Python. Difficulty Easy Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ - requires given linux commands to be executed as a regular non-privileged user Introduction JSON is a favorite among developers for serializing data. It's used in most public APIs on the web, and...
Read More...

How to Encode Data From Python To JSON

Objective Encode Python data into JSON. Distributions This will work on any distribution with Python installed. Requirements A working Linux install with Python Difficulty Easy Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ - requires given linux commands to be executed as a regular non-privileged user Introduction JSON is the universal format for passing data between programs and/or languages,...
Read More...

How to modify scripts behavior on signals using bash traps

Objective The objective of this tutorial is to describe how to use the bash shell trap builtin to make our scripts able to perform certain actions when they receive a signal or in other specific situations. Requirements No special requirements Difficulty EASY Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ - requires given linux commands to be executed as a regular non-privileged user Introduction When...
Read More...

How to obtain Sunrise & Sunset time for any location from Linux command line

Objective The objective is to use command line and bash shell script to obtain Sunrise & Sunset time information for any given location. Operating System and Software Versions Operating System: - Linux distribution agnostic. Requirements Installed lynx tool and access to shell command line. Your location code obtained from https://weather.codes/search/ . Difficulty EASY Conventions
Read More...

How to use getopts to parse a script options

Objective Learn how to use the bash getopts builtin to parse a script options Operating System and Software Versions Operating System: - All Linux distributions Requirements No special requirements, just access to a bash shell Difficulty MEDIUM Conventions
Read More...

Children multiplication tables practice test with Bash script on Linux

Introduction The following post is a little bit different from my other posts as it does not solve any of your Linux configuration problems. Apologies there! This post is an attempt to kill multiple birds with one stone, hence expose children to a command line, avoid web flash and ads driven multiplication practice tests online and most importantly gain some multiplication skills along the way. My daughter reached the age where she is required to perform multiplication calculation at school....
Read More...

Learn the basics of the ZSH shell

Objective Install ZSH with Oh My ZSH and learn the basic features. Distributions ZSH is available in the repositories of nearly every distribution. Requirements A working Linux install with root privileges. Difficulty Easy Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command $ - requires given linux commands to be executed as a regular non-privileged user Introduction Bash isn't bad. It gets the job done just...
Read More...

Introduction to Bash shell redirections

Objective Learn to use redirections, pipes and tee in the Bash shell Operating System and Software Versions Operating System: - Linux distribution agnostic Requirements Access to a Bash shell Difficulty EASY Conventions
Read More...

Python Exception Handling

Introduction Python will let you know when you get your syntax wrong. It'll immediately fail and not allow your program to run. What about when your code has a different type of problem? Those are called exceptions, and they tend to be harder to catch. It's up to you to recognize situations where hey might come up and catch them to prevent your program from crashing altogether. Imagine a scenario where you need user input. Do you want your program to crash every time a user mistypes something...
Read More...