Tuesday, December 8, 2009

Enable Login

SQL SERVER – Enable Login – Disable Login for specific user
In SQL SERVER 2005, all the login (including ’sa’ ) can be enabled and disabled using ALTER LOGIN command.

To disable ’sa’ login:
ALTER LOGIN sa DISABLE
GO

To enable ’sa’ login:
ALTER LOGIN sa ENABLE
GO

Also for additional security (prevent educated guess from hackers) the name of the ’sa’ account can be changed.
ALTER LOGIN [sa] WITH NAME = [AdminUser]
GO

SQL Connection Strings

SqlConnection conn = new SqlConnection("server=localhost; Initial Catalog=Northwind; User Id=sa;Password=sa;");

ID=userid
Passowrd=sql server password to login to that account
server=name/IP of the server you are trying to log in

Thursday, December 3, 2009

Result Set

What is Result Set?

An SQL result set is a set of rows from a database, as well as meta-information about the query such as the column names, and the types and sizes of each column. Depending on the database system, the number of rows in the result set may or may not be known. Usually, this number is not known up front because the result set is built on-the-fly. Precomputations often impose undesired performance impacts.

A result set is effectively a table. The ORDER BY clause can be used in a query to impose a certain sort condition on the rows. Without that clause, there is no guarantee whatsoever on the order in which the rows are returned.

On whole it has following features:
*The data in a ResultSet object is organized in rows and columns.
*A cursor (pointer) is also maintained in a ResultSet object to identify the current data row.
*A ResultSet object also contains ResultSet meta data which provides column definitions.
*ResultSet objects support 3 types of scrollabilities: TYPE_FORWARD_ONLY (default), TYPE_SCROLL_INSENSITIVE, and TYPE_SCROLL_SENSITIVE.
*ResultSet objects support 2 types of update capabilities: CONCUR_READ_ONLY (default) and CONCUR_UPDATABLE.
*ResultSet objects support 3 types of fetch direction hints: FETCH_FORWARD (default), FETCH_REVERSE, and FETCH_UNKNOWN.

Testing

Testing across diffrent languages

Its called Internationalisation testing i,e I18N. I18N is the term used for testing among different international languages .
Localisation testing is the term used for testing among various regional languages .

Localization- Tester can go to convert english to different languages.

Globalization/Internationalization-Tool can go to convert english to diffenrent languages.

Test Case

What is a test case? How to create a good test case?
Test cases are a sequence of steps to test the correct behavior of a functionality/feature of an application. A test case should have an input description, Test Sequence and an Expected Behavior. A test case is a list of the conditions or issues of what the tester want to test in software.
eg.
Test Sequence:
Sequence here is the order in which this step is to be executed. The test case document should be prepared in such a way that the test cases should follow a sequence.

Test Input Description:
1.Login to as administrator.
2. Go to Reports page
3. Click on the ‘Schedule reports' button
4. Add reports
5. Update

Expected Results:
The report schedule should get added to the report schedule table. Provisioning status of the reports should get handled

The objective of any Testing activity is to find the defects at the earliest stage. To test a product we must know

1. What all the features to be tested? (Objective of testing)
2. How to test the features? (Steps to test the objective)
3. What will be the result if I execute the steps given to test the features? (Expected behavior of the output for the objective)

So, a good test case should be more precise. And it should be more focus towards testing one particular functionality rather than covering all functionality.

Write testcase for print option using mswod?
  • in ms-word first check out the printer is connected properly
  • then check when we give print command its doesn't show any error.
  • if error shows then print is not working
  • first click on the print option and then ok
  • go to file option of ms-word and then click on print
  • also give print command by pressing the button ctrl+p then check out the pages to be printed

Temporary Tables

defines a table that is accessible only during the session in which it was created. It exists only for the duration of that session or until it is dropped with a DROP TABLE statement.

  • It is exclusive to the SQL session in which it is created; it is not visible outside of the session and does not share its data with other sessions.
  • It can be joined to any table in the database. Indexes and column default values can be defined for a temporary table and persist during the life of the table.
  • It can have the same name as a permanent table created during a later session, but not the same name as a permanent table created during the same or a prior session
  • Any queries submitted by the user of a temporary table are automatically queried against that table. This is true even if a permanent table with the same name exists or is subsequently created by a user in another session. Temporary tables always take precedence over permanent tables.
  • It does not have to be locked while it is being updated because other users cannot access the temporary table.
  • To avoid system table contention, it is not permanently cataloged in the system tables. Information about a temporary table resides in memory and appears in the system tables during the user's session but disappears when the session ends.
  • It is automatically dropped at the end of the SQL session; however, it can also be dropped during the session with the DROP TABLE statement.
CREATE TABLE #Emp ( EmpID int,EmpName char(30) )

You'll notice I prefixed the table with a pound sign (#). This tells SQL Server that this table is a local temporary table. This table is only visible to this session of SQL Server. When I close this session, the table will be automatically dropped. You can treat this table just like any other table with a few exceptions. The only real major one is that you can't have foreign key constraints on a temporary table

Temporary tables are created in tempdb. If you run this query:

select name from tempdb..sysobjects where name like '#Emp%'

Tuesday, November 24, 2009

Active Directory

What is Active Directory? What is the namespace used to access the Microsoft Active Directories? What are ADSI Directories?
Active Directory Service Interfaces (ADSI) is a programmatic interface for Microsoft Windows Active Directory. It enables your applications to interact with diverse directories on a network, using a single interface. Visual Studio .NET and the .NET Framework make it easy to add ADSI functionality with the DirectoryEntry and DirectorySearcher components.Using ADSI, you can create applications that perform common administrative tasks, such as backing up databases, accessing printers, and administering user accounts. ADSI makes it possible for you to:

1. Log on once to work with diverse directories. The DirectoryEntry component class provides username and password properties that can be entered at runtime and communicated to the Active Directory object you are binding to.
2. Use a single application programming interface (API) to perform tasks on multiple directory systems by offering the user a variety of protocols to use. The DirectoryServices namespace provides the classes to perform most administrative functions.
3. Perform "rich querying" on directory systems. ADSI technology allows for searching for an object by specifying two query dialects: SQL and LDAP.
4. Access and use a single, hierarchical structure for administering and maintaining diverse and complicated network configurations by accessing an Active Directory tree.
5. Integrate directory information with databases such as SQL Server. The DirectoryEntry path may be used as an ADO.NET connection string provided that it is using the LDAP provider. using System.DirectoryServices;

Pooling

What are object pooling and connection pooling and difference? Where do we set the Min and Max Pool size for connection pooling?

Object pooling is a COM+ service that enables you to reduce the overhead of creating each object from scratch. When an object is activated, it is pulled from the pool. When the object is deactivated, it is placed back into the pool to await the next request.

You can configure object pooling by applying the ObjectPoolingAttribute attribute to a class that derives from the System.EnterpriseServices.ServicedComponent class. Object pooling lets you control the number of connections you use, as opposed to connection pooling, where you control the maximum number reached.
Following are important differences between object pooling and connection pooling:
Creation. When using connection pooling, creation is on the same thread, so if there is nothing in the pool, a connection is created on your behalf. With object pooling, the pool might decide to create a new object. However, if you have already reached your maximum, it instead gives you the next available object. This is crucial behavior when it takes a long time to create an object, but you do not use it for very long.
Enforcement of minimums and maximums. This is not done in connection pooling. The maximum value in object pooling is very important when trying to scale your application. You might need to multiplex thousands of requests to just a few objects. (TPC/C benchmarks rely on this.) COM+ object pooling is identical to what is used in .NET Framework managed SQL Client connection pooling. For example, creation is on a different thread and minimums and maximums are enforced.

Thursday, November 12, 2009

Remoting

What is Remoting?
The process of communication between different operating system processes, regardless of whether they are on the same computer. The .NET Remoting system is an architecture designed to simplify communication between objects living in different application domains, whether on the same computer or not, and between different contexts, whether in the same application domain or not.

.NET Remoting Architecture?

• Methods that will be called from the client are implemented in a remote object class.
• Client uses a proxy to call a remote object.
• Remote objects runs inside a process that is different from the client process
• For the client, the proxy looks like the real object with the same public methods.
• When the methods of the proxy are called, messages are created.
• Messages are serialized using a binary formatter class, and are sent into a client channel.
• The client channel communicates with the server part of the channel to transfer the message across the network.
• The server channel uses a formatter to deserialize the message, so that the methods can be dispatched to the remote object.
• The formatter and the proxy is supplied automatically.

How does .NET remoting work?
.NET remoting involves sending messages along channels. Two of the standard channels are HTTP and TCP.
TCP is intended for LANs only -
HTTP can be used for LANs or WANs internet).

Support is provided for multiple message serializarion formats. Examples are SOAP (XML-based) and binary. By default, the HTTP channel uses SOAP (via the .NET runtime Serialization SOAP Formatter), and the TCP channel uses binary (via the .NET runtime Serialization Binary Formatter). But either channel can use either serialization format.
There are a number of styles of remote access:
SingleCall. Each incoming request from a client is serviced by a new object. The object is thrown away when the request has finished.
Singleton. All incoming requests from clients are processed by a single server object.
Client-activated object. This is the old stateful (D)COM model whereby the client receives a reference to the remote object and holds that reference (thus keeping the remote object alive) until it is finished with it.
Distributed garbage collection of objects is managed by a system called 'leased based lifetime'. Each object has a lease time, and when that time expires the object is disconnected from the .NET runtime remoting infrastructure. Objects have a default renew time - the lease is renewed when a successful call is made from the client to the object. The client can also explicitly renew the lease.

