Saturday 20 November 2021

Azure Concepts

 1. App service

2. Azure function

3. Azure AD -a)RBAC b)Graph Api C)App Registration

4) Service BUS

5) Logic app

6) API management

7) Event Grid 

8) Event Hub

9) Blob storage

10) Queue storage, Table storage, File storage,Disk storage, Data lake storage

11) Azure SQL 

12) Radis Cache

13) VM in Azure

14) Subnet

15) Load balancers

16).Azure kubernetes vs.  Docker

17) Azure Service Fabric- micro services- department

18) Power BI

19) App insights, Monitoring,  telemetry

20) Dev ops CI CD pipe

 lines

21) Middle ware in dot net core

22) Git

23) ARM Templates and Power Shell

24) Azure Cosmos DB

25) Security- Authentication- Authorization(basic-bearer - oauth authentication)

26) SendGrid in Azure

27) Web Jobs in Azure

28) Web hook in Azure

29) Data Factory in Azure (SSIS)

30) RabbitMQ (A Service which helps Connecting out side messages Queue)

31)  Azure Data Lake Gen2 . (This built on top of Blob Storage. Dictionary wise can be arranged)

32)  Azure Cognitive Services + AI (Vision, Speech, Language, Decision, Search)

33)  Azure IOT(Internet of Things) IoT Hub , a cloud platform that lets you easily connect, monitor, provision and configure IoT devices.

 35) Azure Power Apps

36) Dynamics 365

37) Data Bricks

38) Azure Sentinel ( analyse threats)

39) Azure Data Hub

40) Postgre server

41) Azure Automation

42) Security Center (Azure Security Center provides configuration analysis and advanced threat monitoring to help detect threats and scenarios )

42)  Azure Application Gateway

43)API gateway

44) Azure Data Factory

45) Azure Data lake

Monday 23 August 2021

Angular : Directives Vs. Components Vs. Attribute directives Vs. Structural directives

 Angular : Directives Vs. Components Vs. Attribute directives Vs. Structural directives


Directives are classes that add additional behavior to elements in your Angular applications. With Angular's built-in directives, you can manage forms, lists, styles, and what users see


Components—directives with a template. This type of directive is the most common directive type.


Attribute directives—directives that change the appearance or behavior of an element, component, or another directive.


Structural directives—directives that change the DOM layout by adding and removing DOM elements.

Thursday 19 August 2021

C# Question and answers

 --Type of serializations and the fastest serialization in c#

--List down the caches you have used, and name 2 distributed caching

--How to perform memory optimizations in C#. Name 2 incidents

--Lazy loading

--what are middleware’s in c# and how to create them

--Difference between SAML and ws-federation protocol in authentication

--How to create test certificates during development, and name the tools you have used

--Difference between symmetric and asymmetric algorithm

--What are the databases you have used?

--How to connect MongoDB database from C# code? Please name the C# driver you have used for this

=============================================================


1.The binary serializer included with .net should be faster that the XmlSerializer. Or another serializer for protobuf, json, ...

But for some of them you need to add Attributes, or some other way to add metadata. For example ProtoBuf uses numeric property IDs internally, and the mapping needs to be somehow conserved by a different mechanism. Versioning isn't trivial with any serializer.

2.This is being primarily used in the industries today, for having the potential to scale on demand & being highly available.

(A). Scalability, High Availability, Fault-tolerance are crucial to the large scale services running online today.
(B). Businesses cannot afford to have their services go offline. Think about health services, stock markets, military. They have no scope for going down. They are distributed across multiple nodes with a pretty solid amount of redundancy.
 Google Cloud uses Memcache for caching data on its public cloud platform. 2.b. OutputCache filter 2.c.Data Caching3.d.Fragment Caching.

3.Dispose an object after use or make it null.

Use try/finally or using block.
Use GC. Collect() if required.
Remove unnecessary object initialization.
Manage Image caching.
Mange BLOB data, Memory stream and file stream.

