These are chat archives for FreeCodeCamp/Help

19th
Jan 2018
Manish Giri
@Manish-Giri
Jan 19 2018 04:45
Any python people around?
Why is this syntax invalid -
  return "Match found" if list_found == i else "No match" for i in list_records
Kaz Baig
@kbaig
Jan 19 2018 05:37
@Manish-Giri isn't it this bit for i in list_records
Claudio Restifo
@Marmiz
Jan 19 2018 05:59
python
Manish Giri
@Manish-Giri
Jan 19 2018 05:59
@kbaig the single line for loop
can that only be with list comprehension?
@Marmiz :wave:
Kaz Baig
@kbaig
Jan 19 2018 06:26
as in there's nothing to do with the iteration? I could be wrong, haven't done Python stuff in years
Claudio Restifo
@Marmiz
Jan 19 2018 06:56
@Manish-Giri :wave:
VaseJS
@VaseJS
Jan 19 2018 07:00
@Manish-Giri @kbaig @Marmiz @bjorno43 @thekholm80 @diomed @Gersho @DarrenfJ Thanks. I just had a break thru moment! ITS ALL SOFTWARE!!! Everything else is just an adjective!
CamperBot
@camperbot
Jan 19 2018 07:00
vasejs sends brownie points to @manish-giri and @kbaig and @marmiz and @bjorno43 and @thekholm80 and @diomed and @gersho and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 6804 | @manish-giri |http://www.freecodecamp.org/manish-giri
:cookie: 202 | @bjorno43 |http://www.freecodecamp.org/bjorno43
:star2: 1669 | @thekholm80 |http://www.freecodecamp.org/thekholm80
:star2: 5299 | @diomed |http://www.freecodecamp.org/diomed
:cookie: 539 | @kbaig |http://www.freecodecamp.org/kbaig
:cookie: 590 | @gersho |http://www.freecodecamp.org/gersho
:star2: 2354 | @darrenfj |http://www.freecodecamp.org/darrenfj
:star2: 1129 | @marmiz |http://www.freecodecamp.org/marmiz
VaseJS
@VaseJS
Jan 19 2018 07:00
points for all. brownie points on me tonight :D
Olapri
@Olapri
Jan 19 2018 10:49
Hello! Pls help me - what is going on with id="camp" ? Why is it displayed so many times? :worried: https://codepen.io/ololpri/pen/PEGdXg
Naris R
@KittenHero
Jan 19 2018 10:53
that would be because you hard coded it in
Naris R
@KittenHero
Jan 19 2018 10:58
try changing the first getJSON to use the url you built instead of the fcc and change the content of the callback function
Eric Miller
@ericmiller777
Jan 19 2018 11:14
hello
Naris R
@KittenHero
Jan 19 2018 11:14
Hi
Eric Miller
@ericmiller777
Jan 19 2018 11:15
Trying to do the beta react tutorial
Naris R
@KittenHero
Jan 19 2018 11:15
haven't seen it
Eric Miller
@ericmiller777
Jan 19 2018 11:15
its hard to read it relly
ah
@KittenHero thanks anyway
CamperBot
@camperbot
Jan 19 2018 11:16
ericmiller777 sends brownie points to @kittenhero :sparkles: :thumbsup: :sparkles:
:cookie: 126 | @kittenhero |http://www.freecodecamp.org/kittenhero
Naris R
@KittenHero
Jan 19 2018 11:16
I can probably help, what's the problem?
Eric Miller
@ericmiller777
Jan 19 2018 11:17
challenge to make a text box change a <p> as you type

class ControlledInput extends React.Component {
constructor(props) {
super(props);
this.state = {
input: {event.target.value}
};
this.handleChange = this.handleChange.bind(this);
}
// change code below this line
handleChange(event){

};
// change code above this line
render() {
return (
<div>
{ / change code below this line /}
<input type="text" value={this.state.input} onChange={this.handleChange()}></input>
{ / change code above this line /}
<h4>Controlled Input:</h4>
<p>{this.state.input}</p>
</div>
);
}
};

