These are chat archives for FreeCodeCamp/Help

12th
Feb 2018
Johnny
@JohnnyBizzel
Feb 12 2018 00:26
@Hijerboa Have a look at some other people's solutions.
Kyle Holm
@thekholm80
Feb 12 2018 00:28
I used svgs because css is hard
Claudio Restifo
@Marmiz
Feb 12 2018 03:12
@ehutchllew managed to (hopefully) fix it.
I had an issue from a graphql query firing on a component that I thought was updating but in fact was re-rendering.
:)
Ishan
@ishanism
Feb 12 2018 03:24

hi can anyone tell me why is my result getting weird?

arr = [[49, 38, 28, 27, 25, 18, 13], [2354, 5, 4, 3, 1], [232, 231, 39, 38, 35, 32], [1001, 1000, 857, 1]]

and doing the following code

tempArr[0] = arr[0][0];

changes the value of arr to
arr = [49,[2354,5.....],[.....],[......]]

Isnt only the value of tempArr supposed to change with arr remaining unchanged?

Claudio Restifo
@Marmiz
Feb 12 2018 03:33
@ishanism how's tempArr initialised?
Ishan
@ishanism
Feb 12 2018 03:34
tempArr = arr;
Claudio Restifo
@Marmiz
Feb 12 2018 03:38

@ishanism this means that tempArr is "pointing" to the same object therefore any change to tempArr will change the original arr as well.

You can initialise tempArr = [] as a new object

Ishan
@ishanism
Feb 12 2018 03:38
oh okay
wow thanks.
i have been trying to crack at it for the last hour..
didn't knew JS had this pointer stuffs. I need to start the camp from beginning again I suppose.
Claudio Restifo
@Marmiz
Feb 12 2018 03:47

Well Array in JS are objects, and variables only hold a reference to an object, not the object itself. Thus both variables have a reference to the same object.

In other languages this is probably more obvious, but it's a functionality that is common :)

Darren
@DarrenfJ
Feb 12 2018 06:08
evening fCC
coderNewby
@coderNewby
Feb 12 2018 06:09
@DarrenfJ pm'd you
coderNewby
@coderNewby
Feb 12 2018 06:36
thanks @DarrenfJ
CamperBot
@camperbot
Feb 12 2018 06:36
codernewby sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2387 | @darrenfj |http://www.freecodecamp.org/darrenfj
AJEET SINGH
@imajeet
Feb 12 2018 07:58
Safari browser can't open my website. I have checked from different laptops too and cleared cache too. Could anyone help me please?
www.imajeet.com this is my website
Claudio Restifo
@Marmiz
Feb 12 2018 08:25
works for me
Linh Nguyen My
@pinglinh
Feb 12 2018 09:29
Hello all...can someone tell me where I am going wrong with this? https://beta.freecodecamp.org/en/challenges/redux/send-action-data-to-the-store
const ADD_NOTE = 'ADD_NOTE';

const notesReducer = (state = 'Initial State', action) => {
  switch(action.type) {
    // change code below this line
    case ADD_NOTE:
      return state.text
      break;
    // change code above this line
    default:
      return state;
  }
};

const addNoteText = (note) => {
  // change code below this line
   return {
     type: ADD_NOTE
     text: note
   }
  // change code above this line
};

const store = Redux.createStore(notesReducer);

console.log(store.getState());
store.dispatch(addNoteText('Hello!'));
console.log(store.getState());
Claudio Restifo
@Marmiz
Feb 12 2018 09:31
@pinglinh when adding text you should take it from action, and not state.
state is how it is as of now
action is the object that holds how we want to change it
Linh Nguyen My
@pinglinh
Feb 12 2018 09:32
@Marmiz in which code block?
OOOO
Claudio Restifo
@Marmiz
Feb 12 2018 09:32
@pinglinh that's what you have to figure it out ;)
Manish Giri
@Manish-Giri
Feb 12 2018 09:33
Claudio be savage
@pinglinh in the ADD_NOTE case

:point_up: February 11, 2018 1:40 PM

@Marmiz any idea how to revert this?

Linh Nguyen My
@pinglinh
Feb 12 2018 09:40
@Marmiz @Manish-Giri hmm I'm probably not inputting this right...tried return addNoteText.text, return addNoteText(text) and return addNoteText = { text: note }
Claudio Restifo
@Marmiz
Feb 12 2018 09:44
@Manish-Giri didn't get what you want to achieve ??
you want the typeof, a breakpoint or what else?
Manish Giri
@Manish-Giri
Feb 12 2018 09:44
 case ADD_NOTE:
      return state.text
      break;
whatever gets returned from the reducer becomes the new state
and in your function definition - const notesReducer = (state = 'Initial State', action) => { - action is the object that holds the piece of state called text when the type is ADD_NOTE
Claudio Restifo
@Marmiz
Feb 12 2018 09:46

therefore

      return state.text

is returning whatever was already in state.text; instead of whatever payload the action is dispatching

Manish Giri
@Manish-Giri
Feb 12 2018 09:46
@Marmiz not really
do you have Firefox
Claudio Restifo
@Marmiz
Feb 12 2018 09:46
y
Manish Giri
@Manish-Giri
Feb 12 2018 09:47
in the console, enter var h = {a: 1, b: 2}
Linh Nguyen My
@pinglinh
Feb 12 2018 09:47
@Manish-Giri @Marmiz
    case ADD_NOTE:
      return action.text
      break;
Manish Giri
@Manish-Giri
Feb 12 2018 09:47
then enter h and see the return
@pinglinh yes
Claudio Restifo
@Marmiz
Feb 12 2018 09:48
@Manish-Giri Object {..}
Manish Giri
@Manish-Giri
Feb 12 2018 09:48
right
note the Object
that shows up too, with the data
now try the same in chrome
Claudio Restifo
@Marmiz
Feb 12 2018 09:49
@pinglinh it's important that you understand the idea of why it works like that.
It's the base of all flux-like state management.
@Manish-Giri chrome doesn't print the type by default
Linh Nguyen My
@pinglinh
Feb 12 2018 09:49
@Marmiz doesn't pass the test though
Manish Giri
@Manish-Giri
Feb 12 2018 09:49
@Marmiz it does
or at least it used to
Linh Nguyen My
@pinglinh
Feb 12 2018 09:50
@Marmiz yeah I'm still tryna get my head around it
Manish Giri
@Manish-Giri
Feb 12 2018 09:50
this is a simple console.log(props)
Linh Nguyen My
@pinglinh
Feb 12 2018 09:51
const ADD_NOTE = 'ADD_NOTE';

const notesReducer = (state = 'Initial State', action) => {
  switch(action.type) {
    // change code below this line
    case ADD_NOTE:
      return action.text
      break;
    // change code above this line
    default:
      return state;
  }
};

const addNoteText = (note) => {
  // change code below this line
   return {
     type: ADD_NOTE
     text: note
   }
  // change code above this line
};

const store = Redux.createStore(notesReducer);

console.log(store.getState());
store.dispatch(addNoteText('Hello!'));
console.log(store.getState());
Claudio Restifo
@Marmiz
Feb 12 2018 09:52

@Manish-Giri probably they changes the source code for the functionality.
Try to look on chrome blog :)

