Wednesday, December 29, 2010

SharaPoint CAML OrderBy DefaultView Limit

The Default List view has direct effect on the number of records that return for the CAML query with OrderBy.
Changed the List's Default View limit to 5 and U see only 5items. Wierd One.
Hope this post will save a lot of time for people researching what the heck happened

Thursday, November 18, 2010

Truncate and shrink Transaction Log file in SQL Server 2008

SQL Server 2008

In SQL Server this process have been changed. In 2008, just change the recovery model to simple and then use DBCC Shrinkfile command.

use [YourDatabaseName]
select name,recovery_model_desc from sys.databases
GO
Alter database [YourDatabaseName] Set Recovery SIMPLE
GO
Declare @LogFileLogicalName sysname
select @LogFileLogicalName=Name from sys.database_files where Type=1
print @LogFileLogicalName

DBCC Shrinkfile(@LogFileLogicalName,1)



______________________________

If you may want to set the recovery back to Full. If so, add the following.
Alter database [YourDatabaseName] Set Recovery FULL

Thursday, May 27, 2010

XSLT String Padding

Create the Template

  <xsl:template name="leftjustify">
    <xsl:param name="content"/>
    <xsl:param name="width"/>

    <xsl:choose>
      <xsl:when test="string-length($content) &gt; $width">
        <xsl:value-of select="substring($content,1,$width)"/>
      </xsl:when>

      <xsl:otherwise>
        <xsl:value-of select="$content"/>
        <xsl:call-template name="spaces">
          <xsl:with-param name="length">
            <xsl:value-of select="$width - string-length($content)"/>
          </xsl:with-param>
        </xsl:call-template>
      </xsl:otherwise>

    </xsl:choose>

  </xsl:template>

  <xsl:template name="spaces">
    <xsl:param name="length"/>
    <!-- the value of this next variable is 255 spaces.. -->
    <xsl:variable name="longstringofspaces">
      <xsl:text>                                                                                                                                                                                                                                                               </xsl:text>
    </xsl:variable>
    <xsl:value-of select="substring($longstringofspaces,1,$length)"/>
  </xsl:template>




Usage:


<xsl:call-template name="leftjustify">
      <xsl:with-param name="content">You can do this</xsl:with-param>
      <xsl:with-param name="width">40</xsl:with-param>
    </xsl:call-template>