These are chat archives for FreeCodeCamp/HelpJavaScript

6th
Apr 2018
Rahsheen Porter
@rahsheen
Apr 06 2018 00:00
Formal education in CS is helpful for context, but definitely not a requirement.
I'm a dummy.
Rahsheen Porter
@rahsheen
Apr 06 2018 00:02
Holy crap. Did he really say that? Wow
Smootimus
@Smootimus
Apr 06 2018 00:03
Computer Science in particular isn't specific to programming
Programming is a side-effect of computer science
Joseph
@revisualize
Apr 06 2018 00:03
Let's find out.
Smootimus
@Smootimus
Apr 06 2018 00:04
Computer Science is mathematical in nature. Software Development in particular isn't
Brad
@bradtaniguchi
Apr 06 2018 00:04

Programming is a side-effect of computer science

I like that quote

Smootimus
@Smootimus
Apr 06 2018 00:04
:) You can use it lol
Joseph
@revisualize
Apr 06 2018 00:05
Actually, It doesn't look like he really said that.
Smootimus
@Smootimus
Apr 06 2018 00:05
lmao
Joseph
@revisualize
Apr 06 2018 00:06
/collapse-all
Rahsheen Porter
@rahsheen
Apr 06 2018 00:06
Damn, it's like that? 😂
Brad
@bradtaniguchi
Apr 06 2018 00:06
gotta watch out for that fake news haha
Smootimus
@Smootimus
Apr 06 2018 00:07
*alternative news
Joseph
@revisualize
Apr 06 2018 00:13
Anyhow.
I still don't understand how I was wrong. But, apparently I was.
Smootimus
@Smootimus
Apr 06 2018 00:13
No you weren't
lol
Joseph
@revisualize
Apr 06 2018 00:13
But, hey, at least in this time I've been able to sharpen a bunch of my knives.
Smootimus
@Smootimus
Apr 06 2018 00:14
Fo sho
Joseph
@revisualize
Apr 06 2018 00:14
I only have a 600 grit stone though.. So, meh.
Smootimus
@Smootimus
Apr 06 2018 00:14
Over here listeni' to Young Buck - Shawty wanna ride with me xD!!
Joseph
@revisualize
Apr 06 2018 00:16
I finally got my two Kabar LDK https://www.amazon.com/Ka-Bar-Enforcement-Ditch-Knife-Sheath/dp/B009F35PFI sharp to 600 grit
Smootimus
@Smootimus
Apr 06 2018 00:17
I want something like a Schrade
Fixed
Joseph
@revisualize
Apr 06 2018 00:18
I put a 17degree edge on them.
Smootimus
@Smootimus
Apr 06 2018 00:18
I don't want a fold anything, I want something decent
Joseph
@revisualize
Apr 06 2018 00:31
I guess because I don't understand computer science. I'm going to take this: https://frontendmasters.com/courses/computer-science/
Smootimus
@Smootimus
Apr 06 2018 00:32
Harvard CS50 on edx is good
I've never seen the one you posted
MITx on edx is good too, I just foun dit
But Computer Science is all about computation
Less about software specifics and stacks
eeflores
@eeflores
Apr 06 2018 00:34
Smootimus
@Smootimus
Apr 06 2018 00:34
I mean any of it would be good really
Or all of it lol
That's usually the route I go : all of it
Kudzu
@czhower
Apr 06 2018 00:35
that compsci course linked above looks quite good - at least from the overview.
Smootimus
@Smootimus
Apr 06 2018 00:35
Which one there two
Kudzu
@czhower
Apr 06 2018 00:36
front end masters.. didnt look at the other one.
Smootimus
@Smootimus
Apr 06 2018 00:36
Yeah it looks pretty nice
anthonygallina1
@anthonygallina1
Apr 06 2018 00:39
@eeflores Berkley Stanford MIT Lagunita Looks Awesome! thank you for the link.
CamperBot
@camperbot
Apr 06 2018 00:39
anthonygallina1 sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:star2: 1063 | @eeflores |http://www.freecodecamp.org/eeflores
eeflores
@eeflores
Apr 06 2018 00:39
hey there @anthonygallina1 no probs :smile:
anthonygallina1
@anthonygallina1
Apr 06 2018 00:39
:)
Brad
@bradtaniguchi
Apr 06 2018 00:43
That https://teachyourselfcs.com/ site looks pretty good, @eeflores like the range of subjects. Gonna put it in my "read when I get a chance or am bored" list :D
@eeflores thanks
CamperBot
@camperbot
Apr 06 2018 00:43
bradtaniguchi sends brownie points to @eeflores :sparkles: :thumbsup: :sparkles:
:star2: 1064 | @eeflores |http://www.freecodecamp.org/eeflores
anthonygallina1
@anthonygallina1
Apr 06 2018 00:43
Four Semesters of Computer Science in 5 Hours @revisualize thank you
CamperBot
@camperbot
Apr 06 2018 00:43
anthonygallina1 sends brownie points to @revisualize :sparkles: :thumbsup: :sparkles:
:star2: 4462 | @revisualize |http://www.freecodecamp.org/revisualize
eeflores
@eeflores
Apr 06 2018 00:44
@bradtaniguchi :thumbsup:
anthonygallina1
@anthonygallina1
Apr 06 2018 00:44
That is the fast tract Hmmmmm
Nate Mallison
@NJM8
Apr 06 2018 00:44
@bradtaniguchi find yourself a study buddy!
anthonygallina1
@anthonygallina1
Apr 06 2018 00:44
Took me years
Nate Mallison
@NJM8
Apr 06 2018 00:44
I started SICP, it is no joke. straight in the deep end
definitely mind expanding
Joseph
@revisualize
Apr 06 2018 00:46
@Smootimus I took CS50 when it was only available via iTunesU.
2009
It's changed a lot.
Smootimus
@Smootimus
Apr 06 2018 00:54
Yeah
It's pretty nice tho
Can be pretty tough
Pjdaze
@Pjdaze
Apr 06 2018 01:21

@Blauelf

 x  => 'Aa~'

is not the same as

x => x  =  'Aa~'
anthonygallina1
@anthonygallina1
Apr 06 2018 01:24
'use strict';

(function (x) {
  return 'Aa~';
});

(function (x) {
  return x = 'Aa~';
});
Pjdaze
@Pjdaze
Apr 06 2018 01:28
lol true
FlashHero
@FlashHero
Apr 06 2018 01:30
anyone know a solution to this because its MIME type ('text/html') is not a supported stylesheet MIME type it's a css file but it says it's mime type is text/html, the same thing applies for javascript file it says it's text/html
eeflores
@eeflores
Apr 06 2018 01:31
file extension wrong?
FlashHero
@FlashHero
Apr 06 2018 01:31
nope
eeflores
@eeflores
Apr 06 2018 01:31
editing the files in windows?
anthonygallina1
@anthonygallina1
Apr 06 2018 01:31
designating it in the link help any?
FlashHero
@FlashHero
Apr 06 2018 01:33
@eeflores yes @anthonygallina1 are you asking me or I don't understand what you mean ?
anthonygallina1
@anthonygallina1
Apr 06 2018 01:33
I am asking
eeflores
@eeflores
Apr 06 2018 01:34
@FlashHero do you have the setting "hide extensions of known file types" set in windows explorer?
anthonygallina1
@anthonygallina1
Apr 06 2018 01:34
Not sure how to replicate the issue here.
eeflores
@eeflores
Apr 06 2018 01:34
@FlashHero also don't know what is generating the error
like, browser, or IDE, or node?
FlashHero
@FlashHero
Apr 06 2018 01:35
@anthonygallina1 @eeflores the files types are right but it responds with content type of text/html and it's nodejs
eeflores
@eeflores
Apr 06 2018 01:36
so it sounds like nodejs sees the files as text/html?
FlashHero
@FlashHero
Apr 06 2018 01:36
yes
eeflores
@eeflores
Apr 06 2018 01:38
googled error and found this
FlashHero
@FlashHero
Apr 06 2018 01:38
@cmccormack nope, I'm using express to send a html file which links to javascript and css and they both respond with mime type of html
eeflores
@eeflores
Apr 06 2018 01:39
ref instead of href?
when referencing CSS?
and maybe JS file?
Christopher McCormack
@cmccormack
Apr 06 2018 01:39
@FlashHero are you using express.static?
FlashHero
@FlashHero
Apr 06 2018 01:39
@cmccormack yes @eeflores no
Christopher McCormack
@cmccormack
Apr 06 2018 01:40
@FlashHero if you are using express.static and you are serving valid css file from the static dir you should be alright
Can you share your express static code as well as an example link from your html?
It may also be possible a different route handler is serving the css file so make sure your static is used first
FlashHero
@FlashHero
Apr 06 2018 01:45
@cmccormack

app.use(express.static(path.resolve("../../dist/")));
app.use(express.static(path.resolve("../../public/")));
eeflores
@eeflores
Apr 06 2018 01:46
maybe the CSS/JS can't be seen by the browser?
FlashHero
@FlashHero
Apr 06 2018 01:47
I think it might be server problem because if I just run it in browser it works fine, but with localhost server it doesn't work
Christopher McCormack
@cmccormack
Apr 06 2018 01:48

it's more likely a different route is handling the request, maybe a * - @FlashHero add a console log statement in your route handlers similar to this:

console.log(`[route] Route Handler - ${req.hostname + req.path}`)

where [route] is changed to your actual route. This should at least tell you which route is attempting to serve the file

FlashHero
@FlashHero
Apr 06 2018 01:49
<!DOCTYPE html>
<html>
<head>
    <title>Title</title>
<meta http-equiv="Content-Security-Policy" content="style-src 'self' http://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:">
<link href="style.css" rel="stylesheet"></head>
<body>
<div id="root"></div>
<script type="text/javascript" src="bundle.js"></script></body>
</html>
Christopher McCormack
@cmccormack
Apr 06 2018 01:49
what do you mean when you run it in the browser it works fine?
Amit Patel
@AmitP88
Apr 06 2018 01:49

hey guys, I know this is a basic problem but I've been puzzled onto how to do this (whatever I seem to do won't work), but how do I vertically center my twitter icon inside the button via css?

https://codepen.io/AmitP88/pen/YepOxg?editors=0010

