These are chat archives for FreeCodeCamp/HelpJavaScript

9th
Aug 2018
Christopher McCormack
@cmccormack
Aug 09 2018 00:07
@newmoon hey glad to see you're starting to study React - there are several reasons to choose one over the other, it may just come down to personal preference. Some React-bootstrap features work with state to trigger actions like dropdowns, while with the bootstrap library you would have to either implement it yourself or use jquery on top of React which can be troublesome
newmoon
@newmoon
Aug 09 2018 00:12
Thanks @cmccormack, but not sure what that means "work with state to trigger actions". Maybe it will make more sense after building more than a simple hello world.
Christopher McCormack
@cmccormack
Aug 09 2018 00:19
yup!
Fikry82
@Fikry82
Aug 09 2018 00:23
var count = 0;

function cc(card) {
  // Only change code below this line
  switch(card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
    count +=1;
    break;
    case 7:
    case 8:
    case 9:
    count = 0;
    break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
    count -=1;
  }
  if(count == 0 || count < 0){
    return 'Hold';
  }else{
    return 'Bet';
  }


  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
whats wrong ??
Fikry82
@Fikry82
Aug 09 2018 00:29
any help ??
Christopher McCormack
@cmccormack
Aug 09 2018 00:29
@Fikry82 count = 0 is wrong
why would you set count to 0 for those cards?
Fikry82
@Fikry82
Aug 09 2018 00:30
did you mean that 0 = no value
and i keep the value of count
Christopher McCormack
@cmccormack
Aug 09 2018 00:37

@Fikry82 I don't know what you mean by

did you mean that 0 = no value

but in that case count should not be modified, so setting it to 0 is bad
Fikry82
@Fikry82
Aug 09 2018 00:37
do i need looping ??
i dont think switch will get me there
Christopher McCormack
@cmccormack
Aug 09 2018 00:39
you should not require a loop, you are not required to loop over anything
you do have the option of simply not assigning anything in the case it is 7 8 or 9
Fikry82
@Fikry82
Aug 09 2018 00:40
still not working :)
Christopher McCormack
@cmccormack
Aug 09 2018 00:42

@Fikry82

still not working :)

this is not useful when you're asking for assistance, you'll have to share what you changed and your thought process as well. We should not be helping you solve the problem fully, you should be trying to figure it out and asking about syntax or other issues you do not recognize or have questions about

Fikry82
@Fikry82
Aug 09 2018 00:44
okay
var count = 0;

function cc(card) {
  // Only change code below this line
  switch(card){
    case 2:
    count +=1;
    case 3:
    count +=1;
    case 4:
    count +=1;
    case 5:
    count +=1;
    case 6:
    count +=1;
    case 10:
    case 'J':
    count -=1;
    case 'Q':
    count -=1;
    case 'K':
    count -=1;
    case 'A':
    count -=1;
  }
  if(count <= 0){
    return count +' '+'Hold';
  }else{
    return count +' ' +'Bet';
  }


  // Only change code above this line
}

// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
Christopher McCormack
@cmccormack
Aug 09 2018 00:46
@Fikry82 you did not need to do the count increments/decrements after every case, you were closer in your previous code
謝育能(Harry Xie)
@a90100
Aug 09 2018 00:46
var count = 0;

function cc(card) {
  // 请把你的代码写在这条注释以下
  switch (card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
      count++;
      break;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
      count--;
      break;
  }
  if(count>0){
    return '\"'+count+" Bet"+'\"';
  }
  else if(count<=0){
    return '\"'+count+" Hold"+'\"';
  }
  // 请把你的代码写在这条注释以上
}
// 你可以在这里添加/删除 cc 方法的调用来测试结果
// 提示: 左边只会显示最后一次执行的返回值
cc(2);cc(3); cc(4); cc(5); cc(6);
Why my code can not work successfully?
Christopher McCormack
@cmccormack
Aug 09 2018 00:48
@a90100 @Fikry82 can you provide the link to the FCC challenge?
Christopher McCormack
@cmccormack
Aug 09 2018 00:49
thanks :)
@a90100 do not add " around your return string
Fikry82
@Fikry82
Aug 09 2018 00:50
function cc(card) {
  // Only change code below this line
  switch(card){
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
    count +=1;
    case 10:
    case 'J':
    case 'Q':
    case 'K':
    case 'A':
    count -=1;
  }
  if(count <= 0){
    return count + ' ' + 'Hold';
  }else{
    return count + ' ' + 'Bet';
  }


  // Only change code above this line
}
Christopher McCormack
@cmccormack
Aug 09 2018 00:50

@a90100

Do NOT include quotes (single or double) in the output.

Fikry82
@Fikry82
Aug 09 2018 00:50
but its string ??
謝育能(Harry Xie)
@a90100
Aug 09 2018 00:51
Oh,I got it.Thanks for the help.
Christopher McCormack
@cmccormack
Aug 09 2018 00:51
@Fikry82 just to verify you still have var count = 0; in your code right?
@a90100 :thumbsup:
Fikry82
@Fikry82
Aug 09 2018 00:52
yes
on top
global
it works :)
Christopher McCormack
@cmccormack
Aug 09 2018 00:53
awesome!
Fikry82
@Fikry82
Aug 09 2018 00:53
break; was the porblem
but i dont understand
if i remove break; it should work right ?
Christopher McCormack
@cmccormack
Aug 09 2018 00:54
@Fikry82 not necessarily, if you have additional expressions below those may be run as well
that's bad
Fikry82
@Fikry82
Aug 09 2018 00:55
yea but will not effect the count value
Christopher McCormack
@cmccormack
Aug 09 2018 00:55
@Fikry82 each count modification is an expression, so it will
Fikry82
@Fikry82
Aug 09 2018 00:56
okay
thx @cmccormack
Nate Mallison
@NJM8
Aug 09 2018 02:34
Hey @cmccormack
hows it going
anyone familiar with axios and http errors?
trying to figure out how this works:
axios.interceptors.response.use(undefined, function(err) {
  return new Promise(function() {
    if (err.status === 401 && err.config && !err.config.__isRetryRequest) {
      console.log("unauthorized");
      this.logout();
      this.$router.push({ name: "login" });
    }
    throw err;
  });
});
not sure what err.config and __isRetryRequest is for
ATom M
@ATom-M
Aug 09 2018 07:59
It looks like this conditional statement is checking whether the err.config is present and also that retry request is false
Tiago Correia
@tiagocorreiaalmeida
Aug 09 2018 08:04
gm everyone
anyone around used to chaihttp?
Tiago Correia
@tiagocorreiaalmeida
Aug 09 2018 08:33
im trying to test a post with image upload + body fields
for some reason the body reaches empty
any idea what im missing?
ATom M
@ATom-M
Aug 09 2018 09:04

