These are chat archives for FreeCodeCamp/HelpFrontEnd

7th
Oct 2017
Ismail Hozain
@ismailhozain
Oct 07 2017 00:06 UTC
hey guys im having issues turning my images into links for the twitch thing.It is giving me a hard time, each time I click on the linked image it turns my screen in the pen white is there anything else that i can do? https://codepen.io/ismailhozain/pen/zdgQEb?editors=1000
never mind i forgot the target blank thing
Ismail Hozain
@ismailhozain
Oct 07 2017 00:16 UTC
argh it not working
(it like opens the page but does not load it
i copied the link of the page into another tab and it worked but not the one opened by my pen
Amit Patel
@AmitP88
Oct 07 2017 00:18 UTC

hey guys, I'm trying to view the demo for this npm match3 package and I can't seem to get it running. I downloaded the master branch (there are a ton of branches) and opened demo.html within the site folder, and the page just displays a big black square where the game would be. In the console, it says "error file not found: bundle.js". bundle.js is in another branch. What do I do to be able to view the 3 match game demo?
https://github.com/PlaytestersKitchen/match-three-js
npm install: https://www.npmjs.com/package/match3
Any help will be greatly appreciated :grinning:

I tried npm start but then I run into this:

match3 error.png
korzo
@korzo
Oct 07 2017 00:31 UTC
@AmitP88 did you clone the repository?
@AmitP88 Or just run npm install match3 ?
Because it looks like you have no package.json in that directory
In first part it installed match3 and complained about missing package.json
In second part, you are running npm start, which can't run without package.json
Amit Patel
@AmitP88
Oct 07 2017 00:34 UTC
@korzo oh yeah, someone told me to run npm init to get that, so I did. then I tried changing the name of the project inside the json file, but it still didnt work
korzo
@korzo
Oct 07 2017 00:34 UTC
@AmitP88 clone repository
cd in it
run npm install
run npm start
Emil
@aguyinmontreal
Oct 07 2017 00:44 UTC
Hey guys! Quick question: Can I use jquery .each() in a comparaison? For example if I have a form with multiple fields with an ID starting my "input": if ($('[id^=input]').each().val() == '') {} (I want to make sure all fields are empty)
Christoph Szczechowicz
@christophszcz
Oct 07 2017 00:48 UTC
I don't think that you can
The .each() method specifies a function to run for each matched element.
korzo
@korzo
Oct 07 2017 00:50 UTC
@aguyinmontreal I don't think so.
each returns jquery and val value for the first element
@aguyinmontreal But you can set some flag before loop and change it, if input is empty
let empty = false;
$('[id^=input]').each((i, e) => {
    if($(e).val() === '') {
    empty = true;
    }
}
});
Emil
@aguyinmontreal
Oct 07 2017 00:52 UTC
@christophszcz @korzo thanks!
CamperBot
@camperbot
Oct 07 2017 00:52 UTC
aguyinmontreal sends brownie points to @christophszcz and @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 590 | @korzo |http://www.freecodecamp.com/korzo
:cookie: 403 | @christophszcz |http://www.freecodecamp.com/christophszcz
piteto
@piteto
Oct 07 2017 01:34 UTC
@aguyinmontreal Yes, you can use $.each() for that:
$.each($('[id^=input]'), function(i, val) {
  if(!$(this).val()) {
    console.log($(this).attr('id') + ' is empty');
  }
});
this is an object: $('[id^=input]') and the syntax for $.each() is: $.each( obj, function( key, value ) { }
This may be easier with vanilla js though:
var isEmpty = [...document.querySelectorAll('[id^=input]')].every((el) => el.value == "");
Amit Patel
@AmitP88
Oct 07 2017 01:37 UTC
@korzo hey bro, sorry I didn't reply earlier. Actually another person couldn't get it to work either. I emailed the author for some guidance so we'll see what happens. I might end up trying to create my own match 3 engine from scratch, since I recently learned about prototypal inheritance :)
@korzo thanks for your help though, I really appreciate it :)
CamperBot
@camperbot
Oct 07 2017 01:37 UTC
amitp88 sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 591 | @korzo |http://www.freecodecamp.com/korzo
alteducation
@alteducation
Oct 07 2017 03:00 UTC
@alpox is there anything than can be done?
Jerzz
@2cool4school
Oct 07 2017 03:02 UTC
does anyone know what could be causing me to not be able to fit 2 .well div's with class=col-md-6 onto one line?
Ken Haduch
@khaduch
Oct 07 2017 03:08 UTC
@2cool4school - your screen might not be wide enough. You might have incorrectly set up the HTML code. Or other randomness (if it's a FCC challenge, sometimes the browser just caches crud...) Can you post your code? If it's on CodePen, you have to load Bootstrap.css...
Johnny
@jtan3
Oct 07 2017 04:56 UTC
Hi can someone help me with my all button? I don't understand the error. https://codepen.io/jtan3/pen/XaedZO?editors=1111
piteto
@piteto
Oct 07 2017 04:59 UTC
@jtan3 I think you just need to add id="all" to your "All" button
Seems to work for me after doing that
Johnny
@jtan3
Oct 07 2017 05:01 UTC
@piteto wow can't believe i missed that
@piteto thanks.
CamperBot
@camperbot
Oct 07 2017 05:01 UTC
jtan3 sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 215 | @piteto |http://www.freecodecamp.com/piteto
piteto
@piteto
Oct 07 2017 05:01 UTC
No problem
Johnny
@jtan3
Oct 07 2017 05:01 UTC
@piteto is there a better way of doing my click buttons? It a lot compared to jquery.
piteto
@piteto
Oct 07 2017 05:03 UTC
You could reduce some code @jtan3 by defining your offlineCards, onlineCards, and allCards variables outside of the hideOff, hideOn, and showAll functions
that way you don't have to re-declare them multiple times
Johnny
@jtan3
Oct 07 2017 05:06 UTC
@piteto can i get an example? I wasn't sure how to do them outside of the function
piteto
@piteto
Oct 07 2017 05:09 UTC
@jtan3 Actually, something like this might be even more concise:
[onButton, offButton, allButton].forEach(el => {
  el.addEventListener("click", () => {
    if(el.id.includes('off')) buttonFilter('.online');
    if(el.id.includes('on')) buttonFilter('.offline');
    if(el.id.includes('all')) buttonFilter();
  })
});

function buttonFilter(className) {
  document.querySelectorAll('.online, .offline').forEach(el => el.style.display = "inline-block");
  document.querySelectorAll(className).forEach(el => el.style.display = "none");
}
have a function that takes a class name as an argument
for each button, add a click event listener
if the button id has the word "off" in it, hide the online classes
if the button id has the word "on" in it, hide the offline classes
otherwise, just show everything
Johnny
@jtan3
Oct 07 2017 05:11 UTC
@piteto thanks i should go study that piece of code for awhile.
CamperBot
@camperbot
Oct 07 2017 05:11 UTC
jtan3 sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
api offline
piteto
@piteto
Oct 07 2017 05:12 UTC
It still isn't quite as short as jquery - there may be better ways
lilithdracorr
@lilithdracorr
Oct 07 2017 06:30 UTC
hey
alpox
@alpox
Oct 07 2017 07:26 UTC
@alteducation i cannot think of anything. I dont think it is possible
Nusrath
@nusrathyasin
Oct 07 2017 10:25 UTC
A quick question to the one who present here--- Which is better to use in web design - W3.css or simply css ?
Ian Gracia
@iangracia
Oct 07 2017 11:01 UTC
whats up guys
someone know why 3-1 = -2 in my script? And 1-3 = 2? when it should be the other way around
is there some untold rule of js that im missing perhaps
abraham anak agung
@padunk
Oct 07 2017 11:03 UTC
@iangracia post your code here
CamperBot
@camperbot
Oct 07 2017 11:03 UTC
padunk sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
:cookie: 353 | @iangracia |http://www.freecodecamp.com/iangracia
Ian Gracia
@iangracia
Oct 07 2017 11:03 UTC
its really long, ill link my codepen
alot of bugs in it, dont try anything crazy with the calc buttons, just 3-1 and equals
then again im not ur boss so do whatever you want
@padunk
Ian Gracia
@iangracia
Oct 07 2017 11:14 UTC
nvm i got it lol
fml
:shipit:
Ian Gracia
@iangracia
Oct 07 2017 12:35 UTC
someone know where i can visualize javascript with html and css ?
alteducation
@alteducation
Oct 07 2017 12:40 UTC
i am trying to setup filtering on this page https://www.alternativeeducation.in/learning-spaces. can someone tell me the logic for doing that. should i use the filter method. should i create seperate functions for each selection that filters what is the best way to go about it?
Ian Gracia
@iangracia
Oct 07 2017 13:48 UTC
wow this chat really has been dead all day
maybe cause im in the wrong timezone
alteducation
@alteducation
Oct 07 2017 13:51 UTC
@iangracia where you from man?
CamperBot
@camperbot
Oct 07 2017 13:51 UTC
alteducation sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
:cookie: 355 | @iangracia |http://www.freecodecamp.com/iangracia
Ian Gracia
@iangracia
Oct 07 2017 13:53 UTC
@alteducation sweden
in a small town where i seem to be the only one interested in learning programming
alteducation
@alteducation
Oct 07 2017 13:56 UTC
@iangracia haha . alone with javascript :D
CamperBot
@camperbot
Oct 07 2017 13:56 UTC
alteducation sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
api offline
ADIL KARMOUZI
@mradil16
Oct 07 2017 13:57 UTC
Guys I want to convert a PNG template to HTML and I don't know what Font this template use ?
Ian Gracia
@iangracia
Oct 07 2017 13:58 UTC
@alteducation where u from?
alteducation
@alteducation
Oct 07 2017 13:59 UTC
@iangracia in the small state of kerala in southern most India
CamperBot
@camperbot
Oct 07 2017 13:59 UTC
alteducation sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
api offline
korzo
@korzo
Oct 07 2017 14:17 UTC
@mradil16 Try this . There are several sites, which can help you identify font
Ahmed Sabry Abdelwahab Mahfouz
@mahfouz1906
Oct 07 2017 15:01 UTC
hello world
alteducation
@alteducation
Oct 07 2017 15:16 UTC
hi can someone guide with some javascript logic
I am trying to add filter for this page https://www.alternativeeducation.in/learning-spaces
Kris
@krisalexander
Oct 07 2017 15:16 UTC
Returning camper.. Hi All
Re-doing Front End
Got put off last attempt at final project. Overwhelmed.
alteducation
@alteducation
Oct 07 2017 15:17 UTC
@krisalexander can you guide me on some javascript logic
please try my calc and find bugs for me to fix
Kris
@krisalexander
Oct 07 2017 15:22 UTC
@alteducation ask one of the FCC gurus
piteto
@piteto
Oct 07 2017 15:23 UTC
@alteducation I can help if you're able to put it in a codepen to see non-minified JS, non-bundled CSS, etc - or narrow it down to a specifc problem. There are tens of thousands of lines of code on that page
@iangracia To simplify your code, you might want to look into eval() - as long as you are limiting input to the calculator buttons, it's a good approach for the calculator.
eval(1+3-4+8)
CamperBot
@camperbot
Oct 07 2017 15:26 UTC
piteto sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
:cookie: 356 | @iangracia |http://www.freecodecamp.com/iangracia
Ian Gracia
@iangracia
Oct 07 2017 15:27 UTC
thanks, will look into that! @alteducation
CamperBot
@camperbot
Oct 07 2017 15:27 UTC
iangracia sends brownie points to @alteducation :sparkles: :thumbsup: :sparkles:
api offline
alteducation
@alteducation
Oct 07 2017 15:29 UTC
@piteto Yeah Sure What I'm Trying to achieve is in the select html element , the options are state names. so for eg if user clicks on 'Delhi' I want to show only Cards which has as text value "delhi" inside them. I have put a class for the h4 element which contains the vales of the states. I just learned the javascript filter method and has only used it with arrays that i made. I dont know how to use it with the dom
Ian Gracia
@iangracia
Oct 07 2017 15:29 UTC
i mean @piteto not @alteducation
piteto
@piteto
Oct 07 2017 15:36 UTC
@alteducation I think .forEach() might work better in that case - for each element value with class name state, if state != "some value", display == none; else display = inline-block
@iangracia No problem
CamperBot
@camperbot
Oct 07 2017 15:36 UTC
piteto sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
api offline
alteducation
@alteducation
Oct 07 2017 16:00 UTC
@piteto that way i will need to create a function for each state?
@piteto sorry i forgot i can do accepting the value from the select option instead of writing more functions
piteto
@piteto
Oct 07 2017 16:09 UTC
@alteducation This might help explain better: https://s.codepen.io/anon/pen/PJQLKR?editors=0010
when your select menu changes, get the value selected. Pass that to a function and then do .hide() or .show() based on the value selected
piteto
@piteto
Oct 07 2017 16:36 UTC
@alteducation Time to enjoy my Saturday and log off - hope that helped, I'm sure others here can explain other ways to do it if needed.
alteducation
@alteducation
Oct 07 2017 16:41 UTC
@piteto thanks a tonn!
CamperBot
@camperbot
Oct 07 2017 16:41 UTC
alteducation sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 217 | @piteto |http://www.freecodecamp.com/piteto
aRtoo
@artoodeeto
Oct 07 2017 19:47 UTC
@piteto yow bro can i ask u question?
aRtoo
@artoodeeto
Oct 07 2017 20:14 UTC
hello fam. question why cant i get the value of test?

var test;

document.getElementById('one').addEventListener('click', function() {
    test = 1;
});

console.log(test);
Dan Schapira
@dsschapira
Oct 07 2017 20:18 UTC
Your event will fire when you click the element with id "one", but it won't re-run the console.log statement. So it will first log your initial value of test (which is undefined), and when you click id="one", it will change the value, but it won't log it to the console.
@artoodeeto .... forgot to @ you :)
aRtoo
@artoodeeto
Oct 07 2017 20:20 UTC
@dsschapira yea. im confuse it wont change the value. but when i try it to jquery it will work
@dsschapira have u experienced it sir? any idea?
Dan Schapira
@dsschapira
Oct 07 2017 20:22 UTC
Can you share the jquery code that works? I still wouldn't expect the jquery version of this to log a different value for test, so maybe I'm just misunderstanding.
@artoodeeto .. so bad at forgetting to @ people lol
aRtoo
@artoodeeto
Oct 07 2017 20:24 UTC
@dsschapira its done sir. thank for the help. someone figureout the problem
CamperBot
@camperbot
Oct 07 2017 20:24 UTC
artoodeeto sends brownie points to @dsschapira :sparkles: :thumbsup: :sparkles:
:cookie: 291 | @dsschapira |http://www.freecodecamp.com/dsschapira
aRtoo
@artoodeeto
Oct 07 2017 20:24 UTC
thanks
@dsschapira ill sent the jquery
Void Demon
@voiddemon
Oct 07 2017 20:31 UTC

