« first day (2761 days earlier)      last day (2409 days later) » 

16:01
@DavidKamer you have great examples
thanks
@FredMcgiff Haha, I can't even remember what it was.
I have a question for everyone though
Could someone theoretically set a type of undefined with a value
user9112019
hi can anyone helpme on this stackoverflow.com/questions/50237561/…
@9112019 Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@9112019 Can you just set a flag for select all and the handle it as a special case on your server side?
you're using jQuery, so I doubt it is a single page app, so you won't be able to effect pages that aren't loaded, so that is probably your problem. You could also use something like redux, but if the user refreshes and you don't reload the store when it is empty you'll end up in the same position and it will be even less easy to manage
user9112019
@DavidKamer yes Jquery datatable severside processing im using. the thing is table.page.info().recordsTotal returns me the total rows count include all pages. but I couldnt founf anyway to fetch the data of those records through datatabl.
user9112019
16:07
do you have anyidea?
user1596138
@FredMcgiff Don';t you dare use the code you just replied to. That was bad and he was trying to find a better way to do things
@Jhawins what is he referring to lol?
user1596138
CLick the little arrow lol. He's replying to where you called setState twice separately in componentDidMount and stored a websocket ref as a state var
some componentDidMount thing
@Jhawins got it. I'm actually still using it... I haven't seen anyone else solve it in a better way. I added componentWillUnmount to destroy the socket.
user1596138
16:09
That guy confuses me to bad
@Jhawins not posting anything it goes to trash can anyhow
for me
user1596138
@DavidKamer lol....
user1596138
We gave you like tons of info on it
@Jhawins every example I've seen does something 5 times worse than mine
@Jhawins I could separate it from the component, but that makes less sense to me because I want it to die when the component dies
user1596138
componentDidMount() {
  this.setState({thing});
  // no ifs or conditions
  this.setState({anotherThing});
}
user1596138
16:10
Already atrocious js
@Jhawins I'm doing it because I don't want the socket listener to exist before the component mounts or messages may be missed and not set through redux
user1596138
Just because other people suck doesn't mean you need to suck. We explained lots of ways to properly arch that. But it's up to you in the end :)
@Jhawins I make a get request when the component is mounted to update all of the messages and I want to wait until after to create the socket. I want to check the session id from the url, and use that to create the socket. I then add listeners. I probably shouldn't use set state for it, but I am using its existence to make sure I have a connection before rendering so that the page doesn't crash or act incorrectly when a user isn't connected to the internet
or if my server when down. I could set it as an instance variable of the class, but I don't like doing that in react and I've never seen anyone else do it with React
(or when it's slow to perform said ajax and socket connection)
which it likely always will be
@KevinB yep, I have it set to show loading when the connection doesn't exist. So one way or another I have to render that conditionally, so check if my socket is created is the best way instead of setting a flag based on if my socket exists which is just an extra step.
16:18
@DavidKamer I would suggest just setting the socket with this.socket = yourSocket
Plus, defining the socket outside of React just makes it that much easier for XSS and sockets are bad with that. The worse thing I'm doing is sending a token over the socket, but it shouldn't matter if my socket is secure in React and I use SSL
No need to put it on the state
@Cereal could it be overridden with a bind call to my component?
Didn't we discuss this same thing just a couple days ago, and I told you exactly what Jhawins is saying now?
3
Q: Where to store socket connection in react-redux?

mike00Tried two ways: call connectToServer() from action creator within Starter component in componentDidMount(); and dispatch like this: let socket = new Socket('ws://address/socket'); socket.connect(); dispatch({ type: Constants.SESSION_SAVE_SOCKET, socket: socket, }); const lobbyChannel = ...

16:20
+ Cereal
it's just websocket week y'all
I might eventually put it in redux to get updates with container components. Is this equally as bad?
the actual socket shouldn't trigger updates, but events the socket produces can, via setstate or redux if you're feeling fancy
I don't know your usecase, I just didn't think a socket had any place on the state
What travis said
stackoverflow.com/questions/45689455/… just the blind leading the blind I guess lol?
16:23
i handle all of that work in my store
I don't even know why I'm arguing lol. I don't think I even need in state. I'm setting all handlers in the component mounting.
the react component doesn't mess with it, it just presents data from the store.
@DavidKamer this is literally the advice I gave you a couple days ago, if I had time I'd look through the logs and link it, I told you to try to call setState just once in a function if possible and then you linked me the react docs showing how they batch some setState functions
@DavidKamer You can put it in componentDidMount, just don't put it on the state
It has nothing to do with react
It's just a websocket. It has its own events and whatnot
@Cereal so how do a force it to close when the component unmounts?
16:24
componentDidUnmount() {
  this.socket.close()
}
Or whatever the syntax is
@Cereal could someone theoretically bind a different socket that way?
Would it be any easier than if it was in state?
I don't understand your questions
It's just a class
It's a property on a class
user1596138
I was saying it's dumb that you call setState which is asynchronous twice
@Jhawins React will group them either way
@Cereal I read that that day too lol
16:26
51
A: What happens when using this.setState multiple times in React component?

Chris GaudreauReact batches state updates that occur in event handlers and lifecycle methods. Thus, if you update state multiple times in a <div onClick /> handler, React will wait for event handling to finish before re-rendering. To be clear, this only works in React-controlled synthetic event handlers and l...

user1596138
I know it jus looks like kludge tho
That doesn't mean you should do it
user1596138
Cause it sort of is lol
it's easy in this case to not do it, but it's not really relevant
@Cereal properties in classes and functions are easily maligned in JavaScript
16:27
Can you just state your concern instead of asking vague questions
@Cereal So here is the scenario:
it can still lead to issues though if you do it often and update the same property, the 2nd update could have old data due to first update, personally I only want to setState in a function once if at all possible, due to the async nature of it
user1596138
@Cereal who me? I don't have any concerns just found it odd that he's still using that
@Jhawins no, david
user1596138
I'm also David
16:29
the other david
Hacker L33T69 has a website that uses Medium and my client is on that site. L33T69 knows how to bind things to my classes using standard JavaScript. He binds a new socket to my socket, steels the user's message and token. Can this be done as easily with it in react's state?
Nicholas Cage stars in a Red Box Exclusive! Wow, he really fell didn't he
user1596138
Obviously you check for the sockets existence before creating it
that is the scenario I'm worried about
user1596138
Obviously you can overwrite a class property
user1596138
16:30
Not sure what you're getting at
@Jhawins How easy is it to overwrite state in React?
user1596138
@DavidKamer if that's even possible you fucked up hardcore. Nothing in the client is secure.
without react telling me?
@DavidKamer The client downloads all of your code when they visit the site
Nothing client side is secure or confidential
@Cereal not what I am saying
16:31
If your user has access to someone else's information because you're downloading all of it for some reason, you shoudl not do that
user1596138
Yeah that's just totally wrong if that's a possible concern. Like massively bad
Yes it is
You're concerned that they're goign to redirect your messages to their own server
which means you're sending information they shouldn't be seeing
You don't even need to rebind the socket, you can just open the network tab and look at it
user1596138
Anyone can find that socket and subscribe to events on it in the client regardless of where it's stored
user1596138
16:32
Or yeah you can just view the frames in Network ^
Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications. XSS enables attackers to inject client-side scripts into web pages viewed by other users. A cross-site scripting vulnerability may be used by attackers to bypass access controls such as the same-origin policy. Cross-site scripting carried out on websites accounted for roughly 84% of all security vulnerabilities documented by Symantec as of 2007. Bug bounty company HackerOne in 2017 reported that XSS is still a major threat vector. XSS effects vary in range from petty nuisance to significant...
if you use ssl, it should be difficult for them to intercept/redirect your traffic?
mitm
user1596138
Not from inside of the page.
@TravisWhite yeah, but xss isn't hard
user1596138
This... Yeah NVM
16:33
@Jhawins I'm just paranoid, I know lol. It's moving to redux state anyway lol.
Your concerns are misplaced
Nothing should be available to the client that you don't want them to have
Because there's a way to get it
I'm not doing that
The nyou have nothing to worry about
user1596138
JSON-P and Shadow DOM
I'm just worried that someone could replace my created socket with another to redirect the messages
user1596138
16:35
That doesn't even make sense
ok, so I create a socket for mywebsite.com:77000
@DavidKamer Yes. And the messages are going from the client to the server
Which means information the client has, is being sent to the servre
Which means the client has it
which means you want them to have it
they then create one for powned.com:420
which means they already have it, regardless of where it's going
they replace my instance variable with theres
it's not hard to do
user1596138
16:36
Replacing the reference won't replace the socket. Closing it and putting a new socket there won't do anything bad as those messages are already completely accesible. They'd just send things where they want outside of your component lol
user1596138
Maybe we should ask this a different way
user1596138
What in the hell about your code makes that not just as easily possible?
@Jhawins so there is 0 possibility that they could just override my socket with one pointing to their website and send private data to themselves that way?
user1596138
He was talking about putting the socket on the instance of the component.
Hey guys , how would I chain filter to filter an API response only with responses I want and then use map to push to the array some image URL? - is this the right direction?
currentImg2() {
const flist = this.forecasts.list;
const image = flist.filter(images =>
images.weather[0].main.toLowerCase().indexOf('clear')
)
.map(image.weather[0].main =
'http://www.pocketables.com/images/2012/07/sunny-608x333.jpg');
}
user1596138
16:38
@DavidKamer If that's possible like I said you already massively failed.
user1596138
Like if it's possible for that to be a problem.
user1596138
What's to stop them replacing your entire component instance lol. It's just a really silly concern and your code doesn't mitigate your concern in any way.
@Jhawins Have you ever seen any XSS or know much about how it works? I don't mean that to sound rude, I'm probably much worse than you in my knowledge on it, I just want to know if you have relevant knowledge on XSS.
user1596138
Yeah I definitely have a firm grasp on that
user1596138
@DavidKamer How does your code change the affect of XSS
user1596138
16:40
Vs. storing it on this.socket instead of this.state.socket. It's identical in this area
You're on your own. Glhf @Jhawins
user1596138
Meh I'm done too I got work to do
@Jhawins so, my theory is, someone would could bind directly just knowing the class name. If it is setState, I don't even know how they would do that without altering the source code. Biding would be easy
user1596138
The class isn't the instance.
user1596138
Even if it was that doesn't make sense... Looks like it works for you, keep on keepin on :thumbs-up:
16:42
alright, I'm not saying I'm right and/or not paranoid, it just seems bad to leave a socket laying around anywhere other than a store of some kind.
@Jhawins thanks for not telling me I'm an idiot for doing it different lol, I know that it can be done the other way and isn't as out of "pattern" with react, but I have my (paranoid) reasons. Paranoia has kept me pretty safe so far lol.
user1596138
It's not about patterns it's just about what actually makes sense
user1596138
You have no reasoning for the way you're doing it. Just baseless "paranoia" lmao. I like to code with logic and reasoning
user1596138
It was never an issue anyway tho. You just told us you had other needs that meant it couldn't be state the other day :P. Idc man, do you
@DavidKamer What do you think a store is?
or a state?
It's all objects. It's all available to the client.
everything is 'just lying around'
Ok, let me explain my logic behind it instead of what I'm trying to do
user1596138
16:47
@DavidKamer Not sure I follow that line of reasoning but we did suggest it sit in a store from the very first message. React State is not a store :P
I figure that it is much more difficult for someone (whether through an automated script or not) to directly set my state with a malicious attack on the client that has the page loaded than it is to override my socket with a bind call on my component's class.
user1596138
It's absolutely no different. If you're looking for an answer to that
The reason I don't want you to put it in the state, is because it's never going to change
Your view isn't changing based on changes to a websocket
Your websocket is receiving and sending messages, and those events are going to subsequently change the state
user1596138
21 hours ago, by David Kamer
@Jhawins I'm just pragmatically saying that doing everything "the right way" isn't always the best way to make money.
user1596138
It must not be profitable to actually grasp and learn React
16:49
@Jhawins ouch
many variables that could be put in state end up in a store when the application grows, that's what I meant and it is more convenient, when reviewing my code, to see that something like a socket in my state needs to be placed in my store, redux.
user1596138
If you're using redux I guess nothing really matters anyway
user1596138
You gonna hate yourself no matter what lmao
@Cereal can you clarify that?
So when the state changes, react runs the render method
Yes?
@Jhawins Redux made me have a life crisis, but now it makes complete sense. I'm insane now tho... so...
@Cereal of course
16:52
const flist = this.forecasts.list;
const image = flist.filter(images =>
images.weather[0].main.toLowerCase().indexOf('clear')
)
.map(image.weather[0].main =
'http://www.pocketables.com/images/2012/07/sunny-608x333.jpg')
Hey guys , how would I chain filter to filter an API response only with responses I want and then use map to push to the array some image URL? - is this the right direction?
Okay good. So you assign create and assign your socket, and you put it on your state
Your variable on the state is now an instance of WebSocket or whatever you were using
It's never going to change
Why is react watching it?
but what if I always want to check if it has changed?
so something like :
user1596138
Do you use it in render
user1596138
16:53
Otherwise you're not checking it
in mobx you could do reaction(() => this.socket, socket => console.log('socket changed');
this.state.websocket.url !== goodsite.com && this.props.history.push("/logout");
user1596138
My socket in mobx isn't even observable because the component should never have a clue where the messages are coming from, IMHO
user1596138
There are other derived values that are observable, but the socket itself no
Yeah my sockets aren't observable either
Are you logging in with a websocket?
16:55
@Jhawins thats the plan more or less, but I'm contemplating using a different socket server for that
Do cross origin requests work on websockets
user1596138
@DavidKamer Wtf lmao you don't need to verify the socket is on the right domain unless your entire application arch is fucked
@Cereal no
@Jhawins just like I don't need antivirus because I have a firewall lol?
user1596138
I don't know how to reply without being rash
user1596138
How long have you been doing Front End?
16:57
I'm pretty much done talking about this, but my purpose was to either a) check for changes on my socket and log the user out if there is an issue or b) eventually put it in redux state and pass it down as a prop.
@Jhawins I don't. I hate it and I'm just doing it because I want to get something done. I honestly would be working on neural nets in python right now if I didn't see a need for starting this website
well decision trees that use neural nets but sam diff
@Jhawins wow, that is freaking sweet
@Jhawins I was thinking about doing this:
let undefined = "I'm defined now";
or
let undefined = (e)=>(window);
is that bad?
:D
@Jhawins did you make that?
user1596138
@DavidKamer Identifier 'undefined' has already been declared
user1596138
That shit don't work no more
hehe ||
really?
Even on IE?
I just read a post about it on SO, but it must have been a few years old.
17:04
that codepen is incredible
I don't think I've seen it before
now implement it in css
I wonder if people like that work for hollywood doing fake UI's for Sci-Fi shows lol
fake UIs probably aren't programmed in JS lol
user1596138
I mean
user1596138
It's 170 lines of JS.
they're probably rendered
user1596138
17:06
Probably nobody is about to go call the creator some crazy savant
certainly not. Still great JS though
@Jhawins like you think it should be way less?
user1596138
The only thing I have on codepen is my shitty piston motion simulator with most the options removed codepen.io/Jhawins/pen/wBoerb
user1596138
@DavidKamer No. I just thought the implication that he was like some hollywood level animator was funny
@ndugger was at lunch, ty for linking that
17:10
@Jhawins I wasn't saying that it was qualifying, I meant people who just do that. I'm not saying holographic stuff, but I'm saying like on NCIS when it's some made up tool that would take like 5 lines of code and is way less complicated than that. Sure they could do like a custom linux distro or desktop, but why do that when CSS and F11 exists lol
why not just play a video on the phone screen
what like guihacker.com
that shit is legit 😉
exactly lol
lol I made that for a random answer on code golf
17:11
I've always secretly wanted to do that. It's like the ultimate job as a front end developer lol
one of my random pens on my profile
user1596138
I heard the guy who made guihacker.com also made the snow on Steam's winter sale
@Jhawins lol
@Loktar whoever wrote that was pretty stupid to use random floats instead of, say, hex ;)
@KendallFrey it has to appeal to the masses!!!
user1596138
17:12
Didn't someone use your tetris too
@Jhawins yeah google dev video used my 3d drawing pen too
threadless.com used my snow forever ago too for a few years in a row
still waiting on my checks though! /s
user1596138
I would post this one I've been working on but it's on my PC at home
user1596138
Using React Konva lol cause I'm a pleb
user1596138
17:13
It's fast af tho.
user1596138
I thought using the lifecycle in React would cost a lot more perf
@Loktar damn. It'll end up in a movie at some point and you're going to be like, "look at that fake ass ui I built that's controlling fake nukes and shit!"
lol, it was in some college promotional video
made me lol
user1596138
Oh yeah lmfao
love the 3d sketch one
user1596138
17:14
It was being used to make people look busy just like the original intent wasnt it
> guihacker saved my life!
292
A: Make it look like I'm working

LoktarJavaScript So I went a little crazy with this. I did it between breaks from working on my GUI to track IP's using Visual Basic. You can access it by going to the super serious domain I made for it tonight as well so you can look busy anywhere Gui Hacker and fork and create your own from the fol...

what licenses is CSS3 under?
^ that's where it came from originally
@Loktar You've probably seen hackertyper.net yeah?
user1596138
17:15
> Basically, if you have this running no one will bother you because they know you are doing some serious stuff.
yeah, people compare it to that all the time
I need to make cool stuff again
@KendallFrey holy hell that's bamf lol
haven't made a pen in years
cc @KendallFrey
i haven't made a fiddle in a while either
if you want to remember some oldies in the chat
aww the music doesn't play anymore
@Loktar what the fuck
user1596138
@Loktar HOLY. That thing went full seizure mode on me
damn @KendallFrey you're not even listed
@Loktar it sure as hell played for me
I need to add you haha
oh really?
17:18
pls no
Music didn't play for me at all bleh.
> Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first
Hey all.. simple question - how do you add a property to an object using map? it works fine with for loop but then I put it inside a map and it doesn't work and return: TypeError: http://icons.iconarchive.com/icons/icons8/ios7/96/Weather-Sun-icon.png is not a function
at Array.map (<anonymous>)
at
what are you using, chrome or someshit?
yeah
17:18
This is the push to the object: this.forecasts.list.image = 'http://icons.iconarchive.com/icons/icons8/ios7/96/Weather-Sun-icon.png'
user1596138
@Loktar is this part intentional lol
yea
user1596138
Ohh okay
user1596138
17:19
Did commodores wig out like that
user1596138
J-sus
haha
can any of you do Rust?
I am slightly familiar with Rust. @ShrekOverflow knows more
@RoelvanUden can
he's the Rust master iirc
user1596138
17:23
I Rust if I get left out in the rain
I gave Rust a real college try, but the type system is way too strict for someone of my background. I'm gonna try C++ instead and then move to Rust again later if it's still popular
do companies usually have merge masters for git?
@makat whats the code?
@makat make a jsfiddle, jsfiddle.net you're way more likely to get some help
user1596138
@Loktar I did the dumbest and funniest thing over the weekend in canvas
what?
user1596138
17:27
I was trying to just make a damn circle and I tested that it was perfect and in the right place by moving a square really quickly around it
user1596138
And ofc it made like a weird diamond shape
user1596138
And I spent like 30mins trying to figure out wtf was wrong before realizing it was just because I was moving a square around the circle and squares have corners lmao
user1596138
I switched to a circle and it was perfect lmao
user1596138
Idk if I explained that right. Was trying to run something along a perfect circular path but I ran a square around it so it looked crazy
@corvid not sure what a "merge master" is
user1596138
17:29
I laughed at myself for 10min
lol I think I get what you're saying
I'm jealous
oh man, I haven't mentioned we got a 14' Trampoline
and it's amazing!
Get a net on that ish
pic?
17:38
psh, my grandparents had a huge trampoline with no netting and a rock solid steel frame
no fatalities, somehow
yeah, we didn't have a net
i'm still alive
oh, you mean side-net?
I was like "wut, what did you jump on"
yeah I need to get a net
and if you didn't mean a side-net: wut, what did you jump on?
only way home insurance will insure it
we got it for free overall
saved us like $250
no holes, great condition, just sans net
the thing is I want to go jump on it when the kids are in school
but I'll look odd to the neighbors
I prob shouldn't gaf though
17:43
neogaf
gross
@Loktar "Oh look, an adult trying to stay in shape. What a curiosity in a culture that only encourages fitness in pre-adolescents."
@KendallFrey well I mean all of our neighbors have them.. but I've never seen an adult use them :/
but yeah good point
in reality I'm just doing it because it's fun af
To be honest, I'd be nervous as an adult
user1596138
17:46
@Loktar @KendallFrey this is what I meant lmao codesandbox.io/s/wrqjp8pjk
don't let your stuffy neighbours prevent you from reaching new heights, bruv
lmao
I don't think my adult knees could handle it, to be honest
@Jhawins ohh
user1596138
It's because I used friggin squares lmao
17:47
since when did dugger get so motivational
> Could not find dependency: 'react-konva'
user1596138
tf
ah had to refresh
works now
user1596138
Ah weird
LMAO nice dude
17:48
@Loktar you really need a modern browser mate
user1596138
Don't click it FYI
user1596138
Seizure alert
@KendallFrey man I need to switch to IE or something
Chrome sucks eh? :P
wtf do you use @KendallFrey?
user1596138
17:48
Click this one lol
user1596138
I love codesandbox that was so easy took like 10min
user1596138
All my code is on my local PC at home so I just redid it lmao
oh jeeze friggin Opera
the prettiest browser no one uses (much)
I see a static green circle-like thing. Am I supposed to be seeing something else?
17:49
lol, the component's name is "Grower"
maybe I should give it another shot
They should rename the "Stage" component to "Shower"
user1596138
For complete example I updated it to Circle codesandbox.io/s/wrqjp8pjk lol looks fine. I was just being stupid af
user1596138
lol @ndugger doesn't have me blocked anymore. Cover blown.
17:51
@KendallFrey that thing has a name
and his volume only depends on the height
saw it on numberphile
and the mathematical demonstration
@Neoares what are you talking about
@Jhawins I have you ignored like 95% of the time. I unignore to get context of a conversation that I can't see
the napkin ring?
so yes, you got me
user1596138
Exact same
17:55
This is how SO feels half the time: youtu.be/sG-ILHABK_o 20 seconds in
@KendallFrey yes
you sure it wasn't vsauce?
yeah sorry
it was vsauce
idk why you thought of that though

« first day (2761 days earlier)      last day (2409 days later) »