These are chat archives for FreeCodeCamp/Help

19th
Sep 2017
Albert Cardona II
@daddycardona
Sep 19 2017 00:01
what are you trying to do @piteto
Gersho
@Gersho
Sep 19 2017 00:02
Eric was having issues with bootstrap buttons
piteto
@piteto
Sep 19 2017 00:02
Trying to eat dinner ;)
Albert Cardona II
@daddycardona
Sep 19 2017 00:02
what version of bootstrap @ericmiller777
I already ate dinner brother
piteto
@piteto
Sep 19 2017 00:02
it's been sorted, if you read up
Albert Cardona II
@daddycardona
Sep 19 2017 00:02
lol
that is to much reading sometimes lol'
piteto
@piteto
Sep 19 2017 00:03
wanted disabled buttons to not look disabled, got an option to do that, but it doesn't work on hover, and that's okay with Eric
Eric Miller
@ericmiller777
Sep 19 2017 00:03
I think i use 3
function checkIfWin(){
    if($("#1").innerHTML == "X"){
      $("#chooseText").html("You Win!");
    }
  }
what am i doing wrongt there?
Albert Cardona II
@daddycardona
Sep 19 2017 00:05
oh okay well how is everyone doing. I am about to start the Convert HTML Entities while using regexp
Eric Miller
@ericmiller777
Sep 19 2017 00:05
oooo
Albert Cardona II
@daddycardona
Sep 19 2017 00:05
OMG here we go
Eric Miller
@ericmiller777
Sep 19 2017 00:05
good luck with that
Albert Cardona II
@daddycardona
Sep 19 2017 00:06
LMAO I know I am having trouble with easier stuff lol
Gersho
@Gersho
Sep 19 2017 00:06
i'm dying in my way too hot room, apart from that i'm doing fine
piteto
@piteto
Sep 19 2017 00:06
@ericmiller777 IDs have to start with a letter
#1 is an invalid selector
Albert Cardona II
@daddycardona
Sep 19 2017 00:06
I am glad they didn't put on the heater where I live
Eric Miller
@ericmiller777
Sep 19 2017 00:06
@piteto good thing i asked thats
Gersho
@Gersho
Sep 19 2017 00:07
oh it's no heater, but with maria i can't really keep the window open
Albert Cardona II
@daddycardona
Sep 19 2017 00:08
oh okay I have the AC on and it s only 68 :degrees:
outside
Eric Miller
@ericmiller777
Sep 19 2017 00:08
function checkIfWin(){
    if($("#A").innerHTML == "X"){
      $("#chooseText").html("You Win!");
    }
  }
still not working :(
Gersho
@Gersho
Sep 19 2017 00:09
have you tried document.getElementById(A).value ?
Albert Cardona II
@daddycardona
Sep 19 2017 00:09
you tried ===?
Eric Miller
@ericmiller777
Sep 19 2017 00:09
nope
Albert Cardona II
@daddycardona
Sep 19 2017 00:09
is it capital #A or lowercase?
Eric Miller
@ericmiller777
Sep 19 2017 00:09
still didnt work
capital
Albert Cardona II
@daddycardona
Sep 19 2017 00:09
what is your link again?
Eric Miller
@ericmiller777
Sep 19 2017 00:10
gotta upload it
Gersho
@Gersho
Sep 19 2017 00:10
are you sure the content of the element is "X" ? not X or "x" or whatever
Albert Cardona II
@daddycardona
Sep 19 2017 00:10
and did you add the jquery so you can use that ?
Gersho
@Gersho
Sep 19 2017 00:10
console.log($("#A").innerHTML == "X")
piteto
@piteto
Sep 19 2017 00:11
if you use .innerHTML you need to refer to the html object, not the jQuery object:
$("#A")[0].innerHTML == "X"
probably better to just do: $("#A").html() == "X"
I should have seen that earlier....dinner is tasty, got distracted :fork_and_knife: lol
Gersho
@Gersho
Sep 19 2017 00:12

probably better to just do: $("#A").html() == "X"

oh i didn't know you could use .html() that way, thanks !

piteto
@piteto
Sep 19 2017 00:12
No problem :)
Joshua Arnett
@josha5
Sep 19 2017 00:12
Can anyone help me with my pomodoro timer
Albert Cardona II
@daddycardona
Sep 19 2017 00:13
or var x = $("#A").html() ; then do if( x=== "x")
Eric Miller
@ericmiller777
Sep 19 2017 00:13
@piteto thanks that worked
CamperBot
@camperbot
Sep 19 2017 00:13
ericmiller777 sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
api offline
Gersho
@Gersho
Sep 19 2017 00:13
but honestly, as i learn more about vanilla, jquery seems not that usefull
@josha5 show your pen ?
Albert Cardona II
@daddycardona
Sep 19 2017 00:13
so you are using vailla now vs jquery, I am still learning jquery @Gersho
Eric Miller
@ericmiller777
Sep 19 2017 00:14
@daddycardona thanks
CamperBot
@camperbot
Sep 19 2017 00:14
ericmiller777 sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 343 | @daddycardona |http://www.freecodecamp.com/daddycardona
Eric Miller
@ericmiller777
Sep 19 2017 00:14
@Gersho thanks
piteto
@piteto
Sep 19 2017 00:14
I agree, feels like I'm less in control for some reason with jQuery but I can see how it speeds things up
Joshua Arnett
@josha5
Sep 19 2017 00:14
No where near being done but here it is
Gersho
@Gersho
Sep 19 2017 00:14
haven't done a project in a while to be honest, all my frontend challenge use jquery
Eric Miller
@ericmiller777
Sep 19 2017 00:14
@piteto thanks
CamperBot
@camperbot
Sep 19 2017 00:14
ericmiller777 sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
api offline
Eric Miller
@ericmiller777
Sep 19 2017 00:14
why does it only say api offline for you?
piteto
@piteto
Sep 19 2017 00:14
It's a bad error message - you already gave me a cookie recently
Gersho
@Gersho
Sep 19 2017 00:15
@piteto yeah, it's conveniant, but doesn't feel as mandatory as it used to when i started
Albert Cardona II
@daddycardona
Sep 19 2017 00:15
you welcome brother
because you thanked him already
@ericmiller777
well be back later must go to the store
Gersho
@Gersho
Sep 19 2017 00:16
@josha5 first you should finish your +/- buttons (or set the base time to 1-2 mins) so we can test what work, what doesn't
Joshua Arnett
@josha5
Sep 19 2017 00:16
I'm trying to fix my add session length button
everytime I add a minute and click start it automatically adds 59 seconds to the time
if I add 1 minute to the timer "26:00" then "26:59 " is displayed
Eric Miller
@ericmiller777
Sep 19 2017 00:18
yea I had to in code for :00 set it to 0 + "0"
Gersho
@Gersho
Sep 19 2017 00:18
@josha5 try putting <= 0 instead of <0 on line 10
Joshua Arnett
@josha5
Sep 19 2017 00:19
tried that its still pushing an extra 59 seconds to the clock
Gersho
@Gersho
Sep 19 2017 00:20
then on start you could force Xmin = X-1min + 59sec so it starts properly
since on setup we only configure minutes and not seconds
piteto
@piteto
Sep 19 2017 00:23
@josha5 update the time display at the end of your click function
  $("#addSession").on("click", function() {
    var timer = timer2.split(":");
    var minutes = parseInt(timer[0], 10);
    var seconds = parseInt(timer[1], 10);

    timer2 = minutes + 1 + ":" + seconds;
    $("#time").text(timer2 + "0");
  });
