14th
Jan 2019
Suds-p
@Suds-p
Jan 14 01:42
Little confused on how findPairs is supposed to work, also in one case it's calling findPairs without using its output? (lines 69-70)
abraham anak agung
Jan 14 01:48
@zoverlvx try using https://repl.it than codepen if you want to 'play' with JS, it is easier to check the result in console.
Regarding your challenges, if you have findPairsWithGivenDifference([1, 5, 11, 7], 4) what the result be?
From what i read, it will be [[5, 11], [1, 7]] is that correct?
@zoverlvx you can use Array.prototype.reduce for this challenge, and than do another loop to check if any condition x-y match k.
Don't overthink it :smile:
Suds-p
@Suds-p
Jan 14 01:51
^
Also, I'm guessing duplicates count, so would a case like findPairsWithGivenDifference([1, 1, 2, 2], 1) yield [[0, 2], [0, 3], [1, 2], [1, 3]]?
Zachary Overhulser
@zoverlvx
Jan 14 01:54
Almost. It should be [[5, 1], [11, 7]] because 5-1===4 and 11-7===4.
There are no duplicates (luckily). I think I've figured out a solution, but I have to carry the the results along down the recursion. Here's my example: https://codepen.io/zoverlvx/pen/MZZEEx?editors=0011
abraham anak agung
Jan 14 01:54
@Suds-p that idk. have to ask @zoverlvx for that. But from the short explanation in his codepen it coud result like [[2, 2, 2, 2], [1, 1, 1, 1]]
Suds-p
@Suds-p
Jan 14 01:55
@padunk Ah sorry, fsr I was assuming it returned indexes instead of elements :facepalm:
19930210
@19930210
Jan 14 14:40

var myObj = {
top: "hat",
bottom: "pants"
};
myObj.hasOwnProperty("top"); // true
myObj.hasOwnProperty("middle"); // false

// 初始化变量
var myObj = {
pet: "kitten",
bed: "sleigh"
};

function checkObj(checkProp) {
// 请把你的代码写在这条注释以下

return "修改这里";
}

// 你可以修改这一行来测试你的代码

Blauelf
@Blauelf
Jan 14 15:10

@19930210 There's a Chinese channel.

Also, "Help ,please" (sic!) is not much to work with. If you could describe where you got stuck, this would help a lot more.

