Programming & Scripting

Introduction to MySQL/MariaDB database SQL views

A database view is nothing but a virtual table, which does not contains data itself, but references data contained in other tables. Views are basically the result of stored queries which can vary on complexity and can be used, for example, to hide data from users, allowing access only on selected columns of a table, or simply to provide a different point of view on the existing data. In this tutorial we will see how to create, update, alter and drop a view on a MySQL , MariaDB database. In...
Read More...

How to perform web requests with PHP using the cURL extension

The open source libcurl is client-side URL transfer library which supports a lot of protocols like FTP , HTTP , HTTPS and works on a multitude of platforms. The PHP cURL module let us access the functionalities provided by the library from the PHP programming language. In this tutorial we will see how to install the module and how to use it to perform simple requests. In this tutorial you will learn: How to install the cURL module The basic steps to follow to initialiaze a cURL session and...
Read More...

How to Change Bash Prompt

Default bash command line prompt on many Linux systems is quite minimal. As we will see in this article, it can be easily changed by modifying bash PS{n} variables, so to include information such as display time, load, number of users using the system, uptime and more. In this tutorial you will learn: What are PS1 and PS2 shell variables How to create custom shell prompts What are the characters we can use to customize a shell prompt Linux bash prompt
Read More...

How to use graphical widgets in bash scripts with zenity

Zenity is a very useful utility which let us create graphical user interfaces for our shell scripts. Several widgets exists, and can be used by invoking the program with the respective options. The widgets are based on the GTK toolkit, and return the result of the user interaction either on the standard output or as a return code. In this tutorial you will learn: What are the general zenity options What are the some of the most useful available widgets and how to use them
Read More...

Persisting data into a PosgreSQL database with PHP

PHP is a widely used server scripting language. It's vast capabilities and lightweight nature makes it ideal for web frontend developing, and while it is possible to create advanced structures in it, it's basic usage also easy to learn, which makes it a good starting point for beginners also. The data recorded, processed, sent or displayed by the application we build is need to be stored somewhere, however; our webpage is stateless without this data. We can store our data in many ways or even...
Read More...

How to extend the GNOME Nautilus file manager with custom scripts

Although GNOME, in its 3.x iteration has been the object of many debates, due to its non-traditional desktop paradigm, it is probably the most used desktop on Linux. The default file manager included in GNOME is Nautilus (the application new name is "Files"). In this tutorial we will see how we can extend the file manager with functionalities provided by custom scripts. In this tutorial you will learn: How to use custom scripts to extend Nautilus functionalities
Read More...

How to Reuse PHP Code Effectively - Introduction to PHP traits

Originally developed by Rasmus Lerdorf in 1994, PHP is one of the most used general-purpose programming languages. Originally born as a template language, during the years it evolved into a fully-featured language with proper OOP (Object Oriented Programming) support. Its latest incarnation, 7.x , introduced new features like return type declaration for functions and huge performance improvements. PHP is a single inheritance language: this means that a class can inherit only for one parent or...
Read More...

How to create, package and sign a Firefox web extension

Firefox is one of the most used web browser in the world: it's a free and open source software built by the Mozilla foundation, and it's available for all the major operating systems. The browser has all the features that nowadays are considered standard: tabbed browsing, private navigation, a synchronization system and its functionalities can be extended using third party addons written in Javascript. In this tutorial we will see how to create, build and sign a simple web extension. In this...
Read More...

Introduction to Bash Shell Parameter Expansions

A shell is a crucial part of an Unix-based operating system and is the main interface we can use to interact with the system itself. Bash is without doubt the most used shell on the majority of Linux distributions: it was born as the free software replacement for the Bourne shell (bash is the acronym for Bourne-again shell) inside the GNU project. In this tutorial we will learn how some of the most useful bash expansions works. In case you are not familiar with Bash yet, or you simply need to...
Read More...

Introduction to the JavaScript Fetch API

Compared to XMLHttpRequest and the libraries built around it, like JQuery.ajax , the fetch API defines a more modern and cleaner way of performing asynchronous requests, based on the use of promises . In this article we will see some of the interfaces provided by the API, like Request and Response , and we will learn how to use the fetch method to perform various types of asynchronous requests. In this tutorial you will learn: How to send asynchronous requests using the fetch method How to...
Read More...