eeflores
@eeflores
Apr 06 2018 01:49
This message was deleted
Christopher McCormack
@cmccormack
Apr 06 2018 01:50
@eeflores :p
FlashHero
@FlashHero
Apr 06 2018 01:50
@cmccormack without express server just run the html file and it serves up css and javascript
eeflores
@eeflores
Apr 06 2018 01:50
:shrug:
Christopher McCormack
@cmccormack
Apr 06 2018 01:50
@FlashHero yeah it's because you aren't using a web server when you run your node server, that's what express.static should do
@FlashHero you may want to try logging your path.resolve("../../dist/") and path.resolve("../../public/") and see if it actually resolved correctly
I like to use app.use(express.static(path.join(__dirname, 'public')))
FlashHero
@FlashHero
Apr 06 2018 01:54
@cmccormack when I run the node server, the localhost doesn't throw error and when I do yarn run build it builds the bundle.js file so when doing res.sendFile() isn't it suppose to point to the javascript and css without any problem because the files are updated and they're linked to html
Christopher McCormack
@cmccormack
Apr 06 2018 01:56
You haven't provided enough information but I assume your res.sendFile is sending the index.html, correct? Even if you send that, your browser will still have to parse all links within the html file, which means sending a request for your css/js files based on your href/src
FlashHero
@FlashHero
Apr 06 2018 01:57
yes and they're on the same folder
I had this same exact error some days ago and I took the whole day to find a solution but I don't remember what I did to fix it, all I know is it didn't really have anything to do with static files being served
Christopher McCormack
@cmccormack
Apr 06 2018 01:58
perhaps, but if your static handler isn't configured correctly then it won't serve that file based on its type.
Do you have your code in git?
FlashHero
@FlashHero
Apr 06 2018 01:59
no sorry
Christopher McCormack
@cmccormack
Apr 06 2018 01:59
hah don't apologize to us we're just trying to help you :)
but my guess is still that your paths for your static files may be wrong
FlashHero
@FlashHero
Apr 06 2018 02:01
@cmccormack ok thanks, I'll try to mess around with paths and see if it works
CamperBot
@camperbot
Apr 06 2018 02:01
flashhero sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1393 | @cmccormack |http://www.freecodecamp.org/cmccormack
Christopher McCormack
@cmccormack
Apr 06 2018 02:02
like I suggested earlier try logging your path.resolves and see if it's resolving to the correct directory
╭─chris@host ~/testing/root/child/subchild
╰─$ node
> const path = require('path')
> path.resolve('../../')
'/Users/chris/testing/root'
> path.resolve('../../public')
'/Users/chris/testing/root/public'
> path.resolve('../dist')
'/Users/chris/testing/root/child/dist'
Notice how it works, I hope that helps
FlashHero
@FlashHero
Apr 06 2018 02:05
@cmccormack ok :+1:
Joseph
@revisualize
Apr 06 2018 04:23
@cmccormack So I may be getting a job as a DevOps-y Inf Engine
Christopher McCormack
@cmccormack
Apr 06 2018 04:24
An engine?
Sounds like greasy work
Joseph
@revisualize
Apr 06 2018 04:24
Engineer
Christopher McCormack
@cmccormack
Apr 06 2018 04:24
@revisualize haha that's great, is it something you want to do?
Joseph
@revisualize
Apr 06 2018 04:25
I want to move my career from being a Mid-level Network / Systems Administrator ... To something that has viability for the future.
Christopher McCormack
@cmccormack
Apr 06 2018 04:26
That's awesome, it's in pretty high demand lately
@revisualize when do you find out if you get it?
eeflores
@eeflores
Apr 06 2018 04:36
hey good stuff @revisualize !
Blauelf
@Blauelf
Apr 06 2018 04:45
@Pjdaze Same as in same input creates same output, as you assign to the function parameter which ceases to exist a moment later, and the returned value is the assigned one.
Markus Kiili
@Masd925
Apr 06 2018 05:17
@revisualize Nice!
Amit Patel
@AmitP88
Apr 06 2018 05:22
hey guys, have any of you ever felt burnt out when working on a project? I was working on the pomodoro timer for the past 4 weeks, but yesterday I decided to take a break from it and redesign my past fcc projects (since I made them pretty much barebones in terms of visual design). Just wondering what you guys do when you feel burnt out when working on something for so long. Btw, after some thinking I've realized that I still have a ton left to do on the pomodoro, even though I completed the user stories long time ago
Markus Kiili
@Masd925
Apr 06 2018 05:32
@AmitP88 I usually just leave such a project for a while and do something else.
Claudio Restifo
@Marmiz
Apr 06 2018 05:33
@AmitP88 just out of curiosity, how many hours you think you have put in the pomodoro timer in the last 4 weeks?
(retorical question, my point is, aren't you loosing focus?)
Markus Kiili
@Masd925
Apr 06 2018 05:34
@Marmiz Morning.
Claudio Restifo
@Marmiz
Apr 06 2018 05:34
@Masd925 :wave: (afternoon 'ere. Back to the office at +6GMT)
Amit Patel
@AmitP88
Apr 06 2018 05:35

@Marmiz not sure, but here's my code if you want to take a look https://codepen.io/AmitP88/pen/ZxWRmx

I wrote a ton and I still got a lot more to do for it before I feel satisfied with it lol

@Masd925 that's what I was thinking of doing too
Claudio Restifo
@Marmiz
Apr 06 2018 05:40

@AmitP88

before I feel satisfied with it lol

that's my point. You'll never feels satisfied. (welcome to software engineering 101)

My suggestion is: don't loose focus.
If your focus is just hobby, then you can take how long you want to .

If your focus is learning, then acquire knowledge. I'm sorry if I come hard, but mind how many hours you are spending on each project, and don't get trapped in a swamp...

Amit Patel
@AmitP88
Apr 06 2018 05:42
@Marmiz for sure, I understand. and honestly, the break timer and tying it into the interface and having it sync with the work timer is the biggest task left to do before completion. It's just that I feel so burnt out with this project atm that I feel compelled just to polish up my other previous projects (the 4 intermediate projects) before coming back to it
@Marmiz as for how many hours I sunk into pomodoro so far, I couldn't tell you, because a lot of those hours were researching and trying to figure out how to bring my ideas to fruition, and another bunch of hours trying to get things to work tweaking things, fixing bugs, etc
my biggest worry is that my projects won't be good enough to make me stand out in the job market when applying for junior roles, so I'm aiming for close to perfection on each project (as crazy as that may seem)
Claudio Restifo
@Marmiz
Apr 06 2018 05:45

@AmitP88 I acted as a potential emplyee. I clicked two buttons, see that works.... glanced at JS for like 30 seconds. And that's all.
To me it's "ok".

(not saying is perfect) but if your goal is acquire knowledge, and showcase that to external people, in my humble opinion your goal is reached

Amit Patel
@AmitP88
Apr 06 2018 05:46
@Marmiz well ultimately, my goal is to get into a junior dev role (preferrably working on applications more than just websites)
Ryan Williams
@Ryanwfile
Apr 06 2018 07:09
@AdelMahjoub Thank you
CamperBot
@camperbot
Apr 06 2018 07:09
ryanwfile sends brownie points to @adelmahjoub :sparkles: :thumbsup: :sparkles:
:cookie: 679 | @adelmahjoub |http://www.freecodecamp.org/adelmahjoub
Zunaid Aslam
@ZunaidAslam
Apr 06 2018 09:29
Hey guys I need some help with css. I made few menus Online, offline, all for my twitch project. I used anchor tag for them. After visiting a link, I don't want the visited color to stay. How do I fix that?
For example if a:visited is blue then when I click online after visiting offline menu, the online stays blue ....
Fabien SHAN
@X140hu4
Apr 06 2018 09:36
@Zunaid-Aslam what about text-decoration: none;
Zunaid Aslam
@ZunaidAslam
Apr 06 2018 09:39
@X140hu4 Text-decoration hides the underline but it doesn't deal with the color
Fabien SHAN
@X140hu4
Apr 06 2018 09:47
@Zunaid-Aslam Do you have a pen?
Stephen James
@sjames1958gm
Apr 06 2018 09:49
@Zunaid-Aslam Not sure exactly what you are wanting but:
a:visited {
  color: inherit;
}
a:hover, a:active {
  color:red;
}
Zunaid Aslam
@ZunaidAslam
Apr 06 2018 09:49
yup
I actually tried that, maybe I messed up the order. Let me share my pen. It's still incomplete.
Stephen James
@sjames1958gm
Apr 06 2018 09:54
@Zunaid-Aslam Wouldn't it be easier to just not make them anchor tags so you have more control over styling?
Zunaid Aslam
@ZunaidAslam
Apr 06 2018 09:56

Yes, I was thinking about that to be honest. I am still in beginner stage and tried to avoid experimenting.

In general I have seen people using anchor tag. So wanted to know if I can solve the issue somehow.

What if in future I have to deal with similar case?

My goal is to make mobile apps using JS, React. Usually menus are made with anchor tag according to my knowledge. Therefore trying this approach. @sjames1958gm

Stephen James
@sjames1958gm
Apr 06 2018 09:57
@Zunaid-Aslam You could use <p> and then
.status > p {
  cursor: pointer;
}
.status > p:hover {
  color: blue;
}
Zunaid Aslam
@ZunaidAslam
Apr 06 2018 09:57
Yeah that works :D
Though I haven't tried it.
One question, what about when dealing with websites? What do you guys do?
Stephen James
@sjames1958gm
Apr 06 2018 10:03
You mean using <a> for menus and handling visited state? I have used inherit in the past.
Zunaid Aslam
@ZunaidAslam
Apr 06 2018 10:07
Let me try inherit here and see how it goes then maybe use p tag for the time being if it doesnt work
I guess I may have to use p tag
Joshua Frias
@Juke-Magic
Apr 06 2018 10:31
guys how can i center my data
1Mher1
@1Mher1
Apr 06 2018 10:32

Enter the number in the input field

To print "true" at Button's clicks, if the whole number is a square and "false", otherwise
The square of natural numbers is 49 square, for example 7 * 7 = 49
For example, 46 is not the case, since we will not get any number multiplied by 46

please help me this

var bnakan =
document.getElementById("btn2").onclick=function(){
var z=document.getElementById("inp3").value
if(Math.sqrt(z) % 1 == true){
bnakan=true
}else{
bnakan=false
}

}
console.log(bnakan)

this is my code
i tried
Markus Kiili
@Masd925
Apr 06 2018 10:34
@1Mher1 if(Math.sqrt(z) % 1 === 0) would test for being a perfect square
1Mher1
@1Mher1
Apr 06 2018 10:38
@Masd925 true and false what line I must put and var bnakan remove or Do var bnakan=0?
May Kittens Devour Your Soul
@diomed
Apr 06 2018 10:41
@Juke-Magic from .container remove margin-left: 550px;
1Mher1
@1Mher1
Apr 06 2018 10:42
@Masd925 because when i do console.log(bnakan) they show only 0
Jen
@jenniredfield
Apr 06 2018 10:43
Use flexbox justify-content: center
:P
Markus Kiili
@Masd925
Apr 06 2018 10:44
@1Mher1 The code inside the onclick handler function runs later when the element is clicked. If that console.log is outside the handler, it will not show the updated value (script is executed before that onclick handler).
Stephen James
@sjames1958gm
Apr 06 2018 10:46
@1Mher1 To make your test more obvious.
Number.isInteger(Math.sqrt(z)) this code reads better because you are saying you want the result to be an integer
% 1 seems obscure to me
1Mher1
@1Mher1
Apr 06 2018 10:48
@Masd925 @sjames1958gm but in my code for example when I write 7 they show me false but 7 is natural

var bnakan =
document.getElementById("btn2").onclick=function(){
var z=document.getElementById("inp3").value
if(Number.isInteger(Math.sqrt(z))){
bnakan=true
}else{
bnakan=false
}

console.log(bnakan)
}

Jen
@jenniredfield
Apr 06 2018 10:48
Geometry class?
Whats the formula for centering things?
Markus Kiili
@Masd925
Apr 06 2018 10:49
@1Mher1 Are you trying to test for a natural number or for being a perfect square?
Stephen James
@sjames1958gm
Apr 06 2018 10:49
@1Mher1 7 is not a perfect square - 49 is
Markus Kiili
@Masd925
Apr 06 2018 10:49
7 is a natural number but not a perfect square.
1Mher1
@1Mher1
Apr 06 2018 10:50
@Masd925 @sjames1958gm thank you help me this challenge ))))))
CamperBot
@camperbot
Apr 06 2018 10:50
1mher1 sends brownie points to @masd925 and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9170 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
:star2: 4764 | @masd925 |http://www.freecodecamp.org/masd925
1Mher1
@1Mher1
Apr 06 2018 10:51
@sjames1958gm remember this challenge? document.getElementById("btn").onclick=function(){
var x = document.getElementById("txt").value
document.getElementById("p").innerHTML = x
}
document.getElementById("btn1").onclick=function(){
var a =document.getElementById("inp1").value
var b =document.getElementById("inp2").value
var d =document.getElementById("sel1").value
document.getElementById("p").style.color = a
document.getElementById("p").style.backgroundColor = b
document.getElementById("p").style.fontFamily = d
please check it why my fon-family dont work?\
Stephen James
@sjames1958gm
Apr 06 2018 10:52
What is the value of d?
1Mher1
@1Mher1
Apr 06 2018 10:54
@sjames1958gm https://codepen.io/1Mher1/pen/eMPQgb value d i put to work font family but they don't work please check this
word color work background work but fon-fmily don't work
Stephen James
@sjames1958gm
Apr 06 2018 10:57
@1Mher1 when I try this d is "Font-Family" which doesn't work
1Mher1
@1Mher1
Apr 06 2018 10:58
font-family for example change Arial put Range they agin don't change
Claudio Restifo
@Marmiz
Apr 06 2018 10:59

@1Mher1 I don't see any value associated with the select.
A simple

<option value="monospace">

made it work for me

Stephen James
@sjames1958gm
Apr 06 2018 10:59
<option style="font-family: Arial">Arial</option>
1Mher1
@1Mher1
Apr 06 2018 11:27
please help me this https://codepen.io/1Mher1/pen/vRVQoJ i am already done in this chart when i am click main button one corner work I must do when i click Secondary Top they must work second corner
1Mher1
@1Mher1
Apr 06 2018 11:54
I must paint other corner
only one corner don't painted please help
1Mher1
@1Mher1
Apr 06 2018 12:04

There will be the following buttons:

secondary ball - clicking on this button will display the dives above the secondary diagonal
Secondary bottom - clicking on this button will display the dives below the secondary diagonal
main top - clicking on this button will display the buttons above the main diagonal
main bottom - clicking this button will display the dives below the main diagonal
chess - when pressing this button, the dives will be chess-based
when pressing these diverges, the gauge diagonal of the compressed diagonal and the same diagonal should be painted in color

this is challenge
Ion Varsescu
@Nei-V
Apr 06 2018 12:45
Hello,can someone help me with this problem? I have an array like this [[a,1][b,2][c,undefined]]. I would like to use filter to get only the items that don't have "undefined" as the second term. I did it with a for loop using push to another array, but I would like to know how to do it with filter and fat arrow syntax. Thanks
Kudzu
@czhower
Apr 06 2018 12:47
Its a mulit dimensional array, filter on the first rank, within the arrow func check if length > 1, and if so check the second elemente for undefined.
1Mher1
@1Mher1
Apr 06 2018 13:43
document.getElementById('btn').onclick=function(){
var text = document.getElementById("txt").value
var str = string.split(" ")
var longest = 0
var word = null
for (var i = 0; i < str.length - 1; i++) {
if (longest < str[i].length) {
longest = str[i].length
word = str[i]
}
}
return word
}
console.log(text)
Kudzu
@czhower
Apr 06 2018 13:44
use ``` to preserve code formatting to make it easier to read.
1Mher1
@1Mher1
Apr 06 2018 13:44
please help to find in textarea longest word if i put in text area aaaaaa bbbbbbb the will find longest word
Kudzu
@czhower
Apr 06 2018 13:44
code here
   see indents?
1Mher1
@1Mher1
Apr 06 2018 13:46
@czhower https://codepen.io/1Mher1/pen/wmYZdR please check this
this link you can read easy
Kudzu
@czhower
Apr 06 2018 13:48
What is the problem currently?
Blauelf
@Blauelf
Apr 06 2018 13:48
@Nei-V Your filter callback could be (x) => x[1] !== undefined, or with array destructuring ([_, x]) => x !== undefined
Kudzu
@czhower
Apr 06 2018 13:48
why would you return a string value to an onclick event?
1Mher1
@1Mher1
Apr 06 2018 13:49
to check longest word
Kudzu
@czhower
Apr 06 2018 13:49
no.. please read my question. Why would you return a string to a clickevent? You are returning it into the void essentially.....
1Mher1
@1Mher1
Apr 06 2018 13:50
yes this is wrong exact word i am alreay delated
Kudzu
@czhower
Apr 06 2018 13:50
also string.split is wrong
if you look in the debugger, it will tell you this exactly.
1Mher1
@1Mher1
Apr 06 2018 13:51
yes string is undifined
Kudzu
@czhower
Apr 06 2018 13:51
you need text.split, not string.split... right now you are not splitting anyting and it doesnt even comipl;e
yes.. well those are errors.. when it has a compile error, it cant run.
1Mher1
@1Mher1
Apr 06 2018 13:52

document.getElementById('btn').onclick=function(){
var text = document.getElementById("txt").value
var str = text.split(" ");
var longest = 0;
var word = null;
for (var i = 0; i < str.length - 1; i++) {
if (longest < str[i].length) {
longest = str[i].length
word = str[i]
}
}

console.log(text)
}

correct?
Kudzu
@czhower
Apr 06 2018 13:52
you still arent logging any output and text is not within the scope to be available in the console.log
look at the error window in Chrome
or moz
1Mher1
@1Mher1
Apr 06 2018 13:53
they don't show me error
Kudzu
@czhower
Apr 06 2018 13:54
ctrl-shift-j
1Mher1
@1Mher1
Apr 06 2018 13:54
what i write in textarea and do click they show me my words but no choose longest word
Kudzu
@czhower
Apr 06 2018 13:54
then select console tab
then click the button in your outptu window and you can see the errors.
Blauelf
@Blauelf
Apr 06 2018 13:55
@1Mher1 Why the -1 in the for loop? Ignore last word?
1Mher1
@1Mher1
Apr 06 2018 13:55
@Blauelf yes
Blauelf
@Blauelf
Apr 06 2018 13:56
You ignore it on purpose?
Kudzu
@czhower
Apr 06 2018 13:57
@Blauelf you need -1 becuase indexing is 0 based, but the length is not.
aah but there is a <
so never mind
Blauelf
@Blauelf
Apr 06 2018 13:57
Ever heard of <? This argument is void.
Exactly. That's the part where I find it unusual, expecting the code to refer to the similar freeCodeCamp challenge.
@1Mher1 Logging text isn't that interesting. There are other variables that you might want to log.
Kudzu
@czhower
Apr 06 2018 13:59
he cant log text anyway, or any var. They exist in the function, not where console.log is.
and he is also returning a string value into the abyss to the onclick
Blauelf
@Blauelf
Apr 06 2018 14:00
The log currently is within the function. But word just got global?
Smootimus
@Smootimus
Apr 06 2018 14:00
:|
1Mher1
@1Mher1
Apr 06 2018 14:01
I should have global var??????????????
Blauelf
@Blauelf
Apr 06 2018 14:01
You made it global by not declaring it.
Kudzu
@czhower
Apr 06 2018 14:01
in the code he sent me, log is after the function.
document.getElementById('btn').onclick=function(){
    var text = document.getElementById("txt").value
    var str = text.split(" ");
    var longest = 0;
    for (var i = 0; i < str.length-1; i++) {
        if (longest < str[i].length) {
            longest = str[i].length
            word = str[i]
        }
    }

console.log(text)
}
aah, wiat its insdie even
1Mher1
@1Mher1
Apr 06 2018 14:02

document.getElementById('btn').onclick=function(){
var text = document.getElementById("txt").value
var str = text.split(" ");
var longest = 0;
for (var i = 0; i < str.length-1; i++) {
if (longest < str[i].length) {
longest = str[i].length

    }
}

console.log(longest)
}

watch they worked but don't exact
they only show me longest second word but if third word can be longest
Blauelf
@Blauelf
Apr 06 2018 14:03

I'm referring to the code on codepen.

document.getElementById('btn').onclick=function(){
    var text = document.getElementById("txt").value
    var str = text.split(" ");
    var longest = 0;
    for (var i = 0; i < str.length-1; i++) {
        if (longest < str[i].length) {
            longest = str[i].length
            word = str[i]
        }
    }

console.log(text)
}

(I did not remove semicola, they weren't in there, really ugly style)

@1Mher1 Like oopsGlobal in https://www.freecodecamp.org/challenges/global-scope-and-functions

Kudzu
@czhower
Apr 06 2018 14:03
Eitehr he changed it and it chagned when I refreshed, or it was the wrapping in codepent that made it appear outside.
yes.. tis chagned.
the original one he had a return word and then console.log was outside.
Blauelf
@Blauelf
Apr 06 2018 14:04
@1Mher1 For the third word, see :point_up: 6. April 2018 15:55
Kudzu
@czhower
Apr 06 2018 14:05
now your code is better, but you arent sendnig the "result" word anywhere
yes, current code. He changed the code... I had to refresh to see his changes.
Blauelf
@Blauelf
Apr 06 2018 14:08
-1 still makes no sense to me...
Kudzu
@czhower
Apr 06 2018 14:09
splitting on " " makes no sense
oh wait, nvm
I was assuming you wanted to split by lines.. but by spaces its fine.
1Mher1
@1Mher1
Apr 06 2018 14:10
all okay
solved
Kudzu
@czhower
Apr 06 2018 14:11
the multiline edit just put me into the mode of assuming you wanted multiple lines....
1Mher1
@1Mher1
Apr 06 2018 14:11
but if i want in same texarea remove same words what can i do/
?
Kudzu
@czhower
Apr 06 2018 14:12
You can count the words, or you can check each word against words before it.
Moisés Man
@moigithub
Apr 06 2018 14:12
a bb ccc dddd eeeeeeeee <-- ur code says longest is 4
1Mher1
@1Mher1
Apr 06 2018 14:13
@czhower namely global I need to have var count = 0 ?
@moigithub already replaced correct code
Kudzu
@czhower
Apr 06 2018 14:14
it would be easier to check words against words before it or make a new list to copy them to.
loop through the words, each iteration see if current word exists in the array but not same index as current iteration, if so you have a dup.
if same you can skip as its first occurance and will be checked again on further iterations.
1Mher1
@1Mher1
Apr 06 2018 14:16
only can't imagine this code to write this(((
Blauelf
@Blauelf
Apr 06 2018 14:17
@1Mher1 Don't understand what you're asking for, could you describe what you want the code to do?
Kudzu
@czhower
Apr 06 2018 14:18
step by step.. thats how all code is written....
coding is like building a house, you build a foundation, and build up step by step.
1Mher1
@1Mher1
Apr 06 2018 14:19
@Blauelf Javascript: find same word in a string and remove
Kudzu
@czhower
Apr 06 2018 14:20
"loop through the words, each iteration see if current word exists in the array but not same index as current iteration, if so you have a dup.
if same you can skip as its first occurance and will be checked again on further iterations."
Blauelf
@Blauelf
Apr 06 2018 14:20
@1Mher1 I mean, what do you want the script to do? Remove all the duplicates from the string in the textarea and write it back without them? The longest word algo doesn't care about duplicates.
@Blauelf yes you correct understand me
Blauelf
@Blauelf
Apr 06 2018 14:26

@1Mher1 So something like

document.getElementById("txt").value = document.getElementById("txt").value.split(" ").filter((word, index, array) => index === array.indexOf(word)).join(" ");

?

1Mher1
@1Mher1
Apr 06 2018 14:26
no

@Blauelf like this document.getElementById("btn1").onclick=function(){
var text = document.getElementById("txt1").value
var unique='';
for(var i=0; i<txt1.length; i++){
if(unique.indexOf(string[i])==-1){
unique += string[i];
}
}

console.log(unique)
}

Blauelf
@Blauelf
Apr 06 2018 14:30

BTW, please use semicola! They may be optional, but them being optional is one of the worst design flaws of JavaScript. It makes

return {
    answer : 42
}

and

return
{
    answer : 42
}

mean completely different things. And they are both valid JavaScript.

@1Mher1 You could still use my line, just adapted.

    unique = text.split("").filter((char, index, array) => index === array.indexOf(char)).join("");

:P

1Mher1
@1Mher1
Apr 06 2018 14:33
@Blauelf watch your code they don't worked https://codepen.io/1Mher1/pen/wmYZdR
Blauelf
@Blauelf
Apr 06 2018 14:34
WTF? (I never expected that assignment to be placed in an if's condition)
document.getElementById("btn1").onclick=function(){
    var text = document.getElementById("txt1").value;
    var unique = text.split("").filter((char, index, array) => index === array.indexOf(char)).join("");
    console.log(unique)
}
1Mher1
@1Mher1
Apr 06 2018 14:39
@Blauelf but if i have There will be textarea - which will be arbitrary text. Let's also have 2 hippopotamuses, first write x-word, and y in the second. By clicking on the button, x in the textarea becomes y.
I should use replace.split?
Elia
@elia-russad
Apr 06 2018 14:39
if( unique = text.split("").filter((char, index, array) => index === array.indexOf(char)).join(""))
is that even legal?
Blauelf
@Blauelf
Apr 06 2018 14:40
@elia-russad Assignments are expressions. They evaluate to the assigned value.
@elia-russad You can do like x = y = 0; which is the same as y = 0; x = 0; (yes, in that order, = is right-associative), just that the 0 is evaluated only once. It is not the same as y = 0; x = y;, but that difference rarely matters either (it does with properties that don't behave like ordinary properties - the DOM API is full of those, like properties that allow assigning but don't change their value)
Blauelf
@Blauelf
Apr 06 2018 14:50

@elia-russad My card counting solution

var count = 0;
function cc(card) {
    return (count += (card < 7) - !(card < 10)) + [" Hold", " Bet"][+(count > 0)];
}

relies on that one, as += is just another assign operator (those are only a few weird parts of JavaScript, the reason why I'm very ambivalent about this language...)

Kudzu
@czhower
Apr 06 2018 14:50
+= is not weird, its pretty common in many languages.
it originates from C, which JS and many others are modeled after.
Blauelf
@Blauelf
Apr 06 2018 14:51
+= isn't the weird part. The behaviour of compare operators is.
1Mher1
@1Mher1
Apr 06 2018 14:52
https://codepen.io/1Mher1/pen/wmYZdR like this than what I can do
Kudzu
@czhower
Apr 06 2018 14:52
@Blauelf which parts? JS has a LOT of bad stuff. JS is almost a case study in how not to make a language.
ehutchllew
@ehutchllew
Apr 06 2018 14:53
@czhower Heresy!
Kudzu
@czhower
Apr 06 2018 14:53
Truth. JS is what it is, its here, we have to use it. but we dont do ourselves any service by whitewashing the truth.
ehutchllew
@ehutchllew
Apr 06 2018 14:53
Yeah. It keeps getting better over the years though.
it has kept*
Kudzu
@czhower
Apr 06 2018 14:54
yes and no.
They repeatedly fix things wrongly and are still decades behind most other langages in many aspects.
ehutchllew
@ehutchllew
Apr 06 2018 14:55
Decades behind? In what regard? ES6 seems pretty mature imo, JS is becoming more OOP.
Kudzu
@czhower
Apr 06 2018 14:55
Compare it to literally any other language..... still no type safety, still implicit identifier declaration, the whole async stuff was a hack rather than doing it right, the list is massive.
Blauelf
@Blauelf
Apr 06 2018 14:56
@czhower I can freely compare strings and numbers, and the behaviour depends on the content of the string.
10 < "a" is false, 10 > "a" is false, 10 == "a" is false.
10 < "10.0" is false, 10 > "10.0" is false, 10 == "10.0" is true
10 < "11" is true, 10 > "11" is false, 10 == "11" is false
I don't like this kind of behaviour. I think those should always return false, all of them, like === does.
Kudzu
@czhower
Apr 06 2018 14:56
lack of upgrades to really support exceptions properly in core code, etc.
yes, thats lack of type safety and implicit type conversions.
ehutchllew
@ehutchllew
Apr 06 2018 14:57
@Blauelf why not just use === then? the shallow comparison has its uses.
Kudzu
@czhower
Apr 06 2018 14:57
even === is hack rather than a fix.
ehutchllew
@ehutchllew
Apr 06 2018 14:58
how?
not trying to debate, i'm legitimately curious.
Kudzu
@czhower
Apr 06 2018 14:58
upgrades shoudl have been done using options rather than additions and keeping old horrible beahviour
Blauelf
@Blauelf
Apr 06 2018 14:58
@ehutchllew There's no equivalent for <. I want at least some warning.
Kudzu
@czhower
Apr 06 2018 14:59
== should have been an optino to change to === behaviour in a file rather than adding a new operator and leaving the old. JS is like Intel, instead of fixing, they just keep piling on top and making the poo pile larger.
Blauelf
@Blauelf
Apr 06 2018 14:59
JavaScript keeps all kinds of design flaws for not breaking the code out there. Like the evil global by default. Fixed only in strict mode. But who's using that one.
ehutchllew
@ehutchllew
Apr 06 2018 14:59
changing behavior of the == to === in a file seems like a pain to me. I have no issue with having both.
Kudzu
@czhower
Apr 06 2018 14:59
They say backwards compat.. but there are better ways to do that and some of the stuff they preserve goes back 20+ years which really doesnt make any sense to preserve such ancient poor behaviour.
ehutchllew
@ehutchllew
Apr 06 2018 15:00
All about preferences I guess.
Kudzu
@czhower
Apr 06 2018 15:00
leaving == allows new code to use it, an optino would help eliminate usage if it were even defaulted to true.
Its about leaving bad things in, they just keep accumulating.
when you have a house with a bad foundation.... .and refuse to fix it.. but keep piling on top..... better to address the foundation.
Blauelf
@Blauelf
Apr 06 2018 15:01
Wait - I think I wrote my first JavaScript about 20 years ago. Oh, at least browser APIs (and event models) got normalized.
Kudzu
@czhower
Apr 06 2018 15:01
It wasn't until the 2000s that it got really standardized well.
Blauelf
@Blauelf
Apr 06 2018 15:02
typeof null === "object" :D
Kudzu
@czhower
Apr 06 2018 15:02
I mean come on... designed in mid 90s.. and first version returned 2 digit years??? really? And thats just one tiny thing.. but this kind of stuff is endemic. 0 based months? Does any other lang do that? I cant remember any.
Blauelf
@Blauelf
Apr 06 2018 15:04
@czhower IE and Netscape had different models, and IE event handlers for a long time required special treatment. Oh, those days of the First Browser War... (got free IE and Netscape at least!)
Kudzu
@czhower
Apr 06 2018 15:04
the fact that identifiers are still implicitly declared and as not only default behavior, but the only behavior is probably the most abysmall behavior. PHP is the same though. This causes so many problems not only for noobs, but advanced devs. Just spent almost 3 days hunting down such a bug in a large code base.
Yes, it was horrid. I've been doing web apps since before JS. In fact since we had to compile our own browser (Moscaic)
And I had to write my own TCP and server clients and then HTTP on top of them as they almost only existed in C at the time
At least JS got standardized. but standardized at what is the issue. :)
JS is here, but noobs must learn the warts properly so they can know how to code around them, how to debug, etc... and also learn proper codnig for when they may move to another language at some point. No one wins when the warts are whitewashed.
And I think its part of the reason why JS doesn't evolve as well as it should as well.
IE was and still is such a massive turd.
Kudzu
@czhower
Apr 06 2018 15:09
I mean Chrome eats up RAM and CPU and often crashes, but at least its DOM and JS is pretty good.
IE is so bad, even MS gave up on it and restarted from near scratch with Edge.
Kudzu
@czhower
Apr 06 2018 15:15
When I was at MS, we couldnt even upgrade our PCs to IE7 because it broke too many internal apps and it took several years for all the apps to get upgraded.
Blauelf
@Blauelf
Apr 06 2018 15:15

Since I force-switched from Firefox 32 bit to 64 bit, my Firefox crashes take the whole system down (previously, it would die on consuming 3GB - now it can manage more, and dies when the computer is out of memory, probably crashing other programmes trying to allocate memory), so I'm not sure whether I want to complain about the Chrome crashes. Sometimes Chrome tabs crash without actually crashing, leaving them in a state you cannot recover unless you kill them in the Chrome Task Manager.

That Microsoft abandoned IE is still a bit weird to me. I mean, Edge is available on Win10. Until 2020, many companies will still run Win7 (AKA Windows NT 6.1) on most of their machines. Which means many people are stuck on IE11 or use Firefox or Chrome (no Safari for Windows any more, but that one never worked that well)

Kudzu
@czhower
Apr 06 2018 15:16
FF isn't perfect either. But I find I have far more issues with Chrome in the last year.
FF Quantum is my new preferred browser but I still use chrome for most dev becuase the FF debugger UI is just super klunky to me vs the Chrome one.
Ion Varsescu
@Nei-V
Apr 06 2018 15:17
@czhower thanks fro the previous answer about the filter for nested array. I did manage to use it, but I also need a counter that sums the second terms in the new filtered array. [[a,1],[b,2],[c,undefined]] should be filtered for [[a,1],[b,2]] and a totat=1+2=3. I tried to put the total in the filter but it didn't work - this is what I tried to do: result = array1.filter((x) => { x[1] !== undefined; total=total+x[1]; }).reverse();
CamperBot
@camperbot
Apr 06 2018 15:17
nei-v sends brownie points to @czhower :sparkles: :thumbsup: :sparkles:
:cookie: 101 | @czhower |http://www.freecodecamp.org/czhower
Kudzu
@czhower
Apr 06 2018 15:17
Edge is a nice start, but its still so far behind in many key areas.
x[1] !== undefined; doesnt do anything there that I can see.. you need a return or an if....
otherwise glad it helped, there are several ways to do it.
Ion Varsescu
@Nei-V
Apr 06 2018 15:20
so the if and return are implicit in this case:result = array1.filter((x) => ( x[1] !== undefined)?
1Mher1
@1Mher1
Apr 06 2018 15:20
@czhower @Blauelf please help what can I do when in textarea write words first and final letter can be capital half code i wrote already https://codepen.io/1Mher1/pen/wmYZdR
Blauelf
@Blauelf
Apr 06 2018 15:20
@czhower Funny thing about compatibility: Check http://kangax.github.io/compat-table/es6/#fx-array-prototype-values-note Footnotes 26 and 27
Kudzu
@czhower
Apr 06 2018 15:22
yeah, stuff like that happens. It used to be FAR more common. Not only did we have to do if ie then, if chrome then. .btu also if ie ver = x.xx etc... and not just IE but IE was the worst by far.
on that front things are WAY better than before.
@1Mher1 What are you trying to do?
1Mher1
@1Mher1
Apr 06 2018 15:24
@czhower in codepan shown already
html/javacsript code
Kudzu
@czhower
Apr 06 2018 15:24
Yes I see the codepen, but I dont know what your end goal is.
Id suggest 2 things to you to help yo in your path:
Blauelf
@Blauelf
Apr 06 2018 15:24
@Nei-V Do you need only the total or do you also need the array itself? Would two steps (one filtering, one summing up) be better?
Kudzu
@czhower
Apr 06 2018 15:25

1) Learn to use the browser debuggers. I dont know why so many courses skip this or save it for really late.

2) split up complex statements like this one so you can "see" it happen in stages. When it all works, you can compact it down again if you want:
```

newarray1.push(array1[x].charAt(0).toUpperCase()+array1[x].slice(1));
1Mher1
@1Mher1
Apr 06 2018 15:25
first and final letter string must be write in console.log capital
for example hello world they must console show me HellO WorlD
Kudzu
@czhower
Apr 06 2018 15:26
also you can put in more console.logs to debug if you dont to use a full debugger. but learn to use the debuggers.. it is the "force" of coding... and you should "learn to use the force"
Ion Varsescu
@Nei-V
Apr 06 2018 15:26
@Blauelf thanks - I tooks Kudzu advice and I inserted an if in the filter and a return statement, that did the trick
Kudzu
@czhower
Apr 06 2018 15:27
break your current codepen long statement into pieces, and log the stages to the console so you can see whats happening stage by stage.
This will help you in all future tasks as well.
also while this is a small loop, you are doing an index lookup [x] twice. In large loops that can have a performance impact.
Blauelf
@Blauelf
Apr 06 2018 15:28
@Nei-V Doing the counting in the filter callback is somewhat... not so stylish. I really like pure functions (functions that return the same values on same input all the time and have no side-effects). My preference.
Ion Varsescu
@Nei-V
Apr 06 2018 15:32
Is there anyone using VS code here with github? I am just learning using git and github, so I managed to integrate VS with github, so each time I can push the commit. the problem is the it always pushes it on the master . is there a (simple ) way to push the commit to another branch that I've already created on github site? // @Blauelf - thanks for the advanced info (I believe that this is a more advanced way of looking at things). I did the same array filtering with a for loop before and a conter in it, so I tried to learn how to do it using the filter... to see if there are any advantages. it seems that in this case the "for loop" method was better in light of what you said
CamperBot
@camperbot
Apr 06 2018 15:32
nei-v sends brownie points to @blauelf :sparkles: :thumbsup: :sparkles:
:star2: 4689 | @blauelf |http://www.freecodecamp.org/blauelf
Kudzu
@czhower
Apr 06 2018 15:34
Generally @Blauelf is right, but on small anon funcs it can be valid sometimes and the outer function can be considered to be the atomic unit. So there are cases where its ok, but in general its the exception not the norm.
Blauelf
@Blauelf
Apr 06 2018 15:38
@Nei-V In your local git repo, which is your current branch? And what is its corresponding remote branch ("tracking branch", where it pushes to)?
Kudzu
@czhower
Apr 06 2018 15:45
@Nei-V Git is a bit more complex than it should be for simple tasks. Do yourself a BIG favor and read some tutorials on basic usage etc and master the basics. Many things are learned well by experimentation, I dont think git is one of them for the basics at least.
Its one of the major reasons SVN remains so popular among non github (ie commercial and other) projects.
Blauelf
@Blauelf
Apr 06 2018 15:53
SVN users around me are complaining all the time and set up their own git repo (no idea how they manage using both at once, probably one direction only, or SVN for one part git for the other)
Kudzu
@czhower
Apr 06 2018 15:54
git is a PITA for those accustomed to SVN.\
it has its own featurse of course, but for those used to SVN, git is often very grating.
Blauelf
@Blauelf
Apr 06 2018 15:56
Well, the SVN users around me are probably not accustomed to SVN then.
Kudzu
@czhower
Apr 06 2018 15:57
Maybe they are git users trying to use SVN like git?
alpox
@alpox
Apr 06 2018 15:58
@czhower that sounds like the real pita
Kudzu
@czhower
Apr 06 2018 15:58
you cant use SVN like Git or vice versa.... they have a big core design difference.
Its like trying to program in JS using VB.NET rules, or vice versa
alpox
@alpox
Apr 06 2018 16:02
Ive seen too much code written the java way
Js code i mean
Ion Varsescu
@Nei-V
Apr 06 2018 16:05
@kudzu and @Blauelf thanks for the tips... I'll do look for some more tutorials. have a nice day
CamperBot
@camperbot
Apr 06 2018 16:05
nei-v sends brownie points to @kudzu and @blauelf :sparkles: :thumbsup: :sparkles:
api offline
api offline
Kudzu
@czhower
Apr 06 2018 16:07
@alpox Java devs if its their main lang very often treat all langs like they are Java.
C++ devs are often bad about this too, but in a more extreme way.
Blauelf
@Blauelf
Apr 06 2018 16:11
@czhower Not sure how they use git, it seems they mostly trust their IDE. The SVN repo however is unavoidable but unpopular.
Kudzu
@czhower
Apr 06 2018 16:13
not sure why. SVN and GIT are still head to head % wise. Our commercial team refuses to move to git from SVN although they use git on github for other projects and Ive seen similar in many teams.
the main reason git is head to head with SVN is that github uses it. Without github SVN woudl be way ahead % wise.
didnt vet, but:
https://svnvsgit.com/
alpox
@alpox
Apr 06 2018 16:15
True story, but I believe that would only be the case because SVN was there much earlier
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:15
@czhower coding stereotype :)
Kudzu
@czhower
Apr 06 2018 16:16
@RoniqueRicketts I said many - not all. But its a common trait among many Java and C++ devs.
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:17
@czhower I agree with you btw hehehe. Most PHP developers has a box mentality that if your learning web dev they believe that you must learn PHP.
I had to turn down a startup job just because of that.
Kudzu
@czhower
Apr 06 2018 16:18
Im in PHP today :(. Fortunately I do very littel PHP work and only for WordPrewss. PHP is actaully a decent scripting lang, but a horror for large stuff. A few small chagnes would make it far better.
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:18
@czhower I know basic PHP scripting
alpox
@alpox
Apr 06 2018 16:19
I always hated PHP since i learned it years ago... But it looks like they made some good advances lately
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:19
I am interesting in JavaScript, Python and C++ I barely know Python but I will learnt if after completing at least 3 personal project by the end of the year
Kudzu
@czhower
Apr 06 2018 16:20
Python is a pretty good language from what Ive seen, although I have never used it.
Jason Luboff
@JLuboff
Apr 06 2018 16:20
I was just working with PHP right now.. but didn't actually have to do any PHP work lol. Just had to change a bunch of emails..easy enough
Kudzu
@czhower
Apr 06 2018 16:20
I would suggest C before C++.
alpox
@alpox
Apr 06 2018 16:20
Python is quite easy to pick up. If you didnt get much OOP yet, you'll maybe want to look into that too then. It can be used without OOP too though
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:20
@czhower mever used it but I have learnt the basic syntax.
Kudzu
@czhower
Apr 06 2018 16:20
I suggest every dev serious about dev, learn basic C at some point.
alpox
@alpox
Apr 06 2018 16:21
@czhower I second that
Kudzu
@czhower
Apr 06 2018 16:21
not to use, just to learn how langs work at a lower level better.
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:21
@JLuboff lol what is the total amount of language you know?
Kudzu
@czhower
Apr 06 2018 16:21
I
I'm easily at dozens.
alpox
@alpox
Apr 06 2018 16:21
Also good, implementing all the basic datastructures with C
To see how they work beneath
Jason Luboff
@JLuboff
Apr 06 2018 16:22
@RoniqueRicketts I'm most proficient in JS/NodeJS(well, express more than vanilla node). I know a bit of C#. Very minimal PHP.
Kudzu
@czhower
Apr 06 2018 16:22
C++ isnt necesary to learn. Its overly complex and unecessarily so, but it never hurts to learn it.
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:22
@alpox I like python
Jason Luboff
@JLuboff
Apr 06 2018 16:22
T-SQL if you want to count that as well
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:22
@czhower maybe later on if I get a job ill learn it
Kudzu
@czhower
Apr 06 2018 16:23
Its good for employment, thats for sure.
yes, SQL a must.
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:23
@czhower lol real nerd
Kudzu
@czhower
Apr 06 2018 16:23
Been coding a long time.
Blauelf
@Blauelf
Apr 06 2018 16:23
@JLuboff ISNULL instead of COALESCE? I think both names are weird.
alpox
@alpox
Apr 06 2018 16:23
But SQL procedures, even when good to know, are a pita
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:23
@JLuboff damn bruv u know a lot
@czhower how long?
Jason Luboff
@JLuboff
Apr 06 2018 16:24
@Blauelf I tried using ISNULL the other day...wouldn't work how I wanted..so switched to COALESCE and it worked like a champ..but ya kind of odd names
I guess ISNull makes kind of sense...but i dunno about coalesce (I don't even know how to pronounce it properly lol)
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:24
I am only 2 years old in the dev world and this is 2 years of ons and offs
Blauelf
@Blauelf
Apr 06 2018 16:26
@JLuboff I think the only difference is the type. COALESCE will return the first non-NULL value with its type. ISNULL will convert it to the type of the first argument.
Stephen James
@sjames1958gm
Apr 06 2018 16:26
If you ever have the urge to implement a native node module, then you'll need C++ :)
Kudzu
@czhower
Apr 06 2018 16:26
@RoniqueRicketts 28-38 years depending on how you measure :)
about 28 years professionally.
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:26
@sjames1958gm thus I want to learn C++ hehehe
Kudzu
@czhower
Apr 06 2018 16:27
do C first.....everything you learn will apply to C++ too.
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:27
@czhower thats an overkill bruv...... but still damn!! that's good news man. Well I am trying to make some apps to get job ready (skill wise)
Kudzu
@czhower
Apr 06 2018 16:27
C++ is basically an OOP superset of C.
Jason Luboff
@JLuboff
Apr 06 2018 16:27
@Blauelf Problem I was having was I wanted to check if I was passing in a null value, if so, keep the original column value. Isnull would identify the null, but than would only get the first character of the string of the column value. coalesce worked like it was supposed to though
alpox
@alpox
Apr 06 2018 16:28
My first language was LPC. Kinda fun :D
Stephen James
@sjames1958gm
Apr 06 2018 16:28
C++ has a lot of features that C doesn't have that aren't directly OOP. Such as const, bool, references, lambdas, etc
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 16:28
@czhower nice I guess i'll have 4 languages by the time I am through with learning. I'll just focus on those 4
Kudzu
@czhower
Apr 06 2018 16:29
yes, it has more than OOP, but OOP by far is the major feature.
Blauelf
@Blauelf
Apr 06 2018 16:29
@JLuboff Maybe you would have to typecast your input to the type of the original column first. But if COALESCE solves the problem...
alpox
@alpox
Apr 06 2018 16:30
C++ seems to me like pure cancer... But at least i can use it toan advanced level :/
Id like not to tho :D
Kudzu
@czhower
Apr 06 2018 16:31
Im not a C++ fan, but it is capable
Jason Luboff
@JLuboff
Apr 06 2018 16:32
@Blauelf Probably better from me to use COALESCE anyhow.. its a SQL standard I believe, where as ISNULL is T-SQL specific
Kudzu
@czhower
Apr 06 2018 16:32
I find it to be far more complex than necessary and avoid it like the plague. I have only one C++ project currently and I hate it. Fortunately its small.
Nazar
@IsaakNazar
Apr 06 2018 16:33
if someone could help with React js. When a user inputs the same Recipe name as previous one there should be a warn message, it shows up on console, but not on a page.
codepen link
Kudzu
@czhower
Apr 06 2018 16:33
But C++ = $$$
Blauelf
@Blauelf
Apr 06 2018 16:33
@alpox LPC? Oh, well, spent too much time in MUDs :D (never wanted to apply for being a wizard/god/whatever, though, as I assume it takes some fun out of playing)
German MUD Unitopia is built with LPC.
Stephen James
@sjames1958gm
Apr 06 2018 16:40
@IsaakNazar Isn't that message in the modal which goes away
Kudzu
@czhower
Apr 06 2018 16:41
LPC or any lang - any start is good. :) What matters is where you go.
Stephen James
@sjames1958gm
Apr 06 2018 16:42
@IsaakNazar If you reopen the modal the message is there
Blauelf
@Blauelf
Apr 06 2018 16:45
I started with BASIC just because it was included with MS-DOS (as QBASIC). PEEK/POKE magic for accessing the mouse driver on interrupt 0x33 AKA 51 :D
Nazar
@IsaakNazar
Apr 06 2018 16:46
@sjames1958gm ah, sorry, I didnt notice that, My new question is how to prevent from inputting already existing recipe? cant figure out the logic, so only the warn message is not enough
Stephen James
@sjames1958gm
Apr 06 2018 16:48
Your insert handler should check for the recipe already there before invoking the parents
add, and don't close the modal until a valid recipe name is entered.
alpox
@alpox
Apr 06 2018 16:50
@Blauelf im god in unitopia =P
Thats where i started
Kudzu
@czhower
Apr 06 2018 16:52
I started in Basic too, but it was one of the few options at the time, and the only option on consumer level computers.
Nazar
@IsaakNazar
Apr 06 2018 16:53
@sjames1958gm and all this logic has to be implemented inside RecipeModal component, right?
Stephen James
@sjames1958gm
Apr 06 2018 16:53
Yes. I think so
Nazar
@IsaakNazar
Apr 06 2018 16:53
@sjames1958gm cool , thanx
CamperBot
@camperbot
Apr 06 2018 16:53
isaaknazar sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9172 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Kudzu
@czhower
Apr 06 2018 16:53
@Blauelf At least you had QBasic.... go back a decade + and basics were all line numbered :(
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:03
I am back
Christopher McCormack
@cmccormack
Apr 06 2018 17:04
@RoniqueRicketts :wave:
Jason Luboff
@JLuboff
Apr 06 2018 17:04
@cmccormack :wave:
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:04
sup brucv @cmccormack
Christopher McCormack
@cmccormack
Apr 06 2018 17:04
@JLuboff yo
What are we up to this lazy Friday
Jason Luboff
@JLuboff
Apr 06 2018 17:05
Whats good on this Friday morning?
Christopher McCormack
@cmccormack
Apr 06 2018 17:05
haha
Jason Luboff
@JLuboff
Apr 06 2018 17:05
oh it aint lazy for me. Been non stop work. Only taking a little snack break lol
Christopher McCormack
@cmccormack
Apr 06 2018 17:05
Finishing up a few work things then going to dig into some code
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:05
@JLuboff my code :) my personal project
Christopher McCormack
@cmccormack
Apr 06 2018 17:06
@RoniqueRicketts what are you working on?
@JLuboff Fridays are meant to be lazy! Even if you get a bunch done there usually isn't anyone around to appreciate it :D
Nazar
@IsaakNazar
Apr 06 2018 17:06
@sjames1958gm so, to be precise, I should disable hittingenter key and save button until the condition is false?
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:07
@cmccormack a School app that acts as a grading system for schools, It will also have a learning session for kids, with games and such but I am staring out from the grading process
Christopher McCormack
@cmccormack
Apr 06 2018 17:07
@IsaakNazar that may be confusing to the user, maybe better to pass an error to the modal if they try to save and it already exists
Jason Luboff
@JLuboff
Apr 06 2018 17:07
I agree... normally Friday's are lazy.. but this entire week has been probably my busiest ever at work lol Still catching up from yesterday..
Christopher McCormack
@cmccormack
Apr 06 2018 17:07
@RoniqueRicketts wow ambitious!
and here I am just working on my stupid voting app still :joy:
Stephen James
@sjames1958gm
Apr 06 2018 17:07
@IsaakNazar You could keep the buttons active and just not close the modal if the data is not valid
Nazar
@IsaakNazar
Apr 06 2018 17:08
ok
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:08
@cmccormack lol, i haven't started that bruv lol. Jamaica needs software to help fix out economy
Stephen James
@sjames1958gm
Apr 06 2018 17:09
@IsaakNazar You could have handlers on the recipe name input change and put up the error if there is already a recipe with that name, which is more ambitious
Nazar
@IsaakNazar
Apr 06 2018 17:09
@cmccormack I've already passed an error, but not implemented from inputting same recipes
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:10
@cmccormack It may be bigger than myself but I shall try it and see how it works. :)
Christopher McCormack
@cmccormack
Apr 06 2018 17:10
@RoniqueRicketts you going to go at it like a pro? UML diagrams, sketches, user stories, etc?
Kudzu
@czhower
Apr 06 2018 17:11
@RoniqueRicketts Jamaica like much of the Caribbean has serious governance issues which make it unattractive for businesses to locate there, especially software shops. Small changes in governance could do wonders.. but...
I was working to move an offshore center to the Caribbean a few years back and I also ran a major service center which covered Jamaica.
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:12
@cmccormack I have designed a little sketch last year but I didn't start building until this year. I ddid't do any user stories. I am just building hehehe
Kudzu
@czhower
Apr 06 2018 17:12
This is why India, Romania, Russia, China all do well but the Caribbean typically has mostly small shops, and everyone else leaves for the US or elsewhere :(
Its a shame, a smart Caribbean country could become a major offshore center for dev or even a Caribbean Singapore.. but the govts are all to short sighted.
Christopher McCormack
@cmccormack
Apr 06 2018 17:14
@RoniqueRicketts if I've learned anything it's that you should definitely try to get some user stories, you may build something noone really wants to use other than yourself
Kudzu
@czhower
Apr 06 2018 17:14
Where I was, nearly every aspiring software dev eventually left. I only know of one that didnt and I was even involved in the college teaching.
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:15
@czhower Damn, you know it bruv. Are you sure your not Jamaican. I am a part of a small group of young developers who want to make this place a little better and more Tech friendly for visitors.
Kudzu
@czhower
Apr 06 2018 17:15
Im not Jamaican, but I'm Caribbean of sorts and many of my neighbors and friends are Jamaican.
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:16
@czhower very short sighted. I wish they would make Jamaica attractive with tech.
@cmccormack ok noted
Kudzu
@czhower
Apr 06 2018 17:16
Maybe you can take General Saunders back. Other Caribbean leaders think he is a wiz :(
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:17
@czhower TBH if I get a Programming job offshore I'll leave too.
@czhower dat a gud ting mon. yuh caa consida yuhself yaadie. hehehe :)
Kudzu
@czhower
Apr 06 2018 17:17
Which is a shame, but I know the reality. The Caribbean govts are fostering the brain drain.
yah, me neighbor say he uh yardie :)
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:19
@czhower but muss mi gena, yuh a yaadie mon! yuh know bo e struggle we deh go unda.
Kudzu
@czhower
Apr 06 2018 17:19
@RoniqueRicketts Today is Fri so Im pretty tied up, but if you want to PM me tmw I might be able to help you a bit with your Jamaican venture as I have set up and run Caribbean based tech companies before. In fact I ran the MSI service center for 7 years which included Jamaica.
Christopher McCormack
@cmccormack
Apr 06 2018 17:21
Man what are the odds
Kudzu
@czhower
Apr 06 2018 17:21

