Home » Articles by: Brad Morton

6 Best PHP Frameworks to Consider in 2021

Best PHP Frameworks

PHP frameworks speed up the development of complex applications greatly. This article features 6 of the most popular frameworks to consider in 2021. These frameworks provide varying scaffolding levels to get you started, from database operations, object handling, user authentication, and page templating. So you are free to build your application without having to constantly write and re-write the common functions that make your application work. They also come with some security benefits – using a sanitized database abstraction layer that has been written and … Read more

Categories PHP

Home » Articles by: Brad Morton

Command Line Arguments in Shell/Bash Scripts [Tutorial]

Command Line Arguments in Bash Scripts

This tutorial explains how to pass command-line arguments to your bash scripts. There are many examples included to help get you started. Bash/Shell scripts are a great way to automate your Linux workflow and speed up your workday so you can leave the office early (or hide in the server room until 5 pm hits). Making scripts re-usable makes them more useful – you don’t need to write a script that does the same task for different sets of information or on different days – … Read more

Home » Articles by: Brad Morton

PHP shell_exec Function: How to Use It [With Examples]

PHP shell exec Function

This tutorial explains how to use the shell_exec function in PHP in order to execute code via the shell and return the output as a string. PHP is a versatile programming language for building server-side web applications, but sometimes you need to execute code from another environment and use the result in PHP. This can be achieved by using the shell_exec function to execute commands on the system’s shell hosting your PHP code and return the result as a string to PHP. When doing so, there are security … Read more

Categories PHP

Home » Articles by: Brad Morton

Javascript eval() Function (and Why to NEVER Use It)

Javascript eval Function

The JavaScript eval() function executes a string as JavaScript. This is a massive security risk as, if used in production, it can allow third parties to execute their own code in your app. eval() Syntax eval(string) Note that: string is a string that contains JavaScript Code eval() will return the value returned by executing the code in the string Just don’t use it Example of Javascript eval() This article gets one example only so you can see how eval() works, so that if you accidentally fall on your keyboard and the … Read more

Home » Articles by: Brad Morton

Python Main Function & Method: What Is It and How Is It Used?

Python Main Function Method

As you build more complex Python apps, you will probably want to start splitting your code into separate files. What Is the __main__ Function? Importing and executing code from another file is common in even small scripts and apps built with Python. As your library of scripts increases, you may choose to import previously written code into new projects. The __main__ function in Python is only executed when the script is called directly, allowing you to set different behavior based on how your code is being … Read more

Home » Articles by: Brad Morton

How to Get User Input in Python [With Examples]

Get User Input in Python

This article covers getting user input on the command line using Python 2 or 3 and includes some useful examples. Get User Input in Python 3 Python 3 uses the input() function to collect user input: myText = input(“Enter some text:”) print(“You entered the text: ” + myText) Get User Input in Python 2 If you’re still using Python 2, you will use the raw_input() function instead: myText = raw_input(“Enter some text:”) print “You entered the text: “, myText # Python 2 uses different syntax to print output Typing Input … Read more

Home » Articles by: Brad Morton

Assign Variables, Global Variables and Scopes in JavaScript (let, var, const)

JavaScript let var const

let, var, and const are all JavaScript statements that assign a value to a variable. Their behavior can differ depending on how and where they are used in your code – read on to find out the details. Scopes in JavaScript As you start to build more complex applications, you’ll start to see a lot of talk about scopes. A variable’s scope defines where it is available in your application. Global Scope (Global Variables) If a variable is in the global scope, it is available anywhere in your application. It can be called … Read more

Home » Articles by: Brad Morton

Creating Multiline Strings in JavaScript [With Examples]

Creating Multiline Strings in JavaScript

There are several ways to create text that spans multiple lines in JavaScript – so here they are! Method 1: Backticks This is the best method, so it goes first. It is only compatible with ECMAScript 6 and onwards, so it is only for use in modern browsers (really, if you’re using any browser that isn’t Internet Explorer, you should be fine, but you should always test your code on the browsers you want to target). var multiText = ` This is multiline text!`; console.log(multiText) // … Read more

Home » Articles by: Brad Morton

Python Scatter Plots with Matplotlib [Tutorial]

Python Scatter Plots

Graphs are awesome. If you disagree, you probably shouldn’t read on. The best (and easiest!) way to create graphs and scatter plots in Python is using the package Matplotlib. This tutorial explains exactly how to do so. https://pypi.org/project/matplotlib/ What is matplotlib? I’ll let them introduce themselves in their own words: Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. This article will give you a jump-start on using Matplotlib to create scatter plots. Install Python Dependencies First, you’ll need to install MatplotLib using … Read more

Home » Articles by: Brad Morton

PHP var_dump() Function [With Examples]

PHP var dump Function

The PHP programming language includes various built-in variable types and allows you to create your own complex object classes. Third-party packages also come with their own object classes. So it’s useful to find out what type of variable a variable is, its value, and the type/value of any properties or values the variable may contain. The PHP var_dump() function returns a given variable or value’s properties, including the value and type. It works through the variable’s properties or value recursively doing the same. Read on to learn … Read more

Categories PHP