HTML5 new tags

To practise online, best workspace is or else try

Below is the list of HTML5 new elements referred from

Article: The <article> tag specifies independent, self-contained content. An article should make sense on its own and it should be possible to distribute it independently from the rest of the site. Eg: <article> <h1>Google Chrome</h1> <p>Google Chrome is a free, open-source web browser developed by Google, released in 2008.</p> </article>

Google Chrome

Google Chrome is a free, open-source web browser developed by Google, released in 2008. Aside: The <aside> tag defines some content aside from the content it is placed in. The aside content should be related to the surrounding content. <p>My family and I visited The Epcot center this summer.</p> <aside> <h4>Epcot Center</h4> <p>The Epcot Center is a theme park in Disney World, Florida.</p> </aside> My family and I visited The Epcot center this summer.

Installation of mongodb in windows

Lets wrench the installation of mongodb today.

Note: Here in this tutorial we are using in different way like how mysql stores all projects in bin of mysql. We are doing the same by creating a common workspace where all the databases store in data folder of mongodb folder. You can maintain a separate db space in your project folder by following this previous tutorial

First download zip file(preferably) or exe file from mongodb

Once after install or extract of mongodb you will find the following files like shown below

29-05-2014 12-22-59

Now copy those files and create a directory in c drive and make sure the path should look like


Here paste the files. Before we startup some thing lets create a couple of directories name “data” and “log” in mongodb fodler. So finally it should look like

29-05-2014 12-25-43

Inside of data folder again create a folder name “db” //all database data will store here

Now install git in your machine in replacement of command prompt.

Hope the installation is complete now…lets step forward

goto c:/mongodb/ folder. right click on bin folder and click “Git Bash” as shown below

29-05-2014 12-34-19

Hope you can see gitbash prompt which resembles like cmd

Now we should define default directory,db path and log manually with commands as shown below

Note: ‘/’ or ‘\’ is very important here in command prompts coz unix style use ‘\’ which works in most cases.

29-05-2014 12-40-58

From the above image you can see the command we should type and hit enter to set default directory,log path, log appends(instead of overwriting in mongodb.log everytime) and to use rest services.

Now you can see log name “mongodb.log” as shown below

29-05-2014 12-43-52

Now go back to mongodb folder and right click bin folder again and click gitbash

Type mongo and hit enter. you can see its connected

29-05-2014 12-46-37

Thats it now you can check dbs by show dbs command and create collections and documents as you wish.

Now we need install mongodb as a window service else you will be figured out with an error showing connection failed.

For that you just need to append –install command to the above command where the command finally will be

> mongod –directoryperdb –dbpath c:/mongodb/data/db  –logpath c:/mongodb/log/mongodb.log –logappend –rest –install

Hit enter, with that it will create a service for us.

29-05-2014 12-55-18

Just type “net start mongoDB

29-05-2014 12-58-10

To verify whether mongodb started or windows and type “services.msc” where you will find a wrench gear up on it and check whether mongodb is started or not.

With this we completed successfully installing and starting mongodb. Lets goto c:/mongodb/bin gitbash prompt and type “mongo”.

Show databases:

Now you can see databases by showdbs command

Create/switch to database:

create db by use database_name command (eg: use sathya will create a database and switches to that database).

Show collections:

show collections – will show the list of collections(tables in oracle)

db.createCollection(“collectionname”) – will create a collection in your database

Lets take an example to insert data in collections..Now i will create a table called employee and stores(create/update/delete) some records in it.

Create collection:

Eg: db.createCollection(“employee”);

the above command creates a employee collection(table) in db. Now lets insert some stuff in it.

Insert records:

db.employee.insert({name:”sathya”,dept:”computers”,technology:”html5″}) – hit enter

To check the record inserted or not..use db.employee.find() – this results an unorder/unformatted content. Lets put up some make up for this.. 😉

Find records:

use command – db.employee.find().pretty()

Find Only one field:

If you wish to find only one employee with particular name..

