Professional Documents
Culture Documents
Jav Afsd
Jav Afsd
ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/DELL/.ssh/id_rsa):
Created directory '/c/Users/DELL/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/DELL/.ssh/id_rsa
Your public key has been saved in /c/Users/DELL/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:nqXM0rBEE7PnUENHQMgIPNLNtbRxT5zQ+ic4OSWbNaM DELL@AmaanShaikh
The key's randomart image is:
+---[RSA 3072]----+
| o.+ +*+O*+. |
|. + +.oX =+ |
| . . B ... |
| . =o = |
| o S@.o |
| . BE+o . |
| o Bo o |
| . |
| |
+----[SHA256]-----+
$ cat /c/Users/DELL/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCyVWpG6LXZQJyaXXWJMDTdMcZUMKrc
j0OfuYoSfGPFvmPD4vJ6FUthiEiyalKr+UAf6remvFqDXsQy/aCh9T3DV7tZF8nr+
nrRJTNotJyYQi3rMHdodt+
+DUlrjpINDpHrWQo0DQAdQhzwTvNBT2q1U5FKDphz+ulpcbBabBdRSZ8HZdjkP5vWWlsJquUzwfyT
NcGbf9z4rhMrVMjgSTt5YfvQFEoosrczLoeVMltOGHzB8372nIoljAYwcI2OdhV5It9MZ+/
l0RJZ3RNeiFWI8LHHOKNjA65wmfdXb3YcsY1yTu
9jqXQAKknIYvoxW9i+NQPanld2up+iWeO0LPvoH1IfB0/1FnSZWSIyEo/
I2+Canst321Z+X8Y2V7Sk4Grd53tMwoWZUIOI97ue3FvZAyXr
T4kLuLk3pEoRJ1N6ddD5DXZMILdUnHg5u57TLF1SKZrrQEGCt3GgZbZ2RVOP5sU8yNoffel6+hyyF9oltWP
7WTw3Y/yzHKMC8= DELL@AaanShaikh
1 March 2022
@Two dimensional array
Jagged array
packname.classname
2 March 2022
@Strings
2 types
mutable (nonchangable)
String s=new String("xyz")
immutable
ways to
by new key String a=new String("a")
by string literal String s2="aA"
char[] n={'s','d'}
String s3=new String(n)
String contents and objects are stored in heap and reference in stack
String methods
sysout(s.tocharAt(4))
sysout(s.index(4))
convert int
int i=100;
String v=String.valueOf(i);
sop(v);
String i="100";
int i=Integer.parseInt(s);
sop(i);
1.Unit Testing
integration
system
acceptance
1.Unit testing-- It is way of testing the smallest piece of code ie unit that can
be
logically isolated in the project.
Junit 5-Jupiter
@proper indentation
cntl+a then cntl+i
Lifecycle hooks
@BeforeAll(annotation)
@AfterAll
@BeforeEach
@AfterEach
@Disabled
@EnabledOnOs(OS.LINUX)
@EnabledOnJre(JRE.JAVA_8)
boolean isServerUp=false;
assumeTrue(isServerUp)
assertAll(
()-> assertEquals(4,c.multiply(2,2)),
()-> assertEquals(-4,c.multiply(-2,2)),
()-> assertEquals(0,c.multiply(-2,0)),
);
// If any of testcase fails all assertEquals gets fail
@Object Orientation
point of view
perspective
-private
+public
#protected
~default
@Connstructor
--If there is no user defined contructor in a class then
a default constructor will be added automatically by JYM
--so either it is default constructor or user defined constructor
but not both
bean Class
1.instance variable
2.default constructor
3.setters and getters
@super()
constructor chaining
NewDog(int a)
{
super(); // parent class means Object class contructor will
// executed
sop("1 arg");
}
NewDog(int a,int b)
{
super();
sop("2arg");
}
local Chaining-calling constructor of same class
NewDog(int a)
{
this(); //either this or super
sop("1arg");
}
NewDog(int a, double b)
{
this(10);
sop("2arg");
}
NewDog()
{
this();
sop("0arg");
}
@
c inherit B and B inherit A if we create object of class c then sequence of
constructor
called is A, B, C
has-A types
tight bound relationship
if student not exist brain not exist
@Inheritance
Single
multilevel
hierarchical
hybrid
Multiple(not supported in java)
static{
name="dsd";
}
constrname(String name,int i)
{
this.name=name;
}
Overloading
main method can also be overloaded
psvm(String[] arg)
{
}
psvm(String arg)
{
}
@Polymorphism
Poly-many
morphs-forms
Abstraction
interface
-interface is to achieve abstraction
-All the methods of interface are by default public and abstract.
-All variable of interface are by default public static and final.
-Multiple inheritance of interface is allowed in java.
-In interface only abstract methods are allowed.
21/3/2022
@File Handling
main() throws IOExcep //here we are ducking the exception not handling it
{
File f=new File("dem.txt");
f.createNewFile();
methods of file
exists()
createNewFile()
mkdir()// make directory
isDirectory()
isFile()
String[] list()
length()
delete()
int count=0;
File f=new File("path of folder");
String[] list=f.list();
for(String names : list)
{
count++;
sysout(names);
}
sysout("no of file"+count);
@writing in file
FileWriter fw=new FileWriter("ad.txt");
fw.write(100);
fw.write("sdfd");
fw.write("\n);
char c[]={'a','b','c'};
fw.write(c);
fw.flush();
fw.close();
FileReader
new FileReader (STRING FILNAME);
new FileReader(File f)
FileReader fr=new FileReader ("ad.txt");
int i=fr.read();
while(i !=-1)
{
sop(i);// prints integer value of text in file
sop((char)i) // prints String value present in file
i=fr.read();
}
sop("all character hs been taken");
BufferedWriter constructor
1. new BufferedWriter(Writer w)
2. new BufferedWriter(Writer w,int buffersize)
methods
write(int ch)
write(char[] ch)
write(String s)
flush()
close()
newLine()
bw.write("Amaan");
bw.newLine();
bw.write("Shaikh");
bw.flush();
bw.close();
BufferedReader
BufferedReader constructor
1. new BufferedReader(Reader r)
2. new BufferedReader(Reader r,int buffersize)
methods
read(int ch)
read(char[] ch)
read(String s)
flush()
close()
newLine()
main()throws FileNotFoundException
{
FileReader fr=new FileReader("demop.text");
BufferedReader br=new BufferedReader(fr);
String line=br.readLine();
while(line !=null)
{
sop(line);
line=br.readLine();
}
br.close();
}
PrintWriter
new PrintWriter(STRING FILNAME);
new PrintWriter(File f)
PrintWriter fr=new PrintWriter("ad.txt");
main()throws IOExcep
{
FileWriter fw=new FileWriter("ad.txt");
PrintWriter pw=new PrintWriter(fw);
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
23 march 2022
@Collections-- is used to store multiple object under a single entity.
methods
add(Object o)
addAll(Collection c)
remove(Object o)
removeAll(Collection c)
retainAll(Collection c)
clear()
size() //return type int
toArray() // return type object array
@List(Interface)
-Insertion order is maintained in all subclass (insertion order means in
whatever order you add elements in the same order it will be stored
in the backend.
-can access elements through index
-duplictes are allowed
-Heterogenous elemenst can be stored(means diff types of)
Methods of List
add(int index,Object o)// on which you want add element you and write that object
here
addAll(int index, Collection c)// from which index u want to add till complete list
of elements from the collection.
remove(int index)
get(int index)
set
indexOf
lastIndexOf
to use only
public class Gene<T extends Number> // bounding T
T can be anything but should be child class of number class
Gene(T ob, T a, T b)
{
this.ob=ob;
this.a=a;
this.b=b;
}
ctrl+2->r
to change name everywhere in code
package com.route;
import java.io.*;
import java.text.ParseException;
import java.util.Collections;
import java.util.List;
while (i<routeCount||reader.readLine()!=null){
String s1[]=reader.readLine().split(",");
String from=s1[0];
String to=s1[1];
int distance=Integer.parseInt(s1[2]);
String time=s1[3];
String fare=s1[4];
routes[i]=new RecordRoute(from,to,distance,time,fare);
i++;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
catch (NullPointerException e){
e.printStackTrace();
}
return routes;
}
public void display() throws IOException
{
String f="src\\main\\resources\\routes.csv";
BufferedReader reader = null;
String line = "";
}
}
public static void main(String[] args) throws IOException, ParseException {
RoutePlanner rp=new RoutePlanner();
rp.display();
String filename="src\\main\\resources\\routes.csv";
int count=countOfRoutes(filename);
RecordRoute[] routes=readRecords(filename,count);
rp.showDirectFlight(routes,"Delhi");
//sortFlights(routes,"Delhi");
}
@comparator(interface)
-used for customize sorting order
compare()
equals()
Map
HashMap(c)
-16 default capacity
-0.75 is default load factor
new HashMap();
new HashMap(int );
new HashMap();
new HashMap();
import java.util.HashMap
HashMap<Integer, String> hm=new HashMap<Integer, String>();
hm.put(101,"alex");
hm.put(102,"John");
hm.put(103,"bob");
sop(hm);
@WAP
check the occurrence of character in word
HashMap<Character, Integer> hm=new HashMap<Character, Integer>();
Java 8 feature
@lambda Expression
--It is an anonymous function(Nameless, no returntype, no modifier)
eg 1
public void fun(){
sop("hello");}
----------------------
()-> sop("hello");
--------------------
eg 2
public void fun(int a,int b){
sop(a+b);}
--------------------------------
(a,b)-> sop(a+b);
-------------------------------
eg 3
public int squ(int i)
{ return i*i;}
-------------------------
i-> i*i; //lambda expression
-----------------------------
eg 4
public String disp(String s)
{ return s.length();}
----------------------------
s->s.length();
-----------------------------
Function<Integer,Integer>f=i-> i*i;
sop("square is="+f.apply(4));
Functional Interface(SAM)
--function which has single abstract method
example
1.Function
2.Predicate
3.Consumer
4.Supplier
5.Runnable
6.Comparable
7.Callable
8.ActionListener
@FunctionalInterface
interface Demo
{
void m1();
}
@FunctionalInterface
interface Demo1 extends Demo{
}
@FunctionalInterface
interface Demo
{
public void m1();
}
@FunctionalInterface
interface Demo
{
public void m1(int a,int b);
}
public class Lan{
psvm(String[] a){
Demo d=(a,b)-> sop("sum is="+(a,b));
d.m1(10,20);
d.m1(20,20);
}
like
int a=10;
String s="sd";
@MultiThreading
return (o1<o2)?+1:(o1>o2)?-1:0
using Lambda
Collections.sort(a,(o1<o2)->(o1<o2)?+1:(o1>o2)?-1:0);
OR
Comaparator<Integer> c=(o1<o2)?+1:(o1>o2)?-1:0;
Collections.sort(a,c);
Collection.binarySearch(list,1);
@-------HTML-------------
<meta> tag --- will give info about particular web page
<!DOCTYPE html>
<html lang="em">
<head>
<title>Wipro</tilte>
<meta name="description" contents="web page created for learning process">
<meta name="author" contents="APJ">
<meta name="keywords" contents="Shopping">
</head>
<body>
<h1>Welcome to Wipro</h1>
<h1>Welcome to Wipro</h1>
<h1>Welcome to Wipro</h1>
.
.
<h6>
<!--Ordered list>
<ol>// for shortcut type ol>*li(how manylist)
<li>First</li>
<li>second</li>
</ol>
` <ol type="i">// for type
<details>
<sumary>Read more</sumary>
<p>---</p>
</details>
<img src="path name" alt="nature" width="300px" height="200px">
<br><br>
<!--Hyperlionk tag-->
<a href="link name" target="blank">Google</a>
<br><br>
<a href="index.html" target="blank">Click here</a>
</body>
</html>
o/p
.apple
.
.
first
second
..
//comment tag
<!--comments-->
developer release
h2{
background-color: 'red';
color:'blue'
}
CD-640MB
audio cd-4-5-6 songs
MP3-150 songs
5 april 2022
@--------Java Script---------
1) describe(function/block)
--Its is used for grouping related specs
describe has 2 parameter string parameter & callback function
string parameter-- for grouping something
});
});
});
//describe 2
describe("this is for login scenario",function(){
beforeEach(function(){
console.log("before Each")
})
});
});
});
var a=true;
expect(a).toBe(true);
expect(a).not.toBe(true)
var b=10;
expect(b).toEqual(10)
var name='Jasmine'
expect(name).not.toBeNull()
var array={10,2,4};
expect(array).toEqual([10,2,4])
var name="Amaan";
expect(name).toContain("A");});
//source file
function(a,b)
{
return a+b;
}
//spec file
describe("Testing calcu",function(){
beforeEach(function(){
console.log("before Each")
})
});
TypeScript
Adds
npm install typescript --save-dev
compile typescript
tsc fname.ts fname.js
OR
tsc fname.ts
addNum(1,2,3,4,5); // any number of parameter can pass bcz its rest parameter
addNum(2,4,1,2,3,4,5);
----------------------------------------------------
// default paramter
function discount(price: number, rate:number =0.50)
{
var dis=price*rate;
console.log(dis);
}
discount(5000);
discount(5000,0.25);
------------------------------------------------
///////////multiple lines comment ctrl+/
--------------------------------------------------
//anonymus function
var disp=function()
{
return "hello"
}
console.log(disp())
--------------------------------------------------
// FunctionConstructor
var myfun=new Function("a","b","return a+b");
var x=myfun(4,4);
console.log(x)
--------------------------------------------------
interface Person{
fname: string;
lname: string;
disp: () =>string
}
--------------------------------------------------
class Employee
{
empid:string
constructor(Empid:string)
{
this.empid=empid
}
display(): void{
console.log("Employee Id is:"+this.empid)
}
}
empobj.display();
--------------------------------------------------
class Animal
{
name: string
constructor(name: string)
{
this.name=name;
}
}
class Dog extends Animal
{
display(): void{
console.log("Name is"+this.name)
}
}
var obj=new Dog("Tommy");
obj.display();
--------------------------------------------------
interface Emp{
ename: string
}
class Empployee implements Emp{
ename: string
constructor(ename
To clone git
function funPromise()
{
let marks=20;
let prom=new Promise((resolve,reject))
{
});
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/
Promise
https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX
https://developer.mozilla.org/en-US/docs/learn/javascript/asynchronous/introducing
system.js.config.js ---file
jsconfig.json---file
https://www.npmjs.com/
i -g @angular/cli
1. ng g library my-button
2. modify file --> my-button.component.ts
3. ng build my-button --prod
4.
npm login
npm publish --access=public
Angular Directives
-- are used to extend the power of html by giving new syntax.
Directives can change, modify, extend behavior of DOM elements
1.Components Directives
2.Structural Directives -ngfor, ngIf, ngSwitch
3.Attribute Directives -ngStyle, ngClass
ngIf
-----
ngIf
ngIf with else
ngIf then and else
<div *ngIf='condition'></div>
ngFor
-----
index
first
last
even
odd
</li>
</ul>
ipl="CSK"
https://rxjs.dev/guide/overview
ng new MyRxJSProject
1. of Operator
2. from operator
3. fromEvent operator
4. internal operator
5. debounceTime operator
Angular Material
ng add @angular/material
https://material.angular.io/
https://www.angularjswiki.com/angular/angular-material-icons-list-mat-icon-list/
function changeTheme(event) {
var target=event.target || event.srcElement;
document.body.style.backgroundColor = themes[target.id].backgroundColor;
document.body.style.color=themes[target.id].color;
}
5 May 2022
@@Spring framework
#dependency injection
ApplicationContext(I)
-classPathXMLApplicationContext(config.xml)
-FileSystemXMLApplicationContext("c/sd/config.xml")
-AnnotationConfigApplicationContext
Steps
1. create maven project
2. get jars ->Spring Core and Spring context(Two dependencies require)
search maven repository and copy this two dependency and write in pom file
3. Create Bean class
-- creating spring bean congigration file
https://docs.spring.io/spring-framework/docs/current/reference/html/core.html
data persistence
getConnection()
ORM - Object-Relational Mapping (Object comes from java and relation comes from
database)
-commit
-Build - Source code is converted into executable form
-Test - Checks if all test cases are passing
-Deploy - Deploys the app to production environment
Jenkins- Github
Build:
Build_a
Build_b
Test:
Test_a
Test_b
Deploy:
Deploy_a
Services:
https://docs.gitlab.com/ee/ci/yaml/