« first day (2412 days earlier)      last day (2522 days later) » 

12:05 AM
I'm new to js/react (java back end for 9 years and only recently started seeing the light). I'm creating a SPA that is rather big. So I'm struggling a lot with best practices in general. Currenlty for all my input fields I have an (more or less generic) on change function that puts every key stroke in my state. Is this the way to go?
 
That's known as a controlled-input, and typically yeah, that's what you want to do
 
real hardcore react devs put every keystroke into their redux state
 
i set int number = 0; in .js file and it doesnt work?
 
@Timppa Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Real hardcore react devs dispatch an action on every keystroke that puts the character into their redux store
 
12:14 AM
guess that makes me a real hardcore react dev cough cough
 
@monners well yeah, how else would you do it?
 
@david Magic.
 
ah yeah
@Timppa what do you mean by int?
javascript doesn't "do" ints
except as a side-effect of the floating point spec
 
no really just a little confirmation that the way I'm implementing this monster is "correct" helps a lot
and another way would be to keep a state on your component
 
@mahieus Here, from the actual react docs: facebook.github.io/react/docs/forms.html
it's quite a good read
on controlled components
 
12:18 AM
and only dispatch it to the store when pressing a button or some other event
@david thanks but I already went through it
I'm missing the picture for very large applications
about the store...
I currently have around 60 entities in it
for example a list with the users to be managed
when I change between pages
I never clean up the data in my store
even though when I return to the user over view page I reload all the data again because I could have been change in meanwhile
will this cause problems in the long run?
 
12:43 AM
let me ask you a question....waht do you happen to expect when the user reloads the page?
like just staight up hits f5
that should be in the store
 
:')
 
@KendallFrey WE GOT HIM HOME!!
it was tight.
 
what is the difference between promises and async.parallel?
 
1:04 AM
if i'm not mistaken, with promises you can indicate what needs to happen when an async call is done. async.parallel will wait for all async call that are done in parallel are done before gonig further
 
If I wanted to display my "productLines" JSON data into a <ul> from this function: snag.gy/czGNP4.jpg , how would I get a nestled <ul> from the "styles" JSON? My code: snag.gy/9JhTYP.jpg
 
1:25 AM
Hello
someone can say what is wrong with my code?
 
1 message moved to Trash can
@OtávioBarreto 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 gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
@CatFox There's so much wrong with that I don't even know where to begin... Maybe... Stop working and read a beginner's guide to JavaScript
 
@monners I am a beginner lol
 
what is wrong?
 
1 message moved to Trash can
@OtávioBarreto 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 gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
1:29 AM
press ctrl+k before you hit enter
 
1 message moved to Trash can
@OtávioBarreto 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 gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
$(document).ready(function() {

       var userpage = "<?php echo htmlspecialchars($donearray); ?>";

       $('#showmore').click(function() {
          $.ajax({
             type: "POST",
             url: "load_more_followers.php",
             data: {'userpage': userpage},
             success: function(msg) {
                $('#showmoreresult').append(html);
                $("#loaderIcon").hide();
             }
          });

       });

    });
 
bravo
 
thanks
 
np :)
 
1:30 AM
do you know what is wrong? it's just is not sending the post request or append the result
 
@monners if you wanted to take a JSON string and grab an object and create a nestled <ul>, how would you do it?
 
@rlemon noooice
 
@CatFox Those three actions are all entirely different things. But, basically, create the <ul>, parse the JSON, then iterate over the object and do whatever with the data, appending <li> to the <ul> as you go
But you're not there yet. Trust me.
 
@OtávioBarreto any errors in the console? Does the network tab show the outgoing request?
 
"Cleveland, Ohio Balloon Launch - a 1986 world record that launched 1.5 million balloons!" How cool is th--wait wha… https://twitter.com/i/web/status/866658064883212288
 
1:34 AM
no errors
the post is being posted
userpage=otaviobarreto
 
hhhhha. StackOverFlow changes to a chatting room.
 
@DaiKaixian Welcome to the JavaScript chat! Please review the room rules. Pleasedon't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
but it just not append the htmk result
 
oh, you're trying to append html but you're getting back msg
do you mean to use msg.html or something?
i don't know what your response format is like
 
my response format is html result
on the page
I just copied this example from some site
I want to retrive the html result
so I need to change something in success: function(msg) ?
 
