These are chat archives for FreeCodeCamp/Help

31st
Oct 2017
Ken Haduch
@khaduch
Oct 31 2017 00:25
@Manish-Giri - back at cha! Thanks for the support!
CamperBot
@camperbot
Oct 31 2017 00:25
khaduch sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6724 | @manish-giri |http://www.freecodecamp.com/manish-giri
Ken Haduch
@khaduch
Oct 31 2017 00:26
@Luckyscar - you can post it here for people to review and comment, and if you submit it, you can always go back and make changes. Did you post it in some chat room, like CodeReview?
Henry
@GitHub-Henry
Oct 31 2017 01:10
@Manish-Giri hello & thank you
CamperBot
@camperbot
Oct 31 2017 01:10
github-henry sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6725 | @manish-giri |http://www.freecodecamp.com/manish-giri
Eric Miller
@ericmiller777
Oct 31 2017 01:53
im not dead btw, just learning react.
Ken Haduch
@khaduch
Oct 31 2017 02:42
@ericmiller777 - me, too... how are you learning react?
Eric Miller
@ericmiller777
Oct 31 2017 02:42
codeacademy
Ken Haduch
@khaduch
Oct 31 2017 02:43
I'm doing a Udemy course - seems to be working okay up to this point.
Eric Miller
@ericmiller777
Oct 31 2017 02:43
im almost done, but im probably going to watch a series to build somthing before i try to do the projects
Claudio Restifo
@Marmiz
Oct 31 2017 04:18
:+1: for React
Kyle Holm
@thekholm80
Oct 31 2017 04:34
@Manish-Giri @heroiczero @DarrenfJ ty
CamperBot
@camperbot
Oct 31 2017 04:34
thekholm80 sends brownie points to @manish-giri and @heroiczero and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1979 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 2210 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 6726 | @manish-giri |http://www.freecodecamp.com/manish-giri
Long Nguyen
@longnt80
Oct 31 2017 04:37
anyone up for some job advices?
Claudio Restifo
@Marmiz
Oct 31 2017 04:39
@longnt80 if we may :D
Long Nguyen
@longnt80
Oct 31 2017 04:39
@Marmiz have you heard of Rapid Application Development tools or OutSystems?
Claudio Restifo
@Marmiz
Oct 31 2017 04:42
Never, sorry.
Long Nguyen
@longnt80
Oct 31 2017 04:43
@Marmiz it's ok, my first time hearing about it too
just got back from an interview with a company that use OutSystems
Claudio Restifo
@Marmiz
Oct 31 2017 04:44
I mean, I've always tought RAD is kinda like Agile... but never get in depth of those concepts...
they always feels like corporate gibberish to me
Long Nguyen
@longnt80
Oct 31 2017 04:44
are you in America?
US
Claudio Restifo
@Marmiz
Oct 31 2017 04:44
nope
Long Nguyen
@longnt80
Oct 31 2017 04:45
this company
they look for people with knowledge of HTML,CSS,Javascript which pretty much front end stuffs
so I applied and they uses this tool OutSystems which is a GUI tool to create crossed platform app
I think my skills can fit their needs but I'm not sure about working with a GUI tool to develop all my products though
if I take this job, not sure if I can getting better as a front end dev since I won't write code very much
Claudio Restifo
@Marmiz
Oct 31 2017 04:50

I don't know in the specific, but my general advice for any job hunting is that if you like it, then go for it.
Write a letter where you explain that you don't have that specific skills, but focus on the one you have that can fit you as a candidate.

It's understandable that you don't have 100% of the skills required, focus on the one you have in common and your strnght

