These are chat archives for FreeCodeCamp/HelpJavaScript

1st
Aug 2018
JJ Megma
@megma_jj_twitter
Aug 01 2018 00:13
hello, I am sorry to be annoying, but every time I try an make a "post" request the data isn't going with the request for some reason?
$("#form-ctrl").on("submit", function(e){
        e.preventDefault()
        let dataArr = $(this).serializeArray()
        let obj = {}
        dataArr.forEach(el =>obj[el.name] = el.value)
        let user = JSON.parse(JSON.stringify(obj))
        console.log(user)
        $.ajax({
            type:"POST",
            url:"http://localhost:3000/api/login",
            data: user,
            success: function(d){
                console.log(d)
            },
            dataType: "json"
        })

    })
Don't mind the JSON.parse and JSON.stringify, that is just me being desperate
Christopher McCormack
@cmccormack
Aug 01 2018 01:24
@JLuboff nope not yet and yeah didn't much like th example
@megma_jj_twitter have you tried it without JSON.parse?
JJ Megma
@megma_jj_twitter
Aug 01 2018 01:25
@cmccormack Yes, and I get "VM9246:1 Uncaught SyntaxError: Unexpected token o in JSON at position 1"
Christopher McCormack
@cmccormack
Aug 01 2018 01:25
ah this is jquery didn't notice that at first
JJ Megma
@megma_jj_twitter
Aug 01 2018 01:26
Christopher McCormack
@cmccormack
Aug 01 2018 01:28
What error are you getting when it is an object
is req.body just empty?
JJ Megma
@megma_jj_twitter
Aug 01 2018 01:29
If I console.log user with out any of the parsing or stringifying
I get an object with expected data
Christopher McCormack
@cmccormack
Aug 01 2018 01:29
I do believe it's supposed to be a string when you assign it to data
JJ Megma
@megma_jj_twitter
Aug 01 2018 01:31
Nope
didn't work
:(
Christopher McCormack
@cmccormack
Aug 01 2018 01:32
not assuming that's the only issue. try adding contentType: 'application/json' to your options
JJ Megma
@megma_jj_twitter
Aug 01 2018 01:32
Oh yes, I believe that is going to be it
yep
That did it
Christopher McCormack
@cmccormack
Aug 01 2018 01:33
awesome
JJ Megma
@megma_jj_twitter
Aug 01 2018 01:33
Thank you so much
Christopher McCormack
@cmccormack
Aug 01 2018 01:33
np
JJ Megma
@megma_jj_twitter
Aug 01 2018 01:33
Why did I have to do that?
Christopher McCormack
@cmccormack
Aug 01 2018 01:33
That's sent to the server for the server to handle, dataType is what you expect as a response
JJ Megma
@megma_jj_twitter
Aug 01 2018 01:34
oh I got that mixed up
Christopher McCormack
@cmccormack
Aug 01 2018 01:35
easy to do, it's all more confusing than it needs to be if you ask me :)
JJ Megma
@megma_jj_twitter
Aug 01 2018 01:35
Yes that does seem a bit silly
Danny Chan
@chandanny
Aug 01 2018 03:26
hello
Simon Cordova
@gbsimon87
Aug 01 2018 07:36
Morning
Blauelf
@Blauelf
Aug 01 2018 07:37
Good morning
abraham anak agung
@padunk
Aug 01 2018 07:59
Good afternoon. Who has learn golang?
tundeiness
@tundeiness
Aug 01 2018 08:03
good morning folks! Trust y'all doing great. So I have a challenge with media query viewport limits. can anyone point me in the direction of the proper viewport limit I can understand and use in my project? The ones I am seeing online are so different one ends up being confused. I applied it and it messed up my design flow. Any help please?
Jefferson
@jeffersonnnn
Aug 01 2018 08:22
hi guys, so i want to inplement the pomodoro timer in javascript; does anyone know if i need to throw in Redux into the mix?
abraham anak agung
@padunk
Aug 01 2018 08:24
@jeffersonnnn most of the time you don't need Redux
Jefferson
@jeffersonnnn
Aug 01 2018 08:25
hmm. that is a thought worth pursuing. @padunk
abraham anak agung
@padunk
Aug 01 2018 08:32
@jeffersonnnn in my opinion Redux is best use for large project where you need to pass data to many components.
Pomodoro Timer don't need that.
Jefferson
@jeffersonnnn
Aug 01 2018 08:37
@padunk thanks for the advice kind online stranger.
catalin560
@catalin560
Aug 01 2018 08:52
hey guys! is there a way to switch from swipe left/right to up/down on mobile devices?
I got this slider that on portrait orientation I use transform rotate to make it look like landscape, but I can't figure out how to also switch swipe left/right...
alpox
@alpox
Aug 01 2018 09:02
@catalin560 I don't think thats going to work :(
The logic for the swipe is very likely implemented only one way
I did not so well understand in what case you do the transform?
catalin560
@catalin560
Aug 01 2018 09:05
@alpox
@media screen and (max-width: 767px) and (min-width: 320px) and (orientation: portrait) {
    .pswp {
        transform: rotate(-90deg);
        /* transform-origin: left top; */
        width: 100vh;
        height: 100vw;
        overflow-x: hidden;
        position: absolute !important;
        top: 100%;
        left: 0;
    }
}
@media screen and (min-width: 320px) and (max-width: 767px) and (orientation: landscape) {
    .pswp {
        width: 100vw;
        height: 100vh;
        overflow-y: hidden;
    }
}
alpox
@alpox
Aug 01 2018 09:06
Doesn't it change the orientation of pictures etc. when you rotate it? Is that wanted?
I mean the page automatically turns 90 deg when the phone changes the orientation
catalin560
@catalin560
Aug 01 2018 09:07
the idea is if you're holding the phone in portrait orientation it should force you to switch to landscape to better see the images
alpox
@alpox
Aug 01 2018 09:08
Hmm so you want to make a visual effect so they likely change?
catalin560
@catalin560
Aug 01 2018 09:08
yea
well.. if I can't manipulate swipe direction then maybe I'll disable it entirely on portrait orientation
alpox
@alpox
Aug 01 2018 09:09
I think I would hate that :D (But thats personal preference)
Well the swipe direction cannot be changed unless they implemented that in their component (Which is unlikely)
catalin560
@catalin560
Aug 01 2018 09:14
@alpox anyhow thank you very much for your feedback!
abraham anak agung
@padunk
Aug 01 2018 09:21
Hi all, is there any onResize event in React? like in JS?
alpox
@alpox
Aug 01 2018 09:25
@padunk window.addEventListener('resize', ...) :)
abraham anak agung
@padunk
Aug 01 2018 09:26
@alpox just that? where you put it?
alpox
@alpox
Aug 01 2018 09:27
@padunk Depends on where you need it
If you just need a global one with no access to whatsoever you can put it into your index.js
If you need it to have access to component stuff, you can put it in the componentDidMount and remove the eventhandler in componentWillUnmount
abraham anak agung
@padunk
Aug 01 2018 09:29
@alpox cool, lemme try it. Thanks.
alpox
@alpox
Aug 01 2018 09:29
handleResize() { ... }
componentDidMount() {
  window.addEventListener('resize', this.handleResize);
}
componentWillUnmount() {
  window.removeEventListener('resize', this.handleResize);
}
@padunk
hensn5250
@hensn5250
Aug 01 2018 09:29
@alpox Hello
alpox
@alpox
Aug 01 2018 09:30
@hensn5250 :wave:
hensn5250
@hensn5250
Aug 01 2018 09:30
you helped me get a better grasp of the minimax algo about a week ago
would like you to check out another tictactoe game, if possible
alpox
@alpox
Aug 01 2018 09:32
@hensn5250 I can try :D
Which one?
its super TTT. I haven't added the AI in yet
alpox
@alpox
Aug 01 2018 09:33
@hensn5250 Huh. So you play 9 tic-tac-toe at once? :D
hensn5250
@hensn5250
Aug 01 2018 09:34
yea. Its TTT in TTT. The square you select picks the board for your opponent
alpox
@alpox
Aug 01 2018 09:35
I see :D
hensn5250
@hensn5250
Aug 01 2018 09:35
to win you have to win 3 boards in a row
alpox
@alpox
Aug 01 2018 09:35
Quite funny
But I don't really understand when one is allowed to play which TTT
hensn5250
@hensn5250
Aug 01 2018 09:37
what do you mean by when one is allowed to play?
abraham anak agung
@padunk
Aug 01 2018 09:38
@alpox it worked! Thanks.
@hensn5250 That is a crazy TTT :smile:
alpox
@alpox
Aug 01 2018 09:40
@padunk You're welcome :)
@hensn5250 The TTT light up in green when you can play in them
This seems very random and sometimes you can play all and sometimes only one randomly
hensn5250
@hensn5250
Aug 01 2018 09:42
Yea its confusing at first. Here are the rules
@padunk here is the game with AI added(found it via google), game link. Its pretty challenging.
abraham anak agung
@padunk
Aug 01 2018 09:52
@hensn5250 i win :smile: but the randomness doesn't make sense. Like @alpox said, it is very random the way the algo select which TTT section you can play
hensn5250
@hensn5250
Aug 01 2018 09:54
The first link is the one I coded. It has no AI so you are playing both X and Y ....* both X and O
The second link I posted is code by some guy, his game has AI so you are against the computer. The rule for the game are here
alpox
@alpox
Aug 01 2018 09:57
@padunk @hensn5250 Yea where to play makes sense now
@hensn5250 But the other super TTT of that guy works different than yours
In yours, sometimes you can choose from any of the TTT
In his, this never happens
(except at the beginning)
When you'd have to play in a TTT which is already solved, in his version you have to still play in the solved TTT anyway
hensn5250
@hensn5250
Aug 01 2018 10:00
The only time you can choose from any square is if your opponent selects a square/board that is already won
In his game the computer doesn't/hardly makes mistakes
In mine you are playing for both X and O... so you are playing a two player game by yourself
alpox
@alpox
Aug 01 2018 10:01
@hensn5250 You can choose that option in his version too
hensn5250
@hensn5250
Aug 01 2018 10:02
really? didn't know
alpox
@alpox
Aug 01 2018 10:02