sorry i dont remember how to make it to code
the input was originally just ""
''
Naris R
@KittenHero
Jan 19 2018 11:19
markdown code formatting is ```
that sounds easy enough
Eric Miller
@ericmiller777
Jan 19 2018 11:19
i wouldnt messw ith things obove the line, but i have run ito a few where it was necessary but, i checked the forum and ppl also said was necessary
does it look like im doing it right at all?
Naris R
@KittenHero
Jan 19 2018 11:22
yea, that looks pretty good
you don't have to bind the handleChange function if you do onChange={() => this.handleChange()}
because arrow functions keeps this bound to the context that it was created
depends on your preference i guess
Eric Miller
@ericmiller777
Jan 19 2018 11:25
I try to avoid ES6 because I suck at it, should probably start using it more
Stephen James
@sjames1958gm
Jan 19 2018 11:25
@ericmiller777 You haven't implemented anything in the handleChange(event) function
Abed El-Rahman
@Abedqaddoura
Jan 19 2018 11:25

how can i fixe this "Your a element should be a dead link with a href attribute set to #" <p>Click here for <a href="#">cat photos</a>.</p>

<a herf="#">
<img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back. ">
</a>

Eric Miller
@ericmiller777
Jan 19 2018 11:26
@sjames1958gm have you seen the challenge i cant really understand what its asking me to do?
Abed El-Rahman
@Abedqaddoura
Jan 19 2018 11:26
ok
Eric Miller
@ericmiller777
Jan 19 2018 11:26
First, create a method called handleChange() that has a parameter called event. When the method is called, it receives an event object that contains a string of text from the input element. You can access this string with event.target.value inside the method. Update the input property of the component's state with this new string.
Stephen James
@sjames1958gm
Jan 19 2018 11:26
@ericmiller777 I think it wants you to update the state (this.setState())when you get the onChange event.
Eric Miller
@ericmiller777
Jan 19 2018 11:26
@Abedqaddoura its href not herf?
Abed El-Rahman
@Abedqaddoura
Jan 19 2018 11:27
ooooh thank you
Eric Miller
@ericmiller777
Jan 19 2018 11:27
@Abedqaddoura happens to everyone
Stephen James
@sjames1958gm
Jan 19 2018 11:28
@ericmiller777 - the function/method is there, you need to add the code.
// change code below this line
handleChange(event){

};
// change code above this line
Abed El-Rahman
@Abedqaddoura
Jan 19 2018 11:28
@ericmiller777 thanks man
Eric Miller
@ericmiller777
Jan 19 2018 11:28
@sjames1958gm >.>;
CamperBot
@camperbot
Jan 19 2018 11:28
abedqaddoura sends brownie points to @ericmiller777 :sparkles: :thumbsup: :sparkles:
:cookie: 322 | @ericmiller777 |http://www.freecodecamp.org/ericmiller777
Eric Miller
@ericmiller777
Jan 19 2018 11:29
@sjames1958gm what would i set it to the text of the input field?
@sjames1958gm and without actully messing with the dom (like a name) im not sure what to do
Stephen James
@sjames1958gm
Jan 19 2018 11:30
@ericmiller777 event.target.value this value is the new text from the user's input - use this.setState to set the new state
Eric Miller
@ericmiller777
Jan 19 2018 11:31
okay i can make it this.setState({input: event.target.value});
but
err
fixed kinda
but then
Naris R
@KittenHero
Jan 19 2018 11:31
yea?
Eric Miller
@ericmiller777
Jan 19 2018 11:31
how do i connect event and th actual input
Stephen James
@sjames1958gm
Jan 19 2018 11:33
@ericmiller777
<input type="text" value={this.state.input} onChange={this.handleChange()}></input>
onChange is expecting a function reference, but you are calling the function (remove the () )
levani
@levanijincharadze
Jan 19 2018 11:35
hello guys
Stephen James
@sjames1958gm
Jan 19 2018 11:35
<input type="text" value={this.state.input} onChange={this.handleChange}></input>
this code is saying - input tag get your value from this.state.input, and when the user changes the input call this.handleChange with the change event
@levanijincharadze Hey
Eric Miller
@ericmiller777
Jan 19 2018 11:36
@sjames1958gm @KittenHero thanks
CamperBot
@camperbot
Jan 19 2018 11:36
ericmiller777 sends brownie points to @sjames1958gm and @kittenhero :sparkles: :thumbsup: :sparkles:
api offline
:star2: 8869 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Naris R
@KittenHero
Jan 19 2018 11:37
I guess you passed :+1:
Eric Miller
@ericmiller777
Jan 19 2018 11:37
handleChange(event){
this.setState({input: event.target.value})
};
what does the event param do?
Naris R
@KittenHero
Jan 19 2018 11:38
it holds information about whatever event you listen to
Eric Miller
@ericmiller777
Jan 19 2018 11:38
i see I notice it doesnt have to be event specifically
Stephen James
@sjames1958gm
Jan 19 2018 11:38
@ericmiller777 The event parameter holds the information about the event, for example the event.target (which element had the event happen to it)
No, that is your choice of name
Naris R
@KittenHero
Jan 19 2018 11:39
well you can name it whatever you want
Eric Miller
@ericmiller777
Jan 19 2018 11:39
how do you know wha information is stored?
Stephen James
@sjames1958gm
Jan 19 2018 11:39
@ericmiller777 You'd have to go to the React docs and look for onChange event
Naris R
@KittenHero
Jan 19 2018 11:39
you'd have to look at React docs
Eric Miller
@ericmiller777
Jan 19 2018 11:39
@sjames1958gm @KittenHero thanks
CamperBot
@camperbot
Jan 19 2018 11:39
api offline
api offline
ericmiller777 sends brownie points to @sjames1958gm and @kittenhero :sparkles: :thumbsup: :sparkles:
Naris R
@KittenHero
Jan 19 2018 11:40
but I'm pretty sure all react events have a reference to the corresponding native event
Eric Miller
@ericmiller777
Jan 19 2018 11:40
@sjames1958gm thanks
CamperBot
@camperbot
Jan 19 2018 11:40
ericmiller777 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
api offline
Eric Miller
@ericmiller777
Jan 19 2018 11:40
:/
Naris R
@KittenHero
Jan 19 2018 11:40
Haha camperbot is overloaded
Stephen James
@sjames1958gm
Jan 19 2018 11:41
api offline just means you said thanks more than once in a short time
Eric Miller
@ericmiller777
Jan 19 2018 11:41
@sjames1958gm dont think you got any points
Naris R
@KittenHero
Jan 19 2018 11:42
Points don't matter anyway
Muhammed Hafiz
@zifahm
Jan 19 2018 11:56
@zifahm
is there anyway in setState that i can only update one object in an object eg:
state={ name:{first:"asdf", last:"asdf"}
setState={ name.first:"asdfa"} and not update the last name ?
i know this wont work makes the last name taken out of the object
Stephen James
@sjames1958gm
Jan 19 2018 12:01
@zifahm Something like this
this.setState = { name: {...this.state.name, first: "newfirst"}}
Muhammed Hafiz
@zifahm
Jan 19 2018 12:02
@sjames1958gm wonderful thanks man again
CamperBot
@camperbot
Jan 19 2018 12:02
zifahm sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8870 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Jan 19 2018 12:06
@zifahm :+1:
Julian
@Julian0925
Jan 19 2018 14:12
Why doesn't jQuery work in codepen?
Kyle Holm
@thekholm80
Jan 19 2018 14:34
@Julian0925 jQuery works fine in codepen, you just have to link in the library. Settings => Javascript => Quick Add => jQuery
@thekholm80 morning :wave:
Kyle Holm
@thekholm80
Jan 19 2018 14:42
@GitHub-Henry Hi Henry
happy Friday
Henry
@GitHub-Henry
Jan 19 2018 14:43
yeah, tgif
quick week, flew by
Kyle Holm
@thekholm80
Jan 19 2018 14:43
Mine too
which is weird, because I think this is the first 5 day week I've worked this year
maybe I'll take the afternoon off to compensate
Henry
@GitHub-Henry
Jan 19 2018 14:45
busy weeks will do that to you
gotta go, talk to you later
Kyle Holm
@thekholm80
Jan 19 2018 14:46
@GitHub-Henry :wave: have a good day
Henry
@GitHub-Henry
Jan 19 2018 14:46
you to
Daniel
@dkapexhiu
Jan 19 2018 14:46
hi! someone can help me what's wrong with this code for google maps api?
https://codepen.io/dkapexhiu/pen/WdJGXg
Fabien SHAN
@X140hu4
Jan 19 2018 15:07
@dkapexhiu What do you expect it to do?
Xapuu
@Xapuu
Jan 19 2018 15:13
Hello guys i have the followin trouble => I have some focus/focusout logic and the focusout is triggered without clicking outside of the element which holds the focusout event, any ideas?
Gersho
@Gersho
Jan 19 2018 15:37
hi everyone :wave:
Kaz Baig
@kbaig
Jan 19 2018 15:38
:wave:
Gersho
@Gersho
Jan 19 2018 15:38

happy Friday

every heard of pushing to prod a friday ?

Kaz Baig
@kbaig
Jan 19 2018 15:38
For the sake of sanity, let's pretend we haven't
Daniel
@dkapexhiu
Jan 19 2018 15:39
hi @X140hu4 i wanted to display the longitude and latitude of marker and i resolved it. thank you
CamperBot
@camperbot
Jan 19 2018 15:39
:cookie: 316 | @x140hu4 |http://www.freecodecamp.org/x140hu4
dkapexhiu sends brownie points to @x140hu4 :sparkles: :thumbsup: :sparkles:
Gersho
@Gersho
Jan 19 2018 15:39

For the sake of sanity, let's pretend we haven't

if you deploy your project on friday and it doesn't work, you can kiss your weekend goodbya

Kyle Holm
@thekholm80
Jan 19 2018 15:56
@Gersho @kbaig :wave:
@Gersho the important thing to remember is to push before you leave then turn your phone off
Gersho
@Gersho
Jan 19 2018 15:57
lol
it's more of a "live push to prod" it's that karaoke on LAN thing i made in django, i'm trying V2 tonight
Kyle Holm
@thekholm80
Jan 19 2018 16:00
oh very cool
Gersho
@Gersho
Jan 19 2018 16:00
oh and i'm home, and since of course there HAD to be something, half of the flat's power grid is down because reasons?? the electritian is supposed to show up today
Skylar
@skyboy1997
Jan 19 2018 16:41
Does anybody know how one would but this into a PSQL table?
var id = 'skylar'; //A variable to store the id value.Used in search and update
app.post('/clicked', (req, res) => {
db.one('UPDATE clicks SET click = click+1 WHERE myId=$1 returning *',id)
.then(function (data) {
    res.send(data.clicks);
})
.catch(function (error) {
    return error;
  });
});
app.get('/clicks', (req, res) => {
db.one('SELECT * FROM clicks WHERE myId = $1', id)
.then(function (data) {
    res.send(data.clicks);
})
.catch(function (error) {
    return error;
  })
});
duwei9918
@duwei9918
Jan 19 2018 16:41

<h1>Hello World</h1>

<h2>我家的猫咪</h2>

<P>Hello Pargraph</p>

</p> no run tests
wtf
Gersho
@Gersho
Jan 19 2018 16:46
<P> -> <p>
Kelechi Chinaka
@ke1echi
Jan 19 2018 16:50
hey man hows it going? @Gersho
Gersho
@Gersho
Jan 19 2018 16:50
:wave: well my day is a bit crappy but it could be worse xD
Kelechi Chinaka
@ke1echi
Jan 19 2018 16:50
lol
hows your edx course going? @Gersho
Gersho
@Gersho
Jan 19 2018 16:57
was kinda busy so i didn't work on it, and got stuff to do today too
i only came to commit something quick to get the green square :P
Kelechi Chinaka
@ke1echi
Jan 19 2018 16:59
:smile:
Gersho
@Gersho
Jan 19 2018 17:00
i upload one project a day, but i'll run out soon :(
Kelechi Chinaka
@ke1echi
Jan 19 2018 17:01
i really need to get started on that
project? how?
u mean code snippets? @Gersho
Gersho
@Gersho
Jan 19 2018 17:03
all the stuff fCC makes you do
simon, pomodoro, etc... check my page you'll see
Kelechi Chinaka
@ke1echi
Jan 19 2018 17:04
o cool...link @Gersho
Gersho
@Gersho
Jan 19 2018 17:05
mouse over my avatar and click open profile
artbohr
@artbohr
Jan 19 2018 17:30
heys guys, can you try my url shortener project? https://url-shortener-mserv.glitch.me/
gishy1
@gishy1
Jan 19 2018 17:33
happy new year guys!!!!
been off for awhile
need help
artbohr
@artbohr
Jan 19 2018 17:33
@gishy1 happy new year
gishy1
@gishy1
Jan 19 2018 17:33
how do i check for a boolean
Alexander Køpke
@alexanderkopke
Jan 19 2018 17:33
@artbohr seems to work as expected. Good work!
artbohr
@artbohr
Jan 19 2018 17:34
@gishy1 what do u mean exactly?
@alexanderkopke thanks for checking it out, nice ^^
CamperBot
@camperbot
Jan 19 2018 17:34
artbohr sends brownie points to @alexanderkopke :sparkles: :thumbsup: :sparkles:
:star2: 1771 | @alexanderkopke |http://www.freecodecamp.org/alexanderkopke
gishy1
@gishy1
Jan 19 2018 17:34
im trying to test if a value is truthy or falsy
so like lest say the number 1
how would i test it using boolean
Alexander Køpke
@alexanderkopke
Jan 19 2018 17:35
@gishy1 you can use Boolean(thing to test here);
artbohr
@artbohr
Jan 19 2018 17:35
@gishy1 if (value) do something does something if the value is true
gishy1
@gishy1
Jan 19 2018 17:36

function bouncer(arr) {
}
  Boolean(0);

bouncer([7, "ate", "", false, 9]);
for example how do i check if 0 is truthy or falsy
i-ts not giving me a result
Alexander Køpke
@alexanderkopke
Jan 19 2018 17:38
Sounds like a task for the filter function
gishy1
@gishy1
Jan 19 2018 17:39
yes i will use the filter eventuAally but im trying to sort it out step by step
Alexander Køpke
@alexanderkopke
Jan 19 2018 17:40
callback
Function is a predicate, to test each element of the array. Return true to keep the element, false otherwise, taking three arguments:
what is true is kept what is false will be discarded. So you can use filter to find the truthies.
Gersho
@Gersho
Jan 19 2018 17:43

yes i will use the filter eventuAally but im trying to sort it out step by step

well, in a way you could say filter is the first step

gishy1
@gishy1
Jan 19 2018 17:49
hmmm im even more confused
Alexander Køpke
@alexanderkopke
Jan 19 2018 17:51
ok you don't have to use filter. You can use a for loop and check for truthy and push to a new array those that are truthy
// pseudo ish code 
var newArr =[];
for loop {
if (arr[i]) newArr.push(arr[i])
}
Henry
@GitHub-Henry
Jan 19 2018 18:07
@alexanderkopke but filter does iteration and checks for truthy
Alexander Køpke
@alexanderkopke
Jan 19 2018 18:07
@GitHub-Henry yup it does
Henry
@GitHub-Henry
Jan 19 2018 18:07
fewer lines of code
Alexander Køpke
@alexanderkopke
Jan 19 2018 18:07
one line
Tim Parsons
@timmparsons
Jan 19 2018 22:36

The arrow functions in FCC beta are getting me everytime. Can anyone help with ES6: Write Higher Order Arrow Functions?

This is what i have:
const squaredIntegers = realNumberArray.filter((arr) { if(realNumberArray[i] % 1) return true;

I was just trying to see if it would show up in the console and see if i'm on the right track
Kyle Holm
@thekholm80
Jan 19 2018 23:31
@timmparsons
function (arg) {
  return  arg;
}
// same as
arg => {
  return arg;
}
// also same as
arg => arg;