you're updating the time display before you increment the minute, so the real time is actually a minute ahead than what is displayed
Joshua Arnett
@josha5
Sep 19 2017 00:25
@piteto Thank you!!
CamperBot
@camperbot
Sep 19 2017 00:25
josha5 sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 120 | @piteto |http://www.freecodecamp.com/piteto
Joshua Arnett
@josha5
Sep 19 2017 00:25
@Gersho Also thanks for the help
Myrons system
@Myron000
Sep 19 2017 00:34
I cant figure out what is wrong with my logic. I can't get the final three test cases.

function mutation(arr) {

var first = arr[0];
var second = arr[1];

for (i = 0; i < second.length; i++){
if (first.charAt(0).indexOf(second.charAt(0)) < 0){
return true;
} else
return false;
}
}

mutation(["hello", "neo"]);

Manish Giri
@Manish-Giri
Sep 19 2017 00:36
@Myron000 your code won't get past the first iteration of the loop
Mike Batista
@mbmontana
Sep 19 2017 00:36
Hi folks, I know this probably needs some work but I just want to know if I'm heading in the right direction with this, and if I'm not, if someone could nudge me in the right direction. I have to remove the false values from the array.
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
 var newArray;
  newArray = arr.filter(function (val){
  val = Boolean(true);
  });
  return newArray;
}

bouncer([7, "ate", "", false, 9]);
Gersho
@Gersho
Sep 19 2017 00:37
you need a return in your filter
Manish Giri
@Manish-Giri
Sep 19 2017 00:38
@mbmontana you probably want to coerce val into a boolean, so rather, should do
arr.filter(function (val){
  return Boolean(val);
  });
Gersho
@Gersho
Sep 19 2017 00:38
oh wow, i think i need to take a break xD blind
Manish Giri
@Manish-Giri
Sep 19 2017 00:39
lol
you're right about the return!
Stephen
@TeddyHugs
Sep 19 2017 00:46
I'm always blind! It happens all the time
Mike Batista
@mbmontana
Sep 19 2017 00:51
omg i passed through but I have no idea how. How is this correct?
function bouncer(arr) {
  // Don't show a false ID to this bouncer.
 var newArray;
  newArray = arr.filter(function (val){
  return Boolean(val);
  });
  return newArray;
}

