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
Jinme Mirabal
@mirabalj
@jcob95 you should validate the JSON returned. What happend if received error?
´´´
{
cod: "404",
message: "Error: Not found city"
}
´´´
jcob95
@jcob95
I agree I need to do this, but for now, provided there is no error, the variables should not return undefined. Unless there is an error I haven't seen
Jinme Mirabal
@mirabalj
@jcob95 what JSON is returned? Log your data var.
jcob95
@jcob95
reeturned undefined
Jinme Mirabal
@mirabalj
Ah, don't forget "http://" in url. @jcob95
It's not magic :smile:
jcob95
@jcob95
I added it, but unfortunately it still returns undefined
wirthual
@wirthual
@jcob95 What happens if you past the url in your browser? Do you get the data you want?
jcob95
@jcob95
Yes
it returns this (removed my location purposely)
weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"base":"cmc stations","main":{"temp":296.42,"pressure":1023,"humidity":73,"temp_min":295.15,"temp_max":297.59},"wind":{"speed":4.6,"deg":250},"clouds":{"all":0},"dt":1468696915,"sys":{"type":1,"id":5078,"message":0.01,"country":"GB","sunrise":1468641828,"sunset":1468699897}
is my syntax for accessing the array correct?
Jinme Mirabal
@mirabalj
@jcob95 show your code in a tool like jsfiddle or codepen, please.
Daniel González Reina
@dgrcode
What do you need @jcob95 ?
Jinme Mirabal
@mirabalj
@jcob95 property "name" don't exists in JSON returned
Ken Haduch
@khaduch
@jcob95 - you need to put an "http://" in your URL for the weather site, at least that's one thing...
Tyler Moeller
@TylerMoeller
@jcob95 A couple of issues.
navigator.geolocation requires HTTPS, but your weather API only works over HTTP. Try using http://ip-api.com/json for location or choose a weather api that supports HTTPS (like forecast.io or weather underground)
Your location variable is scoped to your anonymous getJSON function. To use it elsewhere, pass it to another function like:
  $.getJSON(url,function(data){
    var location = data.name;
    logToConsole(location)
  });

  function logToConsole(location) {
    console.log(location)
  }
Ken Haduch
@khaduch
@jcob95 - I was going to add that I ran it on Firefox, where the geolocation still works in "http://". Just adding the "http://" to your openweather URL looks like it fetches the data. @TylerMoeller 's explanation of the problem with HTTP vs. HTTPS and geolocation and openweather is correct.
Tyler Moeller
@TylerMoeller
@neecholaus remove the li settings in your CSS, close your <a> tags, and add class="navbar nav" to your ul:
      <ul class="navbar nav">
        <li><a href="#">HOME</a></li>
        <li><a href="#">ABOUT</a></li>
        <li><a href="#">PORTFOLIO</a></li>
      </ul>
