text:
/** \file eigen_matrix_impl.h
 * \brief Contains class declaration for pcl2::EigenMatImpl
 */

#ifndef PCL2_EIGEN_MATRIX_IMPL_H
#define PCL2_EIGEN_MATRIX_IMPL_H

#include "pcl2/eigen_matrix.h"

#include "pcl2/matrix_impl.h"
#include "pcl2/typed_matrix_impl.h"

#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <Eigen/Core>

namespace pcl2
{

template <typename T> class EigenMat;
template <typename T> class ConstEigenMat;

namespace core
{

/** \brief The implementation for a shared Eigen matrix */
template<typename T>
class EigenMatImpl : public TypedMatImpl<T>, public boost::enable_shared_from_this<EigenMatImpl<T> >
{
public:
  /** \brief a shared pointer to a EigenMatImpl */
  typedef boost::shared_ptr<EigenMatImpl<T> > Ptr;

  /** \brief a const shared pointer to a EigenMatImpl */
  typedef boost::shared_ptr<const EigenMatImpl<T> > ConstPtr;

private:
  /** \brief This constructor is disabled */
  EigenMatImpl ();

  /** \brief The copy constructor is disabled */
  EigenMatImpl (const EigenMatImpl<T> & f);

protected:
  /** \brief Construct a new EigenMatImpl with the specified number of rows and columns
   *
   * \param rows The number of rows
   * \param cols The number of cols
   */
  EigenMatImpl (size_t rows, size_t cols);

public:
  virtual MatImpl::Ptr copy () const;

  /** \brief Create a new EigenMatImpl of the given size
   *
   * \param rows The number of rows in the new matrix
   * \param cols The number of cols in the new matrix
   * \return A shared pointer to a new matrix
   */
  virtual MatImpl::Ptr createNew (size_t rows, size_t cols) const;

  /** \brief Create a new MatViewImpl from this EigenMatImpl and the
   * provided indices
   *
   * \param indices A matrix of integers indexing rows of this matrix
   * \return A shared pointer to a new MatViewImpl
   */
  virtual MatImpl::Ptr createView (const typename TypedMatImpl<int>::ConstPtr & indices);

  virtual size_t rows () const;
  virtual size_t cols () const;

  virtual void fill (const TypedMatImpl<T> & matrix_ptr);
  virtual void fill (const T & value);

  virtual typename TypedMatImpl<T>::Ptr operator + (const T & operand) const;
  virtual typename TypedMatImpl<T>::Ptr operator - (const T & operand) const;
  virtual typename TypedMatImpl<T>::Ptr operator * (const T & operand) const;
  virtual typename TypedMatImpl<T>::Ptr operator / (const T & operand) const;

  virtual typename TypedMatImpl<T>::Ptr operator + (const TypedMatImpl<T> & operand) const;
  virtual typename TypedMatImpl<T>::Ptr operator - (const TypedMatImpl<T> & operand) const;

  virtual void operator += (const TypedMatImpl<T> & operand);
  virtual void operator -= (const TypedMatImpl<T> & operand);
  virtual void operator *= (const TypedMatImpl<T> & operand);
  virtual void operator /= (const TypedMatImpl<T> & operand);

  /** \brief Access an element in the matrix
   * \param i The row of the element
   * \param j The column of the element
   * \return A reference to the element in the ith row and jth column
   */
  virtual T & operator () (size_t i, size_t j);

  /** \brief Access an element in the matrix
   * \param i The row of the element
   * \param j The column of the element
   * \return A const reference to the element in the ith row and jth column
   */
  virtual const T & operator () (size_t i, size_t j) const;

protected:

  /** \brief The number of rows */
  size_t rows_;

  /** \brief The number of columns */
  size_t cols_;

  /** \brief The matrix data (stored in column major form) */
  Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> data_;

  friend class pcl2::EigenMat<T>;
  friend class pcl2::ConstEigenMat<T>;
};

} // namespace core
} // namespace pcl2

#endif


text:
<?php
class SnippetHierarchy extends DataExtension {
    protected $markedNodes;

    protected $markingFilter;

    /**
     * @var Int
     */
    protected $_cache_numChildren;

    /**
     * True if this DataObject is marked.
     * @var boolean
     */
    protected static $marked=array();

    /**
     * True if this DataObject is expanded.
     * @var boolean
     */
    protected static $expanded=array();

    /**
     * True if this DataObject is opened.
     * @var boolean
     */
    protected static $treeOpened=array();

    /**
     * Validate the owner object - check for existence of infinite loops.
     */
    public function validate(ValidationResult $validationResult) {
        if (!$this->owner->ID) return; // The object is new, won't be looping.
        if (!$this->owner->LanguageID) return; // The object has no parent, won't be looping.
        if (!$this->owner->isChanged('LanguageID')) return; // The parent has not changed, skip the check for performance reasons.

        // Walk the hierarchy upwards until we reach the top, or until we reach the originating node again.
        $node=$this->owner;
        while($node) {
            if ($node->LanguageID==$this->owner->ID) {
                // Hierarchy is looping.
                $validationResult->error(
                    _t(
                        'Hierarchy.InfiniteLoopNotAllowed',
                        'Infinite loop found within the "{type}" hierarchy. Please change the parent to resolve this',
                        'First argument is the class that makes up the hierarchy.',
                        array('type' => $this->owner->class)
                    ),
                    'INFINITE_LOOP'
                );
                break;
            }
            $node=$node->LanguageID ? $node->Language() : null;
        }

        // At this point the $validationResult contains the response.
    }

    /**
     * Return an array of this page and its ancestors, ordered item -> root.
     * @return array
     */
    public function parentStack() {
        $p=$this->owner;

        while($p) {
            $stack[]=$p;
            if($p->FolderID && $p->FolderID>0) {
                $folder=$p->Folder();
                if(!empty($folder) && $folder!==false && $folder->ID!=0) {
                    $p=$folder;
                }
            }else {
                $p=$p->LanguageID ? $p->Language() : null;
            }
        }

        return $stack;
    }

    /**
     * Get the parent of this class.
     * @return DataObject
     */
    public function getParent($filter='') {
        return $this->owner->Language();
    }

    /**
     * Return all the parents of this class in a set ordered from the lowest to highest parent.
     *
     * @return SS_List
     */
    public function getAncestors() {
        $ancestors=new ArrayList();
        $object   =$this->owner;

        while($object=$object->Language()) {
            $ancestors->push($object);
        }

        return $ancestors;
    }

    /**
     * Get the next node in the tree of the type. If there is no instance of the className descended from this node,
     * then search the parents.
     * @param string $className Class name of the node to find.
     * @param string|int $root ID/ClassName of the node to limit the search to
     * @param DataObject afterNode Used for recursive calls to this function
     * @return DataObject
     */
    public function naturalNext( $className=null, $root=0, $afterNode=null ) {
        // If this node is not the node we are searching from, then we can possibly return this
        // node as a solution
        if($afterNode && $afterNode->ID != $this->owner->ID) {
            if(!$className || ($className && $this->owner->class == $className)) {
                return $this->owner;
            }
        }

        $nextNode=null;
        $baseClass=ClassInfo::baseDataClass($this->owner->class);

        $children=DataObject::get(ClassInfo::baseDataClass($this->owner->class), "\"$baseClass\".\"LanguageID\"={$this->owner->ID}" . ( ( $afterNode ) ? " AND \"Sort\" > " . sprintf( '%d', $afterNode->Sort ) : "" ), '"Sort" ASC');

        // Try all the siblings of this node after the given node
        /*if( $siblings=DataObject::get( ClassInfo::baseDataClass($this->owner->class), "\"LanguageID\"={$this->owner->LanguageID}" . ( $afterNode ) ? "\"Sort\" > {$afterNode->Sort}" : "" , '\"Sort\" ASC' ) )
            $searchNodes->merge( $siblings );*/

        if($children) {
            foreach($children as $node) {
                if($nextNode=$node->naturalNext($className, $node->ID, $this->owner)) {
                    break;
                }
            }

            if($nextNode) {
                return $nextNode;
            }
        }

        // if this is not an instance of the root class or has the root id, search the parent
        if(!(is_numeric($root) && $root == $this->owner->ID || $root == $this->owner->class) && ($parent=$this->owner->Language())) {
            return $parent->naturalNext( $className, $root, $this->owner );
        }

        return null;
    }

    /**
     * Mark a segment of the tree, by calling mark().
     * The method performs a breadth-first traversal until the number of nodes is more than minCount.
     * This is used to get a limited number of tree nodes to show in the CMS initially.
     *
     * This method returns the number of nodes marked.  After this method is called other methods
     * can check isExpanded() and isMarked() on individual nodes.
     *
     * @param int $minNodeCount The minimum amount of nodes to mark.
     * @return int The actual number of nodes marked.
     */
    public function markPartialTree($minNodeCount=30, $context=null, $childrenMethod="AllChildrenIncludingDeleted", $numChildrenMethod="numChildren") {
        if(!is_numeric($minNodeCount)) $minNodeCount=30;

        $this->markedNodes=array($this->owner->ClassName.'_'.$this->owner->ID=>$this->owner);
        $this->owner->markUnexpanded();

        // foreach can't handle an ever-growing $nodes list
        while(list($id, $node)=each($this->markedNodes)) {
            $this->markChildren($node, $context, $childrenMethod, $numChildrenMethod);
            if($minNodeCount && sizeof($this->markedNodes)>=$minNodeCount) {
                break;
            }
        }

        return sizeof($this->markedNodes);
    }