Morning, does anyone know if this test is broken? "Basic Data Structures: Iterate Through All an Array's Items Using For Loops"
`function filteredArray(arr, elem) {
let newArr = [];
let arrL = arr.length;
// change code below this line
for(let k=0; k < arrL; k++){
for(let i=0; i < arr[k].length; i++){
if(arr[k][i]===elem){
break;
}
if(i===arr[k].length){
newArr.push(arr[k])
}
}
}
// change code above this line
return newArr;
}

// change code here to test different cases:
console.log(filteredArray([[3, 2, 3], [1, 6, 3], [3, 13, 26], [19, 3, 9]], 3));`

Aditya
@ezioda004
Aug 09 2018 09:10
@ATom-M if(i===arr[k].length) would never execute because i < arr[k].length in the loop.
Blauelf
@Blauelf
Aug 09 2018 09:17
When I click "Run the Tests", nothing seems to happen, the dev tools showing an error message very different on Firefox and Chrome. Not sure if it is something with my settings, but I guess it might indeed be broken.
Ah, now some of the tests are running on Chrome, maybe I was too fast.
hensn5250
@hensn5250
Aug 09 2018 09:20
@Blauelf hello sir
Blauelf
@Blauelf
Aug 09 2018 09:21
First three tests fail even though I'm pretty sure my solution is correct (using indexOf instead of an inner for loop) :-/
@hensn5250 I haven't been knighted (as far as I know), so "sir" is probably inaccurate.
hensn5250
@hensn5250
Aug 09 2018 09:23
oh right
Aditya
@ezioda004
Aug 09 2018 09:23
Maybe because the challenge wants you to use for loop? Seems to be working with nested for loop
hensn5250
@hensn5250
Aug 09 2018 09:23
Just a ice breaker to getting a favor
Blauelf
@Blauelf
Aug 09 2018 09:24
@ezioda004 But it's failing on the content-comparing tests, and is perfectly happy with my single for loop.
hensn5250
@hensn5250
Aug 09 2018 09:24
Was wondering if you or anyone could take a look at some code of mine on JSfiddle
will post the link
Aditya
@ezioda004
Aug 09 2018 09:29
@Blauelf I tried with indexOf instead of inner loop, it worked
Blauelf
@Blauelf
Aug 09 2018 09:29
Chrome?
Aditya
@ezioda004
Aug 09 2018 09:29
Yep
Blauelf
@Blauelf
Aug 09 2018 09:30
I don't even have any extensions installed on that one.
Aditya
@ezioda004
Aug 09 2018 09:34
Cant find any open issue for this either
Blauelf
@Blauelf
Aug 09 2018 09:36
I see a lot of "Blocked script execution in 'https://...' because the document's frame is sandboxed and the 'allow-scripts' permission is not set." - maybe that's the reason.
hensn5250
@hensn5250
Aug 09 2018 09:44
@Blauelf or anyone jsfiddle link
i've been trying to incorporate minimax into a game I already made. the code above was an attempt to use the minimax algo. it doesn't work as expected
the AI selects the wrong values
Blauelf
@Blauelf
Aug 09 2018 09:46
That's interesting. If I use a for..of loop instead of a regular one on https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-all-an-arrays-items-using-for-loops/, everything works. Whenever I go regular for loop, the output is correct, but the tests crash, even though they should work on the output, not the code.
hensn5250
@hensn5250
Aug 09 2018 09:49
^^ so you're suppose to flatten the filtered array???
Tiago Correia
@tiagocorreiaalmeida
Aug 09 2018 09:50
@alpox around?
Blauelf
@Blauelf
Aug 09 2018 09:52
@hensn5250 Where is your code for when you are not maximising?
hensn5250
@hensn5250
Aug 09 2018 09:52
it comes directly after the maximising code
Blauelf
@Blauelf
Aug 09 2018 09:53
Without an else?
hensn5250
@hensn5250
Aug 09 2018 09:53
VS code refused to allow an else since the if has a return
Blauelf
@Blauelf
Aug 09 2018 09:53
Ah, I see you have a return there. Missed that one.
hensn5250
@hensn5250
Aug 09 2018 09:53
didn't bother fighting it
Blauelf
@Blauelf
Aug 09 2018 09:55
How do you call your minimax function?
Ah, found it. Above the definition. Hoisting :P
hensn5250
@hensn5250
Aug 09 2018 09:57
yup
Blauelf
@Blauelf
Aug 09 2018 09:58
JSON.parse(JSON.stringify(game)) is pretty deep for a shallow copy.
hensn5250
@hensn5250
Aug 09 2018 10:01
i meant deep copy , forgot to change it later
shallow copy caused issues
Blauelf
@Blauelf
Aug 09 2018 10:01
What's that game, and why do you think 2 is a bad choice?
hensn5250
@hensn5250
Aug 09 2018 10:01
Tic tac toe
if AI is[0,1] and player is [6,7] AI should play [2] to win the game
it doesn't do that
I've been looking over the code and can't figure out why
Blauelf
@Blauelf
Aug 09 2018 10:05
It's doing so for me.
hensn5250
@hensn5250
Aug 09 2018 10:05
Yea.... just noticed it....smh
it's probably a false positive
Blauelf
@Blauelf
Aug 09 2018 10:05
const game = {
  unmarked_squares: [2, 3, 4, 5, 8],
  droid_marks: [0, 1],
  player_1_marks: [6, 7],
};
Result is 2
hensn5250
@hensn5250
Aug 09 2018 10:08
it wasn't working before
hensn5250
@hensn5250
Aug 09 2018 10:14
const game = {
  unmarked_squares: [ 1, 2, 5, 7, 8],
  droid_marks: [0,3],
  player_1_marks: [4,6],
};
//result is 5
it doesn't block the opponent from winning
Blauelf
@Blauelf
Aug 09 2018 10:47
@hensn5250 I think it's an issue with how you report the move. You always return the move that led to the game end, and pass that up the call chain. So the move you wanted would have led to 5 being the last move with a draw as its result.
@hensn5250 If you replace move : best_move; with { position: sqr, score: move.score } : best_move;, it seems to work.
hensn5250
@hensn5250
Aug 09 2018 10:57
@Blauelf You're right! Still checking all the possibilities but all are passing.
Thanks so much
How did you figure that was the case? I was trying to find the issue using the debugger but since the code was recursive it was hard to keep track of the values.
Blauelf
@Blauelf
Aug 09 2018 11:05
I reduced the empty tiles to two choices: 2 and 5, and logged the board and the return value of the minimax function. The lowest level (game end) would always return the right one, while the initial move would return move 5, but with the correct score of 0. The same the other call reported.
hensn5250
@hensn5250
Aug 09 2018 11:07
I see. Makes sense now.
so is it pointless to add the position as an argument in the minimax( board, depth, maximizer, position ) ?
Blauelf
@Blauelf
Aug 09 2018 11:16
I think so.
hensn5250
@hensn5250
Aug 09 2018 11:22
I tried changing it but it's giving me errors. I'll leave it as it is . Again, thanks a lot. Saved me lots of time.
@Blauelf Later
catalin560
@catalin560
Aug 09 2018 11:23
I don't understand why you're using JSON.parse(JSON.stringify()) instead of array.slice() or even [...array] how is shallow copy not working for you? @hensn5250
hensn5250
@hensn5250
Aug 09 2018 11:24
I was using Object.assign() and getting issues
Blauelf
@Blauelf
Aug 09 2018 11:25