4.Lazy loading is essential when the cost of object creation is very high and the use of the object is vey rare. So, this is the scenario where it's worth implementing lazy loading.
The fundamental idea of lazy loading is to load object/data when needed.
5.Middleware is software that's assembled into an app pipeline to handle requests and responses. Each component:
Chooses whether to pass the request to the next component in the pipeline.
Can perform work before and after the next component in the pipeline.
Request delegates are used to build the request pipeline. The request delegates handle each HTTP request.
Request delegates are configured using Run, Map, and Use extension methods. An individual request delegate can be specified in-line as an anonymous method (called in-line middleware), or it can be defined in a reusable class. These reusable classes and in-line anonymous methods are middleware, also called middleware components. Each middleware component in the request pipeline is responsible for invoking the next component in the pipeline or short-circuiting the pipeline. When a middleware short-circuits, it's called a terminal middleware because it prevents further middleware from processing the request.
6.WS-Federation is primarily championed by Microsoft Corporation which has invested heavily into incorporating WS-Federation into its products. SAML is an older specification that is well supported by many identity management vendors. However, most vendors, including Microsoft, are moving to support both standards.
7.Test-signing requires a test certificate. After a test certificate is generated, it can be used to test-sign multiple drivers or driver packages. For more information, see Test Certificates.

This topic describes how to use the MakeCert tool to create test certificates. In most development environments, test certificates generated through MakeCert should be sufficient to test the installation and loading of test-signed drivers or driver packages. For more information about this type of test certificate.
8.Symmetric Key Encryption:
Encryption is a process to change the form of any message in order to protect it from reading by anyone. In Symmetric-key encryption the message is encrypted by using a key and the same key is used to decrypt the message which makes it easy to use but less secure. It also requires a safe method to transfer the key from one party to another.

Asymmetric Key Encryption:
Asymmetric Key Encryption is based on public and private key encryption technique. It uses two different key to encrypt and decrypt the message. It is more secure than symmetric key encryption technique but is much slower.
9. SqlS erver, Oracle, Sybase,MySql. Azure Sql, Blob Storage, MongoDB

