« first day (3310 days earlier)      last day (1863 days later) » 

02:33
Damt guys, I just can't stop the browser from doing new network calls to the same images :S

https://stackoverflow.com/questions/58602259/how-to-stop-html-network-from-downloading-the-same-images
@demiculus 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.
Can anyone help me with it?
02:44
@demiculus I've posted a possible answer
 
6 hours later…
Tom
Tom
09:13
@JBis Something you could do without too much work would be an extension that told the user on every page how many requests were sent to known tracker domains
@Tom 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.
10:02
Hi, I am not sure if this is the right room to ask, or if I am wording the question correctly but has anyone used inputs of type file before and restricted what it cannot accept?
I found this but it is kind of the opposite to what I want, I want to allow all except for a select few, not allow only a select few
Not required anymore^
10:45
@WhatsThePoint You can handle like this jsbin.com/dolasuzizi/edit?html,js,console,output
@DheerajRao 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.
@WhatsThePoint you can provide basic filters for certain types of file extensions, but you cannot actually look at the file's content client-side
for that you'll need to perform a server-side check
in other words, if you say only files ending with .png can be uploaded, don't assume someone can't rename a .jpg into a .png and upload it
11:06
Hello Everyone !
@AshishMishra 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.
@AshishMishra hola
 
1 hour later…
12:19
Hi anybody there need help in nodejs
@Pardeep 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.
main.js I have function like this importing from other file const trades = functions.getTrades(id,userId);
second file:
module.exports = {
getTrades: function(id,userId) {
Platform.findOne({platform: id, userID: userId}, (err,doc) => {
if(err) return res.status(400).send(err);
return (doc);
})
},
multiply: function(a,b) {
return a*b
}
};
@Pardeep Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. 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
trades is undefined
how can I achive this?
@Pardeep Platform.findOne is returning undefined
I would expect a Promise or something similar here
You should make sure you're calling it properly
12:27
No
document is good
its return everything fine
yes
there must be promise
but how can I use promise? in other file?
I have two files
I have also added async and await
@Pardeep Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
oh okay
module.exports = {
    getTrades: async function(id,userId) {
        await Platform.findOne({platform: id, userID: userId}).then(doc => doc).catch(err => err);
    },
    multiply: function(a,b) {
        return a*b
    }
};
but still it returns undefined
@Pardeep if you're using await then you're forcing the promise to resolve
I don't know honestly. I wouldn't expect undefined to be returned, but again, you should check your call to Platform.findOne and see what gets returned
it shouldn't return undefined unless it is called incorrectly
nope I have checked it returns perfect document
when I don't user
mongoose query
it never returns undefined
it means it goes to next line. did not wait for data which is coming from other file
thats why it is undefined
that's what I mean, if it is async, it should still be returning a Promise
12:35
how can I do that?
Platform.findOne does this
or should do this
check the documentation
let me do findOne
Platform.findOne({platform: id, userID: userId}).then(doc => doc).catch(err => err);
still undefined
added .then and catch
ok, does it say that .then can't be called on undefined?
anyone know a viable alternative to DOM and Prototype?
like so i can write Dom Methods like (Object).methodName();
without prototype
@ne
it returns undefined
this is first file

 const trades = functions.getTrades(id,userId)
        console.log(trades);
it logs undefined
12:43
@TaylorS again with this?
yes.. I wannt to be able to write Object-Attachable Functions
@Pardeep Your getTrades function is returning the result of call to Platform.findOne, right? So find out why Platform.findOne is returning undefined..
I hate the look of normal functions: "functionName(Arguments);"
I like it being attached to the object
then consider making a class instead wrapping the object
Also, neil, I cant find too too much info on why prototype is bad practive
im writing custom classes that arent overwriting internal functions
12:44
because it goes to next line and print undfind it does'nt wait for the function
so there shouldnt be a problem.. right?
return
@TaylorS because it's like global scope. You could conflict with other definitions of prototype
Platform.findOne is right
@Pardeep Platform.findOne = function() { return undefined; }
And if this were the definition of findOne? You'd always get undefined back
12:46
let me tell you
what I mean
it's not defined like this clearly, but if you don't know why it returns undefined, you can't hope to fix it
oh
so its kindof like a variable that can be interfered with other Variables
module.exports = {
    getTrades: function(id,userId) {
       return id;
    },
    multiply: function(a,b) {
        return a*b
    }
};
@Pardeep Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
@TaylorS well if I define a prototype .name and you define a prototype .name, yours wins because yours was defined afterwards
12:47
it works fine
using this is wierd, but its useful, and seems "easier" to use then argument variables
@Pardeep Platform.findOne is what I'm interested in, not getTrades
@TaylorS do you use bind?
const {Platform} = require('../models/platform');