As for the job depends a lot on your personal situation, if you are not in hurry you can afford to be picky and choose the one you prefer :)
Long Nguyen
@longnt80
Oct 31 2017 04:52
yeah, I guess I just put it on hold
Darren
@DarrenfJ
Oct 31 2017 04:54
evening fCC...
hi guys :wave: @longnt80 @Marmiz
Long Nguyen
@longnt80
Oct 31 2017 04:54
@DarrenfJ :wave: hi man
Claudio Restifo
@Marmiz
Oct 31 2017 04:55
@DarrenfJ :wavy_dash: hello
Darren
@DarrenfJ
Oct 31 2017 04:56
also my usual big shout out to the regulars who help out here
korzo
@korzo
Oct 31 2017 04:56
@DarrenfJ Morning
Darren
@DarrenfJ
Oct 31 2017 04:56
thanks @khaduch @alexanderkopke @GitHub-Henry @Manish-Giri @thekholm80 @daddycardona @korzo @longnt80 @sjames1958gm @Marmiz
CamperBot
@camperbot
Oct 31 2017 04:56
darrenfj sends brownie points to @khaduch and @alexanderkopke and @github-henry and @manish-giri and @thekholm80 and @daddycardona and @korzo and @longnt80 and @sjames1958gm and @marmiz :sparkles: :thumbsup: :sparkles:
:cookie: 436 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 1553 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 1689 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:star2: 3436 | @khaduch |http://www.freecodecamp.com/khaduch
:cookie: 435 | @daddycardona |http://www.freecodecamp.com/daddycardona
:cookie: 705 | @korzo |http://www.freecodecamp.com/korzo
:star2: 1067 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 6727 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 8637 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 627 | @longnt80 |http://www.freecodecamp.com/longnt80
Long Nguyen
@longnt80
Oct 31 2017 04:57
@DarrenfJ ty :sparkles:
CamperBot
@camperbot
Oct 31 2017 04:57
longnt80 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2211 | @darrenfj |http://www.freecodecamp.com/darrenfj
Claudio Restifo
@Marmiz
Oct 31 2017 04:59
unfortunately not much community left here in chat :cry:
this has always been a good place to hang out :smile:
korzo
@korzo
Oct 31 2017 05:01
@heroiczero @DarrenfJ @Manish-Giri thanks guys
CamperBot
@camperbot
Oct 31 2017 05:01
korzo sends brownie points to @heroiczero and @darrenfj and @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 2212 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 1980 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 6728 | @manish-giri |http://www.freecodecamp.com/manish-giri
Darren
@DarrenfJ
Oct 31 2017 05:19
@Marmiz yah seriously.. not much helping to do.. but good to hang out...
Boris
@Boris1011
Oct 31 2017 05:20
Hi everyone! Haven't been around in a while, but...
Darren
@DarrenfJ
Oct 31 2017 05:20
@Boris1011 hey buddy :D
Boris
@Boris1011
Oct 31 2017 05:20
@DarrenfJ Hi mate! :wave:
Darren
@DarrenfJ
Oct 31 2017 05:31
I'm off to walk my dogs.. code on HelpRoomies...
liuruijie
@liu582161766
Oct 31 2017 06:37
View more
Taro
@TaroWong
Oct 31 2017 07:32
Hi is anyone here free to help?
Eric Miller
@ericmiller777
Oct 31 2017 07:59
so i did the two reactjs courses on codeacademy, but now that I finished, it says theres another one called Building an Interactive React Application
but I cant find it, does it not exist yet?
Long Nguyen
@longnt80
Oct 31 2017 08:02
@ericmiller777 are you on paid course?
Eric Miller
@ericmiller777
Oct 31 2017 08:02
no
i cant find it
as a paid course either
if i did id use the trial
Long Nguyen
@longnt80
Oct 31 2017 08:02
maybe it's not ready yet
what is an interactive react application?
is the recipe box on FCC an interactive app?
Eric Miller
@ericmiller777
Oct 31 2017 08:03
probably
I know i can switch to another course, just wanted to finish theirs
Long Nguyen
@longnt80
Oct 31 2017 08:04
maybe you just go ahead and do the project
I think you'll learn more by doing
Eric Miller
@ericmiller777
Oct 31 2017 08:04
I think I need another course of react to get more used to it then ill go throughthe projects
probably
Long Nguyen
@longnt80
Oct 31 2017 08:04
the first two FCC react projects are very simple
you will get used to react by doing them
just make sure you post your code after finish so people can review them
I got very helpful tips on my code from the codereview channel and reddit
Eric Miller
@ericmiller777
Oct 31 2017 08:06
@longnt80 thanks
CamperBot
@camperbot
Oct 31 2017 08:06
ericmiller777 sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 628 | @longnt80 |http://www.freecodecamp.com/longnt80
Long Nguyen
@longnt80
Oct 31 2017 08:07
@ericmiller777 also there's a react community on discord which has many seasoned react devs
you could get your question answered overthere
Emmanuel Akodia
@akodiaemma
Oct 31 2017 08:29
@akodiaemma
guys what does it mean when my font awesome icons only show weird squeare boxes and not my icons here is the link http://mambosms.ug/Data/emma/mapenzi/
the icons are below but i see only boxes
ignore the side social media buttons
Stephen James
@sjames1958gm
Oct 31 2017 09:30
@akodiaemma If you look in the dev tools I see 404 responses to your font awesome file requests
heroiczero
@heroiczero
Oct 31 2017 10:41
@khaduch @alexanderkopke @GitHub-Henry @Manish-Giri @thekholm80 @daddycardona @korzo @longnt80 @sjames1958gm @Marmiz @DarrenfJ TY for helping out everyday.
CamperBot
@camperbot
Oct 31 2017 10:41
heroiczero sends brownie points to @khaduch and @alexanderkopke and @github-henry and @manish-giri and @thekholm80 and @daddycardona and @korzo and @longnt80 and @sjames1958gm and @marmiz and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 3437 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1690 | @alexanderkopke |http://www.freecodecamp.com/alexanderkopke
:cookie: 437 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 6729 | @manish-giri |http://www.freecodecamp.com/manish-giri
:cookie: 706 | @korzo |http://www.freecodecamp.com/korzo
:star2: 1068 | @marmiz |http://www.freecodecamp.com/marmiz
:star2: 2213 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 8638 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:cookie: 436 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 1554 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:cookie: 629 | @longnt80 |http://www.freecodecamp.com/longnt80
Stephen James
@sjames1958gm
Oct 31 2017 10:41
@heroiczero :+1:
korzo
@korzo
Oct 31 2017 11:28
@heroiczero thanks
CamperBot
@camperbot
Oct 31 2017 11:28
korzo sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1981 | @heroiczero |http://www.freecodecamp.com/heroiczero
Dorian
@Dorian92
Oct 31 2017 13:38
hi everyone! Is there anyone here who know to work with php and xml? I really need fast help :D
Ken Haduch
@khaduch
Oct 31 2017 15:20
@Dorian92 - this isn't too fast, but have you figure out what you need? If you can post here, we can give it a shot...
mstellaluna
@mstellaluna
Oct 31 2017 17:00
@ahmadabdolsaheb Please do not post especially in large font like this in every single room as it will be considered spamming. if you are looking for a project partner, please use the LetsPair room.
Ahmad Abdolsaheb
@ahmadabdolsaheb
Oct 31 2017 17:01
@mstellaluna thanks didn't know that. let me change the font then
CamperBot
@camperbot
Oct 31 2017 17:01
ahmadabdolsaheb sends brownie points to @mstellaluna :sparkles: :thumbsup: :sparkles:
:star2: 1006 | @mstellaluna |http://www.freecodecamp.com/mstellaluna
Darren
@DarrenfJ
Oct 31 2017 17:31
g'day fCC
popping in to say hi :wave:
Ken Haduch
@khaduch
Oct 31 2017 17:53
@DarrenfJ - hey there - thanks for the greetings and the support to the chat rooms...
CamperBot
@camperbot
Oct 31 2017 17:53
khaduch sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2214 | @darrenfj |http://www.freecodecamp.com/darrenfj
Ken Haduch
@khaduch
Oct 31 2017 17:56
@heroiczero - thank you for the appreciation as well as the help to the chat room visitors...
CamperBot
@camperbot
Oct 31 2017 17:56
khaduch sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1982 | @heroiczero |http://www.freecodecamp.com/heroiczero
why is it that when you hit the tweet button, it does correctly tweet the quote, but also a link to the codepen?
Ken Haduch
@khaduch
Oct 31 2017 18:07
@desordi3 - I think that that is the source URL of the quote or tweet that they send?
Jimmy Van Veen
@JimmayVV
Oct 31 2017 18:09
@desordi3 the API you are using, you need to use https://twitter.com/intent/tweet? not https://twitter.com/share?text= - because by using your URL you are literally sharing the codepen with a text description in front of it (the quote)
https://dev.twitter.com/web/intents
Ken Haduch
@khaduch
Oct 31 2017 18:10
@JimmayVV - thanks Jimmy - I was trying to look up that API URL that you listed...
CamperBot
@camperbot
Oct 31 2017 18:10
khaduch sends brownie points to @jimmayvv :sparkles: :thumbsup: :sparkles:
:cookie: 300 | @jimmayvv |http://www.freecodecamp.com/jimmayvv
Jimmy Van Veen
@JimmayVV
Oct 31 2017 18:11
@khaduch no problem, my pleasure. That API URL was difficult for me to find as well when I did that assignment
Tim Bakker
@ixava
Oct 31 2017 18:14
Does anyone know if it's ok to use O(n) operations in redux reducers? there doesn't seem to be a way around it in some cases
Anthony DeSordi
@desordi3
Oct 31 2017 18:14
Hey thanks guys @JimmayVV @khaduch , and Jim, with that being said, I tried to substitute out my /share?text= with the intent/tweet? that you showed me, and now when i try to tweet out the quote, the quote does not auto populate into the tweet field
CamperBot
@camperbot
Oct 31 2017 18:14
desordi3 sends brownie points to @jimmayvv and @khaduch :sparkles: :thumbsup: :sparkles:
:cookie: 301 | @jimmayvv |http://www.freecodecamp.com/jimmayvv
:star2: 3438 | @khaduch |http://www.freecodecamp.com/khaduch
alpox
@alpox
Oct 31 2017 18:16
@ixava what cases?
Jimmy Van Veen
@JimmayVV
Oct 31 2017 18:18
@desordi3 sorry, I didn't post the entire prefix. Did you add text= after it?
Anthony DeSordi
@desordi3
Oct 31 2017 18:18
Got it. Thanks a ton man!
Jimmy Van Veen
@JimmayVV
Oct 31 2017 18:18
@desordi3 s/b https://twitter.com/intent/tweet?text=[enter_text_here]
@desordi3 no problem - finding the exact right API for that was slightly tough for me as well. Most of the challenges finding the right API doc was easy, but this was wasn't
...this one wasn't**
Anthony DeSordi
@desordi3
Oct 31 2017 18:19
Good to know I wasnt the only one struggling with it!
Tim Bakker
@ixava
Oct 31 2017 18:20
@alpox I'm trying to store data from multiple database tables to redux.
Currently I have data structure like {tableName: {primaryKey: {data}}, ..etc}
But I really want the power that comes with storing data in arrays so I figured I needed a lookup table of some sorts
But Im having difficulty implementing reducer for generating that lookup table without regenerating the entire lookup table every state update
alpox
@alpox
Oct 31 2017 18:21
@ixava hmm are you trying to build a redux inmemory database? :D
Jimmy Van Veen
@JimmayVV
Oct 31 2017 18:21
@desordi3 the weather one is a little tricky as well, due to HTTP/HTTPS connectivity issues. If you do all of these in Codepen you'll be ok. Also, finding dynamic weather icons was a challenge for me as well, but I didn't dwell on it very much :)
Tim Bakker
@ixava
Oct 31 2017 18:22
lol well most tables are not going to grow big but they have relations to tables that do potentially contain alot of data
alpox
@alpox
Oct 31 2017 18:22
@ixava in real databases this is done theough a various range of index datastructures
Those are very performant and dont need so many operations to update
Creating a whole lookup table takes a lot of time
Tim Bakker
@ixava
Oct 31 2017 18:26
@alpox What do you mean various index datastructures? my mysql database is fine but the problem is storing the fetched data in redux
so that I can update it easily
and still use map and reduce etc on the data entries
alpox
@alpox
Oct 31 2017 18:27
@ixava hmm you would just treat it as any array. It shouldnt take so much to update things
Ofc. Redux can be quite an overhead when there are a lot of entries and you copy all of them each time. Immutable.js could perform better in this case
Tim Bakker
@ixava
Oct 31 2017 18:28
ok so how do you delete an entry when I store my data in an array?
there is no way of knowing in which index i stored that data is there?
alpox
@alpox
Oct 31 2017 18:29
Well you somehow read out the data of your array, no? There you should also know your index
And you can pass that through react and back to the action which updates the redux state
Tim Bakker
@ixava
Oct 31 2017 18:30
Thank you, you unglitched my brain
thanks @alpox
CamperBot
@camperbot
Oct 31 2017 18:30
ixava sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1420 | @alpox |http://www.freecodecamp.com/alpox
alpox
@alpox
Oct 31 2017 18:31
@ixava np :D
Alex
@alexandrupintilei
Oct 31 2017 18:36
Guys,what kind of phostohop should i install for a fronend project?
Albert Cardona II
@daddycardona
Oct 31 2017 18:57
hello everyone :)
what you mean what kind of photoshop any of them can work
Ken Haduch
@khaduch
Oct 31 2017 18:58
@daddycardona - hello Albert...
Albert Cardona II
@daddycardona
Oct 31 2017 18:58
hello @khaduch how you doing how is your mom?
Ken Haduch
@khaduch
Oct 31 2017 19:03
@daddycardona - Hi Albert - moving the comment to private chat...
CamperBot
@camperbot
Oct 31 2017 19:03
:cookie: 437 | @daddycardona |http://www.freecodecamp.com/daddycardona
khaduch sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
Albert Cardona II
@daddycardona
Oct 31 2017 19:03
@alexandrupintilei try learning illastrator and photoshop there are no special purpose front end versions of them that is the purpose to have them. A lot of people I know don't use them unless they are using photo ;)
Alex
@alexandrupintilei
Oct 31 2017 19:11
i just want to export each pic from a psd file,to create a frontend project @daddycardona
Albert Cardona II
@daddycardona
Oct 31 2017 19:11
what kind of project
what is your hopes for this project, you creating a site and using photoshop to export psd and are you slicing them and repositioning them with css I mean some people do all that and themsome without photoshop @alexandrupintilei
Alex
@alexandrupintilei
Oct 31 2017 19:22
@daddycardona i need to export layers,so i can create a slider for exemple
Sorin Ruse
@sorinr
Oct 31 2017 19:37
@alexandrupintilei take a look at this post
@alexandrupintilei here another article from adobe
@alexandrupintilei same thing free online
Alex
@alexandrupintilei
Oct 31 2017 19:47
@sorinr thx
CamperBot
@camperbot
Oct 31 2017 19:47
alexandrupintilei sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1349 | @sorinr |http://www.freecodecamp.com/sorinr
Sorin Ruse
@sorinr
Oct 31 2017 19:47
@alexandrupintilei welcome
Henry
@GitHub-Henry
Oct 31 2017 20:36
@heroiczero @DarrenfJ hello & thank you
CamperBot
@camperbot
Oct 31 2017 20:36
github-henry sends brownie points to @heroiczero and @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 1984 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 2215 | @darrenfj |http://www.freecodecamp.com/darrenfj
if anyone has time can they check out my picGenerator function? not sure why it won’t show the picture of the actor under the quote
korzo
@korzo
Oct 31 2017 20:45
@desordi3 newQuote is not defined
@desordi3 it's defined only in function scope, so you can't access it from other function
Anthony DeSordi
@desordi3
Oct 31 2017 20:47
@korzo Ahh okay, so if i initialize in the global scope I should be able to correctly use it for both the randomQuote function and picGenerator function?
@korzo and of course thank you btw!
CamperBot
@camperbot
Oct 31 2017 20:47
desordi3 sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 708 | @korzo |http://www.freecodecamp.com/korzo
korzo
@korzo
Oct 31 2017 20:51
@desordi3 yes, but it should be better to call function picGenerator with quote as soon as you have one.
Anthony DeSordi
@desordi3
Oct 31 2017 20:56
Thanks. i just tried initializing it outside of the local scope. any reason why it isnt recognizing the variable?

