HNHacker News
TopNewBestAskShowJobs

gwking

258 karma · joined January 4, 2016

github: gwk
submissionscomments
gwking··on VOC injection into a house reveals large surface reservoir sizes
I have never seen the word “partition” used in this way before. Hard to search for examples because unrelated computer graphics articles about surface partitioning dominate. I did find this:

Partitioning is the distribution of a solute, S, between two immiscible solvents (such as aqueous and organic phases). It is an equilibrium condition that is described by the following equation:

S(aq) ⇄ S(org)

Interesting to think that a surface can play a role comparable to a solvent. I wonder what a chemist would have to say about it.

https://www.chemicool.com/definition/partitioning.html

gwking··on Python 3.14 is here. How fast is it?
Speaking only for myself, and in all sincerity: every year, there is some feature of the latest CPython version that makes a bigger difference to my work than faster execution would. This year I am looking forward to template strings, zstd, and deferred evaluation of annotations.
gwking··on Litestar is worth a look
I’ll second this, and add that docstrings are becoming ever more useful as modern editors learn how to show them inline when I hover over a symbol. Starlette lacks docstrings entirely and it’s a real miss in my opinion.
gwking··on You Can Now Disable All AI Features in Zed
I paid for a subscription to both cursor and zed, without configuring any different LLMs or other options as far as I recall.
gwking··on You can now disable all AI features in Zed
I went from VS Code to Cursor, then got frustrated with Cursor breaking keybindings and other things, tried to go back to VS Code but missed the superior tab completion. Then I gave Zed a long hard try, but after over a month of daily usage I went back to Cursor again, just for the tab completion quality.

I don't use any of the chat or agent features, but for me Cursor's tab completion is a step forward in work efficiency that Zeta and Copilot were not. Sometimes it's subtle, and sometimes it is very obvious. Cursor seems to have sources of context that the others don't, like file names from the directory tree, and maybe even the relevant .pyi type annotations and docs for python modules. It also jumps to the next relevant problem site very effectively. It feels like the Cursor devs have done a ton of practical work that will be hard to match with anything other than a full-on competitive effort.

I want to see Zed succeed. I think it's very important that VS Code and its ultra-funded derivatives not dominate the modern editor landscape too thoroughly. Tab completion used to seem like a straightforward thing, but if the state of the art requires a very elaborate, whole-workspace-as-context environment to operate in, then I wonder if it's going to become a go big or go home kind of feature.

I can't help wonder what the actual internal API for this kind of thing is going to look like in the future. It used to be something like, what's the current token behind the cursor, and look in a big prefix tree of indexed words. Then maybe it got more elaborate with things like tree-sitter, like what's the incomplete parse tree up to this point. Then when editors started using AI, I stopped having any idea of what the actual inputs are. I'd love to hear about real implementation experience at any stage of this evolution.

gwking··on You can now disable all AI features in Zed
Even after figuring this out for myself I still struggle to do it fluently.
gwking··on Litestream: Revamped
It seems to me that you need to think about your server as the production database, rather than a web server instance that can be trivially spawned by a management layer.

When I deploy a new version of my python/sqlite web app, I do not replace the whole machine. I just upgrade the python package and restart the systemd service.

If I wanted to reduce downtime I could probably figure out a transition using SO_REUSEPORT. During the transition the old and new processes would be using the db concurrently, so the app would have to respect that case. If part of the upgrade requires a db schema change then I’m not sure how you could avoid some downtime. But I don’t know if it is possible with traditional dbs either.

gwking··on Hyper-Typing
I started using swift with a lot of enthusiasm for the type system, but at times it was a huge time suck. There were lots of obscure interface types that read like BipartisanPoliticallyCorrectSequence<T> that made writing my own generic utilities challenging. Documentation for that stuff was very poor and the source code was often totally inscrutable due to the implementation of core types in c++ and the overall complexity of the compiler.

I recently saw Chris Lattner talk about Mojo and he made passing reference to Swift trying to do too much with the type system. It’s telling that a guy with his experience is trying something more like zig’s comptime approach to types after two decades of generics.

gwking··on An end to all this prostate trouble?
I merely saw the domain name 'yarchive' and had a strange inkling that there might be a connection. A quick search yielded this: https://unlimitedhangout.com/2021/08/investigative-reports/t....

I have no opinion of unlimitedhangout.com or the veracity of that article. But in response to "I just find it strange", I'm beginning to associate this sort of intensely intellectual inquiry into disparate topics with equally intense political positions.

I was first introduced to Urbit as if it was a purely technical, humorous and extremely nerdy lark. It was a joke thing my friend got me to sign up for, to own a slice of an imaginary universe (in a quantity called a "frigate" or whatever it was). When I learned years later about how serious the worldview behind it was, I was quite shocked.

