These are chat archives for FreeCodeCamp/Help

19th
Mar 2018
Darren
@DarrenfJ
Mar 19 2018 05:57
@thekholm80 just got a samsung tbh.. needed something with some actual memroy to use apps. My last one was a motoG from like 3+ years ago
BuntyBru
@BuntyBru
Mar 19 2018 06:21

Help me with a thing

It is related to NodeJS

fs.readFileSync('readme.txt','utf8', function(err,data){
console.log(data);
});

//readme.txt is a textfile with data "hello Freecodecamp"

so i was sure that this would print the data on the terminal
I am not sure why this did not happen.

At the same time if i do

fs.readFile('readme.txt','utf8', function(err,data){
console.log(data);
});

The data is printed

As far as i know that the difference between readFile and readFileSync is just the synchronization part
That readFileSync blocks any further operations before it is completed
whereas that is not the case with readFile, readFile allows the further code to run
Claudio Restifo
@Marmiz
Mar 19 2018 08:34
@BuntyBru I doubt that the sync version will accept a callback, since it's a sinchronous operation.
Perhaps you should take an approach closer to:
var data = fs.readFileSync('...' ,  '...');
console.log(data)
BuntyBru
@BuntyBru
Mar 19 2018 08:36
@Marmiz
so i need to assign it to a variable?
okay its working
thanks
Claudio Restifo
@Marmiz
Mar 19 2018 08:38
@BuntyBru that's what you do with a normal synchronous function.
For example:
function addTwo(n) { return n +2}

var x = addTwo(10); // addTwo is a synchronous operation
console.log(x) // 12;
BuntyBru
@BuntyBru
Mar 19 2018 08:39
okay i got that
what of we write addTwo as a asynchronous operation
?
Claudio Restifo
@Marmiz
Mar 19 2018 08:41
Then it should accept a callback as a result of the async call:
var x = addTwo(n).then('do something')
which is exactly how your readFile is working right now
BuntyBru
@BuntyBru
Mar 19 2018 09:15
@Marmiz
okay man
BuntyBru
@BuntyBru
Mar 19 2018 09:46
q
Daniel
@dkapexhiu
Mar 19 2018 11:27
Hello! How to speed up the first meaningful paint and first interactive (beta) in google lighthouse? i have minified evey html, css, js, and images with gulp but performance went from 0 to 10 points.. how can i optimize it further?
Mukesh Kumar Angrish
@MukeshAngrish
Mar 19 2018 13:27
Can anyone please help. I moved my project from Atom editor to codepen and now the keydown events are not working.
I'm getting these errors in the console :
react-dom.development.js:7357 Uncaught TypeError: existingChildren.set is not a function
    at mapRemainingChildren (VM23377 react-dom.development.js:7357)
    at reconcileChildrenArray (VM23377 react-dom.development.js:7841)
    at reconcileChildFibers (VM23377 react-dom.development.js:8193)
    at reconcileChildrenAtExpirationTime (VM23377 react-dom.development.js:8306)
    at reconcileChildren (VM23377 react-dom.development.js:8289)
    at updateHostComponent (VM23377 react-dom.development.js:8540)
    at beginWork (VM23377 react-dom.development.js:8771)
    at performUnitOfWork (VM23377 react-dom.development.js:10766)
    at workLoop (VM23377 react-dom.development.js:10830)
    at HTMLUnknownElement.callCallback (VM23377 react-dom.development.js:580)
