spbooks / nodejs1 Goto Github PK
View Code? Open in Web Editor NEWJump Start Node.js, code archive
Jump Start Node.js, code archive
Within portfolio.ejs, http://twitter.github.com/bootstrap/assets/js/bootstrap-tab.js is broken and nothing happens when the Nockmarket tab is clicked. Has anyone dealt with this or know how to fix it?
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;
}
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
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
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.