These are chat archives for FreeCodeCamp/Help

17th
Mar 2015
John Ellis
@johnmellis
Mar 17 2015 01:42
@johnmellis
Angular 1.3.14 - I have a form that's being validated by a directive; when I use <form name="formname" ng-submit="login(user)"> I can get the validation to work but the submit breaks
if I use <form id="formname" ng-submit="login(user)"> the submission works but the validation doesn't
any ideas?
Oliver
@Dadsaster
Mar 17 2015 02:56
I think you are supposed to use form-name with Angular
Erica
@Buzzlightyear90
Mar 17 2015 03:21
I am having a problem solving the palindrome problem, I tried all the tests on the browser console and they all returned true but not the bonfire
Cristián Berríos
@crisberrios
Mar 17 2015 03:22
can you paste/link your code?
Erica
@Buzzlightyear90
Mar 17 2015 03:26

``` function palindrome(str) {
// Good luck!
var patt1 = /[^\W]/g;
var a = str.match(patt1);
var string = "";
var string2 = "";

for(var i = a.length-1; i>=0; i--){
if (a[i] != " "){
string += a[i];
}
}

for(var j = 0; j<a.length; j++){
if (a[i] != " "){
string2 += a[i];
}
}

if (string.toLowerCase() == string2.toLowerCase()){
return true;
}else{
return false;
}

}```

function palindrome(str) {
  // Good luck!
  var patt1 = /[^\W]/g;
  var a = str.match(patt1);
  var string = "";
  var string2 = "";

  for(var i = a.length-1; i>=0; i--){
    if (a[i] != " "){
      string += a[i];
    }
  }

  for(var j = 0; j<a.length; j++){
    if (a[i] != " "){
      string2 += a[i];
    }
  }

  if (string.toLowerCase() == string2.toLowerCase()){
    return true;
  }else{
    return false;
  }

}
Cristián Berríos
@crisberrios
Mar 17 2015 03:29
let me check
assert.deepEqual(palindrome("never odd or even"), true);AssertionError:expected false to deeply equal true
assert.deepEqual(palindrome("A man, a plan, a canal. Panama"), true);AssertionError:expected false to deeply equal true
assert.deepEqual(palindrome("race car"), true);AssertionError:expected false to deeply equal true
assert.deepEqual(palindrome("eye"), true);AssertionError:expected false to deeply equal true
tests are not passing
Erica
@Buzzlightyear90
Mar 17 2015 03:32
I know but when I try it out on the console on my browser the function returns true for all of them. they are all palindromes
Cristián Berríos
@crisberrios
Mar 17 2015 03:36
let me check in the console
still returns false for A man, a plan, a canal. Panama
Erica
@Buzzlightyear90
Mar 17 2015 03:39
in the console? it returned true for me.
I'm using firebug in firefox
Danny Fritz
@dannyfritz
Mar 17 2015 03:40
Cristián Berríos
@crisberrios
Mar 17 2015 03:40
check line 20
change string for string2
Danny Fritz
@dannyfritz
Mar 17 2015 03:42
she is lower casing them in the if statements though
Cristián Berríos
@crisberrios
Mar 17 2015 03:42
I know, but string2 returns undefinedundefined
Danny Fritz
@dannyfritz
Mar 17 2015 03:42
oh lol, undefined*
ah i see the problem
your logic is good @Buzzlightyear90. You just have a tiny bug.
Erica
@Buzzlightyear90
Mar 17 2015 03:46
the second for loop mentions the variable 'i' again right?
Danny Fritz
@dannyfritz
Mar 17 2015 03:47
:)
Erica
@Buzzlightyear90
Mar 17 2015 03:48
it sucks when the smallest mistake causes great confusion and headache
Danny Fritz
@dannyfritz
Mar 17 2015 03:49
agreed
i think the only way to avoid leaky for variables like that is to use iterators like Array.forEach Array.map Array.reduce and such.
Cristián Berríos
@crisberrios
Mar 17 2015 03:51
or wait for ES6 and let the party go on
Erica
@Buzzlightyear90
Mar 17 2015 03:55
@dannyfritz I am not sure if I understand. I haven't seen such a method before.
Suzanne Atkinson
@AdventureBear
Mar 17 2015 04:05
@terakilobyte has me reading up on react now
anyone else?
Cristián Berríos
@crisberrios
Mar 17 2015 04:09
not yet
still much to learn
Suzanne Atkinson
@AdventureBear
Mar 17 2015 04:17
I'm not sure I get it.
i need "react" for baby JS programmers
Cristián Berríos
@crisberrios
Mar 17 2015 04:23
"thinking in react" is what keeps me off, same as "thinking in Angular"
I'm good at learning new tools
but getting better at Angular/React seems like narrowing too much my focus of attention
Suzanne Atkinson
@AdventureBear
Mar 17 2015 04:49
well I need something to connect my back end to my front! Torn on where to focus my attention and I'm not making any progress right now. :(
well progress, but kind of sideways all the time
Cristián Berríos
@crisberrios
Mar 17 2015 04:49
start with html, go on from there
you don't need react to display data
Suzanne Atkinson
@AdventureBear
Mar 17 2015 05:08
I don't know how to display data without a library of some type
Julie Myers
@BlueOceanView
Mar 17 2015 05:09
@AdventureBear When you say display data, what exactly do you mean?
Suzanne Atkinson
@AdventureBear
Mar 17 2015 05:26
From a mongo db
Julie Myers
@BlueOceanView
Mar 17 2015 05:26
Oh...so port data from MongoDB to the webpage?
You can use node.js, which is pretty popular way to do it.
https://university.mongodb.com/
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 11:29
needing some help with seek and destroy bonfire
here's my code so far
function destroyer(arr) {
  var newArr = arr.toString();
  return newArr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);

