Better HN
topnewbestaskshowjobs
Log inSign up

mediumdeviation

1,791 karma · joined Oct 27, 2012 (14y ago) · 297 submissions

Submissions

comment 3y ago · link · parent

I have to say their own homepage does not inspire confidence - it currently shows three sample search results, and clicking on the first, "best headphones" has quietheadphones.com, a parked domain, as the fourth result. For comparison DDG shows a bunch of headphone review sites, all of which seems reasonably reputable.

In fact all three of these have some odd results -

- "steve jobs"'s fifth result is a YouTube video of Steve Jobs at a 2003 conference, but the result is linked to a seemingly random 2606s timestamp and it is right below the Videos section with much more relevant videos - "python exceptions"'s second result is a blog post about Python exceptions being anti-patterns. I've not used Python in a while but that seems very wrong, and a terrible result to show to someone who might be learning Python or looking up how Exceptions work.

comment 3y ago · link · parent

Russia shot down the satellite in November 2021, so that is very unlikely to be their motivation unless they have some extraordinary level of insight that forecasts Starlink's role in the conflict.

comment 4y ago · link · parent

Also someone proved this experimentally just by tweeting out the same things that Trump did and got banned https://arstechnica.com/tech-policy/2020/06/bot-banned-from-...

comment 4y ago · link · parent

It’s the same format as ‘100 years ago people thought we would have flying cars by now’. 13 years ago a Japanese author thought that by 2022 we would have ‘full dive’ VR technology indistinguishable from reality (that also had a fatal design flaw of being able to kill its wearer). Today we’ve only managed to reproduce the fatal design flaw, not the amazing VR experience.

comment 4y ago · link · parent

Similar but worse, the Horizon scandal in the UK where bugs in Fujitsu stocktaking software sent post office workers to jail and ruined lives because administrators took the software's side when it found accounting shortfalls https://www.bbc.com/news/business-56718036

comment 4y ago · link · parent

For a real world example of this, GitHub uses server-side rendered fragments. Working with low latency and fast internet in the office, the experience is excellent. Trying to do the same outside with mobile internet, and even with a 5G connection, the increased latency makes the application frustrating to use. Every click is delayed, even for simple actions like opening menus on comments, filtering files or expanding collapsed code sections.

I'm actually worried about developers in developing countries where mobile internet is the dominant way to access the Internet and GitHub is now the de facto way to participate in open source, that this is creating an invisible barrier to access.

comment 4y ago · link · parent

That’s strangely a whole 3 percentage points higher than the number of Americans who self identify as ‘evil’ (on the D&D alignment chart) - see 4:47 at https://fivethirtyeight.com/videos/where-americans-fall-on-t..., although at this point we’re probably well within polling margin of error.

comment 4y ago · link · parent

But you can already license your IP using a contract or a license, and that contract can be inked in paper or done digitally. You can even give exclusive license or transfer your rights. The only difference using the blockchain is, well, the blockchain.

This is an even less interesting use of the blockchain than Bitcoin - at least with Bitcoin there is no longer a central authority needed to prevent double spending. Here the blockchain is facilitating a transaction that can already be done without some authority to recognize it.

comment 4y ago · link · parent

> Manderin has non-gendered pronouns referring to a person

That's only when spoken, because 他 and 她 are homophones, no? Otherwise when written it is almost exactly the same as English in how pronouns are gendered with he/she/it.

comment 4y ago · link · parent

Specifically 15 seconds after the code is loaded - since this is a polyfill this means immediately after the page loads - it checks if your browser is in one of Russia's timezones, and alerts the message if it is. It then tries to use window.open to open a change.org petition (user? I'm wary of checking the link), but because this call is triggered by a timer and not user interaction, most browser's popup blocker will block it by default.

comment 4y ago · link · parent

The version was released 22 days ago. npm has a list of dependents https://www.npmjs.com/browse/depended/event-source-polyfill.

Gatsby is the big one, and it doesn't use a lockfile or pin the specific version so any new installation will receive the bad version, but this package is to only be used in development environment https://github.com/gatsbyjs/gatsby/blob/441a5af8e665256c7703....

comment 4y ago · link · parent

> for instance, any node with class skyscraper is considered hidden (maybe the logic is that those elements are shrouded by clouds).

Ha, you wish. Skyscraper is the name of a standard Internet advertising unit. It’s fairly common for adblockers to block it. https://www.marketingterms.com/dictionary/skyscraper_ad/

comment 4y ago · link · parent

I'm surprised nobody else has called this out - implementing browser APIs in a non-browser runtime seems like a really bad idea. Take a look at https://developer.mozilla.org/en-US/docs/Web/API/Window - the submitted article seem to have demonstrated literally the only APIs that make sense to implement in a terminal. What would happen when a library tries to call window.location or window.history? Almost none of these map neatly to any possible implementation on the server or in a scripting environment.