Since then, and especially since the NYT outing of Scott Alexander in 2020, I've become more attuned to the pattern. These hyper-analytical blogs often come with a lot of political implications below the surface.

Again, I'm not taking sides here. If anything, the takeaway for me is that the world is very complicated. We have these rare polymath personalities who go deep into topics, have a strong voice on the internet, and they end up with all sorts of valid criticisms of the status quo. This in turn can align with extreme political views.

gwking··on Farallon Islands live (and controllable) webcam
His website is tonykingart.com. It is sorely in need of an update. I don't have any photos of the Farallon paintings, but a small one hangs in my childhood bedroom. You could contact him through his site and I'm sure he'd oblige!
gwking··on Farallon Islands live (and controllable) webcam
My dad got to go out there in the 90s on an unusual artist permit and painted landscapes for a few days. It sounded incredible. There was white shark research going on and he saw a seal get eaten through a spotting scope.
gwking··on SQLite-on-the-server is misunderstood: Better at hyper-scale than micro-scale
I depend on litestream for production backups and as the months wear on without any releases I am getting more nervous. To be clear, I don’t feel entitled to anything with an open source project like this, but bug reports and fixes seem to be accumulating. I have flirted with the idea of building from main.

I’ve also flirted with the idea of forking litestream and stripping it down dramatically. The reason why is that I don’t like the idea of the production server being in charge of rotation and deletion. It seems like the thing getting backed up shouldn’t have the privilege of deleting backups in case it gets compromised. I might even go so far as to propose that the “even liter stream” process merely writes to a different local volume and then some other process does the uploading but I haven’t gotten beyond the daydream stage.

gwking··on SQLite-on-the-Server Is Misunderstood: Better at Hyper-Scale Than Micro-Scale
I believe the locking models are different making DuckDB less suitable for concurrent read/write but you will have to look up the specifics. As always, for a server environment SQLite should be set to WAL mode and comparisons should be made against that rather than the much older, less concurrent default.

As I recall duckdb’s concurrency model did not sound viable for a web server but I may be behind the times or outright wrong.

gwking··on 3D Rotation Design
The trackball implementation appears to have a numerical bug in it. Occasionally (on mac safari at least) the rendering will be blank white. If you happen to let go of the mouse during that frame, then it gets permanently stuck and requires a page refresh. Seems like it might be a divide by zero due to a small cursor delta or something along those lines.
gwking··on Why Gumroad Didn't Choose Htmx
As many others have mentioned, the comment about AI failing to cough up good answers is intriguing. But what has not been said is that this may also be evidence that the HTMX documentation needs improvement. In particular it needs (many) more examples.

I have always been a reader of documentation for libraries that I use, and I have nearly always felt that docs could be better. Having tried to write docs myself, I know how hard (impossible?) it is to imagine not knowing how the thing you are documenting works.

Recursivedoubts, please take this criticism as encouragement more than anything! I think HTMX is important both as a library and as a reality check against complexity.

There is something unnerving about the HTMX docs to me: over and over again, I read them, and I think, "ok got it, sounds straightforward" but then it turns out there is something slightly tricky that is hard to diagnose. I don't quite know why.

One thing that has gotten me a couple times is not being clear on whether an attribute is for the request or response. I feel kind of dumb admitting this but it has been harder than I'd have thought. My best suggestion would be to add a request/response column in the attributes reference listings. Debug mode validation of "hx-*" attributes would be very welcome.

Early on I definitely mixed up hx-select-oob/hx-swap-oob and hx-include/hx-vals. I've also made mistakes with hx-indicator/htmx-indicator although that's a little different because one is a css class name.

Another that got me recently was trying to set an hx-on: after-settle handler in the target element (client side) and having nothing happen, but then discovering that if I put it in the response it would work. This made no sense at the time. Now I'm wondering if it was because the hx-swap was set to something other than innerHTML.

Anyway, I think the main point is that some of these things are sort of related in various subtle ways, and also sound similar, and are easy to mix up. As a new user, when I try to follow the directions and then apparently nothing happens, it is very hard to know how to proceed. Really the only way forward is to find a working example and try not to break it, or selectively break it to figure out how it works.

I know docs are a lot of work, but in an ideal future there would be example links to click on for each one of the attributes. Perhaps I could help with that at some point.

I've always thought that HTMX has amazing potential on the documentation front because one can build working examples that are served completely statically. In fact I can't think of a UI system that is more amenable to training an LLM. You would just need to write out the expected end-state of the HTML target.

For context, I've been using HTMX as crucial component of a back office web app for two years now. It is mostly a custom scheduling calendar. Most of it is simple HTMX, but I've used OOB-swap and hx-on in places. I use it to do fast state changes without full page refreshes, and to implement a few multi-step forms that require back-and forth of valid form choices. Recently I built a modal control with different edit actions, etc. I don't think I would have taken on this client at all if it weren't for HTMX. So, thank you!

