These are chat archives for FreeCodeCamp/HelpJavaScript

24th
Jan 2019
19930210
@19930210
Jan 24 00:24
HI,Can someone guide me to this question about my program code problem?
image.png
abraham anak agung
@padunk
Jan 24 01:01
@19930210 if you want to store a new variable to x, you have to assign it again like so x = String.fromCharCode(x)
19930210
@19930210
Jan 24 01:06
@padunk Thanks, I'm try.
Pagnito
@Pagnito
Jan 24 02:01
does mongoose not use geo
geoNear anymore
Pagnito
@Pagnito
Jan 24 02:26
ah yea, i ended up using the aggregate with $geoNear
thnx
Pagnito
@Pagnito
Jan 24 02:32
hey how much traffic can a laptop handle, if i host an app on it?
19930210
@19930210
Jan 24 02:40
@padunk The problem is solved!! Thank you
abraham anak agung
@padunk
Jan 24 02:42
@19930210 :thumbsup:
Christopher McCormack
@cmccormack
Jan 24 02:53
@Pagnito probably quite a bit depending on the power of the laptop and the type of work it's doing per request
Pagnito
@Pagnito
Jan 24 02:54
@cmccormack yea i hope my dads old laptop will b relatively fast, i wanna host an app for like a video platform specific to no retarded hip hop
Christopher McCormack
@cmccormack
Jan 24 03:04
that might be more difficult, unless you're hosting just for you or a few people
Pagnito
@Pagnito
Jan 24 03:10
u mean it wont be able to handle many requests?
@cmccormack
Jason Luboff
@JLuboff
Jan 24 05:01
Best thing to do is perform a baseline. It’s difficult to say how much any computer can handle especially with no specs
Brad
@bradtaniguchi
Jan 24 05:28
use the cloud
Pagnito
@Pagnito
Jan 24 05:54
hey, when i hit a key, and it types in a letter, what happens between those two things. The signal is sent? im confused how it generates a letter in one click since its 8 characters right, one byte?
Brad
@bradtaniguchi
Jan 24 06:21
what is it
If you mean a computer+keyboard, then we are talking about layers of abstraction between your physical movement to actual stuff happening on the screen
Idk if confused is the right word, more like unaware of all the stuff going on to make it all happen (not saying I know, idk if anyone knows every detail)
Pagnito
@Pagnito
Jan 24 06:26
yea pretty much, there is alot i dont know
but the thing i want to understand is how everything drops down to true or false
Brad
@bradtaniguchi
Jan 24 06:29
it doesn't "drop down to true and false"
that's still a level higher than "the lowest possible level"
You could go down to the physical structure of your keyboard, how it "generates" a key-press
to an electrical signal, and where that goes and is delt with
that electrical signal get's converted to some binary digit somewhere (I guess you can say that's true and false?), which gets transformed, along with other bits probably for context somewhere, etc.
Id say that's still all lower than the OS too, still lower than the kernal too, maybe even lower than that (?)
Pagnito
@Pagnito
Jan 24 06:40
damn this is gonna be too much for a chat lol, im ask my bro this weekend, since im going over his house then anyways
Brad
@bradtaniguchi
Jan 24 06:45
I'm sure there's some article somewhere that goes into this sorta stuff. I took a class on how the hardware stuff works, and parts of the "layers" above it, but were talking about lots of abstractions ontop of abstractions haha
Pagnito
@Pagnito
Jan 24 06:56
yea haha
alexV
@alexpande
Jan 24 09:34
      Hello everyone  
//This is a simple set of data relationships
var links=[
{source:0,target:3},
{source:0,target:4},
{source:0,target:5},
{source:1,target:3},
{source:1,target:4},
{source:1,target:5},
{source:3,target:6},
{source:3,target:7},
{source:3,target:8},
{source:4,target:6},
{source:4,target:7},
{source:4,target:8},
{source:7,target:9},
{source:7,target:10},
{source:7,target:11},
];
       //Result after data grouping
       var result=[[0,1],[3,4,5],[6,7,8],[9,10,11]]