Advantage over Web Services?

1.It works using purely Commmon Type System.
2.It supports high speed binary over tcp/ip communication.


Advantage over COM/DCOM?
1.It does not have extra interface language (IDL)
2.It Works using purely managed code
3.It's using Common Type System.. No Safearrays etc


Disadvantages
1.It is not an open standard like web services.
2.It is not as widespread and established ad DCOM.
3.Less support for transactions,load balancing compared with DCOM.

Web.Config

Explain Web.config Settings for exception management in ASP.NET
You should configure exception management settings within your application's Web.config file. e.g
< defaultredirect="http://hostname/error.aspx" mode="On">
< statuscode="500" redirect="/errorpages/servererror.aspx">
< statuscode="404" redirect="/errorpages/filenotfound.htm">
< /customErrors>


In the customErrors element, specify a default redirect page. There are three modes for the default redirect page:

On
Unhandled exceptions will redirect the user to the specified defaultredirect page. This is used mainly in production.

Off

Users will see the exception information and not be redirected to the defaultredirect page. This is used mainly in development.

RemoteOnly

Only users accessing the site on the local machine (using localhost) will see the exception information while all other users will be redirected to the defaultredirect page. This is used mainly for debugging.

In addition to the default redirect page, you can set specific pages for certain HTTP error codes. For example, you can specify that all 404 errors result in a certain error page, while all 500 errors result in another

NetBpm

What is NetBpm?
NetBpm is a .Net Port of JBpm1. NetBpm is an open source platform for building, executing and managing workflows. It is very simple to use and integrate in other .Net applications. This Bpm Tool supports the build of Applications which are able to turn business models into executable software models. Business analysts are able to use a model driven approach to design, implement, execute and track business processes. So business people can easily react on business and strategy changes.
Click below for site

http://www.netbpm.org/index.html

Saturday, November 7, 2009

Configuration Files

Configuration Files
Configuration files are XML files that can be changed as needed. Developers can use configuration files to change settings without recompiling applications. Administrators can use configuration files to set policies that affect how applications run on their computers.
Note Managed code can use the System.Configuration API to read settings from the configuration files, but not to write settings to those files.
This section describes the syntax of configuration files and provides information about the three types of configuration files: machine, application, and security.

Configuration File Format
Briefly describes the format of configuration files.
Machine Configuration Files
Describes the contents of machine configuration files.
Application Configuration Files
Describes the different types of application configuration files.
Security Configuration Files
Provides the location of the security configuration files.

Configuration File Format
Configuration files contain elements, which are logical data structures that set configuration information. Within a configuration file, you use tags to mark the beginning and end of an element. For example, the element consists of child elements. An empty element has a start tag, but no end tag.
You specify configuration settings using predefined attributes, which are name/value pairs inside an element's start tag. The following example specifies two attributes (version and href) for the element, which specifies where the runtime can locate an assembly (for more information, see Specifying an Assembly's Location).


The syntax in configuration files is case-sensitive.

Machine Configuration Files
The machine configuration file, Machine.config, contains settings that apply to an entire computer. This file is located in the %runtime install path%\Config directory. Machine.config contains configuration settings for machine-wide assembly binding, built-in remoting channels, and ASP.NET.
The configuration system first looks in the machine configuration file for the element and other configuration sections that a developer might define. It then looks in the application configuration file. To keep the machine configuration file manageable, it is best to put these settings in the application configuration file. However, putting the settings in the machine configuration file can make your system more maintainable. For example, if you have a third-party component that both your client and server application uses, it is easier to put the settings for that component in one place. In this case, the machine configuration file is the appropriate place for the settings, so you don't have the same settings in two different files.
Note Deploying an application using XCOPY will not copy the settings in the machine configuration file.

Application Configuration Files
Application configuration files contain settings specific to an application. This file contains configuration settings that the common language runtime reads (such as assembly binding policy, remoting objects, and so on), and settings that the application can read.
The name and location of the application configuration file depend on the application's host, which can be one of the following:
Executable–hosted application.
The configuration file for an application hosted by the executable host is in the same directory as the application. The name of the configuration file is the name of the application with a .config extension. For example, an application called myApp.exe can be associated with a configuration file called myApp.exe.config.
ASP.NET-hosted application.
ASP.NET configuration files are called Web.config. Configuration files in ASP.NET applications inherit the settings of configuration files in the URL path. For example, given the URL www.microsoft.com/aaa/bbb, where www.microsoft.com/aaa is the Web application, the configuration file associated with the application is located at www.microsoft.com/aaa. ASP.NET pages that are in the subdirectory /bbb use both the settings that are in the configuration file at the application level and the settings in the configuration file that is in /bbb.
For more information about ASP.NET configuration files, see ASP.NET Configuration
Internet Explorer-hosted application.
If an application hosted in Internet Explorer has a configuration file, the location of this file is specified in a tag with the following syntax:

In this tag, location is a URL to the configuration file. This sets the application base. The configuration file must be located on the same Web site as the application.

Security Configuration Files
Security configuration files contain information about the code group hierarchy and permission sets associated with a policy level. It is strongly recommended that you use the .NET Framework Configuration tool (Mscorcfg.msc) or Code Access Security Policy tool (Caspol.exe) to modify security policy to ensure that policy changes do not corrupt the security configuration files.
The following table shows the locations of the security configuration files.






Wednesday, November 4, 2009

IIS 7

What is break mode? What are the options to step through code?
Answer - Break mode lets you to observe code line to line in order to locate error.
VS.NET provides following option to step through code.
Step Into
Step Over
Step Out
Run To Cursor
Set Next Statement

Debug Vs Trace.

Answer - Both these objects are found in the System.Diagnostics namespace.
Both are used for diagnose problems without interrupting application execution.
Debug statement can only be used in debug mode while trace statement can be used both in debug and released mode.
Debug statements can't be compiled into a release version.

Define trace class.
Answer - The trace class in the code is used to diagnose problem.
You can use trace messages to your project to monitor events in the released version of the application.
The trace class is found in the System.Diagnostics namespace.

Define Trace Switches.
Answer - Trace switches are used to configure tracing behavior.
There are two kinds of trace switches: BooleanSwitch and TraceSwitch.
BooleanSwitch: It is either on or off.
TraceSwitch : It has property to determine trace behaviour.
Trace switches can be configured through application's .config file even after the application is compiled.

what is debugging.
debugging is an error correction because 'bug' means error
correct and 'de' including that is determinate the errors
and correct them


IIS Versions 1.0 to 4.0
IIS was released with Service Pack 3 for Windows NT 3.51, as a set of services providing HTTP, Gopher, and WAIS functionality. Although the functions were there, most users chose alternates from third-party vendors such as O'Reilly's Website or Netscape's server. Although these services had been available for years with the various flavors of UNIX operating systems, native Internet services for Windows were mostly an afterthought, with little integration with the Windows operating system.

With the advent of Windows NT 4.0, IIS also matured in version 2.0. The most notable improvement in IIS version 2.0 was closer integration with the Windows NT operating system, taking advantage of Windows security accounts and providing integrated administration through a management console similar to many other Windows services. IIS 2.0 introduced support for HTTP Host headers, which allowed multiple sites to run on a single IP address, and aligned Microsoft's IIS development with NCSA standards, providing for NCSA common log formats and NCSA-style map files. IIS 2.0 also intro-duced a web browser interface for management, and content indexing through Microsoft's Index Server.

IIS version 3.0 was introduced with Windows NT Service Pack 3 and introduced the world to ASP (Active Server Pages) and Microsoft's concept of an application server. A precursor to the ASP.NET envi-ronment, ASP (now referred to as classic ASP) is a server-side scripting environment for the creation of dynamic web pages. Using VBScript, JScript or any other active scripting engine, programmers finally had a viable competitor to CGI and scripting technologies available on non-Microsoft platforms, such as Perl.

IIS 4.0, available in the NT Option Pack, introduced ASP 2.0, an object-based version of ASP that included six built-in objects to provide standardized functionality in ASP pages. IIS 4.0 was the last version of IIS that could be downloaded and installed outside of the operating system.

IIS 5.0 and 5.1
With the release of Windows 2000, IIS became integrated with the operating system. Version numbers reflected the operating system, and there were no upgrades to IIS available without upgrading the oper-ating system. IIS 5.0 shipped with Windows 2000 Server versions and Windows 2000 Professional, and IIS version 5.1 shipped with Windows XP Professional, but not Windows XP Home Edition. For all essential functions, IIS 5.0 and IIS 5.1 are identical, differing only slightly as needed by the changes to the operating system.

With Windows 2000 and IIS 5.0, IIS became a service of the operating system, meant to be the base for other applications, especially for ASP applications. The IIS 5.0 architecture served static content, ISAPI functions, or ASP scripts, with ASP script processing handed off to a script engine based on the file extension. Using file extensions to determine the program that handles the file has always been a com-mon part of Windows functionality, and in the case of ASP processing, the speed of serving pages was increased by the automatic handoff of ASP scripts directly to the ASP engine, bypassing the static con-tent handler. This architecture has endured in IIS to the current version.

