These are chat archives for FreeCodeCamp/HelpFrontEnd

17th
Jun 2016
max77p
@max77p
Jun 17 2016 00:00
does it work for you?
Greg Duncan
@GregatGit
Jun 17 2016 00:01
try $('#id').append(para);
max77p
@max77p
Jun 17 2016 00:02
@GregatGit still nothing lol
Greg Duncan
@GregatGit
Jun 17 2016 00:02
@max77p AHHH! can i see you page?
@GregatGit let me put it back to what was working..1sec
@GregatGit ok refresh
Kyle Strem
@kkdelux
Jun 17 2016 00:05
can anyone help me understand why there is a second move made on the beginning of the second game (only play win starts next game as of now) https://codepen.io/kkdelux/pen/BzzZRe
matthew3454
@matthew3454
Jun 17 2016 00:13
@GregatGit You're very helpful Greg. Thank you, but are you saying that I should change my javascript more than you told me to? http://codepen.io/codeabode20/pen/XKKBvV?editors=1010
CamperBot
@camperbot
Jun 17 2016 00:13
matthew3454 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:warning: matthew3454 already gave gregatgit points
Greg Duncan
@GregatGit
Jun 17 2016 00:15
@matthew3454 You could write a function that success uses - if you want
Luke
@lukenetti3
Jun 17 2016 00:17
Any chance someone can help me...I am working on the random quote challenge. My problem is that on the click of the button to get a new quote it only works once. I can post my whole code if needed, but I have the function that gets a new quote and at the end I have my document ready function and in that has the click function and in that is my call to getNewQuote(which is my function). Anyone know why it only works with the first click of the button?
Greg Duncan
@GregatGit
Jun 17 2016 00:18
@max77p
for(var i in keys){ 
    var para = '<p>' + keys[i] + '</p>';
    $("#myDIV").append(para); 
  }
@lukenetti3 can you post your pen
matthew3454
@matthew3454
Jun 17 2016 00:23
@GregatGit What's the point?
Greg Duncan
@GregatGit
Jun 17 2016 00:24
@matthew3454 neater - better to a have a series of function than one mammoth one
matthew3454
@matthew3454
Jun 17 2016 00:25
@GregatGit I see. Well, I'll keep that in mind. My problem now is finding out how to make a search bar appear.
Tyler Moeller
@TylerMoeller
Jun 17 2016 00:27
@lukenetti3 You seem to be missing your click code $('#newQuote').click(firstQuote);
Or $('#newQuote').click(getNewQuote); depending on which function you want to use. Remove the one you aren't using :)
Luke
@lukenetti3
Jun 17 2016 00:30
@TylerMoeller Where does that click code go though? Inside my getNewQuote or the document ready function?
Tyler Moeller
@TylerMoeller
Jun 17 2016 00:30
@lukenetti3 Separate as if it were another function
Standalone if that makes sense:
$(document).ready(function () {
  getNewQuote();
});

function getNewQuote() {
  var randNum = Math.floor(Math.random() * 30);
  var $quotes = $('.quote');

  $.ajax({
    url: 'http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=' + randNum,
    success: function (quotes) {
      $.each(quotes, function (i, quote) {
        $quotes.html(quote.content + quote.title);
      });
    },
  });
}

$('#newQuote').click(getNewQuote);
matthew3454
@matthew3454
Jun 17 2016 00:32
@GregatGit Nevermind
@GregatGit for now
@GregatGit Okay. I've got the search bar and submit button but they don't do anything.
Luke
@lukenetti3
Jun 17 2016 00:35
@TylerMoeller Thank you so much! I got it! That was so much easier than I thought. I few people who had helped me made it more confusing and I thought there had to be a simpler way. Thanks again!
CamperBot
@camperbot
Jun 17 2016 00:35
:cookie: 604 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
lukenetti3 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
Tyler Moeller
@TylerMoeller
Jun 17 2016 00:35
Any time - :)
Tyler Moeller
@TylerMoeller
Jun 17 2016 00:43
@matthew3454 I'll lget Greg keep helping, but I noticed one thing right away: http://enwikipedia.org should be http://en.wikipedia.org and since you're specifying dataType: "jsonp" in your ajax call, you don't need to specify the format or the callback in your URL. You also don't seem to have any elements with the ID searchTerm, so you aren't passing any value to search for.
Lars
@Oppenheimer1
Jun 17 2016 00:49
When I first did this I didn't take into consideration the test string can start in the middle of the alphabet so I had to go back and the includes method filled in the gap:

function fearNotLetter(str) {

var a,b;
var newStr = [];
var superStr = str.split('');
var alphabet = 'abcdefghijklmnopqrstuvwxyz';

if(alphabet.includes(str)){
a = undefined;
}
else{
for(i=0;i<str.length-1; i++){
if(alphabet[i] === superStr[i]){
newStr.push(alphabet[i]);
}
}
var b = newStr.length;
var a = alphabet[b];
}
return a;
}

fearNotLetter("bcd");

matthew3454
@matthew3454
Jun 17 2016 01:10
@TylerMoeller I fixed the first part, I don't quite understand what you mean by "since you're specifying dataType: "jsonp" in your ajax call, you don't need to specify the format or the callback in your URL.", and I'm not sure what to do with your third suggestion so far other than this: $.ajax({ type: "GET", url: url, contentType: "application/json; charset=utf-8", async: false, searchTerm:, dataType: "jsonp", success: function(data) { console.log(data); $('output').html(''); for (var i = 0; data[1].length; i++) { $("#output").prepend("<li><a href = " + data[3][0] + ">" + data[2][0] + "</a><p>" + data[1][0] + "</p></li>"); } } });
```
$.ajax({ type: "GET", url: url, contentType: "application/json; charset=utf-8", async: false, searchTerm:, dataType: "jsonp", success: function(data) { console.log(data); $('output').html(''); for (var i = 0; data1.length; i++) { $("#output").prepend("<li><a href = " + data[3][0] + ">" + data[2][0] + "</a><p>" + data[1][0] + "</p></li>"); } } });```
``````
Greg Duncan
@GregatGit
Jun 17 2016 01:11
@matthew3454 y delete the <script .... > inside the html
matthew3454
@matthew3454
Jun 17 2016 01:11
@GregatGit right away
Greg Duncan
@GregatGit
Jun 17 2016 01:11
@matthew3454 give your input and id in the html
matthew3454
@matthew3454
Jun 17 2016 01:12
@GregatGit done
Greg Duncan
@GregatGit
Jun 17 2016 01:12
@matthew3454 var searchTerm = $('#that id goes here').val();
Tyler Moeller
@TylerMoeller
Jun 17 2016 01:13
@matthew3454 Just shut down my computer and I'm on the road, driving home...I remember your Wikipedia URL had a 'callback=?' And 'format=jsonp', but those are handled for you by the Ajax call when you use dataType: jsonp. Basically, remove everything after your searchterm variable in that URL.
Perfect, thanks @GregatGit
CamperBot
@camperbot
Jun 17 2016 01:14
tylermoeller sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 596 | @gregatgit |http://www.freecodecamp.com/gregatgit
matthew3454
@matthew3454
Jun 17 2016 01:16
@TylerMoeller Okay dude. Thank you again for your help
CamperBot
@camperbot
Jun 17 2016 01:16
matthew3454 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:cookie: 605 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
matthew3454
@matthew3454
Jun 17 2016 01:17
@GregatGit what should that id be?
Greg Duncan
@GregatGit
Jun 17 2016 01:17
@matthew3454 and fix you for loop up for (var i = 0; i < data[1].length; i++)
Jonathan Aguilar
@jonaguiar
Jun 17 2016 01:18
how do one center ul? I am doing the tribute page and can't seem to center the bullets that go with the text.
Greg Duncan
@GregatGit
Jun 17 2016 01:18
call it item or myItem
matthew3454
@matthew3454
Jun 17 2016 01:19
@GregatGit okay
Greg Duncan
@GregatGit
Jun 17 2016 01:19
@jonaguiar you could try magin-left: 50%; maybe 50 is too much
@matthew3454 fix your loop up first - it is infinate
@matthew3454 searchTerm: searchTerm,
matthew3454
@matthew3454
Jun 17 2016 01:22
@GregatGit done
Greg Duncan
@GregatGit
Jun 17 2016 01:24
@matthew3454 this is wrong for (var i = 0; data[1].length; i++) it will keep on going while dat1.length is true - which it is
matthew3454
@matthew3454
Jun 17 2016 01:24
@GregatGit I fixed the for loop. What does SearchTerm: searchTerm allow me to pass a value to search for?
@GregatGit I mean why does it?...
Greg Duncan
@GregatGit
Jun 17 2016 01:26
@matthew3454 you put searchTerm in there - I don't know why - I would remove that line altogether
matthew3454
@matthew3454
Jun 17 2016 01:27
Greg Duncan
@GregatGit
Jun 17 2016 01:27
you didn't give the input an id
matthew3454
@matthew3454
Jun 17 2016 01:29
@GregatGit How about now?
Greg Duncan
@GregatGit
Jun 17 2016 01:29
you don't have to keep pasting your pen up - i can just refresh
matthew3454
@matthew3454
Jun 17 2016 01:30
@GregatGit gtk
Greg Duncan
@GregatGit
Jun 17 2016 01:30
<input type="text" name="search" placeholder="Search.." id=> still nothing
you already used search
give it a unique one
matthew3454
@matthew3454
Jun 17 2016 01:31
@GregatGit okay
"search-bar"
Greg Duncan
@GregatGit
Jun 17 2016 01:32
call it item
matthew3454
@matthew3454
Jun 17 2016 01:32
@GregatGit okay
don
e
Greg Duncan
@GregatGit
Jun 17 2016 01:32
var searchTerm = $('#searchTerm').val(); now replace searchTerm with whatever you put
matthew3454
@matthew3454
Jun 17 2016 01:33
@GregatGit okay
done
Greg Duncan
@GregatGit
Jun 17 2016 01:34
fix your loop i should be less than, not greater than
matthew3454
@matthew3454
Jun 17 2016 01:35
@GregatGit done
Greg Duncan
@GregatGit
Jun 17 2016 01:35
hit the tidy button on the js tab
matthew3454
@matthew3454
Jun 17 2016 01:36
@GregatGit done
Greg Duncan
@GregatGit
Jun 17 2016 01:36
type in a search item and try it out
matthew3454
@matthew3454
Jun 17 2016 01:37
@GregatGit action!
@GregatGit You rock dude. Thank you.
CamperBot
@camperbot
Jun 17 2016 01:38
matthew3454 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 597 | @gregatgit |http://www.freecodecamp.com/gregatgit
Greg Duncan
@GregatGit
Jun 17 2016 01:38
@matthew3454 :+1:
Matthew Restine
@mattrestine
Jun 17 2016 01:50
I have to do a Personal Portfolio website, what can i do to store images and stuff like that?
lcassettai
@lcassettai
Jun 17 2016 01:51
@Digitalopensky add the url of the img
Greg Duncan
@GregatGit
Jun 17 2016 01:51
@Digitalopensky if you have a codepen pro account ($10 a month)
Matthew Restine
@mattrestine
Jun 17 2016 01:52
I see, thanks @lcassettai @GregatGit
CamperBot
@camperbot
Jun 17 2016 01:52
digitalopensky sends brownie points to @lcassettai and @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 326 | @lcassettai |http://www.freecodecamp.com/lcassettai
:cookie: 598 | @gregatgit |http://www.freecodecamp.com/gregatgit
Chris Cullen
@123xylem
Jun 17 2016 01:53
QUESTION:: Im trying to write something that looks at the value of TIll and counts it to see if the till has sufficient funds to cover change...
How do i access the numbers so I can count it or is it possible?

function checkCashRegister(price, cash, cid) {
var cost=arguments[0];
  var money=arguments[1];
var till= arguments[2];
  var count=0;

  var change= money-cost;

  for(var i in till){
    count+= till[i].hasOwnProperty(val);
  if(change>count){
    return "Insufficient Funds";
  }
  }
 return count;
}
Greg Duncan
@GregatGit
Jun 17 2016 01:54
@Digitalopensky you could also check out this http://www.getcloudstorage.net/4-best-places-store-photos-online-free/
EdenSweden
@EdenSweden
Jun 17 2016 01:54
QUESTION: Hi guys, I am still new to coding and I'm working on my first project so I apologize. I am struggling to center an image. I looked up what to do but it's not working. How do you typically do it?
Greg Duncan
@GregatGit
Jun 17 2016 01:57
@EdenSweden have a look here - I think it should help https://www.w3.org/Style/Examples/007/center.en.html
EdenSweden
@EdenSweden
Jun 17 2016 01:58
@GregatGit I looked at that exact site but it did not work. Should I show you my code?
Greg Duncan
@GregatGit
Jun 17 2016 01:58
@EdenSweden yes
Micah Bales
@micahbales
Jun 17 2016 02:00
Howdy everyone. I think my Simon game is very close to completion. Can you please play it and tell me what flaws you find? Thank you! http://codepen.io/micahbales/pen/MegRqm?editors=0010
Greg Duncan
@GregatGit
Jun 17 2016 02:00
@EdenSweden did you try
    display: block;
    margin-left: auto;
    margin-right: auto
lcassettai
@lcassettai
Jun 17 2016 02:01
@EdenSweden i use this
<img src="url" alt="">

//style
img{
  display:block;
  margin:0px auto;
}
EdenSweden
@EdenSweden
Jun 17 2016 02:01

<style>

IMG.displayed {
display: block;
margin-left: auto;
margin-right: auto;
}
</style>