The state that's cloned is an object, with its properties holding arrays. One would have to slice the arrays separately.

In such cases, I usually modify my state and revert the modifications later, so I can avoid a copy. Isn't applicable everywhere.

catalin560
@catalin560
Aug 09 2018 11:26
@hensn5250 oh my bad... anyway your script looks good! Nice job!
hensn5250
@hensn5250
Aug 09 2018 11:28
Thnks. I thought since there weren't any nested objects Object.assign or similar would work but ran into issues
Later all
Jason Luboff
@JLuboff
Aug 09 2018 15:08
Morning :wave:
Chris
@crokita
Aug 09 2018 15:09
good morning
Jason Luboff
@JLuboff
Aug 09 2018 15:10
How's it going?
Chris
@crokita
Aug 09 2018 15:11
pretty fine, thanks. messing with AWS EC2 machines right now
Jason Luboff
@JLuboff
Aug 09 2018 15:12
Cool
Christopher McCormack
@cmccormack
Aug 09 2018 15:21
@NJM8 hey man sorry I wasn't around, wandered off to watch Westworld with the wife :)
:wave: allo
Jason Luboff
@JLuboff
Aug 09 2018 15:22
First or second season?
Christopher McCormack
@cmccormack
Aug 09 2018 15:26
Second season again
after the second season we wanted to see what we forgot in season 1 so rewatched, then decide to watch season 2 again
Such a great show
Jason Luboff
@JLuboff
Aug 09 2018 15:26
Jeez. I think we're only half way into episode 1 of season 2
Christopher McCormack
@cmccormack
Aug 09 2018 15:27
halfway into an episode??
Jason Luboff
@JLuboff
Aug 09 2018 15:27
Keep in mind....we have a toddler...
Christopher McCormack
@cmccormack
Aug 09 2018 15:30
yeah I guess
kind of violent for a toddler though isn't it?
chenqian
@M-cq
Aug 09 2018 15:30

var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
if(
myObj.hasOwnProperty("checkProp")
){
return "myObj[checkProp]";
}else{
return "Not Found";
}

}
checkObj("gift");

