Home » Articles by: Brad Morton

How to Use Single/Multiline Comments in your PHP Code

PHP Code Comments

This article will quickly walk you through how to comment your PHP code with single and multi-line comments. What is a Comment? A comment in programming is one or more lines of text that aren’t interpreted as programming instructions. Instead, the computer skips the commented lines when executing your code, completely ignoring them. Comments don’t have to conform to any valid syntax. They’re just text that you read, and the computer doesn’t. Comments can span single or multiple lines. Single Line Comments Single line comments are any lines of … Read more

Categories PHP

Home » Articles by: Brad Morton

How to use the JavaScript ‘while’ Loop, With Examples

JavaScript While Loops

This article will show you how a JavaScript while loop is constructed, and what it us used for, with code examples. While loops are one of the simplest kinds of loops, and appear in most programming languages. A while loop runs a block of code repeatedly, until a condition is met. When the while condition is met, the loop stops. It’s important to get comfortable with using loops – and understanding how they work – as they form the backbone of just about every game and application you might write. Make sure you’re familiar … Read more

Home » Articles by: Brad Morton

JavaScript Print – To the Console, WebPage, or a Printer [Examples]

JavaScript Print to Printer, Console, Page

You’ve searched for ‘JavaScript Print’ – so you’re probably trying to output data to the console, to the webpage or to a printer. Here’s how to do all three. Printing to the Console with console.log() The JavaScript console.log() method prints data to the JavaScript console (visible in your browsers web inspector). Any type of data can be logged to the console, including strings, numbers, arrays, and objects, and either the contents of, or a text representation of, the value will be displayed. console.log() is frequently used for debugging – developers use it to view … Read more

Home » Articles by: Brad Morton

DIY Raspberry Pi Chopping Board HomeLab

Raspberry Pi Chopping Board Lab

Here’s an odd solution I came up with to deal with the tangled mess that is my Raspberry Pi HomeLab – mounting it on a cheap kitchen chopping board. There’s not a lot more to be said for it really – it’s a Raspberry Pi attached to a chopping board. But why? I noticed that the micro-HDMI connection to the Pi was getting wonky – every time I shifted things around force was applied to the tiny connector.  I wanted to mount the Pi and … Read more

Home » Articles by: Brad Morton

JavaScript Escape Quotes / Escape Strings [Examples]

JavaScript Escape Quotes

This article will explain how to use escape characters to escape quotes in strings in the JavaScript programming language, with some examples. What is a String Variable in JavaScript? A string is a type of variable. It represents a series of zero or more characters. Other variable types are numeric, boolean, and array variables. A variable’s type defines what values it can hold and what can be done with it. For example, string variables can be split and joined to form new strings, and numeric variables can have mathematical operations … Read more

Home » Articles by: Brad Morton

How to Use the JavaScript ‘do while’ Loop, With Examples

JavaScript do while loops

This article will show you how a JavaScript do while loop is constructed, and what it us used for, with code examples. do while loops are one of the simplest kinds of loops, and appear in most programming languages. A do while loop runs a block of code repeatedly, until a condition is met. When the do while condition is met, the loop stops. It’s important to get familiar with using loops – and understanding how loops work – as they form the backbone of just about every game and application you might … Read more

Home » Articles by: Brad Morton

DietPi – A lightweight Raspberry Pi OS Alternative

Diet-Pi - A lightweight Raspberry Pi OS Alternative

Here’s a quick screenshot walk-through of the installation of DietPi OS for Raspberry Pi.  DietPi is a minimalist but fully featured alternative to Raspberry Pi OS.  I’ve run through the install process so that you can see how everything looks before trying it yourself. Previously, we covered TwisterOS – another Raspberry Pi targetted Linux distribution  which aims to be super user friendly and includes a lot of extra software – check it out if you don’t think the minimalist DietPi is for you. Download & … Read more

Home » Articles by: Brad Morton

How to change DNS servers on Linux (Ubuntu/RedHat/All Distros)

How to change your DNS servers on Linux

Here’s a quick tutorial for a simple but important task – manually setting the DNS server on your Linux system. The steps in this tutorial should work for all Linux distributions – both server and desktop. Manually setting your DNS server is particularly useful if you’re setting up a Pi-Hole ad blocker. Backup Existing DNS Configuration If an existing manual DNS configuration exists, back it up by copying it to a new file: sudo cp /etc/resolv.conf /etc/resolv.conf.bak Edit Linux DNS Configuration The nano text editor … Read more

Home » Articles by: Brad Morton

How to Install OSMC Media Center on Raspberry Pi [Screenshots]

How to Install OSMC Media Center on Raspberry Pi

This step-by-step guide will walk you through installing the OSMC media center software on a Raspberry Pi.  Screenshots of the whole process are provided so that you can follow along! LibreELEC, OpenELEC or OSMC – What’s The Best? LibreELEC, OpenELEC and OSMC are the most popular media center solutions for the Raspberry Pi. I’ve chosen to use OSMC for my media center.  OSMC provides an easy and fast way to get Kodi up and running on a Raspberry Pi. OSMC provides Debian based Linux OS … Read more

Home » Articles by: Brad Morton

How to Convert Array to String in JavaScript with toString() and join()

JavaScript Array to String

This brief tutorial will show you two ways to convert JavaScript arrays to strings using the toString() and join() methods. What Are Arrays? An array is a data structure which holds multiple values. It’s like a numbered list – each item in the array has a value and a position (called the index). The indexes start counting at position 0, so the first item in an array is at index 0, the second at index 1 and so on. Converting Arrays to Strings in JavaScript There are many reasons you may wish … Read more