Benjamin Geer

What makes a good extension language?

“Scripting languages are designed for gluing”, wrote John Ousterhout, the creator of Tcl, in 1998.1 What Ousterhout had in mind was writing an application in a scripting language and having it delegate certain functions to components written in system programming languages. A similar idea inspired the wrapper generator SWIG, developed for scientific computing.2 Nowadays, Python is widely used in this way, thanks to its vast ecosystem of modules written in system programming languages.

Optimising PostgreSQL queries with an open dataset

Overview # This post is a brief illustration of some database optimisation techniques, using the BRÉF (Base Révisée des Élu·es de France / Revised database of representatives elected in France), which contains data about representatives elected in France from 1948 to 2020. The BRÉF is based on French public data, in which a team of researchers has corrected many errors and inconsistencies. It’s published as a PostgreSQL database that consists of several tables and offers many opportunities for joins and optimisations.

Comparing the performance of SQL queries

I wrote a little Rust program, sqlstopwatch, to compare the performance of different SQL queries. I was inspired by the article Benchmarking SQL published by the jOOQ project, where they write the test code in SQL. I wanted something similar, but with a few additional requirements: A command-line program with a simple TUI showing a progress bar. The program should support PostgreSQL, MySQL, and SQLite. It should read the SQL queries and test parameters from a configuration file specified on the command line. It should print the results as a table in the terminal or save them as a CSV file that I can use to generate a chart. The TUI was easy to make with Ratatui. To interact with the database, I used the async database library sqlx, which provides a bundled SQLite library.

Writing a Bittorrent client in Rust

Overview # As my second exercise for learning Rust (after OrganicLox), I decided to implement a client for Bittorrent, the communication protocol for peer-to-peer file sharing. The Bittorrent clients I’ve used have complex GUIs that seem to be designed for users who download and upload torrents all day, rather than for the occasional user like me, who just wants to get one file. And like many GUI applications, Bittorrent clients tend to accumulate files that take up disk space in obscure directories. I do many things in the terminal, and when I need to download a file, my reflex is to use curl. So I thought, why not make something like curl for Bittorrent? Thinking about curl’s progress meter, it occurred to me that I could do something similar with the TUI library Ratatui, which I’d been wanting to try.

Mona Ja‘bub, Leading Society Towards Change

[English version of the text published in Spanish.1] Mona Salem Said Ja‘bub, قيادة المجتمع نحو التغيير: التجربة التربوية لثورة ظفار (1969-1992) [Leading Society towards Change: The Educational Experience of the Dhofar Revolution (1969-1992)], Beirut: مركز دراسات الوحدة العربية [Centre for Arab Unity Studies], first edition 2010, second edition 2023, 368 pages. This first book by Omani historian Mona Ja‘bub has earned praise in the Arab world for its approach to the social and cultural history of the Dhofar revolution in Oman. Published by a prestigious Arab publishing house specialised in social science, the book was initially withdrawn by the Omani authorities from the Muscat International Book Fair in 2012, but it returned the next day, a sign of the relaxation of censorship. The book focuses on gender issues and on the circulation of ideas. Through an analysis of historical events little known outside the Arab world, it makes an original contribution to the study of the global reception of Maoism and Marxism in the 1960s and 1970s.