Thursday, December 1, 2011

snippet to Select DropDown List Item


 if (ddlProduct.Items.FindByValue(lblProduct.Text) != null) {
                    ddlProduct.Items.FindByValue(lblProduct.Text).Selected = true;
                }

Thursday, November 24, 2011

http://weblogs.asp.net/mschwarz/archive/2006/11/20/the-top-10-mistakes-when-using-ajax.aspx

http://weblogs.asp.net/mschwarz/archive/2006/11/20/the-top-10-mistakes-when-using-ajax.aspx


The top 10 mistakes when using AJAX

The last months I found more and more web sites that make a heavy use of AJAX to be on the Web 2.0 train, but a lot of them are very strange because they are slower than before, you will get more errors and sometimes nothing does work (i.e. when running on a mobile device). Here are my top 10 mistakes when using AJAX (not depending which framework you want to use):
  1. Don't use AJAX to update the complete page by putting everything in a UpdatePanel. You want to save time and traffic when running the web page. Never update parts of the web site that can be changed using JavaScript and DHTML (DOM).
  2. Have in mind that there are a couple of visitors that have JavaScript disabled or using a web browser with an older or less JavaScript implementation like the most mobile devices have. What does your visitor see if everything is disabled? I don't recommend to have the full web site available as a JavaScript disabled version!
  3. Cache the same requests on client-side web browser or implement any caching on the web server. The most used scenarios like AutoComplete or DropDown fields are filled everytime the same. A wrong written AutoComplete can slow down your web server (database server) because there more requests done than the version before using PostBacks. Think of pressing F5 (reload) all the time with your old web site. If you have cascading DropDown you can save more traffic/requests!
  4. Don't run concurrent or long running AJAX requests when using CSS or JavaScript to change the UI. There are only two concurrent http connections possible with all common web browsers (I know you can change this, but the default behavior is set to two). If there are running to many AJAX requests running loading of images will be slow down.
  5. Use everytime the asynchrouns invoke of the send method of XMLHttpRequest. There is no issue where you want to use the synchronous one. Your web browser will not be forozen when having network problems or slow connections.
  6. Try your web application using a very slow internet connection. Try it again using a TCP/IP connection with a very high latency for each paket.
  7. Is your web application running as a desktop replacement? Have a look at the memory usage of common web browsers if you run your application one hour, two hours or couple of days. Not everybody has a development machine like yours!
  8. Check the http status code you will get back from XMLHttpRequest. There are a couple of common network errors like DNS not available, http server error 500. Did you ever checked for the status code which tells you if your web browser is in offline mode?
  9. Try to disable the XMLHttpRequest object! With IE7 you can use the native object instead of the ActiveX object, but you can still disable the native object, too.
  10. Check your AJAX requests for security issues! Did you simple open all your data access layers? Make use of FormsAuthentication and PrincipalPermissions on ASP.NET. Can anybody create requests (not only by clicking on a link)?
I know there are more issues where we should have a eye on. My experience is that there is a high need for deciding where and when to use AJAX.

Updated Nov 21, 2006: 
Dave wrote in his comment below about some more mistakes, here are my comments:
  1. A loading indicator is, of course, very important. This should be added to requests that are slower than usal and to actions that need more time (not requests that are running long time on the server, see above).
  2. The back button is not very easy to talk about because it depends on what you are doing with AJAX or Web 2.0. If you do complete page updates (so you replace the common page refresh only) you should have an option to use the back button. In a lot of web applications I've done there AJAX is more used to update monitors, run some actions like delete, save,... and there a back button is not needed. The UI should implement there an undo feature i.e. instead.
  3. A machanism to cancel a requests often isn't as easy as simple call the abort method on XMLHttpRequest because the requests is already running on the web server. The same will happen when you close your web browser during a request. So, there is a need for this but my opinion is that it is not very easy to implement.
  4. The last issue Dave is talking about is a application feature which is interessting, but is not a Web 2.0 or AJAX related new issue, everyone is interested in script errors.
Published Tuesday, November 21, 2006 5:01 AM by Michael Schwarz 
Filed under: 

Sample for recursive CTE