anyway if you want the same a simple console.log(typeof h, h) will do.
(and you can write your own function to do the same... i do it in almost every project. We have a file called logger that we use)

Manish Giri
@Manish-Giri
Feb 12 2018 09:54
 return {
     type: ADD_NOTE,
     text: note
   }
you need a ,
to fix the object
@pinglinh
Claudio Restifo
@Marmiz
Feb 12 2018 09:55
@pinglinh commas in object :)
   return {
     type: ADD_NOTE
     text: note
   }
this is a syntax error
@Manish-Giri as far as I recall chrome gives you the type for nested structures and or big data... I think that for something smaller like the example you just gave me used to output just the data
Linh Nguyen My
@pinglinh
Feb 12 2018 09:56
const ADD_NOTE = 'ADD_NOTE';

const notesReducer = (state = 'Initial State', action) => {
  switch(action.type) {
    // change code below this line
    case ADD_NOTE:
      return {
       type: ADD_NOTE,
       text: note
       }
      break;
    // change code above this line
    default:
      return state;
  }
};

const addNoteText = (note) => {
  // change code below this line
   return {
     type: ADD_NOTE
     text: note
   }
  // change code above this line
};

const store = Redux.createStore(notesReducer);

console.log(store.getState());
store.dispatch(addNoteText('Hello!'));
console.log(store.getState());
still doesn't pass the test O_O
Claudio Restifo
@Marmiz
Feb 12 2018 09:57
@pinglinh ugh! syntax!
the commas goes into the action object not the switch statement
Manish Giri
@Manish-Giri
Feb 12 2018 09:57
Screenshot 2018-02-12 04.57.37.png
@Marmiz it was always the full type
:smile:
Claudio Restifo
@Marmiz
Feb 12 2018 09:58
@pinglinh don't rush ;)
Linh Nguyen My
@pinglinh
Feb 12 2018 09:58
@Marmiz @Manish-Giri ooooooooooooooooooooooooooooo thank you guys!!!!!!!!!!!!!!!!
CamperBot
@camperbot
Feb 12 2018 09:58
pinglinh sends brownie points to @marmiz and @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 1155 | @marmiz |http://www.freecodecamp.org/marmiz
:star2: 6809 | @manish-giri |http://www.freecodecamp.org/manish-giri
Claudio Restifo
@Marmiz
Feb 12 2018 09:58
@Manish-Giri ok so I don't know what changed it T_T
Manish Giri
@Manish-Giri
Feb 12 2018 09:59
@pinglinh :+1:
lyt222
@lyt222
Feb 12 2018 11:39
hi
Aniculaesei
@Aniculaesei
Feb 12 2018 12:30
Hi guys.Is something wrong with this code?Thank you:
  @media (max-height: 800px) {
    p {
      font-size: 10px;
    }
  }
Sweet Coding :)
@SweetCodingInc
Feb 12 2018 13:04
@thekholm80 : Finger crossed situation is over. The code exceeded their expectations and there will be a final round this Friday. :+1:
Stephen James
@sjames1958gm
Feb 12 2018 13:17
@Aniculaesei That is trying to say for height <= 800 font size for p tags is 10px?
That looks correct
Aniculaesei
@Aniculaesei
Feb 12 2018 13:22
The fcc beta has a bug.It works only If i put in one line all the code :)
@sjames1958gm Thanks anyway :)
CamperBot
@camperbot
Feb 12 2018 13:23
aniculaesei sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8965 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Stephen James
@sjames1958gm
Feb 12 2018 13:24
@Aniculaesei :+1: Didn't know it was a challenge. Make learning tougher when you are right but not accepted
Nazar
@IsaakNazar
Feb 12 2018 13:28
hey guys , what all means ?
transition: all 0.1s;
Aniculaesei
@Aniculaesei
Feb 12 2018 13:29
@sjames1958gm yes....It is frustrating :(
Aditya
@ezioda004
Feb 12 2018 13:32
@IsaakNazar That means all the transition of that elements take 0.1 seconds
Nazar
@IsaakNazar
Feb 12 2018 13:50
@ezioda004
but why transition: all 0.1s;gives the same effect as transition: 0.1s;?
Aditya
@ezioda004
Feb 12 2018 14:03
@IsaakNazar Because I believe default is all
So if you don't specify, it sets to all.
Kyle Holm
@thekholm80
Feb 12 2018 14:11
@SweetCodingInc congrats!
Sweet Coding :)
@SweetCodingInc
Feb 12 2018 14:16
@thekholm80 :+1:
Nazar
@IsaakNazar
Feb 12 2018 14:16
@ezioda004 ok thanx :+1:
CamperBot
@camperbot
Feb 12 2018 14:16
isaaknazar sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 452 | @ezioda004 |http://www.freecodecamp.org/ezioda004
gishy1
@gishy1
Feb 12 2018 14:45
hello world!!!!
im trying to figure something out,
what is the delete operator ?
what does it operate on ?
alpox
@alpox
Feb 12 2018 14:47
@gishy1 Its an operator which deletes a property from an object
This means it also works on arrays
gishy1
@gishy1
Feb 12 2018 14:47
i always thought only array methods worked on arrays
can it work o string objects
alpox
@alpox
Feb 12 2018 14:48
var ob = { foo: "bar", any: "baz" }
delete ob.foo;
console.log(ob) // prints { any: "baz" }
gishy1
@gishy1
Feb 12 2018 14:48
?
alpox
@alpox
Feb 12 2018 14:48
This is no method, this is an operator
gishy1
@gishy1
Feb 12 2018 14:48
hmmmm
alpox
@alpox
Feb 12 2018 14:49
var arr = [ 1, 2, 3];
delete arr[1];
console.log(arr); // Prints [1, undefined, 3]
gishy1
@gishy1
Feb 12 2018 14:49
what are some other methods?
alpox
@alpox
Feb 12 2018 14:49
Methods are as example arr.slice
gishy1
@gishy1
Feb 12 2018 14:49
also does it work on strings?
alpox
@alpox
Feb 12 2018 14:49
delete does not work on strings
Strings are immutable. delete is a mutation operation
gishy1
@gishy1
Feb 12 2018 14:50
why is that?
alpox
@alpox
Feb 12 2018 14:51
Because thats how javascript implemented strings
gishy1
@gishy1
Feb 12 2018 14:51
forgive me if what im asking sounds silly?
alpox
@alpox
Feb 12 2018 14:51
That was a design choice
Kyle Holm
@thekholm80
Feb 12 2018 14:51

