Friday, April 19, 2013

how can i pass value from master page to content page and vice versa ?

//on master pag
Label
lbl =(Label) Page.Master.FindControl("ContentPlaceHolder1").FindControl("lblm");
lbl.Text =
"hgfgc";//lbm  label on aspx pages within ContentPlaceHolder1 id



//how can i pass value from content page  to  master page  ?
//on aspx pages
Label lbl = (Label)this.Master.FindControl("lblm");lbl.Text =
"hgfgc";
//lbm lable on master pages

Thursday, April 18, 2013

Passing string values into SQL query via parameter

CREATE PROC S_Test
(
    @params varchar(100)
)
AS
SET NOCOUNT ON
DECLARE @sql as NVARCHAR(4000)
SET @sql = 'select count(*) from myTable where myColumn in (' + @params + ')'
EXEC sp_ExecuteSQL @sql
GO

Template OF Cover Letter

 Dear Sir/Madam,
This mail is to express my interest in the post of Software Testing Engineer in your company. I believe that my strong technical experience and education will make me a very competitive candidate for this position.
I hold a Degree in Bachelor of Technology (Information Technology) from Ghaziabad and I had a total working experience of 4 Years and 10 Months. I have an experience of all the different testing phases in the software lifecycle and good working knowledge of taking a project from the initial requirement stage to the final release stage. I had done Test Planning and also created Test Planning & Strategy documents. I am confident that my presentation skills and high quality and cost effective methodologies can secure big projects for the company.
I assure you that my knowledge and experience will help me to serve the organization in the best possible ways.
I am enclosing my resume for your perusal and looking forward to hear from you soon.
Thanking You,
Yours sincerely,

Tuesday, April 16, 2013

How To prevent back Button to pages in Javascript?

<script type = "text/javascript" >
   function preventBack(){window.history.forward();}
    setTimeout("preventBack()", 0);
    window.onunload=function(){null};
</script>

Wednesday, April 3, 2013

Using NOLOCK and READPAST table hints in SQL Server

When data in a database is read or modified, the database engine uses special types of controls, called locks, to maintain integrity in the database. Locks basically work by making sure database records involved in a transaction cannot be modified by other transactions until the first transaction has committed, ensuring database consistency.


When designing database applications, you should keep in mind the different types of locks that will be issued, and the different levels of isolation your transactions will occur. Typically, the SQL Server defaults work fine for what you are trying to accomplish. However, there will be times when it is advantageous to manually make hints to how locks are issued on your tables in your SQL statements.
This article focuses on two table hints: NOLOCK and READPAST. I'll set up a table to use for our example queries. Execute the script in Listing A to create the SalesHistory table and populate the table with data.

NOLOCK

This table hint, also known as READUNCOMMITTED, is applicable to SELECT statements only. NOLOCK indicates that no shared locks are issued against the table that would prohibit other transactions from modifying the data in the table.
The benefit of the statement is that it allows you to keep the database engine from issuing locks against the tables in your queries; this increases concurrency and performance because the database engine does not have to maintain the shared locks involved. The downside is that, because the statement does not issue any locks against the tables being read, some "dirty," uncommitted data could potentially be read. A "dirty" read is one in which the data being read is involved in a transaction from another connection. If that transaction rolls back its work, the data read from the connection using NOLOCK will have read uncommitted data. This type of read makes processing inconsistent and can lead to problems. The trick is being able to know when you should use NOLOCK.
As a side note, NOLOCK queries also run the risk of reading "phantom" data, or data rows that are available in one database transaction read but can be rolled back in another. (I will take a closer look at this side effect in part two of this article series.)
The following example shows how NOLOCK works and how dirty reads can occur. In the script below, I begin a transaction and insert a record in the SalesHistory table.
BEGIN TRANSACTION
      INSERT INTO SalesHistory
      (Product, SaleDate, SalePrice)          
      VALUES            
      ('PoolTable', GETDATE(), 500)                   
The transaction is still open, which means that the record that was inserted into the table still has locks issued against it. In a new query window, run the following script, which uses the NOLOCK table hint in returning the number of records in the SalesHistory table.
SELECT COUNT(*) FROM SalesHistory WITH(NOLOCK)
The number of records returned is 301. Since the transaction that entered the record into the SalesHistory table has not been committed, I can undo it. I'll roll back the transaction by issuing the following statement:
ROLLBACK TRANSACTION
This statement removes the record from the SalesHistory table that I previously inserted. Now I run the same SELECT statement that I ran earlier:
SELECT COUNT(*) FROM SalesHistory WITH(NOLOCK)
This time the record count returned is 300. My first query read a record that was not yet committed -- this is a dirty read.

READPAST