IIS 6.0
IIS 6.0 shipped with Windows Server 2003 editions and Windows XP Professional 64bit edition, which was built on the Windows Server 2003 Service Pack 1 code base. IIS 6.0 was identical among operating system versions, but there were restrictions or expansions depending on the version of Server 2003 under which IIS was running. For example, Server 2003 Web Edition would only run IIS and a few ancil-lary services; it could not be used to run Microsoft SQL Server. On the other end of the spectrum, only the Enterprise and Data Center versions of Server 2003 included clustering technology.

Operating system changes also expanded the capabilities of IIS as an application server. Native XML Web Services appeared in Server 2003. Process-independent session states made web farms easier to configure and manage, allowing session states to be stored outside the application for redundancy and failover. Web farms also became easier with Server 2003's improved Network Load-Balancing features, such as the NLB Manager, which provided a single management point for NLB functions.

IIS 7.0 Versions
Although there is really only a single version of IIS 7.0, the availability and capabilities vary with the choice of operating system. Because IIS 7.0 is tied to the operating system, as were all versions of IIS since IIS 4.0, it is not available on operating systems prior to Vista or Windows Server 2008. As in Windows XP, the workstation operating systems have limited IIS functionality or no functionality at all. Unlike in Windows XP, Vista versions have no concurrent HTTP connection limitations but instead use concurrent request processing limitations. In XP, reaching a maximum concurrent HTTP connection limit would result in IIS returning a 403.9 result code (too many users), while a request limitation merely queues requests in the order received. The end result is slower response, but no errors.

Some Windows Server 2008 versions also have limitations that affect IIS 7.0. Although IIS 7.0 is included with no limitations in all server versions, the server version itself may have limitations in use. For exam-ple, if you install Windows Server 2008 Core Edition, IIS 7.0 can be installed, but there is no GUI configu-ration application. This version of Windows does not have the .NET Framework available; thus, no managed code can be run on the server.

Windows Server 2008 Web Edition has no functional limits to IIS, but only supports three role services: Web Server, Windows Media Server and Sharepoint Services — it cannot be used to host a Domain Controller, or other types of roles. The following table shows which versions of Windows Vista and Windows Server 2008 have IIS 7.0 and what the limitations are.

IIS 7.0 Features
1)Integrated request pipeline
2) Configurability
3)Extensible Configuration Schemas
4) Componentization (Security,Minimal Installation,Management Delegation,Unified Authentication and Authorization,Request Filtering,Remote Management)
5)Administration Tools
6)AppCmd.exe Command-Line Utility
7)Diagnostics

IIS 7.0 is a ground-up rewrite of IIS 6.0, designed as an integrated web application platform. Integration with the ASP.NET framework combined with fully exposed APIs for complete extensibility of the plat-form and management interfaces make IIS 7.0 a programmer's dream. Security that includes delegation of configuration and a complete diagnostic suite with request tracing and advanced logging satisfies the administrator's desires.

While the most substantial change in IIS 7.0 may be the integration of ASP.NET into the request pipeline, the extensibility of IIS 7.0, configuration delegation and the use of XML configuration files, request trac-ing and diagnostics, and the new administration tools are all welcome changes from previous versions of IIS.

Unlike previous versions of IIS, the modular design of IIS 7.0 allows for easy implementation of custom modules and additional functionality. This increased functionality can come from in-house development, third-party sources, or even Microsoft. Since these modules and additional programs can be plugged into IIS at any time, without changing core operating system functions, the Microsoft IIS devel-opment team can ship additional supported and unsupported modules outside of Microsoft's standard service pack process. The bottom line is that you get what you need faster. Microsoft's web site at http://www.iis.net is the source for these additional downloads.

---------
IIS 7.0 is an evolution of previous IIS versions, building on their strengths while overcoming their weak-nesses. Microsoft has listened to user comments on previous versions and responded positively, to make IIS 7.0 the most robust, configurable, and secure version of their web server. In addition, Microsoft has further enhanced the tie between IIS and ASP.NET, making IIS 7.0 a fully functional application server with entirely integrated processing and configuration of both sides.

Programmers will see the improvements in IIS 7.0 as making their job easier and more manageable. They will no longer need to justify web server changes that might affect numerous sites just to adapt to their application. True XCopy deployment of applications and configurations will allow them to spend less time on deployment schemes that need to work around server configurations. Senior programmers on a site will be able to delegate appropriate permissions for configuration changes to junior programmers, just as administrators will delegate permission to developers.

Administrators will find that the delegation in IIS 7.0 greatly assists in lowering the administrative effort required to maintain an IIS server. Administrators will be able to granularly control their servers and site administration functions while allowing developers to control the areas they need to. Security concerns about opening servers to development staff are a thing of the past, and auditors will be pleased with the control available. The reduction in security exposure provided by the modular installation, as well as the ability to provide unified authentication across an entire site, will further help to lock down an already secure system. Administrators will also enjoy the simplified and unified management tools.

Both administrators and developers will appreciate IIS 7.0's tracing and diagnostic capabilities. The abil-ity to see into a request will ease troubleshooting failed requests as well as allow better tuning for per-formance even in completed requests. The modularity of IIS will also appeal to both camps, especially the ability to write custom modules that sit in the request pipeline and affect all requests, whether for a custom authentication system or simply to add a copyright notice to all images or content served.

After reviewing this chapter, you should have a good idea of the changes and new features in IIS 7.0. The following chapters will take you through installing and configuring the web server and environ-ment. If you have a particular interest, feel free to skip to the chapter or chapters covering it. Otherwise, let's take an in-depth look at the architecture of IIS 7.0, followed by planning your installation and installing IIS 7.0.

INETINFO.EXE,ISAPI.EXE,WP.EXE

inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things. When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe


When a request comes into Microsoft's IIS Web server (inetinfo.exe, is ur webserver running) its extension is examined and, based on this extension, the request is either handled directly by IIS or routed to an ISAPI extension. An ISAPI extension is a compiled class that is installed on the Web server and whose responsibility it is to return the markup for the requested file type.

By default, IIS handles the request, and simply returns the contents of the file requested. This makes sense for static files, like images, HTML pages, CSS files, external JavaScript files, and so on. For example, when a request is made for a .html file, IIS simply returns the contents of the requested HTML file.

For files whose content is dynamically generated, the ISAPI extension configured for the file extension is responsible for generating the content for the requested file. For example, a Web site that serves up classic ASP pages has the .asp extension mapped to the asp.dll ISAPI extension. The asp.dll ISAPI extension executes the requested ASP page and returns its generated HTML markup. If your Web site serves up ASP.NET Web pages, IIS has mapped the .aspx to aspnet_isapi.dll, an ISAPI extension that starts off the process of generating the rendered HTML for the requested ASP.NET Web page.

The aspnet_isapi.dll ISAPI extension is a piece of unmanaged code. That is, it is not code that runs in the .NET Framework. When IIS routes the request to the aspnet_isapi.dll ISAPI extension, the ISAPI extension routes the request onto the ASP.NET engine(aspnet_wp.exe), which is written in managed code - managed code is code that runs in the .NET Framework.

Diifference of IIS 6 and IIS 7
Architecture Monolithic Modular
Setup Most Features Installed Minimum installtion based on role
Extended Features ISAPI Filter and ISAPI Extention Added Module&handler managed code
Customize UI Normal Customize for .NET

IIS 7 Authentication:Each application pool is configured to run under the content of a user account and the default value for this account is NETWORKSERVICE.

IIS7 IP Restriction:allowUnlisted". This property was added to make it easier to configure security policies for your system at a global level.

Tuesday, November 3, 2009

Unit Testing

Types of tests?

Load or Stress test (performance)
Function or System tests (manual)
User Acceptance testing (by customer)
Integration test (testing interacting components of the system)

Unit test is basic level test designed to test your s/w at the smallest level.In the concept of OOP's unit testing is done at the method levels and tests the method at the single level class.
As the complexity of the s/w grows there are more chances to erroer in it.

Unit testing has come up within VS2008(Professional edition) with MSTest.If you are using any other edition then you won't have it within.MStest has test menu in VS2008 also we have test project in VS2008.
Other popular 3rd party softwares are NUnit.most popular and it can be downloaded from http://www.nunit.org/index.php
other is MBUNIT http://www.mbunit.com/
XUNIT http://www.codeplex.com/xunit

Now with each software we get the runner which shows us the test results.

Saturday, October 31, 2009

Page life cycle

Page life cycle?
Paga InIt
Load postback data
Load view state
Page Load
Raise post data
Load Events
Prerender
Save Viewstate
Render to HTML
Page Unload

Wednesday, October 28, 2009

SSRS


Major differences between Crystal reports and SSRS?

Ease of hosting reports: using the URL technology in RS we can host reports more easily then in crystal report where we need to make UI for the same.
Supporting Platform:CR can run on windows, IBM and sun, while RS can run only on windows environment.
Client Tools:In SSRS we have BI studion, while in CR its Report designer.
Caching:Is achieved by cache server, while in reporting services, its stored as snapshots in ReportServer database.
Export formats:In CR we have HTML,PDF,Excel,Word,Rft,CSV files whereas in SSRS we have alll the abave plus gives the capability to extend custom reporting formats.
Data Sources:CR support more data sources whereas
Version issue:
Web server support:


How do we access crystal reports in .NET?
Crystal reports comes with Visual studio setup itself. Right click the solution explorer a add new item and you can see a crystal report template as shown in figure 'Crystal report template'. You can add an '.rpt' file using this template.

What are the various components in crystal reports?
There are four major components in crystal reports

1) Report designer

2) Reports engine

3) Report viewer

4) Object models


Report designer gives a graphical interface to create and modify reports.


Reports engine does the formatting and conversion part of crystal reports. It helps convert the contents of reports in word, excel, PDF, HTML and other formats.


Report viewers are controls which you can see on the visual studio tool box; you can drag and drop those controls on an ASPX page or windows application to view reports made using crystal.


Object models help us manage crystal reports objects during design time and run time.

What basic steps are needed to display a simple report in crystal?

To understand this sample let display a simple report using crystal.
Step1:- Create a web application project.

Step2:- Add new item and select crystal report from the template. This adds a new RPT file in your solution explorer.

Step3 :- Double click on the RPT file click on Crystal reports a Field explorer as shown in figure below. You should see the field explorer toolbar.

Step 4 a Right click on 'Database fields' on the field explorer a then click on database expert a Expand create new connection a Expand OLE DB ADO a Select Microsoft OLEDB provider for SQL Server ( this depends on what kind of data you want to connect ) a Give the server credentials a Click finish and done.

Step5 a Right click on 'Database fields' on the field explorer a then click on database expert a Expand the server , database and select table which you want to add to the report. Below figure 'Table added in reports' shows the right pane showing the table added using database expert.

Step 6 a Expand database fields a table ( in this case it is 'FactCurrencyRate' table). Now you can drag and drop the fields on the report.

Step 7 a We now need to display the report on the ASPX page. For that we need the 'CrystalReportViewer' control. So expand the crystal reports section of the toolbar and drag the component on the ASPX page

Step 8:- Now we need to go to code behind and specify the report source. That's it now compile and run the project you can see your report live in action.
e.g CrystalReportViewer.ReportSource="CrystalReport.rpt";


Can crystal reports be published as a web service?
Right click on the 'RPT' file and click 'Publish as web service' as shown in figure 'Publish crystal as web service'.

How do we invoke the crystal report web service?
We can consume the web service as a normal web service in .NET. The easiest way is by using the 'ReportViewerControl' and specifying the ASMX URL in the report source property.

How do we add formulas using crystal reports?

To add any formula in crystal report is a three step procedure. Below figure 'Add formula in crystal report' shows the three steps in a pictorial format. (TOP OF THIS PAGE)
Step 1 a Go to field explorer and right click and click new formula.
Step 2 a Give and name to the formulae and click on 'Use Editor'.
Step 3 a You will be presented with UI which has all the formulas and function.

How do we pass parameters to crystal reports?

Some times we want to accept input parameter and the report works according to the parameter. To add a input parameter go to field explorer , go to parameter fields , right click , create parameter and you should be popped with a dialog box as shown in the figure 'Parameter field'. Give a name to the parameter , type and that's it you are in action.


Figure 10 :- Parameter fields

How do we export from crystal reports?

There are two way of using the export option one is when we display a report using crystal report viewer you can see a export icon as shown in figure 'Export' below. You can the select in which format you want to export.


Figure 11 : - Export

Second option is through coding. Below is a simple code snippet which shows how we can export a report. Create a object of the crystal report and call the 'ExportToDisk' method specifying in which format you want to export.

Dim Report as New CrystalReport1
Report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.WordForWindows,"c:\my.doc")

How do we print to printer using crystal?

In print we have two ways by which we can print one is when you display the report using crystal report viewer you have a print option and second is by code. Below is a simple code snippet which shows how we have created a object called as report from the rpt file , specified the printer name , paper size and then called the 'PrintToPrinter' method.

Report.PrintOptions.PrinterName = "MyPrinter"
Report.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4
Report.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape
Report.PrintToPrinter(1, True, 1, 3)

How do we generate cross tab reports?

When we go for creating a new report you can see the cross -tab option.


Figure 12 : - Cross tab reports

How can we do grouping in crystal?

For grouping in crystal you need to use the group expert wizard.

Can you explain three-pass reporting which crystal report uses?

Crystal report uses the three pass method for parsing reports. Before we understand what does it means lets define what is a pass ?. Pass is a process used by crystal reports to read and manipulate data as per the report format. Below figure 'Three pass method' shows how the parsing happens. Let's understand the same step by step. In Pre-Pass1 crystal report engine evaluates constants like x=1 and pie=3.14 for a report. Pass 1 does two important things get data from the database and sort records with given conditions. Once this is done it's saved in memory and given to pre-pass2 for further parsing and manipulation. Pre-pass2 is all about grouping and sorting the records according to conditions specified in the crystal report. Pass 2 formats a report, applies condition and groups them. Pass 3 is the final tunnel it just counts the pages and generates reports.


Figure 13 :- Three pass method

Can you explain reporting services architecture?

Reporting services is mainly used to generate reports. Below are the main components of reporting services as shown in figure 'Reporting Services Architecture'. Reporting services has four major components Client, Web services, report server/manager and reporting services database. Let's understand all the major components and the sub components of the same.


Figure 14 : - Reporting Services Architecture

Client: - These are the consumers of reporting services functionality. It can be the report manager or report server (we will discuss report server and manager in more details further) or ASPX and windows application.

Reporting Web service: - Microsoft chose XML to expose the functionality of reporting services. So all the functionality is exposed through web services. One of the most important gains for a web service is that it can be platform independent.

Report server / manager: - Report server and manager forms the core engine of reporting services. They two important systems one is 'Report processor' and the other is

'Scheduling and Delivery processor'. Reporting processor is the main driver to deliver reports. They take request from the end user and process the report and send it to the end client. Figure 'Report Processor' shows how the flow moves. We have seven basic steps which can help us understand in more detail how the report processor works. Step 1 a Any client like ASPX or windows application will request to the web service for reports. Step 2 and 3 a Web service will forward the request to the report processor and get the report definition from the report server DB. Step 4 a Reporting services uses the security extensions to authenticate the end user. Step 5 a Data processing extension calls queries the application database to get data. With data processing extension we can connect to standard data sources like SQL Server, ODBC, Oracle etc. You can also extend the data processing extension to adapt it to some custom data processing extension. Step 6 a Rendering extension then renders the report applies format and sends the same to the end client. Using rendering extension you can deliver reports in Excel, PDF, HTML, CSV and XML. You can also extend the rendering extension to deliver in custom formats.


Figure 15 : - Report Processor

The second system is 'Scheduling and Delivery processor'. Delivery extensions makes reports with the specified format and sends the same to an output target like file, email, FTP etc. Scheduling and delivery processor does two important steps schedules reports and delivers them the same to a output like FTP,Email etc. Schedule and delivery processor using delivery extension to deliver reports to the defined output. So users can subscribe to the reports and depending on these subscriptions the delivery is done by schedule and delivery processor. There are two steps in this one is the subscription process and the other is deliver process. Lets first try to understand the subscription process. There are three steps basically:-
Step 1 a First is the requests a subscription to the report.
Step 2a This subscription is then stored in the report server DB.
Step 3 a A new SQL Server agent is created for this subscription. So we have completed the subscription process.


Figure 16 : - Subscription process

Now that the subscription is created lets see how the delivery process works. Here are five basic steps in delivery process. Step 1 a When the event occurs SQL Server agent makes an entry in the report server DB. Step 2 and 3 a RS windows service keeps polling SQL Server for any events. If a event has occurred it gets the event from the database and sends a message to the 'Scheduling and Delivery Processor'. Step 4 a The report is then processed by the report processor and sent to the delivery extension who finally delivers it on a output which can be a email address, folder, FTP or any other kind of output.


Figure 17 : - Delivery process

Reporting Services Database:- When you install reporting services you will see two databases 'ReportServer' and 'ReportServerTempDB'.'ReportServer' database contains report definitions, schedule, subscriptions, security details and snapshots. 'ReportServerTempDB' stores temporary information like session state about reports which is needed in between HTTP requests and report cache information. Please note snapshots are stored in reportserver and not in tempDB.


Figure 18 :- Databases of reporting services

Saturday, September 19, 2009

FLEX

RIA developers are making applications that people didn't think were possible. With Flex, you can create full enterprise-scale Web applications that have as much interactivity as the best desktop applications. Flex enables some exciting possibilities

What is FLEX?
Adobe Flex is an application development platform that you can use to build Rich Internet Applications (RIAs). Flex applications are Web-based, but they provide immersive levels of interactivity and rich media experiences that make them seem more like computer desktop programs than traditional Web applications. Flex is the ideal technology to use when you want to create complex data visualization, performance dashboards, multimedia experiences, and countless other interactive applications. RIAs are raising the bar for Web applications, and Flex is leading the way
Flex is an application development framework and toolset that you can use to create RIAs. These applications are delivered over the Internet by using the Flash Player.

