These are chat archives for FreeCodeCamp/Help

18th
Jan 2015
Dominic Jones
@towwiow
Jan 18 2015 00:09
anybody around to help me with the codeschool developer tools challenge?
Maxim Orlov
@Maximization
Jan 18 2015 00:09
go ahead
Dominic Jones
@towwiow
Jan 18 2015 00:10
Just started and I'm on the 1.2 Updating Styles part.. the very last one, can't seem to figure it out.
"Add a CSS declaration of "text-decoration: underline" for the ":hover" state of all events, then force the hover state on our "Run 5k" event to see how the new CSS declaration take effect."
I'm currently on the ul id"events" where I believe I should be and added the text-decoration but can't seem to find the right place where I am to add this style
Maxim Orlov
@Maximization
Jan 18 2015 00:11
can you post a link
Maxim Orlov
@Maximization
Jan 18 2015 00:20
can you paste the code which you have so far
Dominic Jones
@towwiow
Jan 18 2015 00:25
i'm using the dev tool in chromium on my ubuntu laptop
all the code is already there.
Maxim Orlov
@Maximization
Jan 18 2015 00:26
the part you've added
Dominic Jones
@towwiow
Jan 18 2015 00:26
it's exactly how it shows. "text-decoration: underline:
underline" **
Maxim Orlov
@Maximization
Jan 18 2015 00:27
under which class?
Dominic Jones
@towwiow
Jan 18 2015 00:27
it's just in the element.styles space... should i have put it in the ul#events space?
ul#events
Maxim Orlov
@Maximization
Jan 18 2015 00:27
do you specify anywhere that it should be effective under the hover state?
Dominic Jones
@towwiow
Jan 18 2015 00:27
it says hover state for all events
I don't know where to
Maxim Orlov
@Maximization
Jan 18 2015 00:28
ok, you have a line of code which you need to add for all the events under the hover state
Dominic Jones
@towwiow
Jan 18 2015 00:29
i'm not sure where you add things to under the hover state
Maxim Orlov
@Maximization
Jan 18 2015 00:29
look up the class all events have in common, specify the code to apply while hovering and add your line
same place as everywhere else
general form is .<class>:hover
Dominic Jones
@towwiow
Jan 18 2015 00:29
I understand you click the hover state activator
Maxim Orlov
@Maximization
Jan 18 2015 00:30
small plus sign top right corner, add new style rule
Dominic Jones
@towwiow
Jan 18 2015 00:30
right right
got that part.
but where to add the line, still don't know
what's confusing me is the ":hover state of all events" part
makes no sense to me and it's not registering what they're really asking me to do here
Maxim Orlov
@Maximization
Jan 18 2015 00:32
what they mean is you need to specify the hover state for the class that all events have in common
now which class is that
Dominic Jones
@towwiow
Jan 18 2015 00:34
I know what class it is. it's the events class, but I don't see that anywhere in the styles part of the console
I have the ul id="events" class="events" part highlighted and that's the code i'm looking at on the styles to the right hand side.. is this what I should be looking at?
Suzanne Atkinson
@AdventureBear
Jan 18 2015 00:35
hey guys, I'm doing a weather API tutorial using javascript and having trouble with the code.
here is the pen:
the error I am getting is "uncaught type error: cannot read property 'toFixed' of undefined" roundTemperature (anonymous function).
this is the tutorial
Maxim Orlov
@Maximization
Jan 18 2015 00:36
the class .events is attached to the grouping element <ul>
Suzanne Atkinson
@AdventureBear
Jan 18 2015 00:36
and this is the working example
Maxim Orlov
@Maximization
Jan 18 2015 00:36
you need to look for the class inside <li>
Nathan
@terakilobyte
Jan 18 2015 00:37
Suzanne, in your example you have a console error
Suzanne Atkinson
@AdventureBear
Jan 18 2015 00:37
right.
Nathan
@terakilobyte
Jan 18 2015 00:37
have you investigated it with the debugger?
Suzanne Atkinson
@AdventureBear
Jan 18 2015 00:37
I'm trying to do that. I guess I don't know how that works.
I'm tryign to debug by looking at it. :)
learn the debugger
time spent now will save you more time later
Suzanne Atkinson
@AdventureBear
Jan 18 2015 00:38
lol. Hmm...OK. after dinner project.
your'e right
Nathan
@terakilobyte
Jan 18 2015 00:38
it was instrumental in me getting bonfire working
had I just looked around I'd still be wondering why it wasn't working :)
Suzanne Atkinson
@AdventureBear
Jan 18 2015 00:39
ok
:)
Maxim Orlov
@Maximization
Jan 18 2015 00:40
@AdventureBear I can't find the toFixed method in your code
Dominic Jones
@towwiow
Jan 18 2015 00:45
sorry guys - ubuntu just had an internal error and screens went black on me.
had to do a quick boot.
Suzanne Atkinson
@AdventureBear
Jan 18 2015 00:47
function roundTemperature
2nd function
@Maximization
Dominic Jones
@towwiow
Jan 18 2015 00:48
-.-'
hate when I refresh the page or leave and come back to a challenge after being stuck and get it right away
Maxim Orlov
@Maximization
Jan 18 2015 00:49
@AdventureBear you're calling .toFixed(2) on temperature, where does .toFixed come from?
ah it's a built in function, my bad let me consult the api
Maxim Orlov
@Maximization
Jan 18 2015 01:01
@AdventureBear ahh I see, toFixed() returns a string, you need to parse it to a number
Dominic Jones
@towwiow
Jan 18 2015 01:05
I was just going to ask @terakilobyte if you suggested running through the discover-devtools.codeschool.com and the google chrome tutorials together?
Suzanne Atkinson
@AdventureBear
Jan 18 2015 01:35
@maximization, that confused me and the tutorial skipped right over it but I found the code in the working source
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:06
so i'm in debugger @terakilobyte
an when it pauses on that error
I can hover over each variable.
weatherData.temperatureValue is = 0, and I can evaluate the expression in the console: (weatherData.temperatureValue - 32) * 5 / 9
which is -17.777778
in the console I type the function calll roundTemperature(-17.777778) and I get back a string "-17.78"
so the number to string typing doesn't seem to be an issue.
Maybe I shoudl comment this out and move forward since it's not vital to the exercise...but it'd be nice to know what's going on
For anyone new to discussion: http://codepen.io/AdventureBear/pen/PwmoMd
Nathan
@terakilobyte
Jan 18 2015 03:08
it looks like it's calling a method on something that doesn'thave that method
look in the api and find that method
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:09
It thnk toFixed is a javascript method. so temperature goes in as a number value, and does that variable have the method .toFixed is that what I'm trying to sort out?
so this method should be available on any number ??
hmm. so I commneted out the toFixed call and just had roundTemperature return temperature (so it returned hte same value that it was passed) and it still gives me an undefined. So maybe no number comes back from the weather API call!
Ben Clist
@BenClist
Jan 18 2015 03:15
try parseInt to make sure it's sending it as a number?
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:19
Hmm. I'm in the debugger right now and I set a breakpoint on the http request call
Nathan
@terakilobyte
Jan 18 2015 03:21
sorry answering questions about bonfire
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:22
no worries. I'm sitting here playing
cool stuff!!!
Nathan
@terakilobyte
Jan 18 2015 03:22
that's what I've been building suzanne :)
well, integrating
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:22
@BenClist thanks...it looks like ti is a number that's being returned...still playing.
@terakilobyte too much fun!!
response.weather.temperature
5.412
typeof response.weather.temperature
"number"
yay, debugger tool.
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:29
fixed!!
 var weatherTemperature = roundTemperature(response.weather.Temperature);