IF (NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'dbo' AND TABLE_NAME = 'tmpCategory'))
BEGIN
CREATE TABLE [dbo].[tmpCategory](
[nCategoryID] [int] IDENTITY(1,1) NOT NULL,
[strCategoryName] [varchar](250) NULL,
[nCategoryParentID] [int] NULL,
[bLeafCategory] [bit] NULL,
[nCatUpdateId] [int] NULL,
[strGroupId] [varchar](15) NULL );

INSERT INTO dbo.[tmpCategory]([strCategoryName],[nCategoryParentID],[bLeafCategory] ) VALUES('1',null,null);
INSERT INTO dbo.[tmpCategory]([strCategoryName],[nCategoryParentID],[bLeafCategory] ) VALUES('2',1,null);
INSERT INTO dbo.[tmpCategory]([strCategoryName],[nCategoryParentID],[bLeafCategory] ) VALUES('3',2,null);
INSERT INTO dbo.[tmpCategory]([strCategoryName],[nCategoryParentID],[bLeafCategory] ) VALUES('4',2,1);
INSERT INTO dbo.[tmpCategory]([strCategoryName],[nCategoryParentID],[bLeafCategory] ) VALUES('5',3,1);

END

go

Create FUNCTION [dbo].[GetChildCategory]
(
@nCategoryId int
)
RETURNS TABLE
AS
RETURN
(
-- Add the SELECT statement with parameter references here
with [CTE] as (
select nCategoryId, strCategoryName, nCategoryParentId from dbo.[tmpCategory] c (nolock) where c.nCategoryParentId = @nCategoryId and c.nCategoryId != @nCategoryId
union all
select c.nCategoryId, c.strCategoryName, c.nCategoryParentId from [CTE] p, dbo.[tmpCategory] c (nolock) where c.nCategoryParentId = p.nCategoryId
)
select nCategoryId from [CTE]
union all
select nCategoryId from dbo.tmpCategory c (nolock) where c.nCategoryId = @nCategoryId
)

go


Create FUNCTION [dbo].[GetTopCategory]
(
@nCategoryId INT
)
RETURNS TABLE
AS
RETURN
(
WITH TopCategory(nCategoryID, strCategoryName, nCategoryParentID, bLeafCategory, strGroupID)
AS
(SELECT nCategoryID, strCategoryName, nCategoryParentID, bLeafCategory, strGroupID FROM dbo.tmpCategory WHERE nCategoryID = @nCategoryId

UNION ALL

SELECT A.nCategoryID, A.strCategoryName, A.nCategoryParentID, A.bLeafCategory, A.strGroupID FROM dbo.tmpCategory A, TopCategory WHERE A.nCategoryID = TopCategory.nCategoryParentID)


SELECT ROW_NUMBER() OVER(ORDER BY (SELECT 0)) AS RowNum, * FROM TopCategory
)

go

Select * from dbo.GetChildCategory(3)

Select * from dbo.GetTopCategory(4)

DROP TABLE [dbo].[tmpCategory];

Wednesday, June 1, 2011

Snippet to configure linked server using Microsoft.ACE.OLEDB


 If a linked server configured using Microsft.ACE.OLEDB, Access Denied error may occur while selecting record

execute the following sql and try to recreate the linked server

 Exec master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess',1 
 go
 Exec master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters', 1 
 go

To solve the following error

It is already opened exclusively by another user,
or you need permission to view its data.".
Msg 7303, Level 16, State 1, Line 1

Set the logon credential of SQL Server service to local user with admin previlege and restart the sql server 

Tuesday, May 31, 2011

Microsoft Access 2003 Linked Server on SQL Server 2008 using the JET and MSDASQL Providers from SSWUB.org


article source http://www.sswug.org/articles/viewarticle.aspx?id=44218


Microsoft Access 2003 Linked Server on SQL Server 2008 using the JET and MSDASQL Providers

For accessing geographically distributed data linked servers provides a good solution. MS SQL Servers always
provided remote access to servers through RPC mechanisms, but they had the limitation of being confined to
invoking procedures on remote locations. A linked server (a virtual server) may be considered a more flexible
way of achieving the same thing, with the added benefits of remote table access and distributed queries. This
linking is achieved using OLE DB technology. Both MySQL and EnterpriseDB servers can access remote data
but not as efficient. This remote access capability requires creating links by a suitable data source provider.
Microsoft's MSDASQL, a OLE DB provider of ODBC can be used. In addition to MSDASQL the Microsoft Jet OLE
DB Provider can also be used.

