Better HN
topnewbestaskshowjobs
Log inSign up

tmpfile

190 karma · joined Nov 4, 2019 (7y ago) · 45 submissions

tmpfile at protonmail
Submissions

comment 5y ago · link · parent

Screenshot https://imgur.com/a/nxvH8cW

32.

VSCode deprecates Enable Telemetry, auto-enrolls you in Telemetry?

388 points · by tmpfile · 5y ago · 181 comments

comment 6y ago · link · parent

It seems the demo is focused on "How to Export Trevor.io Results to Google Docs" on first pass. It breezes past the whole Build Query part, probably since the example query was so trivial. I would've expected a demo more representative of the Query Builder image.

Couple thoughts:

- You should let the user know the goal of the demo before they start it, for example, "Let's build a query of Users by Country and Export it to Google Docs" and indicate their progress through the demo (eg, Step 1 of 5) with a caption of the action they are taking at the bottom of the screen that reinforces the previous bubble. Like:

  - Step 1: Let's build a query of Users by Country
  - Step 2: Here our Users by Country is shown as a bar graph. Let's change it to a Table View 
  - Step 3: We have 14 users in the UK. Let's check the underlying results
  - Step 4: Let's export the results to Google Docs 
  - Step 5: Here's our result exported to Google Docs
- The flying/pulsing circle is fast and distracting - and it shouldn't move the label attached to it

comment 6y ago · link · parent

You're right, my implementation was not a drop-in replacement for replace. How about this?

    String.prototype.replaceAll = function (n, sub) {
      let t, f = "g";
      if (n instanceof RegExp) {
        t = n.source;
        f = n.flags;
        if (!f.includes("g"))
          f += "g";
      } else {
        t = RegExp.escape(n);
      }
      let r = new RegExp(t, f);
      return this.replace(r, sub || "");
    }

comment 6y ago · link · parent

this. 100% this.

comment 6y ago · link · parent

Yikes! It's a lot of effort to reduce memory use. They might be better off creating a new Go entrypoint/server that can call into CPython to reuse all their existing/tested modules (treat their Python as a microservice called by Go). They could then use Go to create/call new microservices or replace various routes on a selective basis.

comment 6y ago · link · parent

I agree. I would think replaceAll would behave like the following:

/* Usage:

  > 'abcdefabc'.replaceAll('abc')
  'def'

  > 'abcdefabc'.replaceAll('abc', '+')
  '+def+'

  > 'abcdefabc'.replaceAll(/abc/, '+')
  '+def+'

  > 'abcdefabc'.replaceAll(/abc/g, '+')
  '+def+'
 */

 String.prototype.replaceAll = function (re_or_str, sub) {
     return this.split(re_or_str).join(sub||'')
 }
On a side note, is it just me or does the linked polyfill for String.prototype.replaceAll [1] seem wildly complex???

[1] https://github.com/es-shims/String.prototype.replaceAll/blob...

38.

The New Field of Twistronics: Take 2 Sheets of Graphene and Twist(nytimes.com ↗)

2 points · by tmpfile · 7y ago · discuss

comment 7y ago · link · parent

Sure, if everyone decides to host their own files, a CDN would never be used. Although, there are benefits to using a CDN, so it's likely the try-shared value could exist and would be useful.

Note the proposed scheme doesn't prevent anyone from using a CDN as the src while also trying other CDNs to increase the chances of a cache hit, which has its own benefits.

For example, <script src="https://code.jquery.com/jquery-3.4.1.min.js" try-shared="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.mi... try-shared="another-src">

comment 7y ago · link · parent

One way to prevent a CDN from seeing every request for a shared resource could be a new attribute that allows serving the resource locally if the resource is not in the shared cache.

For example, <script src="/jquery-3.4.1.min.js" try-shared="https://code.jquery.com/jquery-3.4.1.min.js" try-shared="another-src">

@src can be locally hosted. If it's not in cache, the browser can try each @try-shared attr (without loading the resource from CDN). If no match, the browser downloads @src from your own domain.

Of course, this doesn't solve the Shared Cache issue raised by the article. Suppose the only way to solve that would require adding resources to the shared cache explicitly. The most effective way (I assume) would be a header provided by the CDN of a shared resource, eg, X-Shared-Cache: true, that a browser would recognize... Then @src/@try-shared could still get the benefits of the shared cache and developers don't have to worry about it.

12