HN user

anitil

2,243 karma

jestoph [at] search company

Posts13
Comments1,228
View on HN

Oooh I'd forgotten about that! I'm keen on the real (non-rowid) primary keys and covering indexes. I'm not sure about defaulting to decimal math, but I suppose the reasoning makes sense

There is a way to do this with sqlite in readonly mode using the append vfs [0] which allows you to put your DB appended to the end of the executable, and then the executable can read it (like a zip file the header is then at the end of the db rather than the front). Or you could embed a normal db as a binary blob with the linker. Allowing writes is more tricky because most OSes don't typically allow executables to edit their own executable memory (on unix I believe executables always load as r/x or r/o depending on the region, maybe with some minor exceptions).

And a lot of users of sqlite statically link sqlite within their executable, they actually recommend that instead of dynamically linking.

[0] https://sqlite.org/vfs.html ctrl-f for 'append'

Edit: I got confused between the sqlar command and the append vfs so fixed it.

There's a really good list of lessons in the second half of this page which I think are really interesting (in general, but also in specific for this project). I don't have a Lobste.rs account but I have some comments about some of them so I'll add them here

* If you want to fail on full table scans in tests you could take advantage of EXPLAIN - though, because it relies on the built in analysis/stats this may exactly mimic production tables. I believe Ruby is dynamic enough that you could probably attach an EXPLAIN to all queries in the unit tests [0] and parse the output.

* For the three UDFs - Sqlite has a regexp module that you can build and load rather than using a udf in rails (probably a different version of regexp though, so user beware) [1] there is also an extensions_functions.c in the external contributions that provides 'stddev' [2] (or you could fake it with the percentile module). I'm confused why there's a udf for 'if' but it'd be trivial to build as C module, but I agree it's best to patch over this sort of thing separately from the migration, so perhaps limited benefit.

* 'I'm constantly surprised by the default choices of SQLite.' I think this is fair, but they're quite dedicated in not breaking existing installations, they even have pages dedicated to explaining some peculiar architecture [3]

[0] https://www.sqlite.org/eqp.html EDIT: there's an alternative suggestion here - https://lobste.rs/s/ko1ji1/lobste_rs_is_now_running_on_sqlit...

[1] https://sqlite.org/src/file/ext/misc/regexp.c

[2] https://sqlite.org/src/ext/contrib/ (ctrl-f for 'extensions-functions.c'. It has more than just stddev but you could strip the rest)

[3] https://www.sqlite.org/rowidtable.html I find this a really touching note 'The designer of SQLite offers his sincere apology for the current mess'

I've been building some sqlite plugins for playing with ngrams for text search. I'm not sure why, but I've learned a lot about the internal sqlite apis and it brings me a lot of joy. I would like to start a blog detailing some of this work but haven't found the time yet

I noticed that it wasn't the best comment, I was only concerned with the tone, and I feel like dang has enough going on that we also need to help elevate the conversation. I admit there's some delicious irony in the accuser committing the same crime, but it doesn't improve the discussion to revel in that.

I do the same. But the benefit to me is that by the time I've written out the message and checked my work I've usually solved the problem. So it's like rubber-ducking but with social consequences attached which makes my brain actually pay attention.

The latest post from the very interesting exe.dev project (previously of 'I am building a cloud' [0]). They have a lot of interesting work that goes in to making SSH work with their system (eg previously [1]), and this is a continuation of that.

Using Unix sockets to transfer file handles is not a new idea, but using for SSH connections is interesting to me. I wish it were a little heavier on the details here, but otherwise this is an interesting approach to handling network traffic while maintaining zero-downtime upgrades

[0] https://crawshaw.io/blog/building-a-cloud

[1] https://blog.exe.dev/ssh-host-header

How interesting! I thought that setjmp and longjmp were probably incompatible with Fil-C. And I'd somehow never heard of ucontext at all.

I suppose managing the stack is still managing memory after all, even if we typically don't think of it that way, so Fil-C has something to add here.

It's really worth reading the section here about the complexity of setjmp/longjmp and how they interact with register allocation and stack spilling. I knew they're tricky, but going in to the specifics is delicious.

writing well is really hard

I think because good writing is easier to read and understand than bad writing, there's almost an inverse relationship between how easy writing seems and how easy it is to read. So you read something and think "well, this is obvious" but the magic trick is how much work went in to making it so.

And sometimes you click a permanent action ('ignore' or 'accept' or 'decline') out of muscle memory or an imprecise click. Just this morning I _think_ I allowed some telemetry on a system I use (but don't want telemetry on) because by the time I had registered the text I'd already clicked it and now I can't work out which setting I need to toggle back

My go-to for this is to screenshot and use the built-in text extraction in the screenshot tool (I'm on a mac), then pass on that text data to whatever processing. It's a pretty good tool so long as the PDF is in OK shape (I've had errors in scanned images).

I feel like any problem that Postgres can't handle is a good problem to have. Either you've got so many customers that you're hitting sharp edges, or you're working on such an interesting problem that you're out of the domain where Postgres is helpful. That I should be so lucky

The latest in the 'Mars for the rest of us' series that covers a host of issues with space travel. This one covers the issue of food and nutrition in space.

Including this charming little tidbit -

Officially there is no alcohol allowed on board, but every once in a while NASA spends a few months trying to run down a spike in atmospheric ethanol that is inevitably traced to obscure origins somewhere in the Russian half of the station.

Interesting, I was wondering where catching these errors would fall between 'silently wrong on certain inputs' to 'how did this ever work!?'

I find it charming that to distinguish Fil-C from the K&R language they use the term 'Yolo-C'. I have never used inline asm before, I actually didn't realise how much behaviour it's specifying! (When I've needed asm it was on non-gcc compilers)

Edit to add: If I'm understanding this correctly we should be able to run this against projects and detect asm violations, I feel like this would be very valuable to be able to feed these back to maintainers