Showing posts with label DotNet. Show all posts
Showing posts with label DotNet. Show all posts

Monday, 21 May 2012

WPF Architecture


Hi Friends,
Today I would  like to discuss some  core part of WPF architecutre. in  WPF ,Presentation Framework, Core Presentation and Media Integration Layer (milcore) Are The Three Major components of WPF architecture. These Are the Major portions of the WPF code. Milcore is cash en Unmanaged Code in order to enable tight integration with DirectX. DirectX engine is responsible for all display in WPF, allowing for efficient hardware and software rendering. CLR Provides fine control over the memory and execution. The composition engine in milcore is Extremely sensitive performance, and required giving up Many advantages of the CLR to gain performance.
Details


To know more about the WPF, one must have a clear idea about the architecture of WPF. The architecture of WPF is Actually multilayered architecture. It spans across Three layers - Managed Code and Unmanaged Code Core operating system, we can call thesis set of layers have built up assemblies That The Entire framework. The major components of WPF are illustrated in Figure below

Managed Layer: - The public API is only Exposed via this layer. Majority of WPF is in managed code.
1)   PresentationFramework.dll: - It Holds the top level WPF elements, Including Those That Represents Windows, panels, controls, styles etc.. It implements the aussi end-user presentation features Including time-dependent, story-based animations and data binding.
2)   PresentationCore.dll: - Presentation Core Provides a managed wrapper for MIL and implements the core services for WPF UI Element Such as visual and from Which all shapes and controls derived inPresentationFramework.dll.
3)   WindowsBase.dll: - Holds more basic Elements Which are able To Be Reused outside environment like the WPF Dispatcher Dependency objects and objects.
Unmanaged Layer
1)   milCore.dll: - While the Majority of WPF is managed in layer, the composition engine Which renders the WPF implementation is a native component. It Is Called as Media Integration Layer (MIL) and Resides InmilCore.dll. The purpose of the milcore Directly interface is to provide statement with DirectX and basic medium for 2D and 3D surface. It is the hand of WPF rendering engine and interface is Between DirectX and CLR.
2)   WindowsCodecs.dll: - WindowsCodecs is Another low level API Which is Used For imaging medium in WPF applications like image processing, image displaying and scaling etc.. It comprised of a number of codecs Which encode / decoded image vector graphics Into That Would Be Into WPF rendered screen.
Core Operating System Layer (kernel):
1)   DirectX - DirectX is the low level API-through Which WPF renders all graphics.
2)   User32: - It the primary core Every Which API implementation uses.Actually user32 memory marriages and separation process.

All WPF applications start with Two threads - one for managing the UI and Another background thread for handling the rendering and repainting.Rendering and repainting is managed by WPF and so it does not require Any developer intervention.

Sunday, 3 July 2011

How to prevent from Cross-site scripting attacks on your ASP.NET website?


Hi friends,
Security is major concern for our clients when they ask us to develop their website. Hence we have to take care of  attacks like sql injection and cross-site scripting attacks.
today I come across with a very good library to  prevent our website against cross-site scripting attacks.
Cross-site scripting (which  also called as XSS) attacks occur when an attacker uses a web apps to inject malicious code(mainly scripting), generally in the form of a browser side (means java script injection ), to a different visitor or your site.

Friday, 1 July 2011

How to compress our websites..!!??


Hi friends,
when you have website which has heavy  pages( means all page are loaded with lots of html and css etc...) .It is recommended to compress your website pages while serving. This will decrease your network traffic at your server. To achieve such compression of your website pages while delivering to browser  is done by two way.
 1) By server  setting
 2) do custom coding  in your web application

Wednesday, 29 June 2011

When your client will concern about his db password


Hi friends,

When you get a client who is more technical ,then it accentuate on safety of his critical data. Recently I faced such type of client. When my client went through publish asp.net project on server and he found that our db password inside  web.config ‘s connection string , and  expressed his concern for  it safety of db password. so   he suggested me not to  placed in web.config moreover he asked me to  hardcoded that password in my asp.net code and obfuscate that dll..!!.

Friday, 24 June 2011

A Complete URL Rewriting Solution for ASP.NET 2.0

This article uses regular expressions to specify rewriting rules and resolves possible difficulties with postback from pages accessed via virtual URLs.

Why use URL rewriting?

The two main reasons to incorporate URL rewriting capabilities into your ASP.NET applications are usability and maintainability.


