These are chat archives for FreeCodeCamp/Help

5th
Mar 2018
Claudio Restifo
@Marmiz
Mar 05 2018 03:01
:wave: @Manish-Giri , have you solved the 123 java problem?
mstellaluna
@mstellaluna
Mar 05 2018 04:59
Hello. Please be aware FreeCodeCamp.org is experiencing intermittent connectivity issues. This is due to issues at Digital Ocean. We are currently aware of the issue and actively monitoring it. Thanks ! Happy Coding !
Greg Gordon
@greggordoncode_twitter
Mar 05 2018 06:24
https://s.codepen.io/papageg/debug/yvGYQM/GnrnbVRPKRar#aboutpage why when you click on the about tab on nav bar does it take the about and hide it behind nav bar but not when you have the page loaded up.
Adegoke Fred
@Frediflexta
Mar 05 2018 06:38
Hi guys, good mornig, from over here. please i need some help figuring out a logic
i am trying to writing a sorting algorithm that sorts odd numbers before even numbers and then checks if isNaN(and if it is, it should discard it from the array)
Claudio Restifo
@Marmiz
Mar 05 2018 07:00
@Frediflexta you can do it either combining two methods: sort and then filter or in one go using a reducer function
Adegoke Fred
@Frediflexta
Mar 05 2018 07:05
Okay... would look it up
Adegoke Fred
@Frediflexta
Mar 05 2018 09:28
Hi guys...
so i tried implementing the sort, using an insertion sort alogorithm
it works alright, but i want to include some special cases where it checks and sorts odd numbers before even numbers and then checks if isNaN(and if it is, it should discard it from the array)
Any ideas pleaase?
Alsalman78
@Alsalman78
Mar 05 2018 12:44
hi
Stephen James
@sjames1958gm
Mar 05 2018 13:02
@Alsalman78 :wave:
HC
@HEC309
Mar 05 2018 14:36
50%border-radius?
Daniel
@dkapexhiu
Mar 05 2018 14:47
the code for adding reviews is on line 100
Stephen James
@sjames1958gm
Mar 05 2018 15:03
@dkapexhiu try passing value into the function - maybe self.restaurant.operating_hours isn't set?
Daniel
@dkapexhiu
Mar 05 2018 15:06
that is set into a json file.. i want to add new reviews on clicking the button and compiling the form..
Stephen James
@sjames1958gm
Mar 05 2018 15:09
@dkapexhiu The only thing I saw was the value not being set - I would add console.log statements to determine if that value is not set.
@dkapexhiu Since you have the value, seems more explicit to pass it in.
Daniel
@dkapexhiu
Mar 05 2018 15:17
yes, ok but when i add a review and click ok it refreshes the page.. how can i prevent this?
Kaz Baig
@kbaig
Mar 05 2018 15:41
:wave: long time
Stephen James
@sjames1958gm
Mar 05 2018 15:45
@dkapexhiu Make sure that if you have a form that you prevent the default action of refresh
Kaushik
@kilobytecosec
Mar 05 2018 15:45
Hi guys ! I have a question on docker, anybody can help ?
knight2
@knight2
Mar 05 2018 15:45
just posted this in frontend but asking for help here too
Does anyone know how to make css keyframe animation's to work with react rendering components?
I tried using ReactCSSTransitionGroup from react but it doesn't appear to be working anymore
Then I tried just using regular keyframes for animation, it only works on my first load, and not for subsequent changes of the react components
css for fadein animation

@-webkit-keyframes fadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@-moz-keyframes fadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@-o-keyframes fadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes fadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

