❌

Normal view

There are new articles available, click to refresh the page.
Before yesterdayElavarasu

Hoisting – Javascript

By: Elavarasu
25 October 2024 at 10:38

Hoisting :
we can use variable before creating

message = β€œhello” // without creating variable
console.log(message);
var message; // this type of declaration is hoisting type in JavaScript.

// Hoisting

/ Hoisting

function codeHoist(){
a = 10;
let b = 50;
}
codeHoist();
console.log(a); //10
console.log(b); //Reference Error b is not defined

JAVASCRIPT

By: Elavarasu
25 October 2024 at 09:56

JavaScript is a versatile programming language primarily used to create dynamic and interactive features on websites.
JavaScript is a scripting language that allows you to implement complex features on web pages.
Browsers have Interpreters. It will converts JAVASCRIPT code to machine code.
Browsers have its own interpreters like

  • Chrome – V8-engine
  • Edge – Chakra

JavaScript- Identifiers :

var message; –> Variable (Identifier)
message = β€˜Javascript’;

func sayHello() {
console.log(β€˜Hello’)
}

//sayHello Is the identifier for this function.

//variables , objects,functions,arrays ,classes names are identifiers in js.

SCOPE :
In JavaScript, scope refers to the context in which variables and functions are accessible. It determines the visibility and lifetime of these variables and functions within your code. There are three main types of scope in JavaScript.

Global Scope:.

  • Variables declared outside any function or block have global scope.
  • These variables are accessible from anywhere in the code

example :

let globalVar = "I'm global";

function test() {
  console.log(globalVar); // Accessible here
}

test();
console.log(globalVar); // Accessible here too

Function Scope

  • Variables declared within a function are local to that function.
  • They cannot be accessed from outside the function.

example :

function test() {
  let localVar = "I'm local";
  console.log(localVar); // Accessible here
}

test();
console.log(localVar); // Error: localVar is not defined

Block Scope:

  • Introduced with ES6, variables declared with let or const within a block (e.g., inside {}) are only accessible within that block

example :

{
  let blockVar = "I'm block-scoped";
  console.log(blockVar); // Accessible here
}

console.log(blockVar); // Error: blockVar is not defined

Keywords | Reserved Words

Keywords are reserved words in JavaScript that cannot use to indicate variable labels or function names.

Variables

variables ==> stored values ==> it will stored to ram / It will create separate memory.so we need memory address for access the values.

Stores Anything :
JavaScript will store any value in the variable.

Declaring Variable :

 * Var
 * let
 * const    

we can declare variable using above keywords:

Initialize Variable :

Using assignment operator to assign the value to the variables.

var text = "hello";

Hoisting – Javascript

By: Elavarasu
25 October 2024 at 10:38

Hoisting :
we can use variable before creating

message = β€œhello” // without creating variable
console.log(message);
var message; // this type of declaration is hoisting type in JavaScript.

// Hoisting

/ Hoisting

function codeHoist(){
a = 10;
let b = 50;
}
codeHoist();
console.log(a); //10
console.log(b); //Reference Error b is not defined

JAVASCRIPT

By: Elavarasu
25 October 2024 at 09:56

JavaScript is a versatile programming language primarily used to create dynamic and interactive features on websites.
JavaScript is a scripting language that allows you to implement complex features on web pages.
Browsers have Interpreters. It will converts JAVASCRIPT code to machine code.
Browsers have its own interpreters like

  • Chrome – V8-engine
  • Edge – Chakra

JavaScript- Identifiers :

var message; –> Variable (Identifier)
message = β€˜Javascript’;

func sayHello() {
console.log(β€˜Hello’)
}

//sayHello Is the identifier for this function.

//variables , objects,functions,arrays ,classes names are identifiers in js.

SCOPE :
In JavaScript, scope refers to the context in which variables and functions are accessible. It determines the visibility and lifetime of these variables and functions within your code. There are three main types of scope in JavaScript.

Global Scope:.

  • Variables declared outside any function or block have global scope.
  • These variables are accessible from anywhere in the code

example :

let globalVar = "I'm global";

function test() {
  console.log(globalVar); // Accessible here
}

test();
console.log(globalVar); // Accessible here too

Function Scope

  • Variables declared within a function are local to that function.
  • They cannot be accessed from outside the function.

example :

function test() {
  let localVar = "I'm local";
  console.log(localVar); // Accessible here
}

test();
console.log(localVar); // Error: localVar is not defined

Block Scope:

  • Introduced with ES6, variables declared with let or const within a block (e.g., inside {}) are only accessible within that block

example :

{
  let blockVar = "I'm block-scoped";
  console.log(blockVar); // Accessible here
}

