Category: Programming

  • __builtin_popcountg

    Looking at https://en.cppreference.com/cpp/utility/bitset/count, I was intrigued to see popcount mentioned in the “See also” section. Handy. That made me curious to see how the stdlibs choose to implement it. Here it is for Clang: libcxx/include/__bit/popcount.h For gcc: libstdc++-v3/include/std/bit So, there’s at least one configuration where they end up both calling something called __builtin_popcountg. What are…

  • Progressive rescaling does make a difference

    My dad learned calculus from this book: Practical mathematics, theory and practice with applications to industrial business and military problems. I wanted to include a photo of the title page from his copy of it in a little biography we’re working on for him, but I ended up with jaggies when using my scaleimage tool.…

  • Where is zip?

    Download a copy of CPython’s source: Where is zip implemented? Looks promising! This looks like a good start point — defining it along with the other builtins inside _PyBuiltin_Init in Python/bltinmodule.c: where _PyBuiltin_Init gets called in Python/pylifecycle.c here: where pycore_init_builtins called in Python/pylifecycle.c here: where pycore_interp_init gets called in Python/pylifecycle.c here: where new_interpreter gets called…

  • Getting text from some seed packet labels

    I’ve been enjoying following along with Simon Willison as he plays with LLMs via his llm tool but haven’t tried it out yet. Now I have a small task in mind — I recently planted some seeds, taking a photo of each seed packet while I was at it. I’d like to extract the plant…

  • Extracting Google Scholar metadata

    I wanted to find the number of citations per year for a paper from my dad, at least per Google Scholar. Hacking around, here’s a little JavaScript to get it per results page: How would you do this? Is there a nicer way to do it? There were 12 results pages. I was paranoid about…

  • My second WP plugin

    I’m starting to read “WordPress Plugin Development Cookbook – Third Edition”. The first example does nothing other than make a do nothing plugin visible in the admin page, but the second example already allowed for some fun. I’m happy with how psychedelic this turned out: I won’t add it here though. References mentioned:

  • “C++ Brain Teasers”

    A fun book I finished Sunday: “C++ Brain Teasers” by Anders Schau Knatten. The book site includes a few sample chapters. The acknowledgments point to https://cppquiz.org/. I enjoyed it a lot. Having lessons in bite-sized chunks in a challenge-answer format is a nice way to learn. I also appreciated the expert (but not overly long)…

  • “How to stick with your projects, even when they’re janky”

    There’s a lot to reflect on from this 2025 talk from Jeaye Wilkerson, creator of jank, a Clojure dialect targeting C++ interop: “How to stick with your projects, even when they’re janky”: I’ve not really done his talk full justice, but in the spirit of focusing on shipping, I’m publishing this as is. 🙂

  • Parsing “Pollinator Post”

    May Chen runs a treasure of an e-mail newsletter, the “Pollinator Post”, where she shares macro shots of insects and plants, mostly local natives, from her hikes around the East Bay, along with commentary drawing on her decades of experience as a docent. Until recently, these posts were available only via an invite-only e-mail group,…

  • KmpMatcher + links

    In an earlier post, I talked about extracting attachments from .eml files, which I was doing in pursuit of a half memory of having implemented the Knuth-Morris-Pratt algorithm. That turned out to be a dead end so I ended up consulting a lot of other sources and glomming together something new from those. You can…