Dominic Jones
@towwiow
Jan 18 2015 03:29
awesome! glad you got through it @AdventureBear
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:30
See that capital "T" ?
that was the problem...too many cases of camelCase. I remember typing this line in 3 times as I copioed the tutorial. Looks to me like similar naming of variables (weatherTemperature) and (weather.temperature) is not a good practice!
thanks @towwiow
so...now I have just formed my first opinion about javascript. A sign of no longer being a beginner according to a great video someone posted the other day.
Dominic Jones
@towwiow
Jan 18 2015 03:31
linkage
Dominic Jones
@towwiow
Jan 18 2015 03:33
lol, what about the video link you're talking about
and you just replicated it via the tutorial you found? no changes?
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:38
I got it to work...had to look at the source code of the "functioning" example of the tutorial, to find the missing function (roundTemperature), then had to debug the error I introduced. I call that a good start.
Dominic Jones
@towwiow
Jan 18 2015 03:39
fantastic. you're doing great :) making a lot of progress
Nathan
@terakilobyte
Jan 18 2015 03:39
that's a damn good start
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:39
I'm actually a little dissapointed that the meat of hte tutorial is an API mashup he already wrote which converts the IP to lat/long...that seems to be a cool thing to know.
I'm having fun. My boyfriend wants to know why the same picture keeps coming up, so that will be my first mod!
what pictures come up for you guys? Somethign cool?
Dominic Jones
@towwiow
Jan 18 2015 03:40
same pic. the blue sky and clouds towards the bottom
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:41
yes, but is it a palce near you that you recognize? Mine comes up as University of PItt campus, and earlier tonight I must have had a different IP connection, and the photo was an aweosme balck and white of the local amusement park (kennywood)
Ben Clist
@BenClist
Jan 18 2015 03:43
Gives me a picture of a plane taken at the Art Deco Festival that my city holds every year
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:43
That sounds cool
Ben Clist
@BenClist
Jan 18 2015 03:43
it does change on a ctrl+f5 refresh
got a really nice sunset shot of the Ahuriri Estuary :)
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:44
Is there a way I can "force" an IP address via browser plugin to see different pictures?
like some tool to fake a different location, aside from a VPN?
@BenClist so you're in new zealand?
Ben Clist
@BenClist
Jan 18 2015 03:45
could use something like hola, you can only choose a country though
Suzanne Atkinson
@AdventureBear
Jan 18 2015 03:45
(googled it)
Ben Clist
@BenClist
Jan 18 2015 03:45
I am yes :)
Dominic Jones
@towwiow
Jan 18 2015 03:47
I'm still getting Jacobus. I'm not even getting my location if that's what it's supposed to do. Not sure
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:21
try it now!!!
Nathan
@terakilobyte
Jan 18 2015 04:22
good stuff
is it associated imagery from google earth?
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:23
flickr
Nathan
@terakilobyte
Jan 18 2015 04:23
integrate google earth images :)
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:23
it gets a weather tag, and pulls from nearby flickr photos with a matching tag
Nathan
@terakilobyte
Jan 18 2015 04:23
ah
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:23
the tutorial just loaded hte first phot
photo
and I just added randomized photos from the returned results.
Nathan
@terakilobyte
Jan 18 2015 04:24
good job
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:24
I'll check out google images tomorrow (or monday)
thanks!
little by little I'm accumulating enough to be dangerouse.
dangerous
Nathan
@terakilobyte
Jan 18 2015 04:25
the world isn't ready for dangerouse adventurebears
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:25
haha. dangerouse adventurebears have outstayed their welcome in many friends homes...
Nathan
@terakilobyte
Jan 18 2015 04:28
is there any correlation to drunk adventurebears when that happens?
I'm too honest when drunk and apparently offend people when they ask me questions they didn't really want the answer to
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:30
disinhibition...
AdventureBear is actually very disinhibited, even without alcohol.
Nathan
@terakilobyte
Jan 18 2015 04:31
I also apparently am able to climb to normally impossible to reach areas
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:31
he's a small mascot that travels with me and goes on...well...adventures.
hahah
Nathan
@terakilobyte
Jan 18 2015 04:31
that there's no smooth dismount from
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:31
well the two of you should meet.
he had a total hip disarticulation in a climbing accident many years ago...probabaly from the same thing
Nathan
@terakilobyte
Jan 18 2015 04:32
I somehow got on top of one of the bronco statues in front of bronco stadium while drunk
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:32
OMG
you are one of those...
haha
Nathan
@terakilobyte
Jan 18 2015 04:32
"Because it's there"
just saying
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:34
of course
so how many beers did that take ?
Nathan
@terakilobyte
Jan 18 2015 04:34
a lot
warmed up with jack daniels
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:39
that, um.., helps.
Evan Davis
@davisec52
Jan 18 2015 04:41
Say, question. This code is evaluating to false for the input given, and I don't understand why. I'm hoping someone can take a look at the regex and spot any errors, or anything else that might be off.

