Tuesday, May 31, 2011

converting scientific number to Number - XSLT

To conver BigDecimal number in to the normal number in xslt ,we need to write  a new template .
then call this template in the following way
xsl:call-template name="convertSciToNumString"><xsl:with-param name="inputVal" select="percentAmmo" /></xsl:call-template>Template is
<xsl:template name="convertSciToNumString">
<xsl:param name="inputVal" select="0" />
<xsl:variable name="max-exp">
<xsl:value-of
select="'0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'" />
</xsl:variable>
<xsl:variable name="numInput">
<xsl:value-of select="translate(string($inputVal),'e','E')" />
</xsl:variable>
<!-- ==== Mantisa ==== -->
<xsl:variable name="numMantisa">
<xsl:value-of select="number(substring-before($numInput,'E'))" />
</xsl:variable>
<!-- ==== Exponent ==== -->
<xsl:variable name="numExponent">
<xsl:choose>
<xsl:when test="contains($numInput,'E+')">
<xsl:value-of select="substring-after($numInput,'E+')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-after($numInput,'E')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- ==== Coefficient ==== -->
<xsl:variable name="numCoefficient">
<xsl:choose>
<xsl:when test="0 > $numExponent">
<xsl:text>0.</xsl:text>
<xsl:value-of select="substring($max-exp, 1, -number($numExponent)-1)" />
<xsl:text>1</xsl:text>
</xsl:when>
<xsl:when test="$numExponent > 0">
<xsl:text>1</xsl:text>
<xsl:value-of select="substring($max-exp, 1, number($numExponent))" />
</xsl:when>
<xsl:otherwise>
1
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="result">
<xsl:value-of select="number($numCoefficient) * number($numMantisa)" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$result = 'NaN'">
<xsl:value-of select="$numInput" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$result" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<

Cloud Computing -VMForce

Cloud computing refers to the use of networked infrastructure software and the capacity to provide resources to users in an on-demand environment. With cloud computing, information is permanently stored in servers on the Internet and cached temporarily on desktop computers, notebooks, handhelds, or other client devices. In this model, often referred to as “utility computing,” users can access common business applications online from virtually any end user device, on a pay-per-use basis.
                 By design, cloud computing is scalable and elastic, offering IT departments a way to increase capacity or add capabilities on demand, without investing in new infrastructure, training new personnel, or licensing new software.


VMforce 
The first enterprise cloud computing platform for Java developers . This new service will provide enterprise developers with the powerful combination of the Java programming language, the Spring framework, and the Force.com cloud platform. With VMforce, Java developers will be able to build and deploy enterprise apps that are instantly social and available on mobile devices in real time, and that seamlessly leverage Force.com’s cloud database and pre-built platform elements, including reporting and analytics, search, web services API, and application security services. And all of these apps will run on salesforce.com’s trusted global cloud computing infrastructure



Categories of Cloud
When one digs more into the Cloud, there are many types and models of Cloud like Private Cloud, Public Cloud, Hybrid Cloud, Community Cloud, Enterprise Cloud, Infrastructure as a service (IAAS), Platform as a service (PAAS), Software as a Service (SAAS), Business as a service (BAAS), Gaming as a service (GAAS), BPaas, Haas…or easier to say…Anything as a service(XAAS).
Cloud computing is broken down in to few different categories based on the type of service provided
      SaaS (Software as a Service) is the category of cloud computing in which the main resources available as a service are software applications
      PaaS (Platform as a Service) is the category/application of cloud computing in which the service providers deliver a computing platform or a solution stack to their subscribers over the internet.