Search This Blog

Showing posts with label engine. Show all posts
Showing posts with label engine. Show all posts

Wednesday, October 12, 2016

NodeJs VelocityJs in web app - Template Engine

just create a sample  velocity-text.js  file.

/** * Created by drvijay on 12-10-2016. */
   var context = {
        "name": "velocity"    }

var initialString = "Hello, ${name}!";

var velocityjs = require("velocityjs");
var renderedString = velocityjs.render(initialString,context);
console.log(context);
console.log(initialString);
console.log(renderedString);


// go to cmd type node velocity-text.js



INSTALL

First install velocityjs in your node_modules

npm install velocityjs

Now from your project (where the node_modules mentioned above exists) use browserify

browserify -r velocityjs  > velocity.js

This will create a velocity.js file that you can include in your website directly. If you don't have browserify then do npm install -g browserify

Usage

In your webpage js file first require velocityjs

var velocityjs = require("velocityjs");

Now to get the templated html do

var renderedString = velocityjs.render(initialString,context)

Note that velocity does not care if your initial string was html or not, you need to ensure that

NodeJs VelocityJs in web app - Template Engine

just create a sample  velocity-text.js  file.

/** * Created by drvijay on 12-10-2016. */
   var context = {
        "name": "velocity"    }

var initialString = "Hello, ${name}!";

var velocityjs = require("velocityjs");
var renderedString = velocityjs.render(initialString,context);
console.log(context);
console.log(initialString);
console.log(renderedString);


// go to cmd type node velocity-text.js



INSTALL

First install velocityjs in your node_modules

npm install velocityjs

Now from your project (where the node_modules mentioned above exists) use browserify

browserify -r velocityjs  > velocity.js

This will create a velocity.js file that you can include in your website directly. If you don't have browserify then do npm install -g browserify

Usage

In your webpage js file first require velocityjs

var velocityjs = require("velocityjs");

Now to get the templated html do

var renderedString = velocityjs.render(initialString,context)

Note that velocity does not care if your initial string was html or not, you need to ensure that

Tuesday, September 29, 2009

How Google Search Works..

Google Architecture Overview



process


1. Parse the query.
2. Convert words into wordIDs.
3. Seek to the start of the doclist in the short barrel for every word.
4. Scan through the doclists until there is a document that matches all the search terms.
5. Compute the rank of that document for the query.
6. If we are in the short barrels and at the end of any doclist, seek to the start of the doclist in the full barrel for every word and go to step 4.
7. If we are not at the end of any doclist go to step 4.

Sort the documents that have matched by rank and return the top k.

Hit Counter


View My Stats