Part of the reason so many Jamaicans here is that Jamaica is worse than many other Caribbean nations for taxes and many other things so they move here and to other Caribbean island if they dont go US... Many if not most of the doctors here are either Cuban or Jamaican...

And software devs.. well no Caribbean places is attractive for a variety of reasons from taxes, to unreliable internet, unreliable electric and more...

Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 17:21
But seriously, we could do well with the smarts we have here. We have people here build cars, helicopters, making machines that converts plastic to diesel and cooking gas, I have over 25 developers in my little circle, most of which has to work for some foreign company and the Government only ignore these people. We have people here in little Jamaica working for GOOGLE!!! WTF?!!!!
Kudzu
@czhower
Apr 06 2018 17:24
yep!
Smarts isnt the problem. Its the huge barriers presented by the govt and infra.
Christopher McCormack
@cmccormack
Apr 06 2018 17:36
Just have to outsmart the officials somehow, gotta think like a raccoon and dig up some trash on them!
Kudzu
@czhower
Apr 06 2018 17:37
or fly under the radar.....
I've given up trying to change them. Here is very small. I know the PM, but thats no big deal here.. everyone does. But even then, they are all too myopic.
Christopher McCormack
@cmccormack
Apr 06 2018 17:39
That's only a problem if they don't see a benefit for themselves long term, right? So maybe present a way for the country to benefit long term while providing a symbiotic benefit for the leadership
Kudzu
@czhower
Apr 06 2018 17:41
The Caribbean govts dont care long term. Their length of caring is till next election and mostly what can line their pockets.
Most Caribbean countries dont even require campaign funds to be reported at all......
Do the math from there :)
Christopher McCormack
@cmccormack
Apr 06 2018 17:42
the relationship CAN be monetary
Kudzu
@czhower
Apr 06 2018 17:43
Even if you solve that, you have to solve unreliable expensive internet access, and even more important, same for electricity...and then the tax systems are ancient and draconian for tech workers...
Christopher McCormack
@cmccormack
Apr 06 2018 17:44
That would be part of the solution you would present though - spending money on infrastructure and recruiting talent will then lead to increased income which will benefit both the country and the leadership.
Probably need someone very persuasive though
Kudzu
@czhower
Apr 06 2018 17:45
Thats longer than the election cycle and it affects all aspects of life and business. If they cant such a major issue, you or I are unlikely to do so... they like Madoff types... just look at where Madoff operated and was welcomed in so many Caribbean places.
Christopher McCormack
@cmccormack
Apr 06 2018 17:47
It's too bad they can't see the speed of innovation - it could be a very fast transition if they put the necessary work into it
Kudzu
@czhower
Apr 06 2018 17:48
Yep....
I was working 10 years ago with a govt in the Caribbean.. but gave up because the corruption was standing in the way.....
if it didnt have short term $$.. it was all lip service.
and I mean short term $$ for them.
Ever read "Don't stop the Carnival"? Thats a handbook....
Its sad and odd.. but a few changes and Cuba might be eating all our lunches in the Caribbean
Christopher McCormack
@cmccormack
Apr 06 2018 18:01
Yup
Christopher McCormack
@cmccormack
Apr 06 2018 18:18
How would anyone suggest handling repeat votes in the voting app? I was considering using a 24hr timer for users and something similar using session ID for non-authenticated users but maybe there's a nicer way?
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 18:19
@cmccormack you can get the user ip
Christopher McCormack
@cmccormack
Apr 06 2018 18:19
@tiagocorreiaalmeida :wave: yeah I tossed that idea out considering how many people may be behind a NAT IP
Jason Luboff
@JLuboff
Apr 06 2018 18:20
@cmccormack I used sessions but since I didn't have a session store, it was only persistent for the time the user was on the page
Or until their cache was cleared can't remember
If they logged in, then I stored that in my database
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 18:21
@cmccormack sorry, that makes completly sense, my bad :D so yeah maybe a 24hours timer could work well for that
Christopher McCormack
@cmccormack
Apr 06 2018 18:21
@JLuboff that may be the way I go. It means they can pop into another browser or clear their cache or whatever and vote again, but I think that's more an issue with the User Story than the app anyhow
Jason Luboff
@JLuboff
Apr 06 2018 18:22
Correct
Christopher McCormack
@cmccormack
Apr 06 2018 18:22
@tiagocorreiaalmeida no worries it was actually my first choice until I started considering the implications
Jason Luboff
@JLuboff
Apr 06 2018 18:22
And in the video, I think only authenticated users can vote but the user stories I think says any one?
Christopher McCormack
@cmccormack
Apr 06 2018 18:22
@tiagocorreiaalmeida @JLuboff thanks
CamperBot
@camperbot
Apr 06 2018 18:22
cmccormack sends brownie points to @tiagocorreiaalmeida and @jluboff :sparkles: :thumbsup: :sparkles:
:cookie: 513 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
:star2: 2393 | @jluboff |http://www.freecodecamp.org/jluboff
Christopher McCormack
@cmccormack
Apr 06 2018 18:22
User Story: As an unauthenticated or authenticated user, I can see and vote on everyone's polls.
Jason Luboff
@JLuboff
Apr 06 2018 18:22
@cmccormack You could also create a persistent session store, but I have no experience with that
Ya, there you go lol
Christopher McCormack
@cmccormack
Apr 06 2018 18:23
it's the only user story I really don't like :) it's not like it costs anything to create a user account
Jason Luboff
@JLuboff
Apr 06 2018 18:23
Yup
Christopher McCormack
@cmccormack
Apr 06 2018 18:23
I'm not sure how you could make a persistent session store if an unauthenticated user can just create a new session
But I may also not understand what you're saying haha
I believe I do actually store my sessions in Mongo
Is this what you mean?
// Initialize Passport and enable persistent login sessions stored in mongodb
const sessionOptions = {
  secret: 'cmccormack-voting-app-or-is-it?',
  resave: false,
  saveUninitialized: true,
  cookie: { secure: false },
  store: new MongoStore({ mongooseConnection: db }) // <= this little guy right here?
}
app.use(session(sessionOptions))
Jason Luboff
@JLuboff
Apr 06 2018 18:25
As I have no experience with persistent session stores (I always just used the local session) I'm not sure how to maintain the session when using a session store or how it gets linked back to an unauthenticated user
I think so.
Christopher McCormack
@cmccormack
Apr 06 2018 18:26
I honestly only remember like 1/10 of what it took to get all this stuff working together
now that it's working it's like a glass castle and I'm not going near it haha
Jason Luboff
@JLuboff
Apr 06 2018 18:30
:joy:
Good luck.. gotta go setup some monitors
Christopher McCormack
@cmccormack
Apr 06 2018 18:32
@JLuboff thanks see ya
CamperBot
@camperbot
Apr 06 2018 18:32
cmccormack sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
api offline
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 18:43
@czhower True the Govenment only care about the Election. @cmccormack In the Caribbean they train us but they will outsource for people who has the same skillset they train for out here.+
Nate Mallison
@NJM8
Apr 06 2018 19:17
@cmccormack I think any data you store in a session if you are using the cookie-sessions module will persist for you
sorry
cookie-session
not cookie-sessions, they are different,
Anyways here is a simple app I made: https://github.com/NJM8/users-shoppinglist-app
Christopher McCormack
@cmccormack
Apr 06 2018 19:18
@NJM8 yeah that much I understand. My sessions all work great, my only question is how to prevent repeat votes, at least within a designated time period. If you were unauthenticated all you would have to do is switch browsers and you'd get a new session
Nate Mallison
@NJM8
Apr 06 2018 19:19
hmmm
I think not allowing unauthenticated votes is really the only option
I mean if you don't know who is voting you have no way to check
Moisés Man
@moigithub
Apr 06 2018 19:20
IF i recall.. some ppl used IP info to handle unauthenticated users
Nate Mallison
@NJM8
Apr 06 2018 19:21
people can always get around it, but the more you do to double check the less cheaters there will be, verify full name, ip address, session cookies, and email address
Christopher McCormack
@cmccormack
Apr 06 2018 19:21
@NJM8 yup but the user story prevents me from forcing authentication to vote :)
@moigithub IP would work OK but it would also prevent all people behind the same IP address to not be able to vote.
Nate Mallison
@NJM8
Apr 06 2018 19:23
Is this an FCC challenge?
Christopher McCormack
@cmccormack
Apr 06 2018 19:25
yup