Bryan
@jbhand75-coder
Geolocation should work fine for Firefox and Safai with HTTP, it is Chrome that requires the HTTPS. That may be the problem you are running into.
Jakob Essig
@Jecousa
I need some help with a two-dimensional array. What I am trying to do is have a random music video displayed with the lyrics when the user clicks the button. I can get it to work when there's only one item in the array, but can't figure out how to display both.
Gabriela Lobinska
@gabriela3001
Hi, I am nearly done with the random quote machine, however I have an issue with the Twitter button
The output in the twitter page keeps the tags and also does not return apostrophes and other special characters correctly
could anybody help me out?
Tyler Moeller
@TylerMoeller
@gabriela3001 One way is to use .text() to get the text of the quote + author from the page.
encodeURIComponent($('#quote').text() + ' ~ ' + $('#author').text())
Gabriela Lobinska
@gabriela3001
It worked! Thank you so much!
Jakob Essig
@Jecousa
I don't know how to pair both the lyrics and music video randomly and how to display that
Carrie
@yodermail
How to ensure that elements don't slip behind a fixed nav when they're resized? Or really, what is the "best practice" for setting up a fixed nav?
elminsterrr
@elminsterrr
Hi.
I’m learning webdev with Free Code Camp for about 3 months and I know some HTML, JavaScript, even Bootstrap, but I struggle with CSS. Now I’m close to finish Intermediate Front End Development Project from Free Code Camp - Built a Wikipedia Viewer.
But I want to be better with CSS, because my goal is that my projects look a lot better than now and I want a lot more control of my content.
Could you please recommend me best online courses and YouTube series besides of FCC. I'm constantly searching for new sources, but it is hard to find the best ones...
Aleksandar B.
@aleksandar-b
@elminsterrr devtips on youtube
willcodes
@willcodes
hi guys, I have a var called quotes that has 2 properties
"quote" and "author", I want to make it so that if the author = a particular name, the background changes
function randomQuote() {
 var random = quotes[Math.floor(Math.random() *quotes.length)];
 $("#thisquote").text(random.quote);

  $("#thisauthor").text("-" +random.author);



};
  function changeColor() {
    var change = colors[Math.floor(Math.random() *colors.length)];
    $('body').css("background", change);
    $('#getQuote').css("background", change);
  };

  $('.btn').click(function() {

    randomQuote();
    $("#header").remove();
    if ( quotes["author"] == "Kramer") {
      $("body").css("background-image", "linear-gradient(to top, rgba(0,0,0,0.2), rgba(0,0,0,0.5)),url('file:C:/Users/user/Desktop/freecodecamp/random quote/images/kramer.jpg'"); 
    };


});
elminsterrr
@elminsterrr
@samosale Thx for info. Is this with that bald, bearded guy? :)
CamperBot
@camperbot
elminsterrr sends brownie points to @samosale :sparkles: :thumbsup: :sparkles:
:cookie: 660 | @samosale |http://www.freecodecamp.com/samosale
Aleksandar B.
@aleksandar-b
@elminsterrr yeah
elminsterrr
@elminsterrr
@samosale Ok
Aleksandar B.
@aleksandar-b
@willcodes can I see your quotes object?
willcodes
@willcodes
var quotes = [{

  "quote":"Boy, these pretzels are makin' me thirsty.",
  "author":"Kramer"
},
{

  "quote":"If you know what happened in the Mets game don't tell me, I taped it. Hello?",
  "author":"Jerry"
},
{

  "quote":"It became very clear to me sitting out there today that every decision I've made in my entire life has been wrong. My life is the complete opposite of everything I want it to be. Every instinct I have, in every aspect of life, be it something to wear, something to eat - it's all been wrong.", 

  "author":"George"
},
{

  "quote":"I'm not a lesbian. I hate men, but I'm not a lesbian",
  "author":"Elaine"
},
{

  "quote":"Looking at cleavage is like looking at the sun. You don't stare at it. It's too risky. Ya get a sense of it and then you look away.",
  "author":"Jerry"
},
{

  "quote":"You have the chicken, the hen, and the rooster. The chicken goes with the hen... So who is having sex with the rooster",
  "author":"Frank Costanza"
},
{

  "quote":"The cat - mrrreeeooowww - is out of the bag!",
  "author":"Kramer"
},
{

  "quote": "Jerry, just remember, it's not a lie if you believe it.",
  "author": "George"
},
{

  "quote": "Do you ever get down on your knees and thank God you know me and have access to my dementia",
  "author": "George"
},
{

  "quote": "We don't know how long this will last. They are a very festive people.",
  "author": "Elaine"
},
{

  "quote": "You know I always wanted to pretend I was an architect.",
  "author": "George"
},
{

  "quote": "If you're not gonna be a part of a civil society, then just get in your car and drive on over to the East Side.",
  "author": "Kramer"
},
{

  "quote": "I'm speechless. I have no speech.",
  "author": "George"
},
{

  "quote": "I have been performing feats of strength all morning.",
  "author": "Frank Costanza"
},
{

  "quote": "I lie every second of the day. My whole life is a sham.",
  "author": "George"
},
{

  "quote": "Hi, my name is George, I'm unemployed and I live with my parents.",
  "author": "George"
},
{

  "quote": "Just remember, when you control the mail, you control... information.",
  "author": "Newman"
},
{

  "quote": "I don't trust the guy. I think he regifted, then he degifted, and now he's using an upstairs invite as a springboard to a Super bowl sex romp.",
  "author": "Jerry"
},
{

  "quote": "I don't think I've ever been to an appointment in my life where I wanted the other guy to show up.",
  "author": "George"
},
{

  "quote": "Boy, a little too much chlorine in that gene pool.",
  "author": "Jerry"
},
{

  "quote": "Do you have any idea how much time I waste in this apartment?",
  "author": "Kramer"
},
{

  "quote": "See, this is what the holidays are all about. Three buddies sitting around chewing gum.",
  "author": "Kramer"
},
{

  "quote": "The carpet sweeper is the biggest scam perpetrated on the American public since One Hour Martinizing.",
  "author": "Kramer"
},
{

  "quote": "Here's to feeling good all the time.",
  "author": "Kramer"
},
{

  "quote": "I'll be back. We'll make out.",
  "author": "David Puddy"
},
{

  "quote": "Ah, look, I? I'm sorry to bother you, but I'm a US postal worker and my mail truck was just ambushed by a band of backwoods mail-hating survivalists.",
  "author": "Newman"
},
{

  "quote": "You very bad man, Jerry. Very bad man.",
  "author": "Babu"
},
]
lool dont laugh
Aleksandar B.
@aleksandar-b
@willcodes so it is an array of object
willcodes
@willcodes
oh do I have do put [1].author?
er [0]
YES
IT WORKED
@samosale THANK YOU
CamperBot
@camperbot
willcodes sends brownie points to @samosale :sparkles: :thumbsup: :sparkles:
:cookie: 661 | @samosale |http://www.freecodecamp.com/samosale