Home » 2021

Python Matrix (2D Array, NumPy), With Examples

Python Matrix

This article will explain what a matrix is and how to use them in the Python Programming Language with the NumPy library. What is a Matrix In mathematics and computer programming, a matrix is a two-dimensional array of values. It is a grid of columns and rows, with each position in the grid holding one of these values. It is an array because it’s a collection of elements with multiple elements, and it’s two-dimensional because the values exist at two coordinates (i.e., rows and columns). … Read more

Home » 2021

Remove/Delete Files/Directories in Linux with rm

Linux rm Remove File Directory

This article will outline how to delete files and directories in Linux with the rm command and give example usage. The rm Command in Linux Files and directories can be deleted from the shell/command line in Linux using the rm command. rm Command Syntax rm OPTIONS FILES Note that: OPTIONS is a list of options from the below table FILES is a list of files or directories (if the -r option is specified) to be removed Multiple files or directories can be specified, separated by spaces Options Here are the most commonly used options for … Read more

Home » 2021

Copy a Table in MySQL/MariaDB – How To, With Examples

Mysql MariaDB Copy Table

This article will show you the BEST way to copy a table, with or without the data in it, in MySQL and MariaDB. Copying the Table with All Data in MySql The following code will copy a table including all data using the CREATE TABLE LIKE statement: CREATE TABLE new_table_name LIKE database_name.old_table_name; INSERT new_table_name SELECT * FROM database_name.old_table_name; There are other methods, some single line, but this is probably the best and simplest one. Why did I choose this method? Because it copies the table … Read more

Home » 2021

Move Files With the mv Command in Linux, With Examples

Linux Move File mv

This article will walk you through moving files in Linux with the mv command, with examples and tips on moving files safely. mv Syntax Moving files is done using the mv command, which has the following syntax mv OPTIONS SOURCE DESTINATION Note that: OPTIONS is a list of options from the below table SOURCE is the path to the file you wish to move DESTINATION is the path to the destination you want to move the file 2 This can include a new file name or simply be the path to a … Read more

Home » 2021

PHP vs HTML – What’s The Difference? Which Should You Use?

PHP vs HTML

This article will explain the difference between PHP and HTML and outline which you should use for your project (probably both – and I’ll explain why). If by the end of this article you’re still trying to navigate your way through the different web programming languages, check out these other explainers: jQuery vs. JavaScript – Differences? Which is Better? PHP vs. JavaScript – The Best Choice For Your Project TypeScript Vs. JavaScript – What’s the Difference & Which Should You Use? MySQL vs. MariaDB vs. … Read more

Categories PHP

Home » 2021

How To Run a Python Script (Python 2/3)

How to Run Python Scripts

This article will show you how to run both Python 2 and Python 3 scripts in Linux and find out what versions of Python are installed. Running a Script To run a Python 3 script: python3 /path/to/script.py To run a Python 2 script: python2 /path/to/script.py Read on to find out how to install Python and find out which versions you have installed. Installing Python on Linux You can see what Python packages are installed on your system by running the following commands: which python which … Read more

Home » 2021

Unix vs Linux – What’s the Difference?

Unix vs Linux

Here’s a quick summary of Unix and Linux and what makes them different, and ways you can try them out. Different products, similar uses What is Unix? Unix was developed in the 1970s by Bell Labs as an Operating System for developers. Over time features such as multitasking and support for multiple users were added, turning it into a versatile operating system popular with universities. The modular development of Unix lead to the Unix Philosophy – an emphasis on modular, reusable code and handling files as … Read more

Home » 2021

Checking Whether a String Contains a String in Python, With Examples

Python String Contains

This article will show you how to check if a string contains another string in the Python programming language. PHP and Javascript both have similar functions included: PHP strpos Function: Check if a String Contains Another String Javascript String includes() Method – Check if a String Contains Another String Python has several methods for accomplishing the same thing – read on for how to do it. Using in to Check if A String Contains a String in Python The fastest and best way to check if a … Read more

Home » 2021

Passing Variables by Reference in PHP, with Examples

PHP Pass Variable By Reference

This article will explain how to pass a PHP variable by reference and why you might want to do it – with some examples. What is a Variable? You probably already know this one. A variable stores a value – it has a name, and you can use that name to refer to the variable and the value it contains. In PHP, variable names are prepended with a $ (dollar symbol) and must contain only numbers, letters, dashes, and underscores: $variableName = “Variable Value”; Variable Behaviour in … Read more

Categories PHP

Home » 2021

Exiting Bash Scripts with the exit Command, With Examples

Bash Exit Script

Bash/Shell scripts usually run sequentially until all of the code in the file has been executed. The exit command will exit the script before this based on conditions of your choosing. exit Command Syntax Here’s the syntax for the exit command, which can be used in Bash/Shell scripts: exit STATUS Note that: STATUS is an optional parameter that sets the exit status of the script The exit status tells other programs whether the script executed successfully or not It will default to either 0 or the exit status of the last command executed by … Read more