Mar 052008
 

From OSNews:

Microsoft has released source code from the Singularity research project onto Codeplex under an academic, non-commercial license. “The Singularity Research Development Kit is based on the Microsoft Research Singularity project. It includes source code, build tools, test suites, design notes, and other background materials. The Singularity RDK is for academic non-commercial use only and is governed by this license.”

How cool is that? I’m going to download it and play with it! For those who don’t already know, here’s a description of what Singularity is.

Singularity is a research project focused on the construction of dependable systems through innovation in the areas of systems, languages, and tools. We are building a research operating system prototype (called Singularity), extending programming languages, and developing new techniques and tools for specifying and verifying program behavior.

Advances in languages, compilers, and tools open the possibility of significantly improving software. For example, Singularity uses type-safe languages and an abstract instruction set to enable what we call Software Isolated Processes (SIPs). SIPs provide the strong isolation guarantees of OS processes (isolated object space, separate GCs, separate runtimes) without the overhead of hardware-enforced protection domains. In the current Singularity prototype SIPs are extremely cheap; they run in ring 0 in the kernel’s address space.

Singularity uses these advances to build more reliable systems and applications. For example, because SIPs are so cheap to create and enforce, Singularity runs each program, device driver, or system extension in its own SIP. SIPs are not allowed to share memory or modify their own code. As a result, we can make strong reliability guarantees about the code running in a SIP. We can verify much broader properties about a SIP at compile or install time than can be done for code running in traditional OS processes. Broader application of static verification is critical to predicting system behaviour and providing users with strong guarantees about reliability.

Mar 052008
 

For those who has been getting the ultimate crashes from SharePoint Designer, and many weird oddities with it, this is something that you should know while working with Data View Web Parts. Occasionally, SharePoint Designer will NOT allow you to add a Data View Web Part no matter what you do, as shown below, and the main reason is… *drum roll*… your file is not saved.

The first screen shot shows a “changed but not saved file” and “Insert Selected Fields As…” not working and the second screen shot shows the “Insert Selected Fields as…” working after saving.

Mar 042008
 

While working with SharePoint, I found that I sometimes need to replace strings with some characters or strings, for example, replacing “&” with “&”, or replacing “_x0020_” with ” “. This is a useful template to do so. I got this template from here.

   1:      <!-- here is the template that does the replacement -->
   2:      <xsl:template name="replaceCharsInString">
   3:        <xsl:param name="stringIn"/>
   4:        <xsl:param name="charsIn"/>
   5:        <xsl:param name="charsOut"/>
   6:        <xsl:choose>
   7:          <xsl:when test="contains($stringIn,$charsIn)">
   8:            <xsl:value-of select="concat(substring-before($stringIn,$charsIn),$charsOut)"/>
   9:            <xsl:call-template name="replaceCharsInString">
  10:              <xsl:with-param name="stringIn" select="substring-after($stringIn,$charsIn)"/>
  11:              <xsl:with-param name="charsIn" select="$charsIn"/>
  12:              <xsl:with-param name="charsOut" select="$charsOut"/>
  13:            </xsl:call-template>
  14:          </xsl:when>
  15:          <xsl:otherwise>
  16:            <xsl:value-of select="$stringIn"/>
  17:          </xsl:otherwise>
  18:        </xsl:choose>
  19:      </xsl:template>

And here’s how you’ll call it.

   1:  <!-- pretend this is in a template -->
   2:    <xsl:variable name="myString" select="'This%20is%20Test'"/>
   3:    <xsl:variable name="myNewString">
   4:      <xsl:call-template name="replaceCharsInString">
   5:        <xsl:with-param name="stringIn" select="string($myString)"/>
   6:        <xsl:with-param name="charsIn" select="'%20'"/>
   7:        <xsl:with-param name="charsOut" select="' '"/>
   8:      </xsl:call-template>
   9:    </xsl:variable>
  10:    <!-- $myNewString is a result tree fragment, which should be OK. -->
  11:    <!-- If you really need a string object, do this: -->
  12:    <xsl:variable name="myNewRealString" select="string($myNewString)"/>

And there you have it. Very useful indeed.