Friday 11 October 2013

The type of Client/Server Architecture in ASP.Net

Hi everyone,

             This article to describe the Client/Server  architecture of Asp.net. There are different types of        Client-Server architecture available. Some of them are 2-tier architecture, 3 tier architecture, 4 tier  architecture and n tier architecture.

Here to be explain that to simple.

2-tier Architecture

The 2tier architecture is the application logic is either buried inside the user interface on the client or within the database on the server. With two tier client/server architectures, the user system interface  is usually located in the user’s desktop environment and the database management service are usually in a server that is a more powerful machine that service many client. The process is split between the user system interface environment and the database management server environment.
                                             
          

3-tier Architecture

           The application logic or process lives in the middle tier ,it is separated from the data and the user interface. 3-tier systems are more scalable, robust and flexible. In addition, they can integrate data from multiple sources. In the 3 tier architecture, a middle tier was added between the user system interface client environment and the database management server environment. There are a variety of ways of implementing this middle tier can perform queuing, application execution and database staging. For example, if the middle tier provides queuing, the client can deliver its request to the middle layer and disengage because the middle tier will access the data and return the answer to the client. The three tier client/server architecture has been shown to improve performance for groups with a large number of users. The most basic type of three tier architecture has a middle layer consisting of Transaction Processing (TP) monitor technology. The TP monitor technology is a type of message queuing, transaction scheduling, and prioritization service where the client connects to the TP monitor (middle tier) instead of the database server.
                                         
                                                   



4-tier Architecture
            The 4-tier architecture is all of the data storage and retrieval processes are logically and usually physically located on a single tier. 4-tier architecture allows an unlimited number of programs to run simultaneously, send information to one another, use different protocols to communicate, and interact concurrently. This allows for a much more powerful application, providing many different services to many different clients. In this application we will have following 4-Tiers 
·         Business Object
·         Business Access Layer
·         Data Access Layer
·         UI -4 tier
               

Tuesday 8 October 2013

What is Bundling and Minification?


Guys, I wish to refer the next things going to be extremely interesting and it’s greatly useful, I am not going to explain briefly about this because I will refer the subsequently URL. It’s should be help for us. 

What is Bundling? (Little my knowledge share)
See! Bundling is a new feature for Visual studio 2012, especially given the feature to MVC 4 they had given separate file like Bundle.Config. Here we can initialized javascript  and Css files. Main advantage of use bundling reduce the Request load time, which mean see below table to explain the using bundling and minification.

Using B/M
Without B/M
Change
File Requests
9
34
256%
KB Sent
3.26
11.92
266%
KB Received
388.51
530
36%
Load Time
510 MS
780 MS
53%


Ok friends if you want to know more than about this please clicks here….

Thanks guys....

Saturday 28 September 2013

Vision Ingenious: Razor View Engine

Vision Ingenious: Razor View Engine: Recently me and my team has been working on has been a new view engine option for ASP.NET MVC4 WEB API, we should work new view engine Raz...

Razor View Engine

Recently me and my team has been working on has been a new view engine option for ASP.NET MVC4 WEB API, we should work new view engine Razor view. It’s new for every one including me. I see the samples; little impressed me I am trying to know about this.

WHAT?
Razor view was released for Microsoft Visual Studio 2010, Razor is a simple-syntax view engine and was released as part of ASP.NET MVC3 and the Microsoft WebMatrix tool set.
Razor is easy to learn and enables you to quickly be productive with a minimum of concepts. You use all your existing language and HTML skills. Razor doesn't require a specific tool and enables you to be productive in any plain old text editor –notepad to edit.
It’s not a new language, Supports "layouts" (an alternative to the "master page" concept in classic aspx pages).
The VS editor will also have the itellesense support that some of the other view engines don't have.
Declarative HTML Helpers also look pretty cool as doing HTML helpers within C# code reminds me of custom controls in ASP.NET. I think they took a page from partials but with the inline code.
HTML Encoding use @ block is automatically HTML encoded to better protect against XSS attack scenarios.
This is just Hello World Sample.
@{var message=”Hello World”;}
I Said : @message

i am try to compare Razor view and ASPX View engines, if may be missing any other point.

RAZOR View Engine
ASPX View Engine
The Razor View Engine is an advanced view engine that was introduced with MVC 3.0. This is not a new language but it is markup.
A web form view engine is the default view engine and available from the beginning of MVC
Razor has a syntax that is very compact and helps us to reduce typing.
The web form view engine has syntax that is the same as an ASP.Net forms application.
The Razor View Engine uses @ to render server-side content.
There is a different syntax ("<%: %>") to make text HTML encoded.
Razor does not require the code block to be closed, the Razor View Engine parses itself and it is able to decide at runtime which is a content element and which is a code element.
A web form View engine does not prevent Cross Site Scripting (XSS) attack.
The Razor Engine supports Test Driven Development (TDD).
Web Form view engine does not support Test Driven Development (TDD) because it depends on the System.Web.UI.Page class to make the testing complex.
There is only three transition characters with the Razor View Engine.
There are only three transition characters with the Razor View Engine.
The Razor View Engine is a bit slower than the ASPX View Engine.