19930210
@19930210
Jan 14 15:29
@Blauelf Thank you for your correction! I,m sorry.
Blauelf
@Blauelf
Jan 14 15:34
I see room for improvement in your punctuation :D
If you can describe your problem in English, we might be able to help you here on the channel. For reference, this is the English equivalent.
19930210
@19930210
Jan 14 15:42
@Blauelf This example wants to be able to "check" the MyObj object first if there is this property name, if there is and get the value of the property name, I do not know how to do the first step of the program?
Blauelf
@Blauelf
Jan 14 15:43
Do it with an if and myObj.hasOwnProperty.
19930210
@19930210
Jan 14 15:46
@Blauelf
let me try
@Blauelf
if(myObj.hasOwnProperty("checkProp")){
return checkProp;
}
}
Am I right in this direction?
Blauelf
@Blauelf
Jan 14 15:49
Slightly wrong. You need to use checkProp variable, not a string of value "checkProp". Also, you need bracket notation on the return value. myObj.checkProp would be same as myObj["checkProp"], and again you need the variable, not a static string.
19930210
@19930210
Jan 14 15:58
@Blauelf let me try Thank you!
@Blauelf Thank you!! I have an answer to this question.
Blauelf
@Blauelf
Jan 14 16:04
:+1: Hope you understood the difference between "checkProp" and checkProp.
19930210
@19930210
Jan 14 16:06
@Blauelf OK Thank you for your guidance.
Jason Luboff
@JLuboff
Jan 14 16:10
Morning :wave:
Christopher McCormack
@cmccormack
Jan 14 16:12
@JLuboff :wave: morning
How was the weekend?
Jason Luboff
@JLuboff
Jan 14 16:13
Pretty good actually.. yourself?
Christopher McCormack
@cmccormack
Jan 14 16:14
Good man did some cleaning/cooking/snow shoveling. Can't complain :)
been trying to get updated on all the new custom pc parts and compatability as well to build my new rig
Jason Luboff
@JLuboff
Jan 14 16:16
Nice.. I've been playing aorund with testing. Couple hours over the weekend was spent on testcafe
Kaz Baig
@kbaig
Jan 14 16:17
oooh nice what kind of build is it
Christopher McCormack
@cmccormack
Jan 14 16:18
@JLuboff nice how is it?
@kbaig most likely going to be an i7/nvidia build but not 100%
Kaz Baig
@kbaig
Jan 14 16:19
what gpu
Christopher McCormack
@cmccormack
Jan 14 16:19
haven't gotten there yet
Jason Luboff
@JLuboff
Jan 14 16:19
@cmccormack Pretty fucking cool haha. Complete automates the testing that I've had to by hand.. I still need to figure out some things (like impersonating a user) but its really cool. Can test in whatever browser as well as create a QR code to scan with your phone to test via mobile
Kaz Baig
@kbaig
Jan 14 16:19
Sounds like you're going hard
Christopher McCormack
@cmccormack
Jan 14 16:19
I may just keep the one I have and transfer it, buy a cheaper version of my current to put with my old hardware
currently have a 980Ti
Kaz Baig
@kbaig
Jan 14 16:23
very nice
Christopher McCormack
@cmccormack
Jan 14 16:24
yeah it's pretty great and I haven't been gaming as much so this build is more focused on the processor/mb/ram/storage to replace all my 2010 parts
definitely going to try and run M.2 in Raid 5 if possible
Kaz Baig
@kbaig
Jan 14 16:26
Do you have really high storage needs?
Christopher McCormack
@cmccormack
Jan 14 16:26
nope just want it to be very fast for the OS partition
Kaz Baig
@kbaig
Jan 14 16:27
Ah ok
Just remember that M.2 is different from nvme
Christopher McCormack
@cmccormack
Jan 14 16:27
it's nvme m.2
that I'm looking at
Kaz Baig
@kbaig
Jan 14 16:27
kk cause a lot of people think m.2 makes it faster on its own
Christopher McCormack
@cmccormack
Jan 14 16:29
yeah this is why I'm doing my research
my understanding is this guy supports nvme m.2
@kbaig sounds like you may have built one recently?
Kaz Baig
@kbaig
Jan 14 16:32
It supports up to 4 m.2
I built in oct '17
But I'm always upgrading something or the other, usually aethetically
Christopher McCormack
@cmccormack
Jan 14 16:33
the one I linked above? I only see three
@kbaig haha that's a pricey hobby
I plan to build once every 8 years or so
Kaz Baig
@kbaig
Jan 14 16:33

Triple Ultra-Fast NVMe PCIe Gen3 x4 M.2 with Triple Thermal Guards

not sure if this means 3 or 4

Yeah it really is :/
Christopher McCormack
@cmccormack
Jan 14 16:34
oh I think the x4 is PCIe x4?
Kaz Baig
@kbaig
Jan 14 16:34
ohhh duh
Yeah 4 sounded crazy to me
Christopher McCormack
@cmccormack
Jan 14 16:34
it's confusing to me as well
Kaz Baig
@kbaig
Jan 14 16:35
I'm trying to save for a custom watercooling and home made cables rig with almost none of my current parts
But I want to wait for at least the next nvidia gen
Christopher McCormack
@cmccormack
Jan 14 16:35
nowhere could I find the right header type or whatever it's called, M/B+M, but what I see M is used for nvme, maybe you can clarify
Kaz Baig
@kbaig
Jan 14 16:35
The 20 series is egregious

M/B+M

what do you mean here

