These are chat archives for MontCode/GeneralChat

26th
Jun 2016
Jonathan Herman
@lantech19446
Jun 26 2016 01:54
I juet
I just woke up and saw this and misread it as pantera could not figure out why the hell a metal band had your salad
Lily Romano
@Lilyheart
Jun 26 2016 02:56
@rmaylie9560 I never actually answered your question. Did do much actual coding. I’ve been cleaning up existing repos separating out things in my “personal-projects” repo that have grown to the point they need their own. heh
@lantech19446 I feel like there is a great come back to that but I’m just not able to find it tonight. :crying_cat_face:
Jonathan Herman
@lantech19446
Jun 26 2016 03:17
Sleep on it and let me know
Lily Romano
@Lilyheart
Jun 26 2016 03:21
will do boss
David Castner
@davidjcastner
Jun 26 2016 03:22
alright, got lazy and kept it simple but I'm calling it done http://codepen.io/davidjcastner/pen/KMMxwW
Lily Romano
@Lilyheart
Jun 26 2016 03:31
Love it. Now with "toned down" color shifts.
David Castner
@davidjcastner
Jun 26 2016 03:32
I'll be playing around with animations and transitions more on the next couple projects
Lily Romano
@Lilyheart
Jun 26 2016 03:32
Looking’ forward to it.
Robert Maylie
@rmaylie9560
Jun 26 2016 12:24
The color shifts are what made it awesome. It's well done, but now it's like all the rest of the quote machines😔
Lily Romano
@Lilyheart
Jun 26 2016 12:58
I still sense a shift. Now it's subtle like an inside joke.
Robert Maylie
@rmaylie9560
Jun 26 2016 13:12
I noticed a slight deviation... I thought it might of been misperception.
so I have a random thought that occurred to me today.
how many explosions/fires were caused while Edison was testing concepts for the filiment
Essentially it's a controlled short, but finding a material that is conductive, and illuminates at a low temperature had to be a painful process.
Robert Maylie
@rmaylie9560
Jun 26 2016 13:24
So after some googles... he used tungsten. Coincidently the same material my old wedding ring was made of. Apprently marriage and light bulbs have more in common then I originally thought. (Que tiny violin)
Robert Maylie
@rmaylie9560
Jun 26 2016 13:30
Than not then😕
Jonathan Herman
@lantech19446
Jun 26 2016 13:31
He actually tried over 3200 different materials before tungsten including human hair
Robert Maylie
@rmaylie9560
Jun 26 2016 13:31
Then I should of used than instead of then. Then then would be than
nooooooo waaaaaaay
who the hell would burn hair and expect it to glow!?!?!
Lily Romano
@Lilyheart
Jun 26 2016 13:32
When will then be than? Soooooon
Robert Maylie
@rmaylie9560
Jun 26 2016 13:34
hahaha
Jonathan Herman
@lantech19446
Jun 26 2016 13:34
He baked it first to carbonize it but no one understood electricity yet. The only thing to exist was dc which edison created he wired pretty much our entire area as well as the rest of the northeast of the country they knew metal worked but not why
Lily Romano
@Lilyheart
Jun 26 2016 13:35
Every single time I say soooooon I m quoting that movie. Few know :)
Robert Maylie
@rmaylie9560
Jun 26 2016 13:41
And what movie would that be lil?
Robert Maylie
@rmaylie9560
Jun 26 2016 13:46
very cool Johnny. Just think what he could of accomplished with a modern electric meter.
Thats kind of a paradox....
nevermind
Jonathan Herman
@lantech19446
Jun 26 2016 13:48
Only problem is the electrical meter measures phases in ac to work lol
Robert Maylie
@rmaylie9560
Jun 26 2016 13:51
Hmm... That's kind of correct. Depending on the meter your using and the settings you have on.
but regardless of what type of voltage or wave your mesuring you would need some sort of power be it from the source you're measuring or a secondary source (like a battery powered meter)
You're nor your
Robert Maylie
@rmaylie9560
Jun 26 2016 13:58
not not nor
It's cool you're into electric John, have you played around with an ardunio
Veeeeeery cool stuff
Jonathan Herman
@lantech19446
Jun 26 2016 14:06
No haven't messed with arduino yet, what i do know is mostly from studying ham and when i was younger I was obsessed with edison
Robert Maylie
@rmaylie9560
Jun 26 2016 14:14
Give it a try. satisfy your inner Edison. It probably has a plug in rf module. What frequency range is designated for casual communication?
spaceballs!!!!!
Ahhh great movie
Programming and robotics go together like peas and carrots!
Robert Maylie
@rmaylie9560
Jun 26 2016 14:20
I just wish I was smart enough to understand machine learning...
Jonathan Herman
@lantech19446
Jun 26 2016 15:08
no such thing as not being smart enough, you just have to figure out how you learn best
Lily Romano
@Lilyheart
Jun 26 2016 15:14
@rmaylie9560 I’ve seen this course come recommended https://www.coursera.org/learn/machine-learning
Also search youtube for a playlist called Machine Learning Summer School 2014. Gitter does weird things to playlist links.
kevincauto
@kevincauto
Jun 26 2016 17:22
I'm stuck on the "Steamroller Challenge". I was wondering if someone could take a look at this. Currently, it seems to break the browser when I run it. Infinite loop possibly?
function steamrollArray(arr) {
   var answer = [];

  for(i=-1; i<arr.length; i++){
   //empty array case
    if(arr.length===0){
      return answer;
    }
    if(i===-1){
      i++;
    }
    //if the current array index does 
    //not contain another array
    if(!Array.isArray(arr[i])){
      answer.push(arr[i]);
    }
    //if the current array has a 
    //sub-array use recursion
    if(Array.isArray(arr[i])){
      answer = steamrollArray2(arr[i], answer);
    }
  }

  return answer;

}
//I created a second function just like the first 
//because I don't want to re-initialize
//answer = []; and FCC doesn't like global 
//variables
function steamrollArray2(arr, answer) {

  for(i=-1; i<arr.length; i++){
   //empty array case
    if(arr.length===0){
      return answer;
    }
    if(i===-1){
      i++;
    }

    //if the current array index does 
    //not contain another array
    if(!Array.isArray(arr[i])){
      answer.push(arr[i]);
    }
    //if the current array has a sub-array 
    //use recursion to.
    if(Array.isArray(arr[i])){
      steamrollArray2(arr[i],answer);
    }
  }

  return answer;

}

