These are chat archives for FreeCodeCamp/Help

26th
Jul 2018
theclayster
@theclayster
Jul 26 2018 00:47
anyone online?
snowgoggles
@snowgoggles
Jul 26 2018 00:53
it depends
theclayster
@theclayster
Jul 26 2018 00:54
on 0.o
i need some help
snowgoggles
@snowgoggles
Jul 26 2018 00:54
shoot
theclayster
@theclayster
Jul 26 2018 00:55
im trying to view the css that ive put on my new file, but every time i refresh the page nothing shows up, just my html
i have the css in my index file as well thats why im confused
snowgoggles
@snowgoggles
Jul 26 2018 00:56
well you should'nt have both normally. comment out the local style section
theclayster
@theclayster
Jul 26 2018 00:57
<link rel="stylesheet" href="normalize.css">
snowgoggles
@snowgoggles
Jul 26 2018 00:58
and that css file is at the same folder level as your html file i presume?
theclayster
@theclayster
Jul 26 2018 00:59
incorect lol
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:00
@snowgoggles That completely depends. I use stylesheets when they're used across multiple files. But it's perfectly fine to also have style tags for stuff that only applies to that specific file.
Kyle Holm
@thekholm80
Jul 26 2018 01:01
@bjorno43 :wave:
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:01
@thekholm80 Heya m8 :wave:
snowgoggles
@snowgoggles
Jul 26 2018 01:02
@theclayster the css file is working from what i tested
theclayster
@theclayster
Jul 26 2018 01:02
i just cant figure out why its not displaying in my browser
there has to be something wrong
snowgoggles
@snowgoggles
Jul 26 2018 01:03
what's the url ?
theclayster
@theclayster
Jul 26 2018 01:04
i have no url its linked through my documents
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:04
@thekholm80 In the news here: Some Ethiopean prophet digged up a dead guy with family's permission promissing to raise him from the dead. To everyone's surprise he failed..
Kyle Holm
@thekholm80
Jul 26 2018 01:05
i saw something about that
just a headline
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:05
:joy:
Kyle Holm
@thekholm80
Jul 26 2018 01:05
crazy
snowgoggles
@snowgoggles
Jul 26 2018 01:05
@theclayster so your local copy doesn't work?
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:05
I don't know what's worse. The fact that he thought he could or that the family actually believed him.. :joy:
theclayster
@theclayster
Jul 26 2018 01:05
exactly
@snowgoggles
Kyle Holm
@thekholm80
Jul 26 2018 01:06
@bjorno43 every time i hear a story like this I think "surely this is the bottom, and we'll never get anything dumber than this." then i read the news the next day ...
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:07
@thekholm80 Exactly, lol
snowgoggles
@snowgoggles
Jul 26 2018 01:07
is the same code used as your codepen, then my guess its a path reference issue
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:08
@theclayster Are you running a local webserver?
theclayster
@theclayster
Jul 26 2018 01:08
its the same code i have in my codepen @snowgoggles
& yes @bjorno43
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:10
@theclayster Alright, right click the page and View Source. Then click the link towards the CSS file. See if it actually shows up or gives you a 404 not found error
snowgoggles
@snowgoggles
Jul 26 2018 01:10
@theclayster check the path where your css file is located
theclayster
@theclayster
Jul 26 2018 01:11
it showed me all the html on the page
@snowgoggles @bjorno43
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:12
@theclayster Ye that much is clear. I'm asking you to click the url inside the html source. Like <link rel="stylesheet" href="normalize.css"> <-- click normalize.css
theclayster
@theclayster
Jul 26 2018 01:12
oooh
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:13
Not sure if that works in every browser though..
theclayster
@theclayster
Jul 26 2018 01:13
says its not found
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:14
There you go. You have a path error
theclayster
@theclayster
Jul 26 2018 01:14
could you help please
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:14
I assume you have index.html right?
theclayster
@theclayster
Jul 26 2018 01:14
yes
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:15
Alright. Where is the normalize.css located from that point on. Like in which folder(s)?
theclayster
@theclayster
Jul 26 2018 01:16
its inside of my index.html folder @bjorno43
under img
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:17
@theclayster So change <link rel="stylesheet" href="normalize.css"> to <link rel="stylesheet" href="img/normalize.css">
theclayster
@theclayster
Jul 26 2018 01:18
changed, but i tried refreshing and still no css
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:18
Can you make a screenshot of your folder structure?
theclayster
@theclayster
Jul 26 2018 01:18
ok
how do i post it in here?
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:19
Just copy paste like anything. Press screen shot and do Ctrl+v here
theclayster
@theclayster
Jul 26 2018 01:20
Screen Shot 2018-07-25 at 9.19.11 PM
damn lol
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:20
lol. Just copy the image with ctrl+c and press ctrl+v here
theclayster
@theclayster
Jul 26 2018 01:21
image.png
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:21
Ahhh, now we are getting somehwere
Where is websitetemplate.html saved?
theclayster
@theclayster
Jul 26 2018 01:24
give me a sec have to look
i just moved it over to the index @bjorno43
& that didnt work at all
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:27
The problem is that you don't actually have a index.html file. You have a index.html folder. The actual html file (websitetemplate.html) is located somehwere else and it cannot find index.html/img/normalize.css. You can need to give the href attribute in here <link rel="stylesheet" href="normalize.css"> the correct path from where websitetemplate.html is towards index.html/img/normalize.css
theclayster
@theclayster
Jul 26 2018 01:28
so change the name from websitetemplate.html to index.html?
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:28
No that won't work
theclayster
@theclayster
Jul 26 2018 01:29
:/
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:29
God this is nearly impossible to explain like this..
theclayster
@theclayster
Jul 26 2018 01:29
my bad bro
Kyle Holm
@thekholm80
Jul 26 2018 01:30
it's not you, it's just hard to explain some things in a chat room
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:30
Let's say for example that websitetemplate.html is located here: C:\websitetemplate.html ok?
Just an example!
theclayster
@theclayster
Jul 26 2018 01:30
ok
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:31
And let's assume that your project is here: C:\var\www\index.html\...
theclayster
@theclayster
Jul 26 2018 01:31
ok
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:32
In order to make it work, you have to change <link rel="stylesheet" href="normalize.css"> to <link rel="stylesheet" href="var/www/index.html/img/normalize.css">
theclayster
@theclayster
Jul 26 2018 01:33
so basically your saying i have to play hide and seek and find where the file is located?
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:33
So you don't need to relocate websitetemplate.html and you don't need to change the name either. You need to change this line <link rel="stylesheet" href="normalize.css"> and tell it where to find normalise.css on your hard drive
snowgoggles
@snowgoggles
Jul 26 2018 01:34
@bjorno43 you're brave....kudos to you sir!
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:35
@snowgoggles Just part of my job here :joy:
theclayster
@theclayster
Jul 26 2018 01:36
do i have to type the var/www/?
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:36
No. That was just an example as I said
theclayster
@theclayster
Jul 26 2018 01:36
oh ok
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:36
You need to find the correct folders yourself. I can't look into your hard drive so I don't know them
theclayster
@theclayster
Jul 26 2018 01:37
ok
snowgoggles
@snowgoggles
Jul 26 2018 01:39
@bjorno43 I see 2 img folders in that screenshot
theclayster
@theclayster
Jul 26 2018 01:39
there is two
it wont let me delete one of them
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:40
@snowgoggles Ye so did I. But the css file is located in index.html/img/ so it shouldn't matter. Just bad folder structure but it won't do any harm
theclayster
@theclayster
Jul 26 2018 01:41
image.png
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:41
Honestly I don't know which IDE that is but I'd trash any IDE that makes a index.html folder for me.. :joy:
Karma Drukpa
@coderkarma
Jul 26 2018 01:42
thats atom
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:42
Ahhhh now that helps!
Karma Drukpa
@coderkarma
Jul 26 2018 01:42
@bjorno43
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:43
Alright, try changing <link rel="stylesheet" href="normalize.css"> to <link rel="stylesheet" href="../img/normalize.css"> @theclayster
Karma Drukpa
@coderkarma
Jul 26 2018 01:43
this is very simple question of codewars but my test is not passing wth
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:44
@coderkarma Heard of it. Never used it. Not regretting it either after seeing this, lol
theclayster
@theclayster
Jul 26 2018 01:44
this shit is driving me crazy right now
lol
snowgoggles
@snowgoggles
Jul 26 2018 01:45
blame atom
Karma Drukpa
@coderkarma
Jul 26 2018 01:45
@theclayster what is wrong ?
Kyle Holm
@thekholm80
Jul 26 2018 01:46
i like atom
theclayster
@theclayster
Jul 26 2018 01:46
i cant view my css when i refresh my browser but im able to view the html
Karma Drukpa
@coderkarma
Jul 26 2018 01:46
function fakeBin(x){
let zero = 0;
let ones = 0;
// convert the string digit to a number
//let newNum = Number(x);
// split the string to array 
  let newArr = x.split('');
// loop through array of nums
   for (let i = 0; i < newArr.length; i += 1){
     let num = newArr[i];
         if (num <= 5){
          zero = 1;
// check if the ele of arr  0-5 if yes then 0
// if no then 1
   }   else   {
      ones = 1;
    }
  }
  return newArr.join('');
}
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:46
@theclayster Look at that screenshot. It tells you that websitetemplate.html is located in index.html/css/websitetemplate.html. So now you have to set the correct path. Which is up one folder and then towards /img/ So the correct code should be: <link rel="stylesheet" href="../img/normalize.css">
Karma Drukpa
@coderkarma
Jul 26 2018 01:47
@thekholm80 my test is giving me different output @thekholm80
snowgoggles
@snowgoggles
Jul 26 2018 01:47
@theclayster um view css file in browser ?
Kyle Holm
@thekholm80
Jul 26 2018 01:47
i like that you're commenting your thought process now
theclayster
@theclayster
Jul 26 2018 01:47
bro i typed that in and its still not displaying anything idk whats wront @bjorno43
Karma Drukpa
@coderkarma
Jul 26 2018 01:48
@thekholm80 i am trying kyle
Kyle Holm
@thekholm80
Jul 26 2018 01:48
this is how you get better
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:48
If only he didn't use Mac.. I'd be TeamViewing the hell out of that one by now!
theclayster
@theclayster
Jul 26 2018 01:48
like ill screenshot how i wrote it on the editor i wrote it exactly how you did and still nothing
snowgoggles
@snowgoggles
Jul 26 2018 01:49
there is teamviewer for mac
theclayster
@theclayster
Jul 26 2018 01:49
yes
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:49
Ye I know. But it works very bad from Windows -> Mac
theclayster
@theclayster
Jul 26 2018 01:49
^
glitz20
@glitz20
Jul 26 2018 01:50
hey guys can anyone help me with authnetication in mern using passport
snowgoggles
@snowgoggles
Jul 26 2018 01:50
i remote from linux to mac regularly
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:51
Ye but the issue is that if I give a hotkey from Windows, his Mac be like: Dude, the hell you trying to do?! :joy:
Kyle Holm
@thekholm80
Jul 26 2018 01:51

