« first day (4651 days earlier)      last day (519 days later) » 

10:02
I feel bad, but hsould I downvote this answer? stackoverflow.com/questions/76660410/…
10:25
@paul23 Probably. Also, I suspect it's GPT generated. But even if it's genuine it's not at all good. It completely misses the question even if we allow Python code.
Of note: I am actually in favour of providing solution in different language than the question. As long as it's clear how to convert it. I've even "translated" a Python answer to JS a couple of times. Because the author of the answer was an SME with the problem domain but not in JS. So, they supplied sample implementation which was super easy to follow anyway. But in this case, the answer is totally and completely wrong.
Guess only specifying the salt upfront, instead of letting bcrypt generate one on its own, would be a suitable option here then, I suppose. (If you send anything else besides the token, a username for example, the salt could be a static hash of that, so that you don't use the same static salt for everything.) — CBroe 30 mins ago
The problem with allowing a different language is that "later" better answer is just copy/paste translation of that answer.
Uh, doesn't this basically just elide the salt?
and due to the non forum-ordering each answer needs to be self contained, so that new answer should then also copy-paste all other text, which feels "wrong" to do.
@paul23 My argument is "so what"? Realistically, we shouldn't allow duplicate answers. And that would be a duplicate answer. In practice...that's not what happens. But pretty much nobody seems to bat an eye about it. Yet somehow it's a problem when we talk about posting a Python answer to a JS question. But not when we have the exact same situation but substitute Python with pseudocode.
@paul23 Edit the answer with the Python code.
@VLAZ-onstrike- you see it as duplicate answer: I see it as a major improvement. And "editing" removes the python version which might be useful in some point anyways, even though not the right place it is information that is then lost into the void of answer history.
10:34
I didn't say remove the original code.
hmm I guess fair point then
but anyways, the answer in question is just independent of python code not understandable to me, and if I understood it basically shows the problem again in python version.
As long as the code is simple and clear to follow, then I'm quite in favour of domain SME supplying what they can work with.
@paul23 Correct interpretation. It's useless.
It's still just iterating over each and comparing using bcrypt. Which...is your original problem.
oh I understand the python code, just the post isn't clearly formatted making it hard to follow anyways.
I'm also kind of annoyed a bit that whenever I'm not asking for a direct code-fix (and hence a minimal code example isn't really useful)
But rather a "hey you should use xyz feature of the well known library" or "you should use abc algorithm instead for such a problem" posts often get a comment with "unclear" and downvoted within the hour.
@salbeira This has nothing to do with "https"/security. HTTP is a plain text (message) protocol and for that it needs restrictions on strings/characters usable in "structured data" - like the Header key-value list - for parsing. To allow arbitrary strings at least for the password in Basic Auth it needs to be escaped/encoded. Base64 is a simple solution. Sending it plain text would break the protocol.
@paul23 Yeah, SO has real problem with non-code related questions. The "How to" questions are the bread and butter of SO. Yet, there is a significant portion of users on SO who falsely believe that only questions about fixing code are on-topic. None has ever managed to supply evidence of that. Not really surprising, given that there is no evidence. And plenty of evidence of them being wrong.
Yet correcting the misconception takes significant time and effort. As each needs to be contacted separately. And even then, you can only do that if they ever comment expressing the false beliefs they hold. If they don't and just downvote, then it's almost useless to "counter-comment".
10:42
Well there is the problem when a use asks for how to + a complete working example code. As that often goes into the "do my homework for me" or "help vampire" state.
@VLAZ-onstrike- out of curiousity, shouldn't it be flagged since AI generated answers are currently banned?
@makadev If you can produce convincing evidence - sure. I can't, however.
There is very little to go on with that answer. It completely misses the question and has no formatting. The comments are also pretty useless. This is typical of GPT posts. But not exclusive to them. Plenty of regular users have posted similarly misguided and malformed posts.
hm true
anyone knows btw when fetch will get out of expiremental zone for node?
11:05
@paul23 ¯\_(ツ)_/¯ My best optimistic guess would be within 2-4 LTS versions.
Oops, that was supposed to be 2-4 versions as in 1-2 LTS versions.
 
2 hours later…
13:20
@VLAZ-onstrike- who in their right mind would generate a question with AI?
I understand that some people want to cheat and get extra rep with AI generated answers, but questions?
I don't think I've talked about a GPT generated question.
Ooh, I just answered my own question. They must also be in it for the reputation. I get it now.
Don't know why somebody with such a smart idea would do such an awful thing... AI generated questions??????
@paul23 I don't even use fetch in Node.js. I use my own function that mimics the fetch function and returns a promise. I used the HTTP/HTTPS module instead, it's better
@ParkingMaster I'll bite: why is it "better"?
13:52
@paul23 because Node.js has a tendancy to deprecate things randomly so using a module instead of a built-in function is better. Also, the HTTP module is just much easier to use in Node.js. Client-side wise, I love the fetch method. But in Node.js the module is better.
I'll show the code that I use:
  function fetch(url) {
    return new Promise((resolve, reject) => {
      const http = require("http");
      const https = require("https");
      let client = http;
      if (url.toString().indexOf("https") === 0) {
        client = https;
      }
      client.get(url, (resp) => {
        let data = "";
        resp.on("data", (chunk) => {
          data += chunk;
        });
        resp.on("end", () => {
          resolve(data);
        });
      }).on("error", (err) => {
        reject(err);
I should write a package... wait, there are already tons of modules that do this lol
@ParkingMaster fetch is also a "module"?
What do you mean?
why would node deprecate fetch when it is new?
fetch works now? Jeez, I must have been living under a rock... I though it was still deprecated lol
never deprecated - it's experimental meaning it's new (and you get a warning that it's still expirmental)
13:57
What's good about writing your own functions to emulate the same thing is that Node.js cannot change your function. It should always work no matter what. And what is it with them "experimenting" with it? It should already work, why do they need to change it? And why is it so hard to do what I did, why are they taking so long to finish it?
14:20
are you claiming the fetch api doesn't work?
I agree with paul23, it's generally better to use the built ins than to try to keep up. If there are e.g. security patches that make it to the built in, you'll have to copy the same into your code or risk being exploited. There are many ways for this to go wrong
I have a question about tailwind though--what class can I add to a div to make all the children a tags turn red?
wait what
no
use fetch
tf
lol ^^
@KevinB this made me laugh so hard
i'd imagein something... error related would make all the children text red
(never used tailwind)
it's terrible :( it just slows you down
14:39
the only other thing I would ever use instead of fetch is axios
if you need even higher level communication and wish to keep both front and backend equal
why not jquery
-.-
Hello
I am using mobx-state-tree .actions
export const ChipStateModel = types
  .model({
    componentType: MXComponentTypes,
    allChips: types.array(ChipButtonStateModel),
    isMultiSelectedMode: types.boolean,
  })
  .actions((self) => {
    return {
      deselectAllChips: () => {
        self.allChips.forEach((chip) => {
          chip.isSelected = false;
        });
      },

      selectSingleChip: (buttonKey: string) => {
        const chip = self.allChips.find((chip) => {
          return chip.buttonKey === buttonKey;
        });
and this works as expected if I click another button which currently is not selected
Sorry I'm busy hacking a virtual machine (ethically, of course)
but if I click button which is currently selected in order to toggle selection, that doesn't work
I know why
  if(!chipComponentState.isMultiSelectedMode) {
    chipComponentState.deselectAllChips()
    chipComponentState.selectSingleChip(chipButtonKey);
  }
but how to check if chip isSelected and toggle if it is ?
14:51
this is confusing. You want to check if a chip isSelected? if (chip.isSelected) {}
if you want to toggle a chip chip.isSelected = !chip.isSelected
15:37
more conditions and actions?
i don't see the confusion
 
3 hours later…
18:59
I know I know off topic, but I just had to share this research I just stumbled on
(don't worry it's an english paper0
posted on July 11, 2023 by Ben Mason

Hi everyone! We've just released Chrome Beta 115 (115.0.5790.83) for iOS; it'll become available on App Store in the next few days. You can see a partial list of the changes in the Git log. If you find a new issue, please let us know by filing a bug. Krishna Govind Google Chrome

 
2 hours later…
20:50
@useragent Please don't post unformatted code - use the up arrow to edit your post, then hit Ctrl + K to format the code in that post. See the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
Hello
I have an express application and my current end goal is to submit files to amazon S3 bucket, and my code looks like this:

https://gist.github.com/Sidney-Dev/b37dbae8228421fd559c9052eedf7907
The code works, however, I noticed that the image uploaded is not publicly visible. When I click on the returned link, instead of showing the image, it downloads it.
How do I make it possible to view the image in the browser?
"How do i display s3 images in the browser?"
Thanks for the correction. How do I display S3 images in the browser?
assuming they're correctly configured in AWS, you'd just put them in an image tag.
Oh no... you're right! I was completely overthinking this!

« first day (4651 days earlier)      last day (519 days later) »