Nodemon

  • A node monitor, automatically restarts server when some changes happen.
  • npm install –save-dev gulp-nodemon
  • Change file gulpFile.js and run gulp serve
Advertisements

Gulp

  • Task manager for web project.
  • npm install -g gulp or npm install gulp –save-dev [for devDependencies, gulp is not needed for deployment]
  • Make gulpfile.js run gulp style, gives warning according to the code.
  • To inject js and css automatically:
    • npm install wiredep –save-dev #for bower dependencies
    • npm install gulp-inject –save-dev #for our dependencies
    • Code in gulpFile.js for injecting file.
    • in HTML files put
      <!– bower: js–>
      <!– endbower –>
    • for inject put
      <!– inject: js–>
      <!– endinject –>
    • run gulp inject and HTML files would have all js files required.
    • [See memo for css/less problem in bootstrap/gulp]

//These tools are used in gulpFile.js

JS Hint:

  • For coding standards => .jshintrc
  • Configurable and open source

JSCS:

  • For coding style => .jscsrc
  • Configurable and open source

ExpressJs

use express.static to serve a folder, nodejs will check in this folder to render
    app.use(express.static(“<folderPath>”))

  • app.get(“/text”, function(request, response){..});
  • app.post(“/text”, function(request, response){…});
  • var router = require(“express”).Router();
    router.route(“/”)
    .get(function(req, res){…});
    app.use(“/text”,
    router);
    /text/ app will use router, for /text/text2/, router.route(“/text2”, …) can be used.
  • app.get(“/:id”)

Bower

  • A front-end package management tool.
  • Flat package hierarchy.
  • bower.json
  • npm install bower -g
  • bower init
  • bower install <packageName> –save
  • Make .bowerrc file, add “directory”: “<fullPathoftheFolder>”; bower install…

Nodejs, Express and NPM Introduction

NODEJS:
https://nodejs.org/

Nodejs is an open-source, server-side, running environment.

  • Cross platform
  • Uses JS as language

EXPRESS:
http://expressjs.com/

Web developement framework for nodejs.

NPM:

Node Package Manager.

  • Easy update and version management.
  • npm init => make package.json
  • npm install <package-name> –save => saves the package to package.json
    When saving a package to package.json there can be these string formats:
    “^4.x.x”  [Any release 4 major or minor version]
    “~4.13.x”  [Any minor version of 4.13]
    “4.13.2”  [Exact version]
    “*”  [Newest]
  • in  package.json, in scripts object write “start”: “node index.js”, in console write npm start. The start object would get run.

Some AI Terms

AI Applications:

  • Speech Recognition
  • Q&A
  • Automatic Dialog System
  • Text-to-Speech Converter
  • Machine Translation
  • Web Search
  • Spam Filtering, Text Classification
  • Face Recognition
  • Scene Segmentation
  • Image Classification
  • Robots
  • Theorem Provers
  • NASA Fault Diagnosis
  • IBM’s DeepBlue, the chess player
  • Google’s AlphaGo, the GO player
  • Fraud Detection
  • Recommendations

 

Rational Agent: An agent that can act and perceive in a way that maximizes utility.

Reflex Agent: Works on current state of world, uses mostly if-else.

Planning Agent: Asks what-if. Has a model of the world. Captures future.

Search Problems: 
[INPUT]: Abstract world state i.e. search space,
A successor function, updates and calculates
A start and a goal state
[OUTPUT]: Sequence of states, from start to goal state.

State Space Graph: Have set of search states connected with edges having cost or other related entities. No state is repeated. It is exponentially big.

Search Tree: Has start state as root and then each node is explored by the next possible move. No need to build the whole tree. A cycle in the graph means an infinite tree.