These are chat archives for FreeCodeCamp/HelpJavaScript

8th
Mar 2018
Brian
@BrianCodes33
Mar 08 2018 04:53
i cant wrap my head around react lifecycle changes
Ken Haduch
@khaduch
Mar 08 2018 05:05
@BrianCodes33 - I just googled and found this article - I just scanned it quickly and it looks like it has some good information, maybe helpful to you, if you haven't seen it already? I think that I'm going to bookmark it for some further study...
Tricia
@patricia07
Mar 08 2018 05:40
can u help me guys
var myStr ='<a href= "http://www.example.com" target= "_blank">Link</a>';
what's wrong with my codes
Sweet Coding :)
@SweetCodingInc
Mar 08 2018 05:44
@patricia07 don't see any problem in this snippet
what's the error?
Tricia
@patricia07
Mar 08 2018 05:46
Only remove the backslashes \ used to escape quotes. @SweetCodingInc
Sweet Coding :)
@SweetCodingInc
Mar 08 2018 05:47
@patricia07 may be try resetting your code?
Tricia
@patricia07
Mar 08 2018 05:48
tried it but nothing happened
Sweet Coding :)
@SweetCodingInc
Mar 08 2018 05:49
post the challenge link
Sweet Coding :)
@SweetCodingInc
Mar 08 2018 05:53
@patricia07 I see
you got some extra spaces in your code.
please remove them
Tricia
@patricia07
Mar 08 2018 05:53
@SweetCodingInc where tho
oh i see
Sweet Coding :)
@SweetCodingInc
Mar 08 2018 05:53
// your code
var myStr ='<a href= "http://www.example.com" target= "_blank">Link</a>';

//correct code
var myStr = '<a href="http://www.example.com" target="_blank">Link</a>';
Tricia
@patricia07
Mar 08 2018 05:54
@SweetCodingInc thank you!
CamperBot
@camperbot
Mar 08 2018 05:54
patricia07 sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
:cookie: 350 | @sweetcodinginc |http://www.freecodecamp.org/sweetcodinginc
Sweet Coding :)
@SweetCodingInc
Mar 08 2018 05:54
it's a misleading error
would you like to make a contribution to FCC?
if so, please file an issue on FCC github repo
about this misleading error message
@patricia07
Tricia
@patricia07
Mar 08 2018 05:56
FCC?
Sweet Coding :)
@SweetCodingInc
Mar 08 2018 05:56
Free Code Camp
just a short form
Tricia
@patricia07
Mar 08 2018 05:57
ohhh how to?
Sweet Coding :)
@SweetCodingInc
Mar 08 2018 05:59
log an issue there with the problem you faced
adding/missing spaces causes incorrect error message
Tricia
@patricia07
Mar 08 2018 06:02
@SweetCodingInc i see thanks!
CamperBot
@camperbot
Mar 08 2018 06:02
patricia07 sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
api offline
Brian
@BrianCodes33
Mar 08 2018 06:07
@khaduch thanks
CamperBot
@camperbot
Mar 08 2018 06:07
briancodes33 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3781 | @khaduch |http://www.freecodecamp.org/khaduch
Tricia
@patricia07
Mar 08 2018 06:26
var someAdjective = "nice!";
var myStr = "Learning to code is ";
ourStr += someAdjective;
???
abraham anak agung
@padunk
Mar 08 2018 06:42
@patricia07 what is the issue?
Claudio Restifo
@Marmiz
Mar 08 2018 07:45

guys, anyone knows how to scroll to top a scrolling div inside a div?

imagine something like:

+----------------------------------+
|              +------------+                
|               | scroll me |
|               |    to top    |
|               |     not my |
|               |  parent     |
|               +------------+                                         
|                                                   
+----------------------------------+
them format tho :smile:
Fabien SHAN
@X140hu4
Mar 08 2018 07:54
position: absolute?
GoGeChang
@GoGeChang
Mar 08 2018 07:54
friends I need help
Fabien SHAN
@X140hu4
Mar 08 2018 07:55
@Marmiz then use the properties top, right, bottom, left to position the element
Claudio Restifo
@Marmiz
Mar 08 2018 07:55
@X140hu4 both relative
GoGeChang
@GoGeChang
Mar 08 2018 07:56
oh god! how can I send pictures to illustrate my problem...........
Claudio Restifo
@Marmiz
Mar 08 2018 07:57
what is like, selector.scrollTo(coord) something like that?
haven't done this kind of stuff in ages
Fabien SHAN
@X140hu4
Mar 08 2018 07:59
and then get the position of the parent div?
@GoGeChang try copy pasting or put it on codepen
GoGeChang
@GoGeChang
Mar 08 2018 08:07
thank you! my problem has been solved. thank you friend. @X140hu4
CamperBot
@camperbot
Mar 08 2018 08:07
gogechang sends brownie points to @x140hu4 :sparkles: :thumbsup: :sparkles:
:cookie: 350 | @x140hu4 |http://www.freecodecamp.org/x140hu4
yafumiao
@yafumiao
Mar 08 2018 08:14
hi
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 08:48
@cmccormack by any luck around??
赵佳强
@ZhaojiaQ
Mar 08 2018 09:04
hava anybody here/
problem 208 ,i
wanne get some help
Marianissimus
@Marianissimus
Mar 08 2018 09:06
what is problem 208? say the name, pls
GoGeChang
@GoGeChang
Mar 08 2018 09:10
we are here. say your problem please @ZhaojiaQ
Ronique Ricketts
@RoniqueRicketts
Mar 08 2018 12:43

