These are chat archives for FreeCodeCamp/Help

5th
Feb 2015
Bin Ury
@teddy-error
Feb 05 2015 03:41
grunt-google-cdn@0.4.3 node_modules/grunt-google-cdn
events.js:72
        throw er; // Unhandled 'error' event
              ^
trying to install grunt but getting this
from what ive been reading on stack overflow it seems like people are reverting to 1.8.0 to workaround
> yo doctor                                                                                                          ~/tangogg/client@teddy-mac

Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ NODE_PATH matches the npm root
Ammar Ali Shah
@AmmarAliShah
Feb 05 2015 04:10
Anyone available who can help me understand some python?
Sudeepto
@Sudeepto
Feb 05 2015 15:42

Hello friends I have some doubts. Which query is more preferable ??
$('#location1').find('input').attr('readonly', true)

$('#location1 input' ).attr('readonly', true)

If I am not wrong, the first one is traversal and the second one is selector . Which one is considered good ??

Nathan
@terakilobyte
Feb 05 2015 15:43
the second
you're not beating around the bush
if you know the selector then use it
Cristián Berríos
@crisberrios
Feb 05 2015 15:44
Also, I think that .prop instead of .attr is better for properties
Sudeepto
@Sudeepto
Feb 05 2015 15:46
@terakilobyte What do you mean by know the selector ??
@crisberrios What is the difference between .prop and .attr ??
Cristián Berríos
@crisberrios
Feb 05 2015 15:48
prop is for properties
because readonly is not an attribute
like <input type="text" readonly>
type is an attribute (I think :P)
since you can set type="email" etc...
but readonly is either true or false
or you could say "present or absent"
Nathan
@terakilobyte
Feb 05 2015 15:50
^ prop is preferable
Julie Myers
@BlueOceanView
Feb 05 2015 15:50
@Sudeepto When CSS targets elements it uses selectors. There are many different types of selectors, like the class selector, the element selector and so on. jQuery uses CSS selectors a lot.
Nathan
@terakilobyte
Feb 05 2015 15:50
and what I mean by "know the selector" is this, imagine the following
Cristián Berríos
@crisberrios
Feb 05 2015 15:51
Also, even if what you wrote will work, when you do $('#location1 input' ).attr('readonly', false) it won't
Nathan
@terakilobyte
Feb 05 2015 15:51
<div id="thing1"> stuff
  <div id="thing2"> more stuff </div>
</div>
If I happen to know that I have something I can hook onto directly, why spend the time traversing the DOM?
time = UX = you mess it up and the user is gone
the internet is fast
everything you do slows it down
slow it down too much and you won't have users to author neat stuff for
Sudeepto
@Sudeepto
Feb 05 2015 15:54

@crisberrios . Thank You for the explanation . I searched for it and got the attr() function. Also the solution here on FCC used the attr function.

But I will remember to use prop() from now on.

@terakilobyte Thank you.

