These are chat archives for FreeCodeCamp/Help

24th
Oct 2017
Waterkid123012
@Waterkid123012
Oct 24 2017 00:48
can someone help me with java loops?
int total=0;
for(int s=1; s<15; s++)
{
total=total+s;
} out.println(total);
Coy Sanders
@coymeetsworld
Oct 24 2017 01:11
out.println(total); that line isn't finished @Waterkid123012
Waterkid123012
@Waterkid123012
Oct 24 2017 01:14
yes someone told me that
Albert Cardona II
@daddycardona
Oct 24 2017 01:23
what are you trying to do with it? @Waterkid123012
Waterkid123012
@Waterkid123012
Oct 24 2017 01:23
@daddycardona im learning how to do java
@daddycardona other people in the chat help me so im good
Albert Cardona II
@daddycardona
Oct 24 2017 01:24
okay I was just wanting to know what was you trying to do with the println statement
Waterkid123012
@Waterkid123012
Oct 24 2017 01:25
i kind of made a mistake i should have puted the system.out.println
Albert Cardona II
@daddycardona
Oct 24 2017 01:27
oh okay I was just wondering because people say that and they might need to put console.log('stuf in here') or document.write('stuff in here')
Moisés Man
@moigithub
Oct 24 2017 01:28
he asking about java NOT javascript
Albert Cardona II
@daddycardona
Oct 24 2017 01:28
oooohhhhhh LOL my bag LOL
and he wrote java and I still interpret that as javascript where is my brain : )
@moigithub just smack me bro
:clap: pretend that is you smacking me lol
Manish Giri
@Manish-Giri
Oct 24 2017 02:06
@heroiczero @DarrenfJ @khaduch @daddycardona @GitHub-Henry @thekholm80 my ty as usual :star: :cookie:
CamperBot
@camperbot
Oct 24 2017 02:06
manish-giri sends brownie points to @heroiczero and @darrenfj and @khaduch and @daddycardona and @github-henry and @thekholm80 :sparkles: :thumbsup: :sparkles:
:cookie: 409 | @daddycardona |http://www.freecodecamp.com/daddycardona
:cookie: 410 | @github-henry |http://www.freecodecamp.com/github-henry
:star2: 2171 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 1931 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 3399 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1531 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Kyle Holm
@thekholm80
Oct 24 2017 02:11
@Manish-Giri ty
CamperBot
@camperbot
Oct 24 2017 02:11
thekholm80 sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6681 | @manish-giri |http://www.freecodecamp.com/manish-giri
Albert Cardona II
@daddycardona
Oct 24 2017 02:15
thanks @Manish-Giri
CamperBot
@camperbot
Oct 24 2017 02:15
daddycardona sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6682 | @manish-giri |http://www.freecodecamp.com/manish-giri
Albert Cardona II
@daddycardona
Oct 24 2017 02:15
done for the night :) good night yall
Henry
@GitHub-Henry
Oct 24 2017 02:18
@daddycardona gn
@Manish-Giri hello, and ty for the brownies
CamperBot
@camperbot
Oct 24 2017 02:18
github-henry sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6683 | @manish-giri |http://www.freecodecamp.com/manish-giri
Ken Haduch
@khaduch
Oct 24 2017 04:01
@Manish-Giri - thanks for the thanks, and thanks!
CamperBot
@camperbot
Oct 24 2017 04:01
khaduch sends brownie points to @manish-giri :sparkles: :thumbsup: :sparkles:
:star2: 6684 | @manish-giri |http://www.freecodecamp.com/manish-giri
heroiczero
@heroiczero
Oct 24 2017 04:02
@daddycardona @thekholm80 @GitHub-Henry @DarrenfJ @khaduch @Manish-Giri TY for helping :)
CamperBot
@camperbot
Oct 24 2017 04:02
heroiczero sends brownie points to @daddycardona and @thekholm80 and @github-henry and @darrenfj and @khaduch and @manish-giri :sparkles: :thumbsup: :sparkles:
:cookie: 411 | @github-henry |http://www.freecodecamp.com/github-henry
:cookie: 410 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 1532 | @thekholm80 |http://www.freecodecamp.com/thekholm80
:star2: 2172 | @darrenfj |http://www.freecodecamp.com/darrenfj
:star2: 3400 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 6685 | @manish-giri |http://www.freecodecamp.com/manish-giri
Henry
@GitHub-Henry
Oct 24 2017 04:06
@heroiczero hello, ty for the brownies
CamperBot
@camperbot
Oct 24 2017 04:06
github-henry sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1932 | @heroiczero |http://www.freecodecamp.com/heroiczero
Ken Haduch
@khaduch
Oct 24 2017 13:46
@heroiczero - greetings, and thanks for the effort to keep the chats going!
CamperBot
@camperbot
Oct 24 2017 13:46
khaduch sends brownie points to @heroiczero :sparkles: :thumbsup: :sparkles:
:star2: 1933 | @heroiczero |http://www.freecodecamp.com/heroiczero
gishy1
@gishy1
Oct 24 2017 14:08
hello world need help
image.png
gishy1
@gishy1
Oct 24 2017 14:15
its giving me object object
Stephen James
@sjames1958gm
Oct 24 2017 14:19
hmm don't see anything wrong. Can you post the actual code here not a picture.
https://forum.freecodecamp.com/t/markdown-code-formatting/18391
Dylan
@dhcodes
Oct 24 2017 14:23
@gishy1 I'm not sure you can reassign lower[i] within the loop
may need to make a new variable outside the loop and assign it to first and second within the loop
not sure though... @sjames1958gm is the pro
Stephen James
@sjames1958gm
Oct 24 2017 14:24
@dhcodes It's just an array - replacing a string with another string.
Dylan
@dhcodes
Oct 24 2017 14:24
ah
true, i said i'm not sure for a reason
lol
Stephen James
@sjames1958gm
Oct 24 2017 14:25
@dhcodes I entered this code into the challenge and it passes. Not sure what is happening with that [object object]
gishy1
@gishy1
Oct 24 2017 14:25
@dhcodes either way thanks bro
CamperBot
@camperbot
Oct 24 2017 14:25
gishy1 sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star2: 1852 | @dhcodes |http://www.freecodecamp.com/dhcodes
Stephen James
@sjames1958gm
Oct 24 2017 14:25
@dhcodes :)
Dylan
@dhcodes
Oct 24 2017 14:25
well then
carry on
i'll be good at js someday
circa 2030. right around the time js moves on
Stephen James
@sjames1958gm
Oct 24 2017 14:25
@dhcodes "not sure" is a good state to maintain.
Dylan
@dhcodes
Oct 24 2017 14:25
is it?
lol
Stephen James
@sjames1958gm
Oct 24 2017 14:26
I think so.
I am often not sure - the devtools console is my backup :)
Dylan
@dhcodes
Oct 24 2017 14:31
well glad to hear i'm not the only one
Kaz Baig
@kbaig
Oct 24 2017 14:32
@gishy1 A more advanced answer if you're interested:
// jshint esversion:6
function titleCase(str) {
  return str
    .split(' ')
    .map(w => {
    const arr = w.split('').map(l => l.toLowerCase());
    return [arr[0].toUpperCase(), ...arr.slice(1)].join('');
  })
    .join(' ');
}
gishy1
@gishy1
Oct 24 2017 14:34
@kbaig na bro i need to first get the basics then I will work on more advanced answers
Kaz Baig
@kbaig
Oct 24 2017 14:36
@kbaig No worries! Do try to understand map/filter/reduce as you progress. They make life a lot easier
gishy1
@gishy1
Oct 24 2017 14:39
@kbaig i will bro thanks !!
CamperBot
@camperbot
Oct 24 2017 14:39
gishy1 sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 370 | @kbaig |http://www.freecodecamp.com/kbaig
gishy1
@gishy1
Oct 24 2017 14:48
@sjames1958gm @dhcodes @kbaig thanks bros ive worked something out.
CamperBot
@camperbot
Oct 24 2017 14:48
gishy1 sends brownie points to @sjames1958gm and @dhcodes and @kbaig :sparkles: :thumbsup: :sparkles:
api offline
api offline
:star2: 8606 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
alpox
@alpox
Oct 24 2017 15:15
@kbaig Using .replace you can make this a bit shorter :-)
huynhmatt
@huynhmatt
Oct 24 2017 15:16
Good morning, folks. I am trying to write a code that downloads files from a URL and throws it into a folder. Right now, it goes to the URL, downloads the file, but deletes and remakes the folder to put in another file and repeats until all files are done. I want it to have all the files in a single folder. I believe the placement of FileOutputStream in the For loop is the cause, but when I put it outside it causes Windows to through a .zip invalid error. Any ideas?
        for (int i = 0; i < address.length; i++) {
            URL url = new URL(address[i]);
            BufferedInputStream bis = new BufferedInputStream(url.openStream());
            FileOutputStream fis = new FileOutputStream(file);
            System.out.println("Downloading from " + address[i]);
            byte[] buffer = new byte[1024];
            int count = 0;
            while ((count = bis.read(buffer, 0, 1024)) != -1) {
                fis.write(buffer, 0, count);
            }
                fis.close();
                bis.close();
        }