bouncer([7, "ate", "", false, 9]);
Gersho
@Gersho
Sep 19 2017 00:52
well what do you expect of the filter function ?
if it evaluates as true, it will be kept
and yes 7 is true
piteto
@piteto
Sep 19 2017 00:54
And since filter only keeps items that evaluate to true, this also works :)
return arr.filter(function(val) {
  return val;
});
Eric Miller
@ericmiller777
Sep 19 2017 01:22
erase that from your mind
Eric Miller
@ericmiller777
Sep 19 2017 02:09
weird
if(playerIsX == true && playersTurn == true){
      this.innerHTML = "X";
      this.disabled = true;
      playersTurn = false;
      checkIfWin();
if i erase playersturn == true
it works fine
but i logged it and it comes back true
Gersho
@Gersho
Sep 19 2017 02:11
===
is that tictactoe ?
Eric Miller
@ericmiller777
Sep 19 2017 02:11
yes
lol
still didnt fix it
王正南
@wangzhengnan
Sep 19 2017 02:12
turn-an-image-into-a-link
Eric Miller
@ericmiller777
Sep 19 2017 02:13
also if i remove playersturn = false
it also works?
王正南
@wangzhengnan
Sep 19 2017 02:13
why a tag set a # no work
Eric Miller
@ericmiller777
Sep 19 2017 02:13
@wangzhengnan we would need to see your project
Gersho
@Gersho
Sep 19 2017 02:13
oh since you're comparing to true, you don't even need it, if(playerIsX && playersTurn) should work too
Eric Miller
@ericmiller777
Sep 19 2017 02:14
still doesnt work....
i dont get it
Gersho
@Gersho
Sep 19 2017 02:14
i'm assuming the { you opened is closed properly
Eric Miller
@ericmiller777
Sep 19 2017 02:15
yes lol
its really weird because if i remove playersTurn = false;
it works fine
only other reference is'
Gersho
@Gersho
Sep 19 2017 02:15
what is this supposed to be in this context ? have you tried a console.log inside the THEN to check if the then is trigger but does nothing, or if it is not triggered at all
Eric Miller
@ericmiller777
Sep 19 2017 02:15
var playersTurn = true;
Gersho
@Gersho
Sep 19 2017 02:16
console.log(playerisX);
console.log(playersTurn);
if(playerIsX  && playersTurn){
console.log("test");
      this.innerHTML = "X";
      this.disabled = true;
      playersTurn = false;
      checkIfWin();
}
maybe it's a scope issue ?
Eric Miller
@ericmiller777
Sep 19 2017 02:17
I think isee the problem
Gersho
@Gersho
Sep 19 2017 02:17
apart from scope issue i don't see what could be wrong
Eric Miller
@ericmiller777
Sep 19 2017 02:18
I got it i had my buttons to choose X or O set to the same as the buttons to place a X or a O
so they were setting false
@Gersho thanks
CamperBot
@camperbot
Sep 19 2017 02:20
ericmiller777 sends brownie points to @gersho :sparkles: :thumbsup: :sparkles:
:cookie: 442 | @gersho |http://www.freecodecamp.com/gersho
Gersho
@Gersho
Sep 19 2017 02:20
back, glad you solved your problem
just got a power failure, looks like i won't much around much longer today ^^
Eric Miller
@ericmiller777
Sep 19 2017 02:22
oh no
bad weather?
Gersho
@Gersho
Sep 19 2017 02:23
you could say that, i'm on Maria's path
http://www.sxmcyclone.com/datas/sxmalerte.png
i'm on the one called Guadeloupe
Henry
@GitHub-Henry
Sep 19 2017 02:29
@Gersho World Wind
Gersho
@Gersho
Sep 19 2017 02:29
oh, it's cool looking
75mph ? those are rookie numbers
Henry
@GitHub-Henry
Sep 19 2017 02:32
@Gersho 75mph is category one
Gersho
@Gersho
Sep 19 2017 02:33
@ericmiller777 i'm in a concrete house it's ok :p
Eric Miller
@ericmiller777
Sep 19 2017 02:33
oops i measnt to add a period i erased it lol
@Gersho oh, be careful.
@Gersho thats good
hey i know
how do you get a tag from this
like return this.tag
Nahuel Ovejero
@NahuelOvejero
Sep 19 2017 03:40
oh boi
duvidel
@duvidel
Sep 19 2017 03:49
I have two questions for you all. 1. I have figured out how to create a navigation bar I found here: http://www.cssnewbie.com/super-simple-horizontal-navigation-bar/ In CSS, I learned how to create the links. Yet, I still need to link the sections of the navigation bar like "about me" to the various parts of the page. 2. If I wanted to insert Hebrew words onto a mostly English page, would I have to change from Unicode to something else or could I just paste in the Hebrew words? Please send me a private message if you know the answer, so that I don't disturb anyone else and can go to sleep. Thanks!
I am working with Codepen.
duvidel
@duvidel
Sep 19 2017 04:15
I may have the answer from Nahuel in the other help FreeCodeCamp chat. Thanks! @NahuelOvejero
CamperBot
@camperbot
Sep 19 2017 04:15
duvidel sends brownie points to @nahuelovejero :sparkles: :thumbsup: :sparkles:
api offline
Eric Miller
@ericmiller777
Sep 19 2017 04:16
hey guys, is there a way to check if(all buttons are disabled){}
Eric Miller
@ericmiller777
Sep 19 2017 04:35
nvm
Eric Miller
@ericmiller777
Sep 19 2017 04:54
Okay how can i check if a button is disabled....?
Sandeep Chary
@dsandeepchary
Sep 19 2017 05:28
you hover over it and cannot able to click, I guess.
Eric Miller
@ericmiller777
Sep 19 2017 06:00
wanna try out my tic tac toe?
i solved the question from earlier
Sandeep Chary
@dsandeepchary
Sep 19 2017 06:07
I win in the first go
Eric Miller
@ericmiller777
Sep 19 2017 06:12
yes
thats good?
that you must lose is not a requirment anymore
Eric Miller
@ericmiller777
Sep 19 2017 06:26
ive made it responcive
Eric Miller
@ericmiller777
Sep 19 2017 06:46
added juice :)
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 08:09
Array.prototype.square = function(value){
  var result = [];
  result = this.forEach((value)=>{
    result.push(value*value);
     console.log(result);
  });
   return result;
};
this returns undefined in the return but if I cfonsole log it everytime inside the foreach it has all the values getting pushed 1 by 1
[ 1 ]
[ 1, 4 ]
[ 1, 4, 9 ]
[ 1, 4, 9, 16 ]
[ 1, 4, 9, 16, 25 ]
undefined
nm solved
Emmanuel Akodia
@akodiaemma
Sep 19 2017 08:39
@akodiaemma
i am trying to connect to my databse remotely via appery.io but i keep getting internal error. i have white listed appery.io in mysql plus the other 7 offered DNS's. don't know if this is useful but whats weird is that wen i go to ping.eu and i type in my host name and port 3306, it return port is closed. yet on my end it clearly says open
Screenshot-2017-9-19 connection API Express.png
anyone
rscales02
@rscales02
Sep 19 2017 10:21
function whatFactors(num) {
  var sqrt = Math.sqrt(num)
  var factors = [];
  for (var i = 1; i < sqrt; i++) {
    if (num % i == 0) {
      factors.push(i);
    }

  }
 console.log(factors)
}