https://www.freecodecamp.org/challenges/build-a-voting-app

User Story: As an unauthenticated or authenticated user, I can see and vote on everyone's polls.

Making it work in SOME way should be easy, but I was hoping to find a nicer solution
Nate Mallison
@NJM8
Apr 06 2018 19:27
huh
weird they set it up that way
note they don't say you have to prevent repeat votes
I think I would just store a cookie on the users browser when they vote and if that cookie is there they can't again. leave it at that
IRL I don't think you would allow unauthenticated voting on something that really mattered
unless it was the US election
ooooooooooohhhhh
Jason Luboff
@JLuboff
Apr 06 2018 19:30
But allowing repeat votes defeats the purpose of a voting app :D
Nate Mallison
@NJM8
Apr 06 2018 19:31
right, which is why the user story that allows unauthenticated users to vote makes no sense
plus they don't say you shouldn't allow repeat votes
that's a user story problem not a dev problem.
Christopher McCormack
@cmccormack
Apr 06 2018 19:34
I also want it to be a good app :D
repeating votes would be like the first thing a tester would test
@cmccormack give a try to mocha and chai this way youdont have to test it manually and if you change something and tests start break you can see if you made any big mistake
I didnt like it before, but after a while start makes sense to use it :D
Christopher McCormack
@cmccormack
Apr 06 2018 19:37
@tiagocorreiaalmeida are you referring to those drink flavors in the context of codefights or the voting app?
Ronique Ricketts
@RoniqueRicketts
Apr 06 2018 19:37
I am back again
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 19:38
ahah voting app
by the way join the codefights tournament :D
Christopher McCormack
@cmccormack
Apr 06 2018 19:39
@tiagocorreiaalmeida i'm still not sure what it even is!
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 19:39
mocha and chai?
Christopher McCormack
@cmccormack
Apr 06 2018 19:39
codefights
website doesn't seem to have a faq
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 19:39
its a coding platform that has arcade mode, coding tournaments, weekly coding challenges and you can also fight company bots
Christopher McCormack
@cmccormack
Apr 06 2018 19:40
I don't know what it means to fight with code
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 19:41
in a simple way, the one that gets a solution faster and writes it down wins it
Christopher McCormack
@cmccormack
Apr 06 2018 19:41
ohhh
I feel like I would be terrible at that haha
I mean, I've been working on the first web app for like 4 months now
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 19:42
I got a bit addicted to it lately
its algoritthms mostly
so give it a try :D
and since there's a limit time half of them are quite simple so you can solve them in time
Christopher McCormack
@cmccormack
Apr 06 2018 19:44
I kind of burnt out on that kind of stuff doing Project Euler, Codewars, exercism.io, etc...
It was pretty fun at the time though
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 19:48
no worries, only invited to have a bit of fun, how's the app going tough ?
Christopher McCormack
@cmccormack
Apr 06 2018 19:49
Really well, I'm definitely on the downward slope and putting all these technologies together has really helped deepen my understandings
Probably should be done within the next couple weeks, maybe sooner, then I may try out mocha chai and redux or Context on the next project
@tiagocorreiaalmeida did you finish off your webapps?
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 19:53
yeah the last one was a music related one I think I showed you? lately have been writing some api's and using mocha and chai, and will probably implement some client side this time
or you mean the fcc ones?
cause if you mean those, I regret not knowing react back then :D
Christopher McCormack
@cmccormack
Apr 06 2018 19:56
Yeah I can't see myself doing it all in templates or by hand, but I may end up doing that just to burn through the remaining projects lol
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 19:58
ahaha, I will be honest, I feel its faster and more interesting with react, could be wrong
Amit Patel
@AmitP88
Apr 06 2018 19:58