@coderkarma you have if (num <= 5){ but the instructions say:

any digit 5 and above with '1'.

snowgoggles
@snowgoggles
Jul 26 2018 01:51
true
glitz20
@glitz20
Jul 26 2018 01:52
My sign up works fine, but login doesnot
Kyle Holm
@thekholm80
Jul 26 2018 01:53
@sabin20 which strategy are you using?
glitz20
@glitz20
Jul 26 2018 01:53
_login(username, password) {
        axios.post('http://localhost:4200/auth/login', {
            username,
            password
        })
            .then(response => {
                console.log(response)
                if (response.status === 200) {
                    this.setState({
                        loggedIn: true,
                        user:response.data.user
                    })
                }
            })
    }

  render() {
    return (
        <div className="App">
            <div className="Appheader">
                <Header user={this.state.user} />
                <DisplayLinks _logout={this._logout} loggedIn={this.state.loggedIn} />
                <Route exact path="/" render={() => <Home user={this.state.user} />} />
                <Route exact path="/login" render={() => <LoginForm
                    _login={this._login}
                    _googleSignin={this._googleSignin}
                />}
                />
                <Route exact path="/signup" component={SignupForm} />
                {/*<Route path='/add-item' component={AddItem} />
                <Route path='/edit/:id' component={EditItem} />*/}
            </div>

            <div>
                <h2>Welcome to React</h2>
                <Link to={"/add-item"} className="btn btn-primary">Add New</Link>

                <IndexItem />
            </div>


            {/*<div>
            {this.props.children}
          </div>*/}

        </div>
this is my app.js
class LoginForm extends Component {
    constructor() {
        super()
        this.state = {
            username: "",
            password: "",
            redirectTo: null
        }

        this.handleSubmit = this.handleSubmit.bind(this)
        this.handleChange = this.handleChange.bind(this)

    }

    handleChange(event) {
        this.setState({
            [event.target.name]: event.target.value
        })
    }

    handleSubmit(event) {
        event.preventDefault()
        console.log('handleSubmit')
        this.props._login(this.state.username, this.state.password)
        this.setState({
            redirectTo: '/'
        })
    }

    render() {
        if (this.state.redirectTo) {
            return <Redirect to={{ pathname: this.state.redirectTo }} />
        }

        else
        {
            return (
                <div className="LoginForm">
                    <h1>Login Form </h1>
                    <form>
                        <label htmlFor="username">Username: </label>
                        <input
                            type="text"
                            name="username"
                            value={this.state.username}
                            onChange={this.handleChange}
                        />
                        <label htmlFor="password">Password: </label>
                        <input
                            type="password"
                            name="password"
                            value={this.state.password}
                            onChange={this.handleChange}
                        />
                        <button onClick={this.handleSubmit}>Login</button>
                    </form>
                    <a href="http://localhost:4200/auth/google">
                        <img src={googleButton} alt="sign into google account" />
                    </a>
                </div>
                )
        }
    }
}

export default LoginForm
and this is login form
Kyle Holm
@thekholm80
Jul 26 2018 01:53
no no no
put it on github or something lol don't flood us
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:54
@sabin20 Wooha, please use Pastebin or something? It's against our CoC to paste large walls of code due to spam
glitz20
@glitz20
Jul 26 2018 01:55
oh ok @bjorno43 @thekholm80
Karma Drukpa
@coderkarma
Jul 26 2018 01:55
@thekholm80 yes i am supposed to initilalized 0 , but forgot
if ( num <= 5 || 0){
zero = 0;
@thekholm80 , i tried doing this as well. if our num is less then or === 5 or 0, we have to replace 0 on that.
Kyle Holm
@thekholm80
Jul 26 2018 01:57
all i'm saying is your logic doesn't match the instructions. it says "any digit 5 and above" but you've got 5 and below
Bjorn van de Peut
@bjorno43
Jul 26 2018 01:58
@theclayster Anyway, I think I've done all I could from here m8. Sorry I can't be of any more help than this :( At least you know what's going on now. Perhaps you know someone in your neighberhood that can have a look at it.
theclayster
@theclayster
Jul 26 2018 01:59
thank your for your help! @bjorno43
Kyle Holm
@thekholm80
Jul 26 2018 02:00
oh, someone did it with regex - that's pretty clever
glitz20
@glitz20
Jul 26 2018 02:00
@bjorno43 @thekholm80 here is the link to pastebin
https://pastebin.com/wBiXd71T
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:03
@sabin20 I can't help you with that one m8. I know absolutely nothing about React to be honest
Kyle Holm
@thekholm80
Jul 26 2018 02:04
which passport strategy are you using?
passport local, i assume?
glitz20
@glitz20
Jul 26 2018 02:04
yeah @thekholm80
Kyle Holm
@thekholm80
Jul 26 2018 02:04
can you share that code?
the only reason i ask is i've only ever seen the success redirect happen on the back end, through passport
i'm not saying what you're doing is wrong, but i've not seen it done this way
glitz20
@glitz20
Jul 26 2018 02:06
@thekholm80 here is the link https://pastebin.com/UKtEbeWB
Kyle Holm
@thekholm80
Jul 26 2018 02:06
and your login route handler?
if it's small you can paste it here
glitz20
@glitz20
Jul 26 2018 02:07
I am getting 401 error
POST http://localhost:4200/auth/login 401
Kyle Holm
@thekholm80
Jul 26 2018 02:08
i assume you're using express? can i see your app.post('/auth/login', ...)?
glitz20
@glitz20
Jul 26 2018 02:08
route handler
<Route exact path="/login" render={() => <LoginForm
                    _login={this._login}
                    _googleSignin={this._googleSignin}
                />}
                />
Kyle Holm
@thekholm80
Jul 26 2018 02:08
not in the front, in the back
your server
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:08
As a general rule of thumb: Anything smaller than ~40 lines of code is perfectly fine to paste here
thekholm80 @thekholm80 furiously counts all his code lines
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:09
:joy:
Kyle Holm
@thekholm80
Jul 26 2018 02:09
now i kind of wish i didn't write all my code in notepad
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:09
If you need to count, you seriously need to reconsider the IDE you're using :P
Whahaha
Kyle Holm
@thekholm80
Jul 26 2018 02:10
err mousepad, because linux
glitz20
@glitz20
Jul 26 2018 02:10
@thekholm80 for auth https://pastebin.com/A3RyWp4t
Kyle Holm
@thekholm80
Jul 26 2018 02:11
@sabin20 is your server console showing your log statements?
when you try to login, i mean
    '/login',
    function (req, res, next) {
        console.log(req.body)
        console.log("==========")
        next()
    },
this bit
Karma Drukpa
@coderkarma
Jul 26 2018 02:12
function fakeBin(x){
  let zero = null;
  let ones = null;
// split the string to array 
  let newArr = x.split('');
// loop through array of nums
   for (let i = 0; i < newArr.length; i += 1){
     let num = newArr[i];
        if ( num < 5 || num === 0){
          zero = 0;
    // check if the ele of arr  0-5 if yes then 0
    // if no then 1
   } else{
      ones = 1;
    }
  }
  return newArr.join('');
}
fakeBin('45385593107843568');
    //   01011110001100111
this should pass the test @thekholm80 shouldn't it?
Kyle Holm
@thekholm80
Jul 26 2018 02:13
@coderkarma not quite. you've got the right idea, but all your loops are doing is assigning the value 1 to the variable ones and 0 to the variable zeros
you should either push those to an array or build a string through concatenation
you should use console.log() to see what happens when your code runs
it's invaluable
oh sweet, Ready Player One is out on video now
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:16
I've seen that one. It's a good movie
Kyle Holm
@thekholm80
Jul 26 2018 02:16
i loved it
i've been trying to get the book from my library but there's such a long wait list
and i'm not smart enough to add myself to the wait list
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:17
:joy:
glitz20
@glitz20
Jul 26 2018 02:19
@thekholm80 no it isn't
Kyle Holm
@thekholm80
Jul 26 2018 02:20
can you remove the /auth from axios.post('http://localhost:4200/auth/login', {? i don't see that in your server route handler
unless i'm just missing something
glitz20
@glitz20
Jul 26 2018 02:21
@thekholm80 I have this in app.js in express
app.use('/auth', require('./src/auth'))
Kyle Holm
@thekholm80
Jul 26 2018 02:21
ah, got it
glitz20
@glitz20
Jul 26 2018 02:22
Kyle Holm
@thekholm80
Jul 26 2018 02:22
i see
glitz20
@glitz20
Jul 26 2018 02:22
this is from loginform
handleSubmit(event) {
        event.preventDefault()
        console.log('handleSubmit')
        this.props._login(this.state.username, this.state.password)
        this.setState({
            redirectTo: '/'
        })
    }
i see 'handle submit' in console
Kyle Holm
@thekholm80
Jul 26 2018 02:23
well, i think we're beyond my debugging abilities. you might have better luck in the back end room
glitz20
@glitz20
Jul 26 2018 02:23
and then it shows the error
I am getting 401 error
is that problem with client side?
Kyle Holm
@thekholm80
Jul 26 2018 02:24
i couldn't say
glitz20
@glitz20
Jul 26 2018 02:24

it shows this error

POST http://localhost:4200/auth/login 401 (Unauthorized)

Bjorn van de Peut
@bjorno43
Jul 26 2018 02:25
That moment your housekeeper comes crying because she accidently dropped a cleaning cloth into your toilet.. (mind I've got like an arsenal of 20 of the damn things in the closet)
Kyle Holm
@thekholm80
Jul 26 2018 02:25
did you fire her?
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:26
Ye kicked her straight out the door :joy:
Kyle Holm
@thekholm80
Jul 26 2018 02:26
i'd take the value of the cloth out of her pay
that'll teach her
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:26
Whahaha
Kyle Holm
@thekholm80
Jul 26 2018 02:27
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:27
wtf?? :joy:
brb, gonna take a quick shower. Burning hot like hell here the past few weeks.. ugh
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:36
there we go
Karma Drukpa
@coderkarma
Jul 26 2018 02:37
@thekholm80 yeah i figure it out it was just assigning 0s and 1s
Kyle Holm
@thekholm80
Jul 26 2018 02:37
@coderkarma did you get it to pass?
Karma Drukpa
@coderkarma
Jul 26 2018 02:37
my brain didn't thought of concatenating
yes
thanks man
Kyle Holm
@thekholm80
Jul 26 2018 02:37
:tada:
Truth spoken
Kyle Holm
@thekholm80
Jul 26 2018 02:38
const fakeBin = x => x.split('').map(y => y < 5 ? 0 : 1).join('');
Karma Drukpa
@coderkarma
Jul 26 2018 02:38
hahhaa
one liner
killing me
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:38
@thekholm80 You just had to do it didn't ya?
Kyle Holm
@thekholm80
Jul 26 2018 02:39
the guy that used regex wins though
Karma Drukpa
@coderkarma
Jul 26 2018 02:39
i thought of using regax
like x.replace
Kyle Holm
@thekholm80
Jul 26 2018 02:40
const fakeBin = x => x.replace(/\d/g, y => y < 5 ? 0 : 1); i think it was
Karma Drukpa
@coderkarma
Jul 26 2018 02:40
but wasnot confident enough
Kyle Holm
@thekholm80
Jul 26 2018 02:40
i just never think to use regex
Karma Drukpa
@coderkarma
Jul 26 2018 02:40
can we not use ternary operator there?
Kyle Holm
@thekholm80
Jul 26 2018 02:40
because i hate it
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:40
I had an annoying problem earlier in PHP. Trying to access an out of scope variable from within a callback function. Damn that was a bitch
Kyle Holm
@thekholm80
Jul 26 2018 02:40
what do you mean?
@bjorno43 i just learned that in python
Karma Drukpa
@coderkarma
Jul 26 2018 02:41
can it be done without ternary in regax.?
Kyle Holm
@thekholm80
Jul 26 2018 02:41
kind of odd, someone said they have 'half closures'
@coderkarma yes
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:42
@thekholm80 I solved it by using an anonymous callback function instead with use
Kyle Holm
@thekholm80
Jul 26 2018 02:43
const fakeBin = x => x.replace(/\d/g, y => {
  if (y < 5) {
    return 0;
  } else {
    return 1;
  }
});
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:43
Only other solution was to actually create a class for it which was just overkill for what I wanted
Moisés Man
@moigithub
Jul 26 2018 02:43
~~false
0
~~true
1
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:44
Also had a fun challenge a few days ago: Detect and block VPN users worldwide
Karma Drukpa
@coderkarma
Jul 26 2018 02:44
return x.replace(/[1234]/g, '0').replace(/[56789]/g, '1')
got that answer, it looks very simple with hmm........
Kyle Holm
@thekholm80
Jul 26 2018 02:44
that would work too
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:45
Said that was impossible. But managed to block 99% of em anyway
Kyle Holm
@thekholm80
Jul 26 2018 02:45
oh nice
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:45
Simply blocked every foreign ip address :joy:
Kyle Holm
@thekholm80
Jul 26 2018 02:45
well ...
i was going to say "can you teach reddit how to do that" but your solution wouldn't work
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:46
Nah :P
korzo
@korzo
Jul 26 2018 02:46
@bjorno43 There is always and option to use global :)
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:47
@korzo You want me to come smack your ass or are you going to do it yourself? :joy:
If global is the answer, you're not looking good enough :P
Besides, global would only work if the actual code would be within global scope. If it's not, it'll be pointless to try
Kyle Holm
@thekholm80
Jul 26 2018 02:49
i wish i had learned about globals a little earlier in life
Moisés Man
@moigithub
Jul 26 2018 02:50
const fakeBin = x => x.replace(/\d/g,d=>~~(d>4))
Kyle Holm
@thekholm80
Jul 26 2018 02:50
i wrote something in vb in my last job that i had to pass off to a real dev when i changed positions. i'm pretty sure i could hear her cussing me every day all the way on the other side of the country
korzo
@korzo
Jul 26 2018 02:51
@bjorno43 :D
You can define dummy global and then set it from the function/method :P
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:51
@thekholm80 Whahaha :joy:
@korzo I'd probably just create a scope of my own and use that if I really had no other solution at hand than global :P
Kyle Holm
@thekholm80
Jul 26 2018 02:52
or you could give up on PHP and do something good with your life
like fostering cats
korzo
@korzo
Jul 26 2018 02:53
@bjorno43 I already forget about global, but last week I got to refactor codebase from 2013, where every function starts with block of globals.
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:53
@korzo Scary. Still got nightmares? :P
@thekholm80 Screw you :P
Kyle Holm
@thekholm80
Jul 26 2018 02:53
i don't have to take that kind of abuse
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:54
Hahaha :joy:
Kyle Holm
@thekholm80
Jul 26 2018 02:54
i demand to speak with your manager
Lance
@texas2010
Jul 26 2018 02:54
O_o
Kyle Holm
@thekholm80
Jul 26 2018 02:54
@texas2010 ban bob
please
Lance
@texas2010
Jul 26 2018 02:55
what did he do? O_o
Kyle Holm
@thekholm80
Jul 26 2018 02:55
but only for a minute, cause he's an okay guy most of the time
he stood up for himself when i was bullying him about using php
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:56
:joy:
Lance
@texas2010
Jul 26 2018 02:56
oh well i like php. i didnt get into deep yet.
Kyle Holm
@thekholm80
Jul 26 2018 02:57
and so we lose another to the dark side
Lance
@texas2010
Jul 26 2018 02:57
they didnt make me do it. i make me do that.
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:57
That would be a good one. Banned Bjorno43. Reason: Using a language that I don't like :joy:
Lance
@texas2010
Jul 26 2018 02:57
it was me. lol
Bjorn van de Peut
@bjorno43
Jul 26 2018 02:58
Ghehe welcome to the dark side @texas2010
We have cookies!
Just gonna need your permission before the GDPR comes kicking down my door..
Lance
@texas2010
Jul 26 2018 03:01
LOL
mstellaluna
@mstellaluna
Jul 26 2018 03:01
@thekholm80 u need me to ban both of them for PHP? :imp:
Lance
@texas2010
Jul 26 2018 03:01
@bjorno43 I think @thekholm80 will be happy about they going to swat your house
Kyle Holm
@thekholm80
Jul 26 2018 03:01
@mstellaluna better do it twice each, so we're sure it sticks
mstellaluna
@mstellaluna
Jul 26 2018 03:01
@thekholm80 okie dokie
Kyle Holm
@thekholm80
Jul 26 2018 03:01
can't have that disease spreading
mstellaluna
@mstellaluna
Jul 26 2018 03:02
I fell to the java dark side so im safe :)
Lance
@texas2010
Jul 26 2018 03:02
okay....
mstellaluna
@mstellaluna
Jul 26 2018 03:02
i saw that
lol
Bjorn van de Peut
@bjorno43
Jul 26 2018 03:02
:joy:
Lance
@texas2010
Jul 26 2018 03:02
@mstellaluna i will tell you why i delete it
mstellaluna
@mstellaluna
Jul 26 2018 03:02
its okay im kidding
i have to get back to what i was doing anyway
:)
i just dropped in to provide @thekholm80 some back up
Bjorn van de Peut
@bjorno43
Jul 26 2018 03:03
Whahaha :joy:
Kyle Holm
@thekholm80
Jul 26 2018 03:03
@mstellaluna you have always been my favorite mod
Lance
@texas2010
Jul 26 2018 03:04
hey......
just wait. i will get into php oop someday lol
Kyle Holm
@thekholm80
Jul 26 2018 03:05
image.png
Bjorn van de Peut
@bjorno43
Jul 26 2018 03:05
omg.. :joy:
Lance
@texas2010
Jul 26 2018 03:05
oh gosh.. :joy: :joy: :joy: :joy:
okay i am going to keep that one. it is good meme lol
Kyle Holm
@thekholm80
Jul 26 2018 03:07
my MS Paint skills are a little rusty lol
mstellaluna
@mstellaluna
Jul 26 2018 03:08
@thekholm80 :beer:
mstellaluna
@mstellaluna
Jul 26 2018 03:11
^ hahahha
Kyle Holm
@thekholm80
Jul 26 2018 03:12
poor zukbot, looks like he needs a reboot
Kyle Holm
@thekholm80
Jul 26 2018 03:15
i saw that this morning. i'd love to know the reason this gif actually exists
never in my life has someone filmed me from 2 angles eating toast
Claudio Restifo
@Marmiz
Jul 26 2018 03:17

eating

that's debatable. Do you consider that eating a toast?

"Hi I'm Mark, and welcome to Jackass"
Kyle Holm
@thekholm80
Jul 26 2018 03:21
korzo
@korzo
Jul 26 2018 03:22
This gif is first result in Google for robot eating toast
Kyle Holm
@thekholm80
Jul 26 2018 03:22
lol
Anand Potukuchi
@anandpotukchi
Jul 26 2018 05:39
hi
is thid convention correct
MONGO_URI='mongodb://admin:password@ds018538.mlab.com:18538/test_db'
hello
anyone online?
Anand Potukuchi
@anandpotukchi
Jul 26 2018 06:08
is process.env privat
like .env
Manish Giri
@Manish-Giri
Jul 26 2018 06:53
@Marmiz there?
Claudio Restifo
@Marmiz
Jul 26 2018 08:15
@Manish-Giri yep :)
Anand Potukuchi
@anandpotukchi
Jul 26 2018 08:21
anyoen who knows how to connect mongo to express app?
on glitch
Claudio Restifo
@Marmiz
Jul 26 2018 08:25
mongo.connect() ? Should work regardless of the node framework
May Kittens Devour Your Soul
@diomed
Jul 26 2018 08:26
@faraco hello, :cat:
Momozor
@momozor
Jul 26 2018 08:30
@diomed :cat2: :cat2:
:wave:
May Kittens Devour Your Soul
@diomed
Jul 26 2018 08:33
Neko 4EVER :smirk_cat:
Manish Giri
@Manish-Giri
Jul 26 2018 08:41
@diomed :wave: :cat:
Kelechi Chinaka
@ke1echi
Jul 26 2018 08:42
:wave: @Manish-Giri good to see u still around
Manish Giri
@Manish-Giri
Jul 26 2018 08:43
@Marmiz found an interesting problem on codewars, it's based on the concept of a queue..
@kelechy hey buddy.. how's it going
you changed your picture I think
Kelechi Chinaka
@ke1echi
Jul 26 2018 08:44
@Manish-Giri yea
what are you working on now @Manish-Giri
Manish Giri
@Manish-Giri
Jul 26 2018 08:45
@kelechy practicing some coding problems for interview atm..it's an ass kicking..
other than that, learning Node & Spring
what about you
Kelechi Chinaka
@ke1echi
Jul 26 2018 08:46
cool
taking cs50 atm @Manish-Giri
Manish Giri
@Manish-Giri
Jul 26 2018 08:46
oh man i've still not completed the scratch assignment
which pset are you on
Kelechi Chinaka
@ke1echi
Jul 26 2018 08:47
@Manish-Giri pset3
Manish Giri
@Manish-Giri
Jul 26 2018 08:47
cool
i'll get back on cs50 soon
Kelechi Chinaka
@ke1echi
Jul 26 2018 08:51
:ok:
May Kittens Devour Your Soul
@diomed
Jul 26 2018 09:16
hello @Manish-Giri :cat:
Anand Potukuchi
@anandpotukchi
Jul 26 2018 09:19
do you think it's useful? @Manish-Giri
@Marmiz isn;l working
Anand Potukuchi
@anandpotukchi
Jul 26 2018 09:24
Bjorn van de Peut
@bjorno43
Jul 26 2018 09:34
@faraco That is definitely NOT an alternative to Github. Looks more like a phishing website. It's also registered with GoDaddy and Github doesn't hire their servers there. I will remove that message from you as it might potentially harm other users here
May Kittens Devour Your Soul
@diomed
Jul 26 2018 09:37
I hate when I build a replica of github and they call it phishing site. fml
Claudio Restifo
@Marmiz
Jul 26 2018 09:37
@Manish-Giri my first instinct is "brute force it". write a loop that goes over each element and decrease.
I'm pretty sure you can do it with just plain math tho
@Manish-Giri I mean, can't you just count how many you want * 60 plus how many the guys wants before you * 60?
yaseenmd
@yaseenmd
Jul 26 2018 09:39
AndroidDriver] Error: Cannot get screenshot data because of 'Unable to get file size for '/data/local/tmp/screenshot.png': Unable to parse size from list output: '-rw-rw-r-- 1 root root 18172 Jul 26 13:12 /data/local/tmp/screenshot.png''. Make sure the 'LayoutParams.FLAG_SECURE' is not set for the current view
I am getting the above error. Actually screenshot is taken. but UIdump is not created
Claudio Restifo
@Marmiz
Jul 26 2018 09:40

@Manish-Giri so as in the example:

 [2, 5, 3, 4, 6]

` 3 + 7 + 2 (the position I'm at in queue) == 12

no it doesn't work like that. I'm dumb
you have to account also for the arr.lenght
Manish Giri
@Manish-Giri
Jul 26 2018 09:58
@Marmiz I was studying DS at the time, so I wrote a Queue class (more like a Circular Queue) to solve it..and I used a loop to shift things around..
But of course some of the submitted solutions used just plain math to solve it.. lol
Well I never really liked math anyway, so meh
Amit Patel
@AmitP88
Jul 26 2018 10:00
hey guys, I know this is sort of unrelated to coding help specifically, but I was wondering, have any of you done freelancing projects on www.upwork.com? I was thinking about doing that after completing FCC Certs to get more real world experience
Claudio Restifo
@Marmiz
Jul 26 2018 10:06
@Manish-Giri my first attempt would have been a circular Q as well...
just because the other is math >.<
May Kittens Devour Your Soul
@diomed
Jul 26 2018 10:11
go to sleep @Manish-Giri :yum:
May Kittens Devour Your Soul
@diomed
Jul 26 2018 10:18
SeaSea
_φ( °-°)/
Anand Potukuchi
@anandpotukchi
Jul 26 2018 11:20
wee waah.. nobdy help me
i angry
Anand Potukuchi
@anandpotukchi
Jul 26 2018 12:20
what's scratch?
@Manish-Giri
Amit Patel
@AmitP88
Jul 26 2018 12:22
hey guys, if we completed a project for one of the old certs, do we need to complete it again for the new cert? I noticed two of my previous projects from the old cert are checked off from the new Front End Libraries cert
checked.png
Anand Potukuchi
@anandpotukchi
Jul 26 2018 12:26
@AmitP88 nope, you don;t need to do them again
Amit Patel
@AmitP88
Jul 26 2018 12:27
@anandpotukchi so I can still get the cert? I've finished the ones I didn't do before, I just need to deploy them live
Anand Potukuchi
@anandpotukchi
Jul 26 2018 12:27
yup. you will
Don't do them again
If you have done the project and not saved it, paste the url
Amit Patel
@AmitP88
Jul 26 2018 12:30
ah ok. the only one I redid was the random joke generator, but that was quick lol
I've completed the projects (the ones that I didn't do before) and they're saved on GitHub, but I don't have a live demo of them yet. I tried following the instructions on how to deploy a react project on gh-pages, but it wouldn't work for some reason
Anand Potukuchi
@anandpotukchi
Jul 26 2018 12:37
are you doing CI/CD
check versions
and exec instructions
Fay Vor
@phavor
Jul 26 2018 12:38

How do I create an environment varaiable in js.

PAGE_ACCESS_TOKEN="<PAGE_ACCESS_TOKEN>"

const PAGE_ACCESS_TOKEN = process.env.PAGE_ACCESS_TOKEN;

What is the diff btw these two lines?

Anand Potukuchi
@anandpotukchi
Jul 26 2018 12:38
I'd personally prefer Gitlab w their in-built ci
@phavor what is it for
If it's for a secret, store it in .env
Amit Patel
@AmitP88
Jul 26 2018 12:39
I don't know what you mean by CI/CD. I used create-react-app and once I completed the project, I pushed it to my gh repo
Anand Potukuchi
@anandpotukchi
Jul 26 2018 12:39
if it's public what you did ws right
Anand Potukuchi
@anandpotukchi
Jul 26 2018 12:39
@AmitP88 in korder for reacg to work, you need to start a server right?
Henry
@GitHub-Henry
Jul 26 2018 12:40
no
Anand Potukuchi
@anandpotukchi
Jul 26 2018 12:40
@phavor no quotes
Amit Patel
@AmitP88
Jul 26 2018 12:40
@anandpotukchi to deploy it? or just to create a new project?
Anand Potukuchi
@anandpotukchi
Jul 26 2018 12:40
deploy
Amit Patel
@AmitP88
Jul 26 2018 12:42
I think so
I haven't been able to deploy a react project yet
Anand Potukuchi
@anandpotukchi
Jul 26 2018 12:47
check out how to
search
Iuse gatsby js for many projects
whuch is a react static site gen
I use gitlab CI/CD
Anand Potukuchi
@anandpotukchi
Jul 26 2018 13:03
anyb9ody here worked with mongo
and mongoose
Amit Patel
@AmitP88
Jul 26 2018 13:08
@anandpotukchi is this what you meant? https://www.gatsbyjs.org/tutorial/
Anand Potukuchi
@anandpotukchi
Jul 26 2018 13:08
yup
Amit Patel
@AmitP88
Jul 26 2018 13:13
I'll look more into it, but I don't see how it ties to deploying a react app
alpox
@alpox
Jul 26 2018 14:03
@AmitP88 it does not. Gatsby is a static site generator.
Amit Patel
@AmitP88
Jul 26 2018 14:12
@alpox would fcc accept a link to the github repo of the project instead? or does it have to be a link to a demo of it?
alpox
@alpox
Jul 26 2018 14:17
@AmitP88 Sry, I don't know about that :D but I believe it should be running...
Yago Estévez
@yagoestevez
Jul 26 2018 14:17
FCC will accept anything
As long as it passed the tests, it's alright
Amit Patel
@AmitP88
Jul 26 2018 14:17
@alpox @yagoestevez I see. I'll give it a shot lol
Yago Estévez
@yagoestevez
Jul 26 2018 14:18
It can be ghpages, codepen, etc
alpox
@alpox
Jul 26 2018 14:18
I think the tests cannot pass when you refer to a github repo.
Ofc. ghpages is another thematic
Yago Estévez
@yagoestevez
Jul 26 2018 14:18
Of course, ghpages only. Not the repo
Amit Patel
@AmitP88
Jul 26 2018 14:19
@yagoestevez lol I just used the github repo link
seemed to work
alpox
@alpox
Jul 26 2018 14:19
@AmitP88 Hmm... thats weird :D
Did they run tests on it?
Yago Estévez
@yagoestevez
Jul 26 2018 14:20
Maybe it works, but I don't know later if you will get the certs
Amit Patel
@AmitP88
Jul 26 2018 14:20
@yagoestevez yeah, I'm gonna check that right now
Yago Estévez
@yagoestevez
Jul 26 2018 14:20
You're supposed to have a working example
Amit Patel
@AmitP88
Jul 26 2018 14:20
I was able to claim the certification lol
Yago Estévez
@yagoestevez
Jul 26 2018 14:21
If you don't have it, you could pass Google.com but you're breaking the rules
Amit Patel
@AmitP88
Jul 26 2018 14:21
@yagoestevez yeah, I will work on getting a working demo of it. I just wanted to claim the cert first to get it over with
I still need to polish up my projects too, even though I have all the tests passed
Yago Estévez
@yagoestevez
Jul 26 2018 14:22
I believe you, in advanced node projects you can pass anything and it will pass to the next project
Although it's, again, breaking the rules you accepted
And you won't learn, which for me is way more important
Amit Patel
@AmitP88
Jul 26 2018 14:24
for sure. And I definitely don't want to cheat or anything. I just wanted to get that milestone out of the way, even though I'll be refining the projects and figure out the hosting later
Yago Estévez
@yagoestevez
Jul 26 2018 14:26
Try to use github pages
It's easy, specially with React
Amit Patel
@AmitP88
Jul 26 2018 14:28
that's what I tried to do, following this: https://itnext.io/so-you-want-to-host-your-single-age-react-app-on-github-pages-a826ab01e48 but I was running into errors and apparently I need to host my own server or something, which I'd never done before
Yago Estévez
@yagoestevez
Jul 26 2018 14:29
No you don't
You need to install ghpages package, build your app and deploy it with ghpages
Amit Patel
@AmitP88
Jul 26 2018 14:31
oh I see
ok, that seems simple enough lol
I'll look into it
Yago Estévez
@yagoestevez
Jul 26 2018 14:32
Yep. Good luck with it
Amit Patel
@AmitP88
Jul 26 2018 14:36
thank you :)
Kyle Holm
@thekholm80
Jul 26 2018 15:21
good morning, /help
Nazar
@IsaakNazar
Jul 26 2018 15:24
@AmitP88 also you can deploy your react, node js projects on heroku, just follow the instructions on their off.website.
Kyle Holm
@thekholm80
Jul 26 2018 15:24
i've had good luck hosting react-only apps on firebase
Lance
@texas2010
Jul 26 2018 15:44
@thekholm80 good morning
Kyle Holm
@thekholm80
Jul 26 2018 15:45
@texas2010 :wave:
Momozor
@momozor
Jul 26 2018 15:53
@bjorno43 Thanks for the heads up
Momozor
@momozor
Jul 26 2018 15:58
@IsaakNazar I second that.
Anand Potukuchi
@anandpotukchi
Jul 26 2018 16:16
is it true that mongodb is fadng away
Smootimus
@Smootimus
Jul 26 2018 16:23
The only fading away that's being done is.... me.....
:eyes:
Kyle Holm
@thekholm80
Jul 26 2018 16:24
image.png
if that's fading away, i hope i can create something that fails that much
Kyle Holm
@thekholm80
Jul 26 2018 16:36
@Smootimus have you heard of Garfunkel & Oats?
Smootimus
@Smootimus
Jul 26 2018 16:51
LOL Is that blended?
NOt really, first time hearing this
Kyle Holm
@thekholm80
Jul 26 2018 16:52
they did a song about how you can solve your GF trouble
May Kittens Devour Your Soul
@diomed
Jul 26 2018 17:53
does it involve shooting?
Is it crazy how saying sentences backwards creates backwards sentences saying how crazy it is
Smootimus
@Smootimus
Jul 26 2018 17:57
Oh ahaha
Just finished up a C++ lab
:eyes:
Christopher McCormack
@cmccormack
Jul 26 2018 18:05
I've been watching their videos all morning now because of you @thekholm80
alpox
@alpox
Jul 26 2018 18:07
@thekholm80 TIL those weird girls from Big Bang Theory are a band
Kyle Holm
@thekholm80
Jul 26 2018 18:07
@cmccormack lol
they had a one-season show on IFC that was hilarious
think you can watch it on netflix
my fav is 29/31
Christopher McCormack
@cmccormack
Jul 26 2018 18:19
is that the track title?
Kyle Holm
@thekholm80
Jul 26 2018 18:20
@cmccormack here you go
Christopher McCormack
@cmccormack
Jul 26 2018 18:21
haha
I don't get invited to dinner parties either
Kyle Holm
@thekholm80
Jul 26 2018 18:23
lol
Christopher McCormack
@cmccormack
Jul 26 2018 18:26
These two make me want to break out my unused Uke and start to learn
Kyle Holm
@thekholm80
Jul 26 2018 18:28
i may or may not have purchased a ukulele after i discovered them
Amit Patel
@AmitP88
Jul 26 2018 18:31
@IsaakNazar oh yeah, I've heard of heroku, but I didn't know what it was lol. Thanks for the tip! :)
May Kittens Devour Your Soul
@diomed
Jul 26 2018 19:41
@thekholm80 what's the difference between putting stuff in db, and putting stuff in json?
Kyle Holm
@thekholm80
Jul 26 2018 19:42
permanence
db can store forever, json is just a way to format data
May Kittens Devour Your Soul
@diomed
Jul 26 2018 19:43
:confused:
Kyle Holm
@thekholm80
Jul 26 2018 19:43
it's like writing something in a book, vs translating it to another language
not really a direct compare
May Kittens Devour Your Soul
@diomed
Jul 26 2018 19:43
but json also stores forever, no?
Kyle Holm
@thekholm80
Jul 26 2018 19:44
well, i guess you could write the json to a file and store the file forever
or you can hold the json in a variable, and it will exist as long as the variable exists
May Kittens Devour Your Soul
@diomed
Jul 26 2018 19:44
is that good or is it bad practice?
writing json to a file
Kyle Holm
@thekholm80
Jul 26 2018 19:45
i use json files all the time at work
it's a great upgrade from xml
May Kittens Devour Your Soul
@diomed
Jul 26 2018 19:45
do u generate them?
Kyle Holm
@thekholm80
Jul 26 2018 19:45
but really it's just a way to format data
no, i ingest data. i don't produce
think of a db as a bookshelf where you keep all your books and json as the words you write in the books
luccifer00
@luccifer00
Jul 26 2018 19:46
hi there, i am lost trying to iterate inside an array with pages…. i can not able to change the page to see more entries…..
objet: Array(50), limit: 50, page: 1, total_count: 535, total_page: 11}
May Kittens Devour Your Soul
@diomed
Jul 26 2018 19:47
should be object
Kelechi Chinaka
@ke1echi
Jul 26 2018 20:26
fixed the puzzle together for pset3 @ezioda004
May Kittens Devour Your Soul
@diomed
Jul 26 2018 21:10
what does it mean to slice (0, 3)
Kyle Holm
@thekholm80
Jul 26 2018 21:11
The slice() method returns a shallow copy of a portion of an array into a new array object selected from begin to end (end not included). The original array will not be modified.
so
var a = [1, 2, 3, 4, 5];
var b = a.slice(0, 3); // [1, 2, 3]
May Kittens Devour Your Soul
@diomed
Jul 26 2018 21:12
oh so this nicely shortens articles for readmore
Kyle Holm
@thekholm80
Jul 26 2018 21:13
if your articles are arrays, the maybe?
Michael S
@Ohshi60
Jul 26 2018 21:45
Guys i got asked what my diet was today in a online job application - am i wrong to think this is outrageous? :D
Kyle Holm
@thekholm80
Jul 26 2018 21:46
did you say "the souls of my enemies"?
because that's the only acceptable answer
Michael S
@Ohshi60
Jul 26 2018 21:47
Damn, failed i guess
Kyle Holm
@thekholm80
Jul 26 2018 21:47
i would also accept "babies"
Michael S
@Ohshi60
Jul 26 2018 21:48
I was considering being a bit cheeky, but honestly i felt so violated with all their questions.
Kyle Holm
@thekholm80
Jul 26 2018 21:49
did the person interviewing you have a man bun?
maybe they only hire vegans?
Michael S
@Ohshi60
Jul 26 2018 21:49
It was just an online job application, after i uploaded my resume and coverletter and grades from school it started all the questions...
Kyle Holm
@thekholm80
Jul 26 2018 21:49
that's kind of extreme
Michael S
@Ohshi60
Jul 26 2018 21:50
I mean, i had a job interview that resulted in a 2 hour long IQ test, but THIS i feel is too personal
Kyle Holm
@thekholm80
Jul 26 2018 21:50
IQ?
smh
Michael S
@Ohshi60
Jul 26 2018 21:50
aptitude test they called it
Kyle Holm
@thekholm80
Jul 26 2018 21:51
i hate the thoughts of ever having to find another job
Michael S
@Ohshi60
Jul 26 2018 21:51
Its a meat-market out here!
i dont mind coding tests and such. But these personal questions really annoyed me, i mean how is my diet relevant. And they wanted me to specify what i had for breakfast, lunch and dinner lol
If they want to know if im fat, they can call me in for an interview
Kyle Holm
@thekholm80
Jul 26 2018 21:53
i wonder what the culture is like in that office, if the application is so invasive?
Michael S
@Ohshi60
Jul 26 2018 21:55
i agree, but i can also imagine its just a new school HR employee going all in on recruiting
But no i dont like it, at least buy me dinner first haha
Kyle Holm
@thekholm80
Jul 26 2018 21:57
and then they'd know what you eat, since they're buying it
Michael S
@Ohshi60
Jul 26 2018 21:58
you get it my man
at some point i want to make a parody website, and just fill it with invasive questions like that
Albert Cardona II
@daddycardona
Jul 26 2018 22:13
I just got another job @thekholm80
Kyle Holm
@thekholm80
Jul 26 2018 22:13
@daddycardona oh awesome!
mcdonalds?
:imp:
seriously though, doing the electronics stuff?
Albert Cardona II
@daddycardona
Jul 26 2018 22:14
no technology company called api I started last week
Kyle Holm
@thekholm80
Jul 26 2018 22:14
very cool
Albert Cardona II
@daddycardona
Jul 26 2018 22:14
I was giong to say bk lol
Yeah I make mimics if you know what that is
I am thinking about also learning c# with unity
Kyle Holm
@thekholm80
Jul 26 2018 22:15
aren't mimics those monsters in d&d that can shape-change?
Albert Cardona II
@daddycardona
Jul 26 2018 22:15
I need to get specific with what I want with coding
LMAO nah bro it is basically a amp
Kyle Holm
@thekholm80
Jul 26 2018 22:16
for audio?
Godsgift ThankGod AKARI
@giftakari
Jul 26 2018 22:16
Congratulations @daddycardona
Albert Cardona II
@daddycardona
Jul 26 2018 22:16
no for navy vessels lol and army stuff
thanks gif
thanks @giftakari
Kyle Holm
@thekholm80
Jul 26 2018 22:16
that's awesome
Albert Cardona II
@daddycardona
Jul 26 2018 22:16
thanks @thekholm80
Kyle Holm
@thekholm80
Jul 26 2018 22:16
cbot's dead, no cookies lol
Albert Cardona II
@daddycardona
Jul 26 2018 22:17
Oh okay cool I have not been on for so long I had to delete the old gitter app on my computer lol
Godsgift ThankGod AKARI
@giftakari
Jul 26 2018 22:17
C# is my next target, looks like there are more opportunities in C#
Kyle Holm
@thekholm80
Jul 26 2018 22:17
i just can't pull the trigger on c#
Albert Cardona II
@daddycardona
Jul 26 2018 22:18
Well I just want to focus on something I don't have to relearn 2 minutes the same thing again and again lol
javascript is like that to me :)
Kyle Holm
@thekholm80
Jul 26 2018 22:18
i bet unity is fun
alpox
@alpox
Jul 26 2018 22:18
@thekholm80 Clojure ftw. :D
Kyle Holm
@thekholm80
Jul 26 2018 22:18
i'd love to make some vr apps, but i'd have to bring in someone to draw the pretty pictures
Albert Cardona II
@daddycardona
Jul 26 2018 22:18
IDK all i know is that I can try to learn how to do something and master it like gaming with unity
LOL
Kyle Holm
@thekholm80
Jul 26 2018 22:19
@alpox i was thinking c++
alpox
@alpox
Jul 26 2018 22:19
@thekholm80 useful. But ugly. As heck.
C++ programmers are masochists
Albert Cardona II
@daddycardona
Jul 26 2018 22:19
LOL
Kyle Holm
@thekholm80
Jul 26 2018 22:19
i think the unreal engine uses c++
Godsgift ThankGod AKARI
@giftakari
Jul 26 2018 22:20
.NET is a powerful framework
alpox
@alpox
Jul 26 2018 22:20
@thekholm80 yes it does. C++ is still the best in the domain of games
Albert Cardona II
@daddycardona
Jul 26 2018 22:20
yeah well I just came to say hi to my fam on here like @thekholm80 and others on here @alpox though we never chatted so much and @giftakari
Kyle Holm
@thekholm80
Jul 26 2018 22:20
@daddycardona glad to hear you're doing well
@alpox i agree, the syntax of c++ is hidious
Albert Cardona II
@daddycardona
Jul 26 2018 22:21
thanks man ttyl probably be on a C# help on here next lmao
Kyle Holm
@thekholm80
Jul 26 2018 22:21
and i think it would take a lot for me to get past the ugliness of it
Smootimus
@Smootimus
Jul 26 2018 22:41
Just got access to VMware store Kyle
Kyle Holm
@thekholm80
Jul 26 2018 22:42
oh neat, what are you buying me?
Smootimus
@Smootimus
Jul 26 2018 22:42
image.png
Kyle Holm
@thekholm80
Jul 26 2018 22:43
very cool
but real talk: who watches videos about dwarf fortress?
Smootimus
@Smootimus
Jul 26 2018 22:44
xD
Meeeeee
Ay, all those are freee too btw
Kyle Holm
@thekholm80
Jul 26 2018 22:44
i don't know what most of those do
Smootimus
@Smootimus
Jul 26 2018 22:45
More interested in the Workstation
Kyle Holm
@thekholm80
Jul 26 2018 22:45
can you virtualize servers?
Smootimus
@Smootimus
Jul 26 2018 22:45
Yeah
It's very common
Especially in enterprise
Kyle Holm
@thekholm80
Jul 26 2018 22:45
i thought workstation player would let me run headless vms, but i've not really looked into it much
Smootimus
@Smootimus
Jul 26 2018 22:45
Like having a nice big rack server running VMware controlling many different servers
Kyle Holm
@thekholm80
Jul 26 2018 22:46
my company does that
Smootimus
@Smootimus
Jul 26 2018 22:46
Ye'sir
:D
Kyle Holm
@thekholm80
Jul 26 2018 22:46
but it's all windows 95
Smootimus
@Smootimus
Jul 26 2018 22:46
I would like to get something nice running here like that
LOL! Nice xD
And typical xD
Kyle Holm
@thekholm80
Jul 26 2018 22:46
well, i exaggerate but we have a lot of xp still lol
i've been thinking about buying some raspberry pis to run servers on, but if i can virtualize them instead i think that would make more sense
Smootimus
@Smootimus
Jul 26 2018 22:47
Yeah I know, it's something I run into on the regular
Yep :)
Smootimus
@Smootimus
Jul 26 2018 22:53
So vSphere is Application Virtualization, vCenter is centralized management, vRealize is Cloud management, Workstation is virtualization for PC and Linux, Fusion is virtualization for Mac
There's the differences
Kyle Holm
@thekholm80
Jul 26 2018 22:53
hmm
most of that is over my head
Smootimus
@Smootimus
Jul 26 2018 22:54
Workstation ftw, that's pretty much what matters xD
Kyle Holm
@thekholm80
Jul 26 2018 22:54
i forget what gets added in the pro version, but i've never had any complaints about the free version
i like that i can allocate processor cores and memory to the vm, control just how much of my resources it uses
Smootimus
@Smootimus
Jul 26 2018 22:57
Yes it's very nice
Smootimus
@Smootimus
Jul 26 2018 23:18
Bryan Reese says hello and he misses everyone dearly
Kyle Holm
@thekholm80
Jul 26 2018 23:19
who's that?
Smootimus
@Smootimus
Jul 26 2018 23:20
Some no body lol
Karma Drukpa
@coderkarma
Jul 26 2018 23:21
yes
@thekholm80
need little guidance my logic is failing here
Hello
Kyle Holm
@thekholm80
Jul 26 2018 23:24
how do you think it should be done?
Karma Drukpa
@coderkarma
Jul 26 2018 23:24
let me sent you my thought process
it is not hard i know for sure.
function sumMix(x){
// declare total 
  let total = 0;
// loop through the arr
  for (let i = 0; i <x.length; i += 1){
// check if the element is  str, if it is, convert to number 
     let ele = x[i];

     if (  typeof ele === 'string'){
       let newNum = Number(ele);
    }
    // (little confuse of doing this loop; all i wan to do is all the each elements which is converted to numbers.do another loop over an arr 
    // add the each element of arr ele
  }

  return Number(total);
}
Kyle Holm
@thekholm80
Jul 26 2018 23:26
looks like you're off to a good start, just need to get the addition in there
oh neat, i remembered how to coerce without parseInt()
Karma Drukpa
@coderkarma
Jul 26 2018 23:28
my problem is , once element of array has been converted to numbers, so now i have all element of array as numbers, i was thinking to do loop and add each element but that didn't work .
Kyle Holm
@thekholm80
Jul 26 2018 23:30
but you're storing the converted number in a variable, and you have a variable to hold the total, so why not just add them together?
Karma Drukpa
@coderkarma
Jul 26 2018 23:30
HMMMM....
Kyle Holm
@thekholm80
Jul 26 2018 23:31
and you can skip the if statement and cast everything to Number type, to make it simple
Number(1) and Number('1') will both be 1
Karma Drukpa
@coderkarma
Jul 26 2018 23:33
oh my gosh
i made it so complicated
yes your right
got it
straight forward
@thekholm80 thank you sir
Kyle Holm
@thekholm80
Jul 26 2018 23:35
good job!
Karma Drukpa
@coderkarma
Jul 26 2018 23:37
function sumMix(x){
// declare total 
  let total = 0;
// loop through the arr
  for (let i = 0; i <x.length; i += 1){
// check if the element is  str, if it is, convert to number 
     let ele = x[i];
     // convert the element in number with Number and concate the elements with total
     total += Number(ele);

  }
   return total;
}
Kyle Holm
@thekholm80
Jul 26 2018 23:37
i guess it's probably not 'casting' since JS isn't a typed language, but you get what i meant
Karma Drukpa
@coderkarma
Jul 26 2018 23:37
you got one liner?
Kyle Holm
@thekholm80
Jul 26 2018 23:37
const sumMix = x => x.reduce((a, b) => +b +a, 0); this was mine
Karma Drukpa
@coderkarma
Jul 26 2018 23:37
lol
you killing me now
Kyle Holm
@thekholm80
Jul 26 2018 23:38
you did good
there's still a little fat you could trim off, but it's clear and concise
Karma Drukpa
@coderkarma
Jul 26 2018 23:38
damn, we don't have to convert those string to a number in that one liner.
Kyle Holm
@thekholm80
Jul 26 2018 23:39
the + will attempt to coerce to an integer
Karma Drukpa
@coderkarma
Jul 26 2018 23:39
oh i see..
Kyle Holm
@thekholm80
Jul 26 2018 23:39
i'd never use it in production code
Karma Drukpa
@coderkarma
Jul 26 2018 23:39
WHAT IS THAT FAT
why ?
Kyle Holm
@thekholm80
Jul 26 2018 23:39
it's not very readable
Karma Drukpa
@coderkarma
Jul 26 2018 23:40
okay
Kyle Holm
@thekholm80
Jul 26 2018 23:40
// this
     let ele = x[i];
     // convert the element in number with Number and concate the elements with total
     total += Number(ele);

// could be this
total += Number(x[i]);
it's not a big deal and there's nothing wrong with how you did it
Karma Drukpa
@coderkarma
Jul 26 2018 23:41
cool. I see now. thanks
Kyle Holm
@thekholm80
Jul 26 2018 23:42
it looks like you're getting better at developing plans to solve the problems
that's awesome
the best thing i ever learned is that it's okay to delete all my code and start over if nothing i'm trying is working
Karma Drukpa
@coderkarma
Jul 26 2018 23:47
Thank you, those sentences boosted me now.