Category: Programming

2019-09-09T12:07:38Z

Setting Up a Flask Application in Visual Studio Code

As a follow up to my Setting Up a Flask Application in PyCharm article, today I'm going to show you how to set up your project with Visual Studio Code (Code, for short), which is a free and open source integrated development environment from Microsoft with great support for Python. Like I did in the previous article, you can see me going through all the required steps to set up an example project in the video below. After the video, I provide a short written summary of the process.

2 comments

2019-08-24T18:15:27Z

MicroPython and the Internet of Things, Part V: Temperature and Humidity

In this chapter I'm going to show you how to work with a temperature and humidity sensor.

If you want to see me and hear me explain everything in this tutorial, I encourage you to purchase the video version from my Courses site. Not only it will make for a better learning experience, but you'll also be supporting my effort in keeping my blog updated with relevant content. Thank you!

2019-07-25T06:54:16Z

MicroPython and the Internet of Things, Part IV: Wi-Fi and the Cloud

In this chapter I'm going to show you how to use the Wi-Fi capabilities of the ESP8266 chip.

If you want to see me and hear me explain everything in this tutorial, I encourage you to purchase the video version from my Courses site. Not only it will make for a better learning experience, but you'll also be supporting my effort in keeping my blog updated with relevant content. Thank you!

7 comments

2019-06-25T08:04:12Z

MicroPython and the Internet of Things, Part III: Building a MicroPython Application

In this chapter you are going to learn how to write standalone MicroPython applications and upload them to your microcontroller board.

If you want to see me and hear me explain everything in this tutorial, I encourage you to purchase the video version from my Courses site. Not only it will make for a better learning experience, but you'll also be supporting my effort in keeping my blog updated with relevant content. Thank you!

6 comments

2019-06-04T15:49:57Z

The Ultimate Guide to Python Decorators, Part I: Function Registration

One of the signatures of the Flask framework is its clever use of decorators for common application tasks such as defining routes and error handlers. Decorators give a very concise and readable structure to your code, so much that most Flask extensions and many other Python packages follow the same pattern and expose core parts of their functionality through decorators.

Today I'm starting a series of in-depth posts about different ways in which you can incorporate custom decorators into your Python applications. In this first part I'm going to show you how to create simple decorators that register functions as callbacks for application-specific events.

8 comments

2019-05-24T18:41:21Z

MicroPython and the Internet of Things, Part II: Hello, MicroPython!

In this chapter you are going to learn how to install and use MicroPython on your ESP8266 microcontroller board.

If you want to see me and hear me explain everything in this tutorial, I encourage you to purchase the video version from my Courses site. Not only it will make for a better learning experience, but you'll also be supporting my effort in keeping my blog updated with relevant content. Thank you!

6 comments

2019-04-24T18:15:37Z

MicroPython and the Internet of Things, Part I: Welcome

Welcome to my MicroPython and the Internet of Things tutorial!

In this first part I want to give you a brief overview of what this tutorial is about, and more importantly, provide you the list of components that you are going to need.

2 comments

2019-04-19T19:43:01Z

Introducing My MicroPython Tutorial

I'm happy to announce a new multi-part tutorial that I will soon begin publishing on this blog and several other platforms. The tutorial is titled MicroPython and the Internet of Things and is a beginner tutorial that will introduce you to the exciting world of microcontrollers and small-form Internet enabled devices.

2 comments

2019-02-16T19:29:15Z

Unit Testing Applications that use Flask-Login and Flask-SocketIO

One of the useful features of my Flask-SocketIO extension is the test client, which allows you to write Socket.IO unit tests. A long time limitation of the test client was that it did not see cookies set by Flask, such as the user session. This complicated writing Socket.IO tests for applications that require authentication, because most authentication mechanisms write something to the user session or a custom cookie. The use case that caused pain to a lot of developers was applications that use Flask-Login combined with Flask-SocketIO. To unit test such an application you had to resort to weird tricks such as mocking the current_user variable.

I recently came up with a solution to this problem, so I'm glad to report that this limitation is now a thing of the past. In this short article I want to show you how to set up your project to take advantage of the new cookie support in the Socket.IO test client.

9 comments

2019-02-05T18:39:12Z

How To Make Python Wait

For many types of applications, at times it is necessary to pause the running of the program until some external condition occurs. You may need to wait until another thread finishes, or maybe until a new file appears in a directory on disk that is being watched.

In these and many other situations you will need to figure out a way to make your script wait, and this isn't as easy as it sounds if you want to do it properly! In this article I'm going to show you a few different ways to wait. I'm going to use Python for all the examples, but the concepts I'm going to present apply to all programming languages.

8 comments