These are chat archives for FreeCodeCamp/Help

19th
Feb 2018
where do i put
first=firstname&last=lastname
maybe i should be asking how do I use req.query?
i tryed it as mounting point i tryed it as the object value
Kyle Holm
@thekholm80
Feb 19 2018 02:16 UTC
this ?first=firstname&last=lastname would be part of the url
http://yoursite.com?first=firstname&last=lastname
then that gets parsed by express into req.query
Eric Miller
@ericmiller777
Feb 19 2018 02:18 UTC
could you give me an example?
wait
app.get("/name", function(req, res){
res.json({name: 'firstname lastname'});
});
thats what it said to do
Kyle Holm
@thekholm80
Feb 19 2018 02:19 UTC
so if i did http://yoursite.com/name?first=firstname&last=lastname
req.query would be { first: "firstname", last: "lastname" }
What am i missing in my code that i need to do?
returned {"name":"firstname lastname"}
Eric Miller
@ericmiller777
Feb 19 2018 02:21 UTC
.>;
lol
ummmmm thats embarassing
annnnyyyyyway, im still failing the challenge?
Kyle Holm
@thekholm80
Feb 19 2018 02:22 UTC
you need to get last out of there too
so you should have req.query.first and req.query.last
Eric Miller
@ericmiller777
Feb 19 2018 02:23 UTC
I think im not understanding somthing
Kyle Holm
@thekholm80
Feb 19 2018 02:23 UTC
so more like
Eric Miller
@ericmiller777
Feb 19 2018 02:24 UTC
am i supposed to be setting
route_path: '/library'
actual_request_URL: '/library?userId=546&bookId=6754' 
req.query: {userId: '546', bookId: '6754'}
where do those setting go? I thought that was like a visual representation of what was happening
Kyle Holm
@thekholm80
Feb 19 2018 02:24 UTC
app.get("/name", function(req, res){
  res.json({ name: `${ req.query.firstname } ${ req.query.lastname` });
});
so that you're building your response based on the query strings
Eric Miller
@ericmiller777
Feb 19 2018 02:25 UTC
i see
that makes sense
it couldve gave a better example, and the express documentation doesnt help that much :(
Kyle Holm
@thekholm80
Feb 19 2018 02:26 UTC
reading library docs should be a lesson
it's a nightmare trying to learn how to understand them
it took me over a month to realize that mongodb had docs for their terminal application and for the node api driver
Eric Miller
@ericmiller777
Feb 19 2018 02:27 UTC
@thekholm80 thanks
CamperBot
@camperbot
Feb 19 2018 02:27 UTC
ericmiller777 sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1703 | @thekholm80 |http://www.freecodecamp.org/thekholm80
Eric Miller
@ericmiller777
Feb 19 2018 02:27 UTC
im going to mongo next :(
would you recommend that or right into advanced node/express
?
Kyle Holm
@thekholm80
Feb 19 2018 02:27 UTC
i don't know, i haven't done any of the beta
Eric Miller
@ericmiller777
Feb 19 2018 02:27 UTC
oh okay
Kyle Holm
@thekholm80
Feb 19 2018 02:27 UTC
i like mongo though
it's still easier for me to understand than SQL
Eric Miller
@ericmiller777
Feb 19 2018 02:29 UTC
I've seen SQL and it scares me
lol
Kyle Holm
@thekholm80
Feb 19 2018 02:29 UTC
if you can master sql joins, you can master sql
at least, that was hardest for me
Eric Miller
@ericmiller777
Feb 19 2018 02:35 UTC
app.get("/name", function(req, res){
res.json({ name: `${req.query.firstname} ${req.query.lastname}`});
});
i get undefined
Kyle Holm
@thekholm80
Feb 19 2018 02:36 UTC
lol yeah
req.query.first && req.query.last
Eric Miller
@ericmiller777
Feb 19 2018 02:40 UTC
maybe im missing somthing?
Kyle Holm
@thekholm80
Feb 19 2018 02:40 UTC
since your query string is ?first= and &last= that's what the variables will be named
so ${req.query.firstname} ${req.query.lastname} will be undefined because you're using the wrong variable names
Gersho
@Gersho
Feb 19 2018 02:42 UTC
if you base your response based on string make sure they're escaped properly
you guys sure work hard on a sunday
you guys sure work hard on a sunday
Kyle Holm
@thekholm80
Feb 19 2018 02:42 UTC
i'm just watching youtube
Eric Miller
@ericmiller777
Feb 19 2018 02:43 UTC
got it
@thekholm80 @Gersho thanks
CamperBot
@camperbot
Feb 19 2018 02:43 UTC
ericmiller777 sends brownie points to @thekholm80 and @gersho :sparkles: :thumbsup: :sparkles:
api offline
:cookie: 602 | @gersho |http://www.freecodecamp.org/gersho
Eric Miller
@ericmiller777
Feb 19 2018 02:45 UTC
@Gersho that group i joined though it said was fine for anyone past the intermediate projects, i got till around thursday to get a basic understanding of node/express/mongodb lol
Gersho
@Gersho
Feb 19 2018 02:45 UTC
sounds cool
i'm on the dynamic programming problem set of cs50, i'm having a bit of trouble with it xD
Claudio Restifo
@Marmiz
Feb 19 2018 02:48 UTC
I liked CS50! was fun ^^
And teach you some important things that are totally overlooked in FCC
Gersho
@Gersho
Feb 19 2018 02:49 UTC
yep, the angle is very different
Kyle Holm
@thekholm80
Feb 19 2018 02:49 UTC
@Marmiz why do i get weird side-effects using window.addEventListener() in react?
@Marmiz why do i get weird side-effects using window.addEventListener() in react?
Gersho
@Gersho
Feb 19 2018 02:49 UTC
but the dynamic programming lecture was by another teacher than the usual one (David) and honestly it wasn't that clear xD
Claudio Restifo
@Marmiz
Feb 19 2018 02:50 UTC
@thekholm80 where are you trying to add it? To a React Component?
or outside of one
Gersho
@Gersho
Feb 19 2018 02:50 UTC
outside of one wouldn't seem very react compliant
Eric Miller
@ericmiller777
Feb 19 2018 02:50 UTC
@Gersho which cs50 course are you doing?
Kyle Holm
@thekholm80
Feb 19 2018 02:50 UTC
i put it in componentWillMount() (and removed it in componentWillUnmount())
Gersho
@Gersho
Feb 19 2018 02:50 UTC
the normal one ? the one called cs50
Eric Miller
@ericmiller777
Feb 19 2018 02:51 UTC
ah yes
I tryed to do the stanford one like 7 years ago, was very confusing
Claudio Restifo
@Marmiz
Feb 19 2018 02:52 UTC
@thekholm80 I think it's because you are adding it to a DOM that's not there yet.
Try in componentDidMount
Kyle Holm
@thekholm80
Feb 19 2018 02:52 UTC
@Marmiz that makes sense
what i was doing is kind of hacky anyway, i ended up using <element onKeyUp={ ... }>
Gersho
@Gersho
Feb 19 2018 02:53 UTC
i'm on week 7 (/11) it's pretty good @ericmiller777
Eric Miller
@ericmiller777
Feb 19 2018 02:54 UTC
@Gersho ive heard, im just still kind of put off from the one I tryed a long time ago, I think it was the first series stanford put on youtube, look slike they mightve removed it by now
Claudio Restifo
@Marmiz
Feb 19 2018 02:54 UTC

@thekholm80 from react docs:

Avoid introducing any side-effects or subscriptions in this method. For those use cases, use componentDidMount() instead.

Kyle Holm
@thekholm80
Feb 19 2018 02:55 UTC
i suspected it was the lifecycle hook causing it
Claudio Restifo
@Marmiz
Feb 19 2018 02:55 UTC
higly likely
Kyle Holm
@thekholm80
Feb 19 2018 02:55 UTC
react can die in a fire, i only want to write back end code from now on
Gersho
@Gersho
Feb 19 2018 02:56 UTC
come join python !
Claudio Restifo
@Marmiz
Feb 19 2018 02:56 UTC
@thekholm80 that's how you get SSR React! :laughing:
Kyle Holm
@thekholm80
Feb 19 2018 02:56 UTC
lol
Claudio Restifo
@Marmiz
Feb 19 2018 02:56 UTC
@Gersho Must be new because I don't remember any dynamic programming when I took it :)
Kyle Holm
@thekholm80
Feb 19 2018 02:57 UTC
@Gersho if i could think of any projects to use Python, i'd totally learn it
Claudio Restifo
@Marmiz
Feb 19 2018 02:58 UTC

@thekholm80

if i could think of any projects to use Python, i'd totally learn it

Pull some data from some popular videogame (PUBG, LOL, DOTA) and build a website with statistic, analysis and so on

Gersho
@Gersho
Feb 19 2018 02:58 UTC

Lecture 0Scratch
Lecture 1C
Lecture 2C, continued
Lecture 3Algorithms
Lecture 4Memory
Lecture 5Data Structures
Lecture 6HTTP
Lecture 7Dynamic Programming
Lecture 8Python
Lecture 9Python, continued
Lecture 10SQL
Lecture 11JavaScript
Lecture 12The End

that's the current course

Kyle Holm
@thekholm80
Feb 19 2018 02:59 UTC
@Marmiz that would be fun
Claudio Restifo
@Marmiz
Feb 19 2018 02:59 UTC
When I did it there was PHP and not Py :D @Gersho
Gersho
@Gersho
Feb 19 2018 03:00 UTC
oh btw their intro to html was hilarous it was like "ok so it's a <head> that's a <body>....now let's do some python server side code"
Kyle has an apple, Claudio has 3 bananas, calculate when and where their trains will meet
Kyle Holm
@thekholm80
Feb 19 2018 03:01 UTC
did you say they're using C9 now? when i did it they had us download a linux environment to run in vmware player
Claudio Restifo
@Marmiz
Feb 19 2018 03:01 UTC
@Gersho make sense. You are talking about a CS degree in uni, HTML and CSS are not programming languages, so i think it's enough to spend 5 minutes on how a tag looks like, what's a selector and then leave it to a " the rest is on documentation".
Gersho
@Gersho
Feb 19 2018 03:02 UTC
yep C9 (no Card number required), they also have an offline version (some whatever ubuntu in a docker)
@Marmiz true xD
Eric Miller
@ericmiller777
Feb 19 2018 03:22 UTC
@Marmiz we think that because we learned html a long time ago, im sure theres someone who could use help with it :)
who also just happened to suddenly decide to get a cs degree?
dunno how often that happens tho
Gersho
@Gersho
Feb 19 2018 03:25 UTC
well there was more html than what i said, i just found funny to start with backend xD
Claudio Restifo
@Marmiz
Feb 19 2018 03:29 UTC
@ericmiller777 not really, HTML and CSS are not programming languages... and I don't expect a university to waste time on that, there's not much important CS concept to learn from them.
(remember the focus is CS, not learn to make websites)
The same here, FCC don't teach you any data structure, O notation and so on, which make sense... it's not into the scope of what FCC is here for :)
Gersho
@Gersho
Feb 19 2018 03:30 UTC
html is a markup language and css ? i don't know
html is a markup language and css ? i don't know