mapRemainingChildren @ react-dom.development.js:7357
reconcileChildrenArray @ react-dom.development.js:7841
reconcileChildFibers @ react-dom.development.js:8193
reconcileChildrenAtExpirationTime @ react-dom.development.js:8306
reconcileChildren @ react-dom.development.js:8289
updateHostComponent @ react-dom.development.js:8540
beginWork @ react-dom.development.js:8771
performUnitOfWork @ react-dom.development.js:10766
workLoop @ react-dom.development.js:10830
callCallback @ react-dom.development.js:580
invokeGuardedCallbackDev @ react-dom.development.js:619
invokeGuardedCallback @ react-dom.development.js:476
renderRoot @ react-dom.development.js:10908
performWorkOnRoot @ react-dom.development.js:11556
performWork @ react-dom.development.js:11509
requestWork @ react-dom.development.js:11420
scheduleWorkImpl @ react-dom.development.js:11274
scheduleWork @ react-dom.development.js:11231
enqueueSetState @ react-dom.development.js:6754
Component.setState @ react.development.js:491
playerMove @ pen.js:63
handleKeyPress @ pen.js:145
react-dom.development.js:11079 Uncaught TypeError: capturedErrors.set is not a function
    at captureError (VM23377 react-dom.development.js:11079)
    at renderRoot (VM23377 react-dom.development.js:10933)
    at performWorkOnRoot (VM23377 react-dom.development.js:11556)
    at performWork (VM23377 react-dom.development.js:11509)
    at requestWork (VM23377 react-dom.development.js:11420)
    at scheduleWorkImpl (VM23377 react-dom.development.js:11274)
    at scheduleWork (VM23377 react-dom.development.js:11231)
    at Object.enqueueSetState (VM23377 react-dom.development.js:6754)
    at App.Component.setState (VM23376 react.development.js:491)
    at App.playerMove (VM23378 pen.js:63)
Ken Haduch
@khaduch
Mar 19 2018 13:49
@MukeshAngrish - could you be missing some other package that you loaded in your local project? Or using a different version of React?
Ken Haduch
@khaduch
Mar 19 2018 14:00
@MukeshAngrish - it almost seems like an initialization problem, because after getting the error a couple times, it then proceeds to issue other console messages like Use the arrow keys or WASD to move the player - although the player is not moving, from what I can tell...
Mukesh Kumar Angrish
@MukeshAngrish
Mar 19 2018 14:04
@khaduch I don't think I missed anything. I'm not using any package except React. And in the codepen, I'm using the latest CDN links from reactjs.org . A few hours ago, I copied the project from the editor to codepen and it was working perfectly. Now I added the playerMove() function and copied it to the codepen and it doesn't work.
The console message is because I'm using this at the end of playerMove()
console.log(this.state.message);
Johnny
@JohnnyBizzel
Mar 19 2018 14:07
@MukeshAngrish Why not try it on https://codesandbox.io/ instead?
Mukesh Kumar Angrish
@MukeshAngrish
Mar 19 2018 14:09
@JohnnyBizzel Because the freeCodeCamp challenge requires a Codepen.io link.
Johnny
@JohnnyBizzel
Mar 19 2018 14:09
@MukeshAngrish I don't think it is set in stone. Check the about page. https://forum.freecodecamp.org/t/do-we-have-to-use-codepen-are-there-alternatives/10119
Kyle Holm
@thekholm80
Mar 19 2018 14:11
i turned in several projects that weren't hosted on codepen
@MukeshAngrish You are using a development version of React? Perhaps codepen doesn't support it yet.
Mukesh Kumar Angrish
@MukeshAngrish
Mar 19 2018 14:14
@JohnnyBizzel I thought Codepen was a compulsory thing.
Clearly not
Mukesh Kumar Angrish
@MukeshAngrish
Mar 19 2018 14:15
@JohnnyBizzel Yeah I looked at that. Thanks.
CamperBot
@camperbot
Mar 19 2018 14:15
mukeshangrish sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1809 | @johnnybizzel |http://www.freecodecamp.org/johnnybizzel
Johnny
@JohnnyBizzel
Mar 19 2018 14:15
@MukeshAngrish Look for the question "Do I have to use CodePen for the front end projects?"
Mukesh Kumar Angrish
@MukeshAngrish
Mar 19 2018 14:18
@JohnnyBizzel I have used the development version in earlier projects. And as I said earlier, I copied this project to codepen few hours ago without any issue. But not that I updated the code with the playerMove() function, it's giving this error in the console I haven't seen before.

