Wednesday, March 31, 2010
Cross-Site Access Policy for Self-Hosted WCF Services
Tuesday, March 30, 2010
jQuery
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)
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 SelectorsjQuery 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 SelectorsjQuery 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 SelectorsjQuery 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");
}
Saturday, March 27, 2010
Friday, March 26, 2010
CacheManager dll to control the Caching on ASP.NET
Ref: http://aspalliance.com/
Copy AspAlliance.CacheManager.dll to your application's /bin folder.
Modify your web.config to include an
<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.
Encoding and Decoding using MD5 Alg
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;
Thursday, March 25, 2010
Serialization in .NET
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
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.
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
The Json.NET library makes working with JavaScript and JSON formatted data in .NET simple. Quickly read and write JSON using the JsonReader and JsonWriter or serialize your .NET objects with a single method call using the JsonSerializer.
Features
- LINQ to JSON
- The JsonSerializer for quickly converting your .NET objects to JSON and back again
- Json.NET can optionally produce well formatted, indented JSON for debugging or display
- Attributes like JsonIgnore and JsonProperty can be added to a class to customize how a class is serialized
- Ability to convert JSON to and from XML
- Supports multiple platforms: .NET, Silverlight and the Compact Framework
Ref: http://james.newtonking.com/pages/json-net.aspx
Features
- LINQ to JSON
- The JsonSerializer for quickly converting your .NET objects to JSON and back again
- Json.NET can optionally produce well formatted, indented JSON for debugging or display
- Attributes like JsonIgnore and JsonProperty can be added to a class to customize how a class is serialized
- Ability to convert JSON to and from XML
- Supports multiple platforms: .NET, Silverlight and the Compact Framework
Monday, March 22, 2010
Declarative Programming
All WCF Contracts
- Operation Contracts
- DataMembers
Fault Contracts
Enum Member
Difference between SOAP (Web Service) and REST Protocols
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:
- 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...