function pat(str) {
    var pattern = /^[^\d]\=?(\+)+[a-zA-Z][^\d](\+)+$/g;
    if(pattern.test(str)) {
        return true;
        }
        else
        {
            return false;
        }
    }
pat("=+a+=");
Yay, Jack Daniels, by the way!
one of those
and I fell off onto one of those rocks
I believe that exercise only wants +\w+ no?
there's a way to write a regex for it
but, there's a much much simpler method
Evan Davis
@davisec52
Jan 18 2015 04:47
Right, but the string also must allow the = sign with no other chars.
I think so, too, but now that I've started down this path I'd like to at least know why the regex does not seem to work. I don't see the error.
I think it would be much easier to make everything relative to the index of the string's characters. But, I'd like to see this regex mess through.
Suzanne Atkinson
@AdventureBear
Jan 18 2015 04:49
if that images is tagged with a weather tag, maybe it will show up when you use my new app. :)
Nathan
@terakilobyte
Jan 18 2015 04:51
well
for one
using the start of line and end of line doens't make sense to me if you are also using the global flag
if I may make a recommendation
Evan Davis
@davisec52
Jan 18 2015 04:52
Removing global doesn't seem to make any difference.
Nathan
@terakilobyte
Jan 18 2015 04:52
is amazing for visualizing your regex
Ben Clist
@BenClist
Jan 18 2015 04:53
wow, that's much better than regexr.com
Nathan
@terakilobyte
Jan 18 2015 04:53
I use it when I'm making my regex
I try to share the link when I have reason
Evan Davis
@davisec52
Jan 18 2015 04:54
I've been playing musical regex testers.
Ben Clist
@BenClist
Jan 18 2015 04:54
I've always used regexr but I like love the explanation box on that one
Nathan
@terakilobyte
Jan 18 2015 04:54
yeah
it does a very good job of telling you exactly what the regex is doing
James McShane
@jmcshane
Jan 18 2015 05:01
ive got regex 101 up constantly at work, its the best thing thing to use
Ryan Malm
@Rybar
Jan 18 2015 06:15
I like that it supports multiple flavors of regex, I hadn't seen this one before. You holding out on me Nathan?
Nathan
@terakilobyte
Jan 18 2015 12:28
@Rybar I actually mention it every time I stream
imo it's one of those tools everyone should have
Scott Mac Donald
@Corinos
Jan 18 2015 14:22
Hey, anyone recently done the Code School #3, Working with the DOM?
I'm getting a red error bar at the top when I submit my answer, even if I copy the correct one from the hints...
Bah, nevermind. I had some strange extra code that was added when I turned on the slides or something.
Scott Mac Donald
@Corinos
Jan 18 2015 15:45
Can anyone give me a plain explanation of this line of code in Code School 3.15? It's not covered in the slides... $(this).append(message).find('button').remove();
Nathan
@terakilobyte
Jan 18 2015 15:54
it looks like it's adding a message to a dom element and removing a button
Scott Mac Donald
@Corinos
Jan 18 2015 16:17
Right, but if you walk through it step by step, something like, "This thing (that just got clicked a minute ago), put message into it, find a button in it and remove that button'?
Ammar Ali Shah
@AmmarAliShah
Jan 18 2015 16:20
It means find the thing, display the message and then get rid of the button
That message has some connection with that button in a way that when it is displayed, the button is useless hence us .removing it
Dominic Jones
@towwiow
Jan 18 2015 16:50
great explanation @AmmarAliShah
Ammar Ali Shah
@AmmarAliShah
Jan 18 2015 16:53
@towwiow thanks
Christopher Hutchinson
@cshutchinson
Jan 18 2015 17:38
in a codeschool.com exercises it state that you can test your code by Using your own browser console to test a few inputs (as in Chrome dev tools console)
in the console I can't exactly cut and paste multiple lines of code... do I try to execute the .js file directly from the console?
Nathan
@terakilobyte
Jan 18 2015 17:41
to get a new line without submission in your console it's shift+enter
just like typing multi line stuffs in gitter
Christopher Hutchinson
@cshutchinson
Jan 18 2015 17:42
ty @terakilobyte you always bail me out :)
Nathan
@terakilobyte
Jan 18 2015 17:42
my goal as a counselor :)
Christopher Hutchinson
@cshutchinson
Jan 18 2015 17:42
trying to finish up closures oh my god.....
Nathan
@terakilobyte
Jan 18 2015 17:42
super important
read up on them in Eloquent Javascript as well
higher order functions I believe the chapter is called
they are backbone to node
Christopher Hutchinson
@cshutchinson
Jan 18 2015 17:43
ty, let me see if I can get this console to work; glad I stopped to do all of codeschool.com javasript before node.js
Mark Howard
@iheartkode
Jan 18 2015 17:43
closure is a function inside a function that inner function gets access to all scopes going up
Julie Myers
@BlueOceanView
Jan 18 2015 17:44
closures are much easier to understand with examples.
Mark Howard
@iheartkode
Jan 18 2015 17:44
Indeed
Julie Myers
@BlueOceanView
Jan 18 2015 17:45
My understanding is that the heart of why closures are so cool is that when you run a function and it ends the javaScript engine will then dispose of the function and everything inside of it; thus the program no longer has access to it. A closure, however, keeps that function accessible even after it has finished; thus garbage collection never happens.
Christopher Hutchinson
@cshutchinson
Jan 18 2015 17:45
got it working @terakilobyte ty
Mark Howard
@iheartkode
Jan 18 2015 17:46
function closure() {
  var test = 1;  // the inclosed function has access to the function and global scope
      function  another() {
      }
}
you call for a variable it checks the inclosed function then the global function then global
It's pretty neat
Took me sometime to wrap my head around it
Christopher Hutchinson
@cshutchinson
Jan 18 2015 18:01
function makeTargetAssigner( sharks, targets ){

  return function(shark){
    for (var i=0; i<sharks.length; i++){
      if (sharks[i] == shark){
         alert("What up, " + shark + "!\n" +
              "There've been " + targets[i] + " sightings in our 'hood!\n" +
              "Time for a swim-by lasering, homie!");
      }
    }
  };

}
var listOfSharks = ["Sea Pain", "Great Wheezy",
                    "DJ Chewie", "Lil' Bitey",
                    "Finmaster Flex", "Swim Khalifa",
                    "Ice Teeth", "The Notorious J.A.W."];
