Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
max77p
@max77p
i am wondering does this mean i have to do another json call?
or is there a easier way of grabbing the logo if its null
stuck on this lol
Kevin K. Lee
@kevinkiklee
@max77p oh man. that was the exact problem i had when i designed it. i had to build a separate function. let me take a look at my code.
Rada
@Radascript
@max77p ah I see sorry, not sure how to do that, I didn't like that challenge and did nothing other than fulfill the bare necessary user stories, my app looks like a potato
Kevin K. Lee
@kevinkiklee
@max77p yep, i also did two separate json calls. i also used data.stream like you did. i had one json call when data.stream was null, and another json call when data.stream was not null.
Kevin K. Lee
@kevinkiklee
wow. i just looked at my fcc calendar.
it took me 8 days to start from scratch and finish upto the twitch api.
and i had never really touched JS before.
fucking a. i solved 112 problems on one day. i'm an addict.
Carlos
@CarlosFerrerCeldran
Hi guys, why do I keep getting this error on images?
Failed to load resource: the server responded with a status of 403 (Forbidden)
Kevin K. Lee
@kevinkiklee
@CarlosFerrerCeldran need more context. what are you trying to do
Carlos
@CarlosFerrerCeldran
It happens to images with an href="http://wheretheimageis/image.png or jpg"
max77p
@max77p
@iserbit sweet thanks! so i guess thats okay to make two json calls
CamperBot
@camperbot
max77p sends brownie points to @iserbit :sparkles: :thumbsup: :sparkles:
:cookie: 289 | @iserbit |http://www.freecodecamp.com/iserbit
max77p
@max77p
and i guess i am on the right track then
Kevin K. Lee
@kevinkiklee
@max77p yep good luck dude.
Ken Haduch
@khaduch
@CarlosFerrerCeldran - not all service providers will allow you to link to pictures on their site - for example, imgur forbids cross-linking. Other times is might be a matter of trying to access your page with https:// and the images with http:// - mixing transport types causes some issues. If you have a link to a project where you are trying to do this, perhaps we can confirm what the problem is?
Carlos
@CarlosFerrerCeldran
Found the mistake, there was typo error with https and http, thanks for the information on the picture linking from sites!
Nicolas Reboredo
@nicolasmdf
hey guys, could I maybe get some help? Im working on the weather app and I have a few questions about geolocation
Ken Haduch
@khaduch
@nicolasmdf - geolocation only works on the Chrome browser when you use https:// transport, but if you are using the free version of openweather, then http:// is required for that, so they won't cooperate together. The workaround is to use the IP-based site http://ip-api.com/json which only works on http://. Firefox supports (at least as of my last check) geolocation on http:// so it will work there, but you don't know what browser people will be using. I don't know if that gives you an answer for your question or if you have another? So you can potentially try the geolocation, and if it returns an error, then fall back to the ip-api site. Or just use http://ip-api.com/json, potentially less accurate, but I don't really think that you need accuracy so much as to learn the techniques and design the site to work reliably.
Luke
@lhovee
Hey guys, can someone give me some ideas for how to reduce the amount of code I'm using here?
$("#state2").click(function() {
 $.getJSON("https://fcctop100.herokuapp.com/api/fccusers/top/alltime", function(data) {  
   $("#username1").html(data[0].username);
      $("#recent1").html(data[0].recent);
      $("#total1").html(data[0].alltime);
      $("#username2").html(data[1].username);
      $("#recent2").html(data[1].recent);
      $("#total2").html(data[1].alltime);
      $("#username3").html(data[2].username);
      $("#recent3").html(data[2].recent);
      $("#total3").html(data[2].alltime);
      $("#username4").html(data[3].username);
      $("#recent4").html(data[3].recent);
      $("#total4").html(data[3].alltime);
      $("#username5").html(data[4].username);
      $("#recent5").html(data[4].recent);
      $("#total5").html(data[4].alltime);
    });
Rada
@Radascript
@lhovee you can make an array of names and write a function that takes in paramenters "name" and "index" and does this for each name in an array?
Ken Haduch
@khaduch
@lhovee - yes, as @Radascript says, make a function that loops over an array, generates the ID names that you are generating by appending the index value to the strings #username, #recent, and #total - you might also have fixed divs or something in your HTML - you can generate the appropriate number of divs and append them to the DOM in a similar way, using jQuery.
Luke
@lhovee
@Radascript something like this?
var arr = [username1, username2, etc]
for (var i=0; i<arr.length; i++) {$("#arr[i]).html(data[i].username}
@khaduch could you give me a snippet of what that might look like if I was trying to use React to add the appropriate number of divs to the DOM?
kayzon
@quezanw
for the twitch api project is it bad practice to use a for loop instead 'for each' to interate through my array to get the channel name and attach it to the api url?
Ken Haduch
@khaduch
@lhovee - I don't know React at all - I don't know if it would be different there vs. a jQuery example?
Luke
@lhovee
@khaduch no worries, thank you for the help!
CamperBot
@camperbot
lhovee sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 1452 | @khaduch |http://www.freecodecamp.com/khaduch
Luke
@lhovee
@Radascript thank you for the help!
CamperBot
@camperbot
lhovee sends brownie points to @radascript :sparkles: :thumbsup: :sparkles:
:cookie: 367 | @radascript |http://www.freecodecamp.com/radascript
Coy Sanders
@coymeetsworld
@quezanw don't see a problem using either way of looping
Luke
@lhovee
@Radascript @khaduch hey guys, I tried implementing the suggestion you gave me and came up with this. I'm thinking the format of the getJSON and click can't deviate from what the program expects .... ideas?
var arr = [username1, recent1, total1, username2, recent2, total2, username3, recent3, total3, username4, recent4, total4, username5, recent5, total5];
$(document).ready(function() {
  $("#state2").click(function() {
 $.getJSON("https://fcctop100.herokuapp.com/api/fccusers/top/alltime", function(data) {
      for (var i = 0; i < arr.length; i++) {
        if (i == 0 || i == 3 || i == 6 || i == 9 || i == 12) {
          $("#arr[i]").html(data[i].username)
        };
        else if (i == 1 || i == 4 || i == 7 || i == 10 || i == 13) {
          $("#arr[i]").html(data[i].recent)
        };
        else if (i == 2 || i == 5 || i == 8 || i == 11 || i == 14) {
          $("#arr[i]").html(data[i].total)
        };
      };
    });
  });
or maybe I didn't write this very well .... suggestions much appreciated
Coy Sanders
@coymeetsworld
think your semicolons are misplaced @lhovee, i would look into that as a potential issue
Luke
@lhovee
@coymeetsworld okay I will, thank you
CamperBot
@camperbot
lhovee sends brownie points to @coymeetsworld :sparkles: :thumbsup: :sparkles:
:star2: 1260 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
Coy Sanders
@coymeetsworld
also your jQuery selectors are probably not what you want either
its not going to evaluate i in there, its a String
Luke
@lhovee
@coymeetsworld dang. How can I use jQuery with this array? I'm trying to abbreviate this code:
$("#state1").click(function() {
    $.getJSON("https://fcctop100.herokuapp.com/api/fccusers/top/recent", function(data) {
      $("#username1").html(data[0].username);
      $("#recent1").html(data[0].recent);
      $("#total1").html(data[0].alltime);
      $("#username2").html(data[1].username);
      $("#recent2").html(data[1].recent);
      $("#total2").html(data[1].alltime);
      $("#username3").html(data[2].username);
      $("#recent3").html(data[2].recent);
      $("#total3").html(data[2].alltime);
      $("#username4").html(data[3].username);
      $("#recent4").html(data[3].recent);
      $("#total4").html(data[3].alltime);
      $("#username5").html(data[4].username);
      $("#recent5").html(data[4].recent);
      $("#total5").html(data[4].alltime);
    });
  });
this is supposed to be repeated 100 times and I know writing 300 lines is the wrong answer