Saturday, 3 August 2013

Delegates in c#.net

This also called as c++ function pointer.This will maintain address of subprogram.
1.In c++ function pointer is an ordinary statement ,it is no provided with object oriented approach
2.It  can not maintain address of number function
3.It is not type safe,it will not display parameter names and data types of parameters
The solution in .net is delegate concept

What is delegate?
Delegate is a user defined type in .net to maintain address of subprogram.It acts like a function pointer
Delegate can be classified in to 2types
1.Single case Delegate
Delegate maintaining the address of one subprogram is called single cast delagate
Delegate maintaining the address of more than subprogram is called single cast delagae

Implementation of Delegate
It implementation requires three steps
1.Declaring Delegate type
private/public Delegate sub function delagate (param1,..)
Delagate keyword is provided to create Delegate type and it can be subprogram type function type
2.Delegate variable holding subprogram address:
The Delegate variable can maintain address of subprogram ,where sub program type and signature should match with Delegate type
int *p;
float b=20;p=&b-->no accepted
In this case p can hold the address of only integer type variable
3.calling subprogram using Delegate variable

Wednesday, 31 July 2013

Methods of thread class in .net

The last article has given how the thread being work and what is it.Then we need to know methods which are existing in Thread class.These are used to implement the threads in .net environment.To enable these methods we have to add one name space "System.Threading"to application
1.Start()-->It will start the thread execution["Thread is ready for execution]
2.Current Thread()-->Shared method .It will return thread under execution
3.Sleep(millisecond)-->It will halt thread execution for particular milliseconds
4.suspend()-->It will halt thread execution
5.Resume()-->It will start thread execution which is halted using suspend
6.Method abort();It will stop thread execution(Killing thread execution]
7.Priority:The thread has 3 properties,Which are High,Abnormal,Normal,Below normal,Low
The priority will specify importance /weight-age for thread.The thread with more priority will be given more CPU cycles to finish task quickly

Tuesday, 30 July 2013

multi threading in c# asp.net

1.Thread is a unit of code maintaining its own execution path.
2.The application process with one execution is called single Thread application"
3.The application process with more than one execution path is called "Multi-thread application"
4.CLR will create main thread for .net application process
Example of multi-thread application is ms word

Multithreading is recommended when the application is having a task which can be finished with out user interaction will improve performance of application.The task can be printing job,database connectivity processing client requests to wards server base application

Remoting activation models in .net

Remoting activation model will specify when the object to created where the object to be maintained ,how long the object to be maintained,object to communicate to all the client/unique to client
1.If it is model by value server application will create an object and object will be transmitted to client application.In this case method call's execution will be  in client system.The method execution can not access server side resource like database
2.If it is Marshal by Reference the object will be maintained by server app and reference will be maintained by client system,In this case method call,s the execution will be on server system,This allows accessing Resources
3.Client application making a request to method will create object in server application is called "SAO{server activated Object]"
4.If it is single ton Object,The object will be maintained by server application for serving to other clients,This provides application level state maintaining data common to all the clients.The timeout of single to object is 5 min by default
5.Client application making a call using "New" operator or create instance method of activator class will create an object with in server application is called "Client Activation Object"
6.CAO will maintain data unique to client

Monday, 29 July 2013

Advantages of 3-tier Architecture

1.Less burden on database server[Balancing Load on different system]
2.Less financial investment[Only client side license of data base will be purchase
3.Security resources[Like database] from client
4.Maintenance will be easier[migrating from one database to other database required changes in business layer,it does not require changes in presentation layer,this makes maintenance easier]
5.When business logic maintained on different system it is called "n-Architecture"
Different companies are providing different technologies to implement 3-tier architecture[i:e distributed app development]
i)RPC(Remote Procedure call]this old implements with 'c' language
ii)RMI(Remote method Invocation]this is supported by java
iii)DCOM(Distributed Com)
iv)CORBA{common object request broken Architecture],It is supported by different companies support from Microsoft

Dcom comes with problems
->It supports Microsoft apps communication only under windows network
->It supports only network based implementation ,it doesn,t support internet based implementation
->It implementation supports only client activated implementation,where unique object will be created towards each client,will be burden to server system in certain cases
That solution in .net i 3 things
1.Remoting
2.Web servers
3.Wcf

Thursday, 25 July 2013

populate Asp.net textbox using jquery

As we discuses as the java script is client side programming,But j query is library which is built using java script .Here we need to observe how to get the id of the text box using jquery in asp.net.The one thing we remember when we working with Jquery is"Include the  Library to application".With out add reference we can't perform the  functionality.The below example will show how to populate text box using blur event.When the cursor leaves the first text box the then other one will  be populate.
<html>
<head>
<script type="text/javascript" src="~/jquery-1.4.3.min.js" ></script>
<script type="text/javascript">
$(document).ready(function() {
$("#<%= txtBName.ClientID %>").blur(function(){
var BName = $(this).val();
$("#<%= txtBRname.ClientID %>".val(BName);  

});
});
</script>
</head>
<body>
Enter Book name: <asp:TextBox ID="txtBName" runat="server"></asp:TextBox>
Enter Again:<asp:TextBox ID="txtBRname" runat="server"></asp:TextBox>
</body>
</html>

Wednesday, 24 July 2013

populate textbox with other textbox value in asp.net using javascript

In this articles i will explain about one more standard web control. This control is used to enter the data or can take data from user i:e Text Box.In asp.net Text box has properties to restrict the Lines of data which is Tex Mode property(Single Line and MultiLine).The following example shows how to populate text box with other text box value using Java Script.
                                           Java Script is client side programming which has an event "onblur" to focus functionality.In java script we can't get control value directly.If you want to get the control value,First we need to get the control id using "getElementById" then we can get the value as result.In the above example i have used two text box controls .When the focus has come to second text box ,it will be filled with first Text Box.
<html>
<head>
<script>
function AppendDataToOtherTextBox()
{
var BName=document.getElementById("BooKName");
var BBN=document.getElementById("BooKName1");
BBN.value=BName.value;
}
</script>
</head>
<body>
Enter Book name: <input type="text" id="BooKName" onblur="AppendDataToOtherTextBox()">
Blur Field: <input type="text" id="BooKName1">
</body>
</html>