Wednesday, September 21, 2011

Top 7 Coding Standards & Guideline Documents For C#/.NET Developers

Came across this blog post that aggregates the “top 7” coding standards documents:

http://www.amazedsaint.com/2010/11/top-6-coding-standards-guideline.html

Sunday, September 18, 2011

TFS–determining the build in which a particular changeset was delivered in

If you ever need to determine in which build a particular changeset was delivered in, here is the query that you can run against the TFS_Warehouse database:

SELECT     c.ChangesetTitle, c.ChangesetID, b.BuildID, b.BuildName, b.BuildDefinitionName, b.LastUpdatedDateTime
FROM         FactBuildChangeset AS bc INNER JOIN
                      DimTeamProject AS tp ON tp.ProjectNodeSK = bc.TeamProjectSK INNER JOIN
                      DimBuild AS b ON b.BuildSK = bc.BuildSK INNER JOIN
                      DimChangeset AS c ON c.ChangesetSK = bc.ChangesetSK INNER JOIN
                      DimPerson AS p ON p.PersonSK = c.CheckedInBySK
WHERE    
(tp.ProjectNodeName = 'ProjectName')
AND (p.Name = 'PersonCheckedInByName')
AND (b.BuildDefinitionName = 'BuildDefinitionName')

image

Reference:
http://msdn.microsoft.com/en-us/library/ee620641.aspx (Build Changeset Tables)

Friday, September 16, 2011

Using WinMerge within Visual Studio

In VS 2011, there are major improvements coming to the in-built Diff tool. But in the mean time, there is a better way to performs merges and compares – it uses the OpenSource tool WinMerge:
Here is how:
Open the options dialog: Tools –> Options and navigate to Source-Control –> Visual Studio Team Foundation Server.
image
Click on Configure User Tools….
image
Click on Add
image Extension: .*
Operation: Compare
Command: path to WinmergeU.exe
Arguments: /e /u /x /wl /wr /dl %6 /dr %7 %1 %2 /maximize
Click on Add again and this time setup the Merge tool.
image Extension: .*
Operation: Merge
Command: path to WinmergeU.exe
Arguments: /e /u /x /wl /dl %6 /dr %7 %1 %2 %4 /maximize
note: the Arguments are different between the Compare and Merge settings.
And now you should have a much more powerful way to compare and merge files:
image

Visual Studio 11 Preview via VM

Here is a great way to get to know Visual Studio 11 – through a VM already setup with VS 11.

http://blogs.msdn.com/b/briankel/archive/2011/09/16/visual-studio-11-application-lifecycle-management-virtual-machine-and-hands-on-labs-demo-scripts.aspx

I am downloading it right now and will be checking out the hands-on labs. Should be a great way to learn about all the new features in VS 11.

Friday, September 09, 2011

Online collaboration tools

Came across two cool online collaboration tools today:

Corkboard: Create and share notes online
http://corkboard.me/6hHywKTcdB

image

PiratePad: This is another free tool that allows you to collaborate.
http://piratepad.net/front-page/

image

One nice feature of PiratePad is the fact that multiple people can view whats being typed at the same time. One immediate use that I see for this tool is for using it to conduct phone interviews where you ask the other person to write some psuedo-code.

Both tools have a paid and free option.

Useful!

Thursday, September 08, 2011

Maximum message size quota for incoming messages (65536) has been exceeded even though maxReceivedMessageSize has been set

I was getting this error in the server side WCF trace messages. The weird thing was that the maxReceivedMessageSize was set on the bindingConfiguration (shown below):

image

After a lot of time trying to debug the issue I figured out the issue: the name that I had set on the service was not correct and it did not point to the name of the class that implemented the contract. This I think resulted in a default configuration getting applied to the service and hence the bindingBehavior that I had defined was not being applied to the service. Once I corrected the name, everything began working correctly.

So make sure your service’s name is set correctly.

image

Remember: name. Specifies the type that provides an implementation of a service contract. This is a fully qualified name which consists of the namespace, a period, and then the type name. For example "MyNameSpace.myServiceType". (MSDN)

Note: If you want to use a name other than the class name, then you can use the ServiceBehavior (MSDN) attribute on your class to give it a different name.

References:

Control generated WSDL in WCF - Part 1. Namespaces.
http://www.pluralsight-training.net/community/blogs/kirillg/archive/2006/06/18/28380.aspx

Service versioning
http://msdn.microsoft.com/en-us/library/ms731060.aspx

Wednesday, September 07, 2011

WCF–setting up tracing

All you need to do is to add is the following in your config file (under <Configuration>)

<system.diagnostics>
  <sources>
   <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true" >
    <listeners>
     <add type="System.Diagnostics.DefaultTraceListener" name="Default">
      <filter type=""/>
     </add>
     <add initializeData="myTraceLog.svclog" type="System.Diagnostics.XmlWriterTraceListener" name="sdt" traceOutputOptions="DateTime, Timestamp">
        <filter type=""/>
     </add>
    </listeners>
   </source>
  </sources>
  <trace autoflush="true"/>
</system.diagnostics>

The trace will get written to “myTraceLog.svclog” and can be viewed using “SvcTraceViewer.exe” which can typically be found at “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin”

WCF–sending large messages to the server

For the server to be able to accept large messages from clients you don’t only have to change the “maxReceivedMessageSize” and “maxBufferSize”, but also the HttpRuntime’s maxRequestLength. Without the maxRequestLength being set, large messages will get thrown out by the server.

<system.web>
<httpRuntime maxRequestLength="102400"/>
……
</system.web>

<bindings>
   <basicHttpBinding>
    <binding name="myBinding" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
     maxBufferSize="2147483647 " maxReceivedMessageSize="2147483647" maxBufferPoolSize="524288" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
     <readerQuotas maxDepth="32" maxStringContentLength="819200" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    </binding>
</basicHttpBinding>

If you have One-Way operations, and you attempt to send data that’s larger than the httpRuntime.maxRequestLength value (default is 4mb), then you will not see any errors from the server. Instead you will most probably see a 504 error.

Monday, September 05, 2011

Web design for the design and color challenged

I am web design and color challenged. So I am always looking for cool tools to use to help me in this regard. Today I came across “Kuler” by Adobe. Very cool website that allows you to find palettes that others have created.

image

Another useful color site is “Color Lovers”, which in addition to colors also provides you patterns and other design elements.

image

Go get inspired….