GithubHelp home page GithubHelp logo

nodejs1's People

Contributors

sitepointeditors avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodejs1's Issues

Error in exchange.js?

While running the Chapter 2 code. I found that the code in func "order" would trade any remainingvolume at the best available opp price irrespective of the actual order price. I am not an expert on "Trading" but based on the write up in the book the price check seems to be missing. I added the following and the code works as I expect it should:

var bestOppPrice = oppBook.prices.peek();
var bestOppVol = oppBook.volumes[bestOppPrice];
if (orderType == BUY &&
bestOppPrice > price) {
console.log("break for buy");
break;
}
else if (orderType == SELL &&
bestOppPrice < price) {
console.log("break for sell");
break;
}

Chapter 1 Model User.js

I was going into chapter three changing from the mongolabs to the interal mongo db and got this error, scratching my head wondering what I am doing wrong.
var UserSchema = new db.Schema({
^
TypeError: undefined is not a function
at Object. (/srv/www/www.cross-town-traffic-software.com/public_html/free-cite/models/User.js:3:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

Error in Chapter 2 Code

I am getting an error when trying to run the code for Chapter 2 examples. I get down to the last bit of code before adding the priceFeed.js file; basically all of the exchange.js code and when I run the tests they pass but when I run node nockmarket I get the following error:

$ node nockmarket
order { type: 'buys', price: 35, volume: 93 }

35, 93

TypeError: Object 0 has no method 'toLowerCase'
    at Object.parse [as shorthandParser] (/Users/mswanson/Sites/1524/learning/nodejs/nockmarket/node_modules/jquery/node_modules/jsdom/node_modules/cssstyle/lib/parsers.js:349:11)
    at CSSStyleDeclaration.border (/Users/mswanson/Sites/1524/learning/nodejs/nockmarket/node_modules/jquery/node_modules/jsdom/node_modules/cssstyle/lib/parsers.js:373:27)
    at Object.rbrace (/Users/mswanson/Sites/1524/learning/nodejs/nockmarket/node_modules/jquery/lib/node-jquery.js:1631:21)
    at fire (/Users/mswanson/Sites/1524/learning/nodejs/nockmarket/node_modules/jquery/lib/node-jquery.js:1100:30)
    at Object.self.fireWith (/Users/mswanson/Sites/1524/learning/nodejs/nockmarket/node_modules/jquery/lib/node-jquery.js:1218:7)
    at jQuery.extend.ready [as _onTimeout] (/Users/mswanson/Sites/1524/learning/nodejs/nockmarket/node_modules/jquery/lib/node-jquery.js:460:14)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

I am trying to learn node and I am not sure where to even look to debug this code. Just to be sure it wasn't user error I copied the code from the repository and tried again. I'm still getting the error. Please help. Also some guidance on how best to debug this code would be helpful as well (you know the whole teach a man to fish...). Normally I would just use the Chrome debugger to step through the code.

Thanks

Uncaught exception in chapter01 code

I am using Node 0.8.17 if that matters and while doing npm install in main directory of chapter01 after node app.js I get this:

$node app.js
Express server listening on port 3000 in development mode

/home/user/programming/nodejs/NODEJS1/chapter01/authentication/node_modules/mongoose/lib/utils.js:413
throw err;
^
Error: Uncaught, unspecified 'error' event.
at NativeConnection.EventEmitter.emit (events.js:73:15)
at Model.init (/home/user/programming/nodejs/NODEJS1/chapter01/authentication/node_modules/mongoose/lib/model.js:554:31)
at exports.tick (/home/user/programming/nodejs/NODEJS1/chapter01/authentication/node_modules/mongoose/lib/utils.js:408:16)
at Db.ensureIndex (/home/user/programming/nodejs/NODEJS1/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1066:28)
at Db.indexInformation (/home/user/programming/nodejs/NODEJS1/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1200:28)
at Cursor.toArray (/home/user/programming/nodejs/NODEJS1/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:124:30)
at Cursor.each (/home/user/programming/nodejs/NODEJS1/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:166:32)
at Cursor.nextObject.self.queryRun (/home/user/programming/nodejs/NODEJS1/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:441:39)
at Cursor.close (/home/user/programming/nodejs/NODEJS1/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:687:5)
at Cursor.nextObject.commandHandler (/home/user/programming/nodejs/NODEJS1/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:441:21)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.