These are chat archives for FreeCodeCamp/Help

2nd
May 2018
Kyle Holm
@thekholm80
May 02 2018 01:08
i can never tell if i have enough comments, or too many
that whole "good code doesn't need comments" thing makes me doubt myself lol
Arron Kennedy
@azatherazza_twitter
May 02 2018 01:09
get a linter for your text editor. I think inline comments are not recommended in fcc's style guide but thats about it i think
Kyle Holm
@thekholm80
May 02 2018 01:09
i'm using eslint with airbnb config
Arron Kennedy
@azatherazza_twitter
May 02 2018 01:10
but a linter will help with writing good code
yeh nice, just go with that
comments are there to explain what the code does, I think the level of commenting you want to include will depend on your target audience.
Kyle Holm
@thekholm80
May 02 2018 01:11
mostly just for future me lol
i don't write anything anyone would use
Arron Kennedy
@azatherazza_twitter
May 02 2018 01:12
well then if it's just for you I would just comment in a way that would help you best remember what you did if looking at it in a years time
Claudio Restifo
@Marmiz
May 02 2018 02:19

@thekholm80

mostly just for future me lol

/** 
* You want to fix this?
* lol
*/
Kyle Holm
@thekholm80
May 02 2018 02:19
@Marmiz lol
Arron Kennedy
@azatherazza_twitter
May 02 2018 02:19
haha
Kyle Holm
@thekholm80
May 02 2018 02:20
my last project had:
/**
    NOTE:
    This is server.listen(), not app.listen().  Don't spend another 4 hours
    on stack overflow debugging this stupid mistake again
*/
Kyle Holm
@thekholm80
May 02 2018 02:26
@Marmiz have you worked with graphql?
Claudio Restifo
@Marmiz
May 02 2018 02:26
@thekholm80 we switch to graphql on our main project :)
no more REST
Kyle Holm
@thekholm80
May 02 2018 02:27
i'm so freaking stuck right now

i've got

  type Trade {
    book: Book!
    requestedBy: String!
    tradeStatus: String!
  }

  type TradeList {
    tradeList: [Trade]
    status: String!
  }

  type Query {
    getPendingTradesByOwner: TradeList
  }

and my queries are returning "Syntax Error: Expected Name, found <EOF>"

stackoverflow is failing me

when i had it as

  type Trade {
    book: Book!
    requestedBy: String!
    tradeStatus: String!
  }

  type Query {
    getPendingTradesByOwner: [Trade]
  }

it worked fine

Arron Kennedy
@azatherazza_twitter
May 02 2018 02:31
what language is it? the syntax doesnt look like javascript but i am a noob
Kyle Holm
@thekholm80
May 02 2018 02:32
oh, it's a string literal for graphql - it's javascript but a little weird
Claudio Restifo
@Marmiz
May 02 2018 02:35
@thekholm80 what type is tradelist an array?
Kyle Holm
@thekholm80
May 02 2018 02:35
yeah
i can show you the resolver if that helps
Claudio Restifo
@Marmiz
May 02 2018 02:35
@thekholm80
  type Query {
    getPendingTradesByOwner: [TradeList]
  }
