« first day (3587 days earlier)      last day (1344 days later) » 

12:00 AM
@JBis A segfault? are you sure? TypeError: e.transform is not a function
 
12:23 AM
@Lcf.vs I got three different outputs when running it. One was segfault one was the one above and there was a third one. I cleared npm cache and it seemed to fix it, but it has done that before and the issue comes again every couple builds.
 
12:55 AM
 
1:15 AM
@JBis stop nerdsniping me, I'm trying to get work done lol
gosh now I want to do it
should it include the function braces?
 
 
5 hours later…
6:12 AM
@JBis function _(){return _+"_()"}_()
||> function _(){return _+"_()"}_()
 
@Lapys "function _() { return _+\"_()\" }_()" Logged: `` Took: 0ms
@Lapys "ReferenceError: return_ is not defined" Logged: `` Took: 0ms
@Lapys "function _(){return _+\"_()\"}_()" Logged: `` Took: 0ms
 
Bruh, @JamesBot calm down
 
@Lapys undefined Logged: `` Took: 0ms
 
@JBis ($=_=>`(${$})()`)()
@JBis function _(){return _+"_()"}_()
Sorry for the mess, should've done a bit more testing but yea..
 
7:08 AM
Hi
 
@Menawer Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
I was reading YDKJS book the other day, and i came across a generator runner, and :( it confused me a little, anyone knows why we use apply, in case we sending a generator function inside a runner function, for example inside the runner(gen)
gen.apply( this, args );
I know it shift the context but what exactly its doing in this case, i thought the guy who wrote this bit should know how generators really works internally or am i wrong?
 
@Menawer In general, we use .apply when we want to change (including to preserve) the this context or apply a collection of arguments or both. I'm not sure what the context of that code is, however.
 
Am am allowed to post the question link: :), sorry pretty new to stackoverflow chat
 
Sure, you're allowed.
 
7:16 AM
Thanks

https://stackoverflow.com/questions/63281897/generator-runner-from-ydkjs-book
i thought maybe it does create the iterator inside this context instead of the generator context, but not sure
 
I believe that here the apply is used to preserve or change the context. It's possible that a generator uses this and we don't know whether gen is bound to the correct context. It's possible that somebody uses, say run.call(someContext, gen) or attaches the function to an object and calls something like someObject.run(gen). Using apply ensures that the context is going to be the same between run and gen.
Usually, there is no downside to that - if gen doesn't use this anywhere, it doesn't matter. If gen does use this then it either needs it set at execution or should already be bound.
So, at best, you run the code correctly. At worse, it shouldn't matter to the execution.
 
oh i c now
i didn't think about it from that angle, thanks man
 
As for the promise, I assume it's to handle async generators.
Same logic applies basically, if gen is a plain generator, it doesn't matter if you handle the value it produces as a promise. If it's an async generator, then you need to handle it as a promise.
OK, there is a small inconsistency for plain generators - you will never handle them synchronously. So, calling gen().next() and run(gen) is going to behave differently. However, I suppose it's not that big of a deal at the end of the day when run provides a nice unified API to handle anything.
 
7:31 AM
thank you so much for your time, at least things are clearer now for me
 
 
6 hours later…
1:28 PM
Feel like a sinner doing this:
// Returns an ever incrementing value
function count() { with (count.prototype) {
    // Update the "static" variable: `value`.
    return ++value;
} }
count.prototype = {value: +0};
 
1:56 PM
OK, I understand you don't mind with, while I do. Still, why with(count.prototype)? I don't see the value of attaching the property to the prototype. You cannot override it with by doing count.value = 42, for example - it's still going to fetch the prototype property rather than the instance one.
Comparatively, it makes more sense to attach the value property to the count() function itself.
 
function count() {
  return ++count.prototype.value;
}
count.prototype = {value: +0};
Why use with?
 
2:33 PM
I'd personally just go for this, as it seems more useful overall, than a single global function that always increments. What if I want two independent counters?
function count(value = 0) {
  return function () {
    return ++value;
  }
}
//or
const count => (value = 0) => ++value;
 
3:02 PM
// at that point, why not just
++value;
That feels to me almost like doing
const add = (a, b) => a + b;
I might be missing something
 
@VLAZ That last one: Uncaught SyntaxError: Missing initializer in const declaration
 
I'd guess the first => was accidental
const count = (value = 0) => ++value;
Although, because numbers are immutable, wouldn't it just do this?
let value = 1
> undefined
count(value)
> 2
value
> 1
I feel like that defeats the original intent
 
