« first day (3264 days earlier)      last day (1676 days later) » 
01:00 - 22:0022:00 - 00:00

1:48 AM
@forresthopkinsa how do I do that? Do I need to setup any properties in my react native project that will allow for new typescript files but also allow the old js files to exist without any errors? Thanks!
 
 
1 hour later…
3:07 AM
> “Never make fun of someone if they mispronounce a word. It means they learned it by reading” - Anonymous
Me with anything relating to tech
 
4:05 AM
@Euridice01 you just need to add typescript support
if you're not already using a bundler then this is probably going to add a new step to your build process
just google how to add TS support to your project. From there it should just work
you might need to change some Webpack rules from *.js to *.(js|ts) or whatever
 
4:32 AM
morn!
 
5:22 AM
hi people
how do I get xml with ajax?
it shows CORS error
but I'm able to see the data by opening that url in browser window
it's a jsp page that is returning xml
 
5:52 AM
Fix the cors error and you'll be able to access the xml
Without fixing the cors error, you can't access the xml
The cors error should specify very distinctly what is wrong with the given request. Look for documentation on CORS related to the error message you received. I wouldn't suggest using SO as a source for information related to CORS because there's a whole lot of misinformation out there on SO about CORS.
 
6:07 AM
alright, Do I need to fix cors error on server side?
because I'm using 3rd party API
I'm not able to do any fixes on their end
 
6:53 AM
@AbhishekPandey well it depends. Are the cors errors related to inproper headers client-side?
if so, you can fix it purely client-side. If the server isn't supporting CORS, then not a lot you can do about it unless you can modify the server settings
likely it's the server you'd have to change though
 
how to handle this issue
they must have any solution for this
@Neil I think so, maybe I need to have words with 3rd party API
 
@AbhishekPandey you'll sometimes see servers which provide a service use CORS as a way of "authorizing" users of a service
it's not usually a good idea, but you still sometimes see it (the proper way would be to simply require that a person send username/password for a token)
if they have a long list of authorized sites for CORS, then you'll need to find out how to get added to that list
 
I am sending username and password but calling it from ajax makes things dirty
 
probably paying if it's a third party service like weather or whatnot
 
I'm using Jobdiva's API
 
7:00 AM
usually you'd kind of mask requests behind your backend for that
so you request your backend, and your backend forwards the request with username and password info
That doesn't really fix the CORS problem but still
 
@Neil yeah, I was thinking the same, maybe I need to use PHP
as I'm gonna use this API in wordpress
No 'Access-Control-Allow-Origin' header is present on the requested resource.
I'm getting this error
it's working with postman very well
 
yeah, I think that simply means that you're not on the list
 
@Neil list of authorized users, you mean?
 
7:16 AM
@AbhishekPandey authorized sites
 
okay, I get it
the origin is not allowed
 
that's my guess :)
I can be wrong
believe it or not
 
8:00 AM
@AbhishekPandey that is why there are temporary tokens for
but yours cors issue is something you caused yourself
add that api to yours access control list
 
@KarelG it's not his server
 
he's using wordpress
 
8:16 AM
        let date = new Date(); // initializes to "now"
        let numberOfDaysToShow = this.props.numberOfDays || 7;

        let days = [];
        for (let d = 0; d < numberOfDaysToShow; ++d) {
            days.push(<ReserveSpotDay date={date} key={date}/>)
            date.setDate(date.getDate() + 1);
        }
It's one of those days again
(find the bug, get one local beer, i.e. you need to come here to get it)
 
I secretly want ecma features to pass that would break jsx syntax
 
@BartekBanachewicz date={date} RIP
 
@MadaraUchiha dayum
switching the mindset over to reference semantics always hits hard
anyway it's Monday and I'm writing React code at work
how cool is that
 
you've downgraded?
 
@towc nah, we're having one of those "build whatever you want" days :)
 
8:18 AM
oh, nice!
 
we're building our own version of this thing parkingbenefitem.pl
 
8:32 AM
@KarelG I will use this API in wordpress, but currently I was using ajax call from local server
 
9:09 AM
@forresthopkinsa Chrome is a plague. Just fixed an internal page where all browsers and players play a video fine - except Chrome. Which is as good as failing all non-iPhone visitors.
 
