news
Programming Leftovers
-
Buttondown LLC ☛ You can cheat a test suite with a big enough polynomial
In an earlier version of my talk, I had a gag about unit tests. First I showed the test f([1,2,3]) == 3, then said that this was satisfied by f(l) = 3, f(l) = l[-1], f(l) = len(l), f(l) = (129*l[0]-34*l[1]-617)*l[2] - 443*l[0] + 1148*l[1] - 182. Then I progressively rule them out one by one with more unit tests, except the last polynomial which stubbornly passes every single test.
If you're given some function of f(x: int, y: int, …): int and a set of unit tests asserting specific inputs give specific outputs, then you can find a polynomial that passes every single unit test.
-
Eric Bailey ☛ Quality is a trap
One of my favorite professors at art school (hi Maya!) liked to remind us that, “Interesting is a neutral word.” It was her way of teaching us to be less avoidant and non-committal, and instead dig deeper into things during design crit sessions.
Like “interesting,” “quality” is a neutral word. It is a proxy phrase, and can almost always be replaced by more concrete, constructive, and actionable things that contribute more towards the conversation.
-
Geoffrey Copin ☛ Build a Compiler from Scratch, Part 0: Introduction
In this series, we'll go through this journey together, one tiny iteration at a time. We'll build a program to compile a minimalistic language inspired by Python into x86 assembly code. Along the way, we'll learn many things, including how to write a lexer, a parser, a type checker, a garbage collector, and of course we'll discover the basics of x86 assembly as we implement our code generator. We'll also cover more advanced topics, such as code optimization, intermediate representations, and rich error messages.
-
Geoffrey Copin ☛ Build a Compiler from Scratch, Part 1.1: A Hello World of sorts
It has become common practice to start with a "Hello World" program when learning a new programming language. This is a simple program that outputs the text "Hello, World!" to the screen. While writing such a program is a trivial task with most programming languages, getting our own language to interface with the OS and write data to the standard output will take a fair amount of work.
So we'll start with something simpler. How much simpler? Well, here is the first Pylite program that our compiler will translate to machine code: [...]
-
Rlang ☛ How to draw a pie chart on a map in R with ggplot2 and scatter pie? An example for Turkey
Pie Chart… The unloved boy of visualization family. However, it is getting popularity especially when it is in conjuction with maps. For example, the following chart was publised by to illustrate the vote distribution across the country.
-
Dirk Eddelbuettel ☛ Dirk Eddelbuettel: RcppRedis 0.2.6 on CRAN: Extensions
A new minor release 0.2.6 of our RcppRedis much more). It works equally well with the newer fork Valkey. RcppRedis
This update brings new functions
del
,lrem
, andlmove
(for the matching Redis / Valkey commands) which may be helpful in using Redis (or Valkey) as a job queue. We also extended thepublish
accessor by supporting text (i.e.string
) mode along withraw
orrds
(the prior default which always serialized R objects) just howlisten
already worked with these three cases. The change makes it possible to publish from R to subscribers not running R as they cannot rely on the R deserealizer. An example is provided by almm, a live market monitor, which we introduced in this blog post. Apart from that the continuous integration script received another mechanical update. -
Rlang ☛ Future got better at finding global variables
The future package celebrates ten years on CRAN as of June 19,
2025. This is the first of a series of blog posts highlighting recent
improvements to the futureverse ecosystem. -
Rlang ☛ Segmented Total Bar Chart in R with “`ggsegmentedtotalbar“`
-
Rlang ☛ R version of ‘Backpropagating quasi-randomized neural networks’
-
Python
-
Pitfalls in PySide6
PySide6 is easy to use and powerful but there’s a few pitfalls to look out for. We’ll investigate a performance issue in a large data model, find out that function calls are expensive, and that some of Qt’s C++ Hey Hi (AI) had to be adapted to work in a Python environment.
-
Terence Eden ☛ Reading NFC Passport Chips in Linux
For boring and totally not nefarious reasons, I want to read all the data contained in my passport's NFC chip using Linux. After a long and annoying search, I settled on roeften's pypassport.
I can now read all the passport information, including biometrics.
-
[Old] Brandon Rozek ☛ Filesystem as a persistent key-value store in Python
This approach does not require using any custom serializers or deserializers. Instead, the user or program only needs to navigate and read/write the filesystem.1
However, having to write filesystem code is tedious. What we want is a dictionary that we can write and read from that handles all of the filesystem procedures for us.
-