These are chat archives for FreeCodeCamp/HelpFrontEnd

1st
Mar 2018
Eric Weiss
@eweiss17
Mar 01 2018 00:00 UTC
on your confirmEnding("Open sesame", "same") i just did a basic console log of it and it only pulled an e
rrspence
@rrspence
Mar 01 2018 00:01 UTC
oh ok i see that. so i'm trying to figure out how to get it to pull the whole string. isn't that what length is for then? that was why i put target.length as the second parameter
Eric Weiss
@eweiss17
Mar 01 2018 00:02 UTC
for .str , the first param is for where to start it and the second is for how much
at substr(-1) you are saying the last letter, with a length of how long it is, but it will always be 1
rrspence
@rrspence
Mar 01 2018 00:03 UTC
why will it always be 1 even though i'm specifying the length?
Eric Weiss
@eweiss17
Mar 01 2018 00:03 UTC
because you start at the end
rrspence
@rrspence
Mar 01 2018 00:03 UTC
ohhh
Gulsvi
@gulsvi
Mar 01 2018 00:04 UTC

@rrspence The length is optional.

var str = "Open sesame";
var lastFive = str.substr(-5); // esame

OR...only get the 3 characters after the fifth to last character:

var str = "Open sesame";
var lastFive = str.substr(-5, 3); // esa
*starting from the fifth to last character, I should say
rrspence
@rrspence
Mar 01 2018 00:06 UTC
@gulsvi oh ok that make sense! i'll play with this for a sec.
Eric Weiss
@eweiss17
Mar 01 2018 00:06 UTC
there is probably a bunch of ways to do it but you can just look for (if needed) the last instance of a space and grab the string after it
Gulsvi
@gulsvi
Mar 01 2018 00:08 UTC
Unfortunately, that would not work for confirmEnding("Open sesame", "same")
Eric Weiss
@eweiss17
Mar 01 2018 00:08 UTC
alright nvm
Jack Lyons
@JackEdwardLyons
Mar 01 2018 00:09 UTC
hey guys, i just have a quick question about changing props in jquery using .prop()
is there an elegant way to refactor this code?
$(hiddenFields).each(function(field_i, field) {
                    $(field).prop('id', function(p, value) {
                        return value.replace(/\[[0-9]+\]/g, '[' + list_i + ']');
                     })
                    $(field).prop('name', function(p, value) {
                        return value.replace(/\[[0-9]+\]/g, '[' + list_i + ']');
                    })
                });
instead of the same callback function, is there a way to pass multiple props in the one method?
dont worry about the code per se, its more just about DRYing up the code
Stephen James
@sjames1958gm
Mar 01 2018 00:20 UTC
@JackEdwardLyons Factor out the callback into a non-anonymous funciton.
Jack Lyons
@JackEdwardLyons
Mar 01 2018 00:23 UTC
yeah, so thats the only way @sjames1958gm
i cant do two props in one call?
Stephen James
@sjames1958gm
Mar 01 2018 00:25 UTC
@JackEdwardLyons Looks like you could pass an object with key/value pairs
But then I am not sure how the function would fit in.
Jack Lyons
@JackEdwardLyons
Mar 01 2018 00:30 UTC
yeah, its weird huh
you can pass in an object but then i need to call the function
Gulsvi
@gulsvi
Mar 01 2018 00:30 UTC
Maybe this?
$(hiddenFields).each(function(field_i, field) {
  const getValue = (p, value) => value.replace(/\[[0-9]+\]/g, "[" + list_i + "]");
  $(field).attr({
    "id": getValue(p, value),
    "name": getValue(p, value)
  });
});
I thought .attr() was for IDs and Names, and .prop() was for checked/disabled on inputs
A guess... to be honest
Jack Lyons
@JackEdwardLyons
Mar 01 2018 00:42 UTC
that looks cool, ill give it a go thanks @gulsvi
CamperBot
@camperbot
Mar 01 2018 00:42 UTC
jackedwardlyons sends brownie points to @gulsvi :sparkles: :thumbsup: :sparkles:
:star2: 2631 | @gulsvi |http://www.freecodecamp.org/gulsvi
Stephen James
@sjames1958gm
Mar 01 2018 00:46 UTC
@JackEdwardLyons I don't think that will work, where are p and value coming from?
rrspence
@rrspence
Mar 01 2018 00:47 UTC
@gulsvi @eweiss17 got it! thanks for your help. :)
CamperBot
@camperbot
Mar 01 2018 00:47 UTC
rrspence sends brownie points to @gulsvi and @eweiss17 :sparkles: :thumbsup: :sparkles:
:cookie: 612 | @eweiss17 |http://www.freecodecamp.org/eweiss17
:star2: 2632 | @gulsvi |http://www.freecodecamp.org/gulsvi
Stephen James
@sjames1958gm
Mar 01 2018 00:51 UTC
@JackEdwardLyons
If you need to call the same function on each attr - then maybe like this?
['id', 'name'].forEach((attr) => $(field).attr(attr, (p, value) => value.replace(/\[[0-9]+\]/g, "[" + list_i + "]"));
Curtis
@CurtisJCamp
Mar 01 2018 01:20 UTC
Hey I was wondering if somebody can help me out with adding seconds to my pomodoro clock?
Nate Mallison
@NJM8
Mar 01 2018 01:21 UTC
Sure, what have you got so far?
Curtis
@CurtisJCamp
Mar 01 2018 01:23 UTC

https://codepen.io/CurtisjCamp/pen/gvdjOY?editors=0010

this is it so far its almost done but I want to change what gets displayed in the "progress bar"

Originally I was just going to show the minutes but I want it to shows seconds as well now. I feel like it should be just some simple math thrown in somewhere but I'm pretty frustrated.

@NJM8
Nate Mallison
@NJM8
Mar 01 2018 01:34 UTC
ok
sorry I turned my notifications off
after joining main room the noise was too much.
How do i solve this challenge ?

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
    myObj.hasOwnProperty(checkProp);
  return "Change Me!";
}

