These are chat archives for FreeCodeCamp/HelpFrontEnd

24th
Feb 2018
aadtyaraj01
@aadtyaraj01
Feb 24 2018 03:37
Please everyone share your opinion
https://codepen.io/aadtyaraj/pen/qxYqbL
Tom
@moT01
Feb 24 2018 03:48
@aadtyaraj01 works great
looks decent
looks pretty good - but could be better - function is perfect
maybe one flaw in the function - i can put numbers in till they go off the screen
Ken Haduch
@khaduch
Feb 24 2018 03:59
@aadtyaraj01 - I tried a couple calculations - one thing that I noticed is that after you complete one calculation, with the result displayed in the calculator display, that a new number input is just appended to the result of the previous calculation. Most calculators that I use will clear the previous result and begin a new calculation after the first is completed, when a new number sequence is entered.
Vladislav Ivanov
@developer4eto
Feb 24 2018 06:23
This looks so cool
zootechdrum
@zootechdrum
Feb 24 2018 07:09
hey guys trying to make something for a friend
I need help
how can i apply a different color to each rect element in my blocks array
here is the link to my code
Roman Struna
@RomchyFCC
Feb 24 2018 08:32
you could try using Math.random function when creating a block and add color to it
one thing that comes to mind would be
@zootechdrum
This message was deleted
rgb((Math.floor(Math.random() * 255) + 1),(Math.floor(Math.random() * 255) + 1),(Math.floor(Math.random() * 255) + 1))
Roman Struna
@RomchyFCC
Feb 24 2018 08:42
Here is how I did it @zootechdrum
Block.prototype.render = function() {
 ctx.font = "30px Arial";
ctx.fillText("Happy Birthday",580,50);
  ctx.fillRect(this.x, this.y, this.width, this.height);
  var randomNumber = (Math.floor(Math.random() * 255) + 1);
  var randomNumber1 = (Math.floor(Math.random() * 255) + 1);
  var randomNumber2 = (Math.floor(Math.random() * 255) + 1);
  ctx.fillStyle = "rgb("+randomNumber+","+randomNumber1+","+randomNumber2+")";
}
ahmed-issa-mohd
@ahmed-issa-mohd
Feb 24 2018 10:03
please how can I make like this check box
image.png
can you help me
PierreProgramer
@PierreProgramer
Feb 24 2018 10:03
can you give me the code
ahmed-issa-mohd
@ahmed-issa-mohd
Feb 24 2018 10:10
I do not have the code
just I want to make it
PierreProgramer
@PierreProgramer
Feb 24 2018 10:10
shouldnt be too hard
does it circle the thing when you hover
can you send me the link to the website where you see it
ahmed-issa-mohd
@ahmed-issa-mohd
Feb 24 2018 10:12
I have the image only
Nam V. Do
@fantasy2943
Feb 24 2018 10:57
hey guys,I need you help.
Fabien SHAN
@X140hu4
Feb 24 2018 10:57
@ahmed-issa-mohd Breakdown the task. What is the easiest part you can make? what is the next? and the next?
Nam V. Do
@fantasy2943
Feb 24 2018 10:58
image.png
ahmed-issa-mohd
@ahmed-issa-mohd
Feb 24 2018 11:00
PierreProgramer
@PierreProgramer
Feb 24 2018 11:00
@ahmed-issa-mohd this is where I got so far you can use :hover to do the rest
ahmed-issa-mohd
@ahmed-issa-mohd
Feb 24 2018 11:00
i need make like this
image.png
image.png
Nam V. Do
@fantasy2943
Feb 24 2018 11:01
How can I clear the margin on the right hand side and show the entire white space?
ahmed-issa-mohd
@ahmed-issa-mohd
Feb 24 2018 11:01
i need check box
PierreProgramer
@PierreProgramer
Feb 24 2018 11:02
turn the divs into forms and have checkboxes
ahmed-issa-mohd
@ahmed-issa-mohd
Feb 24 2018 11:02
how ?
please help me
okay i can
i am working now
PierreProgramer
@PierreProgramer
Feb 24 2018 11:03
:)
ahmed-issa-mohd
@ahmed-issa-mohd
Feb 24 2018 11:03
but i have problem check box
Fabien SHAN
@X140hu4
Feb 24 2018 11:11
@ahmed-issa-mohd I am sorry if I am rude but it sounds like you are looking for someone here to do the work for you. If you are here to learn come with something you tried to do, explain your problem and we can work a solution together.
Nam V. Do
@fantasy2943
Feb 24 2018 11:12
alt
How can I fix this?
How can I clear the margin on the right hand side and show the entire white space?
PierreProgramer
@PierreProgramer
Feb 24 2018 11:13
can you send me the url
try using max-width: 100%;
Nam V. Do
@fantasy2943
Feb 24 2018 11:14
In what part?
PierreProgramer
@PierreProgramer
Feb 24 2018 11:14
on the background image
can u send me the code
Nam V. Do
@fantasy2943
Feb 24 2018 11:16
@PierreProgramer How can I fix this?
PierreProgramer
@PierreProgramer
Feb 24 2018 11:18
its not loading
Screen Shot 2018-02-24 at 12.18.49 PM.png
I reloaded already
Nam V. Do
@fantasy2943
Feb 24 2018 11:19
Why?
PierreProgramer
@PierreProgramer
Feb 24 2018 11:20
you dont have any img tags
oh wait nvm
Nam V. Do
@fantasy2943
Feb 24 2018 11:20
This url image seems have broken
plz wait me
PierreProgramer
@PierreProgramer
Feb 24 2018 11:21
ill wait
Nam V. Do
@fantasy2943
Feb 24 2018 11:21
I recreated a new url, you try again...
PierreProgramer
@PierreProgramer
Feb 24 2018 11:23
its your navbar thats screwing it up
Nam V. Do
@fantasy2943
Feb 24 2018 11:24
So What should I do ?
PierreProgramer
@PierreProgramer
Feb 24 2018 11:24
wait 1 second
Nam V. Do
@fantasy2943
Feb 24 2018 11:28
I am still waiting...
PierreProgramer
@PierreProgramer
Feb 24 2018 11:28
you need to make a button that displays the navbar and make it fixed
Nam V. Do
@fantasy2943
Feb 24 2018 11:29
you can show the example code to help me ?
PierreProgramer
@PierreProgramer
Feb 24 2018 11:30
oh I see the problem
you made multiple containers
you should only have one
Vladislav Ivanov
@developer4eto
Feb 24 2018 11:37
Guys, I need some help
PierreProgramer
@PierreProgramer
Feb 24 2018 11:38
@fantasy2943 is it okay if I add boostrap
your navbar is very wrong
Matej BoĆĄnjak
@mbosnjak01
Feb 24 2018 11:45
@developer4eto ask question if you need help :)
PierreProgramer
@PierreProgramer
Feb 24 2018 11:47
@fantasy2943 Im sorry i need to go I got caught
doing programming in history class
Vladislav Ivanov
@developer4eto
Feb 24 2018 11:48
@mbosnjak01 I try to make accordion effect to side menu, but without a result. I don't know why. Here's the code - https://codepen.io/vlado27/pen/zRJNra
Nam V. Do
@fantasy2943
Feb 24 2018 11:57
@PierreProgramer Plz help me,thanks.
CamperBot
@camperbot
Feb 24 2018 11:57
fantasy2943 sends brownie points to @pierreprogramer :sparkles: :thumbsup: :sparkles:
:cookie: 3 | @pierreprogramer |http://www.freecodecamp.org/pierreprogramer
aadtyaraj01
@aadtyaraj01
Feb 24 2018 12:27
@khaduch Hey, thanks for taking the time to check out the program.
The appending was on purpose. I often operate on the result i get from a calculation. Also, the all clear button will solve your issue. :smile:
CamperBot
@camperbot
Feb 24 2018 12:27
aadtyaraj01 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3754 | @khaduch |http://www.freecodecamp.org/khaduch
Edy1988
@Edy1988
Feb 24 2018 12:37
@khaduch thanks! fixed- the nav-bar had to have min-height rather then height!!:)
CamperBot
@camperbot
Feb 24 2018 12:37
edy1988 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3755 | @khaduch |http://www.freecodecamp.org/khaduch
ahmed-issa-mohd
@ahmed-issa-mohd
Feb 24 2018 12:40
image.png
how I can make this , convert checkbox to radio when it checked
Edy1988
@Edy1988
Feb 24 2018 12:40
@gulsvi thanks! I was about to give up and move to a desert to live a life with no technology....
CamperBot
@camperbot
Feb 24 2018 12:40
edy1988 sends brownie points to @gulsvi :sparkles: :thumbsup: :sparkles:
:star2: 2621 | @gulsvi |http://www.freecodecamp.org/gulsvi
Chi
@chiyc
Feb 24 2018 13:12
@ahmed-issa-mohd If you're working with a custom JavaScript component, you need to remove the check on all other options when you select the option
You can approach this different ways, such as a conditional CSS class or writing a variable that holds the binary state for every option
Zerka1982
@Zerka1982
Feb 24 2018 13:28
Hello guys!
Can anyone help me create this button
image.png
This is something new for me ....
Nate Mallison
@NJM8
Feb 24 2018 13:36
@Zerka1982 Start with the image as a button setup, then I would guess that the orange part is an image and not text
Zerka1982
@Zerka1982
Feb 24 2018 13:37
I found a solution
Fabien SHAN
@X140hu4
Feb 24 2018 14:34
@Zerka1982 I wonder if that would involve ::before and ::after
Wilson
@wilson-crawford
Feb 24 2018 14:42
@fantasy2943 probably in CSS. Can you show us the CSS?
@Zerka1982 ^
Liam Docherty
@ldocherty1
Feb 24 2018 14:58