`var newQuote = Math.floor((Math.random() * quote.length)); // function that gets random quote and tweets out the quote function randomQuote() { document.getElementById("quote").innerHTML = quote[newQuote]; var tweetit = document.getElementById("twitterbutton"); tweetit.setAttribute("href",https://twitter.com/intent/tweet?text=` + quote[newQuote])

}``

```

``var newQuote = Math.floor((Math.random() * quote.length)); // function that gets random quote and tweets out the quote function randomQuote() { document.getElementById("quote").innerHTML = quote[newQuote]; var tweetit = document.getElementById("twitterbutton"); tweetit.setAttribute("href",https://twitter.com/intent/tweet?text=` + quote[newQuote])

}```

jesus …
var newQuote = Math.floor((Math.random() * quote.length)); // function that gets random quote and tweets out the quote function randomQuote() { document.getElementById("quote").innerHTML = quote[newQuote]; var tweetit = document.getElementById("twitterbutton"); tweetit.setAttribute("href",https://twitter.com/intent/tweet?text=` + quote[newQuote])
korzo
@korzo
Oct 31 2017 21:09

@desordi3 why not

function randomQuote() {
  var newQuote = Math.floor(Math.random() * quote.length);
  document.getElementById("quote").innerHTML = quote[newQuote];
  var tweetit = document.getElementById("twitterbutton");
  tweetit.setAttribute(
    "href",
    `https://twitter.com/intent/tweet?text=` + quote[newQuote]
  );
  picGenerator(quote[newQuote]);
}

