These are chat archives for FreeCodeCamp/Help

22nd
Oct 2017
David Chen
@Obiwan777
Oct 22 2017 00:17
anyone able to help with me for some c question?
Ken Haduch
@khaduch
Oct 22 2017 02:01
@Obiwan777 - possibly, on your C question...
lik
@98ling
Oct 22 2017 02:04
btn class?what does it mean?
Ken Haduch
@khaduch
Oct 22 2017 02:07
@98ling - if you are using Bootstrap, there are many CSS classes that are defined within the Bootstrap CSS styles. One of them is used to style button elements, the class is named btn, you can add it as an attribute of an element class="btn" to add that styling to the element.
Ken Haduch
@khaduch
Oct 22 2017 02:19

@98ling - if you look into the bootstrap.css code itself, you can see the styling that is applied to an element that has the class btn:

.btn {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}

This page on w3schools gives examples of how to use it.

Darren
@DarrenfJ
Oct 22 2017 03:53
want to say the usual thanks and kudos to the regulars...
thanks @Manish-Giri @khaduch @GitHub-Henry @thekholm80 @heroiczero @sjames1958gm @daddycardona
CamperBot
@camperbot
Oct 22 2017 03:54
darrenfj sends brownie points to @manish-giri and @khaduch and @github-henry and @thekholm80 and @heroiczero and @sjames1958gm and @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 405 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 8593 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 1526 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 1920 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 3393 | @khaduch |http://www.freecodecamp.com/khaduch
:cookie: 406 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 6673 | @manish-giri |http://www.freecodecamp.com/manish-giri
saiwill
@saiwill
Oct 22 2017 03:55

<div class="col-xs-4 row container-fluid">
<button class="btn btn-block btn-primary">Like</button>
</div >

<div class="col-xs-4 row container-fluid">
<button class="btn btn-block btn-info">Info</button>
</div >

<div class="col-xs-4 row container-fluid">
<button class="btn btn-block btn-danger">Delete</button>
</div >

heroiczero
@heroiczero
Oct 22 2017 03:58
@khaduch @GitHub-Henry @alpox @gishy1 @thekholm80 @longnt80 @daddycardona @Manish-Giri @sjames1958gm TY for visiting and participating in the community Help chats everyday :)
CamperBot
@camperbot
Oct 22 2017 03:58
heroiczero sends brownie points to @khaduch and @github-henry and @alpox and @gishy1 and @thekholm80 and @longnt80 and @daddycardona and @manish-giri and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1373 | @alpox |http://www.freecodecamp.com/alpox
:cookie: 406 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 3394 | @khaduch |http://www.freecodecamp.com/khaduch
:cookie: 242 | @gishy1 |http://www.freecodecamp.com/gishy1
:cookie: 407 | @daddycardona |http://www.freecodecamp.com/daddycardona
:cookie: 605 | @longnt80 |http://www.freecodecamp.com/longnt80
:star2: 1527 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 8594 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 6674 | @manish-giri |http://www.freecodecamp.com/manish-giri
Ken Haduch
@khaduch
Oct 22 2017 04:00
@saiwill - what is your question?
heroiczero
@heroiczero
Oct 22 2017 04:00
@saiwill why does your <div class= have col,row,and acontainer class?
inputherf
@inputherf
Oct 22 2017 04:00
bootstrap @heroiczero
Ken Haduch
@khaduch
Oct 22 2017 04:02

@saiwill - the "normal" way to do this is to have something like this:

<div class="container-fluid">
    <div class="row">
        <div class="col-xs-4">
            some other elements
        </div>
        <div class="col-xs-4">
            some other elements
        </div>
        <div class="col-xs-4">
            some other elements
        </div>
    </div>
</div>

I'm not sure if that's what you're supposed to be going for here?