1:43 AM
1 message moved to Trash can
@OtávioBarreto 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 gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
I need to load the html in load_more_followers.php page
 $.ajax({
         type: "POST",
         url: "load_more_followers.php",
         data: {'userpage': userpage},
         success: function(msg) {
            $('#showmoreresult').append(html);
            $("#loaderIcon").hide();
 
i am still having issues parsing results from mongooseModel.find
 
Any recommendation on how to get a let value that is in component that is in file "x" and use it in a component in file "a" if they are in the same directory?
say I use import X from "file/X";
 
@OtávioBarreto change success: function(msg) { to success: function(html) {
@feners you need to export the variable
 
Thanks
 
1:50 AM
How do I specify for it to be exported ? @david
 
are you using babel?
 
yes
 
/webpack
just put export const whatever = value
and then in the other file put import { whatever } from 'x'
 
it's working ok but breaking links and some css styles
 
why cant i use the users array returning from users.find() ?
            Users.find({}).exec(function (error, users) {
                console.log(users);
                callback(users);

            });

            function callback(users) {
                console.log(users);
                for(var i= 0; i < users.length; i++) {
                    // console.log(users[i].username);

                    if(users[i].username === username) {
                        console.log(users[i]);
                        return users[i];
 
2:01 AM
@david if this is in file X pastebin.com/fXi3Mc4y, how can I get that cart value in file A?
specifically
 
@GokhanDilek what does the console print?
 
@feners wait, is this a react component?
 
Yeah
 
are you using redux?
 
@david it now works just fine but break some css styles for the result
 
2:04 AM
No
 
I will see if the problem is my html
 
@OtávioBarreto You're on your own from here dude
i'm not going to help you fix styles ><
@feners any kind of flux implementation at all?
 
it prints this:
[ { _id: 5923ebe155447a248865682e,
user: 'gokhan',
username: 'gokhanAdmin',
password: 'password',
name: 'gokhan name',
role: 'admin',
__v: 0 },
{ _id: 5923ebe155447a248865682f,
user: 'john',
username: 'johnUser',
password: 'password',
name: 'john name',
role: 'user',
__v: 0 } ]
 
Nop xS @david
 
if not i'd probably suggest making a third file with a CartService or something that either exposes a singleton, or better, gets passed into the component via props. Use that as your bridge
i think you probably need to do some reading though
 
2:09 AM
@Cauterite i can console.log the users inside the callback function
 
@david I solved I had a php $var to represent site url
 
then i return the found user like return users[i]
 
I needed to include it inside the show_more file to the css would be like a link
 
@GokhanDilek so… where's the problem ?
 
@Cauterite when I want to read the property within the function, it is fine... But if I try to read its propery, i get Cannot read property 'username' of undefined
@Cauterite i am doing something like UserEntity.getUser(username).username
 
2:12 AM
ahaha
 
UserEntity.getUser(username) is users[i]
 
@GokhanDilek you're wasting people's time with this shit
you paste all this code that works perfectly
and then half an hour later you show the real problem
which is: you don't understand how async functions work
you need to read some javascript tutorials or something
sorry that came across a little harsh
but you need to show more code in these situations
 
I dont want to waste anyone's time. I am just trying to figure out this odd behaviour... If I manually define an array of users, my code works. As soon as I try to use the users.find, I am failing. https://gist.github.com/anonymous/ebb85d9de172fba3a5e3c12f86bb84ab
https://gist.github.com/anonymous/ea6df0e2155151d05448a396955ec3e0
 
there is nothign odd about this behaviour. your find function will always return undefined because it's asynchronous
you need to pass in a callback
or return a promise
 
again, you've given us a code snippet that doesn't even contain the method call you're talking about (users.find)
when your code's logic is abstracted by all these library functions it's very hard to help you troubleshoot unless you give us relevant information
 
2:22 AM
abstraction is a good thing :)
 
@ssube you know what i mean though, without any context we can only guess at what things are supposed to do
whereas if the code's just using standard JS/DOM functions we can usually see what's wrong without much context
 
yeah, it's important to know what the function is doing. Good abstraction should help isolate the problem to a single unit with clear contracts to other modules.
 
I don't even know how to begin explaining to him what he is doing wrong :(
 
I linked him the canonical Q&A on returning data from async/ajax calls, earlier today.
Not sure how to explain it better than those answers.
 
2:26 AM
Evening chaps
 
@ssube Yes, I saw that. There is a lot to take on
 
Should I wait until steam summer sale or buy it now?
 
ohh what game pootis?
 
GTA V
 
I played it for a while and wasn't impressed.
 
2:30 AM
It was pretty fun, got bored like ssube
 
that was mostly it, yeah. It felt like San Andreas and all the others, with floaty spinny cars.
 
"There is a lot to take on" yeah... you kinda need to do that. We can't make you magically know how to program, you need to teach yourself
 
2:46 AM
Ended up buying it.
 
tell us when it finishes downloading in 4 days time
 
if you like free stuff
need to add it to your library before the deadline though
 
free stuff makes me suspicious
 
@Cauterite i found my PS4 is connecting to Japanese servers to download updates.
if I block the IP range on my router it connects to Au servers, and my dl speed increases 6x
 
hah!
 
2:50 AM
took three days to download 1.5GB of Mass Effect
did the router config and the rest was done in like 3 hours
 
It'll take me a few hours.
3-4.
 
im still waiting for it to go on sale
gta V i mean
i suspect i might lose a week of my life once i get it
 
only a week? you must be pretty strong-minded
 
no like
a 24 hour a day week
 
last time i bought a game i lost 8 months playing like that
 
3:03 AM
damn which game was that?
civ?
 
Rainbow Six
 
puu.sh/vZCmV/6e140a9d87.jpg I didn't just lose a week
 
rainbow six seige?
is that any good?
 
That's 7.8k hours fyi
 
!!> 1784/24/30
 
3:04 AM
@david 2.4777777777777774
 
@derp the first one was
I was very good at it
 
almost 2 and a half months of real time spent in dota ><
 
1998
 
more than that I think
 
what a year for gaming
 
3:05 AM
when was swat 4 released?
oh 2005
 
@lix i was talking about myself, you can check your time played in the steam community pages
 
it's the best FPS ever released imo
despite its many flaws
 
Ahh my bad dude
 
@derp It's on sale.
-40%
 
oh steam?
 
3:07 AM
yep
 
Yeah I have 7800 hours on dota 2 currently
 
hmm 60 australian :/
 
i loved rainbow six. it was so much fun to do the tactics. even more fun than actually playing.
 
Hit 5k games played today actually
 
@derp i think the starter edition is much cheaper
i got it for free with my GTX970 though
 
3:08 AM
@hsimah, you may enjoy door kickers
 
I bought the game + $1.5m
 
are you talking about rainbow six or gta @Cauterite
 
@derp rainbow
 
oh sold
 
3:10 AM
is door kickers the name of the game?
 
yeah
 
yeah yeah lucky pootis with his 7.5MB/s internet connection
 
uhh let me link you to the review i saw which sold it to me
 
will have a look online
 
its released for a while now, but this was an early review
 
3:13 AM
@Cauterite It's 67.7 G though.
Insanely big.
 
my friend bought it on DVD
reminds me of getting windows 98 on floppy disks
 
How does that fit on a DVD?
 
12 of them?
 
indeed
 
and then you got to download another 30 GB for updates xD
 
3:15 AM
6 i think, dual-layer discs
 
makes it a bit of a moo point really
but yeah, let me know what you think of door kickers @hsimah
i totally suck at it xD
 
this looks cool
really cool
 
tango down!
 
i know another great game for you:
https://www.youtube.com/watch?v=PQQjlrMRXGk
 
3:30 AM
hi
is there a way to only show your own variables in the chrome dev tools variables section?
 
i guess that kinda works
 
what were you hoping for?
 
to see my global variables unmixed in with 200 others
 
you could uhh try to scope them a bit?
 
3:42 AM
uhh
i guess
 
at the start of your code do const notMyVariables = Object.keys(window); and then at the end of your code do const myVariables = Object.keys(window).filter(v => !notMyVariables.includes(v));
 
interesting
you are filtering out all the window's properties and putting the remaining set inside a global variable for scoping sorta?
 
you may want to do const myVariables = Object.keys(window).filter(v => !notMyVariables.includes(v)).reduce((o, v) => (o[v] = window[v], o), {});
it's a little more readable
 
though if you wrap your code within an anonymous function, then it won't be global
hey @mosho, how's the bike?
 
 
1 hour later…
dhS
5:15 AM
Hi
I am working on a javascript function in the gsp page
the function is to call the url of the method in the controller
when the url call the function will return the excel file
I need to pass the url with the parameters startdate and enddate
I have tried with the following code
 
1 message moved to Trash can
@dhS 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 gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
dhS
ok
 
5:36 AM
Am I correct in saying that most progressive frameworks like vuejs which I'm using work independent or rather are agnostic to the backend you choose to use for server rendering?
My current theory I'm planning to follow was building an API using express and auth0 and then run that as a server.js and make ajax calls from within the vuejs store to gather the data I wish to interpolate into my application. I'm just concerned deployment of this could be expensive to the server in terms of bandwidth / memory consumption. If anyone has any pointers could you let me know :-)
 
6:18 AM
did you have designed it first ?
 
what's a "progressive framework" ?
 
do that by pen and paper. If you think that the final design is good to go, then you can build. A software architect makes a choice based on pro/cons and the target solution
It's an iterative process though. It cna be that you have to add a component or something
 
@Cauterite I think he meant progressive web app framework? developers.google.com/web/progressive-web-apps
 
that page doesn't seem to define what a "progressive web app" is though
other than that it's "reliable, fast, engaging"
 
that "progressive" is a buzzword
marketing bluff
 
6:24 AM
okay wikipedia says "Progressive Web App (PWA) is a term used to denote web apps that uses the latest web technologies"
so "progressive" = "bleeding-edge" ?
 
IIRC google has a checklist of that
by this you can determine when an app is "progressive"
almost all points are part of a normal requirement...
 
"URL responds with a 200 when offline" — uh… wtf?
 
service workers
quite common in SPA's
 
what's an "SPA" ?
 
single page app
 
6:30 AM
ah okay
nonetheless, that undermines the whole point of HTTP status codes
 
well the service worker is acting as a proxy and to the browser, it is getting response back
so it is 200
the actual network call the service worker will timeout but that's okay because the client is getting offline content
 
Hi guysss
 
💩
 
alright this 'service workers' idea is scaring me, i'm gonna disable it and see what happens
 
howda f have you been?
 
6:36 AM
smashing magazine has an awesome one
you can check it out by visitng it, unplugging the network cable and then reloading it
 
wazzup wazzup
 
@derp i tried that, i got "Corrupted Content Error" in firefox
 
@RexAdrivan derp derp
 
@derp boy, I aint not cleaning up that.
 
your workng on your projects?
 
6:43 AM
💩💩💩
 
(y)
 
@derp oh my god at least clean after him
 
i'm a dog
dogs poop
💩
 
wattba
 
the fuck
 
6:49 AM
what the fuck are you doing guys?
 
everytime someone says coding is not fun
i start believing it
 
@Prakhar how pessimistic
 
you're on stackoverflow where people do coding for fake internet points
if it wasn't fun, people wouldn't do it
 
i've been hating my life as a programmer lately
i used to love it
 
i only hate it when microsoft is involved
i've been trying to get these breakpoints in ASP.NET to trigger for hours now
 
6:51 AM
now i dont know why but i want to do cool things, but before "programming" was the coolest thing
@Cauterite yea bro.
 
obviously because your apps are noobs
do you even know websockets and 3d games
 
lol
 
@Prakhar what are you programming?
 
@Prakhar sounds like you need a break and go work on your own thing for a while
 
maybe your apps aren't progressive enough
 
6:53 AM
he's apps are all webserver apps :))
 
@RexAdrivan i can implement the protocol
@RexAdrivan im a mobile/web fullstack
mostly android
 
what about webGL?
 
i
i've worked with unreal engine
 
you only have 1 user per day. hahaha
 
i've been freelancing since a year
maybe thats why
 
6:54 AM
what about marketing tools
 
@derp 💩 + 💣
 
do you even know realtime applications
 
@RexAdrivan im writing one right now
@RexAdrivan i do
 
if that's the case build an application that will change the world
 
i've been programming since i was 13
 
6:56 AM
well you're just programming not inventing
 
im about to be 18 now
i just think i should be doing something cool
like
 
you better create Artificial intellegence.. also do robotics
 
music production
 
@Prakhar Are you in college?
 
@RexAdrivan i used to do robotics
@VermillionAzure dropout
 
6:57 AM
forget software it's too easy
 
how can you have dropped out of university when you're not even 18 yet?
 
@RexAdrivan i think, when i dropped out thinking i dont need school, and when i got into
 
now the hardest part is creating an application with lots of users
 
@Cauterite i dropped out of school
 
@Prakhar oh okay
 
6:58 AM
you dont even have a working app?
 
now when last year
 
vscode question
I find in replace across all project
 
machine learning and artificial intelligence
became mainstream
 
is there a shortcut to go to the next find?
 
i was fucked :D
because i dont know much maths
 
6:58 AM
f3,f4 only go to the next one in the same file
 
@Prakhar what genres do see yourself making?
 
dubstep, house
 
or maybe make a drone that will kill yourself.. jok
 
@Prakhar Why not? Or, rather, why not try and learn some because it's important?
 
i've ordered some maths books
 

« first day (2412 days earlier)      last day (2522 days later) »