Hello Guys, Good morning. I am kinda stuck, what did I do wrong here?

let repeatNum = "42 42 42";
let reRegex = /(\d+)\s\2/; // Change this line
let result = reRegex.test(repeatNum);

https://beta.freecodecamp.org/en/challenges/regular-expressions/reuse-patterns-using-capture-groups

Stephen James
@sjames1958gm
Mar 08 2018 12:57
@RoniqueRicketts Which tests are failing?
Ronique Ricketts
@RoniqueRicketts
Mar 08 2018 13:00
@sjames1958gm
Your regex should reuse the capture group twice.
Your regex should have two spaces separating the three numbers.
Your regex should match "42 42 42".
Your regex should match "100 100 100".
Your regex should match "10 10 10".
Stephen James
@sjames1958gm
Mar 08 2018 13:08
@RoniqueRicketts The capture groups is \1 not \2
Ronique Ricketts
@RoniqueRicketts
Mar 08 2018 13:09
@sjames1958gm even with 1 it still fails
Stephen James
@sjames1958gm
Mar 08 2018 13:09
let reRegex = /^(\d+)\s\1\s\1$/; this is what I had to do to get it to pass.
@RoniqueRicketts match digits space samedigits space samedigits
@RoniqueRicketts Meh on this challenge
Ronique Ricketts
@RoniqueRicketts
Mar 08 2018 13:10
lol
ok
@sjames1958gm thanks
CamperBot
@camperbot
Mar 08 2018 13:10
roniquericketts sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9072 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Mar 08 2018 13:11
@RoniqueRicketts Not sure that that is the expected answer
Ronique Ricketts
@RoniqueRicketts
Mar 08 2018 13:11
@sjames1958gm Oh, it passed though
Regexp is the worst part of JavaScript in my eyes
unfortunately I have to learn it.
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 13:37
@RoniqueRicketts I just write stuff down on regex101 helps alot
hey @sjames1958gm are you into codefights?
Stephen James
@sjames1958gm
Mar 08 2018 13:46
@tiagocorreiaalmeida I have tried to get into that but just haven't taken the time
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 13:55
wanna give it a try on a fight just for fun?
Stephen James
@sjames1958gm
Mar 08 2018 14:13
@tiagocorreiaalmeida With my new job I am just too busy, sorry
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 14:14
@sjames1958gm no worries at all :D
sabahatullah
@sabahatullah
Mar 08 2018 14:15
const defaultObj = {
"profile": {
"CRO01": readCookie("CRO01"),
"CRO02": readCookie("CRO02")
}
"mbox3rdPartyId": customerID();
};
I am getting syntax error on that?
could anyone please help
@sjames1958gm
h1tag
@h1tag
Mar 08 2018 14:19
@sabahatullah you're missing something and you have an extra something
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 14:19
you are missing ,
const defaultObj = {
    "profile": {
        "CRO01": readCookie("CRO01"),
        "CRO02": readCookie("CRO02")
    },
    "mbox3rdPartyId": customerID();
};
also remove the the ; from the function calling
sabahatullah
@sabahatullah
Mar 08 2018 14:23
@tiagocorreiaalmeida yo awesome man.thanks man. I think I need a break or retirement now
CamperBot
@camperbot
Mar 08 2018 14:23
sabahatullah sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 508 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
Francois Beyers
@Blusoup
Mar 08 2018 15:20
Hi there. I'm trying to capture a a selected box when I click a submit button. Basically I have 3 boxes at the top of the webpage and then a form to fill in. After I filled in the form the is a submit button. What I'm trying to achieve is write a cookie that will say which box was selected when I click submit. Has anyone got any suggestions? And thank you
Blauelf
@Blauelf
Mar 08 2018 15:33
What do you mean by "selected"?
I mean there's a "selected" property on some input elements, but those are not boxes per definition (might be styled as such).
Francois Beyers
@Blusoup
Mar 08 2018 15:36
Yeah sorry, I meant they are radio buttons
Blauelf
@Blauelf
Mar 08 2018 16:01

