These are chat archives for FreeCodeCamp/Help

15th
Mar 2018
徐梓淇
@IRON13
Mar 15 2018 03:34 UTC
this task:link to external pages with anchor elements
i can,t find cat photos...
Danny Chan
@chandanny
Mar 15 2018 05:47 UTC
hello
  1. When my markdown previewer first loads, the default text in the #editor field should contain valid markdown that represents at least one of each of the following elements: a header (H1 size), a sub header (H2 size), a link, inline code, a code block, a list item, a blockquote, an image, and bolded text
i don't know why i can't pass it
Darren
@DarrenfJ
Mar 15 2018 06:13 UTC
evening fCC
Jesse
@ki4jgt
Mar 15 2018 07:56 UTC
Trying to build a social network and can't get overflow to work as desired. Was wondering if anyone could help. https://codepen.io/ki4jgt/full/GxZwvW/ Please and thank you.
Sweet Coding :)
@SweetCodingInc
Mar 15 2018 08:02 UTC
@ki4jgt what are you trying to achieve?
Jesse
@ki4jgt
Mar 15 2018 08:03 UTC
@SweetCodingInc I need the timeline to have a scrollbar so that it can be scrolled up and down instead of going beyond the bottom of the page.
The table is setup with 100vh, so it stops at the bottom of the page when the timeline isn't populated with statuses.
I may just let it do it and set the header to sticky to the top of the window.
But I'd prefer to make the list scroll-able.
Sweet Coding :)
@SweetCodingInc
Mar 15 2018 08:08 UTC
I see,,
Sweet Coding :)
@SweetCodingInc
Mar 15 2018 08:15 UTC
@ki4jgt I forked your pen and adjusted markup a little
added a new div inside your td.timeline called div.timeline-wrapper
there is still a primary scrollbar but I think you'd be able to get rid of it by adjusting height
Jesse
@ki4jgt
Mar 15 2018 08:16 UTC
THANK YOU :D
:D :D :D
Sweet Coding :)
@SweetCodingInc
Mar 15 2018 08:17 UTC
In css, this is where all the magic is
.timeline-wrapper{
  height: calc(100vh - 155px);
  overflow:auto;
}
you can get rid of calc business and make it absolutely responsive in a cleaner way if you opt to implement this with flex
Jesse
@ki4jgt
Mar 15 2018 08:19 UTC
Can I send you a private message?
Sweet Coding :)
@SweetCodingInc
Mar 15 2018 08:19 UTC
sure.. but no freelance offerings and/or implement this for me and I will pay you stuff please
Jesse
@ki4jgt
Mar 15 2018 08:19 UTC
OK.
Images&
@Chasdreams
Mar 15 2018 08:22 UTC
Specifies how specific child elements of an element are specified using jquery targets; how does this pass
Supra01
@Supra01
Mar 15 2018 08:29 UTC

Hello I hope everyone is doing well. I'm working on the twitch API project and I need some help adding a second callback function to my getData function. I know I can use promises for this but I want to better understand callbacks before I move on.

var demo = document.getElementById('demo');
var channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];
var urlStreams = "https://wind-bow.glitch.me/twitch-api/streams/";
var urlUsers = "https://wind-bow.glitch.me/twitch-api/users/";
var channelName = [];
var notOnline = [];

/* Make Get Requests */
getData = function (url, callback) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function () {
    if (this.readyState == 4 && this.status == 200) {
      var response = JSON.parse(this.responseText);
      callback(response);
/* I would Like to put another callback here that is called after the first callback without using promises */
    }
  };
  xhttp.open('GET', url, true);
  xhttp.send();
}


/* Use channels array to make URLs to get streaming data */
function getStreams() {
  var stream = '';
  for (var i = 0; i < channels.length; i++) {
    stream = urlStreams + channels[i];
    getData(stream, checkOnline);
  }

}
/* Use URLs to get which users that are online */
function checkOnline(data) {
  if (data.stream !== null) {
    demo.innerHTML += '<h3>' + data.stream.channel.display_name + '</h3><div><img src="' + data.stream.channel.logo + '"><p>Online</p><p>' + data.stream.channel.status + '</p>';
  }
}

getStreams();

https://codepen.io/Supra_01/pen/vdwZLG?editors=1010