@BlueOceanView Thanks for the info :smile:
Julie Myers
@BlueOceanView
Feb 05 2015 15:56
You're welcome.
Nathan
@terakilobyte
Feb 05 2015 15:57
we use attr because it's set to disabled initially
so it's kind of a hacky bad practices way
ideally we'd do use the prop accessor to set it to disabled on page ready
due to the way that challenge is served though it's not an easy thing to do, and the counselors and I that worked on it weren't sure the best way to go about it
Sudeepto
@Sudeepto
Feb 05 2015 16:00
@terakilobyte Ohhh.
One more thing . Can you guys tell me how to stop chrome from displaying notification cards ?? The green indicator on gitter is enough indication for a new message. I want the chrome notification for this site to be disabled.
Nathan
@terakilobyte
Feb 05 2015 16:01
go up into the settings for the room (top right of the window to the left of the search bar, looks like a wrench and a screwdriver) and disabled notifications
Sudeepto
@Sudeepto
Feb 05 2015 16:03
@terakilobyte But that will disable the website notifications. Right ?? I am okay with those green counters. What I don't want is chrome's desktop notifications that pops up one over the other like cards.
Nathan
@terakilobyte
Feb 05 2015 16:03
it disabled the popups for me
not the unread messages icon
Sudeepto
@Sudeepto
Feb 05 2015 16:05
@terakilobyte I think I solved it. I just unchecked the gitter website from chrome's bell icon settings and then it asked me whether to either allow or block the desktop notifications. I clicked on Block . :smile:
Dave Holtzhouser
@dholtz
Feb 05 2015 20:11
There is a recommendation to use Screenhero for paring here: http://www.freecodecamp.com/challenges/34
Screen Shot 2015-02-05 at 2.11.48 PM.png
But it looks like Slack has acquired them and signups are closed?
Branden Byers
@brandenbyers
Feb 05 2015 20:17
The directions for that challenge have a link to download Screenhero @dholtz
Victor
@pahlsson
Feb 05 2015 20:17
you can still grab the program through the direct link on the challenge page (for windows at least)
Branden Byers
@brandenbyers
Feb 05 2015 20:19
@dholtz yes, Screenhero has been acquired, and yes, the service may go away. But until then, we recommend following the direct link and you will be able to sign up for a full free account from within the app. Screenhero still allows current users to invite new users, so consider the challenge with direct links your invitation!
Dave Holtzhouser
@dholtz
Feb 05 2015 20:20
Got it, @brndnb I need to read closer ;)
Suzanne Atkinson
@AdventureBear
Feb 05 2015 20:22
@brndnb so I've done all the challenges but still need to do the coderbytes. @terakilobyte has suggested some nodeschool resources, and someone (was it you?) sent me an angular recipe book. Aside from coderbytes/bonfires, any suggestions as to how to choose a next direction? I'm not doubting nathan, just wondering what others experiences were!
Branden Byers
@brandenbyers
Feb 05 2015 20:24
@AdventureBear the nodeschool stuff is okay, but be prepared to follow the poorly written directions closely and searching the internet for how to parts of the challenges.
Suzanne Atkinson
@AdventureBear
Feb 05 2015 20:24
lol, OK. when it happens I won't get flustered. I have lots of things to work on!
off i go...
Branden Byers
@brandenbyers
Feb 05 2015 20:28
Also, @AdventureBear, it’s not free, but I took a month of the FrontEnd Masters classes and I felt it was worth it. Solidified and extended a lot of my understanding.
They are lecture format, so no browser based coding lessons.
Alex Dixon
@alex-dixon
Feb 05 2015 22:32
I’ve been trying to get a todo list app going with MEAN but keep getting stuck and basically I’m back at square one. Any advice?
Jordan Wood
@jordanw
Feb 05 2015 22:37
@alex-dixon From scratch or are you following a tutorial?
Alex Dixon
@alex-dixon
Feb 05 2015 22:38
@JordanW Not following anything in particular at this point. Whatever you’d recommend. I’m a total n00b
Cristián Berríos
@crisberrios
Feb 05 2015 22:40
@alex-dixon I think I've seen some MEAN/TODO tutorials in youtube. 1st focus in the backend and try to run tests with Mocha or something like that against it.
Jordan Wood
@jordanw
Feb 05 2015 22:40
@alex-dixon Lol. How far along are you in the challenges? Just for a reference point.
Alex Dixon
@alex-dixon
Feb 05 2015 22:41
@JordanW all but coderbytes
Nice. Let me know if you ever want to pair.
Alex Dixon
@alex-dixon
Feb 05 2015 22:47
@JordanW Thanks. So, it says node and angular. I think i’ve done one like that which uses local storage but not mongo
I guess at this point i’m trying to see if I could make a to-do app that uses mongo, express, angular and node together?
Jordan Wood
@jordanw
Feb 05 2015 22:50
@alex-dixon Ok. Yeah not sure why it's titled like that. They use mongoose and mongodb in that tutorial.
philsco
@philsco
Feb 05 2015 22:51
Hey I'm missing something on the Bonfire "Sum All Primes". Not understanding how the test case is even possible: expect(sumPrimes(10)).to.equal(27)
Cristián Berríos
@crisberrios
Feb 05 2015 22:52
if you are 100% sure your code is working as the given instructions, contact @terakilobyte since some tests don't match the description in some bonfires
Alex Dixon
@alex-dixon
Feb 05 2015 22:52
@JordanW Oh. Awesome. :D Thanks
Jordan Wood
@jordanw
Feb 05 2015 22:54
@alex-dixon No problem :). This one covers more of the basics in setting up the MEAN structure https://scotch.io/tutorials/creating-a-single-page-todo-app-with-node-and-angular. In case that other one is hard to follow.
philsco
@philsco
Feb 05 2015 22:55
@crisberrios Its more of a math question actually... I'm probably interpreting it wrong. Sum of prime numbers up to and including 10 should be 17
Cristián Berríos
@crisberrios
Feb 05 2015 22:55
1+2+3+5+7 = 18
philsco
@philsco
Feb 05 2015 22:56
actually 1 is not considered a prime. still not 27 though
Banun Idris
@mininsomniac
Feb 05 2015 22:57
it's 2+3+5+7 = 17 and then including the number passed in (10) i think = 27
Cristián Berríos
@crisberrios
Feb 05 2015 22:57
so, 27 - 17 = 10 ... doesn't make sense
can you link the bonfire and your code please?
Banun Idris
@mininsomniac
Feb 05 2015 22:58
regardless of whether the num passed in is a prime
@mininsomniac ah then 26
Cristián Berríos
@crisberrios
Feb 05 2015 22:58