    /**
     * Mark all children of the given node that match the marking filter.
     * @param DataObject $node Parent node.
     */
    public function markChildren($node, $context=null, $childrenMethod='AllChildrenIncludingDeleted', $numChildrenMethod='numChildren') {
        if($node->hasMethod($childrenMethod)) {
            $children=$node->$childrenMethod($context);
        }else {
            user_error(sprintf("Can't find the method '%s' on class '%s' for getting tree children", $childrenMethod, get_class($node)), E_USER_ERROR);
        }

        $node->markExpanded();
        if($children) {
            foreach($children as $child) {
                if(!$this->markingFilter || $this->markingFilterMatches($child)) {
                    if($child->$numChildrenMethod()) {
                        $child->markUnexpanded();
                    }else {
                        $child->markExpanded();
                    }

                    $this->markedNodes[$child->ClassName.'_'.$child->ID]=$child;
                }
            }
        }
    }

    /**
     * Mark the children of the DataObject with the given ID.
     * @param int $id ID of parent node.
     * @param boolean $open If this is true, mark the parent node as opened.
     */
    public function markById($id, $open=false, $className=null) {
        if(isset($this->markedNodes[$className.'_'.$id])) {
            $this->markChildren($this->markedNodes[$className.'_'.$id]);
            if($open) {
                $this->markedNodes[$className.'_'.$id]->markOpened();
            }

            return true;
        } else {
            return false;
        }
    }

    /**
     * Expose the given object in the tree, by marking this page and all it ancestors.
     * @param DataObject $childObj
     */
    public function markToExpose($childObj) {
        if(is_object($childObj)){
            $stack=array_reverse($childObj->parentStack());
            foreach($stack as $stackItem) {
                $this->markById($stackItem->ID, true, $stackItem->ClassName);
            }
        }
    }

    /**
     * Return the number of direct children.
     * By default, values are cached after the first invocation.
     * Can be augumented by {@link augmentNumChildrenCountQuery()}.
     *
     * @param Boolean $cache
     * @return int
     */
    public function numChildren($cache=true) {
        // Build the cache for this class if it doesn't exist.
        if(!$cache || !is_numeric($this->_cache_numChildren)) {
            if($this->owner instanceof SnippetLanguage) {
                $this->_cache_numChildren=(int)$this->owner->Snippets()->filter('FolderID', 0)->Count() + (int)$this->owner->Folders()->Count();
            }else if($this->owner instanceof SnippetFolder) {
                $this->_cache_numChildren=(int)$this->owner->Snippets()->Count() + (int)$this->owner->Folders()->Count();
            }else {
                $this->_cache_numChildren=0;
            }
        }

        // If theres no value in the cache, it just means that it doesn't have any children.
        return $this->_cache_numChildren;
    }

    /**
     * Returns the children of this DataObject as an XHTML UL. This will be called recursively on each child,
     * so if they have children they will be displayed as a UL inside a LI.
     * @param string $attributes Attributes to add to the UL.
     * @param string|callable $titleEval PHP code to evaluate to start each child - this should include '
'
     * @param string $extraArg Extra arguments that will be passed on to children, for if they overload this function.
     * @param boolean $limitToMarked Display only marked children.
     * @param string $childrenMethod The name of the method used to get children from each object
     * @param boolean $rootCall Set to true for this first call, and then to false for calls inside the recursion. You should not change this.
     * @param int $minNodeCount
     * @return string
     */
    public function getChildrenAsUL($attributes="", $titleEval='"
" . $child->Title', $extraArg=null, $limitToMarked=false, $childrenMethod="AllChildrenIncludingDeleted", $numChildrenMethod="numChildren", $rootCall=true, $minNodeCount=30) {
        if($limitToMarked && $rootCall) {
            $this->markingFinished($numChildrenMethod);
        }

        if($this->owner->hasMethod($childrenMethod)) {
            $children=$this->owner->$childrenMethod($extraArg);
        } else {
            user_error(sprintf("Can't find the method '%s' on class '%s' for getting tree children",
                    $childrenMethod, get_class($this->owner)), E_USER_ERROR);
        }

        if($children) {
            if($attributes) {
                $attributes=" $attributes";
            }

            $output="
\n";

            foreach($children as $child) {
                if(!$limitToMarked || $child->isMarked()) {
                    $foundAChild=true;
                    $output .= (is_callable($titleEval)) ? $titleEval($child) : eval("return $titleEval;");
                    $output .= "\n" .
                            $child->getChildrenAsUL("", $titleEval, $extraArg, $limitToMarked, $childrenMethod, $numChildrenMethod, false, $minNodeCount) . "
\n";
                }
            }

            $output .= "
\n";
        }

        if(isset($foundAChild) && $foundAChild) {
            return $output;
        }
    }

    /**
     * Filter the marking to only those object with $node->$parameterName=$parameterValue
     * @param string $parameterName The parameter on each node to check when marking.
     * @param mixed $parameterValue The value the parameter must be to be marked.
     */
    public function setMarkingFilter($parameterName, $parameterValue) {
        $this->markingFilter=array(
                "parameter" => $parameterName,
                "value" => $parameterValue
        );
    }

    /**
     * Filter the marking to only those where the function returns true.
     * The node in question will be passed to the function.
     * @param string $funcName The function name.
     */
    public function setMarkingFilterFunction($funcName) {
        $this->markingFilter=array(
                "func" => $funcName,
        );
    }

    /**
     * Returns true if the marking filter matches on the given node.
     * @param DataObject $node Node to check.
     * @return boolean
     */
    public function markingFilterMatches($node) {
        if(!$this->markingFilter) {
            return true;
        }

        if(isset($this->markingFilter['parameter']) && $parameterName=$this->markingFilter['parameter']) {
            if(is_array($this->markingFilter['value'])){
                $ret=false;
                foreach($this->markingFilter['value'] as $value) {
                    $ret=$ret||$node->$parameterName==$value;
                    if($ret == true) {
                        break;
                    }
                }
                return $ret;
            } else {
                return ($node->$parameterName == $this->markingFilter['value']);
            }
        } else if ($func=$this->markingFilter['func']) {
            return call_user_func($func, $node);
        }
    }

    /**
     * Ensure marked nodes that have children are also marked expanded.
     * Call this after marking but before iterating over the tree.
     */
    protected function markingFinished($numChildrenMethod="numChildren") {
        // Mark childless nodes as expanded.
        if($this->markedNodes) {
            foreach($this->markedNodes as $id => $node) {
                if(!$node->isExpanded() && !$node->$numChildrenMethod()) {
                    $node->markExpanded();
                }
            }
        }
    }

    /**
     * Return CSS classes of 'unexpanded', 'closed', both, or neither, depending on
     * the marking of this DataObject.
     */
    public function markingClasses() {
        $classes='';
        if(!$this->isExpanded()) {
            $classes .= " unexpanded jstree-closed";
        }
        if($this->isTreeOpened()) {
            if($this->numChildren() > 0) $classes .= " jstree-open";
        } else {
            $classes .= " closed";
        }
        return $classes;
    }

    /**
     * Return the IDs of all the marked nodes
     */
    public function markedNodeIDs() {
        return array_keys($this->markedNodes);
    }

    /**
     * Mark this DataObject as expanded.
     */
    public function markExpanded() {
        self::$marked[ClassInfo::baseDataClass($this->owner->class)][$this->owner->ID]=true;
        self::$expanded[ClassInfo::baseDataClass($this->owner->class)][$this->owner->ID]=true;
    }

    /**
     * Mark this DataObject as unexpanded.
     */
    public function markUnexpanded() {
        self::$marked[ClassInfo::baseDataClass($this->owner->class)][$this->owner->ID]=true;
        self::$expanded[ClassInfo::baseDataClass($this->owner->class)][$this->owner->ID]=false;
    }

    /**
     * Mark this DataObject's tree as opened.
     */
    public function markOpened() {
        self::$marked[ClassInfo::baseDataClass($this->owner->class)][$this->owner->ID]=true;
        self::$treeOpened[ClassInfo::baseDataClass($this->owner->class)][$this->owner->ID]=true;
    }

    /**
     * Check if this DataObject is marked.
     * @return boolean
     */
    public function isMarked() {
        $baseClass=ClassInfo::baseDataClass($this->owner->class);
        $id=$this->owner->ID;
        return isset(self::$marked[$baseClass][$id]) ? self::$marked[$baseClass][$id] : false;
    }

    /**
     * Check if this DataObject is expanded.
     * @return boolean
     */
    public function isExpanded() {
        $baseClass=ClassInfo::baseDataClass($this->owner->class);
        $id=$this->owner->ID;
        return isset(self::$expanded[$baseClass][$id]) ? self::$expanded[$baseClass][$id] : false;
    }

    /**
     * Check if this DataObject's tree is opened.
     */
    public function isTreeOpened() {
        $baseClass=ClassInfo::baseDataClass($this->owner->class);
        $id=$this->owner->ID;
        return isset(self::$treeOpened[$baseClass][$id]) ? self::$treeOpened[$baseClass][$id] : false;
    }

    /**
     * Return a partial tree as an HTML UL.
     */
    public function partialTreeAsUL($minCount=50) {
        $children=$this->owner->AllChildren();
        if($children) {
            if($attributes) $attributes=" $attributes";
            $output="
\n";

            foreach($children as $child) {
                $output .= eval("return $titleEval;") . "\n" .
                        $child->getChildrenAsUL("", $titleEval, $extraArg) . "
\n";
            }
            $output .= "
\n";
        }
        return $output;
    }

    /**
     * Get a list of this DataObject's and all it's descendants IDs.
     * @return int
     */
    public function getDescendantIDList() {
        $idList=array();
        $this->loadDescendantIDListInto($idList);
        return $idList;
    }

    /**
     * Get a list of this DataObject's and all it's descendants ID, and put it in $idList.
     * @var array $idList Array to put results in.
     */
    public function loadDescendantIDListInto(&$idList) {
        if($children=$this->AllChildren()) {
            foreach($children as $child) {
                if(in_array($child->ID, $idList)) {
                    continue;
                }
                $idList[]=$child->ID;
                $ext=$child->getExtensionInstance('Hierarchy');
                $ext->setOwner($child);
                $ext->loadDescendantIDListInto($idList);
                $ext->clearOwner();
            }
        }
    }

    /**
     * Get the children for this DataObject.
     * @return SS_List
     */
    public function Children() {
        if(!(isset($this->_cache_children) && $this->_cache_children)) {
            $result=$this->owner->stageChildren(false);
            if(isset($result)) {
                $this->_cache_children=new ArrayList();
                foreach($result as $child) {
                    if($child->canView()) {
                        $this->_cache_children->push($child);
                    }
                }
            }
        }
        return $this->_cache_children;
    }

    /**
     * Return all children, including those 'not in menus'.
     * @return SS_List
     */
    public function AllChildren() {
        return $this->owner->stageChildren(true);
    }

    /**
     * Return all children, including those that have been deleted but are still in live.
     * Deleted children will be marked as "DeletedFromStage"
     * Added children will be marked as "AddedToStage"
     * Modified children will be marked as "ModifiedOnStage"
     * Everything else has "SameOnStage" set, as an indicator that this information has been looked up.
     * @return SS_List
     */
    public function AllChildrenIncludingDeleted($context=null) {
        return $this->doAllChildrenIncludingDeleted($context);
    }

    /**
     * @see AllChildrenIncludingDeleted
     *
     * @param unknown_type $context
     * @return SS_List
     */
    public function doAllChildrenIncludingDeleted($context=null) {
        if(!$this->owner) user_error('Hierarchy::doAllChildrenIncludingDeleted() called without $this->owner');

        $idxStageChildren=array();
        $idxLiveChildren=array();

        $baseClass=ClassInfo::baseDataClass($this->owner->class);
        if($baseClass) {
            $stageChildren=$this->owner->stageChildren(true);

            $this->owner->extend("augmentAllChildrenIncludingDeleted", $stageChildren, $context);

        }else {
            user_error("SnippetHierarchy::AllChildren() Couldn't determine base class for '{$this->owner->class}'", E_USER_ERROR);
        }

        return $stageChildren;
    }

    /**
     * Return children from the stage site
     *
     * @param showAll Inlcude all of the elements, even those not shown in the menus.
     *   (only applicable when extension is applied to {@link SiteTree}).
     * @return SS_List
     */
    public function stageChildren($showAll=false) {
        $baseClass=ClassInfo::baseDataClass($this->owner->class);

        if($baseClass=='SnippetPackage') {
            if($this->owner->ID==0) {
                $staged=SnippetPackage::get();
            }
        }else if($baseClass=='SnippetLanguage') {
            if($this->owner->ID==0) {
                $staged=SnippetLanguage::get();
            }else {
                $staged=ArrayList::create(array_merge($this->owner->Folders()->toArray(), $this->owner->Snippets()->filter('FolderID', 0)->toArray()));
            }
        }else if($baseClass=='SnippetFolder') {
            $staged=ArrayList::create(array_merge($this->owner->Folders()->toArray(), $this->owner->Snippets()->toArray()));
        }else {
            $staged=new ArrayList();
        }

        $this->owner->extend("augmentStageChildren", $staged, $showAll);
        return $staged;
    }

    /**
     * Returns a human-readable, flattened representation of the path to the object,
     * using its {@link Title()} attribute.
     *
     * @param String
     * @return String
     */
    public function getBreadcrumbs($separator=' » ') {
        $crumbs=array();
        $ancestors=array_reverse($this->owner->getAncestors()->toArray());
        foreach($ancestors as $ancestor) $crumbs[]=$ancestor->Title;
        $crumbs[]=$this->owner->Title;
        return implode($separator, $crumbs);
    }

    /**
     * Get the next node in the tree of the type. If there is no instance of the className descended from this node,
     * then search the parents.
     *
     * @todo Write!
     */
    public function naturalPrev( $className, $afterNode=null ) {
        return null;
    }

    function flushCache() {
        $this->_cache_children=null;
        $this->_cache_numChildren=null;
        self::$marked=array();
        self::$expanded=array();
        self::$treeOpened=array();
    }

    public static function reset() {
        self::$marked=array();
        self::$expanded=array();
        self::$treeOpened=array();
    }
}
?>

redpajama_set_name: RedPajamaGithub


text:
#pragma once
#include <aws/appstream/AppStream_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace AppStream
{
namespace Model
{
  class AWS_APPSTREAM_API CopyImageResult
  {
  public:
    CopyImageResult();
    CopyImageResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    CopyImageResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
The name of the destination image.

     */
    inline const Aws::String& GetDestinationImageName() const{ return m_destinationImageName; }

    /**
     *
The name of the destination image.

     */
    inline void SetDestinationImageName(const Aws::String& value) { m_destinationImageName = value; }

    /**
     *
The name of the destination image.

     */
    inline void SetDestinationImageName(Aws::String&& value) { m_destinationImageName = std::move(value); }

    /**
     *
The name of the destination image.

     */
    inline void SetDestinationImageName(const char* value) { m_destinationImageName.assign(value); }

    /**
     *
The name of the destination image.

     */
    inline CopyImageResult& WithDestinationImageName(const Aws::String& value) { SetDestinationImageName(value); return *this;}

    /**
     *
The name of the destination image.

     */
    inline CopyImageResult& WithDestinationImageName(Aws::String&& value) { SetDestinationImageName(std::move(value)); return *this;}

    /**
     *
The name of the destination image.

     */
    inline CopyImageResult& WithDestinationImageName(const char* value) { SetDestinationImageName(value); return *this;}

  private:

    Aws::String m_destinationImageName;
  };

} // namespace Model
} // namespace AppStream
} // namespace Aws


text:
const EventEmitter = require('events').EventEmitter;

class ConnectorStub extends EventEmitter {
  constructor (options, plugin) {
    super();

    this.connection = 'connection';
    this.mongoose = 'original lib import';

    setTimeout(() => {
      this.emit('ready');
    }, 1);
  }
}

module.exports = ConnectorStub;


text:
#include <xalanc/XPathCAPI/XPathCAPI.h>

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

int
CreateXPath(
			XalanXPathEvaluatorHandle	theXalanHandle,
			const char*					theXPathExpression,
			XalanXPathHandle*			theXPathHandle)
{
	int					theResult = 0;

	assert(theXalanHandle);
	assert(theXPathHandle);

	theResult = XalanCreateXPath(theXalanHandle, theXPathExpression, 0, theXPathHandle);

	if (theResult != XALAN_XPATH_API_SUCCESS)
	{
		fprintf(stderr, "Error creating XPath.  Error code was %d.\n", theResult);
	}

	return theResult;
}

int
DestroyXPath(
			XalanXPathEvaluatorHandle	theXalanHandle,
			XalanXPathHandle			theXPathHandle)
{
	int					theResult = 0;

	theResult = XalanDestroyXPath(theXalanHandle, theXPathHandle);

	if (theResult != XALAN_XPATH_API_SUCCESS)
	{
		fprintf(stderr, "Error creating XPath.  Error code was %d.\n", theResult);
	}

	return theResult;
}

char*
ReadFile(const char*	theXMLFileName)
{
	char*	theBuffer = 0;
	FILE*	theFile = fopen(theXMLFileName, "rb");

	if (theFile == 0)
	{
		fprintf(stderr, "Unable to open input file %s\n", theXMLFileName);
	}
	else
	{
		fseek(theFile, 0, SEEK_END);

		{
			const int	theSize = ftell(theFile);

			if (theSize == -1)
			{
				fprintf(stderr, "Unable to determine the size of the input file\n");
			}
			else
			{
				fseek(theFile, SEEK_SET, 0);

				theBuffer = (char*)malloc(theSize + 1);

				if (theBuffer == 0)
				{
					fprintf(stderr, "Unable to allocate enough memory.  The input file size is %d\n", theSize);
				}
				else
				{
					fread(theBuffer, 1, theSize, theFile);

					theBuffer[theSize] = '\0';
				}
			}
		}

        fclose(theFile);
	}

	return theBuffer;
}

int
EvaluateXPath(
			XalanXPathEvaluatorHandle	theXalanHandle,
			const char*					theXMLFileName,
			const char*					theXPathExpression,
			int*						theBoolean)
{
	XalanXPathHandle	theXPathHandle;

	int					theResult = CreateXPath(theXalanHandle, theXPathExpression, &theXPathHandle);

	if (theResult == XALAN_XPATH_API_SUCCESS)
	{
		char*	theBuffer = ReadFile(theXMLFileName);

		if (theBuffer != NULL)
		{
			theResult = XalanEvaluateXPathAsBoolean(theXalanHandle, theXPathHandle, theBuffer, theBoolean);

			if (theResult != XALAN_XPATH_API_SUCCESS)
			{
				fprintf(stderr, "Unable to evaluate XPath expression.  Error code was %d.\n", theResult);
			}

			free(theBuffer);
		}

		DestroyXPath(theXalanHandle, theXPathHandle);
	}

	return theResult;
}