This is a much less commonly used table hint than NOLOCK. This hint specifies that the database engine not consider any locked rows or data pages when returning results.
The advantage of this table hint is that, like NOLOCK, blocking does not occur when issuing queries. In addition, dirty reads are not present in READPAST because the hint will not return locked records. The downside of the statement is that, because records are not returned that are locked, it is very difficult to determine if your result set, or modification statement, includes all of the necessary rows. You may need to include some logic in your application to ensure that all of the necessary rows are eventually included.
The READPAST table hint example is very similar to the NOLOCK table hint example. I'll begin a transaction and update one record in the SalesHistory table.
BEGIN TRANSACTION
      UPDATE TOP(1) SalesHistory
      SET SalePrice = SalePrice + 1
Because I do not commit or roll back the transaction, the locks that were placed on the record that I updated are still in effect. In a new query editor window, run the following script, which uses READPAST on the SalesHistory table to count the number of records in the table.
SELECT COUNT(*)
 FROM SalesHistory WITH(READPAST)
My SalesHistory table originally had 300 records in it. The UPDATE statement is currently locking one record in the table. The script above that uses READPAST returns 299 records, which means that because the record I am updating is locked, it is ignored by the READPAST hint.
 

Tuesday, April 2, 2013

Name the binders provided by .NET Framework 4.0.

Binders are used by DLR to communicate with not the .NET Framework but also with various other services, such as Silverlight and COM. These services represent language-specific semantics and specify how a particular operation can be performed at the call site.

Call sites refer to the area in the code where logical and mathematical operations, such as a + b or a.b() are performed on dynamic objects.

.NET Framework 4.0 provides the following binders:
  • Object Binder - Enables to communicate with .NET objects.
  • JavaScript Binder - Enables to communicate with JavaScript in Silverlight.
  • Python Binder - Enables to communicate with IronPython.
  • Ruby Binder - Enables to communicate with IronRuby.
  • COM Binder - Enables to communicate with COM.

What is the difference between dynamic and var data types?


The difference between the var and dynamic data types is that the var data type is strongly type checked at the compile time; whereas, the dynamic data type is type checked by the compiler only at run time. After declaring a var data type, you cannot explicitly change its type throughout the execution of the program; however, a variable of the dynamic data type can be changed during runtime. Another major difference between the two is that dynamic type can also be used as the return type for methods, for which var cannot be used.

Important 30 Quetsion and answer on Web Services

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.

Important 25 Question And Answer on Linq

1. What is Language Integrated Query (LINQ)?
LINQ is a programming model that is the composition of general-purpose standard query operators that allow you to work with data, regardless of the data source in any .NET based programming language. It is the name given to a set of technologies based on the integration of query capabilities into any .NET language.
2. What are LINQ query expressions?
A LINQ query, also known as a query expression, consists of a combination of query clauses that identify the data sources for the query. It includes instructions for sorting, filtering, grouping, or joining to apply to the source data. The LINQ query expressions syntax is similar to the SQL syntax. It specifies what information should be retrieved from the data source.
3. Write the basic steps to execute a LINQ query.
The following are the three basic steps to execute a LINQ query:
  • Obtain the data source (The data source can be either an SQL database or an XML file)
  • Create a query
  • Execute the query

4. Write the basic syntax of a LINQ query in Visual Basic as well as in C#.
In Visual Basic, the basic syntax of a LINQ query starts with the From clause and ends with the Select or Group By clause. In addition, you can use the Where, Order By, and Order By Descending clauses to perform additional functions, such as filtering data and generating the data in a specific order.

In C#, the basic syntax of a LINQ query starts with the From clause and ends with the Select or group by clause. In addition, you can use the where, orderby, and Orderby descending clauses to perform additional functions, such as filtering data and generating the data in a specific order.
5. In which statement the LINQ query is executed?
A LINQ query is executed in the For Each statement in Visual Basic and in the foreach statement in C#.
6. In LINQ, lambda expressions underlie many of the standard query operators. Is it True or False?
It is true.

7. What is PLINQ?
PLINQ stands for Parallel Language Integrated Query. It is the parallel implementation of LINQ, in which a query can be executed by using multiple processors. PLINQ ensures the scalability of software on parallel processors in the execution environment. It is used where data grows rapidly, such as in telecom industry or where data is heterogeneous.

PLINQ also supports all the operators of LINQ. In addition, you can query 'collections by using PLINQ. It can also run several LINQ queries simultaneously and makes use of the processors on the system. Apart from this, PLINQ uses parallel execution, which helps in running the queries quickly. Parallel execution provides a major performance improvement to PLINQ over certain types of legacy code, which takes too much time to execute.
8. What are the different Visual Basic features that support LINQ?
Visual Basic includes the following features that support LINQ:
  • Anonymous types - Enables you to create a new type based on a query result.
  • Implicitly typed variables - Enables the compiler to infer and assign a type when you declare and initialize a variable.
  • Extension method - Enables you to extend an existing type with your own methods without modifying the type itself.