hey guys, I've ported my local weather app over to github and am working on it locally. However, I've noticed that on my gh-pages link that it takes a long time for the location and weather data to show up on the page, even after allowing the browser to track my location

demo: https://amitp88.github.io/Local-Weather-App/
repo: https://github.com/AmitP88/Local-Weather-App

Daniel Simeonov
@dbsimeonov
Apr 06 2018 20:02
Guys just got an idea for a background which is like different styles text running and changing/typing constantly. Have you seen something similar on the web that I can try to recreate? Couldn't find anything from google
Christopher McCormack
@cmccormack
Apr 06 2018 20:02
@tiagocorreiaalmeida yeah when you first start and have all these disparate technologies and trying to work them together it's tough but now with experience the next one may be a bit easier
@dbsimeonov that sounds exactly like something you should try to create yourself, before finding another example
Daniel Simeonov
@dbsimeonov
Apr 06 2018 20:03
hmmmm you are right! I will get to work +1
Christopher McCormack
@cmccormack
Apr 06 2018 20:05
@AmitP88 yeah that is really slow
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 20:05
@alpox interesting one, how much time this took you to do ?:D
Christopher McCormack
@cmccormack
Apr 06 2018 20:07
@AmitP88 I imported it to glitch and it's still slow, may be the api https://amit-weather.glitch.me/
alpox
@alpox
Apr 06 2018 20:08
@tiagocorreiaalmeida about 15-30 min
I think
Maybe a bit more until I understood the question right when reading :D
Christopher McCormack
@cmccormack
Apr 06 2018 20:09
@AmitP88 hmm why are you using watchPosition?
Amit Patel
@AmitP88
Apr 06 2018 20:10
@cmccormack lol I don't know. I made this app over a month ago. I'm just returning to it to clean up the design :P
Christopher McCormack
@cmccormack
Apr 06 2018 20:11
@AmitP88 hah you keep doing that, gotta follow through more often :p
Tiago Correia
@tiagocorreiaalmeida
Apr 06 2018 20:14
@alpox yeah looks a bit confusing :\
but will give it a try
alpox
@alpox
Apr 06 2018 20:15
Not atm :D
Amit Patel
@AmitP88
Apr 06 2018 20:16
@cmccormack lol I know. When I first started doing fcc I was rushing, but now i'm slowing down and taking my time on polishing my projects
I have a few days off work, so I figured this would be the perfect time to do so
Christopher McCormack
@cmccormack
Apr 06 2018 20:16
@AmitP88 using Chrome or FF?
Amit Patel
@AmitP88
Apr 06 2018 20:17
Chrome
Christopher McCormack
@cmccormack
Apr 06 2018 20:17
@AmitP88 oh that's cool
try it in FF - it's at least working in FF, not working consistently in Chrome for me
seems like Chrome want's you to use geolocation as part of an event handler maybe?
[Violation] Only request geolocation information in response to a user gesture.
@AmitP88 I did this project back when codepen was http only so we couldn't use navigator in chrome, so I used this - you may want to try it, up to you https://freegeoip.net
Amit Patel
@AmitP88
Apr 06 2018 20:21
@cmccormack hmmm, seems interesting. In FF, it's slightly faster, but still pretty slow. Plus, it shows Shuzenji, JP
82 ℉ data instead of the users location.
oh wait, it changed to my location
but it took a while to do so
I think I'm going to have to review and refactor this project
Christopher McCormack
@cmccormack
Apr 06 2018 20:23
is this your code or the code I am testing on glitch?
your code looks pretty fine, I think the problem may be in the browser
Try adding a button click for your first call to the navigator instead of having it run immediatly
Amit Patel
@AmitP88
Apr 06 2018 20:25
ahh ok. so that way it'll give the app time to fetch the location data?
brb
Christopher McCormack
@cmccormack
Apr 06 2018 20:28
no more about the violation error chrome threw
Nate Mallison
@NJM8
Apr 06 2018 20:30
Are you using the weather api from FCC? It can be slow and inaccurate sometimes. I would randomly get hot temperatures sometimes
Christopher McCormack
@cmccormack
Apr 06 2018 20:32
seem inconsistent between browsers though
https://glitch.com/edit/#!/amit-weather?path=app.js:20:37 you don't see the url logged when it loads, at least not in chrome
Christopher McCormack
@cmccormack
Apr 06 2018 20:39
@AmitP88 can you try this out - is it slow as well? https://codepen.io/cmccormack/pen/dmQGEe?editors=1010
Jason Luboff
@JLuboff
Apr 06 2018 20:40
I dunno whats going on.. but it wasn't slow for me
Christopher McCormack
@cmccormack
Apr 06 2018 20:40
Super slow for me, if it even works in Chrome
takes about 2 seconds in FF
Amit Patel
@AmitP88
Apr 06 2018 20:41
Nah, this one's fast
Jason Luboff
@JLuboff
Apr 06 2018 20:42
I'm getting under 2 seconds and thats including the time for me to click the allow notification
(In FF)
At least according to my console.time()
Christopher McCormack
@cmccormack
Apr 06 2018 20:48
I seem to always have issues with navigator in Chrome. When I did my weather app I had to fake my geolocation when testing
Jason Luboff
@JLuboff
Apr 06 2018 20:48
Were you running via https back then? If not...that would have been why..
Christopher McCormack
@cmccormack
Apr 06 2018 20:48
it was local so I wasn't affected by codepen http
Jason Luboff
@JLuboff
Apr 06 2018 20:49
Ah
well..still..if you were running local..you would have been running non-secure and thus chrome wouldn't of allowed it (I could be wrong here..)
Christopher McCormack
@cmccormack
Apr 06 2018 20:49
I believe it specifically allows it if you're running local
I remember reading it, and it's worked in other places
Jason Luboff
@JLuboff
Apr 06 2018 20:51
Good to know
Markus Kiili
@Masd925
Apr 06 2018 20:51
Evening.
Jason Luboff
@JLuboff
Apr 06 2018 20:51
Afternoon!
Christopher McCormack
@cmccormack
Apr 06 2018 20:51
@Masd925 yo
Conor Murphy
@cmurphy580
Apr 06 2018 20:52
Does anyone have experience with firebase and react?
Christopher McCormack
@cmccormack
Apr 06 2018 20:58
@cmurphy580 not really but is the question about firebase or react, as they are different things?
tundeiness
@tundeiness
Apr 06 2018 21:07