.fadeIn {
  opacity: 0;
  animation-name: fadeIn;
  animation-duration: 2s;
  animation-fill-mode: forwards;
}
knight2
@knight2
Mar 05 2018 15:46
and for react render in js i have

  render(){
    return(

      <div id="quote-box" className="container-fluid row">

        <div className="fadeIn" id="text">
          <p>{this.state.quote}</p>
        </div>

        <div className="fadeIn" id="author">
          <p>{this.state.author}</p>
        </div>

        <div className="buttons">
        <button className="button" onClick={this.getQuote} id="new-quote">New Quote!</button> <br />

        <a className="button" title="Tweet!" className="fa fa-twitter fa-lg" href="#" onClick={this.tweetQuote} id="tweet-quote"></a>
        </div>
      </div>
    );
  };
};
On first load, the webpage properly uses the keyframe animation, however if the user clicks the get new quote button, which changes the state of the component, and loads new text, the new text does NOT play the animation. I am not sure why this is the case?
What do I need to do to ensure all changes to the state of the component that are specified to play the animation on render?
Darren
@DarrenfJ
Mar 05 2018 16:13
morning fCC
Kyle Holm
@thekholm80
Mar 05 2018 16:18
@DarrenfJ :wave:
Darren
@DarrenfJ
Mar 05 2018 16:19
@thekholm80 hye buddy.. haven't caught you on here in a bit..
what's up in your world?
Kyle Holm
@thekholm80
Mar 05 2018 16:20
nothing really exciting, been sick :(
how's life for you?
Sweet Coding :)
@SweetCodingInc
Mar 05 2018 16:33
@thekholm80 Ser Kyle :wave:
@DarrenfJ Ser Darren :wave:
Kyle Holm
@thekholm80
Mar 05 2018 16:36
@SweetCodingInc hiya
Sweet Coding :)
@SweetCodingInc
Mar 05 2018 16:38
@thekholm80 New developments.. I made it to the final rounds of the interview...
Wednesday is the D-Day - whether I am to invade Germany or not lol :P
Darren
@DarrenfJ
Mar 05 2018 16:38
@SweetCodingInc congrats!
Kyle Holm
@thekholm80
Mar 05 2018 16:38
@SweetCodingInc very cool, hope it works out for you
Sweet Coding :)
@SweetCodingInc
Mar 05 2018 16:38
Yo!
Darren
@DarrenfJ
Mar 05 2018 16:39
@thekholm80 I've been focusing on the CSS but lately been watching security vids... gonna hafta figure out blockchain eventually... relearning crypotography.. that kind of thing
and just for shits and giggles decided to reedo the python course on codecademy since they revamped it a while back and i've done no python since then
Kyle Holm
@thekholm80
Mar 05 2018 16:40
sounds like a lot to digest
Darren
@DarrenfJ
Mar 05 2018 16:40
so much for focusssing on CSS ;)
too many things to learn!!
Ken Haduch
@khaduch
Mar 05 2018 17:11
@DarrenfJ - hey there - you are correct about too many things to learn!!! - I spent a couple hours reading interesting articles about functional programming - one article and a second article - still reading, but it's interesting stuff!
hi @thekholm80 @SweetCodingInc and everyone else out there...
Kyle Holm
@thekholm80
Mar 05 2018 17:12
@khaduch :wave:
Darren
@DarrenfJ
Mar 05 2018 17:17
ooo thanks @khaduch for links :D
CamperBot
@camperbot
Mar 05 2018 17:17
darrenfj sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3776 | @khaduch |http://www.freecodecamp.org/khaduch
Ken Haduch
@khaduch
Mar 05 2018 17:19
@DarrenfJ - yeah, just more stuff to learn, but people ask about functional programming now and then - just trying to get a little better handle on it because I keep dabbling in the learning / articles about it. That opensource.com article seemed to be rather interesting!
Darren
@DarrenfJ
Mar 05 2018 17:24
it's one of my next things.. was actually debating python vs deep diving into functional js
Kyle Holm
@thekholm80
Mar 05 2018 17:24
por que no los dos?
Darren
@DarrenfJ
Mar 05 2018 17:25
side note: really loving the scrimba vids.. the tool is pretty fun to use.. watch a vid, then code in the vid!!!
plus CS variables are pretty cool
@thekholm80 welp, i'm redelving into sql, deep diving into CSS, reviewing python and watching treehouse vids on security..
4 things is pretty good ;)
Kyle Holm
@thekholm80
Mar 05 2018 17:26
:)
Darren
@DarrenfJ
Mar 05 2018 17:27
5, even though wafer thin.. is just too much :P
scrimbas got one on grid, and flexbox too i wanna check out.. but i love the tool.. something new and shiney.. check it out
Mukesh Kumar Angrish
@MukeshAngrish
Mar 05 2018 17:47
Hey everyone, the ingredients in my Recipe Box app are not showing (or rendering, maybe). Can someone look into it and help me.😁
Christopher McCormack
@cmccormack
Mar 05 2018 18:06
@MukeshAngrish your ingredients variable is all undefined
Add this to your Recipe render - console.log(ingredients)
@MukeshAngrish either add a return in your map or change the curly braces to parenthesis
artbohr
@artbohr
Mar 05 2018 18:49
why after setting the new state through (this.setState) my component is not rerendering?

