Tuesday, 17 December 2013

Practical use of Delegate

A Real Life Example of Delegates
Let's say there are three of you. You, your friend, and your brother. You're each in a different room in your house so you can't hear each other, even if you shout.
1)You are playing a computer game
2) Friend is building a puzzle
3) Brother is napping
Now, you three are going to stay in your room but you want to be informed if anything interesting is happening to the one of you. Let's say you (playing the computer game) want to know when your brother wakes up.
You could keep walking to the room, checking to see if he's napping, and then walking back to your room. But that would waste a lot of time / resources, and what if you miss when he's awake before he goes back to sleep? That would be bad.
Instead, you hand him a 2-way radio that works between your room and his room. And you inform him that when he wakes up, he should press a button on the radio and say "I'm awake". You are going to be listening to that radio, waiting for him to say he's awake. This, in essence, is how a delegate works.
You're creating an "object" (the radio) that allows you to listen in on an event you specify. You don't want him to send any other messages to you right now, except when he wakes up. And you want to know immediately when he does, so you can go over to his room and say hi. (the methods that are called when a delegate event fires). You're also currently specifying that only you are listening on his radio.
Let's say you want your friend to come into the room at the same time as you, and do something else entirely, like fluff your brother's pillow. You will then give him an identical radio, that also hooks into your brother's radio, and inform him to wait and listen for the "i'm awake" signal.
Then, when your brother wakes up, he says "I'm awake!" and both you and your friend walk into the room. You say hi, and your friend fluffs the pillow, then you both exit.
Later, if you decide you don't care to say hi anymore, you turn off your radio. Now, you have no idea when your brother is awake or not, because you aren't listening anymore.
So again, you are each classes in this example, and each of you have your own methods. You're playing a computer game (PlayComputerGame()), your friend is building a puzzle (BuildPuzzle()) and your brother is napping (Napping()).
You create a delegate (ImAwake) that you set your brother to do, when he wakes up. You listen in on that delegate (giving yourself a radio and turning it on), and when you receive the message, you fire a new method called SayHi()). Your friend is also wired up to the same delegate (using an identical radio) and fires the method FluffPillow().

Monday, 2 December 2013

ASP.NET Web Services Versus WCF Services

1 File Format/Extension :
i) ASP.net service - '.asmx'
ii) WCF service - '.svc'
2 Hosting :
i) ASP.net service - Can be hosted in IIS also can be hosted in a Windows Service.
ii) WCF service - Very flexible, can be hosted in IIS, Windows Activation Services(WAS), Managed Windows Services and It also supports Self-Hosting.
3 Transport Protocols/Binding :
i) ASP.net service - It supports HTTP & TCP protocols along with custom binding.
ii) WCF service - supports HTTP, WS-HTTP, TCP, Custom, Named Pipes, MSMQ & P2P(Point to Point) etc.
4 Data Transformation :
i) ASP.net service - XML serializer for Data Transformation.
ii) WCF service - DataContractSerializer for Data Transformation.
5 Serialization NameSpace :
i) ASP.net service - System.XML.Serialization
ii) WCF service - System.RunTime.Serialization
6 Supported Operations :
i) ASP.net service - only One-Way and Request-Response type.
ii) WCF service - Includes One-Way, Request-Response and Duplex.
7 Encoding :
i) ASP.net service - It uses following encoding mechanisms -
XML1.0, MTOM (Message Transmission Optimization Mechanism), DIME (Direct Internet Message Encapsulation)
ii) WCF service - It uses following encoding mechanisms -
XML1.0, MTOM, Binary

Wednesday, 23 October 2013

Failed to create Designer from any web Server Control

For this type of problem you should use same assembly version number in web.config file and add same version assembly in add reference  and use same version assembly in aspx page

<%@ Register assembly="Infragistics4.Web.v13.1, Version=13.1.20131.2157, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.GridControls" tagprefix="igtbl" %>

then version number  13.1.20131.2157 should be same at three places defined above
Web.config File
Add Reference
Aspx Page

Potential Dangerious Request

a potentially dangerous request.form value was detected from the client in asp.net 4.0

Solution :: In web.config file under System.Web write

<compilation debug="false" targetFramework="4.0" /> 
 <httpRuntime requestValidationMode="2.0"/>

Thursday, 10 October 2013

Repeater control implementation by tarun developer

dataconnectivity u can give on page load event  means connectionstring

<asp:Repeater ID="Repeater1" runat="server">
            <HeaderTemplate>
<table border="1" width="100%">
<tr>
<th>name</th>
<th>userID</th>
<th>password</th>
<th>dob</th>
</tr>
</HeaderTemplate>

<ItemTemplate>
<tr>
<td><%#DataBinder.Eval(Container.DataItem,"name")%></td>
<td><%#DataBinder.Eval(Container.DataItem,"userID")%></td>
<td><%#DataBinder.Eval(Container.DataItem,"password")%></td>
<td><%#DataBinder.Eval(Container.DataItem,"dob")%></td></tr>
</ItemTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

        </asp:Repeater>

name ,userID,password,dob are table columns in database

Thursday, 26 September 2013

Delete Duplicate Records from Table in SQL SERVER

DELETE FROM emp WHERE ID NOT IN (SELECT MIN(ID) FROM emp GROUP BY FName)

delete from tableName where UniqueColumn NOT IN (select MIN(UniqueColumn) from tableName GROUP BY DuplicateRecoedColumn/DeletedDuplicateColumn)

Monday, 2 September 2013

Visual Studio Classification

 http://en.wikipedia.org/wiki/Microsoft_Visual_Studio

Editions feature grid

Editions feature grid[52]
Product Extensions Projects templates MSDN integration Debugging Profiling Static analysis IntelliTrace Unit test Code coverage Coded UI test Test impact analysis Load testing Lab management Architecture and modelling Windows Phone development
Express Yes Limited Essential Yes No No No No No No No No No No Yes
Professional Yes Yes Full or Essentials Yes No No No Yes No No No No No No Yes
Premium Yes Yes Full Yes Yes Yes No Yes Yes Yes Yes No No Read-only Yes
Ultimate Yes Yes Full Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes
Test Professional No No Full No No No No No No No Yes No Yes No No

Version history

Prior to Visual Studio Version 4.0, there were Visual Basic 3, Visual C++, Visual FoxPro and Visual SourceSafe as separate products.
Product name Codename Internal
version
Supported .NET
Framework versions
Release date
Visual Studio N/A 4.0 N/A 1995-04
Visual Studio 97 Boston 5.0 N/A 1997-02
Visual Studio 6.0 Aspen 6.0 N/A 1998-06
Visual Studio .NET (2002) Rainier 7.0 1.0 2002-02-13
Visual Studio .NET 2003 Everett 7.1 1.1 2003-04-24
Visual Studio 2005 Whidbey 8.0 2.0, 3.0 2005-11-07
Visual Studio 2008 Orcas 9.0 2.0, 3.0, 3.5 2007-11-19
Visual Studio 2010 Dev10/Rosario 10.0 2.0, 3.0, 3.5, 4.0 2010-04-12
Visual Studio 2012 Dev11 11.0 2.0, 3.0, 3.5, 4.0, 4.5 2012-09-12
Visual Studio 2013 Dev12 12.0 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1 Upcoming