console.log(blockVar); // Error: blockVar is not defined

Keywords | Reserved Words

Keywords are reserved words in JavaScript that cannot use to indicate variable labels or function names.

Variables

variables ==> stored values ==> it will stored to ram / It will create separate memory.so we need memory address for access the values.

Stores Anything :
JavaScript will store any value in the variable.

Declaring Variable :

 * Var
 * let
 * const    

we can declare variable using above keywords:

Initialize Variable :

Using assignment operator to assign the value to the variables.

var text = "hello";

React -Router

By: Elavarasu
17 October 2024 at 05:08

Understanding Routes

React- Router is used for render the components depends on URL without reloading the browser page. It navigates a page to another page without page reloads. we can use router in react project, first we install the react-router-dom package from react.

Then, access the router using

import {BrowserRouter,Router,Routes} from 'react-router-dom';

after that we use link to diplay the browser using Link instead <a href=''> in react.

so,

import {BrowserRouter,Router,Routes,Link} from β€˜react-router-dom’;

example for using Link and routes:

Using Links:

  '/' is the root page it display default home page

    <Link to='/'>Home</Link>
    <Link to='/about'>About</Link>
    <Link to='/contact'>Contact</Link>

}/> }> }/>

Using Routes:

<Browser Router>
<Router>
<Routes path='/' element={<Home/>}/>
<Routes path='/about' element={<About/>}>
<Routes path='/contact' element={<Contact/>}/>
</Router>
</Browser Router>

React -Router

By: Elavarasu
17 October 2024 at 05:08

Understanding Routes

React- Router is used for render the components depends on URL without reloading the browser page. It navigates a page to another page without page reloads. we can use router in react project, first we install the react-router-dom package from react.

Then, access the router using

import {BrowserRouter,Router,Routes} from 'react-router-dom';

after that we use link to diplay the browser using Link instead <a href=''> in react.

so,

import {BrowserRouter,Router,Routes,Link} from β€˜react-router-dom’;

example for using Link and routes:

Using Links:

  '/' is the root page it display default home page

    <Link to='/'>Home</Link>
    <Link to='/about'>About</Link>
    <Link to='/contact'>Contact</Link>

}/> }> }/>

Using Routes:

<Browser Router>
<Router>
<Routes path='/' element={<Home/>}/>
<Routes path='/about' element={<About/>}>
<Routes path='/contact' element={<Contact/>}/>
</Router>
</Browser Router>

Install postgres & pgadmin

By: Elavarasu
20 September 2024 at 16:57

sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh

To manually configure the Apt repository, follow these steps:

sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc –fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
sudo sh -c β€˜echo β€œdeb

[signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc]

https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main” > /etc/apt/sources.list.d/pgdg.list’
sudo apt update
sudo apt -y install postgresql

sudo -i -u postgres

psql

\q

createdb my_pgdb

psql -d my_pgdb

\conninfo

After the we have download pgadmin using cmd :

#
# Setup the repository
#

# Install the public key for the repository (if not done previously):
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg

# Create the repository configuration file:
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'

#
# Install pgAdmin
#

# Install for both desktop and web modes:
sudo apt install pgadmin4

# Install for desktop mode only:
sudo apt install pgadmin4-desktop

# Install for web mode only:
sudo apt install pgadmin4-web

# Configure the webserver, if you installed pgadmin4-web:
sudo /usr/pgadmin4/bin/setup-web.sh

After tat setting password for pgadmin

sudo -i -u postgres

psql

\password postgres

Enter new pasword :

Enter it again


Reference : https://www.postgresql.org/download/linux/ubuntu/

https://www.pgadmin.org/download/pgadmin-4-apt/


Install postgres & pgadmin

By: Elavarasu
20 September 2024 at 16:57

sudo apt install -y postgresql-common
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh

To manually configure the Apt repository, follow these steps:

sudo apt install curl ca-certificates
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc –fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
sudo sh -c β€˜echo β€œdeb

[signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc]

https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main” > /etc/apt/sources.list.d/pgdg.list’
sudo apt update
sudo apt -y install postgresql

sudo -i -u postgres

psql

\q

createdb my_pgdb

psql -d my_pgdb

\conninfo

After the we have download pgadmin using cmd :

#
# Setup the repository
#

# Install the public key for the repository (if not done previously):
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg

# Create the repository configuration file:
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'

#
# Install pgAdmin
#

# Install for both desktop and web modes:
sudo apt install pgadmin4

# Install for desktop mode only:
sudo apt install pgadmin4-desktop

# Install for web mode only:
sudo apt install pgadmin4-web

# Configure the webserver, if you installed pgadmin4-web:
sudo /usr/pgadmin4/bin/setup-web.sh

