These are chat archives for FreeCodeCamp/Help

27th
Jul 2018
got this easy one with one shot..
i am so happy now...
function findNeedle(haystack) {
  // loop through array
   for (let i = 0; i < haystack.length; i += 1){
  // check each string element is neeedle
     let ele = haystack[i];

     if (String(ele) === 'needle'){
      // if that is needle and return the string 'found the needle' 
      return "found the needle at position " +  haystack.indexOf(ele);
   // concate the string + index
  // index can be found with indexof
    }
  }
}
peseudo is helping @ thanks @thekholm80
return "found the needle at position " + haystack.indexOf("needle"); some one did this lol
Kyle Holm
@thekholm80
Jul 27 2018 00:14
yeah, indexOf() is pretty awesome
Kyle Holm
@thekholm80
Jul 27 2018 00:18
@Manish-Giri ugh why do the instructions have to be so long?
Manish Giri
@Manish-Giri
Jul 27 2018 00:18
:smiley_cat:
Kyle Holm
@thekholm80
Jul 27 2018 00:20
i have 2 thoughts
1st is to use slice since they're giving an index
2nd is to use python because it's more fun
Manish Giri
@Manish-Giri
Jul 27 2018 00:21
I was looking for java, but they don't have it
:cry:
Kyle Holm
@thekholm80
Jul 27 2018 00:22
oh duh my reading comprehension is bad
long instructions :point_up:
Kyle Holm
@thekholm80
Jul 27 2018 00:23
yikes
Karma Drukpa
@coderkarma
Jul 27 2018 00:42
slicing @thekholm80
I tried doing slice on this one but not able to succeed, let me sent you question
I SOLVED OTHER WAY BUT I WANT YOUR METHOD TO
Kyle Holm
@thekholm80
Jul 27 2018 00:45
which problem are you talking about?
function shortcut(string){
// declare the vowels
 let vowels = 'aieou';
// declar empty str
 let newStr = '';
//loop through the string 
  for (let i = 0; i < string.length;  i += 1){
// check if the char is a vowel of not 
    let char = string[i];
// if it is not a vowel just concate the char and newstr;
   if ( vowels.indexOf(char) === -1){
        newStr += char;
   } 
   // if is a vowel do nothing.
 }
 return newStr;
}
i did that way
but i was thinking to slice
Kyle Holm
@thekholm80
Jul 27 2018 00:46
why slice?
Karma Drukpa
@coderkarma
Jul 27 2018 00:47
oh i should have done replace right
Kyle Holm
@thekholm80
Jul 27 2018 00:47
slice just makes a copy of part of an array
i'm not sure that would really help you here
Karma Drukpa
@coderkarma
Jul 27 2018 00:48
I Thought i could slice , if my check would have been like this , if( vowels.indexOf(char ) > -1)
let's say if I had done vowel.indexOf(char) > -1, which means vowels is in the string,so what would be good way of dealing with it then
Kyle Holm
@thekholm80
Jul 27 2018 01:06
@coderkarma the easy way on that one i would think would be filter()
or replace(), actually since then you don't have to convert to an array
Karma Drukpa
@coderkarma
Jul 27 2018 01:11
@thekholm80 ok, I thought of replace but not filter.thanks
Yulian Kuncheff
@Daegalus
Jul 27 2018 01:45
So I have a question. How important is it for the tribute page to stay the same after it was submitted? Reason I ask is my wife made a fantastic tribute page and the requirements to center the image ruined her entire design. She changed it to pass the tests but wanted to know when she could change it back
Karma Drukpa
@coderkarma
Jul 27 2018 01:55
@thekholm80 one little help needed on this question?
you there @thekholm80
@Daegalus I have no clue
I just made simple tribute page whatever it has asked for .
Yulian Kuncheff
@Daegalus
Jul 27 2018 01:58
Ya, my wife is just going above and beyond as she is really trying to learn it
Karma Drukpa
@coderkarma
Jul 27 2018 01:59
that's what I am trying to do as well. @Daegalus .
By the way it seems we live close by .
Yulian Kuncheff
@Daegalus
Jul 27 2018 02:00
It's fine. I think at minimum after she gets the certification, she can change it back for portfolio reasons.
Karma Drukpa
@coderkarma
Jul 27 2018 02:01
Oh gosh!!! I have a long way to go, to get certificate.
Manish Giri
@Manish-Giri
Jul 27 2018 02:01
@coderkarma what was your question
Karma Drukpa
@coderkarma
Jul 27 2018 02:02
just a simple one, I think i should made an empy array push the elements
function countPositivesSumNegatives(input) {
    // declare the count variable
     if (input.length === null){
        return [];     
     }
     let count = 0;
    // declare the sum variable to keep sum all the negative numbers
     let sum = 0;

    // loop through array
      for (let i = 0; i < input.length; i += 1){
    // check to see if the input is greater then 0, ie, postive
       if ( input[i] > 0){
    // increment the count 
       count += 1;

      } else {
      //  if it is less then zero sum  negative  elements of array
        sum += input[i];
        } 
    }
    return [count, sum];
}
@Manish-Giri
codewars 8 kata simple sum question manish
Manish Giri
@Manish-Giri
Jul 27 2018 02:03
yeah it should work
try it out :thumbsup:
@coderkarma
Karma Drukpa
@coderkarma
Jul 27 2018 02:04
nope, it is not
one test is failling
Manish Giri
@Manish-Giri
Jul 27 2018 02:04
 if (input.length === null){
        return [];     
     }