Sweet Coding :)
@SweetCodingInc
Mar 15 2018 08:32 UTC
@Supra01 That should be straight forward as the callback you're referring to is the function checkOnline. This function is synchronous and you don't need promises for this
getData = function (url, callback1, callback2) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function () {
    if (this.readyState == 4 && this.status == 200) {
      var response = JSON.parse(this.responseText);
      callback1(response);
      callback2(response); // ADDED THIS
/* I would Like to put another callback here that is called after the first callback without using promises */
    }
  };
  xhttp.open('GET', url, true);
  xhttp.send();
}
OR
you can keep the code as it is, and call another function from within checkOnline function
function checkOnline(data) {
  if (data.stream !== null) {
    demo.innerHTML += '<h3>' + data.stream.channel.display_name + '</h3><div><img src="' + data.stream.channel.logo + '"><p>Online</p><p>' + data.stream.channel.status + '</p>';
  }
  otherFunction(data); // assuming you've defined a function otherFunction that further processes your data
}
Supra01
@Supra01
Mar 15 2018 09:16 UTC
@SweetCodingInc Thank you! Will the second call back get called when the first one is finished?
CamperBot
@camperbot
Mar 15 2018 09:16 UTC
supra01 sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
:cookie: 375 | @sweetcodinginc |http://www.freecodecamp.org/sweetcodinginc
Supra01
@Supra01
Mar 15 2018 09:18 UTC
@SweetCodingInc because I'm going to make another get request and I need to get all the online user's first
Supra01
@Supra01
Mar 15 2018 09:29 UTC
@SweetCodingInc oops sorry I mean with you first example how do I invoke the second callback ?
Sweet Coding :)
@SweetCodingInc
Mar 15 2018 10:00 UTC
@Supra01 Sorry.. Your question is a bit unclear
you mean after you call callback1, you want to trigger another get request?
Daniel
@dkapexhiu
Mar 15 2018 10:08 UTC
hello! what i am doing wrong in this processing of json file:
https://gist.github.com/dkapexhiu/db27feff4a68f71e1ff105bcb93ba020
that i get this error:
Uncaught TypeError: Cannot read property 'results' of null
Claudio Restifo
@Marmiz
Mar 15 2018 11:13 UTC

@dkapexhiu you should look at the shape of the data response, in the meantime are you sure that:

data.data.results

is not just

data.result
Daniel
@dkapexhiu
Mar 15 2018 11:31 UTC
ok thanks but i have updated that code using fetch api to solve the problem.. i am getting an error on response with status code of 0:
https://gist.github.com/dkapexhiu/db27feff4a68f71e1ff105bcb93ba020
@Marmiz
Stephen James
@sjames1958gm
Mar 15 2018 11:37 UTC
@dkapexhiu Do you need the no-cors? Reading SO that is what is causing the status of 0
Daniel
@dkapexhiu
Mar 15 2018 11:38 UTC
because it is not allowing the request from localhost, not the origin.. how can i allow the request from localhost to google places api?
@sjames1958gm
Stephen James
@sjames1958gm
Mar 15 2018 11:41 UTC
@dkapexhiu Hmm, that is a good question
Daniel
@dkapexhiu
Mar 15 2018 11:43 UTC
i have included this:
headers: new Headers({ "Access-Control-Allow-Origin": "*", })
but no success
Daniel
@dkapexhiu
Mar 15 2018 11:49 UTC
i have used this plugin for chrome for setting the correct headers and the response is returning:
https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?utm_source=chrome-app-launcher-info-dialog
Stephen James
@sjames1958gm
Mar 15 2018 11:49 UTC
Looking at the docs, I am wondering if they intend you to make request like this.
Daniel
@dkapexhiu
Mar 15 2018 11:53 UTC
yes, i am new to this but that plugin does wonders
Stephen James
@sjames1958gm
Mar 15 2018 11:53 UTC
@dkapexhiu All the references seem to use script tags (similar to JSONP)
liqingqing1
@liqingqing1
Mar 15 2018 12:00 UTC
<h2>Hello Paragraph</h2>, is not it right?
Stephen James
@sjames1958gm
Mar 15 2018 12:28 UTC
@liqingqing1 Depends on what the challenge is
MaxOkhten
@MaxOkhten
Mar 15 2018 15:17 UTC
hey there!
who can tell me, why is my challenge history not recording? https://www.freecodecamp.org/maxokhten
Supra01
@Supra01
Mar 15 2018 15:24 UTC
Hello! I'm having trouble invoking my second callback (Not sure if I'm saying that right).
var demo = document.getElementById('demo');
var channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];
var urlStreams = "https://wind-bow.glitch.me/twitch-api/streams/";
var urlUsers = "https://wind-bow.glitch.me/twitch-api/users/";
var channelName = [];
var notOnline = [];


getData = function (url, callback1, callback2) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function () {
    if (this.readyState == 4 && this.status == 200) {
      var response = JSON.parse(this.responseText);
      callback1(response);
      callback2(response);
    }
  };
  xhttp.open('GET', url, true);
  xhttp.send();
}