whatFactors(13195)
can someone tell me why this logs twice? the first log of factors gives me the correct answer, but then it logs again with an empty array. Here is the fiddle
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 10:22
cause you call the whatfactors and that returns a consolelog
and then you callthe primetest that calls wathfactors
so a new console log happens
rscales02
@rscales02
Sep 19 2017 10:26
This is the same setup I had yesterday for the parseAndSum function to call over the array, why is it not working this time?
heroiczero
@heroiczero
Sep 19 2017 10:29
@rscales02 are you trying to find if its a prime?
rscales02
@rscales02
Sep 19 2017 10:29
yesterday's problem vs today's problem I feel like I have the same set up but it returns empty
@heroiczero that is the next step, but right now my question is how do I pull the returned factors into a new function. My setup from yesterday worked perfectly, but (from what I can see) the exact same setup today does not work.
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 10:32
@rscales02 what I told you yesterday was to assign a varaible to the result of the function remember that?
var variable = whatFactors(value);
heroiczero
@heroiczero
Sep 19 2017 10:32
@rscales02 if your trying to find primes i would use https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Example
rscales02
@rscales02
Sep 19 2017 10:38
Ok then, got it... thanks @tiagocorreiaalmeida
CamperBot
@camperbot
Sep 19 2017 10:38
rscales02 sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 355 | @tiagocorreiaalmeida |http://www.freecodecamp.com/tiagocorreiaalmeida
Stephen James
@sjames1958gm
Sep 19 2017 10:38
@rscales02 When you call the function from inside primeTest you don't pass a value.
Yesterday's problem, the called function did not require a parameter.
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 10:38
hey @sjames1958gm how are you?
rscales02
@rscales02
Sep 19 2017 10:38
@sjames1958gm just realized that, thanks!
CamperBot
@camperbot
Sep 19 2017 10:38
:star2: 8467 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
rscales02 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 10:39
got a kinda confusing question when creating a array prototype can you use a arrow function on it? like array.prototype.something =function(){}
instead use arrow functions
Stephen James
@sjames1958gm
Sep 19 2017 10:40
@tiagocorreiaalmeida no, because arrow functions don't rebind the this value, you wont be able to access the array using this
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 10:42
just what I tought thanks @sjames1958gm
CamperBot
@camperbot
Sep 19 2017 10:42
tiagocorreiaalmeida sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8468 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 10:47
validPhoneNumber("(123) 456-7890")  =>  returns true
validPhoneNumber("(1111)555 2345")  => returns false
validPhoneNumber("(098) 123 4567")  => returns false
best awy to achieve this is regex right?
heroiczero
@heroiczero
Sep 19 2017 10:47
yes best way is regex
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 10:48
regex is the kinda of thing I can't figure out how to use and manage
Naveen B
@naveen62
Sep 19 2017 10:48
Hi, how to access a var declared inside a function in nodejs
heroiczero
@heroiczero
Sep 19 2017 10:49
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 10:49
as far as I know if its not global wont work @naveen62
thanks @naveen62
CamperBot
@camperbot
Sep 19 2017 10:49
tiagocorreiaalmeida sends brownie points to @naveen62 :sparkles: :thumbsup: :sparkles:
:cookie: 21 | @naveen62 |http://www.freecodecamp.com/naveen62
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 10:49
thanks @heroiczero *
@naveen62 show the code if possible
Naveen B
@naveen62
Sep 19 2017 10:51
var data = id;
function test() {
    var id = uniqid();
}
heroiczero
@heroiczero
Sep 19 2017 10:51
@tiagocorreiaalmeida np :+1: :)
mbsyaswanth
@mbsyaswanth
Sep 19 2017 10:51
help me with this code, i expect the output as 7,but it gives me 16!
int count(int *);
void main()
{
  int arr[]={1,2,3,4,3,2,1};
  int *values;
  values=arr;
  printf("the num in values is %d\n",values);
  printf("%d",count(values));
}
int count(int *arr)
 {
   int count=0;
   while(*arr)
   {
     count++;
     arr++;
   }
   return count;
 }
heroiczero
@heroiczero
Sep 19 2017 10:52
@naveen62 did you try
function test() {
    id = uniqid();
}
Emmanuel Akodia
@akodiaemma
Sep 19 2017 10:52

hello world
so i am using zxing framewrk to make a qr scanner that works perfect
this is the code

package io.github.akodiaemmanuel.mapenziscanner;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;


import com.google.zxing.Result;

import me.dm7.barcodescanner.core.ViewFinderView;
import me.dm7.barcodescanner.zxing.ZXingScannerView;

/**
 * Created by Akodia Emmanuel on 9/18/2017.
 */

public class MainActivity extends Activity implements ZXingScannerView.ResultHandler {
    private ZXingScannerView mScannerview;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity);
    }

    public void onClick(View v){
        mScannerview = new ZXingScannerView(this);
        setContentView(mScannerview);
        mScannerview.setResultHandler(this);
        mScannerview.startCamera();
    }
    @Override
    public void handleResult(Result result) {
//Do anything with the result here
        Log.w("handleResult",result.getText());
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Scan Result");
        builder.setMessage(result.getText());
        AlertDialog alertDialog = builder.create();
        alertDialog.show();

        //resume scanning
        //mScannerview.resumeCameraPreview(this);
    }
}

i want to connect it to an online database so that i can append data into it...
any ideas