just type db.employee.findOne({name:”sathya”}) – this results only one employee with name sathya

Update command:

db.employee.update({oldname},{new name},{ upsert})

Eg: db.employee.update({name:”sathya”}.{name:”SathyaManoj”}.{upsert:true})

You can even modify different fields/columns by db.employee.update({name:”sathya”,dept:”computers”}.{name:”SathyaManoj”,dept:”IT”}.{upsert:true})

This will update the name sathya with SathyaManoj. And what this upsert does will check for the name sathya to update, if it doesnt find it..then it will create a new one.

Now check it by using db.employee.find().pretty()

Delete command:

db.employee.remove({name:”sathya”}) – will remove the record from the collection.

What is mongodb? Basics of mongodb

MongoDB is a cross-platform, document oriented database that provides, high performance, high availability, and easy scalability. MongoDB works on concept of collection and document.


Database is a physical container for collections. Each database gets its own set of files on the file system. A single MongoDB server typically has multiple databases.


Collection is a group of MongoDB documents. It is the equivalent of an RDBMS table. A collection exists within a single database. Collections do not enforce a schema. Documents within a collection can have different fields. Typically, all documents in a collection are of similar or related purpose.


A document is a set of key-value pairs. Documents have dynamic schema. Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection’s documents may hold different types of data.

Below given table shows the relationship of RDBMS terminology with MongoDB

Database Database
Table Collection
Tuple/Row Document
column Field
Table Join Embedded Documents
Primary Key Primary Key (Default key _id provided by mongodb itself)
Database Server and Client
Mysqld/Oracle mongod
mysql/sqlplus mongo


Sample document

Below given example shows the document structure of a blog site which is simply a comma separated key value pair.

   title:'MongoDB Overview', 
   description:'MongoDB is no sql database',by:'tutorials point',
         message:'My first comment',
         message:'My second comments',

_id is a 12 bytes hexadecimal number which assures the uniqueness of every document. You can provide _id while inserting the document. If you didn’t provide then MongoDB provide a unique id for every document. These 12 bytes first 4 bytes for the current timestamp, next 3 bytes for machine id, next 2 bytes for process id of mongodb server and remaining 3 bytes are simple incremental value.

Any relational database has a typical schema design that shows number of tables and the relationship between these tables. While in MongoDB there is no concept of relationship

Advantages of MongoDB over RDBMS

  • Schema less : MongoDB is document database in which one collection holds different different documents. Number of fields, content and size of the document can be differ from one document to another.
  • Structure of a single object is clear
  • No complex joins
  • Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that’s nearly as powerful as SQL
  • Tuning
  • Ease of scale-out: MongoDB is easy to scale
  • Conversion / mapping of application objects to database objects not needed
  • Uses internal memory for storing the (windowed) working set, enabling faster access of data

Why should use MongoDB

  • Document Oriented Storage : Data is stored in the form of JSON style documents
  • Index on any attribute
  • Replication & High Availability
  • Auto-Sharding
  • Rich Queries
  • Fast In-Place Updates
  • Professional Support By MongoDB

Where should use MongoDB?

  • Big Data
  • Content Management and Delivery
  • Mobile and Social Infrastructure
  • User Data Management
  • Data Hub


 External References:

How to install mongodb and connect to your project part-1


Lets continue with my previous post where i created a project named nodetest in d drive. For instance, lets use the same project here to install and use mongodb.

Before stepinto that..lets know briefly what is mongodb


  • NoSQL database
  • Well documented, huge community
  • Databases = Databases
  • Collections = Tables
  • Documents = Rows
  • Nested documents

For more on documentation of mongodb clickhere

There are many libraries like mongodb,mongoose etc in market. To know the major difference between mongoose and mongodb? clickhere

First download exe file from

Now install it in your machine. Here my path of mongo db installation is C:\Program Files\MongoDB 2.6 Standard

Lets move to next step