Over view of the tutorial

The steps needed to create and verify linked server are:
1. Create a System ODBC DSN to establish a linked server
2. Use the Management Studio to create a linked server
3. Verify that the linked server is functioning as expected

In what follows we first create a Linked Server using the Microsoft OLE DB Provider for ODBC (MSDASQL)
followed by another linked server using Micrsoft Jet 4.0 OLE DB Provider for purposes of comparison.  It may
be noted that linked servers may also be created using stored procedures.

Creating a System ODBC DSN

It is very easy to create a System ODBC DSN by invoking the ODBC Data Source Administrator from Start | Control
Panel |Administrative Tools |Data Sources (ODBC)
When the ODBC Data Source Administrator window gets displayed, click on the Add button to open the Create New
Data Source
 window as shown. Scroll down and highlight Microsoft Access Driver and click on Finish.

Create New Data Source -Choose a driver

In the ODBC Microsoft Access Setup window provide a name for the Data Source. Herein LinkedAcces
was the name chosen. This will be the System DSN you will be using while configuring the linked server.
Provide a description for the data source (Optional). Then click on the Select...button.

This brings up the Select Database window where you locate the Northwind database used in this tutorial.
On this computer, the Northwind database file Northwind.mdb was found at C:\Program Files\Microsoft
Office\OFFICE11\Northwind.mdb. This could be different in your case. Choose the file and Click on OK.
The location information gets into the ODBC Microsoft Access Setup window. Click OK on this window.
You will have created a System ODBC DSN. The ODBC Data Source Administrator shows up listing your file as shown here.

System DSN LinedAccess is created

Click OK and close the ODBC Database Administrator window.

Creating a Linked Server

Open the SQL Server 2008 Management Studio and log on to the Database Engine. Expand the Server Objects 
node and right click to open the drop-down window as shown.

Linked Servers subnode in Object Explorer

Click on the New Linked Server...to open the New Linked Server Window. Provide a name for the linked
server, herein NWIND_LINK was used. Change the provider from default (MediaCatalog OLE DB Provider)
to Microsoft OLE DB Provider for ODBC Drivers.
For Data source you should use a System DSN, the LinkedAccess that was created in earlier. For Product
Name you can use "Microsoft Access 2003" as shown.

Mandatory items to be filled

This is all that is really needed (The wizard will get the required items from the System DSN). A fully detailed
entry would be as shown here.

The complete set of input filled by the wiazrd

Click on the Security navigational link on the left to open the Security related page on the right as shown.

Security related page of Linked server

Accept the default for login namely ' Be made without using a security context ' for the purposes of this tutorial.
Please review the other options. In this tutorial  the Access default user, ADMIN is also the computer owner.

Click on Server Options navigational list item to open the Server Options page as shown. Make no changes
in this window for this tutorial.

Server Options page of Linked Server

When you click OK on the above screen you will have created a Linked MS Access server on SQL Server 2008.
You may need to refresh the Linked Servers node to see your newly created NWIND_LINK server as shown in
the next figure. The Tables and Views on this can be accessed.

NWIND_LINK linked server in Object Explorer

It may also be instructive to script out the linked server by right clicking the linked server and choosing
Script Linked Server as | Create TO | [New Query Window or File... or Clip Board...] and review the
script. The script contains all information collected from the wizards.

Exploring the Linked Server

There are a number of stored procedures that can be used to test the linked server. Only
two of them are described here.Not all stored procedures are supported by all providers.
The stored procedure, sp_helpserver provides details of the linked server as shown here.

Stored procedure sp_helpserver '<Server Name>'

The stored procedure sp_tables_ex provides information regarding the tables in the linked server
as shown.

The stored procedure sp_tables_ex '<Server Name>'

The linked server can be queried as if it is a regular database on the server. For this you can use the openquery()method
with the following syntax to access the data on the database.

OPENQUERY(linked_server, 'query') 
where query is the query string executed against the linked server. The next figure shows an example of this query applied to
the linked server created  in this tutorial.

Usage of Openquery()

Data can also be accessed using the 4 part fully qualified table name while calling remote servers with the
following syntax:

linked_server_name.catalog.schema.object_name
As there is neither a schema nor a catalog associated with Microsoft Access this reduces to the following:

linked_server_name...ObjectName
When a query is executed in the present case with the above syntax the following message is returned.

Invalid use of schema or catalog

MSDASQL does not work in this case. It is not supported. This will not work even if the dbo in the
above query is removed.
 

Providers for Linked Servers

Microsoft supports a number of OLE DB providers so that linked servers can be set up with disparate database
vendor products. Under Server Objects node in the Management Studio you can expand the Linked Servers
node to access the Providers as shown in the next figure. There are two OLE DB Providers that can be used
to create a Microsoft Access linked server on SQL Server 2008 as shown. In the previous section the MSDASQL provider was used.

Linked Servers : the Providers

 

Creating a linked server using the Jet OLE DB Provider

The procedure is very similar to the linked server NWIND_LINK described earlier. The following screen
shows the attributes used in setting up the linked server.

In this case the Microsoft Jet 4.0 OLE DB Provider is used. The information needed to set up the linked
server takes just the provider name and the location of the mdb file as shown.

Linked Server NWIND_JET properties
 

Querying the Linked Server

When the linked server is set using the Microsoft Jet 4.0 OLE DB provider the linked server may be queried using the
openquery() method as shown in the next figure.

openquery() Method

It may be noted that the linked server may also be queried by the (reduced )fully qualified 4 part syntax
as shown in the next figure.

Querying with 4 part fullly qualified name syntax

Summary

The article describes how a linked Microsoft Access server can be created in the SQL Server 2008 using the SQL Server 2008
Management Studio. Two inked servers are created using two different providers. The linked server using the
JET provider is easy to set up requiring nothing more than the location of the mdb file. Also data can be accessed by both the
openquery() method as well as the reduced 4 part fully qualified syntax for the Jet provider created linked server. On the other
hand the MSDASQL provider requires a System DSN and the data can be accessed using only the openquery() method. 

Tuesday, May 24, 2011

Adam Anderson's Dynamic SQL-like Linq OrderBy Extension


For personal reference the post have been copied from 


Dynamic SQL-like Linq OrderBy Extension