when input is null or undefined
it won't have a length property
TypeError: Cannot read property 'length' of null
    at countPositivesSumNegatives
Karma Drukpa
@coderkarma
Jul 27 2018 02:05
it say's it expected [] but got [0,0], and i am thinking, it could be cause of returning [ count , sum ]
at the end
Manish Giri
@Manish-Giri
Jul 27 2018 02:05
well your code passes for me
Time: 593ms Passed: 2 Failed: 0
Test Results:
 Example tests
Test Passed
Test Passed
Completed in 2ms
You have passed all of the tests! :)
Karma Drukpa
@coderkarma
Jul 27 2018 02:05
I tried with 0 as well
Expected: [], instead got: [0, 0]
this is what I am getting for last error
Manish Giri
@Manish-Giri
Jul 27 2018 02:06
Screen Shot 2018-07-26 at 10.06.30 PM.png
Karma Drukpa
@coderkarma
Jul 27 2018 02:08
Screen Shot 2018-07-26 at 7.07.37 PM.png
Manish Giri
@Manish-Giri
Jul 27 2018 02:09
change your if to account for the case where input is null
if(!input || input.length === 0)
If the input array is empty or null, return an empty array:
Karma Drukpa
@coderkarma
Jul 27 2018 02:11
damn ... when i did input.length === 0, why that didn't passed either.
so we had to put !input
now it worked thanks man.
Manish Giri
@Manish-Giri
Jul 27 2018 02:15
because when input is null, input.length will fail
so you needed to check for null input first..
Karma Drukpa
@coderkarma
Jul 27 2018 02:16
hmm ...
we could have written this way as well . if ( input === null || input.length === 0)
Manish Giri
@Manish-Giri
Jul 27 2018 02:21
yeah
I just prefer the shorter/concise version - if(!input || !input.length)
Karma Drukpa
@coderkarma
Jul 27 2018 02:22
nice
Kyle Holm
@thekholm80
Jul 27 2018 02:32
@coderkarma sorry, went to dinner
looks like @Manish-Giri got you sorted out
Karma Drukpa
@coderkarma
Jul 27 2018 02:36
yeah @thekholm80 . what do you usually eat in dinner?
Kyle Holm
@thekholm80
Jul 27 2018 02:36
tonight i had pho
it was tasty
Karma Drukpa
@coderkarma
Jul 27 2018 02:37
pho, I Love that.
Kyle Holm
@thekholm80
Jul 27 2018 02:37
i'm a big fan
sometimes you just gotta eat some noodles
Karma Drukpa
@coderkarma
Jul 27 2018 02:37
yeah, beside that I love poke bowl to.
Kyle Holm
@thekholm80
Jul 27 2018 02:38
i've never tried that
Karma Drukpa
@coderkarma
Jul 27 2018 02:38
oh my gosh, you should try it, it is just awesoooommmmeee
Kyle Holm
@thekholm80
Jul 27 2018 02:39
i'll keep my eye out for it
Karma Drukpa
@coderkarma
Jul 27 2018 02:39
@thekholm80 what are you working on currently?
Kyle Holm
@thekholm80
Jul 27 2018 02:39
i'm watching videos of customized golf carts
Karma Drukpa
@coderkarma
Jul 27 2018 02:39
any projects?
oh!!!
Kyle Holm
@thekholm80
Jul 27 2018 02:40
my life is pretty exciting
not to brag
Karma Drukpa
@coderkarma
Jul 27 2018 02:41
lol!! it is.
mine will not be excited until I find the job.
Kyle Holm
@thekholm80
Jul 27 2018 02:42
you'll get there
Karma Drukpa
@coderkarma
Jul 27 2018 02:42
to much pressure mounting already.
Claudio Restifo
@Marmiz
Jul 27 2018 02:42

