« first day (3625 days earlier)      last day (1306 days later) » 

1:25 AM
@forresthopkinsa i took a look at it, to me it doesn't seem like they needed an entire new run time but whatever
 
I think they needed a new runtime to satisfy their goals but I disagree with them about how valuable those goals are
 
i think standard library is important
 
it helps
lol
 
es6 imports they can just add to node, deprecate commonjs
 
well at that point you're making a clean break from current node
so you might as well go all the way
or so goes their thinking
also you have to keep in mind that stdlib api is one of many things they felt needed to be changed
 
1:29 AM
i just see it as a new version with nonbackward compatible changes (i mean technically it would be because commonjs would work, just deprecated)
 
their module and permissions systems are drastically different from node
 
permission system is stupid imo
 
1. You shouldn't be running scripts you don't trust anyway
2. See #1
 
well none of us audit all our transitive dependencies
 
1:30 AM
Yeah and when was the last time a popular rouge dependency stole data? or did something bad
 
there was that incident a year ago
self-propagating npm module that stole registry credentials
 
> The malicious package is named 1337qq-js and was uploaded on the npm repository on December 30, 2019.

The package was downloaded at least 32 times, before it was spotted and today by Microsoft's Vulnerability Research team.
"at least 32 times" i could spread malware faster by throwing malware filled USBs into a crowded street
 
yeah that's a great response time
that's not what I was referring to though
 
but even so, just add permissions to node
you can make it backwards compatible
 
a default of all permissions granted?
 
1:34 AM
node --insecure
look i'll admit, there is some merit to each of the changes they made but i don't think it warrants a new run time
 
aha I found the incident I was referring to
so it was a little more than a year ago
also, event-stream was a big one, I forgot about that whole thing
 
@forresthopkinsa ah this is interesting. Yes an issue, but lock file should prevent widescale issues.
 
yeah it's crazy that it was doable
such a straightforward attack
 
But also consider every other package manager. None that I know of have security protections like deno has.
sidenote, i kind of want custom css functions
imagine if you could declare a limited featured css function in like wasm or something
 
hmmmmmm
 
 
4 hours later…
5:37 AM
Hi, i have a doubt, what happens the moment when we type a url like www.anysite.com/user. does the browser make a get reqeust automatically to the backend with the path and get us the page? in that case how does the react router knows the path to which i am rendering?
 
6:02 AM
can some1 help me setting up a webrtc for many to 1 connection?
 
 
1 hour later…
7:24 AM
I'm running a news website for a client and it make a maximum of 10 firestore reads per visitor. Google analytics shows 300 sessions in last 7 days and firestore says 35K reads in last 7 days. Anybody else facing the same?
 
 
3 hours later…
10:10 AM
Morning. I've got a function structured like this:
	public async MyAsyncFunction() {
		await Axios.get(`/api/myApiCall`).then((result) => {
			var myStrings = <string[]>result.data.results;
			myStrings.forEach(function (string) {
				this.myStringArray.push(string);
			})
		});
	}
But this.myStringArray is a property on the parent model, whereas "this" inside the function when I try to push() obviously refers to the function itself. How can I access the parent property from here?
Ah, found it. You have to declare something like var self = this before the fn.
 
11:13 AM
@BobTway What sub language or pre processor are you using?
Ive never seen "public" async functions
Is this Node.js or something?
 
Hello
How is everyone this morning?
Maybe you guys can help me out
Why would this Array.prototype.forEach.call only return one result if there are indeed two values inside the array
when I console.log(errors) I see two values but console log error and i only see one
oh i forgot to declare statusElement
well that didn't help
I'm stumped
Got here... FAILED! handler.js:994:11
Array [ "Username already taken by 8", "Passwords do not match" ]
handler.js:995:11
Username already taken by 8
Success works fine
Something with the loop is breaking and causing it to not run a second time
probably should create the element...
lol
sorry ive had little sleep as you may be able to tell
Thanks, have a good one.
 
11:44 AM
oh and this.dom needed to be changed to self.dom
 
@BobTway you can also use an arrow function which doesn't create a new this context. So myStrings.forEach(function (string) { --> myStrings.forEach((string) => {. However, why would you just do, this.myStringArray = myStrings.slice();
@MisterSirCode typescript
|| formatting JustinHarris
|| welcome JustinHarris
 