lol

It's not a bug, it's a feature

alpox
@alpox
Feb 12 2018 14:52
@gishy1 What would you want to do with a delete on a string?
gishy1
@gishy1
Feb 12 2018 14:52
delete ?;
alpox
@alpox
Feb 12 2018 14:52
I mean what effect should it have in your eyes
gishy1
@gishy1
Feb 12 2018 14:53
see what i did there :smile:
alpox
@alpox
Feb 12 2018 14:53
That does not tell me something
gishy1
@gishy1
Feb 12 2018 14:53
im learning by trial and error
thats why some of the questions might come off as silly
alpox
@alpox
Feb 12 2018 14:54
Sure, but i thought you ask if it works on strings with some idea about what it would/could do to a string
So if you had something specific in mind, i could show you how that task which you wanted to accomplish with it is done the (right/working) way
gishy1
@gishy1
Feb 12 2018 14:56
oh alright im working on the hide and seek challenge and the delete operator came out of nowhere
so im trying to find out about it.
alpox
@alpox
Feb 12 2018 14:58
Hmm trying to find that challenge :D
gishy1
@gishy1
Feb 12 2018 14:58
loool
yes that one.
alpox
@alpox
Feb 12 2018 14:59
Ah seek and destroy ok
gishy1
@gishy1
Feb 12 2018 14:59
that would be a good challenge tho.
alpox
@alpox
Feb 12 2018 14:59
Well you don't need any delete there. They already propose the method you need to remove elements from the array (Or better, make a copy of the array with less items according to a condition)
Which is the filter method
Kyle Holm
@thekholm80
Feb 12 2018 15:11
i like filter
i like any method that doesn't mutate the original
less side effects
Stephen James
@sjames1958gm
Feb 12 2018 15:15
@thekholm80 :+1:
Carlos
@jeancarlospena
Feb 12 2018 15:49
Hi, I was going through the web developer bootcamp and out of nowhere the sound went off in all of the videos. Does anyone know how to fix this problem?
__mifflin__
@cdrainxv
Feb 12 2018 15:52
Try checking in the QA.
Carlos
@jeancarlospena
Feb 12 2018 15:55
i lowered the video quality and it worked. weird
Darren
@DarrenfJ
Feb 12 2018 16:05
morning fCC
Stephen James
@sjames1958gm
Feb 12 2018 16:08
@jeancarlospena I have had similar issues on Udemy where I had to lower the quality from auto
@DarrenfJ Yo, hooded one.
Darren
@DarrenfJ
Feb 12 2018 16:09
@sjames1958gm hey brutha
Kyle Holm
@thekholm80
Feb 12 2018 16:09
@DarrenfJ :wave:
Darren
@DarrenfJ
Feb 12 2018 16:15
@thekholm80 hey buddy...
DarrenfJ @DarrenfJ sneaks off to test
Ken Haduch
@khaduch
Feb 12 2018 18:25
@DarrenfJ @thekholm80 - howdy! And everyone else on line here... how's it going?
Kyle Holm
@thekholm80
Feb 12 2018 18:25
@khaduch hi Ken, happy Monday
Altin Rrahmani
@DevKosov
Feb 12 2018 18:26
@khaduch @thekholm80 :wave:
Kyle Holm
@thekholm80
Feb 12 2018 18:26
@DevKosov hiya
Ken Haduch
@khaduch
Feb 12 2018 18:26
@DevKosov :wave:
Altin Rrahmani
@DevKosov
Feb 12 2018 18:26
how are you guys holding
Kyle Holm
@thekholm80
Feb 12 2018 18:27
i think i'm finally beginning to understand proper authentication in MERN, which means I've probably got it all wrong
who'd have thought this would be such a tough concept to grasp?
Henry
@GitHub-Henry
Feb 12 2018 18:28
Are you taking a course or reading a book?
@thekholm80
Kyle Holm
@thekholm80
Feb 12 2018 18:28
just googling
Henry
@GitHub-Henry
Feb 12 2018 18:29
Sound like a lot of searches
to piece it together
Kyle Holm
@thekholm80
Feb 12 2018 18:29
I've not had a lot of luck finding a single resource that works for me
Henry
@GitHub-Henry
Feb 12 2018 18:29
Isn't there a book called MERN
Kyle Holm
@thekholm80
Feb 12 2018 18:30
hmm, maybe
Henry
@GitHub-Henry
Feb 12 2018 18:30
thought that would have put the pieces together, so I was hoping.
Altin Rrahmani
@DevKosov
Feb 12 2018 18:30
Good luck @thekholm80 and don't worry you didn't get it all wrong
i hope so :laughing:
Kyle Holm
@thekholm80
Feb 12 2018 18:31
@DevKosov thanks :)
CamperBot
@camperbot
Feb 12 2018 18:31
thekholm80 sends brownie points to @devkosov :sparkles: :thumbsup: :sparkles:
:cookie: 337 | @devkosov |http://www.freecodecamp.org/devkosov
Kyle Holm
@thekholm80
Feb 12 2018 18:32
@GitHub-Henry this has been particularly helpful
Henry
@GitHub-Henry
Feb 12 2018 18:32
I was hoping this book, Pro MERN Stack would help put some pieces together. Could you have a look and tell me what you think. @thekholm80
Kyle Holm
@thekholm80
Feb 12 2018 18:35
@GitHub-Henry looks like it would get you going, but I wonder how advanced it gets?
Henry
@GitHub-Henry
Feb 12 2018 18:35
@thekholm80 I was just wondering the same
@thekholm80 amazon reviews are possitive for one that wants to put all the pieces together
Kyle Holm
@thekholm80
Feb 12 2018 18:37
my biggest problem with books is they're outdated by the time they go to press
react changes so fast
Altin Rrahmani
@DevKosov
Feb 12 2018 18:38
@thekholm80 agrees
Henry
@GitHub-Henry
Feb 12 2018 18:38
yeah, but since i am learning mern, and it's a book on mern, seems like a good fit, at least for me, since i need to put the pieces together.
Kyle Holm
@thekholm80
Feb 12 2018 18:38
right
Kelechi Chinaka
@ke1echi
Feb 12 2018 18:38
@Gersho i need to ask you some questions about cs50 credit
Altin Rrahmani
@DevKosov
Feb 12 2018 18:38
but a book is always helpful to start with it
Kyle Holm
@thekholm80
Feb 12 2018 18:39
the basics aren't going to really change too quickly, but when I first started learning React I was very frustrated trying to find up-to-date tutorials
Henry
@GitHub-Henry
Feb 12 2018 18:39
have you seen this
Kyle Holm
@thekholm80
Feb 12 2018 18:40
I tried that when I first started working on the back end projects
i don't use those types of things because they include so many things I don't understand or have a use for
and I don't really want some recruiter some day to ask "why did you include xxx but never use it?"
i don't know that that would ever happen, but that's my thought process
Stephen James
@sjames1958gm
Feb 12 2018 18:42
@thekholm80 You should use the framework, that no-one is talking about, its mongo, express and html - Meh
Henry
@GitHub-Henry
Feb 12 2018 18:42
hosting on gitter and having potential employers looking it over, makes sense
Kyle Holm
@thekholm80
Feb 12 2018 18:43
@sjames1958gm my microservice projects were exactly that, it was fun trying to re-learn how to write basic html pages after using react for so long
i also dabbled with handlebars, that was fun
Kyle Holm
@thekholm80
Feb 12 2018 18:49
@sjames1958gm ugh i just got that lol "MEH"
Stephen James
@sjames1958gm
Feb 12 2018 18:49
@thekholm80 I was wondering if you saw that - :smile:
Kyle Holm
@thekholm80
Feb 12 2018 18:49
i'm slow, but I usually get there lol
Stephen James
@sjames1958gm
Feb 12 2018 18:49
Dad jokes are my specialty
Kyle Holm
@thekholm80
Feb 12 2018 18:51
@GitHub-Henry it will be interesting to see how long it lasts
my local college has a web dev certificate course, they still teach angular
Henry
@GitHub-Henry
Feb 12 2018 18:51
@thekholm80 according to the chart it's been strong for two years
demand for angular is weak in comparison
Aditya
@ezioda004
Feb 12 2018 18:52
Hopefully a bit longer, I just started learning :runner:
Kaz Baig
@kbaig
Feb 12 2018 18:52
@thekholm80 you mean angularjs?
Kyle Holm
@thekholm80
Feb 12 2018 18:52
i wonder how many companies start new projects using angular?
@kbaig i wasn't aware there was a difference
Henry
@GitHub-Henry
Feb 12 2018 18:52
i mean angularjs, that's the chart data
Kaz Baig
@kbaig
Feb 12 2018 18:53
It's apparently more popular w/ enterprise
AngularJS is 1.x, Angular is 2+
2 was a full rewrite
they're different frameworks
Kyle Holm
@thekholm80
Feb 12 2018 18:53
it says Angular JS
Kaz Baig
@kbaig
Feb 12 2018 18:54
@thekholm80 idk which one they mean, just because they put a space between Angular and JS
@thekholm80 1.x is referred to as AngularJS and 2+ is referred to as Angular
Gersho
@Gersho
Feb 12 2018 18:55
Hello /help !
Kyle Holm
@thekholm80
Feb 12 2018 18:55
it's all the same to me - "stuff I'll never bother learning"
@Gersho :wave:
Gersho
@Gersho
Feb 12 2018 18:55
@kelechy i'm here if you still need help on credit
Henry
@GitHub-Henry
Feb 12 2018 18:55
Demand for Angular 2 is worse than AngularJS
Kaz Baig
@kbaig
Feb 12 2018 18:55
I might learn Vue at some point
But I like JSX so idk
Kyle Holm
@thekholm80
Feb 12 2018 18:56
can you use vue without pug?
i'm not a big pug fan
Kaz Baig
@kbaig
Feb 12 2018 18:56
You can use Vue with/out pug or JSX
I think most people just use HTML
I'd prob use Pug for Vue
Henry
@GitHub-Henry
Feb 12 2018 18:58
@kbaig I posted the data with Angular 2 and Angular JS so you can see the difference.
Kyle Holm
@thekholm80
Feb 12 2018 18:59
at any rate, i considered that course up until I got to the part where they required me to buy a Mac. no thank you
Henry
@GitHub-Henry
Feb 12 2018 18:59
@thekholm80 courses shouldn't require hardware platforms
Kaz Baig
@kbaig
Feb 12 2018 18:59
@GitHub-Henry We're discussing the course Kyle linked, not the data
Kyle Holm
@thekholm80
Feb 12 2018 19:00
I can kind of get it, it's for beginners and it would be a nightmare for teachers to try to be tech support for every possible OS/hardware config
Gersho
@Gersho
Feb 12 2018 19:00

