These are chat archives for FreeCodeCamp/Help

28th
Mar 2015
Briana Swift
@brianamarie
Mar 28 2015 14:24
Bonfire question on "Drop it like it's hot" - Does drop mean delete from the array?
Bianca Mihai
@biancamihai
Mar 28 2015 14:25
yes delete
Briana Swift
@brianamarie
Mar 28 2015 14:26
Got it. Thanks!
Evan Davis
@davisec52
Mar 28 2015 14:30

Good morning. I'm quite stuck on the Smallest Common Multiples
bonfire challenge. I understand that finding the lcm depends
on finding the prime factors of the numbers in the range.

I don't know if this is the best way to start, but I'm
trying to find the lcm of a single number and work up
from there.

I don't see how to make a loop that properly reduces
a number to its factors. For example, if the number is
24, then: 24 / 2 = 12, 12 / 2 = 6, 6 / 2 = 3.
Then 24 / 3 = 8. The prime factors or [2, 2, 2, 3].

The code sample below does not work for numbers
like 8 or 24 where there are more than 2 of the
same factor. How do I make a loop that runs
until it generates the correct number of each
factor present?

Here is a link to the code on repl.it: http://repl.it/fvj.


function fac(num) {
    var div = 0;
    var j = 1;
    var list = [];
    function isPrime(num) {
        if(num < 2) return false;
        for(var i = 2; i < num; i++) {
            if(num % i === 0) {
                return false;
            }
        }
        return true;
    }
    while(j <= num) {
        j++;
        if(isPrime(j) && num % j === 0) {
            div = num / j;
            list.push(j);
        }
        if(div > j && div % j === 0 && isPrime(j)) {
            div = div / j;
            list.push(j);
        }
    }

    return list;
}
fac(24);  //=> [ 2, 2, 3 ]
Ashley Drake
@aldraco
Mar 28 2015 14:32
@davisec52 there is a helpful wikipedia article about an algorithm for this bonfire
look up Euclid's algorithm
that will help you out :)
Evan Davis
@davisec52
Mar 28 2015 14:33
@aldraco Thank you! I will check it out right now!
storbeck
@storbeck
Mar 28 2015 18:17
I'm reading "Once you've finished all the challenges, click the "I'm done with all the challenges" button, which will become enabled." on the guide to nonprofit projects - I don't see this button
Ashley Drake
@aldraco
Mar 28 2015 18:20
it's on the challenges model
make sure you have marked them all complete
storbeck
@storbeck
Mar 28 2015 18:25
Ohh I missed the "Join Our Forum (currently disabled)"
I can't go to that one :(
Ashley Drake
@aldraco
Mar 28 2015 18:26
you can still mark it complete :)
ooh no you can't
interesting
storbeck
@storbeck
Mar 28 2015 18:33
Justin Rogers
@yaskyj
Mar 28 2015 18:33
@aldraco Sorry to ask again, but what was the algorithm course I asked you about the other day?
I believe it was on Courseware.
storbeck
@storbeck
Mar 28 2015 18:34
controllers/challenges.js
exports.returnChallenge = function(req, res) {
    var challengeNumber = parseInt(req.params.challengeNumber) || 0;
    if (challengeNumber === 2) {
        return res.redirect('../challenges/3');
    }
Ashley Drake
@aldraco
Mar 28 2015 18:35
@yaskyj i think it was the stanford algorithms course on coursera
@storbeck drat
could be a good issue to report since i'm sure you're not the only person in this situation?
storbeck
@storbeck
Mar 28 2015 18:36
Sure I can report it
Justin Rogers
@yaskyj
Mar 28 2015 18:36
@aldraco Thanks again.
Ashley Drake
@aldraco
Mar 28 2015 18:36
sure thing. have fun! i hope to get back to that course soon. perhaps you will inspire me to do it soon
storbeck
@storbeck
Mar 28 2015 18:51
@aldraco Thanks for the help, I submitted the issue and am working on a fix for it
What version of node is freecodecamp using? Trying to setup a local copy to test changes
Ashley Drake
@aldraco
Mar 28 2015 18:52
not sure, but shouldn't npm install give you the right one?
storbeck
@storbeck
Mar 28 2015 18:53
Well I am using nvm but it's failing with v0.12.0
npm ERR! node seed_data/seed.js
Oh wait nevermind, I think it's an issue with mongodb
Ashley Drake
@aldraco
Mar 28 2015 18:54
are you running mongo?
storbeck
@storbeck
Mar 28 2015 18:55
nope :) I need to install it
Ashley Drake
@aldraco
Mar 28 2015 18:55
ah! well then after that you should be in good shape
be warned, installing mongo can be a bit tricky, so go into it with some patience and low expectations :)
storbeck
@storbeck
Mar 28 2015 19:09
woo got it installed and fcc up and running locally :D
Ashley Drake
@aldraco
Mar 28 2015 19:32
awesome!
Jonny
@jaw444
Mar 28 2015 19:43
Hi I am working with HTML making an input submit button. How do I set the text inside the button because it says "submit query" and I would prefer it to just say "Submit". <input type="submit">
Ammar Ali Shah
@AmmarAliShah
Mar 28 2015 19:44
@jaw444 between the tags
grizzlybear09
@grizzlybear09
Mar 28 2015 19:45

Hi there! I have sort of a beginner's question on closure... So say I have a function defined as:
function makeAdder(x) {
function add(y) {
return y + x;
};
return add;
}
//Then I assign the fxn to plusOne:
var plusOne = makeAdder( 1 );
console.log(plusOne); //[Function: add]

