These are chat archives for FreeCodeCamp/Help

21st
Jun 2015
Logan Tegman
@ltegman
Jun 21 2015 04:32
Is there a better approach to the Roman Numeral challenge than an array with all the single digit conversions that can get you up to ~50? I feel like there has to be a less brute method, but I can't for the life of me come up with one.
Ariel
@ArielLeslie
Jun 21 2015 04:34
You don't mean that you have hard-coded I, II, III, IV, V..... all the way up to L do you?
Matthew Vogel
@matthewsvm
Jun 21 2015 04:34
anyone know where to manage the notifications?
Logan Tegman
@ltegman
Jun 21 2015 04:35
@arielleslie I hard coded all the single digits (so for 35 I would consult the entries for 30 and 5) -- I know, not elegant at all
gabazine
@gabazine
Jun 21 2015 04:35
how do i join freecode camp slack
Charles Watson
@sircharleswatson
Jun 21 2015 04:35
@matthewsvm the wrench and screwdriver in the top left
@gabazine you don’t. We’re moving back to Gitter :)
gabazine
@gabazine
Jun 21 2015 04:36
so how do i pass the challenge then
Ariel
@ArielLeslie
Jun 21 2015 04:36
@ltegman You can do it more elegantly than that.
Charles Watson
@sircharleswatson
Jun 21 2015 04:36
just say you passed it
gabazine
@gabazine
Jun 21 2015 04:36
kk tnks
Logan Tegman
@ltegman
Jun 21 2015 04:37
@arielleslie Haha, okay -- I'll keep at it then. Just wanted to make sure I wasn't spinning my wheels for nothing :P
Tony Keovongphet
@TSKeo
Jun 21 2015 04:37
@sircharleswatson, how long have you been coding?
Matthew Vogel
@matthewsvm
Jun 21 2015 04:37
thanks @sircharleswatson I'm watching the video right now. It seems like there is some good info on it
Ariel
@ArielLeslie
Jun 21 2015 04:37
@ltegman think while loops
Charles Watson
@sircharleswatson
Jun 21 2015 04:37
almost 3 years
Ariel
@ArielLeslie
Jun 21 2015 04:39
@ltegman That's only one solution, but it's effective. You just need to code in your edge numbers (9, 4, etc)
Logan Tegman
@ltegman
Jun 21 2015 04:40
@arielleslie Ooo -- that helps a lot. I knew that was the direction I needed to go, but somehow I couldn't get the loop structure quite right.
Ariel
@ArielLeslie
Jun 21 2015 04:41
Glad to help
Matthew Vogel
@matthewsvm
Jun 21 2015 04:44
OK, a couple of things. Does anyone know where that knew waypoint is? I don't see it on /map
also, my ch notification change doesn't seem to be working
and I would prefer "boing" noises to the right side pop-up notifications
OK, I answered the second question. You have to set the settings on each of the rooms you join. There isn't a universal setting for all of them
I still want the "boingy" noise though
Ariel
@ArielLeslie
Jun 21 2015 04:47
@ltegman I think that the advanced topics for python in codecademy has a recursive solution to roman numerals
@matthewsvm which waypoint are you looking for?
Matthew Vogel
@matthewsvm
Jun 21 2015 04:48
I would also like to get notifications for specific topics as I did in slack
Logan Tegman
@ltegman
Jun 21 2015 04:49
@arielleslie Oh dang, I must have stopped that track before I got to that problem. I'm gonna go check it out now, that sounds really interesting. I have trouble getting my brain to think recursively. I always default to loops instead.
Matthew Vogel
@matthewsvm
Jun 21 2015 04:49
@arielleslie the one that quincy shows in the video.
Ariel
@ArielLeslie
Jun 21 2015 04:49
@ltegman me too because I did imperative programming for so long before really learning true functional programming
Charles Watson
@sircharleswatson
Jun 21 2015 04:50
@matthewsvm Gitter doesn have the word notifications like slack
but the syntax highlighting makes up for it :D
Matthew Vogel
@matthewsvm
Jun 21 2015 04:50
syntax highlighting?
Sam Crowe
@crowesam
Jun 21 2015 04:50

Need help - Waypoint: Manage Packages with NPM #12 removed a dist-tag then tried to do an "npm publish" and it gives me errors like it doesn't know who I am. specifically
...
crowesam@workspaceone:~/workspace/devenvironment (master) $ npm publish
npm ERR! publish Failed PUT 404
npm ERR! Linux 3.14.13-c9
npm ERR! argv "node" "/home/ubuntu/.nvm/v0.10.35/bin/npm" "publish"
npm ERR! node v0.10.35
npm ERR! npm v2.11.3
npm ERR! code E404

npm ERR! 404 missing : @samc/devenvironment
npm ERR! 404
npm ERR! 404 '@samc/devenvironment' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/workspace/devenvironment/npm-debug.log

...

Matthew Vogel
@matthewsvm
Jun 21 2015 04:51
@sircharleswatson where do I find syntax highlighting?
Charles Watson
@sircharleswatson
Jun 21 2015 04:51
var myFunction = function() {
    var myArray = [1, 2, “three”, “four”];
}
in the message box there are two buttons you can click on for more details about what you can do in a message
Sam Crowe
@crowesam
Jun 21 2015 04:53
I got it to work before. I think I'll just move on
Matthew Vogel
@matthewsvm
Jun 21 2015 04:55
OK, @sircharleswatson I see the markdown box to what I can do in a message. But I still would like to be notified via a noise of some sort rather than a popup. Is there some way to do tha?
Ariel
@ArielLeslie
Jun 21 2015 04:55
Maybe with the desktop app. I haven't tried it.
Matthew Vogel
@matthewsvm
Jun 21 2015 04:56
Likethisisfancy,butImnotfindingitasusefulyetLike this is fancy, but I'm not finding it as useful yet
Yeah, @arielleslie I'm going to look at the apps
Sam Crowe
@crowesam
Jun 21 2015 04:59

Need help - Waypoint: Manage Packages with NPM #12 removed a dist-tag then tried to do an "npm publish" and it gives me errors like it doesn't know who I am. specifically

```crowesam@workspaceone:~/workspace/devenvironment (master) $ npm publish
npm ERR! publish Failed PUT 404
npm ERR! Linux 3.14.13-c9
npm ERR! argv "node" "/home/ubuntu/.nvm/v0.10.35/bin/npm" "publish"
npm ERR! node v0.10.35
npm ERR! npm v2.11.3
npm ERR! code E404

npm ERR! 404 missing : @samc/devenvironment
npm ERR! 404
npm ERR! 404 '@samc/devenvironment' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/workspace/devenvironment/npm-debug.log```

