Posts

Showing posts from April, 2019

fibonacci series

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace fibonaci {     public class Program     {         public static void Main(string[] args)         {             int i, count, f1 = 0, f2 = 1, f3 = 0;             Console.Write("Enter the Limit : ");             count = int.Parse(Console.ReadLine());             Console.WriteLine(f1);             Console.WriteLine(f2);             for (i = 0; i <= count; i++)             {                 f3 = f1 + f2;                 Console.WriteLine(f3);                 f1 = f2;       ...

calculator using oops

using System;        namespace calcu    {        public class calculator        {                        public void sum(int x, int y)            {                int z = x + y;                Console.WriteLine(z);              }    public void sub(int x, int y)            {                int z = x - y;                Console.WriteLine(z);              }                public void sqrt(double x)            {                double...

Bubble Sort

using System; public class Program {     static void bubbleSort(int []arr)     {         int n = arr.Length;         for (int i = 0; i < n - 1; i++)             for (int j = 0; j < n - i - 1; j++)                 if (arr[j] > arr[j + 1])                 {                     // swap temp and arr[i]                     int temp = arr[j];                     arr[j] = arr[j + 1];                     arr[j + 1] = temp;                 }     }       /* Prints the array */     static void printArray(int []arr)   ...

saveInTheEditor

using System; public class Program { public static void Main() { string str = "saveInTheEditor"; char[] a = str.ToCharArray(); for(int i = 0; i < a.Length; i ++) {           if(i == 0) { str =  str.Replace(a[i].ToString(),a[i].ToString().ToUpper() ); } if(char.IsUpper(a[i]) == true) { str =  str.Replace(a[i].ToString(), Environment.NewLine + a[i].ToString() );           } else { }           }               Console.WriteLine(str); } } output----- Save In The Editor

Authentication in Asp Dot Net

Types of Authentication in Asp Dot Net Introduction Authentication and authorization both are most important things for any system and application. This blog starts with authentication and authorization concepts and after that explains the three default important ways and three custom authentication ways for doing authentication and authorization i.e. windows, forms ,passport, multipass, JWT  and SAML authentication. Plus, in this blog I will explain some fundamental concepts about the different authentication system. Authentication and Authorization Authentication is the process for checking the identity of a user based on the user’s credentials. Generally, user’s credentials are  in the form of user ID and password, and we check their credentials from database or equivalent alternative, if it exists then user is a valid candidate for next process – authorization. Authorization also known as “Permission Control” will come after authentication. Authorization is th...

Razor View Engine VS Web Form(ASPX) View Engine

Razor View Engine VS Web Form(ASPX) View Engine Razor View Engine Web Form View Engine Razor Engine is an advanced view engine  that was introduced with MVC3. This is not a new language but it is a new markup syntax. Web Form Engine is the default  view engine for the Asp.net  MVC that is included with Asp.net MVC from the beginning. The namespace for Razor Engine   is  System.Web.Razor . The namespace for Webform Engine is System.Web.Mvc.WebFormViewEngine . The file extensions used with Razor Engine are different from Web Form Engine. It has .cshtml (Razor with C#) or .vbhtml (Razor with VB) extension for views, partial views, editor templates and for  layout pages. The file extensions used with Web Form Engine are also like  Asp.net Web Forms. It has .aspx extension  for views, .ascx extension for partial views &  editor templates and .master extension for layout/master pages. Razor has new and advance ...

ASP.NET MVC VS WebForms

Difference between ASP.NET MVC and WebForms Asp.Net Web Forms Asp.Net MVC Asp.Net Web Form follow a traditional event-driven development model. Asp.Net MVC is a lightweight and follows MVC (Model, View, Controller) pattern based development, model. Asp.Net Web Form has  server controls. Asp.Net MVC has HTML helpers. Asp.Net Web Form supports  view state for state management at the client side. Asp.Net MVC does not support view state. Asp.Net Web Form has file-based URLs means file name exist in the URLs must have its physical existence. Asp.Net MVC has route-based URLs means URLs are divided into controllers and actions and moreover it is based on controller not on physical file. Asp.Net Web Form follows Web Forms Syntax Asp.Net MVC follow customizable syntax (Razor as default) In Asp.Net Web Form, Web Forms(ASPX)  i.e. views are tightly coupled  to Code behind(ASPX.CS) i.e. logic. In Asp.Net MVC, Views and logic are kept se...

minification

What is minification Minification is a = process of removing unnecessary comments, spaces from JavaScript / css file. Main intention of minification is to decrease the size of javascript / css files so that load time will get decreased. Functionality of javacript / css file remains same in minification. How my page works without Minification Without minification your page downloads each script / css file as it is shown below ( without comments removed and with spaces).

Bundling mvc

What is Bundling Bundling is a process of grouping the css / javascript files. This group of multiple file is combined into a single file. This single file can be cached. Intention of bundling is to improve performance / optimization. How my page works without Bundling

View vs Partial View MVC

The primary difference is that a Partial View is designed to be rendered within other full Views and as a result it will not contain all of the markup that a full View might ( since it is designed to work within other Views ). For example, a normal View might look like this and contain all of the elements present in a traditional HTML page :  <!DOCTYPE html> <html> <head> <meta charset = utf-8 /> <title> Example </title> </head> <body> <!-- Your Content Here --> </body> </html> where as a Partial View might only contain a small section that it needs to render and since it should be displayed within an existing View, it won't require the necessary tags like <head>, <html>, etc. because it is implied that these should already be present when a Partial View is rendered. An example partial View might look like this :  <div> <!-- Example --> <ul> ...

Transactions

Image
What are Transactions? Transactions group a set of tasks into a single execution unit. Each transaction begins with a specific task and ends when all the tasks in the group successfully complete. If any of the tasks fail, the transaction fails. Therefore, a transaction has only two results:  success  or  failure . Incomplete steps result in the failure of the transaction. A database transaction, by definition, must be atomic, consistent, isolated and durable. These are popularly known as ACID  properties. How to implement Transactions using SQL? Following commands are used to control transactions.It is imortant to note that these statements cannot be used while creating tables and are only used with the DML Commands such as – INSERT, UPDATE and DELETE. SET TRANSACTION:  Places a name on a transaction. Syntax: SET TRANSACTION [ READ WRITE | READ ONLY ]; COMMIT:  If everything is in order with all statements within a single transaction, all ch...

Index

What is Index? Indexes are database objects designed to improve query performance. By applying indexes to one or more columns in table or views, we could see faster data retrieval from these tables. Explain the structure of Index in SQL server? An index is structured by the SQL Server Index Manager as a balanced tree (or Btree). A B-tree is similar to an upside-down tree, means with the root of the tree at the top, the leaf levels at the bottom, and intermediate levels in between. Each object in the tree structure is a group of sorted index keys called an index page. All search requests begin at the root of a B-tree and then move through the tree to the appropriate leaf level. What are the different types of indexes in SQL Server? There are two types of indexes • Clustered index • Non Clustered index Both types of indexes are indexes are structured as B-Trees. Explain the difference between clustered index and non clustered index? Clustered index: A clustered index ...

Cursor

Image
Cursor is a database object to retrieve data from a result set one row at a time, instead of the T-SQL commands that operate on all the rows in the result set at one time. We use a cursor when we need to update records in a database table in singleton fashion means row by row. Life Cycle of Cursor Declare Cursor A cursor is declared by defining the SQL statement that returns a result set. Open A Cursor is opened and populated by executing the SQL statement defined by the cursor. Fetch When the cursor is opened, rows can be fetched from the cursor one by one or in a block to do data manipulation. Close After data manipulation, we should close the cursor explicitly. Deallocate Finally, we need to delete the cursor definition and released all the system resources associated with the cursor. Syntax to Declare Cursor Declare Cursor SQL Command is used to define the cursor with many options that impact the scalability and loading behavior of the cursor. The...