These are chat archives for FreeCodeCamp/HelpFrontEnd

31st
Oct 2017
imperial-isms
@imperial-isms
Oct 31 2017 00:38
Anyone familiar with React, state changes, and DOM updates?
I’m doing the Wikipedia project in React and I’m having trouble figuring out how to update the search results
Tom
@moT01
Oct 31 2017 00:43
@imperial-isms have you narrowed anything down?
imperial-isms
@imperial-isms
Oct 31 2017 00:44
I think it has something to do with lifecycle methods
Tom
@moT01
Oct 31 2017 00:44
i see the console log there - setState runs async i think
imperial-isms
@imperial-isms
Oct 31 2017 00:45
Are you talking about?
console.log(this.state.userInput,"---",this.state.userQuery) //bug: have to click button twice for both states to equal    
  };
Tom
@moT01
Oct 31 2017 00:45
yes
you set the state right above it
imperial-isms
@imperial-isms
Oct 31 2017 00:45
Right
Tom
@moT01
Oct 31 2017 00:45
but it doesn't change the value fast enough
imperial-isms
@imperial-isms
Oct 31 2017 00:46
That’s another thing I have to account for
but, when I click the button again, the two states are in sync
It’s one click behind; so shouldn’t the new results be displayed on the second click?
Tom
@moT01
Oct 31 2017 00:48
well
im trying to look into it
Stephen James
@sjames1958gm
Oct 31 2017 00:48
@imperial-isms I don't think that componentWillMount is going to get called again as the component doesn't get unmounted
Tom
@moT01
Oct 31 2017 00:48
that's what we're hoping for i suppose
imperial-isms
@imperial-isms
Oct 31 2017 00:48
I appreciat e it
@sjames1958gm I was considering that, but how do I unmount an API call?
I’ve seen examples of unmounting with clearInterval()
…that makes sense to me
Stephen James
@sjames1958gm
Oct 31 2017 00:50
@imperial-isms
add a parameter to your requestAPI function and call it from your handleSubmit function
requestAPI = (searchQuery) => {
imperial-isms
@imperial-isms
Oct 31 2017 00:51
Thinking...
requestAPI = () => {
    let searchQuery = this.state.userQuery;
Right now it looks like that…if I pass searchQuery as a parameter, isn’t that some kind of circular
requestAPI = (searchQuery) => {
    let searchQuery = this.state.userQuery;
Stephen James
@sjames1958gm
Oct 31 2017 00:55
@imperial-isms
Pass the query value from componentWillMount as well and drop that let statement
imperial-isms
@imperial-isms
Oct 31 2017 00:56
class SearchPanel extends React.Component{
  constructor(props){
    super(props);
    this.state = {
      userInput: "",
      userQuery: "cat",
      resultList: []
    };
  };

  requestAPI = () => {
    let searchQuery = this.state.userQuery;

    $.getJSON (
      "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=&list=search&srsearch=" + searchQuery + "&callback=?", 
      (json) => {
        this.setState({
          resultList: json.query.search
        });
      }
    );
    //setTimeout( () => {console.log(this.state.resultList.length)}, 2500);    

  };
    handleChange = (event) => {
        this.setState({userInput: event.target.value})
    };  
  handleSubmit = () => {
    this.setState({userQuery: this.state.userInput});

    console.log(this.state.userInput,"---",this.state.userQuery) //bug: have to click button twice for both states to equal    
  };

  componentDidMount(){
    if (this.state.userQuery !== ""){
      this.requestAPI();
    }
  };
Pass this.state.userInput into handleSubmit?
Stephen James
@sjames1958gm
Oct 31 2017 00:58
handleSubmit = () => {
    this.setState({userQuery: this.state.userInput});
    this.requestApi(this.state.userInput);
    console.log(this.state.userInput,"---",this.state.userQuery) //bug: have to click button twice for both states to equal    
  };
 componentDidMount(){
    if (this.state.userQuery !== ""){
      this.requestAPI(this.state.userQuery);
    }
  };
imperial-isms
@imperial-isms
Oct 31 2017 01:01
Welp…that definitely works!
Thanks!
My state is still one behind, but the search results update on the first click
Thanks, @sjames1958gm !
CamperBot
@camperbot
Oct 31 2017 01:02
imperial-isms sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8634 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
imperial-isms
@imperial-isms
Oct 31 2017 01:02
I’m going to analyze your fix and understand what exactly is going on here
What’s the basic concept for what the problem was and why your solution works? I want to read abou it.
Stephen James
@sjames1958gm
Oct 31 2017 01:03
@imperial-isms When you call setState - it only queues up the state change - if you put that console.log in your render you would see it change
imperial-isms
@imperial-isms
Oct 31 2017 01:03
Ah!
Stephen James
@sjames1958gm
Oct 31 2017 01:03
@imperial-isms Since componentWIllMount was only called once you were never requesting more data.
This just requests more data when the users submits as well
imperial-isms
@imperial-isms
Oct 31 2017 01:03
Okay, so it’s not until render() when state ACTUALLY updates
Stephen James
@sjames1958gm
Oct 31 2017 01:04
Well, by the time render is called it is updated
imperial-isms
@imperial-isms
Oct 31 2017 01:04
Right
I just noticed that parameter being passed to requestAPI() is this.state.userInput instead of …userQuery
So I can actually omit …
  componentDidMount(){
    if (this.state.userQuery !== ""){
      this.requestAPI(this.state.userQuery);
    }
  };
…unless I want to pre-populate the search results on initial page rendering
Stephen James
@sjames1958gm
Oct 31 2017 01:10
@imperial-isms yes
imperial-isms
@imperial-isms
Oct 31 2017 01:15
Initially, I was changing the state of this.state.userQuerywhen the button was clicked. Since that changed the state, the app should detect that automatically…where else could I have called requestAPI() instead of handleSubmit()? — edit: without passing requestAPI() a parameter and allowing it to reference this.state.userQuery instead
I figured lifecycle hooks could be used to trigger requestAPI()
Stephen James
@sjames1958gm
Oct 31 2017 01:19
@imperial-isms I guess you could have used componentWillUpdate, but handleSubmit seems to be an appropriate place
@imperial-isms Since you are in the top level component componentWillMount is only called once
imperial-isms
@imperial-isms
Oct 31 2017 01:21
At one point, I had it working, but it was caught in an infinite loop of updating the dom with the new results. I can’t remember which hook I used, I just know it wasn’t an ideal result. I was trying to get back there to figure out why it was updating the DOM but in an infinite loop.
imperial-isms
@imperial-isms
Oct 31 2017 01:27
Sweet…got it to work with componentWillUpdate
The handleSubmit updates nextState in componentWillUpdate, which can be used to pass as a parameter to requestAPI and conditionally call requestAPI
imperial-isms
@imperial-isms
Oct 31 2017 01:36
Hey, @sjames1958gm , you still there?
I have a curious case for you...
Screen Shot 2017-10-30 at 9.36.25 PM.png
I annotated the image with the red box. Interestingly, I’m calling this.setState() via requestAPI() inside of componentWillUpdate()
Not sure if this is best practice thing, per https://reactjs.org/docs/react-component.html#componentwillupdate
Stephen James
@sjames1958gm
Oct 31 2017 01:56
@imperial-isms It may not be. I think if you called setState() from a non-async function you would get infinite calls to WillUpdate.
Possibly because you call it in the response from the API call it doesn't do that. But you would have to be careful to only call the Update
when the state has changed.
@imperial-isms If you call setState from inside of WIllUpdate - that would cause another WillUpdate which would set the state which would ....
imperial-isms
@imperial-isms
Oct 31 2017 01:57
Which actually happened already until I implemented a conditional
This makes sense now
Andres Tijera
@android094x
Oct 31 2017 02:26
Good night Guys, can anyone tell me if I should do Single Page App or Multi-Page Apps? I mean when should I use each one??
it depends on what you're building but there are pros and cons for each
Andres Tijera
@android094x
Oct 31 2017 03:50
@sunorei thank you soo much
CamperBot
@camperbot
Oct 31 2017 03:50
android094x sends brownie points to @sunorei :sparkles: :thumbsup: :sparkles:
api offline
TJ Hardin
@AndroidNinjaX
Oct 31 2017 07:01
Hey everyone! Anyone on to help me real quick. Feeling pretty dumb right now.
Markus Kiili
@Masd925
Oct 31 2017 07:04
@AndroidNinjaX You can just ask the question here.
TJ Hardin
@AndroidNinjaX
Oct 31 2017 07:05
@Masd925 Thanks. Ya wanted to make sure someone was around, saw last message was at 22:50.
CamperBot
@camperbot
Oct 31 2017 07:05
androidninjax sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4552 | @masd925 |http://www.freecodecamp.com/masd925
TJ Hardin
@AndroidNinjaX
Oct 31 2017 07:06

Anyway so my question is why is arr being modified in the following code?

function pairwise(arr, arg) {

  function push(index, stuff) {
    stuff.splice(index, 1);
    return stuff;
  }
  for (var i = 0; i < arr.length; i++) { 
    var tempArr = arr;
    var newArr = push(i, tempArr);
    console.log(arr);
    console.log("^arr");
    console.log(newArr);
    console.log("^newArr");
  }
}
pairwise([1,4,2,3,0,5], 7);

The output to that is this

[4, 2, 3, 0, 5]
^arr
[4, 2, 3, 0, 5]
^newArr
[4, 3, 0, 5]
^arr
[4, 3, 0, 5]
^newArr
[4, 3, 5]
 ^arr
[4, 3, 5]
^newArr

what I expect to happen is this

[4, 2, 3, 0, 5]
[1, 2, 3, 0, 5]
[1, 4, 3, 0, 5]
[1, 4, 2, 0, 5]
[1, 4, 2, 3, 0]
dangit
hold on not done yet
Ashwin
@ashwins93
Oct 31 2017 07:07
@AndroidNinjaX splice
TJ Hardin
@AndroidNinjaX
Oct 31 2017 07:07
Ok fixed it
arr just gets shorter every time, and I don't understand why. Im storing the modified array in var newArr
Markus Kiili
@Masd925
Oct 31 2017 07:12
@AndroidNinjaX After var tempArr = arr; both variables point to the same array (=object). If you need to make a separate copy, do var tempArr = arr.slice();
TJ Hardin
@AndroidNinjaX
Oct 31 2017 07:16
@Masd925 OMFG thank you so much. Gosh I was feeling really stupid, i have been looking at this for 2 hours
CamperBot
@camperbot
Oct 31 2017 07:16
androidninjax sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
api offline
hakanpekel
@hakanpekel
Oct 31 2017 08:31

Hi. I found this code on the internet. I changed the something but it doesn't save text file at that moment. Can anyone help me ?
<!DOCTYPE html>

<html>
<head>

<script>
function WriteToFile(passForm) {

var fso = CreateObject("Scripting.FileSystemObject");
var s = fso.CreateTextFile("C:/october.txt", True);

var firstName = document.getElementById('firstName');
var lastName = document.getElementById('lastName');

s.writeline("First Name :" + firstName);
s.writeline("Last Name :" + lastName);

s.writeline("-----------------------------");
s.Close();
}
</script>
</head>
<body>

<form onSubmit="WriteToFile(this)">
<label>Type your first name:</label>
<input type="text" name="firstName" id="firstName" size="20">

<label>Type your last name:</label>
<input type="text" name="lastName" id="lastName" size="20">

<input type="submit" value="submit">
</form>
</body>
</html>

Ghost
@ghost~56ef2a8b85d51f252ab9dec9
Oct 31 2017 09:22
@hakanpekel Hi, what did you change?
@hakanpekel I searched the web for your problem, and it seems that this code only work on IE (Internet Explorer)
hakanpekel
@hakanpekel
Oct 31 2017 09:25
I will send you older version
I cannot run IE
Html part:
<form onSubmit="WriteToFile(this)">
<label>Type your first name:</label>
<input type="text" name="FirstName" id="firstName" size="20">

<label>Type your last name: </abel>
<input type="text" name="LastName" id="lastName" size="20">

<input type="submit" value="submit">
</form>
Ghost
@ghost~56ef2a8b85d51f252ab9dec9
Oct 31 2017 09:26
Well that's why no files are created. This code will not create files if you are running Firefox, Safari or Chrome.
hakanpekel
@hakanpekel
Oct 31 2017 09:27
Javascript part:
function WriteToFile(passForm) {

    set fso = CreateObject("Scripting.FileSystemObject"); 
    set s   = fso.CreateTextFile("<your Path>/filename.txt", True);

    var firstName = document.getElementById('FirstName');
    var lastName  = document.getElementById('lastName');

    s.writeline("First Name :" + FirstName);
    s.writeline("Last Name :" + lastName);

    s.writeline("-----------------------------");
    s.Close();
 }
I'm using IE but it didn't create a text file
Ghost
@ghost~56ef2a8b85d51f252ab9dec9
Oct 31 2017 09:28
Do you have the ActiveX plugin?
hakanpekel
@hakanpekel
Oct 31 2017 09:30
I'm downloading activex plugin for IE
I looked at your url and also i didn't run your url
hakanpekel
@hakanpekel
Oct 31 2017 09:39
Did u run on your computer. Is ıt running ?
Ghost
@ghost~56ef2a8b85d51f252ab9dec9
Oct 31 2017 09:39
I don't run IE so I don't know
But the URL is good
hakanpekel
@hakanpekel
Oct 31 2017 09:40
If u have a time can able to run IE my code older and new version
Ghost
@ghost~56ef2a8b85d51f252ab9dec9
Oct 31 2017 09:42
I can't I'm running macOS
hakanpekel
@hakanpekel
Oct 31 2017 09:44
Ovv how can i execute this code. I don't understand why this code isn't running
Prateek Dabas
@dprateek11
Oct 31 2017 09:54
does anyone know git here
Ghost
@ghost~56ef2a8b85d51f252ab9dec9
Oct 31 2017 10:01
@hakanpekel Honestly I don't know and I can't really help you on that one as I don't have anything to verify
@dprateek11 Yes, basic git
hakanpekel
@hakanpekel
Oct 31 2017 10:04
@thomlom thanks for your help
CamperBot
@camperbot
Oct 31 2017 10:04
hakanpekel sends brownie points to @thomlom :sparkles: :thumbsup: :sparkles:
:cookie: 499 | @thomlom |http://www.freecodecamp.com/thomlom
Tiago Correia
@tiagocorreiaalmeida
Oct 31 2017 11:04
anyone here used the yelp api?
Alvaro
@minutazos
Oct 31 2017 11:54
hi, if someone can help me, i would be very grateful. I've first coded the web on html and it displays okay, but when I translate to php, it doesn't work. I've done it with bootstrap, and there is a row with two cols. In html the second col fits all the row height, but in php, the second col only fits to half the height. I've tried to fix it with a display table or margins and paddings, but it doesn't work.... and the html that generates the php file is exactly the same than the original html file... anyone knows why this happens?
Tiago Correia
@tiagocorreiaalmeida
Oct 31 2017 12:09
can I see the atual code?
Ashwin
@ashwins93
Oct 31 2017 12:17
I just took a look at the FCC beta course, is it possible for me to shift to the beta course once it goes live? Does anyone know about that? Should i have to redo the projects that i already did in the old scheme?
korzo
@korzo
Oct 31 2017 12:25
@ashwins93 according to forum post, progress will be preserved.
Ashwin
@ashwins93
Oct 31 2017 12:26
@korzo that is nice
Deepak
@Deepak-1111
Oct 31 2017 13:43
Anyne online?
urgent helpo
Markus Kiili
@Masd925
Oct 31 2017 13:43
@Deepak-1111 You can just post the question you have here.
Deepak
@Deepak-1111
Oct 31 2017 13:50
Is there anyting to remove unused css files?
@Masd925 Is there anyting to remove unused css files?
Tiago Correia
@tiagocorreiaalmeida
Oct 31 2017 13:51
what's an unused css file?
Deepak
@Deepak-1111
Oct 31 2017 13:51
@tiagocorreiaalmeida Thats an unwanted css files
can you take teamviewer remote of my pc please?
Tiago Correia
@tiagocorreiaalmeida
Oct 31 2017 13:51
youy shouldnt let people do remote desktop of your computer if you dont know them
print and show me
Deepak
@Deepak-1111
Oct 31 2017 13:52
@tiagocorreiaalmeida Problem is that. I have website. which consits lots of unwanted css files
I just need an idea how to remove those
Rodney Guillen
@infrony
Oct 31 2017 13:52
Deepak
@Deepak-1111
Oct 31 2017 13:54
@infrony In my website project. There are lots of unused .css files & .js. Does anyone have idea how to remove or clean up those unwanted files.?
@infrony That i tried it beofre. but doestn work brother
@infrony I have lots of .css files & many .html
Rodney Guillen
@infrony
Oct 31 2017 13:57
@Deepak-1111 what is your editor?
Deepak
@Deepak-1111
Oct 31 2017 13:58
ecllipse php
@infrony Ecllipse PHP brother
Rodney Guillen
@infrony
Oct 31 2017 14:00
@Deepak-1111 and if you try this https://github.com/geuis/helium-css
Deepak
@Deepak-1111
Oct 31 2017 14:01
@infrony Let me try bro
Bro can you take my remote?
pLease
@infrony Please can you take my remote?
Teo
@Teo03
Oct 31 2017 14:26
Can someone take a look at my code to see where I am wrong?
https://codepen.io/Teo03/pen/NwWKVm
Kaz Baig
@kbaig
Oct 31 2017 14:27
@Teo03 what are you trying to fix specifically
dig that font btw
Teo
@Teo03
Oct 31 2017 14:27
@kbaig Anywhere I click it says game over
BlackDrozd
@BlackDrozd
Oct 31 2017 14:29
hi
Teo
@Teo03
Oct 31 2017 14:30
@kbaig Can you please help?
Kaz Baig
@kbaig
Oct 31 2017 14:31
@Teo03 Looking now :)
Teo
@Teo03
Oct 31 2017 14:32
@kbaig WOW I solved it it was in the checkGameOver function I've typed '' instead of ' '
but its very slow
Kaz Baig
@kbaig
Oct 31 2017 14:35
@Teo03 Well one problem you have is that in your win checking function, you're doing logic saying if cell !== '' when your blank cells are actually ' '
but that won't fix it on its own
well it does actually but
you have a million loops
Kaz Baig
@kbaig
Oct 31 2017 15:38
@Teo03 I'm still working on it but you might be interested in looking at the win check helper at the bottom https://codepen.io/kbaig/pen/eemQEJ?editors=0010
Prateek Dabas
@dprateek11
Oct 31 2017 15:40
hi
can anybody tell me how to get my code from git
i can see files in git checkout
Kaz Baig
@kbaig
Oct 31 2017 15:41
@dprateek11 what do you mean by get
if you're checking it out, your code is that of the branch
Prateek Dabas
@dprateek11
Oct 31 2017 15:42
and also my authorization has been revoked from the master
@kbaig i want to get the files which are shown in git checkout
@kbaig my repository doesn't have those files
Roge
@RogeMateos
Oct 31 2017 16:51
Hello i need some help with a navigation with icons anyone can give me a hand please
Prateek Dabas
@dprateek11
Oct 31 2017 16:53
hello i need some help with git
hallowcard13
@hallowcard13
Oct 31 2017 16:54
@RogeMateos can you show what are you currently working ?
Roge
@RogeMateos
Oct 31 2017 16:55
Screen Shot 2017-10-31 at 17.50.43.png
just this navigation with icons
Prateek Dabas
@dprateek11
Oct 31 2017 16:55
@hallowcard13 can you help with git
hallowcard13
@hallowcard13
Oct 31 2017 16:55
@dprateek11 try to use git pull
Prateek Dabas
@dprateek11
Oct 31 2017 16:56
@hallowcard13 i don't have autharization
hallowcard13
@hallowcard13
Oct 31 2017 16:57
@RogeMateos that will be easy if you have the icons already
@dprateek11 why not ? I thought its yours
Roge
@RogeMateos
Oct 31 2017 16:59

i have the icons already

i have them alrady

<nav class="main-nav">
<ul class="main-menu">
<li class=main-menu__item><a href="#" class="main-menu__link">Compra Online</a><li>

    </ul>

</nav>
wondering what is the best way to add the icons, wih a clean code

perhaps using background?

how i attach the icons ? perhaps background?
hallowcard13
@hallowcard13
Oct 31 2017 17:04
well i can say you can use them as it is like using <img> tag or you use this website to convert your icons into font just like fontawesome https://icomoon.io/app/#/select
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:09
hi all
var myStr = "\"Firstline\"\n\"\"Secondline\"\r\"Thirdline\"";
136
any issue with that
?
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:09
@RogeMateos the easy way to insert icons is as individual images, using the img tag. You can include the text descriptions in the images themselves, or have them render in the page
Roge
@RogeMateos
Oct 31 2017 17:10
<nav class="main-nav">
<ul class="main-menu">
<li class=main-menu__item><a href="#" class="main-menu__link">Compra Online</a><li>


</ul>
</nav>
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:10
@kutagullasukumar what does '136' represent?
Roge
@RogeMateos
Oct 31 2017 17:10
so do you think adding img in each link would do the trick
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:10
136th assignment
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:12

@RogeMateos

<nav class="main-nav">
<ul class="main-menu">
<li class=main-menu__item><a href="#" class="main-menu__link"><img src="./path/to/image"> Compra Online</a><li>


</ul>
</nav>

is certainly a simple solution, and simple is usually best

Roge
@RogeMateos
Oct 31 2017 17:12
and then using flex box i suppose
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:12
@RogeMateos but if you have other needs like a responsive design, or the like, then other options might be desireable
@RogeMateos you have a straight in-line menu here, I think you'd be best making the icons a set size as each other, and rely on this consistency to remove the need for flexbox (you can just use primitive div's and li's)
Roge
@RogeMateos
Oct 31 2017 17:15
ok if i used the images with flex box i think would be better for mobile
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:16
@RogeMateos yes, perhaps. Do you have any need for legacy browser support? If not, then sure, if you're comfortable with it
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:17
var myStr = "\"Firstline\"\n\"\"Secondline\"\r\"Thirdline\"";
Roge
@RogeMateos
Oct 31 2017 17:17
ok many thanks
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:19
@kutagullasukumar I'm not sure how to translate assignment #136 into FCC's algorithm challenge names - I might be missing something, do you happen to have the name of the assignemnt?
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:23
forget about 136
my topic is Escape Sequences in Strings
var myStr = "\"Firstline\"\n\"\"Secondline\"\r\"Thirdline\"";
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:24
aside from the fact you are interchanging newline with carriage return, I don't see anything "wrong" with that var
sorry
I just re-read that topic
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:25
@JimmayVV ok
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:26
one sec
@kutagullasukumar you don't need the quotes, you are printing quotes that you don't need
then, you need to actually output a literal \, which you naturally need to escape as '\'
@kutagullasukumar (you only need the very first ", and the very last ", and that's it)
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:28
@JimmayVV var myStr = "\'Firstline\'\n\'\'Secondline\'\r\'Thirdline\'";
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:29

you don't want the single quotes either.

In this case you are outputting

'Firstline'
''Secondline'
'Thirdline'

and you need

Firstline
\Secondline\
Thirdline

you just need the first double quote, the last double quote, and that's it
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:30
@JimmayVV var myStr = '"Firstline"\n\"\"Secondline\"\r"Thirdline"';
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:31

@kutagullasukumar this isn't the final answer, but this will get you closer:

var myStr = "Firstline\nSecondline\rThirdline";

(I removed the extra quotation marks you don't need)
the missing piece you need is to find a way to output the \ symbol (\)
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:33
no it is also wrong
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:34
@kutagullasukumar I know it's wrong, like I said that wasn't the final answer, just a nudge in the right direction
Prateek Dabas
@dprateek11
Oct 31 2017 17:35
@hallowcard13 i worked with someone now he has revoked my access
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:35

@kutagullasukumar

var myStr = "Firstline\nSecondline\rThirdline";

you just need to add the escape chars in order to get the second line to read \Secondline\

Prateek Dabas
@dprateek11
Oct 31 2017 17:35
@JimmayVV can u help me with git
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:36

because right now var myStr = "Firstline\nSecondline\rThirdline"; will output:

Firstline
Secondline
Thirdline

(notice, missing the \ symbols) - so it's close

@dprateek11 I might be able to, what's up? :)
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:39
@JimmayVV no still wrong it is showing
trying
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:40
@kutagullasukumar \\ is how you output a backslash - so you need to add that in twice both before and after Secondline to get it to output correctly
\\Secondline\\ (in addition to all the other stuff)
BuntyBru
@BuntyBru
Oct 31 2017 17:41
hi
everyone
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:42
@JimmayVV : var myStr = 'Firstline\n"\\"Secondline"\\"\rThirdline';/
still showiing one error
myStr should have encoded text with the proper escape sequences and no spacing.
the above error
nowhere spaces are there
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:43
@kutagullasukumar getting closer, but you still have way too many quotes. You should have zero single quotes, and it should start and end with a double quote
when you start with a single quote, nothing gets escaped. So \n gets printed literally, not "new line" like it wants. That's why you need "
@kutagullasukumar so if you go back to var myStr = "Firstline\nSecondline\rThirdline"; you only need to add \\ a couple of times (where the assignments asks for it, just before, and just after Secondline)
@kutagullasukumar you will end up with 3 \'s in a row, as a result (\\\r)
@kutagullasukumar ...the reason being that the first two (\\) turns into a single \, and the \r turns into a carriage return
@kutagullasukumar ... so \\\r turns into \ & carriage return
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:48
var myStr = "Firstline\n\\'Secondline'\\\rThirdline";
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:48
@kutagullasukumar 99.999% right. Just delete the single quotes
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:49
var myStr = "Firstline\n\\Secondline\\\rThirdline";
still wrong
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:49
@kutagullasukumar like I said, zero single quotes at all '
var myStr = "FirstLine\n\\SecondLine\\\rThirdLine"; is wrong for you? That works for me on that one
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:50
but here it is showing wrong
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:50
oooh
your casing is wrong
@kutagullasukumar l in 'line' needs to be capitalized
FirstLine not Firstline, SecondLine not Secondline
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:51
@JimmayVV : oops i misspelled line instead of cap L
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:51
yup
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:51
now its correct
shilpi verma
@shilpiverma509
Oct 31 2017 17:51
Hey guys how can I allow a Weather Api through Chrome's Content Security Policy?
The error I get is "Refused to load the script 'https://api.darksky.net/forecast/Key/lat,lng?callback=jQuery32107268624429256194_1509471971932&_=1509471971933' because it violates the following Content Security Policy directive: "script-src 'self' https://ajax.googleapis.com".
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:51
@kutagullasukumar awesome
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:51
@JimmayVV :clap:
Thanks so much
i really appreciate your support
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:52
@kutagullasukumar you're welcome :) glad to help. Hope that solution makes sense to you as you look at it
shilpi verma
@shilpiverma509
Oct 31 2017 17:52
My code in manifest.json is
"permissions": [
"tabs",
"storage",
"geolocation",
"https://api.darksky.net/forecast/"
],
"chrome_url_overrides":{
"newtab" : "index.html"
},
"content_scripts":[
{
"matches":["https://*/*","http://*/*"],
"css":["styles.css"],
"js":["quote.js"]
}
],
"content_security_policy": "script-src 'self' https://ajax.googleapis.com; 'unsafe-eval'; object-src 'self'"
kutagullasukumar
@kutagullasukumar
Oct 31 2017 17:54
@JimmayVV yep
Jimmy Van Veen
@JimmayVV
Oct 31 2017 17:55
@shilpiverma509 this is probably caused by a http / https conflict. If you call an https API from an http URL, then it won't work
so if you go to CodePen for it, make sure you are using an https connection
shilpi verma
@shilpiverma509
Oct 31 2017 18:07
@JimmayVV I'm not working on codepen .
Jimmy Van Veen
@JimmayVV
Oct 31 2017 18:12
that might be why. Are you working from localhost? Regardless, if you are accessing it from anything other than an HTTPS connection, Chrome will block it
shilpi verma
@shilpiverma509
Oct 31 2017 18:22
@JimmayVV I got it working. I had to include the weather api in the content-scripts also
"content_security_policy": "script-src 'self' https://ajax.googleapis.com https://api.darksky.net/forecast/; 'unsafe-eval'; object-src 'self'"
Jimmy Van Veen
@JimmayVV
Oct 31 2017 18:25
@shilpiverma509 sweet! thanks for the update, glad you got it working
CamperBot
@camperbot
Oct 31 2017 18:25
jimmayvv sends brownie points to @shilpiverma509 :sparkles: :thumbsup: :sparkles:
:cookie: 300 | @shilpiverma509 |http://www.freecodecamp.com/shilpiverma509
shilpi verma
@shilpiverma509
Oct 31 2017 18:27
:+1:
Domantas
@domaantas
Oct 31 2017 18:32
Hello, I'm starting my web dev journey and I was wondering, when making websites, should I learn how to do them with pure html/css first and only then learn Bootstrap, for example?
Kaz Baig
@kbaig
Oct 31 2017 18:39
@domaantas Probably a good idea to slowly learn them together initially, and then decide if you want to drop boostrap or not. Reason is that boostrap will make the learning process easier, and bootstrap will make more sense as you learn more html/css/js
One makes learning the other easier but only if you improve at both at a somewhat equal pace
Domantas
@domaantas
Oct 31 2017 18:40
@kbaig yeah, i decided to make a random project for myself now and I know that I could just paste the bootstrap code for the navbar and I would get a sweet nav, but I see that I'm struggling to do that with pure CSS, so I suppose I should spend more time on it first
Trommelochse
@Trommelochse
Oct 31 2017 18:41
@domaantas If you have literally no knowledge at all, I would practice layouts with pure HTML/CSS. When you then feel that you can do quite some things, and just want to 'GET THINGS DONE', - layout wise - then you can start learning bootstrap. You will also learn bootstrap much faster, when you already have an ok understanding of how HTML and CSS work together
Kaz Baig
@kbaig
Oct 31 2017 18:41
@Trommelochse @domaantas agree in that you should use one to learn the other, and vice versa
Trommelochse
@Trommelochse
Oct 31 2017 18:42
@domaantas in general you should never copy-paste code that you don't understand (we've all done it, but it doesn't bring you anywhere)
Domantas
@domaantas
Oct 31 2017 18:43
okay, thanks :)
Trommelochse
@Trommelochse
Oct 31 2017 18:43
obviously, I don't fully KNOW how the Bootstrap nav works (especially including the JS part) - but I am confident, that I would understand if I would put some effort into looking at the code
Domantas
@domaantas
Oct 31 2017 18:45
also, what kind of learning sources are recommended along with FCC? i'm currently watching The Web Developer's Bootcamp by Colt Steele, and I'm considering Team Treehouse as well
Trommelochse
@Trommelochse
Oct 31 2017 18:47
@domaantas I find youtube videos very helpful - I would check out the DevTips channel
he has very good videos for beginner and intermediate stage (HTML and CSS, mostly)
Domantas
@domaantas
Oct 31 2017 18:48
@Trommelochse I will check them out. One more question, should I be using CSS resets?
Trommelochse
@Trommelochse
Oct 31 2017 18:49
@domaantas if you are not using bootstrap, then I would recommend normalize.css - you don't want any padding on your body tag
Domantas
@domaantas
Oct 31 2017 18:49
@Trommelochse thanks a lot
CamperBot
@camperbot
Oct 31 2017 18:49
domaantas sends brownie points to @trommelochse :sparkles: :thumbsup: :sparkles:
:cookie: 339 | @trommelochse |http://www.freecodecamp.com/trommelochse
Trommelochse
@Trommelochse
Oct 31 2017 18:50
de nada :)
Xapuu
@Xapuu
Oct 31 2017 21:17
Hello guys, can someone help me with some React reactive form validation , when i do my validation check im entering infinie loop
Richard
@rylew0925
Oct 31 2017 21:40
Would someone please explain to me a particular lesson I'm working on?

Finally, the second parameter of repeat() can have multiple values.

This code will create four columns where the first and third columns will be 20 pixels wide and the second and fourth will be 50 pixels wide.

grid-template-columns: repeat(2, 20px 50px)
How are there four columns if the value is only 2?
alpox
@alpox
Oct 31 2017 22:01
@Xapuu Do you validate with a library or your own logic?
Xapuu
@Xapuu
Oct 31 2017 22:01
@alpox im trying with my own logic
alpox
@alpox
Oct 31 2017 22:02
@Xapuu Can you show the validation code so we could investigate the infinite loop?
Stephen James
@sjames1958gm
Oct 31 2017 22:58
@rylew0925 The repeat is two so the result is 20px 50px 20px 50px so 1st and 3rd get 20px and 2nd and 4th get 50px