Home » Articles by: Brad Morton

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

Home » Articles by: Brad Morton

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

Home » Articles by: Brad Morton

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

Home » Articles by: Brad Morton

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

Home » Articles by: Brad Morton

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

Home » Articles by: Brad Morton

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

Home » Articles by: Brad Morton

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

Home » Articles by: Brad Morton

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

Home » Articles by: Brad Morton

Calculating Factorials in Python – The Easy Way

Python Factorial

This short article will show you the quickest and easiest way to calculate a factorial in Python using the factorial() function. This article is written for the Python 3 programming language. What is a Factorial, and How is it Calculated? A factorial is a mathematical formula in which a given positive integer is multiplied by all of the positive integers less than itself – the resulting number being the factorial of the original number. It is denoted with ! (exclamation mark) – so the factorial of 4 is written as 4! And is calculated out like so: … Read more

Home » Articles by: Brad Morton

Converting to Float Numbers with the parseFloat() JavaScript Function, With Examples

JavaScript ParseFloat()

This article will explain floating-point numbers and how to convert values to floating-point numbers using parseFloat() in JavaScript. Looking to convert to an integer value instead – use parseInt()! What is a Floating Point Number? In programming, a floating-point number (commonly just called a float) is a number with any number of characters before or after a decimal point. A floating-point number might look something like this: 14.392 A floating-point number or float is also a type of variable. A variable’s type determines what kind of values it can store and what can be done with the variable … Read more