After tat setting password for pgadmin

sudo -i -u postgres

psql

\password postgres

Enter new pasword :

Enter it again


Reference : https://www.postgresql.org/download/linux/ubuntu/

https://www.pgadmin.org/download/pgadmin-4-apt/


Eclipse closes automatically when Using β€˜System.out.println’

By: Elavarasu
4 June 2024 at 00:07

I’m experiencing an issue with Eclipse where it closes automatically when I use β€˜System.out.println’.

Environment :
Eclipse Version: eclipse 2024-03 is the latest version of Eclipse today I reinstalled it.
I downloaded Eclipse from the official Eclipse Foundation website at Eclipse Downloads | The Eclipse Foundation 1.

JDK version : java 22.0.1 2024-04-16
Javaβ„’ SE Runtime Environment (build 22.0.1+8-16)
Java HotSpotβ„’ 64-Bit Server VM (build 22.0.1+8-16, mixed mode, sharing)

Operating System: Ubuntu Ubuntu 22.04.4 LTS

Problem Description: Whenever I run a simple Java program that uses System.out.println. Eclipse hung and closed automatically without getting any error messages.

How i fix this issue

I fix this issue

Hi everyone,

I recently encountered a problem with Eclipse. when I upgraded Ubuntu 20 to Ubuntu 22 then some applications did not work properly . After some troubleshooting, I discovered that switching from Wayland to X11 resolved the issue. Here’s how you can do it:

How to Switch from Wayland to X11 on Ubuntu

If you’re experiencing issues with Wayland and want to switch back to X11, follow these steps:

Turn off Wayland and switch back to X11.

  1. Log out of Ubuntu.
  2. Start to log in again and click the icon that has appeared at the bottom right of the screen – that gives you the option to disable Wayland.
  3. Switch back to Xorg.

Switching to X11 fixed the issues I was having, so I hope this helps anyone experiencing similar problems. Let me know if you have any questions or need further assistance!

Eclipse closes automatically when Using β€˜System.out.println’

By: Elavarasu
4 June 2024 at 00:07

I’m experiencing an issue with Eclipse where it closes automatically when I use β€˜System.out.println’.

Environment :
Eclipse Version: eclipse 2024-03 is the latest version of Eclipse today I reinstalled it.
I downloaded Eclipse from the official Eclipse Foundation website at Eclipse Downloads | The Eclipse Foundation 1.

JDK version : java 22.0.1 2024-04-16
Javaβ„’ SE Runtime Environment (build 22.0.1+8-16)
Java HotSpotβ„’ 64-Bit Server VM (build 22.0.1+8-16, mixed mode, sharing)

Operating System: Ubuntu Ubuntu 22.04.4 LTS

Problem Description: Whenever I run a simple Java program that uses System.out.println. Eclipse hung and closed automatically without getting any error messages.

How i fix this issue

I fix this issue

Hi everyone,

I recently encountered a problem with Eclipse. when I upgraded Ubuntu 20 to Ubuntu 22 then some applications did not work properly . After some troubleshooting, I discovered that switching from Wayland to X11 resolved the issue. Here’s how you can do it:

How to Switch from Wayland to X11 on Ubuntu

If you’re experiencing issues with Wayland and want to switch back to X11, follow these steps:

Turn off Wayland and switch back to X11.

  1. Log out of Ubuntu.
  2. Start to log in again and click the icon that has appeared at the bottom right of the screen – that gives you the option to disable Wayland.
  3. Switch back to Xorg.

Switching to X11 fixed the issues I was having, so I hope this helps anyone experiencing similar problems. Let me know if you have any questions or need further assistance!

this keyword

By: Elavarasu
12 March 2024 at 13:55
  • this is a java keyword this keyword refers to current object of the same class
  • this keyword helps to differentiate between local variable and global instance variable
  • we cannot use this keyword inside static context. [static method or static block].
  • this only used for object specific.
class Shop
{
static String shopName ="Updatez";
int price, discount; // non-static variable
public static void main(String args[])
{
Shop product = new Shop();
product.price =1000;
product.discount =10;

s.sell(); // method calling
}

void sell()
{
int discount = 30; // local variable
System.out.println(discount);30
System.out.println(this.price);
System.out.println(this.discount);
}
}

output:
30
1000
10

we cannot use this keyword inside the static method and also a main method


Scanner |Java

By: Elavarasu
12 March 2024 at 09:50

import java.util.Scanner;

Scanner sc = new Scanner(System.in);

A simple text scanner that can parse primitive types and strings using regular expressions.
A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace. The resulting tokens may then be converted into values of different types using the various next methods.