@thekholm80 courses shouldn't require hardware platforms

probably so they can have everyone with the same setup (and maybe a deal with apple ?)

Kaz Baig
@kbaig
Feb 12 2018 19:00
I think I'm misunderstand what you mean tho :confused:
Manish Giri
@Manish-Giri
Feb 12 2018 19:00
oh what's this
Henry
@GitHub-Henry
Feb 12 2018 19:01
i thgought i saw something about angular 2 vs JS
Manish Giri
@Manish-Giri
Feb 12 2018 19:01
angular vs react talk
Kyle Holm
@thekholm80
Feb 12 2018 19:01
oh crap, we woke up @Manish-Giri
Gersho
@Gersho
Feb 12 2018 19:01
run for it
Henry
@GitHub-Henry
Feb 12 2018 19:01
Seems employers want react not angular
Kaz Baig
@kbaig
Feb 12 2018 19:01
@GitHub-Henry I was just explaining that Angular != AngularJS
Gersho
@Gersho
Feb 12 2018 19:01
weird, we weren't discussing java
Kyle Holm
@thekholm80
Feb 12 2018 19:01
lol
Kaz Baig
@kbaig
Feb 12 2018 19:01
gottem
Altin Rrahmani
@DevKosov
Feb 12 2018 19:01
lool
Kyle Holm
@thekholm80
Feb 12 2018 19:01
neo4j!
@Manish-Giri how are ya?
Manish Giri
@Manish-Giri
Feb 12 2018 19:02
meh
could've been better @thekholm80
Kyle Holm
@thekholm80
Feb 12 2018 19:02
did you find an answer to your Chrome data types issue?
Manish Giri
@Manish-Giri
Feb 12 2018 19:03
nope
Kyle Holm
@thekholm80
Feb 12 2018 19:04
google's been doing a lot of stuff i feel iffy about lately
Manish Giri
@Manish-Giri
Feb 12 2018 19:04
@GitHub-Henry where did you get that comparison data from
sounds interesting
I wanna check out some java stats
Kelechi Chinaka
@ke1echi
Feb 12 2018 19:44
how did you loop through the credit number @Gersho
:wave: guys
Gersho
@Gersho
Feb 12 2018 19:47
//cn is card number
    long long cn = n;
    int temp;
    // Will store the number of digits in the card number
    int cnlength = 0;

    while ( cn > 0 )
    {
        // Itterate every digit starting from the right
        temp = cn % 10;
        cn /= 10;
        cnlength++;
     // do stuff with temp (temp is a single digit, starting from the right)
}
Kelechi Chinaka
@ke1echi
Feb 12 2018 19:52
now that a good way to get me more confused :smile: @Gersho
i thought you used an array?
Gersho
@Gersho
Feb 12 2018 19:53
no i used a longlong
array i wasn't sure how to handle the various card number lengths
with modulo 10 you get the last digit, then you divide by 10 and keep doing that, you get every number starting from the right
Kelechi Chinaka
@ke1echi
Feb 12 2018 20:01
ok
but i need every 2nd element @Gersho
Manish Giri
@Manish-Giri
Feb 12 2018 20:04
what is the original problem
Kelechi Chinaka
@ke1echi
Feb 12 2018 20:04
implmenting luhn algorithm in C @Manish-Giri
Gersho
@Gersho
Feb 12 2018 20:05
with cnlength % 2 you can extrapolate what digit you are on
and you also need to do some stuff with the other digits anyway, so you need to itterate over all of them, but do different things depending on cnlength % 2
Kelechi Chinaka
@ke1echi
Feb 12 2018 20:25
how do you mean cnlength % 2 to extrapolate? @Gersho
Gersho
@Gersho
Feb 12 2018 20:28
        if (cnlength % 2)
        {
            // The last one and every other
        }
        else
        {
            // Every over starting second to last
          }
