These are chat archives for FreeCodeCamp/Help

9th
Jan 2015
James McShane
@jmcshane
Jan 09 2015 00:12
I feel like this question should get addressed more fully. The three letter acronym of API gets thrown around a lot and isn't often explained. An API is the contract of a codebase. The method signatures identify the valid sets of input and the output type that will arise. When one codebase is opened for others to use, the API communicates with the outside users the manners in which it's functionality can be accessed. This is often paired with API documentation, and it should be, documenting how the code carries out this function identified in the contract.
Nathan
@terakilobyte
Jan 09 2015 00:13
@jmcshane excellent summation
cerissa
@cerissa
Jan 09 2015 01:16
@jmcshane thank you i was a little confused still
Jessi L Wasell
@JessiW
Jan 09 2015 01:21
Hi - I am working on the Free Code Camp Challenge 7 Dash CSS Robot - I was just coming in here to ask another question about my code but when I went back to copy it - my whole code was gone in Dash for the CSS Robot. Thankfully, I have a copy of most of it elsewhere on my computer so I'll be able to get it back. My sister had the same experience on an earlier challenge in Dash and I just wondered why that's happening and if there's anything we can do to fix it?
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:22
what browser are you using?
Jessi L Wasell
@JessiW
Jan 09 2015 01:23
I'm using Google Chrome - not sure what my sister was using at the time.
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:23
what do you mean "went back to it" are you using tabbed browsing?
Jessi L Wasell
@JessiW
Jan 09 2015 01:24
Yes - I have the chat room open on one tab and Dash open in another so I could ask my question. I went back to the browser tab in Dash and my code was gone.
The robot is still there functioning properly, but there's no code!
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:24
oh, well, that seems to be a problem with either hte browser or their site
try refreshing and see if it clears it up
Jessi L Wasell
@JessiW
Jan 09 2015 01:26
okay - I'll try the refresh - I do have a copy of most of it still on my computer (not in Dash) so it will be fine! Once I have my code back I'll come back and ask my original question!!! :)
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:26
alright, let us know how it went
Jessi L Wasell
@JessiW
Jan 09 2015 01:27
Thanks - refresh didn't bring any of my code back - I'll be back in a little bit hopefully!
John Sanchez
@john8801
Jan 09 2015 01:38
I need help!
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:39
whats up @john8801
John Sanchez
@john8801
Jan 09 2015 01:40
I am having a problem with one of the coderbytes...
The challange is:
Using the JavaScript language, have the function ArrayAdditionI(arr) take the array of numbers stored in arr and return the string true if any combination of numbers in the array can be added up to equal the largest number in the array, otherwise return the string false. For example: if arr contains [4, 6, 23, 10, 1, 3] the output should return true because 4 + 6 + 10 + 3 = 23. The array will not be empty, will not contain all the same elements, and may contain negative numbers.
ArrayAdditionI
I have the largest number stored in a variable, but I'm stumped when it comes to iterating over all of the possible combinations
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:44
calling the cavalry for you @john8801 :)
John Sanchez
@john8801
Jan 09 2015 01:44
thx :)
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:45
sure, I have osme ideas, but I'm by no means a pro at those coderbytes and I would likely just confuse it all up more
John Sanchez
@john8801
Jan 09 2015 01:45
np
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:46
ok if you have time, it looks like the other counselors are in and out right now, where are you located?
John Sanchez
@john8801
Jan 09 2015 01:46
EST
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:48
I noticed you are having a heck of a time getting pairing going, you know who I would msg about that would be @phlacin also post on the forums maybe you can set up a pre determined time with another camper at your level who you can pair with
John Sanchez
@john8801
Jan 09 2015 01:48
I actually have been pairing -- we still couldn't get this one
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:49
Oh good
Jessi L Wasell
@JessiW
Jan 09 2015 01:50
Okay - so I tried to just copy my code that I had saved elsewhere into Dash for my CSS Robot. The code didn't show up so I tried just to type it in and now I can't type in the code box either! My Robot is now gone and in its place is this }); }); in the top left corner. I had seen on the Free Code Camp's Twitter account that some people where having trouble with a bug in the CSS Robot lesson. Is that what's happening here? What should I do? Thank you :)
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:51
I've not seen this, at this point I would relaunch your browser all together, log out, relaunch then log back in
Jessi L Wasell
@JessiW
Jan 09 2015 01:52
I tried signing out of all of my accounts and resigning back in - I will try again.
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:52
if it persists, then I would report it on the Dash site
Jessi L Wasell
@JessiW
Jan 09 2015 01:52
Okay just a moment...I'll let you know what happens.
Thank you :)
Kathy O'Driscoll
@odrisck
Jan 09 2015 01:52
no problem
Jessi L Wasell
@JessiW
Jan 09 2015 01:59
Okay! Logged out again and closed all the browsers. The good news is that a small amount of my code showed up again. I was able to paste the code I'd saved elsewhere back into my code box. Now I'll pick up where my saved version leaves off. As long as I don't encounter any more problems I'll for sure be back with my original question. Thanks so much @odrisck !
My Robot is back now too :)
Kathy O'Driscoll
@odrisck
Jan 09 2015 02:03
thats great :)
Jessi L Wasell
@JessiW
Jan 09 2015 02:16
Okay - here's my question: I'm trying to comment out my alert to let me know that the RGBA is working - like this: /alert(randomRGBA)/ I think I'm doing it right but it's not giving me the check mark and the ability to say 'I Did It' to move on to the next step. I'll send more code if you need :)
I'll try again - that's not quite what my code looks like: /alert(randomRGBA)/
Sorry, the chat keeps changing my code - hopefully it still makes sense but there are asterisks on the inside of the forward slashes.
Ben Clist
@BenClist
Jan 09 2015 02:19
your code should look like
Kathy O'Driscoll
@odrisck
Jan 09 2015 02:19
/* This is a single-line comment */
Ben Clist
@BenClist
Jan 09 2015 02:19
//alert(randomRGBA)
or @odrisck 's way
Kathy O'Driscoll
@odrisck
Jan 09 2015 02:20
or Bens way :)
Jessi L Wasell
@JessiW
Jan 09 2015 02:20
Okay I have the first example from @odrisck because what dash said to do - I'll try it @BenClist 's way!
:)
Kathy O'Driscoll
@odrisck
Jan 09 2015 02:21
thats actually differen than what you posted above you posted / alert(randomRGBA)/
it would be
Ben Clist
@BenClist
Jan 09 2015 02:21
I think that was gitters markdown that caused that
stars at either end of a word on here make italics
Kathy O'Driscoll
@odrisck
Jan 09 2015 02:22
/* alert(randomRGBA) */
that would be more like what I did
Jessi L Wasell
@JessiW
Jan 09 2015 02:22
I know - the chat changed my code after I sent it twice - my code looked just like your example.
Kathy O'Driscoll
@odrisck
Jan 09 2015 02:22
ahhh
I believe Ben has it right actually, the tutorials are usually hinky about not putting exactly what they expect
Jessi L Wasell
@JessiW
Jan 09 2015 02:23
Yeah, I tried it Ben's way - and it worked! Now I can move on :) Thank you to you both!
Ben Clist
@BenClist
Jan 09 2015 02:23
it would make more sense from a tech point of view as the method with the star tends to be used for multi-line comments
teaching not tech sorry
Kathy O'Driscoll
@odrisck
Jan 09 2015 02:23
don't be sorry :)
Jessi L Wasell
@JessiW
Jan 09 2015 02:23
okay - good to know - thank you :)
Jason Rueckert
@jsonify
Jan 09 2015 04:32
I'm here for a couple hours if anyone needs anything
Ben Stoltz
@benstoltz
Jan 09 2015 04:32
Yes @phlacin. I would like to know the meaning of life.
MychaelZ
@MychaelZ
Jan 09 2015 04:33
Hey does anyone have an account on frontendmasters?
Ben Stoltz
@benstoltz
Jan 09 2015 04:33
Yessir, what’s up?
Jason Rueckert
@jsonify
Jan 09 2015 04:33
Haha, "meaning" of life. That's a good one @benstoltz
MychaelZ
@MychaelZ
Jan 09 2015 04:33
I really want to see some fo their courses but that price :(
Ben Stoltz
@benstoltz
Jan 09 2015 04:34
They are pretty good. If you’re ready for a bit more advanced courses I highly recommend it
James McShane
@jmcshane
Jan 09 2015 12:50
Good
Ammar Ali Shah
@AmmarAliShah
Jan 09 2015 15:30
need help with codeschool
Nathan
@terakilobyte
Jan 09 2015 15:31
what’s up?
Ammar Ali Shah
@AmmarAliShah
Jan 09 2015 15:54
Let's write another event handler for the form field that will be run when the focus event is triggered. When this occurs, set the number of nights to 7
Don't get it :confused:
Nathan
@terakilobyte
Jan 09 2015 15:59
I’d search the jquery library to see if there is a focus event
just a like a click can trigger a function, so can focus
lotbs
@LookOnTheBrightSide
Jan 09 2015 18:05
hey all. can someone help me with this. what does the if statement do here?
This message was deleted
Charles Watson
@sircharleswatson
Jan 09 2015 18:05
@LookOnTheBrightSide put your code on a new line from the first ```
lotbs
@LookOnTheBrightSide
Jan 09 2015 18:06
var arr = ['first item', 'second item is longer than the third one', 
           'third longish item'];

var lgth = 0;
var longest;

for(var i=0; i < arr.length; i++){
    if(arr[i].length > lgth){
        var lgth = arr[i].length;
        longest = arr[i];
    }      
} 

alert(longest);
This message was deleted
        var lgth = arr[i].length;
        longest = arr[i];
that part is confusing me
Charles Watson
@sircharleswatson
Jan 09 2015 18:09
the if statement is going through each value of the array and checking if it's longer than the lngth value. then it is setting lngth to be that value and setting longest to be the longest item
lotbs
@LookOnTheBrightSide
Jan 09 2015 18:12
is it possible to use something like Math.max() ?
Charles Watson
@sircharleswatson
Jan 09 2015 18:13
I don't think so
Math.max() is the highest value that javascript can handle
lotbs
@LookOnTheBrightSide
Jan 09 2015 18:15
Math.max(arr[i].length)
something like that? or am I just making up my own programming language there? :smile:
lotbs
@LookOnTheBrightSide
Jan 09 2015 18:19
ah yes of course. thanks for helping out!
Jimmy Bryant II
@JimBry
Jan 09 2015 19:43

I cant seem to make this code fit on the whole screen, I would ultimately like it to be responsive and fit any screen.

HTML:

<!DOCTYPE html>
<head>
    <link rel="stylesheet" href="stylesheets/main.css">
</head>
<body>
  <div class="first">
    <h2>THOUGHTS</h2>
    <ul>
      <li>
        <a href="https://twitter.com/savebutter">Twitter</a>
      </li>
    </ul>
  </div>
  <div class="second">
    <h2>PROJECTS</h2>
    <ul>
      <li>
        <a href="https://github.com/JimBry">Github</a>
      </li>
    </ul>
  </div>
  <div class="third">
    <h2>ESSAYS</h2>
    <ul>
      <li>
        <a href="Add Link Here!">School</a>
      </li>
    </ul>
  </div>
  <div class="fourth">
    <h2>FUN</h2>
    <ul>
      <li>
        <a href="http://instagram.com/tokyomyth/">Instagram</a>
      </li>
    </ul>
  </div>
</body>
</html>
CSS:
div {
  height: 500px;
  width: 376px;
  float: left;

}
.first {
  background-color: rgb(201, 232, 235);
}
.second {
  background-color: rgb(246, 183, 89);
}
.third {
  background-color: rgb(236, 67, 46);
}
.fourth {
  background-color: rgb(208, 231, 143);
}
Any suggestions?
Ammar Ali Shah
@AmmarAliShah
Jan 09 2015 19:44
$(document).ready(function() {
  $(".see-photos").on("click", function(event) {
    event.preventDefault();
    $(this).closest(".tour").find(".photos").slideToggle();
  });
  $(".tour").on("click", function(event) {
    event.preventDefault();
    alert("This should not be called");
  });
});
Help with this needed
I'm off to sleep
Suzanne Atkinson
@AdventureBear
Jan 09 2015 19:48
slolved then?
Ammar Ali Shah
@AmmarAliShah
Jan 09 2015 19:48
yes
Jimmy Bryant II
@JimBry
Jan 09 2015 20:13
If you copy and paste the code in to Codepen you can see the problem I'm having thanks!
Maxim Orlov
@Maximization
Jan 09 2015 20:17
@JimBry change width towidth: 25%
this is the simplest solution I could think off
I'm no CSS expert and I'm sure there's a better solution out there
Jimmy Bryant II
@JimBry
Jan 09 2015 20:20
@Maximization Thanks I forgot all about Percents! This helped
Dominic Desimini
@trisell
Jan 09 2015 21:05
Quick question. Would the regex [aeiou] only match for "aeiou" as a word or any of the letters any where in the string?
P1xt
@P1xt
Jan 09 2015 21:06
one instance of any of the letters, any where in the string
Dominic Desimini
@trisell
Jan 09 2015 21:08
Cool. So if I used that while looping through a string, it would id on the vowels and allow me to push those to another array?
Maxim Orlov
@Maximization
Jan 09 2015 21:13
yes
Evan Davis
@davisec52
Jan 09 2015 22:29

Still working on the coderbyte LetterChanges challenge and trying to solve it using modulo. This is clearly to advanced for me. I've been able to cobble together code that performs the changes one character at at time. Strings of more than one character produce ideosyncratic repsonses. Here is the code:

function LetterChanges(str) {
    var alphabet = "abcdefghijklmnopqrstuvwxyz";
    for (var i = 0; i < str.length; i++) {
        var index = alphabet.indexOf(str[i]);
        }
var x = str.replace(/[a-zA-Z]/g, function(c) {
    return alphabet.charAt(((0 + 1) + index) % 26);
    });
    x = x.replace(/[aeiou]/g, function(c){
        return c.toUpperCase();
    });
    return x;    
}
LetterChanges("z");

I'd appreciate any help as to how to get this to produce a full string.

Nathan
@terakilobyte
Jan 09 2015 22:30
@davisec52 let’s have a look :)
Ian Yeager
@iyeager2004
Jan 09 2015 22:30
@davisec52 Have you ever used the Array.map function before?
Nathan
@terakilobyte
Jan 09 2015 22:30
man I wish you were in chat when I walked @trisell through this
Ian Yeager
@iyeager2004
Jan 09 2015 22:31
Oh, nevermind, Nathan's here. I'll let him take it, he's already done this once. :)
Nathan
@terakilobyte
Jan 09 2015 22:31
@davisec52 ok, first thing first. I want you to delete the code out of coderbyte
it’s not bad
and you say modulo is too advanced for you but you are doing some heavy stuff there
but I want to show you a different way
open that link in a new tab
then, we’ll go through it step by step
Maxim Orlov
@Maximization
Jan 09 2015 22:35
@iyeager2004 did you read up my solution to the coderbyte problem we were discussing the other day?
Evan Davis
@davisec52
Jan 09 2015 22:41
@iyeager2004 @terakilobyte Thank you--I'll have a look. As you can see, my solution so far is an abused Frankenstein of a construction.
@iyeager2004 Array.map? No, don't know what that is yet.
Dominic Desimini
@trisell
Jan 09 2015 22:42
And now I'm blowing through challenges like a boss. :D
all because of tera's help
Evan Davis
@davisec52
Jan 09 2015 22:44
@terakilobyte Tab open.
Evan Davis
@davisec52
Jan 09 2015 22:55
Got to take off. Will have to resume later.
Maxim Orlov
@Maximization
Jan 09 2015 22:56
@davisec52 perhaps it's easier and faster to pair next time to explain this