9. What is the function of the DISTINCT clause in a LINQ query?
The DISTINCT clause returns the result set without the duplicate values.
10. What is the DataContext class and how is it related to LINQ?
After you add a LINQ to SQL Classes item to a project and open the O/R Designer, the empty design surface represents an empty DataContext class ready to be configured. The DataContext class is a LINQ to SQL class that acts as a conduit between a SQL Server database and the LINQ to SQL entity classes mapped to that database. This class contains the connection string information and the methods for connecting to a database and manipulating the data in the database. It is configured with connection information provided by the first item that is dragged onto the design surface.
11. What is the difference between the Take and Skip clauses?
The Take clause returns a specified number of elements. For example, you can use the Take clause to return two values from an array of numbers. The Skip clause skips the specified number of elements in the query and returns the rest. For example, you can use the Skip clause to skip the first four strings in an array of strings and return the remaining array of string.
12. What is Object Relational Designer (0/R Designer)?
The 0/R Designer provides a visual design surface to create LINQ to SQL entity classes and associations (relationships) that are based on objects in a database.

13. Which interface implements the standard query operators in LINQ?
The standard query operators implement the IEnumerable<T> or the IQueryable<T> interface in C# and the IEnumerable(Of T) or the IQueryable(Of T) interface in Visual Basic.
14. What are standard query operators in LINQ?
The standard query operators in LINQ are the extension methods that form the LINQ pattern. These operators form an API that enables querying of any .NET array or collection. It operates on sequences and allows you to perform operations, such as determining if a value exists in the sequence and performing an aggregated function, such as a summation over a sequence.
15. On what parameter does the GroupBy clause group the data?
The GroupBy clause groups the elements that share a common attribute.
16. What is a LinqDataSource control?
The LinqDataSource control enables you to use LINQ. in an ASP.NET Web page by setting the properties in the markup text. You can use the control retrieve or modify data. It is similar to the SqIDataSource and ObjectDataSource controls in the sense that it can be used to declaratively bind other ASP.NET controls on a page to a data source. The difference is that instead of binding directly to a database or to a generic class, the LinqDataSource control is designed to bind a LINQ enabled data model.
17. How can you open the O/R Designer?
You can open the O/R Designer by adding a new LINQ to SQL Classes item to a project.
18. The standard query operators are themselves a set of extension methods that provide the LINQ query functionality for any type that implements the IEnumerable<T> interface in Visual Basic. Is it True or False?
False, as it implements the IEnumerable(T) interface in Visual Basic and the IEnumerable<T> interface is implemented in C#.

19. What are lambda expressions in LINQ?
A lambda expression is a function without a name that calculates and returns a single value. All lambda expressions use the lambda operator =>, which read as goes to. The left side of the lambda operator specifies the input parameters and the right side holds the expression or statement block.
20. Before you query a DataSet object by using LINQ to DataSet, you must first populate the dataset How can you do this?
You can load the data into the dataset by using different methods, such as:
  • Using the DataAdapter class
  • Using LINQ to SQL

21. What are the different implementations of LINQ?
The different implementations of LINQ are:
  • LINQ to SQL - Refers to a component of.NET Framework version 3.5 that provides a run-time infrastructure to manage relational data as objects.
  • LINQ to DataSet - Refers to a component that makes it easier and faster to query over data cached in a DataSet object.
  • LINQ to XML - Provides an in-memory XML programming interface.
  • LINQ to Objects - Refers to the use of LINQ queries with any IEnumerable or IEnumerable(T) collection directly, without the use of an intermediate LINQ provider or API, such as LINQ to SQL or LINQ to XML.

22. Which command-line tool generates code and mapping for the LINQ to SQL component of .NET Framework?
The SqlMetal.exe command-line tool generates code and map the LINQ to SQL component.
23. Name the control that exposes the LINQ features to Web developers through the ASP.NET data-source control architecture.
The LinqDataSource control exposes the LINQ features to Web developers through the ASP.NET data-source control architecture.
24. What is the difference between the Select clause and SelectMany() method in LINQ?
Both the Select clause and SelectMany() method are used to produce a result value from a source of values. The difference lies in the result set. The Select clause is used to produce one result value for every source value. The result value is a collection that has the same number of elements from the query. In contrast, the SelectMany() method produces a single result that contains a concatenated collection from the query.

25. Which extension method do you need to run a parallel query in PLINQ?
The AsParallel extension method is required to run a parallel query in PLINQ.

How to see Error Log in computer?

First Right Click On Mycomputer Icon On desktop and Click on Manage then  then explore all tab that has Windows log.....