These are chat archives for FreeCodeCamp/HelpFrontEnd

17th
Dec 2017
DecisiveIndecisive
@DecisiveIndecisive
Dec 17 2017 00:33
@linusphan Just popped in real quick but I think your animation is great! Code benefit from increasing the speed and going one letter at a time at a higher speed to give it that "pointed typing" feel, but I dont know anything about SVG so idk how difficult that is :P
Good work thouhgh
dinesh
@1532j0004kg
Dec 17 2017 02:07
@khaduch thanks , and i have a another quetion in the other program like this . he didn't use "origin=*" but it is working how?
CamperBot
@camperbot
Dec 17 2017 02:07
1532j0004kg sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3598 | @khaduch |http://www.freecodecamp.org/khaduch
Ken Haduch
@khaduch
Dec 17 2017 03:09
@1532j0004kg - you can use "JSONP" as a type of transfer, too. I think that wikipedia is unique in that they allow that origin attribute on the URL. JSONP is a type that you'll see used in many sites like this to deal with cross-origin requests.
Daniel
@DanJP2016
Dec 17 2017 03:20
i think i got this algorithm to finally work the way its supposed to https://codepen.io/bones211/pen/JOxLPO?editors=1010
Tom
@moT01
Dec 17 2017 03:31
:+1: @DanJP2016
Daniel
@DanJP2016
Dec 17 2017 03:34
@moT01 thanks
CamperBot
@camperbot
Dec 17 2017 03:34
danjp2016 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 934 | @mot01 |http://www.freecodecamp.org/mot01
Tom
@moT01
Dec 17 2017 03:35
:-1:
Daniel
@DanJP2016
Dec 17 2017 03:39
it broke already?
Tom
@moT01
Dec 17 2017 03:41
well
maybe not broke
clear all isnt always clearing all
3.3+.3=..=
Daniel
@DanJP2016
Dec 17 2017 03:45
this lap top im using sucks give me a sec to pull the code back up
Tom
@moT01
Dec 17 2017 03:46
yea, mine sucks too
Daniel
@DanJP2016
Dec 17 2017 03:48
hmm, maybe something with codepen because its showing all cleared running from my file
Jessie Cryer
@j-cryer
Dec 17 2017 04:26

Hey, what's up everybody?
I have an issue and the main topics are: jQuery and Events.
I'll give you my code and then some context.

$('#form').on('submit', function (e) {
            var username = $('form input[name=Username]').val();

            $.get('/Users/DuplicateUsername', { username: username })
                .done(function (duplicate) {
                    if (duplicate) {
                        e.preventDefault();
                        // or e.originalEvent().preventDefault();
                    }
                });
        });

Alright, well this bit of code is intended to make a call to my server which returns a boolean value (duplicate) and if it is true stop the form from being submitted. Now it's obvious to me why e.preventDefault() isn't doing the trick inside the .done function or inside the .get block. Is there an easy way to make this happen?

