Blog

AAD

https://docs.microsoft.com/en-us/azure/active-directory/

Main components of Windows server Active Directory:

ADDS

ADLDS

ADFS

ADCS

ADRMS

These are driven by:

Identities, Workstations, Network policies, Servers, Security etc and these are exposed by enterprise protocols like – Kerberos, LDAP, Replication, DNS etc.

Main components of Azure Active Directory:

WAAD (individual identities)

WAACS(Windows Azure Access Control Service) – (will federate access from external providers)

AAD limits itself to Identities and are exposed by protocols like REST, various identity protocols.

How is SSO implemented in Azure? What is Password SSO:

https://docs.microsoft.com/en-us/azure/active-directory/active-directory-sso-integrate-saas-apps

      • Password-based Single Sign-On enables secure application password storage and replay using a web browser extension or mobile app. This leverages the existing sign-in process provided by the application, but enables an administrator to manage the passwords and does not require the user to know the password.
      • Existing Single Sign-On enables Azure AD to leverage any existing single sign-on that has been set up for the application, but enables these applications to be linked to the Office 365 or Azure AD access panel portals, and also enables additional reporting in Azure AD when the applications are launched there.

From <https://social.msdn.microsoft.com/Forums/sqlserver/en-US/134899f4-620a-4078-a80f-ee2ec22c2fbf/difference-between-existing-single-signon-and-password-single-signon?forum=WindowsAzureAD>

ASP.Net

ASP.Net page life cycle

Stage

Description

Page request

The page request occurs before the page life cycle begins. When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and compiled (therefore beginning the life of a page), or whether a cached version of the page can be sent in response without running the page.

Start

In the start stage, page properties such as Request and Response are set. At this stage, the page also determines whether the request is a postback or a new request and sets the IsPostBack property. The page also sets the UICulture property.

Initialization

During page initialization, controls on the page are available and each control’s UniqueID property is set. A master page and themes are also applied to the page if applicable. If the current request is a postback, the postback data has not yet been loaded and control property values have not been restored to the values from view state.

Load

During load, if the current request is a postback, control properties are loaded with information recovered from view state and control state.

Postback event handling

If the request is a postback, control event handlers are called. After that, the Validate method of all validator controls is called, which sets the IsValid property of individual validator controls and of the page. (There is an exception to this sequence: the handler for the event that caused validation is called after validation.)

Rendering

Before rendering, view state is saved for the page and all controls. During the rendering stage, the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream object of the page’s Response property.

Unload

The Unload event is raised after the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and cleanup is performed.

From <https://msdn.microsoft.com/en-us/library/ms178472.aspx>

Types of state management

There are two types of state management techniques: client side and server side.

Client side

      1. Hidden Field
      2. View State
      3. Cookies
      4. Control State
      5. Query Strings

Server side

    1. Session
    2. Application

From <http://www.codeproject.com/Articles/492397/State-Management-in-ASP-NET-Introduction>

Server controls:

When you create ASP.NET Web pages, you can use these types of controls:

  • HTML server controls   HTML elements exposed to the server so you can program them. HTML server controls expose an object model that maps very closely to the HTML elements that they render.
  • Web server controls   Controls with more built-in features than HTML server controls. Web server controls include not only form controls such as buttons and text boxes, but also special-purpose controls such as a calendar, menus, and a tree view control. Web server controls are more abstract than HTML server controls in that their object model does not necessarily reflect HTML syntax.
  • Validation controls   Controls that incorporate logic to enable you to what users enter for input controls such as the TextBox control. Validation controls enable you to check for a required field, to test against a specific value or pattern of characters, to verify that a value lies within a range, and so on. For more information, see ASP.NET Validation Controls.
  • User controls   Controls that you create as ASP.NET Web pages. You can embed ASP.NET user controls in other ASP.NET Web pages, which is an easy way to create toolbars and other reusable elements. For more information, see ASP.NET User Controls.

From <https://msdn.microsoft.com/en-us/library/zsyt68f1.aspx>

Diff between Customer control and User control:

A Custom Control generally inherits from the System.Windows.Controls.Control class. You may derive from a different custom control depending on your requirement.

Custom Controls are compiled into a DLL assembly and can be reused in multiple places very easily. You have total control over the code, thus gives you more flexibility to extend the behaviour. Once you build and add a reference of the custom control in your project, you can find it in the toolbox. Thus, you will be able to drag and drop the control in your Design view and start working with it very easily.

The base “UserControl” is nothing but a Custom Control that you derive to create a control UI specific to your project. Generally, we create a UserControl which is placed inside a XAML page with tight bonding to the code behind. You can directly access its UI elements from the code-behind and do some specific operations.

Custom Control

User Control

A loosely coupled control w.r.t code and UI

