Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Matt
@DaftlyPunkish
it*
Refresh it
@DaftlyPunkish
you need to return from the function
return compChoice
so when you call compPicker()
it will give you compChoice
or whatever you return from that function
making any sense?
Matt
@DaftlyPunkish
It does
I'm just trying to figure out how to apply that to my function
Tom
@moT01
@IsaakNazar ease-in-out does not mean the transition will fade in, then also fade out - it means that the speed of the transtion will start slow (ease-in) and end slow (ease-out)
Matt
@DaftlyPunkish
I'm still getting an error
function compPicker() {
var compChoice = options[Math.floor(Math.random() * 9)];
return compChoice();
}
Tom
@moT01
compChoice is a variable, not a function
Harut
@harut-g
Who is familiar with mongoose?
Matt
@DaftlyPunkish
Oh!
function compPicker() {
var compChoice = options[Math.floor(Math.random() * 9)];
console.log(compChoice);
}
Thank you!
Tom
@moT01
you could shorten it to return options[Math.floor.....9]
the dots not meaning dots -but the rest of what you had
@harut-g somewhat
Matt
@DaftlyPunkish
How would I apply that to the compchoice var?
Tom
@moT01
dont need it anymore
Harut
@harut-g
@moT01 have you experience with it?
Tom
@moT01
function compPicker() {
return options[Math.floor(Math.random() * 9)];
}
then if you console.log(compPicker()) elsewhere - you will get your random things
@harut-g somewhat
Matt
@DaftlyPunkish
I'm starting to think my logic is going to require way too much code and be ridiculously messy. I'm going to have to write an if/else statement for each choice and for each result the compPicker returns
Harut
@harut-g
@moT01 I have two create method on model, which saves the data. And I need to send some data when two methods is done, can you help me with it?
Tom
@moT01
@IsaakNazar move the transtion to the .links
and it will work both ways
Matt
@DaftlyPunkish
Plus all the if statements for all the win variables
Tom
@moT01
@harut-g do you have the code somewhere?
Harut
@harut-g
This message was deleted
                Facility.create(filesJson['facilities'], (err, result) => {
                   if (err) throw err;
                });

                People.create(filesJson['people'], (err, result) => {
                    if (err) throw err;
                });
@moT01 I need to send response when these two methods are done
Tom
@moT01
node?
express
Harut
@harut-g
@moT01 yes
Tom
@moT01
here's some code i've used
newBook.save().then(() => {
             books.find().then(r => {
res.send([r,message]);
i dunno, that's an area i need improvement on
so yours might look like...
facility.create(files.....).then((err,result) => {
    stuff
   people.create().then( => {
     res.send
  }

})
Tom
@moT01
probly not the best way to go, i think that stops the code - when ideally you probly want both of those to start together then send a response when the last one is done
someone posted a link to here about this - i didnt read it, but it might help http://www.datchley.name/es6-promises/
Chris Rutherford
@cjrutherford
anyone good with troubleshooting seed issues?
anyone here to answer questions?
Tom
@moT01
i cant try
Chris Rutherford
@cjrutherford

thanks @moT01 , I'm trying to see my database, and have two models that I have the seed data for in a JSON file. Both seed scripts are nearly identical. The only difference is the JSON file that gets imported, and the variable name that represents the seed data after import. The first imports fine, and the second files with an error like this:

== 20171030160224-outsider: migrating =======
Seed file failed with error: Cannot read property 'autoIncrement' of undefined TypeError: Cannot read property 'autoIncr
ement' of undefined
    at C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\dialects\mssql\query-generator.js
:264:48
    at C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:4389:15
    at baseForOwn (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:2652:24)
    at Function.forOwn (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:12254:24)
    at C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\dialects\mssql\query-generator.js
:258:15
    at arrayEach (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:473:11)
    at Function.forEach (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\lodash\lodash.js:8561:14)
    at Object.bulkInsertQuery (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\dialects\
mssql\query-generator.js:248:13)
    at QueryInterface.bulkInsert (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\node_modules\sequelize\lib\query-
interface.js:568:33)
    at Object.up (C:\Users\rutherfordc.AA\Documents\GitHub\ccs-express\server\seeders\20171030160224-outsider.js:7:27)
    at Migration._callee$ (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\umzug\lib
\migration.js:178:35)
    at tryCatch (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\regenerator-runtime
\runtime.js:65:40)
    at Generator.invoke [as _invoke] (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_module
s\regenerator-runtime\runtime.js:299:22)
    at Generator.prototype.(anonymous function) [as next] (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequ
elize-cli\node_modules\regenerator-runtime\runtime.js:117:21)
    at step (C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\babel-runtime\helpers\a
syncToGenerator.js:17:30)
    at C:\Users\rutherfordc.AA\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules\babel-runtime\helpers\asyncTo
Generator.js:28:13
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

The seed script is as follows:

'use strict';
const cjson = require('cjson');
var outsiderData = cjson.load('server/seeders/Outsider.json');

module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.bulkInsert('Outsiders', outsiderData);
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.bulkDelete('Outsiders', null, {});
  }
};