//Is this what's stored in plusOne? :
var plusOne = function add(y) {
return y + 1;
}

Ammar Ali Shah
@AmmarAliShah
Mar 28 2015 19:47
@grizzlybear09 format the code
Captudcre.PNG
Jonny
@jaw444
Mar 28 2015 19:48
@AmmarAliShah could you possibly show me an example of where in the input tag I would write that? <input type="submit">
Ammar Ali Shah
@AmmarAliShah
Mar 28 2015 19:49
@jaw444 wait
asasasaure.PNG
@jaw444 this is an example from a book on HTML5
Try to do it this way
but change the type="submit"
Oliver
@Dadsaster
Mar 28 2015 19:50
sorry misread
grizzlybear09
@grizzlybear09
Mar 28 2015 19:51

Ok, I hope this is formatted correctly....

Hi there! I have sort of a beginner's question on closure... So say I have a function defined as:


function makeAdder(x) {
    function add(y) {
        return y + x;
    };
    return add;
}
//Then I assign the fxn to plusOne:
var plusOne = makeAdder( 1 );
console.log(plusOne); //[Function: add]

//Is this what's stored in plusOne? : 
var plusOne = function add(y) {
    return y + 1;
}
Oliver
@Dadsaster
Mar 28 2015 19:51
change to ``` not '''
Ammar Ali Shah
@AmmarAliShah
Mar 28 2015 19:51
@grizzlybear09 use backticks
grizzlybear09
@grizzlybear09
Mar 28 2015 19:52
ooh gotcha thx
Oliver
@Dadsaster
Mar 28 2015 19:52
you can edit your post
Jonny
@jaw444
Mar 28 2015 19:52
@AmmarAliShah Thank you!
Ammar Ali Shah
@AmmarAliShah
Mar 28 2015 19:52
@jaw444 You're Welcome
try it out
and tell me if you have success
Jonny
@jaw444
Mar 28 2015 19:58
It did successfully create the button but it still says "Submit Query." I am beginning to think it may just be set up to automatically say that
Oliver
@Dadsaster
Mar 28 2015 19:58
@grizzlybear09 - the right hand side of the equation is evaluated and the result is stored in plusOne
Ammar Ali Shah
@AmmarAliShah
Mar 28 2015 19:59
@jaw444 what are you trying to accomplish exactly?
Jonny
@jaw444
Mar 28 2015 20:00
I just want the button to say "Submit" and for some reason it says "Submit Query"
storbeck
@storbeck
Mar 28 2015 20:01
@grizzlybear09 your theory is correct
The variable will equal the function
Ammar Ali Shah
@AmmarAliShah
Mar 28 2015 20:02
@jaw444 PM
grizzlybear09
@grizzlybear09
Mar 28 2015 20:05
@storbeck & @Dadsaster thanks for helping!
storbeck
@storbeck
Mar 28 2015 20:05
you're welcome
storbeck
@storbeck
Mar 28 2015 21:20
@aldraco Opened a pull request to solve the challenge 2 issue :) Thanks for the help again
Ashley Drake
@aldraco
Mar 28 2015 21:21
yeah, no problem! hope you can get that merged in. it would probably help a lot of people.
storbeck
@storbeck
Mar 28 2015 21:22
hehe yeah
It was a lot of fun digging in to the code, it took a bit to figure out how all the pieces worked together
Ashley Drake
@aldraco
Mar 28 2015 21:24
as i've learned more about apps, i have used the FCC repo as a learning tool. it's something i'm already familiar with so it's a little easier to understand what's going on - it's a great way to see the pieces fit together.
Christopher Hutchinson
@cshutchinson
Mar 28 2015 23:19
anyone here who may be able to help me debug some react HTML layout / less problems?
aqua react flux hapi bootstrap less
i have to make this form layout look better :(
Aiden Montgomery
@AidenMontgomery
Mar 28 2015 23:20
I have used that project
Not sure if I will be able to help though :)
Christopher Hutchinson
@cshutchinson
Mar 28 2015 23:21
they can make their text inputs smaller on some of the admin search pages
but my col-md classes are seemingly ignored
they are referring to some special container styles that I can’t even find outside of the min files
and {feet} and {neck} are confusing me too LOL
Aiden Montgomery
@AidenMontgomery
Mar 28 2015 23:22
ah yeah, I have seen the feet and neck thing. Strange names to choose :)
Christopher Hutchinson
@cshutchinson
Mar 28 2015 23:23
@AidenMontgomery if you think you can help I would love to let you try with screenhero… you can’t mess anything up, I have a wasted afternoon here
Aiden Montgomery
@AidenMontgomery
Mar 28 2015 23:27
@cshutchinson just on facetime with someone. Will have a look when I am done
Vince
@Vince33
Mar 28 2015 23:28
Hi everyone, was wondering if anybody is a pro at preview
for example grabbing images off a site and resizing them and converting to png
or if any one has a suggest method that has worked well for them'
Aiden Montgomery
@AidenMontgomery
Mar 28 2015 23:40
@cshutchinson just going to get a refill on my whisky and then I'll be up for having a look at your code
Ok @cshutchinson ready when you are.
Christopher Hutchinson
@cshutchinson
Mar 28 2015 23:49
grabbing your email for screenhero now
Priscilla P. Wood
@RailsGirl
Mar 28 2015 23:52
Ok, does anybody is experiencing issues with screen hero?