// Test your code by modifying these values
checkObj("gift");
Curtis
@CurtisJCamp
Mar 01 2018 01:36 UTC
@NJM8 its all good that room is super busy
Nate Mallison
@NJM8
Mar 01 2018 01:37 UTC
@CurtisJCamp When I use the timer the minutes count down like seconds?
@mananshah51 think of it this way
if myObject has checkProp
change prop
Curtis
@CurtisJCamp
Mar 01 2018 01:39 UTC
Yeah I changed the timer to seconds instead of minutes for testing but ultimately I would like it to cycle every seconds and display the progress " 5:32 Left". I have been trying to manipulate the workCount to be able to display it.
Stephen James
@sjames1958gm
Mar 01 2018 01:40 UTC
@mananshah51 if you want to have a function return different values you might need an if check
Curtis
@CurtisJCamp
Mar 01 2018 01:40 UTC
every second*
Nate Mallison
@NJM8
Mar 01 2018 01:40 UTC
ok
Eric Weiss
@eweiss17
Mar 01 2018 01:40 UTC
@mananshah51 Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".
do a basic if statement
Stephen James
@sjames1958gm
Mar 01 2018 01:41 UTC
@CurtisJCamp store your time in seconds and count down using 1000 milliseconds on your timer.
when you display it convert seconds to minutes and seconds by dividing by 60 and taking the remainder dividing by 60
Curtis
@CurtisJCamp
Mar 01 2018 01:41 UTC
I have tried multiplying the workCount and then Math.floor"ing" the result tp get the minutes but I havent had much luck with seconds displaying correctly
Nate Mallison
@NJM8
Mar 01 2018 01:41 UTC
So I assume originally workCount would be 600 if set to 10 minutes?
Curtis
@CurtisJCamp
Mar 01 2018 01:42 UTC
ohhh I wasnt doing the remainder part of displaying it
Nate Mallison
@NJM8
Mar 01 2018 01:43 UTC
so you want to do something like this:
function displayTimeLeft(seconds){
  const minutes = Math.floor(seconds / 60);
  const remainderSeconds = seconds % 60;
  const displaySeconds = remainderSeconds >= 10 ? remainderSeconds : '0' + remainderSeconds;
  const display = `${minutes}:${displaySeconds}`;
  timerDisplay.textContent = display;
  document.title = display;
}
Manan Shah
@mananshah51
Mar 01 2018 01:43 UTC
@NJM8 I am unable to figure it out.
@sjames1958gm I am unable to figure it out.
@eweiss17 I am unable to figure it out.
Stephen James
@sjames1958gm
Mar 01 2018 01:44 UTC
@mananshah51 you need an if statement -
myObj.hasOwnProperty(checkProp) this returns true/false so you can use it in your if
Nate Mallison
@NJM8
Mar 01 2018 01:44 UTC
@mananshah51 Take it one step at a time. What code would you write to make sure your object has the variable?
Curtis
@CurtisJCamp
Mar 01 2018 01:44 UTC
That is exactly it. I wasn't handling the remainder correctly. Thanks @NJM8 and @sjames1958gm
CamperBot
@camperbot
Mar 01 2018 01:44 UTC
curtisjcamp sends brownie points to @njm8 and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @njm8 |http://www.freecodecamp.org/njm8
:star2: 9044 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Mar 01 2018 01:45 UTC
@CurtisJCamp :+1:
Nate Mallison
@NJM8
Mar 01 2018 01:45 UTC
No problem @CurtisJCamp . Took me awhile too. Who wants to do math? :)
Curtis
@CurtisJCamp
Mar 01 2018 01:45 UTC
Ain't nobody wanna do math
lol
Nate Mallison
@NJM8
Mar 01 2018 01:47 UTC
Ha, it's quite helpful for programming actually. I've been doing basic algebra and stuff on Kahn Academy as well. It's a little embarrassing to miss problems and see, Oh, that's part of the fifth grade curriculum. :0
Curtis
@CurtisJCamp
Mar 01 2018 01:48 UTC
Haha and I never thought I would use that stuff
Brad
@bradtaniguchi
Mar 01 2018 02:06 UTC
The only math I ever liked was finite state machine stuff, but then IDK if that's actual math haha
Nate Mallison
@NJM8
Mar 01 2018 02:11 UTC
Nothing like a good turn-style or traffic light to warm the blood huh? :smile:
Stephen James
@sjames1958gm
Mar 01 2018 02:12 UTC
@mananshah51 Did you make some progress?
Manan Shah
@mananshah51
Mar 01 2018 02:18 UTC
@sjames1958gm Thanks for checking back in.
I was able to solve that challenge, I saw the solution for reference.
CamperBot
@camperbot
Mar 01 2018 02:18 UTC
mananshah51 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9046 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Hussein Zaki
@Hussein90
Mar 01 2018 02:29 UTC
could anyone help me on something frontend out of fcc @all
Eric Weiss
@eweiss17
Mar 01 2018 02:32 UTC
just post it here
Hussein Zaki
@Hussein90
Mar 01 2018 02:33 UTC

how can I update the "model" of the datatables so when changing the drop down on each row the data will get updated ? here is the testing page i am working on it testing page

I mean i want know when i am in table without adding selected inside the table html when click on option let's say it is cancel it will added selected to it so when i am filter to cancel value i will say only cancel , can anybody help me in this and here is the link
https://codepen.io/HusseinZaki/pen/QQzVNG @all

Eric Weiss
@eweiss17
Mar 01 2018 02:36 UTC
jeez 4k lines of js
Hussein Zaki
@Hussein90
Mar 01 2018 02:38 UTC
i only want update the "model" of the datatables so when changing the drop down on each row the data will get updated
babemyatnoe
@babemyatnoe
Mar 01 2018 02:39 UTC
hi
Hussein Zaki
@Hussein90
Mar 01 2018 02:40 UTC
hi
Eric Weiss
@eweiss17
Mar 01 2018 02:42 UTC
@eweiss17 sjames is one of the most experienced in here, i would wait for him to respond
Brad
@bradtaniguchi
Mar 01 2018 02:42 UTC
@Hussein90 Do you have like some other place to look at this code? I don't think anyone will be able to or want to put in their time to figure out 4k lines of code. Also your second part of your question is very confusing.
Hussein Zaki
@Hussein90
Mar 01 2018 02:43 UTC
okay @bradtaniguchi
is there an area in the code you are trying to do this - and it's not working - or some lines you can point us toward
has pointed out - nobody can go through that much code very quickly
i assume you're talking about the drop down on the top left that shows the number of entries
Hussein Zaki
@Hussein90
Mar 01 2018 02:52 UTC
@moT01 i am talking about the drop down which has pending ,cancel options
so you want to update that value to whenever you change it to - where is the data stored or coming from
Hussein Zaki
@Hussein90
Mar 01 2018 02:54 UTC
i want when i click on it the select on the rows and choose option when i filter i want only these will appear there without go back to html and add attr. selected it will be selected so when i am filter it will do as it do with accepted
by filter - you mean when you use the search in top right?
Hussein Zaki
@Hussein90
Mar 01 2018 02:56 UTC
no by filter beside the title it is icon
icon on the left of status order @moT01
where are you getting the values of the table to do that filter
is there an object in the js - is it created in the html
add an onchange event for that drop down - and change the data there - then when you run the filter - the data should be updated
and the filter should work
so maybe, in that onchange event - there should be a way to change what is selected in the dropdown - it sounds like you filter by whatever option has selected
so onchange - remove selected from pending or whatever - and add it to cancel
or whatever is picked
Hussein Zaki
@Hussein90
Mar 01 2018 03:12 UTC
i write the values in html @ moT01
Heathercoraje
@Heathercoraje
Mar 01 2018 03:17 UTC
Hey folks, I am testing a pure function with Jest and it throws such error
expect(received).toBe(expected)

    Expected value to be (using ===):
      [["QUARTER", 50]]
    Received:
      [["QUARTER", 50]]

    Difference:


    Compared values have no visual difference.
but it still fails the test.
Claudio Restifo
@Marmiz
Mar 01 2018 03:30 UTC
@Heathercoraje how's your test?
Hussein Zaki
@Hussein90
Mar 01 2018 03:36 UTC

@moT01 that what i am trying to do

so maybe, in that onchange event - there should be a way to change what is selected in the dropdown - it sounds like you filter by whatever option has selected

