Lag window function in SQLite
Here's how to use a lag window function to calculate new cases per day when the table just has total cases over time on different dates.
Notes on software engineering
221–240 of 550 posts, newest first.
Here's how to use a lag window function to calculate new cases per day when the table just has total cases over time on different dates.
I figured out how to run a SQL query directly against a CSV file using the command-line utility: sqlite3 :memory: -cmd '.mode csv' -cmd '.import taxi.csv taxi' \ 'SELECT passenger count, COUNT( )…
TLDR: Use in and your containers will probably work! I was trying to figure out how to get a development environment for a Django project running inside Docker in a M1 Mac.
Today I learned how to use the Python trace module to output every single executed line of Python code in a program - useful for figuring out exactly when a crash or infinite loop happens.
I figured this out while adding support to Datasette in 1388. Save the following in : Start against that configuration file - this works without root provided you listen on a high port: nginx -c…
I needed to apply some changes to the DOM if the users window was smaller than 800px - or if the user resized their window to less than 800px after they had first loaded the page.
The GraphQL schema language is a concise way to represent the available schema provided by a GraphQL endpoint.
I'm writing some code that accepts webhooks from Stripe. I wanted to simulate hits to this endpoint in my Django tests.
After rebasing a branch with 60+ commits onto I was disappointed to see that the commit dates on the commits (which are a different thing from the author dates) had all been reset to the same time.
Pyodide provides "Python with the scientific stack, compiled to WebAssembly" - it's an incredible project which lets you run a full working Jupyter notebook, complete with complex packages such as…
I'm learning service workers. I wanted to start with one that intercepts calls to a and returns "Hello World". Here's the initial recipe I came up with.
For datasette-leaflet-geojson I wanted to dynamically load some external CSS and JavaScript and then execute some code once they had loaded (issue 14).
Today I learned how to install tools from GitHub that are written in Go, using github.com/icholy/semgrepx as an example: go install github.com/icholy/semgrepx@latest Running this command grabs a copy…
I wanted to start a new git repository containing just the history of two specific files from my help-scraper repository.
I wanted to upgrade my git-history installation to a new alpha version. doesn't work for that, because it upgrades to the most recent stable version - but I wanted the alpha.
Inspired by Brad Neuberg I decided to take a look at the SQL features in the GDAL family of tools. GDAL is a complex beast.
When comparing secrets, passwords etc it's important to use a constant-time compare function to avoid timing attacks. In Python I use , documented here. I needed an equivalent in Node.js today.
While working on this issue I figured out a neat pattern for running the tests for my project locally against a specific Python version using uv run: The new-to-me trick here is that works for adding…
I wanted to produce the following output from a command-line tool: But I wanted to do it from a streaming iterator - without first buffering the entire output in an in-memory Python list and calling…
I've been trying to get my head around ColBERT. ColBERT is a fast and accurate retrieval model, enabling scalable BERT-based search over large text collections in tens of milliseconds.