These are chat archives for FreeCodeCamp/HelpFrontEnd

30th
Nov 2017
Brian
@brianjckim
Nov 30 2017 00:32
Hi guys - it seems like the tutorials on freeCodeCamp are all in Bootstrap 3. Are we supposed to learn 4 instead?
Rishabh Gupta
@RishabhGupta22
Nov 30 2017 00:44
how to add the local storage settings in the recipe box project of freecodecamp?
Tom
@moT01
Nov 30 2017 00:45
@brianjckim the bootstrap section isn't that big, if i recall - you can do either way you want
like you said, the lessons are using 3
so if you want to do the lessons - maybe use that
i dont think 4 is all that much different
Brian
@brianjckim
Nov 30 2017 00:47
@moT01 Yeah I did the lessons in 3, but I'm wondering what I should use for the first couple of projects
again - up to you
Brian
@brianjckim
Nov 30 2017 00:48
@moT01 Aite, thanks!
CamperBot
@camperbot
Nov 30 2017 00:48
brianjckim sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 919 | @mot01 |http://www.freecodecamp.org/mot01
Tom
@moT01
Nov 30 2017 00:49
i would probly just use 3 since you know it better, it might confuse things to try use 4
Brian
@brianjckim
Nov 30 2017 00:50
@moT01 Yeah I'll give it a try haha
Rishabh Gupta
@RishabhGupta22
Nov 30 2017 02:05
how to prevent the operator(+ ,-, / ,*) from being entered as the 1st element
https://codepen.io/rishabhgupta/full/zPKMLL
thanks in advance
Long Nguyen
@longnt80
Nov 30 2017 02:11
This message was deleted
@RishabhGupta22 I'd put all the inputs in array then check if the first input (array[0]) is one of the operators
Daniel
@DanJP2016
Nov 30 2017 02:15
having trouble writing a shunting-yard algorithm for my calculator project. it works when input is 1 + 1 = 2 , + 1 = 3, and 1 + 1 + 1 = 3. but when you try something like 1 + 1+ 1+ 1, the code returns 3 and pushes a NaN to the stack, and I can' figure out where I went wrong with it.
https://codepen.io/bones211/pen/MOzbzo
Rishabh Gupta
@RishabhGupta22
Nov 30 2017 02:18
@longnt80 that is one solution, but where am i going wrong in this pls tell
Tom
@moT01
Nov 30 2017 02:36
@DanJP2016 dont know
could just check if the length is > 0 when one of those is pressed @RishabhGupta22
Daniel
@DanJP2016
Nov 30 2017 02:39
@moT01 thats cool, thanks for looking at it.
CamperBot
@camperbot
Nov 30 2017 02:39
danjp2016 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 921 | @mot01 |http://www.freecodecamp.org/mot01
Tom
@moT01
Nov 30 2017 02:40
sure looks like a friggin shunting yard if ive ever seen one
Daniel
@DanJP2016
Nov 30 2017 02:41
haha yeah, im gonna have to start from scratch I think
Tom
@moT01
Nov 30 2017 02:49
i put this in the code
Vikrant Singh
@VikrantSingh13
Nov 30 2017 02:49
Why isn't my react code working? https://codepen.io/vikrantsingh13/pen/eGGgGR
Tom
@moT01
Nov 30 2017 02:49
function evaluate() {

    console.log('solving the problem');
  console.log('input= '+input)
    console.log('expression= '+ expression);
  console.log('action= ' +action);
@DanJP2016
when using 4 numbers it doesn't seem like the input is right
it doesn't remove the + and put it in action
which im guessing its supposed to
Rishabh Gupta
@RishabhGupta22
Nov 30 2017 02:51
@moT01 is this looking fine now..?? i added an alert msg to this
https://codepen.io/rishabhgupta/full/zPKMLL
Tom
@moT01
Nov 30 2017 02:52
@RishabhGupta22 sure
Daniel
@DanJP2016
Nov 30 2017 02:52
@moT01 maybe, the numberFactory function thinks its a number? or is finishing before the input stack is clear?
abraham anak agung
@padunk
Nov 30 2017 02:52
@VikrantSingh13 it worked here.
Vikrant Singh
@VikrantSingh13
Nov 30 2017 02:54
@padunk i fixed it thanks
CamperBot
@camperbot
Nov 30 2017 02:54
vikrantsingh13 sends brownie points to @padunk :sparkles: :thumbsup: :sparkles:
:cookie: 400 | @padunk |http://www.freecodecamp.org/padunk
Daniel
@DanJP2016
Nov 30 2017 02:54
or maybe...the number from the first operation being pushed back into the input stack, is an actual number an not a string...
and thats causing all kinds of weird stuff
Tom
@moT01
Nov 30 2017 02:58
if (action.length > 1)
it goes there when the action length is 2 or more
so it never sorts the other operator
im not sure how the algorithm is supposed to work
do you want to like sort the operators first
abraham anak agung
@padunk
Nov 30 2017 03:01
@DanJP2016 when you have 4 input 1,2,3,1 your expression is [1,2] and left become 1 and right is 2, but in next step your expression only have [3] so left is 3 and right become undefined
Tom
@moT01
Nov 30 2017 03:01
then ur pushing back into input at the end
it supposed to do that
abraham anak agung
@padunk
Nov 30 2017 03:01
but i don't really know about shunting yard algo,
Daniel
@DanJP2016
Nov 30 2017 03:02
yeah the result has to be pushed back onto the stack, so the other operations can continue. but with 1 + 1+ 1+ 1 it fails
the code works if the user does not string them all together at once, so its close to being correct I think
Tom
@moT01
Nov 30 2017 03:02
so you want to get input down to one number or empty it out at the beginning?
Daniel
@DanJP2016
Nov 30 2017 03:03
down to one number, then push that result back into input so more operations can be added to it, or it can be cleared
what the number factory does is convert the input into a Reverse Polish Notation, then the evaluate function takes care of the math part, in theory
Tom
@moT01
Nov 30 2017 03:13
hmm
now that is a pickle
i played it through on paper and in my head - seems like it should work
i bet its the evaluating
cause it shows "expression= 1,2,NaN"
how did nan get in there
Daniel
@DanJP2016
Nov 30 2017 03:14
i followed a tutorial and wrote the same algoritm in c++ and it worked fine..can't be that much different in javascript
but i think @padunk is right, the problem might be the left and right variables are not getting cleared
abraham anak agung
@padunk
Nov 30 2017 03:16
i read shunting in wiki, it is confusing for me :smile:
Rishabh Gupta
@RishabhGupta22
Nov 30 2017 03:18
can i post the links to my codepens here to get your feedback?
Tom
@moT01
Nov 30 2017 03:18
i got it i think
Daniel
@DanJP2016
Nov 30 2017 03:18
yeah, im too far into to give up though lol
Tom
@moT01
Nov 30 2017 03:18
your pushing the result back to the end of input
you want to put it at the beginning
so it becomes the first number in the next expression
use unshift()
Daniel
@DanJP2016
Nov 30 2017 03:19
the input is getting cleared before its get pushed though, so its the only value in the array
Tom
@moT01
Nov 30 2017 03:20
it doesnt get cleared though
Daniel
@DanJP2016
Nov 30 2017 03:20
your right yeah, it does not clear it all the way when there more than 3 numbers waiting to be parsed...
sweet jesus man thats brilliant
abraham anak agung
@padunk
Nov 30 2017 03:21
i think it was here if(action.length > 1) { evaluate(); } when you have action.length > 1 it will evaluate
Daniel
@DanJP2016
Nov 30 2017 03:21
@moT01 thank you
CamperBot
@camperbot
Nov 30 2017 03:21
danjp2016 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
api offline
Tom
@moT01
Nov 30 2017 03:21
sure thing
yea i spent too long on it at that point - i had to dive in
Daniel
@DanJP2016
Nov 30 2017 03:23
here is a working example, thanks to @moT01, of a shunt-yard algorithm for anyone else who runs into a similar problem
CamperBot
@camperbot
Nov 30 2017 03:23
danjp2016 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
api offline
Tom
@moT01
Nov 30 2017 03:25
looking at the wiki - it looks like it gets to be quite a bit more
when you start using more operators
and exponents
and all that
abraham anak agung
@padunk
Nov 30 2017 03:26
@DanJP2016
at first loop you have expresion [1 action is empty, second loop exp [1,1] action [+] third loop exp is [1] action is [+] so left is 1 and rigght is undefined
Daniel
@DanJP2016
Nov 30 2017 03:27
@moT01 yeah my excitement kinda wavered when I read that..but this problem is solved at least lol
Tom
@moT01
Nov 30 2017 03:29
i never of it
pretty neat
pretty cool when you can do with a few methods and an array
Daniel
@DanJP2016
Nov 30 2017 03:30
@padunk hmm, i think it needs to be undefined because if its set to zero that will effect multiplication and division.
Daniel
@DanJP2016
Nov 30 2017 03:30
heck yeah, this algorithm was used in most calculators in the 70s and 80s, i think some still use a modified version of it today
Tom
@moT01
Nov 30 2017 03:31
well - the one i made following a tutorial
sort of
and modifying
it needs some work
it's not challenging
abraham anak agung
@padunk
Nov 30 2017 03:34
@DanJP2016 i just add action.length > 1 && expression.length > 1 and it worked
Daniel
@DanJP2016
Nov 30 2017 03:34
that is pretty good though, i like the way it starts out drawing the maze
@padunk ah I see, so that way the evaluate function does not spit out a NaN or undefined?
abraham anak agung
@padunk
Nov 30 2017 03:38
@DanJP2016 yes i think it will evaluate correctly because u use shift and empty the expression
Daniel
@DanJP2016
Nov 30 2017 03:40
ah ok, i got written down and plugged into the example. I will have to rewrite my main code for it, all kinds of crazy stuff going on
abraham anak agung
@padunk
Nov 30 2017 03:42
@DanJP2016 good luck :+1:
Daniel
@DanJP2016
Nov 30 2017 03:42
@padunk thanks for the help, been stuck on it for a couple days now
CamperBot
@camperbot
Nov 30 2017 03:42
danjp2016 sends brownie points to @padunk :sparkles: :thumbsup: :sparkles:
:cookie: 402 | @padunk |http://www.freecodecamp.org/padunk
Ben Hart
@Benjmhart
Nov 30 2017 04:18
hey gang, can anyone help with Simon? having trouble with jquery on line 105 https://codepen.io/Benjmhart/pen/OOErVG
Tom
@moT01
Nov 30 2017 04:23
@Benjmhart the background color?
move it into the css
use pseudo classes
Ben Hart
@Benjmhart
Nov 30 2017 04:42
@moT01 that works until the AI needs to push a button and then it writes into inline styles... or is there a way to trigger psuedoclasses?
Linus Phan
@linusphan
Nov 30 2017 05:43
can anyone walk me through pushing to github?
Lisa Copeland
@lisacopeland
Nov 30 2017 06:05
@linusphan do you already have a repo?
Linus Phan
@linusphan
Nov 30 2017 06:10
I just made a repo on github
And I installed git on my laptop
Lisa Copeland
@lisacopeland
Nov 30 2017 06:14
so you have it cloned in a local directory?
Linus Phan
@linusphan
Nov 30 2017 06:15
I am trying to push files to the remote repo
but it gives me an error
Lisa Copeland
@lisacopeland
Nov 30 2017 06:15
what is the error?
Linus Phan
@linusphan
Nov 30 2017 06:15
remote has work I do not have
on local
Lisa Copeland
@lisacopeland
Nov 30 2017 06:16
do a git pull first
Linus Phan
@linusphan
Nov 30 2017 06:16
im not sure how
Im gonna google
Lisa Copeland
@lisacopeland
Nov 30 2017 06:17
type git pull at the root of the local directory
Linus Phan
@linusphan
Nov 30 2017 06:18

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> master
Lisa Copeland
@lisacopeland
Nov 30 2017 06:19
sounds like you had not cloned the repo
so yes - set the branch with git branch
Linus Phan
@linusphan
Nov 30 2017 06:20
is that: git add remote origin <URL>?
Lisa Copeland
@lisacopeland
Nov 30 2017 06:20
I am not sure
I think you want to do git branch first
Linus Phan
@linusphan
Nov 30 2017 06:21
git branch says im on master branch
Lisa Copeland
@lisacopeland
Nov 30 2017 06:21
ok then do git add remote ...
Linus Phan
@linusphan
Nov 30 2017 06:22
It says remote origin already exists
since I already did that
lol
A-J Roos
@Asjas
Nov 30 2017 06:22
then do a git push remote master not git push
Linus Phan
@linusphan
Nov 30 2017 06:23

$ git push remote master
fatal: 'remote' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

if I change 'remote' to 'origin'
I get the error
$ git push origin master
To https://github.com/linusphan/Algorithms.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/linusphan/Algorithms.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
A-J Roos
@Asjas
Nov 30 2017 06:25
then do a git pull origin master
Linus Phan
@linusphan
Nov 30 2017 06:25
refusing to merge unrelated histories
A-J Roos
@Asjas
Nov 30 2017 06:26
git pull origin master --allow-unrelated-histories
Linus Phan
@linusphan
Nov 30 2017 06:27
how come I have to do this though?
I didn't remember seeing this from watching git tutorials
so I entered that information and im brought to a blue screen now lol
A-J Roos
@Asjas
Nov 30 2017 06:28
Unrelated histories comes from merging two unrelated projects
Linus Phan
@linusphan
Nov 30 2017 06:28
it says enter a message
i don't know where to type
A-J Roos
@Asjas
Nov 30 2017 06:28
that is a commit message yes
just type a commit message
Linus Phan
@linusphan
Nov 30 2017 06:29
do i click enter after im done?
im stuck now T_T
A-J Roos
@Asjas
Nov 30 2017 06:31
You exit and save. Depends on what cli text editor you are using?
Nano, Vi?
Linus Phan
@linusphan
Nov 30 2017 06:32
MINGW64?
are you already a professional web developer?
A-J Roos
@Asjas
Nov 30 2017 06:33
:wq
No I'm not one yet
Linus Phan
@linusphan
Nov 30 2017 06:34
IT WORKED!!!!
Thank you! @Asjas :D
CamperBot
@camperbot
Nov 30 2017 06:34
linusphan sends brownie points to @asjas :sparkles: :thumbsup: :sparkles:
:cookie: 307 | @asjas |http://www.freecodecamp.org/asjas
Linus Phan
@linusphan
Nov 30 2017 06:34
Oh man, I have a lot to go still then
to become a web dev
A-J Roos
@Asjas
Nov 30 2017 06:35
No problem. Yeah it's a long road
But it's extremely fun :)
Linus Phan
@linusphan
Nov 30 2017 06:35
yeah lol
It's fun when you solve problems
like this one
sweet thank you so much
now I can finally start adding some code everyday to my github account =)
A-J Roos
@Asjas
Nov 30 2017 06:37
Pleasure and good luck :)
Linus Phan
@linusphan
Nov 30 2017 06:40
This is fun
:D
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 07:24
hi all, i am trying to understand the challenge: "Applied Visual Design: Lock an Element to its Parent with Absolute Positioning"
i created this pen
the challenge says that the position: absolute, will be different from the position: relative; in that the surrounding items will ignore it
in my case, i have position relative on the 2nd paragraph and the surrounding items are ignoring it as well
Markus Kiili
@Masd925
Nov 30 2017 07:30
@brittanyrutherford What is the question you have about it?
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 07:31
@Masd925 hi
Markus Kiili
@Masd925
Nov 30 2017 07:31
@brittanyrutherford Hello.
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 07:31
my question is, how position relative is different from position absolute
if both of them ignore the elements around them
as in my case, i was expecting that when i set the 2nd paragraph to bottom: 20px; that it'll go up, and push the 1st paragraph
but it ignored it
Markus Kiili
@Masd925
Nov 30 2017 07:35
@brittanyrutherford Normal flow means the normal way to position elements. Relative means moving an element from its normal flow position (without adjusting other elements). Absolute positioning means positioning an element absolutely inside some other element. So isnabsolute positioning, other elements ignore it, but in relative they see it, and element positions are determined, but then the element is moved relative to that normal flow position.
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 07:36
but if they see it, why aren't they pushed when it's moved? @Masd925
I still don't get it :(
Markus Kiili
@Masd925
Nov 30 2017 07:38
@brittanyrutherford Other elements ignore the absolutely positioned element. With relative positioning, the element is positioned normally (other elements see it), but the relative change is ignored (other elements are not further adjusted).
So absolutely positioned element is ignored totally and relatively positioned is ignored partially (first positioned normally and then adjusted without affecting other elements).
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 07:41
:joy: i wouldn't be able to explain this to anyone
so if someone asks me what's the difference
Markus Kiili
@Masd925
Nov 30 2017 07:42
If you wan't other elements to respond to change in elements location, you need to use margins etc.
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 07:42
generally, what would I use in designs? relative or absolute?
Markus Kiili
@Masd925
Nov 30 2017 07:43
@brittanyrutherford If you wan't to position an element inside some other element at fixed position (nothing to do with any other element or normal flow), you use absolute positioning. If you wan't to move an element from its normal flow position (takes into account other elements and the normal flow), you use relative positioning.
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 07:44
but.. elements will ignore the relative position :S
Markus Kiili
@Masd925
Nov 30 2017 07:46
@brittanyrutherford Other elements ignore the relative change after the normal flow positions are determined, yes. With absolute positioning, the element is not at normal flow at all.
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 07:46
hmm
i guess i get it now
Markus Kiili
@Masd925
Nov 30 2017 07:47
You just have to play with some elements and try to use different positionings.
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 07:48
yeah
am doing that right now
so if an element is set to absolute
it's as if it's the only element in that parent div
right?
if it's set to relative, it'll be positioned relatively to other elements, THEN it'll ignore them
for example, I set the element to be position absolute, and it's pushed to the top of the page
when I set it to relative, it wasn't pushed that much, because there was another element
so my new question is, if we have parent div, and only 1 child div, in this case, position the child div as relative should be the same as position absolute, since this is the only element in that div, right?
Markus Kiili
@Masd925
Nov 30 2017 07:51
@brittanyrutherford Yes, absolute positioning positions relative to another (ancestor) element. Doesn't take into account any other elements that might be there.
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 07:52
so in this case, if there's only 1 element, the behavior should be similar?
look
only 1 paragraph in each div, one set to absolute, the other set to relative
and they behave differently
Markus Kiili
@Masd925
Nov 30 2017 07:59
@brittanyrutherford With absolute positioning, the only paragraph will not be inside that parent div, and that parent div will have no content (zero height). Relative positioning (without set top or bottom) will have no effect (same as normal flow).
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 08:00
@Masd925 but I set bottom property in the relative positioned paragraph
but I get what u say regarding the absolute, makes sense
Markus Kiili
@Masd925
Nov 30 2017 08:01
@brittanyrutherford Yes, I was just saying how they differ.
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 08:01
thanks @Masd925
CamperBot
@camperbot
Nov 30 2017 08:01
brittanyrutherford sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4588 | @masd925 |http://www.freecodecamp.org/masd925
Brittany Rutherford
@brittanyrutherford
Nov 30 2017 08:07
@Masd925 do u use the beta?
am doing the exercises on the beta site
jianpingleo
@jianpingleo
Nov 30 2017 08:19
hello ,everyone ,I'm a newbee
A-J Roos
@Asjas
Nov 30 2017 08:22
@jianpingleo Hey and welcome to FCC :tada:
dinesh
@1532j0004kg
Nov 30 2017 08:22
@jianpingleo welcome, Happiee coding and sharing!
Thonio
@Thonio
Nov 30 2017 08:37
Hello everyone!
Markus Kiili
@Masd925
Nov 30 2017 09:51
@brittanyrutherford No, I don't use beta.
@Thonio Hello.
primuscovenant
@primuscovenant
Nov 30 2017 12:29
@heroiczero thx
CamperBot
@camperbot
Nov 30 2017 12:29
primuscovenant sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 2081 | @heroiczero |http://www.freecodecamp.org/heroiczero
linkin-park
@linkin-park
Nov 30 2017 13:29
hello
lawlercoppter
@lawlercoppter
Nov 30 2017 16:03
Hey all! I'm having a bit of trouble getting some elements to line up the way I would like for my portfolio page. https://codepen.io/Lawlercoppter/pen/rYLyNb I'm attempting to get the photo and h1 text in line with each other. Any guidance on where i'm going wrong?
Kaz Baig
@kbaig
Nov 30 2017 16:11
@lawlercoppter are you trying to basically have the h1 on the left half and the img on the right half of the .banner
lawlercoppter
@lawlercoppter
Nov 30 2017 16:12
correct
ideally i'd likethe h1 element to be about 3/4 of the spacing, but if that proves too difficult 1/2 and 1/2 would be just fine
Kaz Baig
@kbaig
Nov 30 2017 16:14
@lawlercoppter To understand why they're not on the same line, read inline vs block elements. h1 is a block element and img is an inline
I would probably do this using flexbox
lawlercoppter
@lawlercoppter
Nov 30 2017 16:14
thank you very much!
Kaz Baig
@kbaig
Nov 30 2017 16:14
:+1:
@lawlercoppter hmu if you're having trouble with flexbox - can be a little confusing at first
crpdomingues
@crpdomingues
Nov 30 2017 16:23
hi
Kaz Baig
@kbaig
Nov 30 2017 16:23
@crpdomingues :wave:
crpdomingues
@crpdomingues
Nov 30 2017 16:25
anyone minds answering me something?
i've just recently started delving into front end dev, signed in on freecodecamp and completed everything fairly easily until I got to the basic algorithm scripting section.
i find myself pressing Hints every exercise
should i study more javascript before progressing further?
or do i continue to try to do them? ty
Kaz Baig
@kbaig
Nov 30 2017 16:27
@crpdomingues I'd say you should pretty much pretend the hint button isn't there
crpdomingues
@crpdomingues
Nov 30 2017 16:27
thanks
ill try
Kaz Baig
@kbaig
Nov 30 2017 16:28
So you can still use fCC as your main learning tool for beginner JS. If you can't figure it out after staring at it for a long time, you should try finding relevant info online. If you still can't you can always ask here. @crpdomingues
crpdomingues
@crpdomingues
Nov 30 2017 16:28
god bless m8
Tom
@moT01
Nov 30 2017 16:29
@crpdomingues those links they give for each challenge are the things (methods) they want you to learn/use
console.log is your best friend
crpdomingues
@crpdomingues
Nov 30 2017 16:30
@moT01 ye like for truncating a string, they tell me to visit string.slice() but i still need the hint button to be honest, i might just need to study this more
ty mate
Kaz Baig
@kbaig
Nov 30 2017 16:32
Man I really wish they hadn't put in the hint button
crpdomingues
@crpdomingues
Nov 30 2017 16:33
ye ill behave like it's not there.
it cuts the accomplished feeling you get for solving the most simple code
Kaz Baig
@kbaig
Nov 30 2017 16:34
While frustrating, it is valuable to make the mistake of staring at a problem for hours not being able to solve it because you mistyped one letter
You stop making those mistakes
crpdomingues
@crpdomingues
Nov 30 2017 16:35
ye, my friend said the exact same thing
Tom
@moT01
Nov 30 2017 16:38
break down the method with some console logs to see what is happening...
var str = 'hello';

