These are chat archives for FreeCodeCamp/HelpFrontEnd

14th
Apr 2016
Greg Duncan
@GregatGit
Apr 14 2016 00:01 UTC
@choppd your url api does work - simply cut and paste it into the address bar of the browser - your code around it is not working -but it shouldn't take too much to get it going
@Dueldrawer8 It made me want to quit
@Dueldrawer8 as you can see "germany" is the only thing you need to change but I imagine you could play around with some of the other fields - if someone else has this problem - just give them this url - you'll save them lots of tears
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 00:04 UTC
@GregatGit in your search, even though you searched for germany it looks for "1968 germany" and its of index 10.. meaning it would be the last search
like if you were to type in tom hanks in your search query it would turn up "cast away" even though your really wanting to look up the character tom hanks
Greg Duncan
@GregatGit
Apr 14 2016 00:06 UTC
@Dueldrawer8 I have to go - but see how it orders them http://codepen.io/gregoverhere/pen/NxdgPJ
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 00:06 UTC
@GregatGit ok thanks
CamperBot
@camperbot
Apr 14 2016 00:06 UTC
dueldrawer8 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:star: 412 | @gregatgit | http://www.freecodecamp.com/gregatgit
Ali Amirazizi
@alivera
Apr 14 2016 00:07 UTC
@tenkdayz hey, can you help map proper links to the twitch users?
Frank XC
@tenkdayz
Apr 14 2016 00:09 UTC
@alivera .. let's see the code
Daniel Gonzales
@choppd
Apr 14 2016 00:11 UTC
@GregatGit Thanks I'll mess around with my code some more
CamperBot
@camperbot
Apr 14 2016 00:11 UTC
choppd sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:star: 413 | @gregatgit | http://www.freecodecamp.com/gregatgit
Frank XC
@tenkdayz
Apr 14 2016 00:12 UTC
@alivera href or a tag is at json.url
Ali Amirazizi
@alivera
Apr 14 2016 00:14 UTC
@tenkdayz what does that mean
Frank XC
@tenkdayz
Apr 14 2016 00:15 UTC
@alivera my mistake.. I'm trying to figure out what's going on... it's a bit differnt from mine.
ok I see.
twitchUrl < replace this with json.url when you assign it to the a tag
Juwdohr
@Juwdohr
Apr 14 2016 00:24 UTC
Working on a V2.0 of the Portfolio. Drop down menu not working. Any help?
http://codepen.io/Jarvis-327/pen/vGdMRW?editors=1100
Frank XC
@tenkdayz
Apr 14 2016 00:26 UTC
@Juwdohr where does the drop down need to go?
Juwdohr
@Juwdohr
Apr 14 2016 00:27 UTC
@tenkdayz So when the screen is small it shows the menu as a dropdown
Ali Amirazizi
@alivera
Apr 14 2016 00:27 UTC
@tenkdayz still not resolved. did you solve it?
Frank XC
@tenkdayz
Apr 14 2016 00:28 UTC
@Juwdohr I thought bootstrap had something like that built in..
Juwdohr
@Juwdohr
Apr 14 2016 00:28 UTC
@tenkdayz I did too. But it
Frank XC
@tenkdayz
Apr 14 2016 00:30 UTC
@alivera the twitchUrl var declaration.. delete it. and when you assign the href for the a tag use json.url instead. I did that on your code and it worked.
Jackson Bates
@JacksonBates
Apr 14 2016 00:30 UTC
@Juwdohr you need to load jquery into the js console (use the gear and 'quick add')
Frank XC
@tenkdayz
Apr 14 2016 00:31 UTC
@Juwdohr I guess jusst create a ul and make it display none .. then display block when you click on the drop down menu thing
Jackson Bates
@JacksonBates
Apr 14 2016 00:31 UTC
@Juwdohr then add bootstrap JS under that
Juwdohr
@Juwdohr
Apr 14 2016 00:31 UTC
@JacksonBates even though I'm not using the javascript?
Jackson Bates
@JacksonBates
Apr 14 2016 00:31 UTC
@Juwdohr yep, it's a dependency for the dropdown
@Juwdohr make sure jquery is above bootstrap in the quick add section. Jquery has to load first
Juwdohr
@Juwdohr
Apr 14 2016 00:33 UTC
@JacksonBates thanks. had to add jquery and bootstrap to the JS side.
CamperBot
@camperbot
Apr 14 2016 00:33 UTC
juwdohr sends brownie points to @jacksonbates :sparkles: :thumbsup: :sparkles:
:star: 303 | @jacksonbates | http://www.freecodecamp.com/jacksonbates
Ali Amirazizi
@alivera
Apr 14 2016 00:35 UTC
@tenkdayz awesome! works! thank you again!
CamperBot
@camperbot
Apr 14 2016 00:35 UTC
alivera sends brownie points to @tenkdayz :sparkles: :thumbsup: :sparkles:
:warning: alivera already gave tenkdayz points
Dustin
@dustininkster
Apr 14 2016 00:38 UTC
```function factorialize(num) {
for (var factor = num-1;factor > 0;factor--){
num *= factor;
}
return num;
}
So on the factorial challenge, the test says that factorialize(0) should return 1. I could check for zero and return 1, but that doesn't seem very elegant. Am I missing something? or is that what is expected?
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 00:43 UTC
dang it.. why isnt my api search working?
Clark Arnold
@clarkarnold
Apr 14 2016 00:43 UTC
@paffson Hey thanks for trying to help out earlier, I was trying to figure out a better way to do that loop but got frustrated and wrote something that did the trick.. any suggestions?
CamperBot
@camperbot
Apr 14 2016 00:43 UTC
clarkarnold sends brownie points to @paffson :sparkles: :thumbsup: :sparkles:
:star: 349 | @paffson | http://www.freecodecamp.com/paffson
Juwdohr
@Juwdohr
Apr 14 2016 00:47 UTC
@JacksonBates Hey do you know how to make the menu auto collapse?
Greg Duncan
@GregatGit
Apr 14 2016 00:54 UTC
@Dueldrawer8 None of the html is loading at the start
lcthornhill
@lsrus
Apr 14 2016 00:56 UTC
@Dueldrawer8 it looks like the data object holds the search results in data.query.pages rather than data.query.search. If you use dev tools on your browser you will see an error stating that data.query.search is undefined
@GregatGit it's actually that codepen is loading the console stretched over the page display, which I've never seen before. Confused the hell out of me
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 00:58 UTC
@lsrus even when i console.log(data) though..it should give me the objects of all the data values which it doesnt
i had it right a literally 15 min and decided to change my query search and all of a sudden i cant get ANY data
Greg Duncan
@GregatGit
Apr 14 2016 00:58 UTC
@Dueldrawer8 You can make your searching a little simpler in stead of the ajax
$.getJSON(myUrl, function(json) {
    yourFunction(json);
  });
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:00 UTC
im soo mad right now
Stephen James
@sjames1958gm
Apr 14 2016 01:00 UTC
@Dueldrawer8 If you are seeing the word Object in your log - try using JSON.stringify to convert the data.
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:00 UTC
i had it working not to long ago.. and somehow it saved over my prevouis working codepen which took me forever to do with a lot of help
lcthornhill
@lsrus
Apr 14 2016 01:00 UTC
@Dueldrawer8 you definitely are getting a json response, I can see it in my console when I make a search
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:01 UTC
Object {
  batchcomplete: "",
  continue: Object {
    continue: "gsroffset||",
    gsroffset: 10
  },
  query: Object {
    pages: Object {}
  }
thats what it looks like though...
it should have much more info than that
Stephen James
@sjames1958gm
Apr 14 2016 01:01 UTC
@Dueldrawer8 See Object there - wrap data in JSON.stringify(data) and you will see what you are looking for
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:02 UTC
@sjames1958gm sweet ill take a look
paffson
@paffson
Apr 14 2016 01:02 UTC
@clarkarnold yeah, i mean, any code that enumerates from say 1 to 9 could and should be written as a for loop
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:03 UTC
whew scared the crap out of me
thanks @sjames1958gm @lsrus
CamperBot
@camperbot
Apr 14 2016 01:03 UTC
dueldrawer8 sends brownie points to @sjames1958gm and @lsrus :sparkles: :thumbsup: :sparkles:
:star: 367 | @lsrus | http://www.freecodecamp.com/lsrus
:star: 627 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
lcthornhill
@lsrus
Apr 14 2016 01:04 UTC
@Dueldrawer8 :+1:
Clark Arnold
@clarkarnold
Apr 14 2016 01:04 UTC
@paffson
'''
function checkWin() {
for (var i=0; i<9; i++) {
if (board[i] == board[i+1] && board[i+1] == board[i+2]) {
alert("So and So wins");
}
}
}
```
CamperBot
@camperbot
Apr 14 2016 01:04 UTC
:bulb: to format code use backticks! ``` more info
Clark Arnold
@clarkarnold
Apr 14 2016 01:04 UTC
function checkWin() {
  for (var i=0; i<9; i++) {
          if (board[i] == board[i+1] && board[i+1] == board[i+2]) {
            alert("So and So wins");
       }
  }
}
Something like that?
With if else for the rest?
paffson
@paffson
Apr 14 2016 01:06 UTC
@clarkarnold yes, something like that, i can't tell you exactly if this is the right loop but that's definitely the way to go
Clark Arnold
@clarkarnold
Apr 14 2016 01:06 UTC
@paffson cool thank you, any tips for figuring out the AI? that Minimax is pretty confusing
CamperBot
@camperbot
Apr 14 2016 01:06 UTC
clarkarnold sends brownie points to @paffson :sparkles: :thumbsup: :sparkles:
:warning: clarkarnold already gave paffson points
paffson
@paffson
Apr 14 2016 01:07 UTC
oh this one is not really easy, change your code in other places to eliminate repetitions
first
get comfortable with loops
then recognize patterns on the board like three in line, two in line, then you need two learn about recursion to search the game tree and find the best move, but take your time
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:11 UTC
how do i get the extract data out of the json now?
console.log(data.query[3].extract)?
{'batchcomplete':'','continue':{'gsroffset':10,'continue':'gsroffset||'},'query':{'pages':{'154698':{'pageid':154698,'ns':0,'title':'Will Smith','index':1,'extract':
seems to be inside query and the third object pageid
Candice
@smrtsmrf
Apr 14 2016 01:14 UTC
yet another regex question… I want to replace any words that start with a. I’ve tried /(^a[a-z]+)/g, but it only gets the first one. suggestions?
Stephen James
@sjames1958gm
Apr 14 2016 01:14 UTC
@Dueldrawer8 So data.query.pages is an object with 10 values
@smrtsmrf You have told it only start of line with ^ use \s+ to indicate a space between words
Greg Duncan
@GregatGit
Apr 14 2016 01:15 UTC
@Dueldrawer8 var myKeys = Object.keys(obj.query.pages);
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:15 UTC
@sjames1958gm im getting
{'batchcomplete':'','continue':{'gsroffset':10,'continue':'gsroffset||'},'query':{'pages':{'154698':{'pageid':154698,'ns':0,'title':'Will Smith','index':1,'extract':
ops
Candice
@smrtsmrf
Apr 14 2016 01:15 UTC
@sjames1958gm ah, ok. well let’s say the string will contain lots of numbers and other junk, so I’m looking for any set of letters that starts with an a
no spaces
Greg Duncan
@GregatGit
Apr 14 2016 01:16 UTC
that will give you however many pages there happen to be
Stephen James
@sjames1958gm
Apr 14 2016 01:17 UTC
@Dueldrawer8 What @GregatGit said up there you can get and array of keys with var keys = Object.keys(data.query.pages). data.query.pages[keys[0]].extract is the first one
@smrtsmrf So you want /[^a-z]+(a[a-z]+)/g -- means match on one or more not a-z followed by a followed by one-or more [a-z]
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:20 UTC
hm interesting thanks @GregatGit @sjames1958gm
CamperBot
@camperbot
Apr 14 2016 01:20 UTC
dueldrawer8 sends brownie points to @gregatgit and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: dueldrawer8 already gave sjames1958gm points
:star: 414 | @gregatgit | http://www.freecodecamp.com/gregatgit
Stephen James
@sjames1958gm
Apr 14 2016 01:20 UTC
@Dueldrawer8 Sure - it would be easier if the pages were stored as an array, but using Object.keys gives you a way to access the data as an array
Greg Duncan
@GregatGit
Apr 14 2016 01:21 UTC
@Dueldrawer8 put the api url into the browser to see what output you are getting - then copy and paste it at https://repl.it/. Then turn it into an obj and play around with it to see if you can access the differect properties
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:21 UTC
yes.. my data before hand was stored as an array.. but since the change .. lol
@GregatGit sure ill try it
Stephen James
@sjames1958gm
Apr 14 2016 01:22 UTC
@GregatGit :+1:
@smrtsmrf Hmm thinking on this it may have issues
Candice
@smrtsmrf
Apr 14 2016 01:23 UTC
@sjames1958gm ok, getting closer. but yeah, not quite working.
@sjames1958gm working with this test string: acos(30)asin(30)tan(30)
it matches acos, (30) but just the first one, asin, and an (not tan)
Stephen James
@sjames1958gm
Apr 14 2016 01:24 UTC
@smrtsmrf The first + should be * so that it can match no characters (beginning of string)
Candice
@smrtsmrf
Apr 14 2016 01:24 UTC
@sjames1958gm yeah, I caught that. I was just about to mention that I changed that
Stephen James
@sjames1958gm
Apr 14 2016 01:25 UTC
@smrtsmrf It matches acos? that surprises me
Candice
@smrtsmrf
Apr 14 2016 01:25 UTC
I don’t know why it’s grabbing one of the (30)’s and why the an
Stephen James
@sjames1958gm
Apr 14 2016 01:26 UTC
@smrtsmrf You want to pick out acos and asin but not tan or (30)
Candice
@smrtsmrf
Apr 14 2016 01:26 UTC
@sjames1958gm correct
Greg Duncan
@GregatGit
Apr 14 2016 01:29 UTC

@Dueldrawer8 paste this is at https://repl.it/

var myQuery = {"pages":{"18156969":{"pageid":18156969,"ns":0,"title":"Canada\u2013Germany relations","index":9,"extract":"Canada\u2013Germany relations are those between Canada and the Federal Republic of Germany."},"11867":{"pageid":11867,"ns":0,"title":"Germany","index":1,"extract":"Germany (/\u02c8d\u0292\u025c\u02d0rm\u0259ni/; German: Deutschland [\u02c8d\u0254\u028ft\u0283lant]), officially the Federal Republic of Germany or FRG (German: Bundesrepublik Deutschland,  listen ), is a federal parliamentary republic in West-Central Europe."},"662281":{"pageid":662281,"ns":0,"title":"Germany women's national football team","index":5,"extract":"The Germany women's national football team (German: Deutsche Fu\u00dfballnationalmannschaft der Frauen) represents Germany in international women's association football and is directed by the German Football Association (DFB)."},"20225783":{"pageid":20225783,"ns":0,"title":"Germany\u2013Italy relations","index":10,"extract":"Germany\u2013Italy relations refer to interstate relations between the Federal Republic of Germany and the Italian Republic."},"17703533":{"pageid":17703533,"ns":0,"title":"Germany\u2013Malaysia relations","index":8,"extract":"Germany\u2013Malaysia relations refers to foreign relations between Germany and Malaysia."},"27539356":{"pageid":27539356,"ns":0,"title":"Germany\u2013Serbia relations","index":3,"extract":"Germany\u2013Serbia relations are foreign relations between Germany and Serbia."},"38456438":{"pageid":38456438,"ns":0,"title":"Germany\u2013South Korea relations","index":2,"extract":"German-South Korean relations were established in the 1950s and play a vital role in the foreign policy of both countries today."},"16557953":{"pageid":16557953,"ns":0,"title":"Germany\u2013Ukraine relations","index":6,"extract":"Germany\u2013Ukraine relations are foreign relations between Germany and Ukraine."},"21212":{"pageid":21212,"ns":0,"title":"Nazi Germany","index":4,"extract":"Nazi Germany and the Third Reich (German: Drittes Reich) are common English names for the period of history in Germany from 1933 to 1945, when it was a dictatorship under the control of Adolf Hitler and the Nazi Party (NSDAP)."},"16278720":{"pageid":16278720,"ns":0,"title":"Outline of Germany","index":7,"extract":"The following outline is provided as an overview of and topical guide to Germany:"}}};

try using Object.keys() on it to get all the page ids into any array - (use console.log()) to see if it worked and once you have that it should be that part of the puzzle solved

should me myQuery not query to avoid clashing with the internal query
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:37 UTC
now how do i loop through the extract data?
data.query.pages[keys[0]].extract.forEach(function(entry) {
      $('#workspace').append('<p>' + entry.extract + '</p>');
       console.log(entry.extract);
   })
i need it to loop through each key and then extract
each key which contains extract
Greg Duncan
@GregatGit
Apr 14 2016 01:38 UTC
@Dueldrawer8 the keys are an array that give you the page number
Stephen James
@sjames1958gm
Apr 14 2016 01:38 UTC
@Dueldrawer8
keys.forEach(function(key) {
     var entry = data.query.pages[key];
      $('#workspace').append('<p>' + entry.extract + '</p>');
       console.log(entry.extract);
   })
Greg Duncan
@GregatGit
Apr 14 2016 01:38 UTC
so you can use that to get data out of the object
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 01:38 UTC
@GregatGit right
Juwdohr
@Juwdohr
Apr 14 2016 01:38 UTC
Hey do anyone know how to make the navbar menu auto collapse?
Bruce Young
@mutantspore
Apr 14 2016 01:39 UTC
@Juwdohr do you have bootstrap.js added in after jQuery.js?
Candice
@smrtsmrf
Apr 14 2016 01:39 UTC
@sjames1958gm I think I got it. /(\b[^a-z()]*)(a)([a-z]+)/g
Bruce Young
@mutantspore
Apr 14 2016 01:39 UTC
@Juwdohr that’s as well as bootstrap.css
Stephen James
@sjames1958gm
Apr 14 2016 01:40 UTC
@smrtsmrf Thought I was getting close but tan is killing me. Can we assume the letters are followed by (\d+)
Ariel
@abibliophile
Apr 14 2016 01:40 UTC
hey everyone! I'm working on the random quote machine and having trouble figuring out why my machine isn't outputting the html of my api
Greg Duncan
@GregatGit
Apr 14 2016 01:41 UTC
@abibliophile you should start by putting your js in the js section
Juwdohr
@Juwdohr
Apr 14 2016 01:41 UTC
@mutantspore yes. When I click on an item in the navbar menu, when it is collapsed it stays open. Do you know how to close it after you have clicked it on the item.
Stephen James
@sjames1958gm
Apr 14 2016 01:41 UTC
@smrtsmrf That seems to work you capture the a separate from the sin and cos, but you can handler that
Candice
@smrtsmrf
Apr 14 2016 01:41 UTC
@sjames1958gm the letters will always be followed by (30) or some other number in parenthese
s
Stephen James
@sjames1958gm
Apr 14 2016 01:42 UTC
What is \b new to me?
Candice
@smrtsmrf
Apr 14 2016 01:42 UTC
@sjames1958gm a word boundary
Ariel
@abibliophile
Apr 14 2016 01:43 UTC
@GregatGit i just did the section about APIs and they put their js in the html section in between script tags? Is there a reson why that doesn't work?
Greg Duncan
@GregatGit
Apr 14 2016 01:44 UTC
@abibliophile You are only getting one quote so you can simplify your js - you don't need to use Oject.keys foreach
you just need to have the html set up and input the text when the api works
Ariel
@abibliophile
Apr 14 2016 01:46 UTC
hm, okay
let me think that through
thanks for pointing me in the right direction @GregatGit !
CamperBot
@camperbot
Apr 14 2016 01:46 UTC
abibliophile sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:star: 415 | @gregatgit | http://www.freecodecamp.com/gregatgit
Greg Duncan
@GregatGit
Apr 14 2016 01:50 UTC
@abibliophile you got the right api and this what should come down
{
"success": {
"total": 1
},
"contents": {
"quotes": [
{
"quote": "All our dreams can come true – if we have the courage to pursue them.",
"length": "77",
"author": "Walt Disney",
"tags": [
"dreams",
"inspire"
],
"category": "inspire",
"date": "2016-04-14",
"title": "Inspiring Quote of the day",
"background": "https://theysaidso.com/img/bgs/man_on_the_mountain.jpg",
"id": "SWNQixrw7xrdBDh_ujjddQeF"
}
]
}
}
Bruce Young
@mutantspore
Apr 14 2016 01:50 UTC
@abibliophile this wil get your quote shown in the console. I don’t know anything about the api… it seems to just get the same one each time
 $(document).ready(function() {
   $(".btn").on("click", function() {
     $.getJSON("http://quotes.rest/qod.json", function(json) {
       console.log(json);
       console.log(json.contents.quotes[0].quote);
       console.log(json.contents.quotes[0].author);

     });
   });
 });
@abibliophile @GregatGit yes.. Quote of the Day… perhaps one per day????
arjunpunnam
@arjunpunnam
Apr 14 2016 01:58 UTC
Hi im getting this error while using the Quotes Api in Quote Generator
No 'Access-Control-Allow-Origin' header is present on the requested resource
Can some help please?
Stephen James
@sjames1958gm
Apr 14 2016 02:15 UTC
@arjunpunnam You have run into the cross origin problem that many before you have. Generally you have to resort to jsonp a protocol for getting around this. But I don't think the website you are trying to access supports jsonp
Daniel Gonzales
@choppd
Apr 14 2016 02:17 UTC
@sjames1958gm How would you work around this, I'm also having trouble with this.
Greg D
@mosaic-greg
Apr 14 2016 02:17 UTC
imho troubleshooting front end is harder than troubleshooting js
Stephen James
@sjames1958gm
Apr 14 2016 02:17 UTC
@choppd What URL/api are you using?
for the quote project I just put the quotes in an array and randomly selected them.
Daniel Gonzales
@choppd
Apr 14 2016 02:18 UTC
Same as the person you responded to. http://quotes.stormconsultancy.co.uk/random.json
Stephen James
@sjames1958gm
Apr 14 2016 02:19 UTC
Looks like that is a pretty meager api.
Not sure how they are expecting you to use it with this issue.
Daniel Gonzales
@choppd
Apr 14 2016 02:21 UTC
@sjames1958gm So you're saying that the data isn't in json, and you can't use .getJSON()
Matt Yamamoto
@MattYamamoto
Apr 14 2016 02:35 UTC
@sjames1958gm @arjunpunnam I don't think that API supports JSONP. You could proxy it via this site https://jsonp.afeld.me/, which would give you this link https://jsonp.afeld.me/?callback=?&url=http://quotes.stormconsultancy.co.uk/random.json to use
Stephen James
@sjames1958gm
Apr 14 2016 02:36 UTC
@choppd The data is json, without jsonp the browser cannot/will not give you the data . See ^^^ @MattYamamoto
Matt Yamamoto
@MattYamamoto
Apr 14 2016 02:37 UTC
oh yeah, whoops...mentioned the wrong person. :smile:
Stephen James
@sjames1958gm
Apr 14 2016 02:37 UTC
@MattYamamoto All good :)
Daniel Gonzales
@choppd
Apr 14 2016 02:38 UTC
@sjames1958gm @MattYamamoto Ahh I see now! Thanks!!!
CamperBot
@camperbot
Apr 14 2016 02:38 UTC
choppd sends brownie points to @sjames1958gm and @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 629 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
:star: 954 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
Daniel Gonzales
@choppd
Apr 14 2016 02:40 UTC
That works! Wow, been stuck on that for a long time
Michael Karpinski
@karpimpski
Apr 14 2016 02:43 UTC
@tuningmind sorry for the late reply, but yes. I've gone through it. why?
$.getJSON('https://api.twitch.tv/kraken/streams/freecodecamp?callback=?', function(data) {
  console.log(data);
});
copied this from the suggested link to see if it works and it doesn't. when I type it in without the callback at the end I get the JSON data on my browser though
Michael Karpinski
@karpimpski
Apr 14 2016 02:52 UTC
I've tried setting the callback to callback=false, but that didn't work. still not getting any data logged to my console. any help would be great!
Stephen James
@sjames1958gm
Apr 14 2016 02:52 UTC
@karpimpski Try console.log(JSON.stringify(data));
Matt Yamamoto
@MattYamamoto
Apr 14 2016 02:53 UTC
@karpimpski link to your pen?
Michael Karpinski
@karpimpski
Apr 14 2016 02:54 UTC
@sjames1958gm nope :/
Stephen James
@sjames1958gm
Apr 14 2016 02:54 UTC
@karpimpski Jquery included in js?
Matt Yamamoto
@MattYamamoto
Apr 14 2016 02:54 UTC
yeah, that's the issue
Michael Karpinski
@karpimpski
Apr 14 2016 02:54 UTC
@sjames1958gm that's the second time you got me on that. thanks, I always forget to include JQuery
CamperBot
@camperbot
Apr 14 2016 02:54 UTC
karpimpski sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star: 630 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
Michael Karpinski
@karpimpski
Apr 14 2016 02:55 UTC
works great now. thanks guys! @MattYamamoto @sjames1958gm
Matt Yamamoto
@MattYamamoto
Apr 14 2016 02:56 UTC
@karpimpski That's why the browser's console is a bit more helpful than codepen's console.... your browser will show you errors.
Michael Karpinski
@karpimpski
Apr 14 2016 02:56 UTC
@MattYamamoto I'm sure this sounds like a noob question, but how do you use the browser's console?
Matt Yamamoto
@MattYamamoto
Apr 14 2016 02:57 UTC
@karpimpski I think it might depend on the browse, but try hitting F12 and see what that does.
Michael Karpinski
@karpimpski
Apr 14 2016 02:58 UTC
@MattYamamoto yep, there it is. how can I put my code in to troubleshoot? just copy and paste? just looks like a one-line console
Stephen James
@sjames1958gm
Apr 14 2016 02:58 UTC
@MattYamamoto Made me think of the early days of WoW when people would ask for help and the response was press alt-F4.
Matt Yamamoto
@MattYamamoto
Apr 14 2016 02:59 UTC
@karpimpski , for example, delete the jquery link and then run the pen, you should see an error in the conosle. So while you can run code in there, it is more useful to debug the current page as it loads/runs
and you'll see your console.log results there too
Michael Karpinski
@karpimpski
Apr 14 2016 02:59 UTC
@sjames1958gm still happens in video games a lot
$.getJSON('https://api.twitch.tv/kraken/streams/freecodecamp?callback=?', function(data) {
  if(data.stream == "null"){
    console.log("No stream");
  }
});
I feel like this should be valid, but I'm not getting anything. I tried === but it was no different
nevermind, just took away the quotations
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:02 UTC
yup, it's a value
Michael Karpinski
@karpimpski
Apr 14 2016 03:07 UTC
@MattYamamoto yeah, I thought that all JSON values had to be stored in quotations, but they differentiate it in the JSON which is nice
Greg D
@mosaic-greg
Apr 14 2016 03:09 UTC
@JiniHendrix maybe use bootstrap columns for the scores and board?
Michael Karpinski
@karpimpski
Apr 14 2016 03:10 UTC
can I put a $.ajax({}) function inside of a for loop? I want my Twitch project to run through an array and display the values using Ajax for each user I have in the array
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:12 UTC
@karpimpski you can, though it will depend on how you implement it. It would be better to write a function that holds the ajax call, then call that function in the loop. Even better, use .forEach() on the array.
actually, I shouldn't necessarily say "even better"... perhaps "alternatively"
Juwdohr
@Juwdohr
Apr 14 2016 03:19 UTC
Does anyone have an idea how to create to columns, that will have a title and a list on both without doing a div or a table?
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:20 UTC
@Juwdohr why would you be against using divs?
Juwdohr
@Juwdohr
Apr 14 2016 03:20 UTC
@MattYamamoto What do you mean? Not understanding question?
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:21 UTC
you are asking how to create 2 columns, correct? But you said you want to do that without using a div or a table.
Juwdohr
@Juwdohr
Apr 14 2016 03:21 UTC
Not against using them, just want to have 2 collumns with lists inside them.
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:22 UTC
if you are using bootstrap (or not against it) then just use their columns. Otherwise just create two divs, given them appropriate widhts, and float them. Of course it's not quite that easy if you want responsiveness.
Miguel Mejia
@miglmj
Apr 14 2016 03:23 UTC
I'm having a lot of trouble calling $.getJSON from within codepen. For some reason, my handler function is not running at all. Could someone maybe take a look at my code?
Juwdohr
@Juwdohr
Apr 14 2016 03:23 UTC
@MattYamamoto what is bootstraps columns?
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:24 UTC
@Juwdohr have you heard of bootstrap?
@miguelmejiamontes link to your pen?
Juwdohr
@Juwdohr
Apr 14 2016 03:24 UTC
@MattYamamoto Let me repharse that. Isn't bootstrap's columns only within divs?
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:26 UTC
@Juwdohr well, I mean yes. But divs are essentially containers, and you'd need to use divs to make two columns... so maybe I'm confused at exactly what youre after. But with bootstrap you could have a row with two columns in it. so yes, you'd have a container div, holding a row div, which holds two column divs.
@miguelmejiamontes weird, why is everybody using that api? See above :point_up: April 13, 2016 7:35 PM
Michael Karpinski
@karpimpski
Apr 14 2016 03:28 UTC
@MattYamamoto do you think it's better to use $.ajax() or $.getJSON()?
Miguel Mejia
@miglmj
Apr 14 2016 03:28 UTC
@MattYamamoto Great, thanks!
CamperBot
@camperbot
Apr 14 2016 03:28 UTC
miguelmejiamontes sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 955 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:28 UTC
I should note that it's probably bad practice to just proxy through something you know nothing about... so I make no claim to the security of that service.
@karpimpski $.getJSON() is just a helper shortcut of $.ajax(). So $.ajax() is more general purose and more powerful. It's worth understanding $.ajax()... but I dont see why one wouldn't use $.getJSON() if it fits the need.
Justin
@daemedeor
Apr 14 2016 03:32 UTC
@MattYamamoto because you can change better parameters through the .ajax make methods out of it
Michael Karpinski
@karpimpski
Apr 14 2016 03:33 UTC

@MattYamamoto what am I doing wrong here?

$.ajax({
  url: 'https://api.twitch.tv/kraken/streams/freecodecamp?callback=?',
  jsonp: "callback",
  dataType: "jsonp",
  success: function(data){
    console.log(data);
  }
});

I'm 99% sure it's my success function, but I'm not sure how to fix it

I should not that the code below works fine:
$.getJSON('https://api.twitch.tv/kraken/streams/freecodecamp?callback=?', function(data) {
  console.log(data);
});
note*
Kevin
@kevinhisel
Apr 14 2016 03:37 UTC
I'm working on my tribute page and technically it fulfills all the user stories and is "done" but it doesn't look good. Should I just submit it and move on?
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:38 UTC
@karpimpski the ?callback=? isn't needed since you have the jsonp: "callback" setting... but what you posted works fine for me
Michael Karpinski
@karpimpski
Apr 14 2016 03:38 UTC
@MattYamamoto that's because I had the getJSON function. I just had to wrap my ajax in a function and call it, then switch "data" to "url"
@kevinhisel that's up to you. as long as it fulfills the user stories you can submit it. it just depends on what you want
Frank XC
@tenkdayz
Apr 14 2016 03:39 UTC
@kevinhisel .. the point of it is for you to learn along the way.. you might learn something new if you try to make it look as you want .. that how I've done it.
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:40 UTC
@kevinhisel yes. If in the future you want to go back and redo it or fix it up, then go ahead. That's not to say I encourage that approach for all the challenges, but I find that challenge pretty limiting in what you can learn.
@karpimpski uh, wait, what? so you got $.ajax() working?
Michael Karpinski
@karpimpski
Apr 14 2016 03:41 UTC
@MattYamamoto yeah, here's my code. could you tell me if everything is written how it should be?
function ajax() {
  $.ajax({
    url: 'https://api.twitch.tv/kraken/streams/freecodecamp?callback=?',
    jsonp: "callback",
    dataType: "jsonp",
    success: function(url) {
      console.log(url);
    }
  });
}

ajax();
Kevin
@kevinhisel
Apr 14 2016 03:41 UTC
Thanks all three of you for your responses!
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:44 UTC

@karpimpski seems to work. again, you don't need the callback in the url. And the parameter for the success function doesn't have to be url, it can be whatever

$.ajax({
    url: 'https://api.twitch.tv/kraken/streams/freecodecamp',
    jsonp: "callback",
    dataType: "jsonp",
    success: function(zebra) {
      console.log(zebra);
    }
  });

but something like json or obj might be more descriptive.

Michael Karpinski
@karpimpski
Apr 14 2016 03:45 UTC
@MattYamamoto got rid of that right after I posted, thanks for that. I'll try the success parameter
CamperBot
@camperbot
Apr 14 2016 03:45 UTC
karpimpski sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 956 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
Michael Karpinski
@karpimpski
Apr 14 2016 03:45 UTC
@MattYamamoto awesome! thanks for your help so far sir
CamperBot
@camperbot
Apr 14 2016 03:45 UTC
karpimpski sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:warning: karpimpski already gave mattyamamoto points
Michael Karpinski
@karpimpski
Apr 14 2016 03:46 UTC
@MattYamamoto sorry about my cluelessness, still struggling a bit with Ajax
noeazar
@noeazar
Apr 14 2016 03:46 UTC
How do I get to the code review chat room?
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:46 UTC
@karpimpski no worries, seems like you've got a handle on it.
Michael Karpinski
@karpimpski
Apr 14 2016 03:47 UTC
noeazar
@noeazar
Apr 14 2016 03:47 UTC
@karpimpski Thank you Michael
CamperBot
@camperbot
Apr 14 2016 03:47 UTC
noeazar sends brownie points to @karpimpski :sparkles: :thumbsup: :sparkles:
:star: 300 | @karpimpski | http://www.freecodecamp.com/karpimpski
Michael Karpinski
@karpimpski
Apr 14 2016 03:48 UTC
@noeazar no problem!
Juwdohr
@Juwdohr
Apr 14 2016 03:48 UTC
This message was deleted
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:51 UTC
@Juwdohr not exactly sure on your layout, but you have columns that need to be in a row div
but maybe you figured that out? :smile:
Juwdohr
@Juwdohr
Apr 14 2016 03:51 UTC
@MattYamamoto Where?
Matt Yamamoto
@MattYamamoto
Apr 14 2016 03:52 UTC
whatever you just changed you fixed it.
Juwdohr
@Juwdohr
Apr 14 2016 03:52 UTC
@MattYamamoto Yup/
Matt Yamamoto
@MattYamamoto
Apr 14 2016 04:00 UTC
@Juwdohr if you don't mind some constructive criticism... I find the white text in the "about" section a little hard to read against the busy background...maybe try a dark overlay? https://css-tricks.com/tinted-images-multiple-backgrounds/
Carrie A
@tuningmind
Apr 14 2016 04:01 UTC
@karpimpski because I'm wrestling to figure out the weather api, and looking for something that can help. I wondered if the udacity ajax class would help. (I went ahead and started it, and I'm up against the same issue with the nyt ajax call. The docs make assumptions I don't know yet how to fill.)
Michael Karpinski
@karpimpski
Apr 14 2016 04:10 UTC
@tuningmind hm, well what helped me best was looking at somebody else's Ajax call and re-writing it until it got drilled into my head
if you want you can PM me for extra help, or I could supply my link with my API call!
can anybody help me figure out why the images won't load in my code? I can get text from my JSON with this, but not the image. http://codepen.io/karpimpski/pen/NNYwKN?editors=1111
Matt Yamamoto
@MattYamamoto
Apr 14 2016 04:17 UTC
@karpimpski 1) I think you need to make a second api call to get the image url. 2) your html function might not work as you have it... I think you might need
function html(src){
  $("#table").append("<tr><td><img src='" + src + "'</td><td>Empty</td><td>Empty</td></tr>")
}
Juwdohr
@Juwdohr
Apr 14 2016 04:18 UTC
@MattYamamoto Thanks, try it now.
CamperBot
@camperbot
Apr 14 2016 04:18 UTC
juwdohr sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:star: 957 | @mattyamamoto | http://www.freecodecamp.com/mattyamamoto
Michael Karpinski
@karpimpski
Apr 14 2016 04:21 UTC
@MattYamamoto that works! can you look at my code and tell me if I can clean it up at all?
Matt Yamamoto
@MattYamamoto
Apr 14 2016 04:29 UTC
@karpimpski umm, well... I apologize, but I have to run... but I'll leave you with this: First, you need to give your two functions unique names.. maybe getChannles and getStreams, or something descriptive like that. Then, in your first API call, the one to the streams url, you actually get the link to the channles url in the returned data. So make the first api call, then inside the success of that call, you want to make another call to the channels url. So you're going to have nested calls. Hopefully that makes sense... and if not... well sorry to bail on you. if you get stuck and nobody else can help you tonight, feel free to PM me and I'll get back to you in the morning. good luck!
Michael Karpinski
@karpimpski
Apr 14 2016 04:30 UTC
@MattYamamoto thanks! I don't fully understand the part about the channels url link, but I'll try to figure it out. thanks again for your help!
CamperBot
@camperbot
Apr 14 2016 04:30 UTC
karpimpski sends brownie points to @mattyamamoto :sparkles: :thumbsup: :sparkles:
:warning: karpimpski already gave mattyamamoto points
does anybody know why my status won't display the status if a streamer is online?
Eldar Tinjić
@EldarT90
Apr 14 2016 05:07 UTC
i need help with two things with some1 who is really good in bootstrap and css
Carrie A
@tuningmind
Apr 14 2016 05:17 UTC
@karpimpski thanks!
CamperBot
@camperbot
Apr 14 2016 05:17 UTC
tuningmind sends brownie points to @karpimpski :sparkles: :thumbsup: :sparkles:
:star: 301 | @karpimpski | http://www.freecodecamp.com/karpimpski
Eldar Tinjić
@EldarT90
Apr 14 2016 05:18 UTC
anyone can help with lil bit of css?
Michael Karpinski
@karpimpski
Apr 14 2016 05:19 UTC
@EldarT90 I can try!
Eldar Tinjić
@EldarT90
Apr 14 2016 05:20 UTC
@karpimpski oke, take a look at this project https://codepen.io/EldarT/pen/xVWqPZ ; i need to centralize elements ("purple boxes") and i need to set max display of them to 4
in 1 row
Michael Karpinski
@karpimpski
Apr 14 2016 05:21 UTC
@EldarT90 what do you mean centralize? make them all in a line that is in the center of the page?
Eldar Tinjić
@EldarT90
Apr 14 2016 05:21 UTC
@karpimpski yes
@karpimpski now they are "floating" to the left; i tried the usual trick with margin 0 auto and display inline block
but that didnt work
Michael Karpinski
@karpimpski
Apr 14 2016 05:23 UTC
@EldarT90 I think the cleanest solution would be to add a new row with the class text-center every time you have a new streamer. you'll need to move a lot, maybe most of, your HTML to JavaScript, but that way you'll have a new row for every box and be able to be more flexible with adding streamers
Eldar Tinjić
@EldarT90
Apr 14 2016 05:24 UTC
for each streamer 1 row ?
Michael Karpinski
@karpimpski
Apr 14 2016 05:24 UTC
@EldarT90 yeah, that way they'll all be in a line in the center of your page, like you wanted
Eldar Tinjić
@EldarT90
Apr 14 2016 05:25 UTC
@karpimpski i dont want that
i want to have 4 elements (when possible) in 1 line
i want the group of boxes to be centered
Carrie A
@tuningmind
Apr 14 2016 05:26 UTC
my tweet runs perfectly in safari and firefox, but the tweet button doesn't even show up in chrome. there are no errors in console or anything, the tweet just doesn't show. anyone have any idea why? http://codepen.io/tuningmind/full/rezmeo/
@EldarT90 I've found wrapping in another row to be the easiest way to solve that
Eldar Tinjić
@EldarT90
Apr 14 2016 05:26 UTC
@tuningmind it shows, im using chrome, tweet button is working
Carrie A
@tuningmind
Apr 14 2016 05:27 UTC
@EldarT90 sweet, thanks!
CamperBot
@camperbot
Apr 14 2016 05:27 UTC
tuningmind sends brownie points to @eldart90 :sparkles: :thumbsup: :sparkles:
:star: 289 | @eldart90 | http://www.freecodecamp.com/eldart90
Zoher Ali
@Zoher-ali
Apr 14 2016 05:28 UTC
Hey every1... I had completed weather app project and now am on wikipedia viewer. I dont have any knowledge about angular js... should i learn angular js first???
Michael Karpinski
@karpimpski
Apr 14 2016 05:28 UTC
@EldarT90 you said you did. in that case, I would still move most of your HTML to JS. then, I would make a variable called something like inRow, and count up every time you add a new streamer. once that reaches 4, I would add an HTML snippet like "</div><div class='row'" so that it makes a new row after the desired number of elements in the row
@Zoher-ali no need to know Angular
@Zoher-ali just curious, why did you think that?
Eldar Tinjić
@EldarT90
Apr 14 2016 05:29 UTC
@karpimpski but problem is that when i add rows for every 4 streamer and i try to shrink size of screen it shows 3-1-3-1
it wont go 3-3-3 format
and that one is ugly
so i actually had to remove rows in order to get equal number of elements in every row
even when the screen cant support 4, but 3
Michael Karpinski
@karpimpski
Apr 14 2016 05:29 UTC
@EldarT90 hm, well it should go 3-3-3-3. I'm really not sure why it isn't
Robert Valmassoi
@valmassoi
Apr 14 2016 05:30 UTC
<svg width={width} height={height}>
          {this.state.cells.map(function (row, y) {
               {row.map(function (life, x) {//column   use life value for className later
                   return (
              <rect key={`${x},${y}`} x={box*x} y={box*y} width={box} height={box} className="alive" stroke="black" strokeWidth="2"/>
                     );
                }.bind(this))}
          }.bind(this))}
 </svg>
cells is a 2d array. its not working, see anything wrong with it??
<svg width={width} height={height}>
              {this.state.cells[0].map(function (life, x) {
                   return (
              <rect key={x} x={box*x} y={0} width={box} height={box} className="alive" stroke="black" strokeWidth="2"/>
                     );
                }.bind(this))}
  </svg>
Zoher Ali
@Zoher-ali
Apr 14 2016 05:30 UTC
@karpimpski bcoz i saw the example's code and it uses angular thts y :smile:
Robert Valmassoi
@valmassoi
Apr 14 2016 05:30 UTC
this works for one row
Michael Karpinski
@karpimpski
Apr 14 2016 05:31 UTC
@Zoher-ali oh, I think they do that kind of stuff so that us plebs can't understand it and re-write their code. anyway, no need for Angular. let me know if you need any help!
ive been stuck on this for awhile and cant figure out whats wrong
Eldar Tinjić
@EldarT90
Apr 14 2016 05:32 UTC
@karpimpski well sadly it wont break up the next row , thats the issue; so thats why it presents it as 3+1+3+1 ; 3+1 3+1
Michael Karpinski
@karpimpski
Apr 14 2016 05:33 UTC
@EldarT90 honestly afraid that's out of my league. I try to help when I can, but we're actually on the same project and probably about the same level of expertise. just try looking over your code and make sure to ask in the other chatrooms like /Help and the main room. also check out the subreddit, it's really great whenever I can't get help on here!
Eldar Tinjić
@EldarT90
Apr 14 2016 05:34 UTC
@karpimpski np mate , tnx for trying ^^ i will ask around yeah
CamperBot
@camperbot
Apr 14 2016 05:34 UTC
eldart90 sends brownie points to @karpimpski :sparkles: :thumbsup: :sparkles:
Zoher Ali
@Zoher-ali
Apr 14 2016 05:34 UTC
@karpimpski den how can i get data from wikipedia i.e., just defination
CamperBot
@camperbot
Apr 14 2016 05:34 UTC
:star: 302 | @karpimpski | http://www.freecodecamp.com/karpimpski
Michael Karpinski
@karpimpski
Apr 14 2016 05:36 UTC
@Zoher-ali http://en.wikipedia.org/w/api.php?action=opensearch&format=json&limit=15&search=(PUT SEARCH HERE). check out the JSON there (preferrably with a chrome JSON extension)
Zoher Ali
@Zoher-ali
Apr 14 2016 05:38 UTC
@karpimpski to give this url in getJSON method?
Michael Karpinski
@karpimpski
Apr 14 2016 05:39 UTC
@Zoher-ali using the .ajax method is typically better, but you can put that in the getJSON method as well
@Zoher-ali for this project you can just use the getJSON method I think
Zoher Ali
@Zoher-ali
Apr 14 2016 05:40 UTC
@karpimpski ohk lets see. :smiley: n thnx for ur suggestion
CamperBot
@camperbot
Apr 14 2016 05:40 UTC
zoher-ali sends brownie points to @karpimpski :sparkles: :thumbsup: :sparkles:
:star: 303 | @karpimpski | http://www.freecodecamp.com/karpimpski
Jackson Bates
@JacksonBates
Apr 14 2016 06:45 UTC
@Juwdohr Sorry - Only just saw your question. No, I don't know how to auto collapse the menu bar, I just click it again to dismiss it, I think. There's probably a nicer automated solution around somewhere...
Zoher Ali
@Zoher-ali
Apr 14 2016 06:45 UTC
why its not showing anything
 $.getJSON("https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=revisions&rvprop=content&format=json",function(json){                                                                                                      document.write(json);
Shafeek B
@sbakhach
Apr 14 2016 06:48 UTC
Is there a location I can see the tribute pages of other campers?
a location where*
Shivam Arora
@shivamarora13
Apr 14 2016 06:49 UTC
@Zoher-ali It will show you the main page
type this address in an address bar and u will see the results.
to get particular data back, you need to provide a callback
Michael Karpinski
@karpimpski
Apr 14 2016 06:51 UTC
http://codepen.io/karpimpski/pen/NNYwKN?editors=1111 can anybody explain why if any streamer is offline, my project shows all of the streamers as offline?
@sbakhach just google tribute page codepen, there should be plenty to choose from
buiphuking
@buiphuking
Apr 14 2016 06:57 UTC
hi guys, i do Arguments Optional, intermediate algorithm
with addTogether(2)(3); what is that mean?
and i code: return arguments[0] won't works,
give me some advice plz!
Dustin Frank
@DustInCompetent
Apr 14 2016 07:04 UTC
@karpimpski because you never set offline = false again?
ajaybti
@ajaybti
Apr 14 2016 07:08 UTC
how to assign value on placetextholder to a another variable using jquery... help please
Frank XC
@tenkdayz
Apr 14 2016 07:08 UTC
@buiphuking read up on closures
@ajaybti do you mean an input text value?
ajaybti
@ajaybti
Apr 14 2016 07:09 UTC
yes
@tenkdayz yes
Frank XC
@tenkdayz
Apr 14 2016 07:11 UTC
var str = $("#elem").val();
ajaybti
@ajaybti
Apr 14 2016 07:14 UTC
@tenkdayz its value is showing on cosole log but not asigning to another variable
Frank XC
@tenkdayz
Apr 14 2016 07:16 UTC
@ajaybti what do you mean another variable.. is it assigned to 2 variables?
Shivam Arora
@shivamarora13
Apr 14 2016 07:17 UTC
can anybody tell me whats the problem with my switch statement
in my project,
I want case 1 to run, but when the variable passed within switch is 1, it still runs both case1 and case 2
you can see the code here
Greg Duncan
@GregatGit
Apr 14 2016 07:19 UTC
@shivamarora13 YOu don't have a break
just put a break; after line 75
Ogundele Olumide
@Lumexralph
Apr 14 2016 07:21 UTC
@GregatGit thought so too
Shivam Arora
@shivamarora13
Apr 14 2016 07:21 UTC
@GregatGit thanks! silly one!
CamperBot
@camperbot
Apr 14 2016 07:21 UTC
shivamarora13 sends brownie points to @gregatgit :sparkles: :thumbsup: :sparkles:
:star: 416 | @gregatgit | http://www.freecodecamp.com/gregatgit
Eldar Tinjić
@EldarT90
Apr 14 2016 07:23 UTC
need some who REALLY understand css and bs(advanced problem) , thanks
Greg Duncan
@GregatGit
Apr 14 2016 07:23 UTC
@shivamarora13 Good luck - nice design on your tic tac toe
ajaybti
@ajaybti
Apr 14 2016 07:24 UTC
@tenkdayz http://codepen.io/ajaybti/pen/vGdPQK?editors=1111....can u tell how to assign value of "input " variable to "search "variable
Frank XC
@tenkdayz
Apr 14 2016 07:34 UTC
@ajaybti
$(document).ready(function(){
var input=$("#search");
$("button").click(function(){
$.getJSON("https://www.mediawiki.org/w/api.php?action=opensearch&search="+input,function(data){
  //...
 });
});
});
and the input value is = input.val()
buiphuking
@buiphuking
Apr 14 2016 07:40 UTC
@tenkdayz i understand closure but what i don't get is why
addTogether(2)(3); 
return arguments.length  ===1 
return typeof arguments[0] === "number";
Frank XC
@tenkdayz
Apr 14 2016 07:45 UTC
@buiphuking where did you get that from?
buiphuking
@buiphuking
Apr 14 2016 07:47 UTC
function addTogether() {

    if (arguments.length === 1 && typeof arguments[0] === 'number') {
        var x = arguments[0];
        return function(y) {
            if (typeof y === 'number') {
                return x + y;
            }
        };
    } else if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') {
        return arguments[0] + arguments[1];
    }

}

addTogether(2)(3);
i this code run at first if
Zoher Ali
@Zoher-ali
Apr 14 2016 07:48 UTC
@shivamarora13 its not showing anything :worried:
Frank XC
@tenkdayz
Apr 14 2016 07:50 UTC
@buiphuking there should be something like
if(arguments.length<1){return undefined;} // right?
buiphuking
@buiphuking
Apr 14 2016 07:52 UTC
Eldar Tinjić
@EldarT90
Apr 14 2016 07:52 UTC
need help from some1 who understand advanced bs css , thanks
Frank XC
@tenkdayz
Apr 14 2016 07:52 UTC
@buiphuking it shows my answer.
I'll paste yours
ok I see it..
works
Zoher Ali
@Zoher-ali
Apr 14 2016 07:54 UTC
https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=Stack%20Overflow
can sm1 figure out why its not showing anything?
$.getJSON("https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=Stack%20Overflow",function(json){    
    document.write(json);
     });
buiphuking
@buiphuking
Apr 14 2016 07:56 UTC
@tenkdayz with addTogether(2)(3);
could you explain how it run with ( arguments.length === 1 && typeof arguments[0] === 'number' )
Frank XC
@tenkdayz
Apr 14 2016 07:57 UTC
arguments[0] = 2 .. it's a number so it proceeds
Jackson Bates
@JacksonBates
Apr 14 2016 07:58 UTC
@Zoher-ali what does the error console tell you? It could be that you need &callback=? In your query string
buiphuking
@buiphuking
Apr 14 2016 07:58 UTC

@tenkdayz

return arguments[0];

won't works

Zoher Ali
@Zoher-ali
Apr 14 2016 07:59 UTC
its not giving any error @JacksonBates
Frank XC
@tenkdayz
Apr 14 2016 08:00 UTC
@buiphuking return it where in the function?
Jackson Bates
@JacksonBates
Apr 14 2016 08:00 UTC
@Zoher-ali are you sure? I get this error when I run it: XMLHttpRequest cannot load https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=Stack%20Overflow. No 'Access-Control-Allow-Origin' header is present on the requested resource.
@Zoher-ali I'm looking in the browser error console
buiphuking
@buiphuking
Apr 14 2016 08:01 UTC
@tenkdayz
function addTogether() {
   /*
    if (arguments.length === 1 && typeof arguments[0] === 'number') {
        var x = arguments[0];
        return function(y) {
            if (typeof y === 'number') {
                return x + y;
            }
        };
    } else if (typeof arguments[0] === 'number' && typeof arguments[1] === 'number') {
        return arguments[0] + arguments[1];
    }
    */
  return arguments[0];
}

addTogether(2)(3);
Jackson Bates
@JacksonBates
Apr 14 2016 08:02 UTC
@Zoher-ali change your getJson call to this:
"https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&exintro=&explaintext=&titles=Stack%20Overflow&callback=?"
Zoher Ali
@Zoher-ali
Apr 14 2016 08:03 UTC
@JacksonBates actually i am working on dreamweaver.. how can i get console error?
Eldar Tinjić
@EldarT90
Apr 14 2016 08:04 UTC
need help in advanced css+bs, anyone here that can help ? =/
Jackson Bates
@JacksonBates
Apr 14 2016 08:04 UTC
@Zoher-ali I added &callback=? which returns a jsonp object. Not sure about dreamweaver error console. Do you then view your code in a browser? The error console can be found by pressing ctrl+shift+J in chrome
Frank XC
@tenkdayz
Apr 14 2016 08:04 UTC
@buiphuking because after a return statement the function finishes.. in this case it returned arguments.[0]+arguments[1]
Zoher Ali
@Zoher-ali
Apr 14 2016 08:04 UTC
@JacksonBates did it!!! and now my browser is loading and loading and loading... may be due to slow internet
Frank XC
@tenkdayz
Apr 14 2016 08:06 UTC
@buiphuking test retuning a value and then alerting something.. it wont do the alert because you return something first
Jackson Bates
@JacksonBates
Apr 14 2016 08:06 UTC
@Zoher-ali I do alot of my practice things in codepen - it makes it a bit easier to juggle all the parts while not having any other distractions. The quick pen I did to test your problem is here: http://codepen.io/Malgalin/pen/zqWqqN?editors=0012
Frank XC
@tenkdayz
Apr 14 2016 08:07 UTC
@buiphuking you understand now?
Zoher Ali
@Zoher-ali
Apr 14 2016 08:08 UTC
@JacksonBates nothing in result :worried:
buiphuking
@buiphuking
Apr 14 2016 08:08 UTC
@tenkdayz no, i use / / to disable all the code, just run
return arguments[0];
This message was deleted
Zoher Ali
@Zoher-ali
Apr 14 2016 08:10 UTC
@JacksonBates i had added callback and now its showing [object Object] and still loading in browser
Jackson Bates
@JacksonBates
Apr 14 2016 08:11 UTC
@Zoher-ali If you're using the embedded pen on Gitter app it won't show, because it doesn't show the console. Follow the link. I changed the document.write to console.log(JSON.stringify(json)) to show the whole contents of the json object
This is what I get:
"{'batchcomplete':'','query':{'pages':{'21721040':{'pageid':21721040,'ns':0,'title':'Stack Overflow','extract':'Stack Overflow is a privately held website, the flagship site of the Stack Exchange Network, created in 2008 by Jeff Atwood and Joel Spolsky. It was created to be a more open alternative to earlier Q&A sites such as Experts-Exchange. The name for the website was chosen by voting in April 2008 by readers of Coding Horror, Atwood's popular programming blog.\nIt features questions and answers on a wide range of topics in computer programming.\nThe website serves as a platform for users to ask and answer questions, and, through membership and active participation, to vote questions and answers up or down and edit questions and answers in a fashion similar to a wiki or Digg. Users of Stack Overflow can earn reputation points and \'badges\'; for example, a person is awarded 10 reputation points for receiving an \'up\' vote on an answer given to a question, and can receive badges for their valued contributions, which represents a kind of gamification of the traditional Q&A site or forum. All user-generated content is licensed under a Creative Commons Attribute-ShareAlike license.\nClosing questions is a main differentiation from Yahoo! Answers and a way to prevent low quality questions. The mechanism was overhauled in 2013; questions edited after being put \'on hold\' now appear in a review queue. Jeff Atwood stated in 2010 that duplicate questions are not seen as a problem but rather they constitute an advantage if such additional questions drive extra traffic to the site by multiplying relevant keyword hits in search engines.\nAs of April 2014, Stack Overflow has over 4,000,000 registered users and more than 10,000,000 questions, with 10,000,000 questions celebrated in late August 2015. Based on the type of tags assigned to questions, the top eight most discussed topics on the site are: Java, JavaScript, C#, PHP, Android, jQuery, Python and HTML.\nStack Overflow also has a Careers section to assist developers in finding their next opportunity. For employers, Stack Overflow provides tools to brand their business, advertise their openings on the site, and source candidates from Stack Overflow's database of developers who are open to being contacted.'}}}}"
Frank XC
@tenkdayz
Apr 14 2016 08:11 UTC
@buiphuking hmm
Zoher Ali
@Zoher-ali
Apr 14 2016 08:13 UTC
@JacksonBates got it :smile: thnx
CamperBot
@camperbot
Apr 14 2016 08:13 UTC
zoher-ali sends brownie points to @jacksonbates :sparkles: :thumbsup: :sparkles:
:star: 305 | @jacksonbates | http://www.freecodecamp.com/jacksonbates
Frank XC
@tenkdayz
Apr 14 2016 08:14 UTC
@buiphuking I dont know why..
Jackson Bates
@JacksonBates
Apr 14 2016 08:14 UTC
@Zoher-ali No worries. The callback trick took me a long time to find, so I'm happy to speed up someone else's efforts :)
Zoher Ali
@Zoher-ali
Apr 14 2016 08:14 UTC
@JacksonBates :laughing:
ajaybti
@ajaybti
Apr 14 2016 08:33 UTC
@tenkdayz thanks ....a lot
CamperBot
@camperbot
Apr 14 2016 08:33 UTC
ajaybti sends brownie points to @tenkdayz :sparkles: :thumbsup: :sparkles:
:star: 387 | @tenkdayz | http://www.freecodecamp.com/tenkdayz
Chad Kreutzer
@ChadKreutzer
Apr 14 2016 08:35 UTC
so I've got the sound in, but I don't think I'm using the setTimeout right: I want the pomedoro to pause for a moment as the sound plays http://codepen.io/ChadKreutzer/pen/oxpOGe?editors=1010
Fancy Zhao
@fancyfsz
Apr 14 2016 09:15 UTC
Hola I'd like to learn front end tech with all of you
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 09:20 UTC
@fancyfsz welcome
lcthornhill
@lsrus
Apr 14 2016 09:25 UTC
@fancyfsz hi
@ChadKreutzer you still having issues?
Chad Kreutzer
@ChadKreutzer
Apr 14 2016 09:43 UTC
@lsrus with the timing of the sound, yeah.
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 09:45 UTC
anyone know some javascript tricks to move my title down into my border box? or should i use css? for example.. do any search and you will see what happens
Stephen James
@sjames1958gm
Apr 14 2016 09:51 UTC
@ChadKreutzer The problem is you are calling your function in the setTimeout call and not passing the function.
setTimeout(function(){
            $("#testClock").text(secToTimeString);
          }, 5000, testPom);
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 09:52 UTC
hm i think i figured it out almost but now im not getting a border around my title and extract
Stephen James
@sjames1958gm
Apr 14 2016 09:52 UTC
@ChadKreutzer Also during that 5 seconds the other timer is running - won't you start 4 more timers and play 4 more sounds
lcthornhill
@lsrus
Apr 14 2016 09:53 UTC
@ChadKreutzer you need to clear the Interval, like you do during pauseCountdown, and then start it again after the right amount of time has passed. Otherwise decrement keeps getting called every second, with an additional single call to secToTimeString after the setTimeout period
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 09:54 UTC
do i need to add a class/id of border to my div that contains the p and h3?
Stephen James
@sjames1958gm
Apr 14 2016 09:55 UTC
@Dueldrawer8 To get this to work for all your entries you are going to have to use a class, the added h3 wont and cant have the same id.
Chad Kreutzer
@ChadKreutzer
Apr 14 2016 09:56 UTC
@lsrus so calling the timeout inside the interval doesn't pause the interval. Gotcha.
lcthornhill
@lsrus
Apr 14 2016 09:56 UTC
:+1:
Stephen James
@sjames1958gm
Apr 14 2016 09:56 UTC
Something like this
$('#workspace').append('<h3 class="title">' + entry.title + '</h3>' + '<p class="entry">' + entry.extract + '</p>');
        console.log(entry.extract);
      })
@Dueldrawer8 Also I would wrap that in a div so you can give styling to the item as a whole
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 09:58 UTC
@sjames1958gm it is wrapped in a div. Also does it matter if i put the class in the append() method like you did or could i put it in html/css also?
Last, is it good practice to add tags and classes inside jQuery methods like that? That's the only way that was easiest for me
Chad Kreutzer
@ChadKreutzer
Apr 14 2016 10:00 UTC
@lsrus hmm. So the sound would need to act like my pause and just auto restart.
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:00 UTC
@sjames1958gm well it seems when i add the classes to html/css it doesnt add it with my forEach call
Stephen James
@sjames1958gm
Apr 14 2016 10:00 UTC
@Dueldrawer8 You are using jquery to build the HTML so you have to. The h3 and p in your html should probably not be there. You are adding new h3 / p
@ChadKreutzer Yes!
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:00 UTC
@sjames1958gm alright thanks
CamperBot
@camperbot
Apr 14 2016 10:00 UTC
dueldrawer8 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star: 631 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:02 UTC
@sjames1958gm can you see in my html i have a div tag already with class workspace? So i'm guessing i should create a div tag just like the h3 and p tags in my jquery method?
Chad Kreutzer
@ChadKreutzer
Apr 14 2016 10:03 UTC
@sjames1958gm @lsrus I can do that. Thanks
CamperBot
@camperbot
Apr 14 2016 10:03 UTC
chadkreutzer sends brownie points to @sjames1958gm and @lsrus :sparkles: :thumbsup: :sparkles:
:star: 371 | @lsrus | http://www.freecodecamp.com/lsrus
:star: 632 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
lcthornhill
@lsrus
Apr 14 2016 10:03 UTC
@ChadKreutzer cool
Stephen James
@sjames1958gm
Apr 14 2016 10:04 UTC

@Dueldrawer8 If you want a div for each h3/p pair that you add in the forEach you need to add it in the forEach. What you have now is the following
If you want to style the added stuff you will need to give the h3 and p elements added a class
```