How to write a conversion method
How to solve
Nate Mallison
@NJM8
Jan 24 10:31
@alexpande You asked a similar question yesterday but again there doesn't seem to be any correlation between the two. The duplicate target is gone, the result looks like the targets except for the [0, 1], and the source property appears to play no role. We need more information if we are to help.
Tiago Correia
@tiagocorreiaalmeida
Jan 24 11:23
the example above makes no sense @alexpande , without more information there's no one who can help you
Shekhar Ramola
@shekharramola
Jan 24 11:37
how costly are try catch block?
alexV
@alexpande
Jan 24 11:43
This is the data relationship of d3-sankey
I want to group d3-sankey data relationships
So I made a simple data relationship as a demo.
@NJM8 @tiagocorreiaalmeida
@NJM8
Tiago Correia
@tiagocorreiaalmeida
Jan 24 11:46
sure but the result array doesnt makes alot of sense
there's no relation between it and the object
Probably don't really need to worry about it unless you are stacking try catches several thousand items deep.
MRE
@AsdDsa9484_twitter
Jan 24 14:57
Hello I need help with React
is there anyway to map through an array without using map() as I don't want to provide unique key values
var code = "const index = this.state.index.map(dl => {
let dd = [];
for(let i = 0; i <= dl.dd.length; i++){
dd.push(<dd><a href={dl.dd[i].path}>{dl.dd[i].text}</a></dd>);
}
}
  return(
    <dl key={dl.id}>
    <dt>{dl.dt}</dt>
      {...dd}
    </dl>
  )
})"
I'm trying to use for loop but I couldn't :D
Tiago Correia
@tiagocorreiaalmeida
Jan 24 15:15
im confused with your question, what was the main probably with the map? @AsdDsa9484_twitter
Christopher McCormack
@cmccormack
Jan 24 15:36
@AsdDsa9484_twitter unique key values is very useful, you should not try to avoid it.
Jason Luboff
@JLuboff
Jan 24 16:05
Morning
Christopher McCormack
@cmccormack
Jan 24 16:08
@JLuboff morning!
Jason Luboff
@JLuboff
Jan 24 16:09
Whats happening?
Blauelf
@Blauelf
Jan 24 16:09
Winter is coming.
Come for the cute puppy, stay for the component hierarchy ideas
Blauelf
@Blauelf
Jan 24 16:12
Bah, puppies. Kitties are better.
Christopher McCormack
@cmccormack
Jan 24 16:13
blasphemy
Jason Luboff
@JLuboff
Jan 24 16:18
Boooo kitties
YAAAA puppies
Blauelf
@Blauelf
Jan 24 16:19
You remember those?
fcc kitties
See the cuteness?
Jason Luboff
@JLuboff
Jan 24 16:19
I see no cuteness
Just ferocious beasts
Christopher McCormack
@cmccormack
Jan 24 16:19
How could I forget! I feel like putting a 2px solid blue border on them
Blauelf
@Blauelf
Jan 24 16:20
lol, yeah, that.
Give them a border-radius: 25%; for fun :)
Christopher McCormack
@cmccormack
Jan 24 16:22
haha so much fun
Jason Luboff
@JLuboff
Jan 24 16:27
Whats everyone working on today?
Christopher McCormack
@cmccormack
Jan 24 16:29
I don't feel like working on anything yet so just been updating stuff
Jason Luboff
@JLuboff
Jan 24 16:31
Lol fair enough
Christopher McCormack
@cmccormack
Jan 24 16:31
you?
Jason Luboff
@JLuboff
Jan 24 16:31
Continuing on with my React app. Had a meeting yesterday to show the current progress so have some changes/features to add
Christopher McCormack
@cmccormack
Jan 24 16:35
They happy with it?
Kaz Baig
@kbaig
Jan 24 16:42
still video editing :/
Jason Luboff
@JLuboff
Jan 24 16:46
@cmccormack Overall, ya. Not many changes but some that might take me a little bit of time to implement (for example, being able to reorder steps or insert inbetween two steps)
@kbaig What sort of video are you working on?
Kaz Baig
@kbaig
Jan 24 16:48
@JLuboff I was in charge of the TEDx at my university a couple years ago. So the videos for that
Jason Luboff
@JLuboff
Jan 24 16:48
Oh neat
Apparently you can set a status now on Github lol
Kaz Baig
@kbaig
Jan 24 16:53
aaaand it's a social network
Jason Luboff
@JLuboff
Jan 24 16:54
:joy:
And its begun... I've started moving my repos from BitBucket to Github
Christopher McCormack
@cmccormack
Jan 24 17:02
poor bitbucket
Jason Luboff
@JLuboff
Jan 24 17:02
I know...they're going to be sad for sure!
Christopher McCormack
@cmccormack
Jan 24 17:26
I used it once for a personal project, seemed fine, but they kind of hide their features behind a very bland frontend
Jason Luboff
@JLuboff
Jan 24 17:27
Whats that, BitBucket?
You're the one who suggested it to me lol
Christopher McCormack
@cmccormack
Jan 24 17:27
yeah for private repos
but now they're free on github right?
Jason Luboff
@JLuboff
Jan 24 17:28
Yup... so thats why I'm moving them over
Christopher McCormack
@cmccormack
Jan 24 17:47
understood, I may do the same
Do you still get green blocks for commits to private repos?
Jason Luboff
@JLuboff
Jan 24 17:48
You do! Thats one of the reasons I wanted to move it over :joy:
Christopher McCormack
@cmccormack
Jan 24 17:48
hmm might decide to make my personal project private for now then
no reason I should expose my dirty laundry right?
Jason Luboff
@JLuboff
Jan 24 17:49
I mean...if it has shit stains...ya no one wants to see that :P
Kaz Baig
@kbaig
Jan 24 17:49
truuu
I should make stuff I haven't finished and am not working on private
Christopher McCormack
@cmccormack
Jan 24 17:51
yeah I don't mind sharing FCC project, can be helpful, but personal stuff? nobody needs to see that lol
NOBODY
Kaz Baig
@kbaig
Jan 24 17:51
I don't need to see it either
Is there a way to hide it from myself?
oh wait delete
Christopher McCormack
@cmccormack
Jan 24 17:51
lol
Jason Luboff
@JLuboff
Jan 24 17:56
Uggggggggggghhhhh.... I'm getting a can't convert undefined to object and can't figure out where its occuring
Christopher McCormack
@cmccormack
Jan 24 17:56
@JLuboff it's happening where your value is undefined
Kaz Baig
@kbaig
Jan 24 17:57
gottem
Christopher McCormack
@cmccormack
Jan 24 17:57
:money_with_wings: please
Jason Luboff
@JLuboff
Jan 24 17:57
:angry:
Christopher McCormack
@cmccormack
Jan 24 17:57
why would it try to convert? some coercion somewhere?
Jason Luboff
@JLuboff
Jan 24 17:58
It's most likely where I'm doing some sort of boolean check (i.e does an element exist)
Kaz Baig
@kbaig
Jan 24 17:59
you mean trying to check obj.prop but obj is undefined?
those can be pretty annoying to deal with
Jason Luboff
@JLuboff
Jan 24 18:00
Ah... think I found it. Was looking in the wrong spot
Christopher McCormack
@cmccormack
Jan 24 18:00
oh maybe you are trying to access using [index] and it's not an array?
Jason Luboff
@JLuboff
Jan 24 18:01
I had Object.keys(obj).map.. but in this test case, obj does not exist...so hence the undefined cant be converted
Kaz Baig
@kbaig
Jan 24 18:01
ahhhhhhhhh
sounds like a job for default values
Jason Luboff
@JLuboff
Jan 24 18:10
Hmm...maybe
Jason Luboff
@JLuboff
Jan 24 18:22
Meh...all I need was {obj.key && ...
Brad
@bradtaniguchi
Jan 24 18:23
@JLuboff If obj was undefined how you getting the key :o
(I must be missing something haha)
Jason Luboff
@JLuboff
Jan 24 18:24
Becuase the above should have been Object.keys(obj.key) lol
Kaz Baig
@kbaig
Jan 24 18:24
oooo
Jason Luboff
@JLuboff
Jan 24 18:25
Yaaaa....
Brad
@bradtaniguchi
Jan 24 18:26
o
Jason Luboff
@JLuboff
Jan 24 18:27
Yup. Silly mistake
Jason Luboff
@JLuboff
Jan 24 18:39

...it is not my morning...

console.log(obj(Object.keys(obj)).map..

obj is not a function... oh..fucking idiot... why am I using () when I should be using [] :facepunch:

Kaz Baig
@kbaig
Jan 24 18:40
take a coffee break
talk to people around the water cooler
Jason Luboff
@JLuboff
Jan 24 18:40
We got a new water cooler the other day. It has three buttons. Hot, Cold, and... room temp I guess?
Christopher McCormack
@cmccormack
Jan 24 18:46
man I bet you guys talk about that a lot around the water cooler
Jason Luboff
@JLuboff
Jan 24 18:47
Yup. Going to install a fish bowl on it. Nothing like fish filtered water
Christopher McCormack
@cmccormack
Jan 24 18:47
yum
Has anyone ever created a custom code block formatting for markdown before?
I want to make something like
```cisco
That formats only certain things
Kaz Baig
@kbaig
Jan 24 18:53
that sounds useful
Brad
@bradtaniguchi
Jan 24 18:57
I wonder how hard it is to define the syntax, hmmm
Jason Luboff
@JLuboff
Jan 24 19:03
You guys ever spend a decent chunk of time implementing something only to realize that you could do it in a different..much easier way?
Kaz Baig
@kbaig
Jan 24 19:04
yeah but you also gotta get to a finished product too so it goes to the nice to haves at the end
or at least, it should but I never send it there
Jason Luboff
@JLuboff
Jan 24 19:05
I have no strict timeline so it helps me here lol
Brad
@bradtaniguchi
Jan 24 19:21
@JLuboff Yes, but usually its only on like a day timescale (usually hehe)
Jason Luboff
@JLuboff
Jan 24 19:21
Ya it's been a day or two. Just realized I didn't need to change anything about my function just how I give it data... lol
Pagnito
@Pagnito
Jan 24 19:36
hey anyone know how to write mocha test to test passport strategies?
Jason Luboff
@JLuboff
Jan 24 19:37
I know how to write Jest test to test NTLM auth. So, I'm of no help. lol
Pagnito
@Pagnito
Jan 24 19:37
whats NTLM?
Jason Luboff
@JLuboff
Jan 24 19:38
Microsoft Active Directory Auth
Pagnito
@Pagnito
Jan 24 19:38
ah
Jason Luboff
@JLuboff
Jan 24 19:40
@Pagnito https://www.npmjs.com/package/passport-mocked this might be of help
Pagnito
@Pagnito
Jan 24 19:42
@JLuboff thnx
Jason Luboff
@JLuboff
Jan 24 19:44
No problem hope it helps
enestatli
@enestatli
Jan 24 20:43
flexbox problem
.product{
      display: flex;
      flex-direction: row;
      background-color: red;

}

.desc{
    display: flex;
      flex-direction: column;
      background-color: blue;

}


.product img{
    margin: 20px 50px 20px 100px;
    width: 25%;
}
how can I align desc classes at the same position?
Tiago Correia
@tiagocorreiaalmeida
Jan 24 20:48
the problem seems to be created by the img it self
and byt the margins you apply around the image, but with a print a not much I can do to help
also if you are using flex dont use width, use the flex property
enestatli
@enestatli
Jan 24 20:50
@tiagocorreiaalmeida how can I apply some margins if I need?
btw, images have same sizes 200x200
Tiago Correia
@tiagocorreiaalmeida
Jan 24 20:51
make a codepen with this
can't help more with prints
enestatli
@enestatli
Jan 24 20:52
oh sorry!
you are right man, when I remove the images, the problem gone :D
Tiago Correia
@tiagocorreiaalmeida
Jan 24 20:52
:)
Tiago Correia
@tiagocorreiaalmeida
Jan 24 20:53
well without the images can't do much to tell you the problem ahaha
enestatli
@enestatli
Jan 24 20:53
@tiagocorreiaalmeida thank you! I want to know how could I fix the image problem :D
Tiago Correia
@tiagocorreiaalmeida
Jan 24 20:53
but Will take a look I guess
enestatli
@enestatli
Jan 24 20:54
:D
I do not understand, all images have same sizes 200x200 what's wrong with it :D
Tiago Correia
@tiagocorreiaalmeida
Jan 24 20:55
on the image tag tell it to have a width of 100% and a display block, remove the margins from there
and apply padding instead
on the outside div apply flex: 0 0 25%;
.item {
flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
}
Jeff
@jargonfilter
Jan 24 20:57
hey everyone. is there a simpler way of achieving this?
  let newStr = str.split(/\s|-|_|(?=[A-Z])/);
  let dashStr = newStr.join('-');
  let finalStr = dashStr.toLowerCase();
  return finalStr;
enestatli
@enestatli
Jan 24 20:57
@tiagocorreiaalmeida thank you man! :)
Tiago Correia
@tiagocorreiaalmeida
Jan 24 20:58
worked @enestatli ?
enestatli
@enestatli
Jan 24 20:58
I will give it a try now
Tiago Correia
@tiagocorreiaalmeida
Jan 24 20:58
@jargonfilter maybe with replace
Jeff
@jargonfilter
Jan 24 20:59
ah, i guess i do the same thing, use replace, and say with "-"
and then only need the toLowerCase at the end
except that seems to give me dashes at the beginning of every word, including the first. so i guess i would need to change my regex
Tiago Correia
@tiagocorreiaalmeida
Jan 24 21:05
because it replaces every space by - and every uppercase by a -
you have spaces followed by uppercases
enestatli
@enestatli
Jan 24 21:05
good night everyone
Tiago Correia
@tiagocorreiaalmeida
Jan 24 21:06
Think that's the issuewould need to give it more time will be back tomorrow and give it a new look
Jeff
@jargonfilter
Jan 24 21:24
ah hmm
Jason Luboff
@JLuboff
Jan 24 21:24
@jargonfilter You can chain all of those methods together
  return str.split(/\s|-|_|(?=[A-Z])/).join('-').toLowerCase();
@tiagocorreiaalmeida Yo
Jeff
@jargonfilter
Jan 24 21:27
wasnt sure if you could chain it cause toLowerCase i thought would only apply to strings
Jason Luboff
@JLuboff
Jan 24 21:27
It is being applied to a string
First the split occurs (turns into an array), then join (turns array back into a string), then toLowerCase (lowercases the string)
alpox
@alpox
Jan 24 21:28
@JLuboff /\s|-|_|(?=[A-Z])/ --> /[\s-_]|(?=[A-Z])/
Jason Luboff
@JLuboff
Jan 24 21:29
@alpox Tell @jargonfilter not me :) I just copied what he had and chained all the methods lol
alpox
@alpox
Jan 24 21:29
Aha :D
Jason Luboff
@JLuboff
Jan 24 21:29
@alpox Whats up?
alpox
@alpox
Jan 24 21:32
@JLuboff Not much :D
Jason Luboff
@JLuboff
Jan 24 21:34
What time is it over there?
alpox
@alpox
Jan 24 21:50
@JLuboff Now about 22:50 :)
Jason Luboff
@JLuboff
Jan 24 21:53
Past my bedtime :P
alpox
@alpox
Jan 24 22:17
:D
Jason Luboff
@JLuboff
Jan 24 22:18
Ugh...have to implement an option to reorder some steps. Debating if I go the drag and drop route or just have an up/down arrows to move them (this would be easier I think)
Riadh
@KWFE
Jan 24 22:19
hi, who has an old computer and he's planning to throw it?
Brad
@bradtaniguchi
Jan 24 22:19
up/down, drag and drop is annoying if you haven't done it before. Plus were talking about business app right?
Jason Luboff
@JLuboff
Jan 24 22:19
@bradtaniguchi Ya, business app.
Christopher McCormack
@cmccormack
Jan 24 22:21
@JLuboff yeah man arrows, if you're using react animations take extra work as well
Jason Luboff
@JLuboff
Jan 24 22:21
Arrows it is!
Christopher McCormack
@cmccormack
Jan 24 22:23
if you don't use an animation library it can be difficult to make it smooth, because it's rerendering you have to basically store the current position of elements then before it rerenders move the element to it's previous position and then let the CSS or JS animation happen
although someone probably has made some really awesome React Hook to do that
Jason Luboff
@JLuboff
Jan 24 22:23
I'll see how it is without going the animation route. Don't think it'll be necessary
Christopher McCormack
@cmccormack
Jan 24 22:25
I think you should try to figure it out :)
there are React animation libraries too
would look nice to see them swap positions in a nicely animated way
Jason Luboff
@JLuboff
Jan 24 22:27
That is true...
Brad
@bradtaniguchi
Jan 24 22:43
I never tried using the chrome debugger much... damn I've been missing out
Jason Luboff
@JLuboff
Jan 24 22:44
I've never used it
Whats the advantage?
Brad
@bradtaniguchi
Jan 24 22:44
Breakpoints in your code at runtime
even hooks up to sourcemaps outa the box, stuff like ctrl+p to find the file you want to add break points to, and it will due the usual pause on execution and what not.
I'm not doing the usual "let me add console.logs to see WTF is going on" any more XD
like damn I didn't know it was so powerful XD
Jason Luboff
@JLuboff
Jan 24 22:46
Where can you set breakpoints/>
?*
alpox
@alpox
Jan 24 22:46
@JLuboff This is kinda cool for masonrys: https://packery.metafizzy.co/draggable.html :D
Jason Luboff
@JLuboff
Jan 24 22:47
@alpox That is pretty neat