comment 4y ago · link · parent

This is somewhat misleading - the definition of M1 was changed in May 2020, so numbers before and after are not directly comparable. See https://fredblog.stlouisfed.org/2021/05/savings-are-now-more.... It’s best to link directly to the page which is interactive and describes the actual components of M1 instead of just the image https://fred.stlouisfed.org/series/M1SL

comment 4y ago · link · parent

Other than the historic messiness the other comment raised, the DOM API is just... not good. I don't think it's surprising developers don't want to bother with fun stuff such as

- The only way to remove a node is node.parentNode.removeChild(node), until you get past IE11 then you can use Element.remove() https://developer.mozilla.org/en-US/docs/Web/API/Element/rem...

- Text node normalization - because there are separate representation of the exact same HTML https://developer.mozilla.org/en-US/docs/Web/API/Node/normal...

- NodeLists are almost but not quite arrays. They could also be live or static but you can't inspect it directly to tell which is which https://developer.mozilla.org/en-US/docs/Web/API/NodeList. Similar almost-array nonsense with HTMLCollection.

- Historically IE and Netscape/Firefox supported two completely different set of API and it was a horrible mess. You can still see remnants of that API war in functions that does almost but not quite the same things such as textContent vs. innerText https://developer.mozilla.org/en-US/docs/Web/API/Node/textCo...,

comment 4y ago · link · parent

https://nitter.42l.fr/blocks (the main nitter.net is down, this just the first mirror instance from https://github.com/zedeus/nitter/wiki/Instances)

comment 5y ago · link · parent

It only applies to purchasing a resell flat. Renters are not affected by this.

comment 5y ago · link · parent

That's not the case here - Singapore is majority Chinese. The sentiments you see are more run of the mill xenophobia - Chinese mainlanders are here to take our jobs, they're loud and unhygienic, they can't speak English, their Chinese has a different accent, etc. You won't hear it being said to your face, but these are not uncommon views.

comment 5y ago · link · parent

I'm surprised - China's recent foreign policy certainly has not endeared it to South East Asian countries, but even before then mainland Chinese were not exactly treated with open arms in Singapore. You probably won't find it said to your face, but xenophobia against foreigners from China and India is definitely not uncommon.

comment 5y ago · link · parent

> Live in Singapore in reality is no more or less 'democratic' than live in Japan or Taiwan or SK.

You absolutely will not be arrested for holding up signs outside government buildings[1], or questioned by the police for reading a book on the train as a protest[2]. You would not be sued to bankruptcy for making what would be considered political speech in these other countries. Or just about anything on this list https://twitter.com/kixes/status/1174024357443600384?s=21.

Singapore is absolutely less democratic - there's no need for scare quotes.

[1]: https://twitter.com/kixes/status/1353999081287245824?s=19

[2]: https://www.todayonline.com/singapore/police-question-one-ma...

comment 5y ago · link · parent

I would not completely blame it on culture. There are practical upsides to having a large number of packages - using a dependency instead of duplicating code means the resulting code is smaller, and splitting large packages up allows you to only include specific functions you need. This is important for the web, which is a lot more size sensitive.

Nowadays tree shaking means that having a large package with lots of smaller function should work better, especially since adding an import incurs its own overhead, but a lot of older packages are stuck on the small packages model.

comment 5y ago · link · parent

So that quote is actually taken out of context. The Senator knows that finstas are, and is using it to drive a different argument - that Instagram is incentivized to help teenagers bypass parental control https://www.theverge.com/2021/10/1/22704308/finsta-instagram...

> “Finstas are fake Instagram accounts. Finstas are kids’ secret second accounts. Finstas often are intended to avoid parents’ oversight. Basically, Facebook depends on teens for growth,” Blumenthal said. “Facebook also knows that nearly every teen in the United States has an Instagram account; it can only add more users as fast as there are new 13-year-olds.”

comment 5y ago · link · parent

That approach unfortunately also makes keeping state updates consistent very difficult. Some pet peeves - when reviewing code, if you set up some file filters then scroll down to trigger more files to load, those newly loaded files are not affected by the previously set filters. Or occasionally the page would helpfully offer to reload to show new commits, but clicking that link loses the current white space and file filter settings.

SPA frameworks aren’t a silver bullet here, and you can definitely fix these without using one, but these bugs are definitely much harder to make since the DOM is rendered from a single source of truth instead of being patched piecemeal.

comment 5y ago · link · parent

It’s not being discriminated against based on some protected class. Being vaccinated is a choice, unlike skin color.