A tightly coupled control w.r.t code and UI

Derives from Control

Derives from UserControl

Defines UI in a ResourceDictionary

Defines UI as normal XAML

UI is skinable

Child controls are skinable

Has dynamic layout

Has static layout

UI can be changed in different projects

UI is fixed and can’t have different looks in different project

Has full toolbox support

Can’t be added to the toolbox

Defines a single control

Defines a set of controls

More flexible

Not very flexible like a Custom Control

Requires in-depth knowledge of Silverlight UI Model

Does not require indepth knowledge of the UI Model

From <http://www.codeproject.com/Articles/179442/So-what-s-the-difference-between-a-Custom-Control>

What is AutoEventWireup

      • the ASP.NET page framework also supports an automatic way to associate page events and methods. If the AutoEventWireup attribute of the Page directive is set to true (or if it is missing, since by default it is true), the page framework calls page events automatically, specifically the Page_Init and Page_Load methods.

From <http://forums.asp.net/t/932513.aspx?What+is+AutoEventWireup+>

What is Event bubbling?

original control as well as to the control that exposes the bubbled event.

Event bubbling is used by the data-bound controls (Repeater, DataList, and DataGrid) to expose command events raised by child controls (within item templates) as top-level events. While ASP.NET server controls in the .NET Framework use event bubbling for command events (events whose event data class derives from CommandEventArgs), any event defined on a server control can be bubbled.

From <https://msdn.microsoft.com/en-us/library/aa719644(v=vs.71).aspx>

Page Directives in ASP.Net:

      • @Page
      • @Master
      • @Control
      • @Import
      • @Implements
      • @Register
      • @Assembly
      • @MasterType
      • @Output Cache
      • @PreviousPageType
      • @Reference

From <http://www.c-sharpcorner.com/UploadFile/azadc/Asp-Net-page-directives/>

Types of validation controls:

Type of validation

Control to use

Description

Required entry

RequiredFieldValidator

Ensures that the user does not skip an entry. For details, see How to: Validate Required Entries for ASP.NET Server Controls.

Comparison to a value

CompareValidator

Compares a user’s entry against a constant value, against the value of another control (using a comparison operator such as less than, equal, or greater than), or for a specific data type. For details, see How to: Validate Against a Specific Value for ASP.NET Server Controls and How to: Validate Against a Data Type for ASP.NET Server Controls.

Range checking

RangeValidator

Checks that a user’s entry is between specified lower and upper boundaries. You can check ranges within pairs of numbers, alphabetic characters, and dates. For details, see How to: Validate Against a Range of Values for ASP.NET Server Controls.

Pattern matching

RegularExpressionValidator

Checks that the entry matches a pattern defined by a regular expression. This type of validation enables you to check for predictable sequences of characters, such as those in e-mail addresses, telephone numbers, postal codes, and so on. For details, see How to: Validate Against Patterns for ASP.NET Server Controls.

User-defined

CustomValidator

Checks the user’s entry using validation logic that you write yourself. This type of validation enables you to check for values derived at run time. For details, see How to: Validate with a Custom Function for ASP.NET Server Controls and How to: Validate Against Values in a Database for ASP.NET Server Controls.

From <https://msdn.microsoft.com/en-us/library/bwd43d0x.aspx>

ORM

Transaction in EF

Earlier the System.Transactions namespace was used to handle transactions in the Entity Framework using TransactionScope and the Entity Framework uses this transaction to save the changes in the database.

From ver6, there is EntitiesContext

      1. using (EntitiesContext context = new EntitiesContext())  
      1. {  
      2.     using (var transaction = context.Database.BeginTransaction())  
      3.     {  
      4.         try  
      5.         {  
      6.             EmployeeMaster employee = new EmployeeMaster();  
      7.             employee.Code = “A0001”;  
      8.             employee.Name = “Jignesh Trivedi”;  
      9.             employee.DepartmentId = 1;  
      10.             context.Employees.Add(employee);  
      11.             context.SaveChanges();  
      12.   
      13.             DepartmentMaster dept = new DepartmentMaster();  
      14.             dept.Code = “DEP0001”;  
      15.             dept.Name = “Department 1”;  
      16.             context.Departments.Add(dept);  
      17.             context.SaveChanges();  
      18.   
      19.             transaction.Commit();  
      20.         }  
      21.         catch (Exception ex)  
      22.         {  
      23.             transaction.Rollback();  
      24.         }  
      25.     }  
      26. }  

From <http://www.c-sharpcorner.com/UploadFile/ff2f08/working-with-transaction-in-entity-framework-6-0/>

Database first vs Schema First vs Code first approaches:

Fluent API in code-first:

https://msdn.microsoft.com/en-us/library/jj591617(v=vs.113).aspx