As you can see below in my code when clicks on the helpsection method a PDF file opens. I was wondering instead of the PDF being behind the program, how can I bring that window in front of the program? I tried using Desktop.setVisible(true); However, I had no luck I got the error messages.

enter image description here

enter image description here

PROGRAM CODE

import java.util.Scanner; //taking input from user
import java.io.File;
import java.awt.Desktop;

public static void helpsection() {
        try {
            Desktop.getDesktop().open(new File("CVliamdocherty.pdf"));
            Desktop.setVisible(true);
        } catch(Exception e) {
            System.out.println(e);
        }
        System.out.println("Would you like to go back into the program to select a course to find out your grade?");
        System.out.println("You can enter 'Yes' or 'No' only.");
        outcome2 = userinput.next();
        if (outcome2.equalsIgnoreCase("Yes")) {
            step1();
        } else if (outcome2.equalsIgnoreCase("No")) {
            System.out.println((username)+" thanks for using Liam's UCAS grade calculator.");
            System.exit(0);
        } else { 
            System.out.println("You have entered an invalid value.");
            System.out.println("The program now will re run, make sure to enter the correct value next time.");
            step1();
        } 
    }
LydaTech
@lydatech
Feb 24 2018 15:05
@ldocherty1 looks like java
Pankaj Jain
@thehitechpanky
Feb 24 2018 15:06
anyone interested to be a part of an opensource chat project PM me.... For details please see https://trello.com/b/Yh5b9pw8/chaterz
Liam Docherty
@ldocherty1
Feb 24 2018 15:07
@lydatech Yes
Stephen James
@sjames1958gm
Feb 24 2018 15:10
@ldocherty1 looks to me like the Desktop class doesn't support what you want
Liam Docherty
@ldocherty1
Feb 24 2018 15:12
@sjames1958gm Oh ok, is there another way to do what I want the outcome to be? thanks for the reply
CamperBot
@camperbot
Feb 24 2018 15:12
ldocherty1 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9023 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Ken Haduch
@khaduch
Feb 24 2018 15:12
@aadtyaraj01 :point_up: February 24, 2018 7:27 AM - you're welcome. I understand the appending, but I don't really see the usefulness of appending directly to the number that resulted with additional numbers? I can see continuing another operation, like adding to it with the + operator, etc.
@Edy1988 - :point_up: February 24, 2018 7:37 AM - you're welcome! :)
Stephen James
@sjames1958gm
Feb 24 2018 15:13
@ldocherty1 I am surprised the opened window is not in front. I don't see a way
Liam Docherty
@ldocherty1
Feb 24 2018 15:18
@sjames1958gm :(
Stephen James
@sjames1958gm
Feb 24 2018 15:21
@ldocherty1 yeah. I would have thought there was something that could move your application behind. Doesn't look like anyway to move the PDF view forward
Liam Docherty
@ldocherty1
Feb 24 2018 15:38
@sjames1958gm Bringing the application behind would also work because the PDF would be in front?
lawrencelee93
@lawrencelee93
Feb 24 2018 15:53
could someone help me?
console.log(
(function fn(n){
return (n > 2 ? n*fn(n-1) ? n-2)
}(5))
)
i have this code here but idk why it won't output anything :'(
Aditya
@ezioda004
Feb 24 2018 16:08
@lawrencelee93 Check the ternary operator, wrong syntax
lawrencelee93
@lawrencelee93
Feb 24 2018 16:09
what should i try putting in there?
sorry i'm a little stuck atm
Aditya
@ezioda004
Feb 24 2018 16:12
Are you trying to get factorial? @lawrencelee93
lawrencelee93
@lawrencelee93
Feb 24 2018 16:13
yes i am
Aditya
@ezioda004
Feb 24 2018 16:13
Then this should work
console.log(
(function fn(n){
return (n > 1 ? n*fn(n-1) : 1)
}(5))
)
lawrencelee93
@lawrencelee93
Feb 24 2018 16:14
why will it not work with 2 in there?
Aditya
@ezioda004
Feb 24 2018 16:15
for n > 2 it'll not multiply by 2, since 2 > 2 //false it'll return 1
lawrencelee93
@lawrencelee93
Feb 24 2018 16:15
sweet !
Thanks for the advice!
Aditya
@ezioda004
Feb 24 2018 16:16
:thumbsup:
lawrencelee93
@lawrencelee93
Feb 24 2018 16:25
(true + false) > 2 + true;
why does this output as false?
lawrencelee93
@lawrencelee93
Feb 24 2018 16:32
never mind i figured it out
function bar() {
return foo;
foo = 10;
function foo() {}
var foo = '11';
}
console.log(typeof bar());
can someone explain why this outputs as function?
Mark Pearyer
@marcusp619
Feb 24 2018 16:33
@lawrencelee93 stop using var switch to let unless its inside a method and you need to refer to an object
Aditya
@ezioda004
Feb 24 2018 16:35
@lawrencelee93 Because foo is a function? foo = 10 never executes , because of return whilefunction foo gets hoisted
lawrencelee93
@lawrencelee93
Feb 24 2018 16:36
sorry that im bombarding with questions :/
Aditya
@ezioda004
Feb 24 2018 16:37
Everyone is here to help and learn, dont worry about it :)
Patrick Moumiet
@PatrickMoumiet
Feb 24 2018 16:42
Hi everyone, i'm struggling for 3 weeks ( don't want to watch the solution) on the basic algorithm on putting capitalise letter on the beginning of the words of each arrays. I'm kind of desperate i tried a lot of different ways... any advices ? here the exercice
Aditya
@ezioda004
Feb 24 2018 16:44
@PatrickMoumiet press crtl + shift + m for markdown help
Patrick Moumiet
@PatrickMoumiet
Feb 24 2018 16:44
function titleCase(str) {

  var sel = str.split(" ");
  var res = [];

  for ( var i = 0 ; i < sel.length ; i++) {

    for ( var x = 0 ; x < sel[i].length ; x++) {

      if ( sel[i][x] == sel[i][x].toUpperCase()) {

         res.push (sel[i][x]) ;
      }

      else {

        res.push (sel[i][x]); 

      }

    }

  }

  return sel;
}