Jason Luboff
@JLuboff
Aug 09 2018 15:31
@M-cq No quotes around checkProp nor around myObj[checkProp]
checkProp is a parameter, by putting quotes around it you're turning it into a string
chenqian
@M-cq
Aug 09 2018 15:31
hello , i have a problem , why i only get the Not Found
Jason Luboff
@JLuboff
Aug 09 2018 15:31
same in your return, you're turning an object into a string
chenqian
@M-cq
Aug 09 2018 15:31
thanks you
i will try it again
thanks so much
Jason Luboff
@JLuboff
Aug 09 2018 15:33
:thumbsup:
@cmccormack Yes... and so the times we can watch it...is when he is sleeping..but..he doesn't like his mom being too far away when he is sleeping lol
chenqian
@M-cq
Aug 09 2018 15:37
last time you get me out from a troble ,now again ,
Christopher McCormack
@cmccormack
Aug 09 2018 15:39
@JLuboff is a saint :angel:
chenqian
@M-cq
Aug 09 2018 15:40
maybe ,haha
Jason Luboff
@JLuboff
Aug 09 2018 15:40
I'd say I'm far from a saint but, thanks lol
Christopher McCormack
@cmccormack
Aug 09 2018 15:43
no demon emoji I could find so you're stuck with it
Jason Luboff
@JLuboff
Aug 09 2018 15:44
hah
Christopher McCormack
@cmccormack
Aug 09 2018 15:49
I haven't had time to review the latest but if you say it's good I don't see why not
Jason Luboff
@JLuboff
Aug 09 2018 16:20
@cmccormack Was that meant for our other room?
Christopher McCormack
@cmccormack
Aug 09 2018 16:21
I think gitter is broken, when you switch between channels it can sometimes merge two channels so it looks like you're posting in the correct channel but you're not necessarily
Jason Luboff
@JLuboff
Aug 09 2018 16:22
You use the browser version huh? I use the desktop version
Christopher McCormack
@cmccormack
Aug 09 2018 16:22
Yeah
I often have trouble just clicking a channel that's near the one I"m in
Can't use that on my work asset
Jason Luboff
@JLuboff
Aug 09 2018 16:23
The desktop version?
Christopher McCormack
@cmccormack
Aug 09 2018 16:27
yeah
Look at that, two certifications of different times in two days time!
Christopher McCormack
@cmccormack
Aug 09 2018 16:29
nice man what was the other one
the SQL?
Jason Luboff
@JLuboff
Aug 09 2018 16:29
Ya lol
Christopher McCormack
@cmccormack
Aug 09 2018 16:29
So productive
Chris
@crokita
Aug 09 2018 16:29
congrats
Jason Luboff
@JLuboff
Aug 09 2018 16:30
Thanks, it was a joint effort on the last project (exercise tracker) between @cmccormack and @moT01 to complete that one
Christopher McCormack
@cmccormack
Aug 09 2018 16:31
Well shoot I cant let @JLuboff beat me I need to get mine too
Jason Luboff
@JLuboff
Aug 09 2018 16:31
So... I need to come up with a new work title for myself.. I suggested DBA/Programmer to my boss and he wanted something different so told me to come up with 3, and he'll come up with 3 and we'll see which one works lol
Christopher McCormack
@cmccormack
Aug 09 2018 16:31
There are industry standard titles out there
maybe check glassdoor
Like my generic Sr. Infrastructure Engineer I - I don't know what that means really but apparently HR across the country do
Jason Luboff
@JLuboff
Aug 09 2018 16:32
Lol
Ya I'll check glass door
I could go with Software Developer but.. that doesn't necessarily include the DBA side
Christopher McCormack
@cmccormack
Aug 09 2018 16:33
Systems Developer?
no idea
Jason Luboff
@JLuboff
Aug 09 2018 16:33
Systems Developer might be good
Christopher McCormack
@cmccormack
Aug 09 2018 16:34
May not be 100% accurate though, System has it's own connotation

http://fcc-exercise-tracker.herokuapp.com

I think it looks great, nice job @moT01 and @JLuboff !

Jason Luboff
@JLuboff
Aug 09 2018 16:35
And a nice job to you as well!
Christopher McCormack
@cmccormack
Aug 09 2018 16:35
the dynamic URL is neat
Jason Luboff
@JLuboff
Aug 09 2018 16:36
Ya I didn't even look to see how Tom did that
I assume a listener on the form
Christopher McCormack
@cmccormack
Aug 09 2018 16:36
most likely
Jason Luboff
@JLuboff
Aug 09 2018 16:36
Then again, he only committed like 2 line changes..so.. :P
Christopher McCormack
@cmccormack
Aug 09 2018 16:37
I know, the slacker
Jason Luboff
@JLuboff
Aug 09 2018 16:37
Hmmm... Systems/Software Engineer might fit..
Christopher McCormack
@cmccormack
Aug 09 2018 16:45
How about Professional Hackerman
Jason Luboff
@JLuboff
Aug 09 2018 16:48
Perhaps... perhaps..
:smile:
Jason Luboff
@JLuboff
Aug 09 2018 16:53
@moT01 Congrats!
Tom
@moT01
Aug 09 2018 16:53
either of you have any of the next section projects done?
Jason Luboff
@JLuboff
Aug 09 2018 16:54
IS/QA projects? No haven't even looked at that section
Tom
@moT01
Aug 09 2018 16:55
me neither - just taking a look now
Christopher McCormack
@cmccormack
Aug 09 2018 16:56
nope
Tom
@moT01
Aug 09 2018 16:56
looks like some good learning in there
Christopher McCormack
@cmccormack
Aug 09 2018 16:56
yeah
I probably won't start any of them for a little while, until work slows down
Jason Luboff
@JLuboff
Aug 09 2018 16:58
Yup...same here.. sounds like I may have more projects incoming
Tom
@moT01
Aug 09 2018 17:00
well, maybe we'll get a chance to team on one of those when we get there
Christopher McCormack
@cmccormack
Aug 09 2018 17:01
yeah - I wonder if they are in order of difficulty
Ankur sharma
@ankur1163
Aug 09 2018 17:34
can someone help me with css
I have something like this
<div class="row">
           <div class="col-1-of-2">
             <h3 class="heading-tertiary">
               You are going to fall in love with nature
             </h3>
             <p  class="paragraphone">
               Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
             </p>
             <h3 class="heading-tertiary">
               Live adventure like you never have before
             </h3>
             <p class="paragraph">
               Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
             </p>
           </div>
           <div class="col-1-of-2">
             Image composition
           </div>
         </div>
the paragraphone or paragraph class doesnt work
.paragraph{
  font-size: 1.6rem;
  margin-bottom: 100px;
  background-color: red;

  &:not(:last-child){
    margin-bottom: 3rem;
  }


}
background color doesnt change , so this class isnt getting applied
that is strange
Christopher McCormack
@cmccormack
Aug 09 2018 17:40
@ankur1163 can you put this into a codepen or similar, best to show all code as occassionally the issue may be somewhere else entirely, like an unclosed tag or lack of <style> tags
Blauelf
@Blauelf
Aug 09 2018 17:41
@ankur1163 Looks like this CSS is SCSS. Have you set up a preprocessor for that?
Ankur sharma
@ankur1163
Aug 09 2018 17:42
yeah that is done
@cmccormack I am using scss. Its compiling perfectly
code here
if i put inline style like this
 <p style="background-color: red" class="paragraph">
               Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
             </p>