function getStreams() {
  var stream = '';
  for (var i = 0; i < channels.length; i++) {
    stream = urlStreams + channels[i];
    getData(stream, checkOnline);
  }

}

function checkOnline(data) {
  if (data.stream !== null) {
    demo.innerHTML += '<h3>' + data.stream.channel.display_name + '</h3><div><img src="' + data.stream.channel.logo + '"><p>Online</p><p>' + data.stream.channel.status + '</p>';
  }
}

getStreams();

/* Invoke second callback*/

function showUsers (data){
  demo.innerHTML+= data.display_name + '<br>';
}

function getUsers (){
  var users = '';
  for (var i = 0; i < channels.length; i++) {
    users = urlUsers + channels[i];
    /* This is getting passed as callback1 but I want it to be passed as callback2*/
    getData(users,showUsers);
  }
}

getUsers();
Supra01
@Supra01
Mar 15 2018 15:31 UTC
I'm trying to get first callback to finish first and push all the users who are offline to a new array and make urls for another set of get requests. But I can't do that until all the data is in first.
Kyle Holm
@thekholm80
Mar 15 2018 15:36 UTC

what are these?

      callback1(response);
      callback2(response);

i don't see them defined anywhere

you have them as args, but when you call that function you're not passing in functions?
Supra01
@Supra01
Mar 15 2018 15:38 UTC
```
Kyle Holm
@thekholm80
Mar 15 2018 15:38 UTC
err, i guess the first is being passed, but not the second getData(users,showUsers);
Supra01
@Supra01
Mar 15 2018 15:39 UTC
@thekholm80 yes
Sorry I'm still new at this. My question is how do I pass it?
Kyle Holm
@thekholm80
Mar 15 2018 15:40 UTC
getData = function (url, callback1, callback2) you define 3 parameters here, but you're only putting 2 in your call getData(users,showUsers);
image.png
so there are errors
Supra01
@Supra01
Mar 15 2018 15:41 UTC
@thekholm80 I realize that. There some way to put a place holder there.
```
Kyle Holm
@thekholm80
Mar 15 2018 15:42 UTC
i suppose it would depend on what you're trying to accomplish. is this your code or did you find it somewhere?
Supra01
@Supra01
Mar 15 2018 15:42 UTC
it's all mine
I'm just trying to shove that secnd callback in there
var demo = document.getElementById('demo');
var channels = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"];
var urlStreams = "https://wind-bow.glitch.me/twitch-api/streams/";
var urlUsers = "https://wind-bow.glitch.me/twitch-api/users/";
var channelName = [];
var notOnline = [];

/* Make Get Requests */
getData = function (url, callback) {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function () {
    if (this.readyState == 4 && this.status == 200) {
      var response = JSON.parse(this.responseText);
      callback1(response);
      // callback2(response);
      /* I would Like to put another callback here that is called after the first callback without using promises */
    }
  };
  xhttp.open('GET', url, true);
  xhttp.send();
}


/* Use channels array to make URLs to get streaming data */
function getStreams() {
  var stream = '';
  for (var i = 0; i < channels.length; i++) {
    stream = urlStreams + channels[i];
    getData(stream, checkOnline);
  }

}
/* Use URLs to get which users that are online */
function checkOnline(data) {
  if (data.stream !== null) {
    demo.innerHTML += '<h3>' + data.stream.channel.display_name + '</h3><div><img src="' + data.stream.channel.logo + '"><p>Online</p><p>' + data.stream.channel.status + '</p>';
  }
}

getStreams();

function showUsers (data){
  demo.innerHTML+= data.display_name + '<br>';
}

function getUsers (){
  var users = '';
  for (var i = 0; i < channels.length; i++) {
    users = urlUsers + channels[i];
    getData(users,showUsers);
  }
}