131
Q: How to customize object equality for JavaScript Set

czernyNew ES 6 (Harmony) introduces new Set object. Identity algorithm used by Set is similar to === operator and so not much suitable for comparing objects: var set = new Set(); set.add({a:1}); set.add({a:1}); console.log([...set.values()]); // Array [ Object, Object ] How to customize equality for...

uegh seriously
 
@BartekBanachewicz object equality has been a moot point with js for ages.
what they could have done is to add a constructor with an function argument that does the comparison job
if the function got provided, use it instead of ===
 
9:30 AM
Ola
 
@champion-runner 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.
 
ok Thanks
 
9:51 AM
hi
... Bruce?
 
@Sheepy Chrome is pretty good at adhering to w3c standards. I'd be unsurprised if Chrome was the only browser behaving correctly
 
10:20 AM
@forresthopkinsa It is, technically. I have the opinion that it cuts the most corners outside of spec, but I agree it is still the most conformance, secure, and cutting edge browser. Let's just say the age of IE dominance has instilled a distrust in me of browser monopoly.
And Chrome is definitely the Good Guy (for now) when you compare it with Safari...
Damn. I am reading a hardware catalog to shield the account and cs team from IT, who was grilling them for not knowing the specific technical requirements of a broadband request. I am just a programmer. Not even full time...
Feeling like a hen protecting a group of little chicks.
 
10:47 AM
@KarelG yup
@BartekBanachewicz This isn't available in English ?
 
 
1 hour later…
11:51 AM
@champion-runner don't think so
 
12:04 PM
uegh people advertising "crypto" "mining" "rigs" as a way to heat your home
I pointed out that a simple electric heater costs way less energy to produce in the first place
their response
"what do you mean by energy to produce"
sigh
> Mining #bitcoin can be good for the environment.
oh no and it seems it's a Polish company
 
 
1 hour later…
1:19 PM
does anyone know a package that can take a few images and build a grip of images e.g 10x10 tileset ?
 
1:42 PM
@BartekBanachewicz I read that as far as electricity costs are concerned, a computer consumes as much as a heater producing the same amount of heat
that's not 100% true, because LEDs and whatnot don't generate heat, but for the most part this is accurate
it's a really sophisticated heater in a sense
 
I'm trying to call fetch() to a server function but I keep getting a 500 error even though the function is getting called and completing without error.
 
I don't know why you'd prefer a crypto mining computer in your home to heat it over a simple heater
but that's another discussion
@Hypersapien 500 is the server response
 
Yeah
 
that means the client isn't doing anything wrong
or it may be, if you're calling it wrong, but still
you can't learn anything more until you see why the server is returning 500 status code
maybe you'll get lucky, and you'll find out that the server is returning 500 for no apparent reason :P
 
This is the javascript function paste.ofcode.org/MTwUyq2vy3MmqSPKuFHa2h
 
1:53 PM
@Hypersapien again, you can't tell based purely on the client side code
maybe the server doesn't like the empty body
maybe it's in a bad mood today
from the looks of your code, there's nothing obviously wrong with it
 
I tried getting rid of the empty body and changing it to GET on both sides, and I got a 404 error instead
 
but that doesn't mean you're not calling it incorrectly
probably it only accepts POST requests
generally you wouldn't see a 500 unless the server messed something up
so it isn't necessarily an invalid request
you still can't know without accessing the server
 
I am accessing the server. I wrote the server function
I'm able to step through it and it doesn't error out
 
check your error logs better then
if you have a framework middlware in place, then maybe something went wrong after your function was called
 
2:24 PM
@Neil yes, but that's after it's produced
 
in what sense?
 
@Neil exactly. The thing is that creating that computer uses tons of energy elsewhere
 
I could see doing that if they offered to reimburse you for the electricity costs
 
I mean a simple heater contains as much say iron as a typical PC
 
you'd simply use it as a heater which costs the family nothing
 
2:25 PM
heck, even discarding the costs of rare metals for CPUs and stuff, they don't matter that much
my point is that creating a CPU requires a much more complex process
and that process uses more energy
 
ah in that sense
 
that's definitely true
 
that's why calling it "green" or "good for environment" is nonsensical
 
that doesn't prevent millions upon millions of computers from being produced every year
 