Kyle Holm
@thekholm80
Feb 12 2018 20:33
oh C languages, why do your bracket styles make my eyes hurt?
Gersho
@Gersho
Feb 12 2018 20:34
that's the style cs50 wants (you loose points if you don't do it that way)
Kyle Holm
@thekholm80
Feb 12 2018 20:35
I know, it's correct for C languages
but that doesn't mean i have to like it
Gersho
@Gersho
Feb 12 2018 20:35
personally i prefer
if(stuff){
//stuff
}else{
//more stuff
}
Kyle Holm
@thekholm80
Feb 12 2018 20:35
at least the brackets are there ... python drives me nuts
Gersho
@Gersho
Feb 12 2018 20:36
python i'm half lovin it half hatin it
always gets me screwed when i start copy pasting
Kyle Holm
@thekholm80
Feb 12 2018 20:36
4 space tabs are an abomination! lol
Gersho
@Gersho
Feb 12 2018 20:36
i use tab and let the editor do it's thing
Kyle Holm
@thekholm80
Feb 12 2018 20:37
i always change the settings in the editor
Gersho
@Gersho
Feb 12 2018 20:37
i like big indentation, 2 would annoy me i think
Kyle Holm
@thekholm80
Feb 12 2018 20:38
that's why i love all the pointless preference debates on reddit ... everyone's opinion is different and it usually doesn't make any difference how you do it
Gersho
@Gersho
Feb 12 2018 20:38
as long as it's consistent
Kyle Holm
@thekholm80
Feb 12 2018 20:38
but everyone has such strong opinions on the right way
Gersho
@Gersho
Feb 12 2018 20:39
are you implying my opinion isn't universal ?
Kyle Holm
@thekholm80
Feb 12 2018 20:43
yours is, everyone else's isn't
Gersho
@Gersho
Feb 12 2018 20:43
:)
Kelechi Chinaka
@ke1echi
Feb 12 2018 21:03
the % returns the last digit of the credit @Gersho
Gersho
@Gersho
Feb 12 2018 21:03
yes
gishy1
@gishy1
Feb 12 2018 21:03
hello what does the Array.prototype.sort() method not automatically sort from lowest to highest.
Kaz Baig
@kbaig
Feb 12 2018 21:03
My boss asked me to do something this week so I told him another priority thing needs to be pushed back. And he said okay :O
gishy1
@gishy1
Feb 12 2018 21:04
it requires a comparative function
Kaz Baig
@kbaig
Feb 12 2018 21:04
@gishy1 Sorry what's your question?
gishy1
@gishy1
Feb 12 2018 21:05
in short what is the default order for the sort method?
Brianna
@brisourceful
Feb 12 2018 21:05

