It is often useful to have a way of ensuring that a program is running at most once (e.g. a system daemon or Cron job). Unfortunately, most commonly used solutions are not without problems. In this post, I show a simple, reliable, Linux-only solution that utilizes Unix domain sockets and the abstract socket namespace. The post includes a sample implementation in the Rust programming language.
Celery is an asynchronous task queue based on distributed message passing. It is written in Python, but the protocol can be implemented in any language. However, there is currently no C++ client that is able to publish (send) and consume (receive) tasks. This is needed when your project is written in a combination of Python and C++, and you would like to process tasks in both of these languages. In the present post, I describe a way of interoperating between Python and C++ workers via the AMQP back-end (RabbitMQ).
C++11 introduced an alternative syntax for writing function declarations. Instead of putting the return type before the name of the function (e.g.
int func()), the new syntax allows us to write it after the parameters (e.g.
auto func() -> int). This leads to a couple of questions: Why was such an alternative syntax added? Is it meant to be a replacement for the original syntax? To help you with these questions, the present blog post tries to summarize the advantages and disadvantages of this newly added syntax.
We will implement the DBSCAN clustering algorithm in Rust. As its input, the algorithm will take a distance matrix rather than a set of points or feature vectors. This will make the implemented algorithm useful in situations when the dataset is not formed by points or when features cannot be easily extracted. The complete source code, including comments and tests, is available on GitHub.
This post introduces my Rust wrapper for ssdeep by Jesse Kornblum, which is a C library and program for computing context triggered piecewise hashes (CTPH). Also called fuzzy hashes, CTPH can match inputs that have homologies. Such inputs have sequences of identical bytes in the same order, although bytes in between these sequences may be different in both content and length. In contrast to standard hashing algorithms, CTPH can be used to identify files that are highly similar but not identical.
When talking about
T&& in C++, you may have heard about universal references and forwarding references. This may get you wonder. Why there are two names for an apparently same concept? Is there any difference between them? Which one should I use? Lets find out.
Have you ever wondered which of the following variants you should use in range-based for loops and when?
const auto&&, or
decltype(auto)? This post tries to present rules of thumb that you can use in day-to-day coding. As you will see, only four of these variants are generally useful.
Upon sending a revised version of a submitted paper to a journal, one is generally required to enclose a statement on the revision based on the referees’ report. In this statement, you basically respond to comments from the referees. A friend of mine asked me whether I could publish the LaTeX template I have been using for writing such statements. Well, here you go :).
If you have been using Git long enough, you have probably heard about
git add -p/--patch, which allows you to selectively stage parts of files. However, did you know that many other Git commands support this argument as well? Among them are
log, and they represent the main topic of the present post.
I have been using Vim as my primary (and only) text editor since 2009. Over the years, I have discovered many useful things about Vim that I wish I knew earlier because they dramatically improved my text-editing efficiency. In this post, I would like to share the most important ones with you.