29 December 2010

HTML : white space nowrap

In the gold days to avoid a white space wrap we could use the nobr tag. Now since the tag is deprecated we must use css:

.nobr { white-space:nowrap; }

This class can be applied to a span with the text we need to avoid the wrap.

16 December 2010

Immediate Window is missing in Visual Studio 2010 Menu

When the Immediate Window is missing in Visual Studio Menu, just do the following steps:
1) In the menu, select View -> Other Windows -> Command Window
2) Type immed in the command window and the It will bring the Immediate Window
3) Type cmd inside the Immediate Window and it will bring the Command Window back again

15 December 2010

Fix the MaxItemsInObjectGraph quota error

When there is a great amount of data to send to a WCF service, the following error occurs:

Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota.

To fix the error the MaxItemsInObjectGraph must be defined on the wcf service server and the client.

On the server:

        <service behaviorConfiguration="Service1Behavior" name="Service1">
           <endpoint address="" binding="basicHttpBinding" contract="IService1"></endpoint>
                <behavior name="Service1Behavior">          
                    <serviceMetadata httpGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                    <dataContractSerializer maxItemsInObjectGraph="2147483647"/>

On the client:

        <endpoint address="http://localhost/Service1.svc" behaviorConfiguration="Service1Behavior" binding="basicHttpBinding" contract="IService1Event" name="Service1">
            <behavior name="Service1Behavior">
              <dataContractSerializer maxItemsInObjectGraph="2147483647"/>    

14 December 2010

Optimize tempdb Performance

To optimize tempdb Performance in a production environment:
1) Set the recovery model of tempdb to SIMPLE.
2) Allow for tempdb files to automatically grow as required.
3) Set the file growth increment to a reasonable size. Set it to 10% of the file size, with a minimnum of 10MB
4) create one data file for each CPU on the server, note that a dual-core CPU is considered to be two CPUs.
5) Make each data file the same size; this allows for optimal proportional-fill performance.
6) Put the tempdb database on a fast I/O subsystem. Use disk striping if there are many directly attached disks.
7) Put the tempdb database on dedicated disks.

For more information: MSDN Optimizing tempdb Performance