10.using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Text;  
using System.Timers;  
using MongoDB.Bson;  
using MongoDB.Driver;  
using MongoDB.Driver.Builders;  
using MongoDB.Driver.GridFS;  
using MongoDB.Driver.Linq;  
using System.Data.SqlClient;  
namespace MongodbRND  
{  
   class Program  
   {  
      static void Main(string[] args)  
      {  
         Console.WriteLine("Mongo DB Test Application");  
         Console.WriteLine("====================================================");  
         Console.WriteLine("Started By:Kailash Chandra Behera");  
         Console.WriteLine("Started On: 14 July 2014");  
         Console.WriteLine("Configuration Setting: 172.16.1.24:27017");  
         Console.WriteLine("====================================================");  
         Console.WriteLine("Initializaing connection");  
         string connectionString = "mongodb://172.16.1.24:27017";  
 
 
         Console.WriteLine("Creating Client..........");  
         MongoClient client = null;  
         try  
         {  
            client = new MongoClient(connectionString);  
            Console.WriteLine("Client Created Successfuly........");  
            Console.WriteLine("Client: " + client.ToString());  
         }  
         catch (Exception ex)  
         {  
            Console.WriteLine("Filed to Create Client.......");  
            Console.WriteLine(ex.Message);  
         }  
 
         Console.WriteLine("Initianting Mongo Db Server.......");  
         MongoServer server = null;  
         try  
         {  
            Console.WriteLine("Getting Servicer object......");  
            server = client.GetServer();  
 
            Console.WriteLine("Server object created Successfully....");  
            Console.WriteLine("Server :" + server.ToString());  
         }  
         catch (Exception ex)  
         {  
            Console.WriteLine("Filed to getting Server Details");  
            Console.WriteLine(ex.Message);  
         }  
 
 
         Console.WriteLine("Initianting Mongo Databaser.........");  
         MongoDatabase database = null;  
         try  
         {  
            Console.WriteLine("Getting reference of database.......");  
            database = server.GetDatabase("Kailash");  
            Console.WriteLine("Database Name : " + database.Name);  
         }  
         catch (Exception ex)  
         {  
            Console.WriteLine("Failed to Get reference of Database");  
            Console.WriteLine("Error :" + ex.Message);  
         }  
         try  
         {  
            Console.WriteLine("Deleteing Collection Symbol");  
            database.DropCollection("Symbol");  
         }  
         catch (Exception ex)  
         {  
            Console.WriteLine("Failed to delete collection from Database");  
            Console.WriteLine("Error :" + ex.Message);  
         }  
 
         Console.WriteLine("Getting Collections from database Database.......");  
 
 
         MongoCollection symbolcollection = null;  
         try  
         {  
            symbolcollection = database.GetCollection<Symbol>("Symbols");  
            Console.WriteLine(symbolcollection.Count().ToString());  
         }  
         catch (Exception ex)  
         {  
            Console.WriteLine("Failed to Get collection from Database");  
            Console.WriteLine("Error :" + ex.Message);  
         }  
         ObjectId id = new ObjectId();  
         Console.WriteLine("Inserting document to collection............");  
         try  
         {  
            Symbol symbol = new Symbol ();  
            symbol.Name = “Star”;  
            symbolcollection.Insert(symbol);  
            id = symbol.ID;  
 
            Symbol symbol = new Symbol ();  
            symbol.Name = “Star1”;  
            symbolcollection.Insert(symbol);  
            id = symbol.ID;  
 
            Console.WriteLine(symbolcollection.Count().ToString());  
         }  
         catch (Exception ex)  
         {  
            Console.WriteLine("Failed to insert into collection of Database " + database.Name);  
            Console.WriteLine("Error :" + ex.Message);  
         }  
 
         try  
         {  
            Console.WriteLine("Preparing Query Document............");  
            List< Symbol > query = symbolcollection.AsQueryable<Entity>().Where<Entity>(sb => sb.Name == "Kailash").ToList();  
 
            Symbol symbol = symbolcollection.AsQueryable<Entity>().Where<Entity>(sb => sb. ID == id).ToList();  
 
         }  
         catch (Exception ex)  
         {  
            Console.WriteLine("Failed to query from collection");  
            Console.WriteLine("Exception :" + ex.Message);  
         }  
         Console.WriteLine("");  
         Console.WriteLine("====================================================");  
         Console.ReadLine();  
      }  
   }  
   public class Symbol  
   {  
      public string Name { get; set; }  
      public ObjectId ID { get; set; }  
   }  

Sunday 8 August 2021

Azure Function Vs Logic Apps

Azure Functions is code being triggered by an event, whereas Logic Apps is a workflow triggered by an event.

Azure Concepts

1. App service

2. Azure function
3. Azure AD -a)RBAD b)Graph Api
4) Service BUS
5) Logic app
6) API management
7) Event Grid 
8) Event Hub
9)  Blob storage
10) Queue storage, Table storage, File storage, Data lake storage
11) Azure SQL 
12) Radis Cache
13) VM in Azure
14) Subnet
15)  Load balancers
16). Azure kubernetes vs.  Docker
17) Azure Service Fabric- micro services- department
18) Power BI
19) App insights, Monitoring,  telemetry
20) Dev ops CI CD pipe
 lines
21) Middle ware in dot net core
22) Git
23) ARM Templates and Power Shell
24) Azure Cosmos DB
25) Security- Authentication- Authorization(basic-bearer - oauth authentication)
26) SendGrid in Azure
27) Web Jobs in Azure
28) Web hook in Azure
29) Data Factory in Azure (SSIS)

Currently these are the concepts for Azure.

Azure Data Factory

 Azure Data Factory 

Azure Data Factory is Azure's cloud ETL service for scale-out serverless data integration and data transformation. It offers a code-free UI for intuitive authoring and single-pane-of-glass monitoring and management. You can also lift and shift existing SSIS packages to Azure and run them with full compatibility in ADF. SSIS Integration Runtime offers a fully managed service.

Web Hook in Azure

 A webhook in azure is an HTTP endpoint. It is a user defined address you can call with relevant information to interact with several other services. Think of it as a sort of mailbox that you can configure services to respond to. You send an HTTP request (mail a letter) and it lands in this mailbox and you have configured say... Azure functions to respond to that particular mailbox or … logic apps or … data factory … The last one for example. You can have data factory post to a webhook when its completed its work if you need some follow on function to be notified upon job complete.