Implement a program that measures the edit distance between two strings.

Implement a web app that depicts the costs of transforming one string into another, a la the below

that's what i'm supposed to do
Claudio Restifo
@Marmiz
Feb 19 2018 03:31 UTC
stylesheet language :)
Kyle Holm
@thekholm80
Feb 19 2018 03:31 UTC
one thing i never understood from cs50 was big O notation
Gersho
@Gersho
Feb 19 2018 03:32 UTC
well it measure the efficiency of your method (but in a not precise approach)
Kyle Holm
@thekholm80
Feb 19 2018 03:33 UTC
well, yeah, i get the premise, just not how to apply it
Gersho
@Gersho
Feb 19 2018 03:33 UTC
so you only know pretty much if runtime is linear, expo or static
Claudio Restifo
@Marmiz
Feb 19 2018 03:33 UTC
@thekholm80 the important aspect of big O is: if you can do that in one round is excellent, in a fraction of the amount of data is good, in the same amount of data is meh and in an exponential amount of data is bad :)
Kyle Holm
@thekholm80
Feb 19 2018 03:34 UTC
i mean, i get WHAT it is, i just never got the hang of how to calculate for myself
math was never my strength
Gersho
@Gersho
Feb 19 2018 03:34 UTC
you don't, at least not in a precise way
Eric Miller
@ericmiller777
Feb 19 2018 03:34 UTC
@Marmiz I feel they should try and teach some O notation
Gersho
@Gersho
Feb 19 2018 03:34 UTC
i suck at maths too :3
Eric Miller
@ericmiller777
Feb 19 2018 03:35 UTC
@Marmiz i feel they should teach some O notation
Gersho
@Gersho
Feb 19 2018 03:36 UTC
but it's more of a scale thing, it's either linear ( r = x ) expo (r = 2^x) or asymptotic (r = log(x) )
but it's more of a scale thing, it's either linear ( r = x ) expo (r = 2^x) or asymptotic (r = log(x) )
Claudio Restifo
@Marmiz
Feb 19 2018 03:37 UTC
@ericmiller777 there will be some once the beta will be live, I think in the external section.
I remember me and Manish had a run at it
Claudio Restifo
@Marmiz
Feb 19 2018 03:42 UTC

