These are chat archives for FreeCodeCamp/Help

14th
Feb 2018
Tom
@moT01
Feb 14 2018 00:03
@thekholm80 :thumbsup:
Kyle Holm
@thekholm80
Feb 14 2018 00:03
@moT01 hey buddy! long time no see
Tom
@moT01
Feb 14 2018 00:06
im around - lingering
Kyle Holm
@thekholm80
Feb 14 2018 00:06
i don't make it to the back end room much anymore
Tom
@moT01
Feb 14 2018 00:06
chat rooms are gettin pretty quiet and not many people to help
artbohr
@artbohr
Feb 14 2018 00:07
@thekholm80 lol, the funny thing is to use react-router with react-bootstrap you need react-router-bootstrap x)
Kyle Holm
@thekholm80
Feb 14 2018 00:07
@artbohr ugh lol
artbohr
@artbohr
Feb 14 2018 00:07
@thekholm80 this dependencies hell, omg :D
Kyle Holm
@thekholm80
Feb 14 2018 00:08
just learn a bit of css and ditch bootstrap lol
Tom
@moT01
Feb 14 2018 00:09
yea, i never got far into bootstrap
Claudio Restifo
@Marmiz
Feb 14 2018 02:17
:wave: :wave:
Gersho
@Gersho
Feb 14 2018 02:18
:wave:
Claudio Restifo
@Marmiz
Feb 14 2018 03:12
Anyone here tried integrating TS or Flux into React? :)
Gersho
@Gersho
Feb 14 2018 03:16
haven't touched react in a while, i'm knee deep in C atm
Gersho
@Gersho
Feb 14 2018 03:24
yay my code works ! now let's see why
Claudio Restifo
@Marmiz
Feb 14 2018 03:41
C or Cpp?
Gersho
@Gersho
Feb 14 2018 03:42
C
Claudio Restifo
@Marmiz
Feb 14 2018 03:50
oh wow! goodbye to OOP :)
Aniculaesei
@Aniculaesei
Feb 14 2018 06:12
Hi guys.I've installed an extension for Visual Studio Code for autocomplete.But it doesnt work....How I can activate it?Thank you
Aditya
@ezioda004
Feb 14 2018 06:13
@Aniculaesei Usually after installing extension in VSC you have to restart the editor.
Aniculaesei
@Aniculaesei
Feb 14 2018 06:15
Thank you :)
@ezioda004 Thank you man :)
CamperBot
@camperbot
Feb 14 2018 06:15
aniculaesei sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 456 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Aditya
@ezioda004
Feb 14 2018 06:15
No problem :)
Linh Nguyen My
@pinglinh
Feb 14 2018 09:35

Hey all! For this section https://beta.freecodecamp.org/en/challenges/react-and-redux/extract-local-state-into-redux