How to combine the results of multiple SQL queries using the UNION statement

In a previous article we talked about the various type of JOIN we can use in a MariaDB/MySQL database. This time, instead, we take a look at the UNION statement: how it works, how we can use it to combine the result of queries run on different tables, and what are its peculiarities. In this tutorial you will learn: How to use the UNION statement in a MariaDB/MySQL server What are the properties of the UNION statement The result of an UNION statement
Read More...

How to perform HTTP requests with python

In this series of article about python and HTTP protocol, we work with HTTP requests and responses. In the first article we explore standard library functions such as urllib.request.urlopen or urllib.request.urlretrieve . In the second part we focus on the external "requests" library, which let us perform complex operations, writing less code. HTTP Requests: The standard and the requests library Table of Content PART I The standard library PART II The "requests" library
Read More...

How to perform HTTP requests with python - Part 2 - The request Library

In the previous article we saw how to perform basic HTTP requests using the python3 standard library. When requests become more complex, or we just want to use less code, and we don't mind adding a dependency to our project, it's possible (and sometimes even recommended) to use the external requests module. The library, which adopted the "HTTP for Humans" motto, will be the focus of this article. In this tutorial you will learn: How to perform HTTP requests with python3 and the 'requests'...
Read More...

How to perform HTTP requests with python - Part 1: The standard Library

HTTP is the protocol used by the World Wide Web, that's why being able to interact with it programmatically is essential: scraping a web page , communicating with a service APIs, or even simply downloading a file, are all tasks based on this interaction. Python makes such operations very easy: some useful functions are already provided in the standard library, and for more complex tasks it's possible (and even recommended) to use the external requests module. In this first article of the...
Read More...

Introduction to eBay APIs with Python

In this series of article about Ebay APIs and their use via python and the Ebay python SDK, we see how to setup our working environment and work with the Finding, Trading and Merchandising APIs. Introduction to eBay APIs with python Ebay is one of the biggest e-commerce sites, used by millions of people to buy or sell items worldwide. The Ebay APIs make us able to programmatically perform a lot of operations like managing our online store, finding and comparing prices and more. In this series...
Read More...

Introduction to Ebay API with Python: The Merchandising API - Part 4

The Ebay Merchandising API is the focus of this fourth and last article of the series dedicated to python and Ebay APIs. This API provides less calls than the ones we previously saw, but among them, one that can be very useful: getMostWatchedItems : we will focus on it. In this tutorial you will learn: What are the calls provided by the Merchandising API How to use the getMostWatchedItems call Introduction to Ebay API with python: The Merchandising API - Part 4
Read More...

Introduction to Ebay API with Python: The Trading API - Part 3

This is the third article of the series dedicated to Ebay APIs and their use via python. In the first article we saw how to setup our working environment , creating a developer and a sandbox "test" account, generating our API keys and installing the python SDK. In the second article we approached the Finding API , focusing on the findItemsByKeywords call. In this article we will introduce the Trading API . In this tutorial you will learn: What are some of the most useful "Trading API" calls...
Read More...

Introduction to Ebay API with Python: The Finding API - Part 2

In the previous article we saw how to perform the preliminary steps to prepare our working environment, create an Ebay developer and a sandbox account and generate the keys and credentials needed to execute API calls. In this new chapter we will create our first request and perform our first call focusing on the "Finding API" In this tutorial you will learn: What are the possible "Finding API" calls; What are the parameters you can use to customize you call; How to build a request with the...
Read More...

Introduction to Ebay API with Python: Obtaining keys and accessing the sandbox - Part 1

Ebay is one of the biggest ecommerce sites. Many people use it to search and buy products, and many stores use it to enlarge their audience and expand their business range. If we want to operate programmatically on Ebay, for example to mass create or modify a set of items, or quickly confront prices, we must use the dedicated application programming interfaces. In this tutorial we will see how to prepare our working environment in order to use python to interact with the Ebay APIs. In this...
Read More...

Introduction to higher order functions in Javascript

By definition, an higher order function is a function which, at least, receives one or more other functions as arguments or returns another function as its result. In this tutorial we will focus on standard library functions as filter, map and reduce: we will see when they can be useful and how to use them. In this tutorial you will learn: What is an higher order function. Why we can use higher order functions in Javascript. How and when to use filter, map and reduce functions.
Read More...