Okay, I'm running on steam here and I can't figure out why this is not working.

function solve(a0, a1, a2, b0, b1, b2) {
  var aSum = 0;
  var bSum = 0;
  switch (true) {
    case a0 > b0:
      aSum++;
    case a1 > b1:
      aSum++;
    case a2 > b2:
      aSum++;
    case a0 < b0:
      bSum++;
    case a1 < b1:
      bSum++;
    case a2 < b2:
      bSum++;
  }
  return aSum + ' ' + bSum;
}

solve(1, 2, 3, 4, 2, 5);

It should return '0, 2' but it returns '0, 3'. Why!??!!?!?

Kyle Holm
@thekholm80
Feb 12 2018 21:05
sort() by itself will automatically sort, just not the way you'd expect
Kelechi Chinaka
@ke1echi
Feb 12 2018 21:05
pls give example of that if else , i still dont get how to differentiate every 2nd element from every last @Gersho
Kaz Baig
@kbaig
Feb 12 2018 21:05

@gishy1

If omitted, the array is sorted according to each character's Unicode code point value, according to the string conversion of each element.

Kyle Holm
@thekholm80
Feb 12 2018 21:05
^
gishy1
@gishy1
Feb 12 2018 21:06
exactly what the hell is a unicode code point value
i read that and just came staright here
Think of it like the character's ID number
Brianna
@brisourceful
Feb 12 2018 21:07
please help. My sleep deprived brain wants to cry
gishy1
@gishy1
Feb 12 2018 21:07
hmmm @kbaig go on ...
Kyle Holm
@thekholm80
Feb 12 2018 21:07
@brisourceful did you try turning it off and on again?
Gersho
@Gersho
Feb 12 2018 21:07
    while ( cn > 0 )
    {
        // Itterate every digit starting from the right
        temp = cn % 10;
        cn /= 10;
        cnlength++;
        if (cnlength % 2)
        {
            // The last one and every other, should be added to total

        }
        else
        {
            // Every over starting second to last, double the digits and make the sum of all digits

        }
try this with some printf inside the if and else
Brianna
@brisourceful
Feb 12 2018 21:08
Can you not pass a boolean into a switch statement??
Kyle Holm
@thekholm80
Feb 12 2018 21:08
you can
Brianna
@brisourceful
Feb 12 2018 21:09
wtf is going on?!?!?!
Kaz Baig
@kbaig
Feb 12 2018 21:09
@brisourceful you can, but it has to be explicitly true, not just truthy
Gersho
@Gersho
Feb 12 2018 21:09
but can you use such comparisons inside a switch ? i've never used it that way
Kaz Baig
@kbaig
Feb 12 2018 21:09
You shouldn't use switch this way but you can
Kyle Holm
@thekholm80
Feb 12 2018 21:09
that's the only way i know of you can do evals in case
Kaz Baig
@kbaig
Feb 12 2018 21:10
Should be using if/else or ternary for this
Kyle Holm
@thekholm80
Feb 12 2018 21:10
@brisourceful why do you expect 0, 2?
oh wait, i'm dumb lol
Brianna
@brisourceful
Feb 12 2018 21:11
hahaha
I was just about to say
@kbaig MDN literally has a similar example to mine so it definitely can be used this way
Kyle Holm
@thekholm80
Feb 12 2018 21:12
so what happens when it's comparing 2 and 2? (a1 & b1)?
Gersho
@Gersho
Feb 12 2018 21:12
for (i = 0; i <= 2; i++){
if (arguments[i] > arguments[i+3]){
//do stuff
}
}
Brianna
@brisourceful
Feb 12 2018 21:13
it evalues 2 < 2 as true which then adds 1 point to bSum which is not true
Kaz Baig
@kbaig
Feb 12 2018 21:13
@brisourceful oh I know why you're seeing 0,3
It's because you have no break statements
Brianna
@brisourceful
Feb 12 2018 21:13
but I want it to evaluate all of them
Kaz Baig
@kbaig
Feb 12 2018 21:13
So each case statement is including the cases under it
Manish Giri
@Manish-Giri
Feb 12 2018 21:13
omg look who's here!
the @brisourceful
Brianna
@brisourceful
Feb 12 2018 21:14
hey hey hey! @Manish-Giri
how i feel right now :worried: :gun:
I don't understand why this switch statement is evaluate 2 < 2 as true.
Kaz Baig
@kbaig
Feb 12 2018 21:15
@brisourceful I could be wrong but I think case is supposed to be like it can only be one of the options. If you want to execute the same thing under multiple cases, do something like the following MDN example
var Animal = 'Giraffe';
switch (Animal) {
  case 'Cow':
  case 'Giraffe':
  case 'Dog':
  case 'Pig':
    console.log('This animal will go on Noah\'s Ark.');
    break;
  case 'Dinosaur':
  default:
    console.log('This animal will not.');
}
gishy1
@gishy1
Feb 12 2018 21:15
function getIndexToIns(arr, num) {
  // Find my place in this sorted array.
  // sort out the arr

  var sorted = arr.sort(function(a,b){return a-b;});
  for (var i=0;i<arr.length;i++){
if(arr[i]<num&&num<arr[i]++)
{
}  
 return arr[i]; 

}

}


getIndexToIns([2, 20, 10], 19);
need help
Manish Giri
@Manish-Giri
Feb 12 2018 21:15
we missed so much of algo practice while you were gone @brisourceful
gishy1
@gishy1
Feb 12 2018 21:16
@Manish-Giri well im here :-1:
Manish Giri
@Manish-Giri
Feb 12 2018 21:16
lol
@gishy1 what's up
Brianna
@brisourceful
Feb 12 2018 21:16
@Manish-Giri aw we will do more! Don't worry
Kelechi Chinaka
@ke1echi
Feb 12 2018 21:16
Christ i feel terrible tonite @Gersho
gishy1
@gishy1
Feb 12 2018 21:17
@Manish-Giri joke bro
but have a look at my code
Manish Giri
@Manish-Giri
Feb 12 2018 21:17
@gishy1 you have a return in your for loop
Kaz Baig
@kbaig
Feb 12 2018 21:17
@brisourceful oh wait that example doesn't work here...awk
Manish Giri
@Manish-Giri
Feb 12 2018 21:17
which will terminate the loop in it's first run
Gersho
@Gersho
Feb 12 2018 21:18

Christ i feel terrible tonite @Gersho

did you try doing it with a pen and paper ? i find it helps when stuck

Kyle Holm
@thekholm80
Feb 12 2018 21:18
function solve(a0, a1, a2, b0, b1, b2) {
  let aSum = 0, bSum = 0;

  a0 > b0 ? aSum++ : b0 > a0 && bSum++;
  a1 > b1 ? aSum++ : b1 > a1 && bSum++;
  a2 > b2 ? aSum++ : b2 > a2 && bSum++;

  return aSum + ',' + bSum;
}

console.log(solve(1, 2, 3, 4, 2, 5));
that got me 0,2
and no ugly switch()
gishy1
@gishy1
Feb 12 2018 21:18
it is in the loop @Manish-Giri
Brianna
@brisourceful
Feb 12 2018 21:19
f the switch statment
cjlynch12
@cjlynch12
Feb 12 2018 21:19
+1 for no switch. My least favorite part of redux.
Brianna
@brisourceful
Feb 12 2018 21:19
I'm getting rid of it.
Kaz Baig
@kbaig
Feb 12 2018 21:19
Ya girl do it
Kyle Holm
@thekholm80
Feb 12 2018 21:19
yaas queen?
Kaz Baig
@kbaig
Feb 12 2018 21:19
I don't think it's the right thing to use here
Manish Giri
@Manish-Giri
Feb 12 2018 21:19
@gishy1 yup that's the problem
Kyle Holm
@thekholm80
Feb 12 2018 21:19
i'm so hip
Jose Gonzalez
@sneezyxl
Feb 12 2018 21:19
^
Kaz Baig
@kbaig
Feb 12 2018 21:19
@thekholm80 dude you're fabulous
Brianna
@brisourceful
Feb 12 2018 21:19
hahahaha
Gersho
@Gersho
Feb 12 2018 21:19
too lazy to test it but he's my attemp
for (i = 0; i <= 2; i++){
if (arguments[i] > arguments[i+3]){
aSum++;
}else{bSum++;}
}
Kyle Holm
@thekholm80
Feb 12 2018 21:20
@Gersho what if the values are equal?
Gersho
@Gersho
Feb 12 2018 21:20
what does the challenge asks in that case ?
Kyle Holm
@thekholm80
Feb 12 2018 21:21
judging by the code she posted it's only increment if the a[x] is greater than the b[x] or vice-versa
Kelechi Chinaka
@ke1echi
Feb 12 2018 21:21
i didnt really @Gersho i felt i could just write it in C since i wrote it in js
Brianna
@brisourceful
Feb 12 2018 21:21
@thekholm80 yes that's exactly it. I'm working through HackerRank's coding algo guestions
Gersho
@Gersho
Feb 12 2018 21:21
for (i = 0; i <= 2; i++){
if (arguments[i] > arguments[i+3]){
aSum++;
}else if (arguments[i] < arguments[i+3]){
bSum++;
}
}
Brianna
@brisourceful
Feb 12 2018 21:22
*questions
Manish Giri
@Manish-Giri
Feb 12 2018 21:22
oh yay hackerrank
gishy1
@gishy1
Feb 12 2018 21:22
@Manish-Giri is that the only thing you see missing ?
Manish Giri
@Manish-Giri
Feb 12 2018 21:22
PM me your ID, i'll follow you
@brisourceful
@gishy1 well your if block doesn't have any code, so there's that
I could give you another approach if you're up for it.. no loops required there.
Brianna
@brisourceful
Feb 12 2018 21:23
@Manish-Giri sure! I just started going through them so I'm only on the warm up questions but this is way better than LeetCode which made me write code for Node's process.stdin and process.stdout stream.
gishy1
@gishy1
Feb 12 2018 21:23
function getIndexToIns(arr, num) {
  // Find my place in this sorted array.
  // sort out the arr

  var sorted = arr.sort(function(a,b){return a-b;});
  for (var i=0;i<arr.length;i++){
if(arr[i]<num&&num<arr[i]+1)
{
   return arr[i]; 
}  


}

}


getIndexToIns([2, 20, 10], 19);
Manish Giri
@Manish-Giri
Feb 12 2018 21:24
@brisourceful leetcode questions are closer to what they actually ask though!
of course I didn't solve them in JS, so I wouldn't know about the node bit
Gersho
@Gersho
Feb 12 2018 21:25
no need to ask the language you used :3
Manish Giri
@Manish-Giri
Feb 12 2018 21:25
:smiling_imp:
Gersho
@Gersho
Feb 12 2018 21:25
if there was more hours in a day i would try it
Brianna
@brisourceful
Feb 12 2018 21:25
@Manish-Giri maybe... they have a whole online course though on HackerRank for CTCI.
Manish Giri
@Manish-Giri
Feb 12 2018 21:26
i'm in chapter 4 of the CTCI book atm
ugh
Kelechi Chinaka
@ke1echi
Feb 12 2018 21:27
whats CTCI?
Brianna
@brisourceful
Feb 12 2018 21:28
CTCI = Cracking the Coding Interview
cjlynch12
@cjlynch12
Feb 12 2018 21:28
aka the big 4 bible
Brianna
@brisourceful
Feb 12 2018 21:28
@Manish-Giri are you solving them in Java?
Manish Giri
@Manish-Giri
Feb 12 2018 21:29
@brisourceful yup
Gersho
@Gersho
Feb 12 2018 21:29
that was a stupid question :P
Manish Giri
@Manish-Giri
Feb 12 2018 21:30
JS barely has any good data structures, to be used in interviews
@Gersho :see_no_evil:
Brianna
@brisourceful
Feb 12 2018 21:31
Yes and no
Kelechi Chinaka
@ke1echi
Feb 12 2018 21:32
so we should stop writing js? @Manish-Giri
Kyle Holm
@thekholm80
Feb 12 2018 21:32
in before someone suggests everyone switch to Clojure
Manish Giri
@Manish-Giri
Feb 12 2018 21:32
@kelechy lol why would we
JS is good for what it does
Kaz Baig
@kbaig
Feb 12 2018 21:33
:O
Someone who doesn't use JS not hating on it? Did I accidentally step into a portal to another dimension?
Manish Giri
@Manish-Giri
Feb 12 2018 21:34
everyone who's here uses JS
Kyle Holm
@thekholm80
Feb 12 2018 21:35
wait, @Manish-Giri doesn't use JS?
Kaz Baig
@kbaig
Feb 12 2018 21:35
I thought he was just a Java person haha
Manish Giri
@Manish-Giri
Feb 12 2018 21:35
think that's common sense, what with FCC being a big JS source
Kaz Baig
@kbaig
Feb 12 2018 21:35
I mean in contrast to the main room, which often seems like non-JS'ers hating on JS
Manish Giri
@Manish-Giri
Feb 12 2018 21:36
main room is garbage
Gersho
@Gersho
Feb 12 2018 21:36
it's never the same if you count main room
Kyle Holm
@thekholm80
Feb 12 2018 21:36
Haskell or gtfo
--main room, probably
Manish Giri
@Manish-Giri
Feb 12 2018 21:36
they love everything that no one uses
Gersho
@Gersho
Feb 12 2018 21:36
that too, but i was being politicaly correct
unityscript was deprecated about 2 months after i started using it, is that hipster enough ?
Kyle Holm
@thekholm80
Feb 12 2018 21:37
i only write in Chicken now
Kelechi Chinaka
@ke1echi
Feb 12 2018 21:37
i would take a fresh look at credit tomoro @Gersho
Kyle Holm
@thekholm80
Feb 12 2018 21:38
on my typewriter
Gersho
@Gersho
Feb 12 2018 21:38
@kelechy come back to it with a fresh mind ;)