Hussein Zaki
@Hussein90
Mar 01 2018 03:45 UTC
@moT01 can you help me do it
Heathercoraje
@Heathercoraje
Mar 01 2018 04:44 UTC
@Marmiz
describe('checkCashRegister', function() {
    describe('#return a correct change record array', function() {
        it('should return one array', function() {
            assert.equal(
                checkCashRegister(19.5, 20.0, [
                    ['PENNY', 1.01],
                    ['NICKEL', 2.05],
                    ['DIME', 3.1],
                    ['QUARTER', 4.25],
                    ['ONE', 90.0],
                    ['FIVE', 55.0],
                    ['TEN', 20.0],
                    ['TWENTY', 60.0],
                    ['ONE HUNDRED', 100.0]
                ]),
                [['QUARTER' , 50]]
            );
        });
    });
});
Greg Gordon
@greggordoncode_twitter
Mar 01 2018 04:46 UTC
https://codepen.io/papageg/pen/yvGYQM Why does my nav bar not not change cover when i hover over it? Is it because of a img background if anyone can help thanks
Heathercoraje
@Heathercoraje
Mar 01 2018 04:46 UTC
@Marmiz the operator isn't even=== I am not sure what makes the test fails when there is no visual difference
Heathercoraje
@Heathercoraje
Mar 01 2018 04:53 UTC
@greggordoncode_twitter
#navbar li {
  display: inline-block;
  padding-right: 100px;
  margin: 25px;
  float: right;
  color: white;
}
#navbar li:hover {
  color: orange
}
Brad
@bradtaniguchi
Mar 01 2018 04:53 UTC
@Heathercoraje Are you trying to compare [['QUARTER' , 50]]with an other array (that looks the same?)
Heathercoraje
@Heathercoraje
Mar 01 2018 04:53 UTC
Yeah
@greggordoncode_twitter Adding the last bit under navbar liwill do. I think it is because it didn't have specific target
Greg Gordon
@greggordoncode_twitter
Mar 01 2018 04:54 UTC
thanks i see i need to be more specific
Heathercoraje
@Heathercoraje
Mar 01 2018 04:55 UTC
@greggordoncode_twitter :+1:
@bradtaniguchi [['QUARTER', 50]] is the return value.
Is it because of it looks the same but it isn't the identical array?
Brad
@bradtaniguchi
Mar 01 2018 04:56 UTC
It technically is the same by value, but the reference (which is checked with assert) is different
AFAI the assert doesn't do a deep compare, which is why its failing
Heathercoraje
@Heathercoraje
Mar 01 2018 04:57 UTC
like value quality is not the same but the value itself is the same?
Wait, I thought deep compare is what checks if they have same refernece.
Brad
@bradtaniguchi
Mar 01 2018 04:58 UTC
Deep compare checks all the values, regardless of if the reference is the same or not
Heathercoraje
@Heathercoraje
Mar 01 2018 04:58 UTC
===?
Brad
@bradtaniguchi
Mar 01 2018 04:59 UTC
that is not deep compare
thats like "strict equals", its different
Heathercoraje
@Heathercoraje
Mar 01 2018 04:59 UTC
Thanks! then == / === isn't the same as deep compare or shallow? compare.
@bradtaniguchi 'not having same reference' does this mean one comes from function and the other is just an array that inserted?
Brad
@bradtaniguchi
Mar 01 2018 05:00 UTC
no, the == should be avoided cuse of things like this: '1' == 1 returns true, or null == undefinedis true
Heathercoraje
@Heathercoraje
Mar 01 2018 05:00 UTC
I understand. the word reference is a bit fuzzy in my head still.
Brad
@bradtaniguchi
Mar 01 2018 05:01 UTC
@Heathercoraje So when I say reference I mean in memory. Non-primitives (like objects and arrays) are passed by reference, not value
Its pretty complicated, but its a lower level idea that comes from how computers work
Heathercoraje
@Heathercoraje
Mar 01 2018 05:02 UTC
so if it is not deep compare, it will just check reference. if it is deep compare then it checks the actual value ?
Brad
@bradtaniguchi
Mar 01 2018 05:03 UTC
@Heathercoraje https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects read the "comparing objects" section for a good explintion
Heathercoraje
@Heathercoraje
Mar 01 2018 05:03 UTC
@bradtaniguchi thank you. Reading it
CamperBot
@camperbot
Mar 01 2018 05:03 UTC
heathercoraje sends brownie points to @bradtaniguchi :sparkles: :thumbsup: :sparkles:
:cookie: 402 | @bradtaniguchi |http://www.freecodecamp.org/bradtaniguchi
Brad
@bradtaniguchi
Mar 01 2018 05:03 UTC
Yes when it comes to assert and ===
np, Id read the whole article, or at least skim through it :D
Claudio Restifo
@Marmiz
Mar 01 2018 05:05 UTC
@Heathercoraje why using assert instead of the jest built-in expect ?
I've used assertion with other testing libraries (jasmine..) but never with jest
Brad
@bradtaniguchi
Mar 01 2018 05:05 UTC
@Marmiz Whats the difference between assert and expect? (I don't do testing too much)
Heathercoraje
@Heathercoraje
Mar 01 2018 05:06 UTC
@Marmiz expect and toBe also throw the same error
@Marmiz Which I didnt understand because expect toBe is supposed to be deep comparision?
as far as I know?
Brad
@bradtaniguchi
Mar 01 2018 05:07 UTC
I mean to do a deep compare there are a few tricks to check equality, but JS has no built in function to do so normally. Idk if test suites offer it aswell.
Heathercoraje
@Heathercoraje
Mar 01 2018 05:11 UTC
 expect(received).toBe(expected)

    Expected value to be (using ===):
      [["QUARTER", 0.5]]
    Received:
      [["QUARTER", 0.5]]

    Difference:

    Compared values have no visual difference.
Claudio Restifo
@Marmiz
Mar 01 2018 05:14 UTC

As far as I recall @bradtaniguchi jest implemented expect from expect.js (another testing lib) that gives meaningful messages from testing.
for example

assert(4 >=0) && expect(4).toBeGreaterThanOrEqual(4)

will perform the same test, but assert often reply with a simple expected true to be false
while expect should be more informative on the tree error..

or so it used to be, i'm not on point with recent versions

Brad
@bradtaniguchi
Mar 01 2018 05:14 UTC
@Heathercoraje You can pass the test by doing one of 2 things. 1. transfer the return value to a string, and compare it against a string. This will work, but is kinda "meh" since your not technically checking the values. 2. manually check the length of the array, the first sub array's first and second values manually. This will check the actual return by value
@Marmiz Ah so it gives a better printout, I see
Claudio Restifo
@Marmiz
Mar 01 2018 05:14 UTC
that was the tradeoff
Heathercoraje
@Heathercoraje
Mar 01 2018 05:15 UTC
@bradtaniguchi it also passes with toEqual
instead of toBe
I will have to read the docs..
have noooo idea
Brad
@bradtaniguchi
Mar 01 2018 05:15 UTC
Yea definantly haha, toEqual probably does a deep compare
Yea just read off SO toEqual does a deep compare
Claudio Restifo
@Marmiz
Mar 01 2018 05:16 UTC
@Heathercoraje have you tried toEqual?
Heathercoraje
@Heathercoraje
Mar 01 2018 05:16 UTC
@Marmiz @bradtaniguchi Thanks mates
CamperBot
@camperbot
Mar 01 2018 05:16 UTC
heathercoraje sends brownie points to @marmiz and @bradtaniguchi :sparkles: :thumbsup: :sparkles:
api offline
:star2: 1179 | @marmiz |http://www.freecodecamp.org/marmiz
Claudio Restifo
@Marmiz
Mar 01 2018 05:17 UTC
toBe means literally is that element. If your function returns a new element will fail (as it should)
Heathercoraje
@Heathercoraje
Mar 01 2018 05:17 UTC
@Marmiz Claudio, you missed my chat before yours. toEqual worked. I thought we are friends :(
@Marmiz @bradtaniguchi .toEqual(value)
Use .toEqual when you want to check that two objects have the same value. This matcher recursively checks the equality of all fields, rather than checking for object identity—this is also known as "deep equal". For example, toEqual and toBe behave differently in this test suite, so all the tests pass:
Brad
@bradtaniguchi
Mar 01 2018 05:19 UTC
@Heathercoraje Nice :)
Heathercoraje
@Heathercoraje
Mar 01 2018 05:20 UTC
by the way.. I just realized I was using mocha then integrated jest init....
Randy
@RandyGoldsmith
Mar 01 2018 05:21 UTC
does anyone know C? lol
Claudio Restifo
@Marmiz
Mar 01 2018 05:21 UTC
const x = obj => Object.assign({}, obj)

test('is the same obj', () => {
const result = x({a: 1});
expect(result).toBe({a: 1}) // should fail
expect(result).toEqual({a: 1}) // should pass
})

jest docs

toBe uses Object.is to test exact equality. If you want to check the value of an object, use toEqual instead:

@Heathercoraje

I just realized I was using mocha

that's where the assert came from

:/
Heathercoraje
@Heathercoraje
Mar 01 2018 05:23 UTC
uhm..
yeah
Claudio Restifo
@Marmiz
Mar 01 2018 05:23 UTC
@RandyGoldsmith heve not used C in a while, somehow more confortable with Cpp
Heathercoraje
@Heathercoraje
Mar 01 2018 05:23 UTC
and then I was running all test with jest installed globally
but test is not defined within Mocha.
but all tests are tested with jest.
Randy
@RandyGoldsmith
Mar 01 2018 05:26 UTC
@Marmiz how does the computer remember the change variable?
do {
       printf("How much change is owed: ");
       change = get_float();

    }
    while(change < 0.00);
somehow if i use another printf outside of the do while loop.. and use change as my output varaible, it knows what i typed into my first printf
does the following line after my first printf just know to store the first input value into change?
Brad
@bradtaniguchi
Mar 01 2018 05:29 UTC
@RandyGoldsmith Is that C?
Claudio Restifo
@Marmiz
Mar 01 2018 05:29 UTC

@bradtaniguchi I just tried the test I written above, this is the error message:

Compared values have no visual difference. Looks like you wanted to test for object/array equality with strict toBe matcher. You probably need to use toEqual instead.

More informative than the assert " compared values have no visual difference"
(this should be a lesson for you @Heathercoraje as well! you could have solved it in a second)

Randy
@RandyGoldsmith
Mar 01 2018 05:30 UTC
@bradtaniguchi yes it is.. maybe get_float would be GetFloat().. im taking harvards cs50 course
they have a cs50.h library for GetFloat which would be get_float
Heathercoraje
@Heathercoraje
Mar 01 2018 05:31 UTC
@Marmiz yeah. I add to 2 more chars and solved it. My last 3hours..
@Marmiz Back to react......... have a good day buddies
Brad
@bradtaniguchi
Mar 01 2018 05:32 UTC
Odd place to be asking for C advice (front-end web development room), I'm trying to remember my experience with how C works, its been a few years. But what is your exact question? Just how C remembers the values?
@Heathercoraje we all have those moments haha
Claudio Restifo
@Marmiz
Mar 01 2018 05:32 UTC
60% of the time would fire you from my team 100% of the time! @Heathercoraje
:stuck_out_tongue: :stuck_out_tongue:
Heathercoraje
@Heathercoraje
Mar 01 2018 05:33 UTC
ahahahaha
Randy
@RandyGoldsmith
Mar 01 2018 05:33 UTC
@bradtaniguchi haha yeah true, im taking a course from a suggested path from an old camper..the p1xt guide
@bradtaniguchi but yes..wondering how c remembers the values
in javascript its var number = prompt();
so your declaring a variable number that will hold the value of prompt in it..thats explicit
Claudio Restifo
@Marmiz
Mar 01 2018 05:34 UTC

@RandyGoldsmith you have defined change outside the do while as well otherwise this

change = get_float();

would throw an error (change type is not defined, at least here)

Brad
@bradtaniguchi
Mar 01 2018 05:34 UTC
@Marmiz I don't think hes asking about why its breaking (I don't think it is)
Randy
@RandyGoldsmith
Mar 01 2018 05:34 UTC
@Marmiz okay, so since its inside the loop.. change is automatically going to a take a float of whatever my input value is?
@bradtaniguchi its not breakin
Claudio Restifo
@Marmiz
Mar 01 2018 05:35 UTC
@bradtaniguchi no but he's asking why he can access it outside of do while, and that's because is defined somewhere else
Randy
@RandyGoldsmith
Mar 01 2018 05:35 UTC
@Marmiz ah yes, its outside my do while loop declared initially as float change;
because ill have to use it again outside the do while loop
@Marmiz just doesnt make sense why the input can hold or remember the change value... unline var number = prompt()...which is explicit in why it can hold whatever the user types in prompt
Claudio Restifo
@Marmiz
Mar 01 2018 05:37 UTC
so you are modifing that variable
Randy
@RandyGoldsmith
Mar 01 2018 05:37 UTC
@Marmiz maybe i need to understand what get_float is which I thought it just means its going to hold a floating point value
so printf('enter a value: ');
and after i put my floating variable change.. and set it equal to get_float()
Claudio Restifo
@Marmiz
Mar 01 2018 05:38 UTC
@RandyGoldsmith it's probably an helper to handle floating precision while the user input a float.
types are fun! :)
Brad
@bradtaniguchi
Mar 01 2018 05:40 UTC
@RandyGoldsmith To me the act of prompting the user for a value in js, and how it works in C is more or less the same (you need to care about datatypes in C, but its the same otherwise)
Claudio Restifo
@Marmiz
Mar 01 2018 05:40 UTC
Learning a strictly-typed language is an esset imho. Makes working in JS feels like child play :sparkles:
Brad
@bradtaniguchi
Mar 01 2018 05:41 UTC
I mean the one pro (and con) of C is the memory management and pointers shudders
Make you REALLY appreciate JS, hell almost any other language handles the memory for you
Randy
@RandyGoldsmith
Mar 01 2018 05:43 UTC
#include <stdio.h>
#include <cs50.h>
#include <math.h>