module.exports = {
    getTrades: function(id,userId) {
        Platform.findOne({platform: id, userID: userId}, (err,doc) => {
            if(err) return res.status(400).send(err);
                console.log(doc)
             return (doc);
        })
    },
    multiply: function(a,b) {
        return a*b
    }
};
here doc is printing
fine
or apply/call?
Well, I always tool-name my functions and prototypes in all my projects.. usually with something like PROJECT-ABREIVIATION_function() {}
so like for CETGui, it would be CET_PNG();
12:48
@TaylorS still not ideal
Yeah, I guess so
well, im not turning into codepen and using random letter/number generators for my function names lol
doc is printing fine
but there is problem with promise
I have to use promise
again, if a promise isn't being returned, then it matters not that your callback is getting called
but I don't know how
the callback is your link with the information getting passed
12:50
I have to leave now
see this thing on MONDAY
:P
13:03
o/
see you monday :)
13:42
hi im new to js and have a (simple) question
@Zaedian 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.
@Zaedian hey
what's your question?
trying to get the x and y coordinates to draw on the screen. I have a drawGui.js and im trying to retrieve the variables but it wont display for me.
this is drawgui.js
client.js
when I console.log(data) it does display all the variables
but after calling in the other file it just displays: undefined
my bad this is client.js
hey
13:48
If a vanillajs app inherits an NgRx store from its parent Angular app..the the vanillajs app creates a number of subscriptions via store.select
How should the vanillajs app unsubscribe from those store subscriptions?
Is it pretty much the same as how you unsubscribe in an Angular app
sorry I dont know, im new to this coding
@Zaedian could you show the code with the console.logs added?
I'm trying to understand how it might display undefined based on its position
okay
the code or the console output?
the code
ok
I had console.log(data); commented out
in client.js
13:52
wait, let me check again
@Zaedian so line 7?
what are you sending to the websocket for the event playerMovement?
all it does is output this: {posX: 288, posY: 272, id: "x8oWnsrOmb76GPPyAAAE", dir: 0, isAnimating: false}
ok, in what instance do you get undefined?
this is in my server.js
server.on("playerMovement", function(data) {
server.send(data, "playerMovement");
});
but in drawGui.js I have: var px and var py
var px = data.posY;
I tried var px = client.data.posX;
but still undefined
I could send all my code if it maybe helps
13:56
so if you add a line in your server.js console.log(data) it shows undefined?
no
only in drawGui.js
the console.log(data) then logs the following: {posX: 288, posY: 272, id: "x8oWnsrOmb76GPPyAAAE", dir: 0, isAnimating: false}
however im trying to draw the X and Y position in drawGui.js
ohhh maybe I understand
you're trying to access data variable outside the context of the event
you can't :)
oh :/
so its not possible to draw the current X and Y positions?
you need to make a function and call it, and use it inside the function
13:58
data doesn't exist outside the callback
if you want that to be used from drawGui.js, you need to call something with that data
you could also assign a global variable to the value passed by the callback, but don't do that
so in client.js above the console.log(data) I can create a function lets say: function(callXY) {

}
and save it in a new variable?
like var data.posX = callX;?
nope didnt work for me XD
where you have: //console.log(data);
you can add:
px = data.posX;
py = data.posY;
so you'd be assigning the two global variables which are used in your drawGui.js
ohh ok
still same :(
14:04
though better to avoid using global variables like that though
undefined in left top
you're still logging undefined, sure
that doens't make what you're logging become defined
oh
this is way harder than I expected
px and py are variables in your other file. When the data arrives, you're updating their values
14:05
and draw function which uses it now uses your updated values automatically
though what I would do is this.. if you don't need to draw every frame, then don't
I set px and py to 0 in drawGui.js
when the coordinates update, you call draw passing the new coordinates
ohh right
thats better indeed
14:07
so you don't need global variables this way
draw on demand :)
now im also drawing the username constantly
:/
Also the username you should pass
even if is the same from call to call
you should eliminate the need for global variables entirely
you mean outside the draw function?
yes
ohh ok
thanks
hmm
wont draw outside it
14:12
add a parameter to draw which will be like {px: px, pv: pv, username: "username"}
and then inside draw, you use this parameter as a sort of "draw parameters" argument
call it whenever one of these values changes
comment out the onload because that's causing the draw call to be repeated
right
and also line 22 where you do requestAnimationFrame(draw);
because that calls to redraw itself
ohh ok
thanks i will try this out
user12053089
14:47
paste your full code?
user12053089
make a workable example?
Hi how can i do this batter way        felIndex(report[0].ipafulldef,report[0].ipadrldef);