Christopher McCormack
@cmccormack
Aug 09 2018 17:45
@ankur1163 is any of the other CSS working?
Ankur sharma
@ankur1163
Aug 09 2018 17:45
The background color do change
yeah, everything else is working
Christopher McCormack
@cmccormack
Aug 09 2018 17:46
@ankur1163 pasting your CSS is still not enough, can you please post in something like codesandbox or codepen if you're going to share?
Blauelf
@Blauelf
Aug 09 2018 17:46
Inline has highest specificity. Have you looked in the inspector which other rules apply, maybe overriding your background colour?
Christopher McCormack
@cmccormack
Aug 09 2018 17:46
You should try it in one of those tools first anyhow to see if you have any issues
issue is this class is not getting attached to the element
Blauelf
@Blauelf
Aug 09 2018 17:47
@ankur1163 I think you are missing a } above that class. The one for .heading-secondary {
Brad
@bradtaniguchi
Aug 09 2018 17:49
nothing sucks more than installing a graphics card, it not working, then trying to install drivers and finding out the internet isn't working either -_-
Ankur sharma
@ankur1163
Aug 09 2018 17:49
yes yes
it works
thanks @bradtaniguchi
and thanks @cmccormack
is there any atom package which can pick such type of error?
Brad
@bradtaniguchi
Aug 09 2018 17:50
hehe I didn't help 1 bit :p
Jason Luboff
@JLuboff
Aug 09 2018 17:51
@bradtaniguchi onboard graphics FTW :P
Ankur sharma
@ankur1163
Aug 09 2018 17:51
lol
newmoon
@newmoon
Aug 09 2018 17:51
sneaker network FTW
Ankur sharma
@ankur1163
Aug 09 2018 17:51
i meant thanks @Blauelf
Brad
@bradtaniguchi
Aug 09 2018 17:52
when you want dual monitors and onboard only offers DVI and a displayport, and you want two hdmi's you gotta go graphics card haha
Or if you want to play games XD]
Jason Luboff
@JLuboff
Aug 09 2018 17:52
It's called an adapter
:)
Blauelf
@Blauelf
Aug 09 2018 17:54
@bradtaniguchi I know that feeling of not having drivers. How would I download my modem's drivers without internet connection? (I downloaded at the university and put the drivers on a bunch of floppies, was not just a modem, but an ISDN adapter with phone and all possible extras, so those were maybe 10 not-so-floppy 3.5" diskettes)
And there are DP->HDMI adapters (assuming your graphics card supports HDMI signals on the port), and they have gotten cheaper since they are not only used by Apple followers any more.
Kudzu
@czhower
Aug 09 2018 17:56
DP --> HDMI only works with certain enabled DP connections IIRC.....
Christopher McCormack
@cmccormack
Aug 09 2018 17:57
yeah needs to be active
I made that mistake before, not sure why they sell passive they never seem to work
Blauelf
@Blauelf
Aug 09 2018 17:57
Yes, the graphics card needs to provide HDMI signals on the DP port, the adapter then does level shifting only.
Kudzu
@czhower
Aug 09 2018 17:57
no, I mean DP can embed a HDMI compat signal but not all DP ports do, espeically cards with more than one DP port.
yes @Blauelf
Brad
@bradtaniguchi
Aug 09 2018 18:00
I've only tried using a display port like 1 time and it didn't work, don't remember why but I usually go hdmi or dvi, and vga only if I can't do the first two
Blauelf
@Blauelf
Aug 09 2018 18:01
@cmccormack All adapters are active at least a bit. But there are full converters (working on any DP port, those might need extra power), and the more efficient are just level shifting an HDMI signal provided on the DP. Those come in different maximum data rates, and nobody prints that on their adapters (for good reason).
Kudzu
@czhower
Aug 09 2018 18:02
@bradtaniguchi 4k etc.. dp becomes more important.
Christopher McCormack
@cmccormack
Aug 09 2018 18:02
I just figured they could sell a passive for cheap, an active for more, and when the passive doesn't work they've now sold two products for a single solution :)
Kudzu
@czhower
Aug 09 2018 18:02
DP gained popularity because those behind HDMI biased it too much for media (TV) and made licensing costs too high, so DP was formed by video/monitor companies.
Jason Luboff
@JLuboff
Aug 09 2018 18:03
Most, if not all new computers we've been getting are strictly DP
Kudzu
@czhower
Aug 09 2018 18:03
Its a PITA to do another change, but DP is really better even if only slightly, but in the right areas than HDMI for PCs etc.
Blauelf
@Blauelf
Aug 09 2018 18:04
Are there any DP monitors not specifically targeted to Apple followers?
Christopher McCormack
@cmccormack
Aug 09 2018 18:06
Anything over 1080P probably has DP
Both of mine do, my pricey G-Sync and my BenQ
Kudzu
@czhower
Aug 09 2018 18:06
4k and up for sure. Mine has 1 DP, 1 DVI and 3 x HDMI.... HDMI has issues at higher resolutions.
"The maximum pixel clock rate for HDMI 1.0 is 165 MHz, which is sufficient to allow 1080p and WUXGA (1920×1200) at 60 Hz. HDMI 1.3 increases that to 340 MHz, which allows for higher resolution (such as WQXGA, 2560×1600) across a single digital link."
ie, hdmi gets complicated and iffy above thos.
Blauelf
@Blauelf
Aug 09 2018 18:08
Now I just need a bigger flat to store a 4k monitor :D
Kudzu
@czhower
Aug 09 2018 18:08
sure hdmi 2.0 etc. .but then cables, hw... ie everything has to match in...
Simon Cordova
@gbsimon87
Aug 09 2018 18:46
Good evening :)
Must say, VS Code is pretty slick
Kudzu
@czhower
Aug 09 2018 18:49
Yes it is. :)
very clean, minimal and very open.
Simon Cordova
@gbsimon87
Aug 09 2018 18:49
Microsoft is really targeting developers, VS Code and Github
These guys aren't playing around these days - funny though, the place I'm currently working for doesn't not support IE11 or lower HA!
love it
Kudzu
@czhower
Aug 09 2018 18:50
Given that MS bought GH... I would say so. :)
Simon Cordova
@gbsimon87
Aug 09 2018 18:51
Where's @Blauelf @cmccormack @JLuboff at?
Blauelf
@Blauelf
Aug 09 2018 18:51
Germany. Pretty late.
Simon Cordova
@gbsimon87
Aug 09 2018 18:52
Fair enough, almost 9 eh
I need to go back one of these days, you know I've been to 6 German cities but never Berlin nor Munich
Black Forest though, that's the spot
Manuel Reyes
@Androbat
Aug 09 2018 18:53
Hey what's up guys!
Can somebody explain me the concept of prototype in javascript? I really don't undertand it very well.
Simon Cordova
@gbsimon87
Aug 09 2018 18:55
That is a loaded question
Manuel Reyes
@Androbat
Aug 09 2018 18:55
Why?
I know that the concept is a little tricky.
Simon Cordova
@gbsimon87
Aug 09 2018 18:55
It's just a very heavy subject
All JavaScript objects inherit properties and methods from a prototype, you may want to refer to mdn or some youtube (check the source)
Manuel Reyes
@Androbat
Aug 09 2018 18:57
Thanks, man. Yes, I should read more about it.
I know the overall but I wanted to go deeper into the concept.
Simon Cordova
@gbsimon87
Aug 09 2018 18:58
Jason Luboff
@JLuboff
Aug 09 2018 19:00
@gbsimon87 I'm around
Kudzu
@czhower
Aug 09 2018 19:00
your perception of prototypes will depend a lot on context - ie have you done oop before or not? and if so typically oop or JS prototypical type? or none...
Brad
@bradtaniguchi
Aug 09 2018 19:00
anyone know much about mongodb's bulk operations vs some of the more "basic" ones like remove and deleteMany?
Simon Cordova
@gbsimon87
Aug 09 2018 19:01
@bradtaniguchi I'm literally just looking at that wow
whats up @JLuboff how's the day man
Brad
@bradtaniguchi
Aug 09 2018 19:02
hehe, so do you know whats the most "optimal" between the two?
Jason Luboff
@JLuboff
Aug 09 2018 19:03
@gbsimon87 Not bad, just been working on determining how to switch from a single file upload to potentially many. Think I got it but not fully happy with the way I'm doing it. Doesn't allow a file to be replaced so most likely need a delete option..
Simon Cordova
@gbsimon87
Aug 09 2018 19:03
@bradtaniguchi
I think @JLuboff and @cmccormack are definitely better than me at this
Jason Luboff
@JLuboff
Aug 09 2018 19:04
Uhhhhh... its been a while since I took the Mongo course. Bulk is probably more optimal if you have indexes and what not but don't quote me on that
Kudzu
@czhower
Aug 09 2018 19:05
bulk will generally be faster on any db as it can batch and transact the changes.
Simon Cordova
@gbsimon87
Aug 09 2018 19:05
@JLuboff
Nice, sounds like you got your hands full
I had a nice day at work, got almost everything done in my sprint which is cool, tomorrow I'm to implement a sidebar and make it sticky, trying to figure out how to right now so I'm not all stuck tomorrow

