HNHacker News
TopNewBestAskShowJobs

salmonellaeater

910 karma · joined October 16, 2012

submissionscomments
salmonellaeater··on Best practices for writing code comments
One that's missing: comments should explain why a piece of code exists or is written in a certain way (and implicitly, when it can be changed or removed). This overlaps with "explain unidiomatic code in comments", but there can be idiomatic code whose purpose isn't obvious.
salmonellaeater··on Supersonic Trebuchet
It might have to do with the fact that he's using rubber bands to turn the arm, while historical trebuchets used weights. A weight is limited in how fast it can accelerate so you need to use a lever (the arm) to increase the speed.
salmonellaeater··on Rust Moderation Team Resigns
There's an article on The Register about it [1], which includes a helpful link to the archived threads [2].

A quote from the article:

> "I have, on two occasions now, recommended this program to photography and graphic design educators (as an alternative to Photoshop) who told me that they considered it and found it good as software but weren't permitted by their institution to use it in the classroom because of the name."

[1] https://www.theregister.com/2019/08/28/gimp_open_source_imag...

[2] https://web.archive.org/web/20190705030057/https://gitlab.gn...

salmonellaeater··on Show HN: Long Range E-Bike
> but you're also not a motorcycle that deserves its own lane. I have at least one car turn in front of me almost every trip out just because they're misjudging my speed. I get honked and yelled at when on the road because folks get frustrated when I'm using the left-hand side of the right-turn lane as a bike path.

Cycling is my primary mode of transportation, and I've found a couple things help with this:

1. Take the lane any time there's a chance of conflict such as a right hook, and when there is not enough space for a car to safely pass [1][2]

2. Use a headlight all the time, even during the day. This is what motorcyclists do, and when I made this change I noted a major drop in the number of drivers that turn without noticing me.

[1] https://en.wikipedia.org/wiki/Vehicular_cycling#Lane_control

[2] This page has descriptions of several types of collision, with example videos and how to choose a lane position that avoids them: https://iamtraffic.org/engineering/behaviors-and-risk/

salmonellaeater··on How Many Thursdays?
Samoa skipped a Friday in December 2011 [1]. There were 4 Fridays left so "4 or 5" still holds, but using arithmetic to calculate the number of Fridays would have yielded a wrong answer.

This is pretty uncommon with whole days so maybe less important, but thinking in this way (how can I optimize this annoying code) often leads to wrong arithmetic around hours (daylight savings and time zone changes) or seconds (leap seconds).

[1] https://www.abc.net.au/news/2011-12-30/samoa-skips-friday-in...

salmonellaeater··on Does “skipping meals make you live longer”?
In the mouse study, both groups were on calorie-restriction. The difference was whether they fasted or not. "fasted is NEGATIVELY health" is right.
salmonellaeater··on Solving the double (quintuple) declaration Problem in GraphQL Applications
> Most Web Applications are just forms that talk to a database.

And this is why the author is frustrated - GraphQL is designed for larger, more complicated systems. It's overkill for a basic web app like this. In fact, coupling the different declarations together like this defeats the purpose of GraphQL.

One of GraphQL's purposes is to let the different layers and parts of a system evolve independently. For instance, the database schema can be changed without changing the GraphQL schema. A resolver can be changed to pull data from a new service instead of the old monolith. It also affords more custom implementations, where the db schema is not exposed directly to the client or the data is stored across multiple technologies.

There's a larger point here, which is that it's okay to have multiple definitions for things that seem similar. It's okay to have one version of a User for the front-end, a different one in the GraphQL layer, and several different ones with varying details in different backend services. The key is that these Users are different things - for each context, there is a useful definition of User that is different from other contexts [1]. Some systems need security details, some need contact info, some only care about the user id, etc.

It's really important in large engineering orgs to allow these different definitions to vary independently so that teams can make incremental changes without updating every single other system. Hence tools like GraphQL.

[1] https://martinfowler.com/bliki/BoundedContext.html

salmonellaeater··on Greenland’s ice sheet is releasing huge amounts of mercury into rivers
Wayback machine: https://web.archive.org/web/20210524233617/https://thehackpo...
salmonellaeater··on Hatetris – Tetris which always gives you the worst piece
Yeah you can game it to fill in upper levels because it seems to greedily avoid letting you complete the next 1 row.

