Welcome to LinuxScrew

A site for Linux lovers worldwide. For newbies, system engineers, administrators, and everybody in between. We cover all things Linux, plus various programming languages, including Python, Javascript, and PHP.

View our featured tutorials and projects in the slider below or scroll down to see all recent articles.

How to Convert a USB Printer to Wireless with a Raspberry Pi
How to Use a Raspberry Pi for Digital Signage
The Worst Things You’ll Probably Google As a Programmer on Linux
How to Build a Raspberry Pi Internet Kiosk
Browsing the Internet on a 1989 Macintosh II with a Web Rendering Proxy
previous arrow
next arrow
Slider

How to Check What Version of PostgreSQL You are Running on Linux

PostgreSQL Check Installed Version

This article will show you how to check the version (or versions) of PostgreSQL running on your Linux system. As it is possible to install multiple versions of PostgreSQL on the same machine, there are a few ways to check the running version, which are detailed below. Checking PostgreSQL Server Version To check the running PostgreSQL server version, use the following pg_config command: Check PostgreSQL Client Version To check which version of the PostgreSQL client you are running, run the following psql command: Finding the PostgreSQL Executables If you … Read more

Safely Using PHP Variable Variables with Arrays [Examples]

PHP Variable Variables and Arrays

PHP variable variables are a powerful way to add flexibility to your code. This article explains the pitfalls and solutions to using them with arrays. Variable variables are a great way to simplify your code and make it more readable. However, when using them with arrays, you need to be careful. PHP Arrays and Variable Variables To use variable variables with PHP arrays, extra considerations need to be taken to resolve potential ambiguities in your code. Consider the following PHP code: To what exactly is the array key … Read more

Categories PHP

How to Test Connection to PostgreSQL Database on Linux (Ubuntu/Debian/Fedora)

Test Connection to PostgreSQL Server Database

This short tutorial will demonstrate how to test the connection to a PostgreSQL database locally and remotely from Linux. This article is part of our series on getting started with PostgreSQL, head back to our index that lists our full PostgreSQL guide. Testing PostgreSQL Database Connection on Ubuntu/Debian To test connectivity to a PostgreSQL server, you’ll need the PostgreSQL client installed if it is not already. Do this by running: Then, you can use the pg_isready command to test the connection to a database: One of the following … Read more

Is PostgreSQL an SQL or NoSQL Database?

PostgreSQL is not NoSQL

A common question is whether PostgreSQL is an SQL or NoSQL database (it’s not) – this article explains why. What is SQL SQL (pronounced sequel or S-Q-L) is the Structured Query Language – a language used by many relational database systems for querying data. It is also increasingly being used for defining data schemas in data analytics applications where the data is not stored in a database but is arriving as a data stream. Data defined and queried by SQL is structured tables that can have relationships between records – for example … Read more

How to Include a JavaScript File in Another JavaScript File [Examples]

How to Include a JavaScript File in Another

This article will detail the various methods for including a JavaScript file in another JavaScript file – providing several methods for use in the browser, and when working in Node.js. One of the cornerstones of programming is reusable code. This concept is encapsulated in the DRY (Don’t Repeat Yourself) principle – that if you need to do something multiple times, you write the code for it once, and re-use it where it is required, rather than having multiple copies of the same code in your code base. … Read more

JavaScript Reference: Complete List of Operators + Examples

JavaScript Operators

This article will explain and list JavaScript operators and expressions. JavaScript operators perform a given operation on the provided expressions or values. Common operations include comparisons, arithmetic, and ternary operations. You will use JavaScript operators frequently (even the simplest JavaScript code will use multiple operators!), so it’s worth getting to know them, and their expected behaviour. What are Operators and Operands? Javascript operators perform a given operation, for example addition, subtraction, and other arithmetic, comparisons like greater than/less than, and more complicated operations like ternary/comparison … Read more

PHP Scopes in Functions, Loops, Modules, With Examples

PHP Variable Scopes

This article explains what variable scopes are, and how they work in the PHP programming language, with code examples. When programming in any language, you must be aware of how variables are scoped – otherwise, you risk unexpected behaviour, including incorrect calculations, or loss of data – detrimental outcomes for any application (especially if you are working with business records or financial data) that will result in angry users. What is a Variable? In computer programming, a variable stores a value, giving it a name that can … Read more

Categories PHP

Python NumPy Crash Course – A Simple Tutorial and Example

Python Numpy Course Tutorial Example

Python’s NumPy library is the standard for working with numerical data. This article will explain why that is, and how to use it. In addition to this, code examples for basic usage will be shown, and we will build a real-world example that implements NumPy to work with some example data. Python and Arrays Whether you are working with data collected for scientific or business reasons, it is usually collected in the form of arrays of data presented as tables with single or multiple columns. … Read more

Python Virtual Environments with virtualenv and Anaconda

python virtualenv

This article will explain and demonstrate virtual environments in Python using virtualenv and in Anaconda. What is a ‘Virtual Environment’? In Python, a virtual environment is an isolated directory that contains all of the dependencies of a Python project. By default, when you install a package using the pip package manager, it is installed globally – that version of the package is available to all Python scripts running on your system. This can cause problems. It clutters up your global Python installation, and all projects … Read more

PHP $this Variable – What It Is, How To Use It [Examples]

PHP this

This article will explain the PHP $this variable – what it is, what it does, and how to use it – with code examples. PHP Objects and Classes PHP is an object-oriented programming language. Code and data can be stored in an object which represents the items your code represents with a set of properties and methods. For example, you might have objects that represent sales invoices, or cars, or pets, or people – each containing code and data relevant to the thing they represent. The properties or attributes of … Read more

Categories PHP