These are chat archives for FreeCodeCamp/HelpJavaScript

22nd
Aug 2018
Jefferson
@jeffersonnnn
Aug 22 2018 10:06
oh yeah, good morning (from where i am , at least). Hi guys :waves:
catalin560
@catalin560
Aug 22 2018 10:09
@jeffersonnnn :wave:
Jefferson
@jeffersonnnn
Aug 22 2018 10:15
can i get input on bitwise operators in JS. They have me in a whirl.
Jefferson
@jeffersonnnn
Aug 22 2018 10:28
i am trying to shave off every zero that exists outside of a bracket that is formed by 1 in a binary representation of an interger. So for every 00100010000011 , the end result will be 100010000011 and for every 00000110001000 the result will be 110001
alpox
@alpox
Aug 22 2018 10:32
@jeffersonnnn Where exactly did you get a representation from where you have leading 0's?
Is that a string?
Jefferson
@jeffersonnnn
Aug 22 2018 10:33
i see that the shift operator >>> should work but i can't seem to wrap my head around it. Help *swallows
Kelechi Chinaka
@ke1echi
Aug 22 2018 10:33
u might want to slice from the first 1 to the last 1 @jeffersonnnn
using indexOf() and lastIndexOf() @jeffersonnnn
Jefferson
@jeffersonnnn
Aug 22 2018 10:34
@alpox it is a binary representation of a number.
alpox
@alpox
Aug 22 2018 10:34
@jeffersonnnn bitwise operators work directly on numbers. There are no leading zeros, only zeros at the end.
Also, removing zeros at the end changes the value of the number
Jefferson
@jeffersonnnn
Aug 22 2018 10:35
@ke1echi something like the binary representation of 1 is 00000001
alpox
@alpox
Aug 22 2018 10:35
@jeffersonnnn Yes and no - the leading zeros do not appear anywhere and do not have a meaning. They are only there to fill up the bytes in memory and there you cannot get rid of them
@jeffersonnnn Can you elaborate on the purpose of removing the zeros?
Kelechi Chinaka
@ke1echi
Aug 22 2018 10:37
s.slice(s.indexOf('1'), s.lastIndexOf('1')+1) @jeffersonnnn
alpox
@alpox
Aug 22 2018 10:37
@ke1echi Its a number, not a string
Kelechi Chinaka
@ke1echi
Aug 22 2018 10:38
you have to convert to a string @jeffersonnnn
alpox
@alpox
Aug 22 2018 10:38
Not necessarly and also, there would not be leading zeros
Aditya
@ezioda004
Aug 22 2018 10:38
@ke1echi Why till last 1? 0's dont have meaning at the beginning, they do afterwards
Niraj Nandish
@Nirajn2311
Aug 22 2018 10:38
@jeffersonnnn what exactly is the purpose of your code
Kelechi Chinaka
@ke1echi
Aug 22 2018 10:39
thats the example he gave @ezioda004
Jefferson
@jeffersonnnn
Aug 22 2018 10:39
@alpox so how can i use it. an example of using it, maybe. i understand that i am asking for a lot.

```js function solution(N) {
const foo = N.toString(2);
if (foo >>>) {

}

}```

note the foo >>>

Like so?

