HN user

venning

1,246 karma

Christopher Venning

Posts5
Comments248
View on HN

It may be worth pointing out: these are equivalent comparisons when testing for even numbers but cannot be extrapolated to testing for odd numbers. The reason being that a negative odd number modulus 2 is -1, not 1.

So `n % 2 == 1` should probably [1] be replaced with `n % 2 != 0`.

While this may be obvious with experience, if the code says `n % 2 == 0`, then a future developer who is trying to reverse the operation for some reason must know that they need to change the equality operator not the right operand. Whereas, with `n % 1 == 0`, they can change either safely and get the same result.

This feels problematic because the business logic that necessitated the change may be "do this when odd" and it may feel incorrect to implement "don't do this when even".

I really disfavor writing code that could be easily misinterpreted and modified in future by less-experienced developers; or maybe just someone (me) who's tired or rushing. For that reason, and the performance one, I try to stick to the bitwise operator.

[1] Of course, if for some reason you wanted to test for only positive odd numbers, you could use `n % 2 == 1`, but please write a comment noting that you're being clever.

From the linked study: [1]

Total operational water "footprint" of data centers in 2018: 5.13 * 10^8 m^3. Of that, indirect consumption through electricity generation: 3.83 * 10^8 m^3, or 74.7%. And indirect consumption related to water and wastewater utilities (non-electicity production): 4.50 * 10^5 m^3, or 0.09%.

The study then does a reasonable job of discussing the concerns of building data centers in water-stressed places.

This article seems to be another "didn't read the study, saw big number" thing.

[1] https://iopscience.iop.org/article/10.1088/1748-9326/abfba1 (PDF page 7, section 3.1)

... 1906 ... to 1932 ... as the period of her infection of others ... That's still not 38 years ...

I never stated that she infected others for 38 years. Being an asymptomatic carrier does not require continually infecting others, only that the carrier maintains the infection without showing symptoms. [1] Additionally, the NIH article isn't complete in listing likely infections, as evidenced by comparing it to the Wikipedia article. Nor does is state that she continued to infect others until her paralysis in 1932.

As for the 38 years, the Wikipedia article notes 1900 as the first known, likely infection of a family she worked for. Then, from the NIH article:

A post mortem revealed that she shed Salmonella typhi bacteria from her gallstones ...

Her death (and, presumably, post mortem) was in 1938. "Bacterial shedding" [2] implies infection and, thus, being a carrier in 1938, though asymptomatic. I arrived at 38 years by considering her likely a carrier from 1900 to 1938.

[1] https://en.wikipedia.org/wiki/Asymptomatic_carrier

[2] https://www.google.com/search?q=bacterial+shedding

I think even the VAT is added on checkout to the price

No. VAT in Germany is not charged to American servicemen and women and dependants. This is covered under the Status of Forces Agreement (SOFA) [1]. One may also receive reimbursement of VAT paid on the economy, though that is subject to some restrictions at around €2500, I believe. There are specific rules on cars. The actual forms for receiving reimbursement are onerous enough that VAT forms aren't often used outside of major purchases.