Which means you could give all the same name and a different value and then ask for the form element's value. Like

<form id="contactform">
  <p>Please select your preferred contact method:</p>
  <div>
    <input type="radio" id="contactChoice1"
     name="contact" value="email">
    <label for="contactChoice1">Email</label>

    <input type="radio" id="contactChoice2"
     name="contact" value="phone">
    <label for="contactChoice2">Phone</label>

    <input type="radio" id="contactChoice3"
     name="contact" value="mail">
    <label for="contactChoice3">Mail</label>
  </div>
  <div>
    <button type="submit">Submit</button>
  </div>
</form>
<script>
document.forms["contactform"].addEventListener("submit", function(e){
    if (document.forms["contactform"]["contact"].value)
        console.log("You chose " + document.forms["contactform"]["contact"].value);
    else
        console.log("You chose none");
    e.preventDefault(); // prevents the actual submit in this example
});
</script>

Now combine that with document.cookie (the actual cookie, which is sent to the server on each request), window.sessionStorage (local-only storage for short duration, like until closing the window), or window.localStorage (local-only storage for more long-term, that's where fCC stores the code before you submit) and you should have what you want.

I hope this form stuff is still working like that, I last used it in the late 1990s :P (back then Netscape and Internet Explorer hat different ideas of how events would work, so it was actually a lot more code involved in registering the event and preventing the submit action from actually happening)

Instead of the value, you could loop over the buttons to find the one that's selected
Francois Beyers
@Blusoup
Mar 08 2018 16:05
thank you @Blauelf I appreciate it. I'll give it ago
CamperBot
@camperbot
Mar 08 2018 16:05
blusoup sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4686 | @blauelf |http://www.freecodecamp.org/blauelf
Jason Luboff
@JLuboff
Mar 08 2018 16:11
Morning
Razvan Jackson
@RazvanJackson
Mar 08 2018 16:12
Morning!
Jason Luboff
@JLuboff
Mar 08 2018 16:14
How's it going?
Razvan Jackson
@RazvanJackson
Mar 08 2018 16:15
Just chillin' out here. How about you?
Jason Luboff
@JLuboff
Mar 08 2018 16:16
Just got into work
Blauelf
@Blauelf
Mar 08 2018 16:20
Morning? Late afternoon, maybe evening, not sure which one to use. Maybe 夕方. Just before sunset.
Jason Luboff
@JLuboff
Mar 08 2018 16:21
@Blauelf Ya ya ya... I know everyones a different time zone :)
Jason Luboff
@JLuboff
Mar 08 2018 17:09
Any promise experts around?
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 17:17
@JLuboff not a promise expert but I can try
Jason Luboff
@JLuboff
Mar 08 2018 17:18
@tiagocorreiaalmeida Alright...give me a second here to get some code

Ok, so I'm trying to move my SQL queries out of my routes folder into their own file. So I have for example

exports.getUserInfo = user => {
  sql
    .connect(sqlConfig)
    .then(pool => {
      const request = new sql.Request(pool);
      request.multiple = true;
      return request.input('user', sql.NVarChar, user + '%')
                    .query(`   Select PersonID, Position, PositionTwo
                               From Person
                               Where Email like @user;`)
                    .then(result => {
                       return result;
                    })
                    .catch(err => {
                      console.log(error(`Admin Portal Select Error: ${err}`));
                    })
                    .then(() => {
                      console.log(conCls(`SQL Connection Closed: /adminPortal`));
                      sql.close();
                    });
                    })

                  sql.on('error', err => {
                    console.log(error(`SQL Error: ${err}`));
                  });
}

Normally in my routes folder with the same code I wouldn't be using return result instead I'd be manipulating result. So then in my routes file I try

