19 Matching Annotations
  1. Last 7 days
    1. Another example:

      const expensiveOperation = async (value) => {
        // return Promise.resolve(value)
          // console.log('value:', value)
          await sleep(1000)
          console.log('expensiveOperation: value:', value, 'finished')
          return value
      }
      
      var expensiveOperationDebounce = debounce(expensiveOperation, 100);
      
      // for (let num of [1, 2]) {
      //   expensiveOperationDebounce(num).then(value => {
      //     console.log(value)
      //   })
      // }
      (async () => { await sleep(0   ); console.log(await expensiveOperationDebounce(1)) })();
      (async () => { await sleep(200 ); console.log(await expensiveOperationDebounce(2)) })();
      (async () => { await sleep(1300); console.log(await expensiveOperationDebounce(3)) })();
      // setTimeout(async () => {
      //   console.log(await expensiveOperationDebounce(3))
      // }, 1300)
      

      Outputs: 1, 2, 3

      Why, if I change it to:

      (async () => { await sleep(0   ); console.log(await expensiveOperationDebounce(1)) })();
      (async () => { await sleep(200 ); console.log(await expensiveOperationDebounce(2)) })();
      (async () => { await sleep(1100); console.log(await expensiveOperationDebounce(3)) })();
      

      Does it only output 2, 3?

  2. Oct 2020
    1. I don't understand the need for the name "Open–closed principle". It doesn't seem meaningful or clear to me.

      Can't we just call it "extensibility" or "easily extendable"? Doesn't "extensibility" already imply that we are extending it (adding new code on top of it, to interoperate with it) rather than modifying its source code?

    1. Don’t indent code blocks.

      Sure, we don't need to add any additional indent. But what if your code block contains indentation (function body)? It would look silly to remove all leading indentation.

  3. Sep 2020
    1. Actually just returning the loginDaoCall works fine. I dont really get what's different as it is the looked like it was the same instance, but probably not.

      So the posted answer wasn't necessary/correct? Which part of the answer was incorrect/unneeded?

      I wish this OP comment included the full version of code that worked.

      I don't understand this OP comment. Wasn't OP already returning loginDaoCall? So maybe the only thing they could mean is that they just needed to change it to return loginDaoCall.then(...) instead...

      That would be consistent with what the answer said:

      the promise returned by the further .then() does also get rejected and was not handled.

      So I guess the unnecessary part of the answer was adding the return true/false...

    1. Can this word be used to describe the property in computing where a value can be dynamic? I feel like "dynamicness" would be a better term for this.

      It seems to refer more to personality:

      1a: marked by usually continuous and productive activity or change a dynamic city b: ENERGETIC, FORCEFUL a dynamic personality

      See also the same sentiment here: https://news.ycombinator.com/item?id=4137596

    1. I considered it, but dynamism refers to personality and philosophy, while dynamicity is just the condition of being dynamic.
  4. Jul 2020
    1. This isn’t an accident. OpenOffice’s sidebar code was copied and incorporated into LibreOffice. The Apache OpenOffice project uses the Apache License, while the LibreOffice uses a dual LGPLv3 / MPL license. The practical result is LibreOffice can take OpenOffice’s code and incorporate it into LibreOffice — the licenses are compatible. On the other hand, LibreOffice has some features — like font embedding — that don’t appear in OpenOffice. This is because the two different licenses only allow a one-way transfer of code. LibreOffice can incorporate OpenOffice’s code, but OpenOffice can’t incorporate LibreOffice’s code. This is the result of the different licenses the projects chose.

      What part of LGPLv3 / MPL prevents LibreOffice code from being incorporated back into OpenOffice's Apache Licensed code??

    1. Take a look at the slogans of some of the popular companies.

      Hmm, are these taglines or slogans? According to https://yourbusiness.azcentral.com/slogan-vs-tagline-12643.html:

      A tagline should represent your business, while a slogan represents a single product or is part of an advertising campaign

      it seems that these are more taglines than slogans.

    1. In the Set class we already called this - and difference, which it is ok but not really accurate because of the previous explanation, but probably not worthwhile to change it.

      Is this saying that the name difference is inaccurate?

      Why is it inaccurate? You even called it the "theoretic difference" above.

      Is that because "relative complement" would be better? Or because the full phrase "theoretic difference" [https://en.wiktionary.org/wiki/set-theoretic_difference] is required in order for it to be accurate rather than just "difference"?

    2. inaccurate

      How is the use of - for sets inaccurate?

  5. May 2020
    1. Related concepts in other fields are: In natural language, the coordinating conjunction "and". In programming languages, the short-circuit and control structure. In set theory, intersection. In predicate logic, universal quantification.

      Strictly speaking, are these examples of dualities (https://en.wikipedia.org/wiki/Duality_(mathematics))? Or can I only, at strongest, say they are analogous (a looser coonection)?

    1. ssh-add <(echo "$PRIVATE_KEY")

      Does this have any advantage over simply saving that key to a key file under ~/.ssh?

      Like they do on https://stackoverflow.com/a/61944004/47185:

      mv "$DEPLOY_KEY_PRIVATE" ~/.ssh/id_rsa
      
    1. Mojofication, Onion Souping, and the Network Service.

      What is Mojofication?

      What is Onion Souping?

    1. The consent provided by the user is saved in some cookies within the host page’s domain. By verifying the presence or the absence of these cookies you can determine whether the user has given their consent or not.

      But how do you check if they've given consent to a specific category??

    1. Make it clear that signing up is optional. Consent must be “freely given”; you may not coerce users into joining your mailing list or make it appear as if joining the list is mandatory. For this reason, you must make it clear that signing up is optional. This is especially relevant in cases where you offer free white-papers (or e-books) for download. While the user’s email address is required for the delivery of the service, signing up for your newsletter is not. In such a case, you must not make it appear as if signing-up to the newsletter list mandatory and must make it clear that it is optional.

      Question (answer below)

      Are they saying that it's not allowed to make signing up for a mailing list a precondition/requirement for anything? This was surprising to me.

      So if you have a newsletter sign-up page that sends a digital bonus gift (like an e-book) to new subscribers, are required to completely change/repurpose your "newsletter sign-up page" into a "download e-book page" (that has an optional checkbox to also sign up for the newsletter, if you want)? That seems dumb to me, since it requires completely reversing the purpose of the page — which was, in my mind, primarily about signing up for the newsletter, with a bonus (an essentially optional one) thrown in for those who do so. Are you required to either repurpose it like that or remove the free bonus offer that would be sent to new subscribers?

      The irony of this is that it requires websites that have a newsletter sign-up page like that to change it into a "newsletter sign-up page" where the newsletter sign-up part is optional. Which make you look kind of stupid, making a page that claims to be one thing but doesn't necessarily do what it says it's for.

      Does this mean, in effect, that you may not lawfully provide any sort of incentive or reward for signing up for something (like a mailing list)? As long as it's very clear that some action is required before delivery of some thing, I don't see why this sort of thing should not be permitted? Would this fall under contract law? And as such, wouldn't such a contract be allowed and valid? Are mailing lists a special class of [service] that has special requirements like this? Or is it part of a broader category to which this requirement applies more generally?

      Why is requiring the user to provide an email address before they can download a digital reward allowed but not requiring signing up to a mailing list? Why isn't it required that even the email address be optional to provide? (To answer my own question, probably because it's allowed to allow a user to request a specific thing to be sent via email, and an email address is required in order to fulfill that request. But...) It seems that the website could just provide a direct link to download it via HTTP/FTP/etc. as an option for users that chose not to provide an email address. (But should they be required to provide that option anytime they / just because they provide the option to have the same thing delivered via email?)

      Answer

      Looks like my question was answered below:

      Explicit Form (where the purpose of the sign-up mechanism is unequivocal). So for example, in a scenario where your site has a pop-up window that invites users to sign up to your newsletter using a clear phrase such as: “Subscribe to our newsletter for access to discount vouchers and product updates!“, the affirmative action that the user performs by typing in their email address would be considered valid consent.

      So the case I described, where it is made very clear that the incentive that is offered is conditional on subscribing, is listed as an exception to the general rule. That's good; it should be allowed.

  6. Apr 2020
    1. Chrome first sends an encrypted, 3-byte hash of your username to Google, where it is compared to Google's list of compromised usernames. If there's a match, your local computer is sent a database of every potentially matching username and password in the bad credentials list

      Why do they only send password matches if username also matches?? A password should be deemed compromised and never used again if the password is found in a breach/paste anywhere, even if in connection with a different username/email.