Kyle Holm
@thekholm80
May 02 2018 02:36
oh, no TradeList is an object, tradeList is an array lol my variable naming is bad
Claudio Restifo
@Marmiz
May 02 2018 02:36
@thekholm80 and the error is when you perform the query?
Kyle Holm
@thekholm80
May 02 2018 02:36
yeah
Claudio Restifo
@Marmiz
May 02 2018 02:36
cos I've never seen an end of file error :O
query?
Kyle Holm
@thekholm80
May 02 2018 02:37
query {
  getPendingTradesByOwner {
    tradeList {
      book {
        title
        author
      }
      requestedBy
      tradeStatus
    }
    status
}
Claudio Restifo
@Marmiz
May 02 2018 02:37
@thekholm80 you're missing a }
at the end
Kyle Holm
@thekholm80
May 02 2018 02:38
mother f
@Marmiz thanks lol
Claudio Restifo
@Marmiz
May 02 2018 02:38
was that?
Kyle Holm
@thekholm80
May 02 2018 02:38
2 hours of my life i'll never get back
{
  "data": {
    "getPendingTradesByOwner": {
      "tradeList": [
        {
          "book": {
            "title": "Green Eggs and Ham",
            "author": "Dr Seuss"
          },
          "requestedBy": "bob",
          "tradeStatus": "pending"
        }
      ],
      "status": "true"
    }
  }
}
Claudio Restifo
@Marmiz
May 02 2018 02:39

@thekholm80 :clap: :clap: :clap:

btw calling an object List is highly misleading :smile: :smile: :smile:

Kyle Holm
@thekholm80
May 02 2018 02:39
yeah lol
that's probably the best resolver i've ever written. i'm loving graphql
Claudio Restifo
@Marmiz
May 02 2018 02:41
cool stuff :)
Kyle Holm
@thekholm80
May 02 2018 02:42
i hope your work lets you use graphiql
it makes testing queries so easy
Claudio Restifo
@Marmiz
May 02 2018 02:43
we are using graphql on our newest project :)
Kyle Holm
@thekholm80
May 02 2018 02:43
graphiql is a web interface for testing, it's awesome
Claudio Restifo
@Marmiz
May 02 2018 02:43
oh that
yes for sure we use it
we prototype there
Kyle Holm
@thekholm80
May 02 2018 02:44
looks like this
image.png
Claudio Restifo
@Marmiz
May 02 2018 02:49
@thekholm80 mine is the same but with ~20 tab queries opened
Kyle Holm
@thekholm80
May 02 2018 02:50
well you're a pro lol i'm just a rookie
Claudio Restifo
@Marmiz
May 02 2018 02:53
no we just have a butt load of data.
Many are wrapped in a viewer and then in a intention before even reaching the data
I have so many helpers to work with objects in my app that you have no idea
Kyle Holm
@thekholm80
May 02 2018 02:53
that sounds crazy
Claudio Restifo
@Marmiz
May 02 2018 02:53
flatObject, objectToTree, objectToPairs, pairsToObject
the list goes on :cry:
well viewer is for auth, intention is for permission
yay
Kyle Holm
@thekholm80
May 02 2018 02:55
i'd like to learn the correct way to handle all that someday, i just did the best i could figuring it out on my own
Claudio Restifo
@Marmiz
May 02 2018 02:56
@thekholm80 that was my senior in elixir. I know it works
  • all I know is that it works
Kyle Holm
@thekholm80
May 02 2018 03:00
lol
auth has been a nightmare to figure out
i'm sure i do it all wrong, but whatever. i'm never going to be an infosec expert
Claudio Restifo
@Marmiz
May 02 2018 03:13
btw @thekholm80 are you familiar with VSCode?
Kyle Holm
@thekholm80
May 02 2018 03:13
a bit, i'm doing my current project using vs code (first time)
and i've done 2 or 3 python projects in vs code, but it's a little different
Claudio Restifo
@Marmiz
May 02 2018 03:28

how the heck can I do a rearch/replace with confirm?
I saw ctrl f but then I have to manually click to confirm/goes to the next selection.

I miss good ol %s/find/replace/gc in vim

Kyle Holm
@thekholm80
May 02 2018 03:29
hmm
i've not dived that deep into it
have you tried the ctrl + shift + h?
Claudio Restifo
@Marmiz
May 02 2018 03:33
to be honest no, I should look into the config file :)
Nikoloz Asatiani
@nikoloz110
May 02 2018 06:38
hi guys, how do i see rooms i have hidden on gitter?
Namara
@Dauntay
May 02 2018 07:45
h
Ene Catalin
@EneCatalin
May 02 2018 07:51
@nikoloz110 you don't, they're hidden
Bashir Harrell
@bookofbash
May 02 2018 09:08
It hurts when even looking at the react documentation doesn't help
class MyForm extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      input: '',
      submit: ''
    };
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }
  handleChange(event) {
    this.setState({
      input: event.target.value
    });
  }
  handleSubmit(event) {
    // change code below this line
    this.setState({
      submit: this.state.value;
      event.preventDefault();
    })
    // change code above this line
  }
  render() {
    return (
      <div>
        <form onSubmit={this.handleSubmit}>
          { /* change code below this line */ }
          <input type='text' value={this.state.value} onChange = {this.handleChange} />
          { /* change code above this line */ }
          <button type='submit'>Submit!</button>
        </form>
        { /* change code below this line */ }
        <h1>{this.state.value}</h1>
        { /* change code above this line */ }
      </div>
    );
  }
};
React: Create a Controlled Form, from FCC Beta
I think something might be wrong with my handleSubmit
and my <h1>
Aditya
@ezioda004
May 02 2018 09:13
@bookofbash Why do you have event.preventDefault(); inside the setState()
Bashir Harrell
@bookofbash
May 02 2018 09:13
  handleSubmit(event) {
    alert('A name was submitted: ' + this.state.value);
    event.preventDefault();
  }