In your nodetest directory, create a subdir called “data”. Then navigate to the directory in which you placed your MongoDB files (let’s say C:\Program Files\MongoDB 2.6 Standard\bin). From that directory, type the following:

mongod --dbpath c:\node\nodetest1\data

28-05-2014 16-22-23

You’ll see the Mongo server start up. This is going to take a while if it’s the first time, because it has to do some preallocating of space and a few other housekeeping tasks. Once it says “[initandlisten] waiting for connections on port 27017”, you’re good. There’s nothing more to do here; the server is running. Now you need to open a second command prompt. Navigate again to your Mongo installation directory, and type:

COMMAND C:\Program Files\MongoDB 2.6 Standard\bin

You’ll see something like the following:

MongoDB shell version:2.4.5
connecting to: test

28-05-2014 16-23-53


Don’t worry about “connecting to: test” … that’s just the default database Mongo decides to use if you don’t specify one on the command line, which we didn’t because it’s not important right now. It doesn’t actually even create the “test” database unless you add a record. It’d be totally fine to just work in that database for right now, but let’s make one of our own. In your Mongo console, type the following:

use nodetest

28-05-2014 16-44-14
From the above shown image you can see, Switched to db nodetest after you hit enter.

To make the database exist, we have to add some data. We’re going to start off by doing that right inside of the Mongo client.


Let’s add a record to our collection. For the purposes of this tutorial, we’re just going to have a simple database of usernames and email addresses. 

In your Mongo client, type this:


28-05-2014 16-49-35

You can see inserted as a result once you hit enter

Something important to note here: that “db” stands for our database, which as mentioned above we’ve defined as “nodetest1”. The “usercollection” part is our collection. Note that there wasn’t a step where we created the “usercollection” collection. That’s because the first time we add to it, it’s going to be auto-created.

Type this:


In case you’re curious, the .pretty() method gives us linebreaks. It will return as shown below..

28-05-2014 16-53-03

let’s add a a couple more. In your Mongo console, type the following:

newstuff =[{"username":"abc","email":""},{"username":"xyz","email":""}]

Note that, yes, we can pass an array with multiple objects to our collection. Handy! Another use of db.usercollection.find().pretty() will show all three records.


In above process, we gave db path for the application folder where db itself maintained in project folder. Else you can try in different way like how mysql stores all projects in bin of mysql. You can achieve the same by the following video. Give a try.

Download git from here

How to create a project/site with nodejs and express

First check the versions of node and npm by the following commands..

node -v

npm -v

Now lets say your workspace is in d:/workspace

here you need to create a basic site with nodejs and express..

In order to do that, first install express in your machine globally..

you can achieve this by following commands

npm install -g express - old process
D:\workspace>npm install -g express-generator (preferable)
D:\workspace>express nodetest

With this you can see a list of folders will be created like shown below

26-05-2014 16-58-07

You’ll note that the express installation routine created a file called package.json in your nodetest directory. Open this up in a text editor and it’ll look like this:

26-05-2014 17-02-09

This is a basic JSON file describing our app and its dependencies. We need to add a few things to it. Specifically, calls for MongoDB and Monk. Let’s make our dependencies object look like this:




Now we’ve defined our dependencies and we’re ready to go. Note that the asterisks tell NPM “just get the latest version” when you run the install, which we’re about to do.


Return to your command prompt, cd to your nodetest directory, and type this:

D:\workspace\nodetest>npm install

It’s going to print out a ton of stuff. That’s because it’s reading the JSON file we just edited and installing all the stuff listed in the dependencies object (yes, including Express – we installed the top level stuff using the –g flag, but we still have to install some necessary code for this particular project). Once NPM has run its course, you should have a node_modules directory which contains all of our dependencies for this tutorial.

You now have a fully-functioning app ready and waiting to run. Before we do that, though, we need to do one quick thing to prepare for setting up our database later. Still in your nodetest1 directory, type this:

C:\node\nodetest1>mkdir data


That’s where we’re eventually going to store our MongoDB data. If that directory doesn’t exist, the database server will choke when we go to run it later. We’re not doing anything with it right now, though, so let’s test out our web server! Type the following:


C:\node\nodetest1>npm start

Hit enter. You’ll get this:

27-05-2014 12-09-30

Everything working? Awesome! Open a browser and head for http://localhost:3000 where you will see a welcome to Express page.

27-05-2014 12-10-41


You are now running your own Node JS webserver, with the Express engine and Jade HTML preprocessor installed 🙂

Javascript Tutorial 1

JavaScript is a very powerful language. It can be used both within any browser in the world. On top of that, it can be used to write server-side code using node.js.

Print data/values

To print out any data or can use document.write and console.log


you can use JavaScript to write directly to the HTML document

<!DOCTYPE html>

<h1>My First Web Page</h1>

<p>My first paragraph.</p>




My First Web Page

My first paragraph.

Mon May 26 2014 13:23:25 GMT+0530 (India Standard Time)


If your browser support debugging, you can use the console.log() method to display JavaScript values in the browser.

Activate debugging in your browser with F12, and select “Console” in the debugger menu.

<!DOCTYPE html>

<h1>My First Web Page</h1>

a = 5;
b = 6;
c = a + b;



Activate debugging in your browser (Chrome, IE, Firefox) with F12, and select “Console” in the debugger menu.


Variables & Types

every variable is defined using the var keyword, and can contain all types of variables.

We can define several types of variables to use in our code:

var myNumber = 3;                   // a number
var myString = "Hello, World!"      // a string
var myBoolean = true;               // a boolean

There are two more advanced types in JavaScript. An array, and an object. We will get to them in more advanced tutorials.

var myArray = [];                    // an array
var myObject = {};                  // an object

Atop of that, there are two special types called undefined and null.

When a variable is used without first defining a value for it, it is equal to undefined. For example:

var newVariable;
console.log(newVariable); //prints undefined


<!DOCTYPE html>
var myNumber =4;
var myString = “variables are great”;
var myBoolean = true;
console.log(“mynumber is equal to:”+ myNumber);
console.log(“myString is equal to:”+ myString);
console.log(“mybool is equal to:”+ myBoolean);
document.write(“mynumber is equal to:”+ myNumber);
document.write(“myString is equal to:”+ myString);
document.write(“myBoolean is equal to:”+ myBoolean);


mynumber is equal to:4

myString is equal to:variables are great

myBoolean is equal to:true 

The above result is displayed in browser and console

what is curl? How to use curl in windows

What is curl?

cURL is the name of the project. The name is a play on ‘Client for URLs’.

 It works as an abbreviation for “Client URL Request Library” or why not the recursive version: “Curl URL Request Library”.

The cURL project produces two products:


A free and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP.

libcurl supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies, user+password authentication, file transfer resume, http proxy tunneling and more!


A command line tool for getting or sending files using URL syntax.


While i am learning nodejs, i use to see in tutorials where programmers execute their code and calling up in curl.

I couldnt understand what it is initially

Now i will explain in simple words..

Once after executing server.js file in node, i need to open up a browser and write localhost:8080 to see the output.Like shown below..

26-05-2014 12-28-29

26-05-2014 12-29-24

Now instead of opening up my browser, i would like to see the same result in windows command prompt. For this we can achieve through this curl. This what  i understood, i donno the other purpose of curl 😉

Now you can see the same result in command prompt below

26-05-2014 12-48-04

How to install curl?

1st method:

If you are not into cygwin, you can use native windows builds, some are here:

from above url you can download curl msi file and install it and can call up anywhere in cmd.

2nd method:

You can just download the curl executable, for example for Windows 64bit. You can download it fromhere and then you just can save the curl.exe file on your C: drive.

To use it, just open the command prompt and type in:


For 2nd method you should go to C:/ where your curl is located and then call up in command prompt like shown in above image.

For 1st method, you can install and call curl anywhere.

For options in curl: try “curl –help” which lists out all options that can be used for curl.

Good luck 🙂