int
main(
			int		argc,
			char*	argv[])
{
	int		theResult = 0;

	if (argc != 3)
	{
		fprintf(stderr, "Usage: SimpleXPathAPI XMLFilePath XPathExpression\n");

		theResult = -1;
	}
	else
	{
		theResult = XalanXPathAPIInitialize();

		if (theResult != XALAN_XPATH_API_SUCCESS)
		{
			fprintf(stderr, "Unable to initialize the API.  Error code was %d.\n", theResult);
		}
		else
		{
			XalanXPathEvaluatorHandle	theXalanHandle;

			theResult = XalanCreateXPathEvaluator(&theXalanHandle);

			if (theResult != XALAN_XPATH_API_SUCCESS)
			{
				fprintf(stderr, "Error creating evaluator.  Error code was %d.\n", theResult);
			}
			else
			{
				int	theBoolean = 0;

				theResult = EvaluateXPath(theXalanHandle, argv[1], argv[2], &theBoolean);

				if (theResult == XALAN_XPATH_API_SUCCESS)
				{
					fprintf(stdout, "The result of the expression was '%s'.\n", theBoolean == 0 ? "false" : "true");
				}

				theResult = XalanDestroyXPathEvaluator(theXalanHandle);

				if (theResult != XALAN_XPATH_API_SUCCESS)
				{
					fprintf(stderr, "Error destroying evaluator.  Error code was %d.\n", theResult);
				}
			}

			theResult = XalanXPathAPITerminate();

			if (theResult != XALAN_XPATH_API_SUCCESS)
			{
				fprintf(stderr, "Error terminating the API.  Error code was %d.\n", theResult);
			}
		}
	}

	return theResult;
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<T3locallangExt>
  <data type="array">
    <languageKey index="de" type="array">
      RealURL-Verwaltung
      Bitte wählen Sie eine Seite aus dem Seitenbaum.
      Tiefe:
      Anzeigen:
      Standard
      Alle
      Sprache:
      Pfad:
      Suchen
      Alle zeigen
      Ergebnisse %1$d-%2$d von %3$d
      -- Alle Domains --
    </languageKey>
  </data>
</T3locallangExt>


text:
<?php

namespace app\models;

use Yii;
use sjaakp\illustrated\Illustrated;
use romi45\seoContent\components\SeoBehavior;

/**
 * This is the model class for table "category".
 *
 * @property integer $id
 * @property integer $parent_id
 * @property string $title
 * @property string $description
 * @property string $created_at
 * @property string $updated_at
 * @property string $picture
 *
 * @property Product[] $products
 */
class Category extends \yii\db\ActiveRecord
{
    /**
    * @inheritdoc
    */
    public static function tableName()
    {
        return '{{%category}}';
    }

    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            'illustrated' => [
                "class" => Illustrated::className(),
                "attributes"    => [
                    "picture"   => [
                        'cropSize'  => 960,
                        'aspectRatio'   => 1,
                        'sizeSteps' => 4,
                        'allowTooSmall'  => true
                    ],
                ],
                'directory' => '@app/web/uploads/images/shop/category',
                'illustrationDirectory' => 'uploads/images/shop'
            ],
            'seo' => [
                'class' => SeoBehavior::className(),

                // This is default values. Usually you can not specify it
                'titleAttribute' => 'seoTitle',
                'keywordsAttribute' => 'seoKeywords',
                'descriptionAttribute' => 'seoDescription'
            ],
        ];
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['parent_id'], 'integer'],
            [['title', 'slug'], 'required'],
            [['description'], 'string'],
            [['created_at', 'updated_at'], 'safe'],
            [['title', 'picture', 'slug'], 'string', 'max' => 255],
            [['seoTitle', 'seoKeywords', 'seoDescription'], 'safe'],
            [['slug'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('bshop', 'ID'),
            'parent_id' => Yii::t('bshop', 'Parent category'),
            'title' => Yii::t('bshop', 'Title'),
            'description' => Yii::t('bshop', 'Description'),
            'created_at' => Yii::t('bshop', 'Created At'),
            'updated_at' => Yii::t('bshop', 'Updated At'),
            'picture' => Yii::t('bshop', 'Picture'),
        ];
    }

    /**
    * @return \yii\db\ActiveQuery
    */
    public function getProducts()
    {
        return $this->hasMany(Product::className(), ['category_id' => 'id']);
    }

    /**
    * @return \yii\db\ActiveQuery
    */
    public function getParent()
    {
        return $this->hasOne(Category::className(), ['id' => 'parent_id']);
    }

    public static function selectList($except = 0)
    {
        return Category::find()
            ->select(['title'])
            ->where('id <> ' . (int)$except)
            ->indexBy('id')
            ->column();
    }

    //@TODO: implement this
    public function search()
    {

    }
}


text:
package org.elasticsearch.action.admin.cluster.snapshots.get.shard;

import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.repositories.RepositoryException;
import org.elasticsearch.repositories.ShardSnapshotInfo;

import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;

public class GetShardSnapshotResponse extends ActionResponse {
    public static GetShardSnapshotResponse EMPTY = new GetShardSnapshotResponse(null, Collections.emptyMap());

    private final ShardSnapshotInfo latestShardSnapshot;
    private final Map<String, RepositoryException> repositoryFailures;

    GetShardSnapshotResponse(@Nullable ShardSnapshotInfo latestShardSnapshot, Map<String, RepositoryException> repositoryFailures) {
        this.latestShardSnapshot = latestShardSnapshot;
        this.repositoryFailures = repositoryFailures;
    }

    GetShardSnapshotResponse(StreamInput in) throws IOException {
        super(in);
        this.latestShardSnapshot = in.readOptionalWriteable(ShardSnapshotInfo::new);
        this.repositoryFailures = in.readMap(StreamInput::readString, RepositoryException::new);
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        out.writeOptionalWriteable(latestShardSnapshot);
        out.writeMap(repositoryFailures, StreamOutput::writeString, (o, err) -> err.writeTo(o));
    }

    public Optional<RepositoryException> getFailureForRepository(String repository) {
        return Optional.ofNullable(repositoryFailures.get(repository));
    }

    public Optional<ShardSnapshotInfo> getLatestShardSnapshot() {
        return Optional.ofNullable(latestShardSnapshot);
    }

    public Map<String, RepositoryException> getRepositoryFailures() {
        return repositoryFailures;
    }
}


text:
require 'test_helper'

class Project::SettingsHelperTest < ActionView::TestCase
end


text:
package io.reactivex.tck;

import org.reactivestreams.Publisher;
import org.testng.annotations.Test;

import io.reactivex.*;
import io.reactivex.functions.Function;

@Test
public class ConcatMapMaybeTckTest extends BaseTck<Integer> {

    @Override
    public Publisher<Integer> createPublisher(long elements) {
        return
                Flowable.range(0, (int)elements)
                .concatMapMaybe(new Function<Integer, Maybe<Integer>>() {
                    @Override
                    public Maybe<Integer> apply(Integer v) throws Exception {
                        return Maybe.just(v);
                    }
                })
            ;
    }
}


text:
package goConsulRoundRobin

import "time"

type serviceEndpoints struct {
	name      string
	endpoints []string
	index     int
	timeout   <-chan time.Time
}

func (s *serviceEndpoints) refresh() error {
	endpoints, err := getHealthyEndpoints(s.name)
	if err != nil {
		return err
	}

	if s.index > (len(endpoints) - 1) {
		s.index = 0
	}

	s.endpoints = endpoints
	s.timeout = time.After(consulRefreshRate)

	return nil
}

func (s *serviceEndpoints) getAndInc() (endpoint string) {
	endpoint = s.endpoints[s.index]
	s.index = (s.index + 1) % len(s.endpoints)
	return endpoint
}

func (s *serviceEndpoints) timedOut() bool {
	select {
	case <-s.timeout:
		return true
	default:
		return false
	}
}


text:
package com.netflix.genie.client;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.google.common.collect.Lists;
import com.netflix.genie.client.apis.SortAttribute;
import com.netflix.genie.client.apis.SortDirection;
import com.netflix.genie.client.configs.GenieNetworkConfiguration;
import com.netflix.genie.client.exceptions.GenieClientException;
import com.netflix.genie.client.interceptors.ResponseMappingInterceptor;
import com.netflix.genie.common.external.util.GenieObjectMapper;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import org.apache.commons.lang3.StringUtils;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.jackson.JacksonConverterFactory;

import javax.annotation.Nullable;
import javax.validation.constraints.NotBlank;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * Utility methods for the Genie client.
 *
 * @author tgianos
 * @since 4.0.0
 */
final class GenieClientUtils {

    static final String LOCATION_HEADER = "location";
    private static final String SLASH = "/";

    /**
     * Utility class doesn't need a public constructor.
     */
    private GenieClientUtils() {
    }

    /**
     * Get a {@link Retrofit} instance given the parameters.
     *
     * @param url                       The url of the Genie Service.
     * @param interceptors              All desired interceptors for the client to be created
     * @param genieNetworkConfiguration A configuration object that provides network settings for HTTP calls.
     * @return A {@link Retrofit} instance configured with the given information
     * @throws GenieClientException If there is any problem creating the constructor
     */
    static Retrofit createRetrofitInstance(
        @NotBlank final String url,
        @Nullable final List<Interceptor> interceptors,
        @Nullable final GenieNetworkConfiguration genieNetworkConfiguration
    ) throws GenieClientException {
        if (StringUtils.isBlank(url)) {
            throw new GenieClientException("Service URL cannot be empty or null");
        }

        final OkHttpClient.Builder builder = new OkHttpClient.Builder();

        if (genieNetworkConfiguration != null) {
            if (genieNetworkConfiguration.getConnectTimeout() != GenieNetworkConfiguration.DEFAULT_TIMEOUT) {
                builder.connectTimeout(genieNetworkConfiguration.getConnectTimeout(), TimeUnit.MILLISECONDS);
            }

            if (genieNetworkConfiguration.getReadTimeout() != GenieNetworkConfiguration.DEFAULT_TIMEOUT) {
                builder.readTimeout(genieNetworkConfiguration.getReadTimeout(), TimeUnit.MILLISECONDS);
            }

            if (genieNetworkConfiguration.getWriteTimeout() != GenieNetworkConfiguration.DEFAULT_TIMEOUT) {
                builder.writeTimeout(genieNetworkConfiguration.getWriteTimeout(), TimeUnit.MILLISECONDS);
            }

            builder.retryOnConnectionFailure(genieNetworkConfiguration.isRetryOnConnectionFailure());
        }

        // Add the interceptor to map the retrofit response code to corresponding Genie Exceptions in case of
        // 4xx and 5xx errors.
        builder.addInterceptor(new ResponseMappingInterceptor());
        if (interceptors != null) {
            interceptors.forEach(builder::addInterceptor);
        }

        return new Retrofit
            .Builder()
            .baseUrl(url)
            .addConverterFactory(JacksonConverterFactory.create(GenieObjectMapper.getMapper()))
            .client(builder.build())
            .build();
    }