saiwill
@saiwill
Oct 22 2017 04:02
(X)确保你的每一个 div 元素都有一个闭合标签。
heroiczero
@heroiczero
Oct 22 2017 04:02
saiwill
@saiwill
Oct 22 2017 04:03
Thank you
Henry
@GitHub-Henry
Oct 22 2017 06:59
@heroiczero @DarrenfJ Hello and ty for the brownies
CamperBot
@camperbot
Oct 22 2017 06:59
github-henry sends brownie points to @heroiczero and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1923 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 2164 | @darrenfj |http://www.freecodecamp.com/darrenfj
Momozor
@momozor
Oct 22 2017 07:32
var data = {'bob':'foo','paul':'dog'};
 $.ajax({
   url: url,
   type: 'POST',
   contentType:'application/json',
   data: JSON.stringify(data),
   dataType:'json',
   success: function(data){
     //On ajax success do this
     alert(data);
      },
   error: function(xhr, ajaxOptions, thrownError) {
      //On error do this
        if (xhr.status == 200) {

            alert(ajaxOptions);
        }
        else {
            alert(xhr.status);
            alert(thrownError);
        }
    }
 });
Is the code above actually do the below?
  1. Send data to server
  2. if we able to get response from server and the return code is 200, alert will be executed
I'm not sure if the success is an indicator for successful response data retrieval or successful response data sending to server.
alpox
@alpox
Oct 22 2017 08:48

@faraco

I'm not sure if the success is an indicator for successful response data retrieval or successful response data sending to server.

Success stands for a successful response from the server

@faraco alert will therefore be executed when the server replies
BryanS
@BSISJ7
Oct 22 2017 09:03

Any idea why swapping out my button doesn't make it turn red(off) when I run the test function?

Game Of Life

Tiago Correia
@tiagocorreiaalmeida
Oct 22 2017 09:18
gm everyone
alpox
@alpox
Oct 22 2017 09:22
@BSISJ7 I'm not exactly sure why it doesn't render it, but its sure no good idea to store react components in the state.
@tiagocorreiaalmeida :wave:
BryanS
@BSISJ7
Oct 22 2017 09:28
@tiagocorreiaalmeida G'morning
@alpox I'll trying fixing that then.
Martynas
@FlintMayers
Oct 22 2017 12:00
Hey guys, anyone familiar with google maps api to calculate length between marker points?
Jake
@JakeDVirus
Oct 22 2017 12:55

i got the snippet below to use for retina displays (where device pixel ratio = 2)

.logo_background {
    background-image: url('../img/logo@1x.png');
    background-position: center center;
    background-repeat: no-repeat;
    background-size: 80px 40px; /* size of the logo image @ 1x */
}
@media /* only for retina displays */
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min--moz-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2),
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-resolution: 192dpi),
only screen and (min-resolution: 2dppx) {
    .logo_background {
        background-image: url('../img/logo@2x.png');
    }
}

i considered to use extra set of code engulf in the media query for the retina display where device-pixel ratio =3 :

.logo_background {
    background-image: url('../img/logo@1x.png');
    background-position: center center;
    background-repeat: no-repeat;
    background-size: 80px 40px; /* size of the logo image @ 1x */
}
@media /* only for retina displays */
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min--moz-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2),
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-resolution: 192dpi),
only screen and (min-resolution: 2dppx) {
    .logo_background {
        background-image: url('../img/logo@2x.png');
    }
}
@media /* only for retina displays with DPR =3 */
only screen and (-webkit-min-device-pixel-ratio: 3),
only screen and (min--moz-device-pixel-ratio: 3),
only screen and (min-device-pixel-ratio: 3),
only screen and (-webkit-min-device-pixel-ratio: 3),
only screen and (min-resolution: ??),  //what shall be the value of min-resolution here?
only screen and (min-resolution: ??) {  //what shall be the value of min-resolution here?
    .logo_background {
        background-image: url('../img/logo@3x.png');
    }
}

so i have two questions precisely.

  1. Is that approach convenient and reliable?
  2. What would be the value fo the "minimum resolution" given in last 5th and 6th line of the last snippet?
