Query for getting the childtable no of rows related to one single row in parent table

28. February 2013
SELECT TOP 5 temp.totalcomments,NewsLetter.title,NewsLetter.nID 
(SELECT NewsLetter.nID,NewsLetter.title ,COUNT(a.nID) AS TotalComments
FROM NewsLetter LEFT OUTER JOIN (select nID from Comments where approved='true') as a
ON a.nID=NewsLetter.nID
GROUP BY NewsLetter.nID,NewsLetter.title) AS temp,Newsletter
WHERE scID=10 AND temp.nID=NewsLetter.nID AND trash='false'
ORDER BY totalcomments DESC;


How can I sort List<T> based on properties of T ?

28. February 2013

A very good answer to this problem is provided on this blog post .



_list.Sort((a,b)=> String.Compare(a.Name,b.Name));


_list.Sort((a,b)=> a.SomethingInteger.CompareTo(b.SomethingInteger));

C# ,

System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client

27. February 2013

This error comes when you try to get user input in raw html through a textbox control in order to resolve this you will have to include ValidateRequest="false"


<%@ Page Title="" ValidateRequest="false" Language="C#" MasterPageFile="" AutoEventWireup="true" CodeBehind="" Inherits="" %>

and also you will have to include this

<compilation debug="true" targetFramework="4.0" />
<httpRuntime requestValidationMode="2.0"/>

in your web.config file


Migrate TFS 2010 Project Collection to another TFS 2010 server

27. February 2013

This is a nice blog post for migrating TFS 2010 Project Collection to another TFS 2010 server


Team Foundation Server 2010

TFS 2010 Error : TF255374 The default collation is set to Latin1_General_CI_AI

23. February 2013

[Configuration Database] TF255374: The following SQL Server instance is not compatible with Team Foundation Server: VBXW2008\SQLSVR08. The default collation is set to Latin1_General_CI_AI. Team Foundation Server requires that the default collation be case insensitive and accent sensitive. You must choose a SQL Server instance whose default collation settings match these requirements


The best option i found out was either i re-install the SQL SERVER 2008 again fresh or create a new instance with collation settings defined properly at the time of installation . 

Team Foundation Server 2010 ,

How to get exception details pushed to client when using WCF web service

11. February 2013

We can enable this setting by including the below code in webconfig of WCF web service . By adding the tag <serviceDebug includeExceptionDetailInFaults="true"/> we can get the details of the specific exception raised at server side into client side when Debugger is attached with client application .

          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />


StackOverflowException thrown in C#

8. February 2013

I was getting a stackOverFlowException in my program , i found out that i have called my function in its own definition body , actually i had a similar name function in other class and i forgot to call that function with its own instance and hence this exception was thrown . 


How to implement IValueConverter Interface and using it in xaml

7. February 2013

Nice msdn article for this topic :- http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter(v=vs.100).aspx