///it's returning "1, 2, 3, 5, 1, 2, 3"
any tips on how to proceed from here? I feel that I'm close to solving this
Evan Davis
@davisec52
Mar 17 2015 12:22
@ThiagoFerreir4 I don't know if this will help, but check out the Arguments object at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments. Also, I found the filter method helpful.
Suzanne Atkinson
@AdventureBear
Mar 17 2015 13:20
@BlueOceanView & @Crisberrios, I'm confused now. My whole quest has been how to bring a database to the web so I can manipulate store and retrieve data. I've done all the challenges here which promote mean. And now looking into alternatives for "A". I've done nodeschool and I am registered for the mongodb course. Somehow I missed the part where node can be used directly to bring data to the webpage...if it's easy why are we studying mean stack instead of MN stack?
Oliver
@Dadsaster
Mar 17 2015 15:16
@AdventureBear I believe some people substitute or leave out Angular and focus on express, node and mongodb. You could do everything in vanilla JavaScipt too.
Cristián Berríos
@crisberrios
Mar 17 2015 15:20
@AdventureBear dynamic data on the client side is not a bad thing and it can create great experiences not possible with html-only (that's why we're learning front-end JavaScript), but you don't need to start taming the gorilla if you can just do with the banana for now. Express uses templates (Jade, EJS and others) and they can be used to render data to the client. From a beginner's point of view this is easier than learning React.
Suzanne Atkinson
@AdventureBear
Mar 17 2015 15:37
I'm fine doing everything in vanilla JS...I just want it to work. I've been on a 2 year quest to get the database running on my laptop to a web based form so I can share it with my clients. I obviously won't give up until I figure it out. But I still feel like i'm going in circles, like in @QuincyLarson 's original article that brought me here. As helpful as people are here in wanting me to keep learning I am still kind of clueless. I've learned a ton of cool stuff. But I have real things I want to accomplish with programming. Help!
Cristián Berríos
@crisberrios
Mar 17 2015 15:39
you're almost there!
Suzanne Atkinson
@AdventureBear
Mar 17 2015 15:49
point me somewhere please!! :)
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 15:52
@AdventureBear This: "But I still feel like i'm going in circles, like in @QuincyLarson 's original article that brought me here. As helpful as people are here in wanting me to keep learning I am still kind of clueless. I've learned a ton of cool stuff. But I have real things I want to accomplish with programming. Help!" Same feeling I have right now!
Suzanne Atkinson
@AdventureBear
Mar 17 2015 15:53
@ThiagoFerreir4 I am starting the mongodb course today and will revisit the nodeschool learnyounode course that I am 7/11ths through. Just keep building a base until something clicks I guess?
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 15:54
@AdventureBear this posted by @crisberrios : http://reactive-extensions.github.io/learnrx/
been helping me to grasp things
but yeah...till something clicks I guess
Suzanne Atkinson
@AdventureBear
Mar 17 2015 16:02
but didn't he just tell us we didn't need react? lol.
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:04