saiwill
@saiwill
Oct 22 2017 13:30
<input type="text" placeholder="cat photo URL" required class="form-control">
<button class="btn btn-primary"><i class="fa fa-paper-plane">Submit</i></button>
</form>
saiwill
@saiwill
Oct 22 2017 13:35
Is't done
Marc
@MWBauer
Oct 22 2017 14:02
Morning everyone!
Marc
@MWBauer
Oct 22 2017 14:44
How weird! I followed the same format from my previous pen for my body image, using a different image, but it won't come up for anything.
Darren
@DarrenfJ
Oct 22 2017 15:29
@GitHub-Henry thanks back :D
CamperBot
@camperbot
Oct 22 2017 15:29
darrenfj sends brownie points to @github-henry :sparkles: :thumbsup: :sparkles:
:cookie: 407 | @github-henry |http://www.freecodecamp.com/github-henry
Darren
@DarrenfJ
Oct 22 2017 15:29
@MWBauer morning! :D
Marc
@MWBauer
Oct 22 2017 16:04
Hey Darren. What's shaking?
Ken Haduch
@khaduch
Oct 22 2017 19:53
@DarrenfJ and @heroiczero - good day to you, thanks for the kudos and same to you, keeping this helpful room going for everyone!
CamperBot
@camperbot
Oct 22 2017 19:53
khaduch sends brownie points to @darrenfj and @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 2165 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 1925 | @heroiczero |http://www.freecodecamp.com/heroiczero
Waterkid123012
@Waterkid123012
Oct 22 2017 20:22
hey can someone help me with java output?
Stephen James
@sjames1958gm
Oct 22 2017 20:32
@Waterkid123012 What is your question?
gishy1
@gishy1
Oct 22 2017 20:49
Hello world I am going to ask some seemingly stupid questions but bear with me
first is a for loop designed for arrays specifically?
second if not then in what cases can it be used?
alpox
@alpox
Oct 22 2017 20:53
@gishy1 A for loop is designed for any kind of recurring job - any algorithm which does a job iteratively
It can be used as example for just do something a certain amount of times:
for(var i = 0; i < 10; i++) {
    console.log("i log 10 times!");
}
And it can be used for a lot of other jobs too :-)
artbohr
@artbohr
Oct 22 2017 22:13
Is there any point in wrapping my <textarea> in a <form > tag? And if yes, why?
<textarea rows="26" value={this.state.markdown} onChange={this.handleChange}/>

vs

<form>
    <textarea rows="26" value={this.state.markdown} onChange={this.handleChange}/>
</form>
also vs bootstrap version of

 <div class="form-group">
  <label for="comment">Comment:</label>
  <textarea class="form-control" rows="5" id="comment"></textarea>
</div>
exclude the label tags, just referring to form-group in this case of bootstrap
Stephen James
@sjames1958gm
Oct 22 2017 22:34
@artbohr For accessibility, yes. Otherwise no.
artbohr
@artbohr
Oct 22 2017 23:03
@sjames1958gm accessibilty in what sense? Can you give a short example of what do u mean, like searching or something?
or like code structure in big projects?
korzo
@korzo
Oct 22 2017 23:09
@artbohr I'm not sure, if textarea outside of form will pass HTML validator.
accessibility for visually impaired whose are using screen readers
@artbohr Anyway, for small/personal project is none of above an issue
artbohr
@artbohr
Oct 22 2017 23:16
@korzo but is it recommended as a convention or something to wrap it?
artbohr
@artbohr
Oct 22 2017 23:22
@korzo @sjames1958gm oh, I misunderstood the word accessibility, now I got it, thank you guys
CamperBot
@camperbot
Oct 22 2017 23:22
artbohr sends brownie points to @korzo and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 654 | @korzo |http://www.freecodecamp.com/korzo
:star2: 8596 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
Oct 22 2017 23:22
@artbohr :+1: