Thursday, December 9, 2010

HTML5 client local storage

Most talked feature of html5 is storing data on client side. This could be achieved in 3 ways.
  1. Session storage.
  2. Local storage
  3. Database storage
Session storage: This is more like a upgraded version of a cookie. It persists only during browsing and once window is closed data is lost. This is easy to implement.
sessionStorage.setItem('shoppingId', '23234')
alert("Shopping Id is: " + sessionStorage.getItem('shoppingId'));
//same thing could also be achieved with sessionStorage.shoppingId

//to remove
sessionStorage.removeItem('shoppingId');




Saturday, November 13, 2010

High Performance Client side technology tweaking for a website

When a page is rendered a typical browser subsystems used and there Best Practices

1. Networkingcompress network traffic with gzip and not compress not
  • Images because they are already compressed.
  • Providing cache able content
  • Conditional Requests
  • Minifing Javascript
  • Don't scale images on the html. Crop to the required size before setting it on the html.
  • Use Image sprites.
2. HTML Parser
  • Avoid Inline Javascript
  • Avoid Linking javascript in head tag
  • Link javascript at end of the body tag, But if required use it with 'defer' tag.
3. CSS ParserAvoid Embedded styles.
  • Counter to Js files use Css linking in the head tag.
  • Avoid @import tag in CSS files but if required for cascading or hierarchical style sheet use it with link tag on the page.
4. Collections
5. Javascript
  • Minimize symbol resolution










  • Minimizing symbol resolution for functions
  • Use JSON Native methods

6. Marshalling
  • Minimize DOM interaction.. Retreive all the DOM elements in one call like
    var elems = document.body.all                                                    
    var lside = elems.lside.value;                                                      
    var rside = elems.rside.value;  
7. DOM
  • Built in methods are always effective.
  • Use selector API's for efficient access of collections (CSS Selectors)
8. Formatting
  • Only send required styles.
  • Simply selector pattern. Avoid Descendent selectors
9. Block Building 10. Layout 11. Rendering --> Layout Optimization
  • Batch Visual Changes

Saturday, August 28, 2010

Sunday, August 15, 2010

RDBMS

  • A relational database is well designed if you can reconstruct the predicates (and propositions) used to describe the business problem.
  • Normalization is a redesign process to unbundle the entities. The process involves decomposition but not decomposition that leads to a loss of information.
  • The goal of normalization is to eliminate redundancy and incompleteness.
  • The first normal form (1NF) says that a table is in fi rst normal form if all columns are atomic. No multivalued columns are allowed. Note that the 1NF defi nition simply states that a table must represent a relation.
  • Second normal form (2NF) a table must be in 1NF and every nonkey column must be functionally dependent on the entire key that means decomposition means creating new tables, not just new rows like in 1NF. To achieve 2NF, you need to decompose the table into two or more tables.
  • third normal form (3NF) a table must be in 2NF, and every nonkey column must
    be nontransitively dependent on every key. In other words, nonkey columns must be mutually independent. (Example)
  • Boyce-Codd normal form (3.5 NF): It is stronger version of 3NF. A 3NF table which doesn't have multiple overlapping candidates keys is guaranteed to be in BCNF. If A--->B and A--->C but B and C are unrelated, ie A--->(B,C) is false, then we have more than one multi-valued dependency.
  • Ref: http://support.microsoft.com/kb/283878

SQL Links

Sunday, May 30, 2010

ASP.NET MVC

simple beginner MVC application







Get Microsoft Silverlight

Sunday, May 16, 2010

Enterprise Library

  • Reference proper assemblies based what block we need to use.
  • Go to web.config or app.config or the configuration file and properly configure them.
  • Easy way to use a block is to use facade class.
  • Always reference common.dll and objectbuilder2.dll

Thursday, April 8, 2010

Inversion of Control (IoC) pattern or Dependancy Injection (DI)

Using object-oriented design principles and features such as interface, inheritance, and polymorphism, the IoC pattern enables better software design that facilitates reuse, loose coupling , and easy testing of software components.

Def of DI: Instead creating an new object every time we call the container which will create the object of that class for us.

Injection or Imposing a Dependacy (called an object b or can be a Property, method also) on the De pendant class A through a container or IoC Framework is called DI.

Ref: http://www.dotnetspark.com/kb/266-inversion-control-ioc-and-dependency-injection.aspx

Wednesday, April 7, 2010

Enterprise Library 3.0

Validation Application Block
Ref:http://www.codeproject.com/KB/aspnet/Questpond.aspx

Hosting in IIS 7

Hosting a web application

1. Add user called IIS_IUSRS or go to application pool -> advanced settings -> In Process model we have Identity change it local system.

2. change authentication to None in web.config file.

Hosting a WCF Application

1. Click the Start button, and then click Control Panel.

2. Click Programs, and then click Programs and Features.

3. On the Tasks menu, click Turn Windows features on or off.

4. Find the .NET Framework 3.5 node, select and then expand it.

5. Select the WCF Http Activation Components box and save the setting.

6.change authentication to None in web.config file.

Tuesday, April 6, 2010

Code Access Security (CAS)

CAS is part of .NET security model that determines whether a piece of code is allowed to run and what resources it can use while running. Example CAS will allow an application to read but not to write and delete a file or a resource from a folder..

Boxing and Unboxing

Boxing and unboxing act like bridges between value type and reference types. When we convert value type to a reference type it’s termed as boxing. Unboxing is just vice-versa. When an object box is cast back to its original value type, the value is copied out of the box and into the appropriate storage location.

Below is sample code of boxing and unboxing where integer data type are converted in to object
and then vice versa.

int i = 1;
object obj = i; // boxing
int j = (int) obj; // unboxing


Value types directly contain their data that are either allocated on the stack or allocated in-line in a structure. So value types are actual data.

Reference types store a reference to the value's memory address, and are allocated on the heap. Reference types can be self-describing types, pointer types, or interface types. You can view reference type as pointers to actual data.

Variables that are value types each have their own copy of the data, and therefore operations on one variable do not affect other variables. Variables that are reference types can refer to the same object; therefore, operations on one variable can affect the same object referred to by another variable. All types derive from the System. Object base type.

Garbage collection in .Net

Garbage collection is a CLR feature, which automatically manages memory. Programmers forget
to release the objects while coding ... Laziness (Remember in VB6 where one of the good
practices is to set object to nothing). CLR automatically releases objects when they are no longer
in use and refernced. CLR runs on non-deterministic to see the unused objects and cleans them.
One side effect of this non-deterministic feature is that we cannot assume an object is destroyed
when it goes out of the scope of a function. We should avoid using destructors because before GC
destroys the object it first executes destructor in that case it will have to wait for code to release
the unmanaged resource. This results in additional delays in GC. So it is recommended to
implement IDisposable interface, write cleanup code in Dispose method, and call
GC.SuppressFinalize method. Its like instructing GC not to call your constructor.

Difference between a namespace and assembly

Namespace: It is a Collection of names wherein each name is Unique.
They form the logical boundary for a Group of classes.
Namespace must be specified in Project-Properties.


An assembly
An assembly is the primary building block of a .NET Framework application. It is a collection of functionality that is built versioned and deployed as a single implementation unit (as one or more files

1) It is an Output Unit.
2)It is a unit of Deployment & a unit of versioning.
3)Assemblies contain MSIL code.
4)Assemblies are Self-Describing. [e.g. metadata,manifest]
5)An assembly is the primary building block of a .NET Framework application.
6)It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files).
7)All managed types and resources are marked either as accessible only within their implementation unit, or by code outside that unit.

IIS and the Process Model

Ref: http://dotnetslackers.com/articles/iis/ASPNETInternalsIISAndTheProcessModel.aspx

The IIS 5.0 Process Model












The IIS 6.0 Process Model

Tuesday, March 30, 2010

Events and Delegates

Ref: http://www.akadia.com/services/dotnet_delegates_and_events.html

Silverlight videos

Creating and calling a WCF and webservice

navigation-framework

jQuery

Ref: http://www.w3schools.com/jquery/default.asp

Ref2 : http://msdn.microsoft.com/en-us/magazine/dd453033.aspx

jQuery Syntax

The jQuery syntax is tailor made for selecting HTML elements and perform some action on the element(s).

Basic syntax is: $(selector).action()

  • A dollar sign to define jQuery
  • A (selector) to "query (or find)" HTML elements
  • An jQuery action() to be performed upon the element(s)
In HTML DOM terms:

Selectors allow you to manipulate DOM elements as a group or as a single node.

jQuery Syntax Examples

$(this).hide()
Demonstrates the jQuery hide() function, hiding the current HTML element.

$("#test").hide()
Demonstrates the jQuery hide() function, hiding the element with id="test".

$("p").hide()
Demonstrates the jQuery hide() function, hiding all

elements.

$(".test").hide()
Demonstrates the jQuery hide() function, hiding all elements with class="test".

The Document Ready Function

You might have noticed that all jQuery functions, in our examples, are inside a document ready function:

$(document).ready(function(){

--- jQuery functions go here ----

});

This is to prevent any jQuery code from running before the document is fully loaded (is ready).

jQuery Selection

jQuery Element Selectors

jQuery uses CSS style selectors to select HTML elements.

$("p") selects all

elements

$("p.intro") selects all

elements with class="intro".

$("p#demo") selects the

element with id="demo".

jQuery Attribute Selectors

jQuery uses XPath style selectors to select elements with given attributes.

$("[href]") select all elements with an href attribute.

$("[href='#']") select all elements with an href value="#".

$("[href!='#']") select all elements with an href attribute<>"#".

$("[href$='.jpg']") select all elements with an href attribute containing ".jpg".

jQuery CSS Selectors

jQuery CSS selectors can be used to change CSS properties for HTML elements.

$("p.intro").css("background-color","yellow");

jQuery Reference - Selectors


ref: http://www.w3schools.com/jquery/jquery_ref_selectors.asp

jQuery Reference - Effects

ref: http://www.w3schools.com/jquery/jquery_ref_effects.asp

jQuery Callback Functions

$("button").click(function(){
$("p").hide(1000,my_alert);
});
function my_alert()
{
alert("The paragraph is now hidden");
}

Friday, March 26, 2010

Convert Html code to displayable text

http://www.felgall.com/htmlt47.htm

CacheManager dll to control the Caching on ASP.NET

CacheManager.v1.0.60115.01 Download

Ref: http://aspalliance.com/

Copy AspAlliance.CacheManager.dll to your application's /bin folder.
Modify your web.config to include an section with the following element:


<httphandlers>

<add verb="*" path="CacheManager.axd" type="AspAlliance.CacheManager.CacheManagerPageFactory,AspAlliance.CacheManager">

</httphandlers>



refer through http://localhost/cachemanager.axd

NOTE:
1. If we dont need Viewstate for large gridviews disable it. It will give lot performance again. and enabling Caching (1sec) for the page gives is awesome and not always.
2. Make use of cache profile in Outputcache while declaring it from the web.config file.
3. sqldependency on the database to enhance caching ways. sqldependency is imposed on the tables so that when ever there is update happening on the table its will directly show on the web page even though caching set to take from the system cache. This can be done using aspnet_resql.

3.

Advanced .NET Videos

http://www.dnrtv.com/archives.aspx

http://www.dotnetrocks.com/

Encoding and Decoding using MD5 Alg

Encoding ascii = Encoding.ASCII;
Byte[] originalBytes;
Byte[] encodedBytes;
MD5 md5 = new MD5CryptoServiceProvider();
originalBytes = ascii.GetBytes(TextBox1.Text);
encodedBytes = md5.ComputeHash(originalBytes);
lblMD5.Text = ascii.GetString(encodedBytes);

Namepaces required
System.Text
System.Security.Cryptography
System.Data;

Test Driven Development Using NUnit in C#

Ref: http://aspnet.4guysfromrolla.com/articles/011905-1.aspx

Visual Studio shortcuts

Ref: http://www.dofactory.com/ShortCutKeys/ShortCutKeys.aspx

Thursday, March 25, 2010

Serialization in .NET

Ref: http://aspalliance.com/983_Introducing_Serialization_in_NET.all

Def: Serialization is a process of converting an object into a stream of data so that it can be is easily transmittable over the network or can be continued in a persistent storage location. (or)
Serialization is the process of saving the state of an object in a persistent storage media by converting the object to a linear stream of bytes.

Serialization in .NET is provided by the System.Runtime.Serialization namespace.

The Serializable Attribute


In order for a class to be serializable, it must have the attribute SerializableAttribute set and all its members must also be serializable, except if they are ignored with the attribute NonSerializedAttribute. However, the private and public members of a class are always serialized by default. The SerializationAttribute is only used for the binary serialization.

Types of Serialization

·
Binary Serialization

· SOAP Serialization

· XML Serialization

· Custom Serialization




Tuesday, March 23, 2010

SSIS Tutorials

it's the solution for automating SQL Server.
SSIS provides a way to build packages made up of tasks that can move data around from place to place and alter it on the way.

Creating a Package using
BIDS

  • Connections to data sources.
  • Data flows, which include the sources and destinations that extract and load data, the transformations that modify and extend data, and the paths that link sources, transformations, and destinations.
  • Control flows, which include tasks and containers that execute when the package runs. You can organize tasks in sequences and in loops.
  • Event handlers, which are workflows that runs in response to the events raised by a package, task, or container.
SSIS uses connection managers to integrate different data sources into packages.

connection manager depends on what type of data sources we are dealing with.
for connecting ADO record set we have to use ADO connection manager
ADO.NET data source we have to use ADO.NET connection manager.

The Control Flow tab of the Package Designer is where you tell SSIS what the package will do.

Ref: http://www.accelebrate.com/sql_training/ssis_tutorial.htm

JSON.NET

Monday, March 22, 2010

Declarative Programming

Declarative programming is when we use XML to create the Config files and based on these configuration web pages displayed and any changes can be made on this XML file (config file) to change the settings.

All WCF Contracts

Service Contract
  • Operation Contracts
Data Contract
  • DataMembers
Message Contracts

Fault Contracts

Enum Member

Difference between SOAP (Web Service) and REST Protocols

1.REST has no WSDL interface definition

2. REST is over HTTP, but SOAP can be over any transport protocols such HTTP, FTP, STMP, JMS etc.

3. SOAP is a protocol for sending/receiving data over HTTP as XML. It uses soap envelope over XML , but REST is just XML.

REST(HTTP GET) keeps the state and SOAP is a stateless.
REST is asynchronous.

Business Entity or Object

  • A business object is an object that represents a real-world entity such as a person, place, or
  • business process.
  • Business objects bring together both the characteristics and behavior of a particular entity.
  • One of the primary jobs of a business object is to enforce business rules. Business rules fall
    into two broad categories:
1. Data integrity rules – This encompasses rules that enforce things such as required
fields, field lengths, ranges, and so on.
2. Domain rules – This refers to high-level business rules such as “You can’t create an
invoice for a client who is over their credit limit”.
  • Business objects are created as a separate layer as a dll and will be available across UI, Business layer and Data access layer.
  • Now more adv... Business objects are made available using WCF services instead of dll. so that all the projects would be same page...