Better HN
topnewbestaskshowjobs
Log inSign up

wireprotocol

7,244 karma · joined Sep 25, 2010 (16y ago) · 2,593 submissions

Submissions

comment 6y ago · link · parent

The U.S. seems to have dropped the ball on testing. That's really the only mistake that seems likely to matter that anyone might have conceivably not made.

Global supply chains are a fact of life. The strongest fighter against over-dependence on China is Trump, and he was ridiculed as "protectionist". Trump's travel restrictions were similarly ridiculed.

Strategic stockpiles are spotty. Sometimes the thing you stockpile is what you need; often not. Did every other country have a stockpile of masks except the US?

comment 6y ago · link · parent

Yeah. I feel like the U.S. is always in the spotlight for criticism, but there are an awful lot of mistakes to go around. People just don't handle crises well.

comment 6y ago · link · parent

Blaming capitalism seems weird. Capitalism is not the only economic system with just-in-time or globally-interdependent supply chains. And capitalism can't explain why our strategic government stockpiles were never replenished.

There's a tendancy to compare the results of a system to what a wise, common-sense person with 20/20 hindsight would do if they were in charge. But that's not how things work. People in a system often fall victim to all kinds of bad assumptions, often thinking that others are wholly or partially responsible for dealing with a particular risk.

It looks like the US was caught flat-footed. It's too early to say how resilient we are, though. And it's way too early to start trying to push specific political angles like the idea that some mythical-but-non-specific non-capitalist system would have served us better.

comment 6y ago · link · parent

It's hard to optimize algorithms while also making them general and composable. We are forever reimplementing good ideas in different combinations of systems.

comment 6y ago · link · parent

This reminds me somewhat of the main postgresql allocator. It keeps segregated freelists for smaller allocations, and then larger allocations are handled by malloc.

comment 6y ago · link · parent

I thought if too many different people bought a stock, you had to make it public. Is that true? How do they keep their stock private?

comment 6y ago · link · parent

It's two different philosophies of publishing. Markdown mixes style with meaning. Something like latex separates meaning from style.

comment 6y ago · link · parent

We need to look forward here. It's way too early for a retrospective.

And let's have some humility here. No matter what such a retrospective shows, it's pretty hard to learn any real lessons from this kind of thing. We will almost certainly just overfit our institutions to fight the next coronavirus; I doubt we will better at handling crises in general.

It's still possible that the US will have a reasonable outcome. Let's do what we can to make that happen and make use of our advantages. More cars and less public transport may make physical distancing more effective.

comment 6y ago · link · parent

It seems like the answer is "more science".

Given how the virus is moving now, couldn't we have a pretty nice study completed in a few weeks?

comment 6y ago · link · parent

I think the general consensus is that it's fine for bad companies to go under. But we have a situation here where a lot of reasonably good companies could go under just because of the social distance on a global scale.

The 2008 crunch was almost purely financial. Let's get past this pandemic and then see where the businesses shake out financially.

comment 6y ago · link · parent

For basic goods like toilet paper, production hasn't fallen, and consumption hasn't risen. Distribution is still adequate for the amount of production and distribution, so it's not directly the problem, either.

The problem is buffering. Normally, buffering happens within the supply chain -- the back rooms of stores, loaded in trucks, warehouses, distribution centers, and the factories themselves. Now, we are telling everyone "buffer at home so you don't need to go out so much". But the problem is, buffering is much less efficient at the end of the chain, so you need to buffer a lot more. That's causing a short-term strain on production and distribution.

Blaming selfishness or gouging probably doesn't do much to help this problem. My guess is that the biggest problem is the discrepancy between how much stuff would be needed to buffer within the supply chain versus how much stuff is needed to buffer at the end of the supply chain (i.e. at home).

Worse, because it's a temporary buffering problem and there's no real increase in consumption, there's little incentive for production to increase now to alleviate it. Any increased production/distribution now just means less demand later when people start to work through their caches at home (and stop buying for a while).

So the only way to alleviate this is to allow the prices (that manufacturers charge) to rise, which will give manufacturers a cushion against the inevitable slump in the future. That's not very popular and not worth the brand damage, so it won't happen.

The good news is that I don't think this will last more than another few weeks. Gougers will stop buying at some point because they don't want to get stuck with a huge supply of toilet paper and no channels to sell it. And the home caches will fill up.

EDIT: this analysis has nothing to do with things like facemasks, where consumption has dramatically risen.

comment 6y ago · link · parent

This article is specifically about viruses, not bacteria. It claims specifically that water alone is not effective against viruses like COVID-19, because they stick to the skin too strongly. It also claims that soap and water together are very effective by ripping the virus apart chemically.

Additionally, streams are not generally safe to drink from, despite how pristine they may look[1].

[1] https://www.cdc.gov/healthywater/drinking/travel/index.html

comment 6y ago · link · parent

It's one thing to criticize religious impositions on a secular activity (like addiction recovery). What you have just done is criticize religious people as a group, and claim that they are abusive.

Criticize ideas and policies; not groups of people.

comment 6y ago · link · parent