3:20 PM
@Cerbrus ...not sure how I messed it up so bad. Was supposed to say const count = (value = 0) => () => ++value
@JoshuaWade suppsed usage is counter = count(); counter(); counter() which will give you 1 and 2. Or you can start it from a given number counter = count(41); counter() to get 42
 
whoa, that's cool
 
3:41 PM
I code JS by day and C++ by night, and sometimes I'm blown away by how expressive JS is
Just discovered that 'a' < 'b' === true
and 'a' > 'b' === false
 
@JoshuaWade Well...it's also buggy. Not literally, it behaves consistently, however it can throw programmers off:
||> 1 < "a"
 
@VLAZ false Logged: `` Took: 0ms
 
||> 1 > "a"
 
@VLAZ false Logged: `` Took: 0ms
 
In both cases, the string is coerced to a number in order to compare it with the numeric value. However, Number("a") is NaN and NaN is neither larger nor smaller, nor equal to any other numeric value
Another problem might be if you have strings
||> "23" > "1"
 
3:47 PM
@VLAZ true Logged: `` Took: 0ms
 
||> "12" > "2"
 
@VLAZ false Logged: `` Took: 0ms
 
ohh why on earth is the string coerced and not the number
This is why I use typescript 🙃
 
Now JS will perform lexicographical comparison even though both strings contain numerics
As for why it's coercing the string - Abstract Equality Rules
|| mdn abstract equality
 
3:49 PM
Check the table under "Loose equality using =="
 
That behavior makes sense to me, "12" > "2" === false
I want it to do lexicographical comparison and not coerce both to numbers because it wanted to be helpful
 
@JoshuaWade it does but many people do something like console.log(a, b) see numbers and then are confused why a > b is not producing the expected result.
 
ahh
I can see it
 
Especially if a and b come from the HTML a = $("input[type='number']").val() for example
 
ohhh I see
JS must be really confusing as a first language
 
3:52 PM
Back to the abstract equality algorithm (the table on the MDN page) - when you have one operand which is number and the other is a string, then the string would be converted to number.
I'm not really sure if it's more confusing as a second language, as many people come in and have unreasonable expectations. Or quite reasonable but only because they apply their previous knowledge to JS.
 
@JoshuaWade i loved it
 
yay haha
 
4:54 PM
posted on August 11, 2020 by Shelley Vohr

Notable Changes [16aa927216] - (SEMVER-MINOR) async_hooks: add AsyncResource.bind utility (James M Snell) #34574 [dc49561e8d] - deps: update to uvwasi 0.0.10 (Colin Ihrig) #34623 [6cd1c41604] - doc: add Ricky Zhou to collaborators (rickyes) #34676 [f0a41b2530] - doc: add release key for Ruy Adorno (Ruy Adorno) #34628 [10dd7a0eda] - doc: add DerekNonGeneric to collaborators (Derek Lewis) #34602

 
5:21 PM
why is there no chat like this for mathematics?
:'(
 
I love you.. did you know that?
 
:)
 
Welcome to The Stack Exchange Network chat! You'll need 20 reputation to talk here.
damn where to get those reputations
 
You probably need to sign in.
Actually, you probably first need to create an account for either Maths.SE or StackExchange itself.
Not sure which account that one uses, I assume it's Maths.SE
Go to math.stackexchange.com and then click "Join this community" in the top right
 
5:32 PM
@Suisse i've had good results there
 
After you join, you'd get your association bonus so you'll have the rep needed to participate in chat.
 
@VLAZ I am actually already a user oO and I even could start chatting (and annoying) without any reputations hmm
@JBis I am such a loser.. I should start in a ML project in two weeks and I can't even read the super duper basic math formulas
:D
:'D
they actually helped me.. wow
they did even not throw any garlic or such strange things
 
6:27 PM
||> 1
 
@JoshuaWade 1 Logged: `` Took: 0ms
 
posted on August 11, 2020 by Prudhvikumar Bommana

The Dev channel has been updated to 86.0.4229.0/.3 for Windows & Mac, 86.0.4229.0 for Linux platforms. A partial list of changes is available in the log. Interested in switching release channels? Find out how. If you find a new issue, please let us know by filing a bug. The community help forum is also a great place to reach out for help or learn about common issues. Google Chrome Prudhviku

 
6:39 PM
@JoshuaWade "ReferenceError: btoa is not defined" Logged: `` Took: 0ms
 