These are different from functions or webjobs in that they do not have any programable logic to execute a task or job. Webhooks are a customizable location to which you can post HTTP requests.

Saturday 7 August 2021

Middleware in dot net core

 What is Middleware?

 

Middleware is a piece of code in an application pipeline used to handle requests and responses.

 

For example, we may have a middleware component to authenticate a user, another piece of middleware to handle errors, and another middleware to serve static files such as JavaScript files, CSS files, images, etc.

 

Middleware can be built-in as part of the .NET Core framework, added via NuGet packages, or can be custom middleware. These middleware components are configured as part of the application startup class in the configure method. Configure methods set up a request processing pipeline for an ASP.NET Core application. It consists of a sequence of request delegates called one after the other.


public void Configure(IApplicationBuilder app, IWebHostEnvironment env)    

{    

    if (env.IsDevelopment())    

    {    

        //This middleware is used reports app runtime errors in development environment.  

        app.UseDeveloperExceptionPage();    

    }    

    else    

    {    

        //This middleware is catches exceptions thrown in production environment.   

        app.UseExceptionHandler("/Error");   

        // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.    

        app.UseHsts(); //adds the Strict-Transport-Security header.    

    }    

    //This middleware is used to redirects HTTP requests to HTTPS.  

    app.UseHttpsRedirection();   

    

    //This middleware is used to returns static files and short-circuits further request processing.   

    app.UseStaticFiles();  

    

    //This middleware is used to route requests.   

    app.UseRouting();   

    

    //This middleware is used to authorizes a user to access secure resources.  

    app.UseAuthorization();    

    

    //This middleware is used to add Razor Pages endpoints to the request pipeline.    

    app.UseEndpoints(endpoints =>    

    {    

        endpoints.MapRazorPages();               

    });    

delegate vs Func vs Predicate

 

A delegate is a type that represents references to methods with a particular parameter list and return type. When you instantiate a delegate, you can associate its instance with any method with a compatible signature and return type. You can invoke (or call) the method through the delegate instance.


Delegates are used to pass methods as arguments to other methods. Event handlers are nothing more than methods that are invoked through delegates. You create a custom method, and a class such as a windows control can call your method when a certain event occurs. The following example shows a delegate declaration:

Action is a delegate (pointer) to a method, that takes zero, one or more input parameters, but does not return anything.


Func is a delegate (pointer) to a method, that takes zero, one or more input parameters, and returns a value (or reference).


Predicate is a special kind of Func often used for comparisons.


Though widely used with Linq, Action and Func are concepts logically independent of Linq. C++ already contained the basic concept in form of typed function pointers.


Func:


using System;  

  

namespace Delegates.Samples.Demo  

{  

    class Program  

    {  

        static void Main(string[] args)  

        {   

            Func<int, int, int> addFunc = new Func<int, int, int>(Add);  

            int result = addFunc(3, 4);  

            Console.WriteLine(result);  

            Console.ReadLine();  

  

        }  

        static int Add(int a, int b)  

        {  

            return a + b;  

        }  

    }  

}  


=====================================

Predicate


using System;  

  

namespace Delegates.Samples.Demo  

{  

    class Program  

    {  

        static void Main(string[] args)  

        {  

            Predicate<int> IsEven = new Predicate<int>(IsEvenNumber);  

            Console.WriteLine(IsEven(10));  

            Console.WriteLine(IsEven(1567));  

            Console.ReadLine();  

  

        }  

        static bool IsEvenNumber(int number)  

        {  

            return number % 2 == 0;  

        }  

    }  

}   

Angular Components communication

 Components can communicate with each other in various ways, including:

Parent to Child: via Input

Child to Parent: via Output() and EventEmitter

Child to Parent: via ViewChild

Unrelated Components: via a Service

Friday 6 August 2021

Event Grid and Event Hubs and Service Bus

Event Hub--Big Data Handling--Event Distribution (Discrete)--Telemetry Data


Eg: Application Insights, Logs


Event Grid---Reactive Programming--Event Streaming (Series)---Status Changes Reaction


Eg: Approval, Rejection


Service Bus--Enterprise Messaging---Messaging---Order Processing & Financial Transactions 


Differences between Event Grid and Event Hubs

The noticeable difference between them is that Event Hubs are accepting only endpoints for the ingestion of data and they don’t provide a mechanism for sending data back to publishers. On the other hand, Event Grid sends HTTP requests to notify events that happen in publishers.

Event Grid can trigger an Azure Function. In the case of Event Hubs, the Azure Function needs to pull and process an event.


Azure Service Bus


In simple terms we can compare this model with a IBM MQ i.e. a Queueing mechanism. Asynchronous flow of data which is based on FirstIn-FirstOut model. You sent a message to a queue and want this message to be processed within a specific amount of time. What if the messages is not processed either move it to dead letter queue or  perform some action to it. There is a temporary control and consistency over the data that is being processed.


EXAMPLE – Super market where the cashiers bills your item one by one


Azure Event Grid


If you have been working with Microsoft BizTalk Server, this concept is quite easy to relate to. Azure Event Grid is a Publisher/Subscriber model, where there is a publisher who sends a message and multiple party at the receiver ends receives these messages. This model is loosely coupled.


EXAMPLE – Supermarket buys similar product from multiple vendors. The place an order which is subscribed by multiple vendors. Each vendor receives a copy of the order.


Azure Event Hub

This is a messaging at scale mechanism where you process large volume of telemetry data. This cloud offering is a one-way event processing system that can take millions of events per second and can be used for analysis and storage. As compared with Queues message will not be removed from the Hub and can be read multiple times.


EXAMPLE : Super Market – All the details related to the purchase, sent to the event hub which can be used to analyse the stock in the inventory and alert the Inventory department whenever the product goes out of stock.

Friday 28 May 2021

Basic vs. Bearer authentication

 


The Basic and Digest authentication schemes are dedicated to the authentication using a username and a secret .


The Bearer authentication scheme is dedicated to the authentication using a token and is described by the RFC6750. Even if this scheme comes from an OAuth2 specification, you can still use it in any other context where tokens are exchange between a client and a server.


Concerning the JWT authentication and as it is a token, the best choice is the Bearer authentication scheme. Nevertheless, nothing prevent you from using a custom scheme that could fit on your requirements.


JSON Web Token (JWT) is a compact URL-safe means of representing claims to be transferred between two parties. The claims in a JWT are encoded.

Cascade DELETE in SQL Server

 


What is a foreign key with Cascade DELETE in SQL Server?

A foreign key with cascade delete means that if a record in the parent table is deleted, then the corresponding records in the child table will automatically be deleted. This is called a cascade delete in SQL Server

Tuesday 25 May 2021

startup in azure


In .NET's dependency injection there are three major lifetimes:


1) Singleton which creates a single instance throughout the application. It creates the instance for the first time and reuses the same object in the all calls.