Scanner sc = new Scanner(System.in);
System.out.println("Enter the value:");
int value =sc.nextInt();
System.out.println(value);
  • int –> nextInt()
  • long –>nextLong()
  • short –>nextShort()
  • float –> nextFloat()
  • double –> nextDouble()
  • boolean –> nextBoolean()
  • String –> nextLine() & next()

reference:https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html

Fields in Java

By: Elavarasu
11 March 2024 at 18:23

Fields are categorized by various data types in java.

Methods -> set of Instructions with a name for a specific task.

Data types in java :

Java programming language is statically typed, means all variables must first be declared before being used.

  • Primitive
  • Non-Primitive

Primitive Data types in java :

Fields | global variables

  • class specific fields
  • object specific fields

Field is a data member of a class. Unless specified otherwise, a field is not static.

  • static variables
  • non-static variables

Static variables:

  • common variables for all objects
  • static members will have only one copy in memory. but static is not constant.
  • values will change.
  • static varibles depends on whole class. so, its a class specific variables.
static String owner_name ="Elavarasu";

Non-static variables: | Instance [object specific]

  • specific to each objects.
  • non-static members will have multiples copies in memory
  • it depends only a object. so it is object specific.
String employee = "name";

Source-Code:


Reference : https://www.shiksha.com/online-courses/articles/data-types-in-java-primitive-and-non-primitive-data-types/

this keyword

By: Elavarasu
12 March 2024 at 13:55
  • this is a java keyword this keyword refers to current object of the same class
  • this keyword helps to differentiate between local variable and global instance variable
  • we cannot use this keyword inside static context. [static method or static block].
  • this only used for object specific.
class Shop
{
static String shopName ="Updatez";
int price, discount; // non-static variable
public static void main(String args[])
{
Shop product = new Shop();
product.price =1000;
product.discount =10;

s.sell(); // method calling
}

void sell()
{
int discount = 30; // local variable
System.out.println(discount);30
System.out.println(this.price);
System.out.println(this.discount);
}
}

output:
30
1000
10

we cannot use this keyword inside the static method and also a main method


Scanner |Java

By: Elavarasu
12 March 2024 at 09:50

import java.util.Scanner;

Scanner sc = new Scanner(System.in);

A simple text scanner that can parse primitive types and strings using regular expressions.
A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace. The resulting tokens may then be converted into values of different types using the various next methods.

Scanner sc = new Scanner(System.in);
System.out.println("Enter the value:");
int value =sc.nextInt();
System.out.println(value);
  • int –> nextInt()
  • long –>nextLong()
  • short –>nextShort()
  • float –> nextFloat()
  • double –> nextDouble()
  • boolean –> nextBoolean()
  • String –> nextLine() & next()

reference:https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html

Fields in Java

By: Elavarasu
11 March 2024 at 18:23

Fields are categorized by various data types in java.

Methods -> set of Instructions with a name for a specific task.

Data types in java :

Java programming language is statically typed, means all variables must first be declared before being used.

  • Primitive
  • Non-Primitive

Primitive Data types in java :

Fields | global variables

  • class specific fields
  • object specific fields

Field is a data member of a class. Unless specified otherwise, a field is not static.

  • static variables
  • non-static variables

Static variables:

  • common variables for all objects
  • static members will have only one copy in memory. but static is not constant.
  • values will change.
  • static varibles depends on whole class. so, its a class specific variables.
static String owner_name ="Elavarasu";

Non-static variables: | Instance [object specific]

  • specific to each objects.
  • non-static members will have multiples copies in memory
  • it depends only a object. so it is object specific.
String employee = "name";

Source-Code:


Reference : https://www.shiksha.com/online-courses/articles/data-types-in-java-primitive-and-non-primitive-data-types/

Features of Java

By: Elavarasu
7 March 2024 at 14:40

1. Java is simple:

Java is a simple programming language. Because syntax is derived from C & C++ language. Java has removed some complex topics like Pointers, Operator Overloading, and Multiple Inheritance explicit memory allocation. Java has an Automatic Garbage Collection.

2. Java is Robust :

  • Java is Robust which means Strong | Reliable
  • It uses strong memory management.
  • Java provides automatic garbage collection which runs on the JVM to get rid of objects that are not being used by a Java application anymore.
  • There is exception handling and the type checking mechanism in Java
  • It is developed in such a way that it puts a lot of effort into checking errors as early as possible, which is why the Java compiler can detect even those errors that are not easy to detect by another programming language.

3. Java is Platform Independent :