@thekholm80 there's not any real formula or calculation to make, it's a way to describe how many times your function run in relation to how the data grows.

Even on interviews they don't want you to calculate it, but to know if the function you just wrote is linear, scalar....

Kyle Holm
@thekholm80
Feb 19 2018 03:43 UTC
can i just assume it's logarithmic since my code is always garbage?
Gersho
@Gersho
Feb 19 2018 03:43 UTC
garbage is expo
Kyle Holm
@thekholm80
Feb 19 2018 03:43 UTC
okay lol exponential then
Gersho
@Gersho
Feb 19 2018 03:44 UTC
i don't know who was the teacher when you did cs50 but you should have a look at the big O lecture he explains it nicely
Kyle Holm
@thekholm80
Feb 19 2018 03:44 UTC
david milan or something like that
Claudio Restifo
@Marmiz
Feb 19 2018 03:44 UTC
@thekholm80 if it's logarithmic you won a teddy bear
Gersho
@Gersho
Feb 19 2018 03:45 UTC

david milan or something like that

Malan, it's still him

Manish Giri
@Manish-Giri
Feb 19 2018 03:45 UTC
actually garbage is factorial

@Marmiz

I remember me and Manish had a run at it

fun times

Kyle Holm
@thekholm80
Feb 19 2018 03:45 UTC
see @Manish-Giri knows, he's seen my code
Gersho
@Gersho
Feb 19 2018 03:45 UTC
:wave:
Manish Giri
@Manish-Giri
Feb 19 2018 03:45 UTC
should do it again soon
@thekholm80 lol :see_no_evil:
@Gersho :wave:
@Gersho how many scripts & sprites did you have in your pset 0
Gersho
@Gersho
Feb 19 2018 03:46 UTC