Not sure how I would write Next, modify the submitMessage() method so that it dispatches submitNewMessage() from this.props, and pass in the current message input from local state as an argument.

  submitMessage() {
    this.setState({
      input:     this.props.submitNewMessage(this.state.input)
    })
Claudio Restifo
@Marmiz
Feb 14 2018 10:27

@pinglinh you don't have to set state when dispatching action, but let the props.dispatch methods sends its data to the store.
You have the dispatch props in your component thanks to the connect function.

So If I want to dispatch some data:

handleAction = () => this.props.dispatch(ActionToDispatch(payload))

And you'll see the store picking up ActionToDispatch as defined

CamperBot
@camperbot
Feb 14 2018 10:27
marmiz sends brownie points to @pinglinh :sparkles: :thumbsup: :sparkles:
:cookie: 293 | @pinglinh |http://www.freecodecamp.org/pinglinh
Linh Nguyen My
@pinglinh
Feb 14 2018 10:46
nvm got it now
harishcalvin
@harishcalvin
Feb 14 2018 12:04
hi ?
Linh Nguyen My
@pinglinh
Feb 14 2018 12:04
@Marmiz sorry I didn't see your message earlier!
@Marmiz yeah I removed setState and input :) think I'm starting to get it :D
@Marmiz Thanks a lot :D
CamperBot
@camperbot
Feb 14 2018 12:05
pinglinh sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1163 | @marmiz |http://www.freecodecamp.org/marmiz
Thejaswini-Nuthi
@Thejaswini-Nuthi
Feb 14 2018 14:27
hi
Ken Haduch
@khaduch
Feb 14 2018 15:16
@Thejaswini-Nuthi :wave:
Kyle Holm
@thekholm80
Feb 14 2018 15:50
good morning help room
Sweet Coding :)
@SweetCodingInc
Feb 14 2018 15:53
@thekholm80 Ser Kyle :wave:
@khaduch Ser Ken :wave:
Ken Haduch
@khaduch
Feb 14 2018 15:59
@thekholm80 @SweetCodingInc - hello and good morning / evening to everyone out there...
Gersho
@Gersho
Feb 14 2018 16:05
the youngsters are up early ! Hello /help
Tom
@moT01
Feb 14 2018 16:06
:rabbit2:
Kyle Holm
@thekholm80
Feb 14 2018 16:06
my new most favorite library: dotenv
Gersho
@Gersho
Feb 14 2018 16:07
oh a thing to manage $VAR
Kyle Holm
@thekholm80
Feb 14 2018 16:08
it allows you to put key/value pairs in a file called .env and then will process them all into process.env.xxx variables
pretty spiffy, i'd been manually adding my process.env variables in the command line like a chump
Gersho
@Gersho
Feb 14 2018 16:09
with django i had trouble finding how/when i had to set them
Kyle Holm
@thekholm80
Feb 14 2018 16:09
i have stuff that i don't want people to see, like api keys, encryption keys, etc
so i hide them as environment variables
Gersho
@Gersho
Feb 14 2018 16:10
yeah that's what i did too
Kyle Holm
@thekholm80
Feb 14 2018 16:10
like my current project:
const PORT = process.env.PORT,
      DB_URL = process.env.DB_URL,
      YELP_ID = process.env.YELP_ID,
      YELP_SECRET = process.env.YELP_SECRET,
      JWT_SECRET = process.env.JWT_SECRET;