Operating System – Os is interface between Human Being and Machine. Platform is nothing but Processor + Os .

  • Java has two level translation – Compilation and Interpretation.
  • Java Development Kit – JDK
  • Compiler is the part of jdk. Error checking mechanism is also present in jdk.
  • First jdk will check the error. If in case error is present in the code compilation is not allowed. So translator need error free file for translation process.
  • .Java file is converted into .classfile using JDK. It will check whole file into single run. Classfile is otherwise called Bytecode.
  • This byte code or .Classfile is Platform Independent code. Because .classfile is common for all the Platform(Os).
  • Java virtual machine – JVM . Jit compiler is part of JVM
  • JVM is part of JRE – Java Runtime Environment.
  • .Class file is converted into binary code using interpreter. It will check line by line. Binary code is otherwise known as Machine code.
  • This compilation is Platform Dependent conversion.
  • Jit compiler : Just in time compiler. Converting Byte code into Binary code.

Reference :

https://www.geeksforgeeks.org/java

https://www.javatpoint.com/features-of-java

Features of Java

By: Elavarasu
7 March 2024 at 14:40

1. Java is simple:

Java is a simple programming language. Because syntax is derived from C & C++ language. Java has removed some complex topics like Pointers, Operator Overloading, and Multiple Inheritance explicit memory allocation. Java has an Automatic Garbage Collection.

2. Java is Robust :

  • Java is Robust which means Strong | Reliable
  • It uses strong memory management.
  • Java provides automatic garbage collection which runs on the JVM to get rid of objects that are not being used by a Java application anymore.
  • There is exception handling and the type checking mechanism in Java
  • It is developed in such a way that it puts a lot of effort into checking errors as early as possible, which is why the Java compiler can detect even those errors that are not easy to detect by another programming language.

3. Java is Platform Independent :

Operating System – Os is interface between Human Being and Machine. Platform is nothing but Processor + Os .

  • Java has two level translation – Compilation and Interpretation.
  • Java Development Kit – JDK
  • Compiler is the part of jdk. Error checking mechanism is also present in jdk.
  • First jdk will check the error. If in case error is present in the code compilation is not allowed. So translator need error free file for translation process.
  • .Java file is converted into .classfile using JDK. It will check whole file into single run. Classfile is otherwise called Bytecode.
  • This byte code or .Classfile is Platform Independent code. Because .classfile is common for all the Platform(Os).
  • Java virtual machine – JVM . Jit compiler is part of JVM
  • JVM is part of JRE – Java Runtime Environment.
  • .Class file is converted into binary code using interpreter. It will check line by line. Binary code is otherwise known as Machine code.
  • This compilation is Platform Dependent conversion.
  • Jit compiler : Just in time compiler. Converting Byte code into Binary code.

Reference :

https://www.geeksforgeeks.org/java

https://www.javatpoint.com/features-of-java

Git Commands

By: Elavarasu
2 March 2024 at 12:24
  • git clone
  • git add
  • git commit
  • git push
  • git pull
  • git branch
  • git checkout
  • git status

git clone remote

to create new repository in github cloud , then create a local repo and clone 2 repositories using git clone remote (repo link).

git add filename
git add .

to add a single file using git add and add all the files which present in the current repo the use git add . | . represent add all the files.

git commit -m "message"

commit the added file using git commit and put some mesagges about the file using -m ” ” .

some ideas of commit messages are available in below mentioned link.

Reference : conventional commit.org | https://www.conventionalcommits.org/en/v1.0.0/

git rm --cached filename
if incase want to remove the added file use git remove
git rm --cached -f filename
-f --> forcefully remove the file.
git push

push the commited file from the local to cloud repo using git push. it will push the file to remote repository.

git pull 

when u need to change or edit or modify the remote file first you will pull the file to local repository from remote using git pull.

git branch 
Branch means where will you store the files in git remote.git branch is to specify the branch name it will push the file to current remote branch.

git checkout -b "branchname"
to create a new branch.

git checkout branchname
check the created branch or new branch

git branch -M branchname
to modify or change the branch name

git branch -a
to listout all branches.
git status
check all the status of previously used command like know the added file is staged or unstaged

Reference : https://www.markdownguide.org/cheat-sheet/

markdown cheathseet for readme file

Reference : conventional commit.org | https://www.conventionalcommits.org/en/v1.0.0/

for commit messages.

Git Commands

By: Elavarasu
2 March 2024 at 12:24
  • git clone
  • git add
  • git commit
  • git push
  • git pull
  • git branch
  • git checkout
  • git status

git clone remote

to create new repository in github cloud , then create a local repo and clone 2 repositories using git clone remote (repo link).

git add filename
git add .

to add a single file using git add and add all the files which present in the current repo the use git add . | . represent add all the files.

git commit -m "message"

commit the added file using git commit and put some mesagges about the file using -m ” ” .

