1.Create free code camp account.
2.Create trello account.
3.create slack account.
Wednesday, June 14, 2017
13/06/2017
API
☺HTTP - Hyper Text Transfer Protocol.
Rules are transferring web pages to your browser.
☺Example for URL :
http://www.codecadamy.com
☺The web pages come from other computers on the Internet called servers.
☺REST - REpresentational State Transfer.
Set of principles.
☺API - Application Programming Interface.
☺API do,
1.Separate the client from the server.
2.Not hold state between requests.
3.Use HTTP.
☺xhr stands for XML HTTP Request.
☺Four HTTP verbs
1.GET - Information receives from the source.
2.POST - Sends new information to the specified source.
3.PUT - Updates existing information of the specified source.
4.DELETE - Removes existing information from the specified source.
☺Three parts of HTTP request.
1.Request lines - which tells the server what kind of request is being sent (GET, POST, etc.) and what resource it's looking for.
2.Header - which sends the server additional information (such as which client is making the request).
3.Body - which can be empty or contain data and information.
☺HTTP status codes
1xx: working on the request.
2xx: successfully
3xx: the server might have to reroute the request before it can get you the resource you asked for.
4xx: "file not found".(user problem)
5xx: can't successfully respond to your request.(server problem)
☺HTTP response code
1.Response line: which includes the three-digit HTTP status code.
2.Header: which includes further information about the server.
3.Body: which includes further information about the server
☺XML : Extensible Markup Language.
It is very similar to HTML.
Monday, June 12, 2017
12/06/2017
SASS
❤Functions and operations
1.color values.
2.Apply styles.
3.Assign values (math operations).
4.Iterate on lists and maps.
❤fade-out
changes a color by decreasing opacity.
❤fade-in
changes a color by increasing opacity.
❤Example
$color2 : fade-out($color,$amount);
❤SASS arithmetic operations
1.addition +
2.subtraction -
3.multiplication *
4.division /
5.module % (remainder)
❤Units are compatible in SASS.[we can not multiply pixels by ems]
❤In regular math, multiplying two units together results in squared units
.(10px*10px=100px*px)
❤So,we would need to multiply 10px*10=100px.
❤For loop
@for $i from $begin through $end {
//some rules and or conditions
}
❤We can use through or to.
.lemonade {
border: 1px yellow;
background-color: #fdd;
}
.strawberry {
@extend .lemonade;
border-color: pink;
}
❤@extend
is working to apply the .lemonade
rules to .strawberry.
❤ % (place holder) → extend
❤Mixin deal with arguments.
❤Place holder don't deal with arguments.
Sunday, June 11, 2017
09/06/2017
SASS
Sass can solve the common repetition and maintenance challenges present in traditional CSS.
compile it to CSS by typing the following command in the terminal and pressing enter
sass main.scss main.css
Nesting
Nesting is the process of placing selectors
inside the scope of another selector.
In css
.parent {
color: blue;
}
.parent .child {
font-size: 12px;
}
In scss
.parent {
color: blue;
.child {
font-size: 12px;
}
}
In Sass, $
is used to define and reference
a variable.
Data types of SASS
1.Map
2.List
3.Number
4.String
5.Boolean
6.Null
Strings of text, with and without quotes.
Examples: "janusha"
, 'janusha'
, janusha
.
Lists can be separated by either spaces or
commas(don't need []).
em Helvetica bold;
Helvetica, Arial, sans-serif;
08/06/2017
LEARN RESPONSIVE DESIGN
Sizing elements
Pixels are used to size content to exact dimensions(px).
create relatively-sized content is the em, written as
em
in CSS.
The second relative unit of measurement in CSS is the rem, coded as
rem
. min-width
— ensures a minimum width for an element
.
max-width
— ensures a maximum width for an element.05/06/2017
1.Created a worst website.
2.Presentation about worst website.
3.Changed it a best website.
4.Presentation about the best website.
26/05/2017
JSON Datatypes
JSON Strings
JSON strings must be written in double quotes.
JSON Numbers
JSON numbers must be an integer or a floating point.
JSON Objects
{
"student":{ "name":"Janusha", "age":19, "city":"Jaffna" }
}
JSON Arrays
{
"student":[ "Janusha", "Karunya", "Poomika" ]
}
JSON Booleans
JSON booleans can be true/false.
{ "sale":true }
JSON Null
{ "middlename":null }
- string
- a number
- an object (JSON object)
- an array
- a boolean
- null
JSON values cannot be one of the following data types:
- a function
- a date
- undefined
JSON Strings
JSON strings must be written in double quotes.
JSON Numbers
JSON numbers must be an integer or a floating point.
JSON Objects
{
"student":{ "name":"Janusha", "age":19, "city":"Jaffna" }
}
JSON Arrays
{
"student":[ "Janusha", "Karunya", "Poomika" ]
}
JSON Booleans
JSON booleans can be true/false.
{ "sale":true }
JSON Null
{ "middlename":null }
25/05/2017
JSON
What is JSON?
- JSON stands for JavaScript Object Notation.
- JSON is a syntax for storing and exchanging data.
- JSON is text, written with JavaScript object notation.
- JSON is "self-describing" and easy to understand.
- JSON is language independent *
JSON syntaxs
- Data is in name/value pairs.
- Data is separated by commas.
- Curly braces hold objects.
- Square brackets hold arrays.
JSON Data
JSON data is written as name and value pairs.
Name and value pair consists of a field name in double quotes, followed by a colon, followed by a value:
"name":"janusha"
JSON Files
The file type for JSON files is ".json".
24/05/2017
DROP
Use the drop() method to delete a table, or collection.
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
db.collection("studentsdetails").drop(function(err, delOK) {
if (err) throw err;
if (delOK) console.log("Table deleted");
db.close();
});
});
UPDATE
Use the update() method to update records, or documents.
You can update multi options.
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://127.0.0.1:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var myquery = { address: "Jaffna" };
var newvalues = { name: "Mala", address: "Colombo" };
db.collection("studentsdetails").update(myquery, newvalues, function(err, res) {
if (err) throw err;
console.log(res.result.nModified + " record updated");
db.close();
});
});
QUERY
You can find records from a table by using find() method.
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var query = { address: /^S/ };
db.collection("studentdetails").find(query).toArray(function(err, result) {
if (err) throw err;
console.log(result);
db.close();
});
});
Use the drop() method to delete a table, or collection.
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
db.collection("studentsdetails").drop(function(err, delOK) {
if (err) throw err;
if (delOK) console.log("Table deleted");
db.close();
});
});
UPDATE
Use the update() method to update records, or documents.
You can update multi options.
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://127.0.0.1:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var myquery = { address: "Jaffna" };
var newvalues = { name: "Mala", address: "Colombo" };
db.collection("studentsdetails").update(myquery, newvalues, function(err, res) {
if (err) throw err;
console.log(res.result.nModified + " record updated");
db.close();
});
});
QUERY
You can find records from a table by using find() method.
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var query = { address: /^S/ };
db.collection("studentdetails").find(query).toArray(function(err, result) {
if (err) throw err;
console.log(result);
db.close();
});
});
23/05/2017
MONGODB NODEJS
SORT
Use the
Use the value -1 in the sort object to sort descending.
{ name: 1 } // ascending
{ name: -1 } // descending
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var mysort ={name:1}; db.collection("studentsdetails").find().sort(mysort).toArray(function(err, result) {
if (err) throw err;
console.log(result);
db.close();
});
});
REMOVE
Use the remove() method to delete records, or documents.
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var myquery = { address: 'Colombo' }; db.collection("studentsdetails").remove(myquery, function(err, obj) {
if (err) throw err;
console.log(obj.result.n + " document(s) deleted");
db.close();
});
});
SORT
Use the
sort()
method to sort the result in ascending or descending order.Use the value -1 in the sort object to sort descending.
{ name: 1 } // ascending
{ name: -1 } // descending
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var mysort ={name:1}; db.collection("studentsdetails").find().sort(mysort).toArray(function(err, result) {
if (err) throw err;
console.log(result);
db.close();
});
});
REMOVE
Use the remove() method to delete records, or documents.
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var myquery = { address: 'Colombo' }; db.collection("studentsdetails").remove(myquery, function(err, obj) {
if (err) throw err;
console.log(obj.result.n + " document(s) deleted");
db.close();
});
});
Wednesday, June 7, 2017
22/05/2017
MongoDB select from
Select one
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/music";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var query = { musicDirector: 'AR Rahman' };
db.collection("songdetails").find(query).toArray(function(err, result) {
if (err) throw err;
console.log(result);
db.close();
});
});
sort
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var mysort = { name: -1 }; db.collection("students").find().sort(mysort).toArray(function(err, result) {
if (err) throw err;
console.log(result);
db.close();
});
});
Remove
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var myquery = { address: 'Mountain 21' }; db.collection("students").remove(myquery, function(err, obj) {
if (err) throw err;
console.log(obj.result.n + " document(s) deleted");
db.close();
});
});
Select one
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/music";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var query = { musicDirector: 'AR Rahman' };
db.collection("songdetails").find(query).toArray(function(err, result) {
if (err) throw err;
console.log(result);
db.close();
});
});
sort
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var mysort = { name: -1 }; db.collection("students").find().sort(mysort).toArray(function(err, result) {
if (err) throw err;
console.log(result);
db.close();
});
});
Remove
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var myquery = { address: 'Mountain 21' }; db.collection("students").remove(myquery, function(err, obj) {
if (err) throw err;
console.log(obj.result.n + " document(s) deleted");
db.close();
});
});
Tuesday, June 6, 2017
19/05/2017
Nodejs Mongo DB
Create a database
Create a database called "uki":
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
console.log("Database created!");
db.close();
});
Create a table
Create a table called "students":
Create a database
Create a database called "uki":
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
console.log("Database created!");
db.close();
});
Create a table
Create a table called "students":
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/uki";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
db.createCollection("students",
function(err, res) {
if (err) throw err;
console.log("Table created!");
db.close();
});
});
Insert in to table
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/student";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var insert = [
{ name:"mala",maths_marks:45,english_marks:53,science_marks:75},
{ name:"venu",maths_marks:80,english_marks:75,science_marks:85},
{ name:"Kala",maths_marks:32,english_marks:46,science_marks:53},
{ name:"Aruli",maths_marks:78,english_marks:85,science_marks:80},
{ name:"Sharu",maths_marks:80,english_marks:76,science_marks:65},
{ name:"Kumaran",maths_marks:32,english_marks:73,science_marks:84},
{ name:"Lucky",maths_marks:66,english_marks:90,science_marks:45},
{ name:"Gva",maths_marks:71,english_marks:75,science_marks:56},
{ name:"Raam",maths_marks:41,english_marks:65,science_marks:88},
];
db.collection("studentmarks").insert(insert, function(err, res) {
if (err) throw err;
console.log("Number of records inserted: " + res.insertedCount);
db.close();
});
});
18/05/2017
Nodejs File System
File System module:
The
Create files
Rename files
File System module:
- Read files
- Create files
- Update files
- Delete files
- Rename files
The
fs.readFile()
method is used to read files.Create files
fs.appendFile()
fs.open()
fs.writeFile()
Update filesfs.appendFile()
fs.writeFile()
Delete filesfs.unlink()
Rename files
fs.rename()
17/05/2017
NODEJS
NODEJS MODULE
Consider modules to be the same as JavaScript libraries.
A set of functions you want to include in your application.
To include a module, use the
var http = require('http');
Create a own module
you can create your own modules, and easily include them in your applications.
exports.myDateTime = function () {
return Date();
};
What is Node.js?
- Node.js is an open source server framework
- Node.js is free
- Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
- Node.js uses JavaScript on the server
NODEJS MODULE
Consider modules to be the same as JavaScript libraries.
A set of functions you want to include in your application.
To include a module, use the
require()
function with the name of the module: var http = require('http');
Create a own module
you can create your own modules, and easily include them in your applications.
exports.myDateTime = function () {
return Date();
};
16/05/2017
MONGODB
MongoDB is an open-source document database and leading NoSQL database
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.
MongoDB is an open-source document database and leading NoSQL database
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.
Advantages of MongoDB over RDBMS
- Schema less − MongoDB is a document database in which one
collection holds different documents. Number of fields, content and size
of the document can 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 Use MongoDB?
- Document Oriented Storage − Data is stored in the form of JSON style documents.
- Index on any attribute
- Replication and high availability
- Auto-sharding
- Rich queries
- Fast in-place updates
- Professional support by MongoDB
Where to Use MongoDB?
- Big Data
- Content Management and Delivery
- Mobile and Social Infrastructure
15/05/2017
DATABASE
A database is a collection of information that is organized so that it can be easily accessed, managed and updated.
1.create a database
create database databasename;
2. drop a database
drop database databasename;
3.create table
create table table_name (
column1 datatype,
column2 datatype,
column3 datatype,
);
4.drop table
drop table table_name;
5.alter table
The alter table statement is used to add, delete, or modify columns in an existing table.
1.alter table table_name
add column_name datatype;
2.alter table table_name
drop column column_name;
1.create a database
create database databasename;
2. drop a database
drop database databasename;
3.create table
create table table_name (
column1 datatype,
column2 datatype,
column3 datatype,
);
4.drop table
drop table table_name;
5.alter table
The alter table statement is used to add, delete, or modify columns in an existing table.
1.alter table table_name
add column_name datatype;
2.alter table table_name
drop column column_name;
Subscribe to:
Posts (Atom)
HTML introduction
HTML stands for Hyper Text Markup Language. HTML describes the structure of web page using markup. HTML elements are the building blo...
-
14TH DAY AT UKI ARRAY 1. Javascript arrays are used to store multiple values in a single variable. Example: ...
-
Building web app using react.js, express.js, node.js and mongodb Backend code var express = require( " express" ); var path ...
-
1.Create free code camp account. 2.Create trello account. 3.create slack account.