The government will not let you serve alcohol at a restaurant unless you check the drinker’s age. The government will now also not let you serve diners indoors unless you check they have been vaccinated.

comment 5y ago · link · parent

It seems no more bothersome than being required to be licensed to drive or to present a proof of age to purchase alcohol. There are perfectly viable alternatives - you can eat outdoors, get takeout, exercise outside, just like how you can ride a bike or take a taxi if you choose not to get a driving license.

And the decision to require vaccination at hospitals are also made on recommendation of doctors that are as, if not more qualified than the hypothetical doctor. The doctor in question can also open their own practice if they do not want to be employed by the hospital.

Licensing systems necessitate some surveillance in the form of identification and data storage, but it's not as if these do not exist already and somehow the driving license has not caused American to spiral into dystopia nor is it even close to being the worst surveillance mechanism that the American government could choose to use if it does turn authoritarian.

comment 5y ago · link · parent

If you have an adblocker with element hiding capability (I don't think any iOS ones do), hiding the #layers element removes the modal but you still cannot scroll.

If you have a userstyles extension, this works for me

    #layers {
        display: none !important;
    }

    html {
        overflow: auto !important;
    }

comment 5y ago · link · parent

A list is usually represented by an ol in HTML, not a table.

HN uses three trs for each item, not one. The table cells are also not consistent, because it's not actually a tabular data, so each cell could have nothing (used as a spacer for layout), or more than one thing squeezed inside. The intermingling of semantic and non-semantic (presentational) elements makes "understanding" the page difficult, which incidentally also makes the page less accessible since screen-readers also rely on the same mechanisms to relay information to non-sighted users.

comment 5y ago · link · parent

The second result is more semantically correct, but it will not function if called on tr.athing because tr.athing contains HTML elements that will be deleted when you replace the text. It is still much safer than innerHTML which will silently corrupt attributes. It's also interesting you need to prompt Codex for security best practices (and a bit questionable if it even "knows" anything about best practices)

I guess part of it is that a one-liner is impossible. Here's what I would write given the prompt

    const makeUppercase = (id) => {
      const element = document.getElementById(id);
      if (element == null) return;
      const makeChildNodeUpper = (node) => {
        if (node.nodeType === Node.TEXT_NODE) {
          node.nodeValue = node.nodeValue.toUpperCase();
        } else {
          node.childNodes.forEach(makeChildNodeUpper);
        }
      }
      makeChildNodeUpper(element);
    }

comment 5y ago · link · parent

Yup, innerHTML just returns a string, so of course you can .toUpperCase() on it even if it is unsafe.

innerHTML's history is fascinating. It was not part of the original DOM Level 1 API but was added in IE5. It is not semantically correct (you should be using Element.textContent or examining the inner text nodes), but because it was so easy and the rest of the DOM API so verbose, it caught on and became one of the primary ways used to manipulate content in JS.

FWIW Chrome recently proposed a Trusted Type mechanism for preventing XSS (which also has the side effect of blocking this sort of unsafe manipulation) - https://web.dev/trusted-types/, https://developer.mozilla.org/en-US/docs/Web/API/TrustedHTML

comment 5y ago · link · parent

It's really interesting. HN's HTML is very un-semantic and is actually quite hard to work with.

    <tr class="athing" id="28191639">
      <td class="title" valign="top" align="right"><span class="rank">9.</span></td>
      <td class="votelinks" valign="top"><center><a id="up_28191639" onclick="return vote(event, this, &quot;up&quot;)" href="vote?id=28191639&amp;how=up&amp;auth=****&amp;goto=news"><div class="votearrow" title="upvote"></div></a></center>
      </td>
      <td class="title">
        <a href="http://be-n.com/spw/you-can-list-a-million-files-in-a-directory-but-not-with-ls.html" class="storylink">You can list a directory containing 8M files, but not with ls</a>
        <span class="sitebit comhead"> (<a href="from?site=be-n.com"><span class="sitestr">be-n.com</span></a>)</span>
      </td>
    </tr>
In the video Codex picks up tr.athing as a news item. I wonder if this is actually generalized learning, or if it just picked the selector up from eg. a userscript that appeared in its training corpus.

Another thing that's kind of scary (and makes it worrying if this is used for Copilot) is the second prompt to make the text uppercase results in code that is superficially correct, but is very semantically wrong - innerHTML.toUpperCase() is dangerous because it not only makes the content uppercase, it also modifies the attributes on the HTML elements inside. This definitely broke the vote button, which uses inline JS which is case sensitive. It also destroys any attached event handler since the elements are basically deleted then re-created.

The correct way to do this is to either use CSS text-transform: uppercase, or if it is important to update the DOM itself, recursively descend and update childNodes with nodeType == text's nodeValue to uppercase.

12345
10