Home » 2021

Capitalize the First Letter of Each Word in a String [JavaScript]

JavaScript Capitalize First Letter

This short article shows you how to capitalize the first letter in a string or all of the words in a string (title case) in the javascript programming language. Capitalizing the first letter in a string is useful if you’re capitalizing a single word or a whole sentence which you wish to display in a grammatically correct manner. Converting a string to title case – that’s where every word is capitalized in a string with multiple words – is useful for formatting text for use in an article … Read more

Home » 2021

Python: View Documentation With the help() Function

Python help() Function

This short article will show you how to use the Python help() function to view the documentation (Docstring) for a Python module, class, or function. Documenting Your Python Code with Docstrings You can document your Python code with a special string called a docstring. We’ve got a whole article on that here. The short version of it is this: put a triple quoted string immediately after declaring a function, class, or module in Python: “”” Just like this “”” …and you can later read from it using the help() … Read more

Home » 2021

How to Check if an Array is Empty in JavaScript [Examples]

Check if JavaScript Array is Empty

This quick tutorial will show you how to check whether an array is empty in the JavaScript programming language. What is an Array? An array is a type of variable that holds a collection of zero or more values. In JavaScript, arrays are ordered – each value in the array has a position (called the index) in the array, which is used to access it. Indexes start counting at 0, so the first value in an array is at index 0. Declaring an Array in JavaScript The quickest way to … Read more

Home » 2021

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

Home » 2021

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

Home » 2021

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 » 2021

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 » 2021

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 » 2021

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 » 2021

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