These are chat archives for FreeCodeCamp/Help

2nd
Mar 2018
Ken Haduch
@khaduch
Mar 02 2018 02:51
@daddycardona - hey Albert - are you back?
Eric Miller
@ericmiller777
Mar 02 2018 04:11
could anyone help with
var Person = new Schema({
    name:  {type: String, required: true},
    age: Number,
    favoriteFoods: [[String]]
  });
Sweet Coding :)
@SweetCodingInc
Mar 02 2018 09:11
@ericmiller777 Yes.. What about it?
Stephen James
@sjames1958gm
Mar 02 2018 11:17
@ericmiller777 Looks like your favoriteFoods is an array of arrays of strings not just array of strings
stuartbiggs
@stuartbiggs
Mar 02 2018 12:39
I am back - I think
Stephen James
@sjames1958gm
Mar 02 2018 12:52
@stuartbiggs I see you
Darren
@DarrenfJ
Mar 02 2018 16:40
morning fCC
hey all the usual suspects are here :D
@daddycardona caught part of yer youtube vid.. good schtuff brutha
Kaz Baig
@kbaig
Mar 02 2018 17:49
:wave:
Darren
@DarrenfJ
Mar 02 2018 17:58
@kbaig hey buddy :D
how goes it?
Daniel
@dkapexhiu
Mar 02 2018 18:19
@forkerino does there exist chrome for lumia?
Pieter Stokkink
@forkerino
Mar 02 2018 18:21
@dkapexhiu reason I asked was because if you test something in Chrome, doesn't mean it works in another browser. You can check wherever you downloads your app if chrome is available for that phone.
Henry
@GitHub-Henry
Mar 02 2018 18:33
Anyone know if VS Code supports server side and client side JavaScript debugging in the same debugging session for MERN apps? If so, could you send a link about setting it up.
alpox
@alpox
Mar 02 2018 18:40
@GitHub-Henry i use vscode for some time and im not aware of a possibility for multiple debugging sessions at once
Henry
@GitHub-Henry
Mar 02 2018 18:42
@alpox this url seems to suggest it, but making it work is a pickle so far https://github.com/Microsoft/vscode-recipes/tree/master/MERN-Starter
alpox
@alpox
Mar 02 2018 18:44
@GitHub-Henry In the first link they say nothing about client debugging
Your second link is interesting though. Let me take a look
One configuration for node, one for chrome debugging - then create a compound
Henry
@GitHub-Henry
Mar 02 2018 18:47
That's the goal
Henry
@GitHub-Henry
Mar 02 2018 19:02
One ring for server, one ring for client, one ring to bind them all
alpox
@alpox
Mar 02 2018 19:05
@GitHub-Henry Beware! Don't go down that path or i will have to call Gandalf!
Henry
@GitHub-Henry
Mar 02 2018 19:07
but it calls to me
Roman Markelov
@webmarkelov
Mar 02 2018 19:55
Hey, there! Why must is it return false?
"Walking on water and developing software from a specification are easy if both are frozen".substr(-1) === "specification".substr(-1)
Aditya
@ezioda004
Mar 02 2018 19:57
@webmarkelov It returns true as it should? From both expressions you get "n"and they are equal therefore true.
Roman Markelov
@webmarkelov
Mar 02 2018 20:04
Yep, but I am deciding task on freecodecamp and the test breaks down.
Aditya
@ezioda004
Mar 02 2018 20:05
Can you post your whole code?
Roman Markelov
@webmarkelov
Mar 02 2018 20:05
function confirmEnding(str, target) {
  // "Never give up and good luck will find you."
  // -- Falcor
  return str.substr(-1) === target.substr(-1);
}

confirmEnding("Bastian", "n");
Aditya
@ezioda004
Mar 02 2018 20:10

Check if a string (first argument, str) ends with the given target string (second argument, target).

So since the target is specification you have to check the whole string not just the last character.

Since frozen !== specification it should be false
Roman Markelov
@webmarkelov
Mar 02 2018 20:15
@ezioda004 Thank you very much. I got it.
CamperBot
@camperbot
Mar 02 2018 20:15
webmarkelov sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 489 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Sam Goldberg
@sgoldber61
Mar 02 2018 21:29

I have a question regarding the voting/nightlife app. In the voting app, I wanted to make sure that a user could not vote twice. I did this by storing (in Mongoose) for each poll, an array consisting of usernames of who already voted. Then, when it was time to process a user clicking on “vote”, I took the username and compared it with the entire array of usernames who already voted. If I got through the array without a username match, then I would tack my username at the end of the array. If I got a username match within the array, then I would stop and return an error that I’m not allowed to vote.

This was fine for a small app, but I feel that when there are thousands of votes that this is not the best idea because I have to check through all of them before a user gets to vote. How should I organize things to solve this problem?

Ken Haduch
@khaduch
Mar 02 2018 22:36
@sgoldber61 - there are ways to store the data that are fast to search, for example a binary tree, and probably others. Whatever database you are using might have some optimized ways to search the data, perhaps mongoose (which I’m not familiar with) has something like that? You could google for fast search algorithms and see what you find, it might give you something interesting to go on?
You would want to avoid a linear search, for sure.
Chris
@bestintown23
Mar 02 2018 23:11
How can i make my slideshow images smaller. i tried a couple of methods but nothing seems to be working. https://codepen.io/bestintown23/pen/xYjbxd
Ken Haduch
@khaduch
Mar 02 2018 23:31
@bestintown23 - I just did an extreme shrinking of it using max-width: 10%; on the class that is attached to each image. It definitely shrank the images, but I cannot try too much on my phone. What else have you tried?
I used the mySlides class
Manish Giri
@Manish-Giri
Mar 02 2018 23:36
@khaduch :wave:
how goes it
Chris
@bestintown23
Mar 02 2018 23:39
@khaduch thank you, this method actually worked, now i have to get my photos back centered.
CamperBot
@camperbot
Mar 02 2018 23:39
bestintown23 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3766 | @khaduch |http://www.freecodecamp.org/khaduch
Ken Haduch
@khaduch
Mar 02 2018 23:49
@Manish-Giri - hello! Doing okay. Mostly babysitting the grandkids at this point... :smile:
How are you doing?