Naveen B
@naveen62
Sep 19 2017 10:53
i found that its bad pratice @heroiczero
heroiczero
@heroiczero
Sep 19 2017 10:53
@mbsyaswanth this looks like java. is it java?
Naveen B
@naveen62
Sep 19 2017 10:53
in vanilla js this can be done using this keyword
mbsyaswanth
@mbsyaswanth
Sep 19 2017 10:53
its c @heroiczero
heroiczero
@heroiczero
Sep 19 2017 10:55
@naveen62 var id is a local scope variable inside the function so it is hard to access it unless you assign it to a global variable inside the function.
Naveen B
@naveen62
Sep 19 2017 10:57
var a
var data = a;
function test() {
    var id = uniqid();
    id = a
}
does this work
heroiczero
@heroiczero
Sep 19 2017 10:58
@naveen62 i think its a=id.
Naveen B
@naveen62
Sep 19 2017 10:59
:smile: my mistake
heroiczero
@heroiczero
Sep 19 2017 10:59
:)
Naveen B
@naveen62
Sep 19 2017 11:00
thanks @heroiczero
CamperBot
@camperbot
Sep 19 2017 11:00
naveen62 sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1750 | @heroiczero |http://www.freecodecamp.com/heroiczero
Kingsley
@Kingwindie
Sep 19 2017 11:20
```
```
  height:320px;
  width:320px;
  background:black;
  left:50%;
  transform:translatex(-50%)
}
can someone help explain to me why this container will not center in the middle of the screen
korzo
@korzo
Sep 19 2017 11:40
@Kingwindie
what is position value?
and display?
Kingsley
@Kingwindie
Sep 19 2017 11:42
@korzo position value fixed it,i set it to absolute,i assume the display is block,it's a div
santhoshbalaguru001
@santhoshbalaguru001
Sep 19 2017 11:43
nav bar i given background-color: black
korzo
@korzo
Sep 19 2017 11:44
@Kingwindie If I remember correctly, transform works only on block elements or absolutely positioned elements
santhoshbalaguru001
@santhoshbalaguru001
Sep 19 2017 11:44
but its doesnot showing
please help me
anyone is ther
korzo
@korzo
Sep 19 2017 11:51
@santhoshbalaguru001 Because div pageone is inside navigation
Kingsley
@Kingwindie
Sep 19 2017 11:53
@korzo thanks
CamperBot
@camperbot
Sep 19 2017 11:53
kingwindie sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 510 | @korzo |http://www.freecodecamp.com/korzo
wky
@immortalwang
Sep 19 2017 12:15

<style>
body {
background-color: black;
font-family: Monospace;
color: green;
}
pink-text {
color: pink;
}
</style>

<body>
<h1 class="pink-text";>Hello World!</h1>
</body>

what erreo
what error
Sorin Ruse
@sorinr
Sep 19 2017 12:17
@immortalwang take a look in here <h1 class="pink-text";>. you have some extra char in there :)
LydaTech
@lydatech
Sep 19 2017 12:26
@Kingwindie Did you fix your issue?
rscales02
@rscales02
Sep 19 2017 12:52
function primeTest() {
  var factorable = whatFactors(13195);
  var factored = [];
  for (var i = 1; i < factorable.length; i++) {
    var m = Math.sqrt(factorable[i])
    for (var x = 2; x < m; x++) {
      if (factorable[i] % x == 0) {
        factored.push(factorable[i]);
      }
    }
  }
  var final = []
  for (var j = 0; j < factored.length; j++) {
    if (factored.indexOf(factorable[j]) == -1)
      final.push(factorable[j]);
  }
  console.log(final);  //[1, 5, 7]
  console.log(factored);  //[35, 65, 91]
  console.log(factorable);  //[1, 5, 7, 13, 29, 35, 65, 91]
}
can someone help me figure out why final stops without including 13 & 29?
Jan Shah
@JanShah
Sep 19 2017 13:04
var m = Math.sqrt(factorable[i]) if you use factorable[i] it gives you the result you want for final. other output is duplicated but that looks like the reason final isn't giving you the complete anser
@rscales02
rscales02
@rscales02
Sep 19 2017 13:12
I got it! for (var j = 0; j < factored.length; j++ should be for (var j = 0; j < factorable.length; j++
Darren
@DarrenfJ
Sep 19 2017 15:03
morning fCC
@ericmiller777 hey like yer tic-tac-toe.. :D
Kyle Holm
@thekholm80
Sep 19 2017 15:07
@DarrenfJ :wave:
Darren
@DarrenfJ
Sep 19 2017 15:07
@thekholm80 hey buddy! haven't seen you around as much anymore...
busy coding I'm assuming
;)
also. brownies, cause yer awesome and i appreciate seeing you hang out and helping out :0
thanks @thekholm80
CamperBot
@camperbot
Sep 19 2017 15:09
darrenfj sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1471 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Darren
@DarrenfJ
Sep 19 2017 15:09
now I have to go pretend to test for a day :/
DarrenfJ @DarrenfJ sneaks out the side door
Kyle Holm
@thekholm80
Sep 19 2017 15:12
@DarrenfJ haha thanks Darren
CamperBot
@camperbot
Sep 19 2017 15:12
thekholm80 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2035 | @darrenfj |http://www.freecodecamp.com/darrenfj
Nahuel Ovejero
@NahuelOvejero
Sep 19 2017 15:59
:wave: people
Kyle Holm
@thekholm80
Sep 19 2017 16:14
@NahuelOvejero :wave:
Nahuel Ovejero
@NahuelOvejero
Sep 19 2017 16:16
@thekholm80 how is my react master doing?
Kyle Holm
@thekholm80
Sep 19 2017 16:17
getting my butt kicked at work
it's really hard to be lazy and get a paycheck
Nahuel Ovejero
@NahuelOvejero
Sep 19 2017 16:21
Well, there always these hardcore days at work
and some dead ones
I hope
Kyle Holm
@thekholm80
Sep 19 2017 16:21
yeah
the busy days make me appreciate the rest
Nahuel Ovejero
@NahuelOvejero
Sep 19 2017 16:23
busy days ends quicker also
Kyle Holm
@thekholm80
Sep 19 2017 16:29
very true
Nahuel Ovejero
@NahuelOvejero
Sep 19 2017 16:30
well Kyle, gota go, hope your works end soon, nice to know about you
have fun!
Kyle Holm
@thekholm80
Sep 19 2017 16:30
@NahuelOvejero :wave:
rscales02
@rscales02
Sep 19 2017 16:32
Has anyone recently done the twitch.tv app?
piteto
@piteto
Sep 19 2017 16:37
yes, someone was asking about it earlier today in the HelpFrontEnd room @rscales02
rscales02
@rscales02
Sep 19 2017 16:40
thanks @piteto I will head there!
CamperBot
@camperbot
Sep 19 2017 16:40
rscales02 sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 122 | @piteto |http://www.freecodecamp.com/piteto
Could anyone tell me how to display a message when the timer reaches zero?
I'm not having any luck with setTimeout
Sorin Ruse
@sorinr
Sep 19 2017 17:28
@josha5 think your problem its in here ​if (minutes < 0) clearInterval..... what if the counter have less then a min? in this case i would transform anything to secnds and then evaluate the if
@josha5 be aware that if u click twice the start btn the counter will decrese by 2secs instead of one
Joshua Arnett
@josha5
Sep 19 2017 17:40
@sorinr Got it working thanks!
CamperBot
@camperbot
Sep 19 2017 17:40
josha5 sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1337 | @sorinr |http://www.freecodecamp.com/sorinr
Sorin Ruse
@sorinr
Sep 19 2017 17:42
@josha5 :+1:
Darren
@DarrenfJ
Sep 19 2017 17:44
@NahuelOvejero buddy!
Joshua Arnett
@josha5
Sep 19 2017 17:44
@sorinr Yeah I plan on fixing that once I'm done building it, its actually a helpful bug right now haha
@sorinr Any suggestions on making a button only clickable once?
Darren
@DarrenfJ
Sep 19 2017 17:44
@thekholm80 gotta take a break.. surprisingly this kata is kicking my ass (hard to do while also testing :D ) ; https://www.codewars.com/kata/exclamation-marks-series-number-3-remove-all-exclamation-marks-from-sentence-except-at-the-end/train/javascript
Sorin Ruse
@sorinr
Sep 19 2017 17:46
@josha5 u can just use a var that u should toggle true or false
Rajan
@ProgramNovice
Sep 19 2017 17:52
Hi guys
I tried to access https://codepen.io/signup/free
but it says that the page is not found
Kyle Holm
@thekholm80
Sep 19 2017 17:52
@DarrenfJ bleh, i tried it but my reading comprehension sucks
Rajan
@ProgramNovice
Sep 19 2017 17:52
have anyone of you experienced this problem too?
Sorin Ruse
@sorinr
Sep 19 2017 17:59
@ProgramNovice think u looking for https://codepen.io/accounts/signup
@ProgramNovice more specifically https://codepen.io/accounts/signup/user/free
Rajan
@ProgramNovice
Sep 19 2017 18:12
@sorinr oh ok thanks alot Sorin :)
CamperBot
@camperbot
Sep 19 2017 18:12
programnovice sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1338 | @sorinr |http://www.freecodecamp.com/sorinr
quickspeedy
@quickspeedy
Sep 19 2017 19:03