@JohnnyBizzel The about page was more clarifying :

Do I have to use CodePen for the front end projects?
As long as your code is publicly viewable somewhere on the internet, and you have a live demo, you can use whatever tools you want.

knight2
@knight2
Mar 19 2018 14:20
Does anyone know a good video tutorial for setting up visual studio code for web development, that will allow use of SCSS, React + babel?
I really don't understand why it is only me who is having this huge issue
I didn't do anything wrong, fresh visual studio code installs, followed instructions for using those externals via the official VSC website. I have spent more time this week trying to figure out the configurations for visual studio code instead of actually programming.
Another IDE would be fine, as long as there are very clear instructions from fresh install on how to work with web development files, use SCSS, use React/babel, and automatically compile those.
And the even bigger question..... Why doesn't FCC pick a popular IDE and show you how to configure it to use all the libraries that THEY make you use?
Johnny
@JohnnyBizzel
Mar 19 2018 14:21
@MukeshAngrish Ok well, if it was me, I would try another service to see if it worked there. Then I would try changing the React version. Then I would start to figure out what the errors left mean.

@knight2

Why doesn't FCC pick a popular IDE and show you how to configure it to use all the libraries that THEY make you use?

Err, for what O/S? Everyone has a preferred IDE.

@knight2 For info, my preferred IDE is codepen, C9.io or Glitch (2 of which are recommended by FCC)
Kyle Holm
@thekholm80
Mar 19 2018 14:24
i use Atom for web, but it's just a text editor not an IDE
Johnny
@JohnnyBizzel
Mar 19 2018 14:25
@thekholm80 Comes with some great plugins though. :+1:
Kyle Holm
@thekholm80
Mar 19 2018 14:25
I'm a big fan
knight2
@knight2
Mar 19 2018 14:25
@JohnnyBizzel windows 8.1 64bit. You preferred ide really is codepen?
Kyle Holm
@thekholm80
Mar 19 2018 14:25
although, i've spent so much time customizing it that it takes forever to set up a fresh install lol
knight2
@knight2
Mar 19 2018 14:26
@JohnnyBizzel is codepen really considered an acceptable development platform professionally?
Johnny
@JohnnyBizzel
Mar 19 2018 14:26
@knight2 I use Bluefish editor.. Not great but does the job. For React I am happy working on C9.
knight2
@knight2
Mar 19 2018 14:26
@thekholm80 does atom automatically compile SCSS and babel/react?
Kyle Holm
@thekholm80
Mar 19 2018 14:26
atom is a text editor. I use webpack to for that
although, the compiling takes place in the browser, for that i use Chrome
knight2
@knight2
Mar 19 2018 14:29
So for example, how would it look like, step by step, if you were writing on the text editor, and then wanted to see it on the browser? I don't understand how you'd use the webpack to compile any scss/babel/react
because FCC doesn't exactly show you this.
I'm happy to use any text editor and/or IDE, but am very unclear on the steps to compile anything that isn't just simple html css javascript
Kyle Holm
@thekholm80
Mar 19 2018 14:31
i write my react / scss files in atom, write a webpack config file, add a start script to package.json then in terminal run that script (in development i use webpack-dev-server to bundle/serve the files) and then i can see it in chrome
this is pretty standard for react development
knight2
@knight2
Mar 19 2018 14:32
Any tutorials/step by step examples you can recommend for this process? write a webpack config file, add a start script to package.json then in terminal run that script
Kyle Holm
@thekholm80
Mar 19 2018 14:32
hmm
i used a udemy course by Stephen Girder (sp?) to learn all that
but it costs money
Johnny
@JohnnyBizzel
Mar 19 2018 14:33