    /**
     * Bind JSON to a Java POJO.
     *
     * @param node  The JSON to convert
     * @param clazz The clazz to bind to
     * @param <T>   The type of the POJO returned
     * @return An instance of {@code T}
     * @throws IOException If the JSON can't bind
     */
    static <T> T treeToValue(final JsonNode node, final Class<T> clazz) throws IOException {
        return GenieObjectMapper.getMapper().treeToValue(node, clazz);
    }

    /**
     * Helper method to parse the id out of the location string in the Header.
     *
     * @param location The location string in the header.
     * @return The id of the entity embedded in the location.
     */
    static String getIdFromLocation(final String location) {
        return location.substring(location.lastIndexOf(SLASH) + 1);
    }

    /**
     * Given a response from a Genie search API parse the results from the list.
     *
     * @param response        The response JSON from the server
     * @param searchResultKey The JSON key the search result list is expected to exist under
     * @param clazz           The expected response type to bind to
     * @param <T>             The type of POJO to bind to
     * @return A {@link List} of {@literal T} or empty if no results
     * @throws IOException          On error reading the body
     * @throws GenieClientException On unsuccessful query
     */
    static <T> List<T> parseSearchResultsResponse(
        final Response<JsonNode> response,
        final String searchResultKey,
        final Class<T> clazz
    ) throws IOException {
        if (!response.isSuccessful()) {
            throw new GenieClientException(
                "Search failed due to "
                    + (response.errorBody() == null ? response.message() : response.errorBody().toString())
            );
        }

        // Request returned some 2xx
        final JsonNode body = response.body();
        if (body == null || body.getNodeType() != JsonNodeType.OBJECT) {
            return Lists.newArrayList();
        }
        final JsonNode embedded = body.get("_embedded");
        if (embedded == null || embedded.getNodeType() != JsonNodeType.OBJECT) {
            // Kind of an invalid response? Could return error or just swallow?
            return Lists.newArrayList();
        }
        final JsonNode searchResultsJson = embedded.get(searchResultKey);
        if (searchResultsJson == null || searchResultsJson.getNodeType() != JsonNodeType.ARRAY) {
            return Lists.newArrayList();
        }

        final List<T> searchList = new ArrayList<>();
        for (final JsonNode searchResultJson : searchResultsJson) {
            final T searchResult = GenieClientUtils.treeToValue(searchResultJson, clazz);
            searchList.add(searchResult);
        }
        return searchList;
    }

    @Nullable
    public static String getSortParameter(
        @Nullable final SortAttribute sortAttribute,
        @Nullable final SortDirection sortDirection
    ) {
        if (sortAttribute != null || sortDirection != null) {
            return ""
                + StringUtils.lowerCase((sortAttribute != null ? sortAttribute : SortAttribute.DEFAULT).name())
                + ","
                + (sortDirection != null ? sortDirection : SortDirection.DEFAULT);
        } else {
            return null;
        }
    }
}


text:
title: Microsoft Technology Center Tour
author: Eric Tendian
layout: post
category: home
permalink: /event/microsoft-technology-center-tour/
---

IEEE Illinois Tech Chapter is organizing the Microsoft Technology Center Tour on Friday October 11th from 2PM-3PM. We will be leaving from in front of Siegel Hall at 1:15 PM and will travel by train. Please bring your U-Pass. Also, a $10 deposit is required to sign up. This deposit will be refunded to you upon return from the tour. The deadline to sign up is Thursday Oct 10th at 11AM.


text:
=begin

  Copyright (c) 2009 Infosoft Global Private Limited

=end
module Fusioncharts::Exporter::Generator
  # PDF Generator, requires zlib
  class PDFGenerator
    require 'zlib'

 #    attr :image_data
 #    attr :width
 #    attr :height
 #    attr :bgcolor
 #    attr :compress
=begin
  Instance Methods
=end
    # Initializes the image_data, width, height and bgcolor
    def initialize(image_data,width,height,bgcolor)
     # @image_data=image_data
     # @width=width
     # @height=height
     # @bgcolor=bgcolor
      @pages_data=[]
      @pageIndex=0
      if(image_data!=nil and width!=nil and height!=nil)
        set_bitmap_data(image_data, width, height, bgcolor)
      else
        # raise error
      end
    end

    # Sets the bitmap data.
    def set_bitmap_data(imageData_FCFormat, width, height, bgcolor="ffffff")
      @pages_data[@pageIndex]= {:width=>width,:height=>height,:bgcolor=>bgcolor,:image_data=>imageData_FCFormat}
      @pageIndex = @pageIndex+1
		end

    # Gets the PDF objects
    def get_pdf_objects(compress=true)
      @compress = compress
       pdf_bytes =""
       #Store all PDF objects in this temporary string to be written to ByteArray
       str_tmp_obj=""
       xref_list=[]
       xref_index =0
       #start xref array
		   xref_list[xref_index]="xref\n0 "
       xref_index+=xref_index

		   xref_list[xref_index]="0000000000 65535 f \n" #Address Refenrece to obj 0
		   xref_index+=xref_index

      #Build PDF objects sequentially
      #version and header
      str_tmp_obj="%PDF-1.3\n%{FC}\n"
      pdf_bytes+=str_tmp_obj

      #OBJECT 1 : info (optional)
      str_tmp_obj="1 0 obj<<\n/Author (FusionCharts)\n/Title (FusionCharts)\n/Creator (FusionCharts)\n>>\nendobj\n"
      xref_list[xref_index]=calculate_xpos(pdf_bytes.length) #refenrece to obj 1
      xref_index+=xref_index
      pdf_bytes+=str_tmp_obj

      #OBJECT 2 : Starts with Pages Catalogue
      str_tmp_obj="2 0 obj\n<< /Type /Catalog /Pages 3 0 R >>\nendobj\n"
      xref_list[xref_index]=calculate_xpos(pdf_bytes.length) #refenrece to obj 2
      xref_index+=xref_index
      pdf_bytes+=str_tmp_obj

      #OBJECT 3 : Page Tree (reference to pages of the catalogue)
      str_tmp_obj="3 0 obj\n<<  /Type /Pages /Kids ["
      0.upto(@pageIndex-1)  do|i|
        str_tmp_obj+=(((i+1)*3)+1).to_s+" 0 R\n"
      end
      str_tmp_obj+="] /Count "+@pageIndex.to_s+" >>\nendobj\n"

      xref_list[xref_index]=calculate_xpos(pdf_bytes.length) #refenrece to obj 3
      xref_index+=xref_index
      pdf_bytes+=str_tmp_obj

      0.upto(@pageIndex-1) do|itr|
        width=@pages_data[itr][:width].to_s
        height=@pages_data[itr][:height].to_s

        #OBJECT 4..7..10..n : Page config
        str_tmp_obj=(((itr+2)*3)-2).to_s+" 0 obj\n<<\n/Type /Page /Parent 3 0 R \n/MediaBox [ 0 0 "+width+" "+height+" ]\n/Resources <<\n/ProcSet [ /PDF ]\n/XObject <</R"+(itr+1).to_s+" "+((itr+2)*3).to_s+" 0 R>>\n>>\n/Contents [ "+(((itr+2)*3)-1).to_s+" 0 R ]\n>>\nendobj\n"
        xref_list[xref_index]=calculate_xpos(pdf_bytes.length) #refenrece to obj 4,7,10,13,16...
        xref_index+=xref_index
        pdf_bytes+=str_tmp_obj

        #OBJECT 5...8...11...n : Page resource object (xobject resource that transforms the image)
        xref_list[xref_index]=calculate_xpos(pdf_bytes.length)  #refenrece to obj 5,8,11,14,17...
        xref_index+=xref_index
        pdf_bytes+=get_xobj_resource(itr);

        #OBJECT 6...9...12...n : Binary xobject of the page (image)
        img_BA=add_image_to_pdf(itr,@compress)
        xref_list[xref_index]=calculate_xpos(pdf_bytes.length)  #refenrece to obj 6,9,12,15,18...
        xref_index+=xref_index
        pdf_bytes+=img_BA
    end

    #xrefs	compilation
		xref_list[0]+=(xref_list.length-1).to_s+"\n"

		#get trailer
		trailer=get_trailer(pdf_bytes.length ,xref_list.length-1)

		#write xref and trailer to PDF
		pdf_bytes+=xref_list.to_s
		pdf_bytes+=trailer

		#write EOF
		pdf_bytes+="%%EOF\n"

		return pdf_bytes
  end

  # Returns the X obj ref
  def get_xobj_resource(itr)
    width=@pages_data[itr][:width].to_s
    height=@pages_data[itr][:height].to_s
    str_len_w_h= ((width+height).length)
    return (((itr+2)*3)-1).to_s+" 0 obj\n<< /Length "+(24+str_len_w_h).to_s+" >>\nstream\nq\n"+width+" 0 0 "+height+" 0 0 cm\n/R"+(itr+1).to_s+" Do\nQ\nendstream\nendobj\n"
  end

  # Calculations XPos
  def calculate_xpos(posn)
		return (posn.to_s.rjust(10,'0'))+" 00000 n \n"
	end

  # Returns the Trailer
  def get_trailer(xref_position,num_xref=7)
      return "trailer\n<<\n/Size "+num_xref.to_s+"\n/Root 2 0 R\n/Info 1 0 R\n>>\nstartxref\n"+xref_position.to_s+"\n"
  end

  # Adds the image to PDF
  def add_image_to_pdf(id=0, compress=true)
    @compress=compress
    bitmap_data = get_bitmap_data_24

    #PDF Object number
    img_obj_no= 6 + id*3

		#Get chart Image binary
		bitmap_data=get_bitmap_data_24(id)
		#Compress image binary
    if(@compress)
      begin
        cl = Zlib::Deflate
      rescue Exception
          raise NameError
      end
      image_binary = Zlib::Deflate.deflate(bitmap_data,9)
      compress_str = "/Filter /FlateDecode "
    else
      image_binary=bitmap_data
      compress_str = ""
    end

		#get the length of the image binary
    len = image_binary.length

    width=@pages_data[id][:width].to_s
    height=@pages_data[id][:height].to_s

		#Build PDF object containing the image binary and other formats required
      pdf_image_str = img_obj_no.to_s+" 0 obj\n<<\n/Subtype /Image /ColorSpace /DeviceRGB /BitsPerComponent 8  /HDPI 72 /VDPI 72 "+ compress_str
      pdf_image_str+= "/Width "+width+" /Height "+height+" /Length "
      pdf_image_str+= len.to_s+" >>\nstream\n"
      pdf_image_str+= image_binary+"endstream\nendobj\n"
	   return pdf_image_str
  end

  # Gets the BITMAP 24 Data
  def get_bitmap_data_24(id=0)
    image_data_24 =""
    rows = @pages_data[id][:image_data].split(";")
    rows.each do |row|
        pixels = row.split(",")
        pixels.each do |pixel|
          pixels_rgb=""
          c,repeat = pixel.split("_")
          if c.length <= 0
            c=@pages_data[id][:bgcolor]
          end
          # if length of the color is less than 6 then pad zeroes
          c="#{c.rjust(6,'0')}"

          r = c[0,2].to_i(16)
          g= c[2,2].to_i(16)
          b=c[4,2].to_i(16)

          #print "R="+r.to_s
          #print "G="+g.to_s
          #print "B="+b.to_s

          rgbArr = [r,g,b]
          rgb = rgbArr.pack("c3")

          (repeat.to_i).times {pixels_rgb << rgb.to_s}

          image_data_24 << pixels_rgb
        end # end of pixels.each
      end# end of rows.each
      return image_data_24
    end #end of function
  end
  # RMagick version of Image generator
  class ImageGenerator
    require 'RMagick'