Aditya
@ezioda004
Aug 22 2018 10:40
@ke1echi That'd only work for odd numbers then :P
alpox
@alpox
Aug 22 2018 10:40
@jeffersonnnn Wait out. First you should know WHY you remove the zeros
We can help you if we know the purpose
Kelechi Chinaka
@ke1echi
Aug 22 2018 10:41
pls make a proper explanantion with examples @jeffersonnnn
Aditya
@ezioda004
Aug 22 2018 10:41
I dont think >>> or << shift operators would do what you want it to do
Kelechi Chinaka
@ke1echi
Aug 22 2018 10:41
i thought so @ezioda004
its weird to want to remove zeros at the beginning or the end @jeffersonnnn
Jefferson
@jeffersonnnn
Aug 22 2018 10:48
@ezioda004 @ke1echi @alpox @Nirajn2311 the purpose for removing the leading 0s is because i want to strip down the binary to the largest gap between independent 1s. In essence, a string is passed in, i convert to it binary representation and go on to find the largest gap between independent 1s
alpox
@alpox
Aug 22 2018 10:49
@jeffersonnnn What is an "independent 1"
Jefferson
@jeffersonnnn
Aug 22 2018 10:49
terrible network at my end. terrible.
alpox
@alpox
Aug 22 2018 10:50
And I believe it would be simpler to keep the string than to transform it to binary
Even though one could create a solution in binary
Your best bet is to use regex for this
Jefferson
@jeffersonnnn
Aug 22 2018 11:01
@alpox i definitely want to use regex, but it isn't my forte. And what i mean is say i have
0000100001 , i'd like to shave off the 0000 in front of 0000
Kelechi Chinaka
@ke1echi
Aug 22 2018 11:02
like 0000100001 => 100001? @jeffersonnnn
alpox
@alpox
Aug 22 2018 11:03
@jeffersonnnn someNumber.toString(2); already shows without leading zeros
Jefferson
@jeffersonnnn
Aug 22 2018 11:05
@ke1echi exactly so.
alpox
@alpox
Aug 22 2018 11:06
const p = 45;
console.log(p.toString(2)); // 101101
Jefferson
@jeffersonnnn
Aug 22 2018 11:08
@alpox then what in the name of all that is Holy is wrong with my code
ugh.
@alpox thank you very much.
Aditya
@ezioda004
Aug 22 2018 11:08
via regex:"0000100001".replace(/^0*/, "")
Kelechi Chinaka
@ke1echi
Aug 22 2018 11:08
you can use indexOf to remove leading zeros @jeffersonnnn
alpox
@alpox
Aug 22 2018 11:09
@jeffersonnnn well there can be still zeros at the end tho
Jefferson
@jeffersonnnn
Aug 22 2018 11:09
@ke1echi the ones at the end, i have no issues with.
alpox
@alpox
Aug 22 2018 11:09
const p = 8;
console.log(p.toString(2)); // 1000
@jeffersonnnn Well there are none at the beginning :D I then wonder what code you have
Jefferson
@jeffersonnnn
Aug 22 2018 11:10
i just want to know which is the biggest gap between 1s . As for the ones at the end, they will be dealt with an if statement
@alpox i'll be back *in terminator's voice
thanks Community!
Kelechi Chinaka
@ke1echi
Aug 22 2018 11:11
str.slice(str.indexOf('1')) @jeffersonnnn
alpox
@alpox
Aug 22 2018 11:35
@jeffersonnnn
function largestGap(N) {
  let maxCounter = 0;
  let counter = 0;
  while(!(N & 1)) N >>>= 1;
  while((N >>>= 1) !== 0) {
    if(!(N % 2)) counter++;
    else {
      if(counter > maxCounter)
        maxCounter = counter;
      counter = 0;
    }
  } 

  return maxCounter;
}
Does not look nice though :D
alpox
@alpox
Aug 22 2018 11:50
Other (trickier) version:
function largestGap(N) {
  let max = 0;
  let prev_one = N ^ (N & (N - 1));
  while(N != 0) {
    N = N ^ prev_one;
    let next_one = N ^ (N & (N - 1))

    const distance = Math.log2(next_one) - Math.log2(prev_one) - 1;
    if(distance > max)
      max = distance;

    prev_one = next_one;
  }
  return max;
}
Jefferson
@jeffersonnnn
Aug 22 2018 12:17
@alpox man i just saw these things. What i would do to superimpose your knowledge of algos into my cranium right now haha. Amazing work, my man!
@alpox thank youu
alpox
@alpox
Aug 22 2018 12:25
@jeffersonnnn Np
Btw. its simpler with regex:

function largestGap(N) {
  N = N.toString(2);
  let result;
  let regex = /1(?=(0*)1)/g;
  let matches = [];
  while(result = regex.exec(N)) {
    matches.push(result[1].length);
  }

  return Math.max(...matches);
}
@jeffersonnnn
Jefferson
@jeffersonnnn
Aug 22 2018 12:32
@alpox my head hurts from even looking at it haha. I have implemented the very first one you dropped.
alpox
@alpox
Aug 22 2018 12:34
@jeffersonnnn Alright, I hope you understand it :D
Jefferson
@jeffersonnnn
Aug 22 2018 12:39
can't imagine what i am getting wrong here
function solution(n) {
    let n = "222323";
    const foo = n.split ("");
    for (let i = 0; i < foo.length; i++) {
        if (foo[i] === i) {
            return yes;
        } else {
            return no; 
        }
    };
};

console.log (n);
im trying to check if characters in an array are unique
Niraj Nandish
@Nirajn2311
Aug 22 2018 12:42
I think it’s better to use a nested for loop
And by unique, do you mean differs letters
alpox
@alpox
Aug 22 2018 12:43
@jeffersonnnn one thing is: you compare entries of the string with their own position in the array - this cannot work out well. Another thing is, there are no variables named yes and no in your code unless you specified them elsewhere
@jeffersonnnn console.log(n) is outside of the function and the function does not seem to be called here
@jeffersonnnn For the comparison of all numbers wich each other, use either a nested loop as @Nirajn2311 indicates, .indexOf or a datastructure for reference (for example an object)
Jefferson
@jeffersonnnn
Aug 22 2018 12:52
@Nirajn2311 yes i do. A nested for loop. hmm sounds tasty.

