Docker Multiple Containers

Docker Multiple Containers

Once you learn how to get a container up and running in Docker, you can then move on to running and managing multiple containers in the same docker engine for your environment. Much like anything else, practicing setting up containers, interacting with them, and tearing them down once done will get you comfortable with the process and workflow for managing containers. In this tutorial, we’ll practice by setting up 3 individual containers.…

How To Run MongoDB In A Docker Container

How To Run MongoDB In A Docker Container

MongoDB is a document-based NoSQL database that is good for high volume data storage. Rather than using tables and rows like traditional relational databases, MongoDB makes use of Collections and Documents. The documents consist of key-value pairs which are the basic unit of data in MongoDB. In this tutorial, we’ll use Docker to launch a container running MongoDB. Once it is up and running in a container, we can connect to it in a shell and test out some of the common Mongo commands.…

How To Run Nginx Using Docker

How To Run Nginx Using Docker

NGINX is a popular open-source software used for web serving, reverse proxying, caching, load balancing, media streaming, and more. It can also function as a proxy server for email (IMAP, POP3, and SMTP) and a reverse proxy and load balancer for HTTP, TCP, and UDP servers. Nginx is quite popular and used on many high traffic websites today. In this tutorial, we’ll learn how to run Nginx in a container using Docker.…

Python Data Class

Python Data Class

Part of what classes are used for in Python is to represent data. It is by using the __init__ function that we can accept data into an object as it is created, and assign those data values to the object using the self keyword. You might notice that sometimes this code setup has a lot of boilerplate to it. In other words, you have to write the same structure of code to simply store simple values on an object.…

What Are Python Magic Methods

What Are Python Magic Methods

Magic Methods in Python are a collection of methods that are automatically associated with every class definition in the language. If you create your own classes, you can override one or more standard magic methods to customize their behavior. There are many magic methods in Python, and we include a table of them at the end of this tutorial. For now, we want to take a look at some of the more commonly used magic methods which can be useful in day to day programming.…

Composition Over Inheritance

Composition Over Inheritance

Inheritance in Python is nice since it facilitates a great deal of code reuse. We put common data and behavior into a Base class and then implement any extra data and behavior needed in derived classes. Therefore when using inheritance, you are making use of an “is a” relationship. For example, a Car is a Vehicle. Another approach to code reuse when using the object-oriented style of programming in Python is Composition.…

Python Interface Design Pattern

Python Interface Design Pattern

By using a combination of multiple inheritance and abstract classes, you can use a design pattern in Python called an Interface. Interfaces are a common technique in object-oriented programming and programming languages like C# and Java implement this feature natively. Interfaces aren’t actually part of the Python language itself, but you can still use this type of design pattern with Python. In interface is a promise, or contract, that forces a given class to implement a given behavior.…

Multiple Inheritance In Python

Multiple Inheritance In Python

Python has the ability to make use of multiple inheritance, which allows a subclass to inherit functionality from multiple parent classes. Often times, multiple inheritances can be quite tricky, and some programming languages like Java strictly prohibit it. There are times when multiple inheritances can have its uses. It can be used to create objects that have two distinct sets of behaviors. Python makes use of something called the Method Resolution Order, or MRO, to determine how to inherit from more than one Superclass.…