=begin
  Instance Methods
=end
      # Initializes with image_data, width, height, bgcolor and format of image
      def initialize(image_data,width,height,bgcolor,format)
        @image_data=image_data
        @width=width
        @height=height
        @bgcolor=bgcolor
        @format=format
      end

      # Returns the BLOB
      def get_image_blob
        image = get_image
        return image.to_blob
      end
      # Creates the image
      def get_image
        begin
          cl1 = Magick
          cl2=Magick::Image.new(10,10)
          cl3=Magick::Draw.new
        rescue Exception =>e
          raise NameError
        end
        if @bgcolor.nil?
          bgcolor="white"
        else
          bgcolor="#"+@bgcolor
        end

        img = Magick::Image.new(@width, @height) {self.background_color = bgcolor}
        img.format=@format
        rows = @image_data.split(";")
        y=0
        draw = Magick::Draw.new
        rows.each do |row|
            ### Reset the count for each new row
            ri = 0
            pixels = row.split(",")
            pixels.each do |pixel|
              c,r = pixel.split("_")
              if c.length > 0
                  mycolor = "#"+"#{c.rjust(6,'0')}"
                  x=ri
                  draw.fill(mycolor)
                  draw.line(x.to_s,y.to_s,(x-1+r.to_i).to_s,y.to_s)
               end #End of if c.length>0
                ri = ri + r.to_i
            end  # End of inner do|pixel|
              y+=1
        end # End of outer do|row|
        draw.draw(img)
        img.format=@format
        return img
      end # End of function get_image
  end # End of class
end #end of module


text:
var request = require('supertest'),
    expect  = require('expect.js'),
    express = require('express');

var app = require('../../app.js');

var mongoose = require('mongoose'),
    Application = mongoose.model('Application');
    User = mongoose.model('User');

describe('Receipt Controller', function(){

    beforeEach(function(done){
        application = new Application({name: "appForTest", secret: "Secret123", active: true, send: {limit: 2000, count: 0}});
        application.save(function(err){
          done();
        });
      });

      afterEach(function(done){
        Application.collection.remove(function(err){
          done();
        });

        Message.collection.remove(function(err){
        });
      });

    var data = {
      "appName": "appForTest",
      "token": "random token123",
      "sender":{
        "name": "sender1",
        "id": "1"
      },
      "message": "this is sample message",
      "messageStatus":[
        {"phonenumber": "+9188556678", "reference": "abc123"},
        {"phonenumber": "+9100056678", "reference": "def456"},
        {"phonenumber": "+9100056679", "reference": "hij789"}
      ]
    };

    var statusUpdateData = {
        "Reference" : "hij789",
        "Status" : "Delivered",
    };

    var missingStatusUpdateData = {
        "Reference" : "hij789",
        "Status" : "",
    };

    var missingReferenceUpdateData = {
            "Reference" : "",
            "Status" : "Delivered",
        };

    var invalidReferenceStatusUpdateData = {
        "Reference" : "blah",
        "Status" : "Delivered",
    };

    it('update the message status when a delivery update is received with a valid reference',function(done){
         var msg = new Message(data);
         msg.save(function(err,m){
            expect(err).to.be(null);

            request(app)
            .post('/receipt')
            .send(statusUpdateData)
            .expect(200)
            .end(function(err, res){
                if (err) return done(err);
                expect("Success",done());
            });
         });
    });

    it('should not update the message status when an invalid delivery update is received with a valid reference',function(done){
             var msg = new Message(data);
             msg.save(function(err,m){
                expect(err).to.be(null);

                request(app)
                .post('/receipt')
                .send(missingStatusUpdateData)
                .expect(400)
                .end(function(err, res){
                    if (err) return done(err);
                    expect("Fail",done());
                });
             });
    });

    it('should not update the message status when an in valid delivery update is received with missing reference',function(done){
                 var msg = new Message(data);
                 msg.save(function(err,m){
                    expect(err).to.be(null);

                    request(app)
                    .post('/receipt')
                    .send(missingReferenceUpdateData)
                    .expect(400)
                    .end(function(err, res){
                        if (err) return done(err);
                        expect("Fail",done());
                    });
                 });
        });
});


text:
package com.adobe.aem.utilities.hotfix.installer.jaxb.packages.object;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="request">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence>
 *                   <element name="param">
 *                     <complexType>
 *                       <complexContent>
 *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                           <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
 *                           <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}string" />
 *                         </restriction>
 *                       </complexContent>
 *                     </complexType>
 *                   </element>
 *                 </sequence>
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="response">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence>
 *                   <element name="data">
 *                     <complexType>
 *                       <complexContent>
 *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                           <sequence>
 *                             <element name="packages">
 *                               <complexType>
 *                                 <complexContent>
 *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                                     <sequence>
 *                                       <element name="package" maxOccurs="unbounded">
 *                                         <complexType>
 *                                           <complexContent>
 *                                             <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                                               <sequence>
 *                                                 <element name="group" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *                                                 <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *                                                 <element name="version" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *                                                 <element name="downloadName" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *                                                 <element name="size" type="{http://www.w3.org/2001/XMLSchema}int"/>
 *                                                 <element name="created" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *                                                 <element name="createdBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *                                                 <element name="lastModified" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *                                                 <element name="lastModifiedBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *                                                 <element name="lastUnpacked" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *                                                 <element name="lastUnpackedBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *                                               </sequence>
 *                                             </restriction>
 *                                           </complexContent>
 *                                         </complexType>
 *                                       </element>
 *                                     </sequence>
 *                                   </restriction>
 *                                 </complexContent>
 *                               </complexType>
 *                             </element>
 *                           </sequence>
 *                         </restriction>
 *                       </complexContent>
 *                     </complexType>
 *                   </element>
 *                   <element name="status">
 *                     <complexType>
 *                       <complexContent>
 *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                           <attribute name="code" type="{http://www.w3.org/2001/XMLSchema}int" />
 *                         </restriction>
 *                       </complexContent>
 *                     </complexType>
 *                   </element>
 *                 </sequence>
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *       </sequence>
 *       <attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="user" type="{http://www.w3.org/2001/XMLSchema}string" />
 *       <attribute name="workspace" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "request",
    "response"
})
@XmlRootElement(name = "crx")
public class Crx {

    @XmlElement(required = true)
    protected Crx.Request request;
    @XmlElement(required = true)
    protected Crx.Response response;
    @XmlAttribute(name = "version")
    protected String version;
    @XmlAttribute(name = "user")
    protected String user;
    @XmlAttribute(name = "workspace")
    protected String workspace;