gwking··on VC Fund gives money back, says the market for mature startups is too weak
This anecdote intrigues me because it sounds like a group-think dynamic. Perhaps I'm reading too much into the "designate one partner" aspect. But I imagine that behind this is a desire for the partners to all be in agreement about the investments they choose, which leads to them being unable to take a wider array of smaller risks.
gwking··on A high-performance, zero-overhead, extensible Python compiler using LLVM
An example related to JSON content is HTML content. I have a Python library that represents all of the standard HTML tags as a family of classes. It is like a lightweight DOM on the server side, and has resulted in a web server that does not use string based templating at all. It lets me construct trees of HTML completely in Python and then render them out with everything correctly escaped. I can also parse HTML into trees and manipulate them as I please (for e.g. scraping tasks and document transforms). It is all strongly typed using mypy and I adhere to the strictest generic typing I can manage.

Each node has a list of children, and the element type is `str|HtmlNode`. I find this vastly easier to use than the LXML ETree api, where nodes have `text` and `tail` attributes to represent interleaved text.

Interestingly, the LXML docs promote their design as follows: > he two properties .text and .tail are enough to represent any text content in an XML document. This way, the ElementTree API does not require any special text nodes in addition to the Element class, that tend to get in the way fairly often (as you might know from classic DOM APIs). https://lxml.de/tutorial.html#elements-contain-text

It could be a simple matter of taste! But I suspect that the difference between what they are describing as "classic DOM" vs what I am doing is that they are referring to experience with C/C++/Java libraries circa 2009 that had much less convenient dynamic type introspection. The "get in the way fairly often" reminds me of how verbose it is to deal with heterogenous data in C/C++/ObjC. In ObjC for example, you could have an array mixing NSString with other NSObject subclasses, but you had to do work to type it correctly. If you wanted numbers in there you had to use NSNumber which is an annoying box type that you never otherwise use. And ObjC was considered very dynamic in its day!

I have long felt that the root of much evil was the overbearing distinction between primitive and object types in C++/Java/Objective-C.

All of this is a long way of saying, I think "how to deal with heterogenous lists of stuff" is a huge question in language design, library design, and the daily work of programming. Modern languages have by no means converged on a single way to represent varying types of elements. If you want to create trees of stuff, at some level that is "mixing types in a list" no matter how you might try to encode it. Just food for thought!

gwking··on A high-performance, zero-overhead, extensible Python compiler using LLVM
It is the design of JSON! Which is a reflection of the same dynamic typing choice made in the original design of Javascript.
gwking··on Operating system threads are always going to be (more) expensive
This sort of candor about hard won lessons is what I value most about this community. Thank you!
gwking··on Ilya Sutskever's SSI Inc raises $1B
For what it's worth, I don't think it has to be all bad. Among many possibilities, I really do believe that AI could change education for the better, and profoundly. Super-intelligent machines might end up helping generations of people become smarter and more thoughtful than their predecessors.
gwking··on Clay (short for C Layout) is a high performance 2D UI layout library
This is a topic about which I have long simmering opinions. I suspect that several things happened.

First, expectations and requirements went up. Laying stuff out with a mouse and snap-to alignment guides is ok for simple UI, but the more complex the design, the more I would end up fighting the vector-art style design interface. I remember staying up late fixing pixel alignment errors in nib files. Often you would need to move objects around to inspect another underneath and then play undo games to get things back exactly where they were.

The interesting parallel here is that the designers were doing all the designs in vector art apps, and were also frequently missing dynamic aspects of the design requirements.

It was one thing to design complex dialog boxes for desktop; think of a photoshop filter control pane. You target a minimum size screen, and then work with a fixed pane and lay things out. When the iPhone came out, IB worked ok for early versions and stock components. Screens were crowded but fixed width.

Once bigger screens came out, more designs started needing variable width layout computation. The APIs for dynamic layout were (as I recall now) more subtle than they sounded in the docs, and I recall joining several teams that misused them. “sizeToFit” and “sizeThatFits” were two culprits. Perhaps it made more sense in the simpler NeXT days, and perhaps the docs degraded. If you didn’t read Apple’s “Programming Guide” docs, it was hard to know how these things were supposed to work together, and those were like mini books. The guides got increasingly ignored as the iPhone’s UIKit took center stage. I was always a fan of NSAutoresizingMaskOptions but rarely saw others use them.

Second, modern version control made the binary nib files unmanageable, and merging the xml xib files was also awful.

Third, and to the parent comment’s point, there were quality problems with Interface Builder. New stuff got heaped on every year. The data model was proprietary but looking at the xml clearly just got more complicated and version-encumbered over time.

In summary, it is tempting to glorify the original NeXT tools, but I never used them. I started toying with IB in 2004. It never felt like a brilliant system because I couldn’t express the underlying logic of designs in the visual box dragging paradigm. Ironically auto layout pushed me further towards UI in code. But to each their own.