he's seen my code

when i ported my C to python, it took about +50% longer to run >.>

hmm not much, only enough for user stories, lemme check
Claudio Restifo
@Marmiz
Feb 19 2018 03:47 UTC
@Manish-Giri if I knew you were around I'd tag you right there.
Always in the shadow :shipit:
Kyle Holm
@thekholm80
Feb 19 2018 03:48 UTC
he's always around
except when he's not
Manish Giri
@Manish-Giri
Feb 19 2018 03:48 UTC
i only come here in search of dog memes
:thought_balloon:
Gersho
@Gersho
Feb 19 2018 03:48 UTC
but the internet is for cats !
Claudio Restifo
@Marmiz
Feb 19 2018 03:53 UTC

JS gurus, can I do something like

Object.assign({}, {key: value}, {null})

and be sure that the null is not added,
or I have to be a proper programmer and check first?

or better:
Object.assign({}, {key: value}, {key: null})
Kyle Holm
@thekholm80
Feb 19 2018 03:56 UTC
i'm not sure why you pass it the argument if you don't intend to use it?
isn't it Object.assign(target, ...sources)
Claudio Restifo
@Marmiz
Feb 19 2018 03:58 UTC
@thekholm80 spaghetti code. don't ask
Kyle Holm
@thekholm80
Feb 19 2018 03:58 UTC
lol
var obj = Object.assign({}, v1, null, v2, undefined, v3, v4); 
// Primitives will be wrapped, null and undefined will be ignored.
Claudio Restifo
@Marmiz
Feb 19 2018 04:01 UTC
what about {key: null}
dang! it's passed (make sense tho)
Kyle Holm
@thekholm80
Feb 19 2018 04:02 UTC
var v1 = 'abc';
var v2 = true;
var v3 = 10;
var v4 = Symbol('foo');
var v5 = { key: null };