What an RIA (Rich Internet Application?
It describes a new model for application development that separated the back-end data services from a rich front-end client. One of the cornerstones of RIA development is the ability to asynchronously load data within the application. Simple HTML Web pages require a full page refresh to load new data. RIAs, on the other hand, load data asynchronously, which means they can load chunks of data without requiring page refreshes and they keep track of the application state in memory. Flex applications are stateful clients, which means they store data about the current state of the application, such as the content of a shopping cart, in memory in the client..
RIAs usually load data by using eXtensible Markup Language (XML). Asynchronously loading XML is an integral part of all RIA technologies (not only Flex). Version 4 of Flash, which was released in 1999, was the first version of Flash that let developers load external XML data into Flash applications

HISTORY
Flex 1 and 1.5, were expensive server-based products. A license for Flex 1.5 cost about $15,000, and you had to deploy a server application that would compile your Flex applications and serve them to the user. These initial versions of Flex were based on Flash Player 7 and ActionScript 2, and the code editor was based on the Macromedia Dreamweaver editor.
Flex 2 marked a dramatic shift in the product line. Flex 2 was no longer a server technology at all; instead, Flex was a completely clientside product. The cost dropped dramatically, and Adobe rewrote the entire Flex framework and the Integrated Development Environment (IDE) from the ground up. Flex 2 was based on Flash Player 9 and ActionScript 3, which brought serious performance gains
Flex 3 added additional functionality to Flex Builder, such as refactoring and enhanced styling support, as well as new data visualization components in the Flex framework. Flex 3 also marked the official open-source release of the Flex SDK and Flex compiler. For more on the open-source aspect of Flex, visit http://opensource.adobe.com.
Flex 4, codenamed Gumbo (coming soon)

FLEX Components
§ Languages: ActionScript 3 and MXML
You use a combination of ActionScript, a scripting language, and MXML, a markup language, to create Flex applications. MXML is similar to HTML, so if you have experience creating HTML Web pages, then you should be able to figure out MXML pretty easily.
§ Component framework: Flex SDK
The Flex SDK (also known as the Flex framework) is a set of user interface components, such as lists, buttons, and charts, that you use to build Flex applications. The Flex SDK (with the exception of the charting package) is free and open source.
§ Integrated Development Environment (IDE): Flex Builder
You use Flex Builder to edit your code, compile your applications, debug your code, and profile performance. Flex Builder is an integrated development environment (IDE) sold by Adobe.
§ Cross-browser runtime: Flash Player
You deploy Flex applications in a Web browser with the Flash Player plug-in. You can also deploy Flex applications as standalone desktop applications by using the Adobe Integrated Runtime (AIR).

Microsoft's Silverlight platform and Sun's JavaFX are two RIA development products aimed directly at taking on Flex
FLASH VS FLEX
§ The Flex framework: Flash has its own component set that has some of the same functionality as the Flex SDK, but it does not provide as many components and does not include charting components, layout containers, and other framework features that are very useful for developing large applications.
§ MXML: You can use MXML markup to create your Flex applications, but this markup language is not available in Flash. Flash does use the same ActionScript 3 scripting language, however.
§ A powerful Integrated Development Environment (IDE): Flex Builder was designed specifically to build applications, as opposed to the Flash Authoring tool, which was originally designed to create animations. You can use both tools to create RIAs, but Flex Builder has features like code-hinting, a powerful debugger, and a profiler that make it a more powerful development tool.
You can use Flash, rather than Flex, to create RIAs, but you have to work in the Flash Authoring environment, which means you don't get the benefits of Flex Builder (such as code hinting), and you can't use the MXML markup language. You may find the Flash Authoring tool really helpful if you're creating animated movies. It uses the timeline metaphor when you create animations and includes drawing tools. Flex Builder, on the other hand, is designed for application development, not animation creation. Flex Builder doesn't include any drawing tools, and it has no timeline.

Flex VS Ajax
Asynchronous JavaScript and XML (AJAX) is a technique that you can use to load data into HTML Web pages without refreshing the full page. Instead of sending a new HTML page to the user's Web browser for every change, AJAX applications send XML asynchronously and update relevant portions of the screen when needed. By using AJAX, you often end up with a much more responsive user interface and a more desktop-like application experience. Flex applications also asynchronously load XML data.

ActionScript VS JavaScript
Multimedia capabilities: Flash Player allows you to create a whole range of rich multimedia experiences that you simply can't achieve by using HTML and JavaScript. Flash has powerful graphics capabilities that can do complex drawing and image manipulation. In addition, Flash supports audio and video streaming, so many leading online video sites use it to play video on the Web.
Cross-browser support: You can be sure that any Flex application you develop will look and behave the same way in all browsers on all platforms. Web browsers all have their own quirks and idiosyncrasies when it comes to how they render HTML and even how they run JavaScript. When you develop AJAX applications, you need to test your application in multiple Web browsers to make sure your application is compatible with them all. However, because Flex applications rely on the Flash Player, you can be assured that your application will look the same, pixel for pixel, and behave the same across all browsers.

Flex VS SilverLight
Microsoft's competitive RIA technology is Silverlight, a browser plug-in, like Adobe's Flash Player. Just like you have to install the Flash Player plug-in to run Flex applications, you need the Silverlight plug-in to run Silverlight applications. Because Silverlight is fairly new, the Silverlight plug-in isn't nearly as common as Flash Player. Silverlight will likely become more widely used in the future, but right now, the Flash Player plug-in has a strong advantage because of the large number of computers on which it is installed.
The first release of Silverlight 1.0 included the browser plug-in and focused on streaming video on the Web. This release certainly competed with Flash Player because it focused on some of the media features of Flash, but it didn't really threaten Flex's position because Silverlight 1.0 didn't contain a set of user interface controls that you could use to build RIAs. Silverlight 1.0 provided all the low-level graphics capabilities but none of the application frame-work pieces.
In early 2008, Microsoft released the first beta version of Silverlight 2.0 (originally named Silverlight 1.1), which included a set of UI controls, such as a DataGrid, CheckBox, and Slider. These new controls make Silverlight a closer competitor with Flex. The competition between Flex and Silverlight has just begun, and it's too early to draw any firm conclusions about how serious a competitor Silverlight will become.
AIR (Adobe Integrated Runtime)
Adobe developed Adobe Integrated Runtime (AIR), previously code-named Apollo, to let you deploy Flex applications as computer desktop applications. By using AIR, you can create your own desktop applications that can run natively on Windows, Mac, and Linux operating systems. You can create AIR applications as Flex applications or AJAX applications, so if you know how to create Flex or AJAX applications, you can create desktop applications, too.
When deciding whether AIR is the right technology for your application, consider these three main features that AIR provides:
§ Local file-system access: One of the main reasons for moving from a Web-based Flex application to a desktop AIR application is the integrated local file-system access that AIR offers. If you build a Flex-based AIR application, you get a few extra tools that don't come in the normal Flex framework. These tools let you read and write to the user's local file system.
§ Integrated Web browser: The AIR runtime includes a built-in Web browser: the open-source WebKit browser. This Web browser allows you to load full HTML pages right into your application, something that you can't do in a Web-based Flex application. The AIR framework also lets you display PDF files within your application.
§ Embedded SQLite database: AIR applications can access an embedded database for offline database access. So, you can build applications that can connect to a server database (like a typical Flex application can) or to an offline database if your application is only occasionally connected to the Internet

Friday, September 18, 2009

XML

What is XML?
XML, Extensible Markup Language, is an open, text based markup language that provides structural and semantic information to data. XML is a metalanguage that can be used to create other language. It is used to structure and describe data that can be understood by other applications. Using XML, we can separate the user interface from data.

Features of XML ?
XML is a generalized markup language that means one can define his/her own tag sets.A valid XML document contains rules and is self-describing.The rules that are found in DTD allow the documents to be validated.


Describe the logical structure of XML.
XML documents comprise of declaration, elements and comments

XML Declaration
It identifies the version to which XML conforms


Document Type Declaration
It consists of markup code that indicates grammar rules or Document Type Definition (DTD) for the particular class of document.

This statement tells the XML processor that the document is of the class Car that conforms the rules specified in the DTD "cr.dtd".

Document element
The document element contains data of an XML document.


Why is XML so popular?
Due to the following advantages of using XML, it has become popular:
It supports Unicode. Therefore documents written in any human language can be communicated.
Data structures: records, lists and trees can be represented using XML.
Its format describes structure, field names and their specific values too. Its therefore called self-documenting.
Its syntax and parsing requirements make the necessary parsing algorithms very simple, efficient, and consistent.
It can be used as a document storage and processing format.
It is platform-independent.

HTTP Protocol

What information is contained in HTTP Header?
From client

Header data that consists of configuration information about the client and its document viewing preferences
From server
header from the server contains information about the server software and the document sent to the client.

Authentication

What are the various ways of authentication techniques in ASP.NET?
Selecting an authentication provider is as simple as making an entry in the web.config file for the application. You can use one of these entries to select the corresponding built in authentication provider:



√ Custom authentication where you might install an ISAPI filter in IIS that compares incoming requests to list of source IP addresses, and considers requests to be authenticated if they come from an acceptable address. In that case, you would set the authentication mode to none to prevent any of the .net authentication providers from being triggered.


Windows authentication and IIS If you select windows authentication for your ASP.NET application, you also have to configure authentication within IIS. This is because IIS provides Windows authentication. IIS gives you a choice for four different authentication methods: ----------------Anonymous,basic,digest and windows integrated
If you select anonymous authentication, IIS doesn’t perform any authentication, Any one is allowed to access the ASP.NET application.
If you select basic authentication, users must provide a windows username and password to connect. How ever this information is sent over the network in clear text, which makes basic authentication very much insecure over the internet.
If you select digest authentication, users must still provide a windows user name and password to connect. However the password is hashed before it is sent across the network. Digest authentication requires that all users be running Internet Explorer 5 or later and that windows accounts to stored in active directory.
If you select windows integrated authentication, passwords never cross the network. Users must still have a username and password, but the application uses either the Kerberos or challenge/response protocols authenticate the user. Windows-integrated authentication requires that all users be running internet explorer 3.01 or later Kerberos is a network authentication protocol. It is designed to provide strong authentication for client/server applications by using secret-key cryptography. Kerberos is a solution to network security problems. It provides the tools of authentication and strong cryptography over the network to help to secure information in systems across entire enterprise

Passport authentication
Passport authentication lets you to use Microsoft’s passport service to authenticate users of your application. If your users have signed up with passport, and you configure the authentication mode of the application to the passport authentication, all authentication duties are off-loaded to the passport servers.
Passport uses an encrypted cookie mechanism to indicate authenticated users. If users have already signed into passport when they visit your site, they’ll be considered authenticated by ASP.NET. Otherwise they’ll be redirected to the passport servers to log in. When they are successfully log in, they’ll be redirected back to your site
To use passport authentication you have to download the Passport Software Development Kit (SDK) and install it on your server. The SDK can be found at http:// msdn.microsoft.com/library/default.asp?url=/downloads/list/websrvpass.aps. It includes full details of implementing passport authentication in your own applications.

Forms authentication
Forms authentication provides you with a way to handle authentication using your own custom logic with in an ASP.NET application. The following applies if you choose forms authentication.
√ When a user requests a page for the application, ASP.NET checks for the presence of a special session cookie. If the cookie is present, ASP.NET assumes the user is authenticated and processes the request.
√ If the cookie isn’t present, ASP.NET redirects the user to a web form you provide201 You can carry out whatever authentication, it check’s you like it checks your form. When the user is authenticated, you indicate this to ASP.NET by setting a property, which creates the special cookie to handle subsequent requests.

Validation Controls

How many types of validation controls are provided by ASP.NET ?
There are six main types of validation controls :-

RequiredFieldValidator It checks whether the control have any value. It's used when you want the control should not be empty.
RangeValidator It checks if the value in validated control is in that specific range.
Example TxtCustomerCode should not be more than eight length.
CompareValidator It checks that the value in controls should match some specific value. Example Textbox TxtPie should be equal to 3.14.
RegularExpressionValidator When we want the control value should match with a specific regular expression.
CustomValidator It is used to define UserDefined validation.
ValidationSummary It displays summary of all current validation errors.

Indexer

What is Indexer ?
An indexer is a member that enables an object to be indexed in the same way as an array.

OOP

What is Object Oriented Programming ?
It is a problem solving technique to develop software systems. It is a technique to think real world in terms of objects. Object maps the software model to real world concept. These objects have responsibilities and provide services to application or other objects.


What’s a Class ?
A class describes all the attributes of objects, as well as the methods that implement the behavior of member objects. It’s a comprehensive data type which represents a blue print of objects. It’s a template of object.


What’s an Object ?
It is a basic unit of a system. An object is an entity that has attributes, behavior, and identity. Objects are members of a class. Attributes and behavior of an object are defined by the class definition.


What is the relation between Classes and Objects ?
They look very much same but are not same. Class is a definition, while object is a instance of the class created. Class is a blue print while objects are actual objects existing in real world. Example we have class CAR which has attributes and methods like Speed, Brakes, Type of Car etc. Class CAR is just a prototype, now we can create real time objects which can be used to provide functionality. Example we can create a Maruti car object with 100 km speed and urgent brakes


What are different properties provided by Object-oriented systems ?

Abstraction It allows complex real world to be represented in simplified manner. Example color is abstracted to RGB. By just making the combination of these three colors we can achieve any color in world.It’s a model of real world or concept.
Encapsulation It is a process of hiding all the internal details of an object from the outside world.
Communication using messages When application wants to achieve certain task it can only be done using combination of objects. A single object can not do all the task. Example if we want to make order processing form.We will use Customer object, Order object, Product object and Payment object to achieve this functionality. In short these objects should communicate with each other. This is achieved when objects send messages to each other.
Object lifetime All objects have life time.Objects are created ,and initialized, necessary functionalities are done and later the object is destroyed. Every object have there own state and identity which differ from instance to instance.
Class hierarchies (Inheritance and aggregation) Twist :- What is difference between Association, Aggregation and Inheritance relationships? In object oriented world objects have relation and hierarchies in between them. There are basically three kind of relationship in Object Oriented world :-
Association This is the simplest relationship between objects. Example every customer has sales. So Customer object and sales object have an association relation between them. Aggregation This is also called as composition model. Example in order to make a "Accounts" class it has use other objects example "Voucher", "Journal" and "Cash" objects. So accounts class is aggregation of these three objects.
Inheritance Hierarchy is used to define more specialized classes based on a preexisting generalized class. Example we have VEHICLE class and we can inherit this class make more specialized class like CAR, which will add new attributes and use some existing qualities of the parent class. Its shows more of a parent-child relationship. This kind of hierarchy is called inheritance.
Polymorphism When inheritance is used to extend a generalized class to a more specialized class, it includes behavior of the top class(Generalized class). The inheriting class often implement a behavior that can be somewhat different than the generalized class, but the name of the behavior can be same. It is important that a given instance of an object use the correct behavior, and the property of polymorphism allows this to happen automatically.


What are abstract classes ?
Following are features of a abstract class :-
√ You can not create a object of abstract class175
√ Abstract class is designed to act as a base class (to be inherited by other classes). Abstract class is a design concept in program development and provides a base upon which other classes are built.
√ Abstract classes are similar to interfaces. After declaring an abstract class, it cannot be instantiated on its own, it must be inherited.
√ In VB.NET abstract classes are created using "MustInherit" keyword.In C# we have "Abstract" keyword.
√ Abstract classes can have implementation or pure abstract methods which should be implemented in the child class.


what are Interfaces?
Interfaces are components used to declare a set of methods. However, the data members of an interface are not implemented. C# allows you to group related data by using structs. However, to group related methods, properties, indexers, and events, you use interfaces. Interfaces contain only method declarations; therefore, you cannot create an instance of an interface. However, you need to declare an interface by using the interface keyword. interface
{
- - - - - - - - - - - - - - - - -
}
Interface declarations do not include a modifier because all interfaces are public by default. Interfaces cannot be abstract, sealed, virtual, or static. However,you can use the new modifier with nested interfaces. The new modifier is used when you need to hide an inherited namespace by the same name as the base namespace. In situations where you want the members of a class to exhibit certain features, you can group these members in an interface. The class can then implement the
interface. The classes in C# can also implement multiple interfaces. Implementing an interface implies that a class is derived from the interface and the class implements all the members of that interface. Consider the following example of the Employee class that implements two interfaces:

interface Employee
{
- - - - - - - - - - - -
}
interface Salary
{
- - - - - - - - - - - -
}
class Employee: Employee, Salary
{
- - - - - - - - - - - -
}
Therefore, the class Employee implements all the methods declared in the interfaces
Employee and Salary.
Similar to classes, interfaces can also be inherited. These interfaces are called explicit base interfaces. C# does not support multiple inheritance of classes. However, you can achieve multiple inheritance in C# by using interfaces. In the previous example, if the interface Salary was inherited from Employee, the interface declaration statement would be:
interface Salary: Employee
{
- - - - - - - - - - - -
}
In C#, if a class implements an interface, the class also implicitly implements its base interfaces.
TIP By now, you have learned about the basic components of C# that you can use to write programs in C#. The next sections look at writing a simple program in C# and then compiling and executing it.

Thursday, September 17, 2009

SQL

Increase SQL performance?

  • Every index increases the time takes to perform INSERTS, UPDATES and
    DELETES, so the number of indexes should not be too much. Try to use
    maximum 4-5 indexes on one table, not more. If you have read-only table,
    then the number of indexes may be increased

    Keep your indexes as narrow as possible. This reduces the size of the index
    and reduces the number of reads required to read the index.
    (2) Try to create indexes on columns that have integer values rather than character
    values.
    (3) If you create a composite (multi-column) index, the order of the columns in
    the key are very important. Try to order the columns in the key as to enhance
    selectivity, with the most selective columns to the leftmost of the key.
    (4) If you want to join several tables, try to create surrogate integer keys for this
    purpose and create indexes on their columns.
    (5)Create surrogate integer primary key (identity for example) if your table will
    not have many insert operations.
    (6)Clustered indexes are more preferable than nonclustered, if you need to select
    by a range of values or you need to sort results set with GROUP BY or ORDER
    BY.
    (7)If your application will be performing the same query over and over on the
    same table, consider creating a covering index on the table.
    (8)You can use the SQL Server Profiler Create Trace Wizard with "Identify Scans
    of Large Tables" trace to determine which tables in your database may need
    indexes. This trace will show which tables are being scanned by queries instead
    of using an index.

What’s difference between "Optimistic" and "Pessimistic" locking ?
In pessimistic locking when user wants to update data it locks the record and till then no one can update data. Other user’s can only view the data when there is pessimistic locking. In optimistic locking multiple users can open the same record for updating, thus increase maximum concurrency. Record is only locked when updating the record. This is the most preferred way of locking practically. Now a days browser based application is very common and having pessimistic locking is not a practical solution.


What is a candidate key ?
A table may have more than one combination of columns that could uniquely identify the rows in a table; each combination is a candidate key. During database design you can pick up one of the candidate keys to be the primary key.
For example, in the supplier table supplierid and suppliername can be candidate key but you will only pick up supplierid as the primary key.

What are the different types of joins? What is the difference between them ?
INNER JOIN Inner join shows matches only when they exist in both tables.
Example, in the below SQL there are two tables Customers and Orders and the inner join in made on Customers Customerid and Orders Customerid.So this SQL will only give you result with customers who have orders.If the customer does not have order it will not display that record.
SELECT Customers.*, Orders.* FROM Customers INNER JOIN Orders ON Customers.CustomerID =Orders.CustomerID

LEFT OUTER JOIN Left join will display all records in left table of the SQL statement.In SQL below customers with or without orders will be displayed. Order data for customers without orders appears as NULL values. For example, you want to determine the amount ordered by each customer and you need to see who has not ordered anything as well. You can also see the LEFT OUTER JOIN as a mirror image of the

RIGHT OUTER JOIN if you switch the side of each table.
SELECT Customers.*, Orders.* FROM Customers LEFT OUTER JOIN Orders ON Customers.CustomerID =Orders.CustomerID278

RIGHT OUTER JOIN Right join will display all records in right table of the SQL statement. In SQL below all orders with or without matching customer records will be displayed. Customer data for orders without customers appears as NULL values.
For example, you want to determine if there are any orders in the data with undefined CustomerID values (say, after a conversion or something like it). You can also see the RIGHT OUTER JOIN as a mirror image of the LEFT OUTER JOIN if you switch the side of each table. SELECT Customers.*, Orders.* FROM Customers RIGHT OUTER JOIN Orders ON Customers.CustomerID =Orders.CustomerID

What are indexes? What is the difference between clustered and nonclustered indexes?
Indexes in SQL Server are similar to the indexes in books. They help SQL Server retrieve the data quickly. There are clustered and nonclustered indexes. A clustered index is a special type of index that reorders the way in which records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages. A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf node of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows.

Design Patterns


What are design patterns ?
Design patterns are recurring solution to recurring problems in software architecture.

Design Patterns are basically divided into 3 classifactions.
Creational patterns.
Structural patterns.
Behavioral patterns.

1) Creational Patterns
√ Abstract Factory:- Creates an instance of several families of classes
√ Builder :- Separates object construction from its representation
√ Factory Method:- Creates an instance of several derived classes
√ Prototype:- A fully initialized instance to be copied or cloned
√ Singleton:- A class in which only a single instance can exist
Note :- The best way to remember Creational pattern is by ABFPS (Abraham Became First President of States).


