These are chat archives for FreeCodeCamp/Help

9th
Apr 2015
Tim Pinoy
@waeren
Apr 09 2015 01:14

Question about http://www.freecodecamp.com/bonfires/symmetric-difference

assert.deepEqual(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5], 'should return the symmetric difference of the given arrays');

Shouldn't the answer be [1,4] ?

Luis Herrera
@luhego
Apr 09 2015 01:36
Hello everyone
Carlos Toro Vera
@carmelo12341
Apr 09 2015 01:37
nope, the answer is correct @waeren
@luhego hi there!
Luis Herrera
@luhego
Apr 09 2015 01:37
I have a doubt about this bonfire: "Truncate a string". I think my code is ok, but it's wrong.
http://repl.it/hmK
Tim Pinoy
@waeren
Apr 09 2015 01:38
@carmelo12341 Ok then I'm lost at what the goal is since the following is mentioned:
the elements in two sets that are in either the first or second set, but not in both.
5 is in all 3
Carlos Toro Vera
@carmelo12341
Apr 09 2015 01:39
just like you said, there are either the first or the second. but not the both
but you are getting the symetric difference of the 3
3diferenciasimetrica.png
that is a better example for the symetric difference of 3
you need to return the red colored part
@luhego can you write the statement please? I can't remember :)
Tim Pinoy
@waeren
Apr 09 2015 01:42
myea in that case the explanation in the challenge is leaving out some much needed info
Luis Herrera
@luhego
Apr 09 2015 01:42
Ok
Carlos Toro Vera
@carmelo12341
Apr 09 2015 01:43
not that, the explanation of what you are supposed to do :/ @luhego
Briana Swift
@brianamarie
Apr 09 2015 01:43
I just finished up that one and it took me so long to understand the problem...Things that helped me 1) There will either be 2 or 3 sets.No more. 2) If it's in 1, return it. If it's in 3, return it. Else, don't.
Luis Herrera
@luhego
Apr 09 2015 01:44
I understand I have to truncate a string if its length is less than the second argument
and I have to use the second parameter as an argument in str.slice()
Carlos Toro Vera
@carmelo12341
Apr 09 2015 01:46
@waeren actually the explication is pretty complete, just take 2 arrays, get the symetric difference , and then get the difference between the third argument and the previously obtained difference
if there is a third argument, otherwise, just return the difference of the 2 arguments
Carlos Toro Vera
@carmelo12341
Apr 09 2015 01:54
@luhego remember that the 3 dots are part of the length
if the new length you need is 11, you have the count the 3 dots, so you will need to truncate 8 characters including the 3 dots :)
Briana Swift
@brianamarie
Apr 09 2015 14:36
Question for clarity on bonfire "Map the Debris" : The given average altitude is from sea level, correct? Does anyone know? http://www.freecodecamp.com/bonfires/map-the-debris
Briana Swift
@brianamarie
Apr 09 2015 14:49
Ah. Figured it out. It's from sea level.
Oliver
@Dadsaster
Apr 09 2015 15:55
yeah - you need to add the radius of the earth to the altitude figure
Meta Hirschl
@MetaCoderHirschl
Apr 09 2015 17:03
greetings! I'm befuddled trying to deploy a first version of our app for nonprofit to Heroku. anyone can offer help? I'd really appreciate it. I've tried every stack overflow trick I can find. App builds in Heroku but App error on deploy
Cristián Berríos
@crisberrios
Apr 09 2015 17:26
hello @MetaCoderHirschl
could you give me more details?
Meta Hirschl
@MetaCoderHirschl
Apr 09 2015 17:27
Hi!
sure -- heroku log first error is: Error: Cannot find module './config'
config.js is at root
so - I've tried a lot of fixes, latest one was to set a heroku variable at command line: heroku config:set NODE_ENV=production -before build, didn't do it.
Cristián Berríos
@crisberrios
Apr 09 2015 17:32
ok
so you are doing a require('./config')
on the main app.js?
Meta Hirschl
@MetaCoderHirschl
Apr 09 2015 17:33
no
Cristián Berríos
@crisberrios
Apr 09 2015 17:34
where is ./config being required?
Meta Hirschl
@MetaCoderHirschl
Apr 09 2015 17:35
I could add "var Config = require('./config');" to app.js
Cristián Berríos
@crisberrios
Apr 09 2015 17:36
I mean, if you are getting the error, it's because somewhere in the code you are using require(./config)
Meta Hirschl
@MetaCoderHirschl
Apr 09 2015 17:37
the manifest.js
of course, yes, you are right....it's being called in the manifest.js
Cristián Berríos
@crisberrios
Apr 09 2015 17:38
and where is manifest.js located?
Meta Hirschl
@MetaCoderHirschl
Apr 09 2015 17:38
also at root
Cristián Berríos
@crisberrios
Apr 09 2015 17:39
try changing require('./config') to ('./config.js')
Meta Hirschl
@MetaCoderHirschl
Apr 09 2015 17:40
thanks, makes sense...coz looking for a folder that isn't there. Will try. question, why works locally and not on heroku, but, let me try this first!
Cristián Berríos
@crisberrios
Apr 09 2015 17:42
no, it should work without .js
but if it's not, then .js is explicit
require defaults to filename.js then /folder/index.js
Meta Hirschl
@MetaCoderHirschl
Apr 09 2015 17:52
grrr. still 'Cannot find module '/config.js' ---I've got to step out for a bit,thanks for your input. I'll keep at it. I've deployed rails to heroku in the past and wasn't so hard. I think I'm missing something (in my head!)
Cristián Berríos
@crisberrios
Apr 09 2015 17:57
that's weird, I hope you can fix it. If you still need help I can take a look at your code and try to see what's wrong
Meta Hirschl
@MetaCoderHirschl
Apr 09 2015 18:00
thx!
VonRichtoffen
@VonRichtoffen
Apr 09 2015 22:30
can anyone offer help with the mutation bonfire?
I'm getting further and further from the answer. I'm trying to sort the arrays and then use indexOf to find one sorted string in the other
is not working
I'm mutating into a frustrated biomass
VonRichtoffen
@VonRichtoffen
Apr 09 2015 22:53
never mind. I found local help.
Evan Davis
@davisec52
Apr 09 2015 23:08

