HN user

blue_pants

126 karma
Posts0
Comments54
View on HN
No posts found.

It is silly to grant agency and moral responsibility exclusively to people living within democracies.

The Putin regime made an informal deal with the population "You stay out of politics and we're gonna stay out of your life". The people outsource political power to the regime.

This passive majority represents the bulk of the population, but not the whole of the population. There are two smaller groups. Ultra-patriots who criticize Putin for not doing more war, more suffering etc. And those who criticize the Putin for the war, although this group is not very vocal, but here I do agree with you that's it's difficult to publicly protest in an authoritarian regime.

Untitled story 4 months ago

I don't think this is true. As per wayland protocol docs (https://wayland-book.com/seat/pointer.html):

Using the wl_seat.get_pointer request, clients may obtain a wl_pointer object. The server will send events to it whenever the user moves their pointer, presses mouse buttons, uses the scroll wheel, etc — whenever the pointer is over one of your surfaces. [...] The server sends this event when the pointer moves over one of our surfaces, and specifies both the surface that was "entered", as well as the surface-local coordinates (from the top-left corner) that the pointer is positioned over.

So the program should know the pointer's local coordinates.

0HN

How do you guys solve the problem of conforming DB schema to TS interfaces (or vice versa depending on what you like)?

Do you manually keep them in-sync (that's what I'm leaning into as the most practical solution)? Do you introspect the DB schema? Or maybe use something like Drizzle which autogenerates sql migration to keep the db schema in-sync

Editing hosts file seems unwieldy, and impossible on a phone without rooting it, AFAIK

split-horizon configuration

Is it when your local router redirects media-server.mydomain.com to a local IP, and say Cloudflare DNS redirects it to your Nebula IP?

Yes, but when you connect your phone to a Nebula network, and go to http://media-server in your browser, the DNS won't resolve it to your desired node, because the phone client (same on desktop) didn't update DNS of the phone, so you'll have to use node's IP address.

That's what I've read (when evaluating Nebula), at least.

Web Numbers 1 year ago
  The commercial domain name system is a perfect example of the type of artificial scarcity capitalism creates and exploits.
  Domain names are tiny little rows in a database. They cost next-to-nothing to set up and maintain. There’s absolutely no reason why they couldn’t be a public good, paid for from the public purse.
  And yet you pay (at times extortionate) amounts for them… why?
  Because capitalism.
Isn't this a bit simplistic? Domain names are a limited resource, so there has to be some way to regulate who can use which domains. What alternative method of regulation would you propose and why it's better?

What about <permission> having browser-defined UI instead? A site needs to access the location, for example there's a button on the page, 'Show my location', which is wrapped in a <permission> tag. When the user hovers over the button, the browser UI would appear on top of the area with a lock or something (the site cannot style this UI). If the user clicks on it, it would show the usual 'Site wants to use your location', and if the user agrees, they can click on the 'Show my location' button, if they don't agree, the browser UI would be shown again on the next hover. It would make it impossible for sites to obscure the permission-requesting UI.

they'll basically be breading economic cannon fodder

Are you suggesting that it's a new development and that, for example, peasants had it better?

I'd say that even if the absolute difference in wealth is greater these days, the disparity in opportunities and quality of life has, on average, decreased (Don't ask for sources as I don't have any)

There's an excellent article on how to implement OpenTelemetry Tracing in 200 lines of code.

https://jeremymorrell.dev/blog/minimal-js-tracing/

"It might help to go over a non-exhaustive list of things the offical SDK handles that our little learning library doesn’t:

- Buffer and batch outgoing telemetry data in a more efficient format. Don’t send one-span-per-http request in production. Your vendor will want to have words."

- Gracefully handle errors, wrap this library around your core functionality at your own peril"

You can solve them of course, if you can

Very interesting indeed. +1 for more explanations

For example, in the "TV -> serial number" abstraction, if I were to define only one operation (checking whether two TV's are the same), would it make it a good abstraction, as now it is both sound and precise?

And what are the practical benefits of using this definition of abstraction? Even if I were to accept this definition, my colleagues might not necessarily do the same, nor would the general programming community

From https://en.wikipedia.org/wiki/James_Lovelock

"In the mid-1950s, Lovelock experimented with the cryopreservation of rodents, determining that hamsters could be frozen and revived successfully.[14] Hamsters were frozen with 60% of the water in the brain crystallised into ice with no adverse effects recorded. Other organs were shown to be susceptible to damage.[15]"

And there's a Tom Scott's interview with James Lovelock:

https://www.youtube.com/watch?v=2tdiKTSdE9Y

Yeah, it's definitely not ideal, but even with its many flaws I prefer TS over plain JS.

The problem in question can be "fixed" like this

    const r1: { a: number; b: number } = { a: 10, b: 20 };

    const r2 = r1 satisfies { a: number };

    const r3: { a: number; b: string } = { b: "hello", ...r2 };
Now, TS would warn us that "'b' is specified more than once, so this usage will be overwritten". And if we remove b property -- "Type 'number' is not assignable to type 'string'"

Another "fix" would be to avoid using spread operator and specify every property manually .

Both of these solutions are far from ideal, I agree.

---

I don't advocate TS in this thread though; I genuinely want to understand what makes row polymorphism different, and after reading several articles and harassing Claude Sonnet about it, I still didn't grasp what row polymorphism allows over what TS has.

PureScript allows you to remove specific fields from a record type. This feature, is called record subtraction, and it allows more flexibility when transforming or narrowing down records.

TypeScript does allow you to remove specific fields, if I understand you right [0]:

    function removeField<T, K extends keyof T>(obj: T, field: K): Omit<T, K> {
        const { [field]: _, ...rest } = obj;
        return rest;
    }

    type Person = { name: string; age: number };
    declare const p: Person;
    const result = removeField(p, 'age'); // result is of type: Omit<Person, "age">

> PureScript allows you to abstract over rows using higher-kinded types. You can create polymorphic functions that accept any record with a flexible set of fields and can transform or manipulate those fields in various ways. This level of abstraction is not possible in TypeScript.

Again, if I understand you correctly, then TypeScript is able to do fancy manipulations of arbitrary records [1]:

    type StringToNumber<T> = {
        [K in keyof T]: T[K] extends string ? number : T[K]
    }

    function stringToLength<T extends Record<string, unknown>>(obj: T): StringToNumber<T> {
        const result: Record<string, unknown> = {};
        for (const key in obj) {
            result[key] = typeof obj[key] === 'string' ? obj[key].length : obj[key];
        }
        return result as StringToNumber<T>;
    }

    const data = {
        name: "Alice",
        age: 30,
        city: "New York"
    };

    const lengths = stringToLength(data);

    lengths.name // number
    lengths.age // number
    lengths.city // number

[0] https://www.typescriptlang.org/play/?#code/GYVwdgxgLglg9mABA...

[1] https://www.typescriptlang.org/play/?#code/C4TwDgpgBAysBOBLA...

edit: provided links to TS playground