@bradtaniguchi on that site it states:

IMPORTANT
In most cases, multi-document transaction incurs a greater performance cost over single document writes, and the availability of multi-document transaction should not be a replacement for effective schema design. For many scenarios, the denormalized data model (embedded documents and arrays) will continue to be optimal for your data and use cases. That is, for many scenarios, modeling your data appropriately will minimize the need for multi-document transactions.

sidebar in ReactJS that is
Kudzu
@czhower
Aug 09 2018 19:06
guess because how it does the doc writes, unusual for most dbs.
probably has to create a lot of locks, ie a poor transaction architecture internally.
Brad
@bradtaniguchi
Aug 09 2018 19:07
so something like removeMany doesn't do that under the hood? Even tho it seems like it would be optimized for such right?
Kudzu
@czhower
Aug 09 2018 19:07
Interbase albeit not a doc db has one of the best archs Ive ever seen for transactions and concurrency, even read level versioning.
(and Firebird, its open source version)
Brad
@bradtaniguchi
Aug 09 2018 19:08
sorry deleteMany* (removeMany isn't a thing)
Brad
@bradtaniguchi
Aug 09 2018 19:14
gosh darn, I'm going with something other than bulkRemove. We aren't using transactions AFAIK
and the syntax for deleteMany and remove is simplier than using bulk, and I would think they are just as optimized as the bulk operations
Jason Luboff
@JLuboff
Aug 09 2018 20:33
@cmccormack Maybe I don't understand the methods properly... but.. JSON.parse turns a JSON string into a valid JSON object...while JSON.stringify turns a JSON object into a string.. so.. why would they stringify then parse it? I guess I'm assuming the this._data is an object..
Christopher McCormack
@cmccormack
Aug 09 2018 20:34
They explain it shortly after the reveal I believe
Chris
@crokita
Aug 09 2018 20:35
It's a quick way to deep clone a JSON object, basically
ArchivalBoat50
@ArchivalBoat50
Aug 09 2018 20:38
Can someone explain what the | and the ?= mean in this regular expression
/\s|_|(?=[A-Z])/ ?
Christopher McCormack
@cmccormack
Aug 09 2018 20:41
I think the ?= is a non-capturing group
the pipe | is a logical or
oops no x(?=y) means Matches 'x' only if 'x' is followed by 'y'. This is called a lookahead.
Jason Luboff
@JLuboff
Aug 09 2018 20:44
I gues I didn't understand the explanation. So basically they don't want to manipulate the original object thus a deep clone will create an actual seperate object, right?
newmoon
@newmoon
Aug 09 2018 20:45
Hmmm, In that regex, I don't see why they're using it
Seems to only match a space or an underscore or nothing followed by a capital letter.
ArchivalBoat50
@ArchivalBoat50
Aug 09 2018 20:47
@cmccormack Oh thanks, it makes sense now.
Christopher McCormack
@cmccormack
Aug 09 2018 20:48
@newmoon agreed
Chris
@crokita
Aug 09 2018 20:49
yeah, it seems that for whatever reason they want to keep the original object untouched while allowing other modules to read and modify that same object. The deep clone makes it so other modules don't need to worry about messing with the original object
Christopher McCormack
@cmccormack
Aug 09 2018 20:49
I think they meant to use (?:x) for noncapturing
Jason Luboff
@JLuboff
Aug 09 2018 20:49
@crokita Got it. Good to know, and thanks for the further explanation
Chris
@crokita
Aug 09 2018 20:50
mhmm!
Simon Cordova
@gbsimon87
Aug 09 2018 20:50
Hey guys, anybody build a react component that stays sticky without bringing in a third party library?
ps @cmccormack good article
Christopher McCormack
@cmccormack
Aug 09 2018 20:51
@gbsimon87 stays sticky?
newmoon
@newmoon
Aug 09 2018 20:52
I agree, btw, excellent article. Had no idea those methods were synchronous. Thought setTimeout and setInterval were the only ones.
Christopher McCormack
@cmccormack
Aug 09 2018 20:58
setTimeout and setInterval are asynchronous
synchronous == blocking
Simon Cordova
@gbsimon87
Aug 09 2018 21:05
yeah position sticky
@cmccormack
Christopher McCormack
@cmccormack
Aug 09 2018 21:06
What does React have to do with it?
you may not want to use sticky positioning either if you plan to support older browsers
Simon Cordova
@gbsimon87
Aug 09 2018 21:08
In React I have to build a sidebar div that after scrolling stays sticky, would I encounter any issues?
IE12 and up
Jason Luboff
@JLuboff
Aug 09 2018 21:08
Wtf is IE12? :smile:
Simon Cordova
@gbsimon87
Aug 09 2018 21:08
edge
internet explorer
Jason Luboff
@JLuboff
Aug 09 2018 21:08
Come on, don't insult it like that homie!
Simon Cordova
@gbsimon87
Aug 09 2018 21:08
oh lol
fair enough
Man I saw they were using css filter method and right away I said I don't think even IE10 supports it nvm IE9 and they just said we aren't concerned with IE11 nor lower
It was so good to hear - my last job we needed to support all the way to IE9, it was a nightmare sometimes
Jason Luboff
@JLuboff
Aug 09 2018 21:19
I have my work app working for IE11... but.. there are some components that don't show up correctly/look off but I don't care lol
Christopher McCormack
@cmccormack
Aug 09 2018 21:23
@gbsimon87 still not sure what React has to do with your question though that's a CSS issue
Simon Cordova
@gbsimon87
Aug 09 2018 21:25
@cmccormack tbh at work they emphasized it had to be sticky so it got me thinking that it would be difficult or I would encounter issues
I take it there's not really any issue to encounter than as long as I set the position to sticky
Christopher McCormack
@cmccormack
Aug 09 2018 21:27
it's all CSS if you chose to use it so no there shouldn't be
You can do it other ways - setting position fixed if scrolltop is <= 0 or something like that
been a while since I used the scroll methods
Simon Cordova
@gbsimon87
Aug 09 2018 21:30
Fair enough, shouldn't be a hard implementation then, I think I'm getting worried for nothing
Going to do a quick mockup on sandbox
how's work going today for you man
Jason Luboff
@JLuboff
Aug 09 2018 21:31
I bet Chris isn't even working right now
Christopher McCormack
@cmccormack
Aug 09 2018 21:31
Rough but at least we finally found the cause of a weeklong issue so that's great!
Jason Luboff
@JLuboff
Aug 09 2018 21:31
Probably playing with his dogs
Christopher McCormack
@cmccormack
Aug 09 2018 21:32
I wish man I wish
@gbsimon87 I did some stuff with scrolltop on my Wikipedia site on codepen if you're interested, was kind of fun
Simon Cordova
@gbsimon87
Aug 09 2018 21:33
Going to check it, thanks, on Codepen I take it?
Christopher McCormack
@cmccormack
Aug 09 2018 21:37
@gbsimon87 yessir should be @cmccormack
Simon Cordova
@gbsimon87
Aug 09 2018 21:38
@cmccormack cheers man I appreciate it
Christopher McCormack
@cmccormack
Aug 09 2018 21:38
probably crappy code was a while ago
Jason Luboff
@JLuboff
Aug 09 2018 21:39
My code is probably still crappy :shit:
Christopher McCormack
@cmccormack
Aug 09 2018 21:40
I tried to do a lot with that wikipedia page using javascript to move the search bar to mobile
had I been more familiar with flexbox and media queries I could have done it without JS
Jason Luboff
@JLuboff
Aug 09 2018 21:41
I wish there were like... 10 mores hours in a day...so I could learn more shit lol
My CSS game is so weak
Simon Cordova
@gbsimon87
Aug 09 2018 21:41
@cmccormack
Christopher McCormack
@cmccormack
Aug 09 2018 21:42
@JLuboff do the responsive projects it will force you to remember how to do CSS a bit
Jason Luboff
@JLuboff
Aug 09 2018 21:42
I'm guessing they don't want you to use a framework?
Christopher McCormack
@cmccormack
Aug 09 2018 21:43
just html and css
and I think they recommend against CSS framework if that's what you mean
Jason Luboff
@JLuboff
Aug 09 2018 21:44
Ya
Christopher McCormack
@cmccormack
Aug 09 2018 21:44
@gbsimon87 dang I think I lied, that one may not use scrollTop
Jason Luboff
@JLuboff
Aug 09 2018 21:44
I think I will go through all the CSS/Flex/etc stuff they have. It'd be good
Christopher McCormack
@cmccormack
Aug 09 2018 21:45
@JLuboff yeah it is pretty good, I did flex and accessibility recently, good stuff
flexboxfroggy is good too
Jason Luboff
@JLuboff
Aug 09 2018 21:47
flexboxfroggy eh
Nate Mallison
@NJM8
Aug 09 2018 22:09
Use tailwindCSS
It's not a framework, just provides utilities so all your CSS is as simple as slapping a class on it
and making your own is simple
Jason Luboff
@JLuboff
Aug 09 2018 22:12
Fancy
Nate Mallison
@NJM8
Aug 09 2018 22:13
how's it going these days? Haven't been on in awhile
Jason Luboff
@JLuboff
Aug 09 2018 22:13
Doing well. Sort of finished my work app (that is, it is now in production but some changes I'm still working on)
Nate Mallison
@NJM8
Aug 09 2018 22:14
nice
Jason Luboff
@JLuboff
Aug 09 2018 22:15
Ya man, hows the new job?
Nate Mallison
@NJM8
Aug 09 2018 22:15
how is the family?
fantastic
I'm really enjoying it.
And they are foolish enough to really like my work! haha
Jason Luboff
@JLuboff
Aug 09 2018 22:16
hahaha thats awesome, glad its working out well
Family is well, no complaints there. You?
Nate Mallison
@NJM8
Aug 09 2018 22:17
Yeah they are super helpful, open to ideas. Giving me good feedback. Offering up more projects soon. I kinda worry I've already peaked with my first dev job. they certainly can't all be like this. haha
Family is good. healthy and happy
Jason Luboff
@JLuboff
Aug 09 2018 22:18
The more projects, the more you'll learn, the better you'll become
Nate Mallison
@NJM8
Aug 09 2018 22:18
yup. definitely learning fast
gtg make some dinner before these ankle biters get to me. later!
Jason Luboff
@JLuboff
Aug 09 2018 22:19
haha see ya man
J. Guidry
@J-Guidry
Aug 09 2018 22:46

Hi. I am doing one of the fcc take home projects, the simon game. I am at the point where after clicking start, generates a color , gets the node where the button is on the page, and makes it highlight. I am having trouble with making it toggle back to its previous state after dimming for a short period. I have been using classList.toggle() for this.

function toggleColor(btnNode){
       //hightlight is the css style for the highlightedbutton
       btnNode.classList.toggle(`${btn.className}Highlight`);

      setTimeout(()=> {
            btnNode.classList.toggle(`${btn.className}`);  
//doesn't work
    }, 2000);
}

I have tried experimenting with setTimeout to toggle it back, but it doesn't work.

Jason Luboff
@JLuboff
Aug 09 2018 22:55
@J-Guidry Have you used dev tools to inspect the element to see if its actually toggling back?
Christopher McCormack
@cmccormack
Aug 09 2018 22:59
@J-Guidry I don't think that's how you want to toggle, toggle should target the same selector each time
Maybe try
setTimeout(()=> {
            btnNode.classList.toggle(`${btn.className}Highlight`);
J. Guidry
@J-Guidry
Aug 09 2018 23:00

@JLuboff Yeah, I should do that. Like, in the codePen im using I have used a console.log and have seen that setTimeout is triggering but I haven't used the chrome debugger itself yet. I'll do that now

@cmccormack I'll try that

Christopher McCormack
@cmccormack
Aug 09 2018 23:00
or just make a separate css selector for highlight and use
.toggle('highlight');
J. Guidry
@J-Guidry
Aug 09 2018 23:04
@cmccormack getting a DOMexception due to html space characters. Probably the template string as it is showing as "blue blueHighlightHighlight which is weird
As for a single css selector, I made a css class for each button highlight. No matter which colornode
is chosen, it would go to the css class it coressponds too.
Christopher McCormack
@cmccormack
Aug 09 2018 23:09
you can do that in CSS without having to target a specific btn
.green-btn.highlight { ... }
Jason Luboff
@JLuboff
Aug 09 2018 23:11
I just have to say...it's really exciting to see my app being used
J. Guidry
@J-Guidry
Aug 09 2018 23:11
ah, two classes being referred to. instead of one. Never seen that before.
newmoon
@newmoon
Aug 09 2018 23:15
@J-Guidry If your button has more than one class name before the initial toggle, you'll be untoggling class1 class2 which is why you get the error about the HTML space characters.
Try:
    const color = btn.className;
    btn.classList.add(`${color}Highlight`);

    setTimeout(()=> {
      btn.classList.remove(`${color}Highlight`);
    }, 2000);
J. Guidry
@J-Guidry
Aug 09 2018 23:16
@newmoon oh, that worked. Thanks. I was on that problem for a while.
Christopher McCormack
@cmccormack
Aug 09 2018 23:17
@newmoon good call I didn't even parse the btn.className being the actual classes on the button
newmoon
@newmoon
Aug 09 2018 23:18
Just a lucky guess :)
Brad
@bradtaniguchi
Aug 09 2018 23:37
Damn I'm excited, I see the horizon the ability for stackdriver integration. Nothing beats stack traces in prod hehe >:D
Jason Luboff
@JLuboff
Aug 09 2018 23:43
@bradtaniguchi say what?
Brad
@bradtaniguchi
Aug 09 2018 23:56
@JLuboff I guess google cloud provide some tracing for applications using stackdriver integration. My understanding is if I log an error, stackdriver will also provide a trace to show what happened before the error. I still need to integrate it, but seems pretty badass.
Jason Luboff
@JLuboff
Aug 09 2018 23:56
Oh that does sound cool