var obj = Object.assign({}, v1, null, v2, undefined, v3, v4, v5); 
console.log(obj); // { "0": "a", "1": "b", "2": "c", key: null }
why does my background on my <p> white and not taking on the main background?
Claudio Restifo
@Marmiz
Feb 19 2018 07:27 UTC
@greggordoncode_twitter what do you mean by background white? The font color?
Moritz Reiter
@anothernode
Feb 19 2018 10:24 UTC
Hi, the text in challange 34 in the HTML & CSS course about the required attribute says that that attribute would not work in Safari (see screenshot), but in fact, at least in Safari's most recent stable version (11.0.3), it does. My question is: is it encouraged to file bug reports for small things like this or not?
Screen Shot 2018-02-19 at 11.20.29.png
Aditya
@ezioda004
Feb 19 2018 10:36 UTC
@anothernode The current challenges are bit old, they're working on beta and they removed that text from the beta challenge. Yeah ofcoure, reporting bugs is appreciated you can check the if the issue is know or not at fcc's github.
Moritz Reiter
@anothernode
Feb 19 2018 10:38 UTC
@ezioda004 All right, good to know, thanks! I guess in this particular case it’s not worth the effort, given that this bit is already removed in the next iteration anyway...
CamperBot
@camperbot
Feb 19 2018 10:38 UTC
anothernode sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 465 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Aditya
@ezioda004
Feb 19 2018 10:41 UTC
Yeah, the beta was suppose to come out during last Christmas, they're fixing the final bugs so it should be coming out soon
Moritz Reiter
@anothernode
Feb 19 2018 10:41 UTC
πŸ‘
Altin Rrahmani
@DevKosov
Feb 19 2018 11:07 UTC
@greggordoncode_twitter can you be more specific?
Nahuel Ovejero
@NahuelOvejero
Feb 19 2018 11:59 UTC
:wave: /help
@thekholm80 nice beard over there bro, it's have been so long? :P
Altin Rrahmani
@DevKosov
Feb 19 2018 12:00 UTC
@NahuelOvejero :wave: hi
Nahuel Ovejero
@NahuelOvejero
Feb 19 2018 12:08 UTC
@DevKosov sup bro!
Altin Rrahmani
@DevKosov
Feb 19 2018 12:18 UTC
nothing much just coding what about you?
Kyle Holm
@thekholm80
Feb 19 2018 14:15 UTC
@NahuelOvejero lol hey thanks
CamperBot
@camperbot
Feb 19 2018 14:15 UTC
thekholm80 sends brownie points to @nahuelovejero :sparkles: :thumbsup: :sparkles:
:cookie: 815 | @nahuelovejero |http://www.freecodecamp.org/nahuelovejero
Kaz Baig
@kbaig
Feb 19 2018 15:55 UTC
What's up room
I finally got back to the full stack projects last week after not touching them for several month
Kyle Holm
@thekholm80
Feb 19 2018 15:56 UTC
@kbaig :wave:
Kaz Baig
@kbaig
Feb 19 2018 15:56 UTC
Only to take hours to figure out how to pass an array as form data to my back end via Postman
@thekholm80 :wave:
Kyle Holm
@thekholm80
Feb 19 2018 15:56 UTC
i don't think i could live without postman
it's pretty much the greatest thing ever
Kaz Baig
@kbaig
Feb 19 2018 15:58 UTC
@thekholm80 isn't Postman deprecated though? My colleague recommended Insomnia which seems to be pretty good
Ken Haduch
@khaduch
Feb 19 2018 15:58 UTC
@kbaig @thekholm80 @DevKosov - happy Monday... :)
Kyle Holm
@thekholm80
Feb 19 2018 15:59 UTC
@khaduch hey ken
@kbaig i know that google apps are deprecated, i think postman has a stand-alone native app now
i haven't tried it yet
Kaz Baig
@kbaig
Feb 19 2018 16:01 UTC
@thekholm80 I thought it was still dependent on Chrome. I get a banner notification when I open it up
We recommend using the Postman native apps, but Postman is also available as a Chrome app. Read more about why support for the Postman Chrome app is being deprecated.
Kaz Baig
@kbaig
Feb 19 2018 16:03 UTC
o kk
Kelechi Chinaka
@ke1echi
Feb 19 2018 16:37 UTC
@Gersho how did u do isupper or ascii math? on caesar
StillCode88
@StillCode88
Feb 19 2018 17:21 UTC
Hiya FreeCode Community. I am looking for someone who meditates very regularly and a professional developer to speak with. After reading peter norvig's how to learn to program in 10 years, I find myself a bit on overload and need some focus.
Nahuel Ovejero
@NahuelOvejero
Feb 19 2018 17:22 UTC
I code daily working in a very professional envoirment, but I never have meditated on my life , so, not sure :P
Kyle Holm
@thekholm80
Feb 19 2018 17:23 UTC
i've caused mediation a time or two
@kbaig you know, now that I think about it I wouldn't be surprised if Postman's native app was made in Electron, in which case it would be dependent on Chromium
Kaz Baig
@kbaig
Feb 19 2018 17:28 UTC
@thekholm80 Yeah but that's not the same thing as being a Chrome app
Oh it looks like I'm actually not on the native app oops
Darren
@DarrenfJ
Feb 19 2018 17:44 UTC
morning fCC
Kyle Holm
@thekholm80
Feb 19 2018 17:44 UTC
@DarrenfJ :wave:
Darren
@DarrenfJ
Feb 19 2018 17:44 UTC
we have a day off today here and i've decided to play video games allday
XCOM
cause i saw some alien show recently and want to fight aliens and save earth
Kyle Holm
@thekholm80
Feb 19 2018 17:45 UTC
lol awesome
Darren
@DarrenfJ
Feb 19 2018 17:45 UTC
i mean, who doesn't want to save earth!!!!
also, sorta code related.. any newbies.. feel free to add your name to this project and get some git commits under yer belt: https://github.com/RomchyFCC/GitHub-Practice-For-All/issues
Sweet Coding :)
@SweetCodingInc
Feb 19 2018 17:51 UTC

i mean, who doesn't want to save earth!!!!

I know I don't ;)