setTimeout(function(){ alert(" "); }, 1000);
titleCase("I'm a little tea pot");
Aditya
@ezioda004
Feb 24 2018 16:45
Why do you have a setTimeout()?
Patrick Moumiet
@PatrickMoumiet
Feb 24 2018 16:45
in case of infinite loop ^^
its res on the return
Aditya
@ezioda004
Feb 24 2018 16:50
@PatrickMoumiet I dont understand what you're trying to do with inner loop, cause the if condition inside dont do anything except pushing the same sel[i][x] to the array.
Patrick Moumiet
@PatrickMoumiet
Feb 24 2018 16:54
i am trying to access to the first letter of each element and then to check if it is a upper ou lower case then move on to the next one. But yeah the code is not correct at all... i just do not get how to access to each first letter and then let the others ones lower case.
Darren
@DarrenfJ
Feb 24 2018 16:56
morning fCC
Stephen James
@sjames1958gm
Feb 24 2018 16:57
@PatrickMoumiet you can use [0] to get the first letter and slice function to get the rest of the string
Patrick Moumiet
@PatrickMoumiet
Feb 24 2018 16:57
like array[x][0] toUpperCase then the others [x][i] to lower case ( but i have also a problems with the spaces..i lost them with split) I'm just basically lost ^^
Stephen James
@sjames1958gm
Feb 24 2018 16:57
@PatrickMoumiet You don't have to have an if statement - just force the value to the desired condition
Aditya
@ezioda004
Feb 24 2018 16:57
As @sjames1958gm suggested you should look into slice()
Stephen James
@sjames1958gm
Feb 24 2018 16:58
@PatrickMoumiet jointhe spaces back in
Patrick Moumiet
@PatrickMoumiet
Feb 24 2018 16:59
@sjames1958gm @sjames1958gm hm okay i m going to try
lawrencelee93
@lawrencelee93
Feb 24 2018 17:00
var arr = [];
arr[0] = 'a';
arr[1] = 'b';
arr.foo = 'c';
console.log(arr.length);
why is the length on this 2?
Stephen James
@sjames1958gm
Feb 24 2018 17:00
@PatrickMoumiet Here is the process that I would do in breaking down the problem
get the code to work with a single word in the string, then use that in a loop to do the whole sentence
@lawrencelee93 because length refers to number indexes and not object properties which is what foo is
lawrencelee93
@lawrencelee93
Feb 24 2018 17:02
thank you
Patrick Moumiet
@PatrickMoumiet
Feb 24 2018 17:03
@sjames1958gm okay thank!
CamperBot
@camperbot
Feb 24 2018 17:03
patrickmoumiet sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9024 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Feb 24 2018 17:06
@camperbot :+1:
Masaki
@masaki1223
Feb 24 2018 17:15
Hi guys. I'm currently having a trouble on Wikipedia API on FCC. Could anyone have a look on my penCode? I cannot get JSON from the api and replace it the body with it. https://codepen.io/reisener/pen/EQemLw
Tiago Correia
@tiagocorreiaalmeida
Feb 24 2018 17:17
hey there @masaki1223 I would start by preventing the form from refreshing the page
there's an event that can be called on the form submission
lawrencelee93
@lawrencelee93
Feb 24 2018 17:17