steamrollArray([1, [2], [3, [[4]]]]);

/*
 steamrollArray([[["a"]], [["b"]]]) should return ["a", "b"].
steamrollArray([1, [2], [3, [[4]]]]) should return [1, 2, 3, 4].
steamrollArray([1, [], [3, [[4]]]]) should return [1, 3, 4].
steamrollArray([1, {}, [3, [[4]]]]) should return [1, {}, 3, 4]. 
*/
David Castner
@davidjcastner
Jun 26 2016 17:26
@kevincauto taking a look at it now
David Castner
@davidjcastner
Jun 26 2016 17:45
@kevincauto your algorithm for solving it seems solid, trying to figure out why it gets stuck in a loop
kevincauto
@kevincauto
Jun 26 2016 17:46
Thanks so much for looking this over @davidjcastner.
Lily Romano
@Lilyheart
Jun 26 2016 17:47
both for starts at -1?
David Castner
@davidjcastner
Jun 26 2016 17:47
@Lilyheart it's so he can check for array length, it might be reason for it, let me check something real quick
I've already put together some example code on an alternative method for checking
ah nevermind I've figured it out
Lily Romano
@Lilyheart
Jun 26 2016 17:52
/curious
David Castner
@davidjcastner
Jun 26 2016 17:56
// for your loop statements use var i = -1 when initializing the index
// use this instead
for(var i = -1; i < arr.length; i++) { /* your loop code */ }
// otherwise i is a global variable and your recursive functions keep overwriting it
// so after it returns from one of them, it goes back to -1 every time