const queries = require('../db/queries');

  app.route('/test').get((req, res) => {
    let user = 'jluboff';
queries.getUserInfo(user).then(..

But I get cannot read property 'then' of undefined

I've tried adding in new Promise.. to the query with no success
Unless..
Jason Luboff
@JLuboff
Mar 08 2018 17:23
I should be handling the then and catch blocks in the routes file?
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 17:24
I think you should be resolving or j
rejecting it still im not quite sure
@alpox is the "pro" you need :D
Jason Luboff
@JLuboff
Mar 08 2018 17:25
Ya.. I'm not great with Promises and it's frustrating that it works if all contained in the same file but complety breaks outside of it lol
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 17:25
have you tried using the new promise and rejecting/resolving it?
Jason Luboff
@JLuboff
Mar 08 2018 17:26
Ya still a no go, unless its becuase I'm using it in the wrong place but I tried in a couple places with no luck
alpox
@alpox
Mar 08 2018 17:26
@tiagocorreiaalmeida Mhhhh?
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 17:26
give a read on the the code @JLuboff posted if you dont mind
Jason Luboff
@JLuboff
Mar 08 2018 17:27
@alpox See my above question about promises lol
Essentially I'm trying to move a promise from my routes file to a seperate query file and can't resolve back to the calling routes file
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 17:28
I guess you would just call it as a normal function @JLuboff ?
and assign the response value to a variable?
Jason Luboff
@JLuboff
Mar 08 2018 17:28
I've tried, but I get undefined returned
alpox
@alpox
Mar 08 2018 17:28
@JLuboff You simply forgot the return in front of sql right at the top
Jason Luboff
@JLuboff
Mar 08 2018 17:28
@alpox Should the return before request.input still be there as well?
alpox
@alpox
Mar 08 2018 17:29
@JLuboff yes that one should still be there
But i would flatten this all
And go sure that sql.on will still be run
So:
exports.getUserInfo = user => {
    sql.on('error', err => {
        console.log(error(`SQL Error: ${err}`));
    });


    return sql
        .connect(sqlConfig)
        .then(pool => {
            const request = new sql.Request(pool);
            request.multiple = true;
            return request.input('user', sql.NVarChar, user + '%')
                .query(`   Select PersonID, Position, PositionTwo
                               From Person
                               Where Email like @user;`);
        })
        .then(result => {
            return result;
        })
        .catch(err => {
            console.log(error(`Admin Portal Select Error: ${err}`));
        })
        .then(() => {
            console.log(conCls(`SQL Connection Closed: /adminPortal`));
            sql.close();
        });
}
Jason Luboff
@JLuboff
Mar 08 2018 17:31
Let me try
alpox
@alpox
Mar 08 2018 17:32
@JLuboff There is still a mistake though as you won't get users
Jason Luboff
@JLuboff
Mar 08 2018 17:33
Inside the query file, I do, but from my routes file, you're correct, I don't I get an empty object now atleast though
alpox
@alpox
Mar 08 2018 17:33
@JLuboff yes thats because of the last .then
Jason Luboff
@JLuboff
Mar 08 2018 17:33
Should I omit that?
The documentation isn't actually very clear on when to use sql.close()
alpox
@alpox
Mar 08 2018 17:34
Hmm you should close the connection though
Well
I'd usually on backend keep the connection open all time
when you start the server - open it
and then close it when shutting down the server
Jason Luboff
@JLuboff
Mar 08 2018 17:35
Ok, so then I should be using a global connection then, otherwise, I won't be able to make anothjer call without an error
alpox
@alpox
Mar 08 2018 17:37
exports.getUserInfo = user => {
    sql.on('error', err => {
        console.log(error(`SQL Error: ${err}`));
    });


    return sql
        .connect(sqlConfig)
        .then(pool => {
            const request = new sql.Request(pool);
            request.multiple = true;
            return request.input('user', sql.NVarChar, user + '%')
                .query(`   Select PersonID, Position, PositionTwo
                               From Person
                               Where Email like @user;`);
        })
        .catch(err => {
            console.log(error(`Admin Portal Select Error: ${err}`));
        })
        .then(result => {
            console.log(conCls(`SQL Connection Closed: /adminPortal`));
            sql.close();
            return result;
        });
}
For now you could use this
Jason Luboff
@JLuboff
Mar 08 2018 17:37
Let me try
alpox
@alpox
Mar 08 2018 17:38
The problem you have with this is just that it still resolves even if there was an error
So you may want to do:
exports.getUserInfo = user => {
    sql.on('error', err => {
        console.log(error(`SQL Error: ${err}`));
    });


    return sql
        .connect(sqlConfig)
        .then(pool => {
            const request = new sql.Request(pool);
            request.multiple = true;
            return request.input('user', sql.NVarChar, user + '%')
                .query(`   Select PersonID, Position, PositionTwo
                               From Person
                               Where Email like @user;`);
        })
        .catch(err => {
            const error = error(`Admin Portal Select Error: ${err}`);
            console.error(error);
            return Promise.reject(error)
        })
        .then(result => {
            console.log(conCls(`SQL Connection Closed: /adminPortal`));
            sql.close();
            return result;
        });
}
Jason Luboff
@JLuboff
Mar 08 2018 17:41
@alpox It's working. This is why we pay your the big bucks (well...big brownies at least)! Thank you
CamperBot
@camperbot
Mar 08 2018 17:41
jluboff sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1577 | @alpox |http://www.freecodecamp.org/alpox
alpox
@alpox
Mar 08 2018 17:41
@JLuboff Np :)
Jason Luboff
@JLuboff
Mar 08 2018 17:41
Any reason to use console.error over console.log? I researched it recently but didn't see a compelling reason to use it over .log
alpox
@alpox
Mar 08 2018 17:42
Well a good reason is that you see better that its an error :D
image.png
There you have the difference :)
Jason Luboff
@JLuboff
Mar 08 2018 17:44
Ah.. in my console window (Windows Node JS command prompt window) they both show up the same. But I'm using chalk to differentiate via colors
alpox
@alpox
Mar 08 2018 17:45
Ah yea there may be :D
Jason Luboff
@JLuboff
Mar 08 2018 17:47
But seriousily... thank you. I'd been racking my brain since yesterday trying to figure it out. Googling wasn't helping lol
alpox
@alpox
Mar 08 2018 17:47
No problem :)
Do you want me to explain it?
Or is it clear :D
Jason Luboff
@JLuboff
Mar 08 2018 17:48
It's fairly clear.. but why did we need the return at the connection string and not just at the point of the request?
oh.. actually I guess becuase thats the beginning of the promise
alpox
@alpox
Mar 08 2018 17:48
Well the return request... is returning it from the inner function
from the function pool => { .... }
You returned nothing from your function getUserInfo -- user => { ... }
Jason Luboff
@JLuboff
Mar 08 2018 17:50
Ya that makes sense
So awesome. Now I can move all my queries out of my routes file
alpox
@alpox
Mar 08 2018 17:52
Nice :)
Jason Luboff
@JLuboff
Mar 08 2018 17:53
Been trying to be better about breaking out my components from my routes file to seperate files
alpox
@alpox
Mar 08 2018 17:55
Thats surely a good practice
Jason Luboff
@JLuboff
Mar 08 2018 17:59
So I've been told (by the internet :P)
Jason Luboff
@JLuboff
Mar 08 2018 18:33
@alpox Still around?
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 20:24
is it today that we are going to have our codefight?:D
@JLuboff
alpox
@alpox
Mar 08 2018 20:48
@JLuboff around now :D
@tiagocorreiaalmeida wanna fight? :P
Aftab Parvez
@aftabparvez
Mar 08 2018 20:49
Hi everyone! I’m having an issue while trying to add external links. Codepen prepends https://s.codepen.io/ before the actual link
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 20:49
@JLuboff lets go
@alpox *
:D
alpox
@alpox
Mar 08 2018 20:50
Have any fight in mind? :D
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 20:50
we can use the codefights platform :D
send you a friend invite
sent*
alpox
@alpox
Mar 08 2018 20:50
Yes but i mean a particular problem
Aftab Parvez
@aftabparvez
Mar 08 2018 20:50
Example the link i’ve generated through JS is https:/twitch.tv/esl_sc2; however, codepen shows it as https://s.codepen.io/twitch.tv/esl_sc2and when i try to click on it, there’s a 404 error
Here’s the codepen link: https://codepen.io/aftabparvez/pen/MQMPae
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 20:51
not at table I think we can go over something generic?
at all*
Aftab Parvez
@aftabparvez
Mar 08 2018 20:51
Line 24 is where I generate the links
Jason Luboff
@JLuboff
Mar 08 2018 20:53
@alpox I'm back now too, do I need to have a catch block in my routes file or is the catch block in the queries file sufficient?
alpox
@alpox
Mar 08 2018 20:53
@aftabparvez You put https:/twitch.tv but it should be https://twitch.tv notice the two consecutive /
Aftab Parvez
@aftabparvez
Mar 08 2018 20:54
@alpox Thanks! Corrected it.. However, I still can’t get it working.
CamperBot
@camperbot
Mar 08 2018 20:54
aftabparvez sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1578 | @alpox |http://www.freecodecamp.org/alpox
alpox
@alpox
Mar 08 2018 20:55
@JLuboff One catch always catches one rejection. After the catch, the chain goes on - means if there was an error and you put there a catch, after the catch, the next .then will keep getting executed.
And a catch always catches any error in the chain before
@JLuboff The example of mdn is quite ok:
p1.then(function(value) {
  console.log(value); // "Success!"
  throw 'oh, no!';
}).catch(function(e) {
  console.log(e); // "oh, no!"
}).then(function(){
  console.log('after a catch the chain is restored');
}, function () {
  console.log('Not fired due to the catch');
});
Aftab Parvez
@aftabparvez
Mar 08 2018 20:57
@alpox Hey! Sorry.. I made that mistake twice
alpox
@alpox
Mar 08 2018 20:57
@aftabparvez Yup :D
Aftab Parvez
@aftabparvez
Mar 08 2018 20:57
@alpox Got it working
alpox
@alpox
Mar 08 2018 20:57
@aftabparvez Good! :)
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 20:57
alopx go :D
alpox
@alpox
Mar 08 2018 20:57
@tiagocorreiaalmeida Go where :D
Aftab Parvez
@aftabparvez
Mar 08 2018 20:58
@alpox Thanks! :-) :-) :clap: :fire: :clap:
CamperBot
@camperbot
Mar 08 2018 20:58
aftabparvez sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
api offline
alpox
@alpox
Mar 08 2018 20:58
Did you send me something? :D
@aftabparvez np :)
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 20:58
codefights yeah
alpox
@alpox
Mar 08 2018 20:59
@tiagocorreiaalmeida Ah sry didn't see it in all those 500 notifications xD
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:00
:D
no worries the time doesnt matter here I think
meh have done all of this boring
Jason Luboff
@JLuboff
Mar 08 2018 21:01
This message was deleted
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:01
those before*
alpox
@alpox
Mar 08 2018 21:02
Aha :D i don't know that one
But why is there some code already?
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:02
yeah that's the boring part of this fights 3 exercises 2 of them you just need to complete and only write down the last one
Jason Luboff
@JLuboff
Mar 08 2018 21:02

