- What is the difference between html and html5
- Tag name available in html5
- What is javascript
- What is ajax and its benefits
- what is the different type of request available in ajax
- what is jquery and its benefits
- Main difference between javascript and jquery
- Event in jquery
- example of jquery event
- what is difference between CSS and CSS3
- what is media query in CSS
- What is bootstrap
- what is grid system in bootstrap
- What is JSON
- What is API
- What is PHP
- what is variable in PHP
- what types of variable available in PHP
- what is array in PHP
- how many types of array available in PHP
- difference between associative array and multidimentional array
- Difference between library function and user defined function in php
- Give me example of library function
- Difference between sessions and cookies
- What is difference between get and post method
- What is database
- What is table
- What is database MYSQL queries
- Type of relationship available in MYSQL
- Which datatype is use to store image in table
- What is OOPS
- Difference between classes and objects
- What is the different type array function in PHP
- Difference between concat() and array_push()
- Difference between constructor() and destructor()
- Types of error available in PHP
- Difference between library file and helper file
- Give me any three datatype of date and time
- What is blob in MYSQL
- Difference between RDBMS and DBMS
- Difference between string datatype and varchar datatype
- Difference between text datatype and String datatype
- What is datatype in MYSQL
- What are the meaning of classes and objects
- Difference between argument and parameter
- difference between cookies and local storage
- what is the difference between session storage and local storage
- Difference between notice error and warning error
- What is the library
- Difference between authentication and authorization
- What is MVC
- What is polymorphism
- Difference between Primary key and foreign key
- What is the full form of DOM and give its types
- Can table have more than one primary key
Category: C Programming
TCET Session Data
day 2:
javascript: addeventlisterner, fetchapi, validation
mongodb: crud on terminal
nodejs: core, custom module, http module
expressjs: routeing with get,post, put, delete methods
routing with route methods
read query params using res.query
read form data using res.body parser
read raw json using res.body parser
mongodb crud using nodejs (mongoose)
Day 1: JavaScript
Introduction
console.log()
console.error()
console.warning()
alert()
confirm()
variables, datatypes and scope
var x | let x | x
concatenation
template literals hello ${name}
Conditional Statement if..else
Loops for
String and String methods
Array and Array methods
Math methods
Functions
callback function
lambda expression/fatarrow function
Classes and Objects
Array of Objects
Inheritance
Interface
JSON
Array of JSON
AJAX using fetch API and json-placeholder dummy API
UI
read data from input box
put data in input box
put data in html
addEventListener
events (onclick, onkeyup, onkeydown, onkeypress, onfocus, onchange, onblur)
JavaScript Validation
Load data in table from API (Web Service: json-placeholder) using AJAX call (fetch API)
=====================================================================
rsync on windows os
rsync: Failed to exec ssh: No such file or directory(2) on windows
nstalling cwrsync, you are likely to get this error when you try to run this sample command from the command line.
rsync -avz -e ssh ycsoftware@google.com:/home/ycsoftware /cygdrive/z/ycsoftware/
“rsync: Failed to exec ssh: No such file or directory(2)” cwrsync
The reason you are getting this is because for some reason rsync is not able to find the path to the ssh.exe file. You should change it to something like this:
C:/cygwin64/bin/rsync.exe -ar . /cygdrive/c/xampp/htdocs/test2/ Ref: http://ycsoftware.net/rsync-failed-to-exec-ssh-no-such-file-or-directory2-on-windows/
Angular 4 http post with php
Component or Service:
let data = {'title': 'foo', 'body': 'bar', 'userId': 1}; this.http.post('http://localhost/angular4/angcrud/add_student_action.php', data) .subscribe( (res:Response) => { console.log(res.json()); }, err => { console.log("Error occured"); } );
Php Script:
<?php $postdata = file_get_contents("php://input"); $request = json_decode($postdata); header('Content-type: application/json'); header("Access-Control-Allow-Origin: *"); header('Access-Control-Allow-Headers: X-Requested-With, content-type, access-control-allow-origin, access-control-allow-methods, access-control-allow-headers'); //$res_ar = array("foo"=> $_REQUEST['body']); echo json_encode($request); ?>
<form #studentForm = "ngForm" (ngSubmit)="addStudentRecord(studentForm.value)"> First name:<br> <input type="text" name="firstname" value="Mickey" ngModel> <br> Last name:<br> <input type="text" name="lastname" value="Mouse" ngModel> <br><br> <input type="submit" value="Submit"> </form>
Angular 4 JSON CRUD
- install json server on windows
npm install -g json-server - run json server
json-server -p 5555 products.json - https://www.youtube.com/watch?v=HCHvrbAd1QA
- https://www.youtube.com/watch?v=WVlNj_6_-uA
- https://www.youtube.com/watch?v=6T1TF7lgVSA
- Angular 4 POST
- Angular 4 Receive data in Php
Installation
git clone https://github.com/angular/quickstart.git quickstart
programs on pointers
- WAP to exchange values of 2 variables by calling a function exchange
- WAP to find length of a string by calling a function lenght
- WAP to copy contents of one string into another by calling a function copy.
- WAP to reverse contents of a string
- WAP to find sum of 10 int values by calling a function sum (passing array as an argument)
- WAP to find mean of 10 in values by calling a function MEAN (passing array as an argument)
- WAP to dynamically read n values and find their sum
- WAP to read information about n students and display them
- WAP to find area and circumference of a circle by calling a single function circle
- WAP to call functions area and circumference of circle by using function pointer
- WAP to count total number of words in a string by calling a function wcount
- WAP to read a String and coutn total vowels in that string
- WAP to read a string and count total no of digits in that string
- WAP to read a string and copy it into another array
- WAP to rad a string and reverse that string
Hibernate Native SQL
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package corehibernatedemo; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; import model.Person; import model.Student; import model.Users; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; /** * * @author Shailesh Sonare */ public class CoreHibernateDemo { /** * @param args the command line arguments */ public static void main(String[] args) throws ParseException { // TODO code application logic here /* Configuration cfg = new Configuration(); cfg.configure("hibernate.cfg.xml"); StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()); SessionFactory factory = cfg.buildSessionFactory(ssrb.build()); Session session = factory.openSession(); Transaction t = session.beginTransaction(); List users = session.createQuery("from Users").list(); System.out.println("done..."); for (Iterator iterator = users.iterator(); iterator.hasNext();) { Users e = (Users) iterator.next(); System.out.println(e.getFirstName()); } Date bdate = new SimpleDateFormat("yyyy-MM-dd").parse("1992-11-15"); Users usr = new Users("Sunita", "Sonare", bdate); String hql = "UPDATE Users SET dob = :dob WHERE id = :id"; Query query = session.createQuery(hql); query.setParameter("dob", bdate); query.setParameter("id", 4); query.executeUpdate(); //session.save(usr); t.commit(); session.close(); System.out.println("DOne...."); */ //Student s = new Student(); Configuration cfg = new Configuration().configure("hibernate.cfg.xml"); StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()); SessionFactory factory = cfg.buildSessionFactory(ssrb.build()); Session session = factory.openSession(); // String hql = "FROM Users"; // List<Users> list = session.createQuery(hql).list(); String sql = "SELECT first_name, last_name, dob FROM users"; SQLQuery query = session.createSQLQuery(sql); query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP); // important when you are using alias <key><value> pair // List<Object[]> rows = query.list(); // // for(Object[] row : rows){ // // Users u = new Users(row[0].toString(), row[1].toString(), new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(row[2].toString())); // System.out.println(u); // System.out.println("--------------"); // } List list = query.list(); for(Object obj : list){ Map map = (Map)obj; System.out.println("" + map.get("first_name")); System.out.println("" + map.get("last_name")); System.out.println("" + map.get("dob")); System.out.println("-------------------------"); } } }
Users.java
package model; // Generated 30 May, 2017 5:20:27 PM by Hibernate Tools 4.3.1 import java.util.Date; /** * Users generated by hbm2java */ public class Users implements java.io.Serializable { private Integer id; private String firstName; private String lastName; private Date dob; public Users() { } public Users(String firstName, String lastName, Date dob) { this.firstName = firstName; this.lastName = lastName; this.dob = dob; } public Integer getId() { return this.id; } public void setId(Integer id) { this.id = id; } public String getFirstName() { return this.firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return this.lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Date getDob() { return this.dob; } public void setDob(Date dob) { this.dob = dob; } @Override public String toString() { return "Users{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", dob=" + dob + '}'; } }
Structure
- WAP to read Information about Student and Display it.
(Information: Roll Number, Name, Age, Sex) - WAP to read Information about an Employee and Display it.
(Information: EmpNo, Name, Job, Sal) - WAP to read Information about a Worker and Print Payment
(Information: Name, Wages, WorkingDays) - WAP to read information about 10 workers and print their Payment.
Print Average Payment
(Information: Name, Wages, WorkingDays) - WAP to read co-ordinates of end point of a line and find its slope by using the structure
struct Line{
int x1, y1, x2, y2;
} - WAP to read information about student
(Roll No. Name, Birth Date, Admission Date) by using following structure
struct date {
int D, M, Y;
}
struct Student {
int RollNo;
char name[20];
struct date bdate;
struct date admsndate;
}
Arrays Programs (Multi Dimensional)
- WAP to read a matrix of size 3 X 5 and find their SUM
- WAP to read a matrix of size 3 X 5 and find sum of each ROW
- WAP to read a matrix of size 3 X 3 and check if it is NULL or NOT
- WAP to read a matrix of size 3 X 5 and count all EVEN and ODD numbers
- WAP to read matrix of size 3 X 3 and check if it is UNIT Matrix or NOT
- WAP to read 2 matrix of size 3 X 3 and find their Addition
- WAP to read 2 matrix of size 3 X 3 and find their Product
- WAP to read matrix of size 3 X 3 and find its Transpose
- WAP to read matrix of size 3 X 3 and find its Transpose without using second matrix
- WAP to read matrix of size 3 X 3 and find its Upper Triangular Matrix
- WAP to read matrix of size 3 X 3 and find its Lower Triangular Matrix
- WAP to read matrix of size 3 X 3 and check if sum of its diagonal is same or not
- WAP to read matrix of size 3 X 3 and check if sum of its middle row is same as sum of its middle column
- WAP to create TIC-TAC-TOE by showing number and take 9 inputs from 2 users.
1 2 3
4 5 6
7 8 9
X O X
O X O
O O X
PLAYER 1 WIN
O X O
X O X
O X O
PLAYER 2 WIN