These are chat archives for FreeCodeCamp/Help

19th
Nov 2017
Marc
@MWBauer
Nov 19 2017 00:08
Hiya' Stephen
Could someone help with api/json for the weather app?
Marc
@MWBauer
Nov 19 2017 00:20
Hello. Anyone around?
Stephen James
@sjames1958gm
Nov 19 2017 01:13
@MWBauer what do you need
Marc
@MWBauer
Nov 19 2017 01:20
Hey. So the api/json is working now. Not sure why it wasn't before. Now I'm working on the button and making the weather info display over the background.
Stephen James
@sjames1958gm
Nov 19 2017 01:29
:+1:
Marc
@MWBauer
Nov 19 2017 01:30
How are ya'?
Joshua Arnett
@josha5
Nov 19 2017 01:32
.
Stephen James
@sjames1958gm
Nov 19 2017 01:38
@MWBauer Well into my second beer :)
Joshua Arnett
@josha5
Nov 19 2017 01:43
@sjames1958gm Hey stephen you busy lol?
Stephen James
@sjames1958gm
Nov 19 2017 01:43
Just watching a movie
Marc
@MWBauer
Nov 19 2017 01:44
What kind of beer?
Stephen James
@sjames1958gm
Nov 19 2017 01:44
Devils's backbone Belgian style Trippel
Joshua Arnett
@josha5
Nov 19 2017 01:45
@sjames1958gm Welll do you think you could help me with why my series function isn't working on my simon game? All I'm trying to do is replay a flash on each button that was successfully clicked.
Stephen James
@sjames1958gm
Nov 19 2017 01:45
@josha5 I can try
Joshua Arnett
@josha5
Nov 19 2017 01:46
function replayFlash(butPressArr) {
  function eachColor(i) {
    setTimeout(function() {
      var litColor = butPressArr[i];
      litColor.addClass("lit");
      setTimeout(function() {
        litColor.removeClass("lit");
      }, 1500 - (1500 / 3));
    }, 1500 * (i + 1));
  }
  for(var i = 0; i < butPressArr.length; i++) {
    eachColor(i);
  }
}
butPressArr contains the id's of all the buttons successfully clicked
I just need to loop over that array and play a flash on each one
Stephen James
@sjames1958gm
Nov 19 2017 01:47
@josha5 Shouldn't your remove timeout use i as well?
Oops never mind it doesn't start until the other runs
What is happening that isn't correct
Marc
@MWBauer
Nov 19 2017 01:49
@sjames1958gm Have you tried their mushroom beer?
Stephen James
@sjames1958gm
Nov 19 2017 01:49
I have not
Joshua Arnett
@josha5
Nov 19 2017 01:49
@sjames1958gm The function just isn't working at all
Marc
@MWBauer
Nov 19 2017 01:50
I encourage you
I'm aggravated with these buttons.
I'm trying to use the same code from my quote gen and it isn't working.
Stephen James
@sjames1958gm
Nov 19 2017 01:51
@josha5 Is butPressArr an array of jquery elements?
Joshua Arnett
@josha5
Nov 19 2017 01:52
yeah "#redButton", "#yellowButton" etc
im calling the function with replayFlash ($(buttonPress))
Stephen James
@sjames1958gm
Nov 19 2017 01:53
I don't see anything wrong with this function
Joshua Arnett
@josha5
Nov 19 2017 01:53
hmm thats what I thought I dont know why its not working
Stephen James
@sjames1958gm
Nov 19 2017 01:53
Maybe use console.log to see if the array is correct going into the function?
Joshua Arnett
@josha5
Nov 19 2017 01:56
hmm I'm getting an error litColor.addClass is not a function
Stephen James
@sjames1958gm
Nov 19 2017 01:57
@josha5 That tells me that the array doesn't have jquery element objects
Joshua Arnett
@josha5
Nov 19 2017 01:59
@sjames1958gm that weird
const simonButtons = [("#greenButton"), ("#redButton"), ("#blueButton"), ("#yellowButton")];
should I use this symbol $ in front of all of them and then push that into the array?
Stephen James
@sjames1958gm
Nov 19 2017 02:01
Yes you need the $ which is a shortcut for jquery function
You don't have to push Just use the $ in that array for each one
Here you only have an array of strings.
like this : [$("#greeButton"}]
Joshua Arnett
@josha5
Nov 19 2017 02:10
I'm still getting an error doing that. When I console.log it its pushing the actual div into the array and not the string
Stephen James
@sjames1958gm
Nov 19 2017 02:21
You want the divs if you are going to use add / remove clasw
Your other option is to use
litColor = $(butPressArr[i]);
then the string will be used to select the div
Joshua Arnett
@josha5
Nov 19 2017 02:24
I just tried that as well i can't figure out why it still isn't working
im still getting the same undefined error
Not sure if you wanna check out my codepen and maybe you'll see something i dont
Stephen James
@sjames1958gm
Nov 19 2017 02:25
post the link
Joshua Arnett
@josha5
Nov 19 2017 02:25
Its a lot and also messy as usual lol
Stephen James
@sjames1958gm
Nov 19 2017 02:27
Try removing the $ here - not sure what jquery is going to do with an array
replayFlash($(buttonPress));
Joshua Arnett
@josha5
Nov 19 2017 02:29
I did it did't make the function work
Joshua Arnett
@josha5
Nov 19 2017 02:38
Meh I've tried everything I don't understand
Stephen James
@sjames1958gm
Nov 19 2017 02:42
I tried var litColor = $(butPressArr[i]); and I don't get that not a function error, but it still isn't lighting the button ??
Joshua Arnett
@josha5
Nov 19 2017 02:44
@sjames1958gm Yeah All I'm getting is undefined now
Stephen James
@sjames1958gm
Nov 19 2017 02:45
I think that is coming from the calling function -
console.log(highLighted);
Joshua Arnett
@josha5
Nov 19 2017 02:45
Oh right I see line 59 just from my clearTimeout
This is so weird so nothing is happening.
Is my css correct for my buttons
wouldn't just be #redButton.lit {}
@sjames1958gm I was getting that error when I was calling the replayFlash function with replayFlash($(buttonPress))
Stephen James
@sjames1958gm
Nov 19 2017 02:49
Yeah that $ is wrong you want the $ when you assign litColor
You might be running into a specificity problem where the #greenColor has high priority than the #greenColor.lit
@josha5 Use the same technique from above
      var litColor = $(butPressArr[i]);
      var c = litColor.css("background-color");

      litColor.css("background-color", "#ffcccc");
