development

Data Shortcode for Hugo

In the article, I show the differences in the website analytic metrics collected on the server- and client-side. It contains several dynamic values (e.g., pageviews or visits number, the date range, etc.) scattered throughout the text. To update them, I need to pass through the content and adjust them manually. So as I plan to bring the data in this post up to date regularly (I get new input every day), this task cumulatively could consume a lot of my time. Therefore, I have decided that the data in the post should be updated automatically. In this article, I describe how I have achieved this goal.

Pedantic Clippy

One of the reasons developers love Rust is its well-developed ecosystem. Clippy, a linter for the Rust code, is one of the main components in this ecosystem. It performs additional checks of the developed code reporting found issues and explaining how to fix them (and sometimes it even can fix them automatically). Its usage may be beneficial for Rust beginners and even professionals. In this article, I describe this tool and explain how to start using it.

Comparing Netlify and Cloudflare Pages

The core idea of the JAMstack architecture (JavaScript, API and Markup) is to substitute dynamic webpages with pre-rendered from a template static pages that use different services exposed through Javascript API to offer dynamic features. During the last several years, the JAMstack architecture has been becoming more and more popular especially due to the proliferation of serverless paradigm. This architecture also gains its interest among bloggers who appreciate full control over their websites. Seeing the rapid development of JAMstack, several companies have started offering services for this architecture: automated builds, build previews, CDN, caching, SSL certificate provisions, hosting. Using these platforms, it is now quite easy for developer-bloggers to launch a website. To my point of view, these platforms may take a piece of a pie from traditional blogging platforms.

For the last three years, I used Netlify to host my website. I was pretty happy with the services this company provides, especially considering that they were free of charge for me. However, recently Cloudflare has also launched its JAMstack platform called Cloudflare Pages, and I decided to try it myself in order to discover its pros and cons. In this article, I compare the services provided by these companies from a blogger perspective, and share my opinion when each of them should be used.

Testing Errors in Rust

Currently besides all other activities, I am developing a habit of programming following Test Driven Development (TDD) methodology. This is a perfect time because I continue to explore Rust, a new programming language to me. Moreover, this language encourages you to cultivate this best practice by providing great documentation and well-thought ecosystem.

In our programs, we often face with exceptional situations (e.g., lack of space when you try to write a file, or absence of a resource), and we need to handle them. If you follow the TDD approach, you need to ensure that these exceptional situations are also properly covered in your tests. Id est, you have to develop tests that reproduce these exceptional situations and make sure that your code detect and handle them correctly. In this post, I want to discuss how to test exceptional situations in Rust.

Closures in Rust

Today, I want to note down my thoughts on closures. Closures are important in Rust, because they are extensively used in iterator adapters paramount in development highly performant programs. However, to my point of view this topic is not well-covered in The Book. This may be a reason why it is considered among the most difficult parts of the language. In this post, I will try to shed more light on it, hopefully making it more clear to Rust learners. Note that I am still a novice to the language, and my understanding may not be fully correct.

Minimal Rust Binary Project

When you develop your first binary application using new language, the first issue that you face is how to organize your code so that you can easily extend it in the future. There is a good example in The Book on how to organize your code, parse and process command line arguments by yourself. However, in real world you would use a library to parse command line arguments, which most probably would be the clap library in case of Rust. In this article, I describe my template for creating a CLI (command line interface) application.

Writing about Rust
I plan to devote some time writing about my experience with Rust.
How to Include Diff into Git Commit Message

De facto, git is a standard version control system now. Not surprisingly that I use it for my projects. Working on a project, I often face with a situation when I have made a number of changes, and I need to describe them in a commit message. Of course, I try following the line when every change results in a new commit, however, on practice, sometime I face with the situation when I need to describe a number of changes in one commit message. If there are a number of changes (or peculiarities), mentioning all of them could be a challenge. Of course, you can open an additional terminal and do diffing, however, it would be great if this information is included in the commit message.

Outdated Pytest Version in Poetry

Problem

Recently, I have updated my operating system, and as a part of this process I have installed the latest poetry version (a tool for Python dependency management). When I have started a new project using my typical routine, I have discovered that poetry cannot install development dependencies exiting with a weird SolverProblemError error.

Starting New Python Project in VSCode

In the previous article, I have described how poetry can be used to configure Python workspace and to create a new Python package project. Although poetry creates the structure of a package and adds some boilerplate code, in order to develop this package in VSCode we need to do some additional configurations. In this post, I describe how to start developing a new Python package project in VSCode.