Sum all the prime numbers up to and including the provided number.

A prime number is defined as having only two divisors, 1 and itself. For example, 2 is a prime number because it's only divisible by 1 and 2. 1 isn't a prime number, because it's only divisible by itself.

The provided number may not be a prime.

philsco
@philsco
Feb 05 2015 22:58
er yea 27
Cristián Berríos
@crisberrios
Feb 05 2015 22:59
try the test adding to the sum the provided number
Banun Idris
@mininsomniac
Feb 05 2015 22:59
yep @philsco
Cristián Berríos
@crisberrios
Feb 05 2015 22:59
see what happens
:P
philsco
@philsco
Feb 05 2015 23:00
yeah works for that test case but not the next. Sorcery I tell ya
Cristián Berríos
@crisberrios
Feb 05 2015 23:00
can you link your code?
philsco
@philsco
Feb 05 2015 23:00

function sumPrimes(num) {
var baseP = [2, 3, 5, 7];
var sum = 0;

for (x=2; x<=num; x++) {
if (x%2!==0 && x%3!==0 && x%5!==0 && x%7!==0) {
console.log(x);
sum +=x;
} else if (x===2 || x===3 || x===5 || x===7) {
console.log(x);
sum +=x;
}
}

return sum;
}

sumPrimes(10);

need to learn how to format this
Banun Idris
@mininsomniac
Feb 05 2015 23:03
add ``` before and after your code
philsco
@philsco
Feb 05 2015 23:03
function sumPrimes(num) {
  var baseP = [2, 3, 5, 7];
  var sum = 0;

  for (x=2; x<=num; x++) {
    if (x%2!==0 && x%3!==0 && x%5!==0 && x%7!==0) {
      console.log(x);
      sum +=x;
    } else if (x===2 || x===3 || x===5 || x===7) {
      console.log(x);
      sum +=x;
    }
  }

  return sum;
}

sumPrimes(10
Cristián Berríos
@crisberrios
Feb 05 2015 23:04
@philsco your function for checking primes doesn't work all the way up to 977
or I might be wrong but as the numbers go up it will miss some primes
philsco
@philsco
Feb 05 2015 23:07
yup back to the drawing board. Now that I know to add the input number regardless of whether its a prime or not
Cristián Berríos
@crisberrios
Feb 05 2015 23:07
with p_i<p_j for i<j. For n=2, 3, ..., the first few are 2, 3, 2, 5, 3, 7, 2, 3, 5, 11, 3, 13, 7, 5, ... (OEIS A006530). The greatest multiple prime factors for squareful integers are 2, 2, 3, 2, 2, 3, 2, 2, 5, 3, 2, 2, 3, ... (OEIS A046028).
add to check 11 and 13 and you will have a much broader range of numbers to work