<html>
<img class="smaller-image" src="http://www.historyanswers.co.uk/wp-content/uploads/2015/10/Ada_Lovelace_portrait-1024x858.jpg"></img>
</div>

</html>

@GregatGit (sorry, that last </div> shouldn't be in there. I took out a lot of the code so it only showed what I'm having a hard time with)

@GregatGit let me redo this.

<style>

IMG.displayed {
display: block;
margin-left: auto;
margin-right: auto;
}
</style>

<html>
<img class="displayed" src="http://www.historyanswers.co.uk/wp-content/uploads/2015/10/Ada_Lovelace_portrait-1024x858.jpg"></img>
</div>

</html>

Greg Duncan
@GregatGit
Jun 17 2016 02:03
@EdenSweden did you do it in code pen?
EdenSweden
@EdenSweden
Jun 17 2016 02:03
yes.
@GregatGit yes
Greg Duncan
@GregatGit
Jun 17 2016 02:04
can you put your pen up
lcassettai
@lcassettai
Jun 17 2016 02:04
@EdenSweden add some width to your img
Greg Duncan
@GregatGit
Jun 17 2016 02:04
@micahbales after i got up to 5 it started to get glitchy
lcassettai
@lcassettai
Jun 17 2016 02:04
IMG.displayed {
display: block;
margin-left: auto;
margin-right: auto;
width:500px;
}
EdenSweden
@EdenSweden
Jun 17 2016 02:05
@lcassettai I tried to do that too. Anything I'm trying to do with this image is not working. But I can alter text and boxes...
lcassettai
@lcassettai
Jun 17 2016 02:05
img doesnt' have closing tag is just <img src="" alt="" />
EdenSweden
@EdenSweden
Jun 17 2016 02:06
@lcassettai wait it shouldn't have a closing tag?
@lcassettai thanks
CamperBot
@camperbot
Jun 17 2016 02:06
edensweden sends brownie points to @lcassettai :sparkles: :thumbsup: :sparkles:
:cookie: 327 | @lcassettai |http://www.freecodecamp.com/lcassettai
lcassettai
@lcassettai
Jun 17 2016 02:06
nope!
lcassettai
@lcassettai
Jun 17 2016 02:06
you must add your style in css module
EdenSweden
@EdenSweden
Jun 17 2016 02:07
@lcassettai I already tried that and it didn't work. It works when I put it in the html module.
Chris Cullen
@123xylem
Jun 17 2016 02:07

  for(i=0; i<till.length;i++){
    for(j=1;j<till[i].length;j+2){
    count+= till[j];
  if(change>count){
    return "Insufficient Funds";
  }}
  }
 return count;
cid=[["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10];    //etc etc
I made a nested loop that looks at 2nd elem of array and adds to count
then i can compare the val of count with change needed
But its giving infi loop...
Greg Duncan
@GregatGit
Jun 17 2016 02:07
@EdenSweden I forked your project and you pretty much had it
Chris Cullen
@123xylem
Jun 17 2016 02:08
cid = till
Greg Duncan
@GregatGit
Jun 17 2016 02:08
@EdenSweden should be img not IMG.displayed
Chris Cullen
@123xylem
Jun 17 2016 02:08
How do i stopthat infi looping
lcassettai
@lcassettai
Jun 17 2016 02:09
blob
EdenSweden
@EdenSweden
Jun 17 2016 02:09
@GregatGit that's what I thought but I was following the example in this website https://www.w3.org/Style/Examples/007/center.en.html and that didn't work either.
Greg Duncan
@GregatGit
Jun 17 2016 02:09
@EdenSweden here is your pen http://codepen.io/gregoverhere/pen/xOOmmN
EdenSweden
@EdenSweden
Jun 17 2016 02:10
@GregatGit so the only thing you did is move the style section to the CSS module?
Micah Bales
@micahbales
Jun 17 2016 02:11
@GregatGit I seem to have random glitches, at different stages in the game. Can't figure out what's going on. Any ideas?
Greg Duncan
@GregatGit
Jun 17 2016 02:11
@EdenSweden and i change the selector from IMG.displayed to img
EdenSweden
@EdenSweden
Jun 17 2016 02:11
ok. @GregatGit Thank you!!
CamperBot
@camperbot
Jun 17 2016 02:11
edensweden sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 599 | @gregatgit |http://www.freecodecamp.com/gregatgit
lcassettai
@lcassettai
Jun 17 2016 02:12
@123xylem you put "j + 2" in the second for loop, but you never asign de value to j
Chris Cullen
@123xylem
Jun 17 2016 02:13
@lcassettai (j=1;j<till[i];j+2)
j should be pos 1 of the till i loop
Greg Duncan
@GregatGit
Jun 17 2016 02:13
@EdenSweden stick them in the css box
Chris Cullen
@123xylem
Jun 17 2016 02:13
and then j always jumps to pos1 of the next array
Greg Duncan
@GregatGit
Jun 17 2016 02:14
@micahbales I think you should try to disable the buttons unless it is the users turn
Micah Bales
@micahbales
Jun 17 2016 02:15
@GregatGit That's a good suggestion. Thank you. Do you have any hints of how to go about that? pointer-events: none doesn't seem to work in this case
CamperBot
@camperbot
Jun 17 2016 02:15
micahbales sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 600 | @gregatgit |http://www.freecodecamp.com/gregatgit
kakismash
@kakismash
Jun 17 2016 02:15
function imagealeator()
{
var imagearr = ["http://fondos.fondoshd.com/images/hd/eclipse-solar-desde-espacio-5303c998cd1c9.jpg", "http://files.vividscreen.info/soft/29dffdcc76ed562e77f50b0c843f95d2/Eclipse-1920x1200.jpg", "http://cdn2.computeridee.nl/source/sites/computeridee.nl/files/nieuwsbeeld/firefox_2.jpg", "http://3.bp.blogspot.com/-6DD537VQEww/UPltOfug5QI/AAAAAAAA0N4/RAybyajxjKg/s1600/Fondo-Negro-Patron-de-Luz-Abstrato_Fondos-de-Pantalla-Abstratos.jpg", "http://www.ifondos.net/hd/wp-content/plugins/my-wallpapers-system/wallpapers/2012/05/1600x900/puntos-de-colores-hd-381.jpg", "http://k40.kn3.net/taringa/4/1/3/9/1/1/3/danielgarcia2010/0A1.jpg?2531", "http://imagenesfotos.com/wp-content/2009/11/fondos-coloridos-2.jpg", "http://1.bp.blogspot.com/-0csPFNlYZX0/TgUSXQTMoSI/AAAAAAAAE5M/LGNJRfiCeVw/s1600/27%252Bfuego.jpeg", "http://www.fondosni.com/descarga/images/wallpapers/decoraciones%20%20de%20color%20rojo-818540.jpg", "http://wallpaper.ultradownloads.com.br/275303_Papel-de-Parede-Para-Todos-os-Anonymous_1920x1200.jpg", "http://hdwallpaperfun.com/wp-content/uploads/2014/12/Anonymous-Typpography-Wallpaper-Free-Download-64803.jpg", "http://lh3.googleusercontent.com/jWKy-JaAjvFkSIoB3ZSFHbu5jNBopJK1VX_jltSHTUxRzyLg-a1LhWHbhclmyQcpHFk=w300", "http://www.hdfondos.eu/pictures/2014/0620/1/anonymous-hd-images-wallpaper-8066.jpg", "https://s-media-cache-ak0.pinimg.com/736x/87/ce/ef/87ceefacb4dd3492cafa326423f9d402.jpg"];
var image = imagearr[Math.floor(Math.random()*imagearr.length)];
document.getElementById("divb").style.backgroundImage = "url("imagearr[image]")";
}
lcassettai
@lcassettai
Jun 17 2016 02:15
hahah
kakismash
@kakismash
Jun 17 2016 02:16
upss sorry, i need help
Greg Duncan
@GregatGit
Jun 17 2016 02:17
@micahbales it's not to hard - just have a boolean like var buttonOn = false if they press a button and buttonOn is false it returns
Micah Bales
@micahbales
Jun 17 2016 02:18
@GregatGit Good call. Thank you!
CamperBot
@camperbot
Jun 17 2016 02:18
micahbales sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:warning: micahbales already gave gregatgit points
lcassettai
@lcassettai
Jun 17 2016 02:19
@123xylem when the second loop start would make this j has value 1 ; then ask J is lees than till[i]? yes he is so do some code, when finish, you say J + 2 (but you dont assign the value j) so the loop would add J is less than till[i] (this will be the same till you compare before) and because you never asign the value to J your loop never stop (sorry my bad english :P hope you can understand haha)
Philippe Oscar Sanoy
@sanoyphilippe
Jun 17 2016 02:20
Anyone here using Meteor js with React?
buiphuking
@buiphuking
Jun 17 2016 02:20
http://codepen.io/buiphuking/pen/JKoEZG?editors=0010
hi guys, play my game and give me feedback plz
EdenSweden
@EdenSweden
Jun 17 2016 02:21
Alright, another noob question. I am trying to move a box down by adjusting it to margin: 100px 10px 10px 10px; however, it just moves it diagonally down to the left when I do that. What am I doing wrong?
Chris Cullen
@123xylem
Jun 17 2016 02:22
@lcassettai ah I have to change j value after every loop
lcassettai
@lcassettai
Jun 17 2016 02:23
@buiphuking i like it! but ...when I select the O does not work and play as if I had selected the X
@EdenSweden send your pen it woul be easier
buiphuking
@buiphuking
Jun 17 2016 02:24
@lcassettai i don't know how to fix it
can you?
lcassettai
@lcassettai
Jun 17 2016 02:26

@123xylem yep j must change his value if you put in a loop, otherwise the loop never finish its for eg doing something like this

for(var i = 0 ;  i <  5 ; i ) {   }

if you never increment i the condicion always gona be true, i always is going to be 0

Chris Cullen
@123xylem
Jun 17 2016 02:26
@lcassettai I tried to say j+=j at t eh end but it crashed the browser.. How do i assign val to j at the end of the loop?
for(i=0; i<till.length;i++){
    for(j=till[i][1];j<till[i].length;){
   j+=j;
    count+= till[j];
  if(change>count){
    return "Insufficient Funds";
  }}
  }
 return count;
}
Or I just want to make J the second val of till[i]
at every array
eg [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10],
lcassettai
@lcassettai
Jun 17 2016 02:28

for(i=0; i<till.length;i++){
     for(j=till[i][1];j<till[i].length;j++){  //if you want to add 1 or j = j+2  to add 2 

        count+= till[j];
        if(change>count){
          return "Insufficient Funds";
        }
}
}
 return count;
}
@123xylem can you send all the function ?
Chris Cullen
@123xylem
Jun 17 2016 02:28
ahh
lcassettai
@lcassettai
Jun 17 2016 02:28
@buiphuking let me see if i can help but i don't start this challenge yet hah
Chris Cullen
@123xylem
Jun 17 2016 02:29
function checkCashRegister(price, cash, cid) {
var val;
 var cost=arguments[0];
  var money=arguments[1];
var till= arguments[2];
  var count=0;

  var change= money-cost;

  for(i=0; i<till.length;i++){
    for(j=till[i][1];j<till[i].length;j=j+2){
    count+= till[j];
  if(change>count){
    return "Insufficient Funds";
  }}
  }
 return count;
}


checkCashRegister(20.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);
buiphuking
@buiphuking
Jun 17 2016 02:31
@lcassettai
i sue unbind, but it not works as i want
lcassettai
@lcassettai
Jun 17 2016 02:42
@123xylem still here?
96street
@96street
Jun 17 2016 02:42
Can someone tell me why this isn't working? http://codepen.io/kingdezz/pen/mEJPLN
Chris Cullen
@123xylem
Jun 17 2016 02:42
@lcassettai YES
lcassettai
@lcassettai
Jun 17 2016 02:43
i think you try something like this or correct me if im wrong
 function checkCashRegister(price, cash, cid) {
   var val;
   var cost=arguments[0];
   var money=arguments[1];
   var till= arguments[2];
   var count=0;
   var change= money-cost;  

   if(change>0){ //if the cost is > than the money you have you don't give change
      for(var i=0; i<till.length;i++){   
        count = till[i][0];     
          if(change>count){
            return "Insufficient Funds";
          }
      }
    }
 return count;
}


checkCashRegister(20.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);
@96street you should add the event click inside the ready function
lcassettai
@lcassettai
Jun 17 2016 02:50
$(document).ready(function() {
  $('#getQuote').on('click', getQuote);

  function getQuote() { 
    $.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=", function(a) {
        $(".quote p").html(a[0].content);
        $("span").html('- ' + a[0].title);
        console.log(a);
    });                                 
  };
});
@96street
Chris Cullen
@123xylem
Jun 17 2016 02:51
@lcassettai looking now
@lcassettai till i0 is the name part of the arrays though?
and it doesnt do a running count on the whole value of the till
lcassettai
@lcassettai
Jun 17 2016 02:53
sorry it should be
 till[i][1]
96street
@96street
Jun 17 2016 02:54
Perfect, thanks @lcassettai
CamperBot
@camperbot
Jun 17 2016 02:54
96street sends brownie points to @lcassettai :sparkles: :thumbsup: :sparkles:
:cookie: 328 | @lcassettai |http://www.freecodecamp.com/lcassettai
Chris Cullen
@123xylem
Jun 17 2016 02:54
@lcassettai What it does seem to give the accumulative total?? How can that be!
96street
@96street
Jun 17 2016 02:54

Can you tell me why

$('#getQuote').on('click', getQuote);

has to go before the code?