gabazine
@gabazine
Jun 21 2015 05:02
so just a simple suggestion for the freecodecamp advanced coders
Right now I am going through the way point:html and css, we have 3 columns, the instructions, the text-editor and the phone app, is there a way to keep the middle colum(text editor) from scrolling when I am reading the instructions?
Den McHenry
@denmch
Jun 21 2015 05:05
@crowesam: I think I can help you out.
@crowesam You may have to rerun how-to-npm and go through a previous step or three. This is a fairly common problem that occurs when people mistakenly try to add or remove dist-tags for version numbers that haven't been published.
@crowesam The other possibility is that it forgot your credentials.
In this case, first run how-to-npm and then npm whoami to verify that it doesn't know who you are.
Den McHenry
@denmch
Jun 21 2015 05:12
This sometimes happens if you follow the directions and scope your npm init, i.e., npm init --scope=<username>
So you can run how-to-npm and go to the login step and run npm adduser again, and then return to the current step and try again. Test to verify that it's working by running npm whoami. If it's working, you should be good to go.
Matthew Vogel
@matthewsvm
Jun 21 2015 05:14
‘’’testing’’’
oh i did the wrong kind of quote
here we go?
ok, still wish I could do other stuff
var code = highlighting?
Den McHenry
@denmch
Jun 21 2015 05:22
Hey, this is cool.
  Gitter automatically adds the closing
    back ticks when you do code blocks.
Sam Crowe
@crowesam
Jun 21 2015 05:27
@denmch Thank you for the information. I have been through most of the npm exercises four-five times now baking up to move forward.
it recognized me on 'npm whoami'
I think I must have wiped something out when I removed the tag
dist-tag
Den McHenry
@denmch
Jun 21 2015 05:28
The best thing to do is to go back and re-run the previous few steps. I did extensive testing with how-to-npm, and those 403 and 404 errors always came back to mistakes with version numbers.
Teja Kodali
@tejaykodali
Jun 21 2015 06:15
This message was deleted
This message was deleted
This message was deleted
Suzanne Atkinson
@AdventureBear
Jun 21 2015 07:32
Hellooooooo gitter!!!
Hugo
@HugoNebreda
Jun 21 2015 09:24
I have a silly question
I have something like this
array = [['dummystring', 1.67],['dummystring', 12.34],['dummystring',523.21]]
But when I try to sum the float numeric member array[index][1] of each element, it concatenates!
Even with parseFloat();
Seems to be something silly but I cannot find where is my problem. Any hint?
Mushfiq Khalid
@mushfick
Jun 21 2015 09:27
so sum = 0; sum += arrayindex; console.log(sum);
err
one sec
sum = 0;
sum += array[index][1];
console.log(sum);
Mushfiq Khalid
@mushfick
Jun 21 2015 09:32
that doesn’t work for you?
sorry, still trying to get used to gitter
first time user
Hugo
@HugoNebreda
Jun 21 2015 09:35
@mushfick I'm going to try it out and reply you
That works, but when I'm tryng to use into a .reduce function
sum = array.reduce(function(acc, curr){ return acc[1] + curr[1]; });
I do not know much about MarkDown but how do you manage to style code with black box like you did?
Mushfiq Khalid
@mushfick
Jun 21 2015 09:40
type in ```
Hugo
@HugoNebreda
Jun 21 2015 09:41
ok
Mushfiq Khalid
@mushfick
Jun 21 2015 09:41
@HugoNebreda you can also click on the checklist icon to the right of this text box, underneath the chat message icon
it’ll open up a modal showing all the things you can do
Hugo
@HugoNebreda
Jun 21 2015 09:41
so when I try to use it in a .reduce
array = [['dummystring', 1.67],['dummystring', 12.34],['dummystring',523.21]];
sum = 0.0;
sum = array.reduce(function(acc, curr){
    return acc[1] + curr[1];
  });
console.log (sum);
Wow, thanks!
I'm kind of new to gitter so didn't explore that much the options, thanks @mushfick
Mushfiq Khalid
@mushfick
Jun 21 2015 09:45
@HugoNebreda To be honest, I haven’t got that far as yet. It’s only my first day here and on gitter
Hugo
@HugoNebreda
Jun 21 2015 09:46
ah ok :smile: don't worry thanks for your help anyway
and happy to have people so helping joined!
Mushfiq Khalid
@mushfick
Jun 21 2015 09:49
you’re welcome :)
And the exercise you’re doing right now, is it part of functional programming?
Hugo
@HugoNebreda
Jun 21 2015 09:54
Advanced Algorithm Scripting bonfire: Exact Change
Right after functional programming waypoint
Mushfiq Khalid
@mushfick
Jun 21 2015 09:54
okay, thanks!
Argentoratum
@Argentoratum
Jun 21 2015 10:09

Hi! Why is this not working?
```
function destroyer(arr) {
// Remove all the values
for(var i=1;i<arguments.length;i++) {
arr=arr.filter(function(element){
return !(element==arguments[i]);});
}
return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
´´´
thanks!!

and how to make it look nice? should i put ´´´ in front of every line?:)
Bianca Mihai
@biancamihai
Jun 21 2015 10:10
code
code
yes add "" to the start and "" to the end of your code
Argentoratum
@Argentoratum
Jun 21 2015 10:12
thanks, i'll try again:)

'''
function destroyer(arr) {
// Remove all the values
for(var i=1;i<arguments.length;i++) {
arr=arr.filter(function(element){
return !(element==arguments[i]);});
}
return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
'''

