tag:blogger.com,1999:blog-74405031964632468102024-03-06T10:12:08.206+05:30AmalayAmalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-7440503196463246810.post-18047230714713481792021-10-15T21:31:00.005+05:302021-12-17T16:08:01.081+05:30SOLID Principle<p>
SOLID is a design principle used in software industry. The objective of this
principle is to make software Scalable, Maintainable, Loosely coupled,
Encapsulated etc. The major flaws in design to fail the software are as below:
</p>
<ul style="text-align: left;">
<li>Assigning more and more responsibility to a single class.</li>
<li>Depending one class on another class.</li>
<li>Spreading/Introducing duplicate code in the system.</li>
</ul>
<p>SOLID principle provide great help to overcome these design flaws.</p>
<h2>SOLID Principle Details</h2>
<ul style="text-align: left;">
<li>S: Single Responsibility Principle (SRP)</li>
<li>O: Open Closed Principle (OCP)</li>
<li>L: Liskov Substitution Principle (LSP)</li>
<li>I: Interface Segregation Principle (ISP)</li>
<li>D: Dependency Inversion Principle (DIP)</li>
</ul>
<h2>S: Single Responsibility Principle (SRP)</h2>
<p>
A Class or Module or Function should have only one job to do. In another
words, our Class or Module or Function should have only one reason to change.
It should not be like Swiss knife wherein if one of them need to change then
entire tool need to be altered. It does not mean that Class should only
contain one method or property. There may be many members as long as they
relate to single responsibility.
<br />
<b>Example</b><br />
User registration and Sending email are two distinct functionalities and there
is no relation between them so there should be two separate classes for both
the functionality.
</p>
<p>
<img
src="https://user-images.githubusercontent.com/84455469/137142137-7a2e2a4e-ec18-4b55-b283-02995f984a34.png"
/>
</p>
<p>
In example 1 we can see that UserRegistration class is not following Single
Responsibility Principle (SRP) because SendEmail and EmailValidation methods
are totally different functionality so these method should not belong to
UserRegistration class. Hence it is separated in example 2 to follow Single
Responsibility Principle (SRP).
</p>
<h2>O: Open Closed Principle (OCP)</h2>
<p>
A Class or Module should be open for extension but closed for modification.<br/>
"<b>Open for extension</b>" means, we need to design our module/class in such a way
that the new functionality can be added only when new requirements are
generated. We can use inheritance for extension.<br/>
"<b>Closed for modification</b>"
means we have already developed a class and it has gone through unit testing.
We should then not alter it until we find bugs.
<br />
<b>Example</b>
</p>
<p>
<img
src="https://user-images.githubusercontent.com/84455469/137136281-c9998e16-aaae-493f-bc96-8e94cd2afecb.png"
/>
</p>
<p>
In example 1, Calculator class is used to calculate the area of rectangle and
it is perfect. <br/><br/>
But lets say tomorrow if we want to extend the Calculator class
by adding one more method to calculate area of circle then what will happen?
Definitely example 2 is one of the solution and it will work well. But we can
see that for every new method we have to modify the Calculator class with
multiple if-else statements. That means it is not following Open Closed
Principle (OCP). <br/><br/>
Now see the example 3, we can add n-number of functionalities
without modifying the Calculator class. We only need to do is, declare one
class for each new functionality. Hence it is open for extension but closed
for modification and that's what the Open Closed Principle (OCP) is.
</p>
<h2>L: Liskov Substitution Principle (LSP)</h2>
<p>
The Liskov Substitution Principle (LSP) is just an extension of the Open
Closed Principle and ensure that a new class can be derived from a base class
without changing their behavior. In another words, a derived class must be
substitutable for its base class.<br />
<b>Example</b>
</p>
<p>
<img
src="https://user-images.githubusercontent.com/84455469/137278862-afb355ce-f10b-4820-8ebb-9c0c84a94fe4.png"
/>
</p>
<p>
In example 1, we want to define a class with read and write operations in
file. For this we have defined one File class and one FileManager class with
required functionalities and it work well. <br/><br/>
Now tomorrow if we want to restrict write operation based on some condition. Means if file is read-only then write
operation should not be performed. To achieve this we have extended the File
class and create one ReadOnlyFile class as shown in example 2. <br/><br/>
But what is wrong here?? <br/><br/>
Firstly, In ReadOnlyFile class we are throwing exception into the
SaveData method explicitly and secondly, we are modifying the FileManager
class by adding some explicit condition into SaveDataIntoFile method. That
means derived class is not a substitutable of it base class. <br/><br/>
Now come to
example 3, to implement Liskov Substitution Principle (LSP), we have
restructured the program and spilt the File class into multiple classes based
on the functionalities using interfaces. Here we can see that any of the
derived class can easily substitute its base class.
</p>
<h2>I: Interface Segregation Principle (ISP)</h2>
<p>
Interface Segregation Principle (ISP) states that clients should not be forced
to implement methods of the interfaces which they don't use. Instead of one
fat interface should be splitted into many small interfaces with related
methods so that client can easily consume the interfaces without implementing
unnecessary methods.<br />
<b>Example</b>
</p>
<p>
<img
src="https://user-images.githubusercontent.com/84455469/137495730-cf3bae7a-4d72-40ab-b011-0dab8bd9c67f.png"
/>
</p>
<p>
In example 1, we can see that ITask interface have three methods "CreateTask",
"AssignTask" and "Development". All three methods are relevant for TeamLead
class and has been implement by "TeamLead" class. But Development method of
the ITask interface is not relevant for "Manager" class because generally
manager don't do the development. But here we are forcing the "Manager" class
to implement "Development" method also unnecessarily. To mitigate this issue
Interface Segregation Principle (ISP) is need to be followed.<br/><br/>
Now in example
2, we have splitted fatty interface ITask into two small interfaces called
ITask and IDevelopment with relavent methods. Now "Manager" class need to
implement only ITask interface and "TeamLead" class can implement both ITask
and IDevelopment interfaces. And thats what Interface Segregation Principle
(ISP) is.
</p>
<h2>D: Depedency Inversion Principle (DIP)</h2>
<p>
Dependency Inversion Principle (DIP) states that high-level modules/classes
should not depend on low-level modules/classes. Both high-level and low-level
module/classes should depend upon abstractions. And abstractions should not
depend upon details rather Details should depend upon abstractions. <br/><br/>
High-level
modules/classes implement business rules or logic in a system (application).
Low-level modules/classes deal with more detailed operations; in other words
they may deal with writing information to databases or passing messages to the
operating system or services. So we must keep these high-level and low-level
modules/classes loosely coupled as much as we can. To do that, we need to make
both of them dependent on abstractions instead of knowing each other.
<b>Example</b>
</p>
<p>
<img
src="https://user-images.githubusercontent.com/84455469/137316213-65b84cf7-4833-4091-a017-0ed3c20652e3.png"
/>
</p>
<p>
In example 1, we can see that ExceptionLogger class is used to log the
exception into file using "FileLogger" class and it is working perfectly. <br/><br/>Now
tomorrow, we want to categorise our exception logging mechanism to log SQL
exception into database while keeping the existing file logging as it. To
achieve this, we have defined one more class as "DbLogger" and consuming that
class inside ExceptionLogger class. Which is also good but you can see that
for each new type of exception, we have to modify ExceptionLogger and that
will impact whole system along with existing clients. <br/><br/>
Now to mitigate this
issue, we have to de-couple the structure in such a way that ExceptionLogger
is not needed to modify at all. <br/><br/>
In example 3, we have de-coupled the design
using ILogger interface. Now you can see that both high-level and low-level
classes are depending on abstraction (i.e. ILogger) instead of knowing each
other. And thats what Depedency Inversion Principle (DIP) is. <br/><br/>
Even in future,
if want to extend it further by adding one more type of exception (lets say
EventLogger) then also there is no need to modify the "ExceptionLogger" logger
class at all as shown in example 4. And we can keep extending without
impacting the existing system.
</p>
<p>
For details understanding and sample please follow my
<a
href="https://github.com/amalay/dotnetcore/tree/main/SolidPrinciple"
target="_blank"
>
Github</a
>
link.
</p>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-77378217067942404802021-10-15T20:21:00.009+05:302021-10-15T21:36:12.122+05:30Design Patterns<p>
Design patterns are basically the best practices used by expert in software
development to achieve high scalability, high maintainability, high
solutionability, high flexibility and so on.
</p>
<p>
Design Patterns can be classified into three categories Creational, Structural
and Behavioral patterns.
</p>
<h2>Creational Design Patterns</h2>
<p>
It provide a way to create an object while hiding the creation logic instead
of instantiating objects directly using new key word. It provide more
flexibility to the program to decide which objects need to be created for a
given use case.
<br />
<b>Example</b>
</p>
<p>
Factory Pattern, Factory Method Pattern, Abstract Factory Pattern, Singleton
Pattern, Builder Pattern, Prototype patterns are the example of creational
design pattern.
</p>
<h2>Structural Design Patterns</h2>
<p>
Assembling classes and objects into larger structure while keeping the
structures flexible and efficient. Inheritance is an example of this pattern.
<br />
<b>Example</b>
</p>
<p>
Adapter Pattern, Bridge Pattern, Composite Pattern, Decorator Pattern, Facade
Pattern, Proxy Pattern are the example of structural design pattern.
</p>
<h2>Behavioral Design Patterns</h2>
<p>
This design pattern focus on communication between objects.
<br />
<b>Example</b>
</p>
<p>
Chain of Responsibility Pattern, Observer Pattern, Iterator Pattern and so on
are the example of behavioral design patter.
</p>
<p> </p>
<h2>Factory Pattern</h2>
<p>
Creates objects without exposing the instantiation logic to the client.<br />
<img
alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirr9enWI099hjQ93eZ0lMtvNJYTy2UvJGRQfpA8mJUmxm4Yw9sKh-1X-niLzNB0nFhvRP0K7wLIw6IgrFH8Jx2O55aCD-SHjYBG_Ca7FGi_g3S71AxA2XldLVaoAo8w1X8vt92SMYBxSc/"
/>
</p>
<h2>Factory Method Pattern</h2>
<p>
Define an interface for creating an object, but let subclasses decide which
class to instantiate.<br />
<img
alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigD3hkBK1pckz-CzP54trejSEBZ1sE8Hgjst9i2V2KkJEYmtaV__MyGJWur9R5WYPI68te_blov8_MP6SICmZhSfG46-DKevwBroB6f9qgPYKPk1i1Safe1B8o8XMG8TqheODffbbFUpw/"
/>
</p>
<h2>Abstract Factory Pattern</h2>
<p>
Provide an interface for creating families of related or dependent objects
without specifying their concrete classes.<br />
<img
alt=""
src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHMoT62vA4APwkRogwnz08KDVLvFX4d3d9Jf-PuEOUbKSpYrduiupcGAbSVe3w_-VzK90drVd_IleRHpg0QOaTe0ORg_N2mgB0XcZVp5Xyu21fdsMj-9DksrFOhEkLYYBFoSm-uYt3IqM/"
/>
</p>
<h2>Singleton Pattern</h2>
<p>
Singleton pattern comes under creational pattern. This pattern ensure that one
and only object will be created of a class through out the application. In
this pattern a class must have:
</p>
<ul style="text-align: left;">
<li>private constructor without any parameter.</li>
<li>private static instance of itself.</li>
<li>
public static property or method to return this instance outside the class.
</li>
<li>class must be sealed so that can't be inherited.</li>
</ul>
<p>
<b>Example 1 (Not Thread Safe and should be avoid)</b><br />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK0wXd89fWXiC3Xh2hGnbV91Kkvo2TwJD-SH8C8umno5zNdPbRYDOyiy_NwhV7avcJY9_ilhQOnanlmSQdJRm-tYrk8bnsN4ilGgX1QiB3cgwyGRHj49YFLArwQE_AZWZawHYzUkiR3vs/" /><br />
</p>
<p>
<b>Example 2 (Thread Safe with lock but performance will degrade due to lock)</b><br />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKsTaLU8hk0gGqaD8Sv9q7wrfS5JfcNoivgAv7jRaF6M9T29s2Bxen4-eWGtr21zjOS2AVHFri-zaT4eCj_z344cOtfXCGtPtXyb6MdBXosVmG9lOAO5v-7_mu7mMC93RpExFwGw8b1MQ/" /><br />
</p>
<p>
<b>Example 3 (Thread Safe without lock but not quite lazy)</b><br />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdkYs8I3Lx0bAHW8z9gBwVZXcfTfu3oXYizcXvqAMsmf3-s3D9vFx1jE3F7l9eDj938KUbuw3msSPZL826j9c6tTQ06nJB8Gh2vLFHPzOZDDGs-TKKki_c2H7P2gompsnEhABSb4n5Jms/" /><br />
</p>
<p>
<b>Example 4 (Thread Safe without lock and fully lazy)</b><br />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMJK_gE0Py7wb9T6yiiDsDOqgExARrR2bYEymf-ne302dfhhDo5t-2qz_dDGvgwI3hzOFDpZhSGiwCRmWavP4JnIs3Pm14pe_5Qkm849xIw_ykt5Bxf5n4ABPK94OMbCOT17UIyTHzvyQ/" /><br />
</p>
<p>
<b>Example 5 (using .NET 4's Lazy type)</b><br />
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqc7-YUAd4VH9lfClDI3V7kd9Bk6gAuIzod4RnkgqZvHEGT73DdVnqtx7NYyOUGeS_uFlkJg-SX623OMdjyeH_KoCjc94VjsKcze7afs2RFuK_aMtkMOf6Efi4lY2S7hqjW2z_5wxeLaQ/" /><br />
</p>
<p>
For details understanding and sample please follow my
<a
href="https://github.com/amalay/dotnetcore/tree/main/DesignPatterns"
target="_blank"
>
Github</a
>
link.
</p>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-73010340119194691592021-09-17T14:20:00.008+05:302021-09-17T18:20:24.150+05:30Frequent Terms used in Cloud world<p style="text-align: justify;">
In cloud world, number of terms or terminology used. We listen and use those terms on our daily life and also implement it in the project. But sometimes if someone suddenly ask about those words, we get confused and feel guilty because of unable to answer properly. That is the reason I am summerising some of the important terms together on this page so that we can memorize it quickly.
</p>
<p style="text-align: justify;">
Before going to the cloud world, lets first understand the <b>Environment</b>.
</p>
<h2>Environment:</h2>
<p style="text-align: justify;">
Combination of Infrastructure/Hardwares, Softwares and Networking is
collectively called as environment. Environment can be setup in two way
On-Premises environment and Cloud environment.
</p>
<h3>1. On-Premises Environment:</h3>
<p style="text-align: justify;">
When all the required resources (Hardwares, Softwares, Tools, Applications
etc.) are deployed in-house and within an enterprise’s IT infrastructure then
it is called on-premises environment.
</p>
<p style="text-align: justify;">
An enterprise is responsible for maintaining the solution and all its related
processes like Infrastructure Setup, Software, Licenses, Hosting, Backup,
Recovery, Security etc. On-Premises environment is fully controlled by
enterprise and enterprise can do each on everything on it.
</p>
<p style="text-align: justify;">
On-Premises environment is good in terms of security & compliance,
regulatory control(e.g. GDPR, HIPAA, FERPA etc.) for sensitive data (e.g.
Government, Banking & Financial etc.).
</p>
<h3>2. Cloud Environment:</h3>
<p style="text-align: justify;">
Cloud is nothing but a kind of on-premises environment only but the difference
is, it is exist in Cloud Service provider's premises. And an enterprise are
able to access those resources and use as much as they want at any given time.
Cloud environment is not in fully controlled by an enterprise.
</p>
<p style="text-align: justify;">
Although Cloud service provider promise to provide good level for security but
despite of their promise, enterprise don't prefer to go to cloud because
security is the first priority for them sometime.
</p>
<h2>Frequent Terms used in Cloud world</h2>
<h3>Cloud Computing:</h3>
<p style="text-align: justify;">
On-demand availability of the required computing resources like Hardwares,
Softwares (e.g. Operating Systems, Frameworks, Tools), Servers, Networking,
Storage, Databases, Applications, Analytics, Intelligence etc.) over the
internet within no time is called Cloud Computing.
</p>
<p style="text-align: justify;">
In Cloud Computing, we only pay for the cloud services which we use. Also we
can reduce the operating cost by running the infrastructure more efficiently
(e.g. scale-up/scale-down the resources based on business need).
</p>
<h3>Cloud Service Providers:</h3>
<p style="text-align: justify;">
The companies which provide all those cloud computing services are called
cloud service providers. There are various cloud service provider available in
the market like Microsoft Cloud (Azure), Amazon Web Services (AWS),
Google Cloud Platform (GCP), Oracle Cloud World Infrastructure (OCI), IBM
Cloud etc. You can choose any of the cloud service provider based on there
offer price, availability in your region and your business requirement.
</p>
<h3>Cloud Type:</h3>
<p style="text-align: justify;">
There are various type of clouds and your can choose/setup based on your
business need.
</p>
<h3>Public Cloud:</h3>
<p style="text-align: justify;">
In public cloud, all the services are offered over public internet and
available to anyone who want to buy it.
</p>
<h3>Private Cloud:</h3>
<p style="text-align: justify;">
In private cloud, all the services are offered over the Internet or over a
private internal network to only selected users or group of users. General
public users can access it.
</p>
<h3>Hybrid Cloud:</h3>
<p style="text-align: justify;">
Combination of both public and private cloud model is called Hybrid cloud. In
hybrid cloud model, public and private clouds are bounded together by
technology in such a way that data and applications can be shared between
them. A hybrid cloud gives businesses greater flexibility to
scale-up/scale-down the resources and offers more deployment options.
</p>
<h3>Multi Cloud:</h3>
<p style="text-align: justify;">
Sometimes some enterprises take some cloud services from one cloud service
provider and some cloud services from other cloud service provider depending
on the availability in their region. So this kind of model is called as Multi
cloud.
</p>
<h3>Cloud Bursting:</h3>
<p style="text-align: justify;">
Cloud bursting is a configuration that’s set up between a private and a public
cloud in such a way that if private cloud's resources are utilized by 100
percent of their capacity, then overflow traffic will be directed to the
public cloud.
</p>
<h3>Virtualization:</h3>
<p style="text-align: justify;">
Virtualization is the process of creating a computing environment (e.g.
including hardware, operating system, storage devices, networking equipments
etc.) virtually rather than a creating it physically.
</p>
<h3>Infrastructure as a service (IaaS):</h3>
<p style="text-align: justify;">
Providing Infrastructure (e.g. including hardwares, servers, networking
equipments and software) as a service over the internet in a virtualized form
is called as IaaS. Sometimes it is also called as Hardware as a Service
(HaaS).
</p>
<h3>Platform as a service(PaaS):</h3>
<p style="text-align: justify;">
Providing a computing platform (e.g. Operating system, Frameworks, Analytics
or Business intelligence and other services which you can subscribe and use
immediately to develop your application) as a service over the Internet is
called as PaaS. Using PaaS you can cut your coding time, increase development
capabilities without adding more staff, efficiently manage your application
life cycle and son. Azure offers PaaS feature.
</p>
<h3>Software as a service (SaaS):</h3>
<p style="text-align: justify;">
Providing an application (e.g. Office 365, Gmail, Web App, API App,
Microservices etc.) over the Internet is called as SaaS. In this case user
don't need to purchase, install and run the application at their machine.
</p>
<p style="text-align: justify;">
SaaS application is also know an hosted application. Earlier SaaS was referred
as Application Server Providers (ASPs).
</p>
<h3>Infrastructure as code (IaC):</h3>
<p style="text-align: justify;">
Infrastructure as a code means create your required infrastructure through the
code written using PowerShell or Azure CLI or Terraform. This code can be
stored and versioned in version control systems, where people can review and
re-utilize. The purpose of infrastructure as code is to enable developers or
operations teams to automatically manage, monitor and provision resources,
rather than manually configure discrete hardware devices and operating
systems. It very helpful to reduce the risk of human error especially for
complex and large environments.
</p>
<h3>Serverless Computing:</h3>
<p style="text-align: justify;">
It is quite confusing word and it doesn't mean that server is not needed at
all to run the application. Of course servers are needed. The purpose of this
naming convention is to remove the burden of provisioning, scaling and
managing the infrastructure from developer so that he can much focus on
writing business logic and less focus on managing infrastructure. Serverless
computing help team to increase their productivity and launch product in the
market quickly. It also allows organizations to better optimize resources and
stay focused on innovation.
</p>
<h3>Elastic Computing:</h3>
<p style="text-align: justify;">
Elastic computing is the ability to quickly scale/de-scale the computer
processing, memory, storage and other resources dynamically based on demand
without worrying about capacity planning and engineering for peak usage.
</p>
<p style="text-align: justify;">
It is typically controlled by system monitoring tools which has the ability to
match the amount of resources allocated with the amount of resources actually
needed without disrupting operations.
</p>
<p style="text-align: justify;">
Using elastic computing, a company avoids paying for unused capacity or idle
resources and doesn’t have to worry about investing in the purchase or
maintenance of additional resources and equipment.
</p>
<p style="text-align: justify;">
Elastic computing is totally automated process and doesn’t need human
administration around the clock. It also offers continuous availability of
services by avoiding unnecessary slowdowns or service interruptions.
</p>
<h3>Artificial Intelligence (AI):</h3>
<p style="text-align: justify;">
Artificial intelligence is the capability of a computer system to imitate
(copy) the human intelligence. A computer system uses Maths and Logic to
simulates the reasoning that humans use to learn from new information and make
decisions. There are various AI services/models designed and available for
developers and data scientists. Using those AI services/models, you can build
and deploy your own AI solutions.
</p>
<h3>Business Intelligence (BI):</h3>
<p style="text-align: justify;">
BI is the procedural and technical infrastructure that used to collect, store
and analyzes the data produced by sources. BI parses this data and produce
easy-to-digest reports, information and trends that help people to make better
decisions.
</p>
<p style="text-align: justify;">
There are various tools available in the market which help a lot in BI
process. e.g. Spreadsheet, Power BI reporting tool, Data mining tools, Online
analytical processing (OLAP) etc.
</p>
<h3>Machine Learning (ML):</h3>
<p style="text-align: justify;">
The process of using mathematical models to predict outcomes versus relying on
a set of instructions. This is made possible by identifying patterns within
data, building an analytical model, and using it to make predictions and
decisions. Machine learning bears similarity to how humans learn, in that
increased experience can increase accuracy.
</p>
<h3>Machine Learning Algorithms (MLA):</h3>
<p style="text-align: justify;">
Machine learning algorithms are pieces of code that help people explore,
analyze, and find meaning in complex data sets. Each algorithm is a finite set
of unambiguous step-by-step instructions that a machine can follow to achieve
a certain goal. In a machine learning model, the goal is to establish or
discover patterns that people can use to make predictions or identifying
anomalies or categorize information.
</p>
<p style="text-align: justify;">
Machine learning algorithms use parameters that are based on training data.
Training data is a subset of data that represents the larger set. As the
training data expands to represent the world more realistically, the algorithm
calculates more accurate results.
</p>
<p style="text-align: justify;">
Machine learning algorithms are commonly divided into those used for
supervised learning and those used for unsupervised learning.
</p>
<p style="text-align: justify;">
The most commonly used algorithms use regression and classification to predict
target categories, find unusual data points, predict values, and discover
similarities.
</p>
<h3>Database Sharding:</h3>
<p style="text-align: justify;">
Database sharding is a type of horizontal partitioning that splits large
databases into smaller databases, which are faster and easier to manage. A
shard is an individual partition that exists on separate database server
instance to spread load.
</p>
<p style="text-align: justify;">
As both the database size and number of transactions keep increasing based on
the traffic on your application which cause delay in response time during
query execution at database. To solve this problem data shard is needed.
</p>
<h3>Cloud Storage:</h3>
<p style="text-align: justify;">
Cloud storage is a service that lets you store data by transferring it over
the Internet or another network to an offsite storage system maintained by a
third party. Cloud storage is cost-effective, scalable and accessible from any
location compare to on-premise storage. There are three type of cloud storage
like Private Cloud Storage, Public Cloud Storage and Hybrid Cloud Storage.
</p>
<h3>Computer Grids:</h3>
<p style="text-align: justify;">
Computer grid is a group of networked computers that work together as a
virtual supercomputer to perform large tasks such as analyzing huge sets of
data or weather modeling.
</p>
<p style="text-align: justify;">
Through cloud computing, you can assemble and use vast computer grids for
specific time periods and purposes, paying only for your usage and saving the
time and expense of purchasing and deploying the necessary resources yourself.
</p>
<p style="text-align: justify;">
Unlike with parallel computing, grid computing projects typically have no time
dependency associated with them. They use computers that are part of the grid
only when idle, and operators can perform tasks unrelated to the grid at any
time.
</p>
<h3>DevOps:</h3>
<p style="text-align: justify;">
DevOps is the union of people, process and technology to enable continuous
delivery of value to customers. The practice of DevOps brings development
team, operations team, quality engineering team and security team together to
coordinate and collaborate to produce better and more reliable products
quickly.
</p>
<p style="text-align: justify;">
By adopting a DevOps culture along with DevOps practices and tools, teams gain
the ability to better respond to customer needs, increase confidence in the
applications they build, and achieve business goals faster.
</p>
<p style="text-align: justify;">
DevOps culture enable strong collaboration between teams, clear visibility
towards the goals and align everyone to achieve the goals.
</p>
<p style="text-align: justify;">
DevOps culture also enable the scope of responsibility and accountability. For
example developers become responsible and accountable not only for development
phase but also for operation phase.
</p>
<p style="text-align: justify;">
DevOps culture does not impact the agile process. Teams be remain agile by
releasing the software in short cycles. Shorter release cycles make planning
and risk management easier since progress is incremental.
</p>
<p style="text-align: justify;">
DevOps culture establish a growth mindset in the individuals. We may fail fast
and incorporate the learnings to improve the processes continuously to
increase the customer satisfaction. DevOps is a journey, so there is always
room to grow.
</p>
<p style="text-align: justify;">
To opt DevOps culture, definitely you have to follow the DevOps practices
through the application life cycle. Important DevOps practices are:
</p>
<h4>1. Continuous integration and continuous delivery (CI/CD):</h4>
<p style="text-align: justify;">
Continuous Integration is the process of merge changes back to the main branch
as often as possible. The integration may occur several times a day, verified
by automated test cases and a build sequence. It help to identify the bugs
early and reduce the bug count on test/production environments.
</p>
<p style="text-align: justify;">
Continuous delivery is the process of deploying all the changes (including
code changes, configuration changes etc.) to test/production environment.
Continuous Delivery help deployment easier and faster.
</p>
<h4>2. Configuration management:</h4>
<p style="text-align: justify;">
Configuration management is the process of managing the state of resources in
a system including servers, virtual machines, and databases. Using
configuration management tools, teams can roll out changes in a controlled,
systematic way, reducing the risks of modifying system configuration. Teams
use configuration management tools to track system state and help avoid
configuration drift, which is how a system resource’s configuration deviates
over time from the desired state defined for it.
</p>
<h4>3. Continuous monitoring:</h4>
<p style="text-align: justify;">
Continuous monitoring is the process of having real-time visibility into the
performance and health of the entire application stack, from the underlying
infrastructure running the application to higher-level software components.
This visibility consists of the collection of telemetry and metadata as well
as the setting of alerts for predefined conditions which warrant attention
from an operator. Telemetry comprises event data and logs collected from
various parts of the system, which are stored where they can be analyzed and
queried.
</p>
<p style="text-align: justify;">
High-performing DevOps teams ensure they set actionable, meaningful alerts and
collect rich telemetry so they can draw insights from vast amounts of data.
These insights help the team mitigate issues in real time and see how to
improve the application in future development cycles.
</p>
<h4>4. Version Control:</h4>
<p style="text-align: justify;">
Version control is the practice of managing code in version control system. It
track the revisions and change history to make code easy to review and
recover. It also allow multiple developers to collaborate in authoring code
and merge code changes that happen in the same files, handle conflicts, and
roll back changes to earlier states.
</p>
<h4>5. Agile software development:</h4>
<p style="text-align: justify;">
Agile is a software development approach that emphasizes team collaboration,
customer and user feedback, and high adaptability to change through short
release cycles. Teams that practice Agile provide continual changes and
improvements to customers, collect their feedback, then learn and adjust based
on customer needs. Agile is substantially different from other more
traditional frameworks such as waterfall, which includes long release
cycles defined by sequential phases. Kanban and Scrum are two popular
frameworks associated with Agile.
</p>
<h4>5. Infrastructure as code:</h4>
<p style="text-align: justify;">
Infrastructure as a code means create your required infrastructure through the
code written using PowerShell or Azure CLI or Terraform. This code can be
stored and versioned in version control systems, where people can review and
re-utilize. The purpose of infrastructure as code is to enable developers or
operations teams to automatically manage, monitor and provision resources,
rather than manually configure discrete hardware devices and operating
systems. It very helpful to reduce the risk of human error especially for
complex and large environments.
</p>
<h2>Difference between On-Premises and Private Cloud</h2>
<p style="text-align: justify;"></p>
<h4>On-premise environment</h4>
<p style="text-align: justify;"></p><ul><li>
In on-premise environment, all the required infrastructures are setup within
the premises of the company and in fully control of the company.
</li><li>
It is costly because you have to setup and manage each and everything on your
own.
</li><li>
It is not easy to scale as n when basis.
</li><li>
Internet connectivity is not needed all the time because it not exposed to
internet.
</li><li>
Updating the softwares and disaster recovery is difficult.
</li></ul><p></p>
<h4>Private cloud</h4>
<p style="text-align: justify;"></p><ul><li>
In private cloud all the required infrastructures are set up outside of the
company premises and managed by third party cloud service providers.
</li><li>
Private cloud is a kind of isolated/single-tenant environment and can be used
by the same tenant only for which it is provisioned.
</li><li>
It is cost effective than on-premise environment because everything is setup
and managed by cloud service provider and you have to pay only for usage.
</li><li>
It is easy to scale as n when basis.
</li><li>
Internet connectivity is needed all the time because it is exposed to
internet.
</li><li>
Easy to update the softwares and recover from any disaster.
</li></ul><p></p>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-17815662906841502942021-09-14T18:20:00.002+05:302021-09-17T18:17:05.249+05:30Infrastructure Automation OR Infrastructure as Code (IaC)<p>
Infrastructure as a code means create your required infrastructure through the
code written using PowerShell or Azure CLI or Terraform.
</p>
<p>
The purpose of infrastructure as code is to enable developers or operations
teams to automatically manage, monitor and provision resources, rather than
manually configure discrete hardware devices and operating systems.
</p>
<p>
Here I am not going to much focus on what is Infrastructure as a code rather I
will prefer to focus more on
</p>
<p>1. How to learn it?,</p>
<p>2. How to write the code for it?,</p>
<p>3. How to execute the code? and</p>
<p>4. How to automate whole process?</p>
<p>
There are various way to write code to create infrastructure but I will mainly
focus on using Terraform script to create infrastructure. You can see the whole steps at this <a href="https://github.com/amalay/terraform-azure/tree/main/learning/day-01" target="_blank">Github</a> link
</p>
<p>
For the simplicity, I have created two folders in this repository one is learning
and another is practical. I will suggest to first refer the learning part and
then come to practical part.
</p>
<p>
For details, please visit refer my <a href="https://github.com/amalay/terraform-azure/tree/main/learning/day-01" target="_blank">Github</a> repository
</p>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-91347795157205704782021-09-14T11:34:00.007+05:302021-09-17T18:17:39.276+05:30Frequent Terms used in Container World
In the container world, number of terms or terminology used. We listen and use those terms on our daily life and also implement it in the project. But sometimes if someone suddenly ask about those words, we get confused and feel guilty because of unable to answer properly. That is the reason I am summerising some of the important terms together on this page so that we can memorize it quickly.
<p>
Some of the important terms are as below:
</p>
<p>
<b>Virtual Machine (VM), Container, Docker, Kubernete, Cluster, Nodes, Master Node, Worker Nodes, POD, Kubernete Service, Replication Controller or ReplicaSet and Auto Scaling</b>
</p>
<p>
I am trying to arrange those terms as per their uses and sequence.
</p>
<h2>Virtual Machine (VM):</h2>
<p style="text-align: justify;">
VM is a kind of a virtual server that you can connect remotely. VM contains
whole Operating Systems with all its libraries like any other physical machine
that make it heavy in GB in size.
</p>
<p style="text-align: justify;">
To run an application web/window, you need a machine either (virtual or
physical). Let say you have developed one application using React.JS and
MySql. That means to run this application, you need a machine which must have
Operating Systems (OS), React.JS environment and MySql Database or Service. To
deploy this application, you need to setup a VM with these dependencies. After
deploying this application on a VM, let say it is serving your purpose for the
moment.
</p>
<p style="text-align: justify;">
In future, if user/demand increase/decrease then definitely you need to scale
or de-scale your infrastructure. In case of scale/de-scale or update your app
with new version and so on are the very expensive, complex and time consuming
task. Its complexity increase more when more than one applications share the
common resources. And because of that, all other applications will also be
down while upgrading one application. This problem is called as Dependency
hell problem and to solve this problem, container come into the picture.
</p>
<h2>Container:</h2>
<p style="text-align: justify;">
A container is the next level of abstraction after virtual machines, in which
each component of the whole application is individually packaged into a
standalone unit. And each of these unit is called a container.
</p>
<p style="text-align: justify;">
Containers only contains the required resources not all the resources
unnecessary like VMs. That's why it is lighter than VM. In this way, we
achieve full portability (the ability to run an app on any OS or environment)
by separating code and app services from the underlying architecture.
</p>
<p style="text-align: justify;">
So for our application, Operating Systems (Windows/Linux/Mac) is one unit
(container). React.JS environment and its dependent libraries are second unit
(container). MySQL platform and the database are third unit(container).
</p>
<p style="text-align: justify;">
One important point here is, each container may depend on another container.
Example - MySQL container depends on OS container and so on. This concept is
called stacked containers. Means each container depends on their below
container. Microservices also works on the same concept.
</p>
<h2>Docker:</h2>
<p style="text-align: justify;">
Docker is the most widely used platform to create and manage applications via
containers.
</p>
<h2>Kubernete:</h2>
<p style="text-align: justify;">
Lets go back to the dependency hell problem once again, There we understand
that container is the good option to scale/de-scale the application based on
the demand. Number of users increase to access our application and to serve
those request frequently, we can increase the number of containers and then
employ the one or more load balancer. This is great and solve the purpose very
well but only up to a certain limit.
</p>
<p style="text-align: justify;">
Lets say number of users are keep increasing from hundreds to thousands to
millions then we need dozens or hundreds of load-balancers, which is another
headache in itself. To perform any update in the app will need a lot of effort
to configure each load balancer.
</p>
<p style="text-align: justify;">
So what is the solution now?? And the solution is Kubernete. With help of
Kubernete, we can roll out all the changes across all containers in one go.
Also with the help of Kubernete, we can easily spin-up, orchestrate, new
ready-to-go containers whenever we need even in the automated manner.
</p>
<h2>How Kubernete works:</h2>
<p style="text-align: justify;">
Kubernete works on the basis on "<b>Desired State</b>" principle. Which means,
whatever the desired state you define for your components. Kubernete engine
will automatically take the responsibility to fulfil your desired state.
</p>
<p style="text-align: justify;">
For Example - Let say you want your web application to run on 4 containers and
your database to run on 3 containers always. This is your desired state. If
anyone of these 7 containers fails, the Kubernetes engine will detect this and
automatically spin up a new container to ensure the desired state is
maintained.
</p>
<h2>Cluster:</h2>
<p style="text-align: justify;">
Cluster is the first setup of the Kubernete. It is a kind of physical area.
All other components are part of a cluster. One physical cluster may be
divided into multiple virtual cluster, called "<b>namespaces</b>."
</p>
<p style="text-align: justify;">
Creating the virtual cluster is very much similar to the creating a multiple
virtual machines (VMs) on the same physical server. If you will not create any
virtual cluster manually, one "<b>default namespace</b>" will be always
created automatically.
</p>
<h2>Nodes:</h2>
<p style="text-align: justify;">
Kubernetes runs on nodes, which are individual machines within the cluster.
Nodes may correspond to physical machines if you run your own hardware, but
more likely correspond to virtual machines running in the cloud.
</p>
<p style="text-align: justify;">
Nodes are where your application or service is deployed, where the work in
Kubernetes gets done. There are 2 types of nodes – the "<b>master node</b>"
and "<b>worker nodes</b>".
</p>
<h2>Master Node:</h2>
<p style="text-align: justify;">
Master Node is a special node that controls all the others. On the one hand,
it’s a node like any other in the cluster, which means it’s just another
machine or virtual instance. On the other hand, it runs the software that
controls the rest of the cluster. It sends messages to all the other nodes in
the cluster to assign work to them, and they report back via an "API Server"
on the master.
</p>
<p style="text-align: justify;">
The master node also itself contains a component called the "<b>API Server</b
>". This API is the only endpoint for communication from the nodes to the
control plane. The API Server is critically important because this is the
point through which worker nodes and the master communicate about the status
of pods, deployments, and all the other Kubernetes API objects.
</p>
<h2>Worker nodes:</h2>
<p style="text-align: justify;">
Worker nodes do the real work in Kubernetes. When you deploy containers or
pods (to be defined shortly) in your application, you’re deploying them to be
run on the worker nodes. Workers have the resources to host and run one or
more containers.
</p>
<h2>POD:</h2>
<p style="text-align: justify;">
Kubernetes’ logical, not physical, unit of work is called a pod. A pod is some
what similar to a container in Docker. A Kubernetes pod usually contains one
or more Docker containers and all managed as a unit.
</p>
<p style="text-align: justify;">
A pod allows you to take multiple containers and specify how they come
together to create your application. And this further clarifies the
relationship between Docker and Kubernetes.
</p>
<p style="text-align: justify;">
Example: If you create a simple container with isolated units of work, then it
can be run independently. But to create complex applications such as a web
server, we often need to combine multiple containers, which then run and are
managed together in one pod.
</p>
<h2>Kubernete Service:</h2>
<p style="text-align: justify;">
Kubernete service is a logical set/group of PODs which provides a single IP
address and DNS name through which you can access all pods within the service.
Kubernete service is very easy to set up and manage load balancing. It helps a
lot when you need to scale in/out your Kubernetes pods.
</p>
<h2>Replication Controller or ReplicaSet:</h2>
<p style="text-align: justify;">
Replication Controller or ReplicaSet is another key feature of Kubernetes. It
is the component responsible for actually managing the pod lifecycle –
starting pods when instructed by the service or if pods go offline or are
accidentally stopped, and also killing pods if the service instructs to do so,
perhaps because of decreased user load.
</p>
<p style="text-align: justify;">
So in other words, the replication controller helps achieve our desired state
regarding the specified number of running pods.
</p>
<h2>Auto Scaling</h2>
<p style="text-align: justify;">
We can use Docker container directly for our purpose but we instead of using
it directly we use it through Kubernete because Kubernetes has ability to
autoscale the application based demands/workload. Autoscaling is achieved by
setting up the cluster to increase the number of nodes when service demand
increases, and also reduce the number of nodes when demand decreases.
</p>
<h2>Note</h2>
<p style="text-align: justify;">
Keep in mind that nodes are "physically" exist which means that our cloud
platform must allow the Kubernetes engine to create new machines.
</p>
<p>
For detail, please refer my Github post:
<a href="https://github.com/amalay/kubernete-samples" target="_blank"
>Github</a
>
</p>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com1tag:blogger.com,1999:blog-7440503196463246810.post-71372858466297132562021-09-13T18:42:00.001+05:302021-09-13T18:45:30.034+05:30How to parse JSON data in SQL ServerTo parse JSON data in SQL Server, there is a function called <b>OPENJSON</b> can
be used in SQL Script.
<div>
<b><br /></b>
</div>
<div>
Syntax:<b> </b
><b
>OPENJSON( [jsondata]<json
>, [path]<path
>) [ with Clause <with_clause> ]</with_clause></path
></json
></b
>.
</div>
<div><br /></div>
<div>
Parameter jsondata is your json data and parameter path is the node of your jsondata.
<b>'$'</b> is used to hold the root node.
</div>
<div><br /></div>
<div>
But before using OPENJSON function in your SQL Server, you must set
<b>compatibility</b> level as 130 at least in your database to support
OPENJSON function.
</div>
<div><br /></div>
<div><b>Example:</b></div>
<div>ALTER DATABASE MyDatabase SET COMPATIBILITY_LEVEL = 130</div>
<div>
<h2>Parse JSON Data</h2>
</div>
<div><b>Example 1:</b></div>
<div>
<div>DECLARE @Json NVARCHAR(MAX)</div>
<div>SELECT @Json = '</div>
<div>{</div>
<div><span style="white-space: pre;"> </span>"StudentList":</div>
<div><span style="white-space: pre;"> </span>[ </div>
<div><span style="white-space: pre;"> </span>{ </div>
<div><span style="white-space: pre;"> </span>"Id":1,</div>
<div><span style="white-space: pre;"> </span>"FirstName":"Amalay",</div>
<div><span style="white-space: pre;"> </span>"LastName":"Verma",</div>
<div><span style="white-space: pre;"> </span>"Class":10,</div>
<div><span style="white-space: pre;"> </span>"Marks":61.5</div>
<div><span style="white-space: pre;"> </span>},</div>
<div><span style="white-space: pre;"> </span>{ </div>
<div><span style="white-space: pre;"> </span>"Id":2,</div>
<div><span style="white-space: pre;"> </span>"FirstName":"Saurabh",</div>
<div><span style="white-space: pre;"> </span>"LastName":"Sharma",</div>
<div><span style="white-space: pre;"> </span>"Class":11,</div>
<div><span style="white-space: pre;"> </span>"Marks":82.7</div>
<div><span style="white-space: pre;"> </span>},</div>
<div><span style="white-space: pre;"> </span>{ </div>
<div><span style="white-space: pre;"> </span>"Id":3,</div>
<div><span style="white-space: pre;"> </span>"FirstName":"Kanchan",</div>
<div><span style="white-space: pre;"> </span>"LastName":"Pandey",</div>
<div><span style="white-space: pre;"> </span>"Class":10,</div>
<div><span style="white-space: pre;"> </span>"Marks":90.5</div>
<div><span style="white-space: pre;"> </span>} </div>
<div><span style="white-space: pre;"> </span>]</div>
<div>}'</div>
<div> </div>
<div>SELECT Id, FirstName, LastName, Class, Marks</div>
<div>FROM OPENJSON (@Json, '$.StudentList')</div>
<div>WITH</div>
<div>(</div>
<div><span style="white-space: pre;"> </span>Id INT,</div>
<div><span style="white-space: pre;"> </span>FirstName VARCHAR(255),</div>
<div><span style="white-space: pre;"> </span>LastName VARCHAR(255),</div>
<div><span style="white-space: pre;"> </span>Class INT,</div>
<div><span style="white-space: pre;"> </span>Marks DECIMAL(3,1)</div>
<div>) AS StudentList;</div>
</div>
<div><br /></div>
<div><b>Example 2:</b></div>
<div>
<div>DECLARE @json NVARCHAR(1000)</div>
<div>SELECT @json =</div>
<div>N'</div>
<div>{</div>
<div> "OrderHeader": </div>
<div> [</div>
<div><span style="white-space: pre;"> </span>{</div>
<div><span style="white-space: pre;"> </span>"OrderId": 100,</div>
<div><span style="white-space: pre;"> </span>"CustomerId": 101,</div>
<div><span style="white-space: pre;"> </span>"OrderDetail": </div>
<div><span style="white-space: pre;"> </span>[</div>
<div><span style="white-space: pre;"> </span>{</div>
<div><span style="white-space: pre;"> </span>"ProductId": 2000,</div>
<div>
<span style="white-space: pre;"> </span>"UnitPrice": 350
<span style="white-space: pre;"> </span>
</div>
<div><span style="white-space: pre;"> </span>}, </div>
<div>
<span style="white-space: pre;"> </span>{
<span style="white-space: pre;"> </span>
</div>
<div><span style="white-space: pre;"> </span>"ProductId": 3000,</div>
<div><span style="white-space: pre;"> </span>"UnitPrice": 450</div>
<div><span style="white-space: pre;"> </span>}</div>
<div><span style="white-space: pre;"> </span>]</div>
<div><span style="white-space: pre;"> </span>}</div>
<div> ]</div>
<div>}'</div>
<div> </div>
<div>SELECT</div>
<div><span style="white-space: pre;"> </span>OrderId,</div>
<div><span style="white-space: pre;"> </span>CustomerId,</div>
<div><span style="white-space: pre;"> </span>ProductId1,</div>
<div><span style="white-space: pre;"> </span>UnitPrice1,</div>
<div><span style="white-space: pre;"> </span>ProductId2,</div>
<div><span style="white-space: pre;"> </span>UnitPrice2</div>
<div>FROM OPENJSON (@json, '$.OrderHeader')</div>
<div>WITH (</div>
<div>
<span style="white-space: pre;"> </span>OrderId INT
'$.OrderId',
</div>
<div>
<span style="white-space: pre;"> </span>CustomerId INT '$.CustomerId',
</div>
<div>
<span style="white-space: pre;"> </span>ProductId1 INT
'$.OrderDetail[0].ProductId',
</div>
<div>
<span style="white-space: pre;"> </span>UnitPrice1 INT
'$.OrderDetail[0].UnitPrice',
</div>
<div>
<span style="white-space: pre;"> </span>ProductId2 INT
'$.OrderDetail[1].ProductId',
</div>
<div>
<span style="white-space: pre;"> </span>UnitPrice2 INT
'$.OrderDetail[1].UnitPrice'
</div>
<div>) AS Orders</div>
</div>
<div><br /></div>
<div><b>Example 3:</b></div>
<div>
<div>DECLARE @Json NVARCHAR(MAX)</div>
<div>SELECT @Json = '</div>
<div>{</div>
<div><span style="white-space: pre;"> </span>"ProfileId":1,</div>
<div>
<span style="white-space: pre;"> </span>"Name":"P 1",
</div>
<div><span style="white-space: pre;"> </span>"BaseGroups":</div>
<div><span style="white-space: pre;"> </span>[</div>
<div><span style="white-space: pre;"> </span>{</div>
<div><span style="white-space: pre;"> </span>"GroupId":11,</div>
<div><span style="white-space: pre;"> </span>"GroupName":"G 11",</div>
<div><span style="white-space: pre;"> </span>"BaseTiles":</div>
<div><span style="white-space: pre;"> </span>[</div>
<div><span style="white-space: pre;"> </span>{</div>
<div>
<span style="white-space: pre;"> </span>"TileId":111,
</div>
<div><span style="white-space: pre;"> </span>"Name":"T 111",</div>
<div><span style="white-space: pre;"> </span>"State":0</div>
<div><span style="white-space: pre;"> </span>},</div>
<div><span style="white-space: pre;"> </span>{</div>
<div>
<span style="white-space: pre;"> </span>"TileId":112,
</div>
<div><span style="white-space: pre;"> </span>"Name":"T 112",</div>
<div><span style="white-space: pre;"> </span>"State":0</div>
<div><span style="white-space: pre;"> </span>}</div>
<div>
<span style="white-space: pre;"> </span>],
</div>
<div><span style="white-space: pre;"> </span>"State":0</div>
<div><span style="white-space: pre;"> </span>},</div>
<div><span style="white-space: pre;"> </span>{</div>
<div><span style="white-space: pre;"> </span>"GroupId":12,</div>
<div><span style="white-space: pre;"> </span>"GroupName":"G 12",</div>
<div><span style="white-space: pre;"> </span>"BaseTiles":</div>
<div><span style="white-space: pre;"> </span>[</div>
<div><span style="white-space: pre;"> </span>{</div>
<div>
<span style="white-space: pre;"> </span>"TileId":121,
</div>
<div><span style="white-space: pre;"> </span>"Name":"T 121",</div>
<div><span style="white-space: pre;"> </span>"State":0</div>
<div><span style="white-space: pre;"> </span>},</div>
<div><span style="white-space: pre;"> </span>{</div>
<div>
<span style="white-space: pre;"> </span>"TileId":122,
</div>
<div><span style="white-space: pre;"> </span>"Name":"T 122",</div>
<div><span style="white-space: pre;"> </span>"State":0</div>
<div><span style="white-space: pre;"> </span>}</div>
<div>
<span style="white-space: pre;"> </span>],
</div>
<div><span style="white-space: pre;"> </span>"State":0</div>
<div><span style="white-space: pre;"> </span>}</div>
<div>
<span style="white-space: pre;"> </span>],
</div>
<div><span style="white-space: pre;"> </span>"State":1</div>
<div>}'</div>
<div> </div>
<div>SELECT ProfileId, Name, State</div>
<div>FROM OPENJSON (@Json, '$')</div>
<div>WITH</div>
<div>(</div>
<div><span style="white-space: pre;"> </span>ProfileId INT,</div>
<div><span style="white-space: pre;"> </span>Name VARCHAR(255),</div>
<div><span style="white-space: pre;"> </span>State INT</div>
<div>) AS ProfileDetails;</div>
</div>
<div><br /></div>
<div><br /></div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-28961675883818298462021-09-10T20:16:00.000+05:302021-09-10T20:16:24.946+05:30Automation of Coding Standards for .Net using StyleCop<div style="text-align: justify;">
While writing c# code, it is very difficult to ensure that every developer is
following coding standards guideline. Forget the advanced level of coding
standards even we have experienced that basic level of coding standards are
not followed properly in the project. And the major reason behind this is the
manual process of forcing team members to follow the coding standards some
time developer minds it and taking negatively. It is better idea to force
developer by machine rather than human to follow coding standards in their
code. For this there are couple of tools which are used to automate the coding
standards process such as
</div>
<div>
<ol style="text-align: left;">
<li> StyleCop </li>
<li> FxCop </li>
<li> Code Analysis etc. </li>
</ol>
</div>
<div style="text-align: justify;">
All these tools have some good and bad thing with own. Here this document is
going to contain all about StyleCop.
</div>
<br />
<div style="text-align: justify;">
<b>StyleCop</b> is a tool from Microsoft (an open Source Tool btw.) to analyse
the Source Code. It works on C# source files directly rather than .DLLs.
<br />
<b>StyleCop</b> defined a set of rules and on the basis of these rules every
c# file is evaluated to ensure that the code written in the file must follow
the coding standards.
</div>
<br />
<div style="text-align: justify;"><b>Installation of StyleCop </b></div>
<div style="text-align: justify;">
<ol>
<li>
Download ReSharper (ReSharperSetup.8.2.0.2160) and install it before
installing StyleCop.
</li>
<li>Download StyleCop (StyleCop-4.7.49.0) and install it.</li>
</ol>
</div>
<b> How to execute StyleCop from Visual Studio after installing it: </b>
<div>
After installed StyleCop to your machine, you can see it inside tool menu of
the visual studio or right click window of the project as shown below:
<div class="separator" style="clear: both;">
<a
href="https://user-images.githubusercontent.com/84455469/132862270-5ac5ef80-7444-4fe6-b37a-8d7571155046.png"
style="display: block; padding: 1em 0px; text-align: center;"
><img
alt=""
border="0"
data-original-height="405"
data-original-width="604"
src="https://user-images.githubusercontent.com/84455469/132862270-5ac5ef80-7444-4fe6-b37a-8d7571155046.png"
/></a>
</div>
</div>
To run StyleCop, you have to click on Run StyleCop or Run StyleCop (Rescan All)
button. <br />Alternatively you can run StyleCop by right clicking on the c#
file and Run StyleCop button.
<div>
For details understanding and sample please follow my
<a
href="https://github.com/amalay/dotnet-codereview/tree/main/StyleCop"
rel="nofollow"
target="_blank"
>Github</a
>
link.
</div>
<br />
<div>
<a
href="https://github.com/amalay/dotnet-codereview/tree/main/StyleCop"
rel="nofollow"
target="_blank"
>Source Code</a
>
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-47138040781167047512018-10-01T00:30:00.000+05:302018-10-01T00:30:37.041+05:30Azure Service Fabric Mesh<div dir="ltr" style="text-align: left;" trbidi="on">
<table>
<tbody>
<tr>
<td><a href="https://www.blogger.com/blogger.g?blogID=7440503196463246810" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFAMTK8r3FOzY5vkEQ4t4UrxXMGjLptdknsJrkqcvXovHAnVjXQm6G4XCLjiTKNr-qGXSVnrg1JL42l8_HYxIbdFNjF_LeWmPd8ZjFrHtaY7XG1iylFjLqZAogEj7wAs9gw0I6CZU0z38/s1600/SFMesh_01.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="118" data-original-width="126" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFAMTK8r3FOzY5vkEQ4t4UrxXMGjLptdknsJrkqcvXovHAnVjXQm6G4XCLjiTKNr-qGXSVnrg1JL42l8_HYxIbdFNjF_LeWmPd8ZjFrHtaY7XG1iylFjLqZAogEj7wAs9gw0I6CZU0z38/s1600/SFMesh_01.png" /></a>
</td>
<td><div class="separator" style="clear: both; text-align: center;">
<span style="color: #0b5394;"></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #0b5394;"></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #0b5394;"></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="color: #0b5394;"></span></div>
<b><span style="color: #0b5394; font-size: x-large;">Service Fabric Mesh
</span></b></td>
</tr>
</tbody></table>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<b><span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;">Azure
Service Fabric Mesh</span></b><span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;"> is an
extension of the <b>Azure Service Fabric. </b>In
another words, we can also say that it is<b>
</b>a kind of Serverless version of Azure Service Fabric.<o:p></o:p></span></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;"><br /></span></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: "calibri" , sans-serif; font-size: 10pt; line-height: 150%;">Azure Service Fabric Mesh is a fully
managed service which works on “<b>code and
deploy</b>” fashion. It enables developers to develop & deploy Microservices
applications without managing virtual machines, storage, networking, or
infrastructure.</span> <span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;">It works by
analyzing the resource requirements of each application and the available
infrastructure, then automatically scales, rolls out upgrades and self-heals
whenever it’s required.<o:p></o:p></span></div>
<div style="background: white; box-sizing: border-box; line-height: 150%; margin: 0in 0in 0.0001pt;">
<span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;">The platform supports both Linux and Windows
containers, Microsoft said.<o:p></o:p></span></div>
<div style="background: white; box-sizing: border-box; line-height: 150%; margin: 0in 0in 0.0001pt;">
<span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;">With Azure Service Fabric Mesh, developers can
deploy container-based Microservices directly from the Azure Portal or Command
Line Interface, or from within Microsoft’s integrated development environment
Visual Studio. <o:p></o:p></span></div>
<div style="background: white; box-sizing: border-box; line-height: 150%; margin: 0in 0in 0.0001pt;">
<br /></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;">Azure Service Fabric Mesh tools that allow developer
to debug and publish their apps to cloud. Once it’s deployed, Azure Service
Fabric Mesh runs in the background, automating functions such as scaling,
service discovery and other maintenance tasks.<o:p></o:p></span></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<br /></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;">The people who are using Visual Studio for their
development work need to do below two things to start development for Azure
Service Fabric Mesh:<o:p></o:p></span></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<br /></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; line-height: 150%; margin: 0in 0in 0.0001pt; text-indent: 0in;">
<!--[if !supportLists]--><span style="background-color: white; color: #333333; font-family: "calibri" , sans-serif; font-size: 10pt; line-height: 150%;">1.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="font-family: "calibri" , sans-serif; font-size: 10pt; line-height: 150%;"><span style="background-color: white; color: #333333;">They need to </span><b style="background-color: white;"><span style="color: blue;"><a href="https://blogs.msdn.microsoft.com/visualstudio/2018/07/16/azure-service-fabric-mesh-tools-now-available-for-visual-studio-2017/" target="_blank"><span style="text-decoration-line: none;"><span style="color: blue;">download & Install</span></span></a> </span></b><span style="background-color: white; color: #333333;">Azure Service Fabric Mesh tools from <o:p></o:p></span></span></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<span style="font-family: "calibri" , sans-serif; font-size: 10pt; line-height: 150%;"><a href="https://marketplace.visualstudio.com/items?itemName=ms-azuretools.ServiceFabricMesh"><span style="color: blue;">https://marketplace.visualstudio.com/items?itemName=ms-azuretools.ServiceFabricMesh</span></a><span style="color: #333333;"><o:p></o:p></span></span></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in; mso-list: l0 level1 lfo1; tab-stops: .25in; text-indent: 0in;">
<!--[if !supportLists]--><span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;">2.<span style="font-family: "times new roman"; font-size: 7pt; font-stretch: normal; line-height: normal;">
</span></span><!--[endif]--><span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;">They also need to download & install </span><span class="MsoHyperlink"><span style="font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;"><span style="color: blue;"> <a href="https://www.microsoft.com/web/handlers/webpi.ashx?command=getinstallerredirect&appid=MicrosoftAzure-ServiceFabric-SDK-Mesh" style="color: blue;"><b>MicrosoftAzure-ServiceFabric-SDK-Mesh</b></a>
</span></span></span><span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;"> at his machine.<o:p></o:p></span></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<br /></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;">
<span style="font-size: 10pt; line-height: 107%;">Once you install these two things, you can start seeing below project templates
in your Visual Studio:</span></span></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;"><span style="font-size: 10pt; line-height: 107%;"><br /></span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEga6lHMd7sp4dhkjpvWgmuwMKjyYz6ANUW1ShAEt1jDFbyGd4JEBz3VgrCSt-ARF1s0E-Y2lsB4NC5ATPkfJqBSLRU5O-VuY1kDMKJD6iHYI8OvF17vCWtJiFZ25Px455SezTfj-x_rCoM/s1600/SFMesh_02.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="369" data-original-width="624" height="189" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEga6lHMd7sp4dhkjpvWgmuwMKjyYz6ANUW1ShAEt1jDFbyGd4JEBz3VgrCSt-ARF1s0E-Y2lsB4NC5ATPkfJqBSLRU5O-VuY1kDMKJD6iHYI8OvF17vCWtJiFZ25Px455SezTfj-x_rCoM/s320/SFMesh_02.png" width="320" /></a></div>
<b></b>
<div style="text-align: left;">
<br />
<div style="text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirYSjAX2b5xz2L-5aGFjTy_IFzOeet759Rkn-qAx7t8Oaqg16eO-zVi89j2VHj2mK_cZBGddDdaPk75DnQ8HbYDdoqEtKhe0tqemvh6uHGysFt8xefuKoNjrZKLWXyEn7vNhLp7FmgXvg/s1600/SFMesh_03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="471" data-original-width="624" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirYSjAX2b5xz2L-5aGFjTy_IFzOeet759Rkn-qAx7t8Oaqg16eO-zVi89j2VHj2mK_cZBGddDdaPk75DnQ8HbYDdoqEtKhe0tqemvh6uHGysFt8xefuKoNjrZKLWXyEn7vNhLp7FmgXvg/s320/SFMesh_03.png" width="320" /></a></div>
</div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIU0PKHNVsmV7bb1lKRtX5vQDxEoIMM1kweBAr7Lo_ytn0nctLBU4D4VHLgiBiuFxlulmxAG7g9B05InldQuPxPwyIA8mKiIwU7Zw9LIx7CY1Zkyv844gJ1xkvuJ9W9Iy3cGalpADXVGQ/s1600/SFMesh_04.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="294" data-original-width="624" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIU0PKHNVsmV7bb1lKRtX5vQDxEoIMM1kweBAr7Lo_ytn0nctLBU4D4VHLgiBiuFxlulmxAG7g9B05InldQuPxPwyIA8mKiIwU7Zw9LIx7CY1Zkyv844gJ1xkvuJ9W9Iy3cGalpADXVGQ/s320/SFMesh_04.png" width="320" /></a></div>
<br/>
<div class="MsoNormal" style="line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-size: 10.0pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">You can create both frontend and backend application
using these templates. To create frontend application, you can select “Web
Application” or “Web Application (MVC)” project template and for backend
application, you can select “API” project template.<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0in;">
<br /></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;"><span style="font-size: 10pt; line-height: 107%;">
<span style="font-size: 10pt; line-height: 107%;">Once
you create your project, you can see your project structure as below:</span></span></span></div>
<div style="background: white; line-height: 150%; margin-bottom: .0001pt; margin: 0in;">
<span style="color: #333333; font-family: "calibri" , sans-serif; font-size: 10.0pt; line-height: 150%;"><span style="font-size: 10pt; line-height: 107%;"><span style="font-size: 10pt; line-height: 107%;"><br /></span></span></span></div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVAcySfzzw5lobc3ls3IuujJyP4GaWTE7p3b4if5RoTDu1SdB3Uw7TQ8he9hGDeHT-ISlx4SnPu9r6QB4NFPu80K_mX_qaitgpkbNmDxUjPHQyonw5NTTLRTUTyWs7pCtd_kGVd-0lLkw/s1600/SFMesh_05.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="329" data-original-width="623" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVAcySfzzw5lobc3ls3IuujJyP4GaWTE7p3b4if5RoTDu1SdB3Uw7TQ8he9hGDeHT-ISlx4SnPu9r6QB4NFPu80K_mX_qaitgpkbNmDxUjPHQyonw5NTTLRTUTyWs7pCtd_kGVd-0lLkw/s320/SFMesh_05.png" width="320" /></a></div>
<br/>
<div class="MsoNormal" style="line-height: 150%; margin-bottom: .0001pt; margin-bottom: 0in;">
<span style="font-size: 10.0pt; line-height: 150%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">You can download the complete sample from
below link:<o:p></o:p></span></div><br/><br/>
<div>
<a href="https://github.com/amalay/learnings/tree/f5ff49e39cc1a44843e9bae6087bb93287820083" style="color: blue;"><b>Github: Service Fabric Mesh Sample</b></a></div><br/><br/>
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com1tag:blogger.com,1999:blog-7440503196463246810.post-86602360784572549572015-09-06T11:29:00.001+05:302015-09-06T11:29:14.391+05:30Page Directives in ASP.NET<div dir="ltr" style="text-align: left;" trbidi="on">
Page directives configure the runtime environment that will execute the page. The complete list of directives is as follows:<br />
<ol style="text-align: left;">
<li>@ Page - Defines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files.</li>
<li>@ Register - Associates aliases with namespaces and classes, which allow user controls and custom server controls to be rendered when included in a requested page or user control.</li>
<li>@ Assembly - Links an assembly to the current page or user control declaratively. </li>
<li>@ Control - Defines control-specific attributes used by the ASP.NET page parser and compiler and can be included only in .ascx files (user controls).</li>
<li>@ Implements - Indicates that a page or user control implements a specified .NET Framework interface declaratively. </li>
<li>@ Import - Imports a namespace into a page or user control explicitly.</li>
<li>@ Master - Identifies a page as a master page and defines attributes used by the ASP.NET page parser and compiler and can be included only in .master files.</li>
<li>@ MasterType - Defines the class or virtual path used to type the Master property of a page.</li>
<li>@ OutputCache - Controls the output caching policies of a page or user control declaratively.</li>
<li>@ PreviousPageType - Creates a strongly typed reference to the source page from the target of a cross-page posting.</li>
<li>@ Reference - Links a page, user control, or COM control to the current page or user control declaratively.</li>
</ol>
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-70844601851376159652015-09-06T11:24:00.000+05:302015-09-06T11:24:01.252+05:30Page Life Cycle in ASP.NET<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<ul style="text-align: left;">
<li>Page_PreInit</li>
<li>Page_Init</li>
<li>Page_InitComplete</li>
<li>Page_PreLoad</li>
<li>Page_Load</li>
<li>Page_LoadComplete</li>
<li>Page_PreRender</li>
<li>Render</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg07kqAj8K8d5jF5a2mA45YLLq9hjmefeMnB_8D_pLscGXvOdbB1zhGr3PwPZ5dDVmD6g2tDG1nbmYrCRmhP_lLuek8HzP0jGR3xvaCi8VR2uDf46sBFFwJMBg0PZhdhg_rwxpWeAIdbqY/s1600/AspNetPageLifeCycle.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg07kqAj8K8d5jF5a2mA45YLLq9hjmefeMnB_8D_pLscGXvOdbB1zhGr3PwPZ5dDVmD6g2tDG1nbmYrCRmhP_lLuek8HzP0jGR3xvaCi8VR2uDf46sBFFwJMBg0PZhdhg_rwxpWeAIdbqY/s640/AspNetPageLifeCycle.jpg" width="514" /></a></div>
</div>
<br /></div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com1tag:blogger.com,1999:blog-7440503196463246810.post-21468623827331983992015-09-06T09:11:00.001+05:302015-09-06T09:11:11.531+05:30Generalization & Specialization in OOPS<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span style="color: #3d85c6;">Generalization:</span></b><br />
The concept of generalization in OOP means that an object encapsulates common state and behavior for a category of objects.<br />
<br />
<span style="color: #3d85c6;">Example</span>: The geometric shape is an object and most geometric shapes have area, perimeter, and color.<br />
<br />
<b><span style="color: #3d85c6;">Specialization:</span></b><br />
The concept of specialization in OOP means that an object can inherit the common state and behavior of a generic object. However, each object needs to define its own special and particular state and behavior.<br />
<br />
<span style="color: #3d85c6;">Example:</span> Each geometric shape has its own color and particular formulas to calculate its area and perimeter.<br />
<br /></div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com1tag:blogger.com,1999:blog-7440503196463246810.post-82843784283957037432015-09-06T09:08:00.000+05:302015-09-13T12:23:31.484+05:30Various .Net Tools<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span style="color: #3d85c6;">What is Ilasm.exe used for?</span></b><br />
Ilasm.exe is a tool that generates PE files from MSIL code. You can run the resulting executable to determine whether the MSIL code performs as expected.<br />
<br />
<b><span style="color: #3d85c6;">What is Ildasm.exe used for?</span></b><br />
Ildasm.exe is a tool that takes a PE file containing the MSIL code as a parameter and creates a text file that contains managed code.<br />
<br />
<span style="color: #3d85c6;"><b>What is the ResGen.exe tool used for?</b></span><br />
ResGen.exe is a tool that is used to convert resource files in the form of .txt or .resx files to common language runtime binary .resources files that can be compiled into satellite assemblies.<br />
<br />
<b><span style="color: #3d85c6;">Strong Name Tool (Sn.exe) used for?</span></b><br />
Sn.exe is a tool that is used to generate strong name. eg: sn -k mykey.snk<br />
<br />
<b><span style="color: #3d85c6;">What is the caspol.exe tool used for?</span></b><br />
The caspol tool grants and modifies permissions to code groups at the user policy, machine policy, and enterprise policy levels.<br />
<div>
<br /></div>
<br />
Some more tool will be added shortly ! Please wait.... </div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-11322298693967448002015-09-06T08:52:00.003+05:302015-09-06T09:21:35.716+05:30A short description about .Net Assembly<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span style="color: #3d85c6;">What is an assembly?</span></b><br />
An assembly is a collection of one or more .exe or dll’s. An assembly is the fundamental unit for application development and deployment in the .NET Framework.<br />
An assembly contains a collection of types and resources that are built to work together and form a logical unit of functionality.<br />
<br />
<span style="color: #6fa8dc;"><b>What are the contents of assembly?</b></span><br />
A static assembly can consist of four elements:<br />
1.<span class="Apple-tab-span" style="white-space: pre;"> </span>Assembly manifest - An assembly manifest contains the information about the identity and version of the assembly. It also contains the information required to resolve references to types and resources.<br />
2.<span class="Apple-tab-span" style="white-space: pre;"> </span>Type metadata - Binary information that describes a program.<br />
3.<span class="Apple-tab-span" style="white-space: pre;"> </span>Microsoft intermediate language (MSIL) code.<br />
4.<span class="Apple-tab-span" style="white-space: pre;"> </span>A set of resources.<br />
<br />
<span style="color: #6fa8dc;"><b>What are the different types of assembly?</b></span><br />
1.<span class="Apple-tab-span" style="white-space: pre;"> </span>Private assembly: A private assembly is installed in the installation directory of an application and is accessible to that application only.<br />
2.<span class="Apple-tab-span" style="white-space: pre;"> </span>Shared assembly: Shared assembly is shared by multiple applications. A shared assembly has a strong name and is installed in the GAC.<br />
3.<span class="Apple-tab-span" style="white-space: pre;"> </span>Satellite assembly: Satellite assemblies are often used to deploy language-specific resources for an application.<br />
<br />
<b><span style="color: #3d85c6;">What is a dynamic assembly?</span></b><br />
A dynamic assembly is created dynamically at run time when an application requires the types within these assemblies.<br />
<br />
<b><span style="color: #3d85c6;">What is a strong name?</span></b><br />
You need to assign a strong name to an assembly to place it in the GAC and make it globally accessible. A strong name consists of a name that consists of an assembly's identity (text name, version number, and culture information), a public key and a digital signature generated over the assembly. <br />
The .NET Framework provides a tool called the Strong Name Tool (Sn.exe), which allows verification and key pair and signature generation.<br />
<br />
<b><span style="color: #3d85c6;">What is GAC? What are the steps to create an assembly and add it to the GAC?</span></b><br />
The global assembly cache (GAC) is a machine-wide code cache that stores assemblies specifically designated to be shared by several applications on the computer. You should share assemblies by installing them into the global assembly cache only when you need to.<br />
Steps<br />
•<span class="Apple-tab-span" style="white-space: pre;"> </span>Create a strong name using sn.exe tool eg: sn -k mykey.snk<br />
•<span class="Apple-tab-span" style="white-space: pre;"> </span>In AssemblyInfo.cs, add the strong name eg: [assembly: AssemblyKeyFile("mykey.snk")]<br />
•<span class="Apple-tab-span" style="white-space: pre;"> </span>recompile project, and then install it to GAC in two ways :<br />
•<span class="Apple-tab-span" style="white-space: pre;"> </span>Drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool)<br />
•<span class="Apple-tab-span" style="white-space: pre;"> </span>gacutil -i abc.dll<br />
<br /></div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-43724014857847866192014-08-01T09:43:00.002+05:302014-08-01T09:43:52.108+05:30Increasing request limit quota in WCF/REST Service<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<strong><span style="font-family: Arial, 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, sans-serif; font-size: 13px; text-align: start;">Customizing </span>webHttpBinding<span style="font-family: Arial, 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, sans-serif; font-size: 13px; text-align: start;"> in web.config and referencing with </span>bindingConfiguration<span style="font-family: Arial, 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, sans-serif; font-size: 13px; text-align: start;"> in endpoint element</span></strong></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<span style="font-family: Arial, 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, sans-serif; font-size: 13px; text-align: start;"><system.serviceModel><br /> <behaviors><br /> <endpointBehaviors><br /> <behavior name="AmmuEndPointServiceBehavior"><br /> <webHttp /><br /> </behavior><br /> </endpointBehaviors><br /> <serviceBehaviors><br /> <behavior name="AmmuServiceBehavior"><br /> <serviceMetadata httpGetEnabled="true" /><br /> <serviceDebug includeExceptionDetailInFaults="true" /><br /> </behavior><br /> </serviceBehaviors><br /> </behaviors><br /> <bindings><br /> <!-- Customizations for REST service --><br /> <webHttpBinding><br /> <!-- Limits set to 10 MB (specified value in bytes) --><br /> <binding name="AmmuBinding" maxReceivedMessageSize="10485760" maxBufferPoolSize="10485760" maxBufferSize="10485760" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00"><br /> <readerQuotas maxDepth="32" maxStringContentLength="10485760" maxArrayLength="10485760" maxBytesPerRead="10485760" /><br /> <security mode="None" /><br /> </binding><br /> </webHttpBinding><br /> </bindings><br /> <br /> <services><br /> <service name="Amalay.Web.Services.AmmuService" behaviorConfiguration="AmmuServiceBehavior"><br /> <endpoint address="" binding="webHttpBinding" contract="Amalay.Web.Services.IAmmuService" bindingConfiguration="AmmuBinding" behaviorConfiguration="AmmuEndPointServiceBehavior" /><br /> </service><br /> </services><br /><br /> <serviceHostingEnvironment aspNetCompatibilityEnabled= "true" multipleSiteBindingsEnabled="true" /><br /><br /> </system.serviceModel></span></div>
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-25698424423597765032014-08-01T09:41:00.002+05:302014-08-01T09:41:24.446+05:30HTTP status codes<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<strong>1xx – Informational: </strong>These status codes indicate a provisional response. The client should be prepared to receive one or more 1xx responses before receiving a regular response.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
100 - Continue.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
101 - Switching protocols.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<strong>2xx – Success: </strong>This class of status codes indicates that the server successfully accepted the client request.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
200 - OK. The client request has succeeded.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
201 - Created.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
202 - Accepted.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
203 - Non-authoritative information.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
204 - No content.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
205 - Reset content.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
206 - Partial content.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<strong>3xx – Redirection: </strong>The client browser must take more action to complete the request. For example, the browser may have to request a different page on the server or repeat the request by using a proxy server.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
301 - Moved Permanently</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
302 - Object moved Temporarily</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
303 - See Other</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
304 - Not modified.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
307 - Temporary redirect.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<strong>4xx - Client Error: </strong>An error occurs, and the client appears to be at fault. For example, the client may request a page that does not exist, or the client may not provide valid authentication information.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
400 - Bad request.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
401 - Access denied. IIS defines a number of different 401 errors that indicate a more specific cause of the error. These specific error codes are displayed in the browser but are not displayed in the IIS log:</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
403 - Forbidden. IIS defines a number of different 403 errors that indicate a more specific cause of the error:</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
404 - Not found. 404.0 - (None) – File or directory not found.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
405 - HTTP verb used to access this page is not allowed (method not allowed.)</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
406 - Client browser does not accept the MIME type of the requested page.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
407 - Proxy authentication required.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
412 - Precondition failed.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
413 – Request entity too large.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
414 - Request-URI too long.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
415 – Unsupported media type.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
416 – Requested range not satisfiable.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
417 – Execution failed.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
423 – Locked error.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<strong>5xx - Server Error: </strong>The server cannot complete the request because it encounters an error.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
500 - Internal server error.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
501 - Header values specify a configuration that is not implemented.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
502 - Web server received an invalid response while acting as a gateway or proxy.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
<br /></div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
503 - Service unavailable. This error code is specific to IIS 6.0.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
504 - Gateway timeout.</div>
<div style="background-color: white; color: #222222; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 18px; text-align: justify;">
505 - HTTP version not supported.</div>
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com1tag:blogger.com,1999:blog-7440503196463246810.post-8744147158104166242014-08-01T09:37:00.000+05:302014-08-01T09:37:01.470+05:30Removing HTML tags from Input String in Sql Server<div dir="ltr" style="text-align: left;" trbidi="on">
CREATE FUNCTION [dbo].[FN_AMMU_REMOVE_HTML_TAGS]<br />
(<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>@INPUT_STRING NVARCHAR(MAX)<br />
)<br />
<br />
RETURNS NVARCHAR(MAX)<br />
AS<br />
BEGIN<br />
DECLARE @Start INT, @End INT, @Length INT;<br />
<br />
WHILE CHARINDEX('<', @INPUT_STRING) > 0 AND CHARINDEX('>', @INPUT_STRING, CHARINDEX('<', @INPUT_STRING)) > 0<br />
BEGIN<br />
SET @Start = CHARINDEX('<', @INPUT_STRING); <br />
SET @End = CHARINDEX('>', @INPUT_STRING, CHARINDEX('<', @INPUT_STRING));<br />
SET @Length = (@End - @Start) + 1;<br />
<br />
IF @Length > 0<br />
BEGIN<br />
SET @INPUT_STRING = STUFF(@INPUT_STRING, @Start, @Length, '')<br />
END<br />
END<br />
<br />
RETURN RTRIM(@INPUT_STRING);<br />
END </div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-30370960508907895342013-09-19T15:18:00.002+05:302013-09-19T15:18:46.561+05:30New features in C# 4.0<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Introduction</b><br />
<div>
The major theme for C# 4.0 is dynamic programming. Increasingly, objects are “dynamic” in the sense that their structure and behavior is not captured by a static type, or at least not one that the compiler knows about when compiling your program. Some examples include</div>
<div>
<br /></div>
<div>
•<span class="Apple-tab-span" style="white-space: pre;"> </span>Objects from dynamic programming languages, such as Python or Ruby</div>
<div>
•<span class="Apple-tab-span" style="white-space: pre;"> </span>COM objects accessed through IDispatch</div>
<div>
•<span class="Apple-tab-span" style="white-space: pre;"> </span>Ordinary .NET types accessed through reflection</div>
<div>
•<span class="Apple-tab-span" style="white-space: pre;"> </span>Objects with changing structure, such as HTML DOM script objects</div>
<div>
•<span class="Apple-tab-span" style="white-space: pre;"> </span>Data readers and other user defined dynamic objects</div>
<div>
<br /></div>
<div>
While C# remains a statically typed language, we aim to vastly improve the interaction with such objects.</div>
<div>
A secondary theme is co-evolution with Visual Basic. Going forward we will aim to maintain the individual character of each language, but at the same time important new features should be introduced in both languages at the same time. They should be differentiated more by style and feel than by feature set.</div>
<div>
<br /></div>
<div>
The new features in C# 4.0 fall into four groups:</div>
<div>
<b>Dynamic binding</b></div>
<div>
Dynamic binding allows you to write method, operator and indexer calls, property and field accesses, and even object invocations which bypass the C# static type checking and instead gets resolved at runtime. </div>
<div>
<br /></div>
<div>
<b>Named and optional arguments</b></div>
<div>
Parameters in C# can now be specified as optional by providing a default value for them in a member declaration. When the member is invoked, optional arguments can be omitted. Furthermore, any argument can be passed by parameter name instead of position.</div>
<div>
<br /></div>
<div>
<b>COM specific interop features</b></div>
<div>
Dynamic binding as well as named and optional arguments help making programming against COM less painful than today. On top of that, however, we are adding a number of other features that further improve the interop experience specifically with COM.</div>
<div>
<br /></div>
<div>
<b>Variance</b></div>
<div>
It used to be that an IEnumerable<string> wasn’t an IEnumerable<object>. Now it is – C# embraces type safe “co-and contravariance,” and common BCL types are updated to take advantage of that.</div>
<div>
<br /></div>
<div>
I will come with more details on this in next blog....</div>
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-880549537347102012013-09-10T18:26:00.003+05:302013-09-10T18:34:19.795+05:30Microsoft's .NET Framework<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Microsoft's .NET Framework is comprised of two main
components - the </span><span style="color: #943634; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Common Language Runtime (CLR)</span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";"> and the .NET Framework </span><span style="color: #943634; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">class libraries</span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">.
The CLR is the real foundation of the .NET Framework. It is the execution
engine (</span><span style="font-family: "Verdana","sans-serif"; font-size: 9.0pt;">runtime
environment)</span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";"> for all .NET applications.
Every target computer requires the CLR to successfully run a .NET application
that uses the .NET Framework. The main features of CLR include:<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: 0in;">
<!--[if !supportLists]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana;">1.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Automatic Memory Management.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: 0in;">
<!--[if !supportLists]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana;">2.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Thread Management.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: 0in;">
<!--[if !supportLists]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana;">3.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Code Compilation & Execution.<o:p></o:p></span></div>
<div class="MsoNormal" style=" text-align: justify; text-indent: 0in;">
<!--[if !supportLists]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana;">4.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Code Verification.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: 0in;">
<!--[if !supportLists]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana;">5.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">High level of security.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: 0in;">
<!--[if !supportLists]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana;">6.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Remoting.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: 0in;">
<!--[if !supportLists]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana;">7.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Structured Exception Handling.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: 0in;">
<!--[if !supportLists]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana;">8.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Interoperability between Managed and Unmanaged code. <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify; text-indent: 0in;">
<!--[if !supportLists]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana;">9.<span style="font-family: 'Times New Roman'; font-size: 7pt;"> </span></span><!--[endif]--><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Integration with Microsoft Office System <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";"><br />
All .NET applications are compiled into </span><span style="color: #943634; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Intermediate
Language code (MSIL)</span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">. When executed on the CLR, MSIL
is converted into native machine code specific to the operating platform. This
process is done by a </span><span style="color: #943634; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Just In Time (JIT)</span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";"> compiler. The code executed by the CLR is called as </span><span style="color: #943634; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Managed Code</span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">.
This code is </span><span style="color: #943634; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">type safe</span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";"> and thoroughly checked by the CLR before being
deployed. <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">The .NET runtime also provides a facility to
incorporate existing COM components and DLL's into a .NET application. Code
that is not controlled by the CLR is called </span><span style="color: #943634; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Unmanaged
Code</span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">One of the interesting points to note is that the CLR
itself manages the life of objects. This is the effect of the </span><span style="color: #943634; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Automatic Garbage Collection</span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";"> system built into it. When the CLR finds an object
that is not being used, it destroys them and thus frees their memory
allocation.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";"><br />
The .NET Framework is further comprised of </span><span class="MsoHyperlink"><span style="color: #943634; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">Common Type System (CTS)</span></span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";"> and </span><span class="MsoHyperlink"><span style="color: #943634; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-fareast-font-family: "Times New Roman";">Common Language Specification (CLS)</span></span><span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">. The CTS defines the common data types used by .NET
programming languages. The CTS tells you how to represent characters and
numbers in a program. <o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">The CLS represents the guidelines defined by for the
.NET Framework. These specifications are normally used by the compiler
developers and are available for all languages, which target the .NET
Framework.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
<b><span style="font-family: "Verdana","sans-serif"; font-size: 9.0pt;">Explain CLS and CTS?<o:p></o:p></span></b></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: "Verdana","sans-serif"; font-size: 9.0pt;">CLS: Common Language
specification is a set of rules that are to be followed by a language in order
to be .NET complaint. This facilitates cross-language integration. Programs
written in one .NET language can interoperate with programs written in another
.NET language.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";">Common language specification defines the common
types that are supported by the languages which are compatible with the .net
framework. For example if u develop a web service with functions which are
accepting unsigned integer values as parameter and u want to use that service in
a language that won't supports unsigned integers then u will get a problem .So
the languages which wants to be compatible with .net must support the types
that are specified by CLS.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
<b><span style="font-family: "Verdana","sans-serif"; font-size: 9.0pt;">CTS: Common Type System<o:p></o:p></span></b></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="font-family: "Verdana","sans-serif"; font-size: 9.0pt;">Common Type System
(CTS) describes how types are declared, used and managed. CTS facilitate
cross-language integration, type safety, and high performance code execution.<o:p></o:p></span></div>
<br />
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";"><br />
CTS are the service which is used by the CLR to manage the code. CTS can
express the semantics of any programming language. CTS define a standard set of
types and rules to create new types. The runtime understands how to create and
execute these types. Compilers and interpreters use the runtime (CLR) services
like CTS to define types, manage objects and make method calls instead of using
tool or language specific methods. CTS goal is to enable multi language
integration.<o:p></o:p></span></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #2a2a2a; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Segoe UI";"><br /></span></div>
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-70127520789592748202013-09-09T16:40:00.001+05:302013-09-09T16:40:27.227+05:30Code compilation stages under .Net Framework<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: left;">
There are four phases of code compilations under .Net framework as shown below:</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2j2FF6ATqXhB-LXN1Bj9CEi7l1EDMNKx3pNN621OsdAU4q7DPVLrYVDjGEYRgTp6EcqRF7XS9zlAYdQk3WYYem9paT0A10HhtdFL4hvIpZyfPukJrj704l7C6nJyhNtxVFuen68N4Wv0/s1600/Arctitecture_DotNet_Framework.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2j2FF6ATqXhB-LXN1Bj9CEi7l1EDMNKx3pNN621OsdAU4q7DPVLrYVDjGEYRgTp6EcqRF7XS9zlAYdQk3WYYem9paT0A10HhtdFL4hvIpZyfPukJrj704l7C6nJyhNtxVFuen68N4Wv0/s640/Arctitecture_DotNet_Framework.jpg" width="424" /></a></div>
<br /></div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-28991095199658914342013-09-08T02:57:00.004+05:302013-09-08T02:57:46.371+05:30Sample of Various Design Patterns<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<b>Sample of Various Design Patterns</b></div>
<div>
<b><br /></b></div>
<div>
1. AbstractFactory</div>
<div>
2. Factory</div>
<div>
3. BuilderPattern</div>
<div>
4. Singleton</div>
<div>
<br /></div>
<div>
<a href="https://sites.google.com/site/amalayverma/downloads/DesignPattern_Amalay.zip?attredirects=0&d=1" target="_blank">downloads</a></div>
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com1tag:blogger.com,1999:blog-7440503196463246810.post-77519635128823897732013-09-07T22:56:00.003+05:302013-09-07T22:56:30.398+05:30C# & Encapsulation<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Encapsulation means to create a boundary around an object to separate its external
(public) behavior from its internal (private) implementation.</b><br />
<br />
<b>Consumers of an object should only concern themselves with what an object does,
not how it does it. </b><br />
<br />
<b>C# supports encapsulation via:
</b><br />
<br />
– Unified Type System<br />
– Classes and Interfaces<br />
– Properties, Methods and Events
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-86912349531651703012013-09-07T22:52:00.001+05:302013-09-07T22:52:24.106+05:30C# & Inheritance<div dir="ltr" style="text-align: left;" trbidi="on">
<b>C# implements Inheritance in two ways:</b><br />
<br />
– A class may inherit from a single base class<br />
– A class may implement zero or more Interfaces.
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-90719115787239289862013-09-07T22:49:00.002+05:302013-09-07T22:49:41.189+05:30C# & Polymorphism<div dir="ltr" style="text-align: left;" trbidi="on">
– A class can be used as its own type, cast to any base types or interface types
it implements.<br />
– Objects may methods as virtual; virtual methods may be overridden in a derived
type. These are executed instead of the base implementation </div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-73758022419164697312013-09-07T19:42:00.003+05:302013-09-07T19:42:39.550+05:30What is Object Oriented Programming?<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<b><span style="font-family: inherit;">To be object oriented, a language is designed around the concept of objects. that
are something, have certain properties and exhibit certain behaviors. This means
the language generally includes support for:</span></b><br />
<b><span style="font-family: inherit;"><br /></span></b>
– Encapsulation<br />
– Inheritance
<br />
– Polymorphism </div>
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0tag:blogger.com,1999:blog-7440503196463246810.post-50970223359756040782013-09-07T18:08:00.001+05:302013-09-07T18:08:26.446+05:30What is an Object?<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="text">
<h4>
An object typically models a concept:</h4>
– An object usually “is” something –i.e. a customer<br />
– An object usually “has” data –i.e. the customer’s first name<br />
– An object usually “performs” actions –i.e. make a customer “preferred” </div>
</div>
Amalayhttp://www.blogger.com/profile/14232206966266349591noreply@blogger.com0