i'm watching videos of customized golf carts

still living the life man @thekholm80

Kyle Holm
@thekholm80
Jul 27 2018 02:42
@Marmiz lol
Karma Drukpa
@coderkarma
Jul 27 2018 03:06
Will try to solve this
da8963
@da8963
Jul 27 2018 03:09
Hi everyone, looking for some advise. Very new to coding, looking to create a database system that would be all online (SAAS), what would be a good program language fo this?
Manish Giri
@Manish-Giri
Jul 27 2018 03:09
@coderkarma :thumbsup:
Kyle Holm
@thekholm80
Jul 27 2018 03:14
@da8963 which ever you are most comfortable with. there's not really a 'best'
glitz20
@glitz20
Jul 27 2018 03:16
Hey guys, I am learning passport authentication in mern and currently following this repo
I cloned this and every thing works fine, but the problem is I cannot signup for more than 1 users
Can anyone can tell what is happening here?
Kyle Holm
@thekholm80
Jul 27 2018 03:18
@Manish-Giri i'm not proud of this
will pm it since others are working on it lol
da8963
@da8963
Jul 27 2018 03:18
@thekholm80 I actually don't even know where to start I am very new new to coding, wondering if you can give me some guidance on at least like three languages to look into, thanks for your help.
Henry
@GitHub-Henry
Jul 27 2018 03:19
python, js
Kyle Holm
@thekholm80
Jul 27 2018 03:19
@da8963 what your describing is possible with javascript, which i think is one of the easiest languages to learn
you can start working through freeCodeCamp to learn JS
Henry
@GitHub-Henry
Jul 27 2018 03:20
there is a complete set of lessons at fcc for you to learn about programming, and js is full stack, meaning it covers most of what you need
da8963
@da8963
Jul 27 2018 03:21
@thekholm80 awesome, thank you very much I really appreciate it.
Kyle Holm
@thekholm80
Jul 27 2018 03:21
np
Karma Drukpa
@coderkarma
Jul 27 2018 03:49
@thekholm80 on the above question do you think we need 2 for loops
I GUES we do need it right, since it is 2d array
Kyle Holm
@thekholm80
Jul 27 2018 03:50
that's kind of how i did it
Karma Drukpa
@coderkarma
Jul 27 2018 03:50
Yes, i am doing that Z
glitz20
@glitz20
Jul 27 2018 03:58
@sabin20
Hey guys, I am learning passport authentication in mern and currently following this repo
https://github.com/b-bly/simple-mern-passport
I cloned this and every thing works fine, but the problem is I cannot signup for more than 1 users
Can anyone can tell what is happening here?
Henry
@GitHub-Henry
Jul 27 2018 04:23
@Daegalus i'm new to the new fcc, could you point out the centering requirement?
Karma Drukpa
@coderkarma
Jul 27 2018 04:27
@thekholm80 now my pseudo for above problem is going so random. LOL, i am trying to figure out but 2d array sucks.
Kyle Holm
@thekholm80
Jul 27 2018 04:28
i had to think about it for a minute, it's not something i've encountered a lot
Henry
@GitHub-Henry
Jul 27 2018 04:28
@coderkarma this might help you visualize your code http://pythontutor.com/javascript.html#mode=edit
Karma Drukpa
@coderkarma
Jul 27 2018 04:29
@GitHub-Henry i am using that lately, actually that helped me so much to understand looping an changes that happens during iteration .
thanks
Yulian Kuncheff
@Daegalus
Jul 27 2018 04:31
@GitHub-Henry its not listed as a requirement, but if you run the test-suite, it requires it
Henry
@GitHub-Henry
Jul 27 2018 04:34
@Daegalus bummer, i thought tests where to verify requirements, not add to them, but you gotta pass the test, so i guess your solution about passing the test and changing it for your purposes later will have to do.
Yulian Kuncheff
@Daegalus
Jul 27 2018 04:35
@GitHub-Henry https://i.imgur.com/5mute7V.png last test in the list
Anand Potukuchi
@anandpotukchi
Jul 27 2018 05:27
good mirning
Claudio Restifo
@Marmiz
Jul 27 2018 05:30