@lcassettai
If I put it after it crashes the browser
Chris Cullen
@123xylem
Jun 17 2016 02:56
@lcassettai Yea that works... GOOD JOB thanks!
CamperBot
@camperbot
Jun 17 2016 02:56
123xylem sends brownie points to @lcassettai :sparkles: :thumbsup: :sparkles:
:cookie: 329 | @lcassettai |http://www.freecodecamp.com/lcassettai
Chris Cullen
@123xylem
Jun 17 2016 02:56
@lcassettai I just have 1 more problem... My change comes out as a - number
How do i make change always positive?
Greg Duncan
@GregatGit
Jun 17 2016 02:57
@EdenSweden just use margin-top: value;
lcassettai
@lcassettai
Jun 17 2016 02:57
@96street because if you put after your ready function you are trying to call a function that doesn't exist, the ready function wait untill all the page it's loaded and then add the java script, if you put after you say hey call getquot but the browser doen't found it
@123xylem great!
96street
@96street
Jun 17 2016 02:58
it doesn't exist because it's only defined inside the ready function? @lcassettai
So outside of the ready function it is undefined?
Chris Cullen
@123xylem
Jun 17 2016 02:58
@lcassettai im using math.abs to make negative positive... I think that will work
lcassettai
@lcassettai
Jun 17 2016 02:58
mmm you can multiply the number for -1 eg : - 10 * (-1) = 10
Diego
@disofu234
Jun 17 2016 02:59
Hey guys can someone look at my jquery code and tell me why my .getJSON() call isn't working
lcassettai
@lcassettai
Jun 17 2016 03:00
@96street yep if you look in the console of the broswer it says this (i send an image)
blob
get cuote its not a function
because it's not declared until the page its full loaded @96street
96street
@96street
Jun 17 2016 03:01
Yep that makes sense ty
lcassettai
@lcassettai
Jun 17 2016 03:02
np bro!
Nick Woelk
@UnluckyNick
Jun 17 2016 03:08

Hi campers! I'm trying to get the length of a string in a <p> element in javascript. I get this error in the console: Uncaught TypeError: Cannot read property 'length' of undefined

var myLength = $("#author").str.length;

This is the HTML element:

<p id="author"></p>
Greg Duncan
@GregatGit
Jun 17 2016 03:10
@disofu234 add this to the end of your api string &callback=?
Chris Cullen
@123xylem
Jun 17 2016 03:11
This message was deleted
Diego
@disofu234
Jun 17 2016 03:11

@UnluckyNick try to do something like:

var myLength = $("#author").text().length;

if that doesn't work then try:

var str = $("#author").text();
var myLength = str.length;
Chris Cullen
@123xylem
Jun 17 2016 03:11

@lcassettai


  if(change<0){
  change=Math.abs(change);}//this makes change positive if its negative value
else change=change;


  for(i=0; i<till.length;i++){
   count+=till[i][1];
  if(change>count){
    return "Insufficient Funds";
  }}
    return "your change is "+ change;


}


checkCashRegister(2.50, 20.00, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.10], ["QUARTER", 4.25], ["ONE", 90.00], ["FIVE", 55.00], ["TEN", 20.00], ["TWENTY", 60.00], ["ONE HUNDRED", 100.00]]);

This code is buggy.. It should be till[i][1] that has the nunber but for some reason it doesnt always work.. Its since I used the math.abs stuff
@disofu234
@UnluckyNick try to do something like:

var myLength = $("#author").text().length;

if that doesn't work then try:

var str = $("#author").text();
var myLength = str.length;
Greg Duncan
@GregatGit
Jun 17 2016 03:13
@disofu234 + "&limit=10&namespace=0&callback=?";
Nick Woelk
@UnluckyNick
Jun 17 2016 03:13
@123xylem Thanks! The first got me past the error.
CamperBot
@camperbot
Jun 17 2016 03:13
unluckynick sends brownie points to @123xylem :sparkles: :thumbsup: :sparkles:
:cookie: 316 | @123xylem |http://www.freecodecamp.com/123xylem
Chris Cullen
@123xylem
Jun 17 2016 03:13
@UnluckyNick your welcome :)
u thanked the wrong guy tho
Diego
@disofu234
Jun 17 2016 03:14
@GregatGit that worked! thank you
CamperBot
@camperbot
Jun 17 2016 03:14
disofu234 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:cookie: 601 | @gregatgit |http://www.freecodecamp.com/gregatgit
Chris Cullen
@123xylem
Jun 17 2016 03:15
@lcassettai count no longer accumulates i1 for some reason?
 if(change<0){
  change=Math.abs(change);}//this makes change positive if its negative value
else change=change;


  for(i=0; i<till.length;i++){
   count+=till[i][0];
  if(change>count){
    return count;
  }}
    return count;
Jose
@MageTank
Jun 17 2016 03:27
Still working on the Tribute page.. so I am I allowed to pretty much copy a timeline i found for the person I am looking for?
Anybody?
Diego
@disofu234
Jun 17 2016 03:32
I did that and linked to the original timeline at the end
Jose
@MageTank
Jun 17 2016 03:32
ok thanks
@disofu234 thanks
CamperBot
@camperbot
Jun 17 2016 03:32
magetank sends brownie points to @disofu234 :sparkles: :thumbsup: :sparkles:
:cookie: 266 | @disofu234 |http://www.freecodecamp.com/disofu234
Vamshi Gudipati
@vamshikrishna144
Jun 17 2016 03:56
Im trying to write code for reverse of a string . Can you please tell me what is wrong with this?
function FirstReverse(str) {

  var reverse;
  for(i=0;i<str.length+1;i++){
      reverse[i] = (str[str.length-i]);
  }
  return str;
}

FirstReverse('Hello world');
Diego
@disofu234
Jun 17 2016 03:58
var reverse = []
try that
Vamshi Gudipati
@vamshikrishna144
Jun 17 2016 03:59
@disofu234 You are the man
Diego
@disofu234
Jun 17 2016 03:59
and return reverse.join("")
Vamshi Gudipati
@vamshikrishna144
Jun 17 2016 03:59
@disofu234 thank you
CamperBot
@camperbot
Jun 17 2016 03:59
vamshikrishna144 sends brownie points to @disofu234 :sparkles: :thumbsup: :sparkles:
:cookie: 267 | @disofu234 |http://www.freecodecamp.com/disofu234
SuryaKavutarapu
@SuryaKavutarapu
Jun 17 2016 04:04
@sanoyphilippe leveluptuts youtube channel take a look his name is Scott tolinski he is teaching a course on meteor + react for everyone it might be helpful for you
Philippe Oscar Sanoy
@sanoyphilippe
Jun 17 2016 04:05
@SuryaKavutarapu Yup I've seen his videos, but still not finished yet last I watched. I was just wondering if anyone who has worked on meteor 1.3 have tried deploying to AWS Beanstalk
Greg Duncan
@GregatGit
Jun 17 2016 04:13
@vamshikrishna144 no loop is required
or any new variables
96street
@96street
Jun 17 2016 04:14
Accessing Nested Objects in JSON
Why isn't this answer working? var gloveBoxContents = "myStorage['glove box']";
Greg Duncan
@GregatGit
Jun 17 2016 04:14
just split / reverse / join / return
glove box should be one word ( i think)
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 04:24
Hi guys, I'm doing the random quote machine can anyone help me with my js code?
here is my code
$(document).ready(function() {
  $("#get-quote").on("click", function() {
    $.getJSON("http://quotes.rest/quote.json", function(json) {
      $("#quote").html(JSON.stringify(json));
    });
  });
});
i'm to get json format but when press #get-quote it doesnt show anything
Ken Nawrocki
@nawrockp
Jun 17 2016 04:30
@NguyenThuongHuy did you check to see if your json call resulted in an error?
I think jquery json fails silently
I am not sure about getJSON though
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 04:33
@nawrockp may i ask how can i check if the call resulted in an error ?
Ken Nawrocki
@nawrockp
Jun 17 2016 04:33
Yeah it does fail silentl
Try ajax instead
I think the jquery documentation for getjson shows you an alternative
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 04:37
@nawrockp i'm not quite understand i try to follow the Get JSON with the jQuery getJSON Method exercise
Ken Nawrocki
@nawrockp
Jun 17 2016 04:39
Getjson is just a shortcut for ajax
If u look at that page it will show alternative ways
For example, you may need to use jsonp
Or set the headers in the request
I dont know that api you are using so i dont know
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 04:42
@nawrockp this the api im trying to get https://theysaidso.com/api/
*this is
Ken Nawrocki
@nawrockp
Jun 17 2016 04:44
That is not what is in your code
Ok. I see now
Hold on...
Well it works in the browser but it may be a cross origen issue. Are you using codepen?
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 04:48
yes i'm using codepen
Ken Nawrocki
@nawrockp
Jun 17 2016 04:48
Chrome?
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 04:48
@nawrockp yeah
Ken Nawrocki
@nawrockp
Jun 17 2016 04:49
You can open chrome developer tools and it might show you the error
The console in codepen does not show errors
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 04:52
@nawrockp they requires https
Ken Nawrocki
@nawrockp
Jun 17 2016 04:52
You can change your codepen url to https
And change the url of the api to https, or better yet just //
Leave out the http:
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 04:57
@nawrockp i try both but it doesnt show anything
here is my html frame
<body>
  <div class="container-fluid">

    <div class="row text-center" id ="header">
      <h1>Random Quote Machine</h1>
      <hr>
    </div>

    <div class="row text-center">
      <div id= "quote"></div>
      <br>
    </div>

    <div class="row text-center" id="button">
      <button class="btn btn-primary" id ="get-quote">Get Quote</button>
      <button class="btn btn-primary" id="twitter">Twitter</button>
    </div>

  </div>


</body>
Ken Nawrocki
@nawrockp
Jun 17 2016 04:58
It
Can you just post the link to the pen?
96street
@96street
Jun 17 2016 05:03
How to I get my Quote Generator to tweet the actual quote and not the codepen? http://codepen.io/kingdezz/pen/mEJPLN/
Ken Nawrocki
@nawrockp
Jun 17 2016 05:05
@NguyenThuongHuy i am on my phone so hard to edit. But try adding this
```
.fail(function() {
console.log( "error" );
})
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 05:10
@nawrockp like this?
$(document).ready(function() {
  $("#get-quote").on("click", function() {
    $.getJSON("https://quotes.rest/quote.json", function(json) {
      $("#quote").html(JSON.stringify(json));
      .fail(function() {
        console.log("error");
      })
    });

  });
});
Ken Nawrocki
@nawrockp
Jun 17 2016 05:11
No. After the next })
No after the next})
And watch out for semicolons
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 05:13

@nawrockp ```js
$(document).ready(function() {
$("#get-quote").on("click", function() {
$.getJSON("https://quotes.rest/quote.json", function(json) {
$("#quote").html(JSON.stringify(json));

});
.fail(function() {
  console.log("error");
})

});
});

