« first day (2750 days earlier)      last day (2192 days later) » 

8:00 AM
i thought it returns the function itself, not a value
 
!!> my_func = (a) => 5; my_func(5);
 
@Neoares "undefined" Logged: 5
 
yeah it's being called there
 
@Neoares 5
 
if you don't add {}, it will return whatever you put inside
but you can only add 1 statement
 
8:01 AM
ah ok, so without curly brackets
it just returns
 
yes
 
so that's why in the example, there's parenthesis
 
Hey guys, im unfamiliar with this syntax of functions: var indexOfStevie = myArray.findIndex(i => i.hello === "stevie");

And don't even know how to search for it ( talking about the => thing). Can anyone link me to some terms or documentation to learn this?
 
@poiasd 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.
 
because if you want to return an object you need to add parenthesis
 
8:01 AM
this.setState(prevState => ({ items: prevState.items.concat(newItem), text: '' })
 
otherwise you have to do { return {a:2}}
 
ah i see it now
 
prevState => (...)
 
Thanks @BenFortune
 
8:02 AM
so this is equivalent to function(prevState) { return {...}; }
 
With the bracket it's an implicit return
 
yes
 
gotcha
 
and the equivalent to (prevState) => { return { ... }; }
 
so this.setState takes a callback
 
8:03 AM
or an object
 
and is called by react
i've only used it with an object
 
react recommends you to give the object directly
 
so i got confused
 
> The second parameter to setState() is an optional callback function that will be executed once setState is completed and the component is re-rendered. Generally we recommend using componentDidUpdate() for such logic instead.
 
well the 2nd parameters wasn't being used
in the example
 
8:04 AM
well
> setState(updater[, callback])
it means the callback
you can use only the second parameter, as in your example
 
huh?
how does js know to use the 2nd parameter
 
Anything in the [] is optional
 
i understand that
but as i understand it, in order to use the 2nd parameter, u need to have something in the 1st
 
you said the 2nd parameter is not being used, but it means the second parameter in the documentation, which is the callback
 
@Neoares ee no
 
8:05 AM
yes
 
@RobertCalove The function can list all possible parameters and then check which ones have values and use them accordingly
 
this.setState(prevState => ({ items: prevState.items.concat(newItem), text: '' })
 
prevstate is updater's
 
this is only using the first parameter
 
8:06 AM
then provide a first parameter
 
yeah so i'm understanding correctly then, i was getting confused
in order to use the 2nd param, u have to have a filler for the 1st
 
@Mosho Oh I liked what i saw about it. Looks like a fantasy XCOM... I might dwelve into it in the future. Maybe when I clear Blade of Darkness without any saves.
 
yes
 
e.g this.setState(null, () => {})
 
oh, I thought you meant the second parameter as the callback
 
8:07 AM
can't call it the second parameter if it isn't, well.. the second
 
haha yes
i appreciate the help, neo, and all
 
so you can use only the second parameter of setState, which is the callback, but the callback needs to have both parameters
^ to be clear xD
no wait
 
you can use only 1 parameter for the callback
this.setState((prevState) => {
  return {quantity: prevState.quantity + 1};
});
 
some languages used named parameters which lets you do like function(namedParam1='value1', namedParam2='value2')
 
8:08 AM
like in componentDidUpdate, and such
wait, I'm an idiot xD
@KamilSolecki that
is what happens when you don't read carefully the docs
 
O neat
Github added a shortcut for instant reply messages
I do have to use Ctrl+# for adding a prepared message
 
Uh, since some confusion was introduced, let me write this again. the first parameter is updater, and it can either be a function with a signature of (prevstate, props) or an object. The second parameter is a callback, which you hgenerally shouldn't use but rather have that logic in componentDidUpdate() @RobertCalove
 
^
had to read the entire documentation
 
does anyone has experience with emmet plugin?
Can anyone help out on this? stackoverflow.com/questions/50013139/…
 
god, I'm sick of this guy calling me up at work on my personal cell phone
I don't even know how he got my number
 
8:23 AM
who
 
stalking?
 
I can smash his head for a brownie
 
tell him to stop calling you at work on your personal cell phone and ask him how he got your number
 
Well it's for work, but he uses it as his own personal channel
 
@towc yeah, that's like saying "tell a rapist to stop raping you"
 
8:24 AM
Maybe I could understand if it were during work hours and for whatever reason, I didn't respond to his e-mails
 
maybe
 
But he's called me after work once, and he always calls before writing me an e-mail
 
or maybe i'll crush his family
 
@Neoares that's way over the top
 
no, a plane is over the top
what I meant is that that is not how things always work
 
8:26 AM
the XY plane?
 
@Neoares it's worth trying
maybe he doesn't realize it's annoying
2
 
I'm seriously tempted to just block his number
 
@Ikari well
 
if he needs me he can write me an e-mail
 
depending on what's Y and what's Z
 
8:27 AM
tell him exactly that
 
@towc says the jobless guy
 
I'd say over the XZ plane
 
@FlorianMargaine does that have something to do with this?
 
@towc heh
 
@towc yes, you want him to join your side
 
8:28 AM
you can tell him politely
 
we did
 
"hey, I'd rather use my personal phone number for family. Do you mind calling me at this number instead?"
 
Well I don't have a work phone
but I figure if that were important enough, they'd give me one
 
so you only want email, right?
 
I got a work phone without needing it lol
 
8:29 AM
I want e-mail to be the preferred means of communication because sometimes I'm in meetings
 
@Neil ask zucc
 
And even if I weren't, honestly, it's my business what I do at work
 
last time I said I preferred emails to phone calls, the room went on about how managers don't have time for sorting through emails
let me find it
@Neil isn't it factually not? Unless you own the company?
 
@Neil do it then
if you do not know how he got your number and he keeps calling you despite your advise to send a mail instead, show where the line is
 
---- <- here
 
8:34 AM
can't find it
 
@towc True, but unless my boss is over my shoulder telling me what I should be doing, generally I do what I think has priority
 
^^^
 
And honestly, we're supposed to be coordinating tests with this guys after my changes, and then I don't hear from him for a month and a half
Now he calls me telling me he needs to have this working by the start of May and that it's incredibly urgent.. excuse me if I don't think it's priority
 
@towc this one ?
 
@KarelG don't think so
 
8:38 AM
what is the best practice for including functions and so on
I have a file with big ass functions and event listeners, should I just put everything into 1 function and then call it in the html with body=onload or is that kind of bad
I feel so unprofessional while doing that
 
that's not only kind of bad... that's really, really bad
 
how should I do it then
 
modules ftw!
 
General rule of thumb, if you have to do groups of operations more than once, make it a function
 
I do that already
but how can I execute em when the page is loaded
 
8:41 AM
If you have a huge function of which several operations have a logical grouping (even if they don't repeat), make it a function
 
so my shiny jquery doesnt run into a error
 
@AltayAkkus make modules, split up where necessary and where it makes sense, provide one (or more) "entry" files, use a bundler like webpack, load the bundled code into the page using a script tag
 
Make one call another
 
that's how it would make sense to do it. for starters you can also just split it up in files, add them through script tags at the bottom of your page
Unrelated... my night read is Clean Code at the moment, but right now we have to work with Matlab for a statistics course at the university
it just feels so wrong
 
Is there a machine learning training set for suspicious logins?
 
8:43 AM
Im not doing that heavy shit js
how can I listen for an change of an table btw
 
@ShrekOverflow now that's an oddly specific question
 
@ShrekOverflow Now I am curious about that either
 
I need to add an placeholder if the user deletes all rows because the table looks shit
 
nothing on kaggle?
 
@KarelG I want ...
Nope can't find
 
8:44 AM
@ShrekOverflow thats a fucking good idea
 
would be difficult to train..
 
ye probably
and too easy
I mean like literally
 
@Neil In my experience not really
 
"suspicious" is kinda subjective though
 
like you could simply rely on very common huristics
 
8:45 AM
add an interval to it after 5 login attempts 15 seconds pause for the account
 
where would you get the data for "suspicious" activity?
 
to start
and then have user's input
@Neil known "I wasn't logged in from here", "Not me attempt"
 
If the very common heuristics are sufficient for finding data, they're also sufficient for finding suspicious activity
 
better would be a js library to detect botting, scraping etc
 
I can obviously generate bogus data
Google does it btw.
 
8:46 AM
you could do a thing like paypal does
 
you should ask google for their secrets :)
 
And I am pretty sure there are startups that are doing the same
@KarelG Google ofc. won't share the data
but I wish this tech was more open / tweakable
 
but but ... they hoard our data
 
whenever you log in your ip is stored, and when you login in germany at 8am and 20 minutes later in brazil they think wait wtf
 
it becomes hard to even find the dataset to experiment
 
8:46 AM
so I deserve to get some data in exchange
 
That's missing the point
 
@AltayAkkus VPN
Google handles that case too somehow
 
VPNs are detectable and most of the password bruteforcers dont use vpns
 
even when I switch VPN like a crazy bufooon
 
The point of using machine learning is to make it spot those hard-to-find cases. But if you trained it using easy-to-find scenarios..
 
8:47 AM
they figure it out
 
they connect your ip with the google login request
 
its also overengineered as fuck
 
@Neil That is exactly why this becomes a chicken and egg problem
 
like srsly
if you want to have an secure login
 
they probably have an algorithm to analyze each login entry using that data
 
8:48 AM
@ShrekOverflow I suppose
 
after every 5th wrong attempt the account gets blocked for 10 seconds
 
I'd like to try at any rate :)
 
Heh, just wondered if any of you came around something
@AltayAkkus We do that, we literally block the user after 10 failed login attempts for the IP
 
I rely on openID connect for handling logins
 
but then, you open a DOS for the user
 
8:48 AM
bruteforcing 123456 would take 300 smth hoursa
 
in combination with lock outs and some IP logging. But that last one has to be revised
 
open a dos for the user?
 
@KarelG Hehe, 😉 I love you <3
 
because EU wants us to keep only 3 days of logs
 
8:49 AM
@AltayAkkus If you were to block foo@company.com after 5 failed attempts, I can just do 5 failed attempts and the user won't be able to login to their account.
 
well then dont block the user
 
@KarelG Use Auth0 :3
 
and use 2 factor auth
 
you have to limit your data collection too :P
 
blocking the user is senseless
 
8:50 AM
We do that for everyone, at scale and a lot other legal stuff etc
 
after every 5th login attempt or 10th you block the user login for a minute or a half minute
and after 20 false login attempts you get ip banned
so they would need 1 new ip for every minute of the account blocked
 
Or, you can just use a captcha and offload this piece to Google or use something like Auth0 (I work here), and offload it to us
 
ye just use recaptcha
every single recaptcha costs like i dunno 0,4cents so
 
I thought re-captcha was free because they get to do machine learning off it for free
 
That's what I had assumed
 
8:52 AM
isnt recaptcha free?
 
you tell us
 
no solving recaptchas costs money
for the bruteforcer
 
oH lol
 
there are chinese fabrics
 
re-captcha is increasingly hard
 
8:53 AM
with people working on solving your captcha and sending it back via api
 
so if many attempts it'll just make it harder for you
 
no its real people choosing the images and sending you the img info via api
 
@AltayAkkus That is a sad existence
 
The more sophisticated checks now will give you 3x3 photos and tell you to pick out all the photos containing cars
They don't really care about accuracy.. they look at your mouse movements
 
8:54 AM
@AltayAkkus yes but if you do it from the same machine it'll increase your cost very significantly as captcha now gets harder by attempt, exponentially.
@Neil Oh that explains why it thinks I am a bot.
My mouse movements are twitchy and accurate, like a CS player
 
Why would you be a bot? WE'RE ALL HUMANS HERE!
 
my captchas are harder than anyone else around me :(
 
i dont think so images play a huge role
 
google tracks your mouse movements yes
I am curious when they decide if a movement is human or robotic
 
@KarelG probably a machine learning thing
 
8:56 AM
I can put a script with firing events with random paths
 
they expect linear and smooth movements in a mouse controlled by a bot
 
should you include js files in the head or at the bottom of the body
 
though they could probably fake that too
 
@AltayAkkus Depends on what you prefer
 
@Neil i can use my own mouse movement as training data
it is a part of their determination when a human is a robot
 
8:57 AM
when i place it on the bottom of the body does it load when the page is loaded?
 
I get it almost all the time that I have to select which picture is what to say that I am human
 
no, you get an harassment suit
 
@KarelG My guess is that the checks are more sophisticated than the simple "check if linear" nowadays
 
that is because I mainly use my keyboard
barely a mouse
 
@KarelG same
 
8:58 AM
those logins are auto-focused, so ...
 
+ mouse keys + twitchy mouse movements
 
they need to do a freakin' statistical analysis on actual human input to be able to say with a percentage the possibility of mouse movements being human
 
if they removed it, then in some situations I have to use my mouse
 
Google Captcha V5
 
which would reduce that # of questions
 
8:58 AM
Turn on the cam
now perform : "x dance here"
 
and wave to it
 
lol yep
and if it thinks you are a bot makes you do random Yoga
 
The captchas of the future would likely require use of a camera to check eye movement
 
@AltayAkkus script files are loaded at the point the script tag is encountered
then it fires a load event when it is complete
 
@Neil That would be a really high power camera
 

« first day (2750 days earlier)      last day (2192 days later) »