@Daegalus it says "center to its parent". We should have a look at how the actual test is implemented but it doesn't say "center in the viewport".

I guess you can place the parent where you want and then have the img center relative to its parent.
Just a theory tho :)

Yulian Kuncheff
@Daegalus
Jul 27 2018 05:37
Ya I thought about that. I told her. But she is just going to wait till the certification is done and use her preferred code for her portfolio
Claudio Restifo
@Marmiz
Jul 27 2018 05:48
For sure, in the end this is mainly a training ground.
I'd expect many people to actually change the projects / rework them later on
John
@taloloy18
Jul 27 2018 05:50
Hi guys
https://codepen.io/taloloy18/pen/MBEpJe Can I still make the image small? Because I want to make it as my logo>
Anand Potukuchi
@anandpotukchi
Jul 27 2018 06:00
people
anybody know mongo and mongoose
Anand Potukuchi
@anandpotukchi
Jul 27 2018 06:09
anyone onloine?
John
@taloloy18
Jul 27 2018 06:15
I think there's no online as of the moment
Do you know mine?
Anand Potukuchi
@anandpotukchi
Jul 27 2018 06:36
is it an image or text
@taloloy18
where's your css
John
@taloloy18
Jul 27 2018 06:59
that's an image
I didn't put the CSS yet?
I just want to make my image small. How to do it?
John
@taloloy18
Jul 27 2018 07:06
https://codepen.io/taloloy18/pen/MBEpJe this is the current code
Adish Jain
@Adishjain58
Jul 27 2018 07:08
@taloloy18 just add code in your css section
and define it's height and width
John
@taloloy18
Jul 27 2018 07:10
Done already!! Thanks!!!
XD
Adish Jain
@Adishjain58
Jul 27 2018 07:10
@taloloy18 welcome
Atkn
@Atkn
Jul 27 2018 08:15
hi
May Kittens Devour Your Soul
@diomed
Jul 27 2018 08:16
yuki yuki
Atkn
@Atkn
Jul 27 2018 08:18
I have a member login on my site. If the information is correct, he can enter it in the dashboard.But from the address bar into the dashboar section, How Can I prevent him from entering?, so I can prevent the entry to the dashboard section without the member login
Yoon Hee-Ku
@heegu0311
Jul 27 2018 08:48