Gersho
@Gersho
Feb 14 2018 16:11
but i didn't add it via terminal, i've put them at the end of one of the files that runs when the server starts
Darren
@DarrenfJ
Feb 14 2018 16:11
morning fCC
Kyle Holm
@thekholm80
Feb 14 2018 16:12
@DarrenfJ :wave:
Darren
@DarrenfJ
Feb 14 2018 16:12
hey guys! :wave: @thekholm80 @Gersho
what up whatup?
Gersho
@Gersho
Feb 14 2018 16:12
os.environ['YTPARTY_SECRET_KEY'] =
os.environ['YTPARTY_DEBUG'] =
os.environ['YTPARTY_API_KEY'] =
cat environment >> ~/projects/ytparty/ytparty/wsgi.py
Kyle Holm
@thekholm80
Feb 14 2018 16:12
@DarrenfJ trying to make myself write some code today
Gersho
@Gersho
Feb 14 2018 16:13
Hey Darren ! finaly finished cs50 pset4 that night ! but i had to switch to the easier challenge
Darren
@DarrenfJ
Feb 14 2018 16:14
noice
on both counts
Tom
@moT01
Feb 14 2018 16:14
:paperclip:
Gersho
@Gersho
Feb 14 2018 16:14
only one more challenge in C and i'm done with it
Kelechi Chinaka
@ke1echi
Feb 14 2018 16:14
:clap: @Gersho
one? how do u mean?
Darren
@DarrenfJ
Feb 14 2018 16:15
I've been distracted with work and this git thing we did in GitHub for new git peeps
Gersho
@Gersho
Feb 14 2018 16:15
@kelechy pset5 has only 1 exercice
:wave:
Darren
@DarrenfJ
Feb 14 2018 16:17
@Gersho and then yer done it all?
Gersho
@Gersho
Feb 14 2018 16:17
no it's about the first half of cs50
Darren
@DarrenfJ
Feb 14 2018 16:18
ah... i haven't looked at the CS50 stuff for a while now
oh yahthough it changes and only does part of it in C,right?
Gersho
@Gersho
Feb 14 2018 16:19
from my understanding the rest is html css js python sql
Kelechi Chinaka
@ke1echi
Feb 14 2018 16:20
o nice @Gersho
where did you find yourself on the speller leaderboard? @Gersho
Gersho
@Gersho
Feb 14 2018 16:21
that's the one from pset5 i haven't done it yet
Kelechi Chinaka
@ke1echi
Feb 14 2018 16:22
ok
Darren
@DarrenfJ
Feb 14 2018 16:32
@Gersho coolCool.. good luck brutha!
Kyle Holm
@thekholm80
Feb 14 2018 17:39
some things take way to long to figure out
Kelechi Chinaka
@ke1echi
Feb 14 2018 18:46
first part done..how did you get the first two long long numbers? @Gersho
Gersho
@Gersho
Feb 14 2018 18:47
on credit ?
there's get_long_long() for that
Kelechi Chinaka
@ke1echi
Feb 14 2018 18:49
thats to get the card number
Gersho
@Gersho
Feb 14 2018 18:49
yes
oh the first 2 digits ?
Kelechi Chinaka
@ke1echi
Feb 14 2018 18:49
yea
Gersho
@Gersho
Feb 14 2018 18:51
in the loop where you %10 and /10, make a check for between 10 and 100, and save it somewhere
Kelechi Chinaka
@ke1echi
Feb 14 2018 18:53
i dont understand
Gersho
@Gersho
Feb 14 2018 18:53
like the card number is 3456
3456
/10
345
/10
34 => save the digits
when you divide by 10 you credit card number, at some point it will be 2 digits, so between 10 and 99
Kyle Holm
@thekholm80
Feb 14 2018 19:06
hallelujah i actually accomplished something
Gersho
@Gersho
Feb 14 2018 19:06
achivement unlocked: got out of bed
Kyle Holm
@thekholm80
Feb 14 2018 19:06
lol
Gersho
@Gersho
Feb 14 2018 19:07
gratz btw !
Kyle Holm
@thekholm80
Feb 14 2018 19:07
i wrote the login route for my project!
Gersho
@Gersho
Feb 14 2018 19:07
what are you working on ?
Kyle Holm
@thekholm80
Feb 14 2018 19:07
the nightlife coordination app
trying to use jwt for the first time
Gersho
@Gersho
Feb 14 2018 19:08
oh you're down pretty far in the list of stuff fCC has to offer
Kyle Holm
@thekholm80
Feb 14 2018 19:08
look how pretty:
  app.post('/auth/login', bodyParser.json(), async (req, res) => {
    const verifyPassword = require('./utils/verifyPassword'),
          { jwtSecret } = require('./utils/config'),
          { errLoginFind, errPassMatch } = require('./utils/errorHandlers'),
          { Users } = mongo,
          { display_name, password } = req.body;

    const user = await Users.findOne({ display_name: display_name })
                            .catch(err => errLoginFind(err)),
          match = await verifyPassword(password, user.password)
                            .catch(err => errPassMatch(err));

    const response = (user && match)
      ? await jwt.sign(user, jwtSecret, { expiresIn: "12h" })
      : { "error": "Invalid user or password" };

    res.json(response);
  });