    /**
     * Gets the value of the request property.
     *
     * @return
     *     possible object is
     *     {@link Crx.Request }
     *
     */
    public Crx.Request getRequest() {
        return request;
    }

    /**
     * Sets the value of the request property.
     *
     * @param value
     *     allowed object is
     *     {@link Crx.Request }
     *
     */
    public void setRequest(Crx.Request value) {
        this.request = value;
    }

    /**
     * Gets the value of the response property.
     *
     * @return
     *     possible object is
     *     {@link Crx.Response }
     *
     */
    public Crx.Response getResponse() {
        return response;
    }

    /**
     * Sets the value of the response property.
     *
     * @param value
     *     allowed object is
     *     {@link Crx.Response }
     *
     */
    public void setResponse(Crx.Response value) {
        this.response = value;
    }

    /**
     * Gets the value of the version property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getVersion() {
        return version;
    }

    /**
     * Sets the value of the version property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setVersion(String value) {
        this.version = value;
    }

    /**
     * Gets the value of the user property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUser() {
        return user;
    }

    /**
     * Sets the value of the user property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUser(String value) {
        this.user = value;
    }

    /**
     * Gets the value of the workspace property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getWorkspace() {
        return workspace;
    }

    /**
     * Sets the value of the workspace property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setWorkspace(String value) {
        this.workspace = value;
    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence>
     *         <element name="param">
     *           <complexType>
     *             <complexContent>
     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *                 <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
     *                 <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}string" />
     *               </restriction>
     *             </complexContent>
     *           </complexType>
     *         </element>
     *       </sequence>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "param"
    })
    public static class Request {

        @XmlElement(required = true)
        protected Crx.Request.Param param;

        /**
         * Gets the value of the param property.
         *
         * @return
         *     possible object is
         *     {@link Crx.Request.Param }
         *
         */
        public Crx.Request.Param getParam() {
            return param;
        }

        /**
         * Sets the value of the param property.
         *
         * @param value
         *     allowed object is
         *     {@link Crx.Request.Param }
         *
         */
        public void setParam(Crx.Request.Param value) {
            this.param = value;
        }

        /**
         *
Java class for anonymous complex type.
         *
         *
The following schema fragment specifies the expected content contained within this class.
         *
         *

         * <complexType>
         *   <complexContent>
         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
         *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
         *       <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}string" />
         *     </restriction>
         *   </complexContent>
         * </complexType>
         *

         *
         *
         */
        @XmlAccessorType(XmlAccessType.FIELD)
        @XmlType(name = "")
        public static class Param {

            @XmlAttribute(name = "name")
            protected String name;
            @XmlAttribute(name = "value")
            protected String value;

            /**
             * Gets the value of the name property.
             *
             * @return
             *     possible object is
             *     {@link String }
             *
             */
            public String getName() {
                return name;
            }

            /**
             * Sets the value of the name property.
             *
             * @param value
             *     allowed object is
             *     {@link String }
             *
             */
            public void setName(String value) {
                this.name = value;
            }

            /**
             * Gets the value of the value property.
             *
             * @return
             *     possible object is
             *     {@link String }
             *
             */
            public String getValue() {
                return value;
            }

