JavaScript Booleans: A Guide
How to Use JavaScript Booleans True or false values are everywhere in programming. We call these values Booleans. They can be used to compare two or more values and control what parts of a program should run. In this guide,…
sudo Command: A Guide for Beginners
What is the sudo Command? “Make a sandwich.” No. “Sudo make a sandwich.” Sure. This is a recurring joke in the programming community. This article will help you understand the sudo joke. Sudo is a command that runs any Linux…
Python Factorial: A Guide
How to Calculate a Python Factorial You may remember the word “factorial” from your high school math class. They’re not very easy to calculate without a calculator. Who wants to calculate the factorial of 10 by manually multiplying 1x2x3x4 and…
NumPy Concatenate: A Guide
How to Concatenate NumPy Arrays NumPy is an excellent library for working with arrays in Python. It covers everything from creating to manipulating arrays of all sizes. It’s no surprise then that NumPy comes with a utility that you can…
JavaScript Shift and JavaScript Unshift: A Complete Guide
JavaScript shift() removes an element at a specified position and shifts the remaining elements up. The JavaScript unshift() function does the opposite. unshift() adds a new element at a particular position and shifts the remaining elements down the list. You…
SQL UPDATE: A Guide
How to Use the SQL UPDATE Statement One of the core features of databases is that stored values can be updated. You can change the values of any record in a database at any time. Values inside an SQL database…
How to Use the git rebase Command
One of the beauties of Git is that it allows you to keep an accurate record of how a codebase has evolved. This makes it easy to see what changes have been made to a repository, when they were made,…
If Else in C++: A Step-By-Step Guide
If...else is a conditional statement in C++. The C++ if statement runs a block of code if a condition is met. An if...else statement functions the same way but runs a second block of code if the condition is not…
Git Revert Commit: A Step-By-Step Guide
The git revert command will undo a commit so you can return a repository to the previous commit. Instead of deleting the commit, revert will create a new commit that will reverse the changes of a published commit. This preserves…
Python Recursion: A Guide
How to Use Python Recursion Python recursion is an intimidating topic for beginners. Let’s dispel the myth that recursion is difficult by defining it. Recursion is a method of programming where a function calls itself. That sounds simple, right? When…
How to Convert a Char to String in Java
To convert a char to a string in Java, the toString() and valueOf() methods are used. The toString() and valueOf() methods are both used to convert any data type to a string. For converting a char to a string, they…
Python Assert Statements: A Step-By-Step Guide
The Python assert keyword tests if a condition is true. If a condition is false, the program will stop with an optional message. Assert statements are used to debug code and handle errors. You should not use an assert statement…
Java String Contains: A Step-By-Step Guide
The Java contains() method checks if a string contains another substring. The contains() method returns either True or False. Java contains() accepts one parameter: the substring to search for in your string. Often, when you’re working with strings, you’ll want…
Python Float: A Step-By-Step Guide
The Python float() method converts a number stored in a string or integer into a floating point number, or a number with a decimal point. Python floats are useful for any function that requires precision, like scientific notation. Programming languages…
Python Print Without Newline: Step-by-Step Guide
To print without a new line in Python 3 add an extra argument to your print function telling the program that you don't want your next string to be on a new line. Here's an example: print("Hello there!", end =…
Python Compare Strings: A Step-By-Step Guide
Strings in Python are compared with == and != operators. These compare if two Python strings are equivalent or not equivalent, respectively. They return True or False. Often, when you’re working with strings in Python, you may want to compare…
Java Initialize Array: A Step-By-Step Guide
To initialize an array in Java, assign data in an array format to the new or empty array. Initializing an array in Java involves assigning values to a new array. Java arrays can be initialized during or after declaration. In…
Git Add Remote: A Beginner’s Guide
How to Add a Remote to a Git Repository Have you just started a new Git repository on your local machine? You’ll need to add a remote if you intend on linking it to a remote repository. The git remote…
Java Compare Strings: A Step-By-Step Guide
There are three ways to compare strings in Java. The Java equals() method compares two string objects, the equality operator == compares two strings, and the compareTo() method returns the number difference between two strings. String comparison is a crucial…
Python String to Int() and Int to String Tutorial: Type Conversion in Python
How to Convert Python String to Int:To convert a string to integer in Python, use the int() function. This function takes two parameters: the initial string and the optional base to represent the data. Use the syntax print(int("STR")) to return…
How to Write a Python Generator
Iterators play an important role in Python. They allow you to create an object that can be iterated upon. It’s a good way to store data that can be accessed through a for in loop. The trouble with iterators is…
What is a Network Interface Card?
Have you ever wondered what connects your computer to a network? Behind the scenes, there is a component called a Network Interface Card that is hard at work. This hardware component is used to allow your computer to connect to…
How to Solve fatal: refusing to merge unrelated histories
After using Git for a while, you’ll notice that there’s a lot of mistakes that can be difficult to fix. This isn’t the case with the fatal: refusing to merge unrelated histories error. Unlike a number of other errors, this…
Bash Aliases for Beginners
After using the command line for a while, you will start to notice that there are a lot of commands that you repeat often. Some of these commands, like “cd” and “ls” are just part-and-parcel of working with the Linux…
How to Resolve Git Merge Conflicts
In most cases, Git can resolve differences between branches and merge them. This is because developers are usually making changes to different lines or files. There are some cases where Git cannot merge a repository. These situations are called merge…
Git Undo Add: A Guide
There’s plenty of reasons why you would want to remove an item from a Git commit. If you’ve not finished working on a file, it may not be ready to commit; you may still be testing it, or you may…
What is a Web Application?
Are you curious about what a web application is? It’s not a bad question because web applications, contrary to what most people think, are not just websites. You’ve probably used a web application at some point without even knowing about…
How to Use the Linux Cat Command
The cat command in Linux is not as cute as a real cat, but it plays a key role in Linux. The cat command allows you to view the contents of a text file from a Linux command line. In…
How to Use JavaScript Promises
Asynchronous code used to be a pain to write in JavaScript. To write asynchronous operations in your code, you would have to deal with multiple levels of callback functions. The more functions that you introduced into your code, the harder…
How to Use JavaScript Callback Functions
You’ve probably seen a few code snippets use the word “callback” inside a function. Callbacks are a special type of function that are passed inside another function. Callbacks are often used inside event handlers to run a block of code.…