hi all what is the base url to check for Twitchtv Streams? I have this

https://wind-bow.glitch.me/twitch-api/streams/ freecodecamp

but I keep getting errors

the correct base URL please
Jason Luboff
@JLuboff
Apr 06 2018 21:11
@tundeiness You have a space thats causing issues
Conor Murphy
@cmurphy580
Apr 06 2018 21:16
@cmccormack fiebase ill check this out
tundeiness
@tundeiness
Apr 06 2018 21:24
@JLuboff seen and corrected. mucho gracias
CamperBot
@camperbot
Apr 06 2018 21:24
tundeiness sends brownie points to @jluboff :sparkles: :thumbsup: :sparkles:
:star2: 2394 | @jluboff |http://www.freecodecamp.org/jluboff
Nate Mallison
@NJM8
Apr 06 2018 22:03
anyone here use firefox?
Jason Luboff
@JLuboff
Apr 06 2018 22:04
I do
Nate Mallison
@NJM8
Apr 06 2018 22:04
familiar with the new debugger>
?
I'm trying to watch variables with breakpoints but the debugger isn't stopping
Jason Luboff
@JLuboff
Apr 06 2018 22:04
I haven't really ever used it, no
Nate Mallison
@NJM8
Apr 06 2018 22:04
ok
huh, seems to be working now
looks like by default it's set to pause only on errors
how dumb, and the tutorials don't mention it. A+
Henry
@GitHub-Henry
Apr 06 2018 22:13
@NJM8 how does ff debugging compare to chome debugging?
Brad
@bradtaniguchi
Apr 06 2018 22:50
@GitHub-Henry Whoa... I legit was looking that up >.>
Henry
@GitHub-Henry
Apr 06 2018 22:55
@bradtaniguchi learn anything about the differences?
Brad
@bradtaniguchi
Apr 06 2018 22:55
@GitHub-Henry Nope, cuse I got side tracked haha, do you know any differences? I use firefox on my laptop since It doesn't eat as much ram. But I never tried the debugger with vscode
Henry
@GitHub-Henry
Apr 06 2018 22:56
@bradtaniguchi I use chrome for client side JS and use VS Code for node JS stuff
Jason Luboff
@JLuboff
Apr 06 2018 22:58
I use FF and Edge on my work computer....
Brad
@bradtaniguchi
Apr 06 2018 23:05
Edge? 80
Jason Luboff
@JLuboff
Apr 06 2018 23:06
Ya you know, that new fangled browser from Microsoft
Blauelf
@Blauelf
Apr 06 2018 23:07
Available on Windows 10 only...
Jason Luboff
@JLuboff
Apr 06 2018 23:07
Mmmmm... it was available in 8 as well if I remember correctly
Henry
@GitHub-Henry
Apr 06 2018 23:07
@JLuboff cutting edge stuff
Jason Luboff
@JLuboff
Apr 06 2018 23:08
Ah...nevermind, it is Windows 10
@GitHub-Henry Damn right!
I actually just mainly use it for searches to get my Bing/Microsoft rewards
Daniel Simeonov
@dbsimeonov
Apr 06 2018 23:09
Guys can you just give me a tip? https://codepen.io/DSimeonov/pen/OvaXGQ?editors=0011
Trying to set this function on intervals to loop again and again
Jason Luboff
@JLuboff
Apr 06 2018 23:09
I do all my testing in FF
Then verify things work in Edge and Chrome (and if I must, IE)
Kudzu
@czhower
Apr 06 2018 23:10
@Blauelf - regarding your issue with JS operators...
blob
kyle-kauzlarich
@kyle-kauzlarich
Apr 06 2018 23:11
what happened to the main FCC room
Jason Luboff
@JLuboff
Apr 06 2018 23:11
@kyle-kauzlarich They deleted it
Christopher McCormack
@cmccormack
Apr 06 2018 23:11
I destroyed it with my javascript skills
kyle-kauzlarich
@kyle-kauzlarich
Apr 06 2018 23:12
@czhower on random JS things without running it what would this come out to? [[][[]]+[]][+[]][++[+[]][+[]]]
Jason Luboff
@JLuboff
Apr 06 2018 23:12
@cmccormack You're still on? I'd thought you'd be off and starting the weekend!
Kudzu
@czhower
Apr 06 2018 23:12
my eyes are too blurry right now to even match those brackets up...
Christopher McCormack
@cmccormack
Apr 06 2018 23:12
@dbsimeonov setInterval takes a reference to a function as the first argument - you're invoking the function instead, which means only the return value of your generator function will be passed, not the reference to the function
kyle-kauzlarich
@kyle-kauzlarich
Apr 06 2018 23:12
ah
Christopher McCormack
@cmccormack
Apr 06 2018 23:13
@dbsimeonov get rid of the () on generator
Kudzu
@czhower
Apr 06 2018 23:13
would take a while to parse that by brain only
kyle-kauzlarich
@kyle-kauzlarich
Apr 06 2018 23:13
yeah its a strange one
Christopher McCormack
@cmccormack
Apr 06 2018 23:13
@JLuboff waiting for the wife to drive down :) writing a quick weather api in codepen with lots of notes that might help others
kyle-kauzlarich
@kyle-kauzlarich
Apr 06 2018 23:13
and easy to mess up
Daniel Simeonov
@dbsimeonov
Apr 06 2018 23:13
@cmccormack dead simple but still a huge mistake. Thanks man.
CamperBot
@camperbot
Apr 06 2018 23:13
dbsimeonov sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1397 | @cmccormack |http://www.freecodecamp.org/cmccormack
mstellaluna
@mstellaluna
Apr 06 2018 23:13
Jason Luboff
@JLuboff
Apr 06 2018 23:14
@cmccormack Ah. I haven't coded anything in a few days... so very sad..
Christopher McCormack
@cmccormack
Apr 06 2018 23:14
@JLuboff get on it buddy!
Jason Luboff
@JLuboff
Apr 06 2018 23:15
@cmccormack This week has been crazy busy for me. Just got caught up here... now cleaning my office since it was destroyed
Christopher McCormack
@cmccormack
Apr 06 2018 23:15
what happened? Earthquake?
Jason Luboff
@JLuboff
Apr 06 2018 23:16
@cmccormack Actually...ya there was an earthquake yesterday lol but thats not what caused it
Just a bunch of monitors and computers and boxes and cables and... you get the idea
Christopher McCormack
@cmccormack
Apr 06 2018 23:18
@JLuboff oh yeah haha
What do you think of this as simple training for newer syntax and API usage?
@JLuboff big plans for the weekend?
Jason Luboff
@JLuboff
Apr 06 2018 23:23
@cmccormack I think your explaination's in the comments are good, but a little confusing to follow due to the order
And no, no big plans as of yet. We're trying to figure out a little mini vacation though in the next few weeks. You?
Christopher McCormack
@cmccormack
Apr 06 2018 23:23
@JLuboff yeah it's a little tough when using const as they aren't hoisted
Daniel Simeonov
@dbsimeonov
Apr 06 2018 23:24