cjlynch12
@cjlynch12
Feb 14 2018 19:08
@thekholm80 congrats! I finally got mine working with JWT for the voting app project as well
was a pain to figure out
Kyle Holm
@thekholm80
Feb 14 2018 19:09
the big hold-up for me was i thought you couldn't expose the jwt on the front end
Gersho
@Gersho
Feb 14 2018 19:09
so pretty my eyes bleed, i don't talk backend JS
cjlynch12
@cjlynch12
Feb 14 2018 19:09
yeah there's a lot of hot debate over local-storage vs cookie storage
Kyle Holm
@thekholm80
Feb 14 2018 19:09
everyone has an opinion lol i probably read like 10,000 blog posts
cjlynch12
@cjlynch12
Feb 14 2018 19:09
I opted for cookie storage with an HTTPonly and secure flag, so it's not exposed but it def took longer to get working cause of it
Kyle Holm
@thekholm80
Feb 14 2018 19:10
i'm going to use session storage so that i can decode the user object
Gersho
@Gersho
Feb 14 2018 19:10
when i see your first block of code, only thing i can think of is that django is like "oh, just add @login_required at the top of your view"
Kyle Holm
@thekholm80
Feb 14 2018 19:10
lol
now i need to figure out how to make graphql play nice with the jwt
@cjlynch12 my voting app was a hot mess, i passed my user id back to the front end, then used a redirect to query the user data. so ugly and insecure
cjlynch12
@cjlynch12
Feb 14 2018 19:13
ahh yeah - I'm still working on implementing the polls so still gotta figure out the best way. Gotta take a crack at it tonight.
since user info is stored in a cookie shouldn't be too difficult (i hope)
Kyle Holm
@thekholm80
Feb 14 2018 19:14
i thought you couldn't access httpOnly cookies in the browser
all this makes my head hurt
cjlynch12
@cjlynch12
Feb 14 2018 19:15
you can't, so I'll have to validate server side and then pass the polls to the front end
Gersho
@Gersho
Feb 14 2018 19:15

so ugly and insecure

we're still talking code right ? or is that what happens when valentines and ash wednesday are on the same day ?

Kyle Holm
@thekholm80
Feb 14 2018 19:15
oh right, the cookie goes back and forth with each req and res
@Gersho ugly and insecure was my 10th grade school picture
cjlynch12
@cjlynch12
Feb 14 2018 19:16
yeah exactly, you can parse the cookie with express , if it's valid match the user id to the poll-user id in mongo, and pass the poll its self back as an object
Gersho
@Gersho
Feb 14 2018 19:16
your own fault for making yearbooks !
cjlynch12
@cjlynch12
Feb 14 2018 19:16
at least that's what my understanding of it is
could be off base lol
Kyle Holm
@thekholm80
Feb 14 2018 19:17
about 6 months ago i gave up on ever understanding any of it and basically quit coding
now i'm trying again lol
cjlynch12
@cjlynch12
Feb 14 2018 19:17
yeah this has def been the most frustrating and time consuming project so far
Gersho
@Gersho
Feb 14 2018 19:18
that reminds me i should get back to designing my portfolio at some point
cjlynch12
@cjlynch12
Feb 14 2018 19:18
but I'm trying to get a good grasp on it before moving on cause it seems like I'll need the basic user auth stuff for the other projects anyway
Kelechi Chinaka
@ke1echi
Feb 14 2018 19:18
ok..i would get back to it in some hours @Gersho
Gersho
@Gersho
Feb 14 2018 19:18
sure ^^
cjlynch12
@cjlynch12
Feb 14 2018 19:18
I've re-factored everything completely at least three times already lol
Kelechi Chinaka
@ke1echi
Feb 14 2018 19:18
quit coding? @thekholm80
Gersho
@Gersho
Feb 14 2018 19:19
i took a 1 week break when pset4 was driving me nuts
Kyle Holm
@thekholm80
Feb 14 2018 19:19
@kelechy i did some katas every now and then, but basically just gave up
Kelechi Chinaka
@ke1echi
Feb 14 2018 19:20
:smile:
cjlynch12
@cjlynch12
Feb 14 2018 19:20
I still need to do cs50, but want to finish up the back end stuff irst
Kelechi Chinaka
@ke1echi
Feb 14 2018 19:20
those breaks helps alot
Kyle Holm
@thekholm80
Feb 14 2018 19:20
when i did cs50 it was really fun
i'd like to do it again
Gersho
@Gersho
Feb 14 2018 19:21
in David's lectures, i wonder how many times he says "back to back to back"