ASP.NET Custom role provider

Easy guide to write your custom role provider

Merge splitted .mkv files

Learn how to merge splitted .mkv files (.mkv001,.mkv002...)

How to Zoom in and Zoom out your sql execution plan ?

Tool to tune your sql query

send .exe files with gmail

How to send files having blocked extension with Gmail ?

Multiple home pages in Internet explorer

How to set multiple home pages in internet explorer ?

4/28/2011

How to enable windows authentication of IIS 7 + in Windows 7 or Vista ? No Windows authentication in IIS ?

I always had a Windows 7 Laptop at my home which I never used for development purposes. Today I installed Windows 7 enterprise version on my office laptop .  I created a website and wanted to set the authentication to Windows . Surprisingly I could see only anonymous authentication which is enabled by default. 


I remember sometime back I was modifying application host config file to play with windows Authentication settings on IIS 7.x .  The configurations of IIS 7 + is not as simple and straight forward as it used to be in IIS 6 and lower version ( Probably Microsoft wanted the IIS admin to be a Geek :) ). So How do we enable Windows authentication in IIS 7 for windows 7 or Vista ?
  • First of all , you should have sufficient administrative access to turn or turn off windows features.
  • If you have the admin previliges , Please go to control panel in Windows and select Programs as shown in figure below.










  • In the settings page that opens, please select Turn windows features on or off .
  • Now Navigate to Internet Information services --> World wide Web Services --> Security and there you should be able to see different kinds of authentications in a dialog window, just as shown in the figure below.

  • Now you can choose the type of authentication you want to be enabled on your IIS 7.x server.
  • If it is Windows authentication , please select windows authentication or if it is Basic authentication , select Basic authentication based on your need.
  • Click Ok after selection and let windows handle it.
  • Now close / Restart your IIS and you should be able to see the chosen authentication types in your IIS as below.

    Hope this has helped you.

    Need more asp.net tips and tricks ? For more Subscribe here or click here to get updates via email

4/22/2011

how to find column dependencies in SQL server ? SQL server 2005 / 2008

Did you ever want to find the dependencies of a column in all the tables and stored procedures in the database ! It helps you sometimes in finding the impact of the changes you want to make very easily. May be if you dont know about the database, it would help you understand the size of the changes you want to make.

Its very simple. All you need to do is just fire this query :)...

select name
from syscomments c
join sysobjects o on c.id = o.id
where TEXT like '%TableName%' and TEXT like '%ColumnName%'


Replace the Table name and the column name with the  name of the table where the column is and the column name itself.


What is syscomments ?

As per MSDN, syscomments contains entries for each view, rule, default, trigger, CHECK constraint, DEFAULT constraint, and stored procedure within the database. The text column contains the original SQL definition statements.


What is Sysobjects ?

Sysobjects contains one row for each object that is created within a database, such as a constraint, default, log, rule, and stored procedure.


These are part of system views which you can find in the link below.


http://msdn.microsoft.com/en-us/library/ms177862.aspx


Love SQL server tips ? For more Subscribe here or click here to get updates via email

4/09/2011

Efficient SQL server query tuning with SQL sentry Plan Explorer : Zoom in Zoom out SQL plan

A day back I had to fine tune a sql query which was way too complex to analyze with a glance. It would take endless time to do that by analyzing just the statements as I was dealing with a couple of million records..

So I decided to start using the tools available in Sql server Management Studio (SSMS) for fine tuning the query. For finding the cost associated with my query, I ran my query with my actual execution Plan set to On. When I ran the query, SSMS displayed the execution plan in the bottom pane of SSMS. Since My query is complex, so my execution plan looked like a train with 100 coaches :)...Navigating through the plan displayed in SSMS was so difficult. I could not make anything out of it. So I tried to find out tools which would help me to understand this plan in a efficient way and do some tuning with it.

I came across a wonderful tool ( Freeware ) which helped me in fine tuning my sql query easily.


SQL Sentry Plan Explorer is a lightweight standalone app that builds a graphical view using SQL query plan so that developers can understand it very easily. It does not require a collector service or database.


The image below explains how well the graphical view is constructed. Please click on the image to enlarge it

It helps us understand which elements in the plan costs more by displaying them in different colors ( Red for high cost, yellow for medium cost...)... It even displays the amount of data that flows between different elements to help you understand where you have more data. All you need to do is tweak accordingly and check the costs again.

How to load your plan into SQL sentry Plan explorer ?

There are different ways through which you can load your execution plan into SQL sentry plan explorer.

  • In SSMS, right-click a graphical plan and select “Show Execution Plan XML”, then copy and paste the plan XML into the Plan Explorer. It doesn’t matter which pane is active, the clipboard handler is global and will auto-detect the plan XML.
  • Save an execution plan from SSMS to a .sqlplan file, then open the file using the Open toolbar button, File->Open menu, or Ctrl + O. Raw plan XML files and .QueryAnalysis files (our own proprietary format) are also supported.
  • Right-click an existing .sqlplan file in Windows Explorer and select “Open with -> SQL Sentry Plan Explorer”.
  • Drag-and-drop a plan file onto the application (The easiest way !)
The sentry plan explorer offers you different views of the plan tree namely :
  • Plan Diagram
  • Plan Tree - A tree representation of the plan which shows all operations and associated metrics
  • Top Operations - List of all plan operations, sorted by total estimated cost by default in descending Order
  • Query Columns - List of all columns accessed by the query along with the table, operation, and index used.
The best part of this is that you can zoom in and zoom out SQL query execution plan which lets you to view your plan in a glance. Its definitely lot better than SSMS plan viewer.

Need more asp.net tips and tricks ? For more Subscribe here or click here to get updates via email

If you want detailed description , please check here.