int main(void)
{
    float change;
    int totalCents;


    do {
       printf("How much change is owed: ");
       change = get_float();

    }
    while(change < 0.00);

    //convert $1: 100 cents
    //multiplying the users input change amount by 100 to get the total amount of cents
    printf("Answer is %f'", change)
    //floating point imprecsion
    //round
}
that code there.. the last printf line
how does C know what i inputting into my first prinf statement?
i didnt save my first printf into a variable like in JS example of var number = prompt()
rdollent
@rdollent
Mar 01 2018 05:46 UTC
oh wow cs50x im only on chapter 3.
Claudio Restifo
@Marmiz
Mar 01 2018 05:46 UTC

@RandyGoldsmith

i didnt save my first printf into a variable

of course you did:

change = get_float();

is reading whatever value the user input and assign it to change

Randy
@RandyGoldsmith
Mar 01 2018 05:46 UTC
@rdollent yup lol
@Marmiz oh okay..thats what its doing? thats what im asking lol
rdollent
@rdollent
Mar 01 2018 05:47 UTC
and i reckon get_float() is defined by the faculty in cs50.h kinda like get_string()
Randy
@RandyGoldsmith
Mar 01 2018 05:47 UTC
@rdollent yes
Claudio Restifo
@Marmiz
Mar 01 2018 05:48 UTC
basic I/O :+1:
Randy
@RandyGoldsmith
Mar 01 2018 05:48 UTC
@Marmiz so get_float() function is really taking the input from the printf method?
@Marmiz ugh so confusing
rdollent
@rdollent
Mar 01 2018 05:48 UTC
so maybe in that function get_float() if you look in the file you;ll see something that takes whatever you pass onto printf() take the thing after ":" and returns it
Randy
@RandyGoldsmith
Mar 01 2018 05:48 UTC
@Marmiz starting with python and then javascript and now trying a lower level language.. its a lot harder
Brad
@bradtaniguchi
Mar 01 2018 05:49 UTC
The get_float() and printf methods are totally unrelated
Randy
@RandyGoldsmith
Mar 01 2018 05:49 UTC
@rdollent yes thanks, Claudio helped me out on that
CamperBot
@camperbot
Mar 01 2018 05:49 UTC
randygoldsmith sends brownie points to @rdollent :sparkles: :thumbsup: :sparkles:
:cookie: 334 | @rdollent |http://www.freecodecamp.org/rdollent
Randy
@RandyGoldsmith
Mar 01 2018 05:49 UTC
@Marmiz thanks
@rdollent maybe when your done we could work on a project together..the final one? :)
rdollent
@rdollent
Mar 01 2018 05:49 UTC
im only on chapter 3 but i think that's how it works. otherwise, how does get_float() know what you put in printf() unless they use printf() inside get_float() and printf() returns a value
@RandyGoldsmith i dont do any of the projects i just watch the videos hahah. a video already runs for 90 mins
Randy
@RandyGoldsmith
Mar 01 2018 05:50 UTC
@rdollent yeah, thats where im confused
Brad
@bradtaniguchi
Mar 01 2018 05:50 UTC
@RandyGoldsmith You could probably do without the printf() method, you just wont see any strings printed to the terminal.
Randy
@RandyGoldsmith
Mar 01 2018 05:51 UTC
@bradtaniguchi well for this excercise im doing, it prompts a user to input a dollar amount so i do need it in this case
Brad
@bradtaniguchi
Mar 01 2018 05:51 UTC
I guess you could say the printf() method just outputs to the terminal (using some underlying IO functions) and the get_float() takes the value later()
I was saying you don't need it idea wise. (plus the user wont know wtf is going on)
as the two functions are unrelated, unlike alert in JS, which is kinda both
rdollent
@rdollent
Mar 01 2018 05:52 UTC
@RandyGoldsmith is that the only code there is?
okay well wait maybe get_float() runs an alert() function inside it
so a dialog box appears and asks for a number
Brad
@bradtaniguchi
Mar 01 2018 05:52 UTC
@rdollent What the?
You know this is C code right haha
rdollent
@rdollent
Mar 01 2018 05:52 UTC
hahah yes
but idk the equivalence of alert() in C
Brad
@bradtaniguchi
Mar 01 2018 05:53 UTC
there isn't one
rdollent
@rdollent
Mar 01 2018 05:53 UTC
oh wait sorry i am confused
Brad
@bradtaniguchi
Mar 01 2018 05:53 UTC
You can get input from the terminal using something like fgetor another one i don't remember off the top of my head( I remember there were a few ways)
Looking at the code, it seems like a small cli app. The UI is the terminal, so nothing fancy
rdollent
@rdollent
Mar 01 2018 05:54 UTC
yeah i vaguely remember that you just supply a value to the function using trhe terminal
in cs50x video
Brad
@bradtaniguchi
Mar 01 2018 05:54 UTC
so prolly the get_float() function wraps the fget (or equivalent) function probably to keep things simple
rdollent
@rdollent
Mar 01 2018 05:56 UTC
i see
so you just run it in the terminal
then it goes to a new line and you just enter a value
i just watched lecture 3 and it says get_string("Name: ");
so for sure get_float() gets passed something.
Roman Struna
@RomchyFCC
Mar 01 2018 06:17 UTC
I've done the cs50, what exactly seems to be the problem, maybe I could help
@RandyGoldsmith
Randy
@RandyGoldsmith
Mar 01 2018 06:21 UTC
@RomchyFCC just wondering about the get_float() function and how it knows to store user input from the printf command
Roman Struna
@RomchyFCC
Mar 01 2018 06:23 UTC
oh get_float is a custom function you import from cs50 library
it's basicly a prompt that cs50 implemented so they can ease you into learning and abstract away things behind the scenes
#include <cs50.h>
when you type this you get stuff like get_float, get_int, get_string and so on :)
Randy
@RandyGoldsmith
Mar 01 2018 06:25 UTC
@RomchyFCC correct
Roman Struna
@RomchyFCC
Mar 01 2018 06:26 UTC
:+1:
mustimuu
@mustimuu
Mar 01 2018 08:35 UTC

