Table
Query
select e.Emp_Name,m.Emp_Name as Manager from EmpDetails e
left join EmpDetails m on m.Manager_Id=e.id
Table
select e.Emp_Name,m.Emp_Name as Manager from EmpDetails e
left join EmpDetails m on m.Manager_Id=e.id
//Word duplication checking
string s = "eearr";
string duplicatewords=string.Empty;
for (int i = 0; i < s.Length; i++)
{
if (!(duplicatewords.Contains(s[i].ToString())))
{
duplicatewords += s[i];
}
}
Console.WriteLine(duplicatewords);
Output:
What is JWT?
JSON Web Token (JWT) serves as a compact and self-contained mechanism for securely transmitting information between parties as a JSON object.
JWT Structure/Components:
Header: Specifies the token type (JWT) and the signing algorithm (e.g., HMAC SHA256).
Payload: Contains the claims, which are statements about an entity (user) and additional metadata.
Signature: Created by encoding the header and payload with a secret, ensuring the token’s integrity.
JWT in Action:
Advantages:
Scalability: Due to their stateless nature, JWTs are ideal for distributed systems.
Flexibility: They can be used across different domains and applications.
Security: When properly implemented, they provide a secure way to handle user authentication.
Security Concerns:
Transmission Security: It's vital to transmit JWTs over HTTPS.
Storage: Store JWTs securely to prevent XSS attacks and other vulnerabilities.
Handling Token Expiry:
Implement short-lived JWTs and use refresh tokens for renewing access without re-authentication.
Interface Class
interface InterfaceA
{
string MethodA(string s);
}
Abstract Class
public class AbstractB:InterfaceA
{
public string MethodA(string s)
{
return s;
}
}
Object Creation Using Abstract
AbstractB abstractB = new AbstractB();
abstractB.MethodA("Abstract object");
Output : Abstract object
Object Creation Using Interface
InterfaceA interfaceA = new AbstractB();
interfaceA.MethodA("Interface object");
Output : Interface object
Note (Object Creation Using Interface) :
|
PROPS |
STATE |
|
The
Data is passed from one component to another. |
The
Data is passed within the component only. |
|
It is
Immutable (cannot be modified). |
It is
Mutable ( can be modified). |
|
Props
can be used with state and functional components. |
The
state can be used only with the state components/class component (Before
16.0). |
|
Props
are read-only. |
The
state is both read and write. |
We use the shouldComponentUpdate() Lifecycle method to customize the default behavior and implement it when the React component should re-render or update itself.
import React from "react";
export default class Test extends React.PureComponent {
render() {
return <h1>Welcome to GeeksforGeeks</h1>;
}
}
Pure components automatically implement the shouldComponentUpdate() method with a shallow prop and state comparison. This method returns false if the props and state haven’t changed.