2:26 PM
if bitcoin didn't exist, you wouldn't need to make that PC in the first place
@Neil yeah but most of them are used in a useful way
bitcoins are virtually useless
 
If cars didn't exist, you wouldn't need to have wars over crude oil
 
just like, well, physical money
 
you can't really deny the usefulness of the technology
 
the technology, no. The bitcoins themselves, as in the information, well
 
Where can I find the toLowerCase() or any JS build in Algorithm?
 
2:27 PM
that's what people don't seem to realize about global warming. They think it'll go away if enough of us start "being green" and using our cars left often. That's definitely not the case
that only slows the progression, but it doesn't halt it
 
there are currencies that do away with the whole mining altogether
you can make a useful virtual currency without wasting gigajoules to create it
heck, a regular bank acount is a virtual currency that's basically an integer
 
it's no longer viable anymore to mine bitcoin anyway
 
@Neil yeah but people keep mining newer and newer currencies
 
we've long since exceeded the point where it costs less electricity than it takes to produce bitcoin
 
the fallacy in the whole eco bitcoin thing is assuming that mining is in any way beneficial or required
 
2:29 PM
it has weight so long as people believe it does
 
they only believe that because of supposed "decentralization" you get that way
which in practice means China owns bitcoin
really, you could conceivably build a blockchain network on top of a regular currency like euro or dollar and that would work just as well
most of the bitcoin trading is done throught bitcoin banks anyway
that being said, heating homes with server farms has been a thing for decades now
but that could be done much more efficiently if you just pipe central city heating network through large datacenters :P
 
@BartekBanachewicz don't know if you were serious about that one :P
it would get cold before it reached the homes though
 
@Neil don't know about where you live, but here the vast majority of the city is heated from a central heat source(s)
there's a lot of insulated pipes going around
 
i've got nothing against bitcoin, but until you start seeing governments officially support bitcoin as a sort of alternative currency, it'll always be very prone to sudden drops
 
2:34 PM
definitely not like that here..
you'll get distributed natural gas, perhaps
and that will give you centralized heating within a given building
 
we also have gas and some places use it
but we also route hot water directly
not sure what's the maximum distance from the heating plant here but certainly in orders of kilometers
 
everything loses energy over distance, electricity is certainly no exception to that rule
but electricity is better than most
 
the photo above was in the purple region
 
I honestly had no idea that was a thing
 
it's really convenient in general
good water pressure, almost no waiting for hot water in the taps or in the room heaters
occasional downtime lasting 2-3 days yearly
no idea how efficient it is in terms of losses though
 
2:40 PM
it must not be that bad if a city can reasonably do this
 
people living in (typically larger) houses often opt out of that, because at a certain level it becomes more cost-effective to burn gas or just coal and heat the entire building that way
but packed blocks generally use it
 
its' above ground though, so it's also prone to getting hit by cars
that would get very expensive to fix, I'd imagine
 
@Neil heh. It says "warmer together" :)
 
and if you're living in some places in Italy, perfectly valid form of protest for some citizens here would be to simply destroy such things if they're not happy with it
@BartekBanachewicz that's cute :)
 
I've never heard about deliberate attacks on that, prolly because noone likes cold showers, regardless of your political opinions :D
District heating (also known as heat networks or teleheating) is a system for distributing heat generated in a centralized location through a system of insulated pipes for residential and commercial heating requirements such as space heating and water heating. The heat is often obtained from a cogeneration plant burning fossil fuels or biomass, but heat-only boiler stations, geothermal heating, heat pumps and central solar heating are also used, as well as heat waste from nuclear power electricity generation. District heating plants can provide higher efficiencies and better pollution control than...
that looks like an interesting read
 
2:48 PM
how can I create dropdown menu in react navigation, cant find in the doc
 
what doc? is "react navigation" a library?
@towc I want ecma features to pass that would completely break vue
 
yes react nativigation is a library
this is the link
 
Is it a "drawer" that you're looking for? reactnavigation.org/docs/en/drawer-based-navigation.html
I don't care to dig any deeper than that, but a drawer might be a dropdown
Their docs are pretty confusing
No actual examples
 
yes, really confusing, actually my menu is inside a drawer
i want a dropdown inside the drawer
 
3:04 PM
freecodecamp.org/news/… something like that may help?
Nested drawer, not quite dropdowns
 