http://www.entityframeworktutorial.net/code-first/fluent-api-in-code-first.aspx

EF code-first data annotations:

https://msdn.microsoft.com/en-us/library/jj591583(v=vs.113).aspx

EF code migrations: If we make any change to model, that has to be updated to database. Use package manager console for this update using migrations feature. It’s a 3-step process.

      1. Enable-migrations
      2. Add-migration name
      3. Update-Database -Verbose

Ex: If more than one context exists

Enable-Migrations -ContextTypeName EFLibrary.SQLContext

Add-Migration AddDescriptionCategory

Update-Database –Verbose

To generate db script for migration – Update-database -SourceMigration: $InitialDatabase -TargetMigration: <migration file name>

Other

Metrics for development:

KLOC, resource count, Cyclomatic complexity, UTC count, Functional Points, Program Size, Cohesion, Coupling, Maintainability Index, Code Coverage, Performance Testing Result comparing existing/ standard benchmarks(load time, execution time), Integration Test results pass %, Bugs count across environment, sign-offs from stakeholders.

https://en.wikipedia.org/wiki/Software_metric

GeoJSON

GeoJSON[1] is an open standard format designed for representing simple geographical features, along with their non-spatial attributes, based on JavaScript Object Notation.[2][3]

The features include points (therefore addresses and locations), line strings (therefore streets, highways and boundaries), polygons (countries, provinces, tracts of land), and multi-part collections of these types. GeoJSON features need not represent entities of the physical world only; mobile routing and navigation apps, for example, might describe their service coverage using GeoJSON.[4]

The GeoJSON format differs from other GIS standards in that it was written and is maintained not by a formal standards organization, but by an Internet working group of developers.[5]

A notable offspring of GeoJSON is TopoJSON, an extension of GeoJSON that encodes geospatial topology and that typically provides smaller file sizes.

From <https://en.wikipedia.org/wiki/GeoJSON>

MEF is Managed Extensibility Framework. Used for scenarios where dll has same data type exposed and needs to use the value in

Azure 70-534 exam

learnnowonline.com/lms/login

measureup

Pluralsight

Test Projects:

D:\Data\TestProjs\ESB\ASBWithTopic\AzureServiceBusTopics\AzureServiceBusTopics – ASB with multiple topics like printer, paper etc

https://www.youtube.com/watch?v=jpZ25l5oPdE

Unicode and ASCII both are standards for encoding texts. Uses of such standards are very much important all around the world. Code or standard provides unique number for every symbol no matter which language or program is being used. From big corporation to individual software developers, Unicode and ASCII have significant influence. Communication between different regions in the world was difficult but this was needed in every time. Recent easiness in communication and development of a unique platform for all people in the world is the result of inventing some universal encoding system.

Unicode

Development of Unicode was coordinated by a non-profit organization Unicode Consortium. Unicode is most compatible with different language like Java, XML, Microsoft .Net etc. Symbolic figure or glyptic art are greatly available due to modification of character shape which is done using some mechanism adopted by Unicode. Invention of Unicode has brought major renovation in texture, graphics, themes etc. Natural numbers or electrical pulse is used to convert a text or picture and they are easy to transmit through different networks.

• Recent version of Unicode consist more than 109000 characters, charts for visual reference, encoding methodology, standard for encoding, collation, two-way display, depicting etc.

• UTF-8 is one of the widely used encodings.

• Unicode consortium consists of world leading software and hardware companies like Apple, Microsoft, Sun Microsystems, Yahoo, IBM, Google Oracle Corporation.

• First book was published by the consortium in 1991 and latest Unicode 6.0 published in 2010

ASCII

Short form of American Standard Code for Information Interchange is ASCII. Encoding of that system is based on ordering the English alphabet. All modern data encoding machines support ASCII as well as other. ASCII was first used by Bell data services as a seven bit Tele-printer. Use of binary system had brought tremendous change in our personal computing. Personal Computer as we see now is the boon of using binary language which was used as core things for encoding and decoding. Various languages later created and adopted are based on it. As binary system makes the PC more comfortable and user friendly for all, similarly ASCII is being used for making easiness in communicating. 33 characters are non-printing, 94 printing characters and space altogether makes 128 characters which are used by ASCII.

• It allows 128 characters.

• WWW or World Wide Web used ASCII as character encoding system but now ASCII is superseded by UTF-8.

• Short passage was encoded by early ASCII.

• ASCII-code order is different from traditional alphabetical order.

Difference between Unicode and ASCII

• Unicode is an expedition of Unicode Consortium to encode every possible languages but ASCII only used for frequent American English encoding. For example, ASCII does not use symbol of pound or umlaut.

• Unicode require more space than ASCII.