Kaz Baig
@kbaig
Oct 24 2017 15:19
@alpox I was looking for a way to replace but couldn't find it. Forgot String.replace can take a substring instead of regex
alpox
@alpox
Oct 24 2017 15:31
@kbaig actually you need a regex in this case
Kaz Baig
@kbaig
Oct 24 2017 15:38
@alpox why can't I just do s.replace(s[0], s[0].toUpperCase())
alpox
@alpox
Oct 24 2017 15:39
@kbaig becazse that gives you only the first letter of the string in uppercase and not all word beginnings
Kaz Baig
@kbaig
Oct 24 2017 15:40
@alpox of course, but i can separate the string into an array of words and map each word
alpox
@alpox
Oct 24 2017 15:40
And also, all occurrences of the character at the beginning of the string would be put in uppercase. Like every s would become S in the whole string
Kaz Baig
@kbaig
Oct 24 2017 15:40
@alpox String.replace with a substring only affects the first occurrence
alpox
@alpox
Oct 24 2017 15:41
This would also happen if you split it in an array of words. Lets say you have the word "sister" which would become "SiSter"
Ah right @kbaig wasnt aware of that
You can do that then, but you would still have to split the array and put it together again
The challenge is possible with only a replace call though :D
Kaz Baig
@kbaig
Oct 24 2017 15:42
@alpox yeah I'd prefer that over straight up regex but it is possible to just do regex
@alpox not that I work with a team of devs but if I did, I'd imagine it's better to do it without regex in this case so that others can quickly read what it's doing. Perhaps that can also just be achieved by giving the function a descriptive name in this case. I suppose you could argue either way
alpox
@alpox
Oct 24 2017 15:46
@kbaig may be the case if the regex was complicated. Its really simple enough that any dev should be able to read it
Kaz Baig
@kbaig
Oct 24 2017 15:46
@alpox Besides garbage recent self-taught ones like myself :)
alpox
@alpox
Oct 24 2017 16:27
@kbaig
function titleCase(str) {
  return str.toLowerCase().replace(/( |^)./g, m => m.toUpperCase());
}
@kbaig I believe you can read that too :D
Kaz Baig
@kbaig
Oct 24 2017 16:53
@alpox honestly, I would have to look up the chars to figure out what it means
@alpox So this would be capture the character, so long as it is not a newline, if it is preceded by a space or it is the beginning of the string
and the g flag means find all instead of just the first occurrence
Kaz Baig
@kbaig
Oct 24 2017 16:59
But I thought it was only supposed to capture what is wrapped around the parentheses? It's capturing what is not in the paren here
alpox
@alpox
Oct 24 2017 17:03
@kbaig It captures just all whitespace or line begins together with a random character following
I just take the whole thing - the character together with the line begin or whitespace and upper-case it in-place
Kaz Baig
@kbaig
Oct 24 2017 17:04
I see that now. But when there are paren, isn't it only the paren that's supposed to be captured?
Darren
@DarrenfJ
Oct 24 2017 17:13
morning fCC
Kyle Holm
@thekholm80
Oct 24 2017 17:13
@DarrenfJ :wave:
Darren
@DarrenfJ
Oct 24 2017 17:13
@thekholm80 buddy! :D
also my usual thank yous...
thanks @daddycardona @thekholm80 @GitHub-Henry @khaduch @Manish-Giri @heroiczero @sjames1958gm
CamperBot
@camperbot
Oct 24 2017 17:14
darrenfj sends brownie points to @daddycardona and @thekholm80 and @github-henry and @khaduch and @manish-giri and @heroiczero and @sjames1958gm :sparkles: :thumbsup: :sparkles:
:cookie: 413 | @github-henry |http://www.freecodecamp.com/github-henry
:cookie: 411 | @daddycardona |http://www.freecodecamp.com/daddycardona
:star2: 8607 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
:star2: 6687 | @manish-giri |http://www.freecodecamp.com/manish-giri
:star2: 3401 | @khaduch |http://www.freecodecamp.com/khaduch
:star2: 1936 | @heroiczero |http://www.freecodecamp.com/heroiczero
:star2: 1533 | @thekholm80 |http://www.freecodecamp.com/thekholm80
Darren
@DarrenfJ
Oct 24 2017 17:14
definitely NOT thank you to @dhcodes ;)
CamperBot
@camperbot
Oct 24 2017 17:14
darrenfj sends brownie points to @dhcodes :sparkles: :thumbsup: :sparkles:
:star2: 1853 | @dhcodes |http://www.freecodecamp.com/dhcodes
Kyle Holm
@thekholm80
Oct 24 2017 17:14
rofl
DarrenfJ @DarrenfJ loves a running joke
Kyle Holm
@thekholm80
Oct 24 2017 17:14
@DarrenfJ ty
CamperBot
@camperbot
Oct 24 2017 17:14
:star2: 2173 | @darrenfj |http://www.freecodecamp.com/darrenfj
thekholm80 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
Henry
@GitHub-Henry
Oct 24 2017 17:15
@DarrenfJ hello, and ty for the brownies
CamperBot
@camperbot
Oct 24 2017 17:15
github-henry sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2174 | @darrenfj |http://www.freecodecamp.com/darrenfj
Darren
@DarrenfJ
Oct 24 2017 17:17
:D
alpox
@alpox
Oct 24 2017 17:22
@kbaig captured, yes. But MATCHED is always the whole, well, from the regex matched range. In the replacement function you get as first argument the whole match and the rest of the arguments would be the capture groups. I ignored them because i didnt need them. I only put a group there for giving the "or" a scope
Meaning the piping
Kaz Baig
@kbaig
Oct 24 2017 17:29
@alpox gotcha thanks for the breakdown
CamperBot
@camperbot
Oct 24 2017 17:29
kbaig sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:star2: 1392 | @alpox |http://www.freecodecamp.com/alpox
Momozor
@momozor
Oct 24 2017 18:23
@alpox Alright, thanks for the explanation.
CamperBot
@camperbot
Oct 24 2017 18:23
:star2: 1393 | @alpox |http://www.freecodecamp.com/alpox
faraco sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
Eunice Park
@eunicode
Oct 24 2017 19:44

