Sunday, 12 June 2016

Difference between Viewstate and Sessionstate ?

 Session state is saved on the server, View State is saved in the page.

View State

1.View state is maintained in page level only .
2.View state information stored in client only.
3.View state persist the values of particular page in the client when post back operation done.  
4.Simple implementation View state does not require any custom programming to use.
5.No server resources are required The view state is contained in a structure within the page code.
6.If ViewState grows larger, it affects the performance of garbage collection. 

Session State:

1.Session state is maintained in session level .
2.Sessioan state value is available in all pages within a user session.
3.Session stae information stored in server.
4.A session is defined as a period of time that is shared between the web application and the user. Each user that is using the web application has their own session. 
5.SessionState variables are cleared, when the user session times out. The default is 20 minutes. This is configurable in web.config

 Usage: If you're going to store information that you want to access on different web pages, you can use SessionState If you want to store information that you want to access from the same page, then you can use Viewstate.   

Storage The Viewstate is stored within the page itself (in encrypted text), while the Sessionstate is stored in the server.

Monday, 30 May 2016

Differences Between Hashtable and Dictionary

Dictionary:

  • Dictionary returns error if we try to find a key which does not exist.
  • It is faster than a Hashtable because there is no boxing and unboxing.
  • Only public static members are thread safe.
  • Dictionary is a generic type which means we can use it with any data type.

Hashtable:

  • It returns null if we try to find a key which does not exist.
  • It is slower than dictionary because it requires boxing and unboxing.
  • All the members in a Hashtable are thread safe,
  • Hashtable is not a generic type,

Reference:

http://www.c-sharpcorner.com/blogs/differences-between-hashtable-and-dictionary1

Wednesday, 28 October 2015

What are windows services? How are they differ from other .NET application? How to create Windows Service in c# ?

Microsoft Windows services, formerly known as NT services, enable you to create long-running executable applications that run in their own Windows sessions. These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface. These features make services ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer.


The main difference between a service and an ordinary windows app
  • Services always run (usually started when computer boots; depending on design, you can manually stop or start these)
  • Services have no UI (If you want to show UI from a service, you need to do it via a separate process) and mostly do not interact directly with users
  • Services run in a separate Windows session (mostly, session 0) and, therefore, are (most always) shared between all users of a computer
  • Services may offer recovery actions (what to do on first, second, and subsequent failures)
  • Services are a bit harder to write and especially to debug. Thus, if thinking of writing a service, please consider console app + scheduled task first windows service vs scheduled task
Refer below link :
http://www.aspdotnet-suresh.com/2011/06/creating-windows-service-in-c-or.html

http://www.csharp-examples.net/create-windows-service/

Saturday, 24 October 2015

Fibonacci series

Before start the programming you need to know exactly what is the Fibonacci series, why it comes around the world??



Golden mean:



Program:
/* Fibonacci Series c language */
#include<stdio.h>
 
int main()
{
   int n, first = 0, second = 1, next, i;
 
   printf("Enter the number of terms\n");
   scanf("%d",&n);
 
   printf("First %d terms of Fibonacci series are :-\n",n);
 
   for ( i = 0 ; i < n ; i++ )
   {
      if ( i <= 1 )
         next = i;
      else
      {
         next = first + second;
         first = second;
         second = next;
      }
      printf("%d\n",next);
   }
 
   return 0;
}

Output:


How to improve applications performance which is hosted in cloud ?

Improving the performance of an application hosted in Microsoft Azure involves a combination of optimizing your application code, leveraging...