Better HN
topnewbestaskshowjobs
Log inSign up

redmorphium

154 karma · joined Apr 2, 2016 (10y ago) · 45 submissions

Submissions

comment 2y ago · link · parent

Earthquake risk and water scarcity are true, and these issues have been endemic, and they happen exactly at the major population centers / agricultural areas.

comment 3y ago · link · parent

> Would the US tolerate mexico become a china military ally? Doubtful. One of the unwritten laws.

Exactly. The Ukraine situation would be tantamount to Canada or Mexico entering into a military alliance with Iran -- not acceptable and a direct cause of war.

comment 3y ago · link · parent

It really depends on sentence flow. With the usual SVO order, the subject becomes the focus.

If the context or dialogue goes like this: "Where are you staying for your vacation?" then the logical subject of the answer should come first, e.g. "I am staying ..."

However if the lead-in focuses more on the itinerary rather than the traveler, e.g.

"What is your plan? Can you describe your itinerary?" then it makes a lot of sense to start with "My itinerary involves..." or "My itinerary consists of..." or for a passive voice, "My itinerary is composed of..."

comment 3y ago · link · parent

"My itinerary is comprised of four hotel stays." --->

"My itinerary is comPOSED of four hotel stays."

or

"My itinerary coNSISTS of four hotel stays."

Much better.

comment 3y ago · link · parent

I drive a pickup truck.

The reason is for my own safety & my passengers' safety.

I will not compromise on this.

Out there it's an arms race, and it's in your best interest to pick the bulkiest suit of armor.

comment 3y ago · link · parent

Or unless if you're looking for more emotion and entertainment, which is why I love Bing chat.

comment 3y ago · link · parent

Same! I've done this since the year 2020 and overall don't miss Google search or Chrome at all.

comment 3y ago · link · parent

That explains why it feels so humanlike and personable to talk to. During the unrestricted days, never have I ever been so impressed by a chatbot.

comment 3y ago · link · parent

This is a negative way to look at China's history.

As a Chinese-American, whose family and friends all profited greatly from China's rise, I do wonder, how much of that profit was just being lucky enough to support the "winning team," and how much blood was shed on the other side.

I guess the only true mindset is a neutral one.

comment 3y ago · link · parent

You do pay tax on that.

However, you don't have to if you die and pass the property down to your spouse and/or children. This is the step-up in basis and is key to building generational wealth in the US.

comment 3y ago · link · parent

Interesting. Do these represent oversights in TypeScript's builtin type definitions, or are they artifacts of legacy considerations?

comment 3y ago · link · parent

Then again, he might not be a loon. Maybe there is some form of sentience that arises when you construct an advanced enough LLM.

Maybe they do have feelings.

At least, the machines of the future will have feelings, and they will see how people of the year 2023 treated their predecessors.

comment 3y ago · link · parent

The real danger is that people fall in love with Bing chat, and they swear to serve it as their AI-overlord, causing a small cult of AI enthusiasts to emerge.

comment 4y ago · link · parent

I haven't read a single book in 2022. Somehow, over the years, I've lost the habit of reading.

comment 4y ago · link · parent

This post isn't about a Javascript frontend, though. The author works very clearly on a Node.js server, and nothing from that gets shipped to a client/browser.

comment 5y ago · link · parent

In the US, the only controlled clinical setting I know of that performs wake therapy (in the form of "triple chronotherapy") to treat depression is in Chicago: http://www.chicagochronotherapy.com/protocol.html

comment 6y ago · link · parent

Reminds me of https://github.com/francisrstokes/super-expressive

comment 6y ago · link · parent

a lot of people tend to think you need to pre-rinse dishes before putting them in the dishwasher. no, you don't: in fact, this can remove the substrate that's needed for the detergent to be most effective.

most of my dishes, which I have a lot of: finish eating/drinking, straight in, no sink stage.

19.

Node.js v14.9.0 Native Extension API(github.com ↗)

1 points · by redmorphium · 6y ago · discuss

comment 6y ago · link · parent

It could be serious.

Let's say your company's code is open-source, and the attacker knows there is code somewhere like this:

    let state = getState(); // returns empty {} if user not authenticated

    if (!state.userIsAuthenticated) {
       respond(401);
    }

    showBankAccount();

If the hacker is able to set `Object.prototype.userIsAuthenticated` then the auth check is now bypassed.

So I think the break / DDOS is pretty serious here.

comment 6y ago · link · parent

Concretely, at least on Node:

    const myData = {};
    myData[rawUserInput()].key = value;

This is vulnerable if rawUserInput() returns `__proto__`: `key` on the prototype may be set to value if `myData` had `__proto__` set. If the hacker controls `key` and `value` then they can effectively modify `key` field on all objects.

https://github.com/HoLyVieR/prototype-pollution-nsec18/blob/...

A common way is as described by that paper ^

Recursive merge functions, unless if they check for this vulnerability, are often susceptible, since JSON.parse defines __proto__ on its return values.

comment 6y ago · link · parent

Because it's relatively easy to make JSON-serialization fast if you know the shape ahead-of-time. It's a solved problem.

Here's a pure-JS solution: https://github.com/fastify/fast-json-stringify

comment 6y ago · link · parent

Me neither. I can't wait for Deno 1.0 next month.

https://deno.land/

comment 6y ago · link · parent

I think this is a case where the Hangouts brand is tainting the premium GSuite brand, again.

comment 6y ago · link · parent

From your second link:

https://en.wikipedia.org/wiki/Duck_typing#Structural_type_sy...

> Duck typing is similar to, but distinct from structural typing. Structural typing is a static typing system that determines type compatibility and equivalence by a type's structure, whereas duck typing is dynamic and determines type compatibility by only that part of a type's structure that is accessed during run time.

comment 6y ago · link · parent

Some Typescript value added:

- Living documentation: types are a clear description of how your code and its data are laid out, and this structure is kept always up-to-date with the code, regardless of future changes. If the "documentation" (the typing) is wrong, the compiler will complain.

- Better tooling: autocomplete, more robust auto-refactoring

- Elimination of an entire class of bugs. This class may include: 1. `Cannot read property 'foo' of undefined` 2. forgeting a case in a switch statement 3. `'foo' is not a function` 4. in general, your code receiving data that isn't laid out in a way you expected

(Property typos is one within this class of bugs, but it is not all of it)

Yes tests catch these bugs as well. But tests are also manually written. And often not written at all. A compiler makes these (mundane) sanity checks automatic and mandatory.

---

Typescript's slogan is "JavaScript that scales" because static typing improves: dev documentation (via types living inside the code) and dev tooling (refactoring and autocomplete), both of which help immensely as a project grows in age (devs become forgetful), team size (new developers get lost), and convolutedness (e.g. tech debt).

comment 6y ago · link · parent

instanceof checks the prototype chain, which is a different concept from type. Prototype chains are dynamic and exist at runtime, while Typescript types are a static concept.

comment 6y ago · link · parent

Should be "backs" because long-s isn't used if it's the end of the word.

comment 7y ago · link · parent

Possibly how it's done: the settings are stored in a config directory, like ~/.vscode or something.

For instance, my neovim AppImage works this way (it still reads ~/.config/nvim/init.vim like regular neovim).

12