@knight2 You can just add these to the head tag

    <script src="https://unpkg.com/react@latest/dist/react.js"></script>
    <script src="https://unpkg.com/react-dom@latest/dist/react-dom.js"></script>
    <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>

for a quick test.

SCSS I don't know.
knight2
@knight2
Mar 19 2018 14:33
so maybe just skip scss?
Johnny
@JohnnyBizzel
Mar 19 2018 14:33
@knight2 That's why I use codepen or jsbin or jsfiddle. You can just add them and away you go.
knight2
@knight2
Mar 19 2018 14:34
Yeah but there is 100% a way to compile automatically via visual studio code
That is the whole point of using it, making it was simpler. All of this should be very simple with the existing tools out there.
Kyle Holm
@thekholm80
Mar 19 2018 14:37
the simple solution is to use create-react-app and not learn to do any of the config yourself
knight2
@knight2
Mar 19 2018 14:37
hmm okay
I think for now, i'll forget about using SCSS, see if I can get automated react compiling with the visual studio code again, if that doesn't work i'll just follow your setup @thekholm80
thanks for discussing @JohnnyBizzel @thekholm80
CamperBot
@camperbot
Mar 19 2018 14:38
knight2 sends brownie points to @johnnybizzel and @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1732 | @thekholm80 |http://www.freecodecamp.org/thekholm80
:star2: 1810 | @johnnybizzel |http://www.freecodecamp.org/johnnybizzel
Johnny
@JohnnyBizzel
Mar 19 2018 14:44
@knight2 :+1:
Muoshu
@Muoshu
Mar 19 2018 14:52
Hello! Can anybody help me?
<style>
h2 {color:blue;}