Hi, everybody. I'm working on the express challenges and am
following the codeschool courses. I'm on level 3, user params,
section 2. I've been following the code in the videos but the
code sample below doesn't work for me.

The main issue is that GET does not work for locations.
It will return results for blocks, but the browser
returns "Cannot GET /locations/Fixed" for a url
string calling locations. Any idea why?

var express = require('express');
var app = express();
var request = require('request');

var blocks = {
  'Fixed': "Fastened securely in position",
  'Movable': "Capable of being moved",
  'Rotating': "Moving in a circle around its center"};

 var locations = {'Fixed': 'First floor', 'Movable': 'Second floor', 'Rotating': 'Penthouse'};

 app.param('name', function(request, response, next) {
  var name = request.params.name;
  var block = name[0].toUpperCase() + name.slice(1).toLowerCase();

  request.blockName = block;

  next();
 });

app.get('/blocks/:name', function(request, response) {
  var description = blocks[request.blockName];

  if(!description) {
    response.status(404).json('No description found for '+ request.params.name);
  }
  else {
    response.json(description);
  } 
});

app.get('/locations/:name', function(request, response) {
  var location = locations[request.blockName];

  if(!description) {
    response.status(404).json('No location found for '+ request.params.name);
  }
  else {
    response.json(location);
  } 
});

app.listen(3000);
Cristián Berríos
@crisberrios
Apr 09 2015 23:37
shouldn't be easier to pass the name in the callback?
BTW

We are moving to Slack

Evan Davis
@davisec52
Apr 09 2015 23:42
@crisberrios I'm just following the code as demonstrated in the video. This is the first problem I've run into.
Cristián Berríos
@crisberrios
Apr 09 2015 23:43
sama express version? 3.x vs 4.x
Evan Davis
@davisec52
Apr 09 2015 23:46
version 4.x
although, now that you mention version, the current 4.x may not be the same as the version 4.x used when codeschool produced the video.
Cristián Berríos
@crisberrios
Apr 09 2015 23:56
but there shouldn't be breaking changes
only 3.x to 4.x had major changes to the API