on my typewriter

when i was your age, we coded on punchcards

Brianna
@brisourceful
Feb 12 2018 21:39
Until we all start writing front end code in WebAssembly
Manish Giri
@Manish-Giri
Feb 12 2018 21:39
just invent a new lang and stick an ML after it
and watch it take off
KyleML
Kyle Holm
@thekholm80
Feb 12 2018 21:39
KyleBlockChainML
Gersho
@Gersho
Feb 12 2018 21:39
damn
Kyle Holm
@thekholm80
Feb 12 2018 21:39
brb making ipo
Gersho
@Gersho
Feb 12 2018 21:39
you beat me to it xD
what's ML btw ?
Kaz Baig
@kbaig
Feb 12 2018 21:43
Machine Learning @Gersho
Gersho
@Gersho
Feb 12 2018 21:44
oh right, thanks @kbaig
CamperBot
@camperbot
Feb 12 2018 21:44
gersho sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 569 | @kbaig |http://www.freecodecamp.org/kbaig
Matt Hwang
@hwangm
Feb 12 2018 21:49
I'm trying to pass the "Create a Map Data Structure" challenge in the fcc beta, and I'm failing on the "add" test. Checking the source code, the test is adding 3 key-value pairs, (5, 6), (2, 3), and (2, 5), then checks if the size of the map is 3. However, I thought that js maps and objects cannot have duplicate keys, so my code as written overwrites the value at key 2, and the resultant size is 2. Do I have to rewrite my Map class to accommodate duplicate keys or is the test inconsistent with the purpose of a Map?
Kyle Holm
@thekholm80
Feb 12 2018 22:06
@hwangm i'm seeing the same thing. I'm not sure why they've implemented it this way
I don't see any open issues on github either, so maybe I don't understand what they're asking? or it's just not a reported bug
Matt Hwang
@hwangm
Feb 12 2018 22:20
@thekholm80 I'm happy to open a new issue to get more info, I wanted to make sure it wasn't something simple that I overlooked
Gersho
@Gersho
Feb 12 2018 22:23
(five minutes ago)
hey i'm making good progress on my code, seeing the end of the tunnel
(now)
won't compile, a billion errors
Kyle Holm
@thekholm80
Feb 12 2018 22:23
this is why i never get optimistic about anything
Gersho
@Gersho
Feb 12 2018 22:24
you'll get bald if you worry too much
wait
Kyle Holm
@thekholm80
Feb 12 2018 22:24
jerk
Gersho
@Gersho
Feb 12 2018 22:42
it compiles but Segmentation fault (core dumped), time for a break xD