@alpox Hmmm. So if I'm following correctly.. if anything I should have in my routes

app.route('/myRoute').get((req, res) => {
queries.getUserInfo(user).
catch(err => {..})
.then(result => {..}

?

alpox
@alpox
Mar 08 2018 21:06
@tiagocorreiaalmeida I rly don't get this mode xD
@JLuboff Well something like that looks ok
Jason Luboff
@JLuboff
Mar 08 2018 21:07
Usually I'd do the then before the catch but I may have confused myself at what you said lol
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:08
@alpox how you normally go? you pick a challenge and try to do it?
alpox
@alpox
Mar 08 2018 21:10
@tiagocorreiaalmeida I don't do codefights :D
I was mostly on codewars
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:11
https://codefights.com/challenges pick one and let sgo
makes more sense
alpox
@alpox
Mar 08 2018 21:14
@tiagocorreiaalmeida We are through though :D
I just have long time to read those xD
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:15
well those are quite simple and indeed all you need to do is read but reading to changing a value its boring xd
alpox
@alpox
Mar 08 2018 21:16
the last one too? :D
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:16
close to that
its 4 if statmenent or 1 with 4 or
xd
alpox
@alpox
Mar 08 2018 21:21
@tiagocorreiaalmeida I was too dumb to understand the question :D its so badly written
Jason Luboff
@JLuboff
Mar 08 2018 21:22
Thats how I feel about a lot of codewar problems
alpox
@alpox
Mar 08 2018 21:22
Rly its mostly 80% reading and 20% coding
For me
Jason Luboff
@JLuboff
Mar 08 2018 21:23
Eh. Half the time I just don't quite understand what they want lol. Usually have to throw in a bunch of console.logs to figure it out
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:23
@JLuboff hey that's me
alpox
@alpox
Mar 08 2018 21:23
Yea i just program something, then i see the results and see: Huh, why is that?
Then i read again
For a minute
Jason Luboff
@JLuboff
Mar 08 2018 21:23
Lol
alpox
@alpox
Mar 08 2018 21:24
And then i get that they meant it different
Than i understood
And that around 20 times
:D
Jason Luboff
@JLuboff
Mar 08 2018 21:24
sigh guess I need to setup my session store via sql at some point.
alpox
@alpox
Mar 08 2018 21:25
@tiagocorreiaalmeida Got a better challenge? :D
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:25
well if @JLuboff wanna join we can make a tournament there you code 3 or 4 challenges and complete 2 I thik
Jason Luboff
@JLuboff
Mar 08 2018 21:25
Busy with actual work haha
I mean... I don't have a deadline for this...but.. still not quite as far as I probably should be
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:26
it has a 10minutes limute
limit
its like roll your face on keyboard
for 10minutes
:D
alpox
@alpox
Mar 08 2018 21:27
@tiagocorreiaalmeida I'm not sure if i can still think fast enough for 10 minutes today :D
My mind is a bit like gum
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:27
aahahaha lets give it a try :D
had to set a 10min delay before the start its the minimal
will just invite random people
alpox
@alpox
Mar 08 2018 21:28
ok ^^
Jason Luboff
@JLuboff
Mar 08 2018 21:29
@alpox Alright..last question for the day (hopefully :P) Good or bad structure here with the catch blocks (I omitted some unnecessary lines)
  app.route('/adminPortal').get(authUser, (req, res) => {

    queries.getUserInfo(user)
      .then(result => {
        if (!pos) {
          //Unauthorized user
          return res.render('adminPortal.hbs', {
            authorized: false
          });
        } else {
          queries.getAdminPortal(pos, posTwo, personId).then(doc => {
              return res.render('adminPortal.hbs', {
                authorized: true,
                data: doc.recordsets[0],
                pages
              });
            })
            .catch(err => {
              console.log(error(`adminPortal getAdminPortal error: ${err}`));
            })
        }
      }).catch(err => {
        console.log(error(`adminPortal getUserInfo error: ${err}`))
      })
  });
alpox
@alpox
Mar 08 2018 21:30
@JLuboff If you just return the inner promise return queries.getAdminPortal you can remove the inner .catch
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:30
@JLuboff join us :D
Jason Luboff
@JLuboff
Mar 08 2018 21:34
@alpox Ok, so return on the inner promise and remove that .catch block (getadminportal catch). Thank you again
CamperBot
@camperbot
Mar 08 2018 21:34
jluboff sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1579 | @alpox |http://www.freecodecamp.org/alpox
alpox
@alpox
Mar 08 2018 21:36
@JLuboff np :)
Jason Luboff
@JLuboff
Mar 08 2018 21:40
Man it took me over two minutes just to read that
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:40
same and to move on to tnext one :D
Jason Luboff
@JLuboff
Mar 08 2018 21:40
move on to the next one?
Can I skip this one? lol
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:41
on top there's a b c
Jason Luboff
@JLuboff
Mar 08 2018 21:41
Oh I see there is A B C
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:41
you can move to the next one and come back
Jason Luboff
@JLuboff
Mar 08 2018 21:42
Dude... fuck all of these. My brain isn't working good enough for this haha
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:42
Im startingto feel the same ahah
welcome to codefights
where you either take a exercise where you just have to write a return or you get this
Jason Luboff
@JLuboff
Mar 08 2018 21:46
Is there no console window?
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:46
you see the console results on the tests
log*
I guess this is going to be a draw
ahahaha @alpox
Jason Luboff
@JLuboff
Mar 08 2018 21:54
So... no one had any points but alpox won?
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:54
joined first :D
Jason Luboff
@JLuboff
Mar 08 2018 21:54
Ah
Gulsvi
@gulsvi
Mar 08 2018 21:55
I joined a little late - had to go through a tutorial and then got this pop up "You were #5 of 5! Tell your friends!"
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:55
@gulsvi I can make a new one if you wanna come
Gulsvi
@gulsvi
Mar 08 2018 21:56
I'll join again, sure - but I'm positive you'll all beat me lol
I might need to practice some more
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:56
dont think so and join just for fun :)
Jason Luboff
@JLuboff
Mar 08 2018 21:57
I was almost there with B
@JLuboff how were you doing it ?
you still can finish it tough
Jason Luboff
@JLuboff
Mar 08 2018 21:57
Looooops!
Nah I wasn't close at all it seems lol
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 21:59
@gulsvi waiting you :)
Jason Luboff
@JLuboff
Mar 08 2018 21:59