gwking··on Hetzner Pricing
I am in the US and have been using Fastmail for years. I have no problem with automated billing to a consumer credit card. I have recently begun using Hetzner as well, and this also bills to the same card. I just looked at the Hetzner charge, and it shows up in the CC transactions as "hetzner.com" with a US domestic phone number associated.

My guess is that your CC has more strict foreign alerting than mine, so perhaps this is not very helpful information. But it is certainly possible, and perhaps Hetzner billing support (and Fastmail too!) have some advice for how to smooth things over with the bank.

gwking··on The algebra and calculus of algebraic data types (2015)
This appears to have been published in 2015. Perhaps update the title with the year?
gwking··on Arm Accuracy Super Resolution
Perhaps one of several reasons is the failed promise of the App Store. If Apple had cultivated a different dynamic between consumers and developers we would have a different landscape of market segments today. Instead they created (or allowed to set in) the consumer expectation that an expensive app was two dollars.
gwking··on Penrose – Tool for Diagrams
The point coordinates are defined at the very bottom of the ".style" tab, after the commented out code. I had the same question!
gwking··on C-Macs – a pure C macOS application
In fact, early objective-c was a preprocessor according to Wikipedia!
gwking··on Ask HN: C/C++ developer wanting to learn efficient Python
I have been writing python for 15 years now and only occasionally have needed or wanted to optimize algorithms. When I have, the general takeaways have been:

* Flattening data from hierarchical, custom types into flatter, builtin collection types can make a speed difference. The builtin type methods spend more time in the native code and are optimized.

* Lots of things that I thought could make a difference but would barely move the needle. There is so much pointer indirection internal to CPython.

* The set and frozenset types can offer easy and immediate algorithmic improvements. This is obvious from a formal/academic perspective but continues to be my favorite thing about writing quick and dirty python. I have encountered cases where an algorithm called for a fancy data structure but doing simple set intersection and difference was good enough.

* Over time, Python taught me to worry less about optimizing things that didn't matter. Everyone pays lip service to the perils of premature optimization but I think there are layers to the problem. Fast languages make many affordances for optimization, and to some extent compel you to make detailed choices that have performance implications (e.g. choice of integer width, choice of collection type). There is something very liberating about reminding myself "it's going to be slow either way, and it doesn't matter." When I work in Swift for example I find myself getting distracted by finer details that relates to efficiency.

gwking··on Ask HN: SQLite in Production?
I am using WAL mode. Without it the site cannot really function.

I am starting to think that the connection errors I have have to do with a combination of the crash recovery process, which takes an exclusive lock, and the fact that I am using ATTACH on multiple auxiliary databases. I have a suspicion that I have entered into less tested territory with the latter. I also might be getting the system into tight recovery/crash loops when systemd is restarting these processes due to "database locked" errors.

gwking··on Ask HN: SQLite in Production?
I have spent the last 18 months building a web app using SQLite, python (starlette) and htmx. It is a back office app that now runs daily operations for a 60 person tax firm. The load is low, and it runs on a very cheap ec2 instance with litestream backups to s3.

The low latency is wonderful because I can write serial queries to construct a complex response. All the queries are written by hand and I do not use an ORM.

I have had a couple of outages, and all but one were basic operator errors. The notable exception was when tax season started, load went up, and I found that I was leaking (or creating too many) db connections. This was scary and I never quite understood the low level failure mechanism. The solution I came up with is to issue warnings whenever a connection (subclass of std sqlite3 Connection) is destroyed (__delete__()) without having been explicitly closed. Then I found all of the usage sites and put them into `with` contexts. Explicitly managing the connection lifetimes took the pressure off and I haven’t had to think about it since. I’d still like to reproduce the problem better though.

I do wonder what I would do if we scaled up to a point where things started to fall apart again, but there’s a good chance it won’t happen. It would require a lot more traffic, which implies massive staff growth.

The other architectural decision worth noting is that I keep complete local copies of various saas api data. A lightweight CRM, customer support, billing, call center, etc. Each of these has a background api fetcher/poller, and writes to its own SQLite file. Then the web app attaches each file to the main db. This gives me schema.table namespacing in the sql, and allows for separate backup policies for the different files. The trade off is no atomicity across the files, but for my purposes it is not significant.

gwking··on Cooking and bird safety
I have done it. I picked a lodge cast iron off of a stoop once and it had started to rust. I used fine grit sandpaper in an electric sander and got a decent result. Compared to the other lodge pan that I bought new, the one I polished is smoother and nicer to use.

[edit]: I did not polish it nearly as much as the mirror finished ones in the link nearby. I only did the cooking surface, and probably worked on it for 15 minutes.

← PreviousPage 2 of 3Next →