@voiddemon
Can anyone please help me with the below code

import java.sql.*;

public class Vogellatest2 {

        Connection c = null;
        Statement s = null;
        ResultSet r = null;

        public void readDataBase()  {
            try {
                Class.forName("com.mysql.jdbc.Driver");
                c = DriverManager
                        .getConnection("jdbc:mysql://localhost/employees" + "user=sameerboppana & password = space");
                s = c.createStatement();
                r = s.executeQuery("Select * from salaries where salary > 155500");
                writeResultSet(r);
            } catch (Exception e) {
                //throw e;
            } finally {
                close();

            }
        }

        private void writeMetaData(ResultSet r) throws SQLException {

            System.out.println("The columns in the table are: ");

            System.out.println("Table: " + r.getMetaData().getTableName(1));
            for (int i = 1; i <= r.getMetaData().getColumnCount(); i++) {
                System.out.println("Column " + i + " " + r.getMetaData().getColumnName(i));
            }
        }

        private void writeResultSet(ResultSet resultSet) throws SQLException {
            // ResultSet is initially before the first data set
            while (resultSet.next()) {
                // It is possible to get the columns via name
                // also possible to get the columns via the column number
                // which starts at 1
                // e.g. resultSet.getSTring(2);
                System.out.print(resultSet.getString(1) + " ");
                System.out.println(resultSet.getString("salary" + " "));

            }
        }

