Saturday 28 July 2012

whatisSQLandwheredoesitcome from?


what is SQL and where does it come from?

Structured Query Language (SQL) is a language that provides an interface to relational database systems. The proper pronunciation of SQL, and the preferred pronunciation within Oracle Corp, is "sequel" and not "ess cue ell".
SQL was developed by IBM in the 1970s for use in System R, and is a de facto standard, as well as an ISO and ANSI standard.
In common usage SQL also encompasses DML (Data Manipulation Language), for INSERTs, UPDATEs, DELETEs and DDL (Data Definition Language), used for creating and modifying tables and other database structures.
The development of SQL is governed by standards. A major revision to the SQL standard was completed in 1992, called SQL2. SQL3 support object extensions and are (partially?) implemented in Oracle8 and 9i.
Example SQL statements:
CREATE TABLE table1 (column1 NUMBER, column2 VARCHAR2(30));
INSERT INTO table1 VALUES (1, 'XYZ');
SELECT * FROM table1 WHERE column2 = 'XYZ';

Friday 27 July 2012

Whatis the use of command objects?



What is the use of command objects?
They are used to connect connection object to Data reader or dataset. Following are the methods provided by command object:-
ExecuteNonQuery: Executes the command defined in the Command Text property against the connection defined in the Connection property for a query that does not return any row (an UPDATE, DELETE, or INSERT). Returns an Integer indicating the number of rows affected by the query.
ExecuteReader: Executes the command defined in the Command Text property against the connection defined in the Connection property. Returns a "reader" object that is connected to the resulting row set within the database, allowing the rows to be retrieved.
ExecuteScalar: Executes the command defined in the Command Text property against the connection defined in the Connection property. Returns only single value (effectively the first column of the first row of the resulting row set any other returned columns and rows are discarded. It is fast and efficient when only a "singleton" value is required

Difference between WCF and Web services?

Difference between WCF and Web services?
 

1.Web Services can be accessed only over HTTP 
2.Web Services works in stateless environment
 
WCF is flexible because its services can be hosted in different types of applications. The following lists several common scenarios for hosting WCF services: 1. IIS
 
2. WAS
3. Self-hosting
4. Managed Windows Service

webservices

1. What are Windows services?
Windows services, previously known as NT services, are applications that are installed on the system as system services. In other words, Windows services are applications that run in the background with the Windows operating system. The primary use of Windows services is to reduce the consumption of memory required for performing backend operations. Let's take an example to understand this easily. Suppose you want to perform a variety of functions, such as monitor the performance of your computer or application, check the status of an application, and manage various devices, such as printers.

        In such a case, you can use Windows services to reduce memory consumption. In addition, Windows services can run on your system even if you have not logged on to your computer. In addition, these services do not have any user interface.

2. Can you share a process between Windows services?
Yes, you can share a process between Windows services.


3. In .NET, which is the parent class to create all Windows services?
The ServiceBase class is the parent class to create all Windows services.


4. Which class in .NET is used to install a Windows service?
The ServiceInstaller class, also known as the project installer class, is used to install a Windows service.

5. While installing a Windows service, an EventLogInstaller class is automatically created to install the event log related to the particular service. Is it true?
Yes, it is true.

6. Which property of the ServiceBase class can be used to specify whether a service can be paused and resumed?
The CanPauseAndContinue property provides such type of service.

7. Describe the services that UDDI provides to Web applications.
UDDI provides the following types of services to a Web application:
  • XML Schema for business descriptions - Includes information about the service publisher (contact name, address, and so on) and specifications on the Web service
  • Web registry of Web services - Includes business, service, and binding information for the Web service
8. Write the file extension for a Web service.
A Web service file extension is .asm file. For example, service1.asmx is a Web service file.

9. Which method is used to uninstall the Windows services?
The Uninstall() method is used to uninstall the Windows services.

10. What is the use of the mustUnderstand attribute in the Header element of a SOAP message?
The mustUnderstand attribute indicates that a header entry is either required or optional for the recipient to process further.

11. Explain the WSDL.
WSDL is a short form for Web Services Description Language, which is used to describe a Web service in terms of the messages that it creates and accepts. The WSDL document is an XML file that contains the interface schema for the Web service. It identifies the methods that are used during the exchange between a Web service consumer and a Web service provider. The following are the elements contained in the WSDL document:
  • Types - Describe the variations of data types that are used to exchange messages between the user and the provider.
  • Message - Describes the actual message or method call.
  • portType - Describes the set of operations and each related message.
  • binding - Describes the protocol details.
  • service - Used to make groups a set of related ports together.
12. What advantage UDDI has over DISCO?
The UDDI directory has an advantage over a DISCO file, as it provides a single location where a client can find the Web services offered by different organizations.

13. How can you ensure that only authorized users access your Web service?
You should use the <authorization> element to ensure that only authorized users access your Web service. This element allows or denies access to your Web service according to their role.

14. Describe the EventLog class.
The EventLog class is used to access the Windows event logs from Windows services. Using EventLog, you can also customize Windows event logs that record information about important software and hardware events, such as the events of the .NET controls, keyboard, or other hardware devices.
           The EventLog class allows you to read or write to event logs, delete logs, and create as well as delete event sources. You can use the EventLog class to create event logs while creating an event source. An event source can be used to write to only one event log at a particular time. However, it is possible to associate one event log to multiple sources.


15. How can you prevent your Web services from unauthorized access?
The following are the ways to prevent your Web service from unauthorized access:
  • Using encryption and message-based security.
  • Using authentication and access controls for the Web service.
16. Explain the concept of Web services in brief.
A Web service may be defined as an independent and self-sustained unit of a software application that is hosted on the Web and implement specific functionalities to execute the business logic. A Web service provides so many functionalities, such as generating pay slips for employees, computing tax, broadcasting weather report, and providing updated news. The Web service allows application to share information or exchange data with other applications across different operating systems and hardware.

Therefore, the work of a Web service is to unite software by exchanging data irrespective of their operating systems, supported hardware, and programming language used in their development. The Web services transfer data in the XML format and use Simple Object Access Protocol (SOAP) to communicate. It is an XML based protocol. The Web services use Web Services Description Language (WSDL) and Universal Description, Discovery, and Integration (UDDI) to describe itself.

17. What advantages have Web services over Component Object Model (COM) and Distributed Component Object Model (DCOM)?
The advantages of Web services over COM and DCOM are as follows:
  • Web services are simple to use and can be implemented on varied platforms.
  • Web services are loosely coupled; as a result, their interfaces and methods can be extended.
  • Web services do not carry any state information with them so that multiple requests can be processed simultaneously.
18. Mention the namespace that you must import in code to build a Web service.
System.Web.Services is the elementary namespace, which must be imported to develop code of a Web service.

19. What does the portType element of a WSDL document contain?
The portType element contains the operations exposed by the Web service, and the messages involved in the communication between the Web service and its consumers.

20. What is DISCO?
DISCO is a technology developed by Microsoft to publish and discover Web services. It discovers URLs of all XML Web services located on a Web server and creates a list of these Web services in a file called as a DISCO file.
21. Which two methods are used to discover the URL of Web services?
The two methods to discover the URL of Web services are Web service discovery tool (Disco.exe) and UDDI.
22. Which step is necessary to perform before a Web service can be consumed?
It is necessary to build a proxy class by using the wsdl.exe utility before a Web service can be consumed.

23. Which property of the WebMethod attribute allows you to maintain the state of objects across sessions in a Web method?
The WebMethod attribute's EnableSession property enables you to enable session state for a Web method.

24. Write the names of public properties defined in the WebService class.
There are many properties defined in the WebServices class:
  • Application - Obtains the application object for the current HTTP request
  • Context - Obtains the HttpContext object for the current request, which encapsulates all HTTP-specific context used by the HTTP server to process Web requests
  • Server - Obtains the HttpServerUtility object for the current request
  • Session - Obtains the HttpSessionState object for the current request
  • SoapVersion - Obtains the version of the SOAP protocol used to make the SOAP request to a Web service
  • User - Obtains the Server User Object. This property can be used to authenticate whether a user is authorized to execute the request.
     25. What do you understand by SOAP encoding?
        The Serialization of the types, such as integers and strings, inside a SOAP message is called encoding. The SOAP objects use XML elements and attributes to serialized data, for example, encodingStyle is an attribute of the Envelop element, which is used to specify the encoding rules for a SOAP object.

       26. What is the use of a .disco file?
        A client application uses a .disco file to locate or discover the documents that contain the description of a Web service. The .disco file contains links to other resources, which describe essential features, such as capabilities of a Web service. The links contained in a .disco file can refer to other discovery documents or XSD schemas. The description about the services and capabilities of a Web service is written in Web services Description Language (WSDL). A .disco file can also contain the information about other XML Web services that reside on the same or a different Web server.

        27. Mention the name of the directory where it is necessary to locate the proxy file to use a Web service.
         The proxy file must be stored in the /bin directory. This directory is situated under the root directory of the application.

         28. Does a Web service have state?
         The Web services do not have any technique to maintain state. However, it can access ASP.NET objects, such as application and session if they extend from the WebService base class.

        29. Which namespace must be included in a code that enables a XML Web service to write events in an event log file?
       The System.Diagnostics is the namespace, which must be included in a code to enable a Web service for writing events in an event log file.

        30. Which tool installs the DLL on your local computer and installs the Windows service in a transactional manner?
      The Installutil.exe tool.

What is WCF?
Windows Communication Foundation or just WCF is a programming framework used to build applications that communicate with each other. It is a part of the .NET Framework dedicated to communications.

What are the different WCF binding available?

• BasicHttpBinding
• WSHttpBinding
• WSDualHttpBinding
• WSFederationHttpBinding
• NetTcpBinding
• NetNamedPipeBinding
• NetMsmqBinding
• NetPeerTcpBinding
• MsmqIntegrationBinding

What is the proxy for WCF Service?
A proxy is a class by which a service client can Interact with the service. By the use of proxy in the client application we are able to call the different methods exposed by the service.


Wednesday 25 July 2012

Page Life Cycle Events


Page Life Cycle Events
This is a transcript of a  programming manual, to refresh my memory, and it’s always good to RTFM. As a control developer you must have a solid understanding of the page life cycle and its phases.
The page framework takes the following actions to handle a request for an .aspx file:
  1. Parses the .aspx file and creates a tree of control builders.
  2. Uses the tree to dynamically implement a class or control that derives from the Page class.
  3. Dynamically compiles the class.
  4. Caches the compiled class for later use.
  5. Dynamically creates an instance of the compiled class. The page springs to life and starts its life cycle where the page goes through different phases of its life cycle.
Page Life Cycle Phases
  1. PreInit
  2. Init
  3. InitComplete
  4. LoadControlState(Postback only)
  5. LoadViewState(Postback only)
  6. LoadPostData(Postback only – first try)
  7. PreLoad
  8. Load
  9. LoadPostData(Postback only – second try)
  10. RaisePostDataChangedEvent(Postback only)
  11. RaisePostbackEvent(Postback only)
  12. LoadComplete
  13. RaiseCallbackEvent(Postback and Callback only)
  14. PreRender
  15. PreRenderComplete
  16. SaveControlState
  17. SaveViewState
  18. SaveStateComplete
  19. Render
  • The page first retrieves the posted data from the QueryString or Form Collection of the Request object.
  • The page then checks whether the posted Data Collection (the NameValueCollection  Form or QueryString) contains an item with the key _CALLBACKID. If it does, it sets its IsCallBack Boolean property to true to signal that the page has been posted back to the server through the ASP.NET callback mechanism.
1. PreInit: The page takes the following actions in the PreInit phase of its life cycle:
a.  Calls its OnPreInit method to raise the PreInit event.
b. Initializes the theme by using the contents of the App_Themes directory to dynamically implement a class of type PageTheme, compiles the class, creates an instance of the compiled class, and assigns the instance to its PageTheme property.
c. Applies the master page.
2. Init: The page takes the following actions in the Init phase of its life cycle:
a. Recursively initializes the controls in its Controls collection. This initialization includes setting the properties of these controls such as Page, ID, NamingContainer, and so on.
b. Recursively applies these controls’ skins.
c. Calls its own OnInit method to raise its own Init event and then recursively calls the child control’s OnInit methods to raise their Init events.
d. Calls its own TrackViewState to start its own view state tracking and then recursively calls the child controls’ TrackViewState methods to start their view state tracking.
3. InitComplete: The page calls its OnInitComplete method to raise the InitComplete event. This event signals the end of the initialization phase. By this time all controls in the Controls collection of the page are initialized.
4. LoadControlState(postback only): The page recursively calls the LoadControlState method of those controls in its Controls collections that have called the RegisterRequiresControlState method of the page class to express interest in using their control states.
5. LoadViewState(postback only): The page first calls its own LoadViewState method and then recursively calls the LoadViewState method of the controls in its Controls collection to allow them to load their saved view states.
6.  LoadPostData(postback only – first try): The page calls the LoadPostData method of the controls that implement the IPostBackDataHandler interface and passes the posted data into it. The LoadPostData method of each control must access the posted data and update the respective property of the control accordingly. For example, the LoadPostData method of the TextBox control assigns the new value of the text box to the Text property of the TextBox control.
7. PreLoad: The page calls its OnPreLoad method to raise the PreLoad event. This event signals the beginning of the load phase of the page life cycle.
8. Load: The page calls its own OnLoad method to raise its own Load event and then recursively calls the OnLoad methods of the controls in its Controls collection to raise their Load events. Page developers may register callbacks for the Load event, where they may programmatically add child controls to the Controls collection of the page.
9. LoadPostData(postback only second try): The page calls the LoadPostData method of those controls that where programmatically added to its Controls collection in the Load phase if they implement the IPostBackDataHandler interface.
10. RaisePostDataChangedEvent(postback only): The page calls the RaisePostDataChangedEvent method of those controls whose LoadPostData method returned true. The RaisePostDataChangedEvent method raises post data changed event. For example, the TextBox control raises this event when the new value of the text box is different from the old value.
11. RaisePostbackEvent(postback only): The page calls the RaisePostBackEvent method of the control whose associated HTML element submitted the form. For example, the Button control’s associated HTML element posts the page back to the server. The RaisePostBackEvent method of a control must map the postback event to one or more server-side events. For example, the RaisePostBackEvent method of the Button control maps the postback event to the Command and Click server-side events.
12. LoadComplete: The page calls its OnLoadComplete method to raise the LoadComplete event to signal the completion of all loading activities including loading post data and raising post data changed event to allow interested controls to update themselves accordingly.
13. RaiseCallBackEvent(postback and callback only): The page calls the RaiseCallBackEvent method of the control that uses the ASP.NET client callback mechanism to allow client-side method(such as a JavaScript function) to call a server-side method  without having to post the entire page back to the server. The RaiseCallbackEvent method must call the respective server-side methods. If the page is posted back through the client callback mechanism, the page will not go through the rest of its lifecycle phases.
14. PreRender: The page takes the following actions in this phase of its life cycle:
a. Calls its EnsureChildControls method to ensure its child controls are created before the page enters its rendering phase.
b. Calls its own OnPreRender method to raise its own PreRender event.
c. Recursively calls the OnPreRender methods of the controls in its Controls collection to raise their PreRender events.
15. PreRender Complete: The page calls its OnPreRenderComplete method to raise the PreRenderComplete event to signal the completion of all prerendering activities.
16. SaveControlState: The page recursively calls the SaveControlState method of those controls in its Controls collection that have called the RegisterRequiresControlState method of the page class to express interest in saving their control states.
17. SaveViewState: The page first calls its own SaveViewState method and then calls the SaveViewState method of the controls in its Controls collection to allow them to save their view states.
18. SaveStateComplete: The page calls its OnSaveStateComplete method to raise the SaveStateComplete event to signal the completion of all save state activities.
19. Rendering: The page takes the following actions in this phase of its life cycle:
a. Creates an instance of the HtmlTextWriter class that encapsulates the output stream of the response.
b. Calls its RenderControl method and passes the HtmlTextWriter instance into it.
The RenderControl method recursively calls the Render Control methods of the child controls to allow each child control to render its HTML markup text. The HTML markup texts of the child controls form the final markup text that is sent to the client browser.

Saturday 21 July 2012

asp.net

ASP.Net Interview Questions and answers for freshers pdf
0. What is .Net?
 It was a System which can be used in the developed as various  kinds of applications like Console, Windows, Web&Mobile.
It Magerly consist of three things
(i) Language (C#.Net, VB.Net, J#.Net, Vcpp.Net etc)
(ii) Technologies (ASP.Net, ADO.Net, WPF, WCF etc)
(iii) Servers (SQL Server, Web Server, Sharepoint Server, Biztalk Server etc)

1 . What is ASP.NET?
ASP.NET is a programming framework built on the common language run time that can be used on a server to build powerful Web applications.

2.What is a IL?
(IL)Intermediate Language is also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code is compiled to IL. This IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.

3.What is a CLR?
Full form of CLR is Common Language Runtime and it forms the heart of the .NET framework. All Languages have runtime and its the responsibility of the runtime to take care of the code execution of the program. For example VC++ has MSCRT40.DLL,VB6 has MSVBVM60.DLL, Java has Java Virtual Machine etc.

4.What is a CLS(Common Language Specification)?
This is a subset of the CTS which all .NET languages are expected to support. It was always a dream of Microsoft to unite all different languages in to one umbrella and CLS is one step towards that. Microsoft has defined CLS which are nothing but guidelines that language to follow so that it can communicate with other .NET languages in a seamless manner.

5.What is a Managed Code?
Managed code runs inside the environment of CLR i.e. .NET runtime. In short all IL are managed code. But if you are using some third party software example VB6 or VC++ component they are unmanaged code as .NET runtime (CLR) does not have control over the source code execution of the language.

6.What is an Assembly?
Assembly is unit of deployment like EXE or a DLL. An assembly consists of one or more files (dlls, exe’s, html files etc.), and represents a group of resources, type definitions, and implementations of those types.An assembly may also contain references to other assembles.

7.What are the different types of Assembly?
There are two types of assembly Private and Public assembly (Shared Assembly).
  • A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath.
  • A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime.
 8.What is a Manifest?
Assembly metadata is stored in Manifest. Manifest contains all the metadata needed to do the following things:
  • Version of assembly
  • Security identity
  • Scope of the assembly
  • Resolve references to resources and classes.
9. What is NameSpace?
Namespace has two basic functionalities:-
  • Namespace logically group types. Ex: - System.Web.UI logically groups our UI related features.
  • In Object Oriented world many times it’s possible that programmers will use the same class name. By qualifying NameSpace with class name this collision is able to be removed.
10.What is Difference between Namespace and Assembly?
Following are the differences between namespace and assembly:
  • Assembly is physical grouping of logical units. Namespace logically groups classes.
  • Namespace can span multiple assemblies.                                                           

Popular posts