HNHacker News
TopNewBestAskShowJobs

stux

149 karma · joined April 29, 2020

submissionscomments
stux··on 2004 RuneScape fit a multiplayer RPG into 56k dial-up
> Before any networking occurs, the client runs a breadth-first search using the local collision map to build a path from where you are to where you clicked, and then writes the packet for the server to read. [...] The packet contains the absolute position of the first waypoint in the path, followed by the delta of each waypoint in the path against the first one

How come the client sends waypoints rather than just the destination? Naively it seems like sending less data would be better. Is the pathfinding so expensive that you'd want to avoid doing it on the server? I suppose it works out as long as it's cheap to validate/correct the client's path?

stux··on Parrot – type-safe SQL in Gleam, supports SQlite, PostgreSQL and MySQL
These sqlc-style libraries are a great solution to the problem of “make running a query as easy as calling a function”, but I’ve always thought SQL’s lack of composability is a more interesting problem that I haven’t seen addressed (the problems with views are well documented).
stux··on Nullable but not null
This is interesting! A field being nullable because it's legitimately optional in the domain model is one thing, but for new fields which shouldn't be nullable in the domain model, unless you can pick a reasonable identity value, you need a concept of absence that's different from null. Luckily the intersection of "non-nullable fields" and "fields with no reasonable identity value" and "fields which didnt exist in v1 of the domain model" is normally pretty small, but it's painful when it happens.

This reminds me of frozen/nonfrozen enums in Swift. You can do exhaustive case analysis on frozen enums, but case analysis on nonfrozen enums requires adding an `@unknown default` case.

https://docs.swift.org/swift-book/documentation/the-swift-pr...

stux··on Web apps built with Ruby on Rails
Rails definitely seems optimized for creating code, but how is it at maintaining code? I've never used it, but it seems like Ruby's dynamic types would make it really challenging to do large refactors. What techniques do rails developers use?
stux··on Some programming language ideas
> with functions named by their normalized hash contents, and referred to anywhere by that, but I can't seem to remember what it's called right now. Something like "Universe" I think?

Unison: https://www.unison-lang.org/docs/the-big-idea/

stux··on We're forking Flutter
> Flutter founder here.

Given that the literal founder of Flutter is in this thread using this introduction multiple times, it’s kinda hard to give you the benefit of the doubt that you honestly just meant “a founder using Flutter”.

stux··on We're forking Flutter
https://github.com/flutter/flutter/pulls?q=is%3Apr+author%3A...

- 0 open PRs

- 2 PRs merged, 1 PR closed in the past 4 years

- All PRs reviewed by a member of the Flutter team within 24hrs

- [“If I'm still supposed to write tests, even for this change, then this is probably as far as I take the PR.”](https://github.com/flutter/flutter/pull/128910#issuecomment-...)

- 40+ PRs from 2019

So, disgruntled ex-employee?

stux··on Swift Static Linux SDK
> Anonymous enums/structs in parameters

Can you share an example of this? It sounds really interesting but I couldn’t find any references. Do you mean the parameter “packs” features?

stux··on The Git repositories of XZ projects are available on GitHub again
Edit: nvm, dupe of https://news.ycombinator.com/item?id=39984512
stux··on SQLite 3.44: Interactive release notes
> Aggregate functions can now include an ORDER BY clause after their last parameter.

Hopefully that means we'll soon get support for `DISTINCT` in `GROUP_CONCAT`.

Atm you can do `group_concat(x, '|')` and `group_concat(distinct x)`, but you can't do `group_concat(distinct x, '|')`.

stux··on Using Redundant Conditions to Unlock Indexes in MySQL
As the article notes,

> Redundant conditions are nice because they require no changes to the database [...] This makes them useful for queries that are only sometimes run or where indexes can't be easily added to the main conditions

but where possible I typically prefer adding an index on the expression that the query is using (if your database supports it) since it expresses your intent more clearly. A redundant condition is more likely to get "optimized away" by other developers or changes in the query planner.

stux··on Ask HN: What are some of the best podcasts for developers?
My two favourites at the moment that haven’t already been mentioned are:

https://podcasts.apple.com/ca/podcast/algorithms-data-struct...

https://podcasts.apple.com/us/podcast/software-unscripted/id...

stux··on 7GUIs
Reminds me of the principles brought up in this talk by Sean Parent:

https://youtu.be/0WlJEz2wb8Y

The temperature converter is a good example of an “implies” relationship, which Sean argues is difficult to model in UIs.

stux··on SQLite: Vulnerabilities
I think the tone of this page is frustration that this page needs to exist. I think if I had to constantly deal with stuff like this I'd be pretty frustrated too:

> CVS-2019-19317 is an excellent example of a bogus CVE. This CVE describes a bug in an unreleased development version of SQLite. We were working on the new generated columns feature of SQLite, and a third-party hacker found an error in the code under active development, and then wrote a CVE against it. The error was fixed before the problem was ever released, and yet still there is this CVE sitting out there, unresolved, and as far as I can tell unresolveable.

Lot's of great related discussion from drh in this[0] sqlite forum thread.

[0]: https://sqlite.org/forum/forumpost/0e8b92001245dec1

stux··on Writing a SQLite clone from scratch in C (2017)
I agree with your general point that "it's very hard to write safe C code", and

> people keep finding use-after-free bugs in sqlite3

is true, but

> that allow attackers to escalate the memory corruption into arbitrary code execution... bugs that have affected major projects, including iCloud and Chrome; here are a handful: there are lots more even from just the past year :/

is just incorrect. I'd strongly encourage you to read https://www.sqlite.org/cves.html

stux··on Simple SQL in Python
Yeah this approach is definitely way nicer with some tooling support.

For example https://github.com/cashapp/sqldelight for Kotlin integrates with IntelliJ to provide ctrl+click navigation (see gif in their readme), and https://github.com/simolus3/moor/ for Dart has similar features that integrate with VSCode (https://moor.simonbinder.eu/docs/using-sql/sql_ide/).

(...since everyone is linking their favorite libraries with a similar approach!)

stux··on How we use Rust in our mobile SDK
Dart’s FFI is still stabilizing, but there’s a small example here https://github.com/brickpop/flutter-rust-ffi