week 10, 2020

How I Start: Nix

Nix is a tool that helps people create reproducible builds. This means that given the a known input, you can get the same output on other machines.Let’s build and deploy a small Rust service with Nix. This will not require the Rust compiler to be installed with rustup or similar.

Source: How I Start: Nix, an article by Christine Dodrill.

Rules of Makefiles

A somewhat tongue-in-cheek title, but this page lists a few very important rules you should always keep in mind when creating makefiles. Following these rules will allow your makefiles to be both pithy and beautiful. And they will make maintaining and modifying them, and thus your entire life, a much more pleasant experience.

Source: Rules of Makefiles, an article by Paul D. Smith.

Zip Files: History, Explanation and Implementation

I have been curious about data compression and the Zip file format in particular for a long time. At some point I decided to address that by learning how it works and writing my own Zip program. The implementation turned into an exciting programming exercise; there is great pleasure to be had from creating a well oiled machine that takes data apart, jumbles its bits into a more efficient representation, and puts it all back together again. Hopefully it is interesting to read about too.

This article explains how the Zip file format and its compression scheme work in great detail: LZ77 compression, Huffman coding, Deflate and all. It tells some of the history, and provides a reasonably efficient example implementation written from scratch in C.

Source: Zip Files: History, Explanation and Implementation, an article by Hans Wennborg.

Why you should not use (f)lex, yacc and bison

Lex and Yacc were the first popular and efficient lexers and parsers generators, flex and Bison were the first widespread open-source versions compatible with the original software. Each of these software has more than 30 years of history, which is an achievement in itself. For some people these are still the first software they think about when talking about parsing. So, why you should avoid them? Well, we found a few reasons based in our experience developing parsers for our clients.

Source: Why you should not use (f)lex, yacc and bison, an article by Federico Tomassetti.

Time Disorder: don't order events by timestamp

When presented with a series of events, many developers will first be tempted to sort them by time. This is dangerous because timestamps do not provide the strict ordering they've assumed.

Out of order events can lead to infrequent but significant bugs: consider "add to basket then checkout" vs "checkout then add to basket".

Instead of timestamps, developers should prefer simple counters and proper conflict detection. Timestamps may still be useful, but should be approached with caution due to the complexities outlined below.

Source: Time Disorder: don't order events by timestamp, an article by Caolan McMahon.

How to use Restricted Shell

You have users logging in to your Linux system. Those users might have not have sudo rights, but they quite possibly could have free rein to poke around most of the system directory tree. You don't want that. Why? Although those users might not be able to edit the vast majority of your configuration files, you certainly don't want those users viewing them. Same holds true for your client data--you want that locked down.

Source: How to use Restricted Shell to limit user access to a Linux system, an article by Jack Wallen.

Know Your Database Types

There can be a number of reasons why your application performs poorly, but perhaps none are as challenging as issues stemming from your database. If your database's response times tend to be high, it can cause a strain on your network and your users’ patience. The usual culprit for a slow database is an inefficient query being executed somewhere in your application logic.

Source: Know Your Database Types, an article by Ben Fritsch.

Scaling Python Asyncio with Ray

Scale your existing asyncio application to thousands of cores with 20 lines of code. Ray added two features to enable seamless integration with Python asyncio ecosystem. Both features help to scale your existing asyncio application to multi-core and multi-node.

Source: Scaling Python Asyncio with Ray, an article by Simon Mo.

Calling C or C++ From Python

Are you a Python developer with a C or C++ library you’d like to use from Python? If so, then Python bindings allow you to call functions and pass data from Python to C or C++, letting you take advantage of the strengths of both languages. Throughout this tutorial, you’ll see an overview of some of the tools you can use to create Python bindings.

Source: Python Bindings: Calling C or C++ From Python, an article by Jim Anderson.