« first day (3513 days earlier)      last day (1418 days later) » 

12:28 AM
oh btw that Async operator doesn't work. so... lol as they upgrade their software kinda shows how not modern it is.
@KevinB
 
12:46 AM
plz don't ping me
 
Can i call you?
 
@ChristianMatthew just shout "Kevin B" into the void
 
KEVIN BBBBBBBBBBBBBBBBBBBBBBBB
lol
 
hmm,
 
lerooyyyyyyyyyyyyyyyy Jenkinsssssssssssss
 
12:55 AM
Like a good neighbor, Kevin B is there!
well, that didn't work either
 
1:21 AM
is it normal when putting data into a db that if the property isn't there that a null is put in it's place instead. With that said, what's the methodology per se to assure that can't happen?
is it more on the client side or the data side to protect against that. just wondering what the normal flow is for that.
name
:
"Christian Matthew"
firstName
:
"Christian"
lastName
:
"Matthew"
email
:
"fffffffff@ffffff.com"
tokenId
:
null
userPhoto
:
"https://graph.facebook.com/keven b/picture?type=norm
 
@ChristianMatthew if null is acceptable then put null in, if not then have some server (and client) side validation
 
got ya. was wondering because something coming from an authentication may come in without that value. not really anything you can do when relying on openid connect
guess you could follow up with a form
 
whats that basic programming exercise where you iterate numbers and print something for every even one or something like?
cant remember what its called
ah Fizz Buzz!
 
1:48 AM
spice it up with Fizz Buzz Trizzle: any number divisible by, or with a digit of, 3/5/7
 
i like it
 
 
1 hour later…
3:15 AM
couple questions here
about async await
const findUser = async (client, userId, email) => {
    console.log('userid', userId);
    console.log('email', email);
    // Get the documents collection
    const collection = client.collection(documentName);
    // find a document
    return await collection.findOne({userId: userId, email: email});

}