@JustinHarris 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.
 
|| formatting JustinHarris
 
@JustinHarris Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
 
Is it a bad idea to handle server/client interaction with XML?
 
11:48 AM
1 message moved to Trash can
 
nvm stupid question
 
@JustinHarris there is no direct problem with it
but you will find that in JS-land, it is much easier to use json
as json tools are much more common and many things for it already exist in the base sdk
 
oh okay well ill practice with json on my next project, for now, ill just continue to use xml since I familiar with it
i am*
 
12:15 PM
Morning
 
12:30 PM
 
@JustinHarris it depends. The first choice should be json, but there are still companies (governments ...) that relies on xml
hence we give two services, initial one in json. If requested, another one can be added to deliver xml with few additions (organic code)
 
12:47 PM
that belgian twat
how can I fix a 403 error?
 
that require more details ...
 
One sec
 
the forbidden error is being displayed usually when you aren't authorized to access that resource
 
But I have full permission on the site
 
so, my guess would be: do you have access 🙂
full permission != access everywhere
 
12:54 PM
99% sure I can. How come I can GET from the urls, but I cannot post
wont let me send the error code bc its too long
:\"en-US\",\"value\":\"The security validation for this page is invalid and might be corrupted. Please use your web browser's Back button to try your operation again.\"}}}","responseJSON":{"error":{"code":"-2130575251, Microsoft.SharePoint.SPException","message":{"lang":"en-US","value":"The security validation for this page is invalid and might be corrupted. Please use your web browser's Back button to try your operation again."}}},"status":403,"statusText":"error"
 
do you use csrf tokens in your POST/PUT requests? It could be that the server is checking for csrf tokens and that you did not have provided one
 
'CSRFToken' : getCSRFTokenValue()
put that in the AJAX header?
 
yea ... but sharepoint has that odd additional requirement as well
I don't recall the exact header name, I think RequestDigest or something
 
I have that
 
*googles*
 
12:56 PM
"X-RequestDigest": $("#__REQUESTDIGEST").val()
 
ah that. ok, see if that's giving a value and not an empty string
do the same for the token
if still having the same problem: check your request
then poke a colleague
 
Hm. When I input CSRFToken into the header I get "Uncaught SyntaxError: Unexpected string"
 
1:22 PM
Ive found something. Im going to try to use fetch instead
 
1:45 PM
	fetch(url1) {
		method: post,
		body: searchParams
	}).then(function(response){
		return response.text();
	}).then(function (text){
		console.log(text);
	}).catch(function (error) {
		console.error(error)
	})
	});
