These are chat archives for FreeCodeCamp/Help

28th
Feb 2018
Darren
@DarrenfJ
Feb 28 2018 01:47
evening fCC
Stephen James
@sjames1958gm
Feb 28 2018 01:52
@DarrenfJ :wave:
Darren
@DarrenfJ
Feb 28 2018 02:26
@sjames1958gm hey buddy! :D
Stephen James
@sjames1958gm
Feb 28 2018 02:26
@DarrenfJ Howsa?
Claudio Restifo
@Marmiz
Feb 28 2018 03:16
@sjames1958gm you remember what I told you yesterday about componentWillMount?

React docs:

Avoid introducing any side-effects or subscriptions in this method. For those use cases, use componentDidMount() instead.

Apollo GraphQL docs:

export class CommentsPage extends Component {
    componentWillMount() {
        this.props.subscribeToNewComments({
            repoFullName: this.props.repoFullName,
        });
    }
}

:worried: :worried:

Who do I trust?
Manish Giri
@Manish-Giri
Feb 28 2018 03:24
Angular
:muscle:
Claudio Restifo
@Marmiz
Feb 28 2018 03:25
@Manish-Giri :fire: :sparkles:
Manish Giri
@Manish-Giri
Feb 28 2018 03:26
@Marmiz :rocket: :fire: :fireworks:
Jacob Fines
@jfines
Feb 28 2018 03:37

Is there an easy way to check for the end of a string? Is there a string.end() function?

I'm not seing it googling but I would think there is that.

Manish Giri
@Manish-Giri
Feb 28 2018 03:40
@jfines just use string[string.length-1]
Jacob Fines
@jfines
Feb 28 2018 03:42
@Manish-Giri I'm looking for something I can use in an if statement (not a loop). Will string.length() work?
I thought string. length() produced a number which would be evaluated as true in any conditional (unless it were and empty string).
oh, I see what you doing. Then I need to push a null or a zero to the end of my string before the check so I get the last element out but not past it?
Manish Giri
@Manish-Giri
Feb 28 2018 03:44
@jfines .length is a property, not really a method, so just string.length, and yes it would return a number but you can still use it in an if
would help if you describe the problem a bit further
maybe an example of what you're trying to do...
Jacob Fines
@jfines
Feb 28 2018 03:47

I'm doing that algorithm challenge where you find the longest word in the string. I think I found a simple soln but dont know a couple things about the stuff I'm working with.

This is my code: https://ideone.com/eDDodm

but I guess I'd have to replace line 13 with:

if(sizeList[sizeList.length()]) {

?

@Manish-Giri ^ sorry
Manish Giri
@Manish-Giri
Feb 28 2018 03:48
okay, I can give you another algorithm if you're up for it
Jacob Fines
@jfines
Feb 28 2018 03:49
sure
Manish Giri
@Manish-Giri
Feb 28 2018 03:52
First algorithm - using a loop -
1. create an array of the individual words in a string (by using .split())
2. create a variable which will hold the longest word
3. loop through the array of words - in each iteration, check if the current word is longer than the variable you created in step 2 (use .length), if it is - set the variable to this word
4. at the end of the loop, the variable from step 2 will have the longest word in the string, which you can then return
Jacob Fines
@jfines
Feb 28 2018 03:53
cool
I like recursion
Manish Giri
@Manish-Giri
Feb 28 2018 03:54

from the link you posted, this comment -

Check if the end of the array has been reached

this would require you to use some sort of a loop either way

Manish Giri
@Manish-Giri
Feb 28 2018 04:00
@jfines there's also a one line solution using .reduce(), but i'm not sure if you've come across this function yet..
Jacob Fines
@jfines
Feb 28 2018 04:00
@Manish-Giri I was shooting for recursion but I keep noticing little problems with my code and tweaking it . (with recursion you have to call the function again)
I hadn't thought of that. thanks
I don't know how I got on this recursion kick
Manish Giri
@Manish-Giri
Feb 28 2018 04:01
@jfines yes, with recursion you need to think of a possible base case that will eventually end your function..maybe something like while(str.length)
in the while, you somehow need to pop words off the array (so as to reach your base case) and simultaneously return the longest word
Jacob Fines
@jfines
Feb 28 2018 04:03

@Manish-Giri this is my latest fiasco (I think I'm getting cllose).

[ I heard loops aren't true recursion though ]

that ^
I'm getting tired...
I do that when things don't go my way :p
Manish Giri
@Manish-Giri
Feb 28 2018 04:04
okay
there are a few problems with that code
sizeList.replace(/./ , sizeList.length()); <- here, for instance
.replace() is a string method, you're using it on an array
but keep at it, hope you solve it with recursion :+1:
Jacob Fines
@jfines
Feb 28 2018 04:09
@Manish-Giri thanks. I appreciate you man
CamperBot
@camperbot
Feb 28 2018 04:09
jfines sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6812 | @manish-giri |http://www.freecodecamp.org/manish-giri
Manish Giri
@Manish-Giri
Feb 28 2018 04:10
:+1:
Claudio Restifo
@Marmiz
Feb 28 2018 04:11
@Manish-Giri they asked me to open a PR and change the docs :)
didMounts always wins
Manish Giri
@Manish-Giri
Feb 28 2018 04:13
change Apollo's docs?
Claudio Restifo
@Marmiz
Feb 28 2018 04:22
yeh
that was an error :)
balance has been restored #zen
Manish Giri
@Manish-Giri
Feb 28 2018 04:26
solve that 123 sum problem for me
Claudio Restifo
@Marmiz
Feb 28 2018 04:34
@Manish-Giri oh I have no idea. I fear it's made with some sort of "hack" in java
Supra01
@Supra01
Feb 28 2018 10:17
Hello I'm currently working on the Wikipedia View Challenge. I'm able to get data from the API. But
when I click my submit button the data shows for a second and then disappears. Does anyone have an idea why it's doing that?
https://codepen.io/Supra_01/pen/gvZKMR?editors=1010
Johnny
@JohnnyBizzel
Feb 28 2018 10:25
@Supra01 I don't think you are handling the asynchronous call to the API correctly.
Aditya
@ezioda004
Feb 28 2018 10:43
@Supra01 Thats because you arent preventing default, add
function loadData(e) {
  e.preventDefault();
//rest of the code
}
Ahmad Abdolsaheb
@ahmadabdolsaheb
Feb 28 2018 10:50
hey all, I get an error Unexpected string in JSON at position 6575. what is this position referring to?
Supra01
@Supra01
Feb 28 2018 11:02
@ezioda004 @JohnnyBizzel Thank you I will look into asynchronous calls and try preventDefault()
CamperBot
@camperbot
Feb 28 2018 11:02
supra01 sends brownie points to @ezioda004 and @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1802 | @johnnybizzel |http://www.freecodecamp.org/johnnybizzel
:cookie: 485 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Stephen James
@sjames1958gm
Feb 28 2018 11:14
@Marmiz trust the React docs
ameenalam
@Ameen-Alam
Feb 28 2018 12:29
@Ameen-Alam
hello
anyone know about react native braintree
hal0o0o0
@hal0o0o0
Feb 28 2018 14:42
hello everybody! does anyone knows how to add img-responsive class?
Kyle Holm
@thekholm80
Feb 28 2018 14:42
just like any other class class='img-responsive'
hal0o0o0
@hal0o0o0
Feb 28 2018 14:43
thank you so much! i'll try it!
<img class="responsive" src="/images/running-cat.jpg">
how about this?
Kyle Holm
@thekholm80
Feb 28 2018 14:46
class="responsive" and class="img-responsive" are not the same
hal0o0o0
@hal0o0o0
Feb 28 2018 14:47
oh my fault! correct it soon!
Ismail Hozain
@ismailhozain
Feb 28 2018 15:03
hey folks, need a CSS animation genius here.How do i make it to where my thing leaves a trace when it moves similar to this https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR22Sb7TL9QJyIv6FRYHukhnbLs6-B7vbyx76zADijaJpU_R-_22Q
that is what i want to achieve.Here is my pen--->https://codepen.io/ismailhozain/pen/LQMawJ
Sweet Coding :)
@SweetCodingInc
Feb 28 2018 15:05
@thekholm80 Ser Kyle :wave:
Kyle Holm
@thekholm80
Feb 28 2018 15:05
@SweetCodingInc hey buddy, you're up early
Sweet Coding :)
@SweetCodingInc
Feb 28 2018 15:05
Yo! I'm up early everyday... :laughing:
Kyle Holm
@thekholm80
Feb 28 2018 15:05
i'm sorry
Sweet Coding :)
@SweetCodingInc
Feb 28 2018 15:06
sorry for what?
lol
Kyle Holm
@thekholm80
Feb 28 2018 15:06
sleep > everything
Sweet Coding :)
@SweetCodingInc
Feb 28 2018 15:06
haha.. I had plenty

function gym(){
  return "SweetCodingInc";
}
const whosOnGitter = morning()
.then(gym);