Functional programming provides developers with the tools to abstract common collection operations into reusable, composable building blocks. You'll be surprised to learn that most of the operations you perform on collections can be accomplished with five simple functions:

map
filter
mergeAll
reduce
zip

Danny Fritz
@dannyfritz
Mar 17 2015 16:09
map and filter are easily implemented with reduce
Cristián Berríos
@crisberrios
Mar 17 2015 16:14
@AdventureBear that tutorial is mostly a functional JS tutorial. Up to challenge 26 it doesn't even use Rx extensions
morning @dannyfritz
Danny Fritz
@dannyfritz
Mar 17 2015 16:15
good morning @crisberrios
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:15
Hey guys
and how to implement it
Danny Fritz
@dannyfritz
Mar 17 2015 16:16
implement it?
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:16
I'm on seek and destroy bonfire
Suzanne Atkinson
@AdventureBear
Mar 17 2015 16:16
HTanks @crisberrios !
Danny Fritz
@dannyfritz
Mar 17 2015 16:17
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:17
@dannyfritz dude....txs really
:)
Suzanne Atkinson
@AdventureBear
Mar 17 2015 16:17
OH, yes I have looked at that one a few times. it's on my short list
Andrew Corcoran
@corca
Mar 17 2015 16:17
:+1: for @dannyfritz
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:18
that was darn fast
lol
I think I wanna be @dannyfritz when I grow up minus the fake beard...LOL
Danny Fritz
@dannyfritz
Mar 17 2015 16:18
lol
it is Spanish Moss
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:19
so you hv spanish moss for facial hair...:P
btw
Suzanne Atkinson
@AdventureBear
Mar 17 2015 16:20
:clap: @ spanish moss for hair
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:21
function destroyer(arr) {
  var newArr = arr.toString([]);
  return newArr;

}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
is my code going somewhere here
or should I just start over
Suzanne Atkinson
@AdventureBear
Mar 17 2015 16:21
@crisberrios in that tutorial you posted, when I look at it this code is already there:
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:21
?
Suzanne Atkinson
@AdventureBear
Mar 17 2015 16:21
function(console) {
    var names = ["Ben", "Jafar", "Matt", "Priya", "Brian"],
        counter;

    for(var counter = 0; counter < names.length; counter++) {
        console.log(names[counter]);
    }
}
Is it asking input additional code to iterate over the array? I find it to be rhetorical.
Danny Fritz
@dannyfritz
Mar 17 2015 16:23
@ThiagoFerreir4 Array.toString doesn't take any arguments. What are you expecting Array.toString([]) to do?
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:26
Remove all values (last argument(s)) from an array (first argument) and return as a new array.
but I'm clueless of how to go about it
Danny Fritz
@dannyfritz
Mar 17 2015 16:26
if you want to do something with arguments you'll need to include arguments. ;)
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:27
well yeah
I was about to
like if I'm on the right track
I was just wondering if that code is taking me somewhere or not
Suzanne Atkinson
@AdventureBear
Mar 17 2015 16:27
start over, lol.
;)
stick the arguments usage in and see what it gives you, hten see if that gives you any ideas
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 16:28
@AdventureBear txs...that was basically my question
get rid of my old code and start anew
Cristián Berríos
@crisberrios
Mar 17 2015 16:29
@AdventureBear 1st exercise(and some others) are just examples
Andrew Corcoran
@corca
Mar 17 2015 16:46
Is the Sorted Union bonfire a bit convoluted to anyone else?
Or do I just not know how to read instructions?
Julie Myers
@BlueOceanView
Mar 17 2015 16:48
@corca The instructions are not always clear.
Andrew Corcoran
@corca
Mar 17 2015 16:55
@BlueOceanView I’ve noticed, but this one seems particularly annoying.
I’ll just make it pass the test and live with it I suppose.
Suzanne Atkinson
@AdventureBear
Mar 17 2015 17:02
what part don't you understand?
Oliver
@Dadsaster
Mar 17 2015 17:03
You can generally figure out what they want by looking at the test cases
Andrew Corcoran
@corca
Mar 17 2015 17:05
Well based on the instructions I would expect that if you passed the two test arrays:
[1, 3, 2], [1, [5]], [2, [4]] and [1, 3, 2], [5, 2, 1, 4], [2, 1] you would want to get back
[ 3, [ 5 ], [ 4 ] ] and [ 3, 5, 4 ] respectively, because those are the unique values in each array passed to the function. But the test cases are looking for [1, 3, 2, [5], [4]] and [1, 3, 2, 5, 4] to be returned, which doesn’t make any sense to me because 1 and 2 are not unique values in the arrays passed as arguments….
In the first case 1 is in the 1st and 2nd arrays and 2 is in the 1st and 3rd. In the second case 1 and 2 are both in all three arrays.
Suzanne Atkinson
@AdventureBear
Mar 17 2015 17:11
a union contains all the values in each set, minus duplicates
[a,b,c], [b,c,d] should return [a,b,c],[d]
Oliver
@Dadsaster
Mar 17 2015 17:13
@corca - you just don't quite understand union
Andrew Corcoran
@corca
Mar 17 2015 17:13
Ooooohhhhhhhh
I’m having high school flashbacks now
Oliver
@Dadsaster
Mar 17 2015 17:13
It screwed me up too
Andrew Corcoran
@corca
Mar 17 2015 17:16
Thanks @AdventureBear and @Dadsaster.
Suzanne Atkinson
@AdventureBear
Mar 17 2015 17:17
:)
@crisberrios exercise 5 there, I can't get it to advance past even if I click "show answer" and "run". Any thoughts?
NM I just refreshed the page
Cristián Berríos
@crisberrios
Mar 17 2015 17:19
^
:D
Suzanne Atkinson
@AdventureBear
Mar 17 2015 17:21
ooh...did 6 all by myself. :)
little things
Cristián Berríos
@crisberrios
Mar 17 2015 17:23
some exercises get really though, but it will really strenghten your knowledge about map/filter/reduce plus mergeAll/flatMap which is a very common pattern
Oliver
@Dadsaster
Mar 17 2015 17:24
Does anyone have a good walkthrough for creating a first app on the MEAN stack?
Cristián Berríos
@crisberrios
Mar 17 2015 17:25
I've seen some tutorials being posted lately, don't know if they are on camper news
try searching the main channel
Suzanne Atkinson
@AdventureBear
Mar 17 2015 17:26
@Dadsaster the one I posted seemed good for a first MEAN stack, it was a simple Todo app.
I just got frustrated with the A part, but if that's what you are after check out out. I'll find it
Andrew Corcoran
@corca
Mar 17 2015 17:28
Do you have that link? Seems to have gotten lost in the fray
Andrew Corcoran
@corca
Mar 17 2015 17:29
Gracias
Oliver
@Dadsaster
Mar 17 2015 17:30
Thanks @AdventureBear
Suzanne Atkinson
@AdventureBear
Mar 17 2015 18:25
doing week 1 lectures of mongo university !
Cristián Berríos
@crisberrios
Mar 17 2015 18:28
me too
Thiago Ferreira
@ThiagoFerreir4
Mar 17 2015 19:00
txs for the tips guys...I got it finally, but had to do some pairing to get the final detail on it
Viacheslav
@Stee1House
Mar 17 2015 21:39
Hello, help me to do better code in example. Chunky Monkey example.
function chunk(arr, size) {
  var arr1 = [], arr2 = [], res = [];
  for(var i = 0; i <= arr.length - 1; i++) {
    if(i <= size - 1) arr1.push(arr[i]);
    else arr2.push(arr[i]);
  }  
    res[0] = arr1;
    res[1] = arr2;
  return res;
}
console.log(chunk(['a', 'b', 'c', 'd'], 2));
Cristián Berríos
@crisberrios
Mar 17 2015 21:39
does it work?
it seems that will only work for 2 chunks
Lucas
@cieslakslash
Mar 17 2015 21:41
does anyone have any video how to do ch#16? we have to do: This page is currently using a two-column layout, with the main content on the left and additional navigation on the right. See if you can make it a one-column layout.
Cristián Berríos
@crisberrios
Mar 17 2015 21:42
there are a few ways to do it
the idea is to modify it using bootstrap
that means adding/removing bootstrap classes
you could also hide the sidebar
Lucas
@cieslakslash
Mar 17 2015 21:45
i see, i will try to do it, but there are a lot of lines of html and css, hard to find something even if u r using ctrl+f
ty