Thursday, 23 June 2011

EB algorithm for Azure Database connection


Hi Friends,
As cloud computing  buzzing now days, so I spend my spare time to do some hand-on code for Window Azure using trial pass and reading related blogs for that
  Then during  my hand-on , once I face the problem of frequent connection failure due to  my Azure db was unavailable for few mins .

XLSExport: A CLR procedure to export proc results to Excel


Introduction

NPOI is a .NET project which can read and write read/write xls, doc, and ppt files without the need for a Microsoft Office installation or license. Formerly on CodePlex, the project is now located on Googlecode at http://code.google.com/p/npoi/.
In this CLR example, I'll use NPOI to create a procedure that takes a stored procedure name and list of parameters and parameter values for that procedure, and outputs an Excel spreadsheet that contains the execution results of that proc to the passed .XLS file specification. The advantage to a CLR solution is that (in addition to lacking an MS Office install or license requirement) ActiveX and COM components are not required on your otherwise pristine SQL Server to accomplish this task.
This procedure supports output data types of CHAR, NCHAR, VARCHAR, NVARCHAR, all numerics, DATE, TIME, DATETIME, DATETIME2, BIT, and BOOLEAN. Other datatype outputs are not currently supported, but are

Extention method for IComparable


Hi friends,
 C# 3.0 gives great feature of extension method. so i keep playing with this. today  I would like to show you something interesting way to use that extension method. This time it's extending IComparable<T>. The API signature for IComparable<T> has been around since the birth of  C language . If the left is less than the right, return something less than 0, if left is greater than right, return something greater than 0, and if they are equivalent, return 0. Well, its readability leaves a bit to be desired.

Tuesday, 21 June 2011

SaaS, Web, Cloud and Mobile enablement of your C/S .NET (Windows Forms) application, is the most cost-effective decision you can make

Visual WebGui is the only technology that can do it. From desktop .NET (C#, VB.NET) into latest .NET based cross-platform HTML5 rich user-interface @ the shortest time to market and the lowest costs and risks.
VWG tool-based code migration tools are currently offered as a service; as a turn-key, or on a work sharing basis with the customers. It includes POC, prototyping, consulting, and "hand holding" support and professional services. The tools will be released in Q2 2011.

how to make common control event for all child control of container

Hi friends
so time in my winform base project, I get scenario where one  to assign a click event handler to all child/dynamic Controls contained in a User Control. This is a good method but I found there was no proper docs for this.

Monday, 20 June 2011

.NET coding standard part - 1

Hello friends, in coding practice there are some coding standards that we should follow to make code more readable and maintainable. I have compiled some coding standards that I have mentioned following.

Naming Conventions and Style

1. Use Pascal casing for type and method names and constants:

public class SomeClass
{
const int DefaultSize = 100;
public void SomeMethod()
{}
}

Server Side Pagination

The paging of a large database resultset in Web applications is a well known problem. In short, you don't want all the results from your query to be displayed on a single Web page, so some sort of paged display is more appropriate. While it was not an easy task in the old ASP, the DataGrid control in the ASP.NET simplifies this to a few lines of code. So, the paging is easy in ASP.NET, but the default behavior of the DataGrid is that all resulting records from your query will be fetched from SQL server to the ASP.NET application. If your query returns a million records this will cause some serious performance issues (if you need convincing, try executing such a query in your web application and see the memory consumption of the aspnet_wp.exe in the task manager). That's why a custom paging solution is required where desired behavior is to fetch only the rows from the current page.

Here I provide some query which provide solution for custom pagination. It helps to improve your search result for your filter data.

Code

As Operator in C#



The as operator is used to perform certain types of conversions between compatible reference types. "As" Operator is also known as a safe cast. What is does is it attempts to cast from one type to another and if the cast fails it returns null instead of throwing an InvalidCastException.


As-casting is equivalent to the following expression except that expression is evaluated only one time.

expression is type ? (type)expression : (type)null

ASP.NET 4.0 Active MarkUp v/s Passive Markup


ASP.NET 4.0 gives us two main flavor of programming style. Active Markup and Passive Markup.
ohh..!! what is this new terminology Active Markup and Passive Mark Markup.. ?!!!. This term you never find on msdn or any Microsoft Evangelist's blog or book. this is new term coin by me for ASP.NET webform and ASP.NET MVC..