HTTP is a stateless protocol and webserver dont know , request comes from which server. So cookies will store the some id like transaction id . Then
Wednesday, 27 March 2013
Tuesday, 26 March 2013
Format of NPM Package
NPM package is a directory structure with package.json file.
Package.json file basic flow as follows
{ name: "nameOfPackage", version:"1.1", main: :mainModuleName", Node Modules[46] modules: { "mod1" : "lib/mod1", "mod2" : "lib/mod2" }
To search a package, use the following command,
$ npm search nameOfPackage
Help command as follows
$ npm help <command>
Find NPM Package:
$npm install moduleName
Package.json file basic flow as follows
{ name: "nameOfPackage", version:"1.1", main: :mainModuleName", Node Modules[46] modules: { "mod1" : "lib/mod1", "mod2" : "lib/mod2" }
To search a package, use the following command,
$ npm search nameOfPackage
Help command as follows
$ npm help <command>
Find NPM Package:
$npm install moduleName
Saturday, 19 January 2013
JavaScript Introduction
JavaScript is a light weight ,interpreted programming language. It is the most popular scripting language which is used by many popular browsers like Mozilla, Safari,Opera,Chrome etc.
JavaScript is embedded directly into Html Pages.
Features of JavaScript:
Embed into HTML:
JavaScript can be easily embedded into HTML pages.
Events :
It will react to events like clicking button,finish loading page etc.
Read/Write HTML elements:
It is used to read/write HTML element.
Validation:
It is used to validate form data beform submitting to the server.
JavaScript is embedded directly into Html Pages.
Features of JavaScript:
Embed into HTML:
JavaScript can be easily embedded into HTML pages.
Events :
It will react to events like clicking button,finish loading page etc.
Read/Write HTML elements:
It is used to read/write HTML element.
Validation:
It is used to validate form data beform submitting to the server.
Thursday, 17 January 2013
what is node
Node is a pltatform built on V8 which is already used by Google crome.It was created by Ryan Dahl.In order to execute javascript,
Node is a platform for writing serverside javascript for writing scalable internet applications where as Javascript is for writing client side script.It was created by Ryan Dahl.
Every function in node is Asynchronous,nonblocking i/o.
Node applications uses asynchronous event driven model.
Node is a platform for writing serverside javascript for writing scalable internet applications where as Javascript is for writing client side script.It was created by Ryan Dahl.
Every function in node is Asynchronous,nonblocking i/o.
Node applications uses asynchronous event driven model.
Node consists of lots of modules and no need to write from scratch. Node is a combination of tho things, run time environment and a library.
Thursday, 10 January 2013
Non Blocking I/O in Node.js
-->
Difference between Blocking and non blocking
Blocking:
In blocking, we can read file one after the other in a time interval.

Non Blocking:
In non blocking, we can read files at same time.
Difference between Blocking and non blocking
Blocking:
In blocking, we can read file one after the other in a time interval.
Non Blocking:
In non blocking, we can read files at same time.
Call Back in node.js
-->
We can add call back in node.js in two ways
1.Write a call back inside a method
Ex:
fs.readFile('/abc/def',function(err,data) {
console.log(data);
});
2. Create a variable for call back and add call back to the function.
var callback=function(err,data){
console.log(data);
}
fs.readFile('/abc/def',callback);
1.Write a call back inside a method
Ex:
fs.readFile('/abc/def',function(err,data) {
console.log(data);
});
2. Create a variable for call back and add call back to the function.
var callback=function(err,data){
console.log(data);
}
fs.readFile('/abc/def',callback);
Tuesday, 8 January 2013
Filesystem module (fs) in node.js
File system module is to access files on the disk.
To use the module, use "require(fs) " and all the methods have synchronous and asynchronous forms.
Asyn form always takes completion call back as a last argument and 1st argument for exception. If the operation completed successfully, it returns null or undefined.
see this example
var fs=require('fs');
To use the module, use "require(fs) " and all the methods have synchronous and asynchronous forms.
Asyn form always takes completion call back as a last argument and 1st argument for exception. If the operation completed successfully, it returns null or undefined.
see this example
var fs=require('fs');
fs.exists(nodemongo.txt,function(exists){
if(exists)
{
fs.stat(nodemongo.txt,function(error,stats){
fs.open(nodemongo.txt,function(error,ab)
{
var bf=new Buffer(stats.size);
fs.read(ab,bf,0,bf.length,null,function(error,bytesRead,buffer){
var txt=bf.toString("utf8",0,bf.length);
fs.close(ab);
});
});
)};
});