<ul class="shopping-list" id="awesome">
<li>
<span>Milk</span>
</li>
<li class="favorite" id="must-buy">
<span class="highlight">Sausage</span>
</li>
</ul>

CSS

ul#awesome #must-buy {
color: red;
}
.favorite span {
color: blue!important;
}

the color of sausage is blue because we are targeting the span inside the favorite class correct?
Tiago Correia
@tiagocorreiaalmeida
Feb 24 2018 17:19
@lawrencelee93 indeed
@masaki1223
lawrencelee93
@lawrencelee93
Feb 24 2018 17:19
While using ExpressJS, what is the difference between the following headers
content-type
accept
Tiago Correia
@tiagocorreiaalmeida
Feb 24 2018 17:19
something similiar to this will stop the apge refresh,
$("form").submit(function(event){
  event.preventDefault();
})
after that you will see what are the other problems I think
Masaki
@masaki1223
Feb 24 2018 17:22
I will try using it thanks @tiagocorreiaalmeida @lawrencelee93
CamperBot
@camperbot
Feb 24 2018 17:22
masaki1223 sends brownie points to @tiagocorreiaalmeida and @lawrencelee93 :sparkles: :thumbsup: :sparkles:
:cookie: 4 | @lawrencelee93 |http://www.freecodecamp.org/lawrencelee93
:cookie: 503 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Feb 24 2018 17:22
@masaki1223 try to look into the console after you gonna spot there some issues
lawrencelee93
@lawrencelee93
Feb 24 2018 17:23

function foo() {
return 1;
}

alert(foo());

function foo() {
return 2;
}