Another way to look at this is how far back you go trying to prevent crime by punishing "pre-crime" activities. For instance, certain kinds of meetings might lead to a criminal plot; or hiding certain kinds of things; or publishing information that might be used by criminals.

comment 6y ago · link · parent

"I'm still not comfortable with the fact that the government will require people to attend what is essentially a religious service as criminal punishment"

Maybe there's some kind of slippery slope there, where they eventually start sending you to church for a parking ticket. But we don't seem to be sliding to that conclusion very quickly; so if it works, just go with it.

If you want to make a big federal case out of it, you could probably win it. But I honestly don't see how anyone wins with that outcome.

comment 6y ago · link · parent

I don't know if that's a good way to look at it. It's not just "bears" selling when you have a big drop. It's people who need the money for something and are worried about liquidity.

Trading halts may or may not fix that, but that's their purpose.

comment 6y ago · link · parent

But low oil prices are an effect of a recession, not a cause.

comment 6y ago · link · parent

Marginal costs are lower for Aramco, right?

comment 6y ago · link · parent

This might run afoul of the Carpenter decision, right? It basically held that asking for cell tower location data is a search of the person rather than a subpoena of records.

EDIT: maybe not. This one had a warrant rather than a subpoena. I'd still be interested in the interaction though.

comment 6y ago · link · parent

In theory, this is why there are stages with increasingly-high standards. Hearings, grand juries, etc.

In practice it doesn't always hold up very well.

Do you have an alternative suggestion? Would the government always pay for the entire defense? Or reimburse if the accused is acquitted?

This is also why gun violence restraining orders are bad. Large costs to the defendent with no standards or hearing or even an accusation of a crime.

comment 6y ago · link · parent

Ah, you got me!

comment 6y ago · link · parent

Option types can require exhaustive matching. So where there can be a NULL, you would have to address it. The syntax can make it pretty easy to handle typical cases.

comment 6y ago · link · parent

I'd like to add that, in the above example, you get bitten by NULL semantics even though you don't have any NULLs in your data at all.

So if you don't start out with any NULLs, and you have complete and unambiguous knowledge of your entire data set, how does "unknown" get injected into such an innocent-looking example?

comment 6y ago · link · parent

I don't recommend that setting, personally. If you do use it, I recommend it only for migration purposes with the idea that you go back to the default setting soon.

Configuration settings that change SQL semantics are just too dangerous.

From the official docs:

"Note that this option only affects the exact form = NULL, not other comparison operators or other expressions that are computationally equivalent to some expression involving the equals operator (such as IN). Thus, this option is not a general fix for bad programming."

https://www.postgresql.org/docs/12/runtime-config-compatible...

I know it seems tempting to use this setting as a convenience, but I strongly recommend against it.

comment 6y ago · link · parent

Well, it's many problems, that's the fun of the example.

But yes, I think left join is fundamentally about grouping, and grouping would be better solved with set-valued attributes or relation-valued attributes.

I wouldn't call that "hierarchically-structured data" because that has the connotation that the data is actually stored in a hierarchy, which I think is generally a bad idea (though not always).

comment 6y ago · link · parent

I don't think that's quite fair. It's pretty easy to know that COALESCE exists and still make the mistake.

A language should help you avoid making mistakes, not trick you into making them. The path of least resistance should be the safest and most normal thing, and SQL fails here.

comment 6y ago · link · parent

You are correct. The coalesce can go inside or outside the SUM().

comment 6y ago · link · parent

DATE_TRUNC('year',...) cuts out the lower-order parts of the timestamp, so I believe my query is correct. More precisely, I believe my query is incorrect in the way I intended but not in other ways ;-)

comment 6y ago · link · parent

A left outer join duplicates the tuple on the LHS for each tuple on the RHS. It's almost exclusively used for grouping operations, so then you need to group the LHS tuples back into a single tuple and aggregate the RHS.

But that's just weird -- in a normal programming language you would never duplicate the tuples and make this mess; you would keep a single tuple on the LHS and group the RHS into a set (or array/list). Then you'd aggregate the set on the RHS. That model is simple because an empty set is a value with known semantics (sum of an empty set is zero), whereas a half-NULL row is just a hack.

Before someone asks, this has nothing to do with declarative/imperative, and nothing to do with some purity of the relational model. You can still have a declarative relational model with values that happen to be sets (or even relations).

comment 6y ago · link · parent

Quiz:

    -- Find all customers with total orders
    -- less than $100 in 2019
    SELECT c.name
      FROM customers c LEFT JOIN orders o
      ON (c.id = o.customer_id)
      WHERE DATE_TRUNC('year', o.ts) = '2019-01-01'::timestamptz
      GROUP BY c.name
      HAVING SUM(o.price) < 100;
Can you find the problem?

[ SPOILER ]

The problem is if there is a customer with no orders. The left join will produce NULLs for the attributes of "orders", and SUM() will sum them up to NULL because it thinks NULL means "nothing". The predicate "NULL < 100" will then think the NULL means "unknown" and produce the result "unknown". Then, the HAVING clause treats NULL like FALSE, and does not produce the row.

1
91011
87