So, it's been a while, but I thought I take moment and do my annual blog post ;).
I've been playing around with ASP.NET MVC and the Linq stuff for NHibernate recently. I was in need of an OrderBy extension method that could take a SQL-Like OrderBy string and sort a IQueryable<> or IEnumerable<> collection. I wrote up an implementation that worked, but I just wasn't satisfied with its internals (quite a bit of reflection to get the correct type to construct a LambdaExpression, etc)
At any rate, I couldn't leave well enough alone, and, after a bit of Googling, I ran across this StackOverflow answer aboutDynamic LINQ OrderBy. The extension method wasn't exactly what I was looking for, but that ApplyOrder method is slick, and solved the portion of my implementation that was bothering me.
So, I though I would post up my version in case anybody finds it useful. It handles the following inputs:
list.OrderBy("SomeProperty");
list.OrderBy("SomeProperty DESC");
list.OrderBy("SomeProperty DESC, SomeOtherProperty");
list.OrderBy("SomeSubObject.SomeProperty ASC, SomeOtherProperty DESC");
Dynamic SQL-like Linq OrderBy Extension
    public static class OrderByHelper
    {
        public static IEnumerable OrderBy(this IEnumerable enumerable, string orderBy)
        {
            return enumerable.AsQueryable().OrderBy(orderBy).AsEnumerable();
        }

        public static IQueryable OrderBy(this IQueryable collection, string orderBy)
        {
            foreach(OrderByInfo orderByInfo in ParseOrderBy(orderBy))
                collection = ApplyOrderBy(collection, orderByInfo);

            return collection;
        }

        private static IQueryable ApplyOrderBy(IQueryable collection, OrderByInfo orderByInfo)
        {
            string[] props = orderByInfo.PropertyName.Split('.');
            Type type = typeof(T);

            ParameterExpression arg = Expression.Parameter(type, "x");
            Expression expr = arg;
            foreach (string prop in props)
            {
                // use reflection (not ComponentModel) to mirror LINQ
                PropertyInfo pi = type.GetProperty(prop);
                expr = Expression.Property(expr, pi);
                type = pi.PropertyType;
            }
            Type delegateType = typeof(Func<,>).MakeGenericType(typeof(T), type);
            LambdaExpression lambda = Expression.Lambda(delegateType, expr, arg);
            string methodName = String.Empty;

            if (!orderByInfo.Initial && collection is IOrderedQueryable)
            {
                if (orderByInfo.Direction == SortDirection.Ascending)
                    methodName = "ThenBy";
                else
                    methodName = "ThenByDescending";
            }
            else
            {
                if (orderByInfo.Direction == SortDirection.Ascending)
                     methodName = "OrderBy";
                else
                     methodName = "OrderByDescending";
            }

            //TODO: apply caching to the generic methodsinfos?
            return (IOrderedQueryable)typeof(Queryable).GetMethods().Single(
                method => method.Name == methodName
                        && method.IsGenericMethodDefinition
                        && method.GetGenericArguments().Length == 2
                        && method.GetParameters().Length == 2)
                .MakeGenericMethod(typeof(T), type)
                .Invoke(nullnew object[] { collection, lambda });

        }

        private static IEnumerable<OrderByInfo> ParseOrderBy(string orderBy)
        {
            if (String.IsNullOrEmpty(orderBy))
                yield break;

            string[] items = orderBy.Split(',');
            bool initial = true;
            foreach(string item in items)
            {
                string[] pair = item.Trim().Split(' ');

                if (pair.Length > 2)
                    throw new ArgumentException(String.Format("Invalid OrderBy string '{0}'. Order By Format: Property, Property2 ASC, Property2 DESC",item));

                string prop = pair[0].Trim();

                if(String.IsNullOrEmpty(prop))
                    throw new ArgumentException("Invalid Property. Order By Format: Property, Property2 ASC, Property2 DESC");
               
                SortDirection dir = SortDirection.Ascending;
               
                if (pair.Length == 2)
                    dir = ("desc".Equals(pair[1].Trim(), StringComparison.OrdinalIgnoreCase) ? SortDirection.Descending : SortDirection.Ascending);

                yield return new OrderByInfo() { PropertyName = prop, Direction = dir, Initial = initial };

                initial = false;
            }

        }

        private class OrderByInfo
        {
            public string PropertyName { getset; }
            public SortDirection Direction { getset; }
            public bool Initial { getset; }
        }

        private enum SortDirection
        {
            Ascending = 0,
            Descending = 1
        }
    }
Anyway, hope someone finds it useful. And if you see any areas that could use some TLC please let me know A

Friday, May 20, 2011

Microsoft Report Designer - Undocumented Error could not load file or assembly...

Try putting your custom assembly in the [ProgramFiles32]\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies folder and see if that solves the issue.

Tuesday, April 26, 2011

Logic Puzzle – Crossing a Desert




You are currently in one of two towns separated by a desert.
You need to cross the desert to get to the other town.
It takes 6 days to cross the desert, but a single person can carry only 4 days worth of food supply.
You can hire porters to help you carry your food supply, but naturally you want to minimize the costs as much as possible.
What would be the plan that will enable you to cross the desert while paying for the minimum possible number of porter days?


source : http://www.tsqlsolutions.com/

ms sql 2000 - delete non-unique records

The follwing content is copied from :
http://www.codingforums.com/archive/index.php/t-60626.html

test it before use, no refund if it doesnt work or destroys your productiondatabase



-- Declare the variables to store the values returned by FETCH.
DECLARE @accountId varchar(40), @appearances int

-- Get the recordset indicating the AccountId with duplicate entries
DECLARE duplicate_cursor CURSOR FOR
SELECT AccountID, COUNT(AccountID) AS namecount
FROM warehouse
GROUP BY AccountID
HAVING COUNT(AccountID) > 1

-- Open the recordset
OPEN duplicate_cursor

-- Perform the first fetch and store the values in variables.
FETCH NEXT FROM duplicate_cursor
INTO @accountId, @appearances

-- Check @@FETCH_STATUS to see if there are any more rows to fetch.
WHILE @@FETCH_STATUS = 0
BEGIN
-- delete all records for this accountId minus 1
-- Determine how many records must be deleted
SET @appearances = @appearances - 1

-- Limit the result of this delete to the above calculated maximum
SET ROWCOUNT @appearances

-- Execute the delete
DELETE warehouse
WHERE AccountID = @accountId

FETCH NEXT FROM duplicate_cursor
INTO @accountId, @appearances
END