<div>
<h3 id="title"></h3><p></p>
<h3>entry.title0</h3><p>entry.extract0</p>
<h3>entry.title1</h3><p>entry.extract1</p>
. . .
</div>

Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:04 UTC
@sjames1958gm my title and extract have borders but are not combined, is there where i need my div to come in so i can style it like you said?
Stephen James
@sjames1958gm
Apr 14 2016 10:05 UTC
@Dueldrawer8 Yes. Add a div in the forEach, give it a class and style it
Chad Kreutzer
@ChadKreutzer
Apr 14 2016 10:06 UTC
(And no. I'm not planning on a 5 second wait. That was just too make it obvious the pause was working while I debugged.)
Stephen James
@sjames1958gm
Apr 14 2016 10:06 UTC
@ChadKreutzer Makes sense
@sjames1958gm If you make your setInterval time 500 msec it counts down faster and makes it easier to rerun the tests.
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:10 UTC
@sjames1958gm I still need to keep my div with the id in my html in order for the loop to put the html/text onto my page as well right?
Stephen James
@sjames1958gm
Apr 14 2016 10:10 UTC
@Dueldrawer8 Correct.
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:10 UTC
in another words, i have a div inside my jquery, and also a div to contain the text
hmm.. interesting, thanks. I'm learning new things everyday. Some of them I don't know why its like that but they key is i am learning lol
Stephen James
@sjames1958gm
Apr 14 2016 10:12 UTC
@Dueldrawer8 When you get to more advanced topics, you would use a HTML template for your entries, so you could still write it like it is HTML. Here you have to build up the per-entry html in your js.
Here is an example. I am trying to build a clock javascript object for later project, all this html is in my js.
  elem.html(
    '<div class="dr">' +
    '<div class="dc">' +
    '<button class="up"><i id="hour-btn-up-"' + id + '" class="fa fa-arrow-up"></i></button>' +
    '<span id="hour-' + id + '"></span>' +
    '<button class="down"><i id="hour-btn-down-"' + id + '" class="fa fa-arrow-down"></i></button>' +
    '</div>' +
    '<div class="dc">' +
    '<span id="hour-colon" class="colon">:</span>' +
    '</div>' +
    '<div class="dc">' +
    '<button class="up"><i id="ten-min-btn-up-"' + id + '" class="fa fa-arrow-up"></i></button>' +
    '<span id="ten-min-' + id + '"></span>' +
    '<button class="down"><i id="ten-min-btn-down-"' + id + '" class="fa fa-arrow-down"></i></button>' +
    '</div>' +
    '<div class="dc">' +
    '<button class="up"><i id="one-min-btn-up-"' + id + '" class="fa fa-arrow-up"></i></button>' +
    '<span id="one-min-' + id + '"></span>' +
    '<button class="down"><i id="one-min-btn-down-"' + id + '" class="fa fa-arrow-down"></i></button>' +
    '</div>' +
    '<div class="dc">' +
    '<span class="colon">:</span>' +
    '</div>' +
    '<div class="dc">' +
    '<button class="up"><i id="ten-sec-btn-up-"' + id + '" class="fa fa-arrow-up"></i></button>' +
    '<span id="ten-sec-' + id + '"></span>' +
    '<button class="down"><i id="ten-sec-btn-down-"' + id + '" class="fa fa-arrow-down"></i></button>' +
    '</div>' +
    '<div class="dc">' +
    '<button class="up"><i id="one-sec-btn-up-"' + id + '" class="fa fa-arrow-up"></i></button>' +
    '<span id="one-sec-' + id + '" class="one-sec"></span>' +
    '<button class="down"><i id="one-sec-btn-down-"' + id + '" class="fa fa-arrow-down"></i></button>' +
    '</div>' +
    '</div><hr>');
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:14 UTC
@sjames1958gm so in my div inside the each loop.. do i need to adjust margin to "push" together the p and h3 tags?
Stephen James
@sjames1958gm
Apr 14 2016 10:14 UTC
@sjames1958gm See here I need to get to each individual digit, so I had to build an id for each digit from an id variable
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:14 UTC
@sjames1958gm oh wow, thats alot
Stephen James
@sjames1958gm
Apr 14 2016 10:14 UTC
@Dueldrawer8 Its kind of repeated, also I have up and down buttons for setting the time.
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:15 UTC
@sjames1958gm but i see what you mean
Stephen James
@sjames1958gm
Apr 14 2016 10:15 UTC
Yes, I believe reducing the margins. (man that red on blue is hard too look at :) )
Chad Kreutzer
@ChadKreutzer
Apr 14 2016 10:18 UTC
@sjames1958gm what is the benefit of doing it that way, vs. The way I did mine?
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:21 UTC
@sjames1958gm this is as close as i can get with the text.. http://codepen.io/duel_drawer8/pen/wGpmGe
yeah sorry i changed it yellow on black now.. im just worried about functionality for now..
Stephen James
@sjames1958gm
Apr 14 2016 10:22 UTC
@Dueldrawer8 Try margin-top: 0; for the extract and margin-bottom: 0; for the title
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:24 UTC
@sjames1958gm much better, just took out the margin px i had for them
Nazim
@nazimkazim
Apr 14 2016 10:26 UTC
@/All Please experienced coders can you suggest me what is wrong with my code?
http://codepen.io/nazimkazim/pen/PNRzvm
lcthornhill
@lsrus
Apr 14 2016 10:31 UTC
@nazimkazim atm your code only runs once, when the page loads. You need to find a way to make it run when it's needed, in this case when the form is submitted
Stephen James
@sjames1958gm
Apr 14 2016 10:31 UTC
@nazimkazim 1) before you access the HTML in javascript you need to wait for loading - wrap all your javascript with
$(document).ready(function() {
@nazimkazim You need to had a click handler as @lsrus said to only do your ajax after submit.
lcthornhill
@lsrus
Apr 14 2016 10:32 UTC
@sjames1958gm I think in codepen the scripts go at the bottom of the body, so in this case it shouldn't be an issue
Stephen James
@sjames1958gm
Apr 14 2016 10:33 UTC
@lsrus True, but good practice
@nazimkazim The reason you are getting undefined is you are using foundArticle before you are setting it. If you want to test your ajax call, then hard code foundArticle to a search string above the var wikiUrl
lcthornhill
@lsrus
Apr 14 2016 10:34 UTC
@sjames1958gm will have to agree to differ ;-)
Islam Ibakaev
@dagman
Apr 14 2016 10:34 UTC
doing preparations for pomodoro timer zipline. Is it good enough to build on top of it?http://codepen.io/dagman/pen/oxqzLx?editors=0011
Stephen James
@sjames1958gm
Apr 14 2016 10:35 UTC
@dagman Yep.
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:40 UTC
@sjames1958gm should i use hide or remove to take away my results from when i do a new search?
if i hide the elements.. technically they are still there in the html/javascript correct?
so if i do a new search i want them completely gone so i guess its remove?
Geo Galagaran
@geeofree
Apr 14 2016 10:41 UTC
can anyone help me with my Random Code Generator? I'm trying to change the body's background using jquery but it's doing something rather weird..
Stephen James
@sjames1958gm
Apr 14 2016 10:41 UTC
@Dueldrawer8 Remove - Try setting the html on your container div to ""
Nazim
@nazimkazim
Apr 14 2016 10:42 UTC
@sjames1958gm @lsrus Thanks for help!
CamperBot
@camperbot
Apr 14 2016 10:42 UTC
nazimkazim sends brownie points to @sjames1958gm and @lsrus :sparkles: :thumbsup: :sparkles:
:star: 372 | @lsrus | http://www.freecodecamp.com/lsrus
:star: 633 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:43 UTC
@sjames1958gm i already have a id though on that div
or maybe removeClass?
Stephen James
@sjames1958gm
Apr 14 2016 10:44 UTC
@Dueldrawer8 Yes. $("#).html(""); I can't recall the id for that div in the html part
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:44 UTC
ah sorry thought you meant i should set the cont div to an empty string
Stephen James
@sjames1958gm
Apr 14 2016 10:44 UTC
@da7thsin Put your quote gen in a function and call it from document.ready and your handler and you will get an initial quote. Took me while to realize that the button was a button.
Geo Galagaran
@geeofree
Apr 14 2016 10:47 UTC
@sjames1958gm I.. Can't follow. You mean the "Randomizer" function? o_o
Stephen James
@sjames1958gm
Apr 14 2016 10:49 UTC
@da7thsin call doQuote from document.ready and click handler
function doQuote() {
    var getSayings = myQuotes[Randomizer(myQuotes)];
    var quoteHTML = '<h1>"' + getSayings.Quote + '"</h1>';
    var authorHTML = "<h3> -" + getSayings.Author + "</h3>";

    $("#quote").html(quoteHTML);
    $("#author").html(authorHTML);

    $('html').css("background", "red");
    $('body').css("background", "blue");
}
Geo Galagaran
@geeofree
Apr 14 2016 10:53 UTC
@sjames1958gm Done. It didn't do anything for the body background changing part which is what I wanted though..
the code works. I just want to change the backgrounds every click haha. :p
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:55 UTC
@sjames1958gm whats the logic for the remove? when the user searches for a new search, remove the element?
Stephen James
@sjames1958gm
Apr 14 2016 10:55 UTC
@da7thsin Just the quote content $('#quote-content').css("background", "blue");
@da7thsin Whatever selectors in css you used for the initial setting use for the onclick
@Dueldrawer8 You could have a clear button, but you can just do it before your $.ajax or $.getJSON call
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:57 UTC
@sjames1958gm so when i make a new search and the page reloads, it will get rid of the current searches and come up with the new ones if i place it before the .ajax call?
Stephen James
@sjames1958gm
Apr 14 2016 10:58 UTC
@Dueldrawer8 I believe so
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 10:58 UTC
@sjames1958gm hard logic for me to follow there
well..
if i place it inside my dosearch function..
before the call.. it knows im searching for something else so it should remove all those elements i guess
Geo Galagaran
@geeofree
Apr 14 2016 11:00 UTC

@sjames1958gm no no. I want the <body> background to be changed which is why I have this line

$('html').css("background","red");
$('body').css("background","blue");

They're split up for some reason(highlighted them blue and red). I don't know why that body/html element is messed up yow.

Stephen James
@sjames1958gm
Apr 14 2016 11:00 UTC
@Dueldrawer8 The first thing in your doSearch function -
$("#workspace").html("");
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 11:03 UTC
@sjames1958gm ah i see what your saying.. even though i said empty strings i wasnt thinking it would literally empty out all the html/text
@sjames1958gm thanks again
CamperBot
@camperbot
Apr 14 2016 11:03 UTC
dueldrawer8 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star: 635 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Apr 14 2016 11:04 UTC
@Dueldrawer8 Good thing about codePen is you can go back as a reference
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 11:04 UTC
@sjames1958gm what do you mean? back to prevouis code after its been saved?
Stephen James
@sjames1958gm
Apr 14 2016 11:05 UTC
@Dueldrawer8 If you are working on a new project, and want to do something similar you can come back and reference
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 11:05 UTC
ah yes very true
still feel very newbish to this.. you've basically done all the work for me lol
i get it more and know what to do now
but would never have guessed to put remove/empty string before ajax call.. would of taken me probably half an hour after researching
Stephen James
@sjames1958gm
Apr 14 2016 11:08 UTC
@Dueldrawer8 Also, if you knew the $.ajax, might take a long time you could insert html to say "Loading..." in addition to clearing. Then in your ajax callback you would remove that before appending your entries
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 11:08 UTC
i believe the hardest part was finding the correct api call to get what you wanted followed by the each loop
Stephen James
@sjames1958gm
Apr 14 2016 11:08 UTC
@Dueldrawer8 It will take practice reading the json to figure the best way to get the data you need
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 11:09 UTC
@sjames1958gm thats an interesting take
Nazim
@nazimkazim
Apr 14 2016 11:11 UTC
@sjames1958gm please can you give me a hint what is wrong with my submit function? It does not work as it should...
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 11:13 UTC
@sjames1958gm no need for loading since the .ajax call doesnt take long at all though right?
tried it but i cant see loading.. possibly because i havent set the color to other than black
Stephen James
@sjames1958gm
Apr 14 2016 11:13 UTC
@Dueldrawer8 Yeah in this case
@sjames1958gm It probably wont last long enough to see either
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 11:18 UTC
just have to link it to wikipedia which i know how to do and create random page from wiki which is easy as well and then make it look pretty.. probably have to make it responsive also which i find complicated.. only because i havent really put in effort to learn bootstrap
Stephen James
@sjames1958gm
Apr 14 2016 11:19 UTC
@nazimkazim What is happening is that your button is in a form and the form is getting submitted, but to nowhere, this is making the page refresh. You have to tell the system not to submit the form. <button onclick="myFunction(); return false;" id="submit-btn">Submit</button> returning false from the onclick() will accomplish this.
@nazimkazim Maybe a cleaner way is to have myFunction return false and <button onclick="return myFunction();" id="submit-btn">Submit</button>
Nazim
@nazimkazim
Apr 14 2016 11:20 UTC
@sjames1958gm Is it better to use form?
Stephen James
@sjames1958gm
Apr 14 2016 11:21 UTC
@nazimkazim Since you are handling all the behavior there is no reason to use form
Nazim
@nazimkazim
Apr 14 2016 11:21 UTC
@sjames1958gm Ok thanks!
CamperBot
@camperbot
Apr 14 2016 11:21 UTC
nazimkazim sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: nazimkazim already gave sjames1958gm points
Stephen James
@sjames1958gm
Apr 14 2016 11:24 UTC
Well, folks off to my day job. Good luck all.
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 11:24 UTC
@sjames1958gm developer i take it?
@sjames1958gm good luck to you too and thanks for all the help
CamperBot
@camperbot
Apr 14 2016 11:25 UTC
dueldrawer8 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:warning: dueldrawer8 already gave sjames1958gm points
Nazim
@nazimkazim
Apr 14 2016 11:27 UTC
@sjames1958gm When i wrap all my code into $(document).ready(function() {} console.log says myFunction(){} undefined?
Geo Galagaran
@geeofree
Apr 14 2016 11:29 UTC
@nazimkazim maybe your function has an argument and you didn't put anything on it when you invoked it?
Stephen James
@sjames1958gm
Apr 14 2016 11:30 UTC
@nazimkazim Since you are only calling it from HTML you don't need the document.ready -
When you put it in document.ready it goes out of global scope and not available to HTML
Nazim
@nazimkazim
Apr 14 2016 11:32 UTC
@sjames1958gm Ok i appreciate!
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:13 UTC
anyone still on?
Islam Ibakaev
@dagman
Apr 14 2016 12:17 UTC

can anyone explain how to apply

var start = new Date().getTime(),
    elapsed = '0.0';

window.setInterval(function()
{
    var time = new Date().getTime() - start;

    elapsed = Math.floor(time / 100) / 10;
    if(Math.round(elapsed) == elapsed) { elapsed += '.0'; }

    document.title = elapsed;

}, 100);

to mycountdown pen

Ken Haduch
@khaduch
Apr 14 2016 12:21 UTC
@dagman - don't do it! I think that trying to get into date calculations on the Pomodoro clock is really unnecessary. (I am assuming that this is what you are planning to do?) Really, if you are trying to do this for the Pomodoro, I would say to not go that route. A simple countdown with the setInterval() function as your timer is probably all that you need for the that project.
@dagman - there is enough complication in managing the setup for the timer, the control of the timer itself, etc... Date calculations just get nasty (in my opinion...)
Islam Ibakaev
@dagman
Apr 14 2016 12:22 UTC
@khaduch but some guys says to use Date object
Robert Uivarosi
@URobert
Apr 14 2016 12:22 UTC
@dagman i haven't. Timer works fine\
Islam Ibakaev
@dagman
Apr 14 2016 12:23 UTC
@khaduch @URobert very happy to hear it guys :smile:
so what i've done is enough to build on?
Robert Uivarosi
@URobert
Apr 14 2016 12:24 UTC
@dagman bottom line, you don't need date object for that project and you should try to keep it as simple as possible.
@dagman link your pen, I'll take a look
Islam Ibakaev
@dagman
Apr 14 2016 12:25 UTC
@URobert i have added a link
:smile:
Robert Uivarosi
@URobert
Apr 14 2016 12:25 UTC
sorry, haven't seen it
Ken Haduch
@khaduch
Apr 14 2016 12:27 UTC
@dagman - I think that it looks good - you've got one thing that I see many people miss when starting on this - that is stopping the interval timer! So I agree with @URobert - definitely don't get into the complication of using the Date object and trying to do date calculations. You can add complexity to the project in other ways, with the UI design and implementation. The timer part is the simple part - controlling it and generation of the view are the interesting parts...
Robert Uivarosi
@URobert
Apr 14 2016 12:27 UTC
@dagman neat start. Start adding the controls... and play around with manipulating your timer variable and it's display
Islam Ibakaev
@dagman
Apr 14 2016 12:28 UTC
@khaduch @URobert thx for clarifications on topic guys! :smile:
CamperBot
@camperbot
Apr 14 2016 12:28 UTC
dagman sends brownie points to @khaduch and @urobert :sparkles: :thumbsup: :sparkles:
:star: 939 | @khaduch | http://www.freecodecamp.com/khaduch
:star: 795 | @urobert | http://www.freecodecamp.com/urobert
Robert Uivarosi
@URobert
Apr 14 2016 12:28 UTC
@dagman yw
@khaduch , @dagman he did stop the timer... there is an if condition for clear interval :)
@dagman just that you know, you have a way more cleaner approach to start with that what I had at the time. Happy coding ! :+1:
prashant
@findname
Apr 14 2016 12:32 UTC
hey any one how cam shift {commented in code} the login email ,checkbox at center using bootstrap
https://codepen.io/findname/pen/qZPwWX?editors=1100
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:32 UTC
@URobert do you know how to shorten width on my h3 tags? my width extends across the page and its linked to wiki so i can click anywhere within the border
Ken Haduch
@khaduch
Apr 14 2016 12:33 UTC
@URobert - I know that he stopped it - I said that he did do that when I have observed that many did not do it and just let the timer go wild! The next thing to do is to make sure that the timer can only be started once... :) @dagman - that's another common problem. Good work, you're welcome, and good luck!
Islam Ibakaev
@dagman
Apr 14 2016 12:35 UTC
:smile:
i like this community!
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:39 UTC
anyone know how to set width so its only my link tag?
rather than letting people click across the screen and it will go aonther link?
Stephen James
@sjames1958gm
Apr 14 2016 12:44 UTC
@Dueldrawer8 Put your a inside your h3? Rather than h3 inside the a?
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:46 UTC
@sjames1958gm wow.. im so retarded
@sjames1958gm thanks lol
CamperBot
@camperbot
Apr 14 2016 12:46 UTC
dueldrawer8 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star: 636 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:46 UTC
about time for me to hit the sack
CamperBot
@camperbot
Apr 14 2016 12:46 UTC
you need to ask about @someone!
Stephen James
@sjames1958gm
Apr 14 2016 12:46 UTC
@Dueldrawer8 Sleep is calling.
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:46 UTC
almost 8 in the morning and havent been to bed!
Stephen James
@sjames1958gm
Apr 14 2016 12:47 UTC
@Dueldrawer8 Dang -
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:47 UTC
i dont work today.. so its cool
dont have a "professional" yet
job*
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:48 UTC
what do you do @Dueldrawer8 ?
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:48 UTC
i'm a server and student
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:48 UTC
cool! :+1:
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:48 UTC
had an internship set up at a startup.. but they had some internal stuff going on so they pushed it back until summer
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:48 UTC
big up for trying to learn this stuff
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:49 UTC
im actually old, been in school on and off for 10 years
i only have 2 semesters in my major which is econ and math.. and lo and behold i want a comp sci degree
Stephen James
@sjames1958gm
Apr 14 2016 12:49 UTC
@Dueldrawer8 LOL - old :ok_hand:
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:50 UTC
for a programmer that is.. apparently age discrimination happens in the tech world.. avg age is what, 24-25?
I'm 30
or was it 29 or something in the survey
Stephen James
@sjames1958gm
Apr 14 2016 12:50 UTC
@Dueldrawer8 Dang I must be twice the programmer :)
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:51 UTC
@sjames1958gm lol
Stephen James
@sjames1958gm
Apr 14 2016 12:51 UTC
@sjames1958gm I am trying to break that old dog myth :)
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:52 UTC
I'm sure it doesnt matter to much if you have the experience but who knows. probably just happens at the larger companies - facebook, google, apple
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:52 UTC
it doesn't matter
I started programming really late too
Did Art first
Until I was 25 pretty much
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:53 UTC
ah so you must be a natural at web dev
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:53 UTC
no
just lots of hard work
like you
:)
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:54 UTC
i dont really like the css/design side.. but its part of it. I like the programming languages, backend, logic stuff. not that the design side isnt logic
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:54 UTC
design == problem solving
system design == design
Shivam Arora
@shivamarora13
Apr 14 2016 12:54 UTC
One of my function is not running one of its aspect
I don't know why
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:54 UTC
@shivamarora13 whaddayamean
Shivam Arora
@shivamarora13
Apr 14 2016 12:54 UTC
If anyone can help
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 12:55 UTC
lol, alright fellows have a good night.. half my day is gone already.. im going to end up waking up at 2-3pm
Shivam Arora
@shivamarora13
Apr 14 2016 12:55 UTC
see the function arrayPrint() in this pen.
@juliankrispel
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:56 UTC
can you be more specific @shivamarora13 ?
what's arrayPrint supposed to do?
Shivam Arora
@shivamarora13
Apr 14 2016 12:57 UTC
yes, when computers move, are compared to all the winning combinations
if it returns true, game shud stop there only
otherwise it shud run further
function arrayPrint(){
  arrComp.sort();
  console.log(arrComp);
  for(var i=0;i<arrComp.length-2;i++){
    var test = [arrComp[i],arrComp[i+1],arrComp[i+2]];
    for(var j=0;j<winCombs.length;j++){
      console.log(winCombs == test);
    }
  }  
}
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:57 UTC
computers move?
Stephen James
@sjames1958gm
Apr 14 2016 12:58 UTC
@juliankrispel The computer is playing the game
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:58 UTC
ah right
haha
Shivam Arora
@shivamarora13
Apr 14 2016 12:58 UTC
@juliankrispel if u can actually help?
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:59 UTC
I can probably help
Shivam Arora
@shivamarora13
Apr 14 2016 12:59 UTC
test is an array, and winCombs also returns an array
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 12:59 UTC
but you still haven't told me what the problem is
Shivam Arora
@shivamarora13
Apr 14 2016 12:59 UTC
when I print them array of 3 elements is returned,
in one case, even if it is same
it returns false
console.log(winCombs[j]) returns suppose 1,3,7
Zubair Ali
@03aliz
Apr 14 2016 13:00 UTC
Hi guys I'm doing the wikipedia viewer project and I'm not sure why this isn't working, I'm trying to get the input of the user but when I press enter the page refreshed instead of running the code.
Shivam Arora
@shivamarora13
Apr 14 2016 13:00 UTC
and console.log(test) also returns 1,3,7
Zubair Ali
@03aliz
Apr 14 2016 13:00 UTC
$(document).ready(function() {
  function ajaxCall() {
    var textInput = $("#userInput").val();//what user types in search box
    var url = "https://en.wikipedia.org/w/api.php?action=query&list=search&utf8=&format=json&callback=?&srsearch=" +textInput;
    $.getJSON(url, function(data) {
      $(data.query.search).each(function(index, value) {
          $("#x").append(value.title + "<br />") 
      });

    });
  };

});
Shivam Arora
@shivamarora13
Apr 14 2016 13:00 UTC
still test === winCombs[j] returns false
@juliankrispel Now is it clear?
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 13:03 UTC
so arrayPrint loops over all the moves that the computer made and if they contain a winning combination it console.logs true?
(I had to read the code to understand btw)
Shivam Arora
@shivamarora13
Apr 14 2016 13:04 UTC
@juliankrispel yes! hahaha, I am sorry for this. but now can u help?
Stephen James
@sjames1958gm
Apr 14 2016 13:04 UTC
@shivamarora13 Are you trying to compare two arrays with === not sure that will work.
Shivam Arora
@shivamarora13
Apr 14 2016 13:04 UTC
@sjames1958gm I tried with == also
still it doesn't work
Stephen James
@sjames1958gm
Apr 14 2016 13:04 UTC
@shivamarora13 I mean you cannot compare arrays without loop
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 13:05 UTC
you cannot compare arrays full stop
you can compare strings or numbers
and pointers, but that's a different thing
Shivam Arora
@shivamarora13
Apr 14 2016 13:05 UTC
ok..
Stephen James
@sjames1958gm
Apr 14 2016 13:05 UTC
@juliankrispel I knew from "full stop" you had to be UK based :)
Shivam Arora
@shivamarora13
Apr 14 2016 13:06 UTC
@sjames1958gm @juliankrispel So, is there some other way to it?
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 13:06 UTC
haha
Stephen James
@sjames1958gm
Apr 14 2016 13:06 UTC
@shivamarora13 For loop over the arrays
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 13:06 UTC
the easiest way
would be to make a string out of the array
and compare that
Shivam Arora
@shivamarora13
Apr 14 2016 13:06 UTC
ok ok, yes This i can do!
@juliankrispel
got that
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 13:07 UTC
make sure you sort it first
so they're always in the correct order
Shivam Arora
@shivamarora13
Apr 14 2016 13:07 UTC
thanks!!!!!! @juliankrispel @sjames1958gm yes sure! :)
CamperBot
@camperbot
Apr 14 2016 13:07 UTC
shivamarora13 sends brownie points to @juliankrispel and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star: 11 | @juliankrispel | http://www.freecodecamp.com/juliankrispel
:star: 638 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
Julian Krispel-Samsel
@juliankrispel
Apr 14 2016 13:07 UTC
pleasure
Stephen James
@sjames1958gm
Apr 14 2016 13:17 UTC
@shivamarora13 :+1:
Shivam Arora
@shivamarora13
Apr 14 2016 13:20 UTC
help again :(
CamperBot
@camperbot
Apr 14 2016 13:20 UTC
no wiki entry for: again
Shivam Arora
@shivamarora13
Apr 14 2016 13:20 UTC
hahaha
function arrayPrint(){
  arrComp.sort();
  console.log(arrComp);
  console.log(winCombs);
  for(var i=0;i<arrComp.length-2;i++){
    var test = arrComp[i]+arrComp[i+1]+arrComp[i+2];
    for(var j=0;j<winCombs.length;j++){
      if(test == winCombs[j]){
        alert("Computer Won!");
        setTimeout(function(){ reset(); },2000);
      }else if(arrComp.length === 5){
        alert("DRAW");
        setTimeout(function(){ reset(); },2000);
      }
    }
  }  
}
Stephen James
@sjames1958gm
Apr 14 2016 13:21 UTC
This message was deleted
ElvisTheStriker
@ElvisTheStriker
Apr 14 2016 13:21 UTC
Hi Guys, I'm having a problem with the random quote exercise. I can get the quote but cannot get it tweeted. Any help/suggestions would be greatly appreciated. http://codepen.io/ElvisTheStriker/pen/mPXVRp
Shivam Arora
@shivamarora13
Apr 14 2016 13:21 UTC
why in this code, alert isn't running, and before it runs, setTimeout, and page is reloaded
without alert running
Stephen James
@sjames1958gm
Apr 14 2016 13:22 UTC
@shivamarora13 You are still comparing arrays test vs. winCombs[j]
Shivam Arora
@shivamarora13
Apr 14 2016 13:24 UTC
var winCombs = [
  ['123'],
  ['456'],
  ['789'],
  ['147'],
  ['258'],
  ['369'],
  ['159'],
  ['357']
];
test is now a String, see how I have manipulated it
@sjames1958gm
Stephen James
@sjames1958gm
Apr 14 2016 13:25 UTC
@shivamarora13 AAAAH
prashant
@findname
Apr 14 2016 13:25 UTC
can any one tell how can i shift email,pswd,login checkbox button using bootstrap class in this page{commented in the code}https://codepen.io/findname/pen/qZPwWX?editors=1100
Shivam Arora
@shivamarora13
Apr 14 2016 13:26 UTC
@sjames1958gm console.log(test == winCombs[j]);
this is returning true but
Greg Duncan
@GregatGit
Apr 14 2016 13:31 UTC
@findname I would have a look at this template to help you along http://www.w3schools.com/bootstrap/bootstrap_scrollspy.asp
ElvisTheStriker
@ElvisTheStriker
Apr 14 2016 13:32 UTC
Hi Guys, I'm having a problem with the random quote exercise. I can get the quote but cannot get it tweeted. Any help/suggestions would be greatly appreciated. http://codepen.io/ElvisTheStriker/pen/mPXVRp
Stephen James
@sjames1958gm
Apr 14 2016 13:36 UTC
@shivamarora13 Sorry - boss in the building - I will have go.
prashant
@findname
Apr 14 2016 13:37 UTC
@GregatGit i eant to shift it at center col-xsoffset isn't working
Greg Duncan
@GregatGit
Apr 14 2016 13:40 UTC
what line is that on?
Paul Borawski
@iAmNawa
Apr 14 2016 13:49 UTC
@findname col-xs-offset ?
prashant
@findname
Apr 14 2016 13:50 UTC
yes
Islam Ibakaev
@dagman
Apr 14 2016 14:46 UTC
hey guys why doesn't it stops on second click? http://codepen.io/dagman/pen/oxqzLx?editors=1011
Clem
@ctataru
Apr 14 2016 14:53 UTC
hey everyone. quick question. how come the buttons here don't line up inside the box? it's like they're ignoring the padding values.
http://codepen.io/wise/pen/redjRo
Coira Ellison
@Coira
Apr 14 2016 14:55 UTC
@dagman ah, a few things. first i think instead of this line pause = pause === true ? false : true; you need pause = !pause
second, logic needs reworking a bit. every time you click the timer you start a new setInterval. so even when you click to pause it, it starts a new one (and stops the old one)
you probably need a bool somewhere saying, "if intervalID isn't set, start setInterval"
Josh Bivens
@joshbivens
Apr 14 2016 14:57 UTC
@dagman I can't figure it out. Intervals are a bane. You could change your pause to pause = !pause; instead of pause = pause === true ? false : true; however.
Oh I didn't see @Coira 's reply
Coira Ellison
@Coira
Apr 14 2016 14:58 UTC
we posted practically the same time :)
Josh Bivens
@joshbivens
Apr 14 2016 14:58 UTC
haha
Coira Ellison
@Coira
Apr 14 2016 14:58 UTC
or something like "if setInterval isn't running, start a new one"
Islam Ibakaev
@dagman
Apr 14 2016 14:59 UTC
@Coira @joshbivens how can i check "if intervalID isn't set, start setInterval"
Coira Ellison
@Coira
Apr 14 2016 14:59 UTC
check if intervalID is null or undefined, then when you clearInterval, set intervalID to null
or you could use a bool, like you have with pause
in fact, you could probably just use pause... you know that when pause is true, setInterval isn't running, and therefore intervalID isn't set
Josh Bivens
@joshbivens
Apr 14 2016 15:04 UTC
I have a quick question about the wikipedia thing if anyone can help
Ah! Never mind I got it ;)
Leigh
@LBCDWB
Apr 14 2016 15:21 UTC
I can't figure out how to get a border around the image. It has to include the caption below but I have not yet gotten to that part - just trying to get the border! https://codepen.io/LBCDWB/pen/pyaYbd
Celestial
@celestialz
Apr 14 2016 15:24 UTC
@LBCDWB I am looking at your code hold up
ehekatlOf
@ehekatlOf
Apr 14 2016 15:27 UTC
did they mention when the react and sass tutorials will be up yet?
Leigh
@LBCDWB
Apr 14 2016 15:30 UTC
@celestialz Thanks - I hope it's not too confusing!
Celestial
@celestialz
Apr 14 2016 15:31 UTC
@LBCDWB I will do the same type of site but use more modern conventions of layout to show you :) because you shouldnt be using b tags for bolding and be using padding to make something center on the page
@LBCDWB but dont worry because when I was super new I made the same mistakes
Leigh
@LBCDWB
Apr 14 2016 15:32 UTC
OK. I am obviously new at this!
Celestial
@celestialz
Apr 14 2016 15:34 UTC
@LBCDWB there are shortcuts for getting a border on an element :) and since an image is an inline element you have to make it display block to add a border to it and then you would use something like img { border: 1px solid black;}
Leigh
@LBCDWB
Apr 14 2016 15:35 UTC
OK. I will keep track of these comments and then try to implement! First, make the image a display block.
Juwdohr
@Juwdohr
Apr 14 2016 15:37 UTC
Hey not sure why but when my portfolio is expanded the links disappear that I have. While it is collapsed they show up? any help?
http://codepen.io/Jarvis-327/pen/vGdMRW/
Clem
@ctataru
Apr 14 2016 15:37 UTC
i'd like to make the output bar at the top of my calculator be a fixed size. because now, if i add a value inside of it, the dimensions change completely. how would i go about doing that? i'm not sure what to google:
http://codepen.io/wise/pen/redjRo
Jeff
@adzam5
Apr 14 2016 15:37 UTC
@LBCDWB Since you are using Bootstrap, you may be able to get the look you are looking for with their thumbnail and caption classes
Leigh
@LBCDWB
Apr 14 2016 15:39 UTC
@celestialz @adzam5 - thank you! I was not using bootstrap intentionally :smile: Oh my - I have a lot to figure out here.
CamperBot
@camperbot
Apr 14 2016 15:39 UTC
lbcdwb sends brownie points to @celestialz and @adzam5 :sparkles: :thumbsup: :sparkles:
:star: 27 | @celestialz | http://www.freecodecamp.com/celestialz
:star: 412 | @adzam5 | http://www.freecodecamp.com/adzam5
Celestial
@celestialz
Apr 14 2016 15:43 UTC
@LBCDWB I am working on my implementation of your site and you can spot the differences
Juwdohr
@Juwdohr
Apr 14 2016 15:51 UTC
This message was deleted
mjs2430
@mjs2430
Apr 14 2016 15:54 UTC
Hi all, can anyone help me figure out why my "tweet quote" button places the <p> tag in the tweet when it opens up a new twitter window? http://s.codepen.io/mjs2430/debug/bpvBwP
Dylan
@dhcodes
Apr 14 2016 16:09 UTC
@mjs2430 because the JSON called quote has one
@mjs2430 you might be able to remove it by converting it to a textNode first or using Regex
@ctataru the buttons don't seem to add anything right now. To answer your question, I used an input box that was read-only and then each button added itself to the input box value with concatenation but there are many ways to do it
@ctataru to set a fixed with you can reference your box with CSS and add width: 200px; or width: 50%; or width: 5vw;
@ctataru you'll also probably want to limit the number of characters as otherwise they will essentially run off the display regarding of your fixed-width
mjs2430
@mjs2430
Apr 14 2016 16:18 UTC
@dhcodes okay thanks! i'll look into it!
CamperBot
@camperbot
Apr 14 2016 16:18 UTC
mjs2430 sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star: 626 | @dhcodes | http://www.freecodecamp.com/dhcodes
Celestial
@celestialz
Apr 14 2016 16:29 UTC
@LBCDWB dont use align="center" for modern css - I have only used that statement in html emails that are like a really old style of laying out web pages for outlook etc.
Dominic Lobban
@alkapwn3d
Apr 14 2016 16:39 UTC
Why isn't my logo fading in when uploaded to server?
http://codepen.io/alkapwn3d/pen/GZxXyM?editors=1000
Evan Davis
@davisec52
Apr 14 2016 16:47 UTC
@alkapwn3d Hi. It does fade in for me, though very fast. I also noticed that you have not enabled jquery on your pen.
Dylan
@dhcodes
Apr 14 2016 16:48 UTC
@alkapwn3d fades for me!
Dominic Lobban
@alkapwn3d
Apr 14 2016 16:48 UTC
it fade in my pen but when i upload to server it doesnt work
Dylan
@dhcodes
Apr 14 2016 16:49 UTC
@alkapwn3d you mean you took your code from codepen and put it on a site and it doesn't work? You likely need to call Jquery in the HTML head
did you do that?
@alkapwn3d nvm, seems like you did
Evan Davis
@davisec52
Apr 14 2016 16:49 UTC
@alkapwn3d are you calling jquery or have you installed it in a file on your server?
Dominic Lobban
@alkapwn3d
Apr 14 2016 16:54 UTC
i was using a cdn link then I downloaded it and saved to a folder called js
thats my server link
doesnt jade in
fade*
Michael Karpinski
@karpimpski
Apr 14 2016 16:58 UTC
can anybody explain why some of my streamers don't show "Offline" when they're offline? http://codepen.io/karpimpski/pen/NNYwKN
Clem
@ctataru
Apr 14 2016 17:03 UTC
@dhcodes thank you!!
CamperBot
@camperbot
Apr 14 2016 17:03 UTC
ctataru sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star: 629 | @dhcodes | http://www.freecodecamp.com/dhcodes
Dylan
@dhcodes
Apr 14 2016 17:04 UTC
@alkapwn3d looks like you have it as a stylesheet link instead of a script
in your HTML header
Dominic Lobban
@alkapwn3d
Apr 14 2016 17:06 UTC
@dhcodes oh good catch. thx
CamperBot
@camperbot
Apr 14 2016 17:06 UTC
alkapwn3d sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star: 630 | @dhcodes | http://www.freecodecamp.com/dhcodes
Dylan
@dhcodes
Apr 14 2016 17:06 UTC
@karpimpski you are getting their status and game, I think you just need to get their game because they can have a status I believe while still being offline
welcome @alkapwn3d
Michael Karpinski
@karpimpski
Apr 14 2016 17:09 UTC
@dhcodes I have the statuses in an if else statement that says if they're offline it will display "offline." if they're not it will display their game: their status
if(offline){
          status = "Offline";
          offline = false;
        }
        else{
          status = json.game + ": " + json.status;
Dylan
@dhcodes
Apr 14 2016 17:10 UTC
@karpimpski ah, I didn't look closely enough
Michael Karpinski
@karpimpski
Apr 14 2016 17:12 UTC
@dhcodes do you know what I did wrong?
Stephen James
@sjames1958gm
Apr 14 2016 17:14 UTC
@karpimpski I am seeing offline
Dylan
@dhcodes
Apr 14 2016 17:14 UTC
@karpimpski I'm looking
Michael Karpinski
@karpimpski
Apr 14 2016 17:14 UTC
@sjames1958gm certain people are offline, yeah. but other channels that should display "offline," like FreeCodeCamp, aren't
Dylan
@dhcodes
Apr 14 2016 17:15 UTC
@karpimpski but your if statement says to still get their info if they are offline
Michael Karpinski
@karpimpski
Apr 14 2016 17:15 UTC
@dhcodes only the channel URL, name, and image source
Dylan
@dhcodes
Apr 14 2016 17:15 UTC
i think
if you read your if statement it says "if true, status is offline", but then makes offline false thereby running the else statement.
at least that's how I read it
I have to go unfortunately. Maybe @sjames1958gm can find something
Michael Karpinski
@karpimpski
Apr 14 2016 17:17 UTC
@dhcodes got rid of that but I have the same problem still. I think with if statements, even if you change the condition to meet the else statement, it won't run it because by default, it won't run the else if it runs the if
@dhcodes saw that with my other "offline" people that worked. it didn't run the else statement in their cases
Dylan
@dhcodes
Apr 14 2016 17:18 UTC
I'm not sure if that's true or not. Interesting thing to look up though. I do know that on my twitch project I had a problem with calls running before they were ready (async vs sync)
mk
sorry I can't help more
gotta run
Stephen James
@sjames1958gm
Apr 14 2016 17:18 UTC
@karpimpski You have a single global for offline - not per user
Dylan
@dhcodes
Apr 14 2016 17:18 UTC
Good luck
Michael Karpinski
@karpimpski
Apr 14 2016 17:18 UTC
@sjames1958gm that shouldn't be a problem because I update it with every user
Stephen James
@sjames1958gm
Apr 14 2016 17:19 UTC
@karpimpski Also, you are calling two $.ajax in parallel and expect the data from one asynchronous task to align with the other. You need to either call your channel $.ajax in your streams callback or vice versa
Michael Karpinski
@karpimpski
Apr 14 2016 17:20 UTC
@sjames1958gm how do I call a stream callback?
@sjames1958gm and I don't try to access data from the other ajax call in either one. I do that once, but I make a global variable from it so that shouldn't be a problem
Stephen James
@sjames1958gm
Apr 14 2016 17:21 UTC
@karpimpski
// Change your for loop
for (var i = 0; i < users.length; i++) {
  ajax(users[i]);
}
// change this functions parameters
function channel(user, offline) { .. }
// add this call in the callback from the ajax function
      channel(user, offline);
@karpimpski Change your for loop to invoke the data you need first - add offline status to your channel function and call your channel function from you first ajax callback
You are sending 20 ajax requests (twice per user) and expecting them to come back in a specific order - "streams first to set offline" channel second to use offline
Michael Karpinski
@karpimpski
Apr 14 2016 17:27 UTC
@sjames1958gm I tried to do what you said, but now it's even more broken
Stephen James
@sjames1958gm
Apr 14 2016 17:29 UTC
@karpimpski channel(user, offline) goes inside your callback you have it too low - this is the chaining of the ajax calls
@karpimpski put it just after
      if (json.stream == null) {
        offline = true;
      }
@karpimpski Also you have at the bottom channel(ajax[i]); -> ajax(users[i]);
@karpimpski With this code you launch 10 ajax streams requests and as each comes back you launch 1 per channel requests.
Michael Karpinski
@karpimpski
Apr 14 2016 17:30 UTC
@sjames1958gm yeah, I fixed that last bit before. it works now, thank you! now, I have 2 more questions if you can help
CamperBot
@camperbot
Apr 14 2016 17:30 UTC
karpimpski sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star: 639 | @sjames1958gm | http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Apr 14 2016 17:31 UTC
@karpimpski Shoot
Michael Karpinski
@karpimpski
Apr 14 2016 17:31 UTC
I don't know how I would sort them so that online users are on top, and offline users are on bottom. also, I think I can figure this out, but I'm not sure how I would assign them colors. I'm assuming I would just give them a class, but I'm not sure how I would assign it since JQuery requires an ID for the command I know
Stephen James
@sjames1958gm
Apr 14 2016 17:32 UTC
@karpimpski You can assign them all a class in your html method.
Michael Karpinski
@karpimpski
Apr 14 2016 17:33 UTC
@sjames1958gm oh, I'm dumb. just if offline is false, I assign them a certain class. then if else, I assign them another. I wasn't really thinking there
what about sorting the online users to the top?
Stephen James
@sjames1958gm
Apr 14 2016 17:35 UTC
@karpimpski An option for sorting would be to place the response data into an array (as an object {status: "", html: "" }). And counting the channel responses when the channel responses are complete - sort that array based on the status in the object then loop over the array and insert the html
Michael Karpinski
@karpimpski
Apr 14 2016 17:35 UTC
@sjames1958gm I'll try that soon, but I'm sure that's out of my league
Stephen James
@sjames1958gm
Apr 14 2016 17:36 UTC
@karpimpski :+1:
Mehrdad Karami
@metao1
Apr 14 2016 17:47 UTC
Hello World!
CamperBot
@camperbot
Apr 14 2016 17:47 UTC

welcome to FreeCodeCamp @metao1!

Mehrdad Karami
@metao1
Apr 14 2016 17:49 UTC
I have question with my Voter ProgressBar https://codepen.io/metao/pen/ZWxryO I don't know why when one progress value get's very low, the span goes off the div
ajaybti
@ajaybti
Apr 14 2016 18:11 UTC
http://codepen.io/ajaybti/pen/vGdPQK?editors=1111 in this json element not showing on console..please help me
Stephen James
@sjames1958gm
Apr 14 2016 18:18 UTC
@ajaybti 1) you are getting a cross -origin error in the browser console (press F12 on chrome to see) - add &callback=? to your request URL (research jsonp) 2) Since you have your input in a form it is trying to submit the form causing the page to refresh, return false; from your click handler to stop the refresh 3) You have a ")" after your url in your $.getJSON call this needs to be after your callback function.
  $("button").click(function() {
    var search = $("#search").val();
    console.log(search);

    $.getJSON("https://en.wikipedia.org/w/api.php?action=opensearch&callback=?&search=" + search + "",
      function(data) {
        console.log(JSON.stringify(data[2][0]));
      });
  return false;
  });