function picGenerator(q) {
  if (q.includes("Tyrell")) {
    var picturePlacement = document.getElementById("picgoeshere");
    newpic.setAttribute(
      "src",
      `http://www.usanetwork.com/sites/usanetwork/files/styles/629x720/public/mrrobot_s2_cast_martin_wallstrom.jpg?itok=keeytAAF`
    );
  }
}

end remove call to picGenerator() at the end of JS block

Anthony DeSordi
@desordi3
Oct 31 2017 21:13
Thank you!!! works great
also really helped me understand functions more. thanks a ton @korzo
CamperBot
@camperbot
Oct 31 2017 21:13
desordi3 sends brownie points to @korzo :sparkles: :thumbsup: :sparkles:
api offline
korzo
@korzo
Oct 31 2017 21:14
@desordi3 never rely on global state and as long as it's possible, always pass data as function's argument
Surya Singh
@surya4
Oct 31 2017 21:14
can anyone help me to store values in the form of key value pair in js: i am doing something like this vbut messing up. here key and pair both are coming dynamically in each loop position
var keyMap = {} ;
// x.length --> 3
p = [1,2,3,4];
for (var i = 0; i < p.length; i++) {
y =  i*i;
keyMap[i] = y;
keyMap[i].y = p[i]
}
korzo
@korzo
Oct 31 2017 21:15
@desordi3 glad to help
Anthony DeSordi
@desordi3
Oct 31 2017 21:15
Good to know. Thanks again
korzo
@korzo
Oct 31 2017 21:21
@surya4 I'm now sure if I understand.
Maybe this?
var keyMap = {} ;
// x.length --> 3
p = [1,2,3,4];
for (var i = 0; i < p.length; i++) {
let y =  i*i;
keyMap[i] = {};
keyMap[i][y] = p[i];
}
Jimmy Van Veen
@JimmayVV
Oct 31 2017 21:22
@korzo I'm not sure this would work, as keyMap is an object, not an array. You'd want dot notation
Adel
@AdelMahjoub
Oct 31 2017 21:23
@surya4 what do you want to do
korzo
@korzo
Oct 31 2017 21:23
@JimmayVV you can't use dot notation with variable
@JimmayVV Also you can access object properties using bracket notation
a.b is the same as a['b']
Surya Singh
@surya4
Oct 31 2017 21:24
i will explain you, i have an object like hashmap concept of java, where for every dynamic key there is a dynamic value
e.g.
keymap {
819: 46,
956:67,
7883:54
}
something like this
@korzo
oh okay, @AdelMahjoub @korzo
korzo
@korzo
Oct 31 2017 21:26
@surya4 then use keymap[key] = value
I'm not sure which of i, y, p[i] is key and value
Adel
@AdelMahjoub
Oct 31 2017 21:27
@surya4 , something like this ?
const keymap = [1, 2, 3, 4].reduce((result, value, index) => {
  result[`${index}:${Math.pow(index, 2)}`] = value;
  return result;
}, {});

