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

What are Python Docstrings and How Are They Used?

Python Docstring

This tutorial will explain what docstrings are in the Python programming language and how they can be used. What is a Docstring in Python? A docstring is a string literal that is used to document your code. A string literal is a sequence of characters 0 or more characters in length, which is to be treated as a single entity – i.e., it’s a string variable of any length. A docstring appears after the definition of a module, class, method, or function and should explain the purpose of the object it … Read more

How to Reset/Clear/Empty an Array in JavaScript

Reset/Clear Array JavaScript

This quick article will show you the right way to reset/clear/empty an array in the JavaScript programming language. The Right Way to Reset/Clear/Empty an Array – Set the length to 0 This is the best way to reset/clear/empty an array in JavaScript. It is unambiguous and will affect both the variable containing the array and any variables referencing the array. var myArray = [1, 2, 3, 4]; myArray.length = 0; Above, an array is declared and then emptied by setting the array’s length property to 0. The Wrong Way – Re-declare the … Read more

How to Use the PHP empty() Function

Check if PHP Variable Empty

This easy tutorial will show you how to use the PHP empty() function to check whether a variable can be considered empty and show some code examples. What Is Empty? A variable is considered empty in PHP if its value equates to FALSE or the variable does not exist. This means that the following are considered empty: An empty string (“”) The number zero (0) In any form (0.0000) Including strings containing only a 0 character (“0”) Boolean FALSE NULL An undeclared variable Empty arrays The empty() function is different from the isset() function. The latter checks only whether … Read more

Categories PHP

C++ vs Python – Which Programming Language to Learn in 2022?

Python vs c++

Here’s a quick primer on the C++ and Python Programming languages to help the beginner or intermediate coders decide which to learn. What is C++? C++ is a compiled general-purpose programming language. It’s an extension of the C programming language – using similar syntax but adding object-oriented programming features like classes, objects, and additional expressions. As C++ is compiled, it is converted to machine language prior to being executed. This means it runs much faster than interpreted languages like Python and means that it has fewer resource overheads, it’s perfect for running on … Read more

Modulus (Mod), Modulo and Python – Explanation and Code Examples

Python mod Modulus Modulo

This tutorial will explain (hopefully in the simplest terms possible) what modulus and modulo mean and how they can be calculated in the Python programming language. Modulus and Modulo are Different Things! There’s a bit of confusion about this, and it seems that in some places, the terms modulus and modulo are used in place of each other – this is wrong (and confused me too – hence this article)! What is Modulus? In mathematics, the modulus is the absolute value of a number. It’s the non-negative value of a number – or its … Read more

Modulus (Mod), Modulo and PHP – Explanation and Code Examples

PHP mod Modulus Modulo

This article will explain (in the simplest terms possible) what modulus and modulo mean and how they are calculated in the PHP programming language. Modulus and Modulo are NOT the Same Things! There’s a bit of confusion about this, and it seems that in some places, the terms are used interchangeably – this is wrong (and confused me too – hence this article)! What is Modulus? In mathematics, the modulus is the absolute value of a number. It’s the non-negative value of a number – or its distance from 0 (zero). … Read more

Categories PHP

The Vital Tools Every IT SuperHero Needs in Their Bag

IT Superhero It Contractor Tools

Starting out as an IT contractor can be tough – making a good first impression is key. Here’s a list of the tools you will need while you’re on the road fixing problems. You don’t want to arrive on-site only to find you don’t have the tools to do the job! A Linux Laptop! This is LinuxScrew, of course. Linux has all of the tools you need to fix any IT issue. Tools for diagnosing network and internet issues, tools for scanning and recovering disks, and anti-malware … Read more

How to Read a Local/Remote JSON File in JavaScript [Examples]

JavaScript Read JSON File

This article will show you how to read a JSON file into JavaScript as a JSON object – both local and remote files. What is JSON? JSON (JavaScript Object Notation) is a file format that stores objects, and arrays of objects, as human-readable text. It’s become the most popular method of storing and transmitting structured data on the internet. Thousands of APIs (used for mapping, communication, authentication, and many other purposes) use it as the format for submitting and receiving data. Desktop applications also use it to … Read more

How to Write to a File Using JavaScript, With Examples

Write to File in JavaScript

This article will show you how to write to files from JavaScript – both from the web browser and Node.js environments. With examples on how to write, append, update, delete and rename files. JavaScript code is usually run from one of two environments – within a web browser when viewing a web page or in a Node.js environment which allows JavaScript to be executed outside of a web browser – commonly used for building back-end services and web apps. Write to a File From the Browser … Read more

R vs Python – What Makes them Different? Which is Best?

R vs Python

This article provides a simple comparison of the R and Python programming languages – and what they’re best used for. If you’re looking to learn to program and are interested in data analysis, you’ll probably run into the choice – R or Python? This article breaks down each and why you might choose to use one – or both – of these languages. What is R? R is a programming language designed specifically for statistical computing. It is designed for, and widely used for, processing and analyzing large data sets. What is it Good … Read more