Readit News logoReadit News
sixbrx commented on Prisma Postgres – Runs on bare metal and unikernels   prisma.io/blog/announcing... · Posted by u/gniting
pier25 · a year ago
I agree but that's not cameCase but PascalCase.
sixbrx · a year ago
Better tell wikipedia: "The format indicates the first word starting with either case,'

https://en.wikipedia.org/wiki/Camel_case

sixbrx commented on Prisma Postgres – Runs on bare metal and unikernels   prisma.io/blog/announcing... · Posted by u/gniting
yen223 · a year ago
Postgres has very counterintuitive behaviour around case-sensitivity.

  CREATE TABLE CamelCase(...)
  SELECT * FROM "CamelCase";
will fail with "CamelCase" not being a table.

That's because the CREATE TABLE statement creates a table named "camelcase", not "CamelCase", despite what you might assume from the query.

sixbrx · a year ago
Thats not particular to postgres, that's the same in Oracle (or any other db following ISO case handling I believe), just with true (quoted) table name being all uppercase instead for the latter but with same error.

You can quote the table name in the create statement to get the camelcase table name. Just remember to quote in both creation and usage or neither, is a good rule of thumb

Deleted Comment

sixbrx commented on Prisma Postgres – Runs on bare metal and unikernels   prisma.io/blog/announcing... · Posted by u/gniting
pier25 · a year ago
I agree but that's not cameCase but PascalCase.
sixbrx · a year ago
Nah - camel's head can be tall just like the hump.
sixbrx commented on Porffor: A from-scratch experimental ahead-of-time JS engine   porffor.dev/... · Posted by u/bpierre
wk_end · a year ago
So - I know this in theory, but avoided mentioning it because I couldn’t immediately think of any persuasive examples (whereas subtype polymorphism is a core, widely used, wholly unrestricted property of the language) that didn’t involve casts or any/unknown or other things that people might make excuses for.

Do you have any examples off the top of your head?

sixbrx · a year ago
Here's an example I constructed after reading the TS docs [1] about flow-based type inference and thinking "that can't be right...".

It yields no warnings or errors at compile stage but gives runtime error based on a wrong flow-based type inference. The crux of it is that something can be a Bird (with "fly" function) but can also have any other members, like "swim" because of structural typing (flying is the minimum expected of a Bird). The presence of a spurious "swim" member in the bird causes tsc to infer in a conditional that checks for a "swim" member that the animal must be a Fish or Human, when it is not (it's just a Bird with an unrelated, non-function "swim" member).

    type Fish = { swim: () => void };
    type Bird = { fly: () => void };
    type Human = { swim?: () => void; fly?: () => void };

    function move(animal: Fish | Bird | Human) {
      if ("swim" in animal) {
        // TSC infers wrongly here the presence of "swim" implies animal must be a Fish or Human
        onlyForFishAndHumans(animal); 
      } else {
        animal;
      }
    }

    function onlyForFishAndHumans(animal: Fish | Human) {
      if (animal.swim) {
        animal.swim(); // Error: attempt to call "not-callable".
      }
      // (receives bird which is not a Fish or Human)
    }

    const someObj = { fly: () => {}, swim: "not-callable" };
    const bird: Bird = someObj;

    move(bird);

    // runtime error: [ERR]: animal.swim is not a function
[1] https://www.typescriptlang.org/docs/handbook/2/narrowing.htm...

sixbrx commented on How to escape Honda's privacy hell   sherwood.news/tech/how-to... · Posted by u/danso
robertlagrant · 2 years ago
They are cheap. 100 years ago it was cheaper to have a full time cleaner than have a car. Now it's the other way round, and with cars a million times better than the ones back then.

I'm not saying they're cheap compared to free. I'm saying they're cheap compared to what you get. 100 years of competition has made cars exceptional.

sixbrx · 2 years ago
full time cleaners aren't cheap either
sixbrx commented on Functional semantics in imperative clothing   rtfeldman.com/imperative-... · Posted by u/lwboswell
still_grokking · 2 years ago
It would be even more "funny" if you'd wrap that `readFile` inside a thunk that gets captured from the environment by the lambda body. Than you'd have a reference to an effect that is supposed to run only inside the lambda but could be executed by external code. Depending on the effect this can have unexpected up to catastrophic outcomes.

That's why Scala introduces so called "capture checking" to make direct style effect systems safe.

https://docs.scala-lang.org/scala3/reference/experimental/cc...

To understand the problem better see:

https://www.inner-product.com/posts/direct-style-effects/#ca...

sixbrx · 2 years ago
I'm pretty sure the thunk would be tagged by the effects of the inner function, so couldn't be called from an external context not declaring those effects. That's what the effect tracking is for.
sixbrx commented on Serious flaws in SQL (1990)   dl.acm.org/doi/10.5555/77... · Posted by u/lioeters
forgetfulness · 2 years ago
The author of the paper invented SQL
sixbrx · 2 years ago
invented the relational model rather
sixbrx commented on Embeddings are a good starting point for the AI curious app developer   bawolf.substack.com/p/emb... · Posted by u/bryantwolf
simonw · 2 years ago
If you ask ChatGPT to give you a cosine similarity function that works against two arrays of floating numbers in any programming language you'll get the code that you need.

Here's one in JavaScript (my prompt was "cosine similarity function for two javascript arrays of floating point numbers"):

    function cosineSimilarity(vecA, vecB) {
        if (vecA.length !== vecB.length) {
            throw "Vectors do not have the same dimensions";
        }
        let dotProduct = 0.0;
        let normA = 0.0;
        let normB = 0.0;
        for (let i = 0; i < vecA.length; i++) {
            dotProduct += vecA[i] * vecB[i];
            normA += vecA[i] ** 2;
            normB += vecB[i] ** 2;
        }
        if (normA === 0 || normB === 0) {
            throw "One of the vectors is zero, cannot compute similarity";
        }
        return dotProduct / (Math.sqrt(normA) * Math.sqrt(normB));
    }
Vector stores really aren't necessary if you're dealing with less than a few hundred thousand vectors - load them up in a bunch of in-memory arrays and run a function like that against them using brute-force.

sixbrx · 2 years ago
i get triggered that the norm vars aren't ever really the norms but their squares

Deleted Comment

u/sixbrx

KarmaCake day1118November 5, 2011View Original