These are chat archives for FreeCodeCamp/Help

23rd
Oct 2017
David Chen
@Obiwan777
Oct 23 2017 01:22

hi guys , quick C question
I have

void getNumbers(struct Numbers *);

in my .h file
and in my .c file
I have

void getNumbers(struct Numbers *){
some codes here
}

but it gives me an error, unnamed prototype parameters not allowed when body is present. expect a formal parameter list, not a type list
anyone know what's wrong

Bashir Harrell
@bookofbash
Oct 23 2017 01:58
I have been working though the backend, and none of this node/express stuff seems to be making any sense even if i solve the problem. Did anyone else have a similar experience?
Manish Giri
@Manish-Giri
Oct 23 2017 02:48
@heroiczero @DarrenfJ @thekholm80 @GitHub-Henry ty :star: :cookie:
CamperBot
@camperbot
Oct 23 2017 02:48
manish-giri sends brownie points to @heroiczero and @darrenfj and @thekholm80 and @github-henry :sparkles: :thumbsup: :sparkles:
:star2: 1528 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 2166 | @darrenfj |http://www.freecodecamp.com/darrenfj
:cookie: 408 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 1926 | @heroiczero |http://www.freecodecamp.com/heroiczero
Thanh Son Nguyen
@nguyen-thanhson
Oct 23 2017 02:59
guys I need help
this is my pomo clock
in chrome the alarm is triggered everytime the timer reaches zero
but not in safari. How's that possible?
Kyle Holm
@thekholm80
Oct 23 2017 03:22
@Manish-Giri ty sir. and @heroiczero @DarrenfJ
CamperBot
@camperbot
Oct 23 2017 03:22
thekholm80 sends brownie points to @manish-giri and @heroiczero and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1927 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 2167 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 6675 | @manish-giri |http://www.freecodecamp.com/manish-giri
Manish Giri
@Manish-Giri
Oct 23 2017 03:23
@thekholm80 haaalp
Kyle Holm
@thekholm80
Oct 23 2017 03:23
?
Manish Giri
@Manish-Giri
Oct 23 2017 03:23
dafuk.png
:point_up:
Kyle Holm
@thekholm80
Oct 23 2017 03:25
you mean the field names may not start with $?
Manish Giri
@Manish-Giri
Oct 23 2017 03:25
yea
Kyle Holm
@thekholm80
Oct 23 2017 03:26
i'm not sure what you're trying to do, I've not used the shell a whole lot
lemme look at the shell api docs
Manish Giri
@Manish-Giri
Oct 23 2017 03:27
i managed to fix that error
now the code is this
db.movies.aggregate([
    {
        $project: {
        titleLengths: {$split: ["title", " "]}
        }
    },
    { 
        $match : { titleLengths : { $size: 1 } }
    } 
]).itcount()
and it gives an answer that's not even in the options to select from
fml
what i'm trying to do is
Using the Aggregation Framework, find a count of the number of movies that have a title composed of one word. To clarify, "Cinderella" and "3-25" should count, where as "Cast Away" would not.
Kyle Holm
@thekholm80
Oct 23 2017 03:29
I see
have you tried hitting it with a hammer
?
Manish Giri
@Manish-Giri
Oct 23 2017 03:31
O.o
Manish Giri
@Manish-Giri
Oct 23 2017 03:42
dex.png
@thekholm80 I gots it
titleLengths: {$split: ["title", " "]} should have been titleLengths: {$split: ["$title", " "]}
heroiczero
@heroiczero
Oct 23 2017 03:59
@Manish-Giri @thekholm80 @sjames1958gm @khaduch @DarrenfJ @GitHub-Henry TY for coming to Help in the Chat :) @alpox @korzo
CamperBot
@camperbot
Oct 23 2017 03:59
heroiczero sends brownie points to @manish-giri and @thekholm80 and @sjames1958gm and @khaduch and @darrenfj and @github-henry and @alpox and @korzo :sparkles: :thumbsup: :sparkles:
:star2: 3397 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 8598 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1529 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:cookie: 655 | @korzo |http://www.freecodecamp.com/korzo
:cookie: 409 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 6676 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 1378 | @alpox |http://www.freecodecamp.com/alpox
:star2: 2168 | @darrenfj |http://www.freecodecamp.com/darrenfj
Ken Haduch
@khaduch
Oct 23 2017 04:13
@heroiczero - thanks for the thanks... and thanks!
CamperBot
@camperbot
Oct 23 2017 04:13
khaduch sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
api offline
Eric Miller
@ericmiller777
Oct 23 2017 04:14
learning more and more of react and it just seems to make writeing jsvascript more convuluted
Long Nguyen
@longnt80
Oct 23 2017 05:04
@ericmiller777 what do you mean?
Nazar
@IsaakNazar
Oct 23 2017 05:18
thx all
Darren
@DarrenfJ
Oct 23 2017 05:25
evening fCC
thanks @heroiczero back atcha! :D
CamperBot
@camperbot
Oct 23 2017 05:26
darrenfj sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1929 | @heroiczero |http://www.freecodecamp.com/heroiczero
Darren
@DarrenfJ
Oct 23 2017 05:26
and as well the usual suspects
thanks @Manish-Giri @thekholm80 @sjames1958gm @khaduch
CamperBot
@camperbot
Oct 23 2017 05:26
darrenfj sends brownie points to @manish-giri and @thekholm80 and @sjames1958gm and @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1530 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 3398 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 6677 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 8599 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Nazar
@IsaakNazar
Oct 23 2017 06:06
bot
cbot
CamperBot
@camperbot
Oct 23 2017 06:06
you called?
Nazar
@IsaakNazar
Oct 23 2017 06:07

there's an array arr = [20, 21, 22, 24];