I was using this as a model but I cant see where it should be
this is from the react documentation ^
''
this.setState({
submit: this.state.value;},
event.preventDefault();
)
Aditya
@ezioda004
May 02 2018 09:15
Yes, but I dont see where it says event.preventDefault(); inside setState, setState should only update the state object, nothing more
Bashir Harrell
@bookofbash
May 02 2018 09:16
ok, I see it needs to be inside the submit handler not the setState
  handleSubmit(event) {
    // change code below this line
    this.setState({
      submit: this.state.value;
    })
      event.preventDefault();

    // change code above this line
  }
Aditya
@ezioda004
May 02 2018 09:17
Yep, does it work now?
Bashir Harrell
@bookofbash
May 02 2018 09:17
@ezioda004 No, it doesn't work
Norvin Burrus
@ndburrus
May 02 2018 09:18
@Marmiz these may be helpful: :sparkles:
Aditya
@ezioda004
May 02 2018 09:22
@bookofbash In handleSubmit() what is .value in this.state.value?
The state only have 2 properties, input and submit
Bashir Harrell
@bookofbash
May 02 2018 09:24
I thought it was the current input value
@ezioda004 "You should then complete the handleSubmit method so that it sets the component state property submit to the current input value in the local state."
Aditya
@ezioda004
May 02 2018 09:28
@bookofbash This is also a problem then <input type='text' value={this.state.value} onChange = {this.handleChange} />
The components state has 2 properties, input and submit, so whenever someone types in the <input> you need to update the given state ie
this.state = {
      input: '',
      submit: ''
    };