I started with this..

let arr1 = [...Array(n + 1).keys()].slice(1);
let arr2 = [...Array(k +1).keys()].slice(1);

To get my arrays of numbers but I think I'd need to check which is longer to set the loop lengths

Gulsvi
@gulsvi
Mar 08 2018 22:00
@tiagocorreiaalmeida In! :)
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 22:00
I dont know I felt a bit lost and indeed the first one and last one had a really big text for 10min
@JLuboff how confusing was to get used to the basics of c#?
one thing I didnt told you about, you can do the challengs in other languages if you prefer
Jason Luboff
@JLuboff
Mar 08 2018 22:04
@tiagocorreiaalmeida Mmm.. it took a little time and I'm still by no means anything beyond a beginner. A lot of concepts in it that aren't in JS (or not as widely used at least). Like polymorphism and its much more object constructor heavy
alpox
@alpox
Mar 08 2018 22:05
@tiagocorreiaalmeida They seem to have even errors in their tests o.O
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 22:08
really where?
the last one is really.. :D
alpox
@alpox
Mar 08 2018 22:09
@tiagocorreiaalmeida
wordList: ["a", 
 "an a", 
 "to a", 
 "a b", 
 "b", 
 "to b"]
// Expected output: true
Jason Luboff
@JLuboff
Mar 08 2018 22:09
Whooo! got one
alpox
@alpox
Mar 08 2018 22:09