2) Structural Patterns
√ Adapter:-Match interfaces of different classes.
√ Bridge:-Separates an object’s interface from its implementation.
√ Composite:-A tree structure of simple and composite objects.
√ Decorator :-Add responsibilities to objects dynamically.
√ Façade:-A single class that represents an entire subsystem.
√ Flyweight:-A fine-grained instance used for efficient sharing.
√ Proxy:-An object representing another object. 8..NET Architecture229
Note : To remember structural pattern best is (ABCDFFP)


3) Behavioral Patterns
√ Mediator:-Defines simplified communication between classes.
√ Memento:-Capture and restore an object's internal state.
√ Interpreter:-A way to include language elements in a program.
√ Iterator:-Sequentially access the elements of a collection.
√ Chain of Resp:-A way of passing a request between a chain of objects.
√ Command:-Encapsulate a command request as an object.
√ State:-Alter an object's behavior when its state changes.
√ Strategy:-Encapsulates an algorithm inside a class.
√ Observer:-A way of notifying change to a number of classes.
√ Template Method:-Defer the exact steps of an algorithm to a subclass.
√ Visitor:-Defines a new operation to a class without change.
Note :- Just remember Music....... 2 MICS On TV (MMIICCSSOTV). Note:- No source code is provided for architecture section as much of the things can be clear from good UML diagrams.