console.log(keymap);
/*
{ '0:0': 1, '1:1': 2, '2:4': 3, '3:9': 4 }

*/
@surya4 can you write the expected result ?
Surya Singh
@surya4
Oct 31 2017 21:29
var keyMap = {} ;
    let dbQuery;
        for (var i = 0; i < flashcardImageIds.length; i++) {
             dbQuery = db('flashcard_images').insert({
                name: flashcardImageIds[i].name,
                flashcard_id: flashcardImageNewId,
                leaf_folder_id: null,
                order: flashcardImageIds[i].order,
                image_uri: flashcardImageIds[i].image_uri,
                image_thumbnail_uri: flashcardImageIds[i].image_thumbnail_uri,
                user_id: flashcardImageIds[i].user_id,
                hidden: flashcardImageIds[i].hidden,
                created_at: createdAt,
                updated_at: createdAt
            });
            let x = flashcardImageIds[i].id;
            dbQuery.then((res) => {
                console.log(x +" <---> "+res);
                console.log(res)
                keyMap[i] = {};
                keyMap[i][x] = res;
            });
this is the original code where for every, keymap iteration i need to store, new x as key and new res as value
@AdelMahjoub its a big csv value, not any particular output i am looking for, just trrying to bind the values in key value pair
Adel
@AdelMahjoub
Oct 31 2017 21:34
@surya4 something that looks like this ?
{
  "key": {
    "id": "res"
  }
}
Surya Singh
@surya4
Oct 31 2017 21:34
yeah @AdelMahjoub
Adel
@AdelMahjoub
Oct 31 2017 21:39
@surya4 is this correct ?
const keymap = [1, 2, 3, 4].reduce((result, value, index) => {
  result[`${index}`] = {};
  result[`${index}`][`${index}:${index*index}`] = value;
  return result;
}, {});

console.log(keymap);

{ '0': { '0:0': 1 },
  '1': { '1:1': 2 },
  '2': { '2:4': 3 },
  '3': { '3:9': 4 } }
@surya4 do you have a data sample
Xapuu
@Xapuu
Oct 31 2017 21:43
Hello guys can someone help me with this React code, i have 1 char lag when confirming the primary mail https://pastebin.com/G3kxRmeF
Surya Singh
@surya4
Oct 31 2017 21:49
almost good @AdelMahjoub
yeah i have
code :
keyMap[i] = {};
                keyMap[i][x] = res;
                console.log(keyMap);
-----------------------------------------------
current outout
{ '12': { '545': [ 959 ] } }
{ '12': { '798': [ 960 ] } }
{ '12': { '799': [ 961 ] } }
{ '12': { '800': [ 962 ] } }
{ '12': { '801': [ 963 ] } }
{ '12': { '802': [ 964 ] } }
{ '12': { '803': [ 965 ] } }
{ '12': { '804': [ 966 ] } }
{ '12': { '805': [ 967 ] } }
{ '12': { '806': [ 968 ] } }
{ '12': { '807': [ 969 ] } }
{ '12': { '808': [ 970 ] } }
desired output
{  { '545': [ 959 ] }, 
{ '798': [ 960 ] },
{ '799': [ 961 ] },
{ '800': [ 962 ] },
{ '801': [ 963 ] },
{ '802': [ 964 ] },
{ '803': [ 965 ] },
{ '804': [ 966 ] },
{ '805': [ 967 ] },
{ '806': [ 968 ] },
{ '807': [ 969 ] },
{ '808': [ 970 ] } }
Surya Singh
@surya4
Oct 31 2017 22:06
its working thank you @AdelMahjoub @korzo
CamperBot
@camperbot
Oct 31 2017 22:06
surya4 sends brownie points to @adelmahjoub and @korzo :sparkles: :thumbsup: :sparkles:
:cookie: 602 | @adelmahjoub |http://www.freecodecamp.com/adelmahjoub
:cookie: 709 | @korzo |http://www.freecodecamp.com/korzo
Adel
@AdelMahjoub
Oct 31 2017 22:06
@surya4 what is the solution you used
Nick Ross
@codecampNick
Oct 31 2017 22:08
hello all! I’m trying to finish up the wiki viewer challenge. I have it working locally with VS Code but when it put he code in code pen to submit, the bootstrap offset columns isn’t working in codepen;
I’m using class="col-md-4 col-md-offset-4">
Surya Singh
@surya4
Oct 31 2017 22:09
@AdelMahjoub
keyMap = {}; keyMap[x] = res; console.log(keyMap);
i put this inside the loop
Ken Haduch
@khaduch
Oct 31 2017 22:09
@codecampNick - are you loading the proper version of Bootstrap in your CodePen pen? (Or are you loading any version, you have to do that manually in the CSS panel config options...) You have a choice of V4 or V3.
Nick Ross
@codecampNick
Oct 31 2017 22:10
hmmm, I know I have bootstrap loaded. I’ll check the version
Ken Haduch
@khaduch
Oct 31 2017 22:11
@codecampNick - make sure you are using the same version that you used on your local copy.
Nick Ross
@codecampNick
Oct 31 2017 22:11
Thanks @khaduch
CamperBot
@camperbot
Oct 31 2017 22:11
:star2: 3439 | @khaduch |http://www.freecodecamp.com/khaduch
codecampnick sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
Nick Ross
@codecampNick
Oct 31 2017 22:11
That cleaned it up for me!
Ken Haduch
@khaduch
Oct 31 2017 22:11
@codecampNick :+1:
Nick Ross
@codecampNick
Oct 31 2017 22:12
whew, I was about ready to loose my mind! I finally had a few hours to work on this and you saved me a migraine!
Ken Haduch
@khaduch
Oct 31 2017 22:16
@codecampNick - that's great - I think that it would have been somewhat difficult to debug... carry on, without a migraine! :)
Nick Ross
@codecampNick
Oct 31 2017 22:17
Will do @khaduch ! On to twitching!
artbohr
@artbohr
Oct 31 2017 22:18
ReactJS question: Is it bad to have state in several components? For example In the recipe-box project I have state in the main component and in the modal component, is it worth it to get rid of modal states and make them all in the main component and pass all through props and back?
Adel
@AdelMahjoub
Oct 31 2017 22:40
@artbohr hack the data flow of that little react app and use an event bus :hammer:
@artbohr I don't think it is bad to have stateful components, but without a state manager, if you you want two sibling childs to communicate you need to lift the state up
zootechdrum
@zootechdrum
Oct 31 2017 23:00

Hello everyone,
I am doing the arguments optional challenge in freecodecamp. I have the following code written down.

function addTogether() {
  var a = arguments[0];
  var b = arguments[1];



 if( typeof a === "number" && typeof b === "number") {
      return(a + b);   
    } else if( typeof a === "number"){
          return function (c)  {
          if(Number.isInteger(c)){
      return(a + parseInt(c) );
      } else {
        return undefined;
      }
     }; 

       }
         else if (typeof b !== "number" || typeof a !== "number"){
         return(undefined);
    }


 addTogether(2,"2");
}

I have consoled.log everything and it looks to my like it should pass. Any ideas on why its not passing the challenge. The one that is still a red “x” is when it passes the parameter (2, “3”)

when i console.log after the first if statement if returns 5 WTF?
Stephen James
@sjames1958gm
Oct 31 2017 23:04
@zootechdrum if arguments.length > 1 then you should not return a function which you probably are
alpox
@alpox
Oct 31 2017 23:04
@zootechdrum because of your else if clause you return a function in this case
zootechdrum
@zootechdrum
Oct 31 2017 23:07
@alpox that function works for parameters like (2)(2) that is why its in there
I wonder why it returns 5 when parameters (2,"2") is passed in.. how weird
alpox
@alpox
Oct 31 2017 23:07
@zootechdrum yes, i know. But you should only return a function in that case. So if you pass a second parameter like "2" you shouldnt return a function
@zootechdrum Btw. i would take out the addTogether(2,"2"); of the function. Its now still in addTogether which would cause a recursive call in some case
Stephen James
@sjames1958gm
Oct 31 2017 23:10
addTogether(2, "2") is inside the function
zootechdrum
@zootechdrum
Oct 31 2017 23:13
@alpox oh no wonder it taken a while to console.log some paramters. Shit I wish i had time to discuss this more. Thanks you everyone. I will try it again @alpox with what you suggested. I am assuming because the second argument is a string in (1, "2") its actually being executed in the first "else if" statement. Thanks! Gotta get home.
CamperBot
@camperbot
Oct 31 2017 23:13
zootechdrum sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1421 | @alpox |http://www.freecodecamp.com/alpox
alpox
@alpox
Oct 31 2017 23:15
@zootechdrum np :)
Adel
@AdelMahjoub
Oct 31 2017 23:32
@artbohr one child component emit events, the other child component listen to events an update its state
import React, { Component } from 'react';
import events from 'events';

const slumux = new events.EventEmitter();

class Controls extends Component {

    increment() {
        slumux.emit('increment');
    }
    decrement() {
        slumux.emit('decrement');
    }
    reset() {
        slumux.emit('reset');
    }
    render() {
        return (
            <div>
                <button onClick={this.increment}>Increment</button>
                <button onClick={this.decrement}>Decrement</button>
                <button onClick={this.reset}>Reset</button>
            </div>
        )
    }
}

class Counter extends Component {
    constructor(props) {
        super(props);
        this.state = {
            counter: 0
        }
    }

    increment() {
        this.setState({counter: this.state.counter + 1});
    }

    decrement() {
        this.setState({counter: this.state.counter - 1});
    }

    reset() {
        this.setState({counter: 0});
    }

    componentDidMount() {
        slumux.addListener('increment', this.increment.bind(this));
        slumux.addListener('decrement', this.decrement.bind(this));
        slumux.addListener('reset', this.reset.bind(this));
    }

    componentWillUnmount() {
        slumux.removeAllListeners();
    }
    render() {
        return <div>{this.state.counter}</div>
    }
}

class App extends Component {
  render() {
    return (
      <div>
          <Counter/>
          <Controls/>
      </div>
    );
  }
}

export default App;