anyone here worked with npm's activedirectory (which is based on ldapjs) and knows how to query entries of nested OU's?
 
3:17 PM
🚽
 
3:30 PM
Anyone have experience with gunDB?
 
never heard of it
 
4:05 PM
@Neil is gold officialy supported?
also, governments deal with bitcoin because they confiscate it from criminals anyway
it's like how the US gov owns several tons of cocaine
I think
 
4:34 PM
whats the best way to represent javascript data in html?
 
wat
 
ok that was a shitty general question
 
depends on the data, depends on the users, depends on a lot of things
 
Let me try again
Basically I am recreating a messaging application minus the messaging part (basically just a message database viewer).
I have all the messages with all the different conversations. I was to display that to the user, but because of the amount of messages (could be thousands) I don't want to load them all into html. However when the user scroll to the top of the window it should load the next x amount.
Sounds simple enough, but I'm not sure how to keep track of what messages are currently rendered, etc.
Maybe I should use react
I have been adding nodes to javascript objects but that seems wrong. (object.htmlNode.setAttribute("hidden",""))
 
object.htmlNode.hidden = true
n0oOO0OooOoo000ob
 
4:41 PM
sure, but you get the idea
maybe I need react
never mind
 
5:43 PM
Hi can you guide, How to compare current html and new change html only first time when page load. not all time
$('body').on('DOMNodeInserted', '#sectionData' function(){
console.log('DOMNodeInserted occurred');
});
it load every time not only one time check
 
Would using .one()... instead of .on() work for you?
 
I want to check only on this method beforeunload when page leave
Actually my data is append in div #sectionData, then i change some input field and reload or leave page then that time i need to check if html is change or not....
@Cameron got the point?
 
5:59 PM
why do you need to know if html is changed or not?
 
6:10 PM
i have formbuilder project and user create the some fields and by mistake page cancel, then beforeunload window popup will show and ask for leave if user leave then page then data will save that he has changed
First time when page load its mean not HTML change then add some fields like text-input and other and leave the page ... action will be happen on leave page.
if no change in data then beforeunload popup will not show.
on backend side i have large nested level of json and can't compare nested level json that may be performance issue
is any way to do that ???????????/
@rlemon
 
I have no idea what your trying to accomplish
 
@KevinB really you did not understand the point?
 
6:26 PM
1 min ago, by Kevin B
I have no idea what your trying to accomplish
At this point i'm not even sure if comparing html or looking for html changes is at all relevant to the problem you are trying to solve.
because i don't know what problem your trying to solve
 
if I understand the problem. you don't have to compare anything
you just need to mark a flag when any content is changed
 
On input change, any input change, bind the beforeunload handler that asks if they're sure
 
Actually, I want to save data on beforeunload if data is changed from user action like edit form or some thing.....if user not change any form the beforeunload popup will not show....
 
Right
so... if you're gonna save the user's data even if they didn't click save, why not save it every time an input changes?
 
I have 17 controls inputs and lots of button i can't bind to every events to tha
 
6:32 PM
i mean... why not?
 
I have almost 100 actions... are you sure it's a correct solution bind DOMNodeInserted to every event.
 
no, lol
i would never use that event to begin with
 
@KevinB Data will be save on SAVE button clicked
 
Can you provide a sample of what an input is in your case?
Are you using content editables? something else?
regular inputs?
You mentioned that on change of an input, you append data to html
why can't you just listen to the change event of said input?
why inpsect the div at all?
It's very easy to determine if the value of an input has changed from default
Determining if html has changed is a whole nother ballgame because browsers differ.
 
 
6:42 PM
hey guys, for those of you familiar with node.js, do you know any libraries that support e2ee (end-to-end encrypted) chatting?
I have found countless encryption libraries out there (that can generate keys and encrypt data), but I haven't found a library that puts it all together in a simple way where you can establish an E2EE connection without having to manually implement the transferring of a key through Diffie-Hellman, etc.
 
here is my page check / compare data on page reload only not input change.
@KevinB http://prntscr.com/p9yto2
 
Why would you compare on reload?
it's just so wasteful
 
it's requirement
 