I'm working on Title Case a Sentence algorithm where first letter of each word needs to be capitalized.

function titleCase(str) {
  var arr = str.toLowerCase().split(" ");
  var updatedArr;
  var upperCase;
  //console.log(arr[0][0].toUpperCase());
  for(var i = 0; i < arr.length; i++) {
    //console.log(arr[i][0].toUpperCase());
    console.log(arr[i][0].toUpperCase());
    //console.log("Uppercase letter: " + upperCase);
    console.log(arr[i]);
    //console.log("Current array: " + arr[3][0].push(upperCase));
//     console.log(updatedArr);
  }
  //console.log(arr);
  return str;
}

I managed to grab each of the first letter of each word and make it uppercase but I am having issue on how to push it back it to the array. I tried arr[i][0].push(upperCase) but I get an error.

Kyle Holm
@thekholm80
Sep 19 2017 19:08
@quickspeedy you can directly change the value of an array item
var myArray = [1, 2, 3];
myArray[1] = 4;
console.log(myArray) // => [1, 4, 3]
for this to work in your application, because you cannot mutate a string this way, you will have to split each word into an array of letters
quickspeedy
@quickspeedy
Sep 19 2017 19:11
@thekholm80 Ok I will try that. Thanks! @thekholm80
CamperBot
@camperbot
Sep 19 2017 19:11
quickspeedy sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1472 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Patryk Zajdler
@pzaj2
Sep 19 2017 19:18
hi everyone, I have what I believe may be unusual question here. It's pretty general, but... how do I start with unit tests and integration tests for web applications? I mean, I know the theory (more/less) of what unit tests, not so much about integration tests. What I find hard is to take that theory and use in practice. Just starting with a question of... what should I actually test using unit tests in web application? I mean, most of the things going on when it comes to web apps I'm thinking about is database communication and/or working with 3rd party APIs, none of these seem to really be testable with unit tests. Just don't know where to start, perhaps that means I don't really get unit tests after all, nevertheless I'd love to actually learn from nice examples rather than just re-read the theory.
aRtoo
@artoodeeto
Sep 19 2017 19:53
hi guys question. i need help. on this code about the heaps algorithm. i called the function inside the for loop and theres if statement inside the for loop. my question is when it goes inside the loop then calls the generate(n-1) will it exit the loop or change the value of n every time it loops while if statement is being executed? im confuse bros. need help. im trying to trace it on paper and im always stuck on that part i dont know which is to move. thnaks.
function generate(n) {
    if(n===1 && !regex.test(str.join(''))) {
      check.push(str.join(''));
    } else {
      for(var i=0; i<n; i++) {
        generate(n-1);
        if(n % 2 === 0 ) {
          swaper(i,n-1);
        } else {
          swaper(0,n-1);
        }
      }
    }
  }
  generate(3);
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 20:00
@artoodeeto for what I see and Think you need to store the result that comes out from the generate(n-1);
so only after you can use it in your if right?
aRtoo
@artoodeeto
Sep 19 2017 20:02
@tiagocorreiaalmeida im sorry bro say what again?? i already got the algo right. i just followed the psuedocode on heaps algorithm and got it right.
@tiagocorreiaalmeida im just confused on for loop with function call inside
Tiago Correia
@tiagocorreiaalmeida
Sep 19 2017 20:03
add some console logs and see where it goes everytime?
aRtoo
@artoodeeto
Sep 19 2017 20:05
@tiagocorreiaalmeida bro i swear i tried that it confuses me more
@tiagocorreiaalmeida tried even making a function on a separate repl.it a simple one confuses me more
Engjell Bislimi
@Engjell00
Sep 19 2017 20:30
Hello guys I have a question is there a way I can take 3 picture to size them about the same size !?
Nahuel Ovejero
@NahuelOvejero
Sep 19 2017 20:34
@Engjell00 width and weigth
Engjell Bislimi
@Engjell00
Sep 19 2017 20:35
since the original picture didnt have the same width and height as the other one. If I change it about the same the picture it's as fluid as it was and looks ugly
it's not **
Nahuel Ovejero
@NahuelOvejero
Sep 19 2017 20:37
welp, gotta download the imgs,modify them with any editor, and then upload it
piteto
@piteto
Sep 19 2017 20:42
@Engjell00 It's easiest to make your images all the same size in a photo editor. If that's not an option, make them background images and use background-size cover, but some of the image will be cropped
Engjell Bislimi
@Engjell00
Sep 19 2017 20:44
@piteto So is it better that I use bigger images to make them smaller?
piteto
@piteto
Sep 19 2017 20:45
@Engjell00 Mainly, they need to have the same aspect ratio, but yes, always best to use smaller images if you can so they load more quickly.
Here's an example of using them as background images if you don't want to edit them in MS Paint/Photoshop/etc: https://codepen.io/anon/pen/OxNWeM?editors=1101
The first one is 400x400, second is 600x600, and the third is 800x800
but they're all shown in a 400x400 div
quickspeedy
@quickspeedy
Sep 19 2017 21:06
I am trying to figure out how to swap the first index of each word. So far, I managed to split each word then to each letter. I use letterArr[0].toUpperCase(); to make the first letter of each word uppercase. I tried to assign it back to the array using push() but it doesn't work. Is there a way to update the array?

