« first day (3517 days earlier)      last day (1414 days later) » 
00:00 - 19:0019:00 - 00:00

12:38 AM
 let XYZ = {
  HealthCUser_refresh: 'eyJhbGciOiJIUzI1NiIsInddddR5cCI6IkpdddXVCJ9.eyJ1cddd2VySWQiOiIxMDE2MzMxMDY5OTk0MDUxNCIsImVtYWlsIjoiY2hyaXN0aWFuMTUyMTNAZ21haWwuY29tIiwiaGFzaElkIjoiJDJhJDEyJEN5cC8yUjJ1Qy5lRHE0cVM3RXI2UmV4WlRGZzFxYXpCYVJhUjB2bjRRZ2dlbnhqSjlhRG1tIiwiaWF0IjoxNTkxMDU1NjMyLCJleHAiOjE1OTEwNTU3NTJ9.I0RW6H0keFiEBLeBMWv85L8gOc4oefR9nsazOxam7y0',
  fbsr_231881927922794: 'N7fFOf7Qw3se8eTBSQSm4SBzCKwHztvlQIW7UJqscjc.eyJ1c2VyX2lkIjoiMTAxNjMzMTA2OTk5NDA1MTQiLCJjb2RlIjoiQVFDVWxoVVliUTBuMGVSTk1wTHdhWjltb2twdTFDaF9aZ2Zaa1R2emVRNjlfLUtVVUF2UkwyajlxQzRJS0VxcjVMWjRLYnQ0VlNwVGtwV1FkVUl2bFZWc
wrote this to access a facebook login token. i feel like I should be using reduce or something. What do you think?
is there a better way to decode a base64 sstring?
this emits a bunch of errors
const decode = Buffer.from(fbRToken, 'base64').toString('utf-8');
 
1:13 AM
@paul23 what docs?
 
I find the whole protest ridiculous, due to the protesting now we have harsher anti corona measures from tomorrow onwards in the netherlands.
 
@paul23 this is so dumb imo
I'm not going to get into the politics of the protests, right now, but I am in support of the non violent protesters. But disabling docs is so stupid.
add a banner if you must
no reason to disable
 
1:46 AM
looks like you can still browse the docs at github
 
so I am getting this error
Unhandled Promise rejection: Cannot set headers after they are sent to the client
because I am trying to rebuild a token, which I do successfully but my api is saying hey you can't "reset" the headers after they've been sent.
anyone familiar with that
 
2:29 AM
Quick q, in node.js if i do await something().then().then() etc, with code hapening inside the then blocks, will await wait for all of them?
 
2:41 AM
I need help getting an xpath...'//dl[@class="userinfo_extra"]/text()' is returning blanks
I need to catch the join date
Nvm, got it. was just missing /dt/ before text
 
@JossieCalderon I've seen so much random stuff on that form. How does a body builder form end up talking abut python? lmao
 
3:06 AM
@JBis When he gets injured from squatting hundreds of pounds of weight LMAO
and also quarantine
and curfews
 
ah, soon enough you'll be able to program a bot to lift the weight for you
 
yeah when i turn into a cyborg
 
@JamesBot test
 
3:28 AM
questoin
I tried to return something in a promise... that's not legal?
try {
                                const result = await findUser(collection, response.data.email);
                                console.log('result = ', result);
                                if (result) {
                                    const hashCompare = await bcrypt.compare(`${response.data.id}someServerKeyFrom.Env`, result['userId']);
                                    console.log('hashCompare ', hashCompare);
                                    if (hashCompare) {
                                        const token = await jwt.sign({
 
alright new feature idea, james detects code and formats it himself
@ChristianMatthew where are you returning something?
 
when you use next();
is that inherently a return?
 
do you mean return, as in the return keyword or as in the response to a http request?
 
return like return
 
thanks for the clarification
 
3:40 AM
} catch (error) {
        console.log('error', error.message);
        // first find out if their token was expired and then renew it.
        if (error.message === 'jwt expired') {
            console.log('do something here');
            // Cookies that have not been signed
            console.log('Cookies: ', req.cookies);
            let fbRToken = {};
            let fbRKey;
            let fbAccessTokenCheck;
            for (const [key, value] of Object.entries(req.cookies)) {
                const isFblo = key.includes('fblo_');
 
next() doesn't implicitly return anything
 
ok and also, this is a question, you can't "return" things in a promise then chain?
 
you can
 
j,,,
i don't know because when I had in that code return next(); but also at the end I have a this
return   res.status(401).json({
                        message: 'Auth failedd'
                    });
and that was messing up all types of things
i think it's because it's middle ware
 
||> Promise.resolve(3).then(a => { return a + 2}).then((sum) => console.log(sum));
 
3:42 AM
@JBis undefined Logged: 5 Took: 0ms
 
in that example you don't need the return
and it is a return to the promise chain not the outer scoped function
like I would need to return the promise
right
 
you do need the return in that example, but yes the return is scoped to the current function.
 
but I think that was it returning the promise is what I should have done
 
function x(){
   function y(){
      return 3; // return value for y not x
   }
}
you can return promises too
 
yes but outside of that if you have not returned func y a function after that can still fire off
 
3:44 AM
||> Promise.resolve(3).then(a => { return Promise.resolve(a + 2)}).then((sum) => console.log(sum));
 
@JBis undefined Logged: 5 Took: 0ms
 
@ChristianMatthew yes, but you can have an empty return statement
 
that's not what I am saying
function x(){
   function y(){
      return 3; // return value for y not x
   }
   return 'something else'
}
the something else wins
unless you do this.
function x(){
  If (something happens = true)
  return function y(){
      return 3; // return value for y not x
   }
   return 'something else'
}
 
@ChristianMatthew 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.
 
@ChristianMatthew it doesn't "win"
 
3:47 AM
you know what I mean
 
3 is returned from y, something else is returned from x
in your second example you are returning a function, not a primitive
 
no x will return 3 if true and if not it will return sometnhing else
 
if you want to pass through you can do this
function x(){
   function y(){
      return 3; // return value for y not x
   }
   return y();
}
 
@JBis 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.
 
@ChristianMatthew no it won't
 
3:49 AM
of course
 
||> function x(){
  if (true){
  return function y(){
      return 3; // return value for y not x
   }
  }
   return 'something else'
}
console.log(x().toString());
 
@JBis undefined Logged: "function y(){\r\n return 3; // return value for y not x\r\n }" Took: 12ms
 
see, its returning the function not 3
 
put it to false
 
||> function x(){
  if (false){
  return function y(){
      return 3; // return value for y not x
   }
  }
   return 'something else'
}
console.log(x().toString());
 
3:52 AM
@JBis undefined Logged: "something else" Took: 0ms
 
no remove the return from fucntion y
function y
and put it back to true
 
||> function x(){
      if (true){
      return function y(){

       }
      }
       return 'something else'
    }
    console.log(x());
 
@JBis 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.
@JBis undefined Logged: "something else" Took: 0ms
@JBis undefined Logged: `` Took: 1ms
 
no remove the function return for func y not the inside and
 
nothing is logged
 
3:53 AM
make it true
 
||> function x(){
      if (true){

      }
       return 'something else'
    }
    console.log(x());
 
@JBis undefined Logged: "something else" Took: 0ms
 
no keepfunction y as it was before
just remove the return from the func part
 
you can do it
just prefix your code with ||>
 
||> function x(){
  if (true){
  function y(){
      return 3; // return value for y not x
   }
  }
   return 'something else'
}
console.log(x().toString());
 
3:55 AM
@ChristianMatthew undefined Logged: "something else" Took: 0ms
 
so what was the answer
is it the logged?
 
yes
 
see what i mean
the return in the fucntion doesn't have anything to do with function x
 
of course
function y isn't even ran there
 
well yea I made that mistake for 5 hours
well if it were a promise you could return it
are you good with express?
 
4:02 AM
you can return a function too
||> function x(){
  if (true){
  return function y(){
      return 3; // return value for y not x
   }
  }
   return 'something else'
}
const z = x(); // this is now the y function
console.log(z()); // i call it here
 
@JBis undefined Logged: 3 Took: 1ms
 
ahh yes
 
@ChristianMatthew "good" is relative. Ask your question and we'll see.
 
lol these would be good interview questions
I created a stateless refresh token from a facebook loging.
login*
in the middleware I check the auth token.
I problem is now I have a loop of that refresh token which calls services to resolve until the user would refresh the page or relogin
unless... I could get that token back out to my frontend. hmmmmmmmm
so the question is. what is the best way to get a value over to the frontend kinda besides using an entire route for it.
does that makes sense?
mmmm I wonder can I set a header
so then I would know the header would have the new token and I could use it in the frontend
like a check the header for refresh token
 
4:18 AM
i have no idea what you mean
anyway i gtg, night yall
o/
 
4:35 AM
Anyone here?
import express from 'express'
import userCtrl from '../controllers/user.controller'
import authCtrl from '../controllers/auth.controller'

const router = express.Router()

router.route('/api/users')
  .get(userCtrl.list)
  .post(userCtrl.create)


router.route('/api/users/photo/:userId')
  .get(userCtrl.photo, userCtrl.defaultPhoto)
router.route('/api/users/defaultphoto')
  .get(userCtrl.defaultPhoto)

router.route('/api/users/follow')
  .put(authCtrl.requireSignin, userCtrl.addFollowing, userCtrl.addFollower)
Can anyone explain how it's possible for one route to have to have more than one request like above?

There the route router.route('/api/users/follow'), has 3 requests under the same PUT

How could this is possible?

Got it from here ==> https://github.com/shamahoque/mern-social/blob/second-edition/server/routes/user.routes.js
hello @Afsar Can you shed some light?
 
Hi , I am seeing only one route for /api/users/follow
@Onthewaytosuccess yeah so you want to have 3 request for one route
 
Hello Afsar,

Thank you for quick reply
 
4:52 AM
@Afsar Yeah, but still how would you explain the three functions running for the same PUT request on /users/follow ?
router.route('/api/users/unfollow')
.put(authCtrl.requireSignin, userCtrl.removeFollowing, userCtrl.removeFollower)


Isn't this above one also have 3 functions running for the same PUT?
 
perfect. I did it!!!
i just send the refresh token back into the header
I have a completely stateless refresh user token encrypted user profile!!!
so the api is smart enough to know if a token is expired while the user is still logged in and then sends the new token back to the front-end in a header!!!
here's the middleware if anyone wants to play around with it
const jwt = require('jsonwebtoken');
const axios = require('axios');
const bcrypt = require('bcryptjs');

module.exports = (req, res, next) => {
    try {
        const token = req.headers.authorization.split(' ')[1];
        console.log('req.headers', req.headers.authorization.split(' ')[1])
        const decoded = jwt.verify(token, 'someServerKeyFrom.Env');
        console.log('decoded ABC 1', decoded);
        req.userData = decoded;
        next();
    } catch (error) {
        console.log('error', error.message);
@Onthewaytosuccess they are all different routs
they all have different endpoints
 
Hey @ChristianMatthew, thanks for the input
But, really? do they have different endpoints?
I'm missing something here!
Doesn't the PUT ('api/user/follow') has the 3 different functions running for it?
 
5:08 AM
i don't see what you're talking about
 
@ChristianMatthew Can you tell me the 3 different end points for this? If it has 3

I can see only one end point which is

put ('/api/users/unfollow')
this means for this ==>
router.route('/api/users/unfollow')
.put(authCtrl.requireSignin, userCtrl.removeFollowing, userCtrl.removeFollower)
 
what are you confused on exactly
 
Confusion is on the routes endpoint

Doesn't the put('api/user/follow') has 3 requests going on? Is it possible to have 3 requests ?
3 requests for the same endpoint?
 
you're not showing me soemthing that has 3 requests
those can be middleware and functions runing in the put command
it really looks like this
router.get('/initial', verifyAPIAuth, (req, res) => {
it's just a controller that has different elements going foward in your get request router
watch this video
watch 11 - 14 that will really help you out
good night
 
    My EXACT confusion was this:
    Doesn't the

    router.put('/unfollow', auth, async (req, res) => {

        }
 
5:18 AM
@Onthewaytosuccess 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.
 
has three request?
@ChristianMatthew Good night Chris
 
5:55 AM
I am trying to put this JavaScript in Adobe as a calculation field. The point of this is to use Term, Amount Financed and APR (Interest Rate) to calculate a monthly car payment for a form I'm creating. All I want to know is what JavaScript code will work? PS. I have limited knowledge in JavaScript.
This code calculates $208.80 a month when the correct calculation in fact is $100 More...
APR Is .21, Term is 60, Amount to Finance is 10,000.00.
My current code below:
var R = Number(this.getField("APR").valueAsString);
 
@ASPtech 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.
 
 
1 hour later…
7:18 AM
does anyone know how to fix this?
0
Q: How to fix the modal toggle using event emitter in angular

Pandauser-setting.html <li class="configuration-body--menu-item action"> <span class="label" (click)="togglePassword()">Change Password</span> <span class="control"></span> </li> user-setting.ts @Output() changePassword: any = new EventEmitter(); togglePassword() {...

 
 
2 hours later…
8:57 AM
Can you mock the target in an event? ie

const mockEvent = new FocusEvent("onfocusin", { target: testObject.host });
this doesnt work
 
you need to stub events. This depends of the framework
there should be articles on the web helping you.
if you stub it, you can return the mocked instance if a function gets called
 
im using jest
 
@SuperUberDuper does this help you: stackoverflow.com/questions/59957285/…
I have jest experience with Jest :P
 
9:13 AM
Does anyone know the easiest way to upload a image file by writing a function that takes in a filename, and that function can be called using a script rather than using a file GUI to select the file?
 
9:27 AM
wat
 
I am trying to deploy a private repo on netlify using git but I am getting repo not found
 
 
4 hours later…
Paz
1:52 PM
Is anyone here familiar with axios? I receive a 401 response through axios but 200 on every other service.
I am making a simple post request to an api
 
that means you're not sending the right credentials for the endpoint you are hitting, or you're not hitting the endpoint you think you are
not really an axios specific problem
 
Paz
Hi, thanks for the response. for some reason the syntax I have used (which they showed in an example in their docs) is incorrect

what I did is: this.$http.post('/token', { username: 'a' })
But what eventually worked is this.$http.post('/token', {}, { params: { username: 'a' }})
I have no idea why and it actually bothers me alot
 
got a link to docs?
 
Paz
I have used their github actually, https://github.com/axios/axios#example
under "Performing POST request"
 
Here's the important bits:
> axios#request(config)
axios#get(url[, config])
axios#delete(url[, config])
axios#head(url[, config])
axios#options(url[, config])
axios#post(url[, data[, config]])
axios#put(url[, data[, config]])
axios#patch(url[, data[, config]])
axios#getUri([config])
note how get and post are different
your object is a config object, but because you didn't include a data object, it was treated as a data object because you can't pass a config object to a post without a data object.
 
Paz
2:09 PM
I know I wrote I did this.$http.post('/token', { username: 'a' }) but it was simplified
I actually send out headers with it, so something like:
this.$http.post('/token', { username: 'a' }, { headers: { 'aaa': 'aaa' })
 
right
so in that case username would be sent as a post param
 
Paz
and it still gave out 401
 
not a url param
 
Paz
what do you mean?
wont it provide the same outcome as this.$http.post('/token', {}, { params: { username: 'a' }}) ?
 
no, because the second sends url params
 
Paz
2:11 PM
so it's an api serverside thing?
 
a url param is a param that is attached to the url
 
Paz
but they are different only in the way the server receives them? I mean, the server choose if he receives it through URL or post param?
 
the server receives both
 
Paz
so why only the first one returns 401?
 
and it's up to the code on the server to decide how (or if) to interpret them
they aren't the same
they aren't interchangable
 
Paz
2:13 PM
so it returns 401 because the server won't accept post params that aren't through URL?
 
it's 401 because it didn't find a username
 
Paz
what
no
 
you gave it the username in a way it wasn't expecting.
 
Paz
so it is because the server won't expect post params that aren't through URL?
is it
 
your server, apparently
 
Paz
2:15 PM
what?
 
it's all up to how the server is written
 
Paz
I did not write the server, I just try to engage with it. So it's a serverside thing that I, as a client side developer, shouldn't be worried about?
 
i mean
i think it's rather important to understand how http works and how servers interpret http requests, even as a client-end dev
 
Paz
I'll try to look at it, but for now:
* the first POST try with passing data instead of params gave me 401
* the seconds POST try with passing params instead of data gave me the information I need

what can I deduce from it?
How do I move forward?
:49532955
Nevermind, A different question. Do you think I actually need to use axios and not just the "request" module for example?
I feel like I thought it would simplify things for me but it does the opposite
 
:shrug:
that's an opinion
I don't use either of those things
 
Paz
2:25 PM
understandable
 
not really a best or better answer there, use what you're most comfortable with
I prefer fetch
 
Paz
thank you very much, you helped me actually understand the situation
i'll check it out
 
2:51 PM
guys how can i get links from google drive folder
 
:shrug:
 
!!shrug
 
¯\_(ツ)_/¯
 
i whant to make samting like const data = [
"https://drive.google.com/uc?id=1MZaUJ6OJwhs27jC7WIHzwPsW0sYyLC6Y",
];
 
Ya know, it is an interesting mystery that you ended up here, in your quest to fetch a google drive link
 
2:54 PM
What are you using to interact with google drive?
some kind of api? a library?
 
google has a "Google Drive API" which is very well-documented
 
stackoverflow?
 
did you have considered to go through it? We have to do that. We got our knowledge from reading docs. So please try to use documentations. They are there for a reason.
 
i reeded and i tested
but no results
i was thinkng that axios cood help in get what i need, but no result too
 
axios is a tool to handle requests in Javascript. Same for using the Fetch API.
You need to be detailed: what do you mean with "no results"?
no error messages?
timed out?
 
2:59 PM
I couldn't get it to work with the google api's documentation, in relation to the axios, I had to have a google drive post with the links, which apparently isn't possible .... so I'm not sure what to do
the idea is to have a folder on the google drive with photos, and get the links to those photos using js to be able to make the gallery
something like that
it makes sense?
 
yep
 
improvement suggestions?
 
the api can do it.
 
its possible without authentication?
 
is teh api usable without authentication?
 
3:13 PM
without authentication? Why?
I don't want you have access to my google drive content
 
the content that belongs is for use by the application, the user will not have access permissions, only the application ... so without authentication ... right?
the content is to be used by the application
 
3:26 PM
coool
 
4:04 PM
What you're trying to do is really a case for Google Cloud Storage, not Google Drive
 
 
1 hour later…
user13494176
5:23 PM
hello everybody, i'm new to react js , and need some help if there's any react js developer please help me with my issue. Here is the link to the question
https://stackoverflow.com/q/62157634/13494176
 
@OybekIkramov 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:01 PM
i got an idea for great new library!
 
6:29 PM
$.cookie
?
 
lol, no. Idea is a lib that is basically websockets over udp.
Using webrtc data channels.
 
can anyone recommend a good tutorial for learning full stack javascript?
(free)
ive been through the plain javascript tutorials (and html,csss,...)
 
@JBis thanks
but what about after that for react/nodejs
 
6:43 PM
@JBis also this doesnt look free
 
node isn't hard, its just js
 
@JBis already done that
 
@Permian then you know basics, start building
whats something you want to build? go build it
 
i failed a test couple of days ago
couldnt even query an api using js
nor build a react carousel
 
@Permian first part is free
 
6:44 PM
lol
 
"a test"?
 
Sam
React question: I have a component with a load of state variables... is there a quick way to check whether all values in the state are not null without having to have a really large conditional statement
 
@JBis hackerrank test
 
iteration?
 
||> [3,4,6,1,"test", {bla: 4}, null].every(variable => !!variable)
 
6:46 PM
@JBis false Logged: `` Took: 1ms
 
||> [3,4,6,1,"test", {bla: 4}].every(variable => !!variable)
 
@JBis true Logged: `` Took: 0ms
 
@Sam ^
if you wanna check specifically null you can do that too
@Permian ok so work on building something
 
@JBis yeah ive done literally every course out there, was hoping i could google my way through the test
 
well
you kinda need to be able to solve problems at some point
you can't just rely on memorizing all the solutions
 
6:48 PM
i'm not sure how to learn problem solving other then by just practicing
 
well, most of us can't anyway
 
@Permian if you want to work on that skill leetcode.com and stuff like that is good. While most of the stuff there isn't practical you will def have to problem solve.
 
@JBis ive done like 600 leetcode questions in python (some in c++) already
i have no problems with algorithms tests
but this i actually had to build something and couldnt
 
ok, so you have issues with practical things?
 
yeah
 
6:50 PM
have you built a todo list?
 
no
ive done nothing but leetcode and tutorials
 
try building that, no searching up "how to build a todo list with react"
 
@JBis my man
 
:D
 
@JBis how did you learn nodejs?
 
6:53 PM
posted on June 02, 2020 by Michaël Zasso

Notable changes This is a security release. Vulnerabilities fixed: CVE-2020-8172: TLS session reuse can lead to host certificate verification bypass (High). CVE-2020-11080: HTTP/2 Large Settings Frame DoS (Low). CVE-2020-8174: napi_get_value_string_*() allows various kinds of memory corruption (High). Commits [07a4d5061f] - crypto: update root certificates (AshCripps) #33682 [0a7bf50fd4] -

posted on June 02, 2020 by Michaël Zasso

Notable changes This is a security release. Vulnerabilities fixed: CVE-2020-8172: TLS session reuse can lead to host certificate verification bypass (High). CVE-2020-11080: HTTP/2 Large Settings Frame DoS (Low). CVE-2020-8174: napi_get_value_string_*() allows various kinds of memory corruption (High). Commits [c6d0bdacc4] - crypto: update root certificates (AshCripps) #33682 [916b2824d1] -

 
i learned it by building apps with it
 
^
 
ah ok
my problem is that i have so little ideas for simple apps
 
and then i perfected my code by asking questions here and getting told why my code was shit
thanks rlemon :)
 
yeah... i had that issue too, fortunately i was able get approval to use it for tasks around work back then while i was using it.
 
6:55 PM
@Permian think of a problem you can solve
or that is already solved but you can solve better
 
look for node.js questions on SO and solve them.
there's an endless stream of problems there
moreso than you'll ever come across on your own
 
@KevinB rm -rf is often the best solution to most of those
 
best of all, most of them are already answered elsewhere on the network if you get stuck
 
Sam
@JBis Thanks. Not familiar with ||>
 
posted on June 02, 2020 by Bethany Nicolle Griggs

Notable changes This is a security release. Vulnerabilities fixed: CVE-2020-8174: napi_get_value_string_*() allows various kinds of memory corruption (High). CVE-2020-10531: ICU-20958 Prevent SEGV_MAPERR in append (High). CVE-2020-11080: HTTP/2 Large Settings Frame DoS (Low). Commits [0ad7970256] - deps: fix OPENSSLDIR on Windows (Shigeki Ohtsu) #29456 [bd78c6ea46] - deps: backport ICU-209

 
Sam
6:59 PM
oh is that for some bot thing xD
 
yea
|!magic
 
00:00 - 19:0019:00 - 00:00

« first day (3517 days earlier)      last day (1414 days later) »