What is MVC pattern?
The main purpose using MVC pattern is to decouple the GUI from the Data. It also gives the ability to provide multiple views for the same Data. MVC pattern separates objects in to three important sections:-
Model: - This section is specially for maintaining data. It is actually where your business logic, querying database, database connection etc. is actually implemented.
Views: - Displaying all or some portion of data, or probably different view of data. View is responsible for look and feel, Sorting, formatting etc.
Controller: - They are event handling section which affects either the model or the view. Controller responds to the mouse or keyboard input to command model and view to change. Controllers are associated with views. User interaction triggers the events to change the model, which in turn calls some methods of model to update its state to notify other registered views to refresh their display.

MVC sections:-
Model: - This section is represented by Data view, Dataset, Typed Dataset, Business components, business entity models etc. Now this section can then be tied up to either windows application or web UI.
View: - ASPX, ASCX, or windows application UI like data grid etc. form the view part of it.
Controller: - In ASP.NET the behind code is the controller as the events are handled by that part. Controller communicates both with Model as well as view. I hope I was able to map you imagination of ASP.NET with the diagram given below.


How can we implement singleton pattern in .NET?
Singleton pattern mainly focuses on having one and only one instance of the object running. Example a windows directory service which has multiple entries but you can only have single instance of it through out the network.
Note:- May of developers would jump to a conclusion saying using the "STATIC" keyword we can have a single instance of object. But that’s not the real case there is something more that has to be done. But please note we can not define a class as STATIC, so this will not serve our actual purpose of implementing singleton pattern.

Following are the three steps needed to implement singleton pattern in .NET:-
√ First create your class with static members.
Public class ClsStaticClass
Private shared objCustomer as clsCustomer
End class
This ensures that there is actually only one Customer object throughout the project.
√ Second define a private constructor to your class. Note: - defining a private constructor to class does not allow a client to create objects directly.
√ Finally provide a static method to get access to your singleton object.

Wednesday, September 16, 2009

Linking Servers


A QUESTION CAN BE ASKED HOW TO CALL A STORED PROCEDURE OF ORACLE DATABASE FROM SQLSERVER DATABASE STORED PROCEDURE
A linked server configuration enables SQL Server to execute commands against OLE DB data sources on remote servers

Linked servers offer the following advantages:
  1. Remote server access.
  2. The ability to issue distributed queries, updates, commands, and transactions on heterogeneous data sources across the enterprise.
  3. The ability to address diverse data sources similarly.

Typically, linked servers are used to handle distributed queries. When a client application executes a distributed query through a linked server, SQL Server parses the command and sends requests to OLE DB. The rowset request may be in the form of executing a query against the provider or opening a base table from the provider.
For a data source to return data through a linked server, the OLE DB provider (DLL) for that data source must be present on the same server as the instance of SQL Server.
When a third-party OLE DB provider is used, the account under which the SQL Server service runs must have read and execute permissions for the directory, and all subdirectories, in which the provider is installed.

Sharepoint 2007

What is SharePoint?
SharePoint is an enterprise information portal, from Microsoft, that can be configured to run Intranet, Extranet and Internet sites. Microsoft Office SharePoint Server 2007 allows people, teams and expertise to connect and collaborate. A SharePoint enterprise portal is composed of both SharePoint Portal and Windows SharePoint Services, with SharePoint being built upon WSS. WSS is typically used by small teams, projects and companies. SharePoint Server is designed for individuals, teams and projects within a medium to large company wide enterprise portal.

What is Microsoft Windows SharePoint Services? How is it related to Microsoft Office SharePoint Server 2007?
Windows SharePoint Services is the solution that enables you to create Web sites for information sharing and document collaboration. Windows SharePoint Services -- a key piece of the information worker infrastructure delivered in Microsoft Windows Server 2003 -- provides additional functionality to the Microsoft Office system and other desktop applications, and it serves as a platform for application development.

Office SharePoint Server 2007 builds on top of Windows SharePoint Services 3.0 to provide additional capabilities including collaboration, portal, search, enterprise content management, business process and forms, and business intelligence.


Why should you use SharePoint?
• As companies grow so does the amount of their files. It soon becomes difficult to keep track of the multiplying documents and their locations. SharePoint overcomes this by allowing you to store and share your files in a central site.
• Sharing work files through email is a cumbersome process. SharePoint eliminates this by allowing files to be stored in one location, allowing easy access to all team members.
• Business Intelligence has traditionally remained in the hands of a few key decision makers within organizations. For years, it has been the goal of BI providers to “democratize business intelligence” by making it available to all levels of workers throughout companies. With the addition of PerformancePoint to the SharePoint Enterprise version of SharePoint, this vision is realized, finally taking business intelligence out of the hands of the few and into the hands of many.
• Today’s work occurs over multiple locations, whether it is in different countries, office locations, separate departments or at your home office. SharePoint enables teams and individuals to connect and collaborate together regardless of where they are located.
• Surveys have shown that employees can spend up to 20 – 30 % of their day searching for data and information. SharePoint eliminates this drag on productivity by providing the robust search functionality needed to find the information and expertise buried in the thousands, or hundreds of thousands of files a company generates in the course of business.
• It’s difficult and time consuming to create and maintain sites. SharePoint allows anyone to create sites for use within their company’s Intranet, as they are needed, whether they are departmental sites, document libraries, meetings sites, survey sites, or discussion boards.

Microsoft Office SharePoint Server 2007 Top 10 Benefits?

Provide a simple, familiar, and consistent user experience
.
Office SharePoint Server 2007 is tightly integrated with familiar client desktop applications, e-mail, and Web browsers to provide a consistent user experience that simplifies how people interact with content, processes, and business data. This tight integration, coupled with robust out-of-the-box functionality, helps you employ services themselves and facilitates product adoption.

Boost employee productivity by simplifying everyday business activities.
Take advantage of out-of-the-box workflows for initiating, tracking, and reporting common business activities such as document review and approval, issue tracking, and signature collection. You can complete these activities without any coding. Tight integration with familiar client applications, e-mail, and Web browsers provide you with a simple, consistent experience. Modifying and extending these out-of-the-box workflow processes is made easy through tools like Microsoft Office SharePoint Designer 2007 (the next release of Microsoft Office FrontPage).

Help meet regulatory requirements through comprehensive control over content.
By specifying security settings, storage policies, auditing policies, and expiration actions for business records in accordance with compliance regulations, you can help ensure your sensitive business information can be controlled and managed effectively. And you can reduce litigation risk for your organization. Tight integration of Office SharePoint Server 2007 with familiar desktop applications means that policy settings are rendered onto client applications in the Microsoft Office system, making it simpler for employees to be aware of and comply with regulatory requirements.

Effectively manage and repurpose content to gain increased business value.
Business users and content authors can create and submit content for approval and scheduled deployment to intranet or Internet sites. Managing multilingual content is simplified through new document library templates that are specifically designed to maintain a relationship between the original version and different translations of a document.

Simplify organization-wide access to both structured and unstructured information across disparate systems.
Give your users access to business data found in common line-of-business systems like SAP and Siebel through Office SharePoint Server 2007. Users can also create personalized views and interactions with business systems through a browser by dragging configurable back-end connections. Enterprise-wide Managed Document Repositories help your organizations store and organize business documents in one central location.

Connect people with information and expertise.
Enterprise Search in Office SharePoint Server 2007 incorporates business data along with information about documents, people, and Web pages to produce comprehensive, relevant results. Features like duplicate collapsing, spelling correction, and alerts improve the relevance of the results, so you can easily find what you need.

Accelerate shared business processes across organizational boundaries.
Without coding any custom applications, you can use smart, electronic forms–driven solutions to collect critical business information from customers, partners, and suppliers through a Web browser. Built-in data validation rules help you gather accurate and consistent data that can be directly integrated into back-end systems to avoid redundancy and errors that result from manual data re-entry.

Share business data without divulging sensitive information.
Give your employees access to real-time, interactive Microsoft Office Excel spreadsheets from a Web browser through Excel Services running on Office SharePoint Server 2007. Use these spreadsheets to maintain and efficiently share one central and up-to-date version while helping to protect any proprietary information embedded in the documents (such as financial models).

Enable people to make better-informed decisions by presenting business-critical information in one central location. /
Office SharePoint Server 2007 makes it easy to create live, interactive business intelligence (BI) portals that assemble and display business-critical information from disparate sources, using integrated BI capabilities such as dashboards, Web Parts, scorecards, key performance indicators (KPIs), and business data connectivity technologies. Centralized Report Center sites give users a single place for locating the latest reports, spreadsheets, or KPIs.

Provide a single, integrated platform to manage intranet, extranet, and Internet applications across the enterprise.
Office SharePoint Server 2007 is built on an open, scalable architecture, with support for Web services and interoperability standards including XML and Simple Object Access Protocol (SOAP). The server has rich, open application programming interfaces (APIs) and event handlers for lists and documents. These features provide integration with existing systems and the flexibility to incorporate new non-Microsoft IT investments.

Top 10 Benefits of Windows SharePoint Services?

Improve team productivity with easy-to-use collaborative tools
Connect people with the information and resources they need. Users can create team workspaces, coordinate calendars, organize documents, and receive important notifications and updates through communication features including announcements and alerts, as well as the new templates for creating blogs and wikis. While mobile, users can take advantage of convenient offline synchronization capabilities.

Easily manage documents and help ensure integrity of content
With enhanced document management capabilities including the option to activate required document checkout before editing, the ability to view revisions to documents and restore to previous versions, and the control to set document- and item-level security, Windows SharePoint Services can help ensure the integrity of documents stored on team sites.

Get users up to speed quickly
User interface improvements in Windows SharePoint Services 3.0 include enhanced views and menus that simplify navigation within and among SharePoint sites. Integration with familiar productivity tools, including programs in the Microsoft Office system, makes it easy for users to get up to speed quickly. For example, users can create workspaces, post and edit documents, and view and update calendars on SharePoint sites, all while working within Microsoft Office system files and programs.

Deploy solutions tailored to your business processes
While standard workspaces in Windows SharePoint Services are easy to implement, organizations seeking a more customized deployment can get started quickly with application templates for addressing specific business processes or sets of tasks.

Build a collaboration environment quickly and easily
Easy to manage and easy to scale, Windows SharePoint Services enables IT departments to deploy a collaborative environment with minimal administrative time and effort, from simple, single-server configurations to more robust enterprise configurations. Because deployment settings can be flexibly changed, less pre-planning time is required and companies can get started even faster.

Reduce the complexity of securing business information
Windows SharePoint Services provides IT with advanced administrative controls for increasing the security of information resources, while decreasing cost and complexity associated with site provisioning, site management, and support. Take advantage of better controls for site life-cycle management, site memberships and permissions, and storage limits.

Provide sophisticated controls for securing company resources
IT departments can now set permissions as deep down as the document or item level, and site managers, teams, and other work groups can initiate self-service collaborative workspaces and tasks within these preset parameters. New features enable IT to set top-down policies for better content recovery and users, groups, and team workspace site administration.

Take file sharing to a new level with robust storage capabilities
Windows SharePoint Services supplies workspaces with document storage and retrieval features, including check-in/check-out functionality, version history, custom metadata, and customizable views. New features in Windows SharePoint Services include enhanced recycle bin functionality for easier recovery of content and improved backup and restoration.

Easily scale your collaboration solution to meet business needs
Quickly and easily manage and configure Windows SharePoint Services using a Web browser or command-line utilities. Manage server farms, servers, and sites using the Microsoft .NET Framework, which enables a variety of custom and third-party administration solution offerings.

Provide a cost-effective foundation for building Web-based applications
Windows SharePoint Services exposes a common framework for document management and collaboration from which flexible and scalable Web applications and Internet sites, specific to the needs of the organization, can be built. Integration with Microsoft Office SharePoint Server 2007 expands these capabilities further to offer enterprise-wide functionality for records management, search, workflows, portals, personalized sites, and more.

Creating an auidence in MOSS 2007
Audience are groups of users that are assigned memberships in icrosoft exchange distribution lists (DLs) or sharepoint group. DLs support communication and enhance the productivity of the users. A portal manager can assign membership to users by configuring rules.In MOSS 2007 rules for auidence are based on user profile on membership in the Active directory. \
An auidence can be group of employees. Usinf auidences enables orgnizations to provide suitable contents to group of users according to their job and task requirement. You can target content so that only users in perticular auidences can view
1) Web Part :different auidences use different web parts
2) Web part items : targeting at list item level.
3) Navigation controls : targeted to different auidence.

MOSS 2007 supports targetting based on rule-based auidences, Sharepoint groups and DL memberships. The namespace in the object model that supports audiences is Microsoft.Office.Server.Audience (contained in Microsoft.Office.Server.dll). for backward compatibility the Microsoft .Sharepoint.Portal.Audience namespace is still supported. And you get an warning message when you use these metnods.



What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from?
There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the SharePoint WebPart Base class or the ASP.NET 2.0 WebPart base class. When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class:

Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure


What are the differences between the two base classes and what are the inherit benefits of using one over another?

The difference is the Microsoft.SharePoint.WebPartPages.WebPart base class is meant for backward compatibility with previous versions of SharePoint. The benefit of using the SharePoint WebPart base class is it supported:

Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure

ASP.NET 2.0 WebParts are generally considered better to use because SharePoint is built upon the ASP.NET 2.0 web architecture. Inheriting from the ASP.NET 2.0 base class offers you features that inherit to ASP.NET 2.0, such as embedding resources as opposed to use ClassResources for deployment of said types.

What is the GAC?

The GAC stands for the global assembly cache. It is the machine wide code cache which will give custom binaries place into the full trust code group for SharePoint. Certain SharePoint assets, such as Feature Receivers need full trust to run correctly, and therefore are put into the GAC. You should always try to avoid deployment to the GAC as much as possible since it will possibly allow development code to do more than it was intended to do.

What is strong naming (signing) a WebPart assembly file mean?

Signing an assembly with a strong name (a.k.a strong naming) uses a cryptographic key pair that gives a unique identity to a component that is being built. This identity can then be referred throughout the rest of the environment. In order to install assemblies into the GAC, they must be strongly named. After signing, the binary will have a public key token identifier which can be use to register the component in various other places on the server.