The problem If you’re using Spring Boot with Spring Data JPA , you’ve probably got a configuration file like this sitting near your server: # application.yml spring : datasource : url : jdbc:mysql://mysqldb:3306/mydb username : root # <-- credentials password : password123 # <-- If you’re a fan of 12-factor apps , you might draw the app configuration/database credentials from…
Summary This is a cautionary tale about how I ended up writing a (bad) regular expression parser and evaluator in pure TypeScript types. type HexStr < S extends string > = Recognize < "[0-9a-fA-F]+" , S > ; type IsMatch < S extends string > = HexStr < S > extends S ? true : false ; const isHex : IsMatch < "deadbeef" > = true const notHex : IsMatch < "nope" > = false The novelty here is parsing and…
The problem I wanted to parse docker-style container image references for a personal project I was writing in rust. Ideally, I’d use the authoritative parser, distribution/reference , which is written in Go. FFI between Go and rust is nontrivial; the examples I found involved a custom build.rs with C bindings , custom assembly , or embedding WASM into your binary. Rather than deal with any…
TL;DR: Using mypy , pydantic , and FastAPI , I generate an openapi.yaml , then I use openapi-generator to create a typescript API client. This means I get an API client for free, and (mostly) preserve type safety across my tech stack! See also: https://fastapi.tiangolo.com/advanced/generate-clients/ Exposition: why FastAPI? At $DAY_JOB , I write a full-stack application. I wrote the backend in…
SQL is a convention. There are many RDBMS s that behave similarly and call themselves “SQL databases”. However, it’s difficult to tell whether an application that works on one SQL database will work on another SQL database. Similarly, validating a new RDBMS against the SQL specification ( ISO/IEC 9075 ) would cost a nontrivial amount of time, effort, and money. At this point,…
TL;DR: we’re all operating on the same hardware that cavemen operated on. Here’s one modern caveman distilling lessons any caveman can understand based from a career in software development.
TL;DR: A SIMD value is called a vector . […] A SIMD vector has a fixed size, known at compile time. [ A] vector is generally aligned to its entire size. A single element position within a [SIMD] vector is called a lane The extra-wide registers that are used for SIMD operations are commonly called vector registers, […] “SIMD registers”, vendor names for specific features,…
TL;DR: I wrote a bad psql meta-command parser so you don’t have to. Get it at https://github.com/skalt/psql_splitter . I’ve received incredulous looks after saying that my preferred way to manually interact with a a postgres database is with command-line psql . To be clear, I earned those looks: anyone looking over my shoulder at me working would be as bewildered as I was while I…
TL;DR: A CPU has several kinds of memory. CPUs cache data in faster and slower memory as the data is used in computation. Reading from a slower cache tends to be more expensive than doing several math operations, even multiplication. Reducing memory usage can vastly speed up an application When possible, 8- or 16-bit integers instead of 32- or 64-bit pointers Using a struct of same-sized arrays…
TL;DR: add an ARCHITECTURE.md document to make contributing to your codebase easier for newcomers A high-level map of the codebase architecture helps newcomers find where to start reading An ARCHITECTURE.md document should cover: how different sections of the codebase work together things that don’t change often (once or twice a year at most) Do name important files, modules, and types. Do…
Ever wanted to check in your build artifacts into a build-specific branch? I used to do that to deploy my Github pages ( demo in my git history ). I had a git submodule in my website repo that pointed at a specific branch of my website repo. I’d dump my built css/js/html into the subrepo and push it to deploy. This workflow let me get my static site online without messing with CI or figuring…
With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody. See also: https://xkcd.com/1172/
TL;DR: parsers take less-structured data and try to turn it into more-structured data. They don’t always succeed, so all parsers need to handle failure. validating throw s away information as exceptions/errors, while parsing holds onto that information parsing inputs as early as possible helps you trust the validity of data once it reaches your business logic. Beware of “shotgun…
A set of jekyll _includes that allow you to use hashed assets from webpack or another asset wrangler in Jekyll without a plugin. Since Github pages don’t allow custom plugins, this is the closest you’ll get to using rails-webpacker in Jekyll. UPDATE : As of 2022-08-10 , you can build your GitHub pages with customized jekyll or other static site generators using GitHub actions.
Why bother? I wanted to clean up my previous site, and I wanted to try out Jekyll. I built the previous iteration of my site with minimalism in mind. This led to an unfortunate experiment in using emoji as icons. For posterity: that experiment failed. Different browsers support different emoji, display the same emoji differently, and apply CSS font color to emoji differently. I selected Jekyll for…
monkey-see-monkey-vue exposes methods for finding events that Vue.js will react to. It’s still a work in progress. Inspired by the excellent gremlins.js and Generating Software Tests by Zeller et al. .
Webpack and compilers can produce hashed asset bundles ( like index.bundle.md5h4sh3d.js ). Flask-Webpack provides global jinja2 templates that look up your your hashed bundles by name in an asset map.
TL;DR: All build systems vary on the following axes: when the build system learns about dependencies (in the build specification or after doing some work) what information the system stores about previous builds where information about previous builds can be stored how build steps are scheduled (e.g. suspending, restarting, start-to-finish) whether the system does the minimum amount of work to…
Background Coming into 2018-19, Mozilla Developer Network (MDN) had crowdsourced HTML tables of compatibility between browsers and features of web standards. They then crowdsourced the conversion of these tables into JSON. I wrote a bookmarklet to scrape MDN’s old browser compatibility tables. To use it, go to a MDN documentation page which needs modernization click the bookmarklet in your…
Mapbox provides an excellent selection of symbols for map-making with its Maki icon set. I built a quick Vue app to help me search and select icons for map-making.
I wrote a lightweight javascript module to translate GeoJSON to GML 3 or 2. This helps newer web GIS tools talk to older tools that rely on OGC GML, i.e. GeoServer .
But we can describe some of the ideas in words. Let’s say we have a regular expression which is supposed to match the strings (‘a’, ‘abab’, ‘aaaabb’, ‘bbc’). The derivative of those strings with respect to 'a' is (’’, ‘bab’, ‘aaabb’) – you strip off the a from every string. It turns out (which is not totally…
This article is an unflinching look at the realities of corporate software development as of 2010. Law: You can’t check code you can’t parse. Checking code deeply requires understanding the code’s semantics. The most basic requirement is that you parse it. Parsing is considered a solved problem. Unfortunately, this view is naïve, rooted in the widely believed myth that programming languages exist.…
TL;DR: Follow these rules for acceptable pretty printing: if an expression is longer than the room left within a maximum length, fold it. else, don’t. This paper inspired prettier and black .
A “hacker” is a person who has gone past using his computer for survival (“I bring home the bread by programming”) to the next two stages [(“social life,” and “entertainment”)]. – Linus Torvalds in “What Makes Hacker’s Tick? a.k.a Linus’s Law”, prologue to Pekka Himanen’s The Hacker Ethic, 2001 See also: This Rich to Open Source…
TL;DR: Lack of formal structure makes it harder for newcomers to participate in changing an organization. According to Seeing Like a State , that barrier might be intentional.
In The Cathedral and the Bazaar , Eric S. Raymond wrote: Linus [Torvalds] was behaving as though he believed something like this: Given a large enough beta-tester and co-developer base, almost every problem will be characterized quickly and the fix is obvious to someone. or, less formally, “Given enough eyeballs, all bugs are shallow.” I dub this: “Linus’s Law”