function titleCase(str) {
  var arr = str.toLowerCase().split(" ");
  var updatedArr;
  var upperCase;
  //console.log(arr[0][0].toUpperCase());
  for(var i = 0; i < arr.length; i++) {
    //console.log(arr[i][0].toUpperCase());
//     console.log(arr[i][0].toUpperCase());
    var letterArr = arr[i].split("");
    console.log("Before Letter: " + letterArr);
    letterArr[0].toUpperCase();
    console.log("After Letter: " + letterArr);
    //console.log("Uppercase letter: " + upperCase);
//     console.log(arr[i]);
    //console.log("Current array: " + arr[3][0].push(upperCase));
//     console.log(updatedArr);
  }
  //console.log(arr);
  return str;
}

titleCase("I'm a little tea pot");
Manish Giri
@Manish-Giri
Sep 19 2017 21:27
@quickspeedy push() adds to the end of the array
won't work
Ygor Dantas
@ygordantas
Sep 19 2017 21:28
Any feedback is welcome. Thx
https://codepen.io/ygordantas/full/LzNWBE/
Stephen James
@sjames1958gm
Sep 19 2017 21:44
@ygordantas Looks great!
@quickspeedy arr[i] = letterArr.join('');
Often you will match a split with a join.
Albert Cardona II
@daddycardona
Sep 19 2017 22:13
@quickspeedy can you do that without an array charAt
@ygordantas looks awesome :)
str.charAt(0).toUpperCase @quickspeedy
nevermind I see what you are doing
Albert Cardona II
@daddycardona
Sep 19 2017 22:19
anyone here good with regex?
Manish Giri
@Manish-Giri
Sep 19 2017 22:20
somewhat
what's your qs
Albert Cardona II
@daddycardona
Sep 19 2017 22:22
Okay I am trying to figure out or understand /W and how to make the spaces go away
var reg = /\s\W+/g;
this will give me spaces with my string I am trying to extract just a special character like &
it gives me white spaces with or witthout the \s
Manish Giri
@Manish-Giri
Sep 19 2017 22:29
what's the input string
Albert Cardona II
@daddycardona
Sep 19 2017 22:30
so for instance "Hamburgers < Pizza < Tacos" I get the space after hamburgers and before pizza
and ofcourse after pizza and before tacos
Manish Giri
@Manish-Giri
Sep 19 2017 22:31
what is it you're extracting
Albert Cardona II
@daddycardona
Sep 19 2017 22:31
I am trying to get the <
but that expression is getting the <
well the spaces as well
Manish Giri
@Manish-Giri
Sep 19 2017 22:32
uh
i'm not sure what you mean
Albert Cardona II
@daddycardona
Sep 19 2017 22:33
the goal is to replace the < with the html version of if like for instance & is &amp
but I get <
there is a space in front of the < and after the < I want to get rid of so space < space
I need the only the <
Manish Giri
@Manish-Giri
Sep 19 2017 22:34
a = "Hamburgers & Pizza & Tacos"
"Hamburgers & Pizza & Tacos"
a.replace(/&/g, '&amp;')
"Hamburgers &amp; Pizza &amp; Tacos"
Albert Cardona II
@daddycardona
Sep 19 2017 22:35
yies
yes
:)
but for this one it is the < lol
Engjell Bislimi
@Engjell00
Sep 19 2017 22:35
Hello guys, Is there any way I could show my website? I'm not sure with Codepen since I have 3 html pages
Manish Giri
@Manish-Giri
Sep 19 2017 22:35
just use < instead of &
and whatever it's version is
Albert Cardona II
@daddycardona
Sep 19 2017 22:37
Okay that makes sence but I have to have a bunch of them so like !@#$%%^^&&*(()) all needs to be replace so if I had multiple sentences then it all needs to be replaced
so my goal was trying to do something like make an regex like \W plus no space so it can capture all the special characters
Engjell Bislimi
@Engjell00
Sep 19 2017 22:51
@daddycardona I think you'll like this fake website I made haha it's about beatboxing
Albert Cardona II
@daddycardona
Sep 19 2017 22:51
oh snap I already love it lol
Engjell Bislimi
@Engjell00
Sep 19 2017 22:52
it has a business aspect about it but you know haha
Kyle Holm
@thekholm80
Sep 19 2017 22:54
@daddycardona maybe something like
const specialChars = [
  {char: '<', special: '&lt;'},
  {char: '>', special: '&gt;'},
  {char: '&', special: '&amp;'}
];

