Here I am posting the important questions whatever I have faced in my interviews. (Few of the contents & links have been taken from various blogs/articles.) Hope it will help you..
Monday, 14 December 2015
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.
http://www.csharp-examples.net/create-windows-service/
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.htmlhttp://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:
Thursday, 15 October 2015
Saturday, 5 September 2015
Tuesday, 26 May 2015
Passing values between Asp.Net pages
If your Asp.Net
application navigates from one Web page to another Web page, you should
aware of how to pass information from the source page to the destination
page. You can implement various methods to pass information between
Asp.Net WebPages and these methods depend on how the redirection occurs.
Using a query string is the most popular way of
passing information between asp.net web pages, the other methods are Use
session state , Get HTTP POST information from the source page , Create
public properties in the source page and access the property values in
the target page and Get control information in the target page from
controls in the source page. Some of the popular methods are follows
with examples.
Query String
is a group of keywords that send request to the web server. These
requests specified by the values following the ? (question mark). The ?
(question mark)is used as a separator and it is not part of the query
string.
e.g.
http://aspserver/program/path/?query_string
Passing single value
http://net-informations.com.com/page1.aspx?field1=value1
Passing multiple values
http://net-informations.com.com/page1.aspx?field1=value1&field2=value2
How to retrieve Query String values in the target page ?
string value1 = Request.QueryString["field1"];
string value2 = Request.QueryString["field2"];
Passing single value
http://net-informations.com.com/page1.aspx?field1=value1
Passing multiple values
http://net-informations.com.com/page1.aspx?field1=value1&field2=value2
How to retrieve Query String values in the target page ?
string value1 = Request.QueryString["field1"];
string value2 = Request.QueryString["field2"];
When the source Asp.Net page uses the HTTP POST action redirect to the target page, you can retrieve posted values from the Form collection in the destination page.
e.g.
In the source page include a form element that
contains a TextBox and a button control that post values when the form
is submitted.
Set the PostBackUrl property for the control to the URL of the page to which you want to post the ASP.NET Web page
The following source code explains a Button
control that is configured to post to a page named destination.aspx in
the root of the Asp.Net Web site.
After the submit, we can retrieve value using Request.Form["ControlID"] at the target page.
Label1.Text = "Submitted Value: " + Request.Form["Textbox1"].ToString();
Information in the Asp.Net session state
is available to all ASP.NET Web pages in the current application. It
takes server memory, and the information is stored until the session
expires, which can be more overhead than you want for simply passing
information to the next page.
In the source page you can set the session values like the following:
Session["field1"] = "value1";
In the destination page you can read the saved session values like the following:
string field1 = (string)(Session["field1"]);
What is IsPostBack?
IsPostBack
Postback is actually sending all the information
from client to web server, then web server process all those contents
and returns back to the client. Most of the time ASP control will cause a
post back (e. g. buttonclick) but some don't unless you tell them to do
In certain events ( Listbox Index Changed,RadioButton Checked etc..) in
an ASP.NET page upon which a PostBack might be needed.
IsPostBack is a property of the Asp.Net page that
tells whether or not the page is on its initial load or if a user has
perform a button on your web page that has caused the page to post back
to itself. The value of the Page.IsPostBack property will be set to true
when the page is executing after a postback, and false otherwise. We
can check the value of this property based on the value and we can
populate the controls on the page.
Is Postback is normally used on page _load event
to detect if the web page is getting generated due to postback requested
by a control on the page or if the page is getting loaded for the first
time.
C# Source Code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// generate form;
}
else
{
//process submitted data;
}
}
Monday, 6 April 2015
Notification Services in SQL Server 2005
SQL Server Notification Services is used for developing and deploying applications that generate and send notifications. Notifications are personalized messages sent to a device that subscribes to them. A subscription defines the preference of the subscriber for a specific type of event. For example, a subscriber can specify a preference to the notification application such as “Notify me when new content is added to the Web site.” The notification application in this example is the Web site. The subscriber could be the editor of the Web site or someone responsible for managing its content. The triggering event is the addition of new content. Thus, a notification will be sent to the subscriber when the triggering event occurs. The notification can be scheduled on a weekly, daily, or hourly basis. SQL Server Notification Services can be used to send a notification to a wide variety of devices, such as a subscriber’s cell phone, personal digital assistant (PDA), Windows Messenger or e-mail account.
Terminologies in Notification services
- Subscriber is a person or application that subscribes to and receives notifications.
- Subscription is a request for specific information to be sent to an e-mail address or a device.
- Event is a piece of information that the subscriber may be interested in. The triggering event can be something like an increase or decrease in the price of a stock.
- Notification is a message that contains information about the triggering event.
There are three major pieces to each notification service. Let’s briefly define and explain each.
Events
For a notification to be sent, there has to be some form of trigger. In SQL NS such a trigger is defined as an “Event”. Events can be triggered by certain actions, or they can be in time intervals, it’s up to the designer. All of the events for a notification service can be defined in the ADF for the service.
An example of an event might be that bob wants to know when his flowers were delivered to his girlfriends house, so he subscribes to the notification service that the flower shop provides. The flower shop has defined an event in their service that generates a notification when the delivery person calls in to confirm delivery. Once the event is generated, the notification is created and delivered to bob via SMS messaging.
An example of a timed event might be that a sale person from XYZ corp. needs an updated contact list each morning before he starts his day. An event is created in the notification services that creates a notification with his updated contact list and sends it to his mobile phone in the form of a smart messaging SMS message. With the press of a button, he accepts the message and his contact list is updated.
Events are created in many ways, most commonly they are pulled from SQL databases, or system logs. When the event is defined in the ADF the method for retrieving the event data is also defined.
Notifications
A notification is the actually data that is sent to a subscriber, it is basically a formatted form of the data that was retrieved when the event that goes with this notification was fired. The contents and format of the notifications that a service supports are defined in the ADF.
Microsoft has provided an XSLT content formatter to make our lives easier in respect to notifications. It allows us to apply an XSLT transform to the raw notification data. This allows us to easily prepare a notification for display to a subscriber.
Subscriptions
A subscriber is the actual real end user of the notification service, this is the guy who wants to be notified of his rising stock so he can buy his yacht. When SQL NS creates the notification service, it creates in SQL Server a database that is just for holding subscriber information. To add subscribers, the developer needs to create some sort of a subscription application, this may sound kind of like being left out cold, but that is not the case. The subscription application is left fully to the imagination of the designers of the service, but Microsoft has provided some tools that make it much easier to build. We don’t have to know the full ER model of the subscription database because we can simply utilize the managed components Microsoft has provided for us to add subscribers.
So, simply create an application for gathering the required information from a subscriber, and use the classes provided in the
Microsoft.SqlServer.NotificationServices namespace. (note these are .NET classes)
Subscribers can choose the events they want to subscribe to, the format of the notifications they want, and even the media they want notifications sent to, and yes they can even choose more than one.
Of course all these features don’t program themselves, but they can easily be added to a service once you have a good handle on build ADFs. Notification services range from the very simple to the extremely complex. You can build one in a day or in a month. It all just depends on what is required for your situation.
Ref:
Subscribe to:
Posts (Atom)
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...
-
Connection pool is the collection of new, open and all type of database connections. Opening database connection is a time consuming op...
-
alert() dialog The alert() dialog box is used to communicate a message to the user (generally warnings of missed actions). For example, ...