I know its simple but what do you think?
Just got motivated and pissed from js learning curve and finally made something from scratch for 20m :D

https://codepen.io/DSimeonov/pen/OvaXGQ?editors=0111

Christopher McCormack
@cmccormack
Apr 06 2018 23:25
@JLuboff you should visit here! There's a ReactJS Phoenix meetup on the 11th :p
Jason Luboff
@JLuboff
Apr 06 2018 23:25
Whats there to do there? (Besides a meetup haha) We're thinking of just driving up the coast as of right now. Maybe do like 4 days
Christopher McCormack
@cmccormack
Apr 06 2018 23:26
In Phoenix? Lots to do, and the mountains are only a couple hours away too
Blauelf
@Blauelf
Apr 06 2018 23:27
Jason Luboff
@JLuboff
Apr 06 2018 23:27
@cmccormack Hmmm... I'll consider it..
Christopher McCormack
@cmccormack
Apr 06 2018 23:29
Hah I'm sure you will
Jason Luboff
@JLuboff
Apr 06 2018 23:29
Lol
Kudzu
@czhower
Apr 06 2018 23:29
@Blauelf Thats good too...
Christopher McCormack
@cmccormack
Apr 06 2018 23:29
@dbsimeonov Pretty cool so far! going to change fonts too?
@Blauelf well I know what my first tattoo is going to be now
Daniel Simeonov
@dbsimeonov
Apr 06 2018 23:32
@cmccormack I'm planning to use it for a background on my portfolio. Thinking to get 4 or 5 fonts and figure out how apply them randomly. What do you think?
Actually I will just sort them inside an array and from there is easy.
Christopher McCormack
@cmccormack
Apr 06 2018 23:34
@dbsimeonov I think getting it to work as a background is interesting, I'd like to see how you work around text selection and all that
Daniel Simeonov
@dbsimeonov
Apr 06 2018 23:35
but its possible right? :D
Or I think to have a string already as background which will change random words in time intervals.. Would look better?
Christopher McCormack
@cmccormack
Apr 06 2018 23:37
It may be possible I"ve not tried. Making something not selectable is pretty simple though
@dbsimeonov I use this but maybe you can find another way.
.unselectable {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: default;
}
Daniel Simeonov
@dbsimeonov
Apr 06 2018 23:39
lol great, thanks man! Its time for bed but tomorrow will make it happen ;)
Christopher McCormack
@cmccormack
Apr 06 2018 23:43
Good luck!
Jason Luboff
@JLuboff
Apr 06 2018 23:46
Luck? We don't need luck!
anthonygallina1
@anthonygallina1
Apr 06 2018 23:46
:four_leaf_clover:
Jason Luboff
@JLuboff
Apr 06 2018 23:47
Now a four leaf clover, that we can use!
anthonygallina1
@anthonygallina1
Apr 06 2018 23:47
lol :)
Kudzu
@czhower
Apr 06 2018 23:47
In CSS, a little luck never hurts.
Considering how much trial and error is usually involved.
anthonygallina1
@anthonygallina1
Apr 06 2018 23:48
it gets better after much time
Jason Luboff
@JLuboff
Apr 06 2018 23:48
hence why I'll unashamely admit I just stick with CSS frameworks and only make minor modifications to the CSS as needed
anthonygallina1
@anthonygallina1
Apr 06 2018 23:49
cool
Jason Luboff
@JLuboff
Apr 06 2018 23:51
One day maybe I'll spend more time on CSS...
anthonygallina1
@anthonygallina1
Apr 06 2018 23:53
Doing the tables on this was a bear https://codepen.io/anthonygallina/pen/evQjWQ
I should make it look better I invested alot of time
Christopher McCormack
@cmccormack
Apr 06 2018 23:53
@anthonygallina1 yeah I bet, that's why I just used Bootstraps tables :D
anthonygallina1
@anthonygallina1
Apr 06 2018 23:54
I made my own responsive grid
Christopher McCormack
@cmccormack
Apr 06 2018 23:54
@anthonygallina1 something's wrong with your second item in the scoreboard
keep toggling the all time/recent button and you'll see it
@anthonygallina1 That's pretty cool though nice job
anthonygallina1
@anthonygallina1
Apr 06 2018 23:55
@cmccormack Yup whats wrong?
The members change rank
From 1 down. That part?
Christopher McCormack
@cmccormack
Apr 06 2018 23:56
@anthonygallina1 yeah it cycles through a few before it stops but why only that one I haven't looked into
Jason Luboff
@JLuboff
Apr 06 2018 23:57
Alright... time for the weekend.. Have a good one everyone
anthonygallina1
@anthonygallina1
Apr 06 2018 23:57
check the tables on phone size
that was the part that was a bear
Converting JSX etc
Christopher McCormack
@cmccormack
Apr 06 2018 23:57
@JLuboff later buddy have a good one
anthonygallina1
@anthonygallina1
Apr 06 2018 23:57
@JLuboff Good seeing you. Have a good time.
Christopher McCormack
@cmccormack
Apr 06 2018 23:59
@anthonygallina1 be wary of the way you're handling your promises and setState
@anthonygallina1 setState is async and you're not waiting for it to finish before running .then