Bianca Mihai
@biancamihai
Jun 21 2015 10:12
`
ahhh
:))
Mushfiq Khalid
@mushfick
Jun 21 2015 10:12
use the tilde key, the one before your 1 key
you’re using the single quotation key and that’s why it isnt working
Argentoratum
@Argentoratum
Jun 21 2015 10:13
function destroyer(arr) {
// Remove all the values
for(var i=1;i<arguments.length;i++) {
arr=arr.filter(function(element){
return !(element==arguments[i]);});
}
return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
yes!!:)
Bianca Mihai
@biancamihai
Jun 21 2015 10:13
great!
what bonfire is this one?
the for loop is iterating through the 2nd,3rd, etc arguments, that's fine... but then my filter function seems to return false everywhere
also, it warns me that functions shouldn't go inside for loops.. but why not?
Bianca Mihai
@biancamihai
Jun 21 2015 10:15
well the bonfire wants you to remove the elements from the first array that match the rest of the arguments
Argentoratum
@Argentoratum
Jun 21 2015 10:17
so I'm going through the arguments, and with each I remove the elements for that argument
so the for loops should run twice in the example, first removing all the 2-s, and than all the 3-s
Bianca Mihai
@biancamihai
Jun 21 2015 10:19
back in 2 mins and :)
Argentoratum
@Argentoratum
Jun 21 2015 10:19
okay, thanks:)
Bianca Mihai
@biancamihai
Jun 21 2015 10:32
@Argentoratum k, I'm back
so you want to use the filter method
and you use it in loop
what if
you use it but not in for loop
and you can think of it like this:
// so all that you will need to do is concat the arguments starting from pos 1
return arr.filter(function(element){
    return[2,3].indexOf(element) === -1;
});
Argentoratum
@Argentoratum
Jun 21 2015 10:35
i haven't thought of this, looks simpler
Bianca Mihai
@biancamihai
Jun 21 2015 10:36
the filter function will execute the callback on each element of the array
so that is O(n)
if you also call it in a loop ...
bad things can happen in production :)
Argentoratum
@Argentoratum
Jun 21 2015 10:40
:)
thanks again, solved it! is it a good solution for "production" as well?:)
function destroyer(arr) {
  // Remove all the values
  var args = Array.prototype.slice.call(arguments);


  return arr.filter(function(element){
    return args.slice(1).indexOf(element) === -1;
  });
                    }


destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Bianca Mihai
@biancamihai
Jun 21 2015 10:44
yeii looks great
my solution is ugly ;)) when I solved in a night around 3AM I guess ;))
too bad I can;t change them now, once I learned more about JS
Argentoratum
@Argentoratum
Jun 21 2015 10:52
i'm trying to learn that now... when I started programming I've just named everything a,b,c,d,e... and then started soon to lost track of what is what actually:)
Bianca Mihai
@biancamihai
Jun 21 2015 10:54
try to also comment your code and choose a convention to name your variables, functions etc ...
good luck with the other challenges ;)
Argentoratum
@Argentoratum
Jun 21 2015 10:54
thank you again for your help!
therealdeadly
@therealdeadly
Jun 21 2015 11:13
hey in html is there any difference between double quotes and single quotes because I seem to be able to use them interchangeably
Bianca Mihai
@biancamihai
Jun 21 2015 11:13
you ca use them both I’m no html expert but from what I have seen “ seems to be a good practice :)
therealdeadly
@therealdeadly
Jun 21 2015 11:14
thanks :)
Bianca Mihai
@biancamihai
Jun 21 2015 11:15
just like you start to name your variables or functions if you use myVar try to use the same convention everywere in your code (if you use my_var try to do the same) don’t mix them :P
Anton Strömkvist
@ahstro
Jun 21 2015 11:24
Can you get help with the Ziplines? Because for whatever reason, I can not perform what seems like a simple Ajax request. Every single URL I try gives me a "No 'Access-Control-Allo-Origin' header is present" error.
Eko Julianto Salim
@ekojsalim
Jun 21 2015 11:26
@LumenTeun Make sure that your request is a JSONP request
Anton Strömkvist
@ahstro
Jun 21 2015 11:27
But, none of the API docs mention JSONP
Eko Julianto Salim
@ekojsalim
Jun 21 2015 11:27
@LumenTeun Hmm, I am pretty sure that angular and jquery docs mention about it
What library / framework are you using?
Anton Strömkvist
@ahstro
Jun 21 2015 11:28
I'm using jQuery's $.ajax() function, trying to get json from the TwitchAPI
I thought I got the issue because the TwitchAPI requires a custom header, but I found another API which does not, and I get the same CORS error.
Eko Julianto Salim
@ekojsalim
Jun 21 2015 11:30
@LumenTeun try adding dataType: 'jsonp',
Bianca Mihai
@biancamihai
Jun 21 2015 11:30
mailkev14
@mailkev14
Jun 21 2015 11:32
Hi
i need help with a javascript bonfire
Bianca Mihai
@biancamihai
Jun 21 2015 11:32
what is the problem @mailkev14 ?
mailkev14
@mailkev14
Jun 21 2015 11:33
the issue is that
im solving the "Smallest Common Multiple"
issue
what I have understood is that I need to find the smallest number which is divisible by the range, Array, that is passed to the function
however the test cases for the same are showing something else
Bianca Mihai
@biancamihai
Jun 21 2015 11:35
can you post your code?
mailkev14
@mailkev14
Jun 21 2015 11:35
wait..i have not finished
the reference link also shows the same logic that I have implemented
my code is here

function smallestCommons(arr) {
var sortedArr = arr.slice(0).sort(function(a, b){return b-a;}),
multiples = sortedArr.slice(0),
multipliers = [1, 1];

while(true)
{
if(multiples1 < multiples[0])
multiples1 = sortedArr1 ++multipliers1;
else if(multiples1 > multiples[0])
multiples[0] = sortedArr[0]
++multipliers[0];
else
return multiples[0];
}
}

smallestCommons([1,5]);

as per the logic in the reference link and the code given above
the answer should be 5
but the test cases show it as 60
Vos
@KrisVos130
Jun 21 2015 11:37
Can someone push me into the right direction on the Pairwise bonfire? I have no clue on what to start off with
mailkev14
@mailkev14
Jun 21 2015 11:37
@KrisVos130 you will need to install Screenhero
and then type the person's handle in the bonfire
to pair with the same
Vos
@KrisVos130
Jun 21 2015 11:38
@mailkev14 Not the pair bonfire, the pairwise bonfire
Eko Julianto Salim
@ekojsalim
Jun 21 2015 11:38
@mailkev14 In this bonfire, you are supposed to find the LCM of the numbers from the range
Vos
@KrisVos130
Jun 21 2015 11:38
@mailkev14 It's an Intermediate Algorithm Scripting bonfire
Bianca Mihai
@biancamihai
Jun 21 2015 11:38
@mailkev14 yes the answer is 60 because they want you to calculate the Smallest Common Multiple for 1,2,3,4,5 not just for 1 and 5
mailkev14
@mailkev14
Jun 21 2015 11:38
@ekojsalim i have done the same but the test cases are showing absurd results
ook
like that
Bianca Mihai
@biancamihai
Jun 21 2015 11:39
;)
mailkev14
@mailkev14
Jun 21 2015 11:39
thanks @biancamihai
Bianca Mihai
@biancamihai
Jun 21 2015 11:39
you are wlcome
Vos
@KrisVos130
Jun 21 2015 11:41
@biancamihai Can you help me you on the pairwise bonfire? I just need to know what to start with
Bianca Mihai
@biancamihai
Jun 21 2015 11:41
will take a look now :) to see what that bonfire was
Vos
@KrisVos130
Jun 21 2015 11:42
Thanks a lot :)
Bianca Mihai
@biancamihai
Jun 21 2015 11:49
did you take a look at it?
Vos
@KrisVos130
Jun 21 2015 11:50
@biancamihai I have but I still don't quite understand them, and when I tried to use them in the past they didn't work properly
Bianca Mihai
@biancamihai
Jun 21 2015 11:52
hmm this might help https://www.airpair.com/javascript/javascript-array-reduce I didn’t solve it with reduce but let me try and get back to you ;)
Vos
@KrisVos130
Jun 21 2015 11:53
@biancamihai Okay, I will take a look at it, thanks
Vos
@KrisVos130
Jun 21 2015 11:59
@biancamihai Thanks, I now understand the reduce function, I just thought that previousValue was the value of the previous index
Bianca Mihai
@biancamihai
Jun 21 2015 11:59
;)
that is great @KrisVos130
I was just working on solving this with reduce :P
my prev solution does not use reduce
that helped me too ;)
Vos
@KrisVos130
Jun 21 2015 12:00
But I am not sure what to do with the reduce function, since the array can have a various amount of numbers
Bianca Mihai
@biancamihai
Jun 21 2015 12:05
hmm
this is my solution without using reduce
Anton Strömkvist
@ahstro
Jun 21 2015 12:05
Wait, are you spoiling Pairwise?
Should I put my fingers in my ears, close my eyes and hum for a minute?
Vos
@KrisVos130
Jun 21 2015 12:06
If I wanted to I could have copied your solution from your profile, but I want to do it myself, I just don't know where to start of with
Anton Strömkvist
@ahstro
Jun 21 2015 12:07
Want to try to tackle it with pair programming now @KrisVos130? Breakfast's over!
Bianca Mihai
@biancamihai
Jun 21 2015 12:07
ok
Ijust wanted to show you a solutuin withour reduce :)
Vos
@KrisVos130
Jun 21 2015 12:07
@LumenTeun Yeah sure, one min
Bianca Mihai
@biancamihai
Jun 21 2015 12:07
without
Anton Strömkvist
@ahstro
Jun 21 2015 12:07
I'll gladly check out your solution later @biancamihai, because I was so close to solving it without reduce earlier.
But, let me figure it out first ;)
Bianca Mihai
@biancamihai
Jun 21 2015 12:08
k, sorry :P just wanted to show a bad solution O(n*n) ;))
Anton Strömkvist
@ahstro
Jun 21 2015 12:08
:P
Bianca Mihai
@biancamihai
Jun 21 2015 12:08
but even with reduce
I still need a loop, hmm
Vos
@KrisVos130
Jun 21 2015 12:09
@LumenTeun What email address are you using for screenhero?
Bianca Mihai
@biancamihai
Jun 21 2015 12:09
solve it now using reduce, let me know what solution do you guys find
Vos
@KrisVos130
Jun 21 2015 12:09
Will do
mailkev14
@mailkev14
Jun 21 2015 12:16

@biancamihai I got the LCM working

Tks :)

Bianca Mihai
@biancamihai
Jun 21 2015 12:17
that is great @mailkev14 good job! ;)
Hugo
@HugoNebreda
Jun 21 2015 12:40
Hey there, any hint on why this code concats the values, instead of sum them?
  var array = [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10]];
  sum = 0;
  sum = array.reduce(function(acc, curr){
    return acc[1] + curr[1];
  });
  console.log("sum: " + sum);
Argentoratum
@Argentoratum
Jun 21 2015 12:47
which is better to use? Math.floor(a/b) or parseInt(a/b) ?
Anton Strömkvist
@ahstro
Jun 21 2015 12:47
They do different things, don't they?
Argentoratum
@Argentoratum
Jun 21 2015 12:48
yes, i mean for integer division (so that 7/3 = 2 )
Eko Julianto Salim
@ekojsalim
Jun 21 2015 12:48
@HugoNebreda after the first iteration, the acc is 3.0599999999999996 , what is 3.0599999999999996[1] ?
Hugo
@HugoNebreda
Jun 21 2015 12:48
hmmm you're right
but the thing is, that even in the first iteration the result log is this
acc: 1.01 + curr: 2.05 = 1.012.05
(at least in my computer)

well, wait, that's the same problem

var array = [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10]];
  sum = 0;
  sum = array.reduce(function(acc, curr){
    return acc + curr[1]; // don't access acc[1] property
  },0); // pass a 0 as parameter
  console.log("sum: " + sum);

I think that should do it

Eko Julianto Salim
@ekojsalim
Jun 21 2015 12:52
@Argentoratum parseInt is definitely slower for that
Jakob Dahl
@saadanerdetbare
Jun 21 2015 12:52
@HugoNebreda i had lots of trouble with floating points on that one as well. i ended up with this little piece of code
function roundToTwo(num) {
    return +(Math.round(num + "e+2") + "e-2");
}
Argentoratum
@Argentoratum
Jun 21 2015 12:52
thanks, i thought so, but was not sure:)
Hugo
@HugoNebreda
Jun 21 2015 12:56

@HugoNebreda i had lots of trouble with floating points on that one as well. i ended up with this little piece of code

function roundToTwo(num) {
    return +(Math.round(num + "e+2") + "e-2");
}

Interesting function, you use it to rund it to two decimal?
If that's the case would it be the same output as using

num.toFixed(2);
mailkev14
@mailkev14
Jun 21 2015 12:56
can someone tell me how to convert a binary string to an english word?
Argentoratum
@Argentoratum
Jun 21 2015 12:56
@saadanerdetbare
I would do it this way:
function roundToTwo(num) {
    return Math.round(num*100)/100;
}
but yes, num.toFixed(2); seems easier
:)
Jakob Dahl
@saadanerdetbare
Jun 21 2015 12:57
num.toFixed(2) just didn't do what i wanted
i kept floating
Bianca Mihai
@biancamihai
Jun 21 2015 12:58
@mailkev14 try to convert from binary to an integer and from integer to text
mailkev14
@mailkev14
Jun 21 2015 12:58
mmm
Jakob Dahl
@saadanerdetbare
Jun 21 2015 12:58
it tricked me alot i'm used to be able to declared a decimal datatype in c#
then you know it stays that way
mailkev14
@mailkev14
Jun 21 2015 13:00
@biancamihai your hint worked like a charm
:)
mailkev14
@mailkev14
Jun 21 2015 13:05
yup i know about charCode thing but it just didn't strike me to process the conversion into 2 folds
i was getting a chinese string otherwise :P
Bianca Mihai
@biancamihai
Jun 21 2015 13:06
well it is solved now, good job! you are moving fast @mailkev14
mailkev14
@mailkev14
Jun 21 2015 13:06
yay
Bianca Mihai
@biancamihai
Jun 21 2015 13:06
you have some experience right?
Argentoratum
@Argentoratum
Jun 21 2015 13:39

Hi! I have to "attach" a function to a string? So that

"abc".toProperCase(); // Abc

function toProperCase(text){
  return text.substring(0,1).toUpperCase()+text.substring(1);
}

would work?

Eko Julianto Salim
@ekojsalim
Jun 21 2015 13:40
@Argentoratum For that to work you need to 'put' that function inside String.Prototype
and use this instead of text
so basically like this
String.prototype.toProperCase = function(){
  return this.substring(0,1).toUpperCase()+this.substring(1);
}
Argentoratum
@Argentoratum
Jun 21 2015 13:43
@ekojsalim Thanks!!
Patrick Metzdorf
@batjko
Jun 21 2015 13:44
@Argentoratum Be aware why that is though, i.e. why you need to add the function to the prototype and how this works in that context.
Eko Julianto Salim
@ekojsalim
Jun 21 2015 13:47
@Argentoratum np :) but as @batjko said you need to understand this, btw are you doing this for the title-case bonfire?
Argentoratum
@Argentoratum
Jun 21 2015 13:48
yes, for the case-sensitive replacing one
which i probably really overcomplicated:)
Eko Julianto Salim
@ekojsalim
Jun 21 2015 13:49
@Argentoratum yeah, you don't actually need to modify the String.Prototype for this, but yeah your solution works :)
Argentoratum
@Argentoratum
Jun 21 2015 13:51
i guess could be shorter, but looks nice and hopefully understandable:
String.prototype.toProperCase = function(){ return this.substring(0,1).toUpperCase()+this.substring(1);};

function MatchCase(sample,text){
       if(sample.toLowerCase()==sample) {return text.toLowerCase();} //aaaa
  else if(sample.toUpperCase()==sample) {return text.toUpperCase();} //AAAA
  else if(sample.toProperCase()==sample){return text.toProperCase();} //Aaaa

}

function replace(str, before, after) {
  var words=str.split(' ');

  for(i=0;i<words.length;i++){
    if(words[i].toLowerCase()==before.toLowerCase()){
      words[i]=MatchCase(words[i],after);
    }
  }
 return words.join(' ');
}

replace("A quick brown fox jumped over the lazy dog", "jumped", "leaped");
I mean easily... when i started to code, sometimes i couldn't understand one day later why and how it is working (or not working...:))
so now I try to write more properly...
Eko Julianto Salim
@ekojsalim
Jun 21 2015 13:57
@Argentoratum Commenting your code can also be helpful, you can also quite a bit shorten it by say using replace or split and join combo
Argentoratum
@Argentoratum
Jun 21 2015 14:02
@ekojsalim I completely agree, I should comment more... I don't understand where to make it shorter. simply replace would not work on this bonfire, because it should reserve the case of the original word
So replace("A quick brown fox Jumped over the lazy dog", "jumped", "leaped"); -->"A quick brown fox Leaped over the lazy dog"
Eko Julianto Salim
@ekojsalim
Jun 21 2015 14:03
ah sorry wrong bonfire
eh wait
nvm I 've just got confused
Eko Julianto Salim
@ekojsalim
Jun 21 2015 14:04
yeah , the search and replace bonfire
@Argentoratum you can modify the afterbefore you replace it
Argentoratum
@Argentoratum
Jun 21 2015 14:07
yes, true:)
Ariel
@ArielLeslie
Jun 21 2015 14:12
I have a question about the correct sequencing in FCC. Is the Map meant to be gone through in order? Because partway through HTML/CSS I got sent to Bonfire 21 and after doing my first Bootstrap Waypoint I was sent to Zipline 3.
Eko Julianto Salim
@ekojsalim
Jun 21 2015 14:12
@arielleslie yeah, it is supposed to go in order, it's probably a bug that send you to the bonfire and zipline
Ariel
@ArielLeslie
Jun 21 2015 14:15
Thanks @ekojsalim . I figured. Is there a bug reporting tool?
Eko Julianto Salim
@ekojsalim
Jun 21 2015 14:17
@arielleslie just report an issue on the FCC github page
Nicholas Butterworth
@Nbutter
Jun 21 2015 14:31
hey guys
so there is a help room ; )
Steven Leiva
@StevenXL
Jun 21 2015 14:34
😁
Grace
@dogbot101
Jun 21 2015 14:34
So there is!
Nicholas Butterworth
@Nbutter
Jun 21 2015 14:34
good, because this is one of the best things about FCC!! ;)
Peter Daily
@thepeted
Jun 21 2015 14:36
Is there a way that this chat room could show up when new users log in.
It didn't for me.
The help room is one of the best things about FCC.
Grace
@dogbot101
Jun 21 2015 14:37
Maybe one of you smart folks can help me out with this: I'm currently working on the bonfire about finding and returning the largest number in array. I noticed the side link has comparison operators, but I've heard that you can also use math.max.apply(). Are we supposed to create an answer using comparison operators? I know there are different ways to complete each of these bonfires. I just want to make sure I understand how this works.
Nicholas Butterworth
@Nbutter
Jun 21 2015 14:37
hi @dogbot101
Alyssa Alvarez
@AlysCole
Jun 21 2015 14:38
@dogbot101 Do whichever way you prefer. :)
I
Grace
@dogbot101
Jun 21 2015 14:38
hello there @Nbutter !
Nicholas Butterworth
@Nbutter
Jun 21 2015 14:38
my solution definitely used comparison operators
Alyssa Alvarez
@AlysCole
Jun 21 2015 14:38
The tests are based on the results of the code.
Nicholas Butterworth
@Nbutter
Jun 21 2015 14:38
the bonfires actually don't care how you solve the problems, as long as your solutions create correct results
and there are a lot of ways to skin a cat
Grace
@dogbot101
Jun 21 2015 14:38
@ Nbutter did you use two for loops then?
Nicholas Butterworth
@Nbutter
Jun 21 2015 14:38
what i would recommend is just getting a solution that works, and not trying to make it too fancy
you can always go back and refactor after
hang on and i'll take a look at my solution...
yup, sure did!!
i have grown to like and appreciate for loops, which i never thought i would ; )
Grace
@dogbot101
Jun 21 2015 14:41
Ahh, cool
thanks @Nbutter
Nicholas Butterworth
@Nbutter
Jun 21 2015 14:43
np!
gabazine
@gabazine
Jun 21 2015 15:19
This message was deleted
Jeremiah Biard
@jeremiahbiard
Jun 21 2015 15:19
@Nbutter Trade in those rusty for loops for map, reduce, filter, et al.
Patrick Metzdorf
@batjko
Jun 21 2015 15:39
If you can do it with array functions like map and reduce, it's a good exercise to try. It enhances algorithmic thinking.
Unless a simple for loop is much quicker, of course.
Soham
@appfobia
Jun 21 2015 15:55
Is there any library to handle files (saving it my my computer) in JS ?
I was working with meteor , I couldn't find any way to do it in JS
I found one "CollectionFS" but it's showing "build failed" in GitHub.
Nicholas Butterworth
@Nbutter
Jun 21 2015 16:02
@appfobia do you mean saving from the browser?
meteor is js, of course...
This message was deleted
Hugo
@HugoNebreda
Jun 21 2015 16:06

I have a question about defining methods through prototype in javascript
How can I filter single properties (name:value) from prototype functions?

var Inventory =  function(arr){
  (var i = 0; i < arr.length; i++) {
    this[arr[i][1]] = arr[i][0];
  }
};

Inventory.prototype.updateItem = function(name,value){
    this[name] = value;
}

if then I do something like this:

Inventory.prototype.toArray = function(){
  var ans = [];
  for (var property in this ) {
    console.log("typeof(" + property + ") -->" + typeof(property));
    if(typeof(property) != "function") ans.push([property , this[property]]);
  }
  return ans;
};

it returns that all properties are typeof String!

Nicholas Butterworth
@Nbutter
Jun 21 2015 16:25
@HugoNebreda hi hugo
i think you may be getting the types of all the keys
when you probably want the types of all the values
maybe you want typeof(this.property) or typeof(this[property])
i'm not too certain about what the "for(var property in this)" exactly accesses
Hugo
@HugoNebreda
Jun 21 2015 16:30
Hi @Nbutter
I think javascript gives me this solved with Object.keys()
Nicholas Butterworth
@Nbutter
Jun 21 2015 16:31
great
!
Hugo
@HugoNebreda
Jun 21 2015 16:31
I just wanted to turn an object in an array with its property names and property values
*into
I have the bad habit of "reinveint the wheel" every time I can :P
Nicholas Butterworth
@Nbutter
Jun 21 2015 16:32
so the way i have seen that, i think, is to use Object.keys like you're doing and then to use map to generate a new array with both keys and values
Hugo
@HugoNebreda
Jun 21 2015 16:32
I solved with a for loop
because seems that using this inside a map inside a prototype function gives me some problems
Nicholas Butterworth
@Nbutter
Jun 21 2015 16:33
but you also may need to use hasOwnProperty if you don't want to do lookups on the prototype chain
Hugo
@HugoNebreda
Jun 21 2015 16:34
In this case, the object was simple, and is not chained with nothing
Nicholas Butterworth
@Nbutter
Jun 21 2015 16:34
oh, right... if you kind of lose track of what "this" is you can try using call or apply()
Hugo
@HugoNebreda
Jun 21 2015 16:34
sure!
Nicholas Butterworth
@Nbutter
Jun 21 2015 16:34
so you can pass both the object and what you want to do to/with it
Hugo
@HugoNebreda
Jun 21 2015 16:34
I always forgot that apply and call can be used
and try to build a workaround for it
Nicholas Butterworth
@Nbutter
Jun 21 2015 16:34
(it seems you are not a novice programmer, correct?) ; )
Hugo
@HugoNebreda
Jun 21 2015 16:34
Nope, I'm not
:P
Nicholas Butterworth
@Nbutter
Jun 21 2015 16:34
it is clear ; )
Hugo
@HugoNebreda
Jun 21 2015 16:35
I'm not an advanced programmer
Nicholas Butterworth
@Nbutter
Jun 21 2015 16:35
these are some fairly advanced topics in js though, it's good to see that you are figuring them out!
Hugo
@HugoNebreda
Jun 21 2015 16:36
I had used javascript a long time ago, when jquery was becoming popular, but never dedicated too much time
so all of this "functional programming"
this "map, reduce, concat, etc" function and this style of doing all in the return line
it's new to me
Justin Dieter
@JDieter12
Jun 21 2015 16:39
anyone decent with Java?
Nicholas Butterworth
@Nbutter
Jun 21 2015 16:40
don't forget filter() ; )
@JDieter12 not me!
Hugo
@HugoNebreda
Jun 21 2015 16:42
@JDieter12 can you define Decent?
Maybe I can help
or maybe not
Vos
@KrisVos130
Jun 21 2015 16:48
@JDieter12 I am decent with Java
Justin Dieter
@JDieter12
Jun 21 2015 16:50
lol. Well maybe!
I need to do a compensation calculator for school. It has you type in your yearly sales, and it uses a commission rate if those sales meet the quota. Also, if applicable, it gives a total with an accelerated commission and bonuses.
However, when I run the program, it starts off as a blank line. Once you type in the number, it goes and runs the program.
Any idea what might cause this?
Vos
@KrisVos130
Jun 21 2015 16:52
No clue
Hugo
@HugoNebreda
Jun 21 2015 17:09

I'm not sure if I fully understand what's the problem.
You execute your

java calculator.java

and it waits until you put some number?

Maybe I cannot help you but, if I understood correctly it seems to be waiting for a parameter to run
Justin Dieter
@JDieter12
Jun 21 2015 17:12
I got it figured out. I had a variable misplaced in the code. It should have come after the first System.out.print, but I had it placed before. So, it would take what I typed in on the blank line, and then start the program.
Hugo
@HugoNebreda
Jun 21 2015 17:17
Hehe, glad you fixed it
Jonathan
@jonathantimm
Jun 21 2015 17:33
Is anyone else getting 500 loopback errors on FCC? I'm getting them every time I go through a waypoint, on the html/css ones.
Loopback
500 Error: Timeout in connecting after 5000 ms
   at null.<anonymous> (/home/freecodecamp/freecodecamp/node_modules/loopback-datasource-juggler/lib/datasource.js:2039:10)
   at null._onTimeout (/home/freecodecamp/freecodecamp/node_modules/loopback/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31)
   at Timer.listOnTimeout (timers.js:110:15)
Hugo
@HugoNebreda
Jun 21 2015 17:34
@jonathantimm seems to work fine to me
at least until this moment
Jonathan
@jonathantimm
Jun 21 2015 17:35
@HugoNebreda thanks hugo. Maybe I'll try it in another browser.
Looks like it works fine in firefox. strange.
Jonathan
@jonathantimm
Jun 21 2015 19:22
Can anyone help me with the waypoint Mobile Responsive images? The second requirement is that you add a second image, and I've done that, but it isn't letting me move on
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<style>
  .red-text {
    color: red;
  }

  h2 {
    font-family: Lobster, Monospace;
  }

  p {
    font-size: 16px;
    font-family: Monospace;
  }

  .thick-green-border {
    border-color: green;
    border-width: 10px;
    border-style: solid;
    border-radius: 50%;
  }

  .smaller-image {
    width: 100px;
  }
</style>

<h2 class='red-text'>CatPhotoApp</h2>

<p>Click here for <a href='#'>cat photos</a>.</p>

<a href='#'><img class='smaller-image thick-green-border img-responsive' src='https://bit.ly/fcc-kittens'/></a>

<img src="http://bit.ly/fcc-kittens2"/>

<p>Things cats love:</p>
<ul>
  <li>cat nip</li>
  <li>laser pointers</li>
  <li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
  <li>flea treatment</li>
  <li>thunder</li>
  <li>other cats</li>
</ol>
<form action="/submit-cat-photo">
  <label><input type='radio' name='indoor-outdoor'> Indoor</label>
  <label><input type='radio' name='indoor-outdoor'> Outdoor</label>
  <br>
  <label><input type='checkbox' name='personality'> Loving</label>
  <label><input type='checkbox' name='personality'> Lazy</label>
  <label><input type='checkbox' name='personality'> Crazy</label>
  <br>
  <input type='text' placeholder='cat photo URL' required>
  <button type='submit'>Submit</button>
</form>
Jonathan
@jonathantimm
Jun 21 2015 19:46
Well, got it. I guess it wanted me to replace the original photo, not add another one. The instructions were unclear on that one.
Den McHenry
@denmch
Jun 21 2015 20:36
It wants you to add another with the image-responsive class, if I recall.
The test checks that the class is applied to the second image, and if it finds it on the first it assumes you made a mistake.
J.Gary Picard
@mrpickens
Jun 21 2015 20:37
I can’t figure out how or where to ‘DEGRADE” a ‘font’ setting in my project
Make all your h2 elements use "Lobster" as their font family, but degrade to the "Monospace" font when the "Lobster" font isn't available.
leave "Lobster" your h2 element's font-family, and have it "degrade" to a different font when "Lobster" isn't available.
use the "Helvetica" font, but also degrade to the "Sans-Serif" font when "Helvetica" wasn't available, you could use this CSS style: p { font-family: Helvetica, Sans-Serif; }
Ben McMahon
@benmcmahon100
Jun 21 2015 20:40
@mrpickens when you do you font-family in css you add the degrading fonts after commas
so font-family: "Times New Roman", Times, serif;
Den McHenry
@denmch
Jun 21 2015 20:41
^^
It's called a font stack.
Ben McMahon
@benmcmahon100
Jun 21 2015 20:41
says use "Times New Roman" or if you cant use times or if you cant use serif
J.Gary Picard
@mrpickens
Jun 21 2015 20:41
ok
Jeff Wilkey
@JeffWilkey
Jun 21 2015 20:41
so it will look something similar to this p { font-family: Lobster, Helvetica, Sans-serif;}
Ben McMahon
@benmcmahon100
Jun 21 2015 20:41
^^
exactly!
Den McHenry
@denmch
Jun 21 2015 20:41
You list fonts in order of preference so that a user without your preferred font will display a nice backup.
J.Gary Picard
@mrpickens
Jun 21 2015 20:42
let me try
ok
thanks
brb
maybe
Luis Fuentes
@luis-fuentes
Jun 21 2015 20:48
function pairwise(arr, arg) {
  var newarr = [0];
  var i = 0;
  var x = 0;

  for (i in arr) {

    if (canBeSum(arr[i]) === true) {
      // If sum is true push 2 index
      newarr.push(arr.indexOf(arr[i]), arr.indexOf(arr[x]));
      // remove values of array
      arr[i] = -1;
      arr[x] = -1;

    }

  }
  function canBeSum(num) {
    for (x in arr) {
      if (num + arr[x] === arg && i !== x) {
        //return true if sum is true
        console.log(x, i);
        return true;
      }
    }
  }

  var total = newarr.reduce(function(a, b) {
    return a + b;
  });
  return total;
}

//pairwise([1,4,2,3,0,5], 7); //11 ok
//pairwise([1, 3, 2, 4], 4); //1 ok
//pairwise([0, 0, 0, 0, 1, 1], 1); //10 ok
//pairwise([], 100); // 0 ok
pairwise([1,1,1], 2); //1
Please help with Bonfire: Pairwise, works in all the cases but pairwise([1,1,1], 2) = 0... but index are 0 and 1, should be 1. i don’t know why...
J.Gary Picard
@mrpickens
Jun 21 2015 20:52

<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>

<style>
.red-text {
color: red;
}

h2 {
font-family: Lobster;
}

p {
font-size: 16px;
font-family: Monospace;
}
</style>

<h2 class='red-text'>CatPhotoApp</h2>

<p class='red-text'>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p class='red-text'>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

I can't seem to place the "p { font-family: Lobster, Helvetica, Sans-serif;} to make this work
Ben McMahon
@benmcmahon100
Jun 21 2015 20:55
@mrpickens you should have
p {
font-size: 16px;
 font-family: Lobster, Helvetica, Sans-serif;
}
J.Gary Picard
@mrpickens
Jun 21 2015 20:55
basically where do I place my input
Den McHenry
@denmch
Jun 21 2015 20:55
In the style element.
J.Gary Picard
@mrpickens
Jun 21 2015 20:56
ok let me try
Den McHenry
@denmch
Jun 21 2015 20:56
It opens <style> and closes </style>.
It currently has p set to monospace.
Jeff Wilkey
@JeffWilkey
Jun 21 2015 20:56
Remember that the waypoint actually asks for you > to set your h2 elements to use "Lobster" and degrade to "Monospace".
You should set up degrading for your h2 element not your p element
J.Gary Picard
@mrpickens
Jun 21 2015 21:03
It says I need to - Your h2 element should degrade to the font "Monospace" when "Lobster" is not available.
Ben McMahon
@benmcmahon100
Jun 21 2015 21:04
so
h2 {
font-family: Lobster, Monospace;
}
#shouldberight
Jeff Wilkey
@JeffWilkey
Jun 21 2015 21:04
^^ yep!
J.Gary Picard
@mrpickens
Jun 21 2015 21:06
That worked!! but I still don't know why
everyone's help is greatly appreciated
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:07
@mrpickens let's say i'm a browser and i see the following css rule: h3 { font-family: Moe, Larry, Curly, sans-serif };
J.Gary Picard
@mrpickens
Jun 21 2015 21:07
ok
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:07
first I'm going to look for the font "Moe" and see if I can show it to the user
based on the local environment where I'm being loaded
J.Gary Picard
@mrpickens
Jun 21 2015 21:07
ok
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:07
if "Moe" isn't available, I'm going to look for a font called "Larry"
that's what "degrading" means
Jeff Wilkey
@JeffWilkey
Jun 21 2015 21:07
Well put @Nbutter
J.Gary Picard
@mrpickens
Jun 21 2015 21:08
ok
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:08
if i can't find a font called Larry, I'll look for a font called "Curly"
J.Gary Picard
@mrpickens
Jun 21 2015 21:08
let me digest this
and thanks
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:08
and if I can't find that... I'm supposed to use any freaking font that's sans-serif
Lightwaves
@Lightwaves
Jun 21 2015 21:08
Three stooges reference?
J.Gary Picard
@mrpickens
Jun 21 2015 21:08
lol
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:08
so that's just how we list fonts. because if you think about all the devices that show web pages... they all have different fonts available
so we can never really be fully sure
and we use backups
J.Gary Picard
@mrpickens
Jun 21 2015 21:09
getting it
starting to see "WHY"
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:09
as a designer, I really really want my page to show "Moe" font
i designed it that way
that's what i look at all day on my expensive monitor and macbook pro loaded with every expensive font
but some guy with some weird smartphone may not have "Moe"
maybe he has "Larry" because it came with some old version of android or something
J.Gary Picard
@mrpickens
Jun 21 2015 21:10
SO he needs a back up
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:10
so as a designer, I still would rather he have Larry than whatever his default is
which is usually Times New Roman
which is what the browser will use if the designer didn't specify anything
J.Gary Picard
@mrpickens
Jun 21 2015 21:11
'Larry' is a font
and 'Moe ' too?
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:11
yeah, in this example these are all font names except for "sans serif" which is a more general description of a lot of different fonts
J.Gary Picard
@mrpickens
Jun 21 2015 21:12
ok Nbutter
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:12
an example with real font names would be like Futura, Univers, "Helvetica Neue", sans-serif
you only have to use quotes if the font name is more than one word
J.Gary Picard
@mrpickens
Jun 21 2015 21:12
those i know
Nbutter short for nutterbutter
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:13
same thing, you're trying to make sure the page looks vaguely like what you intended even if your first-choice font isn't available
no but i like 'em
J.Gary Picard
@mrpickens
Jun 21 2015 21:13
me too
off to camp
David Wilbanks
@dwilbank68
Jun 21 2015 21:14
sometimes you specify a cool font, and the fallback is 'cursive' then when other people without that font look at your page, they see the default cursive font, then they make fun of you for using Brush Script or Comic Sans when that wasn't even your intention. Then you are sad.
Lightwaves
@Lightwaves
Jun 21 2015 21:14
By the way the in the word sans-serif . Sans means without
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:15
implying i didn't specify comic sans as my first choice font!!!
Lightwaves
@Lightwaves
Jun 21 2015 21:15
serifs are the little accents that are used to differient similar looking letters from one another
David Wilbanks
@dwilbank68
Jun 21 2015 21:15
yep
Lightwaves
@Lightwaves
Jun 21 2015 21:15
some typefaces have them
those are serif typefaces
the ones without are sans-serif
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:16
(actually on april 1 last year i did send an urgent text message to my designer telling him about the new font management wanted everything changed to.. you guessed it..)
Ben McMahon
@benmcmahon100
Jun 21 2015 21:16
^^ like I vs l
David Wilbanks
@dwilbank68
Jun 21 2015 21:16
I read that serifs were chiseled into stone (by Romans of course) to allow ice to expand without breaking the letters
which is the most hated font? Is it comic sans? I forgot.
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:17
wow. i'm gonna not even look that up, it's too cool not to be true
David Wilbanks
@dwilbank68
Jun 21 2015 21:17
makes sense for the legs of fonts, but not so much for the tops
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:17
oh yeah, it's comic sans by a mile. although it did have a comeback with the doge craze
David Wilbanks
@dwilbank68
Jun 21 2015 21:17
if they are vertical
Lightwaves
@Lightwaves
Jun 21 2015 21:17
Haha seriously that does sound cool
David Wilbanks
@dwilbank68
Jun 21 2015 21:18
anyone tackled the wikipedia api?
kick0n
@kick0n
Jun 21 2015 21:21
.
Abdul R. Taleb-Agha
@atalebagha
Jun 21 2015 21:22
I’m doing Bonfire: Seek and Destroy and it is not filtering the array. Here is my code
function destroyer(arr) {

  function makeFilter(value) {
      return value !== arguments;
  }

  arr.filter(makeFilter);

  return arr;
}

destroyer([1, 2, 3, 1, 2, 3], 2, 3);
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:24
@atalebagha what do you think "arguments" is?
and what do you think "arr" is?
Abdul R. Taleb-Agha
@atalebagha
Jun 21 2015 21:25
@Nbutter arguments == arr ??
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:25
there are a few more steps required here
Abdul R. Taleb-Agha
@atalebagha
Jun 21 2015 21:26
or arguments == value?
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:26
perhaps you could use console.log() to investigate what exactly is included in "arr" and in "arguments"
Abdul R. Taleb-Agha
@atalebagha
Jun 21 2015 21:26
alright I’ll check it out
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:26
and this might lead you in the right direction ; )
Abdul R. Taleb-Agha
@atalebagha
Jun 21 2015 21:32
thanks
Luis Fuentes
@luis-fuentes
Jun 21 2015 21:33
Someone can help me with Bonfire: Map the Debris, i think i know how to do the fuctions but i don’t know how to calculate the orbital period :worried:
Nicholas Butterworth
@Nbutter
Jun 21 2015 21:36
@YotaCL i was able to work it out with the wikipedia article they linked to and a bit of googling...
Luis Fuentes
@luis-fuentes
Jun 21 2015 21:39
i see the formula on wikipedia, but i don’t get all the variables. is the Small body orbiting a central body calculation right?
Brett Flanders
@tourn171
Jun 21 2015 21:43
2 * PI * sqrtof avgAlt + earthsradius ^ 3 / GM
Luis Fuentes
@luis-fuentes
Jun 21 2015 21:45
thank you!!!
Brett Flanders
@tourn171
Jun 21 2015 21:45
np the math part is where i got stuck on that one too
the coding was the easy part lol
Jakob Dahl
@saadanerdetbare
Jun 21 2015 21:47
@tourn171 like in real life - 2/3 of the time goes into understanding what people is asking and the rest is coming up with a solution
:)
Lightwaves
@Lightwaves
Jun 21 2015 21:48
the earth is giant balloon you are inside the ballon the avg altitude is a needle entering from the outside heading straight to you :P
Brett Flanders
@tourn171
Jun 21 2015 21:50
lol
Nick Magerko
@nmagerko
Jun 21 2015 21:55
Can someone explain what I’m supposed to make happen in the “Pairwise” bonfire? The instructions seem more difficult to understand than the problem’s solution...
Luis Fuentes
@luis-fuentes
Jun 21 2015 22:01
@tourn171 @saadanerdetbare i was thinking in the objetive of the bonfire, the fuction is really easy if you know the formula. but the formula is really hard :/ i get what they want right away, but struggle with the how to
Hugo
@HugoNebreda
Jun 21 2015 22:04
@nmagerko That is a two part problem
One part, you have to find the "pairs" or combinations that equals the sum, knowing that once one number is paired, cannot be paired with another one
And once you have that, you need to know the indexes of that paired numbers in the original array and sum them to return the result
So using the simples example provided from the instructions:
([1, 3, 2, 4], 4)
Part 1 - Find pairs: [1,3] is the only pair posible that sums 4
Part 2 - Sum the indexes: Index of 1 --> 0 ; index of 3 ---> 1 so... 0 + 1 = 1
Nick Magerko
@nmagerko
Jun 21 2015 22:08

@HugoNebreda Sure, but in the example pairwise([1, 4, 2, 3, 0, 5], 7), apparently elements with indices 4, 2, 3, and 5 can be paired with each other to equal seven.

I disagree. I cannot pair values 0 and 2 together to get 7; nor can I with values 3 and 5

Hugo
@HugoNebreda
Jun 21 2015 22:09
no, that arent indexes, they're the numbers
[4,3] and [5,2]
Nick Magerko
@nmagerko
Jun 21 2015 22:09
Ah, I see. Well that clears it up then, thank you
Hugo
@HugoNebreda
Jun 21 2015 22:10
The instructions are some times a little bit trickier than you expect
so I always run the test after reading instructions
to see what are the "correct" values
expected
Nick Magerko
@nmagerko
Jun 21 2015 22:11
Haha no kidding — that’s a good strategy, by the way.
Hugo
@HugoNebreda
Jun 21 2015 22:11
One more thing for this bonfire, is that the dificult part is that you normally think in indexes, or in values, but in this, your solution must use both to get the problem solved
And of course, there going to be weird inputs in the tests
Den McHenry
@denmch
Jun 21 2015 22:22
Be careful not to write code for the tests, though.
I've seen code that includes things like, if (result === 5) { return true }; because they were failing one test case and this "passed."
It's definitely helpful sometimes to see the failed tests to verify that you understand the instructions.
David Wilbanks
@dwilbank68
Jun 21 2015 23:42
Checking every few hours... anyone tackled the wikipedia API zipline?
Luis Fuentes
@luis-fuentes
Jun 21 2015 23:51
not yet, sorry