These are chat archives for FreeCodeCamp/HelpFrontEnd

29th
Apr 2018
roxxlen
@roxxlen
Apr 29 2018 00:53
@ehutchllew I mean the bottom of an online card, it should be replaced by game name and viewers which have the reverse animation as to the previous ones
Amit Patel
@AmitP88
Apr 29 2018 02:00
hey all, I'm trying to get my Wiki Viewer to display "no results found" when the user's search criteria doesn't yield any wiki results.
wiki-viewer.png
I can't for the life of me figure out why my if statement (in red box) isn't working
please, I need help
roxxlen
@roxxlen
Apr 29 2018 02:03
list[0].length ?
try this one ?
Amit Patel
@AmitP88
Apr 29 2018 02:04
@roxxlen nah, still not displaying the message
I even tried list[i].length and same result
roxxlen
@roxxlen
Apr 29 2018 02:16
no idea
Amit Patel
@AmitP88
Apr 29 2018 02:17
hmmm, this is weird
Ken Haduch
@khaduch
Apr 29 2018 02:17
@AmitP88 - well, if i = 0 (your initial condition) and the list.length === 0, then you'll never enter the loop, so you'll never see the message. You would have to check it outside of that for loop body.
Amit Patel
@AmitP88
Apr 29 2018 02:18
@khaduch I tried that too actually. The code was originally placed just below the commented out line in green
outside-loop.png
Ken Haduch
@khaduch
Apr 29 2018 02:22
@AmitP88 - well, what do you get back, then, when there is no matching results? I think that I'm doing a different type of search from you, I just get back and empty array, for sure.
Amit Patel
@AmitP88
Apr 29 2018 02:23
I get an empty array [ ]
I even console.logged list.length when entering gibberish and the console outputted 0, so I know list.length === 0 is valid when there are no matches
roxxlen
@roxxlen
Apr 29 2018 02:24
what's the use of result.empty
should it be initialized as an empty array ?
Amit Patel
@AmitP88
Apr 29 2018 02:26
oh that emptys the results div when the user does a new search
oh nevermind, I figured it out. I had to place the if statement after my for loop :P
ugh, I knew it was something simple, but I just couldn't see it at first
thanks @roxxlen @khaduch for your help though. You two gave me ideas on how to think of resolving it :)
Ken Haduch
@khaduch
Apr 29 2018 02:29
@AmitP88 - it seems as though that would have worked before your for loop, too, but perhaps if you did output that no results found and then emptied the results, that is why you didn't see it....
Amit Patel
@AmitP88
Apr 29 2018 02:30
@khaduch yeah, that's what I was thinking too right before I placed it after the for loop. I figured the code worked, but the results.empty got rid of it so it would never display
ugh, why didn't my brownie points get sent to you @khaduch and @roxxlen ?
lol
roxxlen
@roxxlen
Apr 29 2018 02:31
nono they stopped it
Amit Patel
@AmitP88
Apr 29 2018 02:33
ah I see
is it because everyone moved to Discord?
roxxlen
@roxxlen
Apr 29 2018 02:34
will you paste the final code here ?
i want to have a look
Ken Haduch
@khaduch
Apr 29 2018 02:37
@AmitP88 - I think that the camperbot brownie points stopped about three days ago - there wasn't any official announcement that I saw, just seemed like it fizzled out? I think that they are just trying to kill the chatroom usage completely.
Amit Patel
@AmitP88
Apr 29 2018 02:37
@roxxlen
$(document).ready(function() {

    $("#search").submit(function(e){
        e.preventDefault();
        var search = document.getElementById("query").value;

        $.ajax({
          'url': 'https://en.wikipedia.org/w/api.php?' + 'format=json' + '&action=query' + '&list=search' + '&srsearch=' + search + '&origin=*',
          'dataType': 'json',
          'type': 'GET',
          'success': function(data) {
            var list = data.query.search;
            console.log(list);

            $("#results").empty();          
            for(var i = 0; i < list.length; i++) {

                $("#results").append(
                  '<div class="single-result">' +
                    '<h3>' + list[i].title + '</h3>' +
                    list[i].snippet +
                    '<a href=' + 'https://en.wikipedia.org/?curid=' + list[i].pageid + ' ' + 'target=_blank' + '> See Wiki</a>' +
                  '</div>'
                );                

            }

            // display "No results found if no wiki articles were found based on search criteria"
            if(list.length === 0){
              $("#results").append(
                '<p class="no-results">No results found</p>'
              );
            }

          }
        });
    });
});
roxxlen
@roxxlen
Apr 29 2018 02:37
hmmm Discord has more programmers ?
Marc
@MWBauer
Apr 29 2018 02:38
Good evening everyone!
:star:
Amit Patel
@AmitP88
Apr 29 2018 02:38
@khaduch ah I see. yeah, I heard that there was some drama and that Quincy said he would stop the chatrooms on here or something to that effect. Apparently everyone is on Discord chatrooms now, but the fcc chatrooms on here still seem to be more active than the Discord fcc ones (hence why I still go on here first)
Dhaval Vira
@dhavalveera
Apr 29 2018 02:38
Good Morning @MWBauer
Marc
@MWBauer
Apr 29 2018 02:38
:sparkles:
Namaste?
Amit Patel
@AmitP88
Apr 29 2018 02:39
btw, here's my wiki viewer if you want to check out the finished product: https://amitp88.github.io/Wiki-Viewer/
Marc
@MWBauer
Apr 29 2018 02:39
I haven't finished mine yet
anyone know how to change the brakes on an 82 Nissan 720?
Or why my car won't even register that the key is in and turned forward?
Dhaval Vira
@dhavalveera
Apr 29 2018 02:40
@MWBauer this place is of IT Industry not for Automobile Industry, Sorry
Marc
@MWBauer
Apr 29 2018 02:41
I know. I was goofing around.
These are the 2 things at the front of my mind right now.
Dhaval Vira
@dhavalveera
Apr 29 2018 02:43