Since you already have input property in the state, dont you think you should be updating that?
Bashir Harrell
@bookofbash
May 02 2018 09:33
@ezioda004 Im not sure if I understand you. It seems that you are suggesting that I have: <input type='text' value={this.state.input} onChange = {this.handleChange} />
Aditya
@ezioda004
May 02 2018 09:35
Correct, I think you're getting confused with how data is flowing
I'll break it down. Say you enter something in the <input>, the onChange will trigger which will trigger the callback function this.handleChange which will update the state ie input
And since its a controlled form, you're also controlling the internal state of <input>
By doing value = {this.state.input}
Bashir Harrell
@bookofbash
May 02 2018 09:40
Yea, this is really confusing
Aditya
@ezioda004
May 02 2018 09:41
Now, you when the user clicks on the button, you want to display whatever you've stored in the state.input, so to do that when button is clicked, onSubmit triggers the callback function this.handleSubmit, now in this function you need to figure out how you can make the submit states property same as the updated input property
Bashir Harrell
@bookofbash
May 02 2018 09:42
so my handleSubmit should be this.state.submit
Aditya
@ezioda004
May 02 2018 09:42
Yes, it should update that
Also, in <h1> you need to render this submit, there is no .value
Bashir Harrell
@bookofbash
May 02 2018 09:43
and my h1 should also have {this.state.submit} is what I am gettomg
Aditya
@ezioda004
May 02 2018 09:43
Exactly!
Bashir Harrell
@bookofbash
May 02 2018 09:43
Wow, I feel like it is a bit more clear
Aditya
@ezioda004
May 02 2018 09:44
So whenever this.state.submit is updated, it'll automatically render the <h1>
Bashir Harrell
@bookofbash
May 02 2018 09:44
But I am still not able to solve this.
Aditya
@ezioda004
May 02 2018 09:44
Can you show your updated code?
Bashir Harrell
@bookofbash
May 02 2018 09:45
class MyForm extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      input: '',
      submit: ''
    };
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }
  handleChange(event) {
    this.setState({
      input: event.target.value
    });
  }
  handleSubmit(event) {
    // change code below this line
    this.setState({
      submit: this.state.submit;
    })
      event.preventDefault();

    // change code above this line
  }
  render() {
    return (
      <div>
        <form onSubmit={this.handleSubmit}>
          { /* change code below this line */ }
          <input type='text' value={this.state.input} onChange = {this.handleChange} />
          { /* change code above this line */ }
          <button type='submit'>Submit!</button>
        </form>
        { /* change code below this line */ }
        <h1>{this.state.submit}</h1>
        { /* change code above this line */ }
      </div>
    );
  }
};
Aditya
@ezioda004
May 02 2018 09:45
handleSubmit(event) {
    // change code below this line
    this.setState({
      submit: this.state.submit;
    })
You're updating submit with submit
We've only updated input in handleChange() so submit is still an empty string
Bashir Harrell
@bookofbash
May 02 2018 09:47
maybe i'm still not getting it. I changed it to this.state.input now
how do I type inline code by the way?
Aditya
@ezioda004
May 02 2018 09:48
Just ` code `
Bashir Harrell
@bookofbash
May 02 2018 09:49
this.state.input
Thanks
Aditya
@ezioda004
May 02 2018 09:49
Wait, I'll check your code
Oh woops, you have a semicolon in submit: this.state.input;
Since .setState() takes an object, having a semicolon is invalid syntax
Bashir Harrell
@bookofbash
May 02 2018 09:57
@ezioda004 And this is why people think coding is hard.
Wow, I would have never caught that by myself
Since .setState() takes an object. ok understood
@ezioda004 thank you
Aditya
@ezioda004
May 02 2018 09:58
Probably one of the only times where using a semicolon is bad in JS but yeah syntax matters, also check console when you get stuck, you usually get a hint as to where to look.
I'd also suggest doing this challenge again, so that you understand how data is flowing because its really important concept of React
Bashir Harrell
@bookofbash
May 02 2018 10:00
Oh wow, I always thought that the console wouldn't work in fcc program, but I opened it up and there was that error 1000 times
Thanks, I am going to do it again.
Aditya
@ezioda004
May 02 2018 10:01
Yeah, in case of React and since its beta theres bunch of errors and happy to help!
Yossi Fisch
@yoizfefisch
May 02 2018 11:08
Hello, is it OK to ask a question here regarding JS courses on MDN?
Daniel Simeonov
@dbsimeonov
May 02 2018 11:09
I guess you can ask anything you want :)
Yossi Fisch
@yoizfefisch
May 02 2018 11:15

I just finished this assessment and felt there is something wrong with the way the EvilCircle inherits from Shape.

function EvilCircle(x, y, exists) {
  Shape.call(this, x, y, exists);

  this.color = 'white';
  this.size = 10;
  this.velX = 20;
  this.velY = 20;
}

When this calls the Shape constructor, the 3'rd parameter that's expected there is velX rather than exists.

function Shape(x, y, velX, velY, exists)

Am I missing something here?

Here is the solution's source file:

I actually found this comment on their discussion board where someone seems to have the same question:
https://discourse.mozilla.org/t/adding-features-to-our-bouncing-balls-demo-assessment/24689/17
but nobody answered there.

In my own solution, I did it this way:

function EvilCircle(x, y, exists) {
  Shape.call(this, x, y, 20, 20, exists)
  this.color = 'white';
  this.size = 10;
}

Is anything wrong with this?