Can anybody help me with my "Responsive web design project #3:Build a Product Landing Page"???
I’m currently trying to satisfy this user story #3
User Story #3: Within the #header element I can see a nav element with a corresponding id="nav-bar”

Part of my code related to the story.. I’m looking for someone who can tell what is wrong with my code.

        <header id="header" id="header-img">
            <nav id="header-container" id="nav-bar">
                <img id="header-img" src="https://nervoustype.files.wordpress.com/2015/03/acoffeering.jpg" alt="Heading-image">
                <div id="menubar"><h1>Home-made Coffee & Bread</h1></div>
                <div id="empty"></div>
                <button class="nav-link"><a href="#About-us"><h3>About us</h3></a></button>
                <div id="empty"></div>
                <button class="nav-link"><a href="#How-we-roast"><h3>How we roast</h3></a></button>
                <div id="empty"></div>
                <button class="nav-link"><a href="#How-we-bake"></a><h3>How we bake</h3></a></button>
            </nav>
        </header>
The entire is here in Codepen(https://codepen.io/heegu0311/pen/GBMMzN).
giagar
@Giagar
Jul 27 2018 08:59
@heegu0311 Hi, I believe the problem is that you put 2 ids in the nav element. Delete the first id (header-container), and see if the problem is still there. :-)
Yoon Hee-Ku
@heegu0311
Jul 27 2018 09:03
Oh, that works! Thank you so much! ‘PASS’.. By the way, I need to re-arrange the attributes from header-container.
Yoon Hee-Ku
@heegu0311
Jul 27 2018 09:21
@Giagar I’ve gotten over the matter. Thanks again!
giagar
@Giagar
Jul 27 2018 09:36
@heegu0311 My pleasure. :-)
yaseenmd
@yaseenmd
Jul 27 2018 09:46

yaseenmd @yaseenmd
13:30
I am getting this error. [MJSONWP] Encountered internal error running command: Error: Could not sign with default certificate. Original error Command ''C:\Program Files\Java\jdk1.8.0_181\bin\java.exe' -jar 'C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-adb\jars\sign.jar' 'C:\Program Files (x86)\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v1.12.0.apk' --override' exited with code 1

i am using appium desktop with desired capability as "automationName": "UiAutomator2"