            /**
             * Sets the value of the value property.
             *
             * @param value
             *     allowed object is
             *     {@link String }
             *
             */
            public void setValue(String value) {
                this.value = value;
            }

        }

    }

    /**
     *
Java class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence>
     *         <element name="data">
     *           <complexType>
     *             <complexContent>
     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *                 <sequence>
     *                   <element name="packages">
     *                     <complexType>
     *                       <complexContent>
     *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *                           <sequence>
     *                             <element name="package" maxOccurs="unbounded">
     *                               <complexType>
     *                                 <complexContent>
     *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *                                     <sequence>
     *                                       <element name="group" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *                                       <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *                                       <element name="version" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *                                       <element name="downloadName" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *                                       <element name="size" type="{http://www.w3.org/2001/XMLSchema}int"/>
     *                                       <element name="created" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *                                       <element name="createdBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *                                       <element name="lastModified" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *                                       <element name="lastModifiedBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *                                       <element name="lastUnpacked" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *                                       <element name="lastUnpackedBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
     *                                     </sequence>
     *                                   </restriction>
     *                                 </complexContent>
     *                               </complexType>
     *                             </element>
     *                           </sequence>
     *                         </restriction>
     *                       </complexContent>
     *                     </complexType>
     *                   </element>
     *                 </sequence>
     *               </restriction>
     *             </complexContent>
     *           </complexType>
     *         </element>
     *         <element name="status">
     *           <complexType>
     *             <complexContent>
     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *                 <attribute name="code" type="{http://www.w3.org/2001/XMLSchema}int" />
     *               </restriction>
     *             </complexContent>
     *           </complexType>
     *         </element>
     *       </sequence>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "data",
        "status"
    })
    public static class Response {

        @XmlElement(required = true)
        protected Crx.Response.Data data;
        @XmlElement(required = true)
        protected Crx.Response.Status status;

        /**
         * Gets the value of the data property.
         *
         * @return
         *     possible object is
         *     {@link Crx.Response.Data }
         *
         */
        public Crx.Response.Data getData() {
            return data;
        }

        /**
         * Sets the value of the data property.
         *
         * @param value
         *     allowed object is
         *     {@link Crx.Response.Data }
         *
         */
        public void setData(Crx.Response.Data value) {
            this.data = value;
        }

        /**
         * Gets the value of the status property.
         *
         * @return
         *     possible object is
         *     {@link Crx.Response.Status }
         *
         */
        public Crx.Response.Status getStatus() {
            return status;
        }

        /**
         * Sets the value of the status property.
         *
         * @param value
         *     allowed object is
         *     {@link Crx.Response.Status }
         *
         */
        public void setStatus(Crx.Response.Status value) {
            this.status = value;
        }

        /**
         *
Java class for anonymous complex type.
         *
         *
The following schema fragment specifies the expected content contained within this class.
         *
         *

         * <complexType>
         *   <complexContent>
         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
         *       <sequence>
         *         <element name="packages">
         *           <complexType>
         *             <complexContent>
         *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
         *                 <sequence>
         *                   <element name="package" maxOccurs="unbounded">
         *                     <complexType>
         *                       <complexContent>
         *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
         *                           <sequence>
         *                             <element name="group" type="{http://www.w3.org/2001/XMLSchema}string"/>
         *                             <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
         *                             <element name="version" type="{http://www.w3.org/2001/XMLSchema}string"/>
         *                             <element name="downloadName" type="{http://www.w3.org/2001/XMLSchema}string"/>
         *                             <element name="size" type="{http://www.w3.org/2001/XMLSchema}int"/>
         *                             <element name="created" type="{http://www.w3.org/2001/XMLSchema}string"/>
         *                             <element name="createdBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
         *                             <element name="lastModified" type="{http://www.w3.org/2001/XMLSchema}string"/>
         *                             <element name="lastModifiedBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
         *                             <element name="lastUnpacked" type="{http://www.w3.org/2001/XMLSchema}string"/>
         *                             <element name="lastUnpackedBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
         *                           </sequence>
         *                         </restriction>
         *                       </complexContent>
         *                     </complexType>
         *                   </element>
         *                 </sequence>
         *               </restriction>
         *             </complexContent>
         *           </complexType>
         *         </element>
         *       </sequence>
         *     </restriction>
         *   </complexContent>
         * </complexType>
         *

         *
         *
         */
        @XmlAccessorType(XmlAccessType.FIELD)
        @XmlType(name = "", propOrder = {
            "packages"
        })
        public static class Data {

            @XmlElement(required = true)
            protected Crx.Response.Data.Packages packages;

            /**
             * Gets the value of the packages property.
             *
             * @return
             *     possible object is
             *     {@link Crx.Response.Data.Packages }
             *
             */
            public Crx.Response.Data.Packages getPackages() {
                return packages;
            }

            /**
             * Sets the value of the packages property.
             *
             * @param value
             *     allowed object is
             *     {@link Crx.Response.Data.Packages }
             *
             */
            public void setPackages(Crx.Response.Data.Packages value) {
                this.packages = value;
            }

            /**
             *
Java class for anonymous complex type.
             *
             *
The following schema fragment specifies the expected content contained within this class.
             *
             *

             * <complexType>
             *   <complexContent>
             *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
             *       <sequence>
             *         <element name="package" maxOccurs="unbounded">
             *           <complexType>
             *             <complexContent>
             *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
             *                 <sequence>
             *                   <element name="group" type="{http://www.w3.org/2001/XMLSchema}string"/>
             *                   <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
             *                   <element name="version" type="{http://www.w3.org/2001/XMLSchema}string"/>
             *                   <element name="downloadName" type="{http://www.w3.org/2001/XMLSchema}string"/>
             *                   <element name="size" type="{http://www.w3.org/2001/XMLSchema}int"/>
             *                   <element name="created" type="{http://www.w3.org/2001/XMLSchema}string"/>
             *                   <element name="createdBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
             *                   <element name="lastModified" type="{http://www.w3.org/2001/XMLSchema}string"/>
             *                   <element name="lastModifiedBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
             *                   <element name="lastUnpacked" type="{http://www.w3.org/2001/XMLSchema}string"/>
             *                   <element name="lastUnpackedBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
             *                 </sequence>
             *               </restriction>
             *             </complexContent>
             *           </complexType>
             *         </element>
             *       </sequence>
             *     </restriction>
             *   </complexContent>
             * </complexType>
             *

             *
             *
             */
            @XmlAccessorType(XmlAccessType.FIELD)
            @XmlType(name = "", propOrder = {
                "_package"
            })
            public static class Packages {

                @XmlElement(name = "package", required = true)
                protected List<Crx.Response.Data.Packages.Package> _package;

                /**
                 * Gets the value of the package property.
                 *
                 *

                 * This accessor method returns a reference to the live list,
                 * not a snapshot. Therefore any modification you make to the
                 * returned list will be present inside the JAXB object.
                 * This is why there is not a set method for the package property.
                 *
                 *

                 * For example, to add a new item, do as follows:
                 *

                 *    getPackage().add(newItem);
                 *

                 *
                 *
                 *

                 * Objects of the following type(s) are allowed in the list
                 * {@link Crx.Response.Data.Packages.Package }
                 *
                 *
                 */
                public List<Crx.Response.Data.Packages.Package> getPackage() {
                    if (_package == null) {
                        _package = new ArrayList<Crx.Response.Data.Packages.Package>();
                    }
                    return this._package;
                }

                /**
                 *
Java class for anonymous complex type.
                 *
                 *
The following schema fragment specifies the expected content contained within this class.
                 *
                 *

                 * <complexType>
                 *   <complexContent>
                 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
                 *       <sequence>
                 *         <element name="group" type="{http://www.w3.org/2001/XMLSchema}string"/>
                 *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
                 *         <element name="version" type="{http://www.w3.org/2001/XMLSchema}string"/>
                 *         <element name="downloadName" type="{http://www.w3.org/2001/XMLSchema}string"/>
                 *         <element name="size" type="{http://www.w3.org/2001/XMLSchema}int"/>
                 *         <element name="created" type="{http://www.w3.org/2001/XMLSchema}string"/>
                 *         <element name="createdBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
                 *         <element name="lastModified" type="{http://www.w3.org/2001/XMLSchema}string"/>
                 *         <element name="lastModifiedBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
                 *         <element name="lastUnpacked" type="{http://www.w3.org/2001/XMLSchema}string"/>
                 *         <element name="lastUnpackedBy" type="{http://www.w3.org/2001/XMLSchema}string"/>
                 *       </sequence>
                 *     </restriction>
                 *   </complexContent>
                 * </complexType>
                 *

                 *
                 *
                 */
                @XmlAccessorType(XmlAccessType.FIELD)
                @XmlType(name = "", propOrder = {
                    "group",
                    "name",
                    "version",
                    "downloadName",
                    "size",
                    "created",
                    "createdBy",
                    "lastModified",
                    "lastModifiedBy",
                    "lastUnpacked",
                    "lastUnpackedBy"
                })
                public static class Package {

                    @XmlElement(required = true)
                    protected String group;
                    @XmlElement(required = true)
                    protected String name;
                    @XmlElement(required = true)
                    protected String version;
                    @XmlElement(required = true)
                    protected String downloadName;
                    protected int size;
                    @XmlElement(required = true)
                    protected String created;
                    @XmlElement(required = true)
                    protected String createdBy;
                    @XmlElement(required = true)
                    protected String lastModified;
                    @XmlElement(required = true)
                    protected String lastModifiedBy;
                    @XmlElement(required = true)
                    protected String lastUnpacked;
                    @XmlElement(required = true)
                    protected String lastUnpackedBy;

                    /**
                     * Gets the value of the group property.
                     *
                     * @return
                     *     possible object is
                     *     {@link String }
                     *
                     */
                    public String getGroup() {
                        return group;
                    }

                    /**
                     * Sets the value of the group property.
                     *
                     * @param value
                     *     allowed object is
                     *     {@link String }
                     *
                     */
                    public void setGroup(String value) {
                        this.group = value;
                    }

                    /**
                     * Gets the value of the name property.
                     *
                     * @return
                     *     possible object is
                     *     {@link String }
                     *
                     */
                    public String getName() {
                        return name;
                    }

                    /**
                     * Sets the value of the name property.
                     *
                     * @param value
                     *     allowed object is
                     *     {@link String }
                     *
                     */
                    public void setName(String value) {
                        this.name = value;
                    }

                    /**
                     * Gets the value of the version property.
                     *
                     * @return
                     *     possible object is
                     *     {@link String }
                     *
                     */
                    public String getVersion() {
                        return version;
                    }

                    /**
                     * Sets the value of the version property.
                     *
                     * @param value
                     *     allowed object is
                     *     {@link String }
                     *
                     */
                    public void setVersion(String value) {
                        this.version = value;
                    }

                    /**
                     * Gets the value of the downloadName property.
                     *
                     * @return
                     *     possible object is
                     *     {@link String }
                     *
                     */
                    public String getDownloadName() {
                        return downloadName;
                    }

                    /**
                     * Sets the value of the downloadName property.
                     *
                     * @param value
                     *     allowed object is
                     *     {@link String }
                     *
                     */
                    public void setDownloadName(String value) {
                        this.downloadName = value;
                    }

                    /**
                     * Gets the value of the size property.
                     *
                     */
                    public int getSize() {
                        return size;
                    }

                    /**
                     * Sets the value of the size property.
                     *
                     */
                    public void setSize(int value) {
                        this.size = value;
                    }

                    /**
                     * Gets the value of the created property.
                     *
                     * @return
                     *     possible object is
                     *     {@link String }
                     *
                     */
                    public String getCreated() {
                        return created;
                    }

                    /**
                     * Sets the value of the created property.
                     *
                     * @param value
                     *     allowed object is
                     *     {@link String }
                     *
                     */
                    public void setCreated(String value) {
                        this.created = value;
                    }

                    /**
                     * Gets the value of the createdBy property.
                     *
                     * @return
                     *     possible object is
                     *     {@link String }
                     *
                     */
                    public String getCreatedBy() {
                        return createdBy;
                    }

                    /**
                     * Sets the value of the createdBy property.
                     *
                     * @param value
                     *     allowed object is
                     *     {@link String }
                     *
                     */
                    public void setCreatedBy(String value) {
                        this.createdBy = value;
                    }

                    /**
                     * Gets the value of the lastModified property.
                     *
                     * @return
                     *     possible object is
                     *     {@link String }
                     *
                     */
                    public String getLastModified() {
                        return lastModified;
                    }

                    /**
                     * Sets the value of the lastModified property.
                     *
                     * @param value
                     *     allowed object is
                     *     {@link String }
                     *
                     */
                    public void setLastModified(String value) {
                        this.lastModified = value;
                    }

                    /**
                     * Gets the value of the lastModifiedBy property.
                     *
                     * @return
                     *     possible object is
                     *     {@link String }
                     *
                     */
                    public String getLastModifiedBy() {
                        return lastModifiedBy;
                    }

                    /**
                     * Sets the value of the lastModifiedBy property.
                     *
                     * @param value
                     *     allowed object is
                     *     {@link String }
                     *
                     */
                    public void setLastModifiedBy(String value) {
                        this.lastModifiedBy = value;
                    }

                    /**
                     * Gets the value of the lastUnpacked property.
                     *
                     * @return
                     *     possible object is
                     *     {@link String }
                     *
                     */
                    public String getLastUnpacked() {
                        return lastUnpacked;
                    }

                    /**
                     * Sets the value of the lastUnpacked property.
                     *
                     * @param value
                     *     allowed object is
                     *     {@link String }
                     *
                     */
                    public void setLastUnpacked(String value) {
                        this.lastUnpacked = value;
                    }

                    /**
                     * Gets the value of the lastUnpackedBy property.
                     *
                     * @return
                     *     possible object is
                     *     {@link String }
                     *
                     */
                    public String getLastUnpackedBy() {
                        return lastUnpackedBy;
                    }

                    /**
                     * Sets the value of the lastUnpackedBy property.
                     *
                     * @param value
                     *     allowed object is
                     *     {@link String }
                     *
                     */
                    public void setLastUnpackedBy(String value) {
                        this.lastUnpackedBy = value;
                    }

                }

            }

        }

        /**
         *
Java class for anonymous complex type.
         *
         *
The following schema fragment specifies the expected content contained within this class.
         *
         *

         * <complexType>
         *   <complexContent>
         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
         *       <attribute name="code" type="{http://www.w3.org/2001/XMLSchema}int" />
         *     </restriction>
         *   </complexContent>
         * </complexType>
         *

         *
         *
         */
        @XmlAccessorType(XmlAccessType.FIELD)
        @XmlType(name = "")
        public static class Status {

            @XmlAttribute(name = "code")
            protected Integer code;

            /**
             * Gets the value of the code property.
             *
             * @return
             *     possible object is
             *     {@link Integer }
             *
             */
            public Integer getCode() {
                return code;
            }

            /**
             * Sets the value of the code property.
             *
             * @param value
             *     allowed object is
             *     {@link Integer }
             *
             */
            public void setCode(Integer value) {
                this.code = value;
            }

        }

    }

}


text:
<?xml version="1.0"?>

<iati-activities version="xx">
  <iati-activity> <!-- at least 1 -->
    <iati-identifier></iati-identifier>  <!-- 1 and only 1-->
    <reporting-org type="xx" ref="xx"><narrative>Organisation name</narrative></reporting-org> <!-- 1 and only 1-->
    <title> <!-- 1 and only 1-->
      <narrative>Xxxxxxx</narrative> <!-- At least 1-->
    </title>
    <description>
      <narrative>Xxxxxxx</narrative> <!-- At least 1-->
    </description>
    <participating-org role="xx"></participating-org> <!-- At least 1-->
    <!--<other-identifier></other-identifier>-->
    <activity-status code="xx"/> <!-- 1 and only 1-->
    <activity-date type="xx" iso-date="2013-11-27"/><!-- At least 1 --> <!--Narative allowed-->

    <conditions attached="0"/>

  </iati-activity>
</iati-activities>