// also I'm typing up an alternative way to check for array length because looping through an array
// starting at index of -1 is confusing and not clear, therefore it's a bad practice
your logic is sound though
kevincauto
@kevincauto
Jun 26 2016 17:59
Oh so i is a global variable that is being reused and causing problems. Putting var in there resets it each time.
David Castner
@davidjcastner
Jun 26 2016 18:00
yes and your code works when you use var
Lily Romano
@Lilyheart
Jun 26 2016 18:02
Good catch! I totally missed that.
kevincauto
@kevincauto
Jun 26 2016 18:02
That's awesome! I just learned something new.
David Castner
@davidjcastner
Jun 26 2016 18:02
used a ton of console.log()'s to find it
kevincauto
@kevincauto
Jun 26 2016 18:06
Ok so I know that i=-1 was a clunky solution. I just moved the if statement case for empty arrays out of the loop and set the for loop to var i=0 again. It still works.
David Castner
@davidjcastner
Jun 26 2016 18:06
Nice exactly what I was going to suggest
kevincauto
@kevincauto
Jun 26 2016 18:06
Thank you so much @davidjcastner! That challenge was driving me crazy.
Thanks @Lilyheart for taking a look at it as well!
Lily Romano
@Lilyheart
Jun 26 2016 18:07
Man, I gotta get back to FCC soon or both ya’ll gonna pass me!
David Castner
@davidjcastner
Jun 26 2016 18:09
Here is what I had typed up for suggestions on how to make your code clearer
function steamrollArray(arr) {
    var answer = [];
    // steamrollArray2 is redundant
    // here's how to avoid writing the code twice:
    //
    // instead we can define a function instead here rather than the global
    // namespace and then it avoids writing the same code twice
    //
    // notice it's doesn't take the answer as an argument
    // that's because it will have access to it since it's being defined inside
    // the steamrollArray function
    var recursiveSteamrollArray = function(arr) {
        // starting at index of -1 makes your code unclear, and therefore is
        // a bad practice, even though your logic is correct
        //
        // to avoid the case of arr.length being 0 we can check before enterting
        // the for loop
        if (arr.length === 0) {
            return answer;
        }
        for (var i = 0; i < arr.length; i++) {
            // no need to use if (i === -1) { i++; } anymore
            //if the current array index does
            //not contain another array
            if (!Array.isArray(arr[i])) {
                answer.push(arr[i]);
            }
            //if the current array has a
            //sub-array use recursion
            if (Array.isArray(arr[i])) {
                answer = recursiveSteamrollArray(arr[i], answer);
            }
        }
        return answer;
    };
    // recursiveSteamrollArray was defined but not called yet
    // so let's call the function and then return answer
    recursiveSteamrollArray(arr);
    return answer;
}

console.log(steamrollArray([1, [2],
    [3, [
        [4]
    ]]
]));
kevincauto
@kevincauto
Jun 26 2016 18:10
Ok cool. I will look this over now.
David Castner
@davidjcastner
Jun 26 2016 18:11
@kevincauto it's basically a way to avoid having to duplicate your code in the fcc environment
kevincauto
@kevincauto
Jun 26 2016 18:16
@davidjcastner Love it. Yeah that all makes sense. Everything is contained within the function and avoids the global namespace entirely.
Lily Romano
@Lilyheart
Jun 26 2016 18:17
Oh that is an interesting way to solve!
David Castner
@davidjcastner
Jun 26 2016 18:18
I'm having lunch right now, but you can simplify that even more by using Array.map I'll post that after I eat
Lily Romano
@Lilyheart
Jun 26 2016 18:18
Here is how I did it. I am bad at commenting sometimes
function steamrollArray(arr) {
  var flatArr = [];
  for (var i = 0; i < arr.length; i++) {
    if (Array.isArray(arr[i])) {
      var tempArr = steamrollArray(arr[i]);
      for (var j = 0; j < tempArr.length; j++) {
        flatArr.push(tempArr[j]);
      }
    } else {
      flatArr.push(arr[i]);
    }
  }

  return flatArr;
}
kevincauto
@kevincauto
Jun 26 2016 18:27
Nice!
David Castner
@davidjcastner
Jun 26 2016 18:36
// here is how to do it with Array.map
function steamrollArray(arr) {
    var answer = [];
    var flatten = function(element) {
        if (Array.isArray(element)) {
            element.map(flatten);
        } else {
            answer.push(element);
        }
    };
    flatten(arr);
    return answer;
}
Mike
@dcpking
Jun 26 2016 23:49
Slowly working through the BootCamp (for my sins!). Inputs of type date and password are new to me, and placeholders, and also the checking in the button on the form to see if you entered valid dates, etc. I used to have to write JavaScript to validate those!!
Jonathan Herman
@lantech19446
Jun 26 2016 23:56
If i learn anything from @davidjcastner it damn well better be commenting my code lol.