@alpox 'there are no variables named yes and no in your code unless you specified them elsewhere' && 'console.log(n) is outside of the function and the function does not seem to be called here'

now the noob-ness of my code hits me - once again. Ugh. I have adjusted it.

@a;

catalin560
@catalin560
Aug 22 2018 12:59
well if you really want unique characters and since you already are using ES6 then might as well learn the easy way:
@jeffersonnnn
function solution(n) {
    let foo = [...new Set(n.split(""))];
    return foo.join("");
};

console.log(solution("222323")); //23
alpox
@alpox
Aug 22 2018 13:00
@catalin560 I believe his intent is to return true/false depending on the existence of multiple characters
catalin560
@catalin560
Aug 22 2018 13:00
@alpox ah then I might've misunderstood
Aditya
@ezioda004
Aug 22 2018 13:02
Then add n.length == foo.length ? "yes" : "no";
@catalin560 You can also use spread operators on the strings since they are iterables, [...new Set([...n])]
catalin560
@catalin560
Aug 22 2018 13:05
@ezioda004 nice tip thanks!
Jason Luboff
@JLuboff
Aug 22 2018 15:13
Morning :wave:
Christopher McCormack
@cmccormack
Aug 22 2018 15:13
@JLuboff heya :wave:
Jason Luboff
@JLuboff
Aug 22 2018 15:14
@cmccormack What up
Christopher McCormack
@cmccormack
Aug 22 2018 15:14
Wondering why it's so quiet at work today... you?
Jason Luboff
@JLuboff
Aug 22 2018 15:26
Just trying to get going on the morning
Christopher McCormack
@cmccormack
Aug 22 2018 15:28
:coffee: || :beer:
Simon Cordova
@gbsimon87
Aug 22 2018 15:28
Whats up whats up!
Jason Luboff
@JLuboff
Aug 22 2018 15:28
:coffee:
Simon Cordova
@gbsimon87
Aug 22 2018 15:29
@cmccormack @JLuboff what's going on :)
Just heard of Kotlin, you guys ever use it?
Christopher McCormack
@cmccormack
Aug 22 2018 15:30
@gbsimon87 never used it, seems like Android developers really like it, at least compared to traditional Java
Jason Luboff
@JLuboff
Aug 22 2018 15:30
Never heard of it
Simon Cordova
@gbsimon87
Aug 22 2018 15:31
Kotlin is a statically typed programming language that runs on the Java virtual machine and also can be compiled to JavaScript source code or use the LLVM compiler infrastructure.
That's from the google description
I'm thinking of giving it a shot, just to check it out
I'm going to start my project on react native soon so I wanted to see if you guys knew a bit about it
Christopher McCormack
@cmccormack
Aug 22 2018 15:32
Sounds like fun, always wanted to play with native but haven't had the time
Jason Luboff
@JLuboff
Aug 22 2018 15:33
I've made my way through a quarter of the React FCC curriculm...so while not native...its something
Christopher McCormack
@cmccormack
Aug 22 2018 15:33
@JLuboff nice!
enjoying it so far?
Jason Luboff
@JLuboff
Aug 22 2018 15:34
I think its all stuff I had gone through prior when FCC was still beta...but ya it's alright.
So far its just about rendering/nesting stuff
Simon Cordova
@gbsimon87
Aug 22 2018 15:36
@JLuboff I did the React FCC part and cruised right through it, but I was always familiar with it.
I think FCC is amazing but what they've got there is definitely a birds eye view, but good stuff nonetheless
pluralsight and udemy have some very complete stuff
Christopher McCormack
@cmccormack
Aug 22 2018 15:37
I have the React/Redux Udemy course, it was pretty good, well presented and explained with good examples
Jason Luboff
@JLuboff
Aug 22 2018 15:37
Ya. I haven't been the most impressed with the new FCC content unfortunately
Christopher McCormack
@cmccormack
Aug 22 2018 15:38
I still think the React docs are the best place to start though
Jason Luboff
@JLuboff
Aug 22 2018 15:38
I figured React is large enough that this is just an overview and I'll probably still need some other resources but gotta start somewhere
Simon Cordova
@gbsimon87
Aug 22 2018 15:38
I've got that course as well, the burger one?
Yeah, React docs are hands down best place to start imo
That burger course on Udemy is great, but he rushes the Redux part quite a bit
catalin560
@catalin560
Aug 22 2018 15:40
I would never use udemy or other paid services like it
there are so much free stuff you can learn on your own like... youtube :smiley:
Christopher McCormack
@cmccormack
Aug 22 2018 15:40
If I hadn't started with Youtube videos I would have progressed a lot faster
Simon Cordova
@gbsimon87
Aug 22 2018 15:41
SAme
Same**
Jason Luboff
@JLuboff
Aug 22 2018 15:41
I purchased a couple of Node courses from udemy and appreciate that I did. I've never found a youtube course that parallels something like udemy
Christopher McCormack
@cmccormack
Aug 22 2018 15:41
It wasn't cohesive enough so you always feel like you're missing something
Simon Cordova
@gbsimon87
Aug 22 2018 15:41
Those courses are curated and very comprehensive
Christopher McCormack
@cmccormack
Aug 22 2018 15:41
Agreed
Jason Luboff
@JLuboff
Aug 22 2018 15:42
And hell..for $10-15 a course... I'm not really losing out on much
Simon Cordova
@gbsimon87
Aug 22 2018 15:42
Oh dude I went incognito and brought that down to 9/99
9.99
lolol
Jason Luboff
@JLuboff
Aug 22 2018 15:43
$9.99-15**
Christopher McCormack
@cmccormack
Aug 22 2018 15:43
They have sales often, I'll just wait and if it's good enough maybe grab one
Simon Cordova
@gbsimon87
Aug 22 2018 15:45
They've always got the 'countdown' til the sale is over
Honestly I don't mind paying 15 for a solid course anyway
Christopher McCormack
@cmccormack
Aug 22 2018 15:45
High quality, updated fairly often, not too bad
Simon Cordova
@gbsimon87
Aug 22 2018 15:45
@catalin560 I'd highly recommend giving some of those a chance, the Youtube ones just aren't curated by multiple people
catalin560
@catalin560
Aug 22 2018 15:46
don't know what to say... there are just so many resources on the web...
the whole of internet is just a big library
Simon Cordova
@gbsimon87
Aug 22 2018 15:47
Fair enough, everyones got their way of going about it
Jason Luboff
@JLuboff
Aug 22 2018 15:48
Sure there are plenty of resources on the web, but udemy (and other similar sites) actually bundle everything in a way that its not just a single component if that makes sense
And as @gbsimon87 said, everyone has their own way :)
No single method of learning will work for everybody
catalin560
@catalin560
Aug 22 2018 15:49
I did enjoy youtube tutorials, plus besides it there is w3schools, tutorialspoint, freecodecamp :smiley:
plus recently I've discovered goalkicker.com
I mean just look at the quality of those ebooks
and they'r absolutely free
Christopher McCormack
@cmccormack
Aug 22 2018 15:49
Sometimes you don't want to dredge youtube for small nuggest of gold when there are curated resources you can pay for
it's up to how much you value your time sometimes
catalin560
@catalin560
Aug 22 2018 15:52
sure I guess not anyone has time to search and prefers to be spoonfed all at once
Christopher McCormack
@cmccormack
Aug 22 2018 15:52
@catalin560 don't conflate video resources with written, I've never paid for anything written, the React docs themselves are gold and they are free, tons of great Medium and other blog posts, etc...
I'm sure myself and @gbsimon87 have spent hundreds of hours reading and practicing, to say we're being spoonfed because we chose to purchase quality content is just being obtuse
Simon Cordova
@gbsimon87
Aug 22 2018 15:54
To be honest that React/Redux course was the first I've ever bought, and it was so helpful compared to everything else on Youtube and Medium I was researching, that I went and got the React Native one
Christopher McCormack
@cmccormack
Aug 22 2018 15:54
If it wasn't worth the cost we wouldn't have mentioned it, either
catalin560
@catalin560
Aug 22 2018 15:54
@cmccormack you're right! I'm sorry. I didn't meant it like that
as far as video resources then yes udemy might be good
alpox
@alpox
Aug 22 2018 15:55
Until now I easily learned everything from just freely available sources (no videos though.. They seriously suck for learning in my opinion)
catalin560
@catalin560
Aug 22 2018 15:56
:point_up:
Christopher McCormack
@cmccormack
Aug 22 2018 15:56
They aren't the greatest for truly learning, that's true. But I can throw a video on while working on something monotonous and get a little out of it, enough to be prepared when I have more time
alpox
@alpox
Aug 22 2018 15:56
I usually prefer to learn stuff when I need it
Simon Cordova
@gbsimon87
Aug 22 2018 15:56
I'd say it depends...
If it's a video that you can have on one screen and literally follow along on another, and you're good at learning while doing, videos can be treat
great**
alpox
@alpox
Aug 22 2018 15:58
@gbsimon87 even that I consider as no good. Doing what the guy in the video does is no good learning experience as you dont get to the solution by yourseld
Its copying and just trying to make sense of it without proper understanding
Simon Cordova
@gbsimon87
Aug 22 2018 16:00