In his rules he states:

If your opponent sends you to a board that's already been won, you must play in that board in there is a free square.

hensn5250
@hensn5250
Aug 01 2018 10:02
right right
that's different
alpox
@alpox
Aug 01 2018 10:03
@hensn5250 But
I actually believe his version is wrong

Because in the link he shows about the rules, it says:

What if my opponent sends me to a board that’s already been won? In that case, congratulations – you get to go anywhere you like, on any of the other boards. (This means you should avoid sending your opponent to an already-won board!)

hensn5250
@hensn5250
Aug 01 2018 10:04
yea, not sure what his rules are. I followed the rules from wikipedia
alpox
@alpox
Aug 01 2018 10:05
@hensn5250 Yea that rules are maybe better. The one from that guy is wrong
hensn5250
@hensn5250
Aug 01 2018 10:07
Yea wiki rules state, Once the outcome of a local board is decided (win or draw), no more moves may be played in that board.
alpox
@alpox
Aug 01 2018 10:07
Yes I saw that :D
hensn5250
@hensn5250
Aug 01 2018 10:09
I've been searching for winning strategies to apply to the AI but can't find any
alpox
@alpox
Aug 01 2018 10:10
@hensn5250 Its much harder for this kind of game especially with minimax (Probably not possible because of speed reasons)
But wikipedia says something about the Monte Carlo algorithm
Maybe that helps
hensn5250
@hensn5250
Aug 01 2018 10:11
yea I seen that, will look more into it. It sounds like some machine learning stuff.
hensn5250
@hensn5250
Aug 01 2018 10:18
@alpox @padunk later
Blauelf
@Blauelf
Aug 01 2018 11:38
Monte Carlo must have been a great guy, with all those things named after him :joy:
Blauelf
@Blauelf
Aug 01 2018 11:44
I've done Monte Carlo Simulations before. We used a simple thermodynamic model (acceptance probability goes with eUkTe^{-\frac{U}{k T}}), it might be interesting to see how to weight the different outcomes in the model. Like if I win in two of two runs, can I make any predictions on my win probability, and how much will a third run probably change the result? And wouldn't the opponent do the same, so I have to do some minimax-like level-wise weighing?
Nate Mallison
@NJM8
Aug 01 2018 13:42
Who wants to help with some regex. :smile:
Here is the regex: /(Form|Input)[A-Z]\w+\.(vue|js)$/
and the result: "./formComponents/FormRowTitle.vue", "./inputComponents/InputAddress.vue"
I want to strip the ./formComponents and ./inputComponents
but only if the exist
alpox
@alpox
Aug 01 2018 13:45
@NJM8 So you always only want the ending?
I mean the file name
Also, is this in nodejs?
Nate Mallison
@NJM8
Aug 01 2018 13:54
@alpox It's a webpack thing, but I guess yes node. I only want the ending yes, actually I only need to strip the /formComponents and /inputComponents, the rest gets stripped later
so it captures ./formComponents/FormRowTitle.vue and I want it to capture ./FormRowTitle.vue
alpox
@alpox
Aug 01 2018 13:55
@NJM8 I was just asking because if you only need the filenames you can do:
const path = require('path');
path.basename("./formComponents/FormRowTitle.vue");
Nate Mallison
@NJM8
Aug 01 2018 13:57
hmmm. that might work. I'm doing some dynamic global module registration with webpack in a VueJS project.
alpox
@alpox
Aug 01 2018 13:57
I wonder if thats a good idea but i'll let that be up to you :D
alpox
@alpox
Aug 01 2018 14:03

