Problem: When writing HTML templates for the Django Python framework, you want to use Visual Studio Code’s auto formatting features. However, when you activate the auto-format functionality, VSCode complains that there is no formatter available for such HTML files: “There is no formatter for ‘django-html’ files installed.” Solution: First, install the beautify extension. Then, open the settings.json by pressing SHIFT - CMD - P and enter “Open Settings (JSON)”: Next, add the following block to your settings.json: "files.associations": { "**/*.html": ...

In this post, I am showing you how to use the freely available Open Weather Map API to retrieve hourly weather forecasts 48 hours into the future for a given place using Python without external packages. Continue reading if you need an easy and flexible way to obtain weather data in your python application and you want to avoid using third-party dependencies for the task. You will use the free tier of the Open Weather Map API. The resulting weather ...

Measuring code execution times is hard. Learn how to eliminate systematic and random measurement errors and obtain more reliable results. We often need to measure how long a specific part of code takes to execute. Unfortunately, simply measuring the system time before and after a function call is not very robust and susceptible to systematic and random measurement errors. This is especially true for measuring very short intervals (< 100 milliseconds). Systematic and Random Errors So what is wrong with ...

Bernhard Knasmüller on Software Development