Islam Ibakaev
@dagman
Apr 14 2016 18:22 UTC
i m doing pomodoro timer and this what i did so far. So what u think about my animation?
http://codepen.io/dagman/pen/oxqzLx?editors=0110
ZctrapCoding
@ZctrapCoding
Apr 14 2016 18:26 UTC
@dagman lol i was just about to say that you copied @dagman
Islam Ibakaev
@dagman
Apr 14 2016 18:27 UTC
@ZctrapCoding :smile: 2 hours killed to add this animation
@ZctrapCoding figuring out how to do
ZctrapCoding
@ZctrapCoding
Apr 14 2016 18:29 UTC
@dagman really it works for me ! what was i going to say... i forgot
Islam Ibakaev
@dagman
Apr 14 2016 18:31 UTC
@ZctrapCoding i havent seen poeple build their pomodoro timers this way so i decided to try this stuff
Leigh
@LBCDWB
Apr 14 2016 18:32 UTC
@celestialz Thanks for your help - I just got back to my computer and found your code. I have so much to learn!
CamperBot
@camperbot
Apr 14 2016 18:32 UTC
lbcdwb sends brownie points to @celestialz :sparkles: :thumbsup: :sparkles:
:star: 28 | @celestialz | http://www.freecodecamp.com/celestialz
ZctrapCoding
@ZctrapCoding
Apr 14 2016 18:34 UTC
@dagman cool being original, im not on that yet though and now ill be stuck in my mind!
Stephen James
@sjames1958gm
Apr 14 2016 18:46 UTC
@dagman Nice - here is where I am with mine (the buttons should (but not yet :) hide when running ) http://codepen.io/silgarth/pen/ONQZpZ
Islam Ibakaev
@dagman
Apr 14 2016 18:57 UTC
@sjames1958gm it looks you have a lot of html stuff in js (looks like u emulate React approuch) :smile:
Stephen James
@sjames1958gm
Apr 14 2016 18:58 UTC
@dagman Tried to encapsulate my clock in a class - I can create three of them bam bam bam
@dagman Had not really created any js classes (here using the prototype method)
Islam Ibakaev
@dagman
Apr 14 2016 19:01 UTC
@sjames1958gm a lot of work ahead to do like me with my clock
ghnana
@ghnana
Apr 14 2016 19:01 UTC
Hi guys as am learning and digging deep into bootstrap. I came along platform called webflow. it sparked my interest to speed my frontend development since my aim is to freelance here and there. However I am not sure if this is a good practice or not. What do you guys suggest or advice. Thank you!
ZctrapCoding
@ZctrapCoding
Apr 14 2016 19:03 UTC
@ghnana well i have no experience but ill go check it out
@ghnana my first look isnt so great. It just looks like a website that lets someone just click and drag on elements that you may want, but it does say that it lets you create your own code which you may want after you get some code down in your brain
which lets you just start doing some cool things with no instructions
ZctrapCoding
@ZctrapCoding
Apr 14 2016 19:08 UTC
ill check further
ghnana
@ghnana
Apr 14 2016 19:11 UTC
@ZctrapCoding well, something like that I believe. Just discovered it so taking baby steps myself. Enlighten me later on what your thoughts are later. You can private message me
ZctrapCoding
@ZctrapCoding
Apr 14 2016 19:12 UTC
@ghnana well you cant use your own code unless you upgrade with money...
ghnana
@ghnana
Apr 14 2016 19:14 UTC
@ZctrapCoding i guess that's the catch
Paul Borawski
@iAmNawa
Apr 14 2016 19:19 UTC
Do ya like dags? @dagman
ZctrapCoding
@ZctrapCoding
Apr 14 2016 19:22 UTC
@ghnana yup
Islam Ibakaev
@dagman
Apr 14 2016 19:24 UTC
@iAmNawa dogs not dags :worried:
Marc Vincent Ong
@marcvincentong
Apr 14 2016 19:27 UTC
Can't seem to understand the build a random quote project even after viewing the project's code
Especially JS part
PK
@arcticfries
Apr 14 2016 19:38 UTC
Ok.. I am at building the tribute page and don't know how to get started without looking up the example! Lol.. any suggestions or inspiration on how to get started?
does it matter if we have to start with <div> or <h1> etc?
I have seen some really nice ones and I am like.. whooh.. I don't even know how to do those kinds:(... How do you get started with it?
Dustin
@Key-Banger
Apr 14 2016 20:01 UTC
@arcticfries You can start wherever you would like. I would recommend start using bootstrap and go from there. Just write some code and watch it change.
@marcvincentong I had an array of quotes and then just got a random number between 0 and number of quotes. and returned array[randomNumber]
Miguel Valente
@miguelfvalente
Apr 14 2016 20:18 UTC
The for loop isn't working properly (or at least not as I wanted it to work)
Frank XC
@tenkdayz
Apr 14 2016 20:26 UTC
@miguelfvalente none of them are online.. add this one to the array DreamhackCS
Miguel Valente
@miguelfvalente
Apr 14 2016 20:27 UTC
But the for loop renders the same channel always....that's the real problem
Robert Friedman
@robfr77
Apr 14 2016 20:29 UTC
i want to use jquery to insert json data dynamically, eg use a loop to insert the data without having to manually enter it each time. i can use the loop to increment the sub array i am accessing the data from but how can i do auto traversal with jquery? like start at the first child of a parent, and then for each loop, go to the next child? any help?
Frank XC
@tenkdayz
Apr 14 2016 20:29 UTC
@miguelfvalente you should use forEach instead of a forloop
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 20:32 UTC
@robfr77 i agree with @tenkdayz
i mean @miguelfvalente
Robert Friedman
@robfr77
Apr 14 2016 20:43 UTC
is there a way to use a jquery selector to loop through all the children elements of a parent
Frank XC
@tenkdayz
Apr 14 2016 20:45 UTC
@robfr77 use "#elem.nth-child("+i+")"
bentongarrett
@bentongarrett
Apr 14 2016 20:47 UTC
could someone take a look at my weather app? it works fine on a computer, but nothing shows up on mobile: http://codepen.io/bentongarrett/pen/yOPaBy?editors=1010
Dardan Demiri
@dardandemiri
Apr 14 2016 20:49 UTC
Have you added the jQuery here on codepen
@bentongarrett
bentongarrett
@bentongarrett
Apr 14 2016 20:50 UTC
@dardandemiri, i'm not sure what you mean
Dardan Demiri
@dardandemiri
Apr 14 2016 20:51 UTC
I have checked it for you
and it's fine
bentongarrett
@bentongarrett
Apr 14 2016 20:51 UTC
@dardandemiri, it worked for you on a mobile device?
Frank XC
@tenkdayz
Apr 14 2016 20:52 UTC
@bentongarrett might be a setting you disabled in your phone
bentongarrett
@bentongarrett
Apr 14 2016 20:53 UTC
i've tried it on a bunch of different devices with crossbrowsertesting.com as well as my own and it doesn't seem to work
Andrew Charlebois
@andrewchar
Apr 14 2016 20:53 UTC
hey campers. i would like to show my portfolio version 2.0 i just finished it this morning. constructive criticism is welcomed http://andrewchar.github.io/portfolio/
Dardan Demiri
@dardandemiri
Apr 14 2016 20:54 UTC
@andrewchar wooooww
it Looks Amazing !
I love it !
All what I would change is the buttons
Send button
bentongarrett
@bentongarrett
Apr 14 2016 20:55 UTC
@tenkdayz, doy---got it working. full location services was not enabled on my phone and crossbrowsertesting doesn't seem to have that feature at all
@tenkdayz @dardandemiri thanks
CamperBot
@camperbot
Apr 14 2016 20:55 UTC
bentongarrett sends brownie points to @tenkdayz and @dardandemiri :sparkles: :thumbsup: :sparkles:
:star: 389 | @tenkdayz | http://www.freecodecamp.com/tenkdayz
:star: 306 | @dardandemiri | http://www.freecodecamp.com/dardandemiri
Dardan Demiri
@dardandemiri
Apr 14 2016 20:55 UTC
is a little small
Andrew Charlebois
@andrewchar
Apr 14 2016 20:55 UTC
@dardandemiri to small?
Dardan Demiri
@dardandemiri
Apr 14 2016 20:55 UTC
perhaps you should make more padding
Andrew Charlebois
@andrewchar
Apr 14 2016 20:55 UTC
like width?
Dardan Demiri
@dardandemiri
Apr 14 2016 20:55 UTC
width and height
Andrew Charlebois
@andrewchar
Apr 14 2016 20:56 UTC
i believe ive got 4px padding. lemme check it out
Dardan Demiri
@dardandemiri
Apr 14 2016 20:56 UTC
And the other one: Download my Resume too
Andrew Charlebois
@andrewchar
Apr 14 2016 20:58 UTC
padding for that one?
Frank XC
@tenkdayz
Apr 14 2016 20:58 UTC
@andrewchar nice! dont see anything wrong with it.. looks like you put a lot of work on it.
Andrew Charlebois
@andrewchar
Apr 14 2016 20:58 UTC
also, i tried to make it as responsive as i could, check it out!
Dardan Demiri
@dardandemiri
Apr 14 2016 20:58 UTC
.tools-used-list li {
    background-color: #3498db;
    color: #fff;
    padding: 5px 15px 9px;
    margin: 0 0 5px 5px;
    border-radius: 10px;
}
copy the padding and see what I mean
Veronika Krukovich
@VKrukovich
Apr 14 2016 20:59 UTC
Clip2net_160414235443.png
what is wrong here?
Dardan Demiri
@dardandemiri
Apr 14 2016 21:00 UTC
And add this
.footer-btn {

    padding: 8px 20px 12px;

}
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:01 UTC
how do i make my button go to the right of this textbox?
Frank XC
@tenkdayz
Apr 14 2016 21:01 UTC
@VKrukovich after the case matches you have to set answer = "alpha" "beta" and so on
Dardan Demiri
@dardandemiri
Apr 14 2016 21:02 UTC
Put the button and the input in one div
@Dueldrawer8
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:03 UTC
@dardandemiri they are
Andrew Charlebois
@andrewchar
Apr 14 2016 21:03 UTC
@dardandemiri good call that looks much better, thanks!
CamperBot
@camperbot
Apr 14 2016 21:03 UTC
andrewchar sends brownie points to @dardandemiri :sparkles: :thumbsup: :sparkles:
Frank XC
@tenkdayz
Apr 14 2016 21:03 UTC
@Dueldrawer8 it is to the right.
CamperBot
@camperbot
Apr 14 2016 21:03 UTC
:star: 307 | @dardandemiri | http://www.freecodecamp.com/dardandemiri
Dardan Demiri
@dardandemiri
Apr 14 2016 21:03 UTC
add row class after center
Andrew Charlebois
@andrewchar
Apr 14 2016 21:04 UTC
row class after center?
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:04 UTC
@dardandemiri yeah
Andrew Charlebois
@andrewchar
Apr 14 2016 21:04 UTC
oh your not talking to me lol
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:05 UTC
@tenkdayz in the picture it is, i changed the button to bootstrap and its below the text boxx
Dardan Demiri
@dardandemiri
Apr 14 2016 21:05 UTC
hahaha @andrewchar yes I was helping @Dueldrawer8
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:05 UTC
its still below the text box
<div id='center' class='row'>
    <input type="textbox" id="text" placeholder="Search Wikipedia">
    <input type="button" id="button" class="btn btn-primary" value="Search">
  </div>