Kaz Baig
@kbaig
Feb 19 2018 18:19 UTC
Man I wish I had the day off but IL doesn't really do this holiday
Is 9 days off in the year normal for the US?
Kyle Holm
@thekholm80
Feb 19 2018 18:21 UTC
i get 8 paid holidays + my birthday
Altin Rrahmani
@DevKosov
Feb 19 2018 18:22 UTC
@khaduch hey, sorry for replying late i wasn't around
@thekholm80 hi there
Kyle Holm
@thekholm80
Feb 19 2018 18:23 UTC
@DevKosov :wave:
Ken Haduch
@khaduch
Feb 19 2018 18:23 UTC
that's okay. I'm not here either... ;)
at least not all the time... :D
DevKosov @DevKosov understands
Ken Haduch
@khaduch
Feb 19 2018 18:24 UTC
:+1: @DevKosov
Kaz Baig
@kbaig
Feb 19 2018 18:29 UTC
@thekholm80 idk that seems like not a lot compared to other countries...
Kyle Holm
@thekholm80
Feb 19 2018 18:30 UTC
@kbaig well, i get 5 weeks of paid vacation to use as I see fit, as well. so it's not all bad
Kaz Baig
@kbaig
Feb 19 2018 18:30 UTC
@thekholm80 5 weeks per year?
Kyle Holm
@thekholm80
Feb 19 2018 18:30 UTC
yep
Kaz Baig
@kbaig
Feb 19 2018 18:31 UTC
wow
I get 18 days in a year that accrue @ 1.5 day / month
Altin Rrahmani
@DevKosov
Feb 19 2018 18:31 UTC
WOT
Kyle Holm
@thekholm80
Feb 19 2018 18:32 UTC
i never use it all though
Altin Rrahmani
@DevKosov
Feb 19 2018 18:32 UTC
@thekholm80 :clap:
Kyle Holm
@thekholm80
Feb 19 2018 18:32 UTC
working from home + taking time off to just hang out at home = hanging out at work
Darren
@DarrenfJ
Feb 19 2018 18:32 UTC
@thekholm80 sounds like a schweet deal
Kyle Holm
@thekholm80
Feb 19 2018 18:32 UTC
so i only use like 10 days a year lol
Kaz Baig
@kbaig
Feb 19 2018 18:33 UTC
Man when you get 1.5 days off per month you never wanna use them for sick days. That's the worst part of it I think
Kyle Holm
@thekholm80
Feb 19 2018 18:33 UTC
my company handles time off for hourly employees that way, you earn it throughout the year
salaried folks get it all at the first of the year
Gersho
@Gersho
Feb 19 2018 19:14 UTC
Hello /help
Kyle Holm
@thekholm80
Feb 19 2018 19:15 UTC
@Gersho :wave:
Gersho
@Gersho
Feb 19 2018 19:19 UTC

@kelechy

@Gersho how did u do isupper or ascii math? on caesar

char c = 'A';
if ((int) c == 65) {
// it is a "A"
}
Jacob Fines
@jfines
Feb 19 2018 20:37 UTC
happy presidents day

I'm having some trouble connecting an image into my html. The image resides in a different dir than where my html file is.

Can anyone help?

Kyle Holm
@thekholm80
Feb 19 2018 20:39 UTC
locally? use a relative path
what does your file structure for the project look like?
Jacob Fines
@jfines
Feb 19 2018 20:39 UTC

@thekholm80 I'm not sure what it's supposed to look like. I have the following to show what I have going on.

Pastebin: https://pastebin.com/TgAhwsUP

Path Used: img src="/var/www/portfolio/img/image-placeholder.jpg"