Thanks Guys!! Hope you enjoy.....

Thursday 19 September 2013

Get MD5Hash from FileStream while partially reading

Hello friends,

Recently am worked to CryptoStream using MD5Hash related things and I need to calculate hash of a specified Stream while I was processing its data. I was trying to resolve various solutions and got some samples and customized that and resolve it. Here I will go to describe the difficulty and explanation.
Actually I need to get MD5Hash from filestream while partially reading. Before that we are doing to direct approach.
Along the way I discovered 3 additional methods to calculate hash – all suitable when you can’t rely on seeking in the stream.
Direct Approach for get Hash from container:
                      using (MD5 md5 = System.Security.Cryptography.MD5.Create())
            {
                md5.ComputeHash (inputStraeam);
                String containerHash = BitConverter.ToString(md5.Hash);
                return containerHash;
            }

This is the direct approach to calculate hash from data in stream, but its setback is that after calculating the hash value the stream is read to the end
 If the source stream was seekable (FileStream, MemoryStream…), you can just seek back and process the stream normally, but what if you can’t seek in the processing stream?

The block approach
The block approach you can calculate hash for filestream, using
You can calculate the hash on the go, using TransformBlock and TransformFinalBlock methods of MD5 class.
   using (MD5 md5 = MD5.Create())
        {
          byte[] data = new byte[4096];
          int numRead = 0;
          while ((numRead = inputStream.Read(data, 0, data.length)) > 0)
          {
                           
          md5.TransformBlock(data, 0, numRead, null, 0);

          }
           md5.TransformFinalBlock(data, 0, numRead);

         string fileHash = BitConverter.ToString(md5.Hash);
         fileHash = fileHash.Replace("-", "").ToUpper();
      }

This allows you to calculate the hash of the data at the same time to entire stream.



The block approach with Container position
The block approach with container position you to calculate the hash from set the fileStream position to read and end of stream.
using TransformBlock and TransformFinalBlock methods of MD5 class.
string fileHash = string.Empty;
long totalFileStreamFileStreamSize = fileStreamSize;
byte[] data = new byte[4096];
int readAmount = 0;

 if (fileStreamSize < data.Length)
 {
  readAmount = fileStreamSize;
 }
 else
 {
 readAmount = data.Length;
 }
 using (MD5 md5 = MD5.Create())
 {
 int numRead = 0;

 totalFileStreamFileStreamSize = totalFileStreamFileStreamSize + position;

 while ((numRead = container.Read(data, 0, readAmount)) > 0)
 {

 if ((totalFileStreamFileStreamSize - container.Position) <= readAmount)
 {
 readAmount = (int)(totalFileStreamFileStreamSize - container.Position);
 }
 // Compute MD5 hash
 if (container.Position != totalFileStreamFileStreamSize)
 {
 md5.TransformBlock(data, 0, numRead, null, 0);
 }
 else
 {
 md5.TransformFinalBlock(data, 0, numRead);
 }
 }
 fileHash = BitConverter.ToString(md5.Hash);
 fileHash = fileHash.Replace("-", "").ToUpper();
  }
The CryptoStream Approach
when we want to calculate hash value of output of your algorighm and do not have input in form of a stream, you can use CryptoStreamMode.Write.
using (MD5 md5 = new MD5CryptoServiceProvider())
{
using (CryptoStream writerOutputDocument = new CryptoStream(originalDocument, md5, CryptoStreamMode.Write))
{
while (totalRemaining > 0)
{
int numRead = inputContainer.Read(buffer, 0, readAmount);
if (numRead < 1)
{
throw new Exception("Unexpected end of file readingr.");
}
                                                                    writerOutputDocument.Write(buffer, 0, numRead);

totalRemaining -= numRead;
if (totalRemaining < buffer.Length)
{
 readAmount = (int)totalRemaining;
}
}
}
}

Note – when using CryptoStreamMode.Write, you need to indicate to the hash algorithm that all data is written.


Thursday 4 July 2013

What is HLD & LLD



Hi People,
           The Following articles to describe the HLD & LLD Document creation and used for developments purpose. Reduce, maintainability, minimal time of effort debugging and testing.
Following things going to be explained about HLD and LLD.        
     
What is HLD?
HLD stands for “High level design”. It is very important document of any software. It gives the complete overview of the system and tells to everyone how the system is going to divided into sub systems (functions, modules). It helps developer to understand the design of software (Architecture design, Database design) & complete flow even other team like testing teams review the system and customers plays a major role. For a project SRS is the entry point document And the exit criteria will be HLD projects standards the functional design documents and the database design document.

 
What is LLD?
It stands for “Low Level Design”. This is also a very important document in project management. It gives the details descriptions of the each module in details which is completely based on HLD. It gives the internal logic details of corresponding sub module designers are preparing and mapping individual LLD to Every module. After designing of logic for every program, everything is documented as program specifications not only that unit test plan is also prepared in this phase. A good level of LLD helps developer to develop a product with minimal effort of debugging & testing.