CLOSE duplicate_cursor
DEALLOCATE duplicate_cursor

-- Reset the rowcount limits
SET ROWCOUNT 0
GO

Monday, April 11, 2011

Bookmark of PSD UI templates

http://speckyboy.com/2011/04/11/50-free-psd-ui-kits-and-templates-for-web-designers/ 

Thursday, March 31, 2011

Validate date using Javascript





<script type="text/javascript" src="../script/JqueryMinVer.js">script>
    <script type="text/javascript">
        $(document).ready(
        function () {
            $("[id$='btnLoadStatistics']").click(
          function () {
              return validate();
          }
         );

            function isValidDate(sText) {
//var dateRegex = new RegExp("^([0-2][0-9]|[3][0-1]|[0-9])/([0][0-9]|[1][0-2]|[0-9])/([1][8-9][0-9][0-9]|[2][0-9][0-9][0-9])$")
var reDate = /(?:0[1-9]|[12][0-9]|3[01])\/(?:0[1-9]|1[0-2])\/(?:19|20\d{2})/;
                return reDate.test(sText);
            }
            function validate() {

                var strDate = $("[id$='txtDate']").val();
                if (isValidDate(strDate)) {
                    return true;
                } else {
                    return false;
                }

            }

        }

);
script>



Tuesday, March 29, 2011

Syntax to alter schema

Alter schema [New Schema] Transfer  [Old Schema].[Table Name] 

Monday, March 28, 2011

SQL Server Version



 SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

 SELECT @@VERSION

Friday, March 25, 2011

Crystal Reports - Null Fields and Null Values (Crystal Syntax)


In general, when Crystal Reports encounters a null valued field in a formula, it immediately stops evaluating the formula and produces no value. If you want to handle null field values in your formula, you must explicitly do so using one of the special functions designed for handling them: IsNull, PreviousIsNull or NextIsNull.
Relating to operators, when Crystal Reports evaluates the condition:
IsNull({Product.Color}) Or
InStr({Product.Color}, " ") = 0
It first evaluates IsNull ({Product.Color}), and when it determines that this is True, it knows that the whole condition is True, and thus does not need to check whether
InStr({Product.Color}, " ") = 0
In other words, Crystal Reports will stop evaluating a Boolean expression when it can deduce the results of the whole expression. In the following example, the formula guards against attempting to divide by zero in the case that denom is 0:
Local NumberVar num;
Local NumberVar denom;
...
If denom <> 0 And num / denom > 5 Then
...
Example
The {Product.Color} field contains both basic colors such as "red" and "black" and fancy two word colors such as "steel satin" and "jewel green". Suppose that you want to write a formula that writes out "basic" for the basic colors and "fancy" for the others.
If InStr({Product.Color}, " ") = 0 Then
   "basic"
Else
   "fancy"
The function call to InStr searches the {Product.Color} string for a space. If it finds a space, it returns the position of the space, otherwise it returns 0. Since basic colors are only one word with no spaces, InStr will return 0 for them.
For some products, such as the Guardian Chain Lock, a color value was not recorded and so the {Product.Color} field has a null value in the database for that record. Thus, the Guardian Chain Lock record does not have any word printed beside it.
Here is how to fix up the previous example using IsNull:
If IsNull({Product.Color}) Or 
   InStr({Product.Color}, " ") = 0 Then
   "basic"
Else
   "fancy"

Monday, March 21, 2011

Some new features of Visual Studio 2010 that can help your productivity right away


This post has the content from  http://www.codehappiness.com/post/new-features-of-visual-studio-2010-that-help-productivity.aspx

(This post is part of Visual Studio 2010 series)
I am playing with Visual Studio 2010 for some time now and just thought to sum up some of the new features of Visual Studio 2010 that could enhance your productivity right away after you start using it.
Even though there are more new features in Visual Studio 2010 that can increase productivity, this post focuses on new features that can help productivity immediately, features that will be used by majority of developers frequently/day-to-day basis, than things that are helpful but not used every day(for instance, web.config transformations is not included).

Navigate To…

