Programming & Scripting

How to perform python input/output operations on files with python open function

The manipulation of files is an operation which sooner or later we'll need to perform in our programs. The python built-in open function returns a file object , which lets us interact with files in different modes: we will see them in this article. In this python tutorial you will learn: How to use the python open function. What are the various modes of operation which can be used with the python open function. How to interact with a file object. Why is important to close a file object, and...
Read More...

How to use arrays in bash script

Objective After following this tutorial you should be able to understand how bash arrays work and how to perform the basic operations on them. Requirements No special system privileges are required to follow this tutorial Difficulty EASY Introduction Bash , the Bourne Again Shell , it's the default shell on practically all major linux distributions: it is really powerful and can be also considered as a programming language, although not as sophisticated or feature-reach as python or other...
Read More...

Check Java Version

There are several ways on how to check what version of Java is installed on your system. Most likely the simplest way is to directly use the java binary in combination with the -version option. To do so run java -version on your terminal. $ java -version Check Java Version Furthermore, execute the following command to check the version of the current default Java compiler javac : $ javac -version In case you are looking for a system agnostic way on how to check the Java version installed on...
Read More...

Java Hello World example on Linux

Objective The objective is to write, compile and execute a basic Hello World java example program. Requirements The only requirement is installed java on your Linux system . Difficulty EASY Conventions
Read More...

How to manage the expansion of empty or unset bash variables

Objective The object of this tutorial is to learn how to modify bash behavior when expanding unset or empty variables using dedicated syntax. Requirements No special system privileges are required to follow this tutorial Difficulty EASY Introduction Variables expansion is one of the most common feature used in the shell: when a variable exists and is part of a command, it is "expanded", so that is substituted by its value. The expansion of empty variables, is one of those things, that if not...
Read More...

Introduction to python web scraping and the Beautiful Soup library

Objective Learning how to extract information out of an html page using python and the Beautiful Soup library. Requirements Understanding of the basics of python and object oriented programming 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 Web scraping is a technique which consist in the extraction of...
Read More...

How to create a hot standby with PostgreSQL

Objective Our objective is to create a copy of a PostgreSQL database that is constantly synchronizing with the original one and accepts read-only queries. Operating System and Software Versions Operating system: Red Hat Enterprise Linux 7.5 Software: PostgreSQL server 9.2 Requirements Privileged access to both master and slave systems 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 $ -...
Read More...

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

How to count days since a specific date until today using Bash shell

Objective The objective is to use bash shell to count days since a specific date until now ( today ). 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...

Tutorial on how to write basic udev rules in Linux

Objective Understanding the base concepts behind udev, and learn how to write simple rules Requirements Root permissions 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 non-privileged user Introduction In a GNU/Linux system, while devices low level support is handled at the kernel level, the management of events related to...
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...