<h2> 在大家心目中,猫是慵懒的可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</h2>
</style>
I want my index change to blue :)
Kyle Holm
@thekholm80
Mar 19 2018 14:54
move your <h2></h2> element outside of your <style></style> tags
Nnenanya Chinedu
@Manpee
Mar 19 2018 15:04
Please who can assist me here? Anything wrong with this code;
var myCar = function()
{
this.wheels = 4;
this.engines = 1;
this.seats = 5;
};
myCar.nickname = "camry";
It keeps telling me "The property wheels of myCar should equal 4."
Stephen James
@sjames1958gm
Mar 19 2018 15:06
@Manpee myCar is a function not an object. Perhaps you were supposed to create myCar from the Car constructor
var myCar = new Car();
Nnenanya Chinedu
@Manpee
Mar 19 2018 15:08
Ok @sjames1958gm let me try that
Stephen James
@sjames1958gm
Mar 19 2018 15:08
@Manpee If you use new with the constructor function it will get the properties that are assigned inside the function, such as this.wheels = 4;
@Manpee :+1:
Nnenanya Chinedu
@Manpee
Mar 19 2018 15:09
Thanks @sjames1958gm it worked
CamperBot
@camperbot
Mar 19 2018 15:09
manpee sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9116 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Mar 19 2018 15:10
@Manpee :+1:
Kyle Holm
@thekholm80
Mar 19 2018 15:11
@DarrenfJ I love my Samsung phone - i've had S3, Note 3 & S6 edge+ they're pretty good.
Nnenanya Chinedu
@Manpee
Mar 19 2018 15:11
@sjames1958gm
Stephen James
@sjames1958gm
Mar 19 2018 15:12
@Manpee yes sir?
Nnenanya Chinedu
@Manpee
Mar 19 2018 15:12
@sjames1958gm Thanks
CamperBot
@camperbot
Mar 19 2018 15:12
manpee sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
api offline
Darren
@DarrenfJ
Mar 19 2018 15:59
morning fCC
Kyle Holm
@thekholm80
Mar 19 2018 16:00
@DarrenfJ :wave:
Darren
@DarrenfJ
Mar 19 2018 16:00
@thekholm80 yah mine's the S8... took forever to find one though every place we went on this one company kept trying to iPhones to me
Kyle Holm
@thekholm80
Mar 19 2018 16:00
i'm sure the iphones are good phones, but i'm not interested in owning one
Darren
@DarrenfJ
Mar 19 2018 16:01
me neither
my gf has the iphone which is why I was looking for something at her carrier so we can join into one bill yadda yadda but quite a few stores had almost no android stock it was weird...
Kyle Holm
@thekholm80
Mar 19 2018 16:02
that's crazy
Darren
@DarrenfJ
Mar 19 2018 16:03
yah it was annoying.. when she switched i asked them for anything moto cause i was ok with my moto like moto Z or something and they said they didn't have it in stock and would call me when it was in...
Kyle Holm
@thekholm80
Mar 19 2018 16:03
my watch is motorola, it's pretty spiffy
Darren
@DarrenfJ
Mar 19 2018 16:04
2 months later we went back like wtf? gonna call us? 'oh yah we're not stocking that brand anymore" what about this? and this? and this.. nope nope nope.. called 6 to find a store with the S8 in stock... that was my Saturday : /
Ken Haduch
@khaduch
Mar 19 2018 16:04
@DarrenfJ - hey there! And @thekholm80 - and @sjames1958gm - hello to everyone!
Kyle Holm
@thekholm80
Mar 19 2018 16:04
that's really crazy
@khaduch hi Ken
Darren
@DarrenfJ
Mar 19 2018 16:04
yah i like the motoG it was good but super first gen and was just running out of memory everytime apps updated required me to do it manually (clear the cache) and was super slow to load stuff... so I was ready to upgrade...
hey buddy! :wave: @khaduch
the downside is i now have space to add games
Kyle Holm
@thekholm80
Mar 19 2018 16:05
lol
Darren
@DarrenfJ
Mar 19 2018 16:05
there goes my free time ;)
Kyle Holm
@thekholm80
Mar 19 2018 16:06
i've just started Breath of the Wild, it's taking a lot of my time
Stephen James
@sjames1958gm
Mar 19 2018 16:06
@khaduch :wave:
@thekholm80 Great game
Kyle Holm
@thekholm80
Mar 19 2018 16:07
@sjames1958gm it really is, i'm surprised the franchise can stay so interesting for so long
Stephen James
@sjames1958gm
Mar 19 2018 16:08
@thekholm80 It is really wide open, new, but you can feel the best of the franchise in certain aspects
Kyle Holm
@thekholm80
Mar 19 2018 16:09
so far like 80% of my play time has been spent cooking lol
Darren
@DarrenfJ
Mar 19 2018 16:14
hmmm, sounds interesting ;)
that mobile game?
I'm on try 1000 (actually try 3 this year) to finish the main storyline in Skyrim.. once and for all.. but holy side quests
I'v already put it down... tired of basically clearing a cave in 5 minutes and then spending 3 hours porting loot to merchants...
it's the medieval equivalent of waiting in line at walmart.
Manish Giri
@Manish-Giri
Mar 19 2018 16:16
@DarrenfJ :wave:
Darren
@DarrenfJ
Mar 19 2018 16:16
@Manish-Giri buddy! haven't seen you in here in ages... but then i'm in sporadically tbh
Manish Giri
@Manish-Giri
Mar 19 2018 16:17
@DarrenfJ yah man, i'm mostly away contemplating the meaning of life these days
how're you
Darren
@DarrenfJ
Mar 19 2018 16:17
same, but in gaming format
Ken Haduch
@khaduch
Mar 19 2018 16:18
@Manish-Giri :wave:
Manish Giri
@Manish-Giri
Mar 19 2018 16:18
@khaduch :wave:
Darren
@DarrenfJ
Mar 19 2018 16:18
contemplating the meaning of 3 lives and levelling up
Manish Giri
@Manish-Giri
Mar 19 2018 16:18
how goes it @khaduch
Darren
@DarrenfJ
Mar 19 2018 16:18
brb
Ken Haduch
@khaduch
Mar 19 2018 16:18
@Manish-Giri - okay... not too much going on here. How about you?
Manish Giri
@Manish-Giri
Mar 19 2018 16:19
@DarrenfJ i'd loove to do some gaming too, but my windows PC can barely open chrome without crashing, so..
@khaduch same old, trying to do a hundred things and not getting anything done...
Ken Haduch
@khaduch
Mar 19 2018 16:23
@Manish-Giri - I hear ya - I cannot focus on anything long enough to complete any task...
Manish Giri
@Manish-Giri
Mar 19 2018 16:23
anyone knows of a way to prevent node_modules from being synced into dropbox, like what .gitignore does?
alpox
@alpox
Mar 19 2018 16:24
@Manish-Giri I would already try to circumvent putting projects into dropbox :D
node_modules being one reason
Ken Haduch
@khaduch
Mar 19 2018 16:25
@MukeshAngrish - I don't know if you've gotten anywhere with this, or if you're even online anymore at this point. It seems that the first time the keypress is handled and the state is updated is when the error takes place. That only happens one time, from what I can tell. After that, I'm not seeing the player move, but it seems that the next attempts to process a keypress do not result in an error. Maybe they aren't trying to update the state - I have to walk through the next one in the debugger and see if it actually does go through the same path.
Manish Giri
@Manish-Giri
Mar 19 2018 16:27
@alpox I agree, but I have multiple machines, and I really can't push/pull/merge into github every time, it gets tedious
alpox
@alpox
Mar 19 2018 16:29
@Manish-Giri Worked out for me until now :D
gishy1
@gishy1
Mar 19 2018 16:34
hello guys with the random quote machine after clicking it shows the quote but not the button for me t generate the next new quote
what can i do to rectify this ?
Darren
@DarrenfJ
Mar 19 2018 16:42
@Manish-Giri mine's been doing the same with chrome.. it's a space hog for sure
gishy1
@gishy1
Mar 19 2018 16:43
hello world?
hello universe?
hello marvel universe :laughing:
Manish Giri
@Manish-Giri
Mar 19 2018 16:46
@DarrenfJ I don't have other alternatives either, if I use firefox, it crashes the whole PC, causing BSOD
fml
@gishy1 post your codepen link maybe
Kyle Holm
@thekholm80
Mar 19 2018 16:50
@Manish-Giri :wave:
@DarrenfJ nah, it's not a mobile game
skyrim was fun, i should play it again
Manish Giri
@Manish-Giri
Mar 19 2018 16:55
@thekholm80 :wave:
Darren
@DarrenfJ
Mar 19 2018 17:21
back to testing... le sigh
Kyle Holm
@thekholm80
Mar 19 2018 17:53
well poop. looking at some of my old projects I see that some are broken now. I wonder if it's worth going back and updating them?
Ken Haduch
@khaduch
Mar 19 2018 18:12
@thekholm80 - how broken are they?
Kyle Holm
@thekholm80
Mar 19 2018 18:13
well, i just saw that yelp changed their api authorization, so my nightlife coordination app is just a search box and login app now
somehow the alignment on my game of life got off, so it's all funky
whoever's been building my stuff is really bad at it
Ken Haduch
@khaduch
Mar 19 2018 18:16
:)
Ken Haduch
@khaduch
Mar 19 2018 18:24
@thekholm80 - I guess that maintaining correct operation of the sites would be important if someone was going to be looking at them in the context of your portfolio to see what you've done?
Kyle Holm
@thekholm80
Mar 19 2018 18:25
the lazy side of me is making that same argument lol "nobody's ever going to look at it, so who cares if it works?"
i fixed my GoL, so i feel less bad
Ken Haduch
@khaduch
Mar 19 2018 18:31
@thekholm80 :clap: :)