import React from 'react';
import {Pie} from 'react-chartjs-2';

class ShowForm extends React.Component {
  constructor (props) {
    super(props)
    this.state = {
       votingOption: 0,
       addOptions: ""
     };
  }
  submitVote = (e) => {
    e.preventDefault();

    const url = `${this.props.url}${this.props.pollId}`;

    fetch(url, {
      method: 'POST',
      body: JSON.stringify({'voteOn' : this.state.votingOption }),
      headers: new Headers({
        'Content-Type': 'application/json'
      })
    }).then(res => alert("Thanks for voting!"))
    .catch(error => console.error('Error:', error));
  }

  deletePoll = (e) => {
    e.preventDefault();

    const url = `${this.props.url}${this.props.pollId}`;

    fetch(url, {
      method: 'DELETE',
      body: JSON.stringify({}),
      headers: new Headers({
        'Content-Type': 'application/json'
      })
    }).then(res => alert("Poll deleted!"))
    .catch(error => console.error('Error:', error));
  }

  addOptions = (e) => {
    e.preventDefault();

    const url = `${this.props.url}${this.props.pollId}`;
    const optionsArr = JSON.parse(JSON.stringify(this.props.pollOptions));
    optionsArr.push(this.state.addOptions);

    this.setState({addOptions: ""})

    fetch(url, {
      method: 'PUT',
      body: JSON.stringify({"options" : optionsArr}),
      headers: new Headers({
        'Content-Type': 'application/json'
      })
    }).then(res => alert("Option Added!"))
    .catch(error => console.error('Error:', error));
  }

  render() {
    const colors = ['#FF6384', '#36A2EB', '#FFCE56', '#F19CBB', '#D1001C', '#7F3E98', '#4682BF', '#D2691E']

    const data = {
      labels: this.props.pollOptions.map(d => d),
      datasets: [
        {
          data: this.props.pollVotes,
          backgroundColor: colors,
          hoverBackgroundColor: colors
        }
      ]
    };

    return (<div className="panel panel-default">
      <div className="panel-heading">
        {this.props.pollName}
        <button type="button" className="close" onClick={this.deletePoll}>
          <span aria-hidden="true">Delete</span>
        </button>
      </div>
      <div className="panel-body">
        <form>
          <div className="row form-group">
            <div className="col-sm-5">
              <label>Select Option</label>
              <select className="form-control" onChange={e => this.setState({ votingOption: e.target.value })}>
                {this.props.pollOptions.map((option, i) => <option key={option} value={i}>{option}</option>)}
              </select>
              <br/>
              <button onClick={this.submitVote} className='btn btn-block btn-primary center-block'>Vote</button>

              <div style={{display:'flex'}}>
                <input style={{marginTop:'15px'}} onChange={e => this.setState({ addOptions: e.target.value })} placeholder='Add another option' className='form-control'/> <br />
                <button style={{margin:'15px'}} className="btn btn-primary" onClick={this.addOptions}>Add</button>
              </div>

            </div>
            <div className="col-sm-5">
              <Pie data={data} width={20} height={5} /*options={{maintainAspectRatio: false}}*//>
            </div>
          </div>
        </form>
      </div>
    </div>)
  }
}

