Tampilkan postingan dengan label 1. Tampilkan semua postingan
Tampilkan postingan dengan label 1. Tampilkan semua postingan
Mongo M101JS Week 1
Introduction to Schema Design (? min)
Blog in Documents (? min)
Blog in Relational Tables (? min)
Introduction to class project - Blog (? min)
JSON Spec (? min)
JSON subdocuments (? min)
JSON Revisited (? min)
MongoDB is Schemaless (? min)
Express: Handling POST Requests (? min)
Express: Handling GET Requests (? min)
Hello World using Express, Swig, and Mongo (5.5 min)
Hello World using Express and Swig (3.5 min)
Consolidate is a library handles
Swig is the template engine
Here is the app.js:
var express = require(express),
app = express(),
cons = require(consolidate); // Templating library adapter for Express
app.engine(html, cons.swig);
app.set(view engine, html);
app.set(views, __dirname + /views); // html files stored in directory views
app.get(/, function(req, res){
res.render(hello, { name : World });
});
app.get(*, function(req, res){
res.send(Page Not Found, 404);
});
app.listen(8080);
console.log(Express server started on port 8080);
hello.html:
<h1>Hello, {{name}}!</h1>
Hello World using Express (4 min)
Express is a library for node.js which handles routing and details in a web application context.
// to install the express module for node.js use the following:
// npm install express
var express = require(express);
var app = express(); // create instance of application
app.get(/, function(req, res){
res.send(Hello World);
});
app.get(*, function(req, res){
res.send(Page Not Found, 404);
});
// start the server
var port = 8082;
app.listen(port);
console.log(Express server started on port +port);
$ node app.js
Express server started on port 8082
$ curl http://localhost:8082
Hello World
HelloWorld mongodb style (? min)
Introduction to npm (3 min)
npm is the package manager for node.js
require statements used to include external libraries in node.js.
var express=require(express);
var consolidate = require( consolidate );
var mongodb = require( mongodb );
package.json - has metadata about the package and dependencies
Hello world on Node.js (3 min)
Asynchronous vs. Synchronous (4.5 min)
mongo shell is synchronous
node.js is asynchronous
// mongo shell:
// Find one document in our collection
var doc = db.coll.findOne();
// Print the result
printjson(doc);
// file name: app.js
var MongoClient = require(mongodb).MongoClient;
MongoClient.connect(mongodb://127.0.0.1:27017/test, function(err, db) {
if(err) throw err;
// Find one document in our collection
db.collection(coll).findOne({}, function(err, doc) {
// Print the result
console.dir(doc);
// Close the DB
db.close();
});
// Declare success
console.dir("Called findOne!");
});
$ node app.js
Installing Node.js (mac) (1 min)
Installing from nodejs.org
Verify it is installed:
$ node
> console.log("Hello, Node")
Hello, Node
undefined
Node.js is a platform built on Chromes JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Introduction to JSON (? min)
Quick Introductoin to the Mongo Shell (? min)
Installing MongoDB windows (? min)
Installing MongoDB mac (? min)
System Requirements (? min)
Overview of Building an App with MongoDB (? min)
MongoDB relative to Relational (? min)
What is MongoDB? (? min)
Welcome to M101JS (2.5 min)
apache2 Could not reliably determine the servers fully qualified domain name using 127 0 1 1 for ServerName
How to fix Apache – "Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName" Error on Ubuntu
The following error while restarting the Apache server on Ubuntu Oneiric.
... waiting apache2: Could not reliably determine the servers fully qualified domain name, using 127.0.1.1 for ServerName
Solution: add ServerName directive to /etc/apache2/httpd.conf
ServerName localhost
Save the file and exit vi (or gedit).
Finally restart the server.
Read More..
The following error while restarting the Apache server on Ubuntu Oneiric.
$ sudo /etc/init.d/apache2 restart* Restarting web server apache2 apache2: Could not reliably determine the servers fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the servers fully qualified domain name, using 127.0.1.1 for ServerName
Solution: add ServerName directive to /etc/apache2/httpd.conf
$ sudo vi /etc/apache2/httpd.confBy default httpd.conf file will be blank. Now, simply add the following line to the file.
ServerName localhost
Save the file and exit vi (or gedit).
Finally restart the server.
$ sudo service apache2 restart
Sony 2 in 1 Dual Connector USM SA1 USB Drive
Sony Electronics has developed the new USM-SA1 USB drive which possesses dual micro USB and USB ports to offer consumers a brand new user experience, in addition to providing them with more options to backup, share and store their favourite photos, videos and music.
Available in capacities of 8GB, 16GB and 32GB, this new ultra-compact device gives users a smart and convenient way to transfer and share files easily between devices, and is especially handy in situations such as when backing up the data on your mobile device to a desktop, or when files such as images and video clips need to be shared quickly amongst several individuals – all without the need for a Wi-Fi connection or a USB cable.
Available in white, black and purple, the USM-SA1 USB drive will be available at all Sony stores and authorised outlets from 23 December 2013.
Capacity | Pricing |
8GB | S$ 17.90 |
16GB | S$ 26.90 |
32GB | S$ 43.90 |
To learn more, please visit: http://www.sony.net/Products/ memorycard/en_as/usbsa/index. html
(Information credit Sony Singapore)
Langganan:
Postingan (Atom)