some ideas of commit messages are available in below mentioned link.

Reference : conventional commit.org | https://www.conventionalcommits.org/en/v1.0.0/

git rm --cached filename
if incase want to remove the added file use git remove
git rm --cached -f filename
-f --> forcefully remove the file.
git push

push the commited file from the local to cloud repo using git push. it will push the file to remote repository.

git pull 

when u need to change or edit or modify the remote file first you will pull the file to local repository from remote using git pull.

git branch 
Branch means where will you store the files in git remote.git branch is to specify the branch name it will push the file to current remote branch.

git checkout -b "branchname"
to create a new branch.

git checkout branchname
check the created branch or new branch

git branch -M branchname
to modify or change the branch name

git branch -a
to listout all branches.
git status
check all the status of previously used command like know the added file is staged or unstaged

Reference : https://www.markdownguide.org/cheat-sheet/

markdown cheathseet for readme file

Reference : conventional commit.org | https://www.conventionalcommits.org/en/v1.0.0/

for commit messages.

Why java?

By: Elavarasu
1 March 2024 at 11:26

Java is invented in 1991 by James Gosling of Sun Microsystems (later acquired by Oracle)

WORA –> write once run anywhere

Rules and syntax are derived from C and C++ Languages.

Java is a technology consisting of both a programming language and a software platform

To create an application using java , we need to download the JDK (java development kit) . which is available for all platforms (OS).

JDK

  • JDK is one of three core technology packages.
  • JDK provides the tools necessary to write java programs that can be executed and run by the JVM and JRE.
  • Every jdk contains java compiler
.java  --> compiler | converter | Translator --> Bytecode
write the program in java, then a compiler turns a program into java bytecode.which converts .javafile to .classfile

compiler –> translate the entire source code in a single run and its performance is higher.

interpreter –> translate the entire source code line by line and its performance is lower.

Bytecode

Instruction set for java virtual machine (Jvm) , which means bytecode is not human readable. its is platform (os) independent.

JVM

  • Jvm parses and runs (interprets) the Java bytecode
  • It breaks the bytecode and interprets line by line. and it produce byte code to binary code
  • This byte code is platform dependent (Os)
  • Just in time [ JIT ] Compiler -Interprets the Java bytecode.

JRE

  • Java Runtime Environment
  • java only runs in jre.
  • Its a secured runtime environment. it contains jvm and jvm contains Jit.
  • Jit produce .class file to binary code.
  • so, java is secured language.

Reference : https://www.ibm.com/topics/java

Why java?

By: Elavarasu
1 March 2024 at 11:26

Java is invented in 1991 by James Gosling of Sun Microsystems (later acquired by Oracle)

WORA –> write once run anywhere

Rules and syntax are derived from C and C++ Languages.

Java is a technology consisting of both a programming language and a software platform

To create an application using java , we need to download the JDK (java development kit) . which is available for all platforms (OS).

JDK

  • JDK is one of three core technology packages.
  • JDK provides the tools necessary to write java programs that can be executed and run by the JVM and JRE.
  • Every jdk contains java compiler
.java  --> compiler | converter | Translator --> Bytecode
write the program in java, then a compiler turns a program into java bytecode.which converts .javafile to .classfile

compiler –> translate the entire source code in a single run and its performance is higher.

interpreter –> translate the entire source code line by line and its performance is lower.

Bytecode

Instruction set for java virtual machine (Jvm) , which means bytecode is not human readable. its is platform (os) independent.

JVM

  • Jvm parses and runs (interprets) the Java bytecode
  • It breaks the bytecode and interprets line by line. and it produce byte code to binary code
  • This byte code is platform dependent (Os)
  • Just in time [ JIT ] Compiler -Interprets the Java bytecode.

JRE

  • Java Runtime Environment
  • java only runs in jre.
  • Its a secured runtime environment. it contains jvm and jvm contains Jit.
  • Jit produce .class file to binary code.
  • so, java is secured language.

Reference : https://www.ibm.com/topics/java

Id | Sudo | Su

By: Elavarasu
29 February 2024 at 13:58

To know the user is using id command

id username

sudo

permits the user to execute a command as a super user at the admin level


su

su --> switch user
su -username
id
exit

Zip

zip filename file
zip filename *.txt
zip -sf filename.zip
to view the zipped file.

unzip

unzip filename 

to make another directory to unzip the file or rename the exisisting file.


ulimit

to manage the resources of the particular user.

ulimit -a

soft limit cannot more than hard limit

cat  /etc/security/limits.conf

type> can have the two values:

-β€œsoft” for enforcing the soft limits

– β€œhard” for enforcing hard limits


type

to know where the command it will present

type command