str.slice(1,4);
console.log(str);
i think that's how that one goes
Stephen James
@sjames1958gm
Nov 30 2017 18:48
@crpdomingues You will never stop making the mistyped one letter mistakes, but you will realize that the first thing to look for is the stupid errors
like typos and such.
Ben Hart
@Benjmhart
Nov 30 2017 18:55
hey folks, I'm really stuck in this rut with respect to learning node, react, es6, and modern JS development best practices like multi-file management - is there anywhere that offers a definiteive guide or at least an order of what I should try to learn first - it feels like it all has interconnected dependancies
let me know if you can direct me to good resources
disjfa
@disjfa
Nov 30 2017 18:59
There is no correct way of all interconnected dependecies, only a like for some. Wich dependency broky you?
Ben Hart
@Benjmhart
Nov 30 2017 19:00
well it's kind of all of them all at once
i guess understanding node and setting up an IDE specifically for react is the first... I am going to a nodeschool event this weekend...
disjfa
@disjfa
Nov 30 2017 19:02
There people can realy help
But if you just want to have something to do, start wit create-reat-app to create a react app
Ben Hart
@Benjmhart
Nov 30 2017 19:06
well I tried that
I guess part of the problem is that I met with someone off codementors and basically got ripped to shreds
I feel like FCC doesn't really explain how to set up a JS project to meet professional standards?
disjfa
@disjfa
Nov 30 2017 19:08
Correct, fcc is just entry level
But that helps understanding
Ben Hart
@Benjmhart
Nov 30 2017 19:08
like, i can find resources on OOP and functional and es6, but is there a good general guide on setting up IDE's and splitting up your JS file
oh it was great for basics and design patterns, don't get me wrong, I just need more if I want to go professional
disjfa
@disjfa
Nov 30 2017 19:09
I found a fun project on realworld.io that sets up the same project per app type
Read some of those maybe
Ben Hart
@Benjmhart
Nov 30 2017 19:12
that seems really cool actually, but does it go through how to mount them on a node server?
(don't know if mount is the right term)
disjfa
@disjfa
Nov 30 2017 19:12
Ah, you want to deploy a project
Well, uhm
I got started with this one, https://www.youtube.com/watch?v=kR06NoSzAXY
Ben Hart
@Benjmhart
Nov 30 2017 19:14
well, I want to do all kinds of things
not even sure where to begin.
disjfa
@disjfa
Nov 30 2017 19:14
Just pick one :D If you want to do all the things you do nothing. I know that
Ben Hart
@Benjmhart
Nov 30 2017 19:15
this is the problem
so by deploy, you just mean to get it somewhere it can be publicly accessed?
disjfa
@disjfa
Nov 30 2017 19:15
yes
Ben Hart
@Benjmhart
Nov 30 2017 19:15
(i kind of need a glossary)
is that different than setting it up in an IDE and running NPM start? (i mean, isn't it basically the same thing, but on a public server)?
like say I put it up on cloud 9 and NPM start, is that 'deploying it'?
disjfa
@disjfa
Nov 30 2017 19:17
Yeah, kinda. Only wrap npm start in something like pm2 to run the script whenever a client calls for that.
But that's the hard stuff
Cristi Ciobanu
@c-ciobanu
Nov 30 2017 19:18
hi, i'm doing the wikipedia project but i'm having problems using the API, i get this error CORS header ‘Access-Control-Allow-Origin’ missing
Ben Hart
@Benjmhart
Nov 30 2017 19:20
pm2 - what's that?
Kaz Baig
@kbaig
Nov 30 2017 19:20
@c-ciobanu add origin=* to query string
Ben Hart
@Benjmhart
Nov 30 2017 19:21
@c-ciobanu - origin is a required parameter, the wikipedia API talks about it.
Pm2 is a command line interface? how is it different than bash exactly?
or is it a whole linux wrapper?
disjfa
@disjfa
Nov 30 2017 19:23
If a request gets on a server it redirects the request to the node call
Ben Hart
@Benjmhart
Nov 30 2017 19:24
I don't understand, but that's ok, deployment is a bit beyond me right now
right now, I just want to know how to get an IDE set up say with webpack, lets assume without react, and how I should be splitting up my JS files, and how to pass things around between them.
i guess nodeschool is the right place for me...
crpdomingues
@crpdomingues
Nov 30 2017 19:53
@sjames1958gm Thank you very much for the tip.
CamperBot
@camperbot
Nov 30 2017 19:53
crpdomingues sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8732 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Ben Hart
@Benjmhart
Nov 30 2017 22:18
hey folks, I have a bug in Simon, the function cpurecite, seems to be getting called and it's messing with a global variable, I can't figure out where it's being called from (when testing, this issue interferes starting on turn 2) https://codepen.io/Benjmhart/pen/OOErVG
Kris Baillargeon
@krisb1220
Nov 30 2017 22:22
@Benjmhart what variable?
Ben Hart
@Benjmhart
Nov 30 2017 22:23
choiceCounter
it's supposed to increment when the player presses a button in response to a computer turn
to keep track of what button is the right button
but from what I can tell now that I've introduced a bunch of console.logs - somehow a small part of the cpurecite function is firing in response to the player pressing one of the game buttons, but I can't determine why or where the function is getting fired
Kris Baillargeon
@krisb1220
Nov 30 2017 22:25
What's happening to the variable
is it restarting at 0?
function cpuRecite(){
  iterate gamestate array, each time playing a sound and changing colors
 // var currentCount=0;
  reciteTime=setInterval(function(){
    if(currentCount===gamestate.length){
      clearInterval(reciteTime);
      playerTurn=true;
      playerChoices=[];
      console.log('choiceCounter is being reset by cpurecite');
      choiceCounter=0;
    }
Ben Hart
@Benjmhart
Nov 30 2017 22:26
yeah, and I can see from my console that it's happening from that function, and it only happens when i press the button
Kris Baillargeon
@krisb1220
Nov 30 2017 22:26
Every time you call the function it restarts the variable at 0
Ben Hart
@Benjmhart
Nov 30 2017 22:27
but it's happening when it shouldn't
I'm not calling the function. it's weird
Kris Baillargeon
@krisb1220
Nov 30 2017 22:27
OHHH
I SEE WHAT IT IS
Ben Hart
@Benjmhart
Nov 30 2017 22:28
?
Kris Baillargeon
@krisb1220
Nov 30 2017 22:28
Wait LOL my bad
I thought I saw a syntax issue that might have caused the problem but I was wrong :P
Ben Hart
@Benjmhart
Nov 30 2017 22:30
it probably is a syntax issue.
i introduced an argument so I can log out all the places that could be calling that function and so far as I can tell, it just runs, whenever i click one of the buttons, it just runs, without running the rest of the function
super weird
also i get a stylesheet could not be loaded error partway through the game
Kris Baillargeon
@krisb1220
Nov 30 2017 22:32
I think I got it???
        else{
          console.log('resetting cpu recite');
          setTimeout(function(){
            playerTurn=false                            
          cpuRecite;}, tempo); 
        }
thats running every second every that game starts
resetting choiceCounter
Ben Hart
@Benjmhart
Nov 30 2017 22:42
nope, i found it though
...the cpurecite wasn't firing. I had stuck the reciteTime as a global variable so that it was easier to kill when I had a gameover, that interval was firing forever
setTimeout only runs once when you fire it