Thursday, October 22, 2020

Web API

 Pipeline in MVC

https://www.c-sharpcorner.com/article/mvc-architecture-its-pipeline4/

We can say that pipeline of MVC contains the following processes,

  • Routing
  • Controller Initialization
  • Action Execution
  • Result Execution
  • View Initialization and Rendering

  • Routing is the first step in ASP.NET MVC pipeline.
  • After finding the route successfully, ProcessRequest() method is invoked
While the ProcessRequest() method is invoked, it uses the IControllerFactory instance to create the controller for the URL request
After initialization of controller it has the information about the action method, this detail of action method is passed to controller’s InvokeAction() method

View Engine takes ViewResult type and renders it as a View and shows it by using IView

MVC
 Model?
It is basically a business entity which is used to represent the application data.
it's the presentation layer of ASP.Net MVC.
Controller
The Controller is responsible for taking the end user request and loading the appropriate Model and View.

Web API Security

There are two technique for security in Web API. one is basic authentication and second is token based authorization. We can also maintain session using token based atuhorization.













  1. Serialization:
Person person = new Person { Name = "John", Age = 30, City = "New York" }; string serializedData = JsonSerializer.Serialize(person);

The JsonSerializer.Serialize() method is used to serialize the person object into a JSON string.
  1. Deserialization:
  2. string jsonString = "{\"Name\":\"John\",\"Age\":30,\"City\":\"New York\"}";Person deserializedPerson = JsonSerializer.Deserialize<Person>(jsonString);
  3. In the deserialization example, we have a JSON string jsonString representing the serialized data. The JsonSerializer.Deserialize<T>() method is used to deserialize the JSON string back into a Person object.
The System.Text.Json namespace provides the JsonSerializer class, which offers serialization and deserialization capabilities using JSON format. It's available in .NET Core and .NET 5.0 and later versions.







Session, Cookie, JWT, Token, SSO, and OAuth 2.0 Explained in One Diagram

When you login to a website, your identity needs to be managed. Here is how different solutions work:

- Session - The server stores your identity and gives the browser a session ID cookie. This allows the server to track login state. But cookies don't work well across devices.

- Token - Your identity is encoded into a token sent to the browser. The browser sends this token on future requests for authentication. No server session storage is required. But tokens need encryption/decryption.

- JWT - JSON Web Tokens standardize identity tokens using digital signatures for trust. The signature is contained in the token so no server session is needed.

- SSO - Single Sign On uses a central authentication service. This allows a single login to work across multiple sites.

- OAuth2 - Allows limited access to your data on one site by another site, without giving away passwords.

- QR Code - Encodes a random token into a QR code for mobile login. Scanning the code logs you in without typing a password.

Over to you: QR code logins are gaining popularity. Do you know how it works?






Wednesday, October 21, 2020

Friday, October 9, 2020

Database

select round(  (exp(sum(ln(x))))  ,0) as ProductExample

  from (

    SELECT 3 X FROM DUAL

    UNION ALL 

    SELECT 5 X FROM DUAL

    UNION ALL

    SELECT 2 X FROM DUAL)

Output: 

3

5

2

Output: 

30

The Oracle/PLSQL NULLIF function compares expr1 and expr2. If expr1 and expr2 are equal, the NULLIF function returns NULL. Otherwise, it returns expr1.

https://www.oracletutorial.com/oracle-basics/oracle-group-by/




Wednesday, August 5, 2020

diabetes


হাঁটার দশ কারণ

হাঁটা ভালো ডায়াবেটিসের রোগীদেরও। হাঁটলে হরমোন ইনসুলিন কাজে লাগে জোরে, রক্তের গ্লুকোজ দ্রুত ঢোকে দেহকোষে। শরীর পায় শক্তি। রক্তে কমে গ্লুকোজ। জটিলতা কমবে, স্নায়ুর ক্ষতি, কিডনির ক্ষতি ঠেকানো যাবে হেঁটে। যাঁদের ডায়াবেটিস আছে, তাঁরা প্রতিবার আহারের পর হাঁটুন ১০ মিনিট। আর ম্যাজিক দেখুন নিজেই।

ডায়াবেটিস নিয়ন্ত্রণ রাখার কৌশল

Tuesday, July 7, 2020

Kafka ETL


Kafka is an open source software which provides a framework for storing, reading and analysing streaming data.
What is the actual role of ZooKeeper in Kafka?
Zookeeper is mainly used to track status of nodes present in Kafka cluster and also to keep track of Kafka topics, messages, etc

Debezium is a distributed platform that turns your existing databases into event streams, so applications can see and respond immediately to each row-level change in the databases

Debezium, Zookeeper, Kafka, Source Connector and Sink Connectors :
https://www.knowledgehut.com/interview-questions/kafka
https://data-flair.training/blogs/apache-kafka-tutorial/


--------------------------------------------Linux
 pwd= present Working directory
ls -lrt= directory files and folder
unzip =to unzip folder
clear= clear screen
cd= change directory
./= current folder
../=previous folder
../../=pervious of previous folder
sudo update yum= (redhate)update server
sudo yum update= (centos) update server
vim /etc/os-release= to see server info
cp = copy
mv = move
-r = omitting
.vim= edit
tar = to read tar file
mkdir= create directory
cd /usr= create java folder here
~/ =home+root directory
source= update file change to system
esc :q = quit
esc :wq =write+quit save
vi = read file
rm -rf= delete 

To Save a file Use Esc Button + : + wq(write quit)
cd k + Tab(if you do not know file name or folder name then use initial letter of that file or folder + Tab


--------------------------------------------

Driving

 https://youtube.com/shorts/5Ac2qZHrApU?si=_X-G7pJFHiZoD-s7 https://www.youtube.com/watch?v=f6pSsex87oU