||> let a=' ';for(i=97,a='';i<123;)a+=String.fromCharCode(i++);a=a.split('');a[3]='d';a[8]='j';a[9]='j';a[12]='m';a[13]='n';a=a.join('')+' ';'eazroaqkma prmfayqmzrmfurmjadyqmjnemta nmdayymzrmmmmnm fmfurmeundbrefmfaaymm mfurmeurq'.split('').map(l=>a[((a).indexOf(l)-13+27)%27]).join('');
 
@JoshuaWade "somebody once told me the world was gonna roll me a nt the sharpest tool n the shed" Logged: `` Took: 0ms
 
I need to do a HTTP POST request and get the URL that it redirects to. I looked at Axios and request/request. I couldn't find any methods that return that. Anyone know?
 
@ShreyGupta Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
 
6:45 PM
@josh
@JoshuaWade Will that work on a Firebase Cloud Function (nodejs)?
 
it's me
 
Since there is no browser
 
No, you didn't specify
 
Yes, sorry, my apologizies
 
NodeJS doesn't have fetch but there are polyfills
Have you seen this github post?
some simple googling for axios
 
6:47 PM
gotcha, the node-fetch doesn't have the response.url
let me look
yeah that didnt work for me
it didnt return the last url
 
the node fetch docs have info about following redirection chains
but any competent request library will allow you to do that
even if node-fetch doesn't, I'm sure there's a way with axios or request
 
gotcha thank u
ill give u sum background
im trying to bypass oauth
where we post the login info
on a website
and post the data and get the querysteing from the redirect uri to get the auth code
 
7:17 PM
posted on August 11, 2020 by Bindu Suvarna

Hi, everyone! We've just released Chrome 84 (84.0.4147.122) for iOS: it'll become available on App Store in next few hours. This release includes stability and performance improvements. You can see a full list of the changes in the Git log. If you find a new issue, please let us know by filing a bug. Bindu Suvarna Google Chrome

 
 
2 hours later…
9:12 PM
React v17.0 Announced reactjs.org/blog/2020/08/10/react-v17-rc.html, some minor but good changes
 
 
2 hours later…
11:31 PM
Hi. Anyone?
I have a form where users can upload 5 images at max. It works fine. It generates 5 *File* objects which I save to the server.

Now the problem:
When editing this form, I need to show the pre-filled data with the ability for user to remove any existing image + add new image if they like.
What is the easy way to handle this?
Do I need to keep track of which existing images were deleted so I can delete them from the server?
 
@ZahidSaeed why are the images uploaded before submitting the form?
 
@JBis The images are uploaded when the form is submitted
The user clicks on the new record button:
1. Fill the input fields.
2. Selects the images.
3. Clicks on submit.
4. All data is uploaded
It works fine
Now when the user chooses to edit:
1. Clicks on the edit button on the existing item.
2. The form is shown with everything already filled in.
3. The existing images that were saved are displayed using the absolute URL
Now let's say user wants to delete the 2nd image and selects 2 new images
How will I find out which image to delete? and which 2 new images to store?
The project is in React
 
11:48 PM
ah ok
 
@JBis I actually need to delete the files from the server too
When a file is selected, I create a preview of it
Any clues please?
I'm just confused about how to delete the existing images from the server after figuring out which ones are existing and which ones are new.
 
Here's how I would do it. I would pass a form-id to a hidden input on the edit page. I'd also pass the 5 current image-ids. When the form is submitted, replace all the text values in the form. Then delete any images-id[s related to the form-idthat are not included in the input. Then upload any new images.
Basically, react would receive this:
{
  formId: "<uuid>",
  [...],
  images: [
     {
        id: "<uuid>",
        url: "https://..."
     },
    [...]
   ]
}
 
First question, should I make 2 arrays for rending previews and uploading?
1 which will have blob for file preview
or is it Ok to attach additional property having blob on the File object?
 
wdym?
 
const [ creativeImagesAsFiles, setCreativeImagesAsFiles ] = useState([]);
const [ creativeImagesAsPreview, setCreativeImagesAsPreview ] = useState([]);
Currently I have something i like
1 array holds all File objects
1 array holds the blob
When a file is selected, the File object is pushed to 1st array and its blob is pushed to 2nd array
Is it ok or should I make it to just 1 array?
 
11:59 PM
I'm unsure why you can't just use one, but thats ok
either is ok
 
okay
 

« first day (3587 days earlier)      last day (1344 days later) »