May Kittens Devour Your Soul
@diomed
May 02 2018 11:32
Yashwardhan Pauranik
@yashwp
May 02 2018 13:50
I've deployed my angular app over heroku... But when it is load I'm getting errors for the API calls...
says...
Mix Content error.. What does that mean...How do I fix it?
Kyle Holm
@thekholm80
May 02 2018 13:51
i'd guess that your heroku app is served over https but you're calling apis served over http
Yashwardhan Pauranik
@yashwp
May 02 2018 13:53
So I have to change my api path apiPath = 'http://gisapi-web-staging-1636833739.eu-west-1.elb.amazonaws.com/v2';
https
Kyle Holm
@thekholm80
May 02 2018 13:54
yes
Yashwardhan Pauranik
@yashwp
May 02 2018 13:54
Will that work?
Kyle Holm
@thekholm80
May 02 2018 13:54
if that api path supports https
Yashwardhan Pauranik
@yashwp
May 02 2018 13:55
and if not then ?
Kyle Holm
@thekholm80
May 02 2018 13:55
use a different api
Yashwardhan Pauranik
@yashwp
May 02 2018 13:55
I ve check it on postman
Aleksey
@AlekseyVY
May 02 2018 13:56
Guys I make backend for random quote machine to select and push quotes to htms it works locally, if I open index.html in my browser all working fine after I push it to github and try to open it in github pages it just do not work. here is link to project if any can help: https://github.com/AlekseyVY/Random_Quote_Machine
Yashwardhan Pauranik
@yashwp
May 02 2018 13:57
@thekholm80 I've been given a project...and I've to use their apis
Kyle Holm
@thekholm80
May 02 2018 13:57
oh okay
Yashwardhan Pauranik
@yashwp
May 02 2018 13:58
So how do I fix this... :/
Ive search a bit find this solution but...dont knw what will be my path
Fabien SHAN
@X140hu4
May 02 2018 14:32
@AlekseyVY github pages only supports static websites. You won't be able to run back end code.
nana9801
@nana9801
May 02 2018 14:42
Hello everyone, would anyone be able to help me on a java assignment? I need to figure out what is wrong so I can do javascript
roj basim
@rojbasim1_twitter
May 02 2018 15:19
Hello everyone, can someone pleae help me!!!! My pc chrome can't read HTML file that connect it to JavaScript file it just keep loading and than say page unresponsive please help😐
Ken Haduch
@khaduch
May 02 2018 15:30
@rojbasim1_twitter - have you tried opening the devtools for the browser and looking at the console output to see if there are messages, and if you have done that and don't understand what is happening, please post your code and your messages and someone can try to help.
roj basim
@rojbasim1_twitter
May 02 2018 15:34
@khaduch will if I
@khaduch if I disconnect js file from HTML file the HTML file work perfectly but if I connect js file to HTML file the page just keep loading and nothing shows
Christopher McCormack
@cmccormack
May 02 2018 15:53
@rojbasim1_twitter sounds like there is a bug in your javascript code, as @khaduch stated look in your browsers Developor Console to see if any errors appear when you load the JS
roj basim
@rojbasim1_twitter
May 02 2018 16:05
I swear I opened inspect and looked to the console there is no messages no error
Christopher McCormack
@cmccormack
May 02 2018 16:06
It's possible you have an infinite loop - can you share your code? If it's really long you can put it in a codepen or gist or something offsite
roj basim
@rojbasim1_twitter
May 02 2018 16:13
bandicam 2018-05-02 19-13-05-798.jpg
it's super simple
bandicam 2018-05-02 19-15-41-564.jpg
this is what I get!
Christopher McCormack
@cmccormack
May 02 2018 16:16
@rojbasim1_twitter don't redeclare input in your else if statement, instead move that entire line to the top of your while loop and just declare input with an empty string above your while loop
roj basim
@rojbasim1_twitter
May 02 2018 16:18
no this is not the only file other files also not working
Christopher McCormack
@cmccormack
May 02 2018 16:22
just an FYI having a prompt in a while loop like that is dangerous and will keep causing you issues, maybe instead create a function that calls your prompt when you click a button
roj basim
@rojbasim1_twitter
May 02 2018 16:23
the browser just don't read HTML file with JS file I don't know why
bandicam 2018-05-02 19-23-24-775.jpg
is not reading this
Christopher McCormack
@cmccormack
May 02 2018 16:27
Step it out - remove your while loop and see if you get the prompt and then the alert
prompts can load before the rest of the page loads, and may not display the rest of the html until the prompt is completed
roj basim
@rojbasim1_twitter
May 02 2018 16:33
@cmccormack will I did the prompt load before the rest of the page and then html shows and then disappear again I don't know why because before was working perfectly
Christopher McCormack
@cmccormack
May 02 2018 16:34
@rojbasim1_twitter keep playing with it. When you run into issues like this it can be good to comment out most of your code, test, see if it's working as expected, uncomment a bit of the commented code, test, repeat
test in pieces
roj basim
@rojbasim1_twitter
May 02 2018 16:41
ok thanks
May Kittens Devour Your Soul
@diomed
May 02 2018 17:54
🏵
YoungSee
@YoungSee
May 02 2018 20:05
code loop code
loop
YoungSee
@YoungSee
May 02 2018 20:12

