Context managers are the preferred way to write readable and robust Python code that doesn’t leak resources. contextlib makes writing and using context managers a breeze. Check out some examples for productive use.
Revisiting an earlier example, this post shows how to implement a simple non-blocking echo server using the low level Linux APIs. It also introduces how to use techniques like object oriented design and coroutines in the C language.
Popular comparison sorting algorithms need an order of O(n log n) comparisons to sort an array of size n. But can we do better if we try hard enough? Mathematics says that, in general, we cannot, and here’s the proof.
The title says it all. A guide to building C++ applications with CMake and containerizing them.
Harvoin on saanut valtamediassa seurata raflaavampaa uutisointia ehdollisista todennäköisyyksistä kuin koronakriisin aikana. ”Millä todennäköisyydellä koronavirukselle immuunin henkilön vasta-ainetestin tulos on positiivinen?” on eri kysymys kuin ”Millä todennäköisyydellä positiivisen tuloksen vasta-ainetestissä saanut henkilö on immuuni koronavirukselle?”. Ero on merkittävä ja seuraukset väärinymmärryksestä voivat ovat vakavia.
Signal handling is notoriously hard to do correctly. Handling asynchronous events is a subtle business, and the POSIX signal API is complex. In this post, I’ll implement a simple server application that handles signals as correctly as possible. With Linux flavor.
A general wisdom is that overloading logical operators in C++ should be done with extreme caution, if at all. This blog post introduces boost::tribool: A rare example where logical operator overloading makes sense. Which is exactly why one must be cautious when using it.
A story about my grandfather, balloons and the applicability of physics education outside of basic research.
The C++20 standard is finished and brings lots of long awaited features to a C++ programmer's toolbox. In this post I introduce some of my favorite features, including concepts, ranges, coroutines and the new additions to compile time computation.
Writing unit tests for your code. Tedious waste of time or an awesome productivity tool? Depending on how unit testing is implemented in a project, it can be either. In this post I'm sharing three practices I've used to make unit testing more valuable.