The first thing I tried was: img src="../img/image-placeholder.jpg"
Then: img src="./img/image-placeholder.jpg"
Then: img src="/img/image-placeholder.jpg"
And finally the first one listed here
Kyle Holm
@thekholm80
Feb 19 2018 20:41 UTC
src="../img/image-placeholder.jpg" should work
up one level .. then into /img/ then the file name
Jacob Fines
@jfines
Feb 19 2018 20:41 UTC
I'll try it again
@thekholm80 Yeah, idk why that wouldn't be the right path but all I get is the alternative text.
Kyle Holm
@thekholm80
Feb 19 2018 20:44 UTC
strange
Jacob Fines
@jfines
Feb 19 2018 20:44 UTC
I appreciate your help man
Gersho
@Gersho
Feb 19 2018 20:44 UTC
followin the way you build your file tree, why not do the natural link for the image too ?
Jacob Fines
@jfines
Feb 19 2018 20:45 UTC
@Gersho what do you mean?
natural link?
Gersho
@Gersho
Feb 19 2018 20:45 UTC
```

β”‚   β”œβ”€β”€ jquery-3.2.1.js -> ../libs/jquery-3.2.1.js
β”‚   β”œβ”€β”€ layout.css -> ../css/layout.css
β”‚   β”œβ”€β”€ script.js -> ../js/script.js
β”‚   └── style.css -> ../css/style.css
do the same for the image ? (i wouldn't do it at all personaly, but since you already did for the js and css, why not ?)
Jacob Fines
@jfines
Feb 19 2018 20:46 UTC
@Gersho oh... heh.. I call that a "sim" link. I never heard the other term natural link before
I didn't think you can do that with an image
Gersho
@Gersho
Feb 19 2018 20:46 UTC
your term is probably the right one then ;)
Kyle Holm
@thekholm80
Feb 19 2018 20:47 UTC
interesting, I just tried it locally and it's not working either.
Gersho
@Gersho
Feb 19 2018 20:47 UTC
i'm not good with semantics
Kyle Holm
@thekholm80
Feb 19 2018 20:47 UTC
never mind i'm dumb lol it's working
Gersho
@Gersho
Feb 19 2018 20:47 UTC
i won't say anything
Kyle Holm
@thekholm80
Feb 19 2018 20:48 UTC
image.png
Jacob Fines
@jfines
Feb 19 2018 20:48 UTC
I'm wondering if it's an alignment issue. With my code here I'm using css grid and flexbox to lay stuff out. Idk if I have a real space made for my image but then idk if that matters either
@thekholm80 What was making it NOT work when it didn't ?
maybe I'm making the same mistake
Kyle Holm
@thekholm80
Feb 19 2018 20:48 UTC
i forgot the .jpg
Jacob Fines
@jfines
Feb 19 2018 20:49 UTC
no, I got that
hmm
Gersho
@Gersho
Feb 19 2018 20:49 UTC
well good luck with that, i'm going afk
Jacob Fines
@jfines
Feb 19 2018 20:50 UTC
yeah, thanks
:)
Kyle Holm
@thekholm80
Feb 19 2018 20:52 UTC
@jfines do you see the image element in your console?
oh, you said it's showing the alt text so it should be there
Jacob Fines
@jfines
Feb 19 2018 20:54 UTC
@thekholm80 With chrome I do / with ff I don't ( see the image icon ) but both show the alt text
Hammad
@newnewb
Feb 19 2018 20:54 UTC

Guys, need help with event listener

element.addEventListener("ended", function(){ console.log('end')});

Is not working in chrome

Jacob Fines
@jfines
Feb 19 2018 20:55 UTC
@thekholm80 I'm using apache to server er' up locally. I wonder if I need to make an .htaccess file? <-- but that shouldn't be necessary.
Kyle Holm
@thekholm80
Feb 19 2018 20:56 UTC
oh i don't know anything about that
Jacob Fines
@jfines
Feb 19 2018 20:56 UTC
@newnewb stupid idea, but try clearing the cache ( it has worked for me in odd sitchuations)
I'm gonna take a break and come back to it
Kyle Holm
@thekholm80
Feb 19 2018 20:57 UTC
@newnewb are you sure your media is firing the 'ended' event?
Hammad
@newnewb
Feb 19 2018 20:58 UTC
@thekholm80 I made a test ran the code snippet on Chrome,Firefox & edge it only didn't log in chrome
Kyle Holm
@thekholm80
Feb 19 2018 20:58 UTC
oh, strange
Hammad
@newnewb
Feb 19 2018 20:59 UTC
@thekholm80 https://codepen.io/newnewb/pen/WMdVVX?editors=1111 try this one check if the console logs in your chrome
Kyle Holm
@thekholm80
Feb 19 2018 21:00 UTC
nothing in chrome or IE
Hammad
@newnewb
Feb 19 2018 21:01 UTC
@thekholm80 updated the code to have a visual effect rather than the console logging
in Chrome the text doesn't change, in firefox and edge it does
Aditya
@ezioda004
Feb 19 2018 21:06 UTC
@newnewb I think its because of the short duration of the sound files, it doesnt fully trigger/play
While in other browser you can see the difference
Hammad
@newnewb
Feb 19 2018 21:07 UTC
@ezioda004 Hey there, Okay let me try with a longer mp3 file maybe a couple of seconds
@ezioda004 I think you're onto something, updated it to play 10 seconds of silence
it triggered in chrome
Hammad
@newnewb
Feb 19 2018 21:13 UTC
@ezioda004 thanks, at least I know what's the matter with chrome now
CamperBot
@camperbot
Feb 19 2018 21:13 UTC
newnewb sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 467 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Aditya
@ezioda004
Feb 19 2018 21:13 UTC
Yeah, prob chrome doesnt trigger audios for shorter than 1 sec perhaps? Or even shorter
Hammad
@newnewb
Feb 19 2018 21:14 UTC
trial and error from now on
Kyle Holm
@thekholm80
Feb 19 2018 21:14 UTC
if not for trial and error i couldn't write any code
Aditya
@ezioda004
Feb 19 2018 21:14 UTC
I think @khaduch knows a workaround I think he suggested me or I'm being forgetful
Jacob Fines
@jfines
Feb 19 2018 21:19 UTC
Well, @Gersho If I link the image (like you say) it does work.
But this makes no sense to me why the paths not working just regular
it should work without the linking (including all the other files I had to link in). <-- it's getting to be a mess in my html dir
Gersho
@Gersho
Feb 19 2018 22:01 UTC

But this makes no sense to me why the paths not working just regular

i never said it would :D

Kelechi Chinaka
@ke1echi
Feb 19 2018 22:07 UTC
hey how it been @Gersho
JoΓ£o Novaes Barreiros
@Jon-Nova
Feb 19 2018 22:23 UTC
Hi everyone
I'm stuck on the challenge "ES6: Use Destructuring Assignment to Assign Variables from Objects"
This is my answer
function getLength(str) {
  "use strict";

  // change code below this line
  const length = {len: str.length}; // change this
  const {len} = length;
  // change code above this line

  return len; // you must assign length to len in line

}

console.log(getLength('FreeCodeCamp'));
Gersho
@Gersho
Feb 19 2018 22:24 UTC
@kelechy :wave: fine and you ? making progress ?
Kelechi Chinaka
@ke1echi
Feb 19 2018 22:31 UTC
little.., my logic flawed at some point @Gersho
i am barely awake, i'll take a fresh look tomoro
u want to take a look at code @Gersho
Gersho
@Gersho
Feb 19 2018 22:35 UTC
i've seen a bit in the cs50 room
Kelechi Chinaka
@ke1echi
Feb 19 2018 22:37 UTC
link
oh ok
Gersho
@Gersho
Feb 19 2018 22:38 UTC

i'd suggest


    // Normalise excessive ciphers
    while (caesar_key >= 26)
    {
       caesar_key -= 26;
    }

also you need to take into account that if you try convert for exemple "W" (87) if you add to it "5" you'll be outside of the alphabet (92 is "\")

Kyle Holm
@thekholm80
Feb 19 2018 22:39 UTC
@Jon-Nova these instructions are hard to understand. i've read through them about 5 times now and I'm still not sure what they're asking for. your solution seems reasonable to me
Kelechi Chinaka
@ke1echi
Feb 19 2018 22:43 UTC
if (isupper(plain_text[i]))
                 {
                     plain_text[i] = printf("%c", (plain_text[i] - 'A' + k) % 26 + 'A');
                 }
am trying to assign a letter to the ith index , dunno if am doing it right
Gersho
@Gersho
Feb 19 2018 22:44 UTC
i don't do ascii maths, i aalways use (int)
Kelechi Chinaka
@ke1echi
Feb 19 2018 22:44 UTC
C is head banging :smile:
typecasting?
JoΓ£o Novaes Barreiros
@Jon-Nova
Feb 19 2018 22:45 UTC
@thekholm80
it seems that last year, the question was different.
i found this video
https://www.youtube.com/watch?v=GbjTmXREMYI
Kyle Holm
@thekholm80
Feb 19 2018 22:45 UTC
@Jon-Nova i'm looking at the test and trying to figure out what they're expecting
"getUserInput => assert(getUserInput('index').match(/\\{\\s*length\\s*:\\s*len\\s*}\\s*=\\s*str/g),'message: destructuring with reassignment was used');"
Gersho
@Gersho
Feb 19 2018 22:46 UTC
dunno what it's called, but i do if ((int) s[i] >= 65 && (int) s[i] <= 90 ) to check for upper for exemple
Kelechi Chinaka
@ke1echi
Feb 19 2018 22:51 UTC
how did you find the index of the letter in alphabet @Gersho
Gersho
@Gersho
Feb 19 2018 22:52 UTC
it's index ? you mean like 1= A , 2=B etc ?
Kelechi Chinaka
@ke1echi
Feb 19 2018 22:52 UTC
yea
Gersho
@Gersho
Feb 19 2018 22:53 UTC
i don't use that, here's my code for upper case letter
    for (int i = 0, n = strlen(s); i < n; i++)
    {
        if ((int) s[i] >= 65 && (int) s[i] <= 90 )
        {
            // Uppercase characters
            if (s[i] + k > 90)
            {
                s[i] += (k - 26);
            }
            else
            {
                s[i] += k;
            }
        }
  }
k being the key and s the word
it's a bit dumb, but hey it works
Kelechi Chinaka
@ke1echi
Feb 19 2018 22:55 UTC
:smile: dumb code dont work
Gersho
@Gersho
Feb 19 2018 22:56 UTC
the approach of the problem is dumb, but the code is valid ;)
Kyle Holm
@thekholm80
Feb 19 2018 22:57 UTC
@Jon-Nova okay, figured it out
they're assuming you know that strings have object properties called length, so to destructure and assign it would be const { length: len } = str;
JoΓ£o Novaes Barreiros
@Jon-Nova
Feb 19 2018 23:00 UTC
@thekholm80 thx
CamperBot
@camperbot
Feb 19 2018 23:00 UTC
jon-nova sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1704 | @thekholm80 |http://www.freecodecamp.org/thekholm80
Ken Haduch
@khaduch
Feb 19 2018 23:00 UTC
@Jon-Nova - I looked at this a couple days ago - @thekholm80 is right - the trick (besides understanding the whole destructuring thing) is to realize / remember / recognize that a String is an object - you work with the properties as you would with those example objects. And I did think that it was tricky;!!
Kyle Holm
@thekholm80
Feb 19 2018 23:03 UTC
if the goal is no more than 5 min to solve each challenge, i think they may need to reword that one
JoΓ£o Novaes Barreiros
@Jon-Nova
Feb 19 2018 23:03 UTC
I've been for a while without using js
I need to remember a lot
but thx @khaduch
CamperBot
@camperbot
Feb 19 2018 23:03 UTC
jon-nova sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3742 | @khaduch |http://www.freecodecamp.org/khaduch
Ken Haduch
@khaduch
Feb 19 2018 23:40 UTC
@thekholm80 - you might be right, but it might be one of those "record collection" type of exercises that gives a lot of people trouble...
Kyle Holm
@thekholm80
Feb 19 2018 23:44 UTC
@khaduch could be