Hello guys !

Can someone help me out?

I have this navigation. When i scroll down the property 'black" should be added. When i scroll back up the black should be removed. When i scroll down the navigation should also follow, but i cant find the mistake, heres the link:

http://www.beproductive.dk/projekt1/index.html

Marianissimus
@Marianissimus
Mar 01 2018 08:39 UTC
you want the nav to be black when you scroll down? anyway, this condition should be more than this: if ($(window).scrollTop()) - it should be more or less than something
mustimuu
@mustimuu
Mar 01 2018 08:41 UTC
@Marianissimus thanks
CamperBot
@camperbot
Mar 01 2018 08:41 UTC
mustimuu sends brownie points to @marianissimus :sparkles: :thumbsup: :sparkles:
:cookie: 471 | @marianissimus |http://www.freecodecamp.org/marianissimus
mustimuu
@mustimuu
Mar 01 2018 08:41 UTC
by the way what is angular2 ?
Claudio Restifo
@Marmiz
Mar 01 2018 08:42 UTC
a framework https://angular.io/
Fabien SHAN
@X140hu4
Mar 01 2018 08:43 UTC
@mustimuu You can add a position: fixed; and width:100% to the nav, then add margin: auto; to the menu div
The position prop will keep the navbar on top. The width and margin will reproduce the current style you have.
mustimuu
@mustimuu
Mar 01 2018 08:46 UTC
@X140hu4 thank you so much
CamperBot
@camperbot
Mar 01 2018 08:46 UTC
mustimuu sends brownie points to @x140hu4 :sparkles: :thumbsup: :sparkles:
:cookie: 335 | @x140hu4 |http://www.freecodecamp.org/x140hu4
mustimuu
@mustimuu
Mar 01 2018 08:46 UTC
it helped
Markus Kiili
@Masd925
Mar 01 2018 08:49 UTC
@mustimuu AngularJS x means the old angular, and Angular x means the new angular.
mustimuu
@mustimuu
Mar 01 2018 09:07 UTC
guys
what is the difference between joomla and bootstrap?
Fabien SHAN
@X140hu4
Mar 01 2018 09:26 UTC
From what I google, joomla is a CMS like wordpress it allows you to create websites and manage the content. Bootstrap is a front-end library that allows you to style your website.
They are very different
Markus Kiili
@Masd925
Mar 01 2018 09:26 UTC
@mustimuu Joomla is a Content Managenent System (CMS), and Bootstrap is a CSS framework (roughly put).
mustimuu
@mustimuu
Mar 01 2018 09:27 UTC
so guys

what would you recommend?

If i learn bootstrap and joomla and Sass?

Would it be a good combination to start with?
Fabien SHAN
@X140hu4
Mar 01 2018 09:27 UTC
A good combination for what?
Markus Kiili
@Masd925
Mar 01 2018 09:27 UTC
@mustimuu What do you know at the moment?
mustimuu
@mustimuu
Mar 01 2018 09:27 UTC
i know some HTML and CSS
but my sites always look bad
doesent look like a site and i need some free projects to work on
Markus Kiili
@Masd925
Mar 01 2018 09:28 UTC
@mustimuu JS and possible jQuery is next on skill list.
mustimuu
@mustimuu
Mar 01 2018 09:28 UTC
but how do i master html and css ?
Fabien SHAN
@X140hu4
Mar 01 2018 09:28 UTC
You never
mustimuu
@mustimuu
Mar 01 2018 09:28 UTC
just by building sites ?
Markus Kiili
@Masd925
Mar 01 2018 09:28 UTC
@mustimuu That path is infinite. Nobody really masters HTML/CSS imo.
mustimuu
@mustimuu
Mar 01 2018 09:29 UTC
what is the best way to learn it then?
just youtube and build and repeat
Markus Kiili
@Masd925
Mar 01 2018 09:29 UTC
@mustimuu Read and code and repeat, yes.
Good, if someone more experienced is there to bark at you at times.
mustimuu
@mustimuu
Mar 01 2018 09:30 UTC
any good youtubers?
i am starting to learn to build navigation bars
Fabien SHAN
@X140hu4
Mar 01 2018 09:30 UTC
HTML&CSS you need to be able to search what you need, know well the most common HTML elements and CSS properties, learn how to code maintainable code (for you or others).
mustimuu
@mustimuu
Mar 01 2018 09:30 UTC
i keep repeating it
after html css is jquery
i see
Fabien SHAN
@X140hu4
Mar 01 2018 09:31 UTC
If you want to build sites that look nicer, you need to train your eye and your mind to identify "good" design
Markus Kiili
@Masd925
Mar 01 2018 09:31 UTC
@mustimuu I would do some JS before jQuery, but FCC has it in reverse order.
Fabien SHAN
@X140hu4
Mar 01 2018 09:31 UTC
One way is to translate an image to a webpage for example
mustimuu
@mustimuu
Mar 01 2018 09:32 UTC
do you guys know any free projects?
its just overhelming me
someone says bootstrap
other say joomla
wordpress
Fabien SHAN
@X140hu4
Mar 01 2018 09:33 UTC
What is your goal learning development?
mustimuu
@mustimuu
Mar 01 2018 09:33 UTC
my goal is to build websites for customers
and work for a company
Fabien SHAN
@X140hu4
Mar 01 2018 09:34 UTC
You just entered a restaurant that has all the world's cuisine on its menu. People will have different taste and opinions
mustimuu
@mustimuu
Mar 01 2018 09:35 UTC