Has anyone ever had problems adding SCSS to create-react-app? I followed the instructions in the CRA docs, but I basically get this error whenever I try to save a scss file.

=> changed: project\styles\sass\styles.scss
{
"status": 3,
"message": "File to read not found or unreadable: project/styles/sass/styles.scss",
"formatted": "Internal Error: File to read not found or unreadable: project/styles/sass/styles.scss\n"
}

I found threads like this:
sass/node-sass#1894
michaelwayman/node-sass-chokidar#14

Dylan
@dhcodes
Oct 24 2017 20:11
thanks but no thanks @DarrenfJ
CamperBot
@camperbot
Oct 24 2017 20:11
dhcodes sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2175 | @darrenfj |http://www.freecodecamp.com/darrenfj
Eunice Park
@eunicode
Oct 24 2017 21:14
@kbaig yep
Kaz Baig
@kbaig
Oct 24 2017 21:16
@eunipa hmm. I was actually looking into this last night. Will get back to you if/when I have it working tonight
Eunice Park
@eunicode
Oct 24 2017 21:21
@kbaig I don't know if you're getting the same error as me, but I think mine is caused by my hard drive being slow at writing
Long Nguyen
@longnt80
Oct 24 2017 23:09
@eunipa I did have that error in one of my project, not sure how to fix though
I also used the same setup for another project which I never had that error
Kaz Baig
@kbaig
Oct 24 2017 23:26
@eunipa just did it and it seems to be working fine for me :/
Long Nguyen
@longnt80
Oct 24 2017 23:44
@kbaig I have 2 projects using node-sass-chokidar and one worked flawlessly, the other one had that error
not sure of the cause though