function felIndex(a,b){

   var  ipafulldef= a || 0, ipadrldef = b || 0;
    var classNam = '.porFelf' , texrclass= '.porFelfttl';
 /*  for a =================================================================*/
   /*BEST (Blue) */
   if (ipafulldef>= 3 && ipafulldef<= 4.75) {
    $(classNam).css("background-color", "blue");	$(texrclass).text("BEST");
	}

	/*Best Practical (Blue) */
   if (ipafulldef >= 3.75 && ipafulldef<= 4.75) {
@ShakilHossain Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. 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
@JamesBot I will try to do batter organize Next time
15:37
Is there a way to do splice-like operations on strings?
@ShakilHossain have an array of objects containing threshold and color
Go through each one, and if the threshold is exceeded, use the background color indicated
you don't need to check the upper limit, just the lower
the important thing is that the order is in increasing threshold
16:03
@Neil Any example Sir?
16:15
You know, I"ve been wondering while talking to my grandparents.
My grandparents often require my assistance with their computers, even doing most basic stuff like replying to government mail etc.
What they cannot do is "remember the password". That's not in their system. And when I ask "how?", they are like: "well why should I remember? For my normal mailbox I also don't need a password, why can't kpnplanet -their isp- just make sure the mailbox can only be opened from my address".
helped my neighbor this morning with opening a PDF
he had to login to yahoo. and i was surprised to see that they switched him over to loging in via an sms message rather than a password
This actually got me stunned: why can't ISPs do that? They already uniquely identify an adres to provide them an ip. That could easily be extended to only provide access to a mailbox for that adres.
And make that address mailbox openable without a password (they are already identified)..
that's unreliable
Then you're saying that getting an IP address is also unreliable? And anyone can hijack your connection?
your IP address assigned to you by your ISP can change if you don't have a fixed line
mine changes every 6 months or so, but in some areas it could change daily. just depends on your ISP.
16:20
Yes, of course, but the ISP controls that: I'm talking not about gmail, but an ISP unique mailbox
All ISPs (here at least) provide their own mail service.
most here do as well
there's another problem there tho
So the ISP knows who owns what IP address: they have to for billing purposes.
how do they uniquely identify your computer, vs another computer on your network?
or phone
or whatever other interweb device you happen to install
Oh yes, that is a valid reason, but my grandparents said: "I don't see that as a problem, just like anyone who lives in my house can access my normal mailbox from within the house and I don't keep extra locks".
It's probably more unsafe that I had to give my grandparents a passwords that's the most unsafe password ever, just so they can remember it.
see if the service has an sms instead of password option
they aren't gonna forget their phone
16:35
@KevinB they don't have a moblie phone
My grand parents are 98 and 103 years old.. So it's hard to let them do new things.
Funny is that they want to know how mobile phones works and use them.. It's just that with parkinson all touch screens, and those small buttons on physical mobile keyboards are too hard to touch for them :/
16:50
u5Lv:J$hU%l@bz^NB:WZ
 
1 hour later…
18:10
quick question... isnt ./ in a url meaning Root of Webpage
18:24
or atleast root when you start the html file and go to another
18:35
@paul23 Large screen tablet?
18:46
@TaylorS no
./ is path relative. it's relative to the current path
/ is root relative
// is protocol relative
 
1 hour later…
19:50
Has anyone had issues with Heroku escaping backslashes when you dont want it to?
I'm trying to store a private key as a config var/env variable, and it works when I run it locally, but on heroku it escapes all the backslashes (\n => \\n) and then I get PEM errors, my assumption being that the \\n breaks the key
20:01
Nvm, I fixed it by replacing the \n with actual enters and pasting it into heroku
 
1 hour later…
21:26
You used true return symbols in code...
thought those never worked :L
I always have to use \n
 
1 hour later…
user7437719
22:54
Everyone go to this room:
https://chat.stackoverflow.com/rooms/193540/test-my-bot
user7437719
It's the "test my bot" room
user7437719
I like it very much!
user7437719
I just had a little discussion with jamesbot in there
user7437719
You see, jamesbot welcomes anyone who is new to the room
user7437719
and provides information
user7437719
22:55
i tried to talk with him further
user7437719
but I received no response
user7437719
Oh james, oh james!
user7437719
Anyways, I think he is the default bot there
user7437719
I should not of used the term "he" for an automated program
The room was made for testing jamesbot
user7437719
22:57
Well, James is a masculine name so i guess its okay
user7437719
Really? how interesting
user7437719
There was also a bot called fun bot
Yeah that one is very noisy
user7437719
I personally prefer the JavaScript room to talk
user7437719
I mean the moderation here is a bit terse
user7437719
23:00
Thats why I have leaned to other rooms such as "sobotics"
user7437719
but the people that are in so botics or so close vote reviews aren't the same ones here
user7437719
Different vibe
user7437719
sobotics is really active because of all the bots
user7437719
Unfortunately , all of the good bots went away a long time ago :(
user7437719
They got rid of jukebot
user7437719
23:02
and some other fun ones to
user7437719
now the only good one is housekeeping
I'm sure there are other platforms with a great number of chat bots
user7437719
Yes, there are! But I do not mean some chat bot. I mean like arbitrary bots that are part of sobotics
user7437719
I mean sobotics has scaled down a lot
user7437719
they used to have a lot of excess bots
user7437719
23:06
now they have the bare minimum
user7437719
I have always like housekeeping
user7437719
The bad thing is, housekeeping only chats occasionally
user7437719
like once every few hours
user7437719
not as active as the other ones
user7437719
23:10
i tried going to "so close vote reviewers" room once. I did not dislike it but did not bear any joy out of it either
user7437719
Btw, you are not obligated to reply if you dont want to
user7437719
but if you feel the need to or want to thats fine with me!
user7437719
I see that @user10735853 left the "test my bot" and "duck overflow" room
user7437719
usually I do not pinpoint specific users
user7437719
but there is something about users that have no profile picture that is intriguing to me
user7437719
23:12
especially if there is also just user and then a numeral
user7437719
like that implies a blunt account
user7437719
but its cool nevertheless
user7437719
I have always dreamed of having that default gray profile picture along with the "user0000000"
user7437719
its just the anonymity concerning it
user7437719
anyways, my point was that user10735853 is STILL in this room
user7437719
23:14
but left the others
user7437719
the other thing is, user10735853 has never chatted before
user7437719
only read
user7437719
well im pretty sure they do not have enough reputation to do so
user7437719
so thats why they were unable to reply..
user7437719
such a striking epiphany!
user7437719
23:16
but the thing is, they AUTOMATICALLY over time got demoted to last in active user list
user7437719
anyways, farewell all!
user7437719
I shalt be in the test bot room
user7437719
Good Day!
23:27
okie dokie
23:39
The caption on that one is really solid
user7437554
23:55
Is it possible to add the text in a js file?

« first day (3310 days earlier)      last day (1863 days later) »