export default ShowForm;
all works as intended, but rerenderes does not happen in any case
Konrad Szerszen
@konradcodes
Mar 05 2018 19:22
hi guys i deleted my account and created a new one and linked to my github but all the lessons they are not marked as complete but the code is complete anyone ?
__mifflin__
@cdrainxv
Mar 05 2018 19:35
@Koko7798: Clear your local storage.
Aditya
@ezioda004
Mar 05 2018 19:36
@Koko7798 Hey, if you made a new account then the account progress starts from the beginning
Konrad Szerszen
@konradcodes
Mar 05 2018 19:36
@ezioda004 it didnt for me bro
@ezioda004 only the completed green circle is off
but the lessons that i completed before are already finished like i just need to press completed
Aditya
@ezioda004
Mar 05 2018 19:37
@Koko7798 Thats because the solution is also stored locally, so you should clear your browser cache if you want to delete them locally
Mukesh Kumar Angrish
@MukeshAngrish
Mar 05 2018 19:45
@cmccormack I added a return, but it still doesn't render the ingredients
Christopher McCormack
@cmccormack
Mar 05 2018 20:04
It does @MukeshAngrish but you have them in a collapse that's hiding it
Ken Haduch
@khaduch
Mar 05 2018 20:20
@MukeshAngrish - another thing that might be a problem (at least it's illegal HTML) is that you appear to be using the same ID value for multiple elements in the ingredients. It might cause a problem somewhere if you are using the ID for some DOM accesses...
Daniel
@dkapexhiu
Mar 05 2018 20:20
Hello! this codepen is not working for saving new pushing new objects into reviews array:
https://codepen.io/dkapexhiu/pen/paXgyB
Ken Haduch
@khaduch
Mar 05 2018 20:24
@dkapexhiu - you have some variable nreviews that doesn't seem to be defined - and it is used in a few places?
Ken Haduch
@khaduch
Mar 05 2018 20:29
@dkapexhiu - if you define a variable var nreviews = []; it starts to work - it will at least display the labels with names values of "undefined"... but it adds a new entry after Add button.
Daniel
@dkapexhiu
Mar 05 2018 20:30
ok thank you @khaduch for pointing it out .. exactly it add a new entry but all undefined
CamperBot
@camperbot
Mar 05 2018 20:30
dkapexhiu sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3777 | @khaduch |http://www.freecodecamp.org/khaduch
Daniel
@dkapexhiu
Mar 05 2018 20:30
what it might be?
Ken Haduch
@khaduch
Mar 05 2018 20:33
@dkapexhiu - looking at it a little more.
Ken Haduch
@khaduch
Mar 05 2018 20:39
@dkapexhiu - it looks like the way you are trying to use this in your function describe is not working. I think that if you pass the review that you are processing into the function, and use that parameter to access the various review properties, you can get the data. The data seems to be getting stored into the nreviews array, just not being pulled out.
Daniel
@dkapexhiu
Mar 05 2018 20:42
so, how can that be done in code? what can i do?
Ken Haduch
@khaduch
Mar 05 2018 20:51

@dkapexhiu - the basic idea would be in the place where you are trying to display the data, within the showData() function - do something like this:

function showData() {
  debugger;
  var tmp = "<ul>";
  nreviews.forEach(function(review) {
    tmp += "<li>" + reviews.describe(review) + "</li>";
  });
  _("reviews").innerHTML = tmp + "</ul>";
}

Just passing the current review variable to your describe method. And change the describe method to look like this:

  describe: function(rev) {
    var description =
      "Name:" +
      rev.name +
      "<br>" +
      "Date:" +
      rev.date +
      "<br>" +
      "Comment:" +
      rev.comment;
    return description;
  }

using a function argument rev (or a name of your choice) and then using that to access the variable properties of your description. It's really rough-looking, some output styling should be done, but it gets the information onto the screen...

Zentriks
@Zentriks
Mar 05 2018 21:18
Good Evening
I am making Movie Search Website that recommends you what Movie to watch. My question is do i need strong javascript and php to make it work good?
It's like movie search engine
Daniel
@dkapexhiu
Mar 05 2018 21:23
thank you very much @khaduch very good explanation of it
CamperBot
@camperbot
Mar 05 2018 21:23
dkapexhiu sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
api offline
Daniel
@dkapexhiu
Mar 05 2018 21:27
where did you learn that? giving a parameter to describe function?
Stephen James
@sjames1958gm
Mar 05 2018 21:40
@Zentriks to make it active and modern you will need strong
JavaScript
Kyle Holm
@thekholm80
Mar 05 2018 21:40
lol
Stephen James
@sjames1958gm
Mar 05 2018 21:41
Darn ipad auto correct :)
Kyle Holm
@thekholm80
Mar 05 2018 21:42
i wish i had good reasons for that happening to me, i'm just a crappy typist