Daniyal
@danyalasif
Jul 27 2018 11:59
Hey guys
I don't understand how to submit stuff in the NodeJS curriculum?
It says they have shown how to submit it before but I am jumping directly to NodeJS
so I have no idea how to submit my solutions
Johnny
@JohnnyBizzel
Jul 27 2018 12:11
@danyalasif answered in HelpJavaScript
Henry
@GitHub-Henry
Jul 27 2018 12:57
So it looks like using the Brave browser while working on FCC projects benefits FCC.
Anand Potukuchi
@anandpotukchi
Jul 27 2018 13:38
startling revelation
the mongodb tests doin't work
I've been freakin trying to get the tests to pass - Just opened mLab, I created 112 records since morning
lol
Anand Potukuchi
@anandpotukchi
Jul 27 2018 15:37
am i invisble
just wanted to know coz nobdy seems to bve helping out
Smootimus
@Smootimus
Jul 27 2018 15:39
Who watches Dwarf Fortress on youtube :eyes:
What bum does such a thing
Anand Potukuchi
@anandpotukchi
Jul 27 2018 15:39
never heard of it
yu watchin?
Smootimus
@Smootimus
Jul 27 2018 15:40
Oh yeah I love Dwarf Fortress
Its a game
It's a really, really hard game
Notorious for being complicated and unforgiving
Kyle Holm
@thekholm80
Jul 27 2018 15:42
smh
you kids and your videos of video games
next generation will watch videos of people watching videos of people playing video games
linjie4286
@linjie4286
Jul 27 2018 16:33
Hello
Anand Potukuchi
@anandpotukchi
Jul 27 2018 17:37
Hello yourself
Kyle Holm
@thekholm80
Jul 27 2018 19:56
so quiet today
glitz20
@glitz20
Jul 27 2018 19:59
@thekholm80 I asked this question yesterday too, but no one answered. So I am implementing passport authentication in mern using this as a guide
I cloned it, and every thing is fine, but the problem is I cannot signup for more than one user
when I try to signup for second user, routing doesnot work, signup button doesnot work
Kyle Holm
@thekholm80
Jul 27 2018 20:01
using different usernames each time?
glitz20
@glitz20
Jul 27 2018 20:01
yeah I tried diffrerent username
Kyle Holm
@thekholm80
Jul 27 2018 20:03
i couldn't really say. it's hard to debug someone else's implementation of a 3rd party's code
have you tried posting an issue on the repo? maybe the author of the code could help?
glitz20
@glitz20
Jul 27 2018 20:04
does serialize and deserialize look ok?
or smth do with session and cleaning up smth?
Kyle Holm
@thekholm80
Jul 27 2018 20:07
i couldn't really say
the difficulty here for me is i can't ask why you did anything the way you did it, because you didn't write the code. I couldn't even begin to guess how to start helping you debug - the best shot i'd have is to clone & install the repo and start doing all the heavy lifting for you
and i just don't have the time to do that
Ismail Hozain
@ismailhozain
Jul 27 2018 20:22
Good morning guys.
Kyle Holm
@thekholm80
Jul 27 2018 20:25
@ismailhozain :wave:
Spur
@Spur_Gaming_twitter
Jul 27 2018 20:26
hello
luccifer00
@luccifer00
Jul 27 2018 20:57
hello, i am tring to generate dynamic divs with a msg inside. But I only recive one div... what i am missing??
var numDivs=[[1],[2],[3],[4],[5],[6],[7],[8]];
   var divDire=[];
      for(var y=1;y<numDivs.length+1;y++){
        var div = document.createElement('div');
       div.setAttribute('id','showdata'+y);
        div.setAttribute('class', 'row');
       divDire.push(div);
       document.getElementById('showdata'+y).innerHTML= 'THIS IS THE DIV'+y;

      }
korzo
@korzo
Jul 27 2018 21:19
@luccifer00 You have to insert created divs in DOM.
document.body.appendChild(div)
luccifer00
@luccifer00
Jul 27 2018 22:08
@korzo still returning just one div... the last one
korzo
@korzo
Jul 27 2018 22:09
@luccifer00 Check the link @thekholm80 posted
luccifer00
@luccifer00
Jul 27 2018 22:12
oh! thanks @thekholm80 i thought was other think!
Kyle Holm
@thekholm80
Jul 27 2018 22:13
@luccifer00 you were 99% there, i just added the bit @korzo suggested
luccifer00
@luccifer00
Jul 27 2018 22:19
i am so far to get it what realy i want to do :smile: this was the simple way to understand everything and get more console control! but i'll keep in the way! thanks
luccifer00
@luccifer00
Jul 27 2018 23:20
hi again... when i pass it to my real function, i cant understad why upper code the var divContainer=document.getElementById('showdata'+y); Works Fine!, but inside the ajax and to make a loop inside this code return this error TypeError: Cannot read property 'appendChild'. I check the typeof and it return Stringso i dont know why isnt working.... here is the code :
var idchange ='showdata'+y;
       var divContainer=document.getElementById(idchange);
       divContainer.appendChild(table);
i also try with document.getElementById('showdata'+y);
luccifer00
@luccifer00
Jul 27 2018 23:37
i get it! i am using a variable with the value 0 and mine start with 1 :sweat_smile:
manarsalah
@manarsalah
Jul 27 2018 23:59
hello...I am stuck on first step of learning C#..have been trying to set up visual studio coder and dotnet sdk ..following youtube tutorial ..it's ok till I'm typing "Dotnet restore"..I don't know what tool on my version can open up program .cs