Hello i'm trying to install RVM but i've encountered an error with a repository in my etc/apt/sources.list . When I run rvm install 2.3' it gives me this >Searching for binary rubies, this might take some time. No binary rubies available for: ubuntu/17.10/x86_64/ruby-2.3.4. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies. Checking requirements for ubuntu. Installing requirements for ubuntu. Updating systemThere has been an error while updating your system usingapt-get`.
It seems that there are some 404 Not Found errors for repositories listed in:

/etc/apt/sources.list
/etc/apt/sources.list.d/*.list

Make sure that all repositories are available from your system and verify your setup by running manually:

sudo apt-get update

Make sure that it works correctly before proceeding with RVM.

If you are working from the GUI instead of the terminal, you might want to verify and fix broken
repositories using "Software & Updates" application.

.........
Error running 'requirements_debian_update_system ruby-2.3.4',
please read /home/solohwancho/.rvm/log/1525291633_ruby-2.3.4/update_system.log
Requirements installation failed with status: 100.

so when I try sudo apt-get update | grep "Failed"

E: The repository 'cdrom://Ubuntu 17.10 Artful Aardvark - Release amd64 (20180105.1) artful Release' does not have a Release file.

it gives me this

how do I fix the repository so that I can finish installing RVM
?
YoungSee
@YoungSee
May 02 2018 20:23
nvm fixed it
Mehdi Amlal
@mehdiamlal
May 02 2018 20:59
Hello guys. How can I start contributing to open source projects?
Kyle Holm
@thekholm80
May 02 2018 21:00
go to github and look for open issues with Help Wanted tags
Norvin Burrus
@ndburrus
May 02 2018 21:10
mstellaluna
@mstellaluna
May 02 2018 23:13
@thekholm80 Thanks !!
CamperBot
@camperbot
May 02 2018 23:13
:star2: 1783 | @thekholm80 |http://www.freecodecamp.org/thekholm80
mstellaluna sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
mstellaluna
@mstellaluna
May 02 2018 23:13
He's slow but its working !
Kyle Holm
@thekholm80
May 02 2018 23:14
@mstellaluna you're a rockstar
the hero cbot needs
anthonygallina1
@anthonygallina1
May 02 2018 23:15
@mstellaluna WOW! thanks :)
CamperBot
@camperbot
May 02 2018 23:15
anthonygallina1 sends brownie points to @mstellaluna :sparkles: :thumbsup: :sparkles:
:cookie: 645 | @mstellaluna |http://www.freecodecamp.org/mstellaluna
mstellaluna
@mstellaluna
May 02 2018 23:16
Cbot is apprently, dont go crazy on it :)
CamperBot
@camperbot
May 02 2018 23:16
you called?
mstellaluna
@mstellaluna
May 02 2018 23:16
Ugh
Kyle Holm
@thekholm80
May 02 2018 23:17
lol
@mstellaluna thanks for getting it fixed
CamperBot
@camperbot
May 02 2018 23:17
thekholm80 sends brownie points to @mstellaluna :sparkles: :thumbsup: :sparkles:
:cookie: 646 | @mstellaluna |http://www.freecodecamp.org/mstellaluna
mstellaluna
@mstellaluna
May 02 2018 23:17
Bot apprently fragile so.. be easy on it
It wasnt me, i just opened the issue :)
Kyle Holm
@thekholm80
May 02 2018 23:18
if not for you, it would still be broke though - so you get the credit