for (var i = 0; i < arr.length; i++) {    
    if (arr[i]+1 != arr[i+1]) {
      return arr[i]+1
    }
  }

is it correct way to find missed number in array?

Darren
@DarrenfJ
Oct 23 2017 06:25
@IsaakNazar that does seem like it would return the value 1 greater than arr[i] if adding 1 to it didn't equal the next item in the array
Nazar
@IsaakNazar
Oct 23 2017 06:27
@DarrenfJ maybe smth like this?
var arr = [20,21,22,24]
var newar = [];
var missed;
  for (var i = 0; i < arr.length; i++) {
    newar.push(arr[i].charCodeAt());
    if (newar[i] - newar[i-1] != 1) {
      missed= newar[i]-1;
    }
  }
im trying to return 23
Darren
@DarrenfJ
Oct 23 2017 06:32
and it's not working?
you switched here from checking forward in the array (next index) to checking one behind
i don't think you need that chatCodeAt for the push statement
i guess you compare 'back' because yer pushing into the newar as you go
but I think you could still do something like the comparing the difference to 1 but using the existing array
Darren
@DarrenfJ
Oct 23 2017 06:38
if ( (arr[i+1] - arr[i]) !== 1) {
      missed= arr[i]+1;
    }
something like that
Nazar
@IsaakNazar
Oct 23 2017 06:50
@DarrenfJ thx
function fearNotLetter(str) {
  var arr =  str.split("");
  var newar = [];
  var missed;
  for (var i = 0; i < arr.length; i++) {
    newar.push(arr[i].charCodeAt());
    if (newar[i] - newar[i-1] != 1) {
      missed = String.fromCharCode(newar[i]-1);
    } else {
      missed = undefined;
    }
  }
  return missed;
}
console.log(fearNotLetter('abcdefghjklmno'));//returns undefined WTF
Darren
@DarrenfJ
Oct 23 2017 06:50
no worries.. thanks @IsaakNazar for the opportunity to help out
CamperBot
@camperbot
Oct 23 2017 06:50
darrenfj sends brownie points to @isaaknazar :sparkles: :thumbsup: :sparkles:
:cookie: 286 | @isaaknazar |http://www.freecodecamp.com/isaaknazar
Darren
@DarrenfJ
Oct 23 2017 06:52
have you console.logged to ensure that the newar is giving you the numeric value of the letter?
Nazar
@IsaakNazar
Oct 23 2017 06:53
@DarrenfJ you mean newar.push(arr[i].charCodeAt()); ?
yes
Darren
@DarrenfJ
Oct 23 2017 06:54
and it's giving the you numeric value?
@IsaakNazar what exercise is it?
wanna compare to what I tried
Nazar
@IsaakNazar
Oct 23 2017 06:55
@DarrenfJ
console.log(fearNotLetter('abce'));// returns d
console.log(fearNotLetter('abcdefghjklmno'));//returns undefined
Darren
@DarrenfJ
Oct 23 2017 06:55
@IsaakNazar side note: it's !== and not !=
Nazar
@IsaakNazar
Oct 23 2017 06:56
@DarrenfJ Missing letters
@DarrenfJ in any case !== or != result the same
Darren
@DarrenfJ
Oct 23 2017 07:10
@IsaakNazar ok played around and got it to work
simply switched the != to a >
not srue why the !== is not working but greater than seemed to fix it
anyhoo gotta sneak off to sleep...
have a good one
Nazar
@IsaakNazar
Oct 23 2017 07:12
@DarrenfJ ok thanks
CamperBot
@camperbot
Oct 23 2017 07:12
isaaknazar sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2169 | @darrenfj |http://www.freecodecamp.com/darrenfj
Henry
@GitHub-Henry
Oct 23 2017 08:58
@heroiczero @Manish-Giri @DarrenfJ hello, and thank you for the brownies
CamperBot
@camperbot
Oct 23 2017 08:58
github-henry sends brownie points to @heroiczero and @manish-giri and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2170 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 1930 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 6678 | @manish-giri |http://www.freecodecamp.com/manish-giri
Stephen James
@sjames1958gm
Oct 23 2017 10:00
@IsaakNazar The reason !== -1 did not work because for the first pass in the loop newar[i-1] is undefined (i = 0 so newar[-1] is undefined)
so number - undefined is NaN and
NaN > -1
false
but NaN != -1 is true
Nazar
@IsaakNazar
Oct 23 2017 10:32
@sjames1958gm wow thanx Stephen, another great explanation
CamperBot
@camperbot
Oct 23 2017 10:32
isaaknazar sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8600 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Oct 23 2017 10:34
@IsaakNazar :)
Nazar
@IsaakNazar
Oct 23 2017 10:35
@sjames1958gm are there good (shorter) way to the code below?
if ((/&/g).test(str)) str = str.replace(/&/g, "&amp;");
 if ((/</g).test(str)) str = str.replace(/</g, "&lt;");
 if ((/>/g).test(str)) str = str.replace(/>/g, "&gt;");
 if ((/'/g).test(str)) str = str.replace(/'/g, "&apos;");
 if ((/"/g).test(str)) str = str.replace(/"/g, "&quot;");
I tried to use switch statement, but the length of the code same
Stephen James
@sjames1958gm
Oct 23 2017 10:42
@IsaakNazar Well you don't need the .test part, the str.replace will only replace if there is a match.
Nazar
@IsaakNazar
Oct 23 2017 10:42
@sjames1958gm ok thanx :+1:
CamperBot
@camperbot
Oct 23 2017 10:42
isaaknazar sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
api offline
Giancarlo
@GCa
Oct 23 2017 11:54
Hello, sorry to bother you all. Is there anyone that could suggest me what I'm missing to claim the Front End Certificate? I seem to have completed all the challenges (the items marked with * ), but I'm blocked on the step 3 of the claim process, the error message tells me I haven't completed all the necessary steps.
mstellaluna
@mstellaluna
Oct 23 2017 12:13
@GCa make your GitHub account has your name as its where FCC populates your name to put on the certificate from, also you can send an email to team@freecodecamp.org , make sure to include your userID , the link to your profile and a screenshot of the error message if your getting one, someone will review it and get back to you on it.
Giancarlo
@GCa
Oct 23 2017 12:24
Thanks, will do that.
mstellaluna
@mstellaluna
Oct 23 2017 12:25
@GCa yea you can continue with FCC while you wait for a response, there is a large backlog of emails unfortunately :(
Giancarlo
@GCa
Oct 23 2017 12:26
oh, ok.

Just an information: are the advanced algorithms challenges needed for the Front End Certificate?

On my map they don't have an asterisk. I have completed the first one just to spend some tiem, and still no asterisk appears. Also, on the page where I can claim the certificate there is no mention of the advanced algorithms (while the basic and intermediate are mentioned).

Maybe there is a glitch and they are shown as not needed, while in reality I need to do them.

mstellaluna
@mstellaluna
Oct 23 2017 12:28
@GCa you only need the ones marked with *
Giancarlo
@GCa
Oct 23 2017 12:29
ok, then I guess I've done them all, I checked several times
screenshot1.png
mstellaluna
@mstellaluna
Oct 23 2017 12:31
it shouldn't... maybe try and do them and see if that works.. if it does I suggest open a PR issue that challenges marked with * aren't enough to claim the certificate even though that's the requirement
and put that screenshot with it
alpox
@alpox
Oct 23 2017 12:32
@GCa I don't think they are needed when they don't have an asterisk
mstellaluna
@mstellaluna
Oct 23 2017 12:32
they aren't, but he's blocked for some reason
hence my suggestion to just give it a try and then if it works to open a bug
alpox
@alpox
Oct 23 2017 12:35
@GCa Its 3/4 you have - there are also 4 sections which you have to fulfill - advanced is not one of them. I believe the error must be in another one
Giancarlo
@GCa
Oct 23 2017 12:38

(3/4) is the step of the process:

(1/4) is the introduction page for the certification claim process
(2/3) is to check items have not been plagiarized
(3/4) is to check if all the requirements have been fulfilled

and I guess (4/4) is the end of the process for the certificate claim

screenshot2.png
screenshot3.png
screenshot4.png
Thanks for your time guys :)
I really appreciate that.
I will go do the advanced ones, as suggested, and see what happens
Darren
@DarrenfJ
Oct 23 2017 14:09

@sjames1958gm good catch! thanks.. missed that one...

The reason !== -1 did not work because for the first pass in the loop newar[i-1] is undefined (i = 0 so newar[-1] is undefined)
so number - undefined is NaN and
NaN > -1
false
but NaN != -1 is true

CamperBot
@camperbot
Oct 23 2017 14:09
darrenfj sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8601 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Oct 23 2017 14:10
@DarrenfJ The use of index + 1 or index i -1 in a for loop is often a bug producer.
@DarrenfJ Also, learned:
NaN < -1
false
NaN == -1
false
NaN > -1
false
Darren
@DarrenfJ
Oct 23 2017 14:11
yah i try to avoid using the -1 or going in reverse in a loop unless i have to
Stephen James
@sjames1958gm
Oct 23 2017 14:11
NaN is in another plane of existence ;)
gishy1
@gishy1
Oct 23 2017 14:19
hello world !!!
need help
gishy1
@gishy1
Oct 23 2017 14:26
image.png
Tiago Correia
@tiagocorreiaalmeida
Oct 23 2017 14:27
you need to do first + the rest of the word
gishy1
@gishy1
Oct 23 2017 14:27
image.png
Chris
@bestintown23
Oct 23 2017 14:28
centering the image on this pen? https://codepen.io/bestintown23/pen/VMRgqY
Tiago Correia
@tiagocorreiaalmeida
Oct 23 2017 14:31
@gishy1
you can use lower[i].charAt(0).toUppercase() + lower[i].slice(1) to remove the first letter since you allreadty have it
and you can't set a variable evertime if you need to run an entirel oop
you need to keep setting the extra word to the existent sentence
Giancarlo
@GCa
Oct 23 2017 14:33
@gishy1 check the for loop. Isn't the condition in the for loop always true?
you have
for (var i=0; lower.lenght; i++)
the variable "i" will keep increasing until you go pointing at an undefined value
Stephen James
@sjames1958gm
Oct 23 2017 14:35
@bestintown23 You can use flexbox on your header tag.
  display:flex;
  justify-content: center;
  align-items: center;
Tiago Correia
@tiagocorreiaalmeida
Oct 23 2017 14:35
loveflex.com
gishy1
@gishy1
Oct 23 2017 14:36
@GCa yes just seen one part of the mistake
Chris
@bestintown23
Oct 23 2017 14:36
thanks @sjames1958gm
CamperBot
@camperbot
Oct 23 2017 14:36
bestintown23 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8602 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Oct 23 2017 14:37
@bestintown23 :+1:
Marc
@MWBauer
Oct 23 2017 14:56
Morning Mr. Stephen James
Stephen James
@sjames1958gm
Oct 23 2017 14:57
@MWBauer :wave: :coffee:
Marc
@MWBauer
Oct 23 2017 14:57
Thank you, sir. I can always go for a cuppa
How are you today?
:wave:
Stephen James
@sjames1958gm
Oct 23 2017 14:59
@MWBauer Good.
Yourself?
Marc
@MWBauer
Oct 23 2017 14:59
I'm alright. Working on the weather app
Clues on how to do changing backgrounds?
gishy1
@gishy1
Oct 23 2017 15:03
@MWBauer me 3
@MWBauer hold the milk mate
:smile:
Stephen James
@sjames1958gm
Oct 23 2017 15:03
@MWBauer $("html").css("background-image", 'url(${imageUrl})'); (those should be backticks around the url(${imageUrl}) part
where imageUrl is a variable holding the url
Marc
@MWBauer
Oct 23 2017 15:05
Ok. so the imageUrl is the pic for the weather. I need to have a number of pics available
is imageUrl a var that changes with the temp?
Stephen James
@sjames1958gm
Oct 23 2017 15:08
@MWBauer Yes. or with the type of weather. I used an object where the keys were weather types and the values were URLs
Marc
@MWBauer
Oct 23 2017 15:10
Ok. I need to work on that.
I should put that in my body css
Marc
@MWBauer
Oct 23 2017 15:19
@sjames1958gm I have a few pics
How would I setup the values like you mentioned?
gishy1
@gishy1
Oct 23 2017 15:21
@sjames1958gm mate have a look its not iterating the rest of the word
image.png
Stephen James
@sjames1958gm
Oct 23 2017 15:22
@MWBauer Here is how I did it.
  images: {
    clear: "https://icons.wxug.com/data/wximagenew/n/noneinc/10023-thumb250.jpg",
    clouds: "https://icons.wxug.com/data/wximagenew/e/elcondomondo/2-thumb250.jpg",
    rain: "https://icons.wxug.com/data/wximagenew/d/Doesiedoats/6118-thumb250.gif"
  }
Marc
@MWBauer
Oct 23 2017 15:23
Ok. Thanks.
Stephen James
@sjames1958gm
Oct 23 2017 15:23
@gishy1 Be careful returning inside a for loop or you will not get any looping.
gishy1
@gishy1
Oct 23 2017 15:23
@sjames1958gm if i try returning out of it it tells me out of scope
Stephen James
@sjames1958gm
Oct 23 2017 15:23
@gishy1 var completedWord[i] this is invalid syntax.
gishy1
@gishy1
Oct 23 2017 15:24
@sjames1958gm why?
what do i do then
Stephen James
@sjames1958gm
Oct 23 2017 15:24
@gishy1 You need to use a variable outside of the for loop that you update and return after the for loop
gishy1
@gishy1
Oct 23 2017 15:25
so complete word would go outside the loop ?
Stephen James
@sjames1958gm
Oct 23 2017 15:25
@gishy1 You cannot defined a variable with a index. cannot use var and [i] at the same time.
You could even just replace the word back into lower[i]
gishy1
@gishy1
Oct 23 2017 15:28
@sjames1958gm thats another thing thats been eluding me
the variable in the global scope and how you update it
Stephen James
@sjames1958gm
Oct 23 2017 15:28
lower[i] = first + second
Don't use [i] on first or second
@gishy1 Not in the global scope, local to the function, but outside the for loop
Sort of this structure.
function foo() {
   var bar = [];
   for () {
      bar.push(something);
   }
   return bar;
}
gishy1
@gishy1
Oct 23 2017 15:31
@sjames1958gm you just said lower[i] is an invalid syntax :\
image.png
Stephen James
@sjames1958gm
Oct 23 2017 15:34
@gishy1 No, I said var with [i] is invalid syntax var completedWord[i] is invalid.
but without the var it is ok.
don't use [i] on first or second - just first + second
gishy1
@gishy1
Oct 23 2017 15:37
so where should i declare the completeWord
Tiago Correia
@tiagocorreiaalmeida
Oct 23 2017 15:38
outside the loop
oh wait you did nm
you could use slice to do the job here or chartat
you dont need both
you could slice the letter on first element and remove 1 liek .slice(0,1)
or you can use chartAt(0)
one of them not both
another thing if you want to slice from a point unthil the end you only need to set the start like omn the second variable you would need to say slice(1) to remove out the first value
Stephen James
@sjames1958gm
Oct 23 2017 15:41
@gishy1 But shouldn't that be completedWords ? There are more than one word. So maybe an array to put the completed words into.
Tiago Correia
@tiagocorreiaalmeida
Oct 23 2017 15:41
and keep the rest of the string
he can jump keep variable += values
something like that
test those first then things will be easier
gishy1
@gishy1
Oct 23 2017 15:55
@sjames1958gm @tiagocorreiaalmeida
image.png
its still not working out
Stephen James
@sjames1958gm
Oct 23 2017 15:56
@gishy1 What is first[i] and second[i] ?
completedWord = this will just write the last word into completedWord and not get all the words
gishy1
@gishy1
Oct 23 2017 15:58
@sjames1958gm first[i] +second[i] is me trying to add the capitalised first word and adding i0t to the rest of the word
Giancarlo
@GCa
Oct 23 2017 15:58
completeWord should be a string, initialize it as
completeWord='';
Stephen James
@sjames1958gm
Oct 23 2017 15:58
@gishy1 But why are you using [i] with first or second - [i] is for indexing lower
gishy1
@gishy1
Oct 23 2017 16:00
@GCa you mean without the []?
Stephen James
@sjames1958gm
Oct 23 2017 16:00
first is the first letter and second is the rest of the word
first + second
is the reconstructed word
gishy1
@gishy1
Oct 23 2017 16:01
@sjames1958gm yes but i thought if i dont run a loop through it will not complete all of the strings
Stephen James
@sjames1958gm
Oct 23 2017 16:02
@gishy1 The loop is fine, but you have build up the result from each pass through the loop.
Giancarlo
@GCa
Oct 23 2017 16:02

@gishy1 in the picture I see
var completeWord=0;
but if you are trying to build a string, it would be better to use
var completeWord=''; (two ' )

Then in the for loop you can add the capitalized words to the variable completeWord using the += operator

Tiago Correia
@tiagocorreiaalmeida
Oct 23 2017 16:03
plus this wont do anything at all mate
slice().chartAt();
pls try what I just sent you use it platy with it you only need one of the methods but neither of them work this way
gishy1
@gishy1
Oct 23 2017 16:05
@tiagocorreiaalmeida i tried charAt () without the loop it sliced the first word and capititalised
copy and try and run it
without the loop
Marc
@MWBauer
Oct 23 2017 16:10
@sjames1958gm You only used those 3 pics?
Stephen James
@sjames1958gm
Oct 23 2017 16:11
@MWBauer Yeah. Design is not my forte'
Marc
@MWBauer
Oct 23 2017 16:11
That's fine. I have pics for fog, rain, cool, cold, hot, clear....
lol
I just need to learn how to work it all in.
that image { that you setup was in CSS?
Stephen James
@sjames1958gm
Oct 23 2017 16:19
@MWBauer No, it was a 'global' object in my js
Marc
@MWBauer
Oct 23 2017 16:20
js. thanks
Chris
@bestintown23
Oct 23 2017 16:32
how can i resize my email logo in my row of icons? https://codepen.io/bestintown23/pen/VMRgqY
Jake
@JakeDVirus
Oct 23 2017 17:06
Is there anything wrong in this snippet?? just wana confirm
@mixin background-2x($path, $ext: "png", $w: auto, $h: auto, $pos: left top, $repeat: no-repeat) {

  $at1x_path: "#{$path}.#{$ext}";
  $at2x_path: "#{$path}@2x.#{$ext}";

  background-image: url("#{$at1x_path}");
  background-size: $w $h;
  background-position: $pos;
  background-repeat: $repeat;

  @media only screen and (-webkit-min-device-pixel-ratio : 1.5),
   only screen and (-o-min-device-pixel-ratio: 3/2),
   only screen and (min--moz-device-pixel-ratio: 1.5),
   only screen and (min-device-pixel-ratio: 1.5),
   only screen and (min-resolution: 144dpi) {
    background-image: url("#{$at2x_path}"); 
  }

  @media only screen and (-webkit-min-device-pixel-ratio : 2.5),
   only screen and (-o-min-device-pixel-ratio: 5/2),
   only screen and (min--moz-device-pixel-ratio: 2.5),
   only screen and (min-device-pixel-ratio: 2.5),
   only screen and (min-resolution: 216dpi) {
    background-image: url("#{$at2x_path}"); 
  }
}
Chris
@bestintown23
Oct 23 2017 17:08
How can i place the text to be center underneath each image? https://codepen.io/bestintown23/pen/VMRgqY
Marc
@MWBauer
Oct 23 2017 17:30
What's the point of telling Firefox what page I want as my homepage if it isn't going to go there when I open a tab?
Sorin Ruse
@sorinr
Oct 23 2017 17:33
@bestintown23 if you are using figcaption tag why not use the semantic tag: figure
Marc
@MWBauer
Oct 23 2017 17:37
@sjames1958gm I was just looking at the challenge in FCC and it gives the weather api.
I open it and I'm not absolutely sure what I'm looking at.
Do I copy that whole thing into JS?
Stephen James
@sjames1958gm
Oct 23 2017 17:37
Marc
@MWBauer
Oct 23 2017 17:38
I saw that.
Stephen James
@sjames1958gm
Oct 23 2017 17:39
@MWBauer You'll want to use the browser api for getting location
Then you can plug the lat/lon into the URL https://fcc-weather-api.glitch.me/api/current?lat=35&lon=139
Then using AJAX, either native browser API or jquery you can request the data.
That page shows the same json/js object returned
@MWBauer You can plug that URL above into your browser address bar and see the data that will be returned.
Marc
@MWBauer
Oct 23 2017 17:40
oh...goody. Ok....
lol
Stephen James
@sjames1958gm
Oct 23 2017 17:47
@MWBauer You can do it. :)
Chris
@bestintown23
Oct 23 2017 17:51
why is my h2 element looking kookoo? https://codepen.io/bestintown23/pen/VMRgqY
Sorin Ruse
@sorinr
Oct 23 2017 17:52
@bestintown23 example
Chris
@bestintown23
Oct 23 2017 17:54
@sorinr you took out my h2 element
Sorin Ruse
@sorinr
Oct 23 2017 17:57
@bestintown23 nope. just transformed your <div class="icons1" id="phone"> into <figure> and the example its just a fork of your original
@bestintown23 and added some css
@bestintown23 thats all i've done
@bestintown23 my post above was intended to complete with an example the other post :point_up: October 23, 2017 8:33 PM
Chris
@bestintown23
Oct 23 2017 18:00
@sorinr well i was looking to move my h2 element under my icons, any suggestions?
Sorin Ruse
@sorinr
Oct 23 2017 18:03
@bestintown23 try reload the example :point_up: October 23, 2017 8:52 PM
clinton wambugu
@kwambugu
Oct 23 2017 18:59
hi guy having a problem with google home page project
guys
kwambugu/googl-homepage
in GH
the "about and store" links keep moving to the rigth instead of left
Joshua Arnett
@josha5
Oct 23 2017 19:15
Can anyone help me with my tic tac toe AI?
Tim Bakker
@ixava
Oct 23 2017 19:20
Sure I can help you out if you send me a pm
Xapuu
@Xapuu
Oct 23 2017 19:51
Hello guys can someone help me with some React magic, i'm have some trouble with calling functions in functions
Kaz Baig
@kbaig
Oct 23 2017 19:52
@Xapuu what's up
Xapuu
@Xapuu
Oct 23 2017 19:53
@kbaig can you take a look at this https://pastebin.com/etLJ65KD , on line 20 i want to invoke a function that should return a string depending on passed prop, but i cant make it work :D
Kaz Baig
@kbaig
Oct 23 2017 19:56
@Xapuu what is the error you are getting
Xapuu
@Xapuu
Oct 23 2017 19:59
@kbaig Actually if i remove the .bind from line 20 i get no errors, but im also not receiving the desired output from the 's' function, when i render the element it just displays 'Hello'
Kaz Baig
@kbaig
Oct 23 2017 20:00
@Xapuu Are you saying removing bind makes it so that the first div is not rendered at all, or that the first div just renders 'Hello'
Also, what did you want bind for? I don't think there is a bind property on strings
Xapuu
@Xapuu
Oct 23 2017 20:02
@kbaig :D im new to react so i just tried to see if the bind will do the magic, so without it just displays the 2 div-s without the string that is expected to be returned from the 's' function
working fine for me
All I did was remove bind
You still haven't told me if you're getting an error in the console tho so idk what the problem could be
Xapuu
@Xapuu
Oct 23 2017 20:07
I also removed the div, and i dont get any errors, the thing that i want to happen is to get beside the first 'Hello' a string 'Im |' or 'Im : )' or 'im :|', that should be returned form the 's' function in DemoFunc component
@kbaig i just want to display in the first div the result from the 's' function somehow.
Kaz Baig
@kbaig
Oct 23 2017 20:08
oh I see what you're saying
@Xapuu you are passing props.mood into s but s is expecting props
Xapuu
@Xapuu
Oct 23 2017 20:13
@kbaig God bless you mate :D i didn'd expect that there will be such a noob mistake on my side :D
Ashley
@Ashtheyogi
Oct 23 2017 20:16
what happened to the chat feature on freecodecamp?
??
Coy Sanders
@coymeetsworld
Oct 23 2017 20:17
They removed it some time ago, in an attempt to get more people using forum and reduce the overall noise
I think they're going to put it back in when the beta is finished, or so I've heard
Kyle Holm
@thekholm80
Oct 23 2017 20:18
that will be nice
Ashley
@Ashtheyogi
Oct 23 2017 20:18
ooo thanks @coymeetsworld
CamperBot
@camperbot
Oct 23 2017 20:18
ashtheyogi sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 3004 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Kyle Holm
@thekholm80
Oct 23 2017 20:18
although, the tumbleweeds rolling through here are nice too
Coy Sanders
@coymeetsworld
Oct 23 2017 20:18
I could just go on our local slack channel for that @thekholm80 :)
Ashley
@Ashtheyogi
Oct 23 2017 20:18
quick question. I keep getting marked wrong in this javascript puzzle. here is my code: ```
```
wait how do I show it again?
Kyle Holm
@thekholm80
Oct 23 2017 20:19
@coymeetsworld haha i have seen the tumbleweeds there, too
Xapuu
@Xapuu
Oct 23 2017 20:19
thanks @kbaig
CamperBot
@camperbot
Oct 23 2017 20:19
xapuu sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 366 | @kbaig |http://www.freecodecamp.com/kbaig
Coy Sanders
@coymeetsworld
Oct 23 2017 20:19
just copy and paste @Ashtheyogi, if you can put the ``` between the code that would be easier to read
Kyle Holm
@thekholm80
Oct 23 2017 20:19
@Ashtheyogi
```
paste your code
```
Ashley
@Ashtheyogi
Oct 23 2017 20:19
var b = 7; var a = 7; a = b;
but it keeps saying that I need to make var a = var b
but when I put that in the editor it gets marked as wrong
Coy Sanders
@coymeetsworld
Oct 23 2017 20:20
yes you don't want to set a to 7
the last 2 statements you need to combine together
Ashley
@Ashtheyogi
Oct 23 2017 20:20
so should it look like this? var b= 7; var a = var b;
Coy Sanders
@coymeetsworld
Oct 23 2017 20:20
in a way. a = b at the end doesn't really do anything since a and b are already 7
you only declare a variable once
but yeah that is closer to the idea
Ashley
@Ashtheyogi
Oct 23 2017 20:21
its still getting marked as wrong
Kaz Baig
@kbaig
Oct 23 2017 20:21
no you would only want to write var once for each variable. This is called declaring the variable.
So I declare var b with a value of 7: var b = 7
now, when I want to refer to the variable b, I simply need to write b
Ashley
@Ashtheyogi
Oct 23 2017 20:22
ok so do I not put anything as var = a
Kaz Baig
@kbaig
Oct 23 2017 20:22
I want to create a new variable a that has the same value as that of b
So I declare a new variable a by writing var a, and assign it a value at the same time by writing var a = b
Ashley
@Ashtheyogi
Oct 23 2017 20:23
var b = 7; var a; var a = b;
Kaz Baig
@kbaig
Oct 23 2017 20:23
you're declaring a twice aren't you
Ashley
@Ashtheyogi
Oct 23 2017 20:24
even when I post it as this var b = 7; var a = b; it is still being marked wrong
Kaz Baig
@kbaig
Oct 23 2017 20:24
Can you link the problem?
thanks @kbaig check it out, tell me what you think
CamperBot
@camperbot
Oct 23 2017 20:25
:cookie: 367 | @kbaig |http://www.freecodecamp.com/kbaig
ashtheyogi sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
Kaz Baig
@kbaig
Oct 23 2017 20:26
@Ashtheyogi See we didn't know that a and b are already defined in that problem so you do not need to use the var keyword to define them again
So you simply need to assign the values, you do not need to declare them
Ashley
@Ashtheyogi
Oct 23 2017 20:27
im trying to understand the difference between defining and declaring
Kaz Baig
@kbaig
Oct 23 2017 20:27
same thing
Ashley
@Ashtheyogi
Oct 23 2017 20:27
current code var a = 7; var b = 7;
alpox
@alpox
Oct 23 2017 20:28
@Ashtheyogi Looks right
Kaz Baig
@kbaig
Oct 23 2017 20:28

If I type

var a = 1;
var a = 2;

I will get an error saying a is already defined. Defined/declared mean the same thing

Above where you have to write your solution, a and b are already declared:
var a;
var b = 2;
Ashley
@Ashtheyogi
Oct 23 2017 20:29
ok?
Kaz Baig
@kbaig
Oct 23 2017 20:29
So all you have to do is change the value of each variable. You don't have to define them again.
alpox
@alpox
Oct 23 2017 20:29
@kbaig Linguistic philosophy: Doesn't declared refer to the action and defined to the state of the definition? :D
Ashley
@Ashtheyogi
Oct 23 2017 20:30
im still confused, I'm not sure what they are asking of me
Kaz Baig
@kbaig
Oct 23 2017 20:30
@alpox Yes but semantically they mean the same thing here
Coy Sanders
@coymeetsworld
Oct 23 2017 20:30
@Ashtheyogi instead of setting b to the value 7, set b to a (whose value is currently 7)
you shouldn't only write the number 7 once in your code
Ashley
@Ashtheyogi
Oct 23 2017 20:30
oh ok I see
Kaz Baig
@kbaig
Oct 23 2017 20:31
You change the value of variable x that has already been defined elsewhere by simply writing:
x = 10
Ashley
@Ashtheyogi
Oct 23 2017 20:31
I wrote var b = 7; and then tried to make var a = var b; it was the other way around
so specific!
thanks @kbaig
CamperBot
@camperbot
Oct 23 2017 20:31
ashtheyogi sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
api offline
Kaz Baig
@kbaig
Oct 23 2017 20:32
You weren't supposed to use var though...
I guess this early is too early to explain?
Kyle Holm
@thekholm80
Oct 23 2017 20:33
var x = 'Hi';
var y = 'Hello';

x = y;  // x is now 'Hello'
Surya Singh
@surya4
Oct 23 2017 21:12
// Google+ Login
passport.use(new GoogleStrategy({
    clientID: process.env.GOOGLE_ID,
    clientSecret: process.env.GOOGLE_SECRET,
    callbackURL: '/auth/google/callback',
    passReqToCallback: true
}, function(req, accessToken, refreshToken, profile, done) {
    if (req.user) {
        models.userTables.findOne({
                where: {
                    google: profile.id
                }
            }).then(function(user) {
                if (user) {
                    console.log("Already User exists in Google+ " + user);
                    req.flash('error', { msg: 'There is already an existing account linked with Google+ that belongs to you.' });
                    return done(null, user);
                } else {
                    var new_User = {
                        name: user.name || profile.displayName,
                        gender: user.gender || profile._json.gender,
                        picture: user.picture || profile._json.image.url,
                        google: profile.id
                    }
                    console.log("Inserting into user 1" + new_User);
                    models.userTables.create(
                        new_User
                    ).then(function(res) {
                        req.flash('success', { msg: 'Your Google account has been linked.' });
                        return res.redirect('/');
                    })
                }
            })
            .catch(function(err) {
                console.log("Error " + err);
                return res.redirect('/signup');
            });
    } else {
        models.userTables.findOne({
            where: {
                google: profile.id
            }
        }).then(function(user) {
            console.log("Calling User G+ user 2" + user);

            if (user) {
                console.log("User email is here --> " + user.email);
                req.flash('error', { msg: user.email + ' is already associated with another account.' });
                return done(null, user);
            }
            models.userTables.findOne({
                    where: {
                        email: profile.emails[0].value
                    }
                }).then(function(user) {
                    console.log("Calling User G+ user 2 again" + user);
                    if (user) {
                        req.flash('error', { msg: user.email + ' is already associated with another account.' });
                        done(err);
                    } else {
                        var newUser = {
                            name: profile.displayName,
                            email: profile.emails[0].value,
                            gender: profile._json.gender,
                            location: profile._json.location,
                            picture: profile._json.image.url,
                            google: profile.id
                        };
                        console.log("Inserting into user 2" + newUser.name);
                        models.userTables.create(newUser)
                            .then(function(user) {
                                done(user);
                            })
                    }
                })
                .catch(function(err) {
                    console.log("Error " + err);
                    done(err, user);
                });
        })
    }
}));
here i am trying to connect with g+ using passport and sequelize
  1. can some one optimize the code,
  2. also what is if else doing under function(req, accessToken, refreshToken, profile, done) {
Albert Cardona II
@daddycardona
Oct 23 2017 22:37
I can't help you @surya4 but I know dreamincode can they basically another version of stackoverflow ;)
function truthCheck(collection, pre) {


    let x = Object.keys(collection).every(function(k) {
        //console.log(collection[k])
        if (collection[k].hasOwnProperty(pre)) {
            if (collection[k])
                return true;
        } else {
            return false;
        }
    });

    console.log(x);

    // Only change code above this line
    return x;
}

truthCheck([{"name": "Pete", "onBoat": true}, {"name": "Repeat", "onBoat": true}, {"name": "FastFoward", "onBoat": null}], "onBoat") ; //should return false
truthCheck([{"user": "Tinky-Winky", "sex": "male", "age": 0}, {"user": "Dipsy", "sex": "male", "age": 3}, {"user": "Laa-Laa", "sex": "female", "age": 5}, {"user": "Po", "sex": "female", "age": 4}], "age"); 
// should be false
I don't understand why or what I am doing wrong?
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:01
hmmm
do you think "collection[k].hasOwnProperty(pre)" = true?
@daddycardona
Albert Cardona II
@daddycardona
Oct 23 2017 23:05
what do you mean @JuiceyDuecy
so I don't have to write return true? is that a bad statement? and yes I do or am I missing something here?
Victor Abeledo
@victorja
Oct 23 2017 23:09
but I doesnt work
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:09
@daddycardona basically you can change it to return false I believe
Albert Cardona II
@daddycardona
Oct 23 2017 23:09
okay let me check that
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:10
since the obj has keys it is returning true and stopping the if, else loop there
sorry, may not be 100% accurate... my JS is a bit rusty
Albert Cardona II
@daddycardona
Oct 23 2017 23:10
mine is too lol
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:11
@victorja what isn't working?
Victor Abeledo
@victorja
Oct 23 2017 23:12
I wanted to add a fadeIn effect
but I dont know if it is because I am doing sth wrong in the css file or if I'm not setting the jquery up well
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:13
@victorja paste your code one more time please
Victor Abeledo
@victorja
Oct 23 2017 23:13

HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><!--AGREGO JQUERY --> <script src="script.js"></script>
.js file:

$(document).ready(function(){ $("#hidden").fadeIn(); });

css
``

hidden{

display:none;

}

``

Albert Cardona II
@daddycardona
Oct 23 2017 23:14
what is the agrego jquery?
Victor Abeledo
@victorja
Oct 23 2017 23:14
adding jquery in spanish, it's a comment
Albert Cardona II
@daddycardona
Oct 23 2017 23:15
Okay I am slightly slow lmao
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:15
what html element are you trying to fade in?
Albert Cardona II
@daddycardona
Oct 23 2017 23:15
where is your files at @victorja
Victor Abeledo
@victorja
Oct 23 2017 23:15
<section id="hidden"><p>Hello World</p></section>
:smile: @daddycardona my files are all at the same folder
Albert Cardona II
@daddycardona
Oct 23 2017 23:16
css
#hidden{
display:none;
}
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:16
also, I believe fade in takes a parameter, but have to double check
Victor Abeledo
@victorja
Oct 23 2017 23:17
@daddycardona I already have that line in my css
Albert Cardona II
@daddycardona
Oct 23 2017 23:17
Okay just making sure because i usually have my js files in a different folder called js
Victor Abeledo
@victorja
Oct 23 2017 23:17
@daddycardona yes I have them in different folders too!
Albert Cardona II
@daddycardona
Oct 23 2017 23:17
and according to what you showed your hidden{ not #hidden{ meaning you're missing the hashtag
Victor Abeledo
@victorja
Oct 23 2017 23:18
but it's the first time I'm using js
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:18
ahh, are you requiring /importing your files?
let me try it out
1 sec
Victor Abeledo
@victorja
Oct 23 2017 23:18
@daddycardona oh yes, sorry, gitter formatted it that way, I typed #hidden
@JuiceyDuecy do you mean adding the scripts on the header of the html or what?
Albert Cardona II
@daddycardona
Oct 23 2017 23:19
okay so you want to make sure that your <script src="script.js"></script> should be <script src="folderit is in/script.js"></script>
my script that looks like this main folder then in this folder index.html then 3 folders css, js and img. so if i write a script tag it would look like this
<script src="js/script.js"></script>
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:20
exactly @daddycardona
unfortunately, code pen doesn't show you that you have to "link" your seperate files
Albert Cardona II
@daddycardona
Oct 23 2017 23:21
that should change a lot and if you are using a css file same thing
cs/main.css
Victor Abeledo
@victorja
Oct 23 2017 23:24
so are you saying I should create separate folders in order to make js work?
because I have .html .css .js in the same folder
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:25
@victorja no no
they are seperate files, right?
Albert Cardona II
@daddycardona
Oct 23 2017 23:25
are they txt files ?
Corey Pennington
@JuiceyDuecy
Oct 23 2017 23:25
you have to bring in your .css and .js file into your html files
Albert Cardona II
@daddycardona
Oct 23 2017 23:26
I would have to see what is going on with your computer or are you on codepen.io/?
Victor Abeledo
@victorja
Oct 23 2017 23:27
The files are all in the same folder called project, my folder only has 3 files: 1 for css, other for html and other for js
they are called: index.html style.css script.js
this is the head of the html file
Albert Cardona II
@daddycardona
Oct 23 2017 23:28
okay
Victor Abeledo
@victorja
Oct 23 2017 23:28
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><!--AGREGO JQUERY -->
<script src="script.js"></script>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="style.css">
<title>Title</title>
</head>
Albert Cardona II
@daddycardona
Oct 23 2017 23:29
okay what does your css file look like and please put it between of these
Victor Abeledo
@victorja
Oct 23 2017 23:30
@daddycardona @JuiceyDuecy I found the solution
Albert Cardona II
@daddycardona
Oct 23 2017 23:31
okay :)
happy for you :)
Victor Abeledo
@victorja
Oct 23 2017 23:31
@daddycardona @JuiceyDuecy thanks!
CamperBot
@camperbot
Oct 23 2017 23:31
victorja sends brownie points to @daddycardona and @juiceyduecy :sparkles: :thumbsup: :sparkles:
:cookie: 408 | @daddycardona |http://www.freecodecamp.com/daddycardona
:cookie: 278 | @juiceyduecy |http://www.freecodecamp.com/juiceyduecy
Victor Abeledo
@victorja
Oct 23 2017 23:31
I added :
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
to the head of the html
Albert Cardona II
@daddycardona
Oct 23 2017 23:47
@JuiceyDuecy I don't get what you mean or I do but it is not working properly lol