Software Development

Laravel – How To Check If A Collection Is Empty

In Laravel, it is a common mistake to use PHP’s empty() function to check if a collection is empty. When empty() is used on an empty array [] the boolean value of true is returned. However, using empty() on a collection can cause unexpected results because when a collection has no values the empty() function …

Laravel – How To Check If A Collection Is Empty Read More »

PHP – Loose Comparison (==) VS Strict Comparision (===)

In PHP, there are two options when comparing values in a condition. These comparison options are loose comparison (==) and strict comparison (===). PHP is a loosely typed language which means that variables can be assigned different data types during execution of the application and different data types can be compared in a conditional. This …

PHP – Loose Comparison (==) VS Strict Comparision (===) Read More »

Javascript – Equality (==) Operator VS Strict Equality (===) Operator

In Javascript, there are two options when comparing values in a condition. These comparison options are equality (==) and strict equality (===). Javascript is a loosely typed language which means that variables can be assigned different data types during execution of the application and different data types can be compared in a conditional. In strictly …

Javascript – Equality (==) Operator VS Strict Equality (===) Operator Read More »

Javascript – When To Use console.dir() Instead Of console.log For Debugging

When debugging javascript it is common to use console.log() to print variables or messages to the browser’s dev tools console. The dir() method is another tool for logging that can be useful in certain situations. From the MDN Web Docs, console.dir() is given the following description: “The method console.dir() displays an interactive list of the properties of …

Javascript – When To Use console.dir() Instead Of console.log For Debugging Read More »

C# – Lists

In C#, a list is a variable that is able to store multiple values of the same type and those values can be accessed by an index. This is similar to arrays which were covered in the previous post. However, unlike arrays, the size of the list does not need to be set at declaration …

C# – Lists Read More »

C# – Arrays

In programming, a variable is used to store a value in memory. Arrays are a type of variable that is able to store multiple values. Arrays can be thought of as a container of values. This article will explain how to use arrays in C#. In C#, arrays must be of the same data type …

C# – Arrays Read More »

Javascript – How To Add CSS Styles To console.log Messages

In Javascript, console.log() is used to print messages to the developer tools console to help with debugging. The console output can be updated to have CSS styles. This can be helpful when debugging if you have many console messages and you would like a certain message to stand out to be able to quickly find …

Javascript – How To Add CSS Styles To console.log Messages Read More »

C# – Null-Conditional Operators (?. and ?[])

The System.NullReferenceException: Object reference not set to an instance of an object. exception is a common exception in C#. This exception is thrown when a variable of reference type is null and it is attempted to be accessed. This error can be avoided by using if conditions to make sure the variable is not null …

C# – Null-Conditional Operators (?. and ?[]) Read More »