Joshua Arnett
@josha5
Nov 19 2017 02:57
@sjames1958gm I love you
@sjames1958gm thank you 1000x man
CamperBot
@camperbot
Nov 19 2017 02:57
josha5 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8698 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Nov 19 2017 02:57
@josha5 :+1:
Joshua Arnett
@josha5
Nov 19 2017 02:57
@sjames1958gm always save my ass when im stuck lol
Daniel Shillinglaw
@GiraffeFFA
Nov 19 2017 02:58
   jkm
Stephen James
@sjames1958gm
Nov 19 2017 03:03
@josha5 I am betting that because you used .css in the first place the class and css file was not able to override your .css
Joshua Arnett
@josha5
Nov 19 2017 03:05
@sjames1958gm Yeah that makes sense
@sjames1958gm Good to know for the future lol I was stuck for like 4 hours >.>
Stephen James
@sjames1958gm
Nov 19 2017 03:06
@josha5 I put a long timeout before it did the removeClass and was able to look in the inspector and it showed that there was a element.style setting which I beleive is from .css
Joshua Arnett
@josha5
Nov 19 2017 03:15
@sjames1958gm I need to start using the inspector more instead of just the console inside codepen
Marc
@MWBauer
Nov 19 2017 03:52
Is there something special you need to do to put a button on top of a background?
Henry
@GitHub-Henry
Nov 19 2017 04:07
@MWBauer no, if you don't see the button check the z-index :shipit: :sparkles:
Marc
@MWBauer
Nov 19 2017 04:12
Ok. In the example it has img { etc... Can I just plug it into a class that's already defined and being used? .black-box?
For right now, I have the background, but whenever I try to put the C/F button in it just creates a button at the top and makes a bunch of whitespace.
Marc
@MWBauer
Nov 19 2017 04:18
Ok.
Henry
@GitHub-Henry
Nov 19 2017 04:18
@MWBauer z-index is like any css property, so add it where you need it.
Marc
@MWBauer
Nov 19 2017 04:18
got that button on background. now to get my text on there.
Thanks @GitHub-Henry
CamperBot
@camperbot
Nov 19 2017 04:18
mwbauer sends brownie points to @github-henry :sparkles: :thumbsup: :sparkles:
:cookie: 489 | @github-henry |http://www.freecodecamp.org/github-henry
if you wanna' look. nothing too cool yet
Henry
@GitHub-Henry
Nov 19 2017 04:23
@MWBauer good luck, essential learning for this project includes async JS, & call backs. not needed but really good to learn, promises. i don't remember if fcc mentions it when you start the project.
Marc
@MWBauer
Nov 19 2017 04:33
I've had a higher level coder agree with me that this project is given out too early. It's a lot of learning about aspects that we haven't covered.
But...it's a lot of learning. And that's why we're here
I'm looking up this opaque box and it does the same thing twice...I think. It looks like maybe one example for some browsers and one example for others?
div.transbox {
  margin: 30px;
  background-color: #ffffff;
  border: 1px solid black;
  opacity: 0.6;
  filter: alpha(opacity=60); /* For IE8 and earlier */
}

div.transbox p {
  margin: 5%;
  font-weight: bold;
  color: #000000;
}
Am I correct in what I'm thinking?
Henry
@GitHub-Henry
Nov 19 2017 04:35
@MWBauer i think it encourages self learning
@MWBauer i don't think so (could be wrong), perhaps read this for what it references
primuscovenant
@primuscovenant
Nov 19 2017 10:07
@heroiczero thx
CamperBot
@camperbot
Nov 19 2017 10:07
primuscovenant sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 2066 | @heroiczero |http://www.freecodecamp.org/heroiczero
wulixiaohappy
@wulixiaohappy
Nov 19 2017 15:24
<script $(document).ready(function() {});></script> is that right?
is that the right way to close script?
Marc
@MWBauer
Nov 19 2017 15:31
anytime you close anything I'm pretty sure you use </>
morning everyone!
:coffee::wave:
Marc
@MWBauer
Nov 19 2017 16:15
No one?
Kyle Holm
@thekholm80
Nov 19 2017 16:16
@wulixiaohappy $(document).ready(function() {}); doesn't go inside the opening tag, it goes between <script> and </script>
<script>
  // your code here
</script>
Marc
@MWBauer
Nov 19 2017 16:25
Morning Kyle
Kyle Holm
@thekholm80
Nov 19 2017 16:25
@MWBauer :wave:
Marc
@MWBauer
Nov 19 2017 16:26
have you ever seen something like div.transbox?
Kyle Holm
@thekholm80
Nov 19 2017 16:26
nope
Marc
@MWBauer
Nov 19 2017 16:27
I hadn't either. That's not saying much, but I hadn't
Do you know if it can work that way?
or should I trim it down to .transbox?
Kyle Holm
@thekholm80
Nov 19 2017 16:27
i have no idea what you're talking about
Marc
@MWBauer
Nov 19 2017 16:30
div.transbox p {
  margin: 5%;
  font-weight: bold;
  color: #000000;
}
Darren
@DarrenfJ
Nov 19 2017 16:30
morning fCC
Marc
@MWBauer
Nov 19 2017 16:30
the div.transbox. I've never seen it labeled that way
Morning Darren
Darren
@DarrenfJ
Nov 19 2017 16:30
just popping into say hi before :coffee:
hey buddy!
Kyle Holm
@thekholm80
Nov 19 2017 16:30
@DarrenfJ :wave:
Marc
@MWBauer
Nov 19 2017 16:30
What's shakin'?
Darren
@DarrenfJ
Nov 19 2017 16:31
hi @thekholm80 what's up?
Kyle Holm
@thekholm80
Nov 19 2017 16:31
@DarrenfJ drinking coffee, trying to pry my eyes open
you?
Marc
@MWBauer
Nov 19 2017 16:31
lol
Darren
@DarrenfJ
Nov 19 2017 16:31
aboutto :D
Marc
@MWBauer
Nov 19 2017 16:31
Wife is trying this Gingerbread coffee.
It'll put some hair on your chest for sure. lol
Darren
@DarrenfJ
Nov 19 2017 16:33
mmm sounds delish tbh
Kyle Holm
@thekholm80
Nov 19 2017 16:34
@MWBauer i'm not the best with css selectors, but it looks like what you have will select all p tags whos parents are divs with a class of transbox
Marc
@MWBauer
Nov 19 2017 16:35
Ok. I had never seen that. Wasn't sure if they were trying to use subliminal messaging in the example telling me to use in a <div> the transbox
Marc
@MWBauer
Nov 19 2017 16:59
My api isn't working.
Then it is
Then it isn't.
lol
Sometimes my background is there and sometimes it isn't.
I don't understand what I'm doing that would interrupt it.
Tiffany E Caldwell
@tecald
Nov 19 2017 17:01
sner vvemydad
Darren
@DarrenfJ
Nov 19 2017 17:02
back
oh my it's quiet in here
@MWBauer .transbox is a class? never seen it before either.. what's it do?
lemme google it brb
@tecald hi! sner back atcha
Marc
@MWBauer
Nov 19 2017 17:07
i'm trying to build an opaque or transparent box for the text to go in for the weather app
I had just never seen something like div.xxx
Darren
@DarrenfJ
Nov 19 2017 17:09
I've just run into it on the CSS vids I've been watching... lemme find it
brb
Darren
@DarrenfJ
Nov 19 2017 17:15
ok found it.. it wasn't net ninja but codecademy (redoing the newly released html and css from codecademy as well to shore up the gaps in my knowledge)

"Chaining Selectors
When writing CSS rules, it's possible to require an HTML element to have two or more CSS selectors at the same time.

This is done by combining multiple selectors, which we will refer to as chaining. For instance, if there was a .special class for h1 elements, the CSS would look like:

h1.special {
}

The code above would select only the h1 elements that have a class of special. If a p element also had a class of special, the rule in the example would not style the paragraph."

I'd never seen this way before either until last week
it specifically targets elements with that class only...
now if you are not using the class for anything else then it can be an ID of course and just target the ID, but it's good to know that we can dig right in if we want to when our pages get complex...
ok.. off for more :coffee: and podcasts...
thanks @MWBauer @thekholm80 for the hanging out and chat...
CamperBot
@camperbot
Nov 19 2017 17:18
darrenfj sends brownie points to @mwbauer and @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1595 | @thekholm80 |http://www.freecodecamp.org/thekholm80
api offline
Darren
@DarrenfJ
Nov 19 2017 17:18
ltr
Ken Haduch
@khaduch
Nov 19 2017 18:00
@MWBauer - css-tricks has some guides on CSS selectors - https://css-tricks.com/how-css-selectors-work/. I find that I forget some of these that I don't use often and it's good to get a refresher. Always have to go back and re-learn and refresh things that were once understood... :older_man:
David
@David-Moreira
Nov 19 2017 19:24
Hello guys.
I need a little help please!!
I'm not the Inventory Update Challenge
I'm having some difficulties sorting a 2d array. Why is it not working? Code Below. Any tips!? Appreciate your help!
function updateInventory(arr1, arr2) {
    // All inventory must be accounted for or you're fired!

    function sortFunction(a, b) {
        a = a[1];
        b = b[1];

        return (a === b) ? 0 : (a < b) ? -1 : 1;
    }


  var count = 0;
  arr2.forEach(function(newItem){
    count = 0;
    arr1.forEach(function(currentItem){
        if (currentItem.includes(newItem[1])){
        currentItem[0] += newItem[0];
        count++;

      }
    });
    if (count == 0) {
      arr1.push(newItem);
    }

  });

arr1 = arr1.sort(sortFunction());

return arr1 ;
}



// Example inventory lists
var curInv = [
    [21, "Bowling Ball"],
    [2, "Dirty Sock"],
    [1, "Hair Pin"],
    [5, "Microphone"]
];

var newInv = [
    [2, "Hair Pin"],
    [3, "Half-Eaten Apple"],
    [67, "Bowling Ball"],
    [7, "Toothpaste"]
];

updateInventory([[21, "Bowling Ball"], [2, "Dirty Sock"], [1, "Hair Pin"], [5, "Microphone"]], [[2, "Hair Pin"], [3, "Half-Eaten Apple"], [67, "Bowling Ball"], [7, "Toothpaste"]]);
gishy1
@gishy1
Nov 19 2017 19:27
@DarrenfJ chunky monkey bro
gishy1
@gishy1
Nov 19 2017 19:47
hello world
can anyone explain to me why we cant use a for loop for the chunky monkey exercise?
gishy1
@gishy1
Nov 19 2017 19:53
hello univese??
ola?
ni hao?
Darren
@DarrenfJ
Nov 19 2017 21:28
@khaduch totally agree. have to go back and relearn all the CSS stuff all the time
@gishy1 i'm not sure it would limit you from using a for loop.. I don't recall what I tried...
@gishy1 ok I just checked my solution and i used a for loop
@gishy1 i just made sure my for loop incremented by the size of the chunk.. and then used slice to push a section into a new array.. the chunked array
Darren
@DarrenfJ
Nov 19 2017 21:38
thanks @khaduch for the link. With the CSS challenges I'm back into reviewing everything on CSS.. want to look at it inside and out....
CamperBot
@camperbot
Nov 19 2017 21:38
darrenfj sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3515 | @khaduch |http://www.freecodecamp.org/khaduch
Darren
@DarrenfJ
Nov 19 2017 22:06
man.. that was a great read!!!! thanks again
so many little nuances i missed out on
Ken Haduch
@khaduch
Nov 19 2017 23:58
@DarrenfJ @DarrenfJ - thanks for checking it out. I think that one problem is that I don't have enough practice using the stranger cases - they make interesting lessons, but the use cases seem to sometimes be elusive? At a first level, it's good to know that all of these selectors exist, and you have to remember when to go back and find the right one when you need it. Kind of like regular expressions...
CamperBot
@camperbot
Nov 19 2017 23:58
khaduch sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2280 | @darrenfj |http://www.freecodecamp.org/darrenfj