Uncaught SyntaxError: missing ) after argument list
Its saying that I am missing a ) in the beginning of this line.... }).then(function(response){
but I am not?
 
@bigchungus you have an extra parenth after url1
use a proper text editor
 
Im in Notepad++
 
@JBis lovely, thank you.
 
do you not see a red squiggly line anywhere @bigchungus?
 
It isn't showing up in NP++
It normally does.
 
1:53 PM
I can recommend to use WebStorm instead of NP++
it will make writing Javascript applications much easier
 
Ill look into it. I usually use IntelliJ, but limited to downloads on work computer
 
hmm... WebStorm is not free though... but you can still get it for free if you do primarily open source, or are a student
 
2:07 PM
Yo is there a trivial way of making a div have the same click animation like a button?
 
Which animation?
 
yes
 
The normal one when you click a <button> where it goes into the background a little
 
Yes.
 
Is WebStorm so different from IntelliJ? I'd expect them to be nearly the same.
 
2:08 PM
write css for each state and transition from one to the other
 
@JBis How?
 
@Squirrelkiller they are identical
 
@KevinB This I would not call tivial.
 
the best way is to do what kevin said but if you want a quick and dirty you can use js
 
2:09 PM
¯\_(ツ)_/¯
 
Or I just use a button lol
 
element.style.backgroundColor = ''
 
i don't usually leave buttons at their default style, instead using a generic button style that can also be applied to anchors
then you can change the style with css also
based on state
!!mdn Pseudo-classes
 
Oh there is styling on it, including shadow, so I thought hey why not just remove the button and style on :host (it's an angular component)
 
2:17 PM
!!stat
 
Username: Kevin B
ID: 172549
Reputation: 90999
Reputation Change Month: 148
Last Accessed: Fri Sep 18 2020 10:15:48 GMT-0400 (Eastern Daylight Time)
 
only 9001 to go
jbi, i sthat month rep change for the current month? or last 30 days
 
no idea lol
how are you earning rep? just upvotes from old posts or what?
 
old stuff, yea
mostly promise related questions
i don't even really like that answer
 
I added the CSRFToken header, and it gave me the same response in the console -2130575251 error code. I double checked permissions and it says I have full control on the site where my DataTable is, but the subsites I have different permissions. Could that be it @KarelG
 
2:55 PM
https://jsfiddle.net/MisterSirCode/L1z47w9y/234/

Hey is there a way to make a flexbox space content evenly based on count of containers?

Im assuming Id have to use JS for something like this. space-evenly just separates them based on the size. So if you make a smaller paragraph on either, it shrinks and makes the larger one take up more space. Ultimately making it harder to read the content. Id rather have them scale to the amount of sections
Anyone got any ideas?
I can only come up with dividing screen width over count, and limiting it to like 3 or 4 sections
Im not really sure thats the most efficient method
 
wdym
what if spacing evenly based on count of containers makes one overlap another?
flex wouldn't allow that
 
anyone knows an article about pattern matcher optimization?
 
I mean that... here let me make a change https://jsfiddle.net/MisterSirCode/L1z47w9y/243/

See how the one with a bigger content is squishing the other one
Its not very good looking
I want flex to stretch based on the amount of sections as a whole
 
consider the following antlr4 (not sure if correct though) pattern
 
so maybe... just 2 per width
 
3:04 PM
rule1 : x+=ruleX* 'rule1' ;
rule2 : x+=ruleX* 'rule2' ;
ruleX : ... ;
 
that looks ideal to me
 
would the antlr4 engine optimize out the leading ruleX* matchers?
instead of backtracking that too when it sees that the value "rule2" is not matching the pattern "rule1" and then has to re-do all the ruleX parts it has matched to continue trying for rule2?
 
@KevinB Yeah it looks ideal... until the content is small enough

https://jsfiddle.net/MisterSirCode/L1z47w9y/247/
That is absolutely ugly
 
I am wondering if I should optimize it in my engine or in my grammar
 
Then adjust it
i don't get what you're asking for
 
3:06 PM
how?
 
set the width
 
facepalm...
minimum width
 
there's no space around your boxes
there's no alignment or spacing to be done
 
hmm
alright, I see my mistakes
Now I just need to figure out height... and then I can go on from there
https://jsfiddle.net/MisterSirCode/L1z47w9y/272/ Yeah Im struggling with height...

How can I get the content to match height to the content, same as width with flexbox?
Im trying to go full flexbox with this template
 
o.o
 
3:19 PM
whats wrong?
 
hi
 
ok. hello
 
just poking the window with my nose lol
 
hey is it fine that Im asking semi CSS questions here too? Yall seem generally informed about webdev stuff, and the chat.stackoverflow.com/rooms/29074/html-css-webdesign room is basically dead. People pop in like once a day or once every few hours
though it does get quiet whenever I ask about it
in this case...
asking about asking about it
 
it is fine. happens for years
 
3:24 PM
about a year ago, when I was still new to CSS and stuff, I used to ask about it a lot here
its just been so long
these days I only use javascript for the occassional Node.JS bot, or discord bot someone wants me to make
||💩
 
🚽
 
4:26 PM
Node's http.IncomingMessage makes it really hard to actually use url.Url :|
 
5:14 PM
I created my react app using create-react-app. How can I run test coverage with the jest-dom installed on react
 
5:55 PM
@Xcode I dont think jestdom is part of the jest package out of box for CRA but you need to install it seperately as a dev dep
Guys any idea how to write this properly. I know what the problem is but nor whats the ES6 or React way of fixing this, I have this array and I am filtering this . After my first filter which reduces the initial array from 100 to 20 elements and on the next array it only filters through these 20 elements and not the original 100. How do I write this properly. Currently I am writing this like below

`data : [...this.state.data.filter(elem => elem.name === e.target.innerText)]`
 
?
 
this.setState({
data : [...this.state.data.filter(elem => elem.name === e.target.innerText)]
})
 
 
2 hours later…
8:06 PM
Hey
"An entry without a type name was found, but no expected type was specified. To allow entries without type information, the expected type must also be specified when the model is specified
Status 400 code?? Why am I getting this if everything I am sending is correct and the fields match those of the sharepoint list?
 
@Mike it comes with the create-react-app bootsrap
 
!!magic2
 
8:26 PM
|| status
 
I am currently alive!
 
React help required:
I have <CampaignForm /> component which has tabs in it. I generate these tabs using a loop.
In each tab, there is the same form so I made a <AdForm /> component for it. Each of this component has its own <Form></Form>

Now there is only 1 submit button and when it is pressed, I need to get values from all <AdForm>
and also apply validation. If anyone of them is invalid then I need to redirect to that specific Tab
Shoud each <AdForm> have its own <Form>
Or should i make 1 <Form></Form> at outer level and have <AdForm>'s inside it?
||status
 
I am currently alive!
 
oh it works lol
Any help would be appreciated
 
i don't think the structure is as important as how you store all the data
one flaw in your setup though is you'll also need to be able to handle the situation where there's multiple forms with errors
 
8:31 PM
@KevinB What is a good approach to handle it then?
 
just setting the "invalid" ones as "invalid" and letting the view decide which to show could be problematic
because now you have to decide which one to show when there's multiple (probably the first)
 
yes, this is the problem that I'm facing
 
and then... how do you move them to the second once the first is fixed
 
I have <Tabs> in the parent component
and I can switch to the other tab
by changing its "activeTabIndex" prop
So structure is like this:

<CampaignForm>
    <Tabs>
        <Tab>
            <AdForm />
        </Tab>
        <Tab>
            <AdForm />
        </Tab>
        <Tab>
            <AdForm />
        </Tab>
    </Tabs>
</CampaignForm>
@KevinB Currently each of the <AdForm> has a submit button
and when one of them is submitted, I basically need to get values of all <AdForm>, validate each one of them, and then do the further processing but I don't know how to do it
Is there an easier way to handle this?
 
what if you have one container <form/> tag, and <AdForm> just has the necessary inputs
or fields
each submit button can just trigger the overall form
 
8:37 PM
@JakeZeitz Then I probably no longer need the submit button inside the <AdForm>
@JakeZeitz Now the problem is, how do I access values of the fields inside each <AdForm>?
Is there any way to access variables/states of child components from parent?
I know 1 way is to use the imperativeHandle()
 
look into Formik, there may be a solution using that
 
@JakeZeitz I'm using react-hook-form
 
I think the parent component should handle the state of the whole form. Then the child components can read parent state as props. So the functionality would live on the parent component
 
yes
@JakeZeitz But if let's say there is a validation error on the 2nd <AdForm> how will I figure out?
 
the parent component would handle that
it would look at which forms have errors and then decide which tab to make active
 
8:51 PM
Right
1 last question, please
If i use the <AdForm /> on other pages
Then on other pages, I'll still need to pass props to it and it can no longer handle the submission/validation on its own?
 
Right you would either need to use the same parent component or a new one that has different functionality
 
Hmm okay
Thank you guys for helping @KevinB and @JakeZeitz
 
No problem, good luck with your project
 
9:09 PM
@MisterSirCode I'm not sure I understand your question, do you know about flex-direction: column?
 
hey guys, I'm trying something that's not working and also I can't find anything explaining why its not working. Appreciate if anybody can help
I'm trying to add listeners for each htmlElement based on their id, so I'm trying to loop using a Array.protorype.map() function. But for some reason it ignores the line where the listener is defined
    multipleBySectorData.chartSeries.map(chartSerie => {
      $(document).on('click', `#add_${chartSerie.id.replace(/\s/g, "_").toLowerCase()}`, async (e) => {...});
})
 
@BernardoMarques Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and 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.
 
@BernardoMarques can you give a MCVE?
|| mcve
 
If you would like assistance, please create a Minimal, Complete, and Verifiable Example
 
jsfiddle.net is best
 
9:41 PM
@Xcode Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and 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.
1 message moved to Trash can
 
When I try to run coverage for react app I get instance cannot read property of undefined. What is the problem. Here goes a sample test where container was delcared as variable first

it('invokes resetTimer when the reset button is clicked', ()=> {
const spy = jest.spyOn(container.instance(), 'resetTimer');
container.instance().forceUpdate();
expect(spy).toHaveBeenCalledTimes(0);
container.find('.reset-timer').first().simulate('click');
expect(spy).toHaveBeenCalledTimes(1);
});
 
where is container defined
because that error says it isn't
 
Its defined in the test suite
More Detailed Test Here:

describe('mounted Timer', () => {
  let container;

  beforeEach(() => (container = mount(<Timer />)));

  it('invokes the startTimer when the start button is clicked', () => {
    const spy = jest.spyOn(container.instance(), 'startTimer');
    container.instance().forceUpdate();
    expect(spy).toHaveBeenCalledTimes(0);
    container.find('.start-timer').first().simulate('click');
    expect(spy).toHaveBeenCalledTimes(1);
  });

  it('invokes stopTimer when the stop button is clicked', ()=> {
 
Hey, does anyone here came across radio buttons that don't check in react?
 
if it's a controlled input and clicking it doesn't change the state it's status is based on, then clicking won't change it's state.
 
9:54 PM
So what can I do to change that?
 
uncontrolled, or handle the state properly
 
I have tried to use checked attribute, compare it to state and current ID that checked, it just returns me all the radios checked
like that
checked={price.map(function(p){
return p.id === id;
})}
 
and now you need an event that will result in that price array being updated to reflect it being clicked
 
I have that already, it's works fine
 
apparently not, :p
 
9:58 PM
lol
 
I will upload some of my to codesandbox so you can see what I have done, just a min
 
or i could be wrong, who knows
i haven't messed with react in... about a year now
 
https://codesandbox.io/s/vibrant-blackwell-dn7i4?file=/src/App.js

Don't know why it sends an error, probably It's because I short it a little
selectionChanged(id, value) -> Updates the price value
so the price array (including the id) will update, and p.id will be equal to id.
but it returns true for all radio buttons and check them all for some reason..
 
i don't think you hit save
 
lmao
 
looks like you're trying to use .map on an object
 
price is array of objects
At first price is undefined
maybe that what causing the problem?
 
right, so your problem is your comparason for checked value
checked={price.map(function (p) {
    return p.id === id;
})}
what does .map return?
always
regardless of what the function does
!!mdn array map
 
.some would be more appropriate
though it doesn't completely fix the problem
!!afk
 
@KevinB bye Kevin B
 
Why not?
 
@YotamDahan Can you catch me up
What's your question
 
I'm trying to enable checking in react radio buttons
Kevin has suggested to switch to .some instead .map method
As I changed checked to this:
checked={price.some(val => val === id)}

All my radio inputs turns off, when I click one nothing turns on
I have debugged it, it returns always false..
 
10:33 PM
.some always returns false?
 
yes
maybe because I'm using it wrong
price is array of objects
 
@YotamDahan Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and 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.
1 message moved to Trash can
 
    [
     {
        id: "1",
        value: "1000"
     }
 ]
 
@YotamDahan Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and 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.
 
checked={price.some(function (p) {
  console.log(p, id);
  return p.id === id;
})}
when I do this, it just prints empty arrays
wait..
those empty arrays are from something else
it's not printing anything from that some call
that tells me that price is empty
 
10:38 PM
Yes, it's empty untill I click radio button to add values in it
 
Oh I see
 
wait I got it
my code was missing something
checked={console.log(price.some(val => val.id === id))}
 
oh good
 
val.id
 
10:39 PM
but now I get false, true, false
from just one click
I guess because the DOM refreshes
 
I'd write it the way I posted the log line above
it gives some insight into the shape of your data
anyway I gotta get back to my actual work, good luck
 
Thanks!
Got it fixed, thank you both @forresthopkinsa, @KevinB
 
@YotamDahan KevinB is afk:
 
11:10 PM
Great job guys. Kevin leaves and Forrest picks up :)
 

« first day (3625 days earlier)      last day (1306 days later) »