Programming Leftovers
-
Ted Unangst ☛ an autoflusher
What if we want a grep that doesn’t stuck but we don’t want to resort to wild hacks like editing the source? What if there was some way to flush stdout automatically?
-
Rlang ☛ Basic Data Structures in R: Vectors, Matrices, and Data Frames
Understanding these data structures is like learning the grammar of a language: once you grasp how they work and interact, you unlock the ability to express yourself clearly and effectively in R. Whether you’re calculating statistics for a dataset, organizing results from a machine learning model, or preparing a table for visualization, mastering R’s data structures ensures your work is both efficient and precise.
In this article, we’ll take a guided tour through R’s core data structures, starting with the simplest — vectors — and gradually moving toward more complex ones like lists and data frames. Along the way, we’ll explore practical questions that arise as your data grows in complexity, such as: [...]
-
Rlang ☛ Use of non-API entry points in data.table
Writing R Extensions (“WRE”) is the definitive guide for R package development. Together with the CRAN policy it forms the “rules as written” that the maintainers of CRAN packages must follow. A recent version of R exports 1202 symbols, including 1049 functions (“entry points”, not counting C preprocessor macros) and 153 variables. Not all of them are intended to be used by packages. Even back in R-3.3.0, the oldest version currently supported by data.table, WRE chapter 6, “The R API” classified R’s entry points into four categories: [...]
-
Jussi Pakkanen ☛ Measuring code size and performance
The traditional wisdom is that exceptions are faster when not taken, slower when taken and lead to more bloated code. On the other hand there are cases where using exceptions makes code a lot smaller. In embedded development, even, where code size is often the limiting factor.
-
Hisham ☛ Frustrating Software
As a user and an author of Frustrating Software, there’s a very particular brand of frustration caused by its awkward workflows.
-
Alessandro Diaferia ☛ Thoughts on the Liability of the Product Surface
Conversely, as the organization aims to provide greater value, it must intentionally manage its product surface to ensure it remains an asset, rather than becoming a liability. This means putting in deliberate efforts to maintain the sustainability of the product organization by valuing the right signals and incentivizing the right behaviors.
-
Adnan Siddiqi ☛ Build Your Web Scraper with Crawlbase in Python: A Beginner’s Guide
In this guide, I’m going to walk you step-by-step through the process of building your first web scraper with Python using Crawlbase. By the end, you’ll have a fully functional scraper ready to grab data, saving you countless hours of manual copy-pasting. Sounds like magic? Let’s make it real!
-
Thomas Günther ☛ Extending Kirby models
Ever since Kirby introduced a default model in version 4, I have been handling things like the OG image and the SEO title in there.
I really like this approach. It just feels right to put stuff like that in the model. With a system like Kirby, there are always at least 10 different ways of doing things. You could put it in a controller, in a page method, in a snippet, in a plugin, … but in my experience, a model is the best fit.
In this article I want to share a quick tip on how to extend the default model. It’s a simple thing, but it took me a while to figure it out so I thought it might be helpful to others.
-
Cybertec PostgreSQL International GmbH ☛ Open source and its power demonstrated in PostgreSQL
During a training session on tuning autovacuum, a participant asked me, “Why is autovacuum_vacuum_scale_factor set to 0.2?” Rather than replying with a guess or a wisecrack (“Because that's the way somebody implemented it!” or “If you don't like it, submit a patch!”), I decided to use the opportunity to demonstrate the true power of open source. That was such a nice experience that I decided to share it with a wider audience.
-
Qt ☛ Let's welcome our 2024 Qt Champions!
The wait is finally over! We're thrilled to announce and celebrate our outstanding community members who truly deserve the spotlight.
-
Jim Nielsen ☛ Using Locally-Installed CLI Tools In Node Projects
You have a dependency that provides a CLI tool, how do you use it?
Even though you did
npm i
from your project root, if you run<tool> <command>
it won’t work because that tool is not in your global path.You could install
<tool>
globally, but then if you have<tool>
in multiple projects and you run<tool> <command>
in another project it might not be the same version of the tool.For example, you might have
tool@0.1.0
in one project andtool@0.2.0
in another, and they might have different CLI commands. So you want to run/test whatever version oftool
is installed in your local project (e.g. the one inpackage.json
), you need something other than the globally installed version.Over time, there are three ways I’ve learned to deal with this problem. I’m listing them here for myself.
-
Perl / Raku
-
Perl ☛ Introducing DateTime::Format::RelativeTime
I hope you will enjoy this module, and that it will be useful to you. I have spent quite a bit of time putting it together, and it has been rigorously tested. If you see any bugs, or opportunities for improvement, kindly submit an issue on Gitlab
-
Perl Hacks ☛ Adding structured data with Perl
One of the most powerful ways to achieve this is to add structured data to your site. That means adding extra mark-up to your web pages which explains what the page is about. On the Schema.org website, you can find dozens of “things” the you can describe in structured data – for example, here is the definition of the Person entity. Each entity has a number of (largely optional) properties which can be included in structured data about an object of that type. Each property can be a string or another structured data entity. Additionally, entities are arranged in a hierarchy, so one entity can be based on another, more generic, entity. A Person, for example, inherits all of the properties of a Thing (which is the most generic type of entity). This is a lot like inheritance in Object-Oriented Programming.
-
-
Python
-
Python Speed ☛ Catching memory leaks with your test suite
Resource leaks are an unpleasant type of bug. Little by little your program uses more memory, or more file descriptors, or some other limited resource. Everything seems fine—until you run, and now your program is dead.
In many cases you can catch these sort of bugs in advance, by tweaking your test suite. Or, after you’ve discovered such a bug, you can use your test suite to identify what is causing it. In this article we’ll cover: [...]
-
-
Golang
-
Anton Zhiyanov ☛ Go 1.24 interactive tour
Go 1.24 is scheduled for release in February, so it's a good time to explore what's new. The official release notes are pretty dry, so I prepared an interactive version with lots of examples showing what has changed and what the new behavior is.
-