this one looks like it would return 1
how come it is returning 2?
ehutchllew
@ehutchllew
Feb 24 2018 17:23
@lawrencelee93 you're re-defining it. Overwriting.
Masaki
@masaki1223
Feb 24 2018 17:28
$.getJSON(newApi, function(result){ console.log("result: "+result); }); Does this show result in console? I'm having trouble...
The submission doesn't refresh the page anymore but, still cannot make it show the result
lawrencelee93
@lawrencelee93
Feb 24 2018 17:29
(function(s) {
return (function(r) {
console.log(s);
})(2)
})(1);
could you also explain as to why this outputs 1?
Tiago Correia
@tiagocorreiaalmeida
Feb 24 2018 17:30
@masaki1223 what's your console saying? have you checked?
Masaki
@masaki1223
Feb 24 2018 17:33
@tiagocorreiaalmeida It's saying nothing....
console.log(result) says nothing
it doesn't give me error either
Christopher McCormack
@cmccormack
Feb 24 2018 17:43
@masaki1223 are you looking at the developer console or the codepen console?
@masaki1223 you're getting a cross-origin error in your browser console. Try adding &origin=* to your URL parameters https://www.mediawiki.org/wiki/API:Cross-site_requests
lawrencelee93
@lawrencelee93
Feb 24 2018 17:45
Write a JS function that returns prime numbers upto a specified max (pass the max as an argument to this function). Do not return 17 and 53 in the results. Now wrap it in an immediately invoked function expression (IIFE).
can someoe help me with this?
Christopher McCormack
@cmccormack
Feb 24 2018 17:45
@lawrencelee93 what do you have so far?
lawrencelee93
@lawrencelee93
Feb 24 2018 17:47

for (var counter = 0; counter <= 100; counter++) {

var notPrime = false;
for (var i = 2; i <= counter; i++) {
    if (counter%i===0 && i!==counter) {
        notPrime = true;
    }
}
if (notPrime === false) {
            console.log(counter);
}

}

Christopher McCormack
@cmccormack
Feb 24 2018 17:47
@lawrencelee93
```
[code]
```
lawrencelee93
@lawrencelee93
Feb 24 2018 17:47
but i dont want it printing 17 or 53
Masaki
@masaki1223
Feb 24 2018 17:48
@cmccormack It worked! thanks a lot
CamperBot
@camperbot
Feb 24 2018 17:48
masaki1223 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1332 | @cmccormack |http://www.freecodecamp.org/cmccormack
Christopher McCormack
@cmccormack
Feb 24 2018 17:48
@masaki1223 np
@lawrencelee93 weird requirement, but you could use a filter on your results
lawrencelee93
@lawrencelee93
Feb 24 2018 17:50
could you show me how i could do that?
Christopher McCormack
@cmccormack
Feb 24 2018 17:50
@lawrencelee93 instead of logging in your loop, push the primes to an array
kerafyrm02
@kerafyrm02
Feb 24 2018 17:52
anyone stuck?
im here efor a little bit to help
Christopher McCormack
@cmccormack
Feb 24 2018 17:52
@lawrencelee93 here's a simple way to do it if you store your results in an array called results:
results = results.filter(function(prime){
  return prime !== 17 && prime !== 53
})
You would of course run this after your loop
@lawrencelee93 also, 0 and 1 are not primes
@lawrencelee93 and to make your algorithm more efficient, remember that only odd numbers over 2 will be prime, so you can use i+=2 in your inner loop counter if you start i at 3
lawrencelee93
@lawrencelee93
Feb 24 2018 17:55
im still getting stuck :/
kerafyrm02
@kerafyrm02
Feb 24 2018 17:56
What's the problem?
Christopher McCormack
@cmccormack
Feb 24 2018 17:56
@lawrencelee93 share your updated code and let us know what you're stuck with
im not sure where to add the results
Christopher McCormack
@cmccormack
Feb 24 2018 17:58
@lawrencelee93 create an empty array before the for loop, then push the valid primes to the array instead of logging them
@lawrencelee93 if you don't know how to use filter, you could also just modify your conditional if (notPrime === false) { to also include conditionals that check against 17 and 53
kerafyrm02
@kerafyrm02
Feb 24 2018 18:00
Lawrence do you know what a prime number is.
lawrencelee93
@lawrencelee93
Feb 24 2018 18:00
yes i do
3 5 7 11 13 etc
kerafyrm02
@kerafyrm02
Feb 24 2018 18:01
For starters.
I wouldnt call a variable notAnything
Or what you have notPrime
lawrencelee93
@lawrencelee93
Feb 24 2018 18:02
i was messing around and figured it
out
Tai Jones
@taiJones00
Feb 24 2018 18:09
Can I have some help? All of a sudden i'm getting errors when this was working recently https://codepen.io/taiJones00/pen/zddmNe?editors=1010
Christopher McCormack
@cmccormack
Feb 24 2018 18:12
@taiJones00 Uncaught ReferenceError: searchWiki is not defined
Tai Jones
@taiJones00
Feb 24 2018 18:13
Does this mean I should make it a function declaration instead? @cmccormack
Christopher McCormack
@cmccormack
Feb 24 2018 18:14
@taiJones00 I would suggest not adding onclick attributes to your elements in the first place
but you'll probably need to move that function outside your document.ready jquery if you want the onclick to function properly
I would suggest instead adding an event listener to the button within your javascript instead of using onclick
Tai Jones
@taiJones00
Feb 24 2018 18:19
I'll try it @cmccormack
Ali Abbas
@Abbas-000
Feb 24 2018 18:20
Hi can any anyone tell me how to use wikipedia api .... like which query or prop I should use?
Christopher McCormack
@cmccormack
Feb 24 2018 18:22
@taiJones00 also you don't need to use crossorigin.me - simply add &origin="*" to your URL parameters and wikipedia will allow cross site requests https://www.mediawiki.org/wiki/API:Cross-site_requests
@Abbas-000 there's a nice example on that page, and there is a sandbox you can use to test out other parameters
Tai Jones
@taiJones00
Feb 24 2018 18:25
That actually fixed it. Thank you @cmccormack
CamperBot
@camperbot
Feb 24 2018 18:25
taijones00 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1333 | @cmccormack |http://www.freecodecamp.org/cmccormack
Ali Abbas
@Abbas-000
Feb 24 2018 18:25
@cmccormack yes I am on sandbox I put action=query prop=info list=allpages format=json is it right?
Mark Pearyer
@marcusp619
Feb 24 2018 18:28
@taiJones00 hey
@taiJones00 what did you change its working now
did you remove the document ready ?
lawrencelee93
@lawrencelee93
Feb 24 2018 18:32

