« first day (3620 days earlier)      last day (1327 days later) » 

4:09 AM
@LordReptilia no
 
 
2 hours later…
5:40 AM
anyone knows what's the last part of code above? I mean "(alert, 5)"
 
 
1 hour later…
6:41 AM
those are function arguments
 
 
1 hour later…
7:59 AM
@MartinAJ if you call alert(5), it opens a dialog box with message 5
in that code, you're passing the function and its argument, and it's being called inside in the same way, except it works with any function and argument
 
 
1 hour later…
9:02 AM
I see .. thank you
 
 
4 hours later…
12:41 PM
hi there
    let f = JSON.parse(JSON.stringify(req.body));
    console.log("Sent ingridients",f);
  '{"_id":"5f5da4dee9f496eee226e5ac","ingridients":[{"name":"Käse","calories":0,"allergics":["vegan","halal","koscher"]},{"name":"Rahm","calories":0,"allergics":["vegan","halal","koscher"]}]}': ''
why
I am sending this json in my form over post (or put)
        let dish = {_id: selected_dish_id, ingridients: a};
with one ingridients the object looks like this:
{_id: "5f5da4dee9f496eee226e5ac", ingridients: Array(1)}
ingridients: Array(1)
0: {name: "Milk", calories: 0, allergics: Array(3)}
length: 1
__proto__: Array(0)
_id: "5f5da4dee9f496eee226e5ac"
__proto__: Object
in the formdata (chrome dev tools) it looks like this:
{"_id":"5f5da4dee9f496eee226e5ac","ingridients":[{"name":"Milk","calories":0,"allergics":["vegan","halal","koscher"]}]}:
strange the : in the end
 
1:37 PM
hello
 
@BruTe 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.
 
anybody is here
i need some help..
 
2:31 PM
anyone can help me im spitting out cards with bootstrap carousels in each one the problem is that when they all load they all goto the next slide at the same time and im tryna figure out how to put a random delay one each say like 1-3 i can use rand function but im missing the knowledge in jquery
*1-3 secs
 
@WeTheBrains 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.
 
2:57 PM
        contentType: "application/json",
and dataType: "json"
man man.
thx
 
3:47 PM
Does anyone feel like geeking out on a Sunday morning?

I'm looking at an Excel Spreadsheet with a formula I don't understand that I would like to program into a web app.
 
4:38 PM
@VivianRiver what's the formula?
 
4:53 PM
I'm on the edit screen. I need to load the promotion code that has already been entered on the registration screen. How to reload the BLUR event, once the page is loaded?
I'm trying like this:
$("#promocaoCodigo").on("blur", function(){ ... }).change();
But it does not work.
 
5:16 PM
Hi! I have a question if you can help me with an oppinion:
I am using node js - socket.io. For a multiplayer game, in order to encapsulate event handlers, I have blocks like: io.on('connection', function (socket){}) in multiple classes constructors to obtain socket object and use it only in that class instance. I have discovered that in this way I can not bind the client player itself to actual server player instance. Should I have some kind of route file defining io events, or is it bad to define each socket as player.class member on server (each object instance holding reference to proppe
 
5:50 PM
@BoteaFlorin i'm not understanding your question
can you try to reask it?
 
@JBis I have many class definitions. Each class instance needs io for both emit and listen events in name of a Player (they hold reference to that player). I was thinking that cleanest way would be to declare all events regarding to a class in its definition, but this is leading me in a dead point....
@JBis I was thinking then to create a new file socket-io.ts holding all game events and their handlers, but that file would become messy, big and hard to mentain
 
i had this exact issue, been through two redesigns. Gimme 5 and ill explain what i did.
 
@karthicvel 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.
 
@JBis I am grateful for your time
@JBis An example (is a turn based game): a game room consists of 2 players, player notice other player when doing something, room object is notice its members when their turn ended/started (based on a timeout), room notice its members that the game is starting. I can handle this in one point, but it forces me to declare more extra getters for private variables
 
6:13 PM
ok so here's basically how i did it, it allowed me to separate event listeners into different classes
you'll need to adapt this to your use case. I used dependency inversion with services to manage the events.
instead of
class Whaterver {
    constructor(socket){
        this.socket = socket;
        this.socket.on("soemthing", this.someHandler.bind(this));
     }
     someHandler(){
           // some code
           this.socket.emit("bla", data)
     }
}
i moved to this
class WhateverService {
    constructor(socket){
        this.socket = socket;
        this.socket.on("soemthing", someHandler);
     }
}

// different file
function someHandler(socket){
           // some code
          socket.emit("bla", data)
}
its a bit more complex than that, but the idea is all of the handlers are registered in one file but the handlers themselves can be split up however you like
in my real app i had a wrapper around socket (maybe yours would be User) and then i just passed that around
my repo is a bit of a mess but take a look here:
participant is a wrapper around socket
inside a handler i call a service and pass the wrapper object
its a bit difficult to explain, lmk if you have quesitons
 
6:35 PM
I will try to analyse your repo there to understand it. if I've got it correctly(from your example), in my case, you created a service for each class (instead of each class.instance holding reference to socket). Based on that socket wrapper you identify all regarding object.instances
can you please point me to your socket wrapper ?
@JBis can you please point me to your socket wrapper ?
 
|| starspam
 
the star feature is not meant to be used as a "like" feature. Please respect it
 
sorry :D
 
np
@BoteaFlorin here's the wrapper, i made it an interface because it made more sense for me but you can use a class github.com/oss-videochat/bitlink/blob/…
so the handlers receive a participant and any other input the client sends, then the handler can pass whatever to different services
anyone, including the handlers or the services can access the socket via participant.socket
 
7:10 PM
@JBis so, basically, if I understood well, is not wrong (performance issue) to add a socket member to each Player (in my case), and then in room to have something like: this.members.map(member => member.socket.on("event", handlerWithLocalScopeAccess))
 
you'd want to add the listeners when the player is created or added to a game
there shouldn't be a preformance issue
 
@JBis I thought so, because of js garbage language nature, but I was not sure how socket io is working, and if this would affect performance somehow. Thank you again for your time! You took me out of confusion and now I know how to deal with it. Thanks!
 
np
 
7:46 PM
Hi there!
 
8:00 PM
Someone has visited this project? falstad.com/circuit Checking the GitHub repository, I noticed that 90% of the code is Java. I would like to do it with JavaScript, someone knows if there is any library that allows to move and insert particles in a grid or canvas?
 
8:31 PM
@JBis wait whoa you wrote a chat :o ?
impressive most impressive
 
Bitlink? Yeah it's a video chat program like zoom. You can check it out at bitlink.live if you want
@ShrekOverflow thanks
 
@JBis I did
 
8:45 PM
impressive that the background removal works :)
 
 
2 hours later…
10:26 PM
@ShrekOverflow thanks!
it uses tensorflow bodypix with a couple tricks to improve speed and quality
 
10:43 PM
fair
IT'd be fun to work with you sometime :)
 
@ShrekOverflow Could you send me an email so I can contact you out of SO if/when i become available? I'd love to work with you guys. My email is in my profile or you can use my website.
 
Hmm that'll be hard xD as I obviously don't want to broadcast it here
hold-onm
I'll be on so for a very long time, although if you have twitter @shrekoverflow ;)
 
11:01 PM
my email is josh.stackexchange@gmail.com. You can send me something there so you don't have to broadcast it. Otherwise if you rather not share it, I'll keep twitter in mind. Thanks!
 

« first day (3620 days earlier)      last day (1327 days later) »