Thursday, 31 December 2015

single page application angularjs example

Here I am demonstrating a single page application (SPA) in AngularJs example.
Simple application for basic financial calculator like below; As I used it in mobile cordova application showing the sample for mobile application Screen (Single page application in AngularJs for mobile)


We should include the Some javascript file in application that you can download from below resources for single page application angularjs

Monday, 28 December 2015

Access WebApi using C# secured by certificate


Accessing the Webapi using the C# code and that WebApi is having SSL security.

Step 1: You have to install the SSL certificate into your local system and that you can check into MMC.

You should have the pfx file to install the certificate; you can follow the below steps to install certificates.

Step 2: You have to read the certificate by the thumbprint or by name, pass it to your code header like below; Code snippet to read the certificate as:
Need to import below namespace; using System.Security.Cryptography.X509Certificates;

/// <summary>
        /// Creating the certifactes
        /// </summary>
        /// <returns></returns>
        private static X509Certificate GetClientCert()
        {
            X509Store store = null;
            try
            {

Install SSL Certificate

You can see the link to creation of SSL certificate



You have the icon like below for creation of certificate.


Create New SSL Certificate using IIS 8.1

Create New SSL Certificate

  1. Open IIS; open the run window by window + R, than type inetmgr like below. Then click on Ok.

  1. Internet Information service will open than select the server from left and you will get the list of option as like below screen. On it select the server certificate.

Monday, 21 December 2015

application_error redirect to error page mvc

Handling the error getting in MVC application into Application_Error method in Global.asax page. So whatever the error you will get into application it will work as you handle there.

If getting any application error it will log that error.
If getting 404 it will redirect to particular controller/action like PageNotFound
If getting other than 404 it will redirect to particular controller/action like Index


Wednesday, 16 December 2015

Check url availability c#

You can use this application to check the availability of URL are there are not it can be used as the BVT test for your application.

There is the simple application you can create which will give the result of status of all URL for your application. It will give the Result as status code with URL.

Application will be look like Below;


Monday, 30 November 2015

Difference in AngularJS $rootScope and $scope;


Angularjs share the object which will work like a mediator between the View and Controller. AnjularJs share the two scope which will help to make the glue between View and controller as $scope and $rootscope.


$Scope : It is an object in AngularJs and 
use for communicating between
 the view and controller.
We can find the ng-model
 properties in particular 
controller from the particular
 page by using $scope.


Friday, 27 November 2015

What is View Model in MVC.

View Model work as a hidden layer in MVC applications. It’s a simple class that represents data displaying on the view.

If you will look into MVC, view model is not in the picture. Like;

Model: Used to maintain the business data.
Controller: Maintaining the interaction related details to View.
View: Contains the User Interface.

So, Where is the View model?

When someone first time ask me what is View Model in MVC? I told there is No View Model in MVC.

Friday, 13 November 2015

difference between web api and wcf

We are always little bit confusion when we are making service based application. that which we need to refer Web apt or WCF. The below difference of Web API and WCF will really help to select.



Web API Rest full
ASP.Net WCF Rest Support
Support Protocol
It support only HTTP protocol.
It support multiple protocol such as HTTP, UDP, TCP.
Support WS* Standard
It’s not supporting Transaction or reliable messaging.

It support WS* standard like Transaction, Reliable Messaging. Message security etc.
SOAP Support
No
WCF was primarily designed for SOAP-based XML messages,
Availability
Ship with .Net framework  but available as open source.
Ship with .Net Framework.
Configuration and Attribute
No need of much configuration to use it.
There is hell lot of configuration required to use it and overuse of attributes.
Message Exchange Pattern
It support Request/response only.
It support One Way, Request-Reply, Duplex message Exchange pattern.


Tuesday, 10 November 2015

Angularjs with MVC login form tutorial

Basically for any application we need a login page.  Now demonstrating angularjs with MVC login form tutorial.  Please see the step by step procedure to create the login form like below;



Step 1: Create MVC application in ASP.net;

Saturday, 10 October 2015

Difference between question of sql server

Difference between Table and View

Below list is major difference between Table and View in SQL Server;



Table
View
Table contains Data.
View doesn’t contains data.
Table is physically existence.
View doesn’t physically existence. It’s like virtual table.
You can perform insert, update, delete and Select for it.

Sunday, 27 September 2015

Difference between Where and Having

Below list is major difference between where and having in SQL Server;


Where
Having
The WHERE clause selects rows before grouping
HAVING clause selects rows after grouping.
Where clause states the criteria which individual records should  meet to be selected by a query , used without the GROUP BY clause. 
HAVING clause cannot be used without the GROUP BY clause.
WHERE clause cannot contain aggregate functions
HAVING clause can contain aggregate functions.
WHERE is used before the aggregation takes place.
HAVING is used to check conditions after the aggregation takes place.
select City, CNT=Count(1)
From Address
Where State = 'MA'
Group By City

select City, CNT=Count(1)
From Address
Where State = 'MA'
Group By City
Having Count(1)>5



Difference between Delete and Truncate

Below list is major difference between Delete and Truncate in SQL Server;


Delete
Truncate
Command Type
It is DML command Type.
It is DDL command Type.
Filter
Specify the filter for command like where.
Can’t use Where clause.
Reset Identity
Delete command won’t reset the identity Column.
Truncate command  reset the identity Column.
Performance
Slower than truncate as it keeps logs
High performance  as it won’t keep log.
RollBack
 Rollback is possible.
Rollback is not possible.
Activate Trigger
Delete activates a trigger.
TRUNCATE cannot activate a trigger
Locked Behaviour
DELETE statement lock row, each row in the table is locked for deletion.
TRUNCATE always locks the table and page but not each row.


Difference between Datetime and Datetime2

Below list is major difference between Datetime and Datetime2 in Sql Server;



Datetime
Datetime2
Storage Size
8 byte
6-8 Byte.
Min Value
1753-01-01 00:00:00
0001-01-01 00:00:00
Current Datetime
GetDate() - returns DB Current DateTime of datetime Data Type
SYSDATETIME()  - returns Current DateTime of DateTime2 Data Type
+/- Operator
+/- operator works,
e.g  GetDate() + 1
+/- operator not works; DateAdd function required to add date.
Syntax
 Declare @now datetime
Declare @now datetime2(7)

Difference between Store Procedure and User defined Function

Below list is major difference between Store Procedure and User defined Function in Sql Server;



Store Procedure
User Defined Function
DML Statement
Store procedure supports the DML operations. 
Like Insert update and Delete.
Its not support DML statements.
Return
Store procedure may or may not return the value
Function must return a value.
Transaction
Transactions allows in Store procedure.
Transactions not allow in user defined functions.
Call by Store Procedure
 Store Procedure can call other store procedure and function.
Function cannot call store procedure.
Call from select Statement
Procedures can’t be called from Select statement.
Function can be called from select statement.
Parameters
It Support both input and output Parameters.
It support input but not supports the output parameters.
Exception Handling
Its allow try and catch.
Its not allow try and catch.
Temporary Table
Its allow Temporary table.
Its not allow Temporary table.

Difference between Temporary Table and Table Variable

Below list is major difference between Temporary Table and Table Variable Datatype in Sql Server;


Temporary Table
Table Variable
Change of Structure
We can change
 the structure of temporary table after creation of it,
 we can use DDL statements ALTER, CREATE, DROP
We can’t change the structure of table variable. It doesn’t support DDL Statement like ALTER, CREATE, DROP.
User defined Function
User defined function not allowed temporary table.
Table variables are allowed in User Defined functions.
Transaction
Temporary table support the explicit transactions. .
It not supports the explicit transactions.
Index
 Temporary table allow adding explicit indexes after declarations.
Table variables not allow adding explicit indexes after declarations.
Scope
Scope of the Local Temporary Table is in the session in which it created and they are dropped automatically once the session ends and we can also drop them explicitly.
 Scope of the Table variable is the Batch or Stored Procedure in which it is declared. and they can’t be dropped explicitly,
Syntax
Creating the temporary Table

-- Create Temporary Table
CREATE TABLE Employee (EmpId INT, Name VARCHAR(50))

--Insert records
INSERT INTO #Employee VALUES(1,'BOB')

--Reterive the records
SELECT * FROM #Employe

--DROP Temporary Table
DROP TABLE #Employee
Using Table variables;

-- Create Table Variable
DECLARE @Employee TABLE
(
 Id INT,
 Name VARCHAR(50)  
)
--Insert Two records
INSERT INTO @Employee VALUES(1,'BOb')
--Reterive the records
SELECT * FROM @Employee
GO



Others

You will like to read it