But in their test they say:

and to upset should go before upset

Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 22:09
wait what are we in the same challenge?
you meab the previous one @alpox ?
alpox
@alpox
Mar 08 2018 22:09
Are we not? :D
I'm at the words
Why?
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 22:10
it ended it has a 10min limit you won
first one joining
ahaha
alpox
@alpox
Mar 08 2018 22:10
Oh didn't get that
I rly don't know codefights
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 22:10
no worries my bad sorry @alpox
alpox
@alpox
Mar 08 2018 22:11
But yea too much text and then errors in the tests
I'm not sure if i wanna do more codefights :D
Jason Luboff
@JLuboff
Mar 08 2018 22:11
Shit, I got one done buit have to go to a meeting ugh
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 22:11
yeah sucks I didnt like th big reading tough for 10min had to be alot smaller
I dont think no one will finish the second one
so do the last :D
alpox
@alpox
Mar 08 2018 22:12
@tiagocorreiaalmeida But rly, did i understand that challenge so wrong? The one with the words :D
It seems to me that that test is just plain wrong :D
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 22:12
the issues with some of those challengs is that they are confusing, and you have to findout what to do by just looking at the tests some times
alpox
@alpox
Mar 08 2018 22:13
Well that one makes no sense whatsoever :D
I'd do challenges to help me keep up in real world scenarios
Not for shit xD
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 22:14
yeah inded there's some fights you do against bots here that atually feel a bit like real world or look alot like real world situations give It a try if you want
Gulsvi
@gulsvi
Mar 08 2018 22:18
Yay #4 out of 4 lol
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 22:20
@gulsvi dont worry im usually the last one on the tournaments
also I feel they are just good to make you work under pressure nothing else
Gulsvi
@gulsvi
Mar 08 2018 22:20
It seems coming up with a solution is better than coming up with a good one
@JLuboff only filtered out .com and I would have finished earlier if I had done that - tried to come up with a solution that filtered out any domain extension
Tiago Correia
@tiagocorreiaalmeida
Mar 08 2018 22:21
I used regex to pick what I needed
Ion Varsescu
@Nei-V
Mar 08 2018 22:46
hello, I have a question for the ones with more experience here. I'm almost finnishing the intermediate algorithm scripting on freecodecamp front end curriculum, but I wanted to know if by yhe time I'll complete the front end certification will I have enough knowledge to work in the industry (probably junior fron end developer)? Thank
Brad
@bradtaniguchi
Mar 08 2018 22:53
@Nei-V Maybe, but it depends on what you'll be doing. Its not like you have enough knowledge to be set for life and you don't need to learn anything more. For example you could get work creating a webpage for a client, where you would have a good idea of what needs to be done, but the client say uses React. You'll need to learn that (they teach you it later in fcc) Or they use Angular (which isn't taught by FCC at all), or they use something totally different, say using php.
Ontop of what you learn you might learn that what you did isn't even the best possible solution (some of the easier challenges are 1 liners)
Then there's other things that come to be useful that aren't usually taught by fcc at all. Are you a git pro, do you know testing, you know backend languages besides node, do you know how to work with any cloud providers, do you know about any scripting languages for automation (for devops for the cool hip companies). There's also soft skills, like working with others, writing documentation, meetings, doing requirements, understanding software engineering in general.
Brad
@bradtaniguchi
Mar 08 2018 23:02
So you will have knowledge and some experience after FCC, but you will need to still learn a lot. Depending on whos looking they might be fine with what you have and will hire you and teach you. Or you might have a difficult time as the people they are looking for might want more experience and or knowledge. This sort of stuff is usually dictated by external things (like where you live, where you want to work, country, age, gender, race etc)
Ion Varsescu
@Nei-V
Mar 08 2018 23:05
@bradtaniguchi thanks for the very detailed and eye opening answer
CamperBot
@camperbot
Mar 08 2018 23:05
nei-v sends brownie points to @bradtaniguchi :sparkles: :thumbsup: :sparkles:
:cookie: 416 | @bradtaniguchi |http://www.freecodecamp.org/bradtaniguchi
Brad
@bradtaniguchi
Mar 08 2018 23:06
@Nei-V np, I don't want to scare you I just want to inform you with as much as possible so you get an idea of what to expect. This way you will be able to judge what you'll need todo in the future :D