Does the HTML below trigger a HTTP GET request for the picture file, when the page first loads?

    Case 1:

<img src="mypic.jpg" style="visibility: hidden" alt="">

    Case 2:

<img src="mypic.jpg" style="display:none" alt="">

ehutchllew
@ehutchllew
Feb 24 2018 18:39
@lawrencelee93 No. Are you using a switch with html?
lawrencelee93
@lawrencelee93
Feb 24 2018 18:40
so both of the cases are no?
Marcus Parsons
@marcusparsons
Feb 24 2018 18:40
@lawrencelee93, there will be a request for mypic.jpg regardless of the CSS you set for it if you have those directly on the page. The CSS is only responsible for rendering the content, not for what gets requested.
lawrencelee93
@lawrencelee93
Feb 24 2018 18:40
sorry my professor gave us a homework assignment and i literally have no idea what is going on
ehutchllew
@ehutchllew
Feb 24 2018 18:40
it' shard to tell what you're trying to do with just that block of code.
Marcus Parsons
@marcusparsons
Feb 24 2018 18:40
^ that is also true
lawrencelee93
@lawrencelee93
Feb 24 2018 18:41
that is basically all the professor gave me
ehutchllew
@ehutchllew
Feb 24 2018 18:41
are you trying to create a switch condition that returns some img element?
lawrencelee93
@lawrencelee93
Feb 24 2018 18:41
so im like wtf
Marcus Parsons
@marcusparsons
Feb 24 2018 18:41
It triggers for both of them, if they're just directly in the HTML file.
ehutchllew
@ehutchllew
Feb 24 2018 18:41
Okay, well I won't outright answer your HW for you, but what are the full instructions?
lawrencelee93
@lawrencelee93
Feb 24 2018 18:42
i mean thats literally the question lol
ehutchllew
@ehutchllew
Feb 24 2018 18:42
just "Have an image load on page load."?
lawrencelee93
@lawrencelee93
Feb 24 2018 18:42
image.png
Marcus Parsons
@marcusparsons
Feb 24 2018 18:42
I just explained why above
Since we have to assume those are directly embedded into the HTML document, the browser will trigger a request for either of those. The CSS is only responsible for rendering the content after it has been retrieved.
ehutchllew
@ehutchllew
Feb 24 2018 18:44
Yeah, expanding on Marcus' point, it seems like those cases are from a switch lol, they're literally just different scenarios. They do make a request, just one is hidden but taking up space on the DOM, while the other is hidden and taking up no space.
aren't from*
najeeb-anwari
@najeeb-anwari
Feb 24 2018 18:45
Hello everyone!
I am using waves effect but I encountered with one error
Uncaught TypeError: $(...).tabs is not a function
at HTMLDocument.<anonymous> (waves.js:497)
at mightThrow (jquery-3.3.1.js:3534)
at process (jquery-3.3.1.js:3602)
It seems that the tab function is not defined but what is the reason?
I included the required plugins
and I checked the paths
they were correct
Can you help me?
Marcus Parsons
@marcusparsons
Feb 24 2018 18:53
Here's a Codepen to illustrate the point, @lawrencelee93. Notice how both images are loaded, and then via JavaScript (after page load), their display and visibility properties are overridden to show them. https://codepen.io/marcusparsons/pen/rJZpLg
@najeeb-anwari, perhaps you could throw your code into a Codepen and show us?
kerafyrm02
@kerafyrm02
Feb 24 2018 18:55
who isstuck?
Boarworm
@Boarworm
Feb 24 2018 19:00
Hi guys. Please recommend to me some tool for creating modular html and css. I want to create some base of components (html+css+js+image). For example, I have folder "button" that contain button.html, button.css, button.js and button-icon.jpg. And I have many others components. Then I want to create index.html and include needed components with some modifications. In output I want to get html page and css file. No needed react, angular e.g. All what I need is to create clear and simple html for small sites (landings, sites with 5-10 pages). Did you known some tools (gulp builder) with good comunity and documentation?
coderNewby
@coderNewby
Feb 24 2018 19:17
@DarrenfJ have another question for you
Jorge Garcia
@jorgeagc7
Feb 24 2018 19:17
Hi
Darren
@DarrenfJ
Feb 24 2018 19:17
coolCool wil check out the pm
coderNewby
@coderNewby
Feb 24 2018 19:18
thanks @DarrenfJ
CamperBot
@camperbot
Feb 24 2018 19:18
codernewby sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2402 | @darrenfj |http://www.freecodecamp.org/darrenfj
include*engine
@newtothat
Feb 24 2018 19:18
hey guys
Jorge Garcia
@jorgeagc7
Feb 24 2018 19:18
anyone knows why we need to use this on a constructor?
var Car = function() {
this.wheels = 4;
this.engines = 1;
this.seats = 5;
};
include*engine
@newtothat
Feb 24 2018 19:18
any tutorial for learning file system with dev tools ?
im having issues with specifying directory
Darren
@DarrenfJ
Feb 24 2018 19:19
@jorgeagc7 my very basic understanding is think of it as a very generic reference to the object
include*engine
@newtothat
Feb 24 2018 19:21
in main folder i have html css and js folders and in each of them files but when i open it in atom and open atoms live server it shows my folders there
Darren
@DarrenfJ
Feb 24 2018 19:21
@jorgeagc7 i have to reread stuff like this when i think about it too much: http://javascriptissexy.com/understand-javascripts-this-with-clarity-and-master-it/ because of all the nuance
Neil
@NNeil1
Feb 24 2018 19:22
Hope someone can point me in right direction. I currently have a side navigation, and I want two buttons at the top of Nav linking to other places. I want them inline next to each other with a divider between them (Like this: https://gyazo.com/54cdb6ea66eb16c7fb0a1f5d2644dcf9)
include*engine
@newtothat
Feb 24 2018 19:22
where to tell the browser to look at file
Neil
@NNeil1
Feb 24 2018 19:22
Just having some trouble doing it, and wondered if any one can point me in right direction
Jorge Garcia
@jorgeagc7
Feb 24 2018 19:22
@DarrenfJ mmm I have this strange need or feeling of placing var instead of "this" like declaring wheels etc..,
Nicole F.
@gitasong
Feb 24 2018 19:25
Anyone around? The other rooms seem pretty dead.
Jorge Garcia
@jorgeagc7
Feb 24 2018 19:25
@jorgeagc7 i have to reread stuff like this when i think about it too much: http://javascriptissexy.com/understand-javascripts-this-with-clarity-and-master-it/ because of all the nuance thanks!
CamperBot
@camperbot
Feb 24 2018 19:25
sorry jorgeagc7, you can't send brownie points to yourself! :sparkles: :sparkles:
Nicole F.
@gitasong
Feb 24 2018 19:26

I feel like I'm losing my mind. I completed the FCC Basic Algorithms two years ago, have done 1-1/2 bootcamps, am working in React Native. I'm gong back through the Basic Algorithms to refresh using more advanced syntaxes and now I can't create a simple for loop? What's wrong with my code below (the function's not finished yet)?

// generate array of all numbers <= num using array.push;
// reduce them all to a single accumulator value

function factorialize(num) {
  let numArray = [];
  for (let i = 1; i <= num; i++) {
    numArray.push[i];
  }
  console.log(numArray);
  return numArray;
}

factorialize(5);

This both logs and returns an empty array, []. What am I missing?

Jorge Garcia
@jorgeagc7
Feb 24 2018 19:26
@DarrenfJ thanks!
CamperBot
@camperbot
Feb 24 2018 19:26
jorgeagc7 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2403 | @darrenfj |http://www.freecodecamp.org/darrenfj
Nicole F.
@gitasong
Feb 24 2018 19:32
Never mind; got it from another channel. array.push() is a function, so I need the parentheses, duh: array.push(i) instead of array.push[i].
zootechdrum
@zootechdrum
Feb 24 2018 19:55
@RomchyFCC Yeah that does close to what I want but not exactly
as you can see the rec are doing a rainbow ish affect
Neil
@NNeil1
Feb 24 2018 19:55
How make Bootstrap button group take full width of its parent?
zootechdrum
@zootechdrum
Feb 24 2018 19:55
I just want them to stay one color
@RomchyFCC this is what it is doing currently https://codepen.io/zootechdrum/pen/eVGWgp
Roman Struna
@RomchyFCC
Feb 24 2018 19:56
Ohhh that you need to set that up at create time not animation time
Then*
AbrisM
@AbrisM
Feb 24 2018 19:57
I had a script similiar to that
Changing it to a single color shouldn't be too difficult
change the fillstyle of the random to a set color
zootechdrum
@zootechdrum
Feb 24 2018 19:59
@RomchyFCC can you help me with somethine else.lol I have this loop going in at the bottom that for some reason speeds up the animation. I created the loop originally to loop through the block array. It looks like it does loop through it but for some reason it speeds up if i change the i<1 to say i<500; why?
Roman Struna
@RomchyFCC
Feb 24 2018 20:02
I would have to check the code to understand exactly what you mean and i can't do that at the moment...if you still don't figure it out by tomorrow and i am confident that you will, i will try to help you then, good luck :+1:
Jesse Gilbride
@jessegilbride
Feb 24 2018 20:09

Not sure if this is a good place to ask about WordPress and MAMP, but I'd appreciate the help. This should be super simple, or so I'd think. I'm trying to perform a local installation, with MAMP as the server.

I'm following the instructions on https://codex.wordpress.org/Installing_WordPress_Locally_on_Your_Mac_With_MAMP but MAMP says "error: 1045 Access denied for user...", which I suspect is because no DB exists yet. That's fine, so I put the unzipped WP in the 'document root' folder (within htdocs) and try again and get the same error. Years ago when I tried this I used PHPMyAdmin to create the DB, I'd set the wp-config.php file with user credentials and everything would work out. Now I can't even get to the part where I create a DB.

lawrencelee93
@lawrencelee93
Feb 24 2018 20:10

Consider the following snippet of code. Please explain what is being returned. If unsure, please refer to the .find api of mongo.

db.mycol.find({},{"title":1,_id:0}).limit(2)

{"title":"MongoDB Overview"}
{"title":"NoSQL Overview"}

Neil
@NNeil1
Feb 24 2018 20:18
@jessegilbride Not sure about your problem, but if you're looking for a simple Local Wordpress installation, checkout Flywheel
Jesse Gilbride
@jessegilbride
Feb 24 2018 20:18
Thanks, @NNeil1
CamperBot
@camperbot
Feb 24 2018 20:18
jessegilbride sends brownie points to @nneil1 :sparkles: :thumbsup: :sparkles:
:cookie: 113 | @nneil1 |http://www.freecodecamp.org/nneil1
codepen if anyone can tell me how to make the buttons equal width and full width of the parent
James Diaz
@clanmaster
Feb 24 2018 20:26
Hi all. Just want to be sure but this bit of JS code:
var ToName = function(){} * would it be known of as anonymous function?
Stephen James
@sjames1958gm
Feb 24 2018 20:28
@clanmaster yes because there is no name between function and ()
Aditya
@ezioda004
Feb 24 2018 20:28
Anonymous function expression
James Diaz
@clanmaster
Feb 24 2018 20:29
@ezioda004 thanks @sjames1958gm
CamperBot
@camperbot
Feb 24 2018 20:29
clanmaster sends brownie points to @ezioda004 and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 477 | @ezioda004 |http://www.freecodecamp.org/ezioda004
:star2: 9026 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Marcus Parsons
@marcusparsons
Feb 24 2018 21:30
I made a coinflip app! It looks best on a mobile device, btw. Check it out please! It has more than a few coins to choose from for both heads and tails side. Coinflip App
Abhi Indoria
@AIndoria
Feb 24 2018 21:38
@marcusparsons Is there some bias towards...heads?
I've flipped it 8 times and all 8 times I've gotten heads
Aditya
@ezioda004
Feb 24 2018 21:45
You know what they say about RNG .. its very random ;)
Marcus Parsons
@marcusparsons
Feb 24 2018 21:59
@ezioda004 and @alndoria, I do wish random number generation was a bit more random. Hmmm, it might be worth investigating limiting the number of heads that can be spun lol
Heads or tails rather lol
Aditya
@ezioda004
Feb 24 2018 22:00
Its working fine for me @marcusparsons :)
Marcus Parsons
@marcusparsons
Feb 24 2018 22:00
Sweet! I didn't get more than 3 heads in a row when using it today when my gf and I were playing Pokemon hahaha
I did trip her out and say that I programmed it to recognize my fingerprint so that I could get heads more frequently XD
AbrisM
@AbrisM
Feb 24 2018 23:41
Hi everyone
How would I get 592 in Binary? I'm doing it by hand so I found a method but I want to make sure its correct since 128 would be used more than once
I guess I could extend the table out more instead of ending at 128, to go to 2^8 and 2^9, 2^10....
Gulsvi
@gulsvi
Feb 24 2018 23:45
@AbrisM
var num = 592;
console.log(num.toString(2)); // "1001010000"
Brad
@bradtaniguchi
Feb 24 2018 23:45
@AbrisM I mean yea you could use JS.... but @AbrisM Is doing it by hand
@gulsvi oops
Gulsvi
@gulsvi
Feb 24 2018 23:46
@bradtaniguchi Well, he wanted to make sure it's correct :)
Brad
@bradtaniguchi
Feb 24 2018 23:46
@AbrisM Yes, you need to extend out the table to get to the number you want, otherwise your like doing half binrary
AbrisM
@AbrisM
Feb 24 2018 23:46
I could use JS to check for the answer, yes :)
Brad
@bradtaniguchi
Feb 24 2018 23:47
Id just ask google in a pinch ;D
Gulsvi
@gulsvi
Feb 24 2018 23:47
or wolfram alpha perhaps
AbrisM
@AbrisM
Feb 24 2018 23:47
wolfgram alpha? Haven't used that one
Ugh, it used to be free - now requires a pro subscription to see the step-by-step
AbrisM
@AbrisM
Feb 24 2018 23:49
It looks like both answers are correct on the calculator and wolfram
Like Chegg? Ew, lol
Gulsvi
@gulsvi
Feb 24 2018 23:50
Yeah, but no humans involved
AbrisM
@AbrisM
Feb 24 2018 23:50
and in an 4 octect it's 8 binary digits per group. So the total for an IPv4 is 32 bytes
Chi
@chiyc
Feb 24 2018 23:59
@AbrisM The easiest trick I know for finding a number in binary is to keep dividing it by 2