let str = 'This is a < string with > some special & chars in it';

specialChars.forEach(item => {
  str.replace(item.char, item.special);
});
Albert Cardona II
@daddycardona
Sep 19 2017 22:55
that would work but it is telling me to use regex lol
Kyle Holm
@thekholm80
Sep 19 2017 22:55
oh
i'm dumb when it comes to regex
Albert Cardona II
@daddycardona
Sep 19 2017 22:55
so I am doing this challenge Convert HTML Entities
Kyle Holm
@thekholm80
Sep 19 2017 22:55
i thought this was for something you were building lol
Albert Cardona II
@daddycardona
Sep 19 2017 22:56
No but if it was I would definitely use what you have there so simple lol
Kyle Holm
@thekholm80
Sep 19 2017 22:56
i like simple
Albert Cardona II
@daddycardona
Sep 19 2017 22:57
me too but fcc likes to complicate my brain lol
Kyle Holm
@thekholm80
Sep 19 2017 22:57
fcc is just trying to make you a better coder
i don't want to be better, though. just taller
Albert Cardona II
@daddycardona
Sep 19 2017 23:00
lmao
yes but they said read these regex docs and do it dam you lol
I basically would like to do what you did with regex lol
so what do you use most @thekholm80
Kyle Holm
@thekholm80
Sep 19 2017 23:04
what do i use most?
Albert Cardona II
@daddycardona
Sep 19 2017 23:04
LMAO no when doing these types of challenges if you are still doing any of them you usually oneline everything lol
give that a shot
@dhcodes gave me that link, I think, it's a pretty good way to learn regex
Albert Cardona II
@daddycardona
Sep 19 2017 23:05
that is going to tell me i suck get a life lmao
Kyle Holm
@thekholm80
Sep 19 2017 23:06
nah, it will teach you
it's good
Albert Cardona II
@daddycardona
Sep 19 2017 23:07
Okay I hope well I am off to learn
I am trying to do what you did but with regex son of a gun
Kyle Holm
@thekholm80
Sep 19 2017 23:07
oh, that's easy
one sec, i have to look it up to make sure i don't tell you wrong lol
Albert Cardona II
@daddycardona
Sep 19 2017 23:10
LMAO
like I said I am just trying to match special characters lol
Kyle Holm
@thekholm80
Sep 19 2017 23:10
if you wanted to use what i had, you'd just put /</ instead of '<'
i believe
i haven't used regex in so long
Albert Cardona II
@daddycardona
Sep 19 2017 23:13
it is not about that specific one, I need to catch <!@#$%^& etc.. I am trying to single them out that is all lol
Kyle Holm
@thekholm80
Sep 19 2017 23:15
is this an fcc challenge?
never mind, i found it
Albert Cardona II
@daddycardona
Sep 19 2017 23:16
yes it is lol
Kyle Holm
@thekholm80
Sep 19 2017 23:16
yeah i didn't use regex or replace when i did it lol
Stephen James
@sjames1958gm
Sep 19 2017 23:18
@daddycardona You can read up about regex character classes and character sets
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#character-classes
These are ways of matching sets of characters
Albert Cardona II
@daddycardona
Sep 19 2017 23:18
LMAO cheater what did you do a loop lol
Kyle Holm
@thekholm80
Sep 19 2017 23:19

the instructions say

Convert the characters &, <, >, " (double quote), and ' (apostrophe), in a string to their corresponding HTML entities.

it doesn't say you have to use regexp or replace()
so i didn't cheat, i did it the hard way lol
Albert Cardona II
@daddycardona
Sep 19 2017 23:20
well then that makes sense
I still want to do it the way they want me too maybe i can use something like [<>&"']
not that didn't work lol
Kyle Holm
@thekholm80
Sep 19 2017 23:24
i don't think the code i put up above will work either
replace() returns the new string, it doesn't mutate the original
Albert Cardona II
@daddycardona
Sep 19 2017 23:26
var newstr lol
Manish Giri
@Manish-Giri
Sep 19 2017 23:28
@thekholm80 :wave:
Kyle Holm
@thekholm80
Sep 19 2017 23:29
@Manish-Giri heya
Albert Cardona II
@daddycardona
Sep 19 2017 23:33
btw thanks @thekholm80 @Manish-Giri and @sjames1958gm :)
CamperBot
@camperbot
Sep 19 2017 23:33
daddycardona sends brownie points to @thekholm80 and @manish-giri and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 1473 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 6554 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 8470 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Kyle Holm
@thekholm80
Sep 19 2017 23:36
@daddycardona ty too
CamperBot
@camperbot
Sep 19 2017 23:36
thekholm80 sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 344 | @daddycardona |http://www.freecodecamp.com/daddycardona