@NJM8 I think a better solution would be to add them all to an ./formComponents/index.js where you export them all from one place:

export * from './FormRowTitle.vue';
export * from './AnythingElse.vue';

and then register them:

import * as formComponents from './formComponents';

for(const componentName in formComponents)
  Vue.component(componentName, formComponents[componentName]);
uses webpack to automatically register components of a given base name
So all I have to do is create it and use it
alpox
@alpox
Aug 01 2018 14:06
Hmm okay, weird thing
Nate Mallison
@NJM8
Aug 01 2018 14:07
yup. It is pretty funny, but cool
alpox
@alpox
Aug 01 2018 14:08
Hmm maybe
I'm not much of a fan of webpack trickery
Nate Mallison
@NJM8
Aug 01 2018 14:30
@alpox I don't have enough experience to know better but this is where it came from: https://www.youtube.com/watch?v=7lpemgMhi0k&t=766s
Jason Luboff
@JLuboff
Aug 01 2018 15:05
Morning :wave:
Christopher McCormack
@cmccormack
Aug 01 2018 15:30
@JLuboff heya
Jason Luboff
@JLuboff
Aug 01 2018 15:32
@cmccormack What up
Christopher McCormack
@cmccormack
Aug 01 2018 15:32
@JLuboff you know, working, trying to pay those internet bills
Keep thinking I can catch up so put in 12 hour days, but I haven't been able to just yet :/
Jason Luboff
@JLuboff
Aug 01 2018 15:34
Dang..12 hour days? Sounds like you're behind!
Christopher McCormack
@cmccormack
Aug 01 2018 15:35
yeah. 12 hour days don't bother me too much as I work at home and don't have kids, but it would be nice to do something other than work in the evenings
Jason Luboff
@JLuboff
Aug 01 2018 15:35
I imagine your wife would like to spend some time with you too
Christopher McCormack
@cmccormack
Aug 01 2018 15:36
Nah she has her own things to do too haha
she normally works more hours than I do
Jason Luboff
@JLuboff
Aug 01 2018 15:36
Ah... fair enough
Christopher McCormack
@cmccormack
Aug 01 2018 15:36
What are you up to?
Jason Luboff
@JLuboff
Aug 01 2018 15:38
Running through my querying SQL notes right now. Have my test a week from today. Have a computer that came in that has some issue (don't know what though). And.. might start on the exercise tracker today..maybe..
Christopher McCormack
@cmccormack
Aug 01 2018 15:38
It's great that you have a SQL project for work while you're studying for it, can't ask for a better way to immerse yourself before the exam
Jason Luboff
@JLuboff
Aug 01 2018 15:40
Exactly. Unfortunately, I don't have anything thats overally advanced for my queries (some I would say are intermediate..) but it's definitely helped
Tom
@moT01
Aug 01 2018 15:42
:poodle:
Christopher McCormack
@cmccormack
Aug 01 2018 15:42
Poodle eh?
I don't get it :(
Tom
@moT01
Aug 01 2018 15:43
there's nothing to get
Christopher McCormack
@cmccormack
Aug 01 2018 15:43
oh, then I get it!
Jason Luboff
@JLuboff
Aug 01 2018 15:43
You're looking too far into it
Christopher McCormack
@cmccormack
Aug 01 2018 15:43
@moT01 morning
Tom
@moT01
Aug 01 2018 15:43
just making my presence known
and now you know
Christopher McCormack
@cmccormack
Aug 01 2018 15:47
:checkered_flag:
@moT01 working on anything today?
Tom
@moT01
Aug 01 2018 15:51
i was going to try and get the responsive web cert finished
since you're doing other stuff
and maybe we can still tag team the exercise tracker at some point
two projects to do
landing page and technical documentation page
and I had a thought on an article to write for fcc's medium page as I starting the first one
Christopher McCormack
@cmccormack
Aug 01 2018 15:55
@moT01 ohh fun what article?
Tom
@moT01
Aug 01 2018 15:55
so I might do that
Christopher McCormack
@cmccormack
Aug 01 2018 15:55
@JLuboff might also start the exercise tracker soon
Tom
@moT01
Aug 01 2018 15:55
old site vs new site
Christopher McCormack
@cmccormack
Aug 01 2018 15:55
@moT01 FCC Site?
Tom
@moT01
Aug 01 2018 15:56
yes
i guess that might not be that great since the old site is gone
kind of a pros and cons/ things I like
Christopher McCormack
@cmccormack
Aug 01 2018 15:56
I think if you keep it general enough it could be useful.
Things I don't like: easy pull request fixes still don't seem to be implemented
not sure if this is old vs new though
Tom
@moT01
Aug 01 2018 15:58
what do you mean by that - a lag in the time to merge PR's?
Christopher McCormack
@cmccormack
Aug 01 2018 15:58
but there are lots of issues in the new site that should be easy fixes
like the CDN links for the test suite - something that should have been fixed the moment they changed the CDN
Tom
@moT01
Aug 01 2018 15:58
right
that's fixed now right?
Christopher McCormack
@cmccormack
Aug 01 2018 15:59
might be finally
but I watched that sit there for a while with no update
Tom
@moT01
Aug 01 2018 16:00
i think it is
Christopher McCormack
@cmccormack
Aug 01 2018 16:00
yeah just checked and now the link works
Tom
@moT01
Aug 01 2018 16:00
yea, that's an easy fix
i think some of the core guys like to leave some of the easier stuff for new contributors - and theyre probly trying to do the harder stuff
Christopher McCormack
@cmccormack
Aug 01 2018 16:01
But the pull request was submitted and just sat there for a while
Tom
@moT01
Aug 01 2018 16:01
but that one is kind of crucial
Christopher McCormack
@cmccormack
Aug 01 2018 16:02
I went back and checked every day for like a week and it was still there
Tom
@moT01
Aug 01 2018 16:02
ill add it to the list
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:02
I am trying to use different html files depending on which url is in the browser, I thought this would work but it gives a type error as well as when I tried to use sendFile(_dirname+"/subpage") instead of redirect
const server=http.createServer(function(req,res){
    let pathname=url.parse(req.url).pathname;
    switch(pathname){
        case '/subpage':
            res.redirect("http://localhost.com/subpage");
        break;
        default:
            res.redirect("http://localhost.com");
        break;
    }

}).listen(3000);
Christopher McCormack
@cmccormack
Aug 01 2018 16:02
I guess it's hard to know what it's like for those that actually have to approve the pull requests though
Tom
@moT01
Aug 01 2018 16:03
i have yet to merge something - I do have the ability though
Christopher McCormack
@cmccormack
Aug 01 2018 16:03
oh I should have pinged you then - that was probably the easiest most useful PR I could imagine
Tom
@moT01
Aug 01 2018 16:03
yea, some typo merges would be real easy - I should give it a try
im actually not sure the best way to test it - even though I probly dont need to test a typo
Christopher McCormack
@cmccormack
Aug 01 2018 16:04
I think that would be very useful, to have someone cleanup the minor stuff quickly
Tom
@moT01
Aug 01 2018 16:04
how to pull in a branch to my local version
Christopher McCormack
@cmccormack
Aug 01 2018 16:04
do you need to test? I thought they required it to pass the test suite anyhow?
Tom
@moT01
Aug 01 2018 16:05
you are supposed to run a test, yes - but I think QA's are also supposed to test it locally - but for a typo?
im not sure - there's probly some docs on QAing
Christopher McCormack
@cmccormack
Aug 01 2018 16:05
@megma_jj_twitter what is throwing the error?
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:06
"TypeError: res.redirect is not a function"
gives same error for sendFile
It works if I'm not using the switch statement
Ive had a lot of weird things with this
Christopher McCormack
@cmccormack
Aug 01 2018 16:06
@moT01 yeah that seems pretty cumbersome. I wanted to fix a few types myself but having to clone the repo and run everything locally just to pass the tests seems crazy to me
Tom
@moT01
Aug 01 2018 16:07
it's not easy just to get the repo running
which is something I can add to the list
constant people having problems there
Christopher McCormack
@cmccormack
Aug 01 2018 16:08
@megma_jj_twitter when you say "It works if I'm not using the switch statement" - what specifically worked?
@moT01 didn't they break it up recently into different repos without providing the full documentation?
Tom
@moT01
Aug 01 2018 16:08
why are you using a switch statement in the first place? @megma_jj_twitter
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:09
@moT01 Because I don't know of any other way to do it and I found this on a stack overflow post
app.get('/', function(req, res) {
  res.sendFile(__dirname + '/views/index.html');
});
this works fine
@cmccormack
Christopher McCormack
@cmccormack
Aug 01 2018 16:10
@megma_jj_twitter did redirect work too?
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:10
I didn't try it there
Christopher McCormack
@cmccormack
Aug 01 2018 16:11
app.get is express, I don't know if your previous code snippet even takes the req, res parameters
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:11
So, how do I direct different urls to show different static html pages?
These are the ways I am seeing on stackoverflow
Tom
@moT01
Aug 01 2018 16:12
    let pathname=url.parse(req.url).pathname;
    switch(pathname){
        case '/subpage':
            res.redirect("http://localhost.com/subpage");
im confused - wouldnt the user already be on whatever page
Christopher McCormack
@cmccormack
Aug 01 2018 16:12
@megma_jj_twitter if you're using express, create your server first and handle the endpoints using express middleware
Tom
@moT01
Aug 01 2018 16:12
i go to /subpage - only to get redirected to /subpage
Christopher McCormack
@cmccormack
Aug 01 2018 16:12
http.createServer([options][, requestListener])
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:13
The original code wasn't res.redirect()
It was res.end("some text")
Christopher McCormack
@cmccormack
Aug 01 2018 16:13
@megma_jj_twitter I don't understand why you moved from express to createServer in the first place
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:13
I added redirect just to try it
Tom
@moT01
Aug 01 2018 16:13
i would add a .get for /subpage just like your / - and render whatever you need there
Christopher McCormack
@cmccormack
Aug 01 2018 16:14
agreed
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:14
You guys are thinking I'm better then I am lol
I have no idea why I used createServer
Christopher McCormack
@cmccormack
Aug 01 2018 16:14
@megma_jj_twitter it really helps to read up on the docs for this
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:14
It was just on stackoverflow
Christopher McCormack
@cmccormack
Aug 01 2018 16:14
I read the express docs several times and I'm still an amateur
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:14
I have no reasoning behind anything
Tom
@moT01
Aug 01 2018 16:14
fcc's express lessons are great - https://learn.freecodecamp.org/apis-and-microservices/basic-node-and-express - i just went through them
Christopher McCormack
@cmccormack
Aug 01 2018 16:15
@moT01 oh yeah good point!
Jason Luboff
@JLuboff
Aug 01 2018 16:15
Ya createServer is vanilla node, no need for it in express as you're using app.listen()
Christopher McCormack
@cmccormack
Aug 01 2018 16:15
Keep forgetting they now exist, as they weren't in the old curriculum
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:16
so are you guys saying to do this?
app.get('/', function(req, res) {
  res.sendFile(__dirname + '/views/index.html');
});


app.get('/subpage', function(req, res) {
  res.sendFile(__dirname + '/views/login.html');
});



let port = process.env.PORT || 3000;

app.listen(port, function() {
  console.log(`Listening on port ${ port }`);
});
Christopher McCormack
@cmccormack
Aug 01 2018 16:16
@megma_jj_twitter basically yeah
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:16
Yes, that does not work.
Tom
@moT01
Aug 01 2018 16:17
@megma_jj_twitter that's probly how I would do it
Christopher McCormack
@cmccormack
Aug 01 2018 16:17
what error are you getting?
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:17
That was my first original solution
then I went off the walls an tried anything an everything lol
Christopher McCormack
@cmccormack
Aug 01 2018 16:17

Yes, that does not work.

This is the least helpful feedback if you are looking for help, btw, please provide errors and detail

JJ Megma
@megma_jj_twitter
Aug 01 2018 16:17
I am getting it for you, 1 sec
Have to run the code
Tom
@moT01
Aug 01 2018 16:18
that should be close to working - and is a better way I think @megma_jj_twitter
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:18
ok What the hell
I swear
Christopher McCormack
@cmccormack
Aug 01 2018 16:18
@megma_jj_twitter now may be a good time to learn how to use an SVN like git and github, btw. if you start using those tools, it makes it very easy to share the code with others
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:18
It was not working before
lol
I fucking works now
Christopher McCormack
@cmccormack
Aug 01 2018 16:18
@megma_jj_twitter :joy:
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:18
lol
Thank you guys
For pointing me back to my original solution an then it working
?
lol
I just needed your guys presence to make it work
Christopher McCormack
@cmccormack
Aug 01 2018 16:19
you're welcome I guess
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:19
:laughing:
Christopher McCormack
@cmccormack
Aug 01 2018 16:19
:)
Tom
@moT01
Aug 01 2018 16:19
@megma_jj_twitter come back any time
Jason Luboff
@JLuboff
Aug 01 2018 16:19
Glad I could be here to watch the help occur
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:19
Yes, I like it here a lot, I always get great help
You guys are great
Christopher McCormack
@cmccormack
Aug 01 2018 16:19
But take @moT01 advice and check out the FCC curriculum for node/express, it's pretty good, and forces you to do it in a real environment
Tom
@moT01
Aug 01 2018 16:19
just to chat as well @megma_jj_twitter
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:20
:){
Thank you
Jason Luboff
@JLuboff
Aug 01 2018 16:25
...Nothing like having a computer sent in that has no problem...
Christopher McCormack
@cmccormack
Aug 01 2018 16:25
@JLuboff does that count as 2 hours of paid work? :)
Jason Luboff
@JLuboff
Aug 01 2018 16:26
Eh... if I had to charge...sure lol
Christopher McCormack
@cmccormack
Aug 01 2018 16:27
I constantly think of breaking away from my current position and go consultant, the pay would be good but it would be so much work
but you could make like $200 for a computer repair - imagine if it wasn't even broken!
Jason Luboff
@JLuboff
Aug 01 2018 16:30
Honestly... I don't know how computer repair shops stay in business.. there's a reason I got out of that. You can buy a new computer for $400 (not saying its a great computer, but probably sufficient for most)
Brad
@bradtaniguchi
Aug 01 2018 16:31
People don't like change yo haha
Christopher McCormack
@cmccormack
Aug 01 2018 16:32
A shop doesn't make sense to me either unless it's really cheap rent
Brad
@bradtaniguchi
Aug 01 2018 16:32
idk how physical businesses stay in business in general haha
Christopher McCormack
@cmccormack
Aug 01 2018 16:32
but I wouldn't suggest consulting for normal people, but for business instead
Rents are high, small businesses will move out, owners will need new business, lower rents, big companies like Amazon will move in
This is my prediction
Tom
@moT01
Aug 01 2018 16:34
there's still a big need for a lot of physical businesses
Jason Luboff
@JLuboff
Aug 01 2018 16:35
I think most shops here stay in business becuase they do consultant work for companies...otherwise..I'm not really sure. Given..labor is retardedly expensive for repairs. We charged $135/hr for repair work. Repair work was anywhere from .5-2 hours depending on what needed to be done. I was paid between $18-22/hr (depending on how many jobs I got done and when of my time there we're speaking of)
So...a lot of money was still going to the shop that wasn't my hourly wage
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:41
How long have you all been coding for?
Jason Luboff
@JLuboff
Aug 01 2018 16:41
mmm... 2ish years?
Tom
@moT01
Aug 01 2018 16:42
2 years - pretty heavy - with some off and on past experience/projects
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:42
Only Javascript? or any other languages?
Jason Luboff
@JLuboff
Aug 01 2018 16:43
Javascript + Node (which i mean..is JS..but..different), C# (little bit), SQL, Mongo (yes those are databases, but still require programming)
Tom
@moT01
Aug 01 2018 16:44
i know all of them
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:45
I have been for almost 1 year. But I constantly find stupid stuff to get stuck on.
Tom
@moT01
Aug 01 2018 16:45
that will probly never go away
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:46
:(
Jason Luboff
@JLuboff
Aug 01 2018 16:46
@megma_jj_twitter I'm constantly getting help still. I'm sure @alpox is tired of me by now :joy:
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:47
It sort of feels never ending
Like I have had several times where I feel like I know everything and I'm a God
But I get humbled every time
Jason Luboff
@JLuboff
Aug 01 2018 16:48
Welcome to programming :)
Tom
@moT01
Aug 01 2018 16:49
that probly wont go away either
Kudzu
@czhower
Aug 01 2018 16:49
I've been programming nearly 35 years and I still dont know everytyhing.
JJ Megma
@megma_jj_twitter
Aug 01 2018 16:49
It is never ending!
Tom
@moT01
Aug 01 2018 16:50
yup
Kudzu
@czhower
Aug 01 2018 16:50
I love to learn, so programming is great. Always something to learn.
Brad
@bradtaniguchi
Aug 01 2018 16:53
@megma_jj_twitter If you ever feel like you know everything, stop... you don't, no one does haha
see even old @czhower doesn't know everything :P
Kudzu
@czhower
Aug 01 2018 16:54
Only a fool would claim to know everything.
Christopher McCormack
@cmccormack
Aug 01 2018 16:59
@megma_jj_twitter check out the latest FreeCodeCamp Podcast - the latest episode is about this exact topic
Kudzu
@czhower
Aug 01 2018 17:01
When I used to interview for hires a lot, over confidence was often a reason we declined to hire. Id rather have a mid level dev who knows his limits than an even a more senior dev who thinks they know it all.
Christopher McCormack
@cmccormack
Aug 01 2018 17:04
I wish it were easier for interviewees to understand what the interviewers were going to expect
I try to ask questions prior to the interview but the answers are always "be yourself and make sure you prepare"
Tom
@moT01
Aug 01 2018 17:09
you calling me a fool
@czhower
Kudzu
@czhower
Aug 01 2018 17:09
If you think you know everything.
Tom
@moT01
Aug 01 2018 17:10
i dont
i said I did sarcastically though
i have the same opinion
Brad
@bradtaniguchi
Aug 01 2018 17:54
it has begun... the great refactoring for clean code!!!
Jason Luboff
@JLuboff
Aug 01 2018 18:05
@bradtaniguchi So it begins... it was the best of times...it was the worst of times...
Brad
@bradtaniguchi
Aug 01 2018 18:10
I might go mad after this refactor...
I want to test things, and had concerns things wont be "very testible" and I was right. Utility classes inject nearly all functionality from the entire app (data-base connections, to all drivers
luccifer00
@luccifer00
Aug 01 2018 18:46
hello, i am getting crazy with one thing i that i can not understand .... can i pm someone? pleasee...
Jason Luboff
@JLuboff
Aug 01 2018 19:03
Better to just post it here so anyone can answer
luccifer00
@luccifer00
Aug 01 2018 19:08
i did it before :sweat_smile: but i dont get the real answer to my problem. do u mind if i pm u @JLuboff
Simon Cordova
@gbsimon87
Aug 01 2018 19:09
Whats up whats up
Jason Luboff
@JLuboff
Aug 01 2018 19:09
I may not know the answer :smile: and I'm going to be stepping away soon...but post it up on here, there's others who are lurking who may be able to answer
luccifer00
@luccifer00
Aug 01 2018 19:10
hahaa thanks
Simon Cordova
@gbsimon87
Aug 01 2018 19:10
@luccifer00 were you able to figure out what you needed help with?
Sorry I haven't been able to reply I've just been crazy with interviews and life admin
Jason Luboff
@JLuboff
Aug 01 2018 19:11
@gbsimon87 Got a few interviews in? How'd they go?
Simon Cordova
@gbsimon87
Aug 01 2018 19:12
Hey @JLuboff
They actually went really well - just like my last in person interview, they told me I'd be walking out with an offer if they didn't have to sort out the sponsorship visa logistics
Jason Luboff
@JLuboff
Aug 01 2018 19:12
@gbsimon87 So....what does that mean? They don't want to go through the effort or that they'll try?
Simon Cordova
@gbsimon87
Aug 01 2018 19:13

But good overall - got a technical question I was not expecting
It was basically 'what tools and steps can be implemented to ensure that an application maintains scalability and maintenance'

It means they'll be calling me by Friday latest to inform whether they're in a position to go forth

They need someone immediately, but unfortunately I can't legally start as I don't have a working permit in the UK
Jason Luboff
@JLuboff
Aug 01 2018 19:14
Tell them you'll work off the books until they get that handled ;)
Simon Cordova
@gbsimon87
Aug 01 2018 19:14
lol - that was vaguely hinted at both sides but I didn't want to continue with that
one they're a well established company and I'm pretty sure they wouldn't do that, secondly I don't want to seem like I'd be willing to do something illegal
But it was certainly hinted at lolol
Jason Luboff
@JLuboff
Aug 01 2018 19:15
Haha
Simon Cordova
@gbsimon87
Aug 01 2018 19:16
Man I had like 5 interviews on the phone and 1 in person today - getting a job with a sponsorship is FULL time job damn
Jason Luboff
@JLuboff
Aug 01 2018 19:16
Hey man, thats more interviews than many could say they've had
Simon Cordova
@gbsimon87
Aug 01 2018 19:19
I know - I'm grateful that my CV and honest effort I've put into programming is paying off - it's just a shame I'm not an expert to be easily considered to be sponsored
I've been to the last stage of interviews 4 times now but have lost to candidates that didn't need it
Jason Luboff
@JLuboff
Aug 01 2018 19:19
Ya...thats understandably tough
Simon Cordova
@gbsimon87
Aug 01 2018 19:26
It's no joke trust me
I've currently got 3 leads, so hopefully one hits, if not, I think home calls my name
Anyways lady was promised a date night so off I go before I get called out
lol
good night al
all**
Jason Luboff
@JLuboff
Aug 01 2018 19:40
See ya
Brad
@bradtaniguchi
Aug 01 2018 20:04
this code... I thought I was close to done, I was only 1/4th thru a file OF JUST REVIEWING IT FOR OBVIOUS ISSUES
Luckily I didn't see many, but there are a lot of ways to improve this code
Jason Luboff
@JLuboff
Aug 01 2018 20:37
@bradtaniguchi There's always ways to improve!
Jason Luboff
@JLuboff
Aug 01 2018 20:58
Here's a OOP question (or more specifically.. C#). I have a simple property private static int personID { get; set; } which does what I need (gets...or sets... the value). But VS linter is suggesting I turn it into a method, but I don't see why that would be the better solution? It isn't complex and according to MS own documentation methods represent actions and properties represent data
Brad
@bradtaniguchi
Aug 01 2018 21:08
Who names their variable rr???
Kudzu
@czhower
Aug 01 2018 21:17
Does the linter give a number or ID? or can you give the exact text? I assume its a warning?
Jason Luboff
@JLuboff
Aug 01 2018 21:22
@czhower It's a Quick Action, not even a warning.. Text is Replace 'personID' with Methods
Here's a screenshot
image.png
alpox
@alpox
Aug 01 2018 21:31
@JLuboff Your linter is being dumb :D
Jason Luboff
@JLuboff
Aug 01 2018 21:32
lol
It's just the default built in VS Community one
Which is why I was confused as it didn't really seem to make sense to me
Kudzu
@czhower
Aug 01 2018 21:34
thats a refactor option. It can hint, but its not really a linter.
Thats why there is more than one option presented to you.
A hint will show a yellow lightbulb... that one is not that.
Jason Luboff
@JLuboff
Aug 01 2018 21:36
Is it not the linter that is determining that though?
alpox
@alpox
Aug 01 2018 21:36
I guess one can set preferences for it too so it favors properties
Kudzu
@czhower
Aug 01 2018 21:37
no. C# doesnt really have a "linter" in the JS sense.
Jason Luboff
@JLuboff
Aug 01 2018 21:38
Ok
Kudzu
@czhower
Aug 01 2018 21:38
C# has is typesafe and has a compiler, so the comiler will and can issue warnings. And then there are things that are like linters like fxcop (old name, now its included IIRC under a diff name in VS, code hints or something)
but in general in a static verfied lang like C#, you dont really require a linter like you do in JS.
Jason Luboff
@JLuboff
Aug 01 2018 21:40
Got it, thanks for clearing that up
Kudzu
@czhower
Aug 01 2018 21:40
Typically a linter is replaced by a code anaylzer, but most people dont even use those becase C# as a lang does most of the really important ones for you as a lang feature, or hints from the compiler (unused vars, etc)
C# wont ever let you dump a string into a number without conveting it etc....
and thats just the start of the protections it has as a language.
Jason Luboff
@JLuboff
Aug 01 2018 21:44
Ya true.. the conversions get me sometimes but it tells you quick enough
Brad
@bradtaniguchi
Aug 01 2018 22:33
Its interesting and kinda nice to be working back on my laptop, rather than my desktop. Kinda miss the feel of its keys
Jason Luboff
@JLuboff
Aug 01 2018 22:35
Its funny how people get so used to their keyboards
I've had multiple people keep their old, nasty keyboards becuase they like the feel of it
Brad
@bradtaniguchi
Aug 01 2018 22:36
Its one thing to care about the layouts (I can't work on a mac keyboard, not used to the layout) but otherwise I could care less. But my laptop keyboard has that "shallow" feel, so I guess its comparable to a mac's keyboard in that sense
Jason Luboff
@JLuboff
Aug 01 2018 22:37
Eh... the layouts really not that different
Brad
@bradtaniguchi
Aug 01 2018 22:38
different enough hehe
Jason Luboff
@JLuboff
Aug 01 2018 22:38
Installed this sweet add-in tool for SQL studio manager thats 10 fold better than the built in intellisense
Brad
@bradtaniguchi
Aug 01 2018 22:43
nice, I'm addicted to intellisense, not having it for something is intellinon-sense :trollface:
Jason Luboff
@JLuboff
Aug 01 2018 22:45
Ya it's really neat
Brad
@bradtaniguchi
Aug 01 2018 22:55
back to my desktop computer, done with my "side-task" for now... back to the great refactor project