Dardan Demiri
@dardandemiri
Apr 14 2016 21:06 UTC
<div class="row center">
    <input type="textbox" id="text" placeholder="Search Wikipedia">
    <input type="button" id="button" class="btn btn-primary" value="Search">
  </div>
Try this
@andrewchar Have you uploaded it online ?
the changes ?
Andrew Charlebois
@andrewchar
Apr 14 2016 21:07 UTC
doing that now
Dardan Demiri
@dardandemiri
Apr 14 2016 21:07 UTC
Okey tell me when it's done
Andrew Charlebois
@andrewchar
Apr 14 2016 21:09 UTC
@dardandemiri everytime i make a change i need to rebase master and push to gh-pages. kind of annoying
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:09 UTC
@dardandemiri i just deleted the width in css and its to the right of the button but now it doesnt center anymore
im terrible at css
Veronika Krukovich
@VKrukovich
Apr 14 2016 21:09 UTC
@tenkdayz like this? case 1:
answer='alpha';
break
Andrew Charlebois
@andrewchar
Apr 14 2016 21:10 UTC
@dardandemiri its live
Frank XC
@tenkdayz
Apr 14 2016 21:10 UTC
@VKrukovich yes.. then return answer at the end.
John Sevilla
@jsevilla274
Apr 14 2016 21:10 UTC
out of curiosity what is the functional purpose of "placeholder" attributes?
Andrew Charlebois
@andrewchar
Apr 14 2016 21:10 UTC
@jsevilla274 for text box?
John Sevilla
@jsevilla274
Apr 14 2016 21:11 UTC
yeah like for instance that textbox
Andrew Charlebois
@andrewchar
Apr 14 2016 21:11 UTC
@jsevilla274 so the user knows what its for
Dardan Demiri
@dardandemiri
Apr 14 2016 21:11 UTC
@andrewchar I don't see the changes
Andrew Charlebois
@andrewchar
Apr 14 2016 21:11 UTC
@jsevilla274 instead of writing something above the box or something. can just do placeholder to text appears inside the box
John Sevilla
@jsevilla274
Apr 14 2016 21:12 UTC
ohh that is the grayed out text that appears before input
thanks @andrewchar i forgot
CamperBot
@camperbot
Apr 14 2016 21:12 UTC
jsevilla274 sends brownie points to @andrewchar :sparkles: :thumbsup: :sparkles:
:star: 403 | @andrewchar | http://www.freecodecamp.com/andrewchar
Andrew Charlebois
@andrewchar
Apr 14 2016 21:12 UTC
@dardandemiri the button padding?
Dardan Demiri
@dardandemiri
Apr 14 2016 21:13 UTC
yes
Andrew Charlebois
@andrewchar
Apr 14 2016 21:13 UTC
i see it on my end
and git showing both master and gh-pages are even with the fix
Dardan Demiri
@dardandemiri
Apr 14 2016 21:13 UTC
Oh yeah
it's there
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:13 UTC
@dardandemiri whats the difference between text-align: center, and using margin auto to center something?
Andrew Charlebois
@andrewchar
Apr 14 2016 21:13 UTC
look better? i think so
Dardan Demiri
@dardandemiri
Apr 14 2016 21:13 UTC
Yes it looks amazing
It would be nice if you add more padding to the tools used
and a little padding to the textarea
padding: 6px 12px;
Veronika Krukovich
@VKrukovich
Apr 14 2016 21:15 UTC
@tenkdayz ok i have understood, i made so but it write me mistake missing semicilon, but i have semicolons(((
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:15 UTC
@dardandemiri are you talking to me?
Frank XC
@tenkdayz
Apr 14 2016 21:15 UTC
@VKrukovich semicolon after break... like break;
Dardan Demiri
@dardandemiri
Apr 14 2016 21:16 UTC
Yes @Dueldrawer8
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:17 UTC
@dardandemiri thanks
CamperBot
@camperbot
Apr 14 2016 21:17 UTC
dueldrawer8 sends brownie points to @dardandemiri :sparkles: :thumbsup: :sparkles:
:star: 308 | @dardandemiri | http://www.freecodecamp.com/dardandemiri
Dardan Demiri
@dardandemiri
Apr 14 2016 21:17 UTC

text-align:center aligns the content of element to center.

margin: auto aligns the element

Veronika Krukovich
@VKrukovich
Apr 14 2016 21:18 UTC
Clip2net_160415001549.png
@tenkdayz ahahahaah i have break;
Dardan Demiri
@dardandemiri
Apr 14 2016 21:18 UTC
@Dueldrawer8
You should be careful with margin:auto because it is not supported in IE6. In IE6, you should set text-align:center on the outer container, and reset the CSS for the container itself to text-align:left.
John Sevilla
@jsevilla274
Apr 14 2016 21:18 UTC
why are some of your breaks var
and some without semicolons
breaks are not vars and they require semicolons at the end
Frank XC
@tenkdayz
Apr 14 2016 21:19 UTC
@VKrukovich on all of them.. an take the var before the other breaks...
@VKrukovich you need the switch(val){} part
Andrew Charlebois
@andrewchar
Apr 14 2016 21:20 UTC
@dardandemiri what os and browser are you using
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:21 UTC
@dardandemiri ill try that
Dardan Demiri
@dardandemiri
Apr 14 2016 21:22 UTC
Win 10 and Chrome
Veronika Krukovich
@VKrukovich
Apr 14 2016 21:22 UTC
@tenkdayz thanks it works!) @jsevilla274
CamperBot
@camperbot
Apr 14 2016 21:22 UTC
vkrukovich sends brownie points to @tenkdayz and @jsevilla274 :sparkles: :thumbsup: :sparkles:
:star: 285 | @jsevilla274 | http://www.freecodecamp.com/jsevilla274
:star: 390 | @tenkdayz | http://www.freecodecamp.com/tenkdayz
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:26 UTC
@dardandemiri how do i stretch out the bootstrap button?
width right?
John Sevilla
@jsevilla274
Apr 14 2016 21:27 UTC
@Dueldrawer8 you can make a bootstrap button stretch to the width of the parents element using the .btn-block class as well
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:28 UTC
@jsevilla274 thanks, i dont want it to be the same size as my textbox though, just bigger enough so its easier on the eyes
CamperBot
@camperbot
Apr 14 2016 21:28 UTC
dueldrawer8 sends brownie points to @jsevilla274 :sparkles: :thumbsup: :sparkles:
:star: 287 | @jsevilla274 | http://www.freecodecamp.com/jsevilla274
Dardan Demiri
@dardandemiri
Apr 14 2016 21:28 UTC
just make the width:200px;
@Dueldrawer8
or more
wonsi
@wonsi
Apr 14 2016 21:32 UTC
Could someone take a look at this pen in Chrome and let me know if it says Loading... or actually gives the weather and location? http://codepen.io/CorneliusMooseknuckle/pen/BKJXME
John Sevilla
@jsevilla274
Apr 14 2016 21:32 UTC
it gives me weather @wonsi
if i were you, i'd edit the slider so that the cursor that appears is pointer instead of the text cursor. simple css would be .your-button {cursor: pointer;} @wonsi
wonsi
@wonsi
Apr 14 2016 21:34 UTC
@jsevilla274 Thanks. It works for me in Firefox, but for some reason it just says loading in Chrome. I've cleared the cache restarted and made sure permissions were set to allow codepen my location.
CamperBot
@camperbot
Apr 14 2016 21:34 UTC
wonsi sends brownie points to @jsevilla274 :sparkles: :thumbsup: :sparkles:
:star: 288 | @jsevilla274 | http://www.freecodecamp.com/jsevilla274
John Sevilla
@jsevilla274
Apr 14 2016 21:35 UTC
chrome here so it works fine on my end
wonsi
@wonsi
Apr 14 2016 21:35 UTC
It did this to me last week and I thought I had the problem solved. Guess I'll just work on it in firefox
Alex Dobre
@Zerelt
Apr 14 2016 21:46 UTC
guys do you know of any plugins or something to make a horizontally scrollable(with invisible scrollbar) menubar that's like the google mobile menubar (like ... if you search for something using your mobile you can see that menubar ) .. i tried 2 days ago to make a custom one but it's a real pain Q.Q
Andrew Perrin
@Pezz18
Apr 14 2016 21:49 UTC
hi, can someone help me with the positioning of a couple of buttons??
John Sevilla
@jsevilla274
Apr 14 2016 21:50 UTC
what's the problem @Pezz18
here is my pen
i am trying to align the offline / online buttons inline with the Twitch TV heading.... so leaving the heading centered, but placing the buttons - as they appear now just to the right of the heading text...
John Sevilla
@jsevilla274
Apr 14 2016 21:54 UTC
so im fiddling with it a little, have you tried making you btn class display: inline-block, then placing the buttons withtin the h1 tag?
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:54 UTC
question, my wiki links link directly to the wiki articles, how do i create a back button kind if they want to do another search?
Andrew Perrin
@Pezz18
Apr 14 2016 21:55 UTC
@jsevilla274 not tried, but i can give it a go...
rocng
@rocng
Apr 14 2016 21:55 UTC
@Pezz18 try making the heading display: inline-block and then putting the buttons together in another div and setting that div to inline-block as well
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 21:56 UTC
nvm it goes back
Tyler Moeller
@TylerMoeller
Apr 14 2016 21:57 UTC

@Pezz18 You'll need to take your heading out of the h1 and apply styling you want or set H1 to display: inline

h1 {
  display: inline;
}

or

    <div class="row">Twitch TV Streaming
      <button type="button" class="btn">Online</button>
      <button type="button" class="btn">Offline</button>
    </div>
For both examples, .btn needs display:inline
Andrew Perrin
@Pezz18
Apr 14 2016 22:00 UTC
thanks for your help guys, the suggestions are kind of working,,, but the centering of the heading is moving too,,, but ive had a thought around putting the heading in one column and the buttons in another...
Randy Goldsmith
@Dueldrawer8
Apr 14 2016 22:19 UTC
is there a way to make rounded corners in earlier internet explorer versions?
Michael Karpinski
@karpimpski
Apr 14 2016 22:25 UTC
http://codepen.io/karpimpski/pen/ONvBKJ how can I make this background fit smaller screens?
Kevin Gil Soriano
@kevin0317
Apr 14 2016 22:33 UTC
try changing background-image property to background and add no-repeat center center fixed @karpimpski
Michael Karpinski
@karpimpski
Apr 14 2016 22:34 UTC
@kevin0317 how do I add the no-repeat center center fixed? sorry, I'm just not sure which properties to assign those
Ghost
@ghost~564bf69916b6c7089cbb1fef
Apr 14 2016 22:35 UTC
Fellas I'm trying to make this look like a bit less of a mess http://s.codepen.io/AndrewGHC/debug/mPXjKr - feedback very welcome
Kevin Gil Soriano
@kevin0317
Apr 14 2016 22:35 UTC
like this
Michael Karpinski
@karpimpski
Apr 14 2016 22:36 UTC
@kevin0317 that works great, thanks so much!
CamperBot
@camperbot
Apr 14 2016 22:36 UTC
karpimpski sends brownie points to @kevin0317 :sparkles: :thumbsup: :sparkles:
:star: 445 | @kevin0317 | http://www.freecodecamp.com/kevin0317
Michael Karpinski
@karpimpski
Apr 14 2016 22:36 UTC
@AndrewGHC can't help, but just wanted to say that's great! what project is this?
Ghost
@ghost~564bf69916b6c7089cbb1fef
Apr 14 2016 22:41 UTC
@karpimpski D3 Force Graph
On the github page they said they're looking for a new one as the old one was based on camper news and is now deprecated, so I've put a bit more effort in and I'll submit it as an alternative
This message was deleted
CamperBot
@camperbot
Apr 14 2016 22:41 UTC
sorry andrewghc, you can't send brownie points to yourself! :sparkles: :sparkles:
Ghost
@ghost~564bf69916b6c7089cbb1fef
Apr 14 2016 22:41 UTC
@karpimpski and thanks
Michael Karpinski
@karpimpski
Apr 14 2016 22:56 UTC
how can I make my input field have no background so that it fits my background image?
Kevin Gil Soriano
@kevin0317
Apr 14 2016 22:57 UTC
opacity bro @karpimpski
Michael Karpinski
@karpimpski
Apr 14 2016 22:57 UTC
opacity: 100%?
Kevin Gil Soriano
@kevin0317
Apr 14 2016 22:57 UTC
nah like .5 or something
Michael Karpinski
@karpimpski
Apr 14 2016 22:59 UTC
@kevin0317 I'm trying to make an input field that just has a line on the bottom where I can type my input, with the background completely showing. with this, it dimmens the line on bottom of my input and it dimmens my input. do you know how I could do it so that only the background is see-through?
Jason Fliegel
@JasonF1
Apr 14 2016 23:01 UTC
Anybody know enough about the setInterval() method to help me with an issue I'm experiencing with my Pomodoro Clock?
Stephen James
@sjames1958gm
Apr 14 2016 23:01 UTC
@JasonF1 Possibly
Jason Fliegel
@JasonF1
Apr 14 2016 23:02 UTC
@sjames1958gm So the issue is in the tick() function
@sjames1958gm Basically, when the clock reaches zero, some other functions switch from the work timer to the break timer. Then it resets the time variables (hourVal, minVal, and secondVal) and calls tick() -- which starts at line 125
When I get to the tick() function, hourVal, minVal, and secVal are exactly what they should be based on what the break timer is set to.

But then I call this:
countdown = setInterval(function() {
console.log("Inside tick: " + hourVal + " " + minVal + " " + secondVal);
display();
deductSecond();

}, 1000);

and the hourVal, minVal, and secondVal are set to 0:59:59, which is basically counting backward from 0 since my code wraps around minutes and seconds.

But if I pause the clock and unpause it, it works properly (i.e. resets the countdown to the start of the break period).
Michael Karpinski
@karpimpski
Apr 14 2016 23:05 UTC
@kevin0317 got it, thanks for trying to help!
CamperBot
@camperbot
Apr 14 2016 23:05 UTC
karpimpski sends brownie points to @kevin0317 :sparkles: :thumbsup: :sparkles:
:warning: karpimpski already gave kevin0317 points
Jason Fliegel
@JasonF1
Apr 14 2016 23:06 UTC
@sjames1958gm Actually, strike that last part -- pausing and unpausing the clock doesn't reset the timer (it was doing that before, but I squashed that bug).
Stephen James
@sjames1958gm
Apr 14 2016 23:06 UTC
@JasonF1 Do you have a link so I can look?
Jason Fliegel
@JasonF1
Apr 14 2016 23:06 UTC
Stephen James
@sjames1958gm
Apr 14 2016 23:07 UTC
@JasonF1 Are you stopping the other setInterval?
Jason Fliegel
@JasonF1
Apr 14 2016 23:09 UTC
Yes -- the workflow is there's a checkDone() function at line 48. When that gets called, it executes some code to switch a flag from work to break (or vice versa), executes
clearInterval(countdown);
and then runs startup(), which in turn runs tick(), which is where the setInterval() call is.
@sjames1958gm if you check the console, you can see console.log statements that show the values of hour/min/secVal as we flow through tick(), display(), checkDone(), and startup().
Stephen James
@sjames1958gm
Apr 14 2016 23:15 UTC
@JasonF1 Weird, everything looks right up until the "Inside tick: 0 59 59"
Jason Fliegel
@JasonF1
Apr 14 2016 23:16 UTC
@sjames1958gm That's exactly what I thought too! I was thinking maybe I just don't understand how setInterval() works.
Thanks for looking anyway.
At least it's evidence that whatever problem I'm hitting is an especially tricky one. ;)
Jordi Vilagut Treserra
@jordivilagut
Apr 14 2016 23:20 UTC
Hi guys, trouble with SHOW LOCAL WEATHER
I can't use the API provided
I signed up because i got the error 401 and then I got the APPID
but I don't know how to use the APPID on the API call
anyone could help? thanks :)
Stephen James
@sjames1958gm
Apr 14 2016 23:21 UTC
@JasonF1 In checkDone I replaced startup with setTimeout(startup, 0); and it is working
Jason Fliegel
@JasonF1
Apr 14 2016 23:22 UTC
@bcnjordi9 You need to make sure you've got the right format for your API call.
John Sevilla
@jsevilla274
Apr 14 2016 23:22 UTC
Stephen James
@sjames1958gm
Apr 14 2016 23:23 UTC
@JasonF1 When you unwind your checkDone you are setting the times to 59 59 in deduct min and deduct sec
Jordi Vilagut Treserra
@jordivilagut
Apr 14 2016 23:24 UTC