const createUser = (client, callback, req) => {
    // Get the documents collection
    const collection = client.collection(documentName);
    // Insert some documents
    collection.insertOne({
is it better to make the function async await or the consumer of the function the async awaiter?
i always kind of wondered that
something tells me it's the consumer
answer consumer for sure
kevin b was right
the do have promises
here is how I cleaned it up
const findUser = (client, userId, email): Promise<MongoClient> => {
    console.log('userid', userId);
    console.log('email', email);
    // Get the documents collection
    const collection = client.collection(documentName);
    // find a document
    return collection.findOne({userId: userId, email: email});
}
router.get('/:userId&:email', (req, res) => {
    client.connect( async err => {
        const collection = client.db(dbName);
        if (!err) {
            console.log("Connected successfully to server.");
        } else {
            console.log('Error in DB connection : ', JSON.stringify(err, undefined, 2));
        }
        try {
            const result = await findUser(collection, req.params.userId, req.params.email);
            console.log('result ', result);
            res.send(result);
 
3:54 AM
how do I know a user is logged in?
when using openid connect
should I store a token?
 
 
1 hour later…
4:57 AM
Hi this is my codepen https://codepen.io/lakshmi123__/pen/yLYGoVP?__cf_chl_jschl_tk__=e1d728c80c9b807f9aef4d9cc1a4a82d09158c2e-1590727439-0-AVVltOC4O-ozMTE4AqNGn7Kac4pj-c8TKO3083vIt0rHANv_bL-07rB93UgkD4_Ild3JFtkNGjZ3kQT5QJH5HNvzCTYmO6-kDYiLSC9rCGK7IR1eLpCBgzsd2EytcsV6peWdWLyGuam4zokzWWuG8TLRUzIyg5iO0be2nkcf9hTMRKeqM5_290X_NuT34aE7zP9JEm2mPE-UAceKQn7JgbGsqsg0L90tshEE-QDLSldwifvqFtpNQM5XNbqBviTtjerT0_SHzIPPkz9CqvFYL7j_MXgLLZA88_OM71Z8R3qAc6ufblF5MZxQ71tBacgOtT2cB9PBASni2vW7_kzpc5wZR5UrZO5Wv79clLZDJtrv
 
 
2 hours later…
6:54 AM
This is the course Dan Abramov is working on. Newsletters are awesome, definitely worth subscribing
https://justjavascript.com/
 
@NurulSundarani 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.
 
 
3 hours later…
9:43 AM
Hi, does anyone know how to alternate between 2 email adresses in contact form7?
 
@AlexStanese what do you mean?
 
I want the offer requests sent through contact form 7 to go like this: 1 email to be sent do agent with email 1, 2 email to be sent to the agent with email 2, 3 email to be sent to the agent with email 1, 4 email to be sent to the agent with email 4 etc.
@VLAZ like the odd emails to the first agent and the even emails to the second agent
 
I'd handle that in the backend, not the frontend. If 10 people open the page at the same time, they will not synchronise where an email goes to, they'll all get the same thing. So, you'd need to send a message to a backend and the backend then keeps some state and does a round-robin or any other way of determining who gets a message.
 
I thought something simmilar but... do you have any idea how to do that?
 
10:32 AM
Let's say I have a localhost link, ex. localhost:5501/confirm, can I pass it parameters that I can access later on, without influence on how the link opens, I want it to open the same way
 
if I were you, I'd create a message queue where you push the e-mail details on the queue, and then you have a dedicated thread sending e-mails
you should be careful to not send multiple e-mails to the same person, as mail servers will tend to block it permanently for spam
 
 
2 hours later…
12:40 PM
@G.Lakshmi you did it in jquery. I can't even look at you.
 
1:30 PM
What's the correct english translation for "overmacht"? - Due to the bad weather planes are grounded. Hence the reason I'm late it's "overmacht"? Google translates it to "force of majority"?
 
2:14 PM
I have a string "2016-01-01". When I pass it into new Date() I get "Thu Dec 31 2015 19:00:00 GMT-0500 (Eastern Standard Time) {}". How can I get a date object with that actual date without any time adjustment?
 
2:38 PM
there is no time adjustment
the new Date is fine
and as I say that, I realize that it is still JS's date stuff
but that is not where your problem is
 
Why does new Date("2016-01-01") offset the time by the timezone while new Date("1/1/2016") doesn't?
 
what you see happening is that the Date gets converted to a String
keep in mind, you cannot print or show anything other than Strings (or characters or actual pixels)
the Date needs to be formatted
and the default approach uses your locale
so, it would ask the machine what timezone it is in and what format the machine is set to use by default
 
new Date("1/1/2016") gives me Fri Jan 01 2016 00:00:00 GMT-0500 (Eastern Standard Time) {}
new Date("2016-01-01") gives me Thu Dec 31 2015 19:00:00 GMT-0500 (Eastern Standard Time) {}
 
that first one looks very wrong
 
The first one is the one that I want
 
2:41 PM
but that might be because the parsing at that format is also using your locale
while the dashes might be considered ISO 8601
and therefor ignoring the locale
> the new Date is fine
yea, we can scrap that
but still, you want to parse using UTC timezone and format using UTC timezone
not sure how that is done in JS tho
 
No, I don't, because I'm comparing it to a date object that has no time information in it.
 
exactly
what I assume JS is doing here is
"1/1/2016" is your local format, so I will parse using your timezone
"2016-1-1" is ISO-8601 format, so I will parse using UTC
therefor new Date("1/1/2016") !== new Date("2016-1-1")
even though you want it to be
get rid of the timezone, locale and everything else by using UTC and possibly an explicit date representation pattern
 
3:03 PM
Hey
 
3:49 PM
hi guys
 
@FedericoDe Marco 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.
 
someone could Help me ?
 
Hi all - using react-router and components, which is preferred - passing components in from the top level to be rendered via render={(props) => <MainPage footer={<Footer/>}/>}, for example, or just importing the component in the file itself? And why. Gut instinct is to pass in ala dependency injection.
 
Ingenious, I am horrified
 
4:48 PM
the sad part is that is my second most started repo
 
5:48 PM
does anyone know contact form 7 or php/wordpress?
-1
Q: Alternate between 2 emails in Contact Form 7

Alex StaneseI have a website with many product pages. On each product page there is a contact form which send an offer request to an email. I want all the received email to be somehow divided for 2 sales agents like this: first email to be sent to email address 1 second email to be sent to email address ...

 
6:05 PM
typescript question
If I need to preform an async function in the constructor, the usual solution is to create an init method. However, with typescript I will get an error that I didn't set my properties in the constructor.
 
Well, you didn't
 
class Example {
    private test: string;

    async init(){
       const something = await somethingAsync();
       this.test = something
    }
}
 
You end up having a delay between the instantiation of the class and the properties being set
What's the error?
 
Property `test` has no initializer and  is not definitively assigned in the constructor
private test: string | null = null;
 
I'd say initialize it
Yeah
Set it to null or undefined
 
6:13 PM
if I do something like that, then, everytime i refer to it I will have to do:
this.test!
because it won't know if its null or a string
 
Well that's kind of the point of type checking, there is a possibility that it will be undefined
If you don't initialize it to undefined then the possibility is still there, it's just less noticeable
 
so theres no solution?
 
As they say - not a bug :P
 
hmm
ok
 
One solution is a static factory function
Do the async work there and pass the data into a non-async constructor
 
6:15 PM
lol that was going to be my next question
ok, i'll go that root thanks
 
hey guys
I have a doubt
 
I have doubts too
 
rude
 
6:23 PM
I want to stream something via nodejs to all the logged in users of php
when to connect to my node server link
Please give your idea
 
Wow this doesn't sound fun
 
there are 1000's of logged in users
 
1. Don't self host, you'll kill your server (or spend lots of $$ keeping it alive). Use YouTube.
2. If you must, have node run on a subdomain. Check they are logged in using the same DB PHP uses. And then stream your stuff.
 
Hi , its json text stream
maximum 100 characters
 
oh i thought you meant a video stream
where is the text from?
and why do you need a stream of it
 
6:27 PM
Its stock market price
 
ah, so you want live updates
Where are you getting the stock market prices from? An API?
 
I am doing some algo check and streaming to users
 
Ok then use websockets
Node is good at that
 
WS or socket.io ?
which is fastest for 1000's of users
 
(then again, anything is better then php for everything)
 
6:29 PM
I mean , I dont use php or http for streaming
 
@Graciewilliams Do you need to support old browsers?
 
no
latest browsers
 
Then you can use either.
Socketio will use WS under the hood. It's just a helpful abstraction.
but may not be needed if its just simple stuff
 
what else is more simple ? I just want 1000 users to receive that json .. from one nodejs websocket
kinda broadcasting
 
both are pretty simple
 
6:34 PM
kinda broadcasting
 
research both of them and decide which one best suits your needs
 
ok planning to do socketio
in socketio code example is using port and html file
how do I just stream to the user who connects to wss link ?
 
7:11 PM
Hi! Can smb comment on this question on leetcode: leetcode.com/problems/move-zeroes/discuss/659060/…
 
user8729657
:O @JBis, so this is why America kept it's African American
 
^
 
7:29 PM
🤔
 
posted on May 29, 2020 by Srinivas Sista

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

 
Here's something interesting
var el =  document.createElement('script');
el.innerHTML =  `
console.log("A")
`;

document.querySelector('body').append(el)
console.log("B")
Prints "A" first
How is that possible?
 
consider, the console isn't sync
but also
it's gonna run that inline code synchronously
 
sure, but shouldn't it be added to the event loop
 
nope
 
7:37 PM
unless adding a script element acts as executing a function
 
If adding an element to the DOM is a synchronous operation, and processing an inline script is part of rendering the tree, then it makes sense
 
7:55 PM
i guess running that script is too, just wouldn't think so
 
!!magick
 
Invalid command! Did you mean: magic2, magic, magic3? Try help for a list of available commands..‍.‍.‍.‍.‍.‍.‍
 
!!imagemagick
 
Invalid command! Did you mean: codemagic, magic2, magic? Try help for a list of available commands..‍.‍.‍.‍.‍
 
8:21 PM
 
8:31 PM
wat
 
!!wat
 
!!undo
 
Invalid command! Did you mean: info, no, sudo? Try help for a list of available commands.
 
no!
 
8:33 PM
!!no
 
lmao
 
Good commands
 
lol
!!magic2
 
8:34 PM
meh
 
 
1 hour later…
9:48 PM
!!sudo
||> "are you alive?"
 
@VLAZ "are you alive?" Logged: `` Took: 0ms
 
hmm, James, why did you lie about the sudo command?
 
10:08 PM
stahp
 
HAMMAHTIME!
 
days when its tuff, ponder : Toni, "with an eye, just the one & I've recently been diagnosed with cancer for the 3rd time time, this time its likely to be incurable so I am making preparations to die at age 30. Ask Me Anything Medical" bit.ly/toniOneEye
hi i would like to learn angular 8
any better tutorials free or max usd $15 ?
 
10:40 PM
@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.
1 message moved to Trash can
 
hey guys, I'm pretty sure this is a basic mistake but I'm not sure how to search after it.
This is my code

(async () => {
console.log("3. selectedVotes", selectedVotes)
let parties = await fetchVotingData(`${apiUrl}/votopartido`, selectedVotes);
console.log("4. selectedVotes", selectedVotes)
})()
does anybody know why in my function call the parameter selectedVotes is not being passed? I'm pretty sure it's because of the async/await but I don´t know how to handle it
 
Does fetchVotingData actually have a second parameter?
What's the value of selectedVotes?
 
@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.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
1 message moved to Trash can
 
it´s an array of strings, that´s what the endpoint is expecting. This function call is working, I was able to acces the endpoint manually. Now I need to get it from an array that is generated by a selector. But for some reaason passing that array doesn't work
yes
 const fetchVotingData = async (url, body) => {
      let myData = {};
      if (url) {
        try {
            const response = await fetch(url, {
              method: "POST",
              body: JSON.stringify(body)
            });
            if (!response.ok) throw Error(response.statusText);
            myData = await response.json();
        } catch (error) {
            console.log(error);
            target.html("Error loading chart data");
        }
      }
      return myData
    };
 
How do you determine that it doesn't work? What do you see happening? What do you expect to happen?
 
10:50 PM
all that block is inside a $("#submit").on('click',async (e)=> { block. After clicking the button It was supposed to plot some charts and table with that data. console.log prints the array before and after the call, but there is no data being printed
 
You fetch the data but I don't see it being passed anywhere. Did you call the plotting functionality with the data? Did you call it correctly - maybe you need to transform the data? Did you check what the response actually was?
 
nevermind, thanks fot the help. I was passing invalid IDs now I'm getting the data xD
 
Hey ppl - anyone here good with recursion?
 

« first day (3513 days earlier)      last day (1418 days later) »