@alpox I wouldn't say that's 'no good' - not everyone learns the same way.

For example, this Udemy course we were referring to, yes he is doing it, but he's giving you his mental process while going at it - so he's not just doing it, he's showing you WHY he got to where he is and numerous ways to handle it.

That's my two cents though.
Again, like @cmccormack said, I've literally spent hundreds of hours reading/practicing programming, it's what I do as a hobby and career.

Which is why I certainly recommend certain paid courses, they have huge ratings and massive download numbers (from programmers themselves) for a reason
Simon Cordova
@gbsimon87
Aug 22 2018 16:07
@catalin560 pretty good resource you mentioned, one I've used in the past is Dash - also very suitable - https://kapeli.com/dash
catalin560
@catalin560
Aug 22 2018 16:10
@gbsimon87 ah I don't have mac but I remember using a windows version of the same app, they'r also good if internet is down :smirk:
Simon Cordova
@gbsimon87
Aug 22 2018 16:11
All about that offline support, I feel this one is a must have
Jason Luboff
@JLuboff
Aug 22 2018 16:15
https://zealdocs.org/ I have this guy for windows, but haven't used it lol
Christopher McCormack
@cmccormack
Aug 22 2018 16:19
I can't find it but there used to be an online api doc browser that used local storage so you could queue up a few languages/libraries and read them anywhere, it was pretty good
catalin560
@catalin560
Aug 22 2018 16:20
@JLuboff thats the one I was talking about... it even has a ad for the same app @gbsimon87 was suggesting LOL
Simon Cordova
@gbsimon87
Aug 22 2018 16:21
for Dash?
catalin560
@catalin560
Aug 22 2018 16:21
yea it says get Dash for mac
Jason Luboff
@JLuboff
Aug 22 2018 16:22
Oh ya, there it is lol
Ah... Dash provides the docsets
Simon Cordova
@gbsimon87
Aug 22 2018 16:23
Yeah, their design team did a great job imo
Christopher McCormack
@cmccormack
Aug 22 2018 16:36
Are any of these cross-platform?
I hate having to use different products all the time
Jason Luboff
@JLuboff
Aug 22 2018 16:39
@cmccormack Stop being a weenie ;)
Christopher McCormack
@cmccormack
Aug 22 2018 16:39
hahaha
Simon Cordova
@gbsimon87
Aug 22 2018 16:39
very true
Lucky I use Mac and Dash is honestly my fav - I don't understand why they don't build for both though
Christopher McCormack
@cmccormack
Aug 22 2018 16:40
Lazy
catalin560
@catalin560
Aug 22 2018 16:40
well zeal seems to work on windows and linux so... more power to it I guess
btw is anyone here on linux?
Jason Luboff
@JLuboff
Aug 22 2018 16:45
Nah.. Windows 10 here
Simon Cordova
@gbsimon87
Aug 22 2018 16:47
Do ordinary users use Linux?
Jason Luboff
@JLuboff
Aug 22 2018 16:49
Some..but it doesn't have a large market hold
Christopher McCormack
@cmccormack
Aug 22 2018 16:50
It has the majority market if you consider servers
I use it on my raspberry pis
oh and my digital ocean VPS
Simon Cordova
@gbsimon87
Aug 22 2018 16:51
I've always been under the impression it was for programmers
Jason Luboff
@JLuboff
Aug 22 2018 16:55
I guess I should say market hold for workstation users in business
Christopher McCormack
@cmccormack
Aug 22 2018 16:56
Once you know it well enough it could pretty easily be used as a daily driver OS
Simon Cordova
@gbsimon87
Aug 22 2018 16:56
but does it have programs like word excel etc?
Good for everyday computer users
I always thought it was more 'shell' based and little GUI
Jason Luboff
@JLuboff
Aug 22 2018 16:58
There are Linux equivelent like LibreOffice
But.. I find the UI of which to be...of lower quality..
but it is free..
Simon Cordova
@gbsimon87
Aug 22 2018 16:59