I see

So if my goal is to be working at a company i should just start building pages and repeat

Fabien SHAN
@X140hu4
Mar 01 2018 09:35 UTC
Ok so you need to focus on a core set of technologies to learn and not stray from that until you feel confident you have a good grasp of your tech stack.
mustimuu
@mustimuu
Mar 01 2018 09:35 UTC
exactly
Fabien SHAN
@X140hu4
Mar 01 2018 09:36 UTC
HTML&CSS are the building blocks. Now you need Javascript to make your pages more dynamic.
You will practice HTML&CSS anyway going forward with JS.
mustimuu
@mustimuu
Mar 01 2018 09:36 UTC
I see
someone told me to practise angular2 also
do you know any good tutorials?
or is it just by finding
Fabien SHAN
@X140hu4
Mar 01 2018 09:37 UTC
I personally prefer not to touch too much the different frameworks and libraries, because at their core they are always HTML/CSS/JS.
mustimuu
@mustimuu
Mar 01 2018 09:37 UTC
i see
JS og jquery?
Fabien SHAN
@X140hu4
Mar 01 2018 09:38 UTC
But that's my approach, it makes things difficult but you get a better understanding of the frameworks/libraries and how they work
mustimuu
@mustimuu
Mar 01 2018 09:38 UTC
jquery is the library
Markus Kiili
@Masd925
Mar 01 2018 09:38 UTC
@mustimuu HTML/CSS/JS is the basic, but for most common tasks, most firms use frameworks and libraries that make the development easier to manage.
Fabien SHAN
@X140hu4
Mar 01 2018 09:38 UTC
jQuery is a JS library. It's like the difference between making your own dough or buying it when you want to make a cake
mustimuu
@mustimuu
Mar 01 2018 09:39 UTC
so if i want to work for a company i should mix between html & css, js and frameworks
Fabien SHAN
@X140hu4
Mar 01 2018 09:41 UTC
Different companies use different tech stacks but focusing on these will give you a good shot.
mustimuu
@mustimuu
Mar 01 2018 09:42 UTC
I see
Thanks
Fabien SHAN
@X140hu4
Mar 01 2018 09:42 UTC
Afterwards learning other languages is not as difficult as they share a lot of concepts.
mustimuu
@mustimuu
Mar 01 2018 09:42 UTC
than kyou
@X140hu4 thank you
CamperBot
@camperbot
Mar 01 2018 09:42 UTC
mustimuu sends brownie points to @x140hu4 :sparkles: :thumbsup: :sparkles:
api offline
Markus Kiili
@Masd925
Mar 01 2018 09:42 UTC
@mustimuu You will be learning new things all the time anyway, so learning one way at first is enough.
Fabien SHAN
@X140hu4
Mar 01 2018 09:47 UTC
@mustimuu You could start with what freeCodeCamp offers, read articles related to web dev, listen to podcasts (freecodecamp, codenewbie, etc), lurk in the forum and chatrooms helping others or reading about other peoples struggles and achievements.
Learning the language is only part of the equation. You wouldn't learn [insertForeignLanguage] only from books about grammar, vocab and syntax :)
mustimuu
@mustimuu
Mar 01 2018 09:49 UTC
@X140hu4 thank you
CamperBot
@camperbot
Mar 01 2018 09:49 UTC
mustimuu sends brownie points to @x140hu4 :sparkles: :thumbsup: :sparkles:
:cookie: 336 | @x140hu4 |http://www.freecodecamp.org/x140hu4
mustimuu
@mustimuu
Mar 01 2018 09:49 UTC
@Masd925 thank you
mustimuu
@mustimuu
Mar 01 2018 10:02 UTC
@X140hu4
i know a company that required HTML & CSS, Jquery and joomla
Puneeth N
@puneethnviraat
Mar 01 2018 10:04 UTC

hello everoyone ..unable to get the weather data......here is the code.....function showPosition(position) {
var lati=position.coords.latitude;
var logi=position.coords.longitude;
x.innerHTML = "Latitude: " + lati + "<br>Longitude: " +logi;

var resultElement = $('#resultDiv');
var weather="https://api.openweathermap.org/data/2.5/weather?lat="+lati+"&lon="+logi+"&appid=7658e29ee6204da60dcec48c4cd297a5"
        $.ajax({
                url:'weather',
                 method:'get',
                 dataType:"json",
                 success:function(data){
     resultElement.html('weather:'+data.weather[0].main+'<br/>'+'Description:'+data.weather[0].description);

 }

});
}