```

Ken Nawrocki
@nawrockp
Jun 17 2016 05:14
You cannot put a . After a ;
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 05:17
@nawrockp can you send me any article or website for json api so i can read?
Ken Nawrocki
@nawrockp
Jun 17 2016 05:17
Yeah the link i sent you
For getjson
Shows many ways of doing it
Huy Nguyen Thuong
@NguyenThuongHuy
Jun 17 2016 05:19
@nawrockp Thank you so much for helping me!
CamperBot
@camperbot
Jun 17 2016 05:19
nguyenthuonghuy sends brownie points to @nawrockp :sparkles: :thumbsup: :sparkles:
:cookie: 317 | @nawrockp |http://www.freecodecamp.com/nawrockp
Ken Nawrocki
@nawrockp
Jun 17 2016 05:20
Here is one i did a while ago
..
It has json with error checking
RakeshNerkar
@Rakesh18754
Jun 17 2016 05:40
        HTML

        <div ng-repeat="s in selectedBooks" >
              <p class="col-md-6">{{s.author}}</p>
              <button class="btn btn-success confirmbtn" ng-model="tagName" ng-click="checkout(s.id); addBookID(s.id); updateDataBookID();">
                    Confirm
              </button>
        </div>

        JS

        $scope.bookid= []; 
        $scope.addBookID = function(id){
            $scope.bookid.push({
                name: $scope.id
            });
        };
        console.log($scope.bookid);

        $scope.updateDataBookID = function(){
           $localStorage.bookTaken  =  $scope.bookid;
        }; 
        $scope.updateDataBookID();


        but when in my local storage the value is null? any idea why?
Steve Wilcox
@ThinknBoutStuff
Jun 17 2016 06:06
I'm having trouble with the quote generator API. I'm expecting there to be some kind of text change when I click on the "new quote" div I set up, but I'm not getting anything. Any help would be appreciated: https://codepen.io/Thinknboutstuff/pen/GqZryV
Ken Nawrocki
@nawrockp
Jun 17 2016 06:13
@ThinknBoutStuff i just was chatting with someone about the same thing
Might be an issue with https
Steve Wilcox
@ThinknBoutStuff
Jun 17 2016 06:15
I've found a pen that is using the API I'm trying to use. Although they format thier .getJSON function differently. http://codepen.io/dting/pen/PqrZgb
Looks like this codepen is able to use the http
Ken Nawrocki
@nawrockp
Jun 17 2016 06:16
Yeah i see that
Is the question mark in the right place in the api url?
kirbyedy
@kirbyedy
Jun 17 2016 06:18
it might be the security issue
kirbyedy
@kirbyedy
Jun 17 2016 06:18
all request are supposed to be secure over https
Danny Rubio
@drbe4t
Jun 17 2016 06:18
hey guys I need help formatting the three photos on this in a straight line.
I for the life of me can't get it to work.
Ken Nawrocki
@nawrockp
Jun 17 2016 06:19
@ThinknBoutStuff try moving the question mark before
The word method
Steve Wilcox
@ThinknBoutStuff
Jun 17 2016 06:23
@nawrockp Hmm. Trying that now. Doesn't seem to be working. I'm trying to work out why the example codepen is working, even when I try to use their exact same link. I'm looking at the .getJSON documentation right now to get a deeper understanding of what I'm tinkering around with.
@drbe4t I can't see your images, seems like they're stored locally.
Danny Rubio
@drbe4t
Jun 17 2016 06:26
@ThinknBoutStuff I don't have code pen pro so I couldn't upload them. Do I need to add som random photos as place holder?
Steve Wilcox
@ThinknBoutStuff
Jun 17 2016 06:30
It might be helpful to see the specific alignment challenges that you're facing. Placeholders seem fine if they're similarly sized.
Ken Nawrocki
@nawrockp
Jun 17 2016 06:30
@ThinknBoutStuff any errors in chrome dev tool?
The codepen console does not show errors
Danny Rubio
@drbe4t
Jun 17 2016 06:30
@ThinknBoutStuff alright added some.
Steve Wilcox
@ThinknBoutStuff
Jun 17 2016 06:31
@nawrockp Didn't look at chrome console until now... and it's littered with them.
Haha. Let me take a second to read through this.
@drbe4t Yeah, says it's an insecure response.
Even with httpss
RakeshNerkar
@Rakesh18754
Jun 17 2016 06:35

i want to generate an array of objects like this so how do i insert values dynamically

var array = [{
user-id : 5;
cars-id : ["2", "4","6"];
},{
user-id : 6;
cars-id : ["2", "4","6"];
}
];

Steve Wilcox
@ThinknBoutStuff
Jun 17 2016 06:36
@drbe4t Are you using bootstrap?
@drbe4t Nvm. The way you made your col classes looked bootstrap-like.
Danny Rubio
@drbe4t
Jun 17 2016 06:41
@ThinknBoutStuff So it' s not the full bootstrap I just coded it like bootsrap It's for a class and I don't know if the professor frowns upon doing stuff he doesn't teach. But I tried setting it up and I'm not sure it's my padding or picture size or what.
I'm also refining my css skills and so my CSS is not the cleanest.
kirbyedy
@kirbyedy
Jun 17 2016 06:50
@drbe4t maybe you should use the bootstrap grid system
col-md-4 will give you 3 equal columns where you can place your images
@drbe4t Might be worth a read for working around not using bootstrap
My intution is that you'll want to play around with <figure> (which I'm just assuming work like <div> tags) to get your desired results.
Danny Rubio
@drbe4t
Jun 17 2016 07:03
And how would I do that on my local files? I can just add it through the setting spot in code pen right?
Steve Wilcox
@ThinknBoutStuff
Jun 17 2016 07:10
If you're able to view your files locally I'm sure it will be fine. Otherwise some 3rd party image hosting might be required.
Danny Rubio
@drbe4t
Jun 17 2016 07:13
Oh i was talking about setting up the bootstrap grid. I have read about it but have never sit up in a project.
kirbyedy
@kirbyedy
Jun 17 2016 07:13
if you dont want to use frameworks like bootstrap or similar I would suggest to use flexbox
only 1 attribute in the css gave me this:
of course you can play around and make it nicer, this is just a start
Screen Shot 2016-06-17 at 10.14.41.png
so if you want to learn about flexbox read this: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
there is also a lot of youtube video tutorials which are nice
Steve Wilcox
@ThinknBoutStuff
Jun 17 2016 07:16
I just checked out that link. It looks pretty informative.
Danny Rubio
@drbe4t
Jun 17 2016 07:28
@kirbyedy I do want to use boostrap I know how to add it in code pen but not sure how to set up in my local project. Also I did add it to the code pen and it aligned fairly decently I think I have to adjust some things but maybe I'll just mess with flexbox. Thanks for the help!
CamperBot
@camperbot
Jun 17 2016 07:28
drbe4t sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1128 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
kirbyedy
@kirbyedy
Jun 17 2016 07:30
@drbe4t if you want to have similar result with bootstrap you have to use 3 separate divs with col-md-4 class, and put your photos in each of them
MD91
@MD91
Jun 17 2016 07:31
@TylerMoeller hi tyler, thanks for help but it didn't work
CamperBot
@camperbot
Jun 17 2016 07:31
md91 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:cookie: 606 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
kirbyedy
@kirbyedy
Jun 17 2016 07:31
by default is should work, but... once you want to tweak them, then the pain starts :D
Danny Rubio
@drbe4t
Jun 17 2016 07:31
and in flex i only have to add the flex attribute in the class? is that waht I'm understanding?
kirbyedy
@kirbyedy
Jun 17 2016 07:31
pretty much, no additional libraries like bootstrap
which makes your site lighter
there is a lot of fine adjustments for flexbox, take a bit of time to explore it, I think you will like it
Danny Rubio
@drbe4t
Jun 17 2016 07:33
thanks man. I did read about it in another article but this one really helped. Gracias!
Danny Rubio
@drbe4t
Jun 17 2016 07:33
that's from devtips right?
I think so, yes...
Danny Rubio
@drbe4t
Jun 17 2016 07:34
Great stuff from that channel.
Steve Wilcox
@ThinknBoutStuff
Jun 17 2016 07:34
Sooooo, in case anyone was wondering, I was able to connect to the API.
Instead of changing the API link for the .getJSON function --- I changed the codepen.io project link to http
Looks like that API uses a third party somewhere so when chrome tries to verify the link, it fails.
Good night ya'll! Catch you people another time:]
Danny Rubio
@drbe4t
Jun 17 2016 07:38
@ThinknBoutStuff thanks bro! take it easy. Glad you where able to figure that out.
CamperBot
@camperbot
Jun 17 2016 07:38
drbe4t sends brownie points to @thinknboutstuff :sparkles: :thumbsup: :sparkles:
:cookie: 275 | @thinknboutstuff |http://www.freecodecamp.com/thinknboutstuff
Danny Rubio
@drbe4t
Jun 17 2016 07:49
So do i add padding to to the class of the photos or do I need to add space to the photos with a flexbox attribute.
Danny Rubio
@drbe4t
Jun 17 2016 08:03
jk i got it figured out.
Quoc Anh Nguyen
@quocanh261997
Jun 17 2016 08:24
Hey Guys, I'm doing the Wiki Project and have a really difficult time figuring out how I can get the api to the things I search. I know there's a few hint from FreeCodeCamp, but I don't know how to get the api like the one I did with openweather API, can anyone help me?
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 08:36
I need help guys
I'm currently doing 'Portfolio' Project & having some problem with code
I'm trying to put an Awesome icon in place of 'Brand' in header with some text after it but the icon isn't getting displayed instead of it the text is getting styled with italic font.
plz have a look at my code & tell what am i doing wrong?\
kirbyedy
@kirbyedy
Jun 17 2016 08:44
@kaushikpraveen this is wrong: <link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
path/to... where does that lead ?
Quoc Anh Nguyen
@quocanh261997
Jun 17 2016 08:46
@kaushikpraveen You haven't installed/added font awesome link into your project
Oh wait a minute, you actually, do install it, wait
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 08:48
@kirbyedy @quocanh261997 is that path wrong?
kirbyedy
@kirbyedy
Jun 17 2016 08:51
yes its wrong, does not exist
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 08:52
@kirbyedy okay lemme go and find out the correct one then
Quoc Anh Nguyen
@quocanh261997
Jun 17 2016 08:52
yes, that's the correct link
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 08:54
@kirbyedy @quocanh261997 yep its working now..Ty very much :smile:
Nivedita
@nive2907
Jun 17 2016 09:04
guys it seems that chrome has blocked geolocation on non HTTPS pages
My codepen page is not secure. How can get latitude and longitude in that?
Fadhli Ismail
@fadhliismail
Jun 17 2016 09:06
@nive2907 just add https:// infront of your page link
Nivedita
@nive2907
Jun 17 2016 09:08
I did that @fadhliismail
I will try if it works now
96street
@96street
Jun 17 2016 09:10
Can someone help? I want the tweet share button to share the quote not the page link I'm doing the Quote Generator challenge http://codepen.io/kingdezz/pen/mEJPLN
Fadhli Ismail
@fadhliismail
Jun 17 2016 09:10
does it work? @nive2907 ?
my geolocation is working just fine with https
Eli
@elisspace
Jun 17 2016 09:12
@nive2907 I just used firefox.
Nivedita
@nive2907
Jun 17 2016 09:13
yes it does work @fadhliismail
@elisspace shouldn't our app work in all browsers ?
I couldn't understand what it need to challange?
Irfan Kucuk
@Ikucuk
Jun 17 2016 09:16
@GaneshCloud You have to make a page similar to that one yourself
Nivedita
@nive2907
Jun 17 2016 09:17
Does openweather api work all the time? @elisspace @fadhliismail
For me it sometimes work and sometimes doesnt
Irfan Kucuk
@Ikucuk
Jun 17 2016 09:17
Without looking at the code of the example, and it has to be a tribute page with an image and text, it also needs to have a link to a page with more information on the person or subject you choose to write the page about @GaneshCloud
kirbyedy
@kirbyedy
Jun 17 2016 09:18
@nive2907 you can fool it its secure with https://crossorigin.me
Eli
@elisspace
Jun 17 2016 09:18
@nive2907 I think it should--but for the sake of learning I was okay with just getting it to work. The only way around the issue was to find and pay for an API that used HTTPS as far as I could figure it. Not worth it for having the same exact code either way anyway
GaneshCloud
@GaneshCloud
Jun 17 2016 09:19
ok @Ikucuk
Paolo
@mav1283
Jun 17 2016 09:20
hey guys how do you use open weather icons on codepen? it says here to request it on open weather, https://gist.github.com/tbranyen/62d974681dea8ee0caa1 do you have to use 2 APIs? one for the icons?
kirbyedy
@kirbyedy
Jun 17 2016 09:21
no
Nivedita
@nive2907
Jun 17 2016 09:24
Does chrome block non https request to openweather? because the request work me at times but sometimes doesnt @elisspace
I will have a look at it @kirbyedy
Paolo
@mav1283
Jun 17 2016 09:24
so i don't have to req another api?
kirbyedy
@kirbyedy
Jun 17 2016 09:26
@nive2907 yes
@mav1283 no
Paolo
@mav1283
Jun 17 2016 09:29
@kirbyedy ok so how do i get to the json file of the icons, so i can call on them via javascript
Eli
@elisspace
Jun 17 2016 09:29

As far as I know it does @nive2907

And @mav1283 -- openweather has icons! http://openweathermap.org/img/w/04d.png is an example. The API will return the code (for example 04d) and then you can just hardlink it. Although I would never do that if I was writing something I thought would make more than 1 API call a year haha

Paolo
@mav1283
Jun 17 2016 09:31
@elisspace i just did that but it returns the code not the actual icon
kirbyedy
@kirbyedy
Jun 17 2016 09:32
wi wi-owm- +the code from api
Eli
@elisspace
Jun 17 2016 09:32
@mav1283 Then just write a bit of code that adds it to http://openweathermap.org/img/w/ and puts it in the page
Paolo
@mav1283
Jun 17 2016 09:36
Thanks @elisspace !
CamperBot
@camperbot
Jun 17 2016 09:36
mav1283 sends brownie points to @elisspace :sparkles: :thumbsup: :sparkles:
:cookie: 256 | @elisspace |http://www.freecodecamp.com/elisspace
ABHIII
@aviralsharma1997
Jun 17 2016 10:17
in the random quote machine challenge ,,what should i study to put in the new quote ,, somebody plzzz help
Somebody there iam stuck
Ankit Panwar
@coderNoob
Jun 17 2016 10:44
@aviralsharma1997 You can start by putting a collection of quotes in an array and then randomize the array to display a quote on screen.
SBeard
@etacalpha
Jun 17 2016 10:49
@aviralsharma1997 Google random quote API and you will get a list that you use
Leow Wei Xiang
@boyboi86
Jun 17 2016 10:56
@tuliodnw Hi thanks for viewing my work. Eh.. I don't think so.. I think it's empty.
CamperBot
@camperbot
Jun 17 2016 10:56
boyboi86 sends brownie points to @tuliodnw :sparkles: :thumbsup: :sparkles:
:cookie: 398 | @tuliodnw |http://www.freecodecamp.com/tuliodnw
RakeshNerkar
@Rakesh18754
Jun 17 2016 11:05
In Angular JS is their a way to maintain the value of a variable in the controller even if the partial gets changed?
Martialis39
@Martialis39
Jun 17 2016 11:22
Hey guys, can someone tell me
why this request isnt working?
greg
@wearenotgroot
Jun 17 2016 11:27
@Martialis39 maybe a crossorigin problem
@Martialis39 try adding "&callback=?" at the end of the api url
@Martialis39 also dont forget the "http://" on the url
Thabani Manzini
@ThabaniM
Jun 17 2016 11:50
hello, can anyone help me implement the $.on() and $.off() methods to prevent user clicking while computer is showing sequence. its not working the way i did it http://codepen.io/ThabaniM/pen/yOggQE?editors=1010
Greg Duncan
@GregatGit
Jun 17 2016 12:25
@ThabaniM why is there a switch to play sounds and a function to plays sounds?
Greg Duncan
@GregatGit
Jun 17 2016 12:36
@ThabaniM you have a function called userAnimate that is 50 lines long - you code is very complicated and very hard to follow. 'i' is generally used in for loops and when another coder looks at it they know exactly what it it. You have used as and index (i think) if it is a user index then call it userIndex or something meaningful so whoever is reading your code knows what it is.
@ThabaniM I recomend you turn your big functions into smaller manageable ones -
Greg Duncan
@GregatGit
Jun 17 2016 12:44

@ThabaniM To prevent the user from clicking you could set up var waitForComputer = true; and when someone clicks on a color

if (waitForComputer)
    return;

so when the the computer finishes play it can waitForComputer = false;

JD Tadlock
@jdtdesigns
Jun 17 2016 12:51
@ThabaniM or set the buttons to disabled and just enable them when the sequence is over
DumeD
@DumeD
Jun 17 2016 12:55
hi guys
i vahe done a project to excercise my bootstrap
but i have encountered an issue
i have a problem white the review section, i can’t set the background-color of .review
i wrote padding-bottom to see what would happen, the result is that the background is actually the padding
chekc the codepen to understand better
JD Tadlock
@jdtdesigns
Jun 17 2016 13:04
@DumeD give .review a .row class
.row is basically the class that clears floats
and floats are the reason bs sucks lol
DumeD
@DumeD
Jun 17 2016 13:09
@jdtdesigns it works! Thanks a lot
CamperBot
@camperbot
Jun 17 2016 13:09
dumed sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 500 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
DumeD
@DumeD
Jun 17 2016 13:09
@jdtdesigns but why it works?
what does .row do?
srishti-learner
@srishti-learner
Jun 17 2016 13:10
hi,all. can anyone explain this to me?
try { return window.self !== window.top; } catch (e) { return true;
NatixDev
@NatixDev
Jun 17 2016 13:16
Hi guys, I have to ask you a question, i'm really lost on how I need to make my workflow, there are so many things to know and how that can be realized, I know that Github is important and I need to improve myself with that tool, there is docker too that I don't understand so much for the moment, or nodejs, jekyll for multipages, I see express/angular which can do the same things as jekyll with much power, or meteor which is for front and back end, I don't know which one I must choose for working with another, if it is efficient for simple website or for more dynamic website with ecommerce etc... Yes I'm lost and I know I'm little bit hurried lol, it would be cool if I could find a tutorial or something like with all of it
jdoichy
@jdoichy
Jun 17 2016 13:17
how can i set the background color for a span to use it as a divider? background isnt working
Hamza Anwer
@ImHamzaAnwer
Jun 17 2016 13:22
@jdoichy give your <span> a class then style it through css
JD Tadlock
@jdtdesigns
Jun 17 2016 13:22
@DumeD like i said above, .row 'clears' floats. Floats are taken out of the document structure so their parent will collapse due to the floats not taking up the static height they would if they were block, inline-block. Because of this, you need to 'clear' the floats by setting the parent of the floats to clear: both or using other methods. Look up clearing floats to find out more. ;)
jdoichy
@jdoichy
Jun 17 2016 13:26
@ImHamzaAnwer I did it with an id and it isnt working :(
JD Tadlock
@jdtdesigns
Jun 17 2016 13:27
@jdoichy post your codepen
jdoichy
@jdoichy
Jun 17 2016 13:29
here it is dont make fun of me for my sloppy code i know its bad im learning: http://codepen.io/jdoichy/pen/QEEYyr
Dylan
@dhcodes
Jun 17 2016 13:29
@jdtdesigns since you got me on this flexbox bandwagon I'm pm'ing you a problem
deal?
JD Tadlock
@jdtdesigns
Jun 17 2016 13:30
@jdoichy use <hr> instead
@dhcodes ok ;)
jdoichy
@jdoichy
Jun 17 2016 13:30
alright I've never heard of that so ill take a look at it. does that just replace the h1 or the span?
JD Tadlock
@jdtdesigns
Jun 17 2016 13:31
@jdoichy it replaces the h1 with the span inside
jdoichy
@jdoichy
Jun 17 2016 13:33
@jdtdesigns so then would I put the special characters inside of something else and use css to place them on top of the hr?
Dylan
@dhcodes
Jun 17 2016 13:35
@jdtdesigns pm sent
Ale Gerosa
@alegerosa
Jun 17 2016 13:38
Hi all, some of you helped me yesterday with my tribute project, so I wanted to share the final -ish outcome. Feedback welcome and needed! http://codepen.io/alegerosa/pen/oLLegm
JD Tadlock
@jdtdesigns
Jun 17 2016 13:38
@jdoichy you can use an :after pseudo element to place the special characters
N1A2
@N1A2
Jun 17 2016 13:45
Help - How do I amend the code so that the slider pictures (top of webpage) go under the navigation bar - not over it...? http://codepen.io/N1A2/pen/LNMZNE
CamperBot
@camperbot
Jun 17 2016 13:45
no wiki entry for: - how do i amend the code so that the slider pictures top of webpage go under the navigation bar - not over it httpcodepenion1a2penlnmzne
Donovan
@dnvn999
Jun 17 2016 13:47
Hi guys, can i actually keep my progress streak in freecodecamp while i am working on my basic project in codepen?
Dylan
@dhcodes
Jun 17 2016 13:48
thanks @jdtdesigns
CamperBot
@camperbot
Jun 17 2016 13:48
dhcodes sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 501 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
Dylan
@dhcodes
Jun 17 2016 13:48
@dnvn999 you would need to keep doing challenges of some sort (video challenges at the end for example) or help out here in the chat room
@dnvn999 the streak is based on the brownie points you get for challenges or helping here when people say "thanks"
Donovan
@dnvn999
Jun 17 2016 13:49
@dhcodes I see, thanks. What do you meant by video challenges at the end for example?
CamperBot
@camperbot
Jun 17 2016 13:49
dnvn999 sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star2: 1054 | @dhcodes |http://www.freecodecamp.com/dhcodes
Dylan
@dhcodes
Jun 17 2016 13:50
@dnvn999 at the bottom of the map, there are some video challenges about chrome dev tools you can watch and get a point for each to keep your streak while you work on a project
they are short
Taras Yaremkiv
@Y-Taras
Jun 17 2016 13:51
Hello everyone. I've got stuck with calculator( :worried:
I want to do it in pure JS, and not to use a "eval" function.
here is my html, how could I get values from pressed buttons ? I Just don't know what to start with.
<div class="main">

    <header class="title">
        <p>FCC</p>
        <p>My Electronic Calculator</p>
    </header>
    <div class="screen">
    </div>
    <div class="buttons">
        <button id="ac">AC</button>
        <button id="ce">CE</button>
        <button id="remainder">%</button>
        <button id="divide">&divide;</button>

        <button id="7" value="7">7</button>
        <button id="8" value="8">8</button>
        <button id="9" value="9">9</button>
        <button id="mult">&times;</button>

        <button id="4" value="4">4</button>
        <button id="5" value="5">5</button>
        <button id="6" value="6">6</button>
        <button id="minus">-</button>

        <button id="1" value="1">1</button>
        <button id="2" value="2">2</button>
        <button id="3" value="3">3</button>
        <button id="plus">+</button>

        <button id="0" value="0">0</button>
        <button id="point">.</button>
        <button id="equal">=</button>
        <button id="changeSign">+/-</button>
    </div>
JD Tadlock
@jdtdesigns
Jun 17 2016 13:52
@Y-Taras document.getElementById('ac').innerHTML;
Dylan
@dhcodes
Jun 17 2016 13:52
@Y-Taras or document.getElementById('0').value();
Taras Yaremkiv
@Y-Taras
Jun 17 2016 13:53
@dhcodes @jdtdesigns I mean I want to catch a event when button is clicked
JD Tadlock
@jdtdesigns
Jun 17 2016 13:53
@dhcodes value is used for input on forms
Dylan
@dhcodes
Jun 17 2016 13:53
@jdtdesigns you can use it for buttons too though...
i'm pretty sure i did on my calc
Donovan
@dnvn999
Jun 17 2016 13:54
@dhcodes i see
Dylan
@dhcodes
Jun 17 2016 13:54
@Y-Taras write a loop for the number of button tags
and then button[i].addEventListener('click' function() { ... })
is one way
ex. buttonArray = document.getElementByTagName('button');
because getElementByTagName will return an array
JD Tadlock
@jdtdesigns
Jun 17 2016 13:56
var buttons = document.querySelectorAll('.buttons button');

for ( var i = 0; i < buttons.length; i++ {
  buttons[i].addEventListener('click', getUserInput);
}

var getUserInput = function() {
  // do something
}
@dnvn999
Taras Yaremkiv
@Y-Taras
Jun 17 2016 13:57
@dhcodes @jdtdesigns Is it compulsory to add type button to button tag in my case?
JD Tadlock
@jdtdesigns
Jun 17 2016 13:57
@dhcodes value may return the text, but value refers to the value attribute of an input element
it's best practice to use innerHTML for other elements
@dnvn999 Button is set to button type by default
Dylan
@dhcodes
Jun 17 2016 13:59
@Y-Taras not in this case
@jdtdesigns idk that it's necessarily wrong to use value. It's a given attribute of button https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
only about 10,000 of these posts explaining why 'not' to use value
Dylan
@dhcodes
Jun 17 2016 14:04
well fine
JD Tadlock
@jdtdesigns
Jun 17 2016 14:04
:D
Dylan
@dhcodes
Jun 17 2016 14:04
but it still works, and I thought innerHTML was frowned upon for security reasons
sometiems
JD Tadlock
@jdtdesigns
Jun 17 2016 14:05
?
security is based on user input
such as form data
Dylan
@dhcodes
Jun 17 2016 14:06
yeah
too much to know
JD Tadlock
@jdtdesigns
Jun 17 2016 14:06
i speak from experience with seasoned devs who have told me i'm dumb in the past
i don't just shoot from the hip so to speak ;)
Dylan
@dhcodes
Jun 17 2016 14:30
@jdtdesigns anybody who says you're dumb for using real code capabilities and not knowing better is a jerk
just saying
JD Tadlock
@jdtdesigns
Jun 17 2016 14:31
@dhcodes lol, my point is we don't know jack
so assume that i'm telling you not to use .value because you shouldn't ;)
and take the advice and use it wisely instead of standing up for your false belief
Dylan
@dhcodes
Jun 17 2016 14:34
@jdtdesigns oh I will.
Jonathan
@JonKaric
Jun 17 2016 15:03
hey guys i need to check if my analytics works on my site, i need at least one person to visit a second page (anything on portfolio) to check if it works
site is : JonKaric.co.uk
Holish
@Holish
Jun 17 2016 15:15
@JonKaric nice portfolio website
Jonathan
@JonKaric
Jun 17 2016 15:17
@Holish Thanks!
CamperBot
@camperbot
Jun 17 2016 15:17
jonkaric sends brownie points to @holish :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for holish
Holish
@Holish
Jun 17 2016 15:17
@JonKaric welcome
Paul Borawski
@iAmNawa
Jun 17 2016 15:18
@JonKaric nice site!
webdevlocalhost
@webdevlocalhost
Jun 17 2016 15:19
how can I get this working in the correct order? http://codepen.io/anon/pen/xOEKxv
Paul Borawski
@iAmNawa
Jun 17 2016 15:20
@webdevlocalhost why not just use plain css?
Holish
@Holish
Jun 17 2016 15:21
It's possible to do it with flexbox
webdevlocalhost
@webdevlocalhost
Jun 17 2016 15:21
i can't walk away from this just yet, I have to figure out how to get this one thing working
Jonathan
@JonKaric
Jun 17 2016 15:22
@iAmNawa Thanks! analytics is working great now, alot better than using google anylytics
CamperBot
@camperbot
Jun 17 2016 15:22
jonkaric sends brownie points to @iamnawa :sparkles: :thumbsup: :sparkles:
:cookie: 548 | @iamnawa |http://www.freecodecamp.com/iamnawa
Holish
@Holish
Jun 17 2016 15:22
@webdevlocalhost , try "Display:flex" for parent , then order: '1' for child
Paul Borawski
@iAmNawa
Jun 17 2016 15:22
@JonKaric different than google analytics?
Jonathan
@JonKaric
Jun 17 2016 15:24
@iAmNawa I'm using piwik analytics, alot cleaner than googles. free too!
Micah Bales
@micahbales
Jun 17 2016 15:40
Hi everyone! I feel really good about my Simon game, but there's just one bug that I have to sort out. Can you help? Here's the issue: Sometimes when the button flashes, it doesn't play a sound. This becomes a bigger problem the farther along the games goes (and, therefore, the faster the buttons are lighting up). Here's the code: http://codepen.io/micahbales/pen/MegRqm?editors=0010
Paul Borawski
@iAmNawa
Jun 17 2016 15:48
@JonKaric thanks for the info
CamperBot
@camperbot
Jun 17 2016 15:48
iamnawa sends brownie points to @jonkaric :sparkles: :thumbsup: :sparkles:
:cookie: 84 | @jonkaric |http://www.freecodecamp.com/jonkaric
Thabani Manzini
@ThabaniM
Jun 17 2016 15:49
@jdtdesigns @GregatGit sorry about that I got dc and fell asleep. Yes the code could have been better written. maybe its because I am tired of doing the same game.
Paul Borawski
@iAmNawa
Jun 17 2016 15:50
@micahbales It’s because that noise is too long of a noise, find a shorter beep and the problem should go away
Micah Bales
@micahbales
Jun 17 2016 15:51
@iAmNawa Hmmm. These are the sounds provided for the challenge.
Thabani Manzini
@ThabaniM
Jun 17 2016 15:52
@jdtdesigns my colors aren't exactly buttons they just plain divs, unless I can add "type = button" attribute to the div html , not sure if that would work
Paul Borawski
@iAmNawa
Jun 17 2016 15:53
@micahbales That’s funny because the example doesn’t use those sounds, I’ve seen people use the sounds that you did before and have the same problem though
Micah Bales
@micahbales
Jun 17 2016 15:54
@iAmNawa Hrmmm. Interesting. Is there any alternative besides making the delays longer (which doesn't seem ideal)?
Paul Borawski
@iAmNawa
Jun 17 2016 15:56
@micahbales I would find a beep someone else on the internet or make a noise in garageband or something and use it
somewhere*
Micah Bales
@micahbales
Jun 17 2016 15:59
@iAmNawa thanks for the advice. frustrating these provided sounds don't seem to work well with the project
CamperBot
@camperbot
Jun 17 2016 15:59
micahbales sends brownie points to @iamnawa :sparkles: :thumbsup: :sparkles:
:cookie: 549 | @iamnawa |http://www.freecodecamp.com/iamnawa
Perry
@perryodical
Jun 17 2016 16:45
function lookUpProfile(firstName, prop){
// Only change code below this line
var end = "No such contact";

  if (contacts.firstName===firstName && contacts.hasOwnProperty(prop)===true) {

    end = contacts[prop];

    }

    else if (contacts.hasOwnProperty(prop)===false) {
      answer = "No such property";
    }

  return end;
// Only change code above this line
}

// Change these values to test your function
lookUpProfile("Bob", "number");
on the profile lookup challenge any one have insight on where my code has gone wrong
Tyler Moeller
@TylerMoeller
Jun 17 2016 16:50
@perryodical contacts.firstName will return undefined. You will need to loop through the object and check contacts[0].firstName, contacts[1].firstName, etc.
Chethan Bhat
@chethanbhat
Jun 17 2016 16:57
Hi guys, for advanced algorithm challenges, should we build a robust solution or solution good enough to pass test cases?
I built a solution which satisfies test cases for us telephone validation. but its very fragile.
Tyler Moeller
@TylerMoeller
Jun 17 2016 16:59
@chethanbhat The algorithm challenges are not required for certification. Do them any way you would like, they are primarily meant to help you learn so you can complete the required projects for certification.
Chethan Bhat
@chethanbhat
Jun 17 2016 17:00
Thanks @TylerMoeller
CamperBot
@camperbot
Jun 17 2016 17:00
chethanbhat sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:cookie: 608 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
Chethan Bhat
@chethanbhat
Jun 17 2016 17:00
are there any good resources outside freecodecamp
mainly full stack development, more of back end i need
Tyler Moeller
@TylerMoeller
Jun 17 2016 17:01
@chethanbhat Correction, not all* of the algorithm challenges are required. Only the ones with an asterisk next to them. In the end, however, the solutions will be up on your profile and you may want to share the code with others, so make them proud :)
Chethan Bhat
@chethanbhat
Jun 17 2016 17:01
sure
Tyler Moeller
@TylerMoeller
Jun 17 2016 17:01
I go to NodeSchool to help with learning back-end. A really great community!
Chethan Bhat
@chethanbhat
Jun 17 2016 17:02
nice..
Tyler Moeller
@TylerMoeller
Jun 17 2016 17:02
You can check for any local chapters near you at http://nodeschool.io/chapters.html
Chethan Bhat
@chethanbhat
Jun 17 2016 17:02
hey wat abt front end frameworks, i do not know much abt frameworks
Tyler Moeller
@TylerMoeller
Jun 17 2016 17:03
You'll get to learn React and D3 after the front-end development work. Aside from that, it's primarily jQuery and Bootstrap here
Those are more libraries than frameworks though, to be honest.
Marc Vesper
@marcvesper
Jun 17 2016 17:15

Hi. newb with a question on understanding... jQuery and DOM tree... manipulation? (I think that's right). In a <div> in my <body> with class="test-div" and id="test-div2" why will the following (in document.ready) work:

$(".test-div").text("changed text");

but not when I try the same by ID like this:

$("#test-div2").text("changed text"); ?

Hope I wasn't too unclear.

Tyler Moeller
@TylerMoeller
Jun 17 2016 17:18
@marcvesper That should work fine. Make sure your ID is id="test-div2" and not id="#test-div2" in your HTML.
Marc Vesper
@marcvesper
Jun 17 2016 17:19
@TylerMoeller ...ok, thought I was missing something, thanks X)
CamperBot
@camperbot
Jun 17 2016 17:19
marcvesper sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:cookie: 609 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
JD Tadlock
@jdtdesigns
Jun 17 2016 17:27
@ThabaniM Here's a little code i created for you to give you an example of how to setup the click listener and fire the sequence ;) http://jsbin.com/nukuyiz/edit?js,output
Utkarsh Bhimte
@Utkarshbhimte
Jun 17 2016 17:40
http://codepen.io/utkarshbhimte/pen/ezzwrg
why isnt the colapsible not working, I am using Materializecss and I have plugged in jQuery but still I am getting : script.js:1 Uncaught ReferenceError: $ is not defined
Guys check it out
Coy Sanders
@coymeetsworld
Jun 17 2016 17:45
@Whiplash5057 I won the game but the msg says "Hard luck..better luck next time"
also don't see a way to reset game after
looks good though so far
lcassettai
@lcassettai
Jun 17 2016 17:46
@Whiplash5057 i like it! but, when draw, doesn't make anithing
yep and when you win say better luck next time XD
blob
y put en O in the top left and this happend hah
Richard Andrews
@Whiplash5057
Jun 17 2016 17:54
@coymeetsworld If you click on the win or lose message the game restarts :smile: and I'll fix the code ...a lot of errors... thanks @lcassettai
CamperBot
@camperbot
Jun 17 2016 17:54
whiplash5057 sends brownie points to @coymeetsworld and @lcassettai :sparkles: :thumbsup: :sparkles:
:star2: 1165 | @coymeetsworld |http://www.freecodecamp.com/coymeetsworld
:cookie: 331 | @lcassettai |http://www.freecodecamp.com/lcassettai
Srinivasan
@kksrini89
Jun 17 2016 17:57
hi guys anyone help me to position /align the span text for "Twitch Tv JSON Api" project
anyone?
Alecg956
@Alecg956
Jun 17 2016 18:02
Hi everyone, I am working on the weather app and I have created my interface, but how do i use the openweather API to pull the data?
Srinivasan
@kksrini89
Jun 17 2016 18:07
@Alecg956 you can have either city id or long,latitude attributes or city name, by using these you can pull the data back to your app

@Alecg956 you can do like

var url = "http://api.openweathermap.org/data/2.5/weather";
 $.getJSON(url+"?id="+ currentCityId + "&appid=" + apiKey,function(result) {
  //displaying results
});

You should register in open weather map site to use their api. then you will be get app key which to be send along with request.

Isaac Abrahamson
@IsaacAbrahamson
Jun 17 2016 18:20
trying to do weather project and api call gave me this:
XMLHttpRequest cannot load http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&APPID=fd99e0cd863cff15807add93a82c79a7. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://s.codepen.io' is therefore not allowed access.
how am I supposed to get the data?
srishti-learner
@srishti-learner
Jun 17 2016 18:23
@IsaacAbrahamson have you registered on the website?
Isaac Abrahamson
@IsaacAbrahamson
Jun 17 2016 18:24
@srishti-learner yes my api key is valid
i cant get the data if i copy and paste link in browser too so I know link works
Alecg956
@Alecg956
Jun 17 2016 18:24
@kksrini89 Using you code do I need to input my api key? I already signed up. Also, how can i verify that i have successfully imported the json object?
Srinivasan
@kksrini89
Jun 17 2016 18:24
@Alecg956 yes you need to input your api key
Isaac Abrahamson
@IsaacAbrahamson
Jun 17 2016 18:25

Here's my code

var apiKey = "&APPID=fd99e0cd863cff15807add93a82c79a7";
  var url = "http://api.openweathermap.org/data/2.5/weather";
  $.getJSON(url + '?lat=35&lon=139' + apiKey, function(json) {
    console.log(JSON.stringify(json));
  });

and I get the error i mentioned above.

Alecg956
@Alecg956
Jun 17 2016 18:28
@kksrini89 here is what I'm doing but the output doesn't work in the console saying $ is undefined:
var apikey = "ee30f4aeb498d665f128d265ba0dd58a";
var url = "http://api.openweathermap.org/data/2.5/weather";
$.getJSON(url+"?id="+ "Saint Louis" + "&appid=" + apiKey,function(result) {
console.log(JSON.stringify(json));
});
Srinivasan
@kksrini89
Jun 17 2016 18:28
@IsaacAbrahamson try with this
$.getJSON(url + '?lat=35&lon=139&appid=' + apiKey, function(json) {
    console.log(JSON.stringify(json));
  });
@Alecg956 import jquery library
@Alecg956 make sure whether you added it before
Isaac Abrahamson
@IsaacAbrahamson
Jun 17 2016 18:30
@kksrini89 I get the same error
Srinivasan
@kksrini89
Jun 17 2016 18:30
link pls?
Alecg956
@Alecg956
Jun 17 2016 18:31
@kksrini89 pen.js:91 Uncaught ReferenceError: J is not defined
pen.js:11 Uncaught ReferenceError: json is not defined
when imported and changed as u said
Isaac Abrahamson
@IsaacAbrahamson
Jun 17 2016 18:31
nvm it was an internet error.
reset and it works
Srinivasan
@kksrini89
Jun 17 2016 18:32
@IsaacAbrahamson OK FINE
Alecg956
@Alecg956
Jun 17 2016 18:33
any ideas?
Srinivasan
@kksrini89
Jun 17 2016 18:33
@Alecg956 try with this
$.getJSON(url+"?id="+ "Saint Louis" + "&appid=" + apiKey,function(result) {
console.log(JSON.stringify(result));
});
there is no variable called json from your function callback
seems you access which is not present
Alecg956
@Alecg956
Jun 17 2016 18:34
now im getting the error, undefined city
or city not found
available city with id
Isaac Abrahamson
@IsaacAbrahamson
Jun 17 2016 18:38
@Alecg956 the id is '5008414'
for St.Lois
try that
Alecg956
@Alecg956
Jun 17 2016 18:38
worked, thanks guys
now to parse the data, what would be the recomended steps?
i have my whole interface finished
Isaac Abrahamson
@IsaacAbrahamson
Jun 17 2016 18:39
@Alecg956 isn't there a fcc challenge for this?
Anthony Ho
@chiho13
Jun 17 2016 18:39
who's read "One does not simply code" on medium? Since I started coding, I always felt dumb
Iulian Crudu
@IulianCrudu
Jun 17 2016 18:39
Hi , can anybody help me please with the tribute page?
Alecg956
@Alecg956
Jun 17 2016 18:39
@IsaacAbrahamson Yea im working on the weather challenge, Im just not really that familiar with json objects
Isaac Abrahamson
@IsaacAbrahamson
Jun 17 2016 18:40
@kksrini89 how do you want the spans positions? do you mean centered evenly?
Srinivasan
@kksrini89
Jun 17 2016 18:41
yes
Isaac Abrahamson
@IsaacAbrahamson
Jun 17 2016 18:53
on the weather project how do I get the user's city id?
Chrissy Albert
@chrissyalbert
Jun 17 2016 18:53
This message was deleted
srishti-learner
@srishti-learner
Jun 17 2016 18:55
Chrissy Albert
@chrissyalbert
Jun 17 2016 18:57
Hi Everyone, I'm working on the Show the Local Weather project and I can't figure out how to change the img src url. According to http://openweathermap.org/weather-conditions there is a png url for every Open Weather API icon like this: http://openweathermap.org/img/w/01d.png So in my pen I've tried to use append to add an img element and make a variable for the src url. But it's not working. Any ideas? Here is the link to my pen. http://codepen.io/chrissyalbert/pen/qNaEOM?editors=0010
srishti-learner
@srishti-learner
Jun 17 2016 18:58

@IsaacAbrahamson the browser is blocking it as it usually allows a request in the same origin for security reasons. You need to do something different when you want to do a cross-domain request.
When you are using postman they are not restricted by this policy.

NOTE-Regular web pages can use the XMLHttpRequest object to send and receive data from remote servers, but they're limited by the same origin policy. Extensions aren't so limited. An extension can talk to remote servers outside of its origin, as long as it first requests cross-origin permissions.

Isaac Abrahamson
@IsaacAbrahamson
Jun 17 2016 19:01
@srishti-learner I got it show the weather for coordinates and the api to work, but I'm having problems getting the user's geo-location:
var lat = 0;
  var lon = 0;  
  //get geo-location
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
      lat = position.coords.latitude;
      lon =  position.coords.longitude;
    });
  }
srishti-learner
@srishti-learner
Jun 17 2016 19:05
the code looks fine to me..i don't know. share the link to the codepen
shivam kumar
@shivamgpt38
Jun 17 2016 19:06
plz help me with this fancy <hr > tag
Chris
@MrChristofferson
Jun 17 2016 19:07
@shivamgpt38 What help do you need with it?
srishti-learner
@srishti-learner
Jun 17 2016 19:07
@shivamgpt38 define a custom <hr> with desired color and height.
shivam kumar
@shivamgpt38
Jun 17 2016 19:07
the horizontal line/rule
But how
DJ
@qualitymanifest
Jun 17 2016 19:08
@chrissyalbert two things - remember to add .png onto the end of the IMG url variable. also, look at where you're adding it into the HTML '<img src="iconSrc" alt="Weather icon" height="200" width="200" />' you aren't concatenating iconSrc in correctly, it's just being treated like a string
srishti-learner
@srishti-learner
Jun 17 2016 19:10
@shivamgpt38 see i did it like this-
{
width: 80%;
height: 2px;
margin-left: auto;
margin-right: auto;
background-color: black;
color: white;
border: 0 none;
}
shivam kumar
@shivamgpt38
Jun 17 2016 19:11
ok thx @srishti-learner
CamperBot
@camperbot
Jun 17 2016 19:11
shivamgpt38 sends brownie points to @srishti-learner :sparkles: :thumbsup: :sparkles:
:cookie: 265 | @srishti-learner |http://www.freecodecamp.com/srishti-learner
Ermias GIOVANNI
@egg-develops
Jun 17 2016 19:11
Hello FCC Fam. Does anybody know how to turn a Codepen project into a thumbnail to use on my project page?
srishti-learner
@srishti-learner
Jun 17 2016 19:12
:+1:
shivam kumar
@shivamgpt38
Jun 17 2016 19:12
@srishti-learner look at mine how it is?
Chrissy Albert
@chrissyalbert
Jun 17 2016 19:13
@qualitymanifest Thank you for the help with this! I added the .png to the variable iconSrc, but I can't figure out how to concatenate it correctly. Any ideas?
CamperBot
@camperbot
Jun 17 2016 19:13
chrissyalbert sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:star2: 1205 | @qualitymanifest |http://www.freecodecamp.com/qualitymanifest
srishti-learner
@srishti-learner
Jun 17 2016 19:14
@shivamgpt38 i think,it isn't complete right now otherwise nice start.complete it first. :)
DJ
@qualitymanifest
Jun 17 2016 19:15
'<img src=' + datIconUrl + 'alt="blah blah"' etc
shivam kumar
@shivamgpt38
Jun 17 2016 19:16
yep @srishti-learner
DJ
@qualitymanifest
Jun 17 2016 19:16
basically, just do it in the same manner that you concatenated in data.weather[0].icon into the url var
Chrissy Albert
@chrissyalbert
Jun 17 2016 19:17
@qualitymanifest Thank you again!
CamperBot
@camperbot
Jun 17 2016 19:17
chrissyalbert sends brownie points to @qualitymanifest :sparkles: :thumbsup: :sparkles:
:warning: chrissyalbert already gave qualitymanifest points
DJ
@qualitymanifest
Jun 17 2016 19:17
no problem
could anyone suggest how to get the weather of the users location?
this is what ive got so far
Brett Guillory
@kurzninja
Jun 17 2016 19:59
question about scope: are two different javascript <script> tags on a page all part of the same global scope?
hey can someone help me getting my link to work on each "article"
i created 'a' element to have the link for each page...what i want to do is make each <p> element the respective link to the page
having trouble getting it to work
flindip
@flindip
Jun 17 2016 20:16
Hi, I'm working on the Random Quote Machine. Trying to get my button to link with the javascript: is this proper code?
 <button type="button" input type= "button" name= "randomQuote" onClick= "randomQuote();" class="btn btn-lg" id="btn1">New Quote</button>
or do I have to nest the JS button into an input div?
Chris
@MrChristofferson
Jun 17 2016 20:20
@flindip, no nesting needs to be done. You can just have a <button> element. But make sure there aren't any spaces in your attribute declarations..
onClick="randomQuote();" // correct
onClick= /*space*/ "randomQuote();" // incorrect
@kurzninja, In short, yes. That's why you're able to insert a script tag referencing jquery and in a script tag right below that one use the "$" variable without explicitly declaring it's value :grin:
flindip
@flindip
Jun 17 2016 20:24
@MrChristofferson gotcha. Then I'm just trying to figure out how to display it at this point in another div. Thanks
CamperBot
@camperbot
Jun 17 2016 20:24
flindip sends brownie points to @mrchristofferson :sparkles: :thumbsup: :sparkles:
:cookie: 77 | @mrchristofferson |http://www.freecodecamp.com/mrchristofferson
Chris
@MrChristofferson
Jun 17 2016 20:25
@flindip No prob. Check back if you need more help :)
flindip
@flindip
Jun 17 2016 20:26
@MrChristofferson I think I'm on the finishing touch. I just need to display it. Do you wanna take a look at it?
Chris
@MrChristofferson
Jun 17 2016 20:27
@kurzninja example:
<script src="some.jquery.cdn" type="text/javascript"></script> /* where "$" is declared */
<script>
$('.selector') /* would error "$ is not defined" if vars weren't globally scoped */
</script>
@flindip Fosho :grin:
Brett Guillory
@kurzninja
Jun 17 2016 20:31
@MrChristofferson ok, well then why don't my different React components see each other then? I separated some components into different .js files, and I have them all loading in my HTML
Chris
@MrChristofferson
Jun 17 2016 20:32
@kurzninja Can I see a code snippet? Remember order of script tags matters :grin:
Brett Guillory
@kurzninja
Jun 17 2016 20:32
yet my CommentBox component throws an error that CommentList is not defined, even though the script tag with commentList.js is above the one for commentBox
here's my HTML page
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>React Tutorial</title>
    <!-- Not present in the tutorial. Just for basic styling. -->
    <link rel="stylesheet" href="css/base.css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.16/browser.js"></script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/remarkable/1.6.2/remarkable.min.js"></script>

  <body>
    <div id="content"></div>


    <script type="text/babel" src="/scripts/comment.js"></script>
    <script type="text/babel" src="/scripts/commentList.js"></script>
    <script type="text/babel" src="/scripts/commentBox.js"></script>


  </body>
</html>
Chris
@MrChristofferson
Jun 17 2016 20:32
@flindip - looks good man. Be sure to take out the val parameter in your randomQuote() function since nothing is being passed or it won't work :)
Brett Guillory
@kurzninja
Jun 17 2016 20:33
you'll see I have my React script stuff in the head, and my component stuff near the bottom
flindip
@flindip
Jun 17 2016 20:33
@MrChristofferson Just leave it empty then?
Brett Guillory
@kurzninja
Jun 17 2016 20:33
when CommentBox tries to render(), it throws an error that CommentList is undefined
Manny
@Alloffices
Jun 17 2016 20:33
@tommygebru Hey check this 360 degree panorama page I made with just 18 lines of code: http://architect-tubs-64101.netlify.com/ git repo here: https://github.com/Alloffices/360-DP/blob/master/index.html
Chris
@MrChristofferson
Jun 17 2016 20:34
@kurzninja Are any of your components rendering?
Brett Guillory
@kurzninja
Jun 17 2016 20:34
no, CommentBox is the "outermost" component
Chris
@MrChristofferson
Jun 17 2016 20:34
@flindip - Yep :) Since the random value is being created inside of the function
Brett Guillory
@kurzninja
Jun 17 2016 20:35
and it's not rendering because CommentList is "not defined"
but they're all defined with "var", so they should all be in the global scope
someone told me that I had to use ES6 export/import, but I don't think I should have to do that
since the script files are manually declared in the HTML
Chris
@MrChristofferson
Jun 17 2016 20:36
@kurzninja Do you have your js file with the render method in it?
Brett Guillory
@kurzninja
Jun 17 2016 20:36
yes
flindip
@flindip
Jun 17 2016 20:36
@MrChristofferson what about, in my JS, the var value which randomizes 1-9?
Brett Guillory
@kurzninja
Jun 17 2016 20:36
I have a CommentBox, CommentList, and Comment
flindip
@flindip
Jun 17 2016 20:36
since that is a declared value
Brett Guillory
@kurzninja
Jun 17 2016 20:37
all should be good React components with render() that returns the JSX output
Chris
@MrChristofferson
Jun 17 2016 20:37
@kurzninja Could I see the parent code? Commentbox?
Brett Guillory
@kurzninja
Jun 17 2016 20:37
var $content = $('#content');
var $contentRaw = $content[0];

var CommentBox = React.createClass({
    render: function(){
      console.log('commentbox');
      return (
        <div className="commentBox">
            <h1>Comments</h1>
            <CommentList />                
        </div>
      );
    }     
 });

ReactDOM.render(
  <CommentBox />,
  $contentRaw
 );
Chris
@MrChristofferson
Jun 17 2016 20:38
@flindip, but there's no value being passed to the function. It just calls it and the function returns a random value
Brett Guillory
@kurzninja
Jun 17 2016 20:38
console.logs were for testing :P
Chris
@MrChristofferson
Jun 17 2016 20:39
@kurzninja Are you exporting your CommentList in it's code?
Brett Guillory
@kurzninja
Jun 17 2016 20:39
it's declared as a global variable
do you seriously have to manually export it using ES6 export?
Chris
@MrChristofferson
Jun 17 2016 20:40
Even though it's 'global' it still has to be exported to be seen by other js files.
Brett Guillory
@kurzninja
Jun 17 2016 20:40
that's goofy :/
Chris
@MrChristofferson
Jun 17 2016 20:40
All you do is module.exports = { CommentList } :grin:
Brett Guillory
@kurzninja
Jun 17 2016 20:41
if it's in the global scope when the script is loaded, why isn't it just attached to Window?
Chris
@MrChristofferson
Jun 17 2016 20:41
It makes a lot more sense when you start building monolithic apps
If it were attached to the window it would be
window.CommentList = React.createClass({})
But don't do that lol
that's bad
instead of
var CommentList
Does that make sense?
flindip
@flindip
Jun 17 2016 20:42
@MrChristofferson I took the val out of the randomQuote function. I got the the code to display but its not switching. Do you wanna see the code?
Chris
@MrChristofferson
Jun 17 2016 20:42
@flindip fosho
@kurzninja So even though your code is globally declared it still has to be exposed
Brett Guillory
@kurzninja
Jun 17 2016 20:43
doing "var CommentList" at the outtermost scope should be identical to "window.CommentList", right?
flindip
@flindip
Jun 17 2016 20:43
Chris
@MrChristofferson
Jun 17 2016 20:44
@kurzninja, Not necessarily. Once you've exported your module (or React class), you can just call out "<CommentList />" in your parent
Brett Guillory
@kurzninja
Jun 17 2016 20:45
"module is not defined"
max77p
@max77p
Jun 17 2016 20:45
can anyone help me figure out how to clear the values from a form search
and outpute the new values when user types in a new search item?
Chris
@MrChristofferson
Jun 17 2016 20:45
forrealz :| @kurzninja Is it on github?
Brett Guillory
@kurzninja
Jun 17 2016 20:46
do I need to include Common.js in my HTML also?
no, not on github, just locally
Chris
@MrChristofferson
Jun 17 2016 20:46
@kurzninja Yes on commonjs
Brett Guillory
@kurzninja
Jun 17 2016 20:46
blah
Chris
@MrChristofferson
Jun 17 2016 20:47
lol
webpack man!
:)
Webpack takes away all of this nonsense :grin:
@flindip I see your problem
can someone help me figure out how to clear the search results and show new search results when form is submitted again
Chris
@MrChristofferson
Jun 17 2016 20:49
@flindip Inside your randomQuote() function, change the innerHtml of #mirror with the value of "quote" instead of returning it
Brett Guillory
@kurzninja
Jun 17 2016 20:50
@MrChristofferson I'm just trying to learn React, not build a whole app
Chris
@MrChristofferson
Jun 17 2016 20:51
@kurzninja A different todo app without module craziness :grin: - https://www.youtube.com/watch?v=IR6smI_YJDE
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 20:52
NEED HELP
Chris
@MrChristofferson
Jun 17 2016 20:52
@max77p - You know how you got the value of the input field with .val()?
max77p
@max77p
Jun 17 2016 20:52
@MrChristofferson yes
Chris
@MrChristofferson
Jun 17 2016 20:53
@max77p - Now do the opposite with the same selector, tell it you want it to be blank ;)
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 20:54
Working on portfolio project- Want to make a static navbar..added class 'navbar-static-top'
But its not working..plz checkout the code & tell what am i missing?
Chris
@MrChristofferson
Jun 17 2016 20:54
@max77p - perhaps something like...
input.val = ''
@ the end of your function
@kaushikpraveen The link is wrong :grin:
jv
@jv88899
Jun 17 2016 20:56

Hi all. I'm working on the Pomodoro-clock, so I've been looking at ways to print out time. I understand the math part of it, but I keep seeing syntax that looks like this:

h > 0 ?

can someone explain what that is? or what that means? I'm assuming its shorthand for an if/then statement or something?

Brett Guillory
@kurzninja
Jun 17 2016 20:56
screw it, i'm just gonna put all my components in a single script file for now
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 20:56
oops I'm missing a 'c' in codepen..silly me
Chris
@MrChristofferson
Jun 17 2016 20:56
@kurzninja That's the spirit :grin:
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 20:56
max77p
@max77p
Jun 17 2016 20:57
@MrChristofferson i get that blanks the value...but the problem is, after the first search there are items on the page that won't disappear and show new results when i search again
Brett Guillory
@kurzninja
Jun 17 2016 20:57
I'll figure the rest of that crap out later
max77p
@max77p
Jun 17 2016 20:57
i.e if i type in madrid i get 10 rresults...then when i type in paris, the new 10 results are just tagged to bottom of madrid results
Brett Guillory
@kurzninja
Jun 17 2016 20:57
@jv88899 that's the tertiary operator, basically a one line if/else
h > 0 is your condition
? signals you have two choices coming up
if h > 0 is true, it uses the first choice, otherwise it uses the second
so
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 20:58
@MrChristofferson posted the correct link :smile:
Brett Guillory
@kurzninja
Jun 17 2016 20:59
h > 0 ? console.log("prints true") : console.log("prints false");
Chris
@MrChristofferson
Jun 17 2016 20:59
@max77p - Ohhh my bad :) It's because you're using the .append method. You'll have to .remove() the current children elements before appending the new ones
max77p
@max77p
Jun 17 2016 20:59
@MrChristofferson ahh nvm i figured it out lol....just emptying the div on start of myfunction works. thanks
CamperBot
@camperbot
Jun 17 2016 20:59
max77p sends brownie points to @mrchristofferson :sparkles: :thumbsup: :sparkles:
:cookie: 78 | @mrchristofferson |http://www.freecodecamp.com/mrchristofferson
jv
@jv88899
Jun 17 2016 20:59
@kurzninja awesome, thank you!
CamperBot
@camperbot
Jun 17 2016 20:59
jv88899 sends brownie points to @kurzninja :sparkles: :thumbsup: :sparkles:
:cookie: 447 | @kurzninja |http://www.freecodecamp.com/kurzninja
max77p
@max77p
Jun 17 2016 20:59
@MrChristofferson what other method could i have used?
Jonathan
@JonKaric
Jun 17 2016 21:01
@kaushikpraveen wrong class. use .navbar-fixed-top instead
Chris
@MrChristofferson
Jun 17 2016 21:01
@max77p - Using loops to iterate over data from ajax with templates is usually the way to do it. Sound familiar?
flindip
@flindip
Jun 17 2016 21:02
@MrChristofferson so you mean with:
document.getElementById("mirror").innerHTML=randomQuote();
You want me to remove "mirror" and replace it with "quote"? Will it display?
@MrChristofferson thanks
CamperBot
@camperbot
Jun 17 2016 21:02
flindip sends brownie points to @mrchristofferson :sparkles: :thumbsup: :sparkles:
:warning: flindip already gave mrchristofferson points
Chris
@MrChristofferson
Jun 17 2016 21:02
@flindip - Close. You know how you're returning the "quote" variable at the bottom of your function?
max77p
@max77p
Jun 17 2016 21:03
@MrChristofferson ahh yes yes that makes sense
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 21:03
@JonKaric oh yes that is working f9.. Ty very much :smile:
Can you plz also sort out the other thing
CamperBot
@camperbot
Jun 17 2016 21:03
kaushikpraveen sends brownie points to @jonkaric :sparkles: :thumbsup: :sparkles:
:cookie: 86 | @jonkaric |http://www.freecodecamp.com/jonkaric
Jonathan
@JonKaric
Jun 17 2016 21:03
@kaushikpraveen whats the other thing?
Chris
@MrChristofferson
Jun 17 2016 21:04
@flindip -
// this instead of return quote;
document.getElementById("mirror").innerHTML = quote;
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 21:05
@JonKaric Under the 'About Me ' section, mis-alignment taking place when i try to add col-xs-6 along the image element, the grid sys is messed up there
Jonathan
@JonKaric
Jun 17 2016 21:08
@kaushikpraveen is the image meant to be under the about me section?
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 21:09
@JonKaric yes,i want to add it there
and thinking of adding some text & buttons on the other column
Jonathan
@JonKaric
Jun 17 2016 21:11
@kaushikpraveen http://codepen.io/JonKaric/pen/mErJGB - this should be your code
line 22-30
Kenzo Mendoza
@KenzoM
Jun 17 2016 21:13
hello all, I just started on working tic tac toe
I need help getting started though. I know it's best to use object orienated in this project but I'm not sure where to start from there
OO is still new to me..
Praveen Kaushik
@kaushikpraveen
Jun 17 2016 21:17
@JonKaric okay..now i understand wat i was doing wrong
Thanks again :smile:
CamperBot
@camperbot
Jun 17 2016 21:17
kaushikpraveen sends brownie points to @jonkaric :sparkles: :thumbsup: :sparkles:
:warning: kaushikpraveen already gave jonkaric points
JD Tadlock
@jdtdesigns
Jun 17 2016 21:22
@Neotriz You want to focus on functional programming. Break every process up into functions.
i tend to combine the two in js because js is great for functional programming
JD Tadlock
@jdtdesigns
Jun 17 2016 21:35
/**
* Create a class with IIFE function. 
* This keeps it from being globally scoped
*
**/
var SomeClass = (function() {
  var init = function() {  
    // Initialize some action, event
  };

  var someOtherMethod = function()  {
    // Another private method/function to do something
  };

  // Here I set init to public
  return {
    init: init
  };
});

var app = new SomeClass();

app.init(); // Start the app
Chris
@MrChristofferson
Jun 17 2016 21:38
^^^ Great example of js class layout @jdtdesigns
JD Tadlock
@jdtdesigns
Jun 17 2016 21:39
@MrChristofferson thanks :)
CamperBot
@camperbot
Jun 17 2016 21:39
jdtdesigns sends brownie points to @mrchristofferson :sparkles: :thumbsup: :sparkles:
:cookie: 79 | @mrchristofferson |http://www.freecodecamp.com/mrchristofferson
flindip
@flindip
Jun 17 2016 21:42
@MrChristofferson ahh thank you
CamperBot
@camperbot
Jun 17 2016 21:42
flindip sends brownie points to @mrchristofferson :sparkles: :thumbsup: :sparkles:
:cookie: 80 | @mrchristofferson |http://www.freecodecamp.com/mrchristofferson
Chris
@MrChristofferson
Jun 17 2016 21:44
@flindip - It's working now??
flindip
@flindip
Jun 17 2016 21:47
@MrChristofferson I'm implementing something wrong. You mean the return quote which is in the function correct?
@MrChristofferson
function randomQuote(){
var random=function(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
    };  
    var val=random(1,9);
switch(val){

    case 1 :
    return "Denial ain't just a river in Egypt!";

    case 2:
    return "Whining is anger coming through a very small opening.";
    break;

    case 3:
    return "You're only as sick as your secrets.";
    break;

    case 4:
    return "I am a human being, not a human doing.";
    break;

    case 5:
    return "I'm a skeleton because its scary and because it reminds me that I am a human being. And that's okay. That's what I am. And beside, I think it makes me look thinner (a Halloween thought).";
    break;

    case 6:
    return "I learned what love is from my parents. Which is that you find that one-special person who was placed on the planet just for you, and then you put them through forty years of living hell.";
    break;

    case 7:
    return "Trace it, face it, and erase it.";
    break;

    case 8:
    return "I've decided to take a risk, and wear a new sweater. It was sent to me by a recovering sex addict, Melissa D., who knitted it herself; she said it gave her something to do with her hands. ";

    break;

    case 9:
        return "It’s easier to put on slippers than to carpet the whole world.";
        break;


    }    
document.getElementById("mirror").innerHTML=quote;
};
randomQuote();
document.getElementById("mirror").innerHTML=randomQuote();
JD Tadlock
@jdtdesigns
Jun 17 2016 21:50
@flindip You could just create an array with the quotes in it. Then use a random number to get one of the quotes. ;)
or use an api
flindip
@flindip
Jun 17 2016 21:51
@jdtdesigns I don't think its necessary. It displays I'm just trying to get the actual button to work
Chris
@MrChristofferson
Jun 17 2016 21:52
@flindip - There's no quote variable to return anymore :grin: replace "quote" at the end of your function with "val"
document.getElementById("mirror").innerHTML=val;
flindip
@flindip
Jun 17 2016 21:55
@MrChristofferson yeah, the button is still not responding. This is what I put in:
document.getElementById("mirror").innerHTML=val;
};
randomQuote();
document.getElementById("mirror").innerHTML=randomQuote();
Chris
@MrChristofferson
Jun 17 2016 21:56
can you relink your codepen for me?
Marc Vesper
@marcvesper
Jun 17 2016 21:56
Hi, new here. For the Local Weather challenge, I get console output of "ERROR(1): Only secure origins are allowed" when calling navigation.geolocation in Chrome. Is there a way around this?
flindip
@flindip
Jun 17 2016 21:57

@MrChristofferson sure thing:

http://codepen.io/flindip/pen/mEEjXa

Aksharif
@abusharif
Jun 17 2016 21:57
need help with "Counting Cards"

var count = 0;

function cc(card) {
// Only change code below this line

switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:
card = "5 Bet";
break;

case 7:
case 8:
case 9:
  card="0 Hold";
  break;

case  10:
case "J":
case "Q":
case "K":
case "A":
  card = "-5 Hold";
  break;

}

return card;
// Only change code above this line
}

Chris
@MrChristofferson
Jun 17 2016 21:57
@marcvesper make sure your ajax call has "https://" in the url :grin:
Aksharif
@abusharif
Jun 17 2016 21:58

var count = 0;

function cc(card) {
// Only change code below this line

switch (card){

case 2:
case 3:
case 4:
case 5:
case 6:
  card = "5 Bet";
  break;

case 7:
case 8:
case 9:
  card="0 Hold";
  break;

case  10:
case "J":
case "Q":
case "K":
case "A":
  card = "-5 Hold";
  break;

}

return card;

JD Tadlock
@jdtdesigns
Jun 17 2016 21:59
@marcvesper Chrome has deprecated geolocation on http. You can use a logic statement that checks for chrome and loads the location from a location api like http://ip-api.com/, and use the navigator for other browsers.
if ( window.chrome ) {
  // Use the ip locator
} else {
  // use navigator
}
Marc Vesper
@marcvesper
Jun 17 2016 22:01
Ah, ok, thanks @jdtdesigns @MrChristofferson
CamperBot
@camperbot
Jun 17 2016 22:01
marcvesper sends brownie points to @jdtdesigns and @mrchristofferson :sparkles: :thumbsup: :sparkles:
:cookie: 502 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
:cookie: 81 | @mrchristofferson |http://www.freecodecamp.com/mrchristofferson
JD Tadlock
@jdtdesigns
Jun 17 2016 22:01
welcome ;)
Aksharif
@abusharif
Jun 17 2016 22:01
anyone?plz
JD Tadlock
@jdtdesigns
Jun 17 2016 22:02
@abusharif Umm, what is your question?
Aksharif
@abusharif
Jun 17 2016 22:02
@jdtdesigns need help with "Counting Cards"?

@jdtdesigns
var count = 0;

function cc(card) {
// Only change code below this line

switch (card){

case 2:
case 3:
case 4:
case 5:
case 6:
  card = "5 Bet";
  break;

case 7:
case 8:
case 9:
  card="0 Hold";
  break;

case  10:
case "J":
case "Q":
case "K":
case "A":
  card = "-5 Hold";
  break;

}

@jdtdesigns I think im missing something
Chris
@MrChristofferson
Jun 17 2016 22:03
@flindip - Change replace all of your return statements with val=
flindip
@flindip
Jun 17 2016 22:04
@MrChristofferson gotcha
JD Tadlock
@jdtdesigns
Jun 17 2016 22:04
@abusharif You're supposed to be raising or lowering a 'count' variable based on the card I believe
then set the string value of card after the switch runs
flindip
@flindip
Jun 17 2016 22:06
@MrChristofferson Success! Thank you
CamperBot
@camperbot
Jun 17 2016 22:06
flindip sends brownie points to @mrchristofferson :sparkles: :thumbsup: :sparkles:
:warning: flindip already gave mrchristofferson points
Chris
@MrChristofferson
Jun 17 2016 22:07
@flindip :grin: :+1:
Aksharif
@abusharif
Jun 17 2016 22:08
@jdtdesigns how do i do that?
mobiuschang
@mobiuschang
Jun 17 2016 22:11
Can somebody help me with the weather app? I am having trouble with the Open Weather API. when I call the api, codepen is attaching something to the front of the url. I don't know why it is doing that.
jdoichy
@jdoichy
Jun 17 2016 22:11
im having trouble getting my hr element to not go all the way to the edge of my div element
JD Tadlock
@jdtdesigns
Jun 17 2016 22:12
@abusharif You need to use your switch to determine the type of card. If the value is less than 7, subtract 1 from count(count--). If the value is 7, 8 or 9, don't add or subtract from count. If 10, J, Q, K or A, you need to add one to count(count++);
then below the switch, you check what count is equal to in an if/else and output the correct string based on count value
Chris
@MrChristofferson
Jun 17 2016 22:13
@mobiuschang - add "https://" to the beginning of your url :)
Codepen is trying to extend itself with an incomplete url
Coy Sanders
@coymeetsworld
Jun 17 2016 22:14
needs to be http @MrChristofferson @mobiuschang, free account with openweather doesn't give you secure connection
also if you're using Chrome navigator.geolocation won't work on non-secure connections
so you can't use both at the same time, for Chrome
Aksharif
@abusharif
Jun 17 2016 22:14
@jdtdesigns thanx man. let me try it.
CamperBot
@camperbot
Jun 17 2016 22:14
abusharif sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 503 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
jdoichy
@jdoichy
Jun 17 2016 22:14
'
JD Tadlock
@jdtdesigns
Jun 17 2016 22:15
@mobiuschang You can't use https with codepen for openweather unless you pay for openweather premium. You'll need to do what i posted above.
jdoichy
@jdoichy
Jun 17 2016 22:15
I can't get my hr element to stop and not touch the edge of my div center-block element and i cannot find a solution anywhere
JD Tadlock
@jdtdesigns
Jun 17 2016 22:16
@jdoichy It's most likely you have padding on the container which is pushing the width inward. ;)
You can try 100vw for the width
jdoichy
@jdoichy
Jun 17 2016 22:17
what is vw? i see it used everywhere but never explained
mobiuschang
@mobiuschang
Jun 17 2016 22:17
Thanks. I tried adding http:// to the front but it is giving me a different error.
jquery.min.js:4 XMLHttpRequest cannot load http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&APPID=39daf205ed933345fe041b3dc30e846d. Failed to start loading.
But when I click on that link, it does give me the correct json
JD Tadlock
@jdtdesigns
Jun 17 2016 22:18
@mobiuschang Like i said, you can't use https//
mobiuschang
@mobiuschang
Jun 17 2016 22:18
I didn't. I use http