getUsers();
here is my original
it gets the data
but not in the right order
Kyle Holm
@thekholm80
Mar 15 2018 15:47 UTC
i enjoyed this project because it taught me a ton about asynchronous execution. it was a pain though. the best thing i can suggest is to talk through the code, state what you expect to happen then use console.log() to see if it's doing what you expect
Supra01
@Supra01
Mar 15 2018 15:47 UTC
I'm try to use a second callback to make sure getStreams part finishes first
Kyle Holm
@thekholm80
Mar 15 2018 15:48 UTC
or, if you're around later today i'll help you debug it, i'm pressed for time right now
Supra01
@Supra01
Mar 15 2018 15:49 UTC
@thekholm80 thank you and no worries
CamperBot
@camperbot
Mar 15 2018 15:49 UTC
supra01 sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1726 | @thekholm80 |http://www.freecodecamp.org/thekholm80
rafahm
@rafahm
Mar 15 2018 15:50 UTC
hiya
guys
can we learn how to code
with swift
on free code camp
? xx
Kyle Holm
@thekholm80
Mar 15 2018 15:52 UTC
i don't think fCC has any swift lessons right now, sorry
rafahm
@rafahm
Mar 15 2018 15:52 UTC
can you reccomend any that do
Kyle Holm
@thekholm80
Mar 15 2018 15:53 UTC
it looks like udemy has a bunch of courses on swift
i've not done any so i can't recommend
rafahm
@rafahm
Mar 15 2018 15:53 UTC
thank so much
Darren
@DarrenfJ
Mar 15 2018 17:18 UTC
afternoon fCC - how goes the code?
Stephen James
@sjames1958gm
Mar 15 2018 17:27 UTC
@DarrenfJ Slow and surly
Kyle Holm
@thekholm80
Mar 15 2018 17:54 UTC
@DarrenfJ :wave:
trying to figure out when/why to choose django over express - seems like any conversation about A vs B in tech all comes down to a matter of opinion, hard to find empirical comparisons
Kyle Holm
@thekholm80
Mar 15 2018 18:03 UTC
and i'm amazed by the number of "lol javascript sux use xxx" type stuff I see
Christopher McCormack
@cmccormack
Mar 15 2018 18:14 UTC
@thekholm80 use Django when you want to use Python instead of javascript? :D
Kyle Holm
@thekholm80
Mar 15 2018 18:15 UTC
that's about all i can figure lol
i was hoping to find some information about why companies choose the particular stacks they choose
i really thought it would boil down to more than just personal preference
Christopher McCormack
@cmccormack
Mar 15 2018 18:36 UTC
@thekholm80 looks like express has been around 5 years less than Django, and maybe backend devs don't want to deal in JS if they can avoid it
Kyle Holm
@thekholm80
Mar 15 2018 18:37 UTC
yeah
Christopher McCormack
@cmccormack
Mar 15 2018 18:38 UTC
@thekholm80 I've been brushing up on my Python lately and I have to admin, Django is pretty nice. I sure like Python's decorators
Kyle Holm
@thekholm80
Mar 15 2018 18:39 UTC
i'm only learning django because i wanted to learn python lol. I just couldn't think of any python programs i wanted to write
Flask is a lot of fun, too
Christopher McCormack
@cmccormack
Mar 15 2018 18:39 UTC
@thekholm80 that's always been my biggest issue with Python, finding projects I actually wanted to work on.
Kyle Holm
@thekholm80
Mar 15 2018 18:40 UTC
i discovered Beautiful Soup last night, now I kind of want to build a web scraper just to see how it works
Christopher McCormack
@cmccormack
Mar 15 2018 18:40 UTC
At least with web dev you get to see your results in a place you're familiar with, the browser
Kyle Holm
@thekholm80
Mar 15 2018 18:40 UTC
very true
Christopher McCormack
@cmccormack
Mar 15 2018 18:41 UTC
@thekholm80 yeah BS is great! I used it to scrape songs from Billboard because their api didn't work https://github.com/cmccormack/billboard_scrape
super easy to use
Kyle Holm
@thekholm80
Mar 15 2018 18:41 UTC
that's really cool!
Christopher McCormack
@cmccormack
Mar 15 2018 18:42 UTC
@thekholm80 thanks
CamperBot
@camperbot
Mar 15 2018 18:42 UTC
cmccormack sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1727 | @thekholm80 |http://www.freecodecamp.org/thekholm80
Kyle Holm
@thekholm80
Mar 15 2018 18:43 UTC
i use a program called youtube-dl that i think is written in python, i've been thinking about trying to pick it apart to see how it works
Christopher McCormack
@cmccormack
Mar 15 2018 18:44 UTC
Is that the one that lets you download all of your videos at different sizes and encodings?
or maybe other videos as well?
Kyle Holm
@thekholm80
Mar 15 2018 18:44 UTC
yes - sort of. if you pair it with ffmpeg you can stipulate encodings
Christopher McCormack
@cmccormack
Mar 15 2018 18:46 UTC
Man I love Python - if that were written in C++ it would be a garbled mess to my eyes
Kyle Holm
@thekholm80
Mar 15 2018 18:46 UTC
lol
reminds me of this
Christopher McCormack
@cmccormack
Mar 15 2018 18:46 UTC
haha
does Python recognize := though??
Kyle Holm
@thekholm80
Mar 15 2018 18:47 UTC
lol i don't know
Christopher McCormack
@cmccormack
Mar 15 2018 18:47 UTC
probably can add it somehow :D
May Kittens Devour Your Soul
@diomed
Mar 15 2018 20:56 UTC
what would u say it's the most common wtf of css you enountered?
Kyle Holm
@thekholm80
Mar 15 2018 21:01 UTC
#titanic{float:none}
Kaz Baig
@kbaig
Mar 15 2018 21:02 UTC
gottem
Gulsvi
@gulsvi
Mar 15 2018 21:18 UTC
#hands {
  color: orange;
  font-size: xx-small;
}
Kyle Holm
@thekholm80
Mar 15 2018 21:20 UTC
lol
Kaz Baig
@kbaig
Mar 15 2018 21:21 UTC
noice
Aditya
@ezioda004
Mar 15 2018 21:35 UTC
.illuminati {
   position: absolute;
   visibility: none;
}
Kyle Holm
@thekholm80
Mar 15 2018 21:35 UTC
now they know you're on to them
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 15 2018 21:40 UTC
@ezioda004 I have a question about your profile
*portfolio
Aditya
@ezioda004
Mar 15 2018 21:41 UTC
@thekholm80 Theres a good yomama joke there I cant find
@MuhammedKarim Yes?
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 15 2018 21:42 UTC
Under the skills section, how do you know what percentage you know of the language? @ezioda004
Kyle Holm
@thekholm80
Mar 15 2018 21:42 UTC
@ezioda004 rofl
Aditya
@ezioda004
Mar 15 2018 21:43 UTC
@MuhammedKarim I mean..its what I think how much I know lol, purely subjective
Kyle Holm
@thekholm80
Mar 15 2018 21:44 UTC
total language / current knowledge = % mastered
it's math
hmm, maybe i have that backwards
i suck at math
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 15 2018 21:45 UTC
yeah its backwards lol
Aditya
@ezioda004
Mar 15 2018 21:45 UTC
Kyle.toFixed(Math)
There you go :sparkles:
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 15 2018 21:45 UTC
u forgot to times it by hundred too :P
@ezioda004 gotcha, thanks
CamperBot
@camperbot
Mar 15 2018 21:45 UTC
muhammedkarim sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 502 | @ezioda004 |http://www.freecodecamp.org/ezioda004
thekholm80 @thekholm80 that feeling when you're being a smartass and you get it all wrong
Ghost
@ghost~5a4a80acd73408ce4f859755
Mar 15 2018 21:47 UTC
oh we all know that feeling too well...
some of us do i mean, not all ;)
Kyle Holm
@thekholm80
Mar 15 2018 21:47 UTC
lol
artbohr
@artbohr
Mar 15 2018 22:22 UTC
I wanted to claim a certificate (API projects) from the beta.fcc but I can't, I have all the projects submitted and checked
anyone knows what's up?
getting this
it looks like you have not completed the neccessary steps. Please complete the required challenges to claim the APIs and Microservices Certificate
and how can I contact any admin or support to ask them?
LydaTech
@lydatech
Mar 15 2018 22:34 UTC
@artbohr I dont believe certs are issued in beta
Kyle Holm
@thekholm80
Mar 15 2018 22:38 UTC
save your projects, though and you can submit them when beta is done being beta
artbohr
@artbohr
Mar 15 2018 22:40 UTC
@lydatech @thekholm80 alright, I thought I could get the certificate tho, that's a pity, well, will wait for it to be over then
@thekholm80 @thekholm80 ty fellas
CamperBot
@camperbot
Mar 15 2018 22:40 UTC
artbohr sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1728 | @thekholm80 |http://www.freecodecamp.org/thekholm80
artbohr
@artbohr
Mar 15 2018 22:42 UTC
@lydatech ty
CamperBot
@camperbot
Mar 15 2018 22:42 UTC
artbohr sends brownie points to @lydatech :sparkles: :thumbsup: :sparkles:
:star2: 2719 | @lydatech |http://www.freecodecamp.org/lydatech
Sam Goldberg
@sgoldber61
Mar 15 2018 23:41 UTC
Does anyone know a good simple article on ES6 promises? Just their basic functionality and use and what they can do better than callbacks can.
Kyle Holm
@thekholm80
Mar 15 2018 23:46 UTC
@sgoldber61 maybe this one
i <3 Eric Elliott's articles
Sam Goldberg
@sgoldber61
Mar 15 2018 23:47 UTC
@thekholm80 OK thanks I will take a look!
CamperBot
@camperbot
Mar 15 2018 23:47 UTC
sgoldber61 sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1729 | @thekholm80 |http://www.freecodecamp.org/thekholm80