i got the coordinates of location.
error : "Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https."
please help me..
Anas Abdennaim
@Aka-Dev
Mar 01 2018 10:08 UTC
@puneethnviraat
Marianissimus
@Marianissimus
Mar 01 2018 10:08 UTC
it's a codepen issue (or actualy a cross-origin security issue)... but can't remember the solution... :(
Anas Abdennaim
@Aka-Dev
Mar 01 2018 10:08 UTC
@puneethnviraat Hello you must remove " ' " from 'weather' then test
because weather is variable not string
dinesh
@1532j0004kg
Mar 01 2018 10:09 UTC
@puneethnviraat crossOrigin = *
add this in the URL.
Marianissimus
@Marianissimus
Mar 01 2018 10:12 UTC
yes, or this: https://cors-anywhere.herokuapp.com/https://api.openweathermap... etc. also listen to @Aka-Dev , weather is not a string
Puneeth N
@puneethnviraat
Mar 01 2018 10:13 UTC
@Aka-Dev thanks lot...:)
CamperBot
@camperbot
Mar 01 2018 10:13 UTC
puneethnviraat sends brownie points to @aka-dev :sparkles: :thumbsup: :sparkles:
:cookie: 308 | @aka-dev |http://www.freecodecamp.org/aka-dev
Anas Abdennaim
@Aka-Dev
Mar 01 2018 10:16 UTC
@puneethnviraat you're welcome
Fabien SHAN
@X140hu4
Mar 01 2018 10:29 UTC
@mustimuu One company among many thousands. Where are you from?
mustimuu
@mustimuu
Mar 01 2018 10:34 UTC
@X140hu4 Denmark
Puneeth N
@puneethnviraat
Mar 01 2018 11:57 UTC
i designed "Show the Local Weather" its working in my local folder....if i copy and paste in code-pin it's not working code pin sitte..
in my desktop i created an index.html it's working fine..
h1tag
@h1tag
Mar 01 2018 12:00 UTC
@puneethnviraat check your browser console for errors
@ldocherty1 could be a missing resource, or a difference in some resource version
I can't see the resources you've added on jsfiddle to compare them
Puneeth N
@puneethnviraat
Mar 01 2018 12:06 UTC
@h1tag this is the erroe: Access to Font at 'https://static.codepen.io/assets/telefon/bold/af889c53-1ee3-4868-8fdc-2b310d587b50-3-b7a87e0fbd213943fae0c0ef5985635dd43fa9c24876b2725127a13ccaf4ab6a.woff' from origin 'https://codepen.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://codepen.io' is therefore not allowed access.
h1tag
@h1tag
Mar 01 2018 12:07 UTC
@puneethnviraat can you provide the link to your pen
h1tag
@h1tag
Mar 01 2018 12:11 UTC
@puneethnviraat that was a warning, not an error.
it's working fine for me, I get the coordinates and the weather status
did you check to see if you get any error (red colored) after pressing the button?
Puneeth N
@puneethnviraat
Mar 01 2018 12:17 UTC
@h1tag ,,really u got coordinates and the weather status...i'm trying here but not working an error displaying for me...same as i mentioned above.
h1tag
@h1tag
Mar 01 2018 12:17 UTC
@puneethnviraat whats the color of the error?
if it's yellow, then it's a warning (it won't cause a problem). if red, then it's an error
Puneeth N
@puneethnviraat
Mar 01 2018 12:19 UTC
it's in red.
h1tag
@h1tag
Mar 01 2018 12:19 UTC
I see
What browser are u using?
Puneeth N
@puneethnviraat
Mar 01 2018 12:20 UTC
chrome
is there any way to send screenshot
h1tag
@h1tag
Mar 01 2018 12:21 UTC
I'm on firefox. I tried chrome, and now I see the error
I don't see the link to the font that's causing the error, where did you add it?
Puneeth N
@puneethnviraat
Mar 01 2018 12:23 UTC
hey thank you your support..chrome was blocked my location access...that was the error now i solved it...thank's lot...:)
h1tag
@h1tag
Mar 01 2018 12:24 UTC
really?! We should checked for that first, lol
Abhinav Mishra
@abhinav-m
Mar 01 2018 12:38 UTC
Hey guys, im facing a problem which stumps me
this is a sample portfolioi made
i made the same with react components , sass and you can see that here
the css is pretty much the same, however the one i hosted isnt responsive
Im using css-grid for making it responsive
ahmed-issa-mohd
@ahmed-issa-mohd
Mar 01 2018 12:42 UTC
how to make offset for positioning absolute element responsively
Cato Myhre
@Zalmez
Mar 01 2018 12:45 UTC
I have no idea what I'm doing wrong with my weather app it returns "Please provide longitude as lon and latitude as lat as numbers/floats."
Aditya
@ezioda004
Mar 01 2018 12:45 UTC
@Zalmez Codepen link perhaps?
I tried making the float into a whole number, tried to change the variable names to lat and lon cuz it didn't really accept it as latitude or longitude
facepalm
found it
Aditya
@ezioda004
Mar 01 2018 12:50 UTC
var weatherLink = api + "lon=" + lon + "&lat=" + lat;
Cato Myhre
@Zalmez
Mar 01 2018 12:50 UTC
thanks tho @ezioda004
CamperBot
@camperbot
Mar 01 2018 12:50 UTC
zalmez sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 487 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Aditya
@ezioda004
Mar 01 2018 12:51 UTC
You debugged yourself :clap:
Cato Myhre
@Zalmez
Mar 01 2018 12:54 UTC
I really don't know where I got the ":" from :thought_balloon:
Aditya
@ezioda004
Mar 01 2018 12:55 UTC
Its in the endpoint page example syntax :D prob from there
Cato Myhre
@Zalmez
Mar 01 2018 12:56 UTC
probably
Federico Dente
@fez994
Mar 01 2018 13:18 UTC
Hei guys i need help with bootstrap, can anyone help me?
h1tag
@h1tag
Mar 01 2018 13:19 UTC
@fez994 I'll try
Federico Dente
@fez994
Mar 01 2018 13:19 UTC
I want the search button on the same line as the input, how can i do it? https://codepen.io/fez994/pen/wyNNdq
h1tag
@h1tag
Mar 01 2018 13:20 UTC
@fez994 it's on the same line for me
Screenshot.png
Federico Dente
@fez994
Mar 01 2018 13:21 UTC
nope it's slight higher
h1tag
@h1tag
Mar 01 2018 13:21 UTC
oh, ok
@fez994 you dont want to use css?
Federico Dente
@fez994
Mar 01 2018 13:23 UTC
it's ok using css
as long as it's responsive
@h1tag
h1tag
@h1tag
Mar 01 2018 13:25 UTC
@fez994 change the margin for the button, use em units (you'll need to use small numbers like 0.35em)
Markus Kiili
@Masd925
Mar 01 2018 13:26 UTC
@fez994 col classes scale up, so just col-xs-2 would do the same as col-xs-2 col-md-2 col-xl-2 I think.
Federico Dente
@fez994
Mar 01 2018 13:36 UTC
@Masd925 oh i see thank you
CamperBot
@camperbot
Mar 01 2018 13:36 UTC
fez994 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4710 | @masd925 |http://www.freecodecamp.org/masd925
Federico Dente
@fez994
Mar 01 2018 13:36 UTC
@h1tag yeah em worked, thanks
Spetsnaz
@Spetsnaz-Dev
Mar 01 2018 15:15 UTC
@RishabhGupta22 did you found your answer or having problem.I've gone through your code!
Spetsnaz
@Spetsnaz-Dev
Mar 01 2018 15:24 UTC

Can you pls explain me this line of code??

$("#display").html(eval(total));

what does the eval(total) does here??

have a good read
Spetsnaz
@Spetsnaz-Dev
Mar 01 2018 15:43 UTC
thank you...
lol this function is huge amount slower than other ones @X140hu4
CamperBot
@camperbot
Mar 01 2018 15:43 UTC
spetsnaz-dev sends brownie points to @x140hu4 :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @x140hu4 |http://www.freecodecamp.org/x140hu4
Fabien SHAN
@X140hu4
Mar 01 2018 15:51 UTC
@Spetsnaz-Dev Yes because it goes against some JS rules that makes it so fast
You can read a bit about that on You Dont Know JS, maybe on the closure & scope book
Nate Mallison
@NJM8
Mar 01 2018 16:03 UTC
I think you aren't supposed to use eval.
Aditya
@ezioda004
Mar 01 2018 16:05 UTC
^
Nate Mallison
@NJM8
Mar 01 2018 16:05 UTC
Can anyone help me with my random quote generator? https://njm8.github.io/FreeCodeCampFrontEndProjects/randomQuoteGenerator/
I'm using this css to load the image full viewport with no overflow:
html { 
  background: url(01860_sanfrancisco_2560x1600.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}
but it is disabling my button
for some reason the waves class does nothing and clicking the button does nothing
If I remove the css for the image it works fine. I have also tried a couple different methods to do the back ground image from this article: https://css-tricks.com/perfect-full-page-background-image/. And they all have the same affect on the button.
h1tag
@h1tag
Mar 01 2018 16:09 UTC
@NJM8 which button, cause the new quote and twitter buttons are working for me
Nate Mallison
@NJM8
Mar 01 2018 16:13 UTC
Sorry, the blue thing that says created by nate dawg is supposed to a link to my portfolio
If you delete the css for the image you will see it works
Riadh
@KWFE
Mar 01 2018 16:17 UTC
hey hope you are doing well ,,, who has an idea about this challenge!!
https://www.freecodecamp.org/challenges/find-the-longest-word-in-a-string
Nate Mallison
@NJM8
Mar 01 2018 16:18 UTC
Did you read the helpful links?
string.split can split the string into an array, from there just check the length of each and return the longest
h1tag
@h1tag
Mar 01 2018 16:19 UTC
@NJM8 where did these classes come from waves-effect waves-light btn blue lighten-2 hoverable?
h1tag
@h1tag
Mar 01 2018 16:26 UTC
@NJM8 so, if you remove the html rule in the CSS file, the button works?
Nate Mallison
@NJM8
Mar 01 2018 16:36 UTC
Yes, if you open your browser tools, go to styles and delete the whole html rule the button will work
h1tag
@h1tag
Mar 01 2018 16:37 UTC
@NJM8 I tried to that here, but it's still not working
Nate Mallison
@NJM8
Mar 01 2018 16:38 UTC
Huh, yeah that's weird
Liam Docherty
@ldocherty1
Mar 01 2018 16:38 UTC
@h1tag Sorry just got back, I did do a cross check and noticed no difference. Going to repost in the hope someone spots my mistake. Thanks for the response.
CamperBot
@camperbot
Mar 01 2018 16:38 UTC
ldocherty1 sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 927 | @h1tag |http://www.freecodecamp.org/h1tag
Nate Mallison
@NJM8
Mar 01 2018 16:38 UTC
you would think an a tag would work in codepen
Liam Docherty
@ldocherty1
Mar 01 2018 16:38 UTC
When I move my jsfiddle over to my code it doesn't seem to work. I copied all the html,css and JS over. Is it a resource link I'm missing? https://github.com/ldocherty1/Unit28_Assignment1. The navigation bar doesn't come out as the same as in the JSFIDDLE. https://jsfiddle.net/dff82rp5/ Any ideas?
queenofthescythians
@queenofthescythians
Mar 01 2018 16:39 UTC
GUYS DOES ANYONE KNOW HOW TO RESTORE FB LIKES AFTER MOVING TO SSL???
h1tag
@h1tag
Mar 01 2018 16:39 UTC
@NJM8 If you add target='_blank', yes
Darren
@DarrenfJ
Mar 01 2018 16:43 UTC
@coderNewby hey noticed your new PM, will check it when I get a chance
thanks @coderNewby for being patient :D
CamperBot
@camperbot
Mar 01 2018 16:43 UTC
darrenfj sends brownie points to @codernewby :sparkles: :thumbsup: :sparkles:
:cookie: 60 | @codernewby |http://www.freecodecamp.org/codernewby
Riadh
@KWFE
Mar 01 2018 16:43 UTC
@NJM8 thanks i ll try it
CamperBot
@camperbot
Mar 01 2018 16:43 UTC
kwfe sends brownie points to @njm8 :sparkles: :thumbsup: :sparkles:
:cookie: 311 | @njm8 |http://www.freecodecamp.org/njm8
h1tag
@h1tag
Mar 01 2018 16:53 UTC
@NJM8 it has to do with the z-index for the quote-card
its disabling your button
Nate Mallison
@NJM8
Mar 01 2018 16:55 UTC
Ohh, huh, but the quote card doesn't cover it?
h1tag
@h1tag
Mar 01 2018 16:59 UTC
it's fixed by removing postion: absolute from quote card too, lol @NJM8
absolute
The element is removed from the normal document flow; no space is created for the element in the page layout. Instead, it is positioned relative to its closest positioned ancestor if any; otherwise, it is placed relative to the initial containing block. Its final position is determined by the values of top, right, bottom, and left. This value creates a new stacking context when the value of z-index is not auto. Absolutely positioned boxes can have margins, and they do not collapse with any other margins.
Nate Mallison
@NJM8
Mar 01 2018 17:03 UTC
man
h1tag
@h1tag
Mar 01 2018 17:03 UTC
CSS :p
Nate Mallison
@NJM8
Mar 01 2018 17:05 UTC
Whoever created CSS was like, hey lets make this 3D container for all our elements that has all these weird rules and cases where things affect each other differently
ugh
thanks @h1tag
CamperBot
@camperbot
Mar 01 2018 17:05 UTC
njm8 sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 928 | @h1tag |http://www.freecodecamp.org/h1tag
h1tag
@h1tag
Mar 01 2018 17:05 UTC
lol, true
you're welcome
Nate Mallison
@NJM8
Mar 01 2018 17:10 UTC
I just made the z-index the same. removing the absolute screws up the initial position, is there a better way?
h1tag
@h1tag
Mar 01 2018 17:11 UTC
idk
coderNewby
@coderNewby
Mar 01 2018 17:14 UTC
@DarrenfJ thanks for the heads up
CamperBot
@camperbot
Mar 01 2018 17:14 UTC
codernewby sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2409 | @darrenfj |http://www.freecodecamp.org/darrenfj
Yogender
@yb1997
Mar 01 2018 17:24 UTC
https://codepen.io/ybisht1997/pen/LQaPZw?editors=0100
Can anyone see the shadow of sidebar on top of blue header clearly ?
expected output: should not be visible
h1tag
@h1tag
Mar 01 2018 17:26 UTC
@yb1997 it's there, but not that clear
Yogender
@yb1997
Mar 01 2018 17:27 UTC
@h1tag is it ignorable on monitor screen ?
@h1tag my monitor resolution is not that good so can't say how it's rendering on high res displays
h1tag
@h1tag
Mar 01 2018 17:29 UTC
@yb1997 second thought, I 'm not sure tbh, could be an illusion (the shadow)
but if it's rly there, I'd say its ignorable
you're talking about the bar that show after checking the box, right?
Yogender
@yb1997
Mar 01 2018 17:31 UTC
@h1tag yea thats the sidebar
@h1tag is there any way to bring the shadow of blue bar on top of sidebar ?
that blue bar is actually the parent element of sidebar so z-index is not gonna work here
h1tag
@h1tag
Mar 01 2018 17:35 UTC
@yb1997 why do you want to bring the shadow over the blue bar, i think it looks better the other way
and from a functional standpoint too
Yogender
@yb1997
Mar 01 2018 17:36 UTC
@h1tag hmm thanks for your suggestion
CamperBot
@camperbot
Mar 01 2018 17:36 UTC
yb1997 sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 929 | @h1tag |http://www.freecodecamp.org/h1tag
h1tag
@h1tag
Mar 01 2018 17:37 UTC
either, I think it's showing on top of the blue bar, but not 100 sure :smile:
Yogender
@yb1997
Mar 01 2018 17:38 UTC
the more I focus more I get confused so I better leave that shadow in its place :smile:
h1tag
@h1tag
Mar 01 2018 17:38 UTC
lol
Yogender
@yb1997
Mar 01 2018 17:41 UTC
one more thing, clicking on either google or fb link slowly doesn't navigate to the link but if you click quickly then everything's fine
h1tag
@h1tag
Mar 01 2018 17:43 UTC
@yb1997 you need target="_blank" for the link to work properly on codepen, target="_blank" opens the link in new tap. Not sure if that what was causing the problem, but it seems fixed
Yogender
@yb1997
Mar 01 2018 17:45 UTC
@h1tag sorry my bad, I was lookig at previous version of the styles
h1tag
@h1tag
Mar 01 2018 17:53 UTC
@ldocherty1 I added the css from jsfiddle to one on github, and it looks the same: https://codepen.io/anon/pen/ddrPZw
Gulsvi
@gulsvi
Mar 01 2018 19:27 UTC
@yb1997 Curious if you're aware of the Materialize CSS Framework. I noticed you were using bootstrap. https://codepen.io/gulsvi/pen/ddrGYj?editors=1010
Nate Mallison
@NJM8
Mar 01 2018 20:24 UTC
materialize is great
rdollent
@rdollent
Mar 01 2018 22:35 UTC
maybe i should use materialize css. i dont wanna be hard-coding all the transforms and animation and box shadows. ugh. why is css so tedious
Gulsvi
@gulsvi
Mar 01 2018 22:43 UTC
The problem with materialize, at least for me, is your website looks like it was coded by Google. Not very unique
Aiden
@AidenMead
Mar 01 2018 23:42 UTC
Hey folks! I was hoping to grab a bit of input on some more in depth CSS styling (kind of)
VaseJS
@VaseJS
Mar 01 2018 23:44 UTC
@AidenMead Google search: “harry roberts css” nuff said
Aiden
@AidenMead
Mar 01 2018 23:48 UTC
Am I supposed to be seeing a site that asks me repeatedly to hire him? XD