console.log(whosOnGitter);
guess the output
Kyle Holm
@thekholm80
Feb 28 2018 15:08
exhaustion?
Sweet Coding :)
@SweetCodingInc
Feb 28 2018 15:11
:laughing:
nah... Whoever told you that working out exhausts you must be someone who never worked out
Kyle Holm
@thekholm80
Feb 28 2018 15:12
just thinking about it makes me exhausted
Sweet Coding :)
@SweetCodingInc
Feb 28 2018 15:13
lmao
alpox
@alpox
Feb 28 2018 15:38
@SweetCodingInc The output is a promise :x
Sweet Coding :)
@SweetCodingInc
Feb 28 2018 15:40
@alpox smart! :laughing:
many people say the return value of gym function
alpox
@alpox
Feb 28 2018 15:51
Well, people which are not familiar with promises :D
Sweet Coding :)
@SweetCodingInc
Feb 28 2018 16:07
which is many :laughing:
Supra01
@Supra01
Feb 28 2018 16:43
@ezioda004 e.preventDefault(); worked! Thanks again! .... Why does this work lol? And is it normal for people to use this when a form has no back end to send to it?
CamperBot
@camperbot
Feb 28 2018 16:43
:cookie: 486 | @ezioda004 |http://www.freecodecamp.org/ezioda004
supra01 sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
Aditya
@ezioda004
Feb 28 2018 17:00
@Supra01 Actually it prevents the default action, if you're submitting form, using prevntDefault() will stop from submitting form.
Supra01
@Supra01
Feb 28 2018 17:10
@ezioda004 :+1:
Phuong Tran
@ptran0089
Feb 28 2018 18:45
Hey everyone, so I am trying to start the full stack book trading app project. Any tips?
I think I should implement a server API? But how do I prevent just anyone from making requests to the API and altering the database?
Christopher McCormack
@cmccormack
Feb 28 2018 18:53
@ptran0089 don't give access to alter the database :)
You can use passport for authentication
Phuong Tran
@ptran0089
Feb 28 2018 18:59
@cmccormack Ok that makes sense. What was I thinking? Too early in the morning
@cmccormack Thanks
CamperBot
@camperbot
Feb 28 2018 18:59
ptran0089 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1353 | @cmccormack |http://www.freecodecamp.org/cmccormack
denis1006
@denis1006
Feb 28 2018 19:43
hi
<p class="red-text">Kitty ipsum dolor sit amet, shed everywhere shed everywhere
<a herf="http://freecatphotoapp.com"> cat photos
</a>
stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
You need an a element that links to http://freecatphotoapp.com
what am i doing wrong?
Aditya
@ezioda004
Feb 28 2018 19:50
@denis1006 Which challenge is it?
LydaTech
@lydatech
Feb 28 2018 19:58
@ptran0089 be careful with copyrighted material
Stephen James
@sjames1958gm
Feb 28 2018 20:42
@denis1006 herf vs. href
Albert Cardona II
@daddycardona
Feb 28 2018 22:54
what up everyone ;)
what @sjames1958gm said :)
Kyle Holm
@thekholm80
Feb 28 2018 22:55
@daddycardona hey man
Albert Cardona II
@daddycardona
Feb 28 2018 22:55
I am forgetting everything I learn thanks to this electronics class
Kyle Holm
@thekholm80
Feb 28 2018 22:56
that means you get to learn it again! lucky
Albert Cardona II
@daddycardona
Feb 28 2018 22:57
I even had an answer for you on the two way diodes. However, I forgot it again, but I will soon be studying it, they called zener diodes :)
I am literally on that section in my modules ;)
pronounced Zee ner
Kyle Holm
@thekholm80
Feb 28 2018 22:58
yeah, they flow both ways
pretty neat
Albert Cardona II
@daddycardona
Feb 28 2018 23:02
they flow both ways but prevent or slow down the certain function. I believe they are used like this. A car battery uses it force to start up a car and then runs the radio and all the electronic coponets. So it initiated the charge for the car and the sparks so that the spark plugs etc.. use. One way flow, then it allows the alternater to charge it but keeps the flow at a certain level only allowing it to send back enough energy to charge it so will not overload ;)
that is the best eplenation for them right now in my brain housing group lol
explanation lol
Kyle Holm
@thekholm80
Feb 28 2018 23:03
i used to build vape stuff and I'd use the zener diodes to step down voltage for low amperage switches
Albert Cardona II
@daddycardona
Feb 28 2018 23:05
yeah so you already knew
Kyle Holm
@thekholm80
Feb 28 2018 23:05
but now you know too!
Albert Cardona II
@daddycardona
Feb 28 2018 23:05
you just trying to mess with my head
Kyle Holm
@thekholm80
Feb 28 2018 23:05
we're knowledge buddies!
Albert Cardona II
@daddycardona
Feb 28 2018 23:06
lmao yeah you got me wanting to know the answer now I feel dumb you already knew lol
I wanted to sound smart but now I just feel minute lol
lmao
Kyle Holm
@thekholm80
Feb 28 2018 23:06
you did sound smart
learning stuff is awesome
Albert Cardona II
@daddycardona
Feb 28 2018 23:08
awesome I am just messing with you
Kyle Holm
@thekholm80
Feb 28 2018 23:08
:D
Albert Cardona II
@daddycardona
Feb 28 2018 23:09
I pass 2 certifications test DC and AC.
DC was easy but AC was a pain it has alot of verbage lol I literally was slep running lol
Kyle Holm
@thekholm80
Feb 28 2018 23:10
how far into the course are you? is this a short program or do you still have a ways to go?
Albert Cardona II
@daddycardona
Feb 28 2018 23:11
its a 5 month program literally just electronic technician type jobs it will help me get ;)
they help find me a job too ;)
Kyle Holm
@thekholm80
Feb 28 2018 23:11
you'll make good money, too
and be doing something fun
Albert Cardona II
@daddycardona
Feb 28 2018 23:11
like 20 an hour
I hope but since I am a head of the program modules I will be using a PLC
programmable logistic control
Manish Giri
@Manish-Giri
Feb 28 2018 23:12
@daddycardona :wave:
howdy
Albert Cardona II
@daddycardona
Feb 28 2018 23:12
and I would write some c commands :)
hey brother how are you ;)
Manish Giri
@Manish-Giri
Feb 28 2018 23:12
not too bad
you?
Kyle Holm
@thekholm80
Feb 28 2018 23:13
i'd love to get an arduino or something like that and learn how to build stuff
Albert Cardona II
@daddycardona
Feb 28 2018 23:13
I am good @Manish-Giri and you can easily you're a lot smarter than I
Kyle Holm
@thekholm80
Feb 28 2018 23:14
lol i doubt it
Albert Cardona II
@daddycardona
Feb 28 2018 23:15
if you can grasp concepts @thekholm80, like using filter() and the rest of the m ;)
Kyle Holm
@thekholm80
Feb 28 2018 23:16
some day when i'm sufficiently motivated i'll probably grab one and give it a try
i bet youtube is full of tutorials
Albert Cardona II
@daddycardona
Feb 28 2018 23:16
yes they are I am going to watch some of them vids too LOL
Manish Giri
@Manish-Giri
Feb 28 2018 23:17
@daddycardona teach me C when you get to that part
Albert Cardona II
@daddycardona
Feb 28 2018 23:17
i bet you can learn faster with tutorials lol
besides the c scripts I will be doing will be all predefine and I can only use them lol
Manish Giri
@Manish-Giri
Feb 28 2018 23:19
C is fun
Albert Cardona II
@daddycardona
Feb 28 2018 23:20
I think my main problem with languages is I don't know what I want to do with them
then changing what I want to do with them from english to a language
Kyle Holm
@thekholm80
Feb 28 2018 23:22
i'm looking through all the C language memes, it doesn't inspire me to want to learn C
Albert Cardona II
@daddycardona
Feb 28 2018 23:23
is visual c++ still a thing lol
Kyle Holm
@thekholm80
Feb 28 2018 23:23
i'm pretty sure I did some C in CS50, but all i can remember is being annoyed that I couldn't declare & call functions
Albert Cardona II
@daddycardona
Feb 28 2018 23:24
function func(){}
Kyle Holm
@thekholm80
Feb 28 2018 23:24
so maybe i don't remember anything
pretty normal
Manish Giri
@Manish-Giri
Feb 28 2018 23:25
if you're calling a function before it's been defined
you just have to write out it's method signature up front (I think)
Albert Cardona II
@daddycardona
Feb 28 2018 23:25
yeah but that might be C++ I know you have to declare variables in C++ like int = 123 and double and so forth
Manish Giri
@Manish-Giri
Feb 28 2018 23:25
like void sayHello(int a, int b)
Albert Cardona II
@daddycardona
Feb 28 2018 23:26
yeah i forgot about the void
and you use those if you don't have a return statement or something like that
Kelechi Chinaka
@ke1echi
Feb 28 2018 23:27
:wave: guys
Kyle Holm
@thekholm80
Feb 28 2018 23:27
@kelechy :wave:
Kelechi Chinaka
@ke1echi
Feb 28 2018 23:27
done with scratch part? @Manish-Giri
Manish Giri
@Manish-Giri
Feb 28 2018 23:27
:wave:
Albert Cardona II
@daddycardona
Feb 28 2018 23:27
type functionName( type [argname] [, type, ...] );
hey :wave:
Kyle Holm
@thekholm80
Feb 28 2018 23:28
Manish Giri
@Manish-Giri
Feb 28 2018 23:28
@kelechy I kinda figured out what I wanted to do, but no further progress lol
Kelechi Chinaka
@ke1echi
Feb 28 2018 23:28
what are you working on now @thekholm80
Kyle Holm
@thekholm80
Feb 28 2018 23:28
@kelechy i'm trying to build a gitter clone with graphql so i can learn about subscriptions
Kelechi Chinaka
@ke1echi
Feb 28 2018 23:29
you could just jot it down move onto pset and do ut later :smile: @Manish-Giri
Kyle Holm
@thekholm80
Feb 28 2018 23:29
and maybe sharpen my UI skills from terrible to mostly bad
Albert Cardona II
@daddycardona
Feb 28 2018 23:29
I want to build a ad blocker for chrome etc..
Kyle Holm
@thekholm80
Feb 28 2018 23:30
if you make one better than ublock origin i'll use it
Kelechi Chinaka
@ke1echi
Feb 28 2018 23:30
:smile: oh nice @thekholm80
Manish Giri
@Manish-Giri
Feb 28 2018 23:32
@kelechy I'll do it tonight, I was planning to be up overnight anyway
Albert Cardona II
@daddycardona
Feb 28 2018 23:32
its just for learning how to script better not really to be better than someone who is already good at it lol
Kyle Holm
@thekholm80
Feb 28 2018 23:33
don't sell yourself short, you don't know how good it will be until you try
Albert Cardona II
@daddycardona
Feb 28 2018 23:34
yeah I am goint to have to learn from tutorials and docs lmao
going
I can't spell going right how can I make a app lmao
Kyle Holm
@thekholm80
Feb 28 2018 23:36
i've been reading about writing my own kernal, it's pretty intimidating. I'm amazed by how many really great resources there are for it though
Albert Cardona II
@daddycardona
Feb 28 2018 23:37
yes I seen many good resources for making a app for chrome or an extension
/* function returning the max between two numbers */
int max(int num1, int num2) {

   /* local variable declaration */
   int result;

   if (num1 > num2)
      result = num1;
   else
      result = num2;

   return result; 
}
here is how you make a function without using void in C you must use the return type like int double etc..
Kyle Holm
@thekholm80
Feb 28 2018 23:38
google is killing chrome apps :(
Albert Cardona II
@daddycardona
Feb 28 2018 23:38
why?
Kyle Holm
@thekholm80
Feb 28 2018 23:38
at least that's what postman tells me every time i open it
Albert Cardona II
@daddycardona
Feb 28 2018 23:41
good thing extenstions are still good lol
Kyle Holm
@thekholm80
Feb 28 2018 23:42
i'd quit using chrome if they got rid of the extensions
Albert Cardona II
@daddycardona
Feb 28 2018 23:42
i don't think I use apps on chrome much either
i use adblock for estensions not much else though
Kyle Holm
@thekholm80
Feb 28 2018 23:43
image.png
Albert Cardona II
@daddycardona
Feb 28 2018 23:44
is that react extension
Kyle Holm
@thekholm80
Feb 28 2018 23:44
the one on the left is the react dev tools
Albert Cardona II
@daddycardona
Feb 28 2018 23:45
nice I wanted to get in to react but slowly am getting by with what I learned so far and been like too tired to care about learning more at this moment but now I want to go look at a video about extensions lol
Kyle Holm
@thekholm80
Feb 28 2018 23:45
lol
react is very cool but there's a pretty steep learning curve
i haven't tried the react lessons on beta yet, they might be a good way to go
Albert Cardona II
@daddycardona
Feb 28 2018 23:46
well I guess I will go do that then I will create my own github repo and learn some command line stuff for it
Manish Giri
@Manish-Giri
Feb 28 2018 23:46
i'm using Opera atm
Albert Cardona II
@daddycardona
Feb 28 2018 23:46
I am a video junkie I don't get things just by reading so I read and look for an explanation to make sure I get it
Manish Giri
@Manish-Giri
Feb 28 2018 23:46
somehow it's blazing fast, and it also has its own ad blocker built in
Albert Cardona II
@daddycardona
Feb 28 2018 23:47
I hate oopera lol
opera
Kyle Holm
@thekholm80
Feb 28 2018 23:47
i'm going to switch back to Netscape Navigator
Albert Cardona II
@daddycardona
Feb 28 2018 23:47
LMAO
I have not used opera in years though lol
I like edge it seems to be faster for me too ;) but I still use chrome for the most part