2) Scoped lifetime services are created once per request within the scope. It is equivalent to a singleton in the current scope. For example, in MVC it creates one instance for each HTTP request, but it uses the same instance in the other calls within the same web request.


3) Transient lifetime services are created each time they are requested. This lifetime works best for lightweight, stateless services.


 1)Transient objects are always different; a new instance is provided to every controller and every service.


2)Scoped objects are the same within a request, but different across different requests.


3)Singleton objects are the same for every object and every request.

Sunday 16 May 2021

App Service Azure

App Service Plans => Multiple Web Apps Asp.net application can be deployed to one web app

Kubernetes Vs. Docker

1)Kubernetes is developed by Google whereas Docker Swarm is developed by Docker Inc. 2)Kubernetes provides Auto-scaling whereas Docker Swarm doesn’t support autoscaling. 3)Kubernetes supports up to 5000 nodes whereas Docker Swarm supports more than 2000 nodes. 4)Kubernetes is less extensive and customizable whereas Docker Swarm is more comprehensive and highly customizable. 5)Kubernetes provides low fault tolerance while Docker provides high fault tolerance. features of Kubernetes: 1)Offers automated scheduling 2)Self-Healing capabilities 3)Automated rollouts & rollback 4)Horizontal Scaling & Load Balancing 5)Provides a higher density of resource utilization 6)Offers enterprise-ready features 7)Application-centric management 8)Auto-scalable infrastructure 9)You can create predictable infrastructure 10)Provides declarative configuration 11)Deploy and update software at scale 12)Offers environment consistency for development, testing, and production. features of Docker: Isolated environments for managing your applications 1.Easy Modeling 2.Version control 3.Placement/Affinity 4.Application Agility 5.Developer Productivity 6.Operational Efficiencies

