Home » Programming

How to Install Anaconda (Python & R) on Ubuntu

Install Anaconda Ubuntu

We like Python. Anaconda is a popular distribution of Python and the R programming languages, which includes package management and deployment tools, with hundreds of packages pre-installed. Anaconda is aimed at data scientists and people working with machine learning, but it’s useful for anyone. It has a quick and easy install process for Ubuntu, so here’s how to get up and running! Download the Anaconda installer Anaconda has various additions, and we want the Open Source (free!) individual edition, available from: https://www.anaconda.com/products/individual Scroll down and … Read more

Home » Programming

COVID Vaccination Rate Notifier [Project] – Scraping and Displaying with Python

COVID Vaccination Rate Notifier

This article takes you through the creation of a COVID vaccination rate notifier. This project works by scraping data from the web and then displaying system notifications with Python. It hasn’t been the greatest year – but there’s light at the end of the tunnel. We’ve waited for the vaccine, and now we wait for people to get the vaccine. To keep sane through the winter, we’re all watching the vaccination rate slowly climb – hopefully to the point where we can go to the … Read more

Home » Programming

Using the ‘UNION’ Operator in MySQL and MariaDB

mysql union

MySQL SELECT queries are commands that pull data from your database tables according to conditions each record must meet. Complex queries will often need to combine the results from two or more SELECT queries – this is what the UNION operator does. UNION Syntax SELECT column [, column2, column3…] FROM first_table UNION SELECT column [, column2, column3…] FROM second_table; Note that: Each SELECT statement must have the same number of columns in its results Data type in each of the columns must match The columns … Read more

Home » Programming

Building a Python Script to Resize & Watermark Images [Code Included]

Building a Python Script to Resize Watermark Images

In this project, we take you through building, packaging, and publishing a command-line application using Python to resize and watermark images. Whenever I complete an article for LinuxScrew, I need to go through and add watermarks and make other small adjustments to any photos I’ve taken. This can be tedious so I thought, why not automate it. Then I thought, why not make a command-line app to do it (rather than just a bash script), and show you how you can make your own command-line … Read more

Home » Programming

Guide to Foreign Key Constraints in MySQL and MariaDB [With Examples]

Guide to Foreign Key Constraints in MySQL

In this guide, we cover foreign key constraints in MySQL and MariaDB, along with a number of useful examples. MySQL (and its fork MariaDB) are Relational Database Management Systems (RDBMS) – Database Systems which hold data in tables which can be related to each other. Tables in an RDBMS are organized into columns that contain data in rows (also called tuples). Each row will usually have a Primary Key – a unique value to identify the row in the table. To define relationships between two rows in two different … Read more

Home » Programming

Python “while” Loops [with Examples]

python while loops

This tutorial explains how to create loops in Python by using the “while” statement. Included below are the syntax and examples. In programming (and thus, in Python), a loop is a statement which will execute a block of code repeatedly until a condition is met, or the loop is broken out of manually. This article will look at Python Loops and conventions to use when writing them. Looping with the while statement, Syntax and Example Here is a basic loop which will increment (add 1) the variable ‘i’ … Read more

Home » Programming

Python time.sleep() to Pause, Sleep, Wait or Stop a Python Script

Pause Sleep Wait or Stop a Python Script

There is a useful function in Python called ‘sleep()’. It’s part of the ‘time’ module and allows you to pause, sleep, wait, or stop a Python script or application. Python can be used to make useful command-line tools to streamline your workflow, but sometimes you need to wait for the user, or for a pre-defined amount of time. For example, you may want to prompt the user to press a key when they have finished reading instructions or give them time to override a default … Read more

Home » Programming

Python List ‘sort()’ Method – Sorting Lists in Python Easily

Sorting Lists in Python Easily

In Python, there’s an easy way to sort lists: using the sort() method. This tutorial explains how to use sort(), with examples. We’ve covered the following in Python: Removing list items Checking if items are in lists Finding items in lists Now it’s time to find out how to sort a list. Syntax for the sort() Method list.sort(reverse=True|False, key=sortFunction) Note that: ‘reverse’ should be a True/False boolean value and is optional reverse=True will sort the list descending The default is reverse=False True/False values case sensitive in Python! … Read more

Home » Programming

Python: Find in a List and Return Values [using ‘filter’]

Python Find in a List and Return Values

This tutorial explains how to find items within a list in Python and return the values, using “filter”. Previously we covered checking whether items exist in a list in Python, but that could only tell us whether they were present, or not (with a boolean return value containing the result). If you are searching a list for a specific value, you already know what the value of the matching items will be so the above method is sufficient. However, what if you are searching by a set of … Read more

Home » Programming

PHP trim() Function [With Examples]

PHP trim Function

You’ll want to process and tidy your user input before you do anything with it when building PHP apps. trim() is one of the tools available to do this – it removes all white space from the beginning and end of a string. Whitespace is things like spaces, tabs, and newlines which may be invisible to the user. PHP trim Syntax trim ( $string [, $character_mask = ” \t\n\r\0\x0B” ] ) Note that: By default, $string will be returned by trim() with all whitespace removed from the beginning and end, including: … Read more

Categories PHP