Web Technologies Practical.
Web Technologies Practical.
Web Technologies
Subject Code: MCAL14
A Practical Journal Submitted in Fulfillment of the Degree of
MASTER
in
COMPUTER APPLICATION
Year 2023-2024
By
Mr. Vivek Balaso Desai
(Seat No-10266)
(Application Id-76229)
PCP Center
Vidyalankar School of Information Technology
1
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
CERTIFICATE
2
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
INDEX
1 Node.JS Basics
a. Basic arithmetic operations using node JS
b. String Operations
c. Program to create Functions to print Factorial of a
number
3 a. URL Module
b. File Module
4 Angular JS
a. Write a program to display your name with welcome
note :HELLO
b. Write a simple program for multiplication
3
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
Practical No: 1
let x=10;
let y =20;
console.log("x="+x);
console.log("y="+y);
console.log("Addition=",(x+y));
console.log("Substraction=",(x-y));
console.log("Division=",(x/y));
console.log("Multiply=",(x*y));
console.log("Percentage=",(x%y));
console.log("Pre Increment x=",(++x));
console.log("Pre Decrement x=",(--x));
console.log("Post Increment x=",(x++));
console.log("Post Decrement x=",(x--));
4
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
console.log("s1=",s1);
console.log("s2=",s2);
console.log("Concantenation=",(s1+","+s2));
console.log("Concantenation with function=",s1.concat(s2));
console.log("Split=",s1.split(' '));
console.log("Join=",s3.join('- '));
console.log("Character at 5th position=",s1.charAt(5));
console.log("Length=",s1.length);
console.log("UpperCase=",s2.toUpperCase());
console.log("LowerCase=",s1.toLowerCase());
function factorial(n){
let f=1;
for(let i=1;i<=n;i++)
{
f=f*i;
}
return f;
}
let n=7;
5
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
console.log("factorial=",factorial(n));
D] Program to create function to perform math operation like square, cube, squareroot,
min, max, round of a number using node JS:
function MathOperations() {
console.log("Squareroot of 10=",Math.sqrt(10));
console.log("Square of 6=",Math.pow(6,2));
console.log("Cube of 9=",Math.pow(9,3));
console.log("Cube of 9=",Math.pow(9,3));
console.log("Minimum=",Math.min(111,232));
console.log("Max=",Math.max(111,232));
console.log("Round=",Math.round(10.734));
console.log("Ceil=",Math.ceil(10.734));
console.log("Floor=",Math.floor(10.734)); }
MathOperations();
6
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
Practical No: 2
B] Node JS modules :
Mymodule.js:
exports.myDateTime=function()
{
return Date();
};
Module.js:
var http = require('http');
var dt = require('./mymodule');
http.createServer(function (req ,res)
7
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
res.writeHead(200,{'Content-Type':'text/html'});
res.write("The date and time are currently: " + dt.myDateTime());
res.end();
}).listen(8080);
8
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
Practical No: 3
B] File Module :
1. Create :
var http=require('http');
var fs=require('fs');
http.createServer(function (req,res){
fs.appendFile('mynewfile1.txt','Hello content!',function (err){
if(err) throw err;
console.log('Saved!');
return res.end();
});
}).listen(8080);
9
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
3. Rename:
var http=require('http');
var fs=require('fs');
http.createServer(function (req,res){
fs.rename('mynewfile1.txt','myrenamedfie.txt',function (err){
res.writeHead(200,{'Contsnt-Type':'test/html'});
res.write("rename done");
return res.end();
});
}).listen(8080);
4. Delete:
var http=require('http');
var fs=require('fs');
http.createServer(function (req,res){
fs.unlink('mynewfile1.txt',function (err){
if(err) throw err;
console.log('file deleted');
});
}).listen(8080)
10
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
Practical No: 4
A] Write a program to display your name with Welcome note Hello in Angular JS.
testAngularJS.html:
<html>
<head>
<title>AngularJS First Application</title>
</head>
<body>
<h1>Sample Application</h1>
<div ng-app = "">
<p>Enter your Name: <input type = "text" ng-model = "name"></p>
<p>Hello <span ng-bind = "name"></span>!</p>
</div>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js">
</script>
</body>
</html>
index.html:
<hr><!doctype html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js">
</script>
</head>
<body>
<div>
<label>Name:</label>
<input type="text" ng-model="yourName" placeholder="Enter a name here">
<h1>Hello {{yourName}}!</h1>
11
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
</div>
</body>
</html>
12
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
Practical No: 5
13
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
14
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
Practical No: 6
15
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
16
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
Practical No: 7
Index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-number-filter-production</title>
<script src="//code.angularjs.org/snapshot/angular.min.js"></script>
</head>
<body ng-app="numberFilterExample">
<script> angular.module('numberFilterExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.val = 1234.56789;
}]);
</script>
<div ng-controller="ExampleController">
<label>Enter number: <input ng-model='val'></label><br> Default formatting: <span id='number-
default'>{{val | number}}</span><br>
No fractions: <span>{{val | number:0}}</span><br> Negative number: <span>{{-val |
number:4}}</span>
</div>
</body>
</html>
Protractor.js
it('should format numbers', function() {
expect(element(by.id('number-default')).getText()).toBe('1,234.568');
expect(element(by.binding('val | number:0')).getText()).toBe('1,235');
expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');
});
17
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
18
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
Practical No: 8
19
FYMCA SEM 1 WEB TECNHOLOGIES VIVEK BALASO DESAI
</html>
20