Christopher McCormack
@cmccormack
Jan 14 16:36
is that the ray tracing?
Kaz Baig
@kbaig
Jan 14 16:36
The ones that have ray tracing yes
Christopher McCormack
@cmccormack
Jan 14 16:36
@kbaig M and B+M have different headers on the SSD, B+M has an extra notch
Kaz Baig
@kbaig
Jan 14 16:38
B keyed M.2's can handle PCIe x2, SATA, SMBus, USB 2.0 and 3.0, and other stuffs.
M keyed M.2's can handle PCIe x4, SATA, and SMBus. (PCIe/NVMe SSDs can operate at faster speeds)/
B+M keyed operate at the speed of B keyed M.2's, they're just keyed that way for broader compatibility
This isn't something I'd worry about today
Christopher McCormack
@cmccormack
Jan 14 16:39
well when you're shopping for M.2 and they have the options you have to know!
but that's a better explanation than I could find
Kaz Baig
@kbaig
Jan 14 16:39
You're almost def going to have compatibility
Christopher McCormack
@cmccormack
Jan 14 16:39
dang that ray tracing is great, I wonder how they were able to make it happen in real time
Kaz Baig
@kbaig
Jan 14 16:39
It's not the same as conventional ray tracing
Christopher McCormack
@cmccormack
Jan 14 16:40
yeah don't think it could be, takes so much processing for every pixel
when does that one come out?
Kaz Baig
@kbaig
Jan 14 16:42
Been out for quite a while
the 20 series
Christopher McCormack
@cmccormack
Jan 14 16:44
neat maybe I will get a new one... lol there goes my budget
Kaz Baig
@kbaig
Jan 14 16:45
I wouldn't
They're too expensive for what they are
I'd recommend either a 10 series to sate you for a while or to hold out entirely
Christopher McCormack
@cmccormack
Jan 14 16:45
maybe I'll just keep my current, I haven't been gaming nearly as much on my PC anyhow
Kaz Baig
@kbaig
Jan 14 16:46
I feel bad playing on my PS4 when I have a 1080ti
But I can't play exclusives on my pc so
Christopher McCormack
@cmccormack
Jan 14 16:47
hah i've been doing the same, playing Horizon Zero Dawn atm
also my switch
Kaz Baig
@kbaig
Jan 14 16:48
I have that but I need to get through the kingdom hearts games first
racing to finish them before kh3 release
Christopher McCormack
@cmccormack
Jan 14 16:48
oh yeah hehe
@kbaig know much about gsync? I bought a gsync monitor a while back, don't think it would work if I got a freesync video card but couldn't find any results on that, just freesync monitors with gsync cards
Kaz Baig
@kbaig
Jan 14 16:50
They don't have any interoperability
Christopher McCormack
@cmccormack
Jan 14 16:50
I know they will generally work fine but possibly not add the tearing/etc stuff
Kaz Baig
@kbaig
Jan 14 16:50
freesync/nvidia or amd/gsync
I have a gsymc screen and the diff on vs off is very noticable
Christopher McCormack
@cmccormack
Jan 14 16:50
I never noticed it, what type of game is it noticeable in?
Kaz Baig
@kbaig
Jan 14 16:51
It keeps the game looking smooth when the framerate isn't stable
It tries to match the refresh rate with the fps
Since it's suppose to help with stuttering, it'd be most noticeable in fast paced games
Christopher McCormack
@cmccormack
Jan 14 16:52
yeah that makes sense but I guess I never played anything that would actually surface those issues
Kaz Baig
@kbaig
Jan 14 16:52
You'd notice it in an fps for sure
Christopher McCormack
@cmccormack
Jan 14 16:53
i'll go install fortnite real quick and try with and without :)
alpox
@alpox
Jan 14 16:53
@cmccormack for gsync you need nvidia carda
Kaz Baig
@kbaig
Jan 14 16:53
ofc it only matters if your fps is below 60 or 144
alpox
@alpox
Jan 14 16:54
Christopher McCormack
@cmccormack
Jan 14 16:54
@alpox yeah and that's why I got gsync but was hoping maybe they made it cross compatable by now, I think nvidia is going to support freesync now no?
alpox
@alpox
Jan 14 16:54
I dont think so :D
Kaz Baig
@kbaig
Jan 14 16:55
It's not going to be as good as gsync with a gsync module but yes they are
@alpox They announced something at ces
alpox
@alpox
Jan 14 16:55
I got a freesync monitor with AMD graphicscard. Works very well
@kbaig that would be nice
Although I do not intend to buy nvidia
Kaz Baig
@kbaig
Jan 14 16:55
Basically they got bootleg gsync working on almost all monitors
alpox
@alpox
Jan 14 16:56
Too overpriced for the same
Kaz Baig
@kbaig
Jan 14 16:56
Problem is there is no same for high end
Jason Luboff
@JLuboff
Jan 14 17:58
:fire:
Blauelf
@Blauelf
Jan 14 18:18
Running my notebook at 50Hz (too lazy to change it, shouldn't be much of a power saver), I am just impressed by all those numbers, those look much better than the marketing bs of "800Hz TV" (100Hz, with three marketing-based x2 multipliers)
Does one have to fix the rate for playing videos?
Kaz Baig
@kbaig
Jan 14 18:37
@Blauelf high refresh on tvs isn't bs, it's just interpolated frames
Jason Luboff
@JLuboff
Jan 14 18:58
@kbaig Well... it can be bs though... A lot of manufacturs claim 240! but in reality the LCD panel only has a refresh of 120 and then its doubled via algorithms
Kaz Baig
@kbaig
Jan 14 18:59
yes, interpolation
Blauelf
@Blauelf
Jan 14 19:07
800Hz is cow feces. No LCD comes even close in switching frequency (and it was before OLED became big). Also, those multipliers were marketing stuff, like "we do two-pass optimization, so that's another x2!" "we factor in last image, another x2!"
Interpolating frames is definitely science given how many ways there are to encode videos. Half vs full frames, frames converted from one to the other, converted in resolution, frame rate, fast and slow movement,...
Kaz Baig
@kbaig
Jan 14 19:11
I didn't realize you were talking about literally 800
Blauelf
@Blauelf
Jan 14 19:52
Marketing 800. Not real. Real data looked like 100Hz (our regular TV used to have 50 interlaced frames per second, so that's a multiple)
Atsushi Toda
Jan 14 20:12

Hey guys - I have a working smallest common multiple issue - I have a working code but it exceeds maximum call stack in the FCC ide.

Was hoping for a second set of eyes to help see if I'm missing something.

Chris
@crokita
Jan 14 20:30
@broadsinatlanta so the program works, but the test running it throws a max call stack error?
I guess what I would do is remove the recursive call to smallestCommons to make it just a for loop. there's a lot of redundant work being done there anyway.
ex: store progress in a variable, such as result = numRange[0], then in a for loop run the LCM function: result = LCM(result, numRange[1]), then have the inner loop call LCM(result, numRange[2]) in the next iteration, etc.
rebello
@rebello
Jan 14 21:16
code
Chris
@crokita
Jan 14 21:16
put the  backticks on separate lines
rebello
@rebello
Jan 14 21:18
var p = ["apple","musumbi","grapes","orange","chikku","watermelon"];
var p1 =["apple","grapes","watermelon","bannas"];
var ptemp = p;

for( i=0;i< p.length;i++) {
for(j=0;j<p1.length;j++) {
if(p[i] ==p1[j]) {
p.splice(i,1);
}
}
}

for(i=0;i<p.length;i++) {
if(p[i] === 'chikku' || p[i] === 'watermelon') {
p.splice(i,1);
}
}
console.log(p);
Help needed to refactor the function
Chris
@crokita
Jan 14 21:21
what's the code snippet supposed to do?
rebello
@rebello
Jan 14 21:21
remove p1 array elements in p (remove duplicate) and remove chikku and watermelon if either exits in p1
Chris
@crokita
Jan 14 21:24
If either chikku or watermelon exist in p1, then both should be removed in p?
If that's the case, then the second for loop will always remove chikku and watermelon in p, even if those elements don't exist in p1.
If you're comfortable with higher-order functions, then the filter() method for arrays may be useful to you.
rebello
@rebello
Jan 14 21:26
If either chikku or watermelon exist in p1, then both should be removed in p? yes correct
I dont want to use 2 loops ..want to add in the first function.. I tried modifying the array to var p = ["apple","musumbi","grapes","orange","chikku or watermelon"]; but failed with string matching
Chris
@crokita
Jan 14 21:34

If you want to remove the second for loop, then you should be able to move that if(p[i] === 'chikku' || p[i] === 'watermelon') line to the inner for loop. You would make the if condition check p1 instead of p, in addition to checking if(p[i] ==p1[j]). I think you can combine the two ifs using an or statement.

The filter() function should also help make things more clear with that for loop. Here's the reference page for it: https://www.w3schools.com/jsref/jsref_filter.asp

oh, hang on
My suggestion wouldn't work. I think you should try replacing the for loops with filter first; it would just make the code easier to read, and therefore make adding in the chikku/watermelon check easier to write
That combined with the find() function, which lets you put in a string to search through an array for a matching element
rebello
@rebello
Jan 14 21:42
@crokita thanks will try with filter and find combination
Chris
@crokita
Jan 14 21:43
Alright! good luck. As for that chikku/watermelon check, you would need to first see if either value exists in p1, then store that answer so you know whether to filter those values out too
That could also be done with find()
enestatli
@enestatli
Jan 14 22:19
Hello guyz
Jason Luboff
@JLuboff
Jan 14 22:19
Hi
enestatli
@enestatli
Jan 14 22:19
how are you @JLuboff ?
Jason Luboff
@JLuboff
Jan 14 22:19
Doing alright, yourself?
enestatli
@enestatli
Jan 14 22:23
everything is fine
finally I go outside tomorrow after about 4-5 weeks staying at home :D
Btw, I have a question about requests, do you have any experience?
Jason Luboff
@JLuboff
Jan 14 22:24
Wow...thats a long time...were you injured?
enestatli
@enestatli
Jan 14 22:24
No, I just learning :D
Jason Luboff
@JLuboff
Jan 14 22:24
What type of requests
Kaz Baig
@kbaig
Jan 14 22:24
Don't you have groceries to do man haha
enestatli
@enestatli
Jan 14 22:25
I am trying scrape data through a website and wonder how many requests per second websites handle
@kbaig there is a market just below the apartment :D
Jason Luboff
@JLuboff
Jan 14 22:27
Oh... I don't have any experience with that. But I would venture to say that different sites can handle different number of requests based on the host
enestatli
@enestatli
Jan 14 22:27
So, I think big websites probably handle much more
I hope this little website that I am scrapping, won't be hammered because of my 25000 requests :D
Jason Luboff
@JLuboff
Jan 14 22:29
You could cause a DDoS... which I'm sure the host would not like
Unless this is your own site you're checking against
enestatli
@enestatli
Jan 14 22:30
oh bad, then I should go adding sleep function to delay my requests
oh I wish I had one!
Jan 14 22:49
@enestatli I would try hard to keep the requests as low as feasabily possible. Any sensible host would block your IP if they dislike you scraping their content.
On a project were the number of API calls mattered (there was a hard limit for each API key given out) I used localStorage to "cache" previous calls, so I'd call 1 time per person per day.
enestatli
@enestatli
Jan 14 22:51
@bradtaniguchi oh didn't know that. Thank you!
Jan 14 22:51
np :D
enestatli
@enestatli
Jan 14 22:52
"I used localStorage to "cache" previous calls, so I'd call 1 time per person per day." I don't understand this one excatly :D
you make cahce file to hold something in it then per person per day of what? :D
Jason Luboff
@JLuboff
Jan 14 22:53
@bradtaniguchi Man...why didn't you tell me how fun E2E testing is?!
Jan 14 22:54
@enestatli Depending on where your making requests, and were you can cache, you can use anything, from a global variable shared on your server, local storage, or even your own database
@JLuboff Haha how'd I know you'd find it fun XD
Jason Luboff
@JLuboff
Jan 14 22:55
I dunno. But.. its pretty cool
enestatli
@enestatli
Jan 14 22:56
Jan 14 22:56
@enestatli np :D
enestatli
@enestatli
Jan 14 22:56
and good night to whoever read this message :D
Jan 14 22:56
@JLuboff Automation is the future :sunglasses:
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 22:57
how computers see the codes
Jason Luboff
@JLuboff
Jan 14 22:57
@bradtaniguchi This would have saved me so much time in the past...
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 22:57
as text
?
Jason Luboff
@JLuboff
Jan 14 22:58
1 and 0
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 22:58
yeah
Jan 14 22:58
@JLuboff At least now your saving yourself time in the future :D
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 22:58
it's the same for images video
Jason Luboff
@JLuboff
Jan 14 22:58
@bradtaniguchi True. Need to rework things a bit...need to create a super user other than the actual super user
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 22:58
basically for anytthing?
Jason Luboff
@JLuboff
Jan 14 22:59
Yes. At the deepest level, a computer is just reading 1 and 0
aka on and off
Jan 14 22:59
@Lia-Sue-Kim Yup, or electrical signals that are "converted" to 1's and zero's :P
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 23:00
so it uses two digit number system?
when they make a new programming language
do they write it in 1's and 0's
or use a programming language
Jan 14 23:01
@Lia-Sue-Kim Its all layers of abstraction
You asked about what the "machine sees" and the machine, essentially sees the lowest abstraction. But you can think of it at higher levels
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 23:03
ok
What I get is what we learn
without even understanding how all these work behind
Jan 14 23:04
Kinda, the higher your abstraction get's, the more stuff is "below" you, but usually the more things you can use. Something like Javascript is a higher abstraction than something like C
And C is a higher abstraction than assembly, which is higher than plain binary codes
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 23:06
if I continue CS and programming
will I get this one day?
what it means to become a computer scientist
Do they code too or just learn theory
Jan 14 23:08
@Lia-Sue-Kim Computer scientists are all about theory.
Code is just a tool to implement the theory for the most part
But were' talking more about hardware/software concepts, not anything computation wise. You can be a computer scientist without all this "abstraction" crap. Look up Ada Lovelace, she was the OG programmer, before electricity was common
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 23:11
OG?
before electricity im not sure if there was a computer
i know before electronic computer s the term computer used to refer to people who did calculations
like mathematicians maybe?\
CS is really overwhelming sometimes
Jan 14 23:15
@Lia-Sue-Kim Computer scientists study computation of information. The idea they "know how to code" is just becuase that's where its most useful in practice, but you could be a computer scientist and now be a programmer
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 23:16
if you learn by yourself you arre just a coder
rght
t o become a Computer scientist you have to enroll to a study programm
Jan 14 23:17
Nope, you can learn by yourself, it just matters what you learn
If you spend 24/7 programming, you learn something different than if you spent 24/7 studying computer science as a subject.
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 23:19
another thing i dont get is evolution
Jan 14 23:20
@JLuboff Hey wait a moment, I just realized you said why didn't I tell you how fun testing was. I'm sure I told you "you should be testining" multiple times XD, Idk if I every addressed it as fun, but still :P
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 23:20
in other professions if you have 10+ years experience you are kind of expert but in CS you becomejust outdated
Jason Luboff
@JLuboff
Jan 14 23:20
@bradtaniguchi Ya...I mean..you did say I should be...but you never said it was fun :P
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 23:20
as it evolves always
Jan 14 23:21
@Lia-Sue-Kim If you have 10+ years in the same thing, you are outdated, but if you keep up with trends, then you should be fine. I can't see a 10+ year expert being worse than a beginner at new-er technologies, as long as the expert kept up at least a little. Most "new" stuff is pretty old. (Like functional programming)
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 23:23
It's just my first year and there are so many ideas that confuses me
Jan 14 23:24
@Lia-Sue-Kim Gotta keep learning. If it was easy to learn everyone would do it XD
Lia-Sue-Kim
@Lia-Sue-Kim
Jan 14 23:26
it reminds me of a mathematician who became ill cuz not getting the right answer
i forgot his name
I hope neday
oneday*
I won't become sick like him
Atsushi Toda