which 

where the command will locate

which mv


whatis

to know the description of the command


whereis

locate the binary, source, and manual page files for a command


apropos

search the manual page names and descriptions


change attribute

which makes the file unchangeable in the same location. but will copy the file in another location and edit the file.

sudo chattr +i filename
lsattr
sudo chattr -i file

it will convert unchangeable file to changeable file

sudo chattr -R +i dir1
sudo chattr -R -i dir1

to change the directory to unmutable


pid | pwdx

By: Elavarasu
29 February 2024 at 08:06
pidof ---> find the process ID of running program
vi test --> new process
ps -ef | grep vi
pidof vi
pwdx 8279
to know the present working directory of vi using pid.

nice value

NI –> (-20 to 19) highest priority to lowest priority range.

1 to 19 –> non root users will aslo set the ni values

-20 to -1 –> root user only set the value

to modify the program priority.
ps -l --> process list
to change the priority of the running program
nice -n 11 ps -l

renice

changing the priority of the running program.


user-management

useradd

create a new user or update default new user information.

tail /etc/passwd –> userslist

adduser –> adduser, addgroup – add a user or group to the system

sudo passwd sample
to set a password for sample user.
sudo passwd -Sa
to check all the users having password or not.
set a password for the sample user

after setting the passwd for sample user

sudo passwd -d sample
d --> delete
NP --> no passwd

user-delete

sudo userdel sample
sudo userdel -r sample --> to delete with home

Group

to create group with user

to create a group

addgroup :

deletegroup :

sudo groupdel groupname
sudo delgroup groupname
sudo usermod -aG sudo username
permission to using i commands for new user
to give sudo or root previlage for new user.

Id | Sudo | Su

By: Elavarasu
29 February 2024 at 13:58

To know the user is using id command

id username

sudo

permits the user to execute a command as a super user at the admin level


su

su --> switch user
su -username
id
exit

Zip

zip filename file
zip filename *.txt
zip -sf filename.zip
to view the zipped file.

unzip

unzip filename 

to make another directory to unzip the file or rename the exisisting file.


ulimit

to manage the resources of the particular user.

ulimit -a

soft limit cannot more than hard limit

cat  /etc/security/limits.conf

type> can have the two values:

-β€œsoft” for enforcing the soft limits

– β€œhard” for enforcing hard limits


type

to know where the command it will present

type command

which 

where the command will locate

which mv


whatis

to know the description of the command


whereis

locate the binary, source, and manual page files for a command


apropos

search the manual page names and descriptions


change attribute

which makes the file unchangeable in the same location. but will copy the file in another location and edit the file.

sudo chattr +i filename
lsattr
sudo chattr -i file

it will convert unchangeable file to changeable file

sudo chattr -R +i dir1
sudo chattr -R -i dir1

to change the directory to unmutable


pid | pwdx

By: Elavarasu
29 February 2024 at 08:06
pidof ---> find the process ID of running program
vi test --> new process
ps -ef | grep vi
pidof vi
pwdx 8279
to know the present working directory of vi using pid.

nice value

NI –> (-20 to 19) highest priority to lowest priority range.

1 to 19 –> non root users will aslo set the ni values

-20 to -1 –> root user only set the value

to modify the program priority.
ps -l --> process list
to change the priority of the running program
nice -n 11 ps -l

renice

changing the priority of the running program.


user-management

useradd

create a new user or update default new user information.

tail /etc/passwd –> userslist

adduser –> adduser, addgroup – add a user or group to the system

sudo passwd sample
to set a password for sample user.
sudo passwd -Sa
to check all the users having password or not.
set a password for the sample user

after setting the passwd for sample user

sudo passwd -d sample
d --> delete
NP --> no passwd

user-delete

sudo userdel sample
sudo userdel -r sample --> to delete with home

Group

to create group with user

to create a group

addgroup :

deletegroup :

sudo groupdel groupname
sudo delgroup groupname
sudo usermod -aG sudo username
permission to using i commands for new user
to give sudo or root previlage for new user.

MariaDb

By: Elavarasu
27 February 2024 at 11:22
sudo apt install mariadb-server mariadb-client

sudo systemctl status mariadb.servcie

to check the mariadb services.

sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
sudo systemctl stop mariadb.service
sudo mysql_secure_installation

enter into the database using

mysql -u root -p

to view the default databases which present in mariadb using

show databases;
create new database using 
create database name;
show created database
show databases:
to use the exsisting database
use databasename;

Jobs | Kill

By: Elavarasu
26 February 2024 at 16:42
jobs -l
t will dsiplay the job with process id
jobs -p
it will display only pid
fg % 1
foreground
ctrl + z to stop the job
bg % 2
we cannot stop it runs in background

