These are chat archives for FreeCodeCamp/Help

13th
Mar 2015
Suzanne Atkinson
@AdventureBear
Mar 13 2015 00:30
turns out there were only about 20 of them, so I did it manually
Suzanne Atkinson
@AdventureBear
Mar 13 2015 01:04
IT"S WORKING
Cristián Berríos
@crisberrios
Mar 13 2015 01:11
good!
but I think you got routers wrong
the idea is to have routes in their own files
and route from root
so /todos is / on the router
then you require the route and mount it on /todos
Suzanne Atkinson
@AdventureBear
Mar 13 2015 01:24
I think the next tutorial from scotch covers refactoring the routes
You can't see the database from there but I got the 50k items imported
Check the products model
Cristián Berríos
@crisberrios
Mar 13 2015 01:36
looks fine to me
Suzanne Atkinson
@AdventureBear
Mar 13 2015 01:37
:-)
I'm Chuffed as they say in the UK!
Suzanne Atkinson
@AdventureBear
Mar 13 2015 01:43
Next I'd like to learn how to connect collections so we can make estimates for customers
Carlos Toro Vera
@carmelo12341
Mar 13 2015 02:16
how to solve the mutations bonfire?
any tips?
advice?
Cristián Berríos
@crisberrios
Mar 13 2015 02:20
my generic tip for all bonfires
check all the array and string methods
Suzanne Atkinson
@AdventureBear
Mar 13 2015 02:23
lol
OK, so @crisberrios on the routes...looks like my add bear & add todo doesn't work anymore, it adds an item, but doesn't keep the name. Is this b/c my routes are messed up and only the last set of routes works? (I don't htink so but suotmheint to thin about for tomorrow)
Cristián Berríos
@crisberrios
Mar 13 2015 02:24
what changes did you made?
Suzanne Atkinson
@AdventureBear
Mar 13 2015 02:26
oh, i was sending the wrong kind of data.
all I did was keep adding routes
by cutting & pasting them adding the new model
not too sophisticated, but it worked
I am using postman to test
I had to send the www-form - urlencoded to get the new todo or new bear's name to stick. :)
so now I ahve bears, todos and bicycle parts in one database.
lol
Cristián Berríos
@crisberrios
Mar 13 2015 02:27
nothing wrong with that as long as they are on their own collections
Suzanne Atkinson
@AdventureBear
Mar 13 2015 02:28
When I get all the products, the browser crashes, there are 55k of them! Is there a super quick way to just get 10 so I can show my boyfriend it's (kind of ) working before bed? in postman just using the api?
@crisberrios yes they are all in their own collections.
The bears are hibernating, the todos are gathering dust and the bike parts are rusting
    // get all the products (accessed at GET http://localhost:8080/api/products)
    .get(function(req, res) {
        Product.find(function(err, products) {
            if (err)
                res.send(err);

            res.json(products);
        });
    });
WHere can I find documentation for modifying the get actions? Is this mongoose? Express?
I think express!
Eric Blosch
@eblosch
Mar 13 2015 03:48
Has anyone already started the pairwise bonfire?
I'm not looking for help solving; just guidance understanding the parameters of the problem. The first test case makes sense, but I don't see how the description of the problem would allow [[0,0,0,0,1,1], 1] to equal 10.
Dan Raley
@danraley
Mar 13 2015 05:38
Hello!
I have a question relating to the first project to create your own site
is it possible to replace the input box (since it really does not work on that site) with a link/button to my wordpress blog and also to my twitter account?
I am determined to use that page as single page landing page for now in replacement of the page I created while going through a Treehouse tutorial.
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:39
@danraley Hey! Can you please provide the link for the challenge
Dan Raley
@danraley
Mar 13 2015 05:40
sure, hold on please.
would it be better to post the code I wrote in it here?
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:41
@danraley sure
post in in between ```
like:
// code here
Dan Raley
@danraley
Mar 13 2015 05:44
This message was deleted
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:44
@danraley add space after ``` at the top
same for the end
put ``` on a new-line after </body>
Screenshot from 2015-03-13 10:46:03.png
<!DOCTYPE html>
<head>
<title>Daniel Raley</title>
  <style>
  html {
    height: 100%;
    min-height:100%;
}
  body {
      text-align: center;
      background: url("http://i.imgur.com/PY2qlct.jpg");
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      width: 100%;
      height: 100%;
      color: white;
      font-family: helvetica;
  }
    body {
      min-height: 100%;
}
    p {
      font-size: 22px; 
      padding-top: 30px; 
   }
    input {
      border: 0;
      padding: 10px;
      font-size: 18px;  
   }

    input[type="submit"] {
      background: red;
      color: white;
   }

   img {
      border:2px solid white;
      border-radius: 100%;
      margin-top: 80px;
      box-shadow: 0 0 8px rgba(0, 0, 0, .8);
   }
  </style>
</head>
  <body>
    <img src= "http://i.imgur.com/PpTeWGE.jpg">
    <p>Hi! I'm Daniel Raley, a Tampa based Front End Web Developer. Say Hello!</p>
  </body>
Dan Raley
@danraley
Mar 13 2015 05:47
sorry I did not get that right
not sure where I went wrong
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:48
@danraley no prob
just skip that for now
so you wan't to add a twitter account button after the line of text?
Dan Raley
@danraley
Mar 13 2015 05:49
yes, that and a button linking to the blog I just started on wordpress
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:49
@danraley So you need to add:
  • A follow button to your Twitter account
  • A link to your blog
Dan Raley
@danraley
Mar 13 2015 05:50
correct
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:50
Okay so the Twitter button first
Dan Raley
@danraley
Mar 13 2015 05:50
then style the link so it does not just look like a plain link
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:51
And add in your account details
Dan Raley
@danraley
Mar 13 2015 05:51
done!
now can i add a link on same line to my blog, or will it have to be below that button?
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:52
@danraley no no wait
Dan Raley
@danraley
Mar 13 2015 05:52
ok
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:52
copy the code on the right
Dan Raley
@danraley
Mar 13 2015 05:52
I did
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:52
and paste in in your code after the <p> tag
Dan Raley
@danraley
Mar 13 2015 05:53
I did
and it worked
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:53
@danraley okay great
now the second thing is a link to your blog
that's simple
Dan Raley
@danraley
Mar 13 2015 05:53
simple os good for now lol
*is
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:54
<a href="link to blog">My blog or any text you want</a>
and if you want it to open the link in a new tab just add target="_blank" like this:
<a href="link to blog" target="_blank">My blog or any text you want</a>
Dan Raley
@danraley
Mar 13 2015 05:56
That worked for the link and I had added one like that previously, but wanted to try and add it more of a button style of link
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:56
@danraley you want to add a button?
Dan Raley
@danraley
Mar 13 2015 05:56
yes vs just a plain link, it gets lost on the page as just a link to me
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:57
so just add in a <button> tag
Dan Raley
@danraley
Mar 13 2015 05:57
where would that be added in at?
would be nice if wordpress had something like twitter!
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 05:59
@danraley
<button><a href="http://blog.ammaralishah.me/" target="_blank">Ammar's Blog</a></button>
Something like this maybe
You can style the <a> tag to your liking
tweak it a bit
Dan Raley
@danraley
Mar 13 2015 06:00
ok, I'll try that
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 06:03
@danraley so?
Dan Raley
@danraley
Mar 13 2015 06:03
can't get it to style?
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 06:03
@danraley why not?
Dan Raley
@danraley
Mar 13 2015 06:03
i don't know
I added the a {}
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 06:03
a{
   text-decoration: none;
   color: red;
}
@danraley any luck?
Dan Raley
@danraley
Mar 13 2015 06:08
some, was able to change color to black, but not the size to match the twitter one, and they are not aligned ( blog button it lower than twitter one
it actually looks like the twitter one is sitting on top of the other
Ammar Ali Shah
@AmmarAliShah
Mar 13 2015 06:22
okay I'm back
@danraley ah alignment problems
Dan Raley
@danraley
Mar 13 2015 06:24
yes
Blake Johnston
@johnstonbl01
Mar 13 2015 17:35

howdy y'all. truncate a string bonfire:
why doesn't this work?

function truncate(str, num) {
  // Clear out that junk in your trunk
  str.substring(0, num);
  console.log(str);
}

i couldn't get the substring() method to work at all. feel like i'm missing something obvious...

result i get back in console is:
//A-tisket a-tasket A green and yellow basket
Andrew Corcoran
@corca
Mar 13 2015 17:37
@johnstonbl01 The substr method returns a new string but doesn’t modify the one passed to it.
Blake Johnston
@johnstonbl01
Mar 13 2015 17:37
got it - thanks
Andrew Corcoran
@corca
Mar 13 2015 18:04
Did the Sorted Union bonfire confuse anyone else?
Evan Davis
@davisec52
Mar 13 2015 18:44

Good afternoon everybody. I'm working on a Codepen practice project that involves using jquery to activate a button on a simple form. The button (Add tasks) reveals a section on the form for data input. I have activated jquery through the Codepen interface. The code is located at the bottom of the .html, and I've also included the
snippet below.

The codepen link: http://codepen.io/davisec52/pen/ramPVG

Here is another link to a live example on my own hosting account: http://www.xylomance.com/tasks.html.

I'd appreciate anyone taking a look to spot the error.


<script>
  $('[required="required"]').prev('label').append('<span>*</span>').children('span').addClass('required');

  $('tbody tr:even').addClass('even');

  $('#btnAddtask').click(function(evt){evt.preventDefault(); $('#taskCreation').removeClass('not');
  });

  $('tbody tr').click(function(evt){$evt.target).toggleClass('row.Highlight');
  });
</script>
Bojangerton the 3rd
@SuperBojangs
Mar 13 2015 19:06
I use jsbin because the console is right there and you can look and see errors easy
Evan Davis
@davisec52
Mar 13 2015 19:09
I should have excerpted the specific code chunK:

<script>
   $('#btnAddtask').click(function(evt){evt.preventDefault(); $('#taskCreation').removeClass('not');
  });
</script>
Danny Fritz
@dannyfritz
Mar 13 2015 19:16
@davisec52 I'm guessing having the <script> tag orphaned like that makes it execute before <body>, despite placing it after <body>. <script> tags are only valid in <body> or <head>
Evan Davis
@davisec52
Mar 13 2015 19:18
@dannyfritz Thank you, Danny. I tried placing the code before the </body> tag with no effect. I did not try placing it in <head>
Danny Fritz
@dannyfritz
Mar 13 2015 19:18
@davisec52 capitalize the T in btnAddtask
Evan Davis
@davisec52
Mar 13 2015 19:21
@dannyfritz unfortunately, no change.
Danny Fritz
@dannyfritz
Mar 13 2015 19:22
I got it to work using #btnAddTask
a form appeared when i clicked the button
Evan Davis
@davisec52
Mar 13 2015 19:22
@dannyfritz I'll try again
That is what should happen
@dannyfritz How strange. Doesn't want to work for me.
Ok. it is working on the version uploaded to private hosting. For some reason must not working for me on Codepen.
Evan Davis
@davisec52
Mar 13 2015 19:28
@dannyfritz Anyway, thank you for catching the error!
James Barnett
@barnettjw
Mar 13 2015 20:46
Trying to figure out what to do with a bonfire
Andrew Corcoran
@corca
Mar 13 2015 21:10
@barnettjw Which one?
Christopher Nguyen
@crosscris
Mar 13 2015 23:15
Does anyone have experience resizing an overlay after expanding the page?
Suzanne Atkinson
@AdventureBear
Mar 13 2015 23:17
an image?
Christopher Nguyen
@crosscris
Mar 13 2015 23:18
I have a overlay for a modal window. It goes to 100% in the beginning. However, I expand the body and the overlay maintains its size.
I've gotten it to work by making the overlay fixed, but...I think making the overlay actually take over the entire doc would be faster.
Suzanne Atkinson
@AdventureBear
Mar 13 2015 23:25
oh. dunno.
sorry. I keep trying to help people.
no go.
Christopher Nguyen
@crosscris
Mar 13 2015 23:26
All good. I appreciate any input. Gotta see new problems to find new solutions.
I'm just gonna use fixed positioning for now and mark my notes.
Suzanne Atkinson
@AdventureBear
Mar 13 2015 23:31
/Users/suzanne/Developer/bikebuilder/server.js:291
require('./app/routes')(app);
                       ^
TypeError: object is not a function
    at Object.<anonymous> (/Users/suzanne/Developer/bikebuilder/server.js:291:24)
any thoughts on this nodemon error?
it occured when I tried to refactor my server.js and put the routes in their own files. Maybe a typo is hiding
Christopher Nguyen
@crosscris
Mar 13 2015 23:36
I'm seeing two possibilities: files aren't there or that reference is broken somewhere.
Cristián Berríos
@crisberrios
Mar 13 2015 23:44
you are calling routes as a function
what does routes look like?
does it export a function, an object?