var listOfTargets = ["icicle bat", "snow yeti",
                     "killer penguin", "frost tiger",
                     "polar bear", "iceberg",
                     "blue witch", "wooly mammoth"];

var getTargetFor = makeTargetAssigner(listOfSharks, listOfTargets );
getTargetFor("Ice Teeth");
it worked finally thank you guys!
Mark Howard
@iheartkode
Jan 18 2015 18:04
lil bitey lol
Where are is this from?
Christopher Hutchinson
@cshutchinson
Jan 18 2015 18:06
codeschool.com full javascript course level 3
i saw i needed help before I could finish challenge 34... and since 35 is at codeschool anyway, I figured why not do it...
Mark Howard
@iheartkode
Jan 18 2015 18:09
Nice
Dominic Jones
@towwiow
Jan 18 2015 20:43
need a little help with the very first http://www.freecodecamp.com/jquery-exercises
we're supposed to be calling the .attr(); in the console right?
Nathan
@terakilobyte
Jan 18 2015 20:55
yes
Dominic Jones
@towwiow
Jan 18 2015 20:55
it's just supposed to be .attr(#next-challenge); right ?
or am I missing something
Nathan
@terakilobyte
Jan 18 2015 20:55
nope
you need to first get the element you want to modify the attr of
so something like $('#element').attr(something, somethingElse);
Dominic Jones
@towwiow
Jan 18 2015 20:56
so it should be $("#next-challenge").attr(false);
Nathan
@terakilobyte
Jan 18 2015 20:56
not quite
Dominic Jones
@towwiow
Jan 18 2015 20:56
the console accepts jquery though?
Nathan
@terakilobyte
Jan 18 2015 20:56
what attr is false?
yes the console runs jquery
Dominic Jones
@towwiow
Jan 18 2015 20:56
didn't know that. thought it only took console commands
uhm..
Nathan
@terakilobyte
Jan 18 2015 20:57
it can access any script the page loaded
head to the jquery site and read up on the .attr() method
it takes two arguments
Dominic Jones
@towwiow
Jan 18 2015 20:57
I read that before coming over.
to ask for help
Nathan
@terakilobyte
Jan 18 2015 20:59
$('#next-exercise').attr(whichattr, whichstate);
Dominic Jones
@towwiow
Jan 18 2015 20:59
If I want to change the javascript in the console, I should look in the .js files to find it to try and find that other attribute i need to change right?
Nathan
@terakilobyte
Jan 18 2015 20:59
no
you can execute it as a console command
Dominic Jones
@towwiow
Jan 18 2015 20:59
right
Nathan
@terakilobyte
Jan 18 2015 20:59
in your console type $('next-exercise')
Dominic Jones
@towwiow
Jan 18 2015 20:59
but to find out whichattr, whichstate
Nathan
@terakilobyte
Jan 18 2015 20:59
on that page
it'll actually fetch it as an object you can inspect in the console
Dominic Jones
@towwiow
Jan 18 2015 21:00
ahh..
Nathan
@terakilobyte
Jan 18 2015 21:00
so just type your jquery right in the console
Dominic Jones
@towwiow
Jan 18 2015 21:00
see .. no prior knowledge of this tool is making me feel stupid again.
thanks
Dominic Jones
@towwiow
Jan 18 2015 21:11
@terakilobyte - I've tried $("#next-exercise").attr("disabled", "false"); and I've cycled the false to "off" and "no" as I see there are the only few expressions you can use. Also have tried enable. all to no avail. What am I doing wrong now?
Nathan
@terakilobyte
Jan 18 2015 21:12
'false' is a string
false is a boolean
$('#next-exercise').attr('disabled', false);
Dominic Jones
@towwiow
Jan 18 2015 21:28
thanks @terakilobyte
Nathan
@terakilobyte
Jan 18 2015 21:29
np
get it working?
Dominic Jones
@towwiow
Jan 18 2015 21:43
v.v' yeah
gotta stop being so hard on myself, dig in and look harder