Here's a game with 7:

ԫقຽࡨதقลƻஸปໃɡЩටʈम౻ටիঅஶΟໃࡦѻ೯ܘݪ௨൜ІݚɪؾÐݪߜගІסञඉȣݣ౫ඞУݸԫؼПݒ౺sܪݚஶsԀŦਛfΔݹटɈເљࠑಜÐݶɺටळ൪ԪؾЂɚலڌෆࡨࢸదQॡభඝଘݒಈలНމࢲඖИܭޜϻϨॷభĐ

salmonellaeater··on America's 1% Has Taken $50T From the Bottom 90%
The framing in the article is ahistorical. The post-WW2 period was a period of exceptionally _low_ inequality. If you look back to just the 1800s there were swings in inequality comparable to the present day. We're now moving back to the historical baseline.

There are some contributing factors to the shift in inequality, a major one being that labor is now oversupplied compared to the post-war period, and the competition is driving wages lower. The U.S. has much higher immigration rates now, which contributes to the oversupply of labor. The late 1800s and early 1900s had similarly high immigration and high inequality. [1]

Whether the historical baseline for inequality is the best amount of inequality is a different question though. It's clear that as redistribution flattens the income curve there is dead-weight loss as highly productive people stop wasting their time doing taxable work. It's also clear that investing in children who would otherwise be malnourished or lack education or healthcare is a net positive for society. It's not clear to me that the current level of inequality is the wrong one - we're admitting a lot of immigrants who are vastly improving their life prospects as a result, the economy is growing, and technology is amazing. Spending more money on health care would have limited benefits [2]. I don't really have a strong opinion on whether inequality should be higher or lower (it's hard to find a good-faith analysis in these terms), but the Time article uses an arbitrary timeframe and doesn't shed any light on the question.

[1] See Ages of Discord for a much more detailed dive into this. http://peterturchin.com/ages-of-discord/

[2] Robin Hanson gives an argument with lots of evidence here: https://www.cato-unbound.org/2007/09/10/robin-hanson/cut-med...

salmonellaeater··on Language Development During Interstellar Travel
> Planets will start to diverge in culture, language, maybe even biology if we look far enough into the future.

This is good! More diversity means more chance of surviving catastrophes, whether they're physical, biological, or memetic. And it makes the world more interesting.

salmonellaeater··on Birdwatch, a community-based approach to misinformation
> As we develop algorithms that power Birdwatch — such as reputation and consensus systems

Consensus is the enemy of understanding. For topics where there is conflicting or poor evidence or that bear on the culture war, I do not want people voting on what is the consensus truth. I want to see all the evidence. We have enough problems with researchers not publishing uncomfortable data; I don't want the little that exists flagged because it conflicts with the average Twitter user's sensibilities.

salmonellaeater··on DRY Is a Trade-Off
It helps a lot to only extract common code that has a clear purpose. If I find myself naming a method "doThisThingThisOtherThingAndLogSomeStuff" then it's not a good refactor. On the other hand, "markStaleRows" or "enforceTreeInvariants" have clear purposes that help future engineers make intelligent decisions about how to use these functions and how they should evolve. I want to build in to the common code answers to the questions "should I call markStaleRows or roll my own code?" and "should I make this code change in the calling function or in markStaleRows?".
salmonellaeater··on [dead]
There's a difference between how the corporation itself acts, and how it expects its employees to act. I'm fine with the company I work for taking public political stances that help its business. I'm not fine with being expected to personally take those stances as part of my job.

If a company expects its employees to take particular political stances, think about how this affects people's ability to work for this company. You might think of your political stances as a personal choice, but a lot of people come from families and communities with overwhelming political leanings that they can't really change. Maybe your family is Catholic or evangelical or atheist, or some of your family members live in a country that one candidate supports more, or your community is hugely affected by offshoring or drug laws. You would alienate a lot of your friends and family if you support the other candidate at your employer's urging.