<!DOCTYPE html>

<html>
<head>
<title> Bootstrap navbar </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
</head>
<body>

<nav class="navbar navbar-expand-lg navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<a class="navbar-brand" href="#">Hidden brand</a>
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>


<script src="bootstrap.min.js"></script>
<script src="jquery-slim.min.js"></script>
<script src="popper.min.js"></script>

</body>
</html>

Menu is not opening when we select to open
plz help
roxxlen
@roxxlen
Apr 29 2018 02:47
use ``` to make it highlighted
Ken Haduch
@khaduch
Apr 29 2018 02:52
@dhavalveera - I think that you might need the full jquery.js, not the jquery-min.js. At least that rings a bell with me from looking at this quite a while ago? Oh, and you also need to load jquery.js (even if the "min" will work) before you load bootstrap.js. And you might need to load popper.js before bootstrap.js. So jquery first, popper second, bootstrap.js third.
Dhaval Vira
@dhavalveera
Apr 29 2018 02:53
I got my Solution from StackOverflow
Thanks a lot
in this there is White Space just above Project heading that is Background Image, can anyone tell me that how to remove that White-Space means Extra Space from Background Image ?
Brittany Rutherford
@brittanyrutherford
Apr 29 2018 03:58
@dhavalveera do:
#Projects h1{ margin-top: 0px; }
Dhaval Vira
@dhavalveera
Apr 29 2018 03:58
not for h1
problem is in background image
Brittany Rutherford
@brittanyrutherford
Apr 29 2018 03:58
it is a margin top for h1 inside the Projects div
Dhaval Vira
@dhavalveera
Apr 29 2018 03:58
on all the background image it is working fine
Brittany Rutherford
@brittanyrutherford
Apr 29 2018 03:58
just try it out
try it out and the white space will be gone
Dhaval Vira
@dhavalveera
Apr 29 2018 04:01
@brittanyrutherford Thanks a lot. your opinion works. Thanks a lot
Brittany Rutherford
@brittanyrutherford
Apr 29 2018 04:01
:thumbsup:
Dhaval Vira
@dhavalveera
Apr 29 2018 04:01
@brittanyrutherford ++
Ghost
@ghost~55a04b725e0d51bd787af54c
Apr 29 2018 05:01
Hi all
Dhaval Vira
@dhavalveera
Apr 29 2018 05:02
hi
Ghost
@ghost~55a04b725e0d51bd787af54c
Apr 29 2018 05:03
I'm having trouble with Google's OAuth
Could anyone help?
Dhaval Vira
@dhavalveera
Apr 29 2018 05:03
I am not familiar with Google's OAuth
Ghost
@ghost~55a04b725e0d51bd787af54c
Apr 29 2018 05:03
Kshitiz
@kshtzsharma48
Apr 29 2018 07:21
what do we need to know reactjs as a newbie to javascript
?
Dhaval Vira
@dhavalveera
Apr 29 2018 07:28
first learn JavaScript properly
Kshitiz
@kshtzsharma48
Apr 29 2018 07:31
then
?
Dhaval Vira
@dhavalveera
Apr 29 2018 07:31
first learn JavaScript properly
you have to understand it properly
Kshitiz
@kshtzsharma48
Apr 29 2018 07:31
hmmm
and then ?
Dhaval Vira
@dhavalveera
Apr 29 2018 07:32
then any Library, or Framework or Server-Side Language you can learn
Kshitiz
@kshtzsharma48
Apr 29 2018 07:32
thanks @dhavalveera
Dhaval Vira
@dhavalveera
Apr 29 2018 07:32
your welcome
Fedoua Jnt
@FedouaJnt
Apr 29 2018 08:49
heey everyone please does any one code with php
Ene Catalin
@EneCatalin
Apr 29 2018 09:39
this is the front-end section
@diomed
NickTheDesigner
@NickTheDesigner
Apr 29 2018 11:57
@NickTheDesigner
I'm having a major git issue I'm trying to push my repository to my GitHub link (https://github.com/NickTheDesigner/Jerry-s-Website) and when I try to do git push origin master it says To https://github.com/NickTheDesigner/Jerry-s-Website.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/NickTheDesigner/Jerry-s-Website.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I have added and committed everything and when I do git status it says On branch master nothing to commit, working tree clean
really confused
Let me know if more context it needed
Michael S
@Ohshi60
Apr 29 2018 11:58
@NickTheDesigner what does git pull do
NickTheDesigner
@NickTheDesigner
Apr 29 2018 12:01
"Incorporates changes from a remote repository into the current branch. In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD."
Michael S
@Ohshi60
Apr 29 2018 12:02
that error you receive is usually when you try to push but havent used git pull
NickTheDesigner
@NickTheDesigner
Apr 29 2018 12:02
I tried git pull and git push
Michael S
@Ohshi60
Apr 29 2018 12:02
what does the git pull msg say
NickTheDesigner
@NickTheDesigner
Apr 29 2018 12:03
I get this error `Annas-MacBook-Air:Jerrys NikitaNovikov$ git pull origin master
From https://github.com/NickTheDesigner/Jerry-s-Website
  • branch master -> FETCH_HEAD
    fatal: refusing to merge unrelated histories`
Michael S
@Ohshi60
Apr 29 2018 12:03
i think i understand the problem
NickTheDesigner
@NickTheDesigner
Apr 29 2018 12:03
save me
Michael S
@Ohshi60
Apr 29 2018 12:04
you have created a local repository and then created a separate github repo and initiated the repo with a readme am i right?
NickTheDesigner
@NickTheDesigner
Apr 29 2018 12:04
Yes
Michael S
@Ohshi60
Apr 29 2018 12:04
so your local repository has its own change history
and your origin repository has a separate. That confuses it
NickTheDesigner
@NickTheDesigner
Apr 29 2018 12:04
Ahhh
So do I have to merge the two histories together?
Michael S
@Ohshi60
Apr 29 2018 12:06
hmm gimme a sec trying to remember the "smart" way to fix it :)
or else it might be faster to just delete repository and make a new and try again :)
NickTheDesigner
@NickTheDesigner
Apr 29 2018 12:06
I would not mind that at all
would I just get rid of the .git file?
Michael S
@Ohshi60
Apr 29 2018 12:08
okay we might be getting philosophical here - but your local .git file has all the changes and commits stored
so might want to save that, and the upstream one has 1 commit which only is for making a readme
NickTheDesigner
@NickTheDesigner
Apr 29 2018 12:10
One sec I will be back
Michael S
@Ohshi60
Apr 29 2018 12:18
@NickTheDesigner https://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories-on-rebase try using the --allow-unrelated-histories flag
NickTheDesigner
@NickTheDesigner
Apr 29 2018 12:26
Didn’t work
Tried that
I think it’s just better to just delete .git folder I haven’t gotten too far into my project
Michael S
@Ohshi60
Apr 29 2018 12:28
can you show me the error msg when you try?
@NickTheDesigner you can also delete the github repo and make a new one(which is what i meant when i said to start from scratch). If you do that dont initialize it with a readme or commits
you could also save all your work somewhere on your computer, then clone the github repo onto your computer, then add your files work, then finally commit and push. but you would lose all your commit history and changelog etc. Up to you, since i dont know how much work you will lose
chompoo500ml
@chompoo500ml
Apr 29 2018 12:38
you may try this
- rename local repo
- clone github repo to local again
- copy file from rename-local-repo to the new local clone folder
- git push from new local clone
chompoo500ml
@chompoo500ml
Apr 29 2018 12:45
@NickTheDesigner
mzedlach
@mzedlach
Apr 29 2018 12:49
Hello everyone!
h1tag
@h1tag
Apr 29 2018 12:50
hello!
mzedlach
@mzedlach
Apr 29 2018 12:50
I just made a single-page site for a friend of mine to help build my portfolio. But, I need to also provide it in German.
How would I go about that? Do I just make a file index.html/de?
Or... ?
NickTheDesigner
@NickTheDesigner
Apr 29 2018 12:51
Thank you @chompoo500ml and Michael
mzedlach
@mzedlach
Apr 29 2018 12:51
Or.... german.html and just link that all through the index.html doc?
chompoo500ml
@chompoo500ml
Apr 29 2018 12:58
@mzedlach basically, you gonna need to create 2 pages; or for the hard way, you can use javascript to manipulate content
or use server-side rendering which depends on your stack
Deepak Gowda
@Deep2322_twitter
Apr 29 2018 13:20
_configChanged(newConfig) {
    if (this.isConfigIntialized && newConfig && this._periodChanged) {
            this._requestData(this.demo, criteria)
    }
}

_periodChanged() {
    var criteria = {
        period: this.period
    };
    return criteria;
}
how can i get returned criteria from _periodChanged function and pass it to _configChanged function
so that i can pass the criteria as param to _requestData along with the other two params
Moisés Man
@moigithub
Apr 29 2018 13:37
functions returns values after they get CALLED
to call a function u add () parenthesis after its name
function gimmeOne(){  return 1; }
console.log ( gimmeOne()  ); // shows 1 on console
mzedlach
@mzedlach
Apr 29 2018 13:40
@chompoo500ml It's a simple one-page site. It's one index.html, 404.html, styles.css, folder of images . I'm also using a bucket in AWS for all the files. So, would I just make a file called "deutsch.html" (for example), put that in the bucket with the index.html and link it all within the html?
chompoo500ml
@chompoo500ml
Apr 29 2018 13:42
@mzedlach yes, that's correct
mzedlach
@mzedlach
Apr 29 2018 13:44
@chompoo500ml Wonderful, thank you :)
chompoo500ml
@chompoo500ml
Apr 29 2018 13:45
@mzedlach you are welcome!
Marc
@MWBauer
Apr 29 2018 14:29
Mornin
everyone
:coffee:
Stephen James
@sjames1958gm
Apr 29 2018 14:29
@MWBauer :wave:
Marc
@MWBauer
Apr 29 2018 14:30
Mr. Stephen James, how are ya'?
Stephen James
@sjames1958gm
Apr 29 2018 14:33
@MWBauer ok. Struggling through some c# code
Marc
@MWBauer
Apr 29 2018 14:34
Get a good grinding stone and you can make it more like cdull. or cflat
I moved the code into js and it still isn't showing. THe style part of it shows up as the text and the text that should display isn't.
lol
Stephen James
@sjames1958gm
Apr 29 2018 14:38
Let's see
Marc
@MWBauer
Apr 29 2018 14:39
Any ideas why the book would have me comment out the text? it says to use:
<script type="text/javascript">
  <!--text//-->
</script>
Stephen James
@sjames1958gm
Apr 29 2018 14:40
@MWBauer Well it could be a misleading comment - meaning that your js goes there, but we put text inside a comment
So that it would "parse" but you don't put your js inside of the comments
Norvin Burrus
@ndburrus
Apr 29 2018 14:45
@dhavalveera you might like these: :sparkles:
Dhaval Vira
@dhavalveera
Apr 29 2018 14:46
for what @ndburrus
Kai Stampe
@DonBeisser
Apr 29 2018 15:19
Hi, can anyone help me with my TwitchViewer? i get all informations of Online user but only of one Offline Streamer for serveral times can anyone tell me how to fix it and why it doesn't work correctly?
Moisés Man
@moigithub
Apr 29 2018 15:32
for loop is "sync"
and getJSON is "asynchronous" @DonBeisser
soo by the time getJSON answer gets back.. currentStreamerOffApiUrl will no longer have the original value it had when getJSON was called initially
2 ways to solve this..
  1. using function (soo i variable value will be keep on function scope) (external or IIFE)
  2. using let (to declare ur variables on block scope)
Norvin Burrus
@ndburrus
Apr 29 2018 15:42
@DonBeisser you might like this: :sparkles:
Stephen James
@sjames1958gm
Apr 29 2018 15:43
@DonBeisser forEach is another mechanism which uses a callback function that creates a separate context for each value in the array
Kai Stampe
@DonBeisser
Apr 29 2018 15:58
@moigithub thanks I'll try the options later.
@sjames1958gm but foreach is much slower, isn't it?
Stephen James
@sjames1958gm
Apr 29 2018 16:03
@DonBeisser Your app is doing API calls which are orders of magnitude slower than the difference between for and forEach (if there is a difference)
Kai Stampe
@DonBeisser
Apr 29 2018 16:14
ah. ok. thanks @sjames1958gm
AbrisM
@AbrisM
Apr 29 2018 16:23
Anyone familiar with GPO settings?
AbrisM
@AbrisM
Apr 29 2018 18:16
@ndburrus thanks
what is wrong with <div class="index-boxlink-square"> in here
Norvin Burrus
@ndburrus
Apr 29 2018 18:37
@AbrisM you're welcome! enjoy :+1:
include*engine
@newtothat
Apr 29 2018 18:39
the problem is with .index-boxlink-square inside @media only screen and (min-width: 1000px)
Aleksandar B.
@aleksandar-b
Apr 29 2018 19:36
@ndburrus hello :palm_tree:
Norvin Burrus
@ndburrus
Apr 29 2018 19:37
@samosale hi
Ashraf Patel
@AshrafPatel
Apr 29 2018 20:35
hey can someone help me why this is wrong
var arr2 = [];

function chunkArrayInGroups(arr, size) {
  var size2 = size;
  var count = 2;
  size = 0;

  while (size2 <= arr.length) {
    arr2.push(arr.slice(size, size2));
    size += size2;
    size2 *= count;
    count++;
  }
  return arr2;
}
its the chunkymonkey challenge
Stephen James
@sjames1958gm
Apr 29 2018 20:43
@AshrafPatel If you are doing FCC challenges you cannot have globals, because it won't reset them between tests
Ashraf Patel
@AshrafPatel
Apr 29 2018 20:44
@sjames1958gm thanks is my solution OK btw
Gulsvi
@gulsvi
Apr 29 2018 20:44
@AshrafPatel It may help to use variables like start and end or left and right to more easily follow the pointer you're tracking. Your while loop will need to loop while the start (leftmost) pointer is less than the length of the array.
Stephen James
@sjames1958gm
Apr 29 2018 20:45
@AshrafPatel
It doesn't look like it, if you console.log(size) and size2 what values are they?
Gulsvi
@gulsvi
Apr 29 2018 20:45
There shouldn't be a *= in that loop, as well, for another hint
Stephen James
@sjames1958gm
Apr 29 2018 20:46
@AshrafPatel
For example size2 will be 2, 4, 12
Ashraf Patel
@AshrafPatel
Apr 29 2018 20:49
@sjames1958gm @gulsvi Thank you I figured out when you mentioned 4 variables start, end, left right
Gulsvi
@gulsvi
Apr 29 2018 22:38
Glad you got it!
Amit Patel
@AmitP88
Apr 29 2018 23:38
hey guys, I just finished polishing up my Wiki Viewer: https://amitp88.github.io/Wiki-Viewer/
What do you think of it?
Stephen James
@sjames1958gm
Apr 29 2018 23:44
@AmitP88 Looks great - I would clear the input field on search, so the user doesn't have to press backspace for the next search
Amit Patel
@AmitP88
Apr 29 2018 23:45
@sjames1958gm ah good idea! thanks man, I was wondering if it needed anything else :)
Stephen James
@sjames1958gm
Apr 29 2018 23:46
@AmitP88 You could also change the cursor to pointer when you hover over the x in the input box
A cool effect might be to have each row come in one at a time - staggered :)
Moisés Man
@moigithub
Apr 29 2018 23:47
maybe add some style to each title results.. or turn into a link
Amit Patel
@AmitP88
Apr 29 2018 23:48

@sjames1958gm oh yeah, I was trying to do that at first with the rows coming in one at a time, but looking at my code below:

$(document).ready(function() { 
    $("#search").submit(function(e){
        e.preventDefault();
        var search = document.getElementById("query").value;

        $.ajax({
          'url': 'https://en.wikipedia.org/w/api.php?' + 'format=json' + '&action=query' + '&list=search' + '&srsearch=' + search + '&origin=*',
          'dataType': 'json',
          'type': 'GET',
          'success': function(data) {
            var list = data.query.search;
            $("#results").empty();          
            for(var i = 0; i < list.length; i++) {
                $("#results").append(
                  '<div class="single-result slideRight">' +
                    '<h3>' + list[i].title + '</h3>' +
                    list[i].snippet +
                    '<a href=' + 'https://en.wikipedia.org/?curid=' + list[i].pageid + ' ' + 'target=_blank' + '> See Wiki</a>' +
                  '</div>'
                );
            }
            // display "No results found if no wiki articles were found based on search criteria"
            if(list.length === 0){
              $("#results").append(
                '<p class="no-results">No results found</p>'
              );
            }
          }
        });
    });
});

I couldn't figure out how to do it

@moigithub good idea! I'll turn the titles into the wiki links instead of the "see wiki" text
@moigithub thanks :)
Stephen James
@sjames1958gm
Apr 29 2018 23:54
Try this - it may not work I didn't debug it. But instead of your loop
if (list.length > 0) stagger(list, 0);
   function stagger(list, i) {
          $("#results").append(
              '<div class="single-result slideRight">' +
              '<h3>' + list[i].title + '</h3>' +
              list[i].snippet +
              '<a href=' + 'https://en.wikipedia.org/?curid=' + list[i].pageid + ' ' + 'target=_blank' + '> See Wiki</a>' +
              '</div>'
             );
             i++;
            if (i < list.length) {
               setTimeout(() => stagger(list, i), 500);
            }
   }