Wednesday 12 May 2021

Azure CLI

What is the Azure CLI? The Azure CLI is Microsoft's cross-platform command-line tool for managing Azure resources. It's available for macOS, Linux, and Windows, or in the browser using Azure Cloud Shell. The Azure CLI can help you manage Azure resources such as virtual machines and disks from the command line or in scripts. Let's get started and see what it can do with Azure Virtual Machines.

Azure Cache for Redis

Azure Cache for Redis: Develop, operate, and scale Redis Enterprise across Microsoft Azure. Now available for public preview. Learn what others are saying and see the benefits. Primary Database. Geo Distributed. Faster Time to Value. Best Database Experience. Large Datasets. Ease of Use.

Function Vs Logic apps in Azure

Logic apps are similar to functions. Both enable you to trigger logic based on an event. Where functions execute code, logic apps execute workflows that are designed to automate business scenarios and are built from predefined logic blocks. Logic app creates automated work flows.

Tuesday 4 May 2021

TRIGGER in sqlserver

CREATE TRIGGER triggerName ON table AFTER INSERT |After Delete |After Upadte AS BEGIN INSERT INTO dbo.User END ========================================= DML Instead of Trigger: An Instead of trigger is fired instead of the triggering action such as an insert, update, or delete After Trigger: An After trigger executes following the triggering action, such as an insert, update or delete ========================================= DDL Trigger This type of trigger is fired against DDL statements like Drop Table, Create Table or Alter Table. DDL Triggers are always After Triggers.

Table variable Vs Temporary tables

Table variable can be passed as a parameter to functions and stored procedures while the same cannot be done with Temporary tables.Temporary tables are visible in the created routine and also in the child routines. Whereas, Table variables are only visible in the created routine. Temporary Tables are physically created in the tempdb database. These tables act as the normal table and also can have constraints, index like normal tables. Table Variable acts like a variable and exists for a particular batch of query execution. It gets dropped once it comes out of batch. It is created in the memory database but may be pushed out to tempdb. Use Table variable, if you have less than 1000 rows otherwise go for Temporary tables. 1.Table variable (@table) is created in the memory. Whereas, a Temporary table (#temp) is created in the tempdb database. However, if there is a memory pressure the pages belonging to a table variable may be pushed to tempdb. 2. Table variables cannot be involved in transactions, logging or locking. This makes @table faster then #temp. So table variable is faster then temporary table. 3. Temporary tables are allowed CREATE INDEXes whereas, Table variables aren’t allowed CREATE INDEX instead they can have index by using Primary Key or Unique Constraint. 4. Table variable can be passed as a parameter to functions and stored procedures while the same cannot be done with Temporary tables. 5. Temporary tables are visible in the created routine and also in the child routines. Whereas, Table variables are only visible in the created routine. 6. Temporary table allows Schema modifications unlike Table variables. There are two types of temporary tables: local and global. Local temporary tables are visible only to their creators during the same connection to an instance of SQL Server as when the tables were first created or referenced. Local temporary tables are deleted after the user disconnects from the instance of SQL Server. Global temporary tables are visible to any user and any connection after they are created, and are deleted when all users that are referencing the table disconnect from the instance of SQL Server. Local Temporary Table Scope If a local temporary table created in a stored procedure, it is dropped automatically when the stored procedure is finished. This means that this local temporary table can be referenced only by nested stored procedures. The local temporary table cannot be referenced by the stored procedure or application that called the stored procedure that created the local temporary table. Global Temporary Tables A global temporary table is created using CREATE TABLE statement with the table name prefixed with a double number sign (##table_name). In SQL Server, global temporary tables are visible to all sessions (connections). So if you create a global temporary table in one session, you can start using it in other sessions.