I think there are several reasons why it's bad to put employees in this situation, but one I find compelling is that it reduces the available employee pool; it's bad for hiring and hence business. Maybe this is on purpose, to filter the employees to ones who are more aligned politically, to make management's lives easier in some way. I don't know. I do know that as a non-partisan, when my employer endorses any political stance, I feel alienated. I'm sure this leads to a loss in productivity and more attrition among employees like me.

salmonellaeater··on Things Unexpectedly Named After People
One I'm fond of is Angel Falls[1] in Venezuela, named after aviator Jimmie Angel.

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

salmonellaeater··on Dates and Times in JavaScript – A New API for Dates from TC39
There is already a JS port of Joda[1] which works well and, crucially, uses all the same names and concepts. Could we just replace the Temporal proposal with this and save a lot of work and confusion?

[1] https://js-joda.github.io/js-joda/

salmonellaeater··on The effectiveness of cloth masks has been misrepresented
> The researchers found that 97% of particles penetrated through cotton masks. Why would a ‘review of the evidence’ neglect this key finding?

This statement in the article is completely disingenuous. The study in question[1] was looking at whether wearing a mask protects the wearer from getting infected. The primary purpose of wearing the mask is to prevent the wearer from infecting others. These are unrelated!

[1] Text of the study: https://bmjopen.bmj.com/content/5/4/e006577.full

salmonellaeater··on Show HN: Tail Recursion Optimization for the JVM
I've been hoping for tail call elimination[1] on the JVM for a long time, and historically it has been blocked by a security requirement[2]. Changing the number of stack frames between two calls would cause an error. Apparently that check is no longer there so TCE is possible!

[1] Using the word 'optimization' suggests that eliminating tail calls is optional, but for it to be really useful it has to be guaranteed. If you're writing in recursive style, your program becomes instantly incorrect if TCE goes away because many acceptable inputs will start causing stack overflows.

[2] See this answer: https://softwareengineering.stackexchange.com/a/272086

salmonellaeater··on How porting to TypeScript solved our API woes
> You lose flexibility when suddenly everything is locked to each other by name.

This is only true of nominally typed languages (such as... most typed languages). TypeScript is a notable exception: values just have to have the same property names and types and they'll fit. The language's philosophy is basically to describe the way people write JS rather than prescribe how people should write it, so idiomatic JS is usually easy to express in TypeScript.

salmonellaeater··on More nurturing reading environment may stimulate brain development in children
The article doesn't mention anything about what the researchers controlled for. Some other explanations that fit the data:

1. Parents who take good care of their children in other ways also tend to read to their children (perhaps because they're conscientious and have read other research that says reading helps brain development, so they read to their kids). It's actually the "take good care of their children in other ways" that makes the difference, and reading just correlates.

2. There is a shared genetic factor between parent and child. Parents with this factor are more likely to read to their children. Children with this factor score better on literacy tests. Any factor that affects intelligence or personality would fit the bill.

3. Reading doesn't affect language skills, but they are instead caused by other environmental or genetic factors. Children who have factors that lead to good language ability enjoy hearing stories, and their caregivers adapt by reading to them more. Children without those factors react poorly to being read to, so their caregivers read to them less.

A randomized controlled trial would tell us much more about whether reading actually causes any later outcomes.

salmonellaeater··on Why Garmin watches have become common in some segments of tactical aviation
Consumer GPS devices have a speed and altitude limit [1], which I initially thought should preclude using it in a fighter jet, but I was wrong (only something extreme like an SR-71 would hit this limit):

> ...a limit placed on GPS tracking devices that disables tracking when the device calculates that it is moving faster than 1,000 knots (1,900 km/h; 1,200 mph) at an altitude higher than 18,000 m (59,000 ft).[3] This was intended to prevent the use of GPS in intercontinental ballistic missile-like applications.

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

salmonellaeater··on Early-career setback and future career impact
The paper tests this hypothesis and finds that there's probably a causal effect:

"...these results demonstrate that the screening effect may have played a role, but it appears insufficient to entirely account for the observed difference between near misses and narrow wins."

salmonellaeater··on Be wary of functions which take several parameters of the same type
Destructured object parameters make this easy in TypeScript (and JS):

  async function copyFile({
    source,
    dest,
  }: {source:string, dest:string}): Promise<void> {
    // ...
  }

  await copyFile({source: 'presentation.md', dest: '/tmp/backup'});
salmonellaeater··on On the Impact of Programming Languages on Code Quality
Of note is that these are all associations. It's possible the associations are all due to selection effects (or even that the "better" language are actually worse but their effects are reversed by selecting for programmers who are better).

In the early days of Python, some employers used it as a way to filter for candidates who were ahead of the curve. I believe Paul Graham mentioned Lisp being good for attracting better programmers, although I can't find the reference anymore [1]. If there's any value in this kind of filter, the effects will show up in the programmers' output.

1. I'm having a hard time finding references for these assertions; the best I've found is some Reddit posts and Joel Spolsky's post on finding great developers: https://www.joelonsoftware.com/2006/09/06/finding-great-deve...

salmonellaeater··on America Finally Admits Recycling Doesn’t Work
The root of the problem is that the environmental costs of producing difficult-to-recycle plastic are not being paid by the manufacturers. A solution is to make manufacturers internalize those costs: require a deposit or fee for every gram of plastic manufactured or imported. Scale the fee to cover the actual cost of recycling.

Manufacturers that start to use more environmentally-friendly materials will have lower costs, and will be able to sell their products at a lower price, leading to more market share. There will still be some use of difficult- or impossible-to-recycle plastics, but we as a society can express our distaste for storing garbage by adjusting the fees.

salmonellaeater··on Women: Learn to Program This Summer
The plaintiffs lost.

> Judgment was entered as follows: Judgment entered for FS ISAC Inc and against Allison, Rich ;Hamilton, James

https://unicourt.com/case/ca-sd-allison-vs-fs-isac-inc-86101...

salmonellaeater··on Cleveland.com’s ‘right to be forgotten’ removes names from some crime stories
I don't necessarily disagree with you, but I can offer a third purpose for jail that I think is the most important: it keeps people who are likely to harm others from doing so.

This idea is in concordance with the idea of rehabilitation (both separation and rehabilitation can happen at once), and it accommodates cases where the convicted is mentally ill.

salmonellaeater··on For a baby’s brain to benefit, read the right books at the right time
> After three months passed, the families returned to our lab so we could again measure the infants’ attention to our storybook characters.

The researchers are rash to think that an effect observed after three months have passed will still be observable after five years or twenty. The psychological literature is full of examples of interventions that raise intelligence in the short term and have no long-term effect [1]. To date, I'm not aware of any childhood intervention (aside from adequate nutrition) that has an appreciable effect on adult intelligence.

[1] https://www.researchgate.net/publication/284123208_The_envir...

salmonellaeater··on Mastodon is big in Japan, and the reason why is uncomfortable
Reddit cannot allow lolicon or Nazi imagery because it's illegal in some countries, and the company would risk fines by allowing it. Mastodon has no such problem as long as the server is in a country that allows the content.

Mastodon also avoids the problem some Youtube creators are facing with demonetization. If a video is controversial, Youtube may decide not to show ads on it at all (nor pay the creator) because some advertisers don't want to be associated with the content. I don't know if any Mastodon servers use advertising at all, but if they did they could be more fine-grained in matching content to advertisers. A similarly federated video-sharing network could serve controversial video creators.

salmonellaeater··on I'm a creep. I'm sorry
Assuming McClure follows through by 1) refraining from harassing any more people and 2) making things right with the particular people he hurt, it doesn't matter whether he is sincere or not. How would you even tell what's in his mind? What matters is that he has changed the common knowledge of what behavior he publicly endorses (or in this case, condemns) [1]. His apology is proof of sorts that he will follow a better standard of behavior, because now he stands to be treated as a liar and hypocrite on top of the normal punishment if he backslides.

From our side, if we as a community continue to denigrate him even after he has done the most he possibly could to change the moral consensus on this topic for the better, we're going to discourage others from apologizing and drive them to deny. Why bear the cost of admitting you're wrong if there's no benefit?

[1] I highly recommend Rational Ritual: Culture, Coordination, and Common Knowledge by Michael Suk-Young Chwe for a game-theoretic exploration of topics like this. http://press.princeton.edu/titles/9998.html

← PreviousPage 2 of 6Next →