You can use Navigate To(Ctrl + ,) to search specific methods, class’, etc in your code. This helps navigating your code faster, code navigation speed in Visual Studio 2010 is increased highly because of this new feature. This also comes handy when you keep jumping between different methods of your code frequently. In previous versions of Visual Studio you didn’t have such a swift option.
VisualStudio2010-NavigateTo
You can do more cool things using Navigate To, like, you can type the abbreviation of the method to find it, as below..
VisualStudio2010-NavigateTo-PascalCase
or type the words itself like “get categories”, “search category”, etc.

Export/Import Break points

In Visual Studio 2010 we can Export/Import breakpoints this helps you in many ways, you can read more about this in my earlier article about Visual Studio 2010 new features in debugging.

Sticky DataTips - with Export/Import option

You know that we can see DataTips when we hover the mouse over variables when Visual Studio is in debug mode, but in Visual studio 2010 we can even pin/unpin datatips to the screen and Export/Import them, you can read more about this too in my earlier article here.

IntelliTrace (only in Visual Studio 2010 Ultimate Edition)

Intellitrace is an innovative new feature added to Visual Studio 2010 which helps debugging applications easier. IntelliTrace is a feature previously known as Historical debugging, which is a major enhancement made to the Visual Studio 2010 debugger. When an exception occurs, you usually start debugging with breakpoints set in suspected areas and check variable/object values for correctness.
But if an exception occurs when IntelliTrace is enabled, it allows you to just go back in time of your application execution and find out what events got raised and what were the values of various variables, etc, similar to Call stack like approach. This helps you inspect all the events that finally triggered the exception. This helps in many ways, even you don’t need to worry about breakpoints.
I have written a separate article about IntelliTrace here.

Call Hierarchy(in C#, not in VB.net)

Call Hierarchy is a new window available in Visual Studio 2010. If you right click a method and choose View Call Hierachy, Call Hierarchy window will show what methods are calling the method and what methods are called by the method. This helps much in understanding existing code. For instance, this could help some one new to the team to a great extent. It can also give a clear picture of your own code (maybe)written a long time back.
VisualStudio2010-CallHierarchyWindow

Variable highlighting

If you place the cursor on a variable/object, all the places where that variable is used is highlighted as shown below. This also helps in understanding code faster.
VisualStudio2010-VariableHighlighting

Select any code and collapse(hide)

As you know, we can collapse a Region or Method in Visual Studio code editor. But have you ever wanted to hide some set of lines which you wouldn’t like to see when you scroll through your code, as for you it is a set of similar lines that appears in various areas in your current code file or for some other reason?
In Visual Studio 2010 code editor, you can select any set of lines of code, right click and choose Outlining –> Hide Selection to collapse it, you can expand as usual(by clicking the “+” near left margin of code editor). And you can right click on the hidden code and choose Outlining –> Stop Hiding Current to revert back.
VisualStudio2010-CollapseCode

Multiple monitor support

(This would apply only if you have more than one monitor) 
It might be ridiculous for many when we talk about multiple monitors for developers, but multiple monitors is a proven productivity enhancing method and most developer geeks know about this, even if they don’t use. Addition of multiple monitor support in Visual Studio 2010 adds evidence to this fact. Visual Studio 2010 provides options to place any Visual Studio window including tool windows in multiple monitors.


Friday, March 18, 2011

Workflows of MSF Agile and CMMI Process Templates for TFS


Content Duplicated from http://msmvps.com/blogs/vstsblog/archive/2009/01/09/workflows-of-msf-agile-and-cmmi-process-templates-for-tfs.aspx


When trying to decide which of the two MSF Process Templates - Agile vs. CMMI Process Improvement - for TFS is the right starting point for your company, it helps to compare the work item types and its workflows.
You can download the full guidance from:

MSF for Agile Software Development

featuring 5 work item types: Bug, Requirement, Quality of Service Requirement (QoS), Risk and Task.
Work Item Type: Bug
msfagile_wi_bug_flow
Work Item Type: Scenario
msfagile_wi_scenario_flow
Work Item Type: Quality of Service Requirement (also known as "technical requirement")
msfagile_wi_qos_flow
Work Item Type: Risk
 msfagile_wi_risk_flow
Work Item Type: Task
 msfagile_wi_task_flow

MSF for CMMI Process Improvement

featuring 7 work item types: Bug, Requirement, Change Request, Issue, Review, Risk, Task
Work Item Type: Bug
cmmi_bug
Work Item Type: Requirement