I went to high school on an American military base in Germany in the 1990s. At least then, the major items of note were jeans and gasoline/diesel (though, I had a teenager's bias). Both were subject to significant taxation on the economy that Americans didn't need to pay on base. In practice, this meant there were some restrictions on how many jeans people could purchase at once, to prevent Americans from reselling them to the Germans. There were also special booklets that Americans could buy on base that had little tear-out pages; each page could be exchanged for a certain number of liters of fuel at, specifically, Esso gas stations on the economy. While fuel prices on base (the same rate as the booklets) were considerably more expensive than in the US, it was still far cheaper than off base.

Most of the goods available in stores on base were imported from the US [2]. All prices and payments were in dollars. We did not use pennies on the base, since they were too expensive to import. All bills/receipts were rounded to the nearest five cents [3].

I was told by a teacher at the time that the Rhine valley had "the single largest concentration of Americans outside of America." That specific area of US installations has grown in the intervening 20 years both due to the wind down of smaller Cold War-era bases scattered throughout Germany and due to the current conflicts the US is involved in, of which, most require US forces to deploy via Germany.

[1] https://en.wikipedia.org/wiki/Status_of_forces_agreement

[2] As a major exception, I believe the bases purchased civilian fuel from German suppliers directly as part of the taxation agreement.

[3] The base bank would always do business to the penny which, over the course of years, would create a small pile of useless copper in every home.

...Americans use 500 million plastic straws a day ... hundreds of thousands of straws are found littering coastlines around the world each year...

If "hundreds of thousands" means 500 thousand, then this is saying that 0.00027% of those plastic straws are found on coastlines.

I understand that there are problems with both of those statistics, but it still seems a bit odd to publish them like this (there are 13 words between those numbers).

Again, the "500 million" number is likely wrong (as OP references, [1]) and the "hundreds of thousands" number was probably the author taking a spitball at something that there aren't real statistics for, but they still chose to print it.

[1] https://www.nytimes.com/2018/07/19/business/plastic-straws-b...

EDIT: In reference to [1], being within an order-of-magnitude is pretty impressive for a 9-year-old.

As a counterpoint, I found it to be very helpful in understanding the information presented.

The animals breakdown (Chart B) contains 10 values, ranging from 1 Gt to 0.002 Gt. That's a difference of 500x. That's a bit hard to perceive in a one-dimensional chart.

The two-dimensionality of a Voronoi makes it easier to perceive, particularly in a small image (as is presented on a phone's screen), at least to me. I imagine this is mostly due to a 2D chart consuming far more physical pixels to convey the same information.

A stacked bar chart of the same information: [1]. Admittedly, I didn't take time sprucing up that chart, but I find it extremely hard to intuit from and can't even see the value for "wild birds".

[1] https://www.meta-chart.com/share/untitled-23893

I can't find the source for this but, as I recall, HN has a system where certain new or recent submissions are artificially promoted to a low position on the front page for a few minutes to see if they gain traction naturally. Also, I believe that some people (perhaps just dang and sctb, I don't know) can manually add to the pool of submissions that the algorithm will randomly draw from to temporarily promote. They don't have the power to push them directly to the front page, only to give them a chance to be selected for a few moments of spotlight.

Forgive me if I got some of that wrong, or if the system as a whole does not work like than anymore. Not exactly what was asked, but maybe helpful to someone.

EDIT: Closest source I can find: https://news.ycombinator.com/item?id=9866140

It references a long comment from dang three years ago regarding this as an "experiment": https://news.ycombinator.com/item?id=8790134

As a former car salesperson, I can tell you that, in the state of Virginia, car sales contracts are not valid until the customer has physically taken possession of the vehicle. As a result, we were always very reticent to sell a car "off the truck". Customers would swear up and down that they'll definitely follow through but, most of the time, they'd just never come to pick up the vehicle and we'd be stuck trying to unwind a contract. I'm sure this is common in a lot of states.

Last I read, Tesla is holding $985MM in customer deposits. [1] Now they are asking for, I'm assuming, full payment for cars starting at $48,000. However, the soonest one can be delivered is in "two to four months" and that's only for the trim that starts at $64,000. Plus there are now quite a few options costing in the thousands.

For every 10,000 customers that place an order of the, likely, several hundred thousand current deposit holders, that's somewhere around $600 MM in additional customer money that Tesla would be holding. For every 10,000 customers. But that money won't deliver a physical product for months.

Is this a play to make billions more in deposit money? Is this how they plan to take no more investment/debt this year?

Is there anyone on the list looking to buy one that can confirm if this requires full payment?

EDIT: Apparently, the ask is for an additional $2,500. [2] That would make $25MM per 10,000 customers that place an order.

Putting forth the additional $2,500 also removes the ability for you receive a refund of the original $1,000 deposit if you do not cancel within three days.

[1] https://www.bloomberg.com/graphics/2018-tesla-burns-cash/

[2] https://www.cnbc.com/2018/06/28/tesla-model-3-orders-cost-25...

You started by questioning jail time, then brought in the SEC. Now you're stating the SEC doesn't deal with industrial sabotage and talking about fines, which no one else mentioned.

As for actual jail time, here [1] is a single engineer in California (same jurisdiction as Tesla, presumably) that was sentenced to 15 years. Also, $28 million in fines, which is what he earned for his espionage. Another engineer got 2.5 years for the same incident [2]. And this was the very first instance of people being convicted under the Economic Espionage Act you mentioned. Further reading: [3].

I don't think the facts support your position.

[1] http://www.latimes.com/business/la-fi-espionage-sentence-dup...

[2] https://www.law360.com/articles/571212/ex-dupont-engineer-ge...

[3] https://www.justice.gov/opa/pr/two-individuals-and-company-f...

the hundreds of $1000 spent just defending his short position through hiring former Herbalife people, funding legal campaigns, funding support groups

You are describing entirely legal actions. Sabotage and (this form of) industrial espionage are very much illegal. There's quite a difference there.

a few $100k is pocket change for these guys

But a few billion dollars of market cap and a few years of jail time are the price of being found guilty of what Musk is insinuating.

That's not a small leap.

The point I was trying to make is that, in practice, everyone will run at full optimization, since that's the point of something like Closure. It's not gzip where "good enough" exists sometimes. JavaScript compilers are all about saving users time. Because of that, offering a product that breaks deployment cycles becomes a non-starter.

There are, essentially, an infinite number of optimizations you could make to Closure, though probably several thousand are reasonable. Every marginal optimization needs to run though the entire AST and many of them require prior optimizations to be re-run. As 'cromwellian pointed out, the number of passes is the dominating factor in speed. At some point, it's no longer worth it.

It's been a while since I looked at Closure's codebase but, as I recall, the individual optimizations are not loosely overlaid, but somewhat dependent on each other and specifically ordered, so "lower optimization levels" would involve manually deciding which optimizations could be removed from the path without adversely affecting the others. But I could be wrong on that.

More importantly, this is a compiler targeted towards one-time compilations to permanently reduce large JavaScript payloads per millions of downloads, and not a compiler that is required during development. As such, blunting its effect to save a few seconds is pretty meaningless, so I doubt the maintainers ever considered "less optimization".

That said, it does allow for "dangerous" but more aggressive optimizations that require assurances from the JavaScript or you'll break the code. In that way, Closure offers user-specified levels of optimization.

EDIT: A secondary and less-obvious effect is that using a smaller number of total optimizations produces more internally-consistent code, as opposed to producing unusual and internally-unique constructions for rare optimizations. Internal consistency is great for the next step after compilation: run-length compression.

a global optimizing compile tends to be dominated by the O(f(x)) of the optimization passes

Really good point. Closure Compiler, at least historically, rejected many valid optimizations because they aren't common enough to justify growing the rate of number of passes.

If you rewrote something like Closure Compiler in C, I doubt you could get more than a 2x-4x speedup.

Closure Compiler is written in Java. I don't know exactly where the state of the art of JIT is right now, but I would bet C wouldn't be that much faster.

Towards the end of the Introduction, they have a paragraph where they discuss how the study intends to test the "greater male variability hypothesis", something I had not heard of before.

They reference other studies which have show greater variability among males in: cognitive ability, academic achievement test results, personality, athletic performance, birth weight, and adult weight.

In which case, continued usage of obsolete headers is to Fastly's benefit. Turning them off saves the customer money.

For what it's worth, the author is listed as a "Developer Advocate".

No. Object.keys() does not allow iteration on strings or `arguments` or HTMLCollections. It only returns an array of indices not values. You can call Array#forEach() on the resultant array, but you'd need another iteratee signature to process them than you would for a proper forEach or for Lodash's method, or you'd have to dereference each element manually. At that point, you might as well run a for loop, since the code will be nearly identical.