Fair enough.

Heading home - I may log in from home if the wifey is out
If not, night chaps! :)

Christopher McCormack
@cmccormack
Aug 22 2018 16:59
@gbsimon87 see ya
Jason Luboff
@JLuboff
Aug 22 2018 16:59
Bye
Christopher McCormack
@cmccormack
Aug 22 2018 16:59
Google docs is usually fine for me for small stuff
Office 365 is cross platform as well
unless it uses Silverlight
Jason Luboff
@JLuboff
Aug 22 2018 17:02
Office 365 is cross platform with Linux too? Didn't know that
Christopher McCormack
@cmccormack
Aug 22 2018 17:05
It's web isn't it?
not all of it but some of it at least
Jason Luboff
@JLuboff
Aug 22 2018 17:05
OH...I thought you meant the apps themselves, not the web versions
Christopher McCormack
@cmccormack
Aug 22 2018 17:05
I use it some at work, don't really like the web version as much
it's getting better though
I wonder if you can run office in Wine
Jason Luboff
@JLuboff
Aug 22 2018 17:06
I hate web versions...they're always awful lol
Brad
@bradtaniguchi
Aug 22 2018 17:22
Google docs :+1: (I'm like paid to say that tho :P)
Jason Luboff
@JLuboff
Aug 22 2018 17:23
Why do you say you're paid to say that?
Brad
@bradtaniguchi
Aug 22 2018 17:31
we work on google cloud, and contract work for google cloud work. So no AWS, or MS stuffs hehe
Jason Luboff
@JLuboff
Aug 22 2018 17:32
Ah
Gah...there are so many errors in this book its ridicilious
Brad
@bradtaniguchi
Aug 22 2018 17:34
what book is it?
Jason Luboff
@JLuboff
Aug 22 2018 17:35
"Developing SQL Databases" Exam Ref from Microsoft
The errata document is 25 pages
Brad
@bradtaniguchi
Aug 22 2018 17:36
geezus
Jason Luboff
@JLuboff
Aug 22 2018 17:37
Ya.. and its not in order either becuase there were three different times they updated it
Brad
@bradtaniguchi
Aug 22 2018 17:38
ah good old microsoft
Jason Luboff
@JLuboff
Aug 22 2018 17:42
Ya...pretty disappointing. The previous book was pretty decent but it also didn't have an errata so not sure if there were any errors
Brad
@bradtaniguchi
Aug 22 2018 17:43
haha, coulda been worse, but no one reported the bugs so no one knows :P
Jason Luboff
@JLuboff
Aug 22 2018 17:49
True which is part of the problem, I'm learning so I'm trusting it
Brad
@bradtaniguchi
Aug 22 2018 19:01
Alright I just had some funky level stuff going on with my typescript code. Legit, a function wasn't being called somehow, even tho there is 0 logic. I changed the order of the lines and bam it starts working after 20 minutes of being confused
Brad
@bradtaniguchi
Aug 22 2018 19:26
found the culprit, I was running the wrong build files :?
Jason Luboff
@JLuboff
Aug 22 2018 20:12
Helps if you use the right build files
Brad
@bradtaniguchi
Aug 22 2018 20:23
my npm run build build files 1 way, but then when I ran npm run dev it was using the build files, and updating the code.... that I wasn't looking at -_-
Jason Luboff
@JLuboff
Aug 22 2018 20:24
hehe
Pagnito
@Pagnito
Aug 22 2018 20:59
Screen Shot 2018-08-22 at 4.59.09 PM.png
it was working fine for days and now suddenly its givin me this
and i dont get how, cuz it prints the url but then suddenly its undefined
Christopher McCormack
@cmccormack
Aug 22 2018 21:00
@Pagnito this is React right?
are you changing state to where that object may get overwritten?
Pagnito
@Pagnito
Aug 22 2018 21:01
no component state on this one
Christopher McCormack
@cmccormack
Aug 22 2018 21:02
is it possible some articles don't have multimedia?
Pagnito
@Pagnito
Aug 22 2018 21:02
nah they all do
Christopher McCormack
@cmccormack
Aug 22 2018 21:03
I'm going to guess a few don't and that's what you're hitting
may want to log each property in the chain independently
Pagnito
@Pagnito
Aug 22 2018 21:03
i think ur right about something rerendering tho and messing it up
Christopher McCormack
@cmccormack
Aug 22 2018 21:03
you'll most likely get undefined
Pagnito
@Pagnito
Aug 22 2018 21:03
nah
it was working for days
i know they all have multi media
Christopher McCormack
@cmccormack
Aug 22 2018 21:03
but this is a dynamic api right?
Tiago Correia
@tiagocorreiaalmeida
Aug 22 2018 21:04
hello everyone
Pagnito
@Pagnito
Aug 22 2018 21:04
whatsa dynamic api
Christopher McCormack
@cmccormack
Aug 22 2018 21:04
@tiagocorreiaalmeida heya
Jason Luboff
@JLuboff
Aug 22 2018 21:04
@tiagocorreiaalmeida Yo yo yo
Christopher McCormack
@cmccormack
Aug 22 2018 21:04
@Pagnito the response you get from the API, will that change depending on the time/day?
Jason Luboff
@JLuboff
Aug 22 2018 21:04
dynamic means the data changes
Tiago Correia
@tiagocorreiaalmeida
Aug 22 2018 21:05
how are you today?
Jason Luboff
@JLuboff
Aug 22 2018 21:05
Doing alright..yourself?
Pagnito
@Pagnito
Aug 22 2018 21:06
@cmccormack oh ya it is
so i think ur right
i just checked
@cmccormack thnx
Christopher McCormack
@cmccormack
Aug 22 2018 21:06
np
Tiago Correia
@tiagocorreiaalmeida
Aug 22 2018 21:07
not so great after turning on my new laptop and spot something similiar to a "scratch" on the "Inside" part of the screen
:D
Jason Luboff
@JLuboff
Aug 22 2018 21:08
Uh oh
Tiago Correia
@tiagocorreiaalmeida
Aug 22 2018 21:08
yeah so now a pain in the butt send it back wait more days ahah
Christopher McCormack
@cmccormack
Aug 22 2018 21:09
ouch
what did you decide on?
The Asus?
Tiago Correia
@tiagocorreiaalmeida
Aug 22 2018 21:10
yeah other thn the scratch it looks quite great
have you been coding anything lately @cmccormack ?
Christopher McCormack
@cmccormack
Aug 22 2018 21:11
@tiagocorreiaalmeida no I wish, been too busy with work lately :/
Tiago Correia
@tiagocorreiaalmeida
Aug 22 2018 21:12
I know the feeling, well someday will be the day :D
also tried something you pointed me a few months ago
web scraping with python
Jason Luboff
@JLuboff
Aug 22 2018 21:12
My work is coding now..so..now I get to say I'm too busy to not program?
Tiago Correia
@tiagocorreiaalmeida
Aug 22 2018 21:13
was fun to play with it even tought I didnt found a real use in my case
yeah kinda off @JLuboff
ahah
Christopher McCormack
@cmccormack
Aug 22 2018 21:14
@tiagocorreiaalmeida you can use it to scrape all the new items for sale on sites like craigslist to find bargains!
Tiago Correia
@tiagocorreiaalmeida
Aug 22 2018 21:16
could be an interesting one, thanks for the idea @cmccormack
Christopher McCormack
@cmccormack
Aug 22 2018 21:17
Could scrape github for api keys :)
Tiago Correia
@tiagocorreiaalmeida
Aug 22 2018 21:17
a person sent me this a few months ago but I had to share it, https://imgur.com/9z8bgUA
Brad
@bradtaniguchi
Aug 22 2018 21:18
@tiagocorreiaalmeida hahaha
Christopher McCormack
@cmccormack
Aug 22 2018 21:19
haha
Jason Luboff
@JLuboff
Aug 22 2018 21:23
:joy:
Brad
@bradtaniguchi
Aug 22 2018 21:26
I have a quick question on async/await, having await here is useless right? Or do I need it so the res wont send until the update is "done?" or is async await not working anyways?
async (req, res) => {
  try {
    await this.updateDocument(req)
    res.status(200).send('Success!')
  } catch (e) {
    console.error(e);
  }
}
Jason Luboff
@JLuboff
Aug 22 2018 21:27
Do you want to send an error status if the update fails?
If so, then ya I'd say you'd want async/await. If you're going to send 200 regardless...then no need
Brad
@bradtaniguchi
Aug 22 2018 21:54
yea, id like to "wait" to make sure no error gets thrown, I should update the example and say in the catch I return an error in the response, I dont just console log the error
Christopher McCormack
@cmccormack
Aug 22 2018 21:59
Any reason not to use .then and .catch for this example?
Brad
@bradtaniguchi
Aug 22 2018 22:01
@cmccormack I could, but I was curious about if I could do it with async await
since there's some sync code around the updateDocument call that could throw an error too
Jason Luboff
@JLuboff
Aug 22 2018 22:35
Ya I think the above is good but include in your catch to send failure status
Brad
@bradtaniguchi
Aug 22 2018 22:36
yes yes, in my example I just put console log for simplicity, but I do send back an error response
Jason Luboff
@JLuboff
Aug 22 2018 22:39
:thumbsup:
Jason Luboff
@JLuboff
Aug 22 2018 23:00
Ugh. I hate all the shitty CSS/HTML I did on our company intranet page so long ago...think I need to rebuild again.. :joy:
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:02
:smile: cs50 really head banging me @JLuboff
Jason Luboff
@JLuboff
Aug 22 2018 23:02
@ke1echi I've never taken it, good course?
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:03
yea... but very challenging
Brad
@bradtaniguchi
Aug 22 2018 23:03
@ke1echi what you learning?
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:04
image resizing @bradtaniguchi
Brad
@bradtaniguchi
Aug 22 2018 23:05
ew, sounds like lots of math :(
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:06
:laughing:
Jason Luboff
@JLuboff
Aug 22 2018 23:07
Hmm...should I learn Flexbox or Grid to fix my atrocis CSS?
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:07
flexbox
Jason Luboff
@JLuboff
Aug 22 2018 23:09
Thats one vote flexbox... @cmccormack @bradtaniguchi any thoughts?
Christopher McCormack
@cmccormack
Aug 22 2018 23:09
flex first absolutely
Brad
@bradtaniguchi
Aug 22 2018 23:09
isn't flex the future?
Christopher McCormack
@cmccormack
Aug 22 2018 23:09
then grid for more powerful stuff
Brad
@bradtaniguchi
Aug 22 2018 23:10
I'm not good with css stuff, I only know flex, so I am biased by having no experience haha
Jason Luboff
@JLuboff
Aug 22 2018 23:10
@bradtaniguchi You sound like me :)
I'm not good with CSS stuff but I was trying to avoid using bootstrap at the time if I remember right..so figure..might as well learn flexbox or whatever to fix my old garbage
Philip Durbin
@pdurbin
Aug 22 2018 23:12
I took cs75 and it was good. You liked cs50 @ke1echi?
Jason Luboff
@JLuboff
Aug 22 2018 23:13
Given..it doesn't need to be responsive...but flex will help me build a grid like structure similar to bootstrap/bulma, right? @cmccormack
Christopher McCormack
@cmccormack
Aug 22 2018 23:13
yeah man those tools usually use flex underneath
flex makes it super simple to get started with responsiveness
Jason Luboff
@JLuboff
Aug 22 2018 23:13
:thumbsup:
What if I don't want it to be responsive because who needs that? ;)
doesn't have to be just for responsiveness, great for centering grouping, etc...
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:16
cs50 is good, just very demanding @pdurbin
Brad
@bradtaniguchi
Aug 22 2018 23:16
haha yes
Jason Luboff
@JLuboff
Aug 22 2018 23:17
@cmccormack Great! Exactly what I need. Hopefully won't take me too long to pickup on
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:17
why not use boostrap to do your thing instead of learning css/flex/grid @JLuboff
did you take cs50? @pdurbin
Jason Luboff
@JLuboff
Aug 22 2018 23:18
@ke1echi It's for my companies intranet page, would rather limit the number of CDN's I need to use
Plus, good learning experience
Christopher McCormack
@cmccormack
Aug 22 2018 23:18
I dropped frameworks when doing the new FCC content, was a great learning experience
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:19
true... always good learning experience @JLuboff
i think i should try my hands on the new fcc @cmccormack
Christopher McCormack
@cmccormack
Aug 22 2018 23:20
@ke1echi yeah, some are kind of simple but the test cases make them much more difficult! :D
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:21
wow
finished the curriculum? @cmccormack
Christopher McCormack
@cmccormack
Aug 22 2018 23:22
no on the Information Security And Quality Assurance Certification now
keep wanting to work on it more but work has been hellish recently
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:22
wow..almost done @cmccormack
Christopher McCormack
@cmccormack
Aug 22 2018 23:23
yeah, want to do the legacy full stack projects too just for more practice, those were pretty neat
Philip Durbin
@pdurbin
Aug 22 2018 23:23
@ke1echi no, I didn't take cs50. Just cs75 (building dynamic websites). In person because I work at Harvard and it was only $40 to take the class through the extension school. This was several years ago.
Christopher McCormack
@cmccormack
Aug 22 2018 23:23
then I'll almost be caught up with @JLuboff !
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:25
wow... any plans on taking it? @pdurbin
Jason Luboff
@JLuboff
Aug 22 2018 23:27
@cmccormack Eh I think you have me beat don't you?
Or you will then
I don't have the data viz cert
Christopher McCormack
@cmccormack
Aug 22 2018 23:27
@JLuboff ohh then maybe we're tied now... ish
I know each fullstack app is worth at least two other projects though
Kelechi Chinaka
@ke1echi
Aug 22 2018 23:28
u skipped data viz @JLuboff
do u have data viz cert? @cmccormack
Jason Luboff
@JLuboff
Aug 22 2018 23:28
Ya...I was more interested in backend and it paid off
Christopher McCormack
@cmccormack
Aug 22 2018 23:29
Yeah finished data viz
legacy anyway - I did the new projects as well but need to finish the user story tests for some of the old ones
just for fun
Philip Durbin
@pdurbin
Aug 22 2018 23:30
no plans to take cs50 but I'm sure it would be good for me
Christopher McCormack
@cmccormack
Aug 22 2018 23:48
:wave: see ya
Jason Luboff
@JLuboff
Aug 22 2018 23:49
Adios amigo