Tom
@moT01
Dec 17 2017 04:34
the form has already been submitted i think by the time you get to that part of the code
RHCPsnow
@RHCPsnow
Dec 17 2017 04:35
can anyone tell me if i'm using .splice wrong or if my problem is somewhere else? Here is my code
Tom
@moT01
Dec 17 2017 04:35
i dont think preventdefault would stop it from being submitted either
RHCPsnow
@RHCPsnow
Dec 17 2017 04:36
function destroyer(arr) {

  arr = Array.prototype.slice.call(arguments);
  arr = [].slice.call(arguments);

  for (i = 1; i < arr.length; i++) {
    for (j = 0; j < arr[0].length; j++) {
      if (arr[i] === arr[0][j]) {
       arr[0].splice(arr[0][j], 0);
      }
    }
  }
  return arr[0];
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Tom
@moT01
Dec 17 2017 04:36
what are you trying to do @j-cryer
Jessie Cryer
@j-cryer
Dec 17 2017 04:37
@moT01 yeah preventDefault() where it is now won't and that's the problem. I run a similar code example in codepen and I can stop the form from being submitted after doing other logic. The problem is stopping the form submission from inside the other calls.
Daniel
@DanJP2016
Dec 17 2017 04:39
@RHCPsnow are you trying to remove something or add something to the array?
RHCPsnow
@RHCPsnow
Dec 17 2017 04:40
i trying to remove
i'm*
Tom
@moT01
Dec 17 2017 04:41
so if you're right - i feel like its an async issue - and we dont get to that part of the code before the form gets submitted...
meaning you click submit
make the .get call
the form gets submitted
then we get to the .done (cause we waited for the call)
maybe
put some console logs in there to find out
Daniel
@DanJP2016
Dec 17 2017 04:42
ok instead of a 0, you need to add a 1, that tells splice to remove one item. here is an article about it that might help. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
Tom
@moT01
Dec 17 2017 04:43
or put some action in the .done
Jessie Cryer
@j-cryer
Dec 17 2017 04:44
@moT01 I actually have console.log inside it all it all gets called. In fact if I write e.preventDefault(); at the very end of the entire thing it stops it.
Tom
@moT01
Dec 17 2017 04:45
they get called in the order theyre shown?
Jessie Cryer
@j-cryer
Dec 17 2017 04:48

@RHCPsnow This may mess your train of thought up but here's a hint that I find really helpful.

var args = Array.from(arguments);
args.shift();

this little piece of code will give you an array of all arguments passed to the function, the array and the list of values to remove from the array. when you call shift on it it removes the first element of the args array which removes the actual array that was passed into the function and you're left with and array of each element you need to remove from the array, which you still have access to via the argument that was passed in (arr)

RHCPsnow
@RHCPsnow
Dec 17 2017 04:53
@j-cryer Thanks so much. I've been stuck on this for a while so i need to try something new. I'm going to read about .from and .shift. Thanks again
CamperBot
@camperbot
Dec 17 2017 04:53
rhcpsnow sends brownie points to @j-cryer :sparkles: :thumbsup: :sparkles:
api offline
Jessie Cryer
@j-cryer
Dec 17 2017 04:54
@RHCPsnow are you farmiliar with .pop ? .shift() is the frontal equivalent it removes one from the beginning
RHCPsnow
@RHCPsnow
Dec 17 2017 04:56
oh cool thanks
i think i have used that before but i have never used .from
Jessie Cryer
@j-cryer
Dec 17 2017 05:00
@DanJP2016 That stackoverflow thread had my answer, thank you
CamperBot
@camperbot
Dec 17 2017 05:00
j-cryer sends brownie points to @danjp2016 :sparkles: :thumbsup: :sparkles:
:cookie: 307 | @danjp2016 |http://www.freecodecamp.org/danjp2016
Jessie Cryer
@j-cryer
Dec 17 2017 05:01
$('form :submit').click(function (e) {
            e.preventDefault();
            $('.alert').remove();

            var username = $('form input[name=Username]').val();

            $.get('/Users/DuplicateUsername', { username: username })
                .done(function (duplicate) {
                    if (!duplicate) {
                        $('form').submit();
                    } else {
                        $('.panel-body')
                            .prepend('<div class="alert alert-danger text-center"><p><strong>' + username + '</strong> is not available</p></div>');
                    }
             });
});
Daniel
@DanJP2016
Dec 17 2017 05:01
your welcome. here is another example that might've helped that i was fixing to post lol. http://phppot.com/jquery/prevent-form-double-submit-using-jquery/
Dhaval
@dhavalchaudhary
Dec 17 2017 05:45
Whenever I try to use jquery's append it appends my html string inside a font tag. Has anyone faced this issue before?
dinesh
@1532j0004kg
Dec 17 2017 06:46
@khaduch thanks for helping!
CamperBot
@camperbot
Dec 17 2017 06:46
1532j0004kg sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3600 | @khaduch |http://www.freecodecamp.org/khaduch
in this how i can able to equall the all well!
at the time of searching, if the long word comes the well is not equals to others.
if u search anything u can able to find.
Reinier Blanco-Diaz
@reycuban
Dec 17 2017 07:50
Jefferson
@jeffersonnnn
Dec 17 2017 09:56
hi guys, i have a question on reactjs, can anyone help me please?
David Bercovici
@davidberco
Dec 17 2017 10:12
@reycuban simple and effective. Question you set the transition to 1s, how you set the transition when you "unhover"? I want that the button returns to the original position more fast or slow.
Gustavo Borda
@guhborda
Dec 17 2017 10:22
hello guys, someone could help me
?
Ghost
@ghost~56bd2077e610378809c105cd
Dec 17 2017 10:47
good morning
LuxCoder26
@LuxCoder26
Dec 17 2017 10:51
Hi @guhborda, I’ll try to help
Hi guys I am having an issue with the palindrome function
LuxCoder26
@LuxCoder26
Dec 17 2017 10:57
Basically, every test case is working except “1 eye for of 1 eye.” . Now, if we remove everything, numbers, dot and spaces, this string is actually a palindrome, nevertheless the test case states that the function should return false as a value
Can someone help me please?
dinesh
@1532j0004kg
Dec 17 2017 10:58
share the code!
consider the .(dot)
LuxCoder26
@LuxCoder26
Dec 17 2017 10:59
function palindrome(str) {
  // Good luck!

  str = str.replace(/[\.]/,"");
  str = str.replace(/[\,]/,"");
  str = str.replace(/[\,]/,"");
  str = str.replace(/[\_]/,"");
  str = str.replace(/\W+/,"");
  str = str.replace(/\d+/gi,"");
  str = str.replace(/\s+/gi,"");


  if(str == "")
    return true;

  str = str.toLowerCase();

  var pal = str;
  var arr1, arr2;


  arr1 = str.split("");
  arr2 = pal.split("");


  arr2.reverse();

  var check = false;

  for (var i = 0; i < arr1.length; i++){
    if(arr1[i] != arr2[i])
      check = true;
  }

  return !check;
}



palindrome("1 eye for of 1 eye.");
Hi @1532j0004kg, consider that I had some trouble with the replace functions
dinesh
@1532j0004kg
Dec 17 2017 11:00
ok checking
LuxCoder26
@LuxCoder26
Dec 17 2017 11:01
they were not removing all the characters, I think this has something to do with the browser and not with the code
dinesh
@1532j0004kg
Dec 17 2017 11:02
if(str == "" )
what it will actually do.
LuxCoder26
@LuxCoder26
Dec 17 2017 11:03
is it a question?
dinesh
@1532j0004kg
Dec 17 2017 11:03
i think it does not do anything
LuxCoder26
@LuxCoder26
Dec 17 2017 11:03
actually, that part is working
dinesh
@1532j0004kg
Dec 17 2017 11:04
ok
LuxCoder26
@LuxCoder26
Dec 17 2017 11:04
because take for example string "0_0 (: /-\ :) 0-0”. After you replace all the characters in this string, you remain with an empy string
0_0 (: /-\ :) 0-0
dinesh
@1532j0004kg
Dec 17 2017 11:04
haha
yup
LuxCoder26
@LuxCoder26
Dec 17 2017 11:05
and that’s what that if statement does
dinesh
@1532j0004kg
Dec 17 2017 11:06
got it
LuxCoder26
@LuxCoder26
Dec 17 2017 11:07
:+1:
dinesh
@1532j0004kg
Dec 17 2017 11:07
all other example are working?
LuxCoder26
@LuxCoder26
Dec 17 2017 11:07
yes, all of them
dinesh
@1532j0004kg
Dec 17 2017 11:07
i think only this example is problem,
LuxCoder26
@LuxCoder26
Dec 17 2017 11:08
Screen Shot 2017-12-17 at 12.07.52.png
dinesh
@1532j0004kg
Dec 17 2017 11:08
i have no idea sorry
LuxCoder26
@LuxCoder26
Dec 17 2017 11:09
no worries, thanks for checking wiht me :+1:
dinesh
@1532j0004kg
Dec 17 2017 11:09
program number!
?
LuxCoder26
@LuxCoder26
Dec 17 2017 11:09
sorry? you mean the challenge number?
dinesh
@1532j0004kg
Dec 17 2017 11:09
yes
heroiczero
@heroiczero
Dec 17 2017 11:11
@LuxCoder26 you have to keep numbers
@LuxCoder26 it says You'll need to remove all non-alphanumeric characters
LuxCoder26
@LuxCoder26
Dec 17 2017 11:12
ah, s*t, thanks @heroiczero
CamperBot
@camperbot
Dec 17 2017 11:12
luxcoder26 sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 2108 | @heroiczero |http://www.freecodecamp.org/heroiczero
LuxCoder26
@LuxCoder26
Dec 17 2017 11:13
it’s still giving me issues though
@heroiczero
btw, do you know why the replace functions are not working properly?
has this something to do with the browser/compiler?
Gustavo Borda
@guhborda
Dec 17 2017 11:47
@LuxCoder26 i'm sorry saw only now
i need put the content of a file inside a div
LuxCoder26
@LuxCoder26
Dec 17 2017 11:48
and what is the issue you are facing?
Gustavo Borda
@guhborda
Dec 17 2017 11:49
i pass by ajax the name of file to php, and ther i verify if file exists, if exist i return the name of the file, and put the code of file into a div, but this return the entire page or just the text
entire page i means only the page without the content of the file
inside of the page
is given this url file:///C:/xampp/htdocs/projetos/sellcontrol/pages/404.phtml
LuxCoder26
@LuxCoder26
Dec 17 2017 11:51
have you tried to put the name of the file + the extension?
Gustavo Borda
@guhborda
Dec 17 2017 11:51
shit, worked, i'm passing the wrong extensio
LuxCoder26
@LuxCoder26
Dec 17 2017 11:51
btw, I didn’t come to that part yet, so this stuff it’s quite advanced for me
ahah that’s great
Gustavo Borda
@guhborda
Dec 17 2017 11:52
aah but you did a great work thanks for the atention
your programing logic is good?
LuxCoder26
@LuxCoder26
Dec 17 2017 11:54
quite good I’d say, I studied c++ for a long time
Gustavo Borda
@guhborda
Dec 17 2017 11:57
i having another problem --'
LuxCoder26
@LuxCoder26
Dec 17 2017 11:58
shoot
Gustavo Borda
@guhborda
Dec 17 2017 11:58
i updated the content of the file, but in load is not updated
for example, i click in the nav, and this load the file, this file at first has only a text "cadAdmin", but i updated the content with a tag h3 and still just cadAdmin without the tag
LuxCoder26
@LuxCoder26
Dec 17 2017 12:01
with which tag did you delcare the text at the beginning?
alpox
@alpox
Dec 17 2017 12:01
@guhborda invalidate your cache and try again
LuxCoder26
@LuxCoder26
Dec 17 2017 12:01
maybe you are not noticing the difference
or yeah, what @alpox said
Gustavo Borda
@guhborda
Dec 17 2017 12:02
figured out
but is weird
one another file works the same, but when i pass // in the response, works
if(file_exists($LocalPath."/pages//".$pagina.".phtml")){
echo json_encode("./pages//".$pagina.".phtml");
in echo where is pages// if i put only one / the file don't work, but another file works normaly, but not this one "cadAdmin"
the cadCliente works weird
dinesh
@1532j0004kg
Dec 17 2017 14:49
hi @any
guys
need help
Stephen James
@sjames1958gm
Dec 17 2017 14:51
@1532j0004kg Ask away
dinesh
@1532j0004kg
Dec 17 2017 14:53
how to equal the height of the column.
Ryan Christopher
@ryan-christopher
Dec 17 2017 14:55
Anyone available to answer a Twitch question?
Stephen James
@sjames1958gm
Dec 17 2017 14:56
@ryan-christopher I can try.
@1532j0004kg Not sure what you are asking
Ryan Christopher
@ryan-christopher
Dec 17 2017 15:00
@sjames1958gm Great, so here's my pen https://codepen.io/rcd1693/pen/XVmYdv. It's the "#online-btn". The first part of the button's code comes from the button used to get all users; it populates the DOM. The ifstatement just below that is where I'd like to filter the DOM just for users who are online. I put a console.log() statement inside that if statement to determine if the code, on button click, actually reaches that point; it doesn't. Any thoughts as to why?
Stephen James
@sjames1958gm
Dec 17 2017 15:03
@ryan-christopher Since your getAllUser is async that if statement will run before all the user data has been returned, so the DOM is not yet populated.
Ryan Christopher
@ryan-christopher
Dec 17 2017 15:06
@sjames1958gm Ok, when in doubt, that is usually my issue: badly handled async behaviour. Is there a workaround other than making this synchronous, which is roundly frowned upon? I'd hate to do a complete refactor, but you do what you have to do, right?
Stephen James
@sjames1958gm
Dec 17 2017 15:08
@ryan-christopher Rather than fully refactor you could pass a callback into getAllUser and then that could be passed down into isOnline and after the DOM is built call it.
Then in the online button put that if check in the callback.
Maybe it would be better to retrieve all the users first and then the buttons could just operate on the fetched data?
Ryan Christopher
@ryan-christopher
Dec 17 2017 15:10
@sjames1958gm It's certainly worth a shot. Thanks for the diagnostics and suggestion!
CamperBot
@camperbot
Dec 17 2017 15:10
ryan-christopher sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8784 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Dec 17 2017 15:11
@ryan-christopher :+1:
dinesh
@1532j0004kg
Dec 17 2017 15:33
@sjames1958gm i want to know how to equall the column?https://codepen.io/dinesh007/pen/goaoNW
anyones suggestion is accepted,thanks!!!
ehutchllew
@ehutchllew
Dec 17 2017 15:38
@1532j0004kg What do you mean?
dinesh
@1532j0004kg
Dec 17 2017 15:39
ok i fixed it!
thanks
Devansh-Anhal
@Devansh-Anhal
Dec 17 2017 15:42
can someone help me with this challenge : Use CSS class to style an element

<style>
.red-text{
color: red;
}

</style>

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

here's my code
Stephen James
@sjames1958gm
Dec 17 2017 15:43
@Devansh-Anhal I assume you have to add class="red-text" to some element
Devansh-Anhal
@Devansh-Anhal
Dec 17 2017 15:45
@sjames1958gm within the style attribute?
Stephen James
@sjames1958gm
Dec 17 2017 15:45
Like <p class="red-text">
Devansh-Anhal
@Devansh-Anhal
Dec 17 2017 15:46
ohkkayy .. thanks :D
Stephen James
@sjames1958gm
Dec 17 2017 15:46
You give an element a class and then in css you reference that class with .
Devansh-Anhal
@Devansh-Anhal
Dec 17 2017 15:46
Just ike we create an object in java
Stephen James
@sjames1958gm
Dec 17 2017 15:48
No not really.
.red-text in <style> says apply this styling to any element with class="red-text"
Devansh-Anhal
@Devansh-Anhal
Dec 17 2017 15:49
Ohh :D :D :D :+1:
Got it
@sjames1958gm thanks
CamperBot
@camperbot
Dec 17 2017 15:49
devansh-anhal sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8785 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Jacob Pieczynski
@JacobPie
Dec 17 2017 16:34
Just started my portfolio page and I currently have no CSS. How can I get my nav bar to be separate from the rest of my page? https://codepen.io/JakePie/pen/opjKGR
Tom
@moT01
Dec 17 2017 16:35
@JacobPie what do you mean by separate
add some margin or padding to it? make some space
Jacob Pieczynski
@JacobPie
Dec 17 2017 16:36
Oh. I see where I went wrong. Thanks, @moT01 \
CamperBot
@camperbot
Dec 17 2017 16:36
jacobpie sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 935 | @mot01 |http://www.freecodecamp.org/mot01
Darren
@DarrenfJ
Dec 17 2017 17:17
@JacobPie for the top nav bar you might want to explore the CSS position property... it can allow to fix the top navbar so when you scroll it stays on the top o the page.. sometimes a nice feature... https://developer.mozilla.org/en-US/docs/Web/CSS/position
Simey de Klerk
@simeydk
Dec 17 2017 17:31

Hi Everyone
I have a CSS layout question: How do I position an element at the bottom-right of its parent container? I have managed this once using {position: absolute, right:0, top:0;}, but when I do that in a new scenario, it does that relative to the entire page, rather than the element in question's parent container. Can anyone point me in the right direction on this?

And in general, is there someplace I can read up on this?

Kudzu
@czhower
Dec 17 2017 17:32
try relative instead of absolute
Simey de Klerk
@simeydk
Dec 17 2017 17:36
@czhower Thanks, that doesn't seem to work, though. Here's my pen: https://codepen.io/simeydk/pen/YYyGjw
I want to have avatar on the left, then username with text below to the right of that, then the number to the far right of the container (and behind the username and details text, if they overlap)
CamperBot
@camperbot
Dec 17 2017 17:36
simeydk sends brownie points to @czhower :sparkles: :thumbsup: :sparkles:
:cookie: 29 | @czhower |http://www.freecodecamp.org/czhower
Kudzu
@czhower
Dec 17 2017 17:39

I dont have time to debug it ,but relative is probably what youare looknig for but you might have other CSS overriding it. Check here:

https://www.w3schools.com/css/css_positioning.asp

Note this:
"Elements are then positioned using the top, bottom, left, and right properties. However, these properties will not work unless the position property is set first. They also work differently depending on the position value."
Simey de Klerk
@simeydk
Dec 17 2017 17:40
it worked for the .streamname class in my twitch app (putting the streamname at the bottom right of the block), but it doesn't seem to work here. https://codepen.io/simeydk/pen/ayyEYK
Thanks, will check that
Kudzu
@czhower
Dec 17 2017 17:40
actually absolute is probably closer to what you want - try looking at it in the browser withii ctrl-shift-J, youip can debug the CSS there.
ehutchllew
@ehutchllew
Dec 17 2017 17:42
@simeydk if you want bottom use bottom: 0 instead of top: 0
Simey de Klerk
@simeydk
Dec 17 2017 17:43
yes. trying with absolute now
hehe @ehutchllew, good catch!
Muhammad Hasham
@MohammadHasham
Dec 17 2017 17:44
the clicked element has more space then others
Kudzu
@czhower
Dec 17 2017 17:44
padding or margins most likely
Simey de Klerk
@simeydk
Dec 17 2017 17:45

Here's my class:

.rank {
  font-family: Arial, Sans-serif;
  position: absolute;
  left: auto;
  right: 0;
  top: auto;
  bottom: 0;
}

However, it positions all my elements at the bottom of the viewport rather than at the bottom of the element's parent.

ehutchllew
@ehutchllew
Dec 17 2017 17:48
@simeydk it's because of your div with class layer-1
@simeydk wait scratch that, one sec
Muhammad Hasham
@MohammadHasham
Dec 17 2017 17:55
@czhower does this has any name?
Kudzu
@czhower
Dec 17 2017 17:56
I dont see the effect you describe, but from your description it soudns like they are just increasing the paddnig or margins. I dont think it has a name for the effect.
Simey de Klerk
@simeydk
Dec 17 2017 17:58
@ehutchllew I've figured it out:
placement for position:absolute depends on the position of the parent.
if the parent is position:relative then the child is placed relative to the parent.
if the parent is position:static (i.e. default), then child is placed realtive to viewport
https://codepen.io/simeydk/pen/VyeZNM
ehutchllew
@ehutchllew
Dec 17 2017 17:58
@simeydk I think I solved it
Simey de Klerk
@simeydk
Dec 17 2017 17:59
hehe. same fix as mine?
ehutchllew
@ehutchllew
Dec 17 2017 17:59
@simeydk yeah, change user-card to position: relative;
@ehutchllew and all the children position: absolute; will work properly
Simey de Klerk
@simeydk
Dec 17 2017 17:59
CSS is weird sometimes.
Thanks for the help!
ehutchllew
@ehutchllew
Dec 17 2017 18:00
@simeydk just have to change the positioning of the child elements.
@simeydk position: absolute; only works relative to a parent if the parent is "positioned" so the parent has to have something other than the default "static", otherwise it positions relative to the document body.
Simey de Klerk
@simeydk
Dec 17 2017 18:03
Thanks. It feels hack-ey though. I understand both behavoirs can be handy in some cases, but i.m.o. it would have been clearer to then have position:absolute and position:absolute-viewport or something like that
Onome Sotu
@onomesotu
Dec 17 2017 18:03
Hello guys,
in wikipedia viewer, what is expected in the random wikipedia entry?
Is it a randon list of articles or a single random search title?
Simey de Klerk
@simeydk
Dec 17 2017 18:07
@onomesotu I interpreted it as "a link that takes me to a random article", I think that's how it is in the example solution as well
ehutchllew
@ehutchllew
Dec 17 2017 18:10
@simeydk it does feel hack-y, that's why i suggest you take a look at Grid or Flexbox
Onome Sotu
@onomesotu
Dec 17 2017 18:12
The example solution doesn't have a random button :)
@simeydk but i think you are right
The random api only provides list of titles
so it has to be a link
Simey de Klerk
@simeydk
Dec 17 2017 18:13
@ehutchllew Thanks! I have started looking at them, and I'm using flexbox in this challenge. Is it possible to have items overlay each other in flexbox? I understand grid can also easily solve my problem, but I haven't started using it just yet, for an ill-defined concern of compatability with older browsers
CamperBot
@camperbot
Dec 17 2017 18:13
simeydk sends brownie points to @ehutchllew :sparkles: :thumbsup: :sparkles:
:cookie: 363 | @ehutchllew |http://www.freecodecamp.org/ehutchllew
ehutchllew
@ehutchllew
Dec 17 2017 18:17
@simeydk unfortunately flexbox is 1 dimensional and grid is 2, but you can use the same 'hack-y' methods to overlay using flexbox.
Simey de Klerk
@simeydk
Dec 17 2017 18:18
@onomesotu I guess that leaves it open to interpretation. If you're looking to copy the behavior I implemented, then I'm sure you can inspect my output to figure out what I did without looking at my code ;-) [https://codepen.io/simeydk/full/oewqBo]
(how do I include a codepen link without embedding the pen?)
Tom
@moT01
Dec 17 2017 18:23
add s at the beginning
Simey de Klerk
@simeydk
Dec 17 2017 18:40
@moT01 thanks!
CamperBot
@camperbot
Dec 17 2017 18:40
simeydk sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 936 | @mot01 |http://www.freecodecamp.org/mot01
Darren
@DarrenfJ
Dec 17 2017 18:48
@simeydk i htink it works like any other link in markdown... [description](link)
for example - your pen [your pen](https://codepen.io/simeydk/full/oewqBo)
Simey de Klerk
@simeydk
Dec 17 2017 18:49
Thanks @DarrenfJ !
CamperBot
@camperbot
Dec 17 2017 18:49
simeydk sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2318 | @darrenfj |http://www.freecodecamp.org/darrenfj
Darren
@DarrenfJ
Dec 17 2017 18:50
no worries brutha
Deepak Manjunath
@Deepak2322
Dec 17 2017 20:29
_queryFn(datasource, query) { return datasource.filter(function (item) { if(item.Name && item.No){ return ( item.Name.toLowerCase().indexOf(query) != -1 || item.No.indexOf(query) != -1 ); } else if(!item.Name) { return true } }); } }
i am using some autocomplete plugin to search using name and number, when i search using number let’s assume when i search for “100” i want only to display results that start with 100 and ignore other’s. but the current implementation shows the results with number “100" and others as well. does anyone have any idea how to accurately search and display only what is searched for ?
dog123cats
@dog123cats
Dec 17 2017 20:30
what do I use to code?
Kudzu
@czhower
Dec 17 2017 20:30
please use code formatting option in gitter.. thats a spaghetti mess no one wants to try to read that way
type ` three times and hit enter, the paste code
dog123cats
@dog123cats
Dec 17 2017 20:32
I just got on and I dont know how to do that
Deepak Manjunath
@Deepak2322
Dec 17 2017 20:32
 _queryFn(datasource, query) { 
            return datasource.filter(function (item) {
              if(item.Name && item.No){
                return (
                    item.Name.toLowerCase().indexOf(query) != -1 || item.No.indexOf(query) != -1
                );
              } else if(!item.Name) {
                  return true
              }
            });
          }
        }
dog123cats
@dog123cats
Dec 17 2017 20:33
what are you trying to code?
Kudzu
@czhower
Dec 17 2017 20:35
why do yo have the return value in ()?
Alsop arrow syntax is considered a bit cleaner than using function()
and you dont need the else at all, because first if has a return.
Deepak Manjunath
@Deepak2322
Dec 17 2017 20:37
if search for any letter starting with 'ra' it displays at last in dropdown, it doesn't come first
dog123cats
@dog123cats
Dec 17 2017 20:40
how do I start coding?
Matthew Hoth
@kingofthecross
Dec 17 2017 20:41
What am I missing?
I want the text to be return only if it is NOT part of the answers string. If it is I want the function to run until it is not
function makeTile() {
     text = possible[Math.floor(Math.random() * possible.length)];
    while (answers.indexOf(text) === -1){
      return text;
  }

    if(answers.indexOf(text) !== -1){
      makeTile();
    }
Tom
@moT01
Dec 17 2017 20:48
@kingofthecross what are you trying to do
and what does the rest of the code look like
Matthew Hoth
@kingofthecross
Dec 17 2017 20:48
@moT01 I want the text to be returned only if it is NOT part of the answers string. If it is I want the function to run until it is not
Here is the current codepen
Tom
@moT01
Dec 17 2017 20:52
im not sure what your trying to do but maybe try this
   setTimeout(function(){
    console.log('i');
    $('.shifter').text(makeTile());
    console.log('whyy');
},0);
i added () in makeTile()
Matthew Hoth
@kingofthecross
Dec 17 2017 20:53
When the page loads I want to put a character into each box that is not included in a string (answers)
I have it working when the randomly selected character is not included in the string. But when it is, the box is just left blank
LuxCoder26
@LuxCoder26
Dec 17 2017 20:55
Hi Guys , can someone help me please?
Matthew Hoth
@kingofthecross
Dec 17 2017 20:56
@LuxCoder26 Post the problem
dog123cats
@dog123cats
Dec 17 2017 20:56
what do I use to make codes
LuxCoder26
@LuxCoder26
Dec 17 2017 20:56
it’s the chunk the array challenge, this is my code

function chunkArrayInGroups(arr, size) {
  // Break it up.

  var aux = [];
  var result = [];


  /* for(var i = 0; i <= arr.length - size; i + size){
    aux = arr.slice(i, i + size);
    result.push(aux);
    aux = aux.splice(0, aux.length - 1);
  } */ 

  var i = 0;
  while(i <= arr.length - size){
    aux = arr.slice(i, i + size);
    //return arr;
    result.push(aux);
    i += size;
    aux.splice(0, size);
  }

  return result;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);
Matthew Hoth
@kingofthecross
Dec 17 2017 20:57
@dog123cats your keyboard. Start with the first stage of freecodecamp bud
Henry
@GitHub-Henry
Dec 17 2017 20:57
@dog123cats codepen.io is a good place to start
Tom
@moT01
Dec 17 2017 20:59
@kingofthecross well, im struggling to follow whats going on there
LuxCoder26
@LuxCoder26
Dec 17 2017 20:59
@kingofthecross I’m not sure what is wrong with my code. When I return the array, the compiler says that it is empty,but it actually shouldn’t be
Matthew Hoth
@kingofthecross
Dec 17 2017 20:59

change the while loop to
i< arr.length

instead

after that run through your code
if you need more help, i'm here. i don't want to just give you the answer right away
@tom no worries man
LuxCoder26
@LuxCoder26
Dec 17 2017 21:00
@kingofthecross still not working, but I think that is not the issue cause if I change that line, the while doesn’t perform the second loop
Matthew Hoth
@kingofthecross
Dec 17 2017 21:01
@lux also you won't need two arrays for this challenge
i know
that is not the only change needed
Tom
@moT01
Dec 17 2017 21:01
whats with the set timeout
Matthew Hoth
@kingofthecross
Dec 17 2017 21:01
@tom it's for something later, doesn't affect current processes
@lux you actually have the right code written, you just have too much extra
Ken Haduch
@khaduch
Dec 17 2017 21:02
@LuxCoder26 - are you familiar with the site http://pythontutor.com/javascript.html ? You can plug that code into their editor, and then as long as there are no code errors, you can step through and it gives you a visualization of the code operation. It's a nice tool once you get used to it.
Matthew Hoth
@kingofthecross
Dec 17 2017 21:02
  • 100 to pythontutor
your code should look closer to this:
 while(i < arr.length ){
   aux.push(a slice function);
  }

return aux;
Tom
@moT01
Dec 17 2017 21:06
@kingofthecross is that function getting called a bunch cause you have a bunch of '.shifter'?
i think you need to use a do while loop
but im not quite sure why - cause im not sure whats happening yet
LuxCoder26
@LuxCoder26
Dec 17 2017 21:07
@khaduch thanks, I was actually looking for that site, I lost its traces long time ago
CamperBot
@camperbot
Dec 17 2017 21:07
luxcoder26 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3602 | @khaduch |http://www.freecodecamp.org/khaduch
Matthew Hoth
@kingofthecross
Dec 17 2017 21:07
@tom there is a while loop
There are 12 boxes
each box needs to be filled with a character from an array.
the character cannot be one the is found inside a certain string.
The function does this. However, if the character is found inside the string the function does not continue to try until it selects a character NOT in the string
Tom
@moT01
Dec 17 2017 21:09
  function makeTile() {

   do {
     text = possible[Math.floor(Math.random() * possible.length)];

     if(answers.indexOf(text) === -1) {
       return text;
     }
   } while(answers.indexOf(text) >= 0)
LuxCoder26
@LuxCoder26
Dec 17 2017 21:09
@kingofthecross thanks, the first 3 test case are working, will try to figure out the other ones
CamperBot
@camperbot
Dec 17 2017 21:09
luxcoder26 sends brownie points to @kingofthecross :sparkles: :thumbsup: :sparkles:
:cookie: 320 | @kingofthecross |http://www.freecodecamp.org/kingofthecross
Tom
@moT01
Dec 17 2017 21:13
that doesnt work either - does it, that's a strange piece of code - you call that function 12 times, all at the same time - one for each of the shifter classes
i think is what is happening
Matthew Hoth
@kingofthecross
Dec 17 2017 21:13
wait
i think that does work
dog123cats
@dog123cats
Dec 17 2017 21:14
can I use note pad to write code?
Tom
@moT01
Dec 17 2017 21:14
@dog123cats yes
@kingofthecross no - i see the same character
dog123cats
@dog123cats
Dec 17 2017 21:14
ok
Matthew Hoth
@kingofthecross
Dec 17 2017 21:14
@dog check out Atom it's a text editor for writing code
@tom i think if the boxes have the same characters it's fine
as long as there are no characters from the string included
Tom
@moT01
Dec 17 2017 21:23
well, alright then
Matthew Hoth
@kingofthecross
Dec 17 2017 21:24
@moT01 thank you
CamperBot
@camperbot
Dec 17 2017 21:24
kingofthecross sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 937 | @mot01 |http://www.freecodecamp.org/mot01
Maduro-BL
@Maduro-BL
Dec 17 2017 21:51
@kingofthecross , you prefer atom over VSC?
Hey guys, how can I remove “home” and “about me” when I enter mobile view.
AbrisM
@AbrisM
Dec 17 2017 23:46
https://s33.postimg.org/oxelvehe7/Untitled.png Anyone having problems with one of the freecode IDES? I have an inline h2 element but it's marking it incorrect when it is correct
Anker
@ankerpeet
Dec 17 2017 23:48

The clear function in my calculator project is not working. I've been stuck for 2 days on this. Haha Could really use some help Calculator Project Link
JAVASCRIPT

var strOfNums = "";

function addNumToStr(num){
  strOfNums += num;
  draw();
}
function clear(){
  console.log("hey");
  strOfNums = "0";
  draw();
}

function draw(){
  document.getElementById("display").innerHTML = strOfNums;
}

HTML

<div onclick="clear()" class="col-xs-3 btn btn-default">AC</div>
    <div onclick="clear()" class="col-xs-3 btn btn-default">CE</div>
AbrisM
@AbrisM
Dec 17 2017 23:49
Hmm I had a project similiar to this clear function, but using canvas
You could have it as a white template placed over the text to pseudo "clear" it in the calculator
LuxCoder26
@LuxCoder26
Dec 17 2017 23:49
Hi guys, does anyone know how i can access the 2 arguments 2 and 3, if they have not been passed as parameters to the function?
AbrisM
@AbrisM
Dec 17 2017 23:50
But you want the actual calculator part cleared, correct?
LuxCoder26
@LuxCoder26
Dec 17 2017 23:50
here is the code
AbrisM
@AbrisM
Dec 17 2017 23:50
@LuxCoder26 You could try an ArrayList if they haven't been passed
LuxCoder26
@LuxCoder26
Dec 17 2017 23:50

function destroyer(arr) {
  // Remove all the values

  var newArr = [];

  newArr = arr.filter(function(val){
    return this.val > val;
  });

}  


destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Anker
@ankerpeet
Dec 17 2017 23:51
@AbrisM Yes, I have the value of what is displayed on the screen stored in a variable. And what is being drawn to the screen is based on that variable.
@LuxCoder26
You have to add 2 more parameters to your destroyer function like this to get it to work.
function destroyer(arr, val1, val2) {
  // Remove all the values

  var newArr = [];

  newArr = arr.filter(function(val){
    return this.val > val;
  });

}  

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
LuxCoder26
@LuxCoder26
Dec 17 2017 23:56
@ankerpeet, actually I just realized that you need to use arguments for this challenge