Error when trying to access Source Control with Team Explorer- No such Interface found

Try the following steps to resolve the issue:

1. Open a command prompt.

2. Navigate to the following folder:

  “%programfiles%\Microsoft Visual Studio 10.0\Common7\IDE\”

3. Type the following:

devenv.exe /resetuserdata

Advertisements

Bugs and Defects

What is the difference between the bug and defects? bug and defect are differ only theoretically, practically all are same.
Error : Any deviations from the requirements is an error
Bug : Bug is an error during the execution of program
Defect : Post production errors are called as defects
Fault : It is the condition where the system/component is unable to function as per the
Requirement.
Failure : It’s the inability of the system to function as per the requirements.

Pivot Table

Yesterday I was wondering about how to use Pivot tables in SQL Server with SQL, Thougtht  of share the concept with simple example.

What is Pivoting?
 Pivoting is reorganizing the table data. This can help to quickly summarize the flat data,and displaying information in a more useful way to interpret.

Following is the example

 After Pivoting

Lambda Expression- Compare list with custom collection

Following example illustrates how to compare the string list with custom collection using Lambda expression

class Program
{
public class First
{
      public string Name
     {
             get;
              set;
   }
}

static void Main(string[] args)
{
List nameList = new List {“Hai”, “Welcome”};
First first = new First
{
Name = “Hai”
};
List firstList = new List
{
first
};

bool result = (firstList.Any(field => nameList.Contains(field.Name)));
if(result)
{
Console.WriteLine(“Name Found in name list…”);
}
}
}

How change the height of the iframe at run time- using script

Following javascript is useful when we wants to change the height of the iframe at run time
<asp:Content ID=”ModuleContent” ContentPlaceHolderID=”ModuleContent” Runat=”Server”> 
 <iframe id=”testFrame” src =”c:\Test.html” scrolling=”no” width=”80%” height =”0″ frameborder=”0″ onload=”resizeFrame(this);”>
 </iframe>  
 <script type=”text/javascript” language=”javascript”>
  function resizeFrame(iframe) {
   {
    iframe.height = document.frames[iframe.id].document.body.scrollHeight + 20;    
   }
  }
    </script>
</asp:Content>

Garbage Collection

Recently I had a chance to revisit the .Net framework concept ‘Garbage Collection’. It was quite interesting.
Garbage collection basically to reclaim the memory of th eobject which no longer being used.CLR(common language runtime) using the garbage collection algorithm to identify if the application is using an object or not?

How the algorithm works?
All the application has the roots( ie: static, global variable, CPU registers) the roots refer to an objects on the managed heap . The list of active roots is maintained by the just-in-time (JIT) compiler and common language runtime. Initially garbage collection assume that all the objects in the heap are garbage. Finally it assume and reclaim the memory of the obejct which doesnot have the pointer with the root.

Object In Heap

Object In Heap

 

Heap after garbage collection

Create and Use a Template in C#

How to create and Use a Template in C#

Template is use to create a  Skeleton for New Item(File) or project     
   1. Itemtemplate (For File)
   2. ProjectTemplate (For Project)

How to Create  ItemTemplate

1. It require Template class file (.cs)
2. vstemplate (VisualStudio Template), It is a XML file having the extension as .vstemplate

All vstemplate files must have the following format:

<VSTemplate Version=”1.1.0″>
               <TemplateData>
                               <Name>
                               <Description>
                               <Icon>
                               <ProjectType>
                                              <Languages>
                                                             <Language>
                                              </Languages>
                               </ProjectType>
                               <SortOrder>
                               <DefaultName>
               </TemplateData>
               <TemplateContent>
                               <References>
                                              <Reference>
                                                             <Assembly>
                                              </Reference>
                               <ProjectItem>
                                              <SourceFile>
                                              <ReplaceParameters>
                               </ProjectItem>
               </TemplateContent>
</VSTemplate>

Example
<VSTemplate Version=”2.0.0″ xmlns=”http://schemas.microsoft.com/developer/vstemplate/2005″&gt;            <TemplateData>
                        <Name>Sample Template</Name>
                        <Description> This is the Sample Template for Testing /Description>
                        <Icon>Sample.ico</Icon>—————If u want any Icon for Template
                        <ProjectType>CSharp</ProjectType>
                        <DefaultName>Default Sample Name</DefaultName>–Default name for the File
           </TemplateData> 
            <TemplateContent>
    <References>
                          <Reference>
                                <Assembly>System</Assembly>
                </Reference>
    </References>
    <ProjectItem SubType=”Code” TargetFileName=”$fileinputname$.cs” placeParameters=”true”>SIMPLE.cs</ProjectItem>
            </TemplateContent>
</VSTemplate> 

Save the above file as “SIMPLE.vstemplate”

SIMPLE.cs is  class file to act as Template using the skeleton of  .vstemplate

using System;
using System.Collections;
namespace $rootnamespace$ —————————–Detect the Namespace name
{
    public class $safeitemname$—————————-Detect the class
    {
                public $safeitemname$()
                {
                }
     }
}

1 .Save the both file (SIMPLE.cs and SIMPLE.vstemplate) in to the same directory, for example SIMPLE
2. Make the above directory as a zip file. Now, we could put it in to the ItemTemplates directory \My Documents\Visual Studio 2005\Templates\ItemTemplates Drop the zip file in that folder and then load Visual Studio. Create a new project and right-click to add a new file. There you’ll see our new template, select the Template and enjoy coding.