Friday, June 3, 2011

XStream - Features

XStream is a simple library to serialize objects to XML and back again.
Features
  • Ease of use. A high level facade is supplied that simplifies common use cases.
  • No mappings required. Most objects can be serialized without need for specifying mappings.
  • Performance. Speed and low memory footprint are a crucial part of the design, making it suitable for large object graphs or systems with high message throughput.
  • Clean XML. No information is duplicated that can be obtained via reflection. This results in XML that is easier to read for humans and more compact than native Java serialization.
  • Requires no modifications to objects. Serializes internal fields, including private and final. Supports non-public and inner classes. Classes are not required to have default constructor.
    Full object graph support. Duplicate references encountered in the object-model will be maintained. Supports circular references.
  • Integrates with other XML APIs. By implementing an interface, XStream can serialize directly to/from any tree structure (not just XML).
  • Customizable conversion strategies. Strategies can be registered allowing customization of how particular types are represented as XML.
  • Error messages. When an exception occurs due to malformed XML, detailed diagnostics are provided to help isolate and fix the problem.
  • Alternative output format. The modular design allows other output formats. XStream ships currently with JSON support and morphing

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.