it isn't though
It's the Y in an X/Y problem
Your requirement is to ask the user if they're sure when leaving the page if and only if they have unsaved changes. Comparing on reload isn't part of that
All you should be doing at that point is checking a flag that should have already been set at that point.
I'm not going to help you compare html.
 
when user first time on page and not change the data then reload the page,,, then do not need popup,, if user change some on like section title xyz then poup should show. for saving data
Where i set the flag can you describe ?
 
6:47 PM
When the user changes something.
 
Your requirement is to ask the user if they're sure when leaving the page if and only if they have unsaved changes. Comparing on reload isn't part of that...
Exact they save changing when leave the page.it's for option for user
little thing compare the json is correct solution or not?
 
Bind a change event on the form. Listen to it. when it occurs, if the default value of the input that changed doesn't match its value, set the flag.
it's simple
it doesn't care how many inputs you have
just 1 event handler
 
if user not change the value he drop some other upload-picture field then...?
if user delete the field
copy field
 
note the part about default value
As far as image change, that's litterally a change
even if they give the same image
Treat it as such imo.
 
here is lot of places not just value. like if user resize the fields
 
6:53 PM
Resizing the field changes a value somewhere
The event of changing said value should set the dirty flag to true, thus prompting the user on exit.
 
actually i am using the indexDB my all data saving in indexDB then save on Server.
is any other way to do check data in indexDB is changed or not
 
during an unload? no
that would require ajax
 
yes onload not first time laod
 
If something changes, set the flag.
it's not complicated
 
for indexDB i am using this.
https://dexie.org/
 
6:56 PM
i don't know what that is other than a url to some website i've never visited.
 
it's i will bind handler and set flag to every event change right..?
 
7:34 PM
err
howd i get here
 
a series of considerably less than optimal life choices, presumably
 
0
Q: How to make the situation true JAVASCRIPT

NewProgI don't know what is the missing code here it's giving me a headache because of the conditional statement. Add the missing codes so that the condition below will evaluate to TRUE and print “it works!” in the console. if (num == 100 && num== 200 && num==300) { document.write('it works!'); }...

 
The sad part is if a question like the following was asked today it would be downvoted
2426
Q: Can (a== 1 && a ==2 && a==3) ever evaluate to true?

Dimpu Aravind Buddha Moderator note: Please resist the urge to edit the code or remove this notice. The pattern of whitespace may be part of the question and therefore should not be tampered with unnecessarily. If you are in the "whitespace is insignificant" camp, you should be able to accept the code as is. Is ...

 
It was downvoted then too
-7 when i answered it
Today it'd just get closed as a dupe
 
7:58 PM
@KevinB Hmm. So what change it to be upvoted so much?
 
people didn't think it was possible
 
so if a question doesnt have a solution than its downvoted?
 
it's a stupid useless question
it did get downvoted
it got upvoted because people found it interesting
 
whats the current count?
 
-40
 
8:01 PM
It should have the "this is a shitty question but we keep it here for historical purposes" message
 
that's only used for questions that would otherwise match a close reason
this one is on topic
 
oh
 
8:20 PM
would you guys set a limit on loaded messages in a chat?
for example here you can go back in time and load messages
 
There is a limit here
eventually it will stop and force you to go to the transcript
I think that's a good thing, as too many elements on the page could be detrimental to performance
 
what is a transcript?
 
an archive of chat
The transcript contains all messages ever posted to the room that weren't deleted or moved.
 
isn't that made of messages as well? with a bunch of divs?
 
yes
but it's paginated
 
8:22 PM
so what's the difference?
 
...
it doesn't show an endless number of messages
 
if I go back in time in the transcript and load all pages?
 
only the ones on a given "page"
 
mm okay
thank you
what limit of messages would you suggest?
1024?
 
dunno
 
8:24 PM
paginated in pages of 32?
 
20? 50? 100?
 
8:42 PM
is this ok?
    Promise.all([
        this.getParticipants().then(participants => this.participants = participants),
        this.getMessages().then(messages => this.messages = messages),
    ]).then(_ => this.emit("ready"));
(Making the array of promises have then statements instead of using values in promise.all)?
 
8:57 PM
sure, why not
 
Hey guys. What's going on here ?
 
@AmadouBeye 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.
 
01:00 - 22:0022:00 - 00:00

« first day (3264 days earlier)      last day (1676 days later) »