These are chat archives for FreeCodeCamp/HelpFrontEnd

11th
Nov 2017
Christopher Brown
@ChrisBrownie55
Nov 11 2017 00:26
@PrincessTabitha your design needs a lot of work and on mobile the long paragraphs are too squished into the center. Also I think the tribute page is supposed to be about someone else that has a wiki page. Check out the ‘Build Tribute’s user stories that you’re supposed to fulfill
Botenga
@Botenga
Nov 11 2017 00:33
Hey guys
Hey it would be helpful if someone could check out my pen and tell me what you think about my color palette
Christopher Susi
@chrisandsuch
Nov 11 2017 00:37
@Botenga looks pretty good!
Christopher Brown
@ChrisBrownie55
Nov 11 2017 01:14
@Botenga the text color doesn’t go well with the lighter blue background and the text at the bottom section doesn’t go with it’s background either, the first two sections are good maybe change the fonts though
Botenga
@Botenga
Nov 11 2017 01:19
@ChrisBrownie55 I think i might go with black for the base
Christopher Brown
@ChrisBrownie55
Nov 11 2017 01:20
@Botenga try #222 instead of straight black and if you want to learn better color schemes go check some really nice websites
João Porfírio
@pixelparker
Nov 11 2017 02:10
hey guys, anyone with good react knowledge?
Tom
@moT01
Nov 11 2017 02:16
goodish
key word ish
Angel J Piscola
@Redmega
Nov 11 2017 02:16
I do it for a living
What's up
Tom
@moT01
Nov 11 2017 02:17
maybe you can help me after he's been helped
or before
so i found my problem
not sure how to fix it
Angel J Piscola
@Redmega
Nov 11 2017 02:18
@joaotporfirio @moT01 I'm not here all night, so fire away ;)
Tom
@moT01
Nov 11 2017 02:18
so im using react and redux
a jwt authentication
(not very familiar with that)
Angel J Piscola
@Redmega
Nov 11 2017 02:19
jwt is basically an auth cookie to let a client authentitcate with the server
more or less
What's the problem?
Tom
@moT01
Nov 11 2017 02:19
so i have a settings page
to change the users info
and it updates the db, and the store
so if someone then closes the window, or opens a new one
and goes to the settings page it gets the info from the token
Angel J Piscola
@Redmega
Nov 11 2017 02:20
err
Tom
@moT01
Nov 11 2017 02:20
the settings page is a form, that's pre filled
Angel J Piscola
@Redmega
Nov 11 2017 02:20
the token stores the info?
Or what do you mean
Tom
@moT01
Nov 11 2017 02:21
yes
i didnt make this part
   if (user.length > 0){
     if (bcrypt.compareSync(password, user[0].pass_digest)) {
       const token = jwt.sign({
         id: user[0]._id,
         username: user[0].username,
         firstName: user[0].firstName,
         lastName: user[0].lastName,
         city: user[0].city,
         state: user[0].state,
         zipcode: user[0].zipcode,
         books: user[0].books
       }, process.env.JWT_SECRET);
       res.json({token});
that's after a login click
export function login(data){
  return dispatch => {
    return axios.post('/api/auth', data).then(res => {
      const token = res.data.token;
      localStorage.setItem('jwtToken', token);
      setAuthorizationToken(token);
      dispatch(setCurrentUser(jwtDecode(token)));
    });
  }
}
the first code i pasted there is in the route, it sends the token back to dispatch
im trying my best to explain
Angel J Piscola
@Redmega
Nov 11 2017 02:23
No i get you
So whats the issue exactly?
Tom
@moT01
Nov 11 2017 02:25
so if i change my settings and save it, then open a new window it gets the info from the token
when i save it - it all works
db updated, the form saves the info, the store gets updated
function mapStateToProps(state) {
    return {
        globalState: state,
      id: state.auth.user.id,
      firstName: state.auth.user.firstName,
      lastName: state.auth.user.lastName,
      city: state.auth.user.city,
      state: state.auth.user.state,
      zipcode: state.auth.user.zipcode,
    }
}
thats in the settings form component
Angel J Piscola
@Redmega
Nov 11 2017 02:28
Ok, so far so good
Tom
@moT01
Nov 11 2017 02:29
so it pulls from that token
here's how i update the store
export default (state = initialState, action = {}) => {
    switch(action.type) {
      case SET_CURRENT_USER:
        return {
          isAuthenticated: !isEmpty(action.user),
          user: action.user
        }
      case CHANGE_SETTINGS:
        return { ...state,
             user: { ...state.user,
               lastName: action.settings.user.firstName,
               firstName: action.settings.user.lastName,
               city: action.settings.user.city,
               state: action.settings.user.state,
               zipcode: action.settings.user.zipcode
             }
        }
      default: return state;
    }
}
Angel J Piscola
@Redmega
Nov 11 2017 02:31
looks alright to me. No need to ...state in the SET_CURRENT_USER?
Tom
@moT01
Nov 11 2017 02:31
um, im not sure, i didn't make that part
that's also fuzzy for me
but i dont think that's it
Angel J Piscola
@Redmega
Nov 11 2017 02:32
whats exactly the issue though, you still haven't said it ;)
Tom
@moT01
Nov 11 2017 02:33
so what i go and change the settings form and submit it
when*
like it said, that all works, store gets updated
values in the form change to match
but the token doesn't change
so when i open a new tab
and go to the settings form
it's filled with the info from the token
Angel J Piscola
@Redmega
Nov 11 2017 02:34
hmm
where are you changing the jwt token contents
Tom
@moT01
Nov 11 2017 02:34
im not
i didn't make that either, probly why im struggling with this part
he labeled it as a const
so i wasn't sure if i should change it
Angel J Piscola
@Redmega
Nov 11 2017 02:35
Ok show me where it updates the jwt token
Tom
@moT01
Nov 11 2017 02:35
you think i should just change the token when i change the settings
Angel J Piscola
@Redmega
Nov 11 2017 02:35
I don't even think it works that way...
We don't store any mutable info in the jwt token
Tom
@moT01
Nov 11 2017 02:36
i think i showed the token creation
Angel J Piscola
@Redmega
Nov 11 2017 02:36
jwt token isj ust used to verify the client iwth the server afaik
Tom
@moT01
Nov 11 2017 02:36
and nothing gets changed
Angel J Piscola
@Redmega
Nov 11 2017 02:36
wow those typos. its been a long day at work, sorry
What you need to do is invalidate the jwt token and generate a new one
since the data contained within is no longer valid
Tom
@moT01
Nov 11 2017 02:37
something like that kinda came to mind, force a logout on a close, or expire the token or something on close
but still, what if a window is open and then another one gets open before the first one closes - the token would be there
i cant change the token info right?
that's what you meant by no mutable info im guessing
Angel J Piscola
@Redmega
Nov 11 2017 02:40
Yeah
to the best of my knowledte
maybe http://jwt.io can help you
knowledge*
Ive been working since 6am and its not 9pm so... yeah... sorry i can't be of more help :skull:
now*
Tom
@moT01
Nov 11 2017 02:41
that's fine
im trying to think of another way to get the info for that form
or store the info for the form somewhere else maybe
so it doesn't get the info from the token
Angel J Piscola
@Redmega
Nov 11 2017 02:44
the jwt token can just be used to authenticate
you can get the info from and update it with an ajax request
write to db
through a rest endpoint
the endpoint can authenticate with hte jwt token so no random people spew nonsense into your endpoint
Tom
@moT01
Nov 11 2017 02:46
alright
i think that might be enough for me to go on
thanks @Redmega
CamperBot
@camperbot
Nov 11 2017 02:47
mot01 sends brownie points to @redmega :sparkles: :thumbsup: :sparkles:
:cookie: 159 | @redmega |http://www.freecodecamp.com/redmega
Angel J Piscola
@Redmega
Nov 11 2017 02:48
:clap:
nsonhouse
@nsonhouse
Nov 11 2017 02:52
Can any one explain why the <h1>...</h1> tag would not work?
Tom
@moT01
Nov 11 2017 02:53
@nsonhouse not me, it should work
.html file?
nsonhouse
@nsonhouse
Nov 11 2017 02:54
yes
Tom
@moT01
Nov 11 2017 03:01
well, i dunno
put it in a codepen and show it, maybe i can help
nsonhouse
@nsonhouse
Nov 11 2017 03:06
Ok, I just found the problem. I am using the reset.css from meyerweb.
Seah Eng Chye
@Seahchye
Nov 11 2017 03:19
@khaduch thats a great explanation thanks!
CamperBot
@camperbot
Nov 11 2017 03:19
seahchye sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3493 | @khaduch |http://www.freecodecamp.com/khaduch
Olivia Raven
@OliviaRaven1579
Nov 11 2017 03:21
Hello
Tom
@moT01
Nov 11 2017 03:26
@OliviaRaven1579
Christopher Susi
@chrisandsuch
Nov 11 2017 03:49
Gonna hit the sack. Goodnight all!
Tom
@moT01
Nov 11 2017 03:50
cya
thinsoldier
@thinsoldier
Nov 11 2017 04:27
What is best practice for markup of main navigation <nav><a> or <nav><ul><li><a> ?
Allister
@AlyxMoon
Nov 11 2017 04:32
@thinsoldier The second example is how I always see it done. Semantically it makes sense, as it is usually a list of links in the navigation bar even if isn't displayed like a typical list.
thinsoldier
@thinsoldier
Nov 11 2017 04:32
I thought things would have changed for the simpler after html5...
Does anyone have an example of a multi-level navigation using the BEM naming convention?
Presently I have lots of stuff like: .nav-main li ul li ul
primuscovenant
@primuscovenant
Nov 11 2017 05:30
@heroiczero thx
CamperBot
@camperbot
Nov 11 2017 05:30
primuscovenant sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 2052 | @heroiczero |http://www.freecodecamp.com/heroiczero
Seah Eng Chye
@Seahchye
Nov 11 2017 07:12
@khaduch @heroiczero in this case where is the alt text?
blob
I only see pictures on the cat photo
blob
Sorin Ruse
@sorinr
Nov 11 2017 07:24
@Seahchye you will see the alt text in case the link to the img is broken
Seah Eng Chye
@Seahchye
Nov 11 2017 07:25
@sorinr I See Thanks!
CamperBot
@camperbot
Nov 11 2017 07:25
seahchye sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1351 | @sorinr |http://www.freecodecamp.com/sorinr
Sorin Ruse
@sorinr
Nov 11 2017 07:43
@Seahchye welcome
Yashasvi
@TechMky
Nov 11 2017 07:46
Hi, I was working on the weather front end project, and I hope I could some some help from the community.
So, I know I to consume the api and everything, and I have a set of CSS weather icons that I want to display on the page according to the weather conditions of the given location. Does anyone knows what are all the possible values for "weather.main" in the response so that I can maybe dynamically create a list of class?
If there is any other kind of solution please share, that would be really great.
Bhoomi Khanderia
@bhoomikhanderia
Nov 11 2017 08:02
Hi guys!
How can I connect to an api using javascript?
Yashasvi
@TechMky
Nov 11 2017 08:47
@Bhoomi-Github look for jQuery ajax method.
abraham anak agung
@padunk
Nov 11 2017 08:57
@TechMky you could do console.log(weather.main) and check the value in your devtools or open console if you working in codepen
Bhoomi Khanderia
@bhoomikhanderia
Nov 11 2017 09:05
@TechMky

<!DOCTYPE html>

<html>
<head>
<title>Hi</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">

<script>

function getJSONP(url, success) {

var ud = '_' + +new Date,
script = document.createElement('script'),
head = document.getElementsByTagName('head')[0]
|| document.documentElement;

window[ud] = function(data) {
head.removeChild(script);
success && success(data);
};

script.src = url.replace('callback=?', 'callback=' + ud);
head.appendChild(script);

}

getJSONP('http://alintacodingtest.azurewebsites.net/api/Movies', function(data){
console.log(data.status);
});

</script>
</head>
<body>
<!-- <button type="submit" onclick="UserAction()">Search</button> -->
</body>
</html>

Yashasvi
@TechMky
Nov 11 2017 09:05
@padunk I have done that. My question is what are the possible values that the API can give me in "weather.main". In the docs, it says "Rain, Clouds, etc" . I need to know exactly what all those 'etc' are.
Bhoomi Khanderia
@bhoomikhanderia
Nov 11 2017 09:05
What is my mistake here?
Yashasvi
@TechMky
Nov 11 2017 09:06
@Bhoomi-Github Let me just go through it
abraham anak agung
@padunk
Nov 11 2017 09:07
@TechMky than you need to read their API doc, i think they must have it there somewhere
@Bhoomi-Github put your code inside ``` tag it is hard to read
Yashasvi
@TechMky
Nov 11 2017 09:10
@padunk I did. It just says that, "Weather parameters (Rain, Clouds, Snow, etc)" I tried looking up everywhere, Didn't had much luck.
Bhoomi Khanderia
@bhoomikhanderia
Nov 11 2017 09:11

'<!DOCTYPE html>

<html>

<head>
<title>Hi</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">

<script>

function getJSONP(url, success) {

var ud = '_' + +new Date,
    script = document.createElement('script'),
    head = document.getElementsByTagName('head')[0] 
           || document.documentElement;

window[ud] = function(data) {
    head.removeChild(script);
    success && success(data);
};

script.src = url.replace('callback=?', 'callback=' + ud);
head.appendChild(script);

}

getJSONP('http://alintacodingtest.azurewebsites.net/api/Movies', function(data){
console.log(data.status);
});

</script>

</head>

<body>
<!-- <button type="submit" onclick="UserAction()">Search</button> -->
</body>
</html>'

catalin560
@catalin560
Nov 11 2017 09:32
hello
does anyone know what this code does?
it looks messed up
A-J Roos
@Asjas
Nov 11 2017 09:53
@catalin560 Seems it searches for empty input fields and then applies a class and a css style to it.
catalin560
@catalin560
Nov 11 2017 09:53
@Asjas thanks
CamperBot
@camperbot
Nov 11 2017 09:53
catalin560 sends brownie points to @asjas :sparkles: :thumbsup: :sparkles:
:cookie: 284 | @asjas |http://www.freecodecamp.com/asjas
soybeanlee
@gitaoliao
Nov 11 2017 12:30
Hello, how you guys test ie678 by macbookpro?
Long Nguyen
@longnt80
Nov 11 2017 12:48
@gitaoliao IE6 still exists? :scream:
@gitaoliao use VM
Tiago Correia
@tiagocorreiaalmeida
Nov 11 2017 13:56
any bootstrap users around?
Jacob Colborn
@jcolborn-dropdeadgames
Nov 11 2017 14:31
@gitaoliao Microsoft offers VM's you can download from https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ but they only have IE8 and newer. For IE6 testing you will need a Windows XP SP3 VM.
@tiagocorreiaalmeida You could call me a bootstrap user
Tiago Correia
@tiagocorreiaalmeida
Nov 11 2017 15:12
allready got it solved but thanks @jcolborn-dropdeadgames
CamperBot
@camperbot
Nov 11 2017 15:12
tiagocorreiaalmeida sends brownie points to @jcolborn-dropdeadgames :sparkles: :thumbsup: :sparkles:
api offline
Tiago Correia
@tiagocorreiaalmeida
Nov 11 2017 15:23
image.png
anyone know's a thing like fontawsome that has icons like this with free use?
Quantomistro3178
@Quantomistro3178
Nov 11 2017 15:38
ugh, RegExp and .replace() is so hard to understand on MDN!!!
Paul Freeman
@pfreema1
Nov 11 2017 15:45
could anyone explain to me why the next to last test should return insufficient funds on the exact-change algorithm challenge?
the total cash in drawer is greater than the change due
or am i reading it wrong?
Moisés Man
@moigithub
Nov 11 2017 15:47
MDN is hard to understand... its more technical
for newcomers probably w3school would be easier
...its not updated, but for most basic stuff is ok ... i think @Quantomistro3178

checkCashRegister(19.50, 20.00, [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1.00], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]]) should return "Insufficient Funds"

soo u need to refund 0.5
and the money u have on ur cash machine is
["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1.00], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]] @pfreema1

Paul Freeman
@pfreema1
Nov 11 2017 15:50
ah ok so if it doesnt work out to the change, it should return insufficient funds as well?
Adel
@AdelMahjoub
Nov 11 2017 15:54
@tiagocorreiaalmeida this one is not free https://www.flaticon.com/ , and this one have some free https://www.iconshock.com/
Quantomistro3178
@Quantomistro3178
Nov 11 2017 15:58
@moigithub Yeah, but W3C websites are blocked in china (the damn GFW), so I can't use any. I mean, there are sort of W3C websites available here, but they're all in chinese.
Adel
@AdelMahjoub
Nov 11 2017 15:59
@Quantomistro3178 is not possible to use a vpn ? to get around the filter ?
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:00
Internet security in china varies based on your location inside china too. where i am, most of the vpns are blocked too. only the expensive paid ones work.
and i'm just a 14yo kid, mate. so.....
Tiago Correia
@tiagocorreiaalmeida
Nov 11 2017 16:02
thanks @AdelMahjoub
CamperBot
@camperbot
Nov 11 2017 16:02
tiagocorreiaalmeida sends brownie points to @adelmahjoub :sparkles: :thumbsup: :sparkles:
:cookie: 617 | @adelmahjoub |http://www.freecodecamp.com/adelmahjoub
Moisés Man
@moigithub
Nov 11 2017 16:05
@Quantomistro3178 what about devdocs ?
http://devdocs.io/javascript/global_objects/string/replace
(not sure if easier to read/understand )
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:09
wait. let me try
hmm....kinda looks the same as MDN, but i'll look a bit more into it
Adel
@AdelMahjoub
Nov 11 2017 16:18
@Quantomistro3178 does glitch.com works in china ?
@Quantomistro3178 if it works you can proxy content and display it in iframes
@Quantomistro3178 or scrap the responses and build some personal docs
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:23
wait
glitch.com is working, what do i do?
Ken Haduch
@khaduch
Nov 11 2017 16:24
@pfreema1 - note sure if anyone answered your final question - but if there is not enough of the correct type of change available to return the exact change, then you have to return the "Insufficient funds" status.
Adel
@AdelMahjoub
Nov 11 2017 16:25
@Quantomistro3178 write a small nodejs script that that w3school url in the querystring, make a get request from the node app to w3school, it will get the content. send back that content to your client, since glitch works it won't be blocked
@Quantomistro3178 you can request css and js files too and even rebuild a clone of w3school china
@Quantomistro3178 in other word you'll be scrapping w3school content to build a clone
@Quantomistro3178 or in more generic terms, smuggling web content into china
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:28
whoa, wait a minute.
How am i supposed to do all that if i can't learn HOW to do all that in the first place?
Adel
@AdelMahjoub
Nov 11 2017 16:29
@Quantomistro3178 nodejs
@Quantomistro3178 or php
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:29
i don't know anything
Adel
@AdelMahjoub
Nov 11 2017 16:29
@Quantomistro3178 you can learn basic php real quick
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:29
like i said, i cant even understand RegExp properly
Adel
@AdelMahjoub
Nov 11 2017 16:30
@Quantomistro3178 no worries, all what you need is a couple of lines
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:30
hmmm, you know, I was thinking of learning a server-side language sooner or later.....
Adel
@AdelMahjoub
Nov 11 2017 16:30
@Quantomistro3178 then it is time to learn and to smuggle web content :smile:
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:31
@AdelMahjoub thanks, mate!
CamperBot
@camperbot
Nov 11 2017 16:31
quantomistro3178 sends brownie points to @adelmahjoub :sparkles: :thumbsup: :sparkles:
:cookie: 618 | @adelmahjoub |http://www.freecodecamp.com/adelmahjoub
Darren
@DarrenfJ
Nov 11 2017 16:31
@Quantomistro3178 right on for tackling coding at any age :D good for you brutha!
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:33
@DarrenfJ I'm doing this 50% because i'll be able to make money at home as a freelance coder, and 50% because it is an awesome way to impress people and 'look cool'
Darren
@DarrenfJ
Nov 11 2017 16:34
i hear yah ;)
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:35
so tell me
why this won't work for finding if a string is palindrome or not
function palindrome(str) {
  // Good luck!
  var regex = /[\W_]/g;
  var a = str.replace(regex, "").toLowerCase();
  var i = a.split("").reverse().join("");

  if (i === a){
    return true;
  }
}

palindrome("eye");
it returns true no matter which string is place into the palindrome function.
Adel
@AdelMahjoub
Nov 11 2017 16:38
@Quantomistro3178 because i always equal a
Darren
@DarrenfJ
Nov 11 2017 16:39
did yah console.log after the var a var i to see what they turn out to be?
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:39
@AdelMahjoub how so?
Adel
@AdelMahjoub
Nov 11 2017 16:40
@Quantomistro3178 add a return after the if
@Quantomistro3178 it returns undefined if they are not equal
Quantomistro3178
@Quantomistro3178
Nov 11 2017 16:42
ah right
forgot to add else { return false;}
@AdelMahjoub thanks
CamperBot
@camperbot
Nov 11 2017 16:42
quantomistro3178 sends brownie points to @adelmahjoub :sparkles: :thumbsup: :sparkles:
api offline
Adel
@AdelMahjoub
Nov 11 2017 16:42
@Quantomistro3178 no need of the else, since it is return
if equal return, so the else is unreachable
@Quantomistro3178 you can just put a return there without an else
@Quantomistro3178 or get rid of the if and return a === i
Liam Docherty
@ldocherty1
Nov 11 2017 16:44

What is wrong with this line of code, I keep getting an error in my JAVA program.

System.out.println("Please insert the relevant grade for each of the units" + (PASS)+"," +(MER)+"," +(DIST)+".");

Adel
@AdelMahjoub
Nov 11 2017 16:45
@ldocherty1 but what kind of error it is
Liam Docherty
@ldocherty1
Nov 11 2017 16:47
@AdelMahjoub
public static void NinetyCredCalc(){ //* 90 Credit Calculations*//
        String grade;
        int yr1cred[] = new int[9];
        char yr1grade[] = new char[9];

        System.out.println("You have chosen BTEC 90 Credit Diploma");
        System.out.println("Please insert the relevant grade for each of the units (P, M, D).");
        for(int i=1; i<=9; i++){
            System.out.println("Please enter the grade for Unit " +i);
            grade=userinput.next();

            yr1grade[i-1] = grade.charAt(0);

            if(yr1grade[i-1] == 'P' || yr1grade[i-1] == 'p') {
                yr1cred[i-1] = yr1cred [i-1] + P;
            }
            if(yr1grade[i-1] == 'M' || yr1grade[i-1] == 'm') {
                yr1cred[i-1] = yr1cred [i-1] + M;
            }
            if(yr1grade[i-1] == 'D' || yr1grade[i-1] == 'd') {
                yr1cred[i-1] = yr1cred [i-1] + D;
            }
        }
        for(int j=0; j<9; j++){
            year1points = year1points + yr1cred[j];
        }

        if(year1points >=630 & year1points<660){
            finalGrade="PP";
            ucasPoints=32;
            System.out.println(" You have scored "+year1points +" BTEC Points");
        }
        if(year1points >=660 & year1points<689){
            finalGrade="MP";
            ucasPoints=48;
            System.out.println(" You have scored "+year1points +" BTEC Points");
        }
        if(year1points >=690 & year1points<719){
            finalGrade="MM";
            ucasPoints=64;
            System.out.println(" You have scored "+year1points +" BTEC Points");
        }
        if(year1points >=720 & year1points<749){
            finalGrade="DM";
            ucasPoints=80;
            System.out.println(" You have scored "+year1points +" BTEC Points");
        }
        if(year1points >=750 & year1points<769){
            finalGrade="DD";
            ucasPoints=96;
            System.out.println(" You have scored "+year1points +" BTEC Points");
        }
        if(year1points >=770 & year1points<789){
            finalGrade="D*D";
            ucasPoints=104;
            System.out.println(" You have scored "+year1points +" BTEC Points");
        }
        if(year1points >=790){
            finalGrade="D*D*";
            ucasPoints=112;
            System.out.println(" You have scored "+year1points +" BTEC Points");
        }
        System.out.println("Your BTEC Grade is: "+finalGrade);
        System.out.println("Your UCACs Points are: "+ucasPoints);
        System.out.println("Do you have any Functional Skills Qualification?");
        System.out.println("1) Yes 2) No");
        outcome= userinput.nextInt();
        if(outcome==1){
            FunctionalSkills();
        } 
        if(outcome==2){
            System.out.println("Thanks for using the Liam's UCAS grade calculator application.");
            System.exit(0);
        } 

    }
Adel
@AdelMahjoub
Nov 11 2017 16:51
@ldocherty1 input mismatch , I only know one function in java, System.out.println, but that error have to do with an unexpected type of input. check if you are inputting the right type
Adel
@AdelMahjoub
Nov 11 2017 16:56
@ldocherty1 is this variable year1points declared
@ldocherty1 I guess I found it, add input.nextLine() after each userinput.nextInt(); I guess it is scanning the EOL character instead of the int
DevDigitalNomad
@DevDigitalNomad
Nov 11 2017 17:40
Guys. I have 3 columns grid assigned to body and if i set grid area of my div to my custum then it's do nothing. That div is in header element (body->header->div). It only works when header has display set to grid.
blob
Srry. Forget to add source of header file xD
@import '_color'; header { background: $primary-menu; // display: grid; // grid-template-columns: 1fr 3fr 1fr; // grid-template-areas: "logo menu profile"; grid-row: 1 / 2; grid-column: 1 / 4; }
Pablo Vent
@PabloVent
Nov 11 2017 17:46
I'm getting an eslint error which is the following:
```
image.png
when I add
App.propTypes = {
headerMessage: React.proptypes.string,
 };
the eslint error goes away
however React stops working
Only by commenting App.propTypes out will React get back in business
but the eslint error comes back
Stephen James
@sjames1958gm
Nov 11 2017 17:51
@PabloVent do you see any errors in the console? what is the eslint error
Pablo Vent
@PabloVent
Nov 11 2017 17:52
@sjames1958gm headermessage is missing in props validation
this file takes over when Reacts gets decoupled
import config from './config';
import apiRouter from './api';
//import fs from 'fs';

import express from 'express';
const server = express();

server.set('view engine', 'ejs');

server.get('/', (req, res) => {
  res.render('index', {
    content: 'Hello Express and <em>EJS</em>!'
  });
});

server.use('/api', apiRouter);
server.use(express.static('public'));
// server.get('/about.html', (req, res) => {
//     fs.readFile('./about.html', (err, data) => {
//         res.send(data.toString());
//     })
// })

server.listen(config.port, () => {
  console.info('Express listening on port: ', config.port);
});
no errors in the console
the server looks healthy
it only an eslint issue
Jake
@NeelDVirus
Nov 11 2017 18:10
which media condition will win in the given code below. there arises two possiblities.
Suppose the screen is greater than 800px and also has device-pixel-ratio equals to 2, then both the media queries resolves to true. which image will be retrieved? and if there any change that both will get retrieved at the runtime?
.img {
  background-image: url(small.jpg);
}
@media
  (-webkit-min-device-pixel-ratio: 2), 
  (min-resolution: 192dpi) {
  .img {
    background-image: url(medium.jpg);
  }
}
@media
  (min-width: 800px) {
  .img {
    background-image: url(large.jpg);
  }
}
sinnytk
@sinnytk
Nov 11 2017 18:15
Hey.
Tom
@moT01
Nov 11 2017 18:21
@NeelDVirus i dont know, but i think the second one cause it's after
Jake
@NeelDVirus
Nov 11 2017 18:33
@moT01 yeah i also think so, but it would be dangerous to rely on hunch
Tom
@moT01
Nov 11 2017 18:36
go test it out
load a page with those two properties and see what one is loaded
you need to meet those two media tests, of course
Liam Docherty
@ldocherty1
Nov 11 2017 18:48
How can I add a space between these three characters the variables?
System.out.println("Please insert the relevant grade for each of the units"+(PASS)+ (MER)+ (DIST)+".");
Ever Lord
@ev3rlord
Nov 11 2017 19:02
@ldocherty1 isn't it like " " + var + " "?
kevinGillispie()
@kevingillispie
Nov 11 2017 19:17
Does anyone know how to update your Twitter information on freeCodeCamp? The account settings page does say anything about this.
kevinGillispie()
@kevingillispie
Nov 11 2017 19:24
*does not
Jacob Colborn
@jcolborn-dropdeadgames
Nov 11 2017 19:26
@oknqll They had an issue on Github a while ago where there was no way to update this yourself, you had to send an email to team@freecodecamp.com to get it updated/removed. I think this is still true.
kevinGillispie()
@kevingillispie
Nov 11 2017 19:28
Oh, wow! Thanks for the info! @jcolborn-dropdeadgames
CamperBot
@camperbot
Nov 11 2017 19:28
oknqll sends brownie points to @jcolborn-dropdeadgames :sparkles: :thumbsup: :sparkles:
:cookie: 227 | @jcolborn-dropdeadgames |http://www.freecodecamp.com/jcolborn-dropdeadgames
Znadams
@Znadams
Nov 11 2017 19:41
var movies =
[ 
    {
        title: "Shawshank",
        rating: 5,
        hasWatched: true
    },
    {
        title: "Boardwalk empire",
        rating: 5,
        hasWatched: true
    },
    {
        title: "bladerunner",
        rating: "unkown",
        hasWatched: false
    },
    {
        title: "Ratatouille",
        rating: 4,
        hasWatched: true
    }
]

for(var i = 0; i <movies.length; i++)
{
    if(movies[i].hasWatched)
    {
        console.log("You have seen " + movies[i].title + " - " + movies[i].rating);
    }
    else if(movies[i].haswatched !== true)
    {
        console.log("You have not seen " + movies[i].title + " - " + movies[i].rating);
    }
}
When I change the else-if to else, all of the code falls thorugh and it produces this output:
You have seen Shawshank - 5
You have not seen Shawshank - 5
You have seen Boardwalk empire - 5
You have not seen Boardwalk empire - 5
You have not seen bladerunner - unkown
You have seen Ratatouille - 4
You have not seen Ratatouille - 4
Why is this?
it is particularly interesting that bladerunner only gets output once. the only apparent difference is that the rating property is a "string" and not "number". Does this have some effect?
Benjmhart
@Benjmhart
Nov 11 2017 19:46
hey there - having some issue trying to apply a click handler to a class in the calculator exercise. trying to grab the innerHTML of the item being clicked. https://codepen.io/Benjmhart/pen/mqyajd?editors=0011
can anyone tell me what I'm doing wrong?
Benjmhart
@Benjmhart
Nov 11 2017 19:56
nvm, got it
Kevin K. Lee
@kevinkiklee
Nov 11 2017 20:10
@Znadams you wrote haswatched instead of hasWatched
Znadams
@Znadams
Nov 11 2017 20:11
oh jfc
im very sorry
Kevin K. Lee
@kevinkiklee
Nov 11 2017 20:12
lol no, that is the most common mistake EVERYONE makes. even experienced developers do it.
Znadams
@Znadams
Nov 11 2017 20:12
it acutally still seems to behqave the same way
Kevin K. Lee
@kevinkiklee
Nov 11 2017 20:12
hmm
Vincent Chho
@koalavc
Nov 11 2017 20:12
I have two user prompts that asks for user inputs and it stores it in an array. I would like it to store it as [[userinput] [1], [[userinput2] [2], [userinput3][3]] instead it stores the array as [[userinput, userinput2, userinput3] , [1,2,3]]
Kevin K. Lee
@kevinkiklee
Nov 11 2017 20:12
let me open up my editor
Vincent Chho
@koalavc
Nov 11 2017 20:13
//Create a blank array
var userInput = [];
var userInput2 = [];
//initialize i to be 0, i must be less than 3, and it will continue to increment until it hits 3
for (i = 0; i < 3; i++) {
  //it will push the users prompt into the console 3 times
  userInput.push(prompt("What do you want to do this weekened? " + (i + 1)));

  userInput2.push(prompt("How many hours do you think it will take? " + (i + 1)));

  var arr3 = [userInput, userInput2];

}
console.log(arr3);
```
Marcus Eisele
@eiselems
Nov 11 2017 20:14
hi all
Kevin K. Lee
@kevinkiklee
Nov 11 2017 20:15
@Znadams weird. it seems to work fine on my machine.
Znadams
@Znadams
Nov 11 2017 20:15
are you using the code as i've psoted it?
Ken Haduch
@khaduch
Nov 11 2017 20:15
@koalavc - you are storing your separate answers in two different arrays, so your final answer is that you are storing those two separate arrays in your arr3 and that's how you have it coded.
Kevin K. Lee
@kevinkiklee
Nov 11 2017 20:15
You have seen Shawshank - 5
You have seen Boardwalk empire - 5
You have not seen bladerunner - unkown
You have seen Ratatouille - 4
yea
Znadams
@Znadams
Nov 11 2017 20:15
I was asking about when I change the else-if to else
Kevin K. Lee
@kevinkiklee
Nov 11 2017 20:16
ah
if you just do else, it should still be the same
Marcus Eisele
@eiselems
Nov 11 2017 20:16
currently I am sitting here and having a strange case of css flakyness
Znadams
@Znadams
Nov 11 2017 20:17
For some reason it outputs every object twice except bladerunner
Ken Haduch
@khaduch
Nov 11 2017 20:18
@koalavc - your desired format is a little bit confusing, too? [[userinput] [1], [[userinput2] [2], [userinput3][3]] does not seem to be a legal syntax for an array. And you are mentioning userinput3 which you do not have declared - do you mean the third input?
@eiselems - what are you trying to do?
It looks a bit off when accessing it from mobile
button is outside the screen having no clue why
browser is Chrome for Android ... when I activate "show Desktop Version" it looks exactly the same as on the desktop
Ken Haduch
@khaduch
Nov 11 2017 20:21
@eiselems - do you have a fixed width somewhere in your page?
Marcus Eisele
@eiselems
Nov 11 2017 20:21
Don't think so
I don't get what the difference of "default Android Chrome" vs "Show desktop version" is
Tom
@moT01
Nov 11 2017 20:23
does it work?
i tried chatting, no one responded
Marcus Eisele
@eiselems
Nov 11 2017 20:26
mhm think heroku does not support websockets
or it is not working for me at least ...
locally it works from multiple devices ... tought I would just be faster pushing it to heroku to discuss the css issue instead of moving it to codepen
Tom
@moT01
Nov 11 2017 20:27
glitch supports it for sure
Jake
@NeelDVirus
Nov 11 2017 20:27
Is there anything wrong in the media query block of @media only screen and (mix-width: 360px)?
when i inspect the page in non-retina mobile view (width greated than 360 and less than 768) the image rendered in the page is banner360-640.jpg
Seems like this media block is not fired even true.
.banner-wrapper {height: 100%;}

.banner {
    height: 100%;
    background-image: url("../images/banner/01mobile/banner360-640.jpg");
    background-size: cover;
}

@media only screen and (-webkit-min-device-pixel-ratio : 1.5),
     only screen and (-o-min-device-pixel-ratio: 3/2),
     only screen and (min--moz-device-pixel-ratio: 1.5),
     only screen and (min-device-pixel-ratio: 1.5),
     only screen and (min-resolution: 108dpi) {
        .banner {background-image: url("../images/banner/01mobile/banner576-1024.jpg");}
}

@media only screen and (mix-width: 360px) {
  .banner {background-image: url("../images/banner/01mobile/banner576-1024.jpg");}
}
@media only screen and (min-width: 768px) {
  .banner {background-image: url("../images/banner/02tablet/banner768-1024.jpg");}
}
@media only screen and (min-width: 1366px) {
  .banner {background-image: url("../images/banner/03desktop/banner1366-768.jpg");}
}
@media only screen and (min-width: 1920px) {
  .banner {background-image: url("../images/banner/03desktop/banner1920-1080.jpg");}
}
Marcus Eisele
@eiselems
Nov 11 2017 20:28
@moT01 is glitch for node only?
Tom
@moT01
Nov 11 2017 20:28
im not sure
Marcus Eisele
@eiselems
Nov 11 2017 20:29
Backend is a Spring Boot application (Java)
Tom
@moT01
Nov 11 2017 20:29
but you can quickly import a repo
yea, it might be - but i dont know
Marcus Eisele
@eiselems
Nov 11 2017 20:29
no problem ;)
Tom
@moT01
Nov 11 2017 20:29
i made a real similar chat https://my-chat.glitch.me/
Marcus Eisele
@eiselems
Nov 11 2017 20:33
:+1:
Vincent Chho
@koalavc
Nov 11 2017 20:38
@khaduch solved my problem
//Create a blank array
var userInput = [];
var userInput2 = [];
//initialize i to be 0, i must be less than 3, and it will continue to increment until it hits 3
for (i = 0; i < 3; i++) {
  //it will push the users prompt into the console 3 times
  userInput.push([prompt("What do you want to do this weekened? "), prompt("How many hours do you think it will take? " )]);

  // userInput.push( + (i + 1)));

  var userInput2 = userInput;

}
console.log(userInput2);
@khaduch tried putting my second prompt in push and it gave me my desired result
Ken Haduch
@khaduch
Nov 11 2017 20:39
@koalavc - good!
Abdelmalek LAHMAR
@malix213
Nov 11 2017 20:54
hi
Ken Haduch
@khaduch
Nov 11 2017 21:01
@malix213 - hello
Christopher Susi
@chrisandsuch
Nov 11 2017 21:01
Hello all!
Ken Haduch
@khaduch
Nov 11 2017 21:02
@chrisandsuch :wave:
Christopher Susi
@chrisandsuch
Nov 11 2017 21:04
If you wanted to build a cross platform app, which stacks would you use? Different answers are okay.
Can anyone suggest some good resources for practicing math?
Abdelmalek LAHMAR
@malix213
Nov 11 2017 21:32
@khaduch hi
Znadams
@Znadams
Nov 11 2017 22:07
@chrisandsuch khanacademy
Dr-D-M
@Dr-D-M
Nov 11 2017 22:08
hey there!
does anybody else had trouble with the show the weather project at freecode camp?
showing the lattitude and longitude as well as using the API ??
Christopher Susi
@chrisandsuch
Nov 11 2017 22:10
@Znadams Thats a great idea. Thank you!
CamperBot
@camperbot
Nov 11 2017 22:10
chrisandsuch sends brownie points to @znadams :sparkles: :thumbsup: :sparkles:
:cookie: 79 | @znadams |http://www.freecodecamp.com/znadams
Znadams
@Znadams
Nov 11 2017 22:11
Khanacademy has been a godsend for math to me
Christopher Susi
@chrisandsuch
Nov 11 2017 22:12
@Dr-D-M which location api are you using? ipinfo?
Tiago Correia
@tiagocorreiaalmeida
Nov 11 2017 22:13
Christopher Susi
@chrisandsuch
Nov 11 2017 22:15
@tiagocorreiaalmeida wow that is much better. Thank you!
CamperBot
@camperbot
Nov 11 2017 22:15
chrisandsuch sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 438 | @tiagocorreiaalmeida |http://www.freecodecamp.com/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Nov 11 2017 22:16
but I dont that asks user for premission
let me see how I did it
Christopher Susi
@chrisandsuch
Nov 11 2017 22:16
Very cool stuff!
@tiagocorreiaalmeida does this triangulate your position using three satelites? Can you control the precision?
Tiago Correia
@tiagocorreiaalmeida
Nov 11 2017 22:19
can't tell
navigator.geolocation.getCurrentPosition(function(position) {  
  lat = position.coords.latitude;  
  long = position.coords.longitude; 
});
Notification.requestPermission().then(function(result) {
  console.log(result);
  if (result === 'denied') {
    $("#notfound").html("No Location Found!");
    return;
  }
  if (result === 'default') {
    $("#notfound").html("No Location Found!");
    return;
  }
});
here what I used
Dr-D-M
@Dr-D-M
Nov 11 2017 22:20
but, did you get the API on weather map?
I've done this so far
$(document).ready(function(){
  if (navigator.geolocation){
    navigator.geolocation.getCurrentPosition(function(position){
      $("#data").html("latitude: " + position.coords.latitude + "</br>longitude: " + position.coords.longitude);
    });
  }


  var api = "http://api.openweathermap.org/data/2.5/weather?id=2172797&appid=d8e6a24a078d1389572aba5dc3bff6bd";
  // $.getJSON(api, function(data){
    //alert(data.coord.lat);
  });
});
it is supposed that'll display the latitude and longitude
but is not being displayed
@chrisandsuch weather map....
Christopher Susi
@chrisandsuch
Nov 11 2017 22:23
@Dr-D-M wow thats even better. Thank you!
CamperBot
@camperbot
Nov 11 2017 22:23
chrisandsuch sends brownie points to @dr-d-m :sparkles: :thumbsup: :sparkles:
:cookie: 256 | @dr-d-m |http://www.freecodecamp.com/dr-d-m
Dr-D-M
@Dr-D-M
Nov 11 2017 22:23
@tiagocorreiaalmeida hey, that's quite use ful
but, cannot browse anything, you know why?
Christopher Susi
@chrisandsuch
Nov 11 2017 22:24
I’ll fix my location weather on codepen with these two things thanks again @tiagocorreiaalmeida @Dr-D-M
CamperBot
@camperbot
Nov 11 2017 22:24
chrisandsuch sends brownie points to @tiagocorreiaalmeida and @dr-d-m :sparkles: :thumbsup: :sparkles:
api offline
api offline
Dr-D-M
@Dr-D-M
Nov 11 2017 22:25
@chrisandsuch you're welcome but, that haven't worked for me yet jaja
@tiagocorreiaalmeida the documentation you sent substitute the API from weather map or I should write it on code as well?
should I combine it all??
Ruben Abraham
@BuBBRBbr1
Nov 11 2017 22:31
Check out Jose Moreno's youtube channel for free help with the entire front end developer program.
Tiago Correia
@tiagocorreiaalmeida
Nov 11 2017 22:41
what I sent you lets you get the user location by showing a popup asking the user if he wanna shares is location or not I sent the code above on how to handle it :D
Dr-D-M
@Dr-D-M
Nov 11 2017 22:47
@tiagocorreiaalmeida got it! thanks
CamperBot
@camperbot
Nov 11 2017 22:47
dr-d-m sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 439 | @tiagocorreiaalmeida |http://www.freecodecamp.com/tiagocorreiaalmeida
Mike
@mikeytsou
Nov 11 2017 22:50
can anyone help me with a MaxStack function that returns the maximum value in a stack which should run in O(1) time?
Mohamed Nabil Ayoub
@MohNabil
Nov 11 2017 22:51
Screen Shot 2017-11-12 at 12.47.46 AM.png
Hi everyone,why there is errors in the javascript file is there a problem in the path of the file in the script the two files are in the same folder
João Porfírio
@pixelparker
Nov 11 2017 22:51
react experts? anyone?
alpox
@alpox
Nov 11 2017 22:59
@mikeytsou a stack should by definition always return the next available value in O(1)
Moisés Man
@moigithub
Nov 11 2017 23:00
script tag uses src attribute.. not href @MohNabil
alpox
@alpox
Nov 11 2017 23:01
@MohNabil the errors are from your linter. He doesnt see a definition of those variables because the linter doesnt know that you run the js in a browser environment. That are therefore no real errors.
@mikeytsou Im not sure what the use of a function would be which returns the maximum value in a stack. A stack is defined as such that it cannot and should not provide any other value for access than that last value you put on it. Are you not talking about a PriorityQueue instead?