ps – process

report a snapshot for the current process

ps aux ---> it will dsiplay all users
ps x

Kill

kill -9 pid1

used to kill the process


pstree

display running process in tree structure.


MariaDb

By: Elavarasu
27 February 2024 at 11:22
sudo apt install mariadb-server mariadb-client

sudo systemctl status mariadb.servcie

to check the mariadb services.

sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
sudo systemctl stop mariadb.service
sudo mysql_secure_installation

enter into the database using

mysql -u root -p

to view the default databases which present in mariadb using

show databases;
create new database using 
create database name;
show created database
show databases:
to use the exsisting database
use databasename;

Jobs | Kill

By: Elavarasu
26 February 2024 at 16:42
jobs -l
t will dsiplay the job with process id
jobs -p
it will display only pid
fg % 1
foreground
ctrl + z to stop the job
bg % 2
we cannot stop it runs in background

ps – process

report a snapshot for the current process

ps aux ---> it will dsiplay all users
ps x

Kill

kill -9 pid1

used to kill the process


pstree

display running process in tree structure.


Apache Webserver

By: Elavarasu
26 February 2024 at 06:50

apache -> Hypertext transfer protocol webserver.

sudo apt install apache2 -y

install apache2 webserver in ubuntu.

sudo systemctl status apache2
apache2 status check
sudo systemctl enable apache2

persistently run across the reboot

cd /var/www/html

ubuntu default apache webpage.

sudo vim /etc/hosts

customize the localhost name 127.0.0.1 localhost to eladhruv.in. it will reflect only in local server.

rm index.html  -->  it removes default webpage
we customize the default page.

Join

By: Elavarasu
25 February 2024 at 15:57
join file1 file2

join lines of two files on a common field. if no common fields are there then error should be occurs.

join -1 2 -2 1 s3.txt s4.txt

print unpairable lines using column number where FILE NUM is 1 or 2, corresponding to FILE1 or FILE2.


File

to determine the file type.

file filename
file -b filename
b --> brief
file *

it display all the file type including directory.


touch

It will create a empty file the it will change the time snap.

touch filename
touch file{1..20}.txt

It will create 20 empty files. file size are user defined we can create more files.

touch -d tomorrow filename

It will change the day

touch -r s1.txt s2.txt
r --> reference

time reference from s1.txt


Calendar

It display calendar


Reverse

Reverse the character


Redirection

> output Redirection | < input redirection

cat > filename
it will create a new file and we can give input to the file
cat < filename
it will display the file content
 wc < text.txt > text1.txt
cat < text1

it will save the wc of the file to file1
cat >> filename
adding the content to exisiting file
>> append

Tee

tee – read from standard input and write to standard output and files

df -Th | tee df.txt

Grep

grep – print lines that match patterns

grep "word" filename
grep "word" file1 file2
grep -i "word" file1 file2

Apache Webserver

By: Elavarasu
26 February 2024 at 06:50

apache -> Hypertext transfer protocol webserver.

sudo apt install apache2 -y

install apache2 webserver in ubuntu.

sudo systemctl status apache2
apache2 status check
sudo systemctl enable apache2

persistently run across the reboot

cd /var/www/html

ubuntu default apache webpage.

sudo vim /etc/hosts

customize the localhost name 127.0.0.1 localhost to eladhruv.in. it will reflect only in local server.

rm index.html  -->  it removes default webpage
we customize the default page.

Join

By: Elavarasu
25 February 2024 at 15:57
join file1 file2

join lines of two files on a common field. if no common fields are there then error should be occurs.

join -1 2 -2 1 s3.txt s4.txt

print unpairable lines using column number where FILE NUM is 1 or 2, corresponding to FILE1 or FILE2.


File

to determine the file type.

file filename
file -b filename
b --> brief
file *

it display all the file type including directory.


touch

It will create a empty file the it will change the time snap.

touch filename
touch file{1..20}.txt

It will create 20 empty files. file size are user defined we can create more files.

touch -d tomorrow filename

It will change the day

touch -r s1.txt s2.txt
r --> reference

time reference from s1.txt


Calendar

It display calendar


Reverse

Reverse the character


Redirection

> output Redirection | < input redirection

cat > filename
it will create a new file and we can give input to the file
cat < filename
it will display the file content
 wc < text.txt > text1.txt
cat < text1

it will save the wc of the file to file1
cat >> filename
adding the content to exisiting file
>> append

Tee

tee – read from standard input and write to standard output and files

df -Th | tee df.txt

Grep

grep – print lines that match patterns

grep "word" filename
grep "word" file1 file2
grep -i "word" file1 file2

❌
❌