        private void close() {
            try {
                if (r != null) {
                    r.close();
                }

                if (s != null) {
                    s.close();
                }

                if (c != null) {
                    c.close();
                }
            } catch (Exception e) {

            }
            public static void main (String args[]) {    
///i'm getting an error here saying  void is an invalid type for main

                new Vogellatest2().readDataBase();
            }
        }

    }

i'm getting an error saying void is an invalid type for main

Dan Schapira
@dsschapira
Oct 07 2017 20:55 UTC
@voiddemon my Java is super rusty, but I think the issue might be that you're missing a constructor in your Vogellatest2 class. Within public class Vogellatest2, I think there is usually a public Vogellatest2 as well. This stackoverflow thread might help: https://stackoverflow.com/questions/21219917/void-is-invalid-for-the-variable-main
Void Demon
@voiddemon
Oct 07 2017 21:00 UTC
@dsschapira thankyou
CamperBot
@camperbot
Oct 07 2017 21:00 UTC
voiddemon sends brownie points to @dsschapira :sparkles: :thumbsup: :sparkles:
:cookie: 292 | @dsschapira |http://www.freecodecamp.com/dsschapira
Unknown
@Unknownhezipaz
Oct 07 2017 21:12 UTC
Can I ask for php help on this chat
Dan Schapira
@dsschapira
Oct 07 2017 21:16 UTC
I'd think the HelpBackEnd chat would probably be more help with PHP
Ismail Hozain
@ismailhozain
Oct 07 2017 23:41 UTC
hey guys i need help with my twitch streamer[https://codepen.io/ismailhozain/pen/zdgQEb]
Gersho
@Gersho
Oct 07 2017 23:43 UTC
you seem to be on the good path since you can already display each channel's logo
so what do you need help with ?
Ismail Hozain
@ismailhozain
Oct 07 2017 23:44 UTC
my issue is with when the user is streaming i need to show what they are streaming but dont know how and my console is not much of a help
Gersho
@Gersho
Oct 07 2017 23:46 UTC
about your code
you should make a loop to handle your calls
Ismail Hozain
@ismailhozain
Oct 07 2017 23:47 UTC
ok
Gersho
@Gersho
Oct 07 2017 23:47 UTC
you're rewriting too much stuff here
easiest would be an array = [ "channel1", "channel2,..]
Ismail Hozain
@ismailhozain
Oct 07 2017 23:47 UTC
what part of the api would i link that to
piteto
@piteto
Oct 07 2017 23:50 UTC
@ismailhozain if you're copy/pasting code over and over, there is always a better way
Gersho
@Gersho
Oct 07 2017 23:50 UTC
you do like
arr=["chan1","chan2"]
arr.forEach(function(user){
//your getJSON code and what you're gonna do with it, you write this once instead of once per user

}
piteto
@piteto
Oct 07 2017 23:50 UTC
to figure out what someone is streaming - try looking at the users on twitch.tv and finding out which ones are online/offline
then compare their json
Ismail Hozain
@ismailhozain
Oct 07 2017 23:51 UTC
this is what i tried.....
Gersho
@Gersho
Oct 07 2017 23:51 UTC
you need to collect 4 JSON to have a good view
Ismail Hozain
@ismailhozain
Oct 07 2017 23:51 UTC
what does that mean?
this is what i tried..... function(esl_sc2sdata) { console.log("esl_sc2s"); console.log(esl_sc2sdata); if (esl_sc2sdata.stream===null) { $("#esl_sc2s").html("Offline"); } else { $("#esl_sc2s").html("Streaming"); $("#esl_sc2g").html(esl_sc2sdata.game); }
Gersho
@Gersho
Oct 07 2017 23:52 UTC
when user is ON: /stream and /channel
when user is OFF: /stream and /channel
so you can compare the 4 different json
Gersho
@Gersho
Oct 07 2017 23:52 UTC
yeah that
Ismail Hozain
@ismailhozain
Oct 07 2017 23:54 UTC
wait so it has to be on which one the stream or the channel?
cause currently it is on the stream
piteto
@piteto
Oct 07 2017 23:58 UTC
You need to use both of those depending on the streamer's online status, that's one of the challenges for this project
Gersho
@Gersho
Oct 07 2017 23:58 UTC
depends what kind of data you want, check the 2 online one piteto provided, and choose your favorite depending on the information provided and what you want to use (or use both !)
Ismail Hozain
@ismailhozain
Oct 07 2017 23:59 UTC
honestly i just want the game part game:"StarCraft II"
that was from my console