• Unicode use 8, 16 or 32 bit characters based on different presentation while ASCII is seven-bit encoding formula.

• Many software and email can’t understand few Unicode character set.

• ASCII only supports 128 characters while Unicode supports much more characters.

Though different variations appear among Unicode and ASCII but both are very much essential in development of web based communication

From <http://www.differencebetween.com/difference-between-unicode-and-ascii/>

 

 

Unit Test

Shims & Fakes

https://msdn.microsoft.com/en-in/library/hh549176.aspx

 

What is stub?

Stub types are one of two technologies that the Microsoft Fakes framework provides to let you easily isolate a component you are testing from other components that it calls. A stub is a small piece of code that takes the place of another component during testing. The benefit of using a stub is that it returns consistent results, making the test easier to write. And you can run tests even if the other components are not working yet. Stubs are used mainly to create objects of interfaces.

https://msdn.microsoft.com/en-us/library/hh549174.aspx

 

What is Moq?

Moq is a tool to mock libraries.

 

Explain dependency injection with Unity: If there are more than one implementation for a class, and both are being used by 2 different classes, how can we register those classes with the respective clients?

 

https://msdn.microsoft.com/en-us/library/ff953186(v=pandp.50).aspx

IUnityContainer container = new UnityContainer();
container.RegisterType<IFoo, Foo1>(“Foo1”);
container.RegisterType<IFoo, Foo2>(“Foo2”);

container.RegisterType<Client1>(new InjectionConstructor(new ResolvedParameter<IFoo>(“Foo1”)));
container.RegisterType<Client2>(new InjectionConstructor(new ResolvedParameter<IFoo>(“Foo2”)));

Client1 client1 = container.Resolve<Client1>();
Client2 client2 = container.Resolve<Client2>();

 

From <http://stackoverflow.com/questions/18665324/unity-register-for-one-interface-multiple-object-and-tell-unity-where-to-inject>

 

Lifetime managers in Unity:

ContainerControlledLifetimeManager:

      • If you used the RegisterType method to register a type, Unity creates a new instance of the registered type during the first call to the Resolve or ResolveAll method or when the dependency mechanism injects instances into other classes. Subsequent requests return the same instance.
      • If you used the RegisterInstance method to register an existing object, Unity returns this instance every time you call the Resolve or ResolveAll method or when the dependency mechanism injects instances into other classes.

 

ExternallyControlledLifetimeManager:

This lifetime manager allows you to register type mappings and existing objects with the container so that it maintains only a weak reference to the objects it creates when you call the Resolve or ResolveAll method or when the dependency mechanism injects instances into other classes based on attributes or constructor parameters within that class. Unity returns the same instance of the registered type or object each time you call the Resolve or ResolveAll method or when the dependency mechanism injects instances into other classes. However, the container does not hold onto a strong reference to the object after it creates it, which means that the garbage collector can dispose of the object if no other code is holding a strong reference to it.

 

PerThreadLifetimeManager

Unity returns, on a per-thread basis, the same instance of the registered type or object each time you call the Resolve or ResolveAll method or when the dependency mechanism injects instances into other classes. This lifetime manager effectively implements a singleton behavior for objects on a per-thread basis. PerThreadLifetimeManager returns different objects from the container for each thread. The behavior is as follows:

      • If you used the RegisterType method to register a type, Unity creates a new instance of the registered type the first time the type is resolved in a specified thread, either to answer a call to the Resolve or ResolveAll methods for the registered type or to fulfill a dependency while resolving a different type. Subsequent resolutions on the same thread return the same instance.
      • Using the RegisterInstance method to register an existing object results in the same behavior as if you just registered the lifetime container with RegisterType. Therefore, it is recommended that you do not use the RegisterInstance method to register an existing object when using the PerThreadLifetimeManager.
      • PerThreadLifetimeManager returns the object desired or permits the container to create a new instance if no such object is currently stored for the current thread. A new instance is also created if called on a different thread than the one that set the value. This lifetime manager does not dispose the instances it holds.

 

https://msdn.microsoft.com/en-us/library/ff647854.aspx

 

What is Chutzpah?

Chutzpah is test runner for Jasmine unit test framework. It is an alternative for Moksha. Although moksha is more popular, Chutzpah is having matured integration with VS.

Getting Started with Unit Tests For Angular with Jasmine, Visual Studio and Chutzpah

 

Unity IoC container registration types:

https://msdn.microsoft.com/en-us/library/dn507479(v=pandp.30).aspx

 

Dependency injection and testing:

Getting Started With Unit Testing (Dependency Injection, IoC Containers, Unity, Moq)

 

 

https://www.youtube.com/watch?v=FuAhnqSDe-o

 

Javascript-Jquery unit testing with Qunit:

JavaScript Unit testing with QUnit