{"@attributes":{"version":"2.0"},"channel":{"title":"Daniel Moerner","link":"https:\/\/moerner.com\/","description":"Recent content on Daniel Moerner","generator":"Hugo","language":"en-us","lastBuildDate":"Fri, 12 Jun 2026 20:46:34 -0400","item":[{"title":"On Pomegranate Molasses","link":"https:\/\/moerner.com\/posts\/on-pomegranate-molasses\/","pubDate":"Fri, 12 Jun 2026 20:46:34 -0400","guid":"https:\/\/moerner.com\/posts\/on-pomegranate-molasses\/","description":"<p>I love pomegranate molasses. The tangy, sour sweetness of a good pomegranate\nmolasses is unmatched by any other syrup. However, it can be difficult to find\na satisfying brand; I&rsquo;ve tried at least ten.<\/p>\n<p>Only two meet my expectations. I prioritize sourness in pomegranate molasses.\nToo many brands, especially cheap ones (avoid anything in a plastic bottle),\ntaste too much like molasses and have little to no pomegranate flavor. Only if\nyou overuse them does the pomegranate come out, and then the sweetness ruins\nyour dish.<\/p>"},{"title":"Goodbye OpenAI","link":"https:\/\/moerner.com\/posts\/goodbye-openai\/","pubDate":"Sat, 28 Feb 2026 08:11:51 -0500","guid":"https:\/\/moerner.com\/posts\/goodbye-openai\/","description":"<p>I have canceled my personal subscriptions to ChatGPT and committed to not using\nCodex or ChatGPT at work going forward. I cannot continue to support a company\nthat shows such disregard for my values and the values of its employees.<\/p>\n<p>Last night, Sam Altman, the CEO of OpenAI, <a href=\"https:\/\/archive.ph\/nipGb\">announced<\/a> that OpenAI would be\nentering into an agreement with the Department of Defense to use their models:<\/p>\n<blockquote>\n<p>Tonight, we reached an agreement with the Department of War [sic] to deploy our models in their classified network.<\/p>"},{"title":"The Pragmatic Programmer in 2025","link":"https:\/\/moerner.com\/posts\/pragmatic-programmer\/","pubDate":"Tue, 15 Jul 2025 20:12:23 -0400","guid":"https:\/\/moerner.com\/posts\/pragmatic-programmer\/","description":"<p>Over the past few weeks, I read through the 20th Anniversary Edition of <em>The\nPragmatic Programmer<\/em>, by David Thomas and Andrew Hunt (2019). I&rsquo;ve often seen this\nbook praised as a practical resource for software development. In this\nlow-effort blog post, I&rsquo;m just going to reproduce a few of my notes on what I\nfound interesting or puzzling here. The book is divided into 53 Topics, which I\nuse to organize my notes.<\/p>"},{"title":"On Interviewing in Tech and Academia","link":"https:\/\/moerner.com\/posts\/interviewing\/","pubDate":"Sat, 24 May 2025 09:54:18 -0400","guid":"https:\/\/moerner.com\/posts\/interviewing\/","description":"<p>I&rsquo;ve recently switched careers from academia to software engineering. Some reflections on the interview and job market in these two different fields.<\/p>\n<h1 id=\"adversarial-and-non-adversarial\">Adversarial and Non-adversarial<\/h1>\n<p>In my experience, every step in the interview process in academia is\nadversarial. This both characterizes my own experience as an interviewee, and the interviews I gave as a\nfaculty member of at the University of Chicago. The first step in each meeting\nis to get the interviewee to commit to something; the second step is to object\nto it. This patterns holds from group interviews, to job talks, to one-on-one\nmeetings, and even to casual meals. Many one-on-one meetings begin with an\nupfront claim that it will not be a discussion of work; they almost inevitably\nevolve into a series of debates.<\/p>"},{"title":"How to Make a One-Click File Upload Button in Svelte","link":"https:\/\/moerner.com\/posts\/svelte-file-upload-button\/","pubDate":"Thu, 06 Mar 2025 17:50:17 -0500","guid":"https:\/\/moerner.com\/posts\/svelte-file-upload-button\/","description":"<p>I&rsquo;ve recently started using Svelte for some personal projects, like <a href=\"https:\/\/github.com\/dmoerner\/svelteclick\">SvelteClick<\/a> and <a href=\"https:\/\/github.com\/dmoerner\/pytorrent\">PyTorrent<\/a>, which is a collaborative project developed with Lamone Armstrong. While writing the front-end for PyTorrent, I wanted to make a one-click file upload and submit button. Why? Because this is ugly:<\/p>\n<p><img src=\".\/ugly-button.png\" alt=\"Separate buttons for Browse and Upload\"><\/p>\n<p>And this is nice:<\/p>\n<p><img src=\".\/nice-button.png\" alt=\"Single button to open dialogue window and upload\"><\/p>\n<p>Sure, you can style the former, but the problem is that the workflow is clunky:\nThere&rsquo;s no reason to make the user click twice just to upload a file. This blog\npost outlines how I failed and then how I got it working. Thanks to Teon Brooks\nfor pairing on this with me!<\/p>"},{"title":"When do you need nonlocal or global in Python?","link":"https:\/\/moerner.com\/posts\/python-nonlocal-global\/","pubDate":"Wed, 19 Feb 2025 09:23:52 -0500","guid":"https:\/\/moerner.com\/posts\/python-nonlocal-global\/","description":"<p>I recently realized I had a slightly hazy understanding of name scope in\nPython. I knew I needed to use <code>global<\/code> or <code>nonlocal<\/code> in some instances, but I wasn&rsquo;t\nexactly clear when and where they were needed. In practice this means\nscattering them everywhere they might be used.<\/p>\n<p>I think I figured it out, and\nit&rsquo;s really quite simple, but I didn&rsquo;t find as clear a statement as I would\nhave liked in the documentation. This post draws on the <a href=\"https:\/\/docs.python.org\/3\/reference\/simple_stmts.html\">official Python 3\ndocumentation<\/a>\nand <a href=\"https:\/\/peps.python.org\/pep-3104\/\">PEP 3104 - Access to Names in Outer\nScopes<\/a>, as well as my own testing.<\/p>"},{"title":"etracker Public Demo","link":"https:\/\/moerner.com\/posts\/etracker-public-demo\/","pubDate":"Mon, 17 Feb 2025 18:25:06 -0500","guid":"https:\/\/moerner.com\/posts\/etracker-public-demo\/","description":"<p>Over the past two months I have been sharing work here and on\n<a href=\"https:\/\/github.com\/dmoerner\/etracker\">Github<\/a> on a new BitTorrent tracker\n<code>etracker<\/code>. I&rsquo;m happy to share that a public demo is now available:\n<a href=\"https:\/\/etracker.moerner.com\/\">https:\/\/etracker.moerner.com\/<\/a>. The public demo is deployed with a small\ninfohash allowlist consisting of recent Linux ISOs. An expanded frontend with\nsupport for suggesting allowed infohashes is under development.<\/p>\n<p>To briefly summarize: <code>etracker<\/code> is a tracker designed to contribute to solving\nfree-riding problems in the BitTorrent protocol at the tracker level. Clients\nwhich behave poorly (failing to seed snatches; failing to upload more than they\ndownload) receive proportionately less peers from the tracker than clients\nwhich are well-behaved. New BitTorrent clients to the tracker receive a full\ncomplement of peers, so there is no startup penalty when initially joining the\ntracker.<\/p>"},{"title":"fatal: bad object HEAD","link":"https:\/\/moerner.com\/posts\/fatal-bad-object-head\/","pubDate":"Sat, 08 Feb 2025 13:19:48 -0500","guid":"https:\/\/moerner.com\/posts\/fatal-bad-object-head\/","description":"<p>Thanks to all my friends and colleagues for such a wonderful in-person week at\nthe <a href=\"https:\/\/www.recurse.com\/\">Recurse Center<\/a> hub in Brooklyn. I got so much\nout of the pairing, the social environment, and especially the opportunity to\npresent my work in-person at Presentations+. Part of me wishes I had spent a\nweek in-person earlier, but part of me also believes it was so great precisely\nbecause it was so late in the batch and my work was in a good place for\ncollaboration.<\/p>"},{"title":"Learning React and Rethinking JavaScript's Warts","link":"https:\/\/moerner.com\/posts\/rethinking-js-react\/","pubDate":"Wed, 29 Jan 2025 10:44:51 -0500","guid":"https:\/\/moerner.com\/posts\/rethinking-js-react\/","description":"<p>There are many ways to do the same thing in every popular programming language,\nbut not all of them are made equal. (I presume this is a corollary of Turing\ncompleteness.) This is why it is so\nimportant when learning a new language to get a grip on common patterns and\n<a href=\"https:\/\/en.wikipedia.org\/wiki\/Anti-pattern\">anti-patterns<\/a>. Otherwise we risk\nmaking the wrong choices (like assuming that tail recursion is always the optimal\nrecursive algorithm even though with small inputs the time costs of reversing the result may be larger than\nthe benefits in space complexity), or being paralyzed by the thought of too\nmany choices (like I felt when I learned the Node <code>fs<\/code> module provides <a href=\"https:\/\/nodejs.org\/en\/learn\/manipulating-files\/reading-files-with-nodejs\">three\ninterfaces<\/a>\nthat all do the same thing).<\/p>"},{"title":"Bad Counterpoint, and MIDI and HTML5 in 2025","link":"https:\/\/moerner.com\/posts\/midi-html-2025\/","pubDate":"Tue, 21 Jan 2025 20:48:04 -0500","guid":"https:\/\/moerner.com\/posts\/midi-html-2025\/","description":"<p>Today I spent some toy throwing together a toy music generator in Python, <a href=\"https:\/\/github.com\/dmoerner\/badbach\">Bad\nBach<\/a>. Counterpoint is a musical style\nwith roots in the Renaissance which follows a strict set out of rules. I set out to deliberately write bad\ncounterpoint, or what I later learned is called <a href=\"https:\/\/en.wikipedia.org\/wiki\/Counterpoint#Dissonant_counterpoint\">dissonant\ncounterpoint<\/a>, which breaks as many of those rules as possible. I initially approached this as a puzzle solver problem, with the goal of maximizing under a set of constraints. However, I realized this music would be too deterministic for my taste. So instead I constructed a set of weights for (breaking) each rule, and then randomly generate rule-breaking harmonies based on those weights.<\/p>"},{"title":"Is Communication within the Youtube Apparatus Meaningless?","link":"https:\/\/moerner.com\/posts\/is-youtube-meaningless\/","pubDate":"Tue, 14 Jan 2025 18:57:51 -0500","guid":"https:\/\/moerner.com\/posts\/is-youtube-meaningless\/","description":"<p>Over the past day there has been discussion of a provocative essay by Kevin\nMunger, <a href=\"https:\/\/kevinmunger.substack.com\/p\/in-the-belly-of-the-mrbeast\">in the belly of the MrBeast<\/a>, which builds on his recent book <a href=\"https:\/\/www.cambridge.org\/core\/elements\/youtube-apparatus\/36600D69788530F805C650B70976A585\">The YouTube Apparatus<\/a>. I want to applaud the author for publishing this under CC-BY-NC 4.0, since otherwise I wouldn&rsquo;t be able to read it.<\/p>\n<p>Central to both essay\nand book is the thesis that there is something meaningless about YouTube. As\nthe book puts it, &ldquo;This is what I mean by <em>nihilism<\/em>: Communication within the YouTube Apparatus <em>has no meaning<\/em>.&rdquo; As summarized in the essay:<\/p>"},{"title":"A Curious Moon in Podman or Docker","link":"https:\/\/moerner.com\/posts\/docker-postgres-makefile\/","pubDate":"Sun, 12 Jan 2025 10:34:11 -0500","guid":"https:\/\/moerner.com\/posts\/docker-postgres-makefile\/","description":"<p>I recently started working through <a href=\"https:\/\/sales.bigmachine.io\/curious-moon\">A Curious Moon<\/a>, a wonderfully clever data science &ldquo;mystery&rdquo; in PostgreSQL. The setup in the book uses Postgres on bare metal, but I wanted to use Postgres in <a href=\"https:\/\/docs.podman.io\/en\/latest\/\">Podman<\/a>, which is like Docker. One interesting suggestion in the book is to use a Makefile to organize ETL. But this needed a little massaging work with Podman on Fedora, which I want to share here.<\/p>\n<p>Here is my Compose file:<\/p>"},{"title":"Brainstorming BitTorrent Peer Distribution Algorithms","link":"https:\/\/moerner.com\/posts\/brainstorming-peer-distribution-algorithms\/","pubDate":"Thu, 12 Dec 2024 12:55:53 -0500","guid":"https:\/\/moerner.com\/posts\/brainstorming-peer-distribution-algorithms\/","description":"<p>Recently, I&rsquo;ve been working on <a href=\"https:\/\/github.com\/dmoerner\/etracker\">etracker<\/a>, an experimental BitTorrent tracker designed to incentivize healthy client behavior. If you already know about the Bittorrent protocol or about my project, feel free to skip ahead to the actual <a href=\"#brainstorming\">brainstorming<\/a>.<\/p>\n<h1 id=\"project-background\">Project Background<\/h1>\n<p>BitTorrent is a P2P file transfer protocol, which can use centralized trackers to distribute peer lists to clients, who in turn connect to each other. A collection of clients announcing a particular content infohash is a swarm, which consists of some clients &ldquo;seeding&rdquo; content they already have, and other &ldquo;leeching&rdquo; content they do not yet have. A tracker must keep track of many clients, each in one or more swarms.<\/p>"},{"title":"Where can you use a PostgreSQL parameter placeholder?","link":"https:\/\/moerner.com\/posts\/postgresql-parameter-placeholders\/","pubDate":"Wed, 11 Dec 2024 15:54:46 -0500","guid":"https:\/\/moerner.com\/posts\/postgresql-parameter-placeholders\/","description":"<p>This blog post is mostly a note to future me. As I work on my latest Go project\n<a href=\"https:\/\/github.com\/dmoerner\/etracker\">etracker<\/a>, I&rsquo;ve been using PostgreSQL\nfor the first time, using the excellent <a href=\"https:\/\/github.com\/jackc\/pgx\">pgx<\/a>\ndriver.<\/p>\n<p>When writing dynamic statements, best practice is to use a parameter\nplaceholder:<\/p>\n<div class=\"highlight\"><pre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"><code class=\"language-go\" data-lang=\"go\"><span style=\"display:flex;\"><span><span style=\"color:#a6e22e\">_<\/span>, <span style=\"color:#a6e22e\">err<\/span> = <span style=\"color:#a6e22e\">dbpool<\/span>.<span style=\"color:#a6e22e\">Exec<\/span>(<span style=\"color:#a6e22e\">context<\/span>.<span style=\"color:#a6e22e\">Background<\/span>(), \n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#e6db74\">`INSERT INTO peers (peer_id, ip_port, info_hash) \n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\"> VALUES ($1, $2, $3) \n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\"> ON CONFLICT (peer_id, info_hash) \n<\/span><\/span><\/span><span style=\"display:flex;\"><span><span style=\"color:#e6db74\"> DO UPDATE SET ip_port = $2;`<\/span>,\n<\/span><\/span><span style=\"display:flex;\"><span> <span style=\"color:#a6e22e\">announce<\/span>.<span style=\"color:#a6e22e\">peer_id<\/span>, <span style=\"color:#a6e22e\">announce<\/span>.<span style=\"color:#a6e22e\">ip_port<\/span>, <span style=\"color:#a6e22e\">announce<\/span>.<span style=\"color:#a6e22e\">info_hash<\/span>)\n<\/span><\/span><\/code><\/pre><\/div><p>Although the pgx driver supports this with variable parameter methods, it&rsquo;s\njust an abstraction on top of the underlying PostgreSQL PREPARE statement:<\/p>"},{"title":"Isn't Go Reflection Slow?","link":"https:\/\/moerner.com\/posts\/isnt-go-reflection-slow\/","pubDate":"Tue, 03 Dec 2024 01:02:49 +0000","guid":"https:\/\/moerner.com\/posts\/isnt-go-reflection-slow\/","description":"<p>Sharing a short note about something which surprised me today.<\/p>\n<p>I&rsquo;ve just started working on a self-healing Bittorrent tracker, which uses\ntracker-level tools (peer allocation algorithms and error messages) to handle\nunhealthy Bittorrent swarms. Ordinarily, such unhealthy swarms (low seeder to\nleecher ratio, broken clients, etc.) are either ignored or are handled\noutside the protocol using a separate frontend. I want to explore to what\nextent they can be handled by the tracker itself, within the constraints of the\nBittorrent protocol. For more information, check out the README on my Github,\nalthough none of this is actually implemented yet:\n<a href=\"https:\/\/github.com\/dmoerner\/etracker\">https:\/\/github.com\/dmoerner\/etracker<\/a>.<\/p>"},{"title":"\"For Historical Reasons\": Go String and Int Conversion","link":"https:\/\/moerner.com\/posts\/for-historical-reasons-go-string-int-conversion\/","pubDate":"Mon, 25 Nov 2024 20:15:44 +0000","guid":"https:\/\/moerner.com\/posts\/for-historical-reasons-go-string-int-conversion\/","description":"<p>Damilola Israel Oluwole and I have started learning Go, and decided to play\naround with the language to write a toy implementation of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Run-length_encoding\">Run-length\nencoding<\/a>. While working on\nthis little project we ran into a corner case with Go type conversion, which\nturns out to be documented in the Go spec but neither of us were aware of.<\/p>\n<p>Run-length encoding is a simple lossless text compression algorithm which\nencodes each sequence of <em>n<\/em> identical characters <em>c<\/em> into the substring &ldquo;cn&rdquo;.\nFor example, &ldquo;Hello&rdquo; is encoded as &ldquo;H1e1l2o1&rdquo;, and &ldquo;AAAAAAAAAAH&rdquo; is encoded as\n&ldquo;A10H1&rdquo;. Obviously in the worst case, a string with no adjacent identical\ncharacters, an RLE encoding of a string of length <em>n<\/em> requires length <em>2n<\/em>.\nHowever, in the best case, a string which consists of a single sequence of a\nsingle character, the encoded length scales as the <del>square root<\/del> log of the\noriginal length. (Thank you to Charles Eckman for the correction!) Our\nimplementation can be found on Github: <a href=\"https:\/\/github.com\/dmoerner\/go-rle\">https:\/\/github.com\/dmoerner\/go-rle<\/a>.<\/p>"},{"title":"When Impossible Day Feels Impossible: \/tmp Inode Exhaustion","link":"https:\/\/moerner.com\/posts\/impossible-day-inode-exhaustion\/","pubDate":"Tue, 19 Nov 2024 21:16:04 +0000","guid":"https:\/\/moerner.com\/posts\/impossible-day-inode-exhaustion\/","description":"<p>Impossible Stuff Day is a special sprint at the <a href=\"https:\/\/www.recurse.com\/\">Recurse Center<\/a> devoted to working beyond the edge of your abilities. I had an ambitious day planned around <a href=\"https:\/\/mirageos.org\">MirageOS<\/a> microkernels, but I made one critical mistake: I did not test my OCaml development environment with MirageOS.<\/p>\n<p>But that&rsquo;s no problem: There&rsquo;s a nice guide to <a href=\"https:\/\/mirage.io\/docs\/install\">install MirageOS<\/a>, and it looks pretty simple. We can install MirageOS and confirm that the <a href=\"https:\/\/mirage.io\/docs\/hello-world\">Hello World<\/a> tutorial works. However, it very much does not:<\/p>"},{"title":"Benchmarking a Binary Search Optimization, from 1991 to 2024","link":"https:\/\/moerner.com\/posts\/benchmarking-binary-search\/","pubDate":"Fri, 08 Nov 2024 20:00:00 +0100","guid":"https:\/\/moerner.com\/posts\/benchmarking-binary-search\/","description":"<p>While reading Chris Okasaki&rsquo;s <a href=\"https:\/\/www.cambridge.org\/core\/books\/purely-functional-data-structures\/0409255DA1B48FA731859AC72E34D494\">Purely Functional Data Structures<\/a> I became aware of an interesting optimization for binary search proposed by Arne Andersson in his 1991 paper, <a href=\"https:\/\/user.it.uu.se\/~arneande\/ps\/searchproc.pdf\">A Note on Searching in a Binary Search Tree<\/a>. This blog post is an investigation of this optimization, including some updated benchmarks in Go and OCaml.<\/p>\n<h1 id=\"binary-search-algorithms\">Binary Search Algorithms<\/h1>\n<p>As a reminder, a binary search tree can be thought of as a data structure consisting of empty leaves and non-empty nodes; each node contains a value and pointers to left and right subtrees. A binary search tree must satisfy the BST Invariant: For any node <em>n<\/em>, every node in the left subtree of <em>n<\/em> has a value less than <em>n<\/em>&rsquo;s value, and every node in the right subtree of <em>n<\/em> has a value greater than <em>n<\/em>&rsquo;s value. This naturally suggests the following algorithm for binary search, implemented in Go:<\/p>"},{"title":"About","link":"https:\/\/moerner.com\/about\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/moerner.com\/about\/","description":"<p>Senior Software Engineer at <a href=\"https:\/\/clerk.com\">Clerk<\/a>. Formerly an Assistant Professor of Philosophy at the University of Chicago, now taking a break to explore my passions in tech and coding at <a href=\"https:\/\/www.recurse.com\/\">The Recurse Center<\/a>. Here is an out-of-date <a href=\".\/files\/Moerner-CV-2025-03-06.pdf\">copy of my CV<\/a>. Contact me at <a href=\"mailto:dmoerner@gmail.com\">dmoerner@gmail.com<\/a>.<\/p>"}]}}