"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Sunday, May 29, 2011

Differentiate Local Temporary table and Global Temporary table

You can create local and global temporary tables. Local temporary tables are visible only in the current session; global temporary tables are visible to all sessions. Prefix local temporary table names with single number sign (# table_name), and prefix global temporary table names with a double number sign (##table_name). 



Have a nice day... 'N happy Coding :)

Friday, May 27, 2011

Left Outer Join, Right Outer Join and Full Outer Join.

LEFT OUTER JOIN - This returns all the matching rows and the unmatched rows of the left table of the SQL code.
RIGHT OUTER JOIN - This returns all the matching rows and the unmatched rows of the right table of the SQL.
FULL OUTER JOIN - This returns all the matching and unmatched rows from both the tables.


Have a nice day... 'N happy Coding :)

Wednesday, May 25, 2011

Business Intelligence (BI)

Business Intelligence is the data warehousing and reporting. Where the original concept of data warehousing is primarily concerned with the integration of vast amounts of data across multiple business systems, business intelligence technologies help to gather, analyze, and provide access to that integrated store of data in order to make informed strategic business decisions.
Business intelligence technologies to track business performance, detect trends, and produce accurate forecasts about the future, businesses hope to turn their wealth of corporate data into a competitive advantage. Where strategic business decisions 100 years ago were largely made by guesswork, business intelligence systems help to eliminate the guesswork by providing much more insight into past performance and more accurate predictions of the future conditions. This high-quality information can actually be targeted at any level of an organization, although most use cases involve upper management.

The Report Center : The Report Center site provides a central location for business-intelligence-related information. It contains special document libraries for storing reports, lists, and connections to external data sources.


Excel Services: Excel Services provides to store an Excel workbook on a server and publish any part of that workbook on a Web page. Users need only a browser to view and interact with the live data. The workbook is published on the Web page by using the Excel Web Access (EWA) Web Part.

Key Performance Indicators (KPIs) : A Key Performance Indicator (KPI) is a visual cue that communicates the amount of progress made toward a goal. KPIs are valuable for teams, managers, and businesses to evaluate quickly the progress made against measurable goals.

Connections to external data sources : In addition to using external data sources in Excel workbooks, you can use data from other business applications, such as SAP and Siebel, in SharePoint lists, pages, and Web Parts.

Filter Web Parts : Filters allows display only the subset of data that user interested in viewing. For example, a data set can contain ten years' record's of multiple products for the entire country/city. By using filters, user can display something more meaningful, such as only one sales region, only one product, or only the current year.

Dashboards : Dashboards are tools that are used to communicate status and to drive action. An Office SharePoint Server 2007 dashboard is a Web page template that allows you to assemble and display information from disparate sources such as reports, charts, metrics, and key performance indicators.


Stay Tune...
Have a nice day... 'N happy Coding :)

Tuesday, May 24, 2011

Find the fifth highest salary in Salary Table

Its a very common interview question.Actually its very simple here it goes:

SELECT MIN(Salary) AS Expr1 FROM tblEmployee 
WHERE (empid IN (SELECT DISTINCT TOP 5 empid FROM tblSalary ORDER BY Salary))

Stay tune...
Have a nice day... 'N happy Coding :)

Sunday, May 22, 2011

ASP.Net And XHTML compatibility

simple words, XHTML is a stricter and cleaner version of HTML. XHTML stands for EXtensible Hypertext Markup Language and is a W3C Recommendation.
Yes, ASP.NET 2.0 Pages are XHTML compliant. However the freedom has been given to the user to include the appropriate document type declaration.
More info can be found at http://msdn2.microsoft.com/en-us/library/exc57y7e.aspx
Can I deploy the application without deploying the source code on the server?
Yes. You can obfuscate your code by using a new precompilation process called ‘precompilation for deployment’. You can use the aspnet_compiler.exe to precompile a site. This process builds each page in your web application into a single application DLL and some placeholder files. These files can then be deployed to the server.
You can also accomplish the same task using Visual Studio 2005 by using the Build->Publish menu.

Does ViewState affect performance? What is the ideal size of a ViewState? How can you compress a viewstate?

Viewstate stores the state of controls in HTML hidden fields. At times, this information can grow in size. This does affect the overall responsiveness of the page, thereby affecting performance. The ideal size of a viewstate should be not more than 25-30% of the page size.
Viewstate can be compressed to almost 50% of its size. .NET also provides the GZipStream or DeflateStream to compress viewstate. Another option is explained by Scott Hanselmann over here.

How can you detect if a viewstate has been tampered?
By setting the EnableViewStateMac to true in the @Page directive. This attribute checks the encoded and encrypted viewstate for tampering.

Can I use different programming languages in the same application?
Yes. Each page can be written with a different programming language in the same application. You can create a few pages in C# and a few in VB.NET.

Can the App_Code folder contain source code files in different programming languages?
No. All source code files kept in the root App_Code folder must be in the same programming language.
Update: However, you can create two subfolders inside the App_Code and then add both C# and VB.NET in the respective subfolders. You also have to add configuration settings in the web.config for this to work.

How do you secure your connection string information?
By using the Protected Configuration feature.

How do you secure your configuration files to be accessed remotely by unauthorized users?
ASP.NET configures IIS to deny access to any user that requests access to the Machine.config or Web.config files.

How can I configure ASP.NET applications that are running on a remote machine?
You can use the Web Site Administration Tool to configure remote websites.

How many web.config files can I have in an application?
You can keep multiple web.config files in an application. You can place a Web.config file inside a folder or wherever you need (apart from some exceptions) to override the configuration settings that are inherited from a configuration file located at a higher level in the hierarchy.
I have created a configuration setting in my web.config and have kept it at the root level. How do I prevent it from being overridden by another web.config that appears lower in the hierarchy?
By setting the element's Override attribute to false.

What is the difference between Response.Write and Response.Output.Write?
As quoted by Scott Hanselman, the short answer is that the latter gives you String.Format-style output and the former doesn't.

What is Cross Page Posting? How is it done?
By default, ASP.NET submits a form to the same page. In cross-page posting, the form is submitted to a different page. This is done by setting the ‘PostBackUrl’ property of the button(that causes postback) to the desired page. In the code-behind of the page to which the form has been posted, use the ‘FindControl’ method of the ‘PreviousPage’ property to reference the data of the control in the first page.

Can you change a Master Page dynamically at runtime? How?
Yes. To change a master page, set the MasterPageFile property to point to the .master page during the PreInit page event.

How do you apply Themes to an entire application?
By specifying the theme in the web.config file.

How do you exclude an ASP.NET page from using Themes?
To remove themes from your page, use the EnableTheming attribute of the Page directive.

Your client complains that he has a large form that collects user input. He wants to break the form into sections, keeping the information in the forms related. Which control will you use?
The ASP.NET Wizard Control.

Do webservices support data reader?
No. However it does support a dataset.

What is use of the AutoEventWireup attribute in the Page directive ?
The AutoEventWireUp is a boolean attribute that allows automatic wireup of page events when this attribute is set to true on the page. It is set to True by default for a C# web form whereas it is set as False for VB.NET forms. Pages developed with Visual Studio .NET have this attribute set to false, and page events are individually tied to handlers.

What happens when you change the web.config file at run time?
ASP.NET invalidates the existing cache and assembles a new cache. Then ASP.NET automatically restarts the application to apply the changes.

Can you programmatically access IIS configuration settings?
Yes. You can use ADSI, WMI, or COM interfaces to configure IIS programmatically.

How does Application Pools work in IIS 6.0?
As explained under the IIS documentation, when you run IIS 6.0 in worker process isolation mode, you can separate different Web applications and Web sites into groups known as application pools. An application pool is a group of one or more URLs that are served by a worker process or set of worker processes. Any Web directory or virtual directory can be assigned to an application pool.

Every application within an application pool shares the same worker process. Because each worker process operates as a separate instance of the worker process executable, W3wp.exe, the worker process that services one application pool is separated from the worker process that services another. Each separate worker process provides a process boundary so that when an application is assigned to one application pool, problems in other application pools do not affect the application. This ensures that if a worker process fails, it does not affect the applications running in other application pools.

Use multiple application pools when you want to help ensure that applications and Web sites are confidential and secure. For example, an enterprise organization might place its human resources Web site and its finance Web site on the same server, but in different application pools. Likewise, an ISP that hosts Web sites and applications for competing companies might run each companys Web services on the same server, but in different application pools. Using different application pools to isolate applications helps prevent one customer from accessing, changing, or using confidential information from another customers site.
In HTTP.sys, an application pool is represented by a request queue, from which the user-mode worker processes that service an application pool collect the requests. Each pool can manage requests for one or more unique Web applications, which you assign to the application pool based on their URLs. Application pools, then, are essentially worker process configurations that service groups of namespaces.
Multiple application pools can operate at the same time. An application, as defined by its URL, can only be served by one application pool at any time. While one application pool is servicing a request, you cannot route the request to another application pool. However, you can assign applications to another application pool while the server is running.

Have a nice day... 'N happy Coding :)

Friday, May 20, 2011

State Management in ASP.Net

There are two major categories of the above :
  1. Server-Side State Management
  2. Client-Side State Management

1. Server-Side State Management:-
  1. Session State
  2. ASP.NET application object
  3. Types of Cache
  4. .NET remoting
  5. Static variables

2. Client-Side State Management:-
  1. Cookies
  2. ViewState
  3. Hidden fields
  4. Query Strings
  5. Control State
Stay Tune...
Have a nice day... 'N happy Coding :)

Tuesday, May 17, 2011

Advantages of using stored procedure in database

A stored procedure is a set of Structured Query Language (SQL) statements that you assign a name to and store in a database in compiled form so that you can share it between a number of programs.
  1. They allow modular programming.
  2. They allow faster execution.
  3. They can reduce network traffic.
  4. They can be used as a security mechanism. 

Have a nice day... 'N happy Coding :)

Sunday, May 15, 2011

Difference bettween web form and web content form in asp.net 2008

Web form is nothing but normal .aspx page. When you create web form you see all tags such as <head>,
<body>, <html> etc.

Master page is nothing but a common page which holds a common content so that you can use it across
multiple pages. That means if you want to display menu on 3-4 pages, you can write the code into
master page and use it on all pages. This way you don’t have to write same code again and again on all
3-4 pages.

This is also another type of form which exists with master page, Basically content page is the page which
holds un-common content where master page contains common content among lets say 3-4 pages. You
get <asp:content> tag in this type of paSoolutiom In a normal website, you create a content page by
ticking the “Select Masterpage” checkbox when adding a page. For Web Application Projects, you need
to select Web Content Form to create a content page and a Web Form to add a normal (no masterpage)
page

1. In a normal website, you create a content page by ticking the “Select Masterpage” checkbox when
adding a page. For Web Application Projects, you need to select Web Content Form to create a content
page and a Web Form to add a normal (no masterpage) page..

2. Web content is the textual, visual or aural content that is encountered as part of the user
    experience on websites.It may include, among other things: text, images, sounds, videos and
    animations.


Stay Tune...
Have a nice day... 'N happy Coding :)

Friday, May 13, 2011

using locks inside stored procedure

Microsoft® SQL Server™ 2000 uses locking to ensure transactional integrity and database consistency. Locking prevents users from reading data being changed by other users, and prevents multiple users from changing the same data at the same time. If locking is not used, data within the database may become logically incorrect, and queries executed against that data may produce unexpected results.
Lock mode Description. There are six different type of locks given below:

Shared (S) Used for operations that do not change or update data (read-only operations), such as a SELECT statement.
Update (U) Used on resources that can be updated. Prevents a common form of deadlock that occurs when multiple sessions are reading, locking, and potentially updating resources later.
Exclusive (X) Used for data-modification operations, such as INSERT, UPDATE, or DELETE. Ensures that multiple updates cannot be made to the same resource at the same time.
Intent Used to establish a lock hierarchy. The types of intent locks are: intent shared (IS), intent exclusive (IX), and shared with intent exclusive (SIX).
Schema Used when an operation dependent on the schema of a table is executing. The types of schema locks are: schema modification (Sch-M) and schema stability (Sch-S).
Bulk Update (BU) Used when bulk-copying data into a table and the TABLOCK hint is specified.


Have a nice day... 'N happy Coding :)

Wednesday, May 11, 2011

Difference between TRUNCATE & DELETE in SQL

Difference Between DELETE & TRUNCATE Are


1. DELETE  is a DML Command & TRUNCATE is a DDL Command

2. After DELETE  can rollback the Records & After TRUNATE cannot rollback the records

3. In DELETE Command you can give the conditions in WHERE Clause & In TRUNCATE you cannot give conditions

4. After using DELETE Command The memory will be occupied till the user does not give ROLLBACK or COMMIT & After using TRUNCATE Command The memory realeased immediately


Have a nice day... 'N happy Coding :)

Tuesday, May 10, 2011

HttpApplication Instances

During the lifetime of your application, ASP.NET maintains a pool of Global.asax-derived HttpApplication instances.When your application receives an HTTP request, the ASP.NET page framework assigns one of these instances to process that request. That particular HttpApplication instance is responsible for managing the entire lifetime of the request it is assigned to, and the instance can only be reused after the request has been completed.

 Hope u got it...
Stay tune...
Have a nice day... 'N happy Coding :)

Friday, May 6, 2011

Getting File type or Getting file extension

 Getting File type or Getting file extension is done by some many ways a few is listed here ::-
  • string fileExtension = System.IO.Path.GetExtension(@"C:\MyFolder\MyFile.jpg"
  • System.IO.FileInfo f = new System.IO.FileInfo(Server.MapPath("~/MyFolder/MyFile.jpg"));
    string extension = f.Extension;
 Over here i prefer the second method.

Stay tune...
Have a nice day... 'N happy Coding :)

Tuesday, May 3, 2011

Choosing between char, varchar, varchar(MAX) and text datatype in SQL Server 2005

char, varchar, varchar(MAX) and text datatype are used for storing character string. Note you cannot store multilingual data. i.e. You will not allowed to store japanes or hindi characters.

Char datatype
  1.  Stores character (non-unicode) data.
  2.  Stores data in fixed-length format.  
  3.  Choose char datatype when size of data is consistent.
Varchar datatype

  1. Stores Character (non-unicode) data.
  2. Stores data in variable-length format.
  3. Choose varchar datatype when size of data varies between 8000 bytes

Varchar(MAX) datatype
  1. Stores Character (non-unicode) data.
  2. Stores data in variable-length format.
  3. Choose varchar datatype when size of data varies and it may exceeds 8000 bytes.

Text datatype

  1. Text datatype is used in previous versions of SQL Server, it is recommended to use Varchar(MAX) instead of Text datatype, as ntext, text, and image data types will be removed in a future version of Microsoft SQL Server
  2. Stores large amount of character string
  3. Stores data in variable-length format.
  4. Choose text datatype when size of data varies may exceeds 8000 bytes.



Have a nice day... 'N happy Coding :)