text:
<?php

/**
 * Base static class for performing query and update operations on the 'productphoto' table.
 *
 *
 *
 * @package propel.generator.api.om
 */
abstract class BaseProductphotoPeer
{

    /** the default database name for this class */
    const DATABASE_NAME = 'api';

    /** the table name for this class */
    const TABLE_NAME = 'productphoto';

    /** the related Propel class for this table */
    const OM_CLASS = 'Productphoto';

    /** the related TableMap class for this table */
    const TM_CLASS = 'ProductphotoTableMap';

    /** The total number of columns. */
    const NUM_COLUMNS = 7;

    /** The number of lazy-loaded columns. */
    const NUM_LAZY_LOAD_COLUMNS = 0;

    /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
    const NUM_HYDRATE_COLUMNS = 7;

    /** the column name for the idproductphoto field */
    const IDPRODUCTPHOTO = 'productphoto.idproductphoto';

    /** the column name for the idproduct field */
    const IDPRODUCT = 'productphoto.idproduct';

    /** the column name for the productphoto_url field */
    const PRODUCTPHOTO_URL = 'productphoto.productphoto_url';

    /** the column name for the productphoto_width field */
    const PRODUCTPHOTO_WIDTH = 'productphoto.productphoto_width';

    /** the column name for the productphoto_height field */
    const PRODUCTPHOTO_HEIGHT = 'productphoto.productphoto_height';

    /** the column name for the productphoto_status field */
    const PRODUCTPHOTO_STATUS = 'productphoto.productphoto_status';

    /** the column name for the productphoto_type field */
    const PRODUCTPHOTO_TYPE = 'productphoto.productphoto_type';

    /** The enumerated values for the productphoto_status field */
    const PRODUCTPHOTO_STATUS_PENDING = 'pending';
    const PRODUCTPHOTO_STATUS_REJECTED = 'rejected';
    const PRODUCTPHOTO_STATUS_ACTIVE = 'active';
    const PRODUCTPHOTO_STATUS_REVISION = 'revision';

    /** The enumerated values for the productphoto_type field */
    const PRODUCTPHOTO_TYPE_PRIVATE = 'private';
    const PRODUCTPHOTO_TYPE_PUBLIC = 'public';

    /** The default string format for model objects of the related table **/
    const DEFAULT_STRING_FORMAT = 'YAML';

    /**
     * An identity map to hold any loaded instances of Productphoto objects.
     * This must be public so that other peer classes can access this when hydrating from JOIN
     * queries.
     * @var        array Productphoto[]
     */
    public static $instances = array();

    /**
     * holds an array of fieldnames
     *
     * first dimension keys are the type constants
     * e.g. ProductphotoPeer::$fieldNames[ProductphotoPeer::TYPE_PHPNAME][0] = 'Id'
     */
    protected static $fieldNames = array (
        BasePeer::TYPE_PHPNAME => array ('Idproductphoto', 'Idproduct', 'ProductphotoUrl', 'ProductphotoWidth', 'ProductphotoHeight', 'ProductphotoStatus', 'ProductphotoType', ),
        BasePeer::TYPE_STUDLYPHPNAME => array ('idproductphoto', 'idproduct', 'productphotoUrl', 'productphotoWidth', 'productphotoHeight', 'productphotoStatus', 'productphotoType', ),
        BasePeer::TYPE_COLNAME => array (ProductphotoPeer::IDPRODUCTPHOTO, ProductphotoPeer::IDPRODUCT, ProductphotoPeer::PRODUCTPHOTO_URL, ProductphotoPeer::PRODUCTPHOTO_WIDTH, ProductphotoPeer::PRODUCTPHOTO_HEIGHT, ProductphotoPeer::PRODUCTPHOTO_STATUS, ProductphotoPeer::PRODUCTPHOTO_TYPE, ),
        BasePeer::TYPE_RAW_COLNAME => array ('IDPRODUCTPHOTO', 'IDPRODUCT', 'PRODUCTPHOTO_URL', 'PRODUCTPHOTO_WIDTH', 'PRODUCTPHOTO_HEIGHT', 'PRODUCTPHOTO_STATUS', 'PRODUCTPHOTO_TYPE', ),
        BasePeer::TYPE_FIELDNAME => array ('idproductphoto', 'idproduct', 'productphoto_url', 'productphoto_width', 'productphoto_height', 'productphoto_status', 'productphoto_type', ),
        BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
    );

    /**
     * holds an array of keys for quick access to the fieldnames array
     *
     * first dimension keys are the type constants
     * e.g. ProductphotoPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
     */
    protected static $fieldKeys = array (
        BasePeer::TYPE_PHPNAME => array ('Idproductphoto' => 0, 'Idproduct' => 1, 'ProductphotoUrl' => 2, 'ProductphotoWidth' => 3, 'ProductphotoHeight' => 4, 'ProductphotoStatus' => 5, 'ProductphotoType' => 6, ),
        BasePeer::TYPE_STUDLYPHPNAME => array ('idproductphoto' => 0, 'idproduct' => 1, 'productphotoUrl' => 2, 'productphotoWidth' => 3, 'productphotoHeight' => 4, 'productphotoStatus' => 5, 'productphotoType' => 6, ),
        BasePeer::TYPE_COLNAME => array (ProductphotoPeer::IDPRODUCTPHOTO => 0, ProductphotoPeer::IDPRODUCT => 1, ProductphotoPeer::PRODUCTPHOTO_URL => 2, ProductphotoPeer::PRODUCTPHOTO_WIDTH => 3, ProductphotoPeer::PRODUCTPHOTO_HEIGHT => 4, ProductphotoPeer::PRODUCTPHOTO_STATUS => 5, ProductphotoPeer::PRODUCTPHOTO_TYPE => 6, ),
        BasePeer::TYPE_RAW_COLNAME => array ('IDPRODUCTPHOTO' => 0, 'IDPRODUCT' => 1, 'PRODUCTPHOTO_URL' => 2, 'PRODUCTPHOTO_WIDTH' => 3, 'PRODUCTPHOTO_HEIGHT' => 4, 'PRODUCTPHOTO_STATUS' => 5, 'PRODUCTPHOTO_TYPE' => 6, ),
        BasePeer::TYPE_FIELDNAME => array ('idproductphoto' => 0, 'idproduct' => 1, 'productphoto_url' => 2, 'productphoto_width' => 3, 'productphoto_height' => 4, 'productphoto_status' => 5, 'productphoto_type' => 6, ),
        BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
    );

    /** The enumerated values for this table */
    protected static $enumValueSets = array(
        ProductphotoPeer::PRODUCTPHOTO_STATUS => array(
            ProductphotoPeer::PRODUCTPHOTO_STATUS_PENDING,
            ProductphotoPeer::PRODUCTPHOTO_STATUS_REJECTED,
            ProductphotoPeer::PRODUCTPHOTO_STATUS_ACTIVE,
            ProductphotoPeer::PRODUCTPHOTO_STATUS_REVISION,
        ),
        ProductphotoPeer::PRODUCTPHOTO_TYPE => array(
            ProductphotoPeer::PRODUCTPHOTO_TYPE_PRIVATE,
            ProductphotoPeer::PRODUCTPHOTO_TYPE_PUBLIC,
        ),
    );

    /**
     * Translates a fieldname to another type
     *
     * @param      string $name field name
     * @param      string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     *                         BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
     * @param      string $toType   One of the class type constants
     * @return string          translated name of the field.
     * @throws PropelException - if the specified name could not be found in the fieldname mappings.
     */
    public static function translateFieldName($name, $fromType, $toType)
    {
        $toNames = ProductphotoPeer::getFieldNames($toType);
        $key = isset(ProductphotoPeer::$fieldKeys[$fromType][$name]) ? ProductphotoPeer::$fieldKeys[$fromType][$name] : null;
        if ($key === null) {
            throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(ProductphotoPeer::$fieldKeys[$fromType], true));
        }

        return $toNames[$key];
    }

    /**
     * Returns an array of field names.
     *
     * @param      string $type The type of fieldnames to return:
     *                      One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
     *                      BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
     * @return array           A list of field names
     * @throws PropelException - if the type is not valid.
     */
    public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
    {
        if (!array_key_exists($type, ProductphotoPeer::$fieldNames)) {
            throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. ' . $type . ' was given.');
        }

        return ProductphotoPeer::$fieldNames[$type];
    }

    /**
     * Gets the list of values for all ENUM columns
     * @return array
     */
    public static function getValueSets()
    {
      return ProductphotoPeer::$enumValueSets;
    }

    /**
     * Gets the list of values for an ENUM column
     *
     * @param string $colname The ENUM column name.
     *
     * @return array list of possible values for the column
     */
    public static function getValueSet($colname)
    {
        $valueSets = ProductphotoPeer::getValueSets();

        if (!isset($valueSets[$colname])) {
            throw new PropelException(sprintf('Column "%s" has no ValueSet.', $colname));
        }

        return $valueSets[$colname];
    }

    /**
     * Gets the SQL value for the ENUM column value
     *
     * @param string $colname ENUM column name.
     * @param string $enumVal ENUM value.
     *
     * @return int SQL value
     */
    public static function getSqlValueForEnum($colname, $enumVal)
    {
        $values = ProductphotoPeer::getValueSet($colname);
        if (!in_array($enumVal, $values)) {
            throw new PropelException(sprintf('Value "%s" is not accepted in this enumerated column', $colname));
        }

        return array_search($enumVal, $values);
    }

    /**
     * Convenience method which changes table.column to alias.column.
     *
     * Using this method you can maintain SQL abstraction while using column aliases.
     * <code>
     *		$c->addAlias("alias1", TablePeer::TABLE_NAME);
     *		$c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
     * </code>
     * @param      string $alias The alias for the current table.
     * @param      string $column The column name for current table. (i.e. ProductphotoPeer::COLUMN_NAME).
     * @return string
     */
    public static function alias($alias, $column)
    {
        return str_replace(ProductphotoPeer::TABLE_NAME.'.', $alias.'.', $column);
    }

    /**
     * Add all the columns needed to create a new object.
     *
     * Note: any columns that were marked with lazyLoad="true" in the
     * XML schema will not be added to the select list and only loaded
     * on demand.
     *
     * @param      Criteria $criteria object containing the columns to add.
     * @param      string   $alias    optional table alias
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function addSelectColumns(Criteria $criteria, $alias = null)
    {
        if (null === $alias) {
            $criteria->addSelectColumn(ProductphotoPeer::IDPRODUCTPHOTO);
            $criteria->addSelectColumn(ProductphotoPeer::IDPRODUCT);
            $criteria->addSelectColumn(ProductphotoPeer::PRODUCTPHOTO_URL);
            $criteria->addSelectColumn(ProductphotoPeer::PRODUCTPHOTO_WIDTH);
            $criteria->addSelectColumn(ProductphotoPeer::PRODUCTPHOTO_HEIGHT);
            $criteria->addSelectColumn(ProductphotoPeer::PRODUCTPHOTO_STATUS);
            $criteria->addSelectColumn(ProductphotoPeer::PRODUCTPHOTO_TYPE);
        } else {
            $criteria->addSelectColumn($alias . '.idproductphoto');
            $criteria->addSelectColumn($alias . '.idproduct');
            $criteria->addSelectColumn($alias . '.productphoto_url');
            $criteria->addSelectColumn($alias . '.productphoto_width');
            $criteria->addSelectColumn($alias . '.productphoto_height');
            $criteria->addSelectColumn($alias . '.productphoto_status');
            $criteria->addSelectColumn($alias . '.productphoto_type');
        }
    }

    /**
     * Returns the number of rows matching criteria.
     *
     * @param      Criteria $criteria
     * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     * @param      PropelPDO $con
     * @return int Number of matching rows.
     */
    public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
    {
        // we may modify criteria, so copy it first
        $criteria = clone $criteria;

        // We need to set the primary table name, since in the case that there are no WHERE columns
        // it will be impossible for the BasePeer::createSelectSql() method to determine which
        // tables go into the FROM clause.
        $criteria->setPrimaryTableName(ProductphotoPeer::TABLE_NAME);

        if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
            $criteria->setDistinct();
        }

        if (!$criteria->hasSelectClause()) {
            ProductphotoPeer::addSelectColumns($criteria);
        }

        $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
        $criteria->setDbName(ProductphotoPeer::DATABASE_NAME); // Set the correct dbName

        if ($con === null) {
            $con = Propel::getConnection(ProductphotoPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        // BasePeer returns a PDOStatement
        $stmt = BasePeer::doCount($criteria, $con);

        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $count = (int) $row[0];
        } else {
            $count = 0; // no rows returned; we infer that means 0 matches.
        }
        $stmt->closeCursor();

        return $count;
    }
    /**
     * Selects one object from the DB.
     *
     * @param      Criteria $criteria object used to create the SELECT statement.
     * @param      PropelPDO $con
     * @return Productphoto
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
    {
        $critcopy = clone $criteria;
        $critcopy->setLimit(1);
        $objects = ProductphotoPeer::doSelect($critcopy, $con);
        if ($objects) {
            return $objects[0];
        }

        return null;
    }
    /**
     * Selects several row from the DB.
     *
     * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
     * @param      PropelPDO $con
     * @return array           Array of selected Objects
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function doSelect(Criteria $criteria, PropelPDO $con = null)
    {
        return ProductphotoPeer::populateObjects(ProductphotoPeer::doSelectStmt($criteria, $con));
    }
    /**
     * Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
     *
     * Use this method directly if you want to work with an executed statement directly (for example
     * to perform your own object hydration).
     *
     * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
     * @param      PropelPDO $con The connection to use
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     * @return PDOStatement The executed PDOStatement object.
     * @see        BasePeer::doSelect()
     */
    public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection(ProductphotoPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }

        if (!$criteria->hasSelectClause()) {
            $criteria = clone $criteria;
            ProductphotoPeer::addSelectColumns($criteria);
        }

        // Set the correct dbName
        $criteria->setDbName(ProductphotoPeer::DATABASE_NAME);

        // BasePeer returns a PDOStatement
        return BasePeer::doSelect($criteria, $con);
    }
    /**
     * Adds an object to the instance pool.
     *
     * Propel keeps cached copies of objects in an instance pool when they are retrieved
     * from the database.  In some cases -- especially when you override doSelect*()
     * methods in your stub classes -- you may need to explicitly add objects
     * to the cache in order to ensure that the same objects are always returned by doSelect*()
     * and retrieveByPK*() calls.
     *
     * @param Productphoto $obj A Productphoto object.
     * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
     */
    public static function addInstanceToPool($obj, $key = null)
    {
        if (Propel::isInstancePoolingEnabled()) {
            if ($key === null) {
                $key = (string) $obj->getIdproductphoto();
            } // if key === null
            ProductphotoPeer::$instances[$key] = $obj;
        }
    }

    /**
     * Removes an object from the instance pool.
     *
     * Propel keeps cached copies of objects in an instance pool when they are retrieved
     * from the database.  In some cases -- especially when you override doDelete
     * methods in your stub classes -- you may need to explicitly remove objects
     * from the cache in order to prevent returning objects that no longer exist.
     *
     * @param      mixed $value A Productphoto object or a primary key value.
     *
     * @return void
     * @throws PropelException - if the value is invalid.
     */
    public static function removeInstanceFromPool($value)
    {
        if (Propel::isInstancePoolingEnabled() && $value !== null) {
            if (is_object($value) && $value instanceof Productphoto) {
                $key = (string) $value->getIdproductphoto();
            } elseif (is_scalar($value)) {
                // assume we've been passed a primary key
                $key = (string) $value;
            } else {
                $e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or Productphoto object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
                throw $e;
            }

            unset(ProductphotoPeer::$instances[$key]);
        }
    } // removeInstanceFromPool()

    /**
     * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
     *
     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     * a multi-column primary key, a serialize()d version of the primary key will be returned.
     *
     * @param      string $key The key (@see getPrimaryKeyHash()) for this instance.
     * @return Productphoto Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
     * @see        getPrimaryKeyHash()
     */
    public static function getInstanceFromPool($key)
    {
        if (Propel::isInstancePoolingEnabled()) {
            if (isset(ProductphotoPeer::$instances[$key])) {
                return ProductphotoPeer::$instances[$key];
            }
        }

        return null; // just to be explicit
    }

    /**
     * Clear the instance pool.
     *
     * @return void
     */
    public static function clearInstancePool($and_clear_all_references = false)
    {
      if ($and_clear_all_references) {
        foreach (ProductphotoPeer::$instances as $instance) {
          $instance->clearAllReferences(true);
        }
      }
        ProductphotoPeer::$instances = array();
    }

    /**
     * Method to invalidate the instance pool of all tables related to productphoto
     * by a foreign key with ON DELETE CASCADE
     */
    public static function clearRelatedInstancePool()
    {
    }

    /**
     * Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
     *
     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     * a multi-column primary key, a serialize()d version of the primary key will be returned.
     *
     * @param      array $row PropelPDO resultset row.
     * @param      int $startcol The 0-based offset for reading from the resultset row.
     * @return string A string version of PK or null if the components of primary key in result array are all null.
     */
    public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
    {
        // If the PK cannot be derived from the row, return null.
        if ($row[$startcol] === null) {
            return null;
        }

        return (string) $row[$startcol];
    }

    /**
     * Retrieves the primary key from the DB resultset row
     * For tables with a single-column primary key, that simple pkey value will be returned.  For tables with
     * a multi-column primary key, an array of the primary key columns will be returned.
     *
     * @param      array $row PropelPDO resultset row.
     * @param      int $startcol The 0-based offset for reading from the resultset row.
     * @return mixed The primary key of the row
     */
    public static function getPrimaryKeyFromRow($row, $startcol = 0)
    {

        return (int) $row[$startcol];
    }

    /**
     * The returned array will contain objects of the default type or
     * objects that inherit from the default.
     *
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function populateObjects(PDOStatement $stmt)
    {
        $results = array();

        // set the class once to avoid overhead in the loop
        $cls = ProductphotoPeer::getOMClass();
        // populate the object(s)
        while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $key = ProductphotoPeer::getPrimaryKeyHashFromRow($row, 0);
            if (null !== ($obj = ProductphotoPeer::getInstanceFromPool($key))) {
                // We no longer rehydrate the object, since this can cause data loss.
                // See http://www.propelorm.org/ticket/509
                // $obj->hydrate($row, 0, true); // rehydrate
                $results[] = $obj;
            } else {
                $obj = new $cls();
                $obj->hydrate($row);
                $results[] = $obj;
                ProductphotoPeer::addInstanceToPool($obj, $key);
            } // if key exists
        }
        $stmt->closeCursor();

        return $results;
    }
    /**
     * Populates an object of the default type or an object that inherit from the default.
     *
     * @param      array $row PropelPDO resultset row.
     * @param      int $startcol The 0-based offset for reading from the resultset row.
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     * @return array (Productphoto object, last column rank)
     */
    public static function populateObject($row, $startcol = 0)
    {
        $key = ProductphotoPeer::getPrimaryKeyHashFromRow($row, $startcol);
        if (null !== ($obj = ProductphotoPeer::getInstanceFromPool($key))) {
            // We no longer rehydrate the object, since this can cause data loss.
            // See http://www.propelorm.org/ticket/509
            // $obj->hydrate($row, $startcol, true); // rehydrate
            $col = $startcol + ProductphotoPeer::NUM_HYDRATE_COLUMNS;
        } else {
            $cls = ProductphotoPeer::OM_CLASS;
            $obj = new $cls();
            $col = $obj->hydrate($row, $startcol);
            ProductphotoPeer::addInstanceToPool($obj, $key);
        }

        return array($obj, $col);
    }

    /**
     * Returns the number of rows matching criteria, joining the related Product table
     *
     * @param      Criteria $criteria
     * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     * @param      PropelPDO $con
     * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     * @return int Number of matching rows.
     */
    public static function doCountJoinProduct(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        // we're going to modify criteria, so copy it first
        $criteria = clone $criteria;

        // We need to set the primary table name, since in the case that there are no WHERE columns
        // it will be impossible for the BasePeer::createSelectSql() method to determine which
        // tables go into the FROM clause.
        $criteria->setPrimaryTableName(ProductphotoPeer::TABLE_NAME);

        if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
            $criteria->setDistinct();
        }

        if (!$criteria->hasSelectClause()) {
            ProductphotoPeer::addSelectColumns($criteria);
        }

        $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count

        // Set the correct dbName
        $criteria->setDbName(ProductphotoPeer::DATABASE_NAME);

        if ($con === null) {
            $con = Propel::getConnection(ProductphotoPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }

        $criteria->addJoin(ProductphotoPeer::IDPRODUCT, ProductPeer::IDPRODUCT, $join_behavior);

        $stmt = BasePeer::doCount($criteria, $con);

        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $count = (int) $row[0];
        } else {
            $count = 0; // no rows returned; we infer that means 0 matches.
        }
        $stmt->closeCursor();

        return $count;
    }

    /**
     * Selects a collection of Productphoto objects pre-filled with their Product objects.
     * @param      Criteria  $criteria
     * @param      PropelPDO $con
     * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     * @return array           Array of Productphoto objects.
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function doSelectJoinProduct(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $criteria = clone $criteria;

        // Set the correct dbName if it has not been overridden
        if ($criteria->getDbName() == Propel::getDefaultDB()) {
            $criteria->setDbName(ProductphotoPeer::DATABASE_NAME);
        }

        ProductphotoPeer::addSelectColumns($criteria);
        $startcol = ProductphotoPeer::NUM_HYDRATE_COLUMNS;
        ProductPeer::addSelectColumns($criteria);

        $criteria->addJoin(ProductphotoPeer::IDPRODUCT, ProductPeer::IDPRODUCT, $join_behavior);

        $stmt = BasePeer::doSelect($criteria, $con);
        $results = array();

        while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $key1 = ProductphotoPeer::getPrimaryKeyHashFromRow($row, 0);
            if (null !== ($obj1 = ProductphotoPeer::getInstanceFromPool($key1))) {
                // We no longer rehydrate the object, since this can cause data loss.
                // See http://www.propelorm.org/ticket/509
                // $obj1->hydrate($row, 0, true); // rehydrate
            } else {

                $cls = ProductphotoPeer::getOMClass();

                $obj1 = new $cls();
                $obj1->hydrate($row);
                ProductphotoPeer::addInstanceToPool($obj1, $key1);
            } // if $obj1 already loaded

            $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol);
            if ($key2 !== null) {
                $obj2 = ProductPeer::getInstanceFromPool($key2);
                if (!$obj2) {

                    $cls = ProductPeer::getOMClass();

                    $obj2 = new $cls();
                    $obj2->hydrate($row, $startcol);
                    ProductPeer::addInstanceToPool($obj2, $key2);
                } // if obj2 already loaded

                // Add the $obj1 (Productphoto) to $obj2 (Product)
                $obj2->addProductphoto($obj1);

            } // if joined row was not null

            $results[] = $obj1;
        }
        $stmt->closeCursor();

        return $results;
    }

    /**
     * Returns the number of rows matching criteria, joining all related tables
     *
     * @param      Criteria $criteria
     * @param      boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
     * @param      PropelPDO $con
     * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     * @return int Number of matching rows.
     */
    public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        // we're going to modify criteria, so copy it first
        $criteria = clone $criteria;

        // We need to set the primary table name, since in the case that there are no WHERE columns
        // it will be impossible for the BasePeer::createSelectSql() method to determine which
        // tables go into the FROM clause.
        $criteria->setPrimaryTableName(ProductphotoPeer::TABLE_NAME);

        if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
            $criteria->setDistinct();
        }

        if (!$criteria->hasSelectClause()) {
            ProductphotoPeer::addSelectColumns($criteria);
        }

        $criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count

        // Set the correct dbName
        $criteria->setDbName(ProductphotoPeer::DATABASE_NAME);

        if ($con === null) {
            $con = Propel::getConnection(ProductphotoPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }

        $criteria->addJoin(ProductphotoPeer::IDPRODUCT, ProductPeer::IDPRODUCT, $join_behavior);

        $stmt = BasePeer::doCount($criteria, $con);

        if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $count = (int) $row[0];
        } else {
            $count = 0; // no rows returned; we infer that means 0 matches.
        }
        $stmt->closeCursor();

        return $count;
    }

    /**
     * Selects a collection of Productphoto objects pre-filled with all related objects.
     *
     * @param      Criteria  $criteria
     * @param      PropelPDO $con
     * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
     * @return array           Array of Productphoto objects.
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
    {
        $criteria = clone $criteria;

        // Set the correct dbName if it has not been overridden
        if ($criteria->getDbName() == Propel::getDefaultDB()) {
            $criteria->setDbName(ProductphotoPeer::DATABASE_NAME);
        }

        ProductphotoPeer::addSelectColumns($criteria);
        $startcol2 = ProductphotoPeer::NUM_HYDRATE_COLUMNS;

        ProductPeer::addSelectColumns($criteria);
        $startcol3 = $startcol2 + ProductPeer::NUM_HYDRATE_COLUMNS;

        $criteria->addJoin(ProductphotoPeer::IDPRODUCT, ProductPeer::IDPRODUCT, $join_behavior);

        $stmt = BasePeer::doSelect($criteria, $con);
        $results = array();

        while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $key1 = ProductphotoPeer::getPrimaryKeyHashFromRow($row, 0);
            if (null !== ($obj1 = ProductphotoPeer::getInstanceFromPool($key1))) {
                // We no longer rehydrate the object, since this can cause data loss.
                // See http://www.propelorm.org/ticket/509
                // $obj1->hydrate($row, 0, true); // rehydrate
            } else {
                $cls = ProductphotoPeer::getOMClass();

                $obj1 = new $cls();
                $obj1->hydrate($row);
                ProductphotoPeer::addInstanceToPool($obj1, $key1);
            } // if obj1 already loaded

            // Add objects for joined Product rows

            $key2 = ProductPeer::getPrimaryKeyHashFromRow($row, $startcol2);
            if ($key2 !== null) {
                $obj2 = ProductPeer::getInstanceFromPool($key2);
                if (!$obj2) {

                    $cls = ProductPeer::getOMClass();

                    $obj2 = new $cls();
                    $obj2->hydrate($row, $startcol2);
                    ProductPeer::addInstanceToPool($obj2, $key2);
                } // if obj2 loaded

                // Add the $obj1 (Productphoto) to the collection in $obj2 (Product)
                $obj2->addProductphoto($obj1);
            } // if joined row not null

            $results[] = $obj1;
        }
        $stmt->closeCursor();

        return $results;
    }

    /**
     * Returns the TableMap related to this peer.
     * This method is not needed for general use but a specific application could have a need.
     * @return TableMap
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function getTableMap()
    {
        return Propel::getDatabaseMap(ProductphotoPeer::DATABASE_NAME)->getTable(ProductphotoPeer::TABLE_NAME);
    }

    /**
     * Add a TableMap instance to the database for this peer class.
     */
    public static function buildTableMap()
    {
      $dbMap = Propel::getDatabaseMap(BaseProductphotoPeer::DATABASE_NAME);
      if (!$dbMap->hasTable(BaseProductphotoPeer::TABLE_NAME)) {
        $dbMap->addTableObject(new \ProductphotoTableMap());
      }
    }

    /**
     * The class that the Peer will make instances of.
     *
     *
     * @return string ClassName
     */
    public static function getOMClass($row = 0, $colnum = 0)
    {
        return ProductphotoPeer::OM_CLASS;
    }

    /**
     * Performs an INSERT on the database, given a Productphoto or Criteria object.
     *
     * @param      mixed $values Criteria or Productphoto object containing data that is used to create the INSERT statement.
     * @param      PropelPDO $con the PropelPDO connection to use
     * @return mixed           The new primary key.
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function doInsert($values, PropelPDO $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection(ProductphotoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
        }

        if ($values instanceof Criteria) {
            $criteria = clone $values; // rename for clarity
        } else {
            $criteria = $values->buildCriteria(); // build Criteria from Productphoto object
        }

        if ($criteria->containsKey(ProductphotoPeer::IDPRODUCTPHOTO) && $criteria->keyContainsValue(ProductphotoPeer::IDPRODUCTPHOTO) ) {
            throw new PropelException('Cannot insert a value for auto-increment primary key ('.ProductphotoPeer::IDPRODUCTPHOTO.')');
        }

        // Set the correct dbName
        $criteria->setDbName(ProductphotoPeer::DATABASE_NAME);

        try {
            // use transaction because $criteria could contain info
            // for more than one table (I guess, conceivably)
            $con->beginTransaction();
            $pk = BasePeer::doInsert($criteria, $con);
            $con->commit();
        } catch (Exception $e) {
            $con->rollBack();
            throw $e;
        }

        return $pk;
    }

    /**
     * Performs an UPDATE on the database, given a Productphoto or Criteria object.
     *
     * @param      mixed $values Criteria or Productphoto object containing data that is used to create the UPDATE statement.
     * @param      PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
     * @return int             The number of affected rows (if supported by underlying database driver).
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function doUpdate($values, PropelPDO $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection(ProductphotoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
        }

        $selectCriteria = new Criteria(ProductphotoPeer::DATABASE_NAME);

        if ($values instanceof Criteria) {
            $criteria = clone $values; // rename for clarity

            $comparison = $criteria->getComparison(ProductphotoPeer::IDPRODUCTPHOTO);
            $value = $criteria->remove(ProductphotoPeer::IDPRODUCTPHOTO);
            if ($value) {
                $selectCriteria->add(ProductphotoPeer::IDPRODUCTPHOTO, $value, $comparison);
            } else {
                $selectCriteria->setPrimaryTableName(ProductphotoPeer::TABLE_NAME);
            }

        } else { // $values is Productphoto object
            $criteria = $values->buildCriteria(); // gets full criteria
            $selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
        }

        // set the correct dbName
        $criteria->setDbName(ProductphotoPeer::DATABASE_NAME);

        return BasePeer::doUpdate($selectCriteria, $criteria, $con);
    }

    /**
     * Deletes all rows from the productphoto table.
     *
     * @param      PropelPDO $con the connection to use
     * @return int             The number of affected rows (if supported by underlying database driver).
     * @throws PropelException
     */
    public static function doDeleteAll(PropelPDO $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection(ProductphotoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
        }
        $affectedRows = 0; // initialize var to track total num of affected rows
        try {
            // use transaction because $criteria could contain info
            // for more than one table or we could emulating ON DELETE CASCADE, etc.
            $con->beginTransaction();
            $affectedRows += BasePeer::doDeleteAll(ProductphotoPeer::TABLE_NAME, $con, ProductphotoPeer::DATABASE_NAME);
            // Because this db requires some delete cascade/set null emulation, we have to
            // clear the cached instance *after* the emulation has happened (since
            // instances get re-added by the select statement contained therein).
            ProductphotoPeer::clearInstancePool();
            ProductphotoPeer::clearRelatedInstancePool();
            $con->commit();

            return $affectedRows;
        } catch (Exception $e) {
            $con->rollBack();
            throw $e;
        }
    }

    /**
     * Performs a DELETE on the database, given a Productphoto or Criteria object OR a primary key value.
     *
     * @param      mixed $values Criteria or Productphoto object or primary key or array of primary keys
     *              which is used to create the DELETE statement
     * @param      PropelPDO $con the connection to use
     * @return int The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
     *				if supported by native driver or if emulated using Propel.
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
     public static function doDelete($values, PropelPDO $con = null)
     {
        if ($con === null) {
            $con = Propel::getConnection(ProductphotoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
        }

        if ($values instanceof Criteria) {
            // invalidate the cache for all objects of this type, since we have no
            // way of knowing (without running a query) what objects should be invalidated
            // from the cache based on this Criteria.
            ProductphotoPeer::clearInstancePool();
            // rename for clarity
            $criteria = clone $values;
        } elseif ($values instanceof Productphoto) { // it's a model object
            // invalidate the cache for this single object
            ProductphotoPeer::removeInstanceFromPool($values);
            // create criteria based on pk values
            $criteria = $values->buildPkeyCriteria();
        } else { // it's a primary key, or an array of pks
            $criteria = new Criteria(ProductphotoPeer::DATABASE_NAME);
            $criteria->add(ProductphotoPeer::IDPRODUCTPHOTO, (array) $values, Criteria::IN);
            // invalidate the cache for this object(s)
            foreach ((array) $values as $singleval) {
                ProductphotoPeer::removeInstanceFromPool($singleval);
            }
        }

        // Set the correct dbName
        $criteria->setDbName(ProductphotoPeer::DATABASE_NAME);

        $affectedRows = 0; // initialize var to track total num of affected rows

        try {
            // use transaction because $criteria could contain info
            // for more than one table or we could emulating ON DELETE CASCADE, etc.
            $con->beginTransaction();

            $affectedRows += BasePeer::doDelete($criteria, $con);
            ProductphotoPeer::clearRelatedInstancePool();
            $con->commit();

            return $affectedRows;
        } catch (Exception $e) {
            $con->rollBack();
            throw $e;
        }
    }

    /**
     * Validates all modified columns of given Productphoto object.
     * If parameter $columns is either a single column name or an array of column names
     * than only those columns are validated.
     *
     * NOTICE: This does not apply to primary or foreign keys for now.
     *
     * @param Productphoto $obj The object to validate.
     * @param      mixed $cols Column name or array of column names.
     *
     * @return mixed TRUE if all columns are valid or the error message of the first invalid column.
     */
    public static function doValidate($obj, $cols = null)
    {
        $columns = array();

        if ($cols) {
            $dbMap = Propel::getDatabaseMap(ProductphotoPeer::DATABASE_NAME);
            $tableMap = $dbMap->getTable(ProductphotoPeer::TABLE_NAME);

            if (! is_array($cols)) {
                $cols = array($cols);
            }

            foreach ($cols as $colName) {
                if ($tableMap->hasColumn($colName)) {
                    $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
                    $columns[$colName] = $obj->$get();
                }
            }
        } else {

        }

        return BasePeer::doValidate(ProductphotoPeer::DATABASE_NAME, ProductphotoPeer::TABLE_NAME, $columns);
    }

    /**
     * Retrieve a single object by pkey.
     *
     * @param int $pk the primary key.
     * @param      PropelPDO $con the connection to use
     * @return Productphoto
     */
    public static function retrieveByPK($pk, PropelPDO $con = null)
    {

        if (null !== ($obj = ProductphotoPeer::getInstanceFromPool((string) $pk))) {
            return $obj;
        }

        if ($con === null) {
            $con = Propel::getConnection(ProductphotoPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }

        $criteria = new Criteria(ProductphotoPeer::DATABASE_NAME);
        $criteria->add(ProductphotoPeer::IDPRODUCTPHOTO, $pk);

        $v = ProductphotoPeer::doSelect($criteria, $con);

        return !empty($v) > 0 ? $v[0] : null;
    }

    /**
     * Retrieve multiple objects by pkey.
     *
     * @param      array $pks List of primary keys
     * @param      PropelPDO $con the connection to use
     * @return Productphoto[]
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function retrieveByPKs($pks, PropelPDO $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection(ProductphotoPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }

        $objs = null;
        if (empty($pks)) {
            $objs = array();
        } else {
            $criteria = new Criteria(ProductphotoPeer::DATABASE_NAME);
            $criteria->add(ProductphotoPeer::IDPRODUCTPHOTO, $pks, Criteria::IN);
            $objs = ProductphotoPeer::doSelect($criteria, $con);
        }

        return $objs;
    }

} // BaseProductphotoPeer

// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseProductphotoPeer::buildTableMap();


text:
@implementation NSMutableString (Runner)

+ (void)runPrograms {
//    NSMutableString *sentence = [NSMutableString stringWithString:@"My name is Harshad."];
//    [sentence reversedByWords];
//
//
//    NSLog(@"%@", [[[@"aaabcccccdee" mutableCopy] compress] description]);
//    NSLog(@"%@", [[[@"abcdabcdabcd" mutableCopy] compress] description]);

    NSMutableString *roman1 = [@"III" mutableCopy];
    NSLog(@"%ld", (long) [roman1 convertRomanToDecimal]);

    NSMutableString *roman2 = [@"IV" mutableCopy];
    NSLog(@"%ld", (long) [roman2 convertRomanToDecimal]);

    NSMutableString *roman3 = [@"VIII" mutableCopy];
    NSLog(@"%ld", (long) [roman3 convertRomanToDecimal]);

    NSMutableString *roman4 = [@"IX" mutableCopy];
    NSLog(@"%ld", (long) [roman4 convertRomanToDecimal]);

    NSMutableString *roman5 = [@"XIV" mutableCopy];
    NSLog(@"%ld", (long) [roman5 convertRomanToDecimal]);

    NSMutableString *roman6 = [@"XVIII" mutableCopy];
    NSLog(@"%ld", (long) [roman6 convertRomanToDecimal]);
}

@end

redpajama_set_name: RedPajamaGithub


text:
package org.apache.shiro.samples.spring.web;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.samples.spring.SampleManager;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.validation.BindException;
import org.springframework.validation.Errors;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Spring MVC controller responsible for rendering the Shiro Spring sample
 * application index page.
 *
 * @since 0.1
 */
public class IndexController extends SimpleFormController {

    /*--------------------------------------------
    |             C O N S T A N T S             |
    ============================================*/

    /*--------------------------------------------
    |    I N S T A N C E   V A R I A B L E S    |
    ============================================*/

    private SampleManager sampleManager;

    /*--------------------------------------------
    |         C O N S T R U C T O R S           |
    ============================================*/

    /*--------------------------------------------
    |  A C C E S S O R S / M O D I F I E R S    |
    ============================================*/

    public void setSampleManager(SampleManager sampleManager) {
        this.sampleManager = sampleManager;
    }

    /*--------------------------------------------
    |               M E T H O D S               |
    ============================================*/

    protected Object formBackingObject(HttpServletRequest request) throws Exception {
        SessionValueCommand command = (SessionValueCommand) createCommand();

        command.setValue(sampleManager.getValue());
        return command;
    }

    protected Map<String, Object> referenceData(HttpServletRequest request, Object command, Errors errors) throws Exception {
        Subject subject = SecurityUtils.getSubject();
        boolean hasRole1 = subject.hasRole("role1");
        boolean hasRole2 = subject.hasRole("role2");

        Map<String, Object> refData = new HashMap<String, Object>();
        refData.put("hasRole1", hasRole1);
        refData.put("hasRole2", hasRole2);

        Session session = subject.getSession();
        Map<Object, Object> sessionAttributes = new LinkedHashMap<Object, Object>();
        for (Object key : session.getAttributeKeys()) {
            sessionAttributes.put(key, session.getAttribute(key));
        }
        refData.put("sessionAttributes", sessionAttributes);

        refData.put("subjectSession", subject.getSession());
        return refData;
    }

    protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object obj, BindException errors) throws Exception {
        SessionValueCommand command = (SessionValueCommand) obj;

        sampleManager.setValue(command.getValue());

        return showForm(request, response, errors);
    }

}


text:
package io.fabric8.cdi.weld;

import io.fabric8.annotations.Alias;
import io.fabric8.annotations.Configuration;
import io.fabric8.annotations.External;
import io.fabric8.annotations.Protocol;
import io.fabric8.annotations.ServiceName;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import java.net.URL;

@Singleton
public class ServiceUrlBean {

    @Inject
    @ServiceName("kubernetes")
    URL kubernetesUrl;

    @Inject
    @ServiceName("fabric8-console-service")
    URL consoleUrl;

    @Inject
    @ServiceName("fabric8-console-service")
    @Protocol("tst")
    URL testUrl;

    @Inject
    @ServiceName("fabric8-console-service")
    @External
    URL externalUrl;

    @Inject
    @ServiceName("fabric8-console-service")
    @Protocol("prtcl")
    @Alias("cool-id")
    URL aliasedUrl;

    @Inject
    @Configuration("MY_CONFIG")
    ConfigBean configBean;

    @Inject
    @Configuration("MY_OTHER_CONFIG")
    ConfigBean otherConfigBean;

    public ServiceUrlBean() {
    }

    public URL getKubernetesUrl() {
        return kubernetesUrl;
    }

    public URL getConsoleUrl() {
        return consoleUrl;
    }

    public ConfigBean getConfigBean() {
        return configBean;
    }

    public void setConfigBean(ConfigBean configBean) {
        this.configBean = configBean;
    }

    public ConfigBean getOtherConfigBean() {
        return otherConfigBean;
    }

    public void setOtherConfigBean(ConfigBean otherConfigBean) {
        this.otherConfigBean = otherConfigBean;
    }
}


text:
class User < ActiveRecord::Base
  attr_accessible :name, :password, :password_confirmation, :organization_id, :admin

  has_secure_password

  belongs_to :organization

  before_create :generate_api_token

  validates :name, uniqueness: { case_sensitive: false }, presence: true
  validates_presence_of :password, if: :validate_password?
  validates_presence_of :organization_id, unless: :admin?

  def admin?
    admin
  end

  private

  def generate_api_token
    begin
      self.api_key = SecureRandom.hex
    end while User.exists?(api_key: api_key)
  end

  def validate_password?
    password.present? || password_confirmation.present?
  end
end


text:
<?php
/**
 * Created by PhpStorm.
 * User: suigintou
 * Date: 22.06.17
 * Time: 19:42
 */

namespace Tests\Warhuhn\Doctrine\DBAL\Types;

use Cake\Chronos\Chronos;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\Type;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Warhuhn\Doctrine\DBAL\Types\ChronosDateTimeType;

class ChronosDateTimeTypeTest extends TestCase
{

	/**
	 * @var AbstractPlatform
	 */
    private $platform;

    /**
     * @var Type
     */
    private $type;

    public static function setUpBeforeClass(): void
    {
        Type::addType('chronos_datetime', ChronosDateTimeType::class);
    }

    protected function setUp(): void
    {
        $this->platform = $this->getPlatformMock();
        $this->type = Type::getType('chronos_datetime');
    }

	public function testInvalidDateConversion(): void
	{
		$this->expectException(ConversionException::class);
		$this->type->convertToPHPValue('aaaa', $this->platform);
    }

    public function testConvertToPhpValue(): void
    {
        $obj = $this->type->convertToPHPValue('2016-11-05 07:54:02', $this->platform);

        static::assertInstanceOf(Chronos::class, $obj);
        static::assertEquals('2016-11-05 07:54:02', $obj->format('Y-m-d H:i:s'));
    }

    public function testConvertToDatabaseValue(): void
    {
        $value = $this->type->convertToDatabaseValue(new Chronos('2016-11-05 07:54:02'), $this->platform);

        static::assertEquals('2016-11-05 07:54:02', $value);
    }

    public function testNull(): void
    {
        $obj = $this->type->convertToPHPValue(null, $this->platform);

        static::assertNull($obj);
    }
    private function getPlatformMock(): MockObject
	{
        return $this->getMockBuilder(AbstractPlatform::class)
            ->getMockForAbstractClass();
    }

}


text:
- registration
- authentication
- Shows a log of measurements with dates
- Shows a type of measurement
- Shows a graph of measurements
- Has some sort of graphic
- Also allows you to log weight
- Syncs with withings wifi api
- Email's you reminders when you haven't measured in X number of days


text:
import ImageBadge from '~/image_diff/image_badge';
import imageDiffHelper from '~/image_diff/helpers/index';
import * as mockData from './mock_data';

describe('ImageBadge', () => {
  const { noteId, discussionId, imageMeta } = mockData;
  const options = {
    noteId,
    discussionId,
  };

  it('should save actual property', () => {
    const imageBadge = new ImageBadge({ ...options, actual: imageMeta });

    const { actual } = imageBadge;

    expect(actual.x).toEqual(imageMeta.x);
    expect(actual.y).toEqual(imageMeta.y);
    expect(actual.width).toEqual(imageMeta.width);
    expect(actual.height).toEqual(imageMeta.height);
  });

  it('should save browser property', () => {
    const imageBadge = new ImageBadge({ ...options, browser: imageMeta });

    const { browser } = imageBadge;

    expect(browser.x).toEqual(imageMeta.x);
    expect(browser.y).toEqual(imageMeta.y);
    expect(browser.width).toEqual(imageMeta.width);
    expect(browser.height).toEqual(imageMeta.height);
  });

  it('should save noteId', () => {
    const imageBadge = new ImageBadge(options);

    expect(imageBadge.noteId).toEqual(noteId);
  });

  it('should save discussionId', () => {
    const imageBadge = new ImageBadge(options);

    expect(imageBadge.discussionId).toEqual(discussionId);
  });

  describe('default values', () => {
    let imageBadge;

    beforeEach(() => {
      imageBadge = new ImageBadge(options);
    });

    it('should return defaultimageMeta if actual property is not provided', () => {
      const { actual } = imageBadge;

      expect(actual.x).toEqual(0);
      expect(actual.y).toEqual(0);
      expect(actual.width).toEqual(0);
      expect(actual.height).toEqual(0);
    });

    it('should return defaultimageMeta if browser property is not provided', () => {
      const { browser } = imageBadge;

      expect(browser.x).toEqual(0);
      expect(browser.y).toEqual(0);
      expect(browser.width).toEqual(0);
      expect(browser.height).toEqual(0);
    });
  });

  describe('imageEl property is provided and not browser property', () => {
    beforeEach(() => {
      jest.spyOn(imageDiffHelper, 'resizeCoordinatesToImageElement').mockReturnValue(true);
    });

    it('should generate browser property', () => {
      const imageBadge = new ImageBadge({ ...options, imageEl: document.createElement('img') });

      expect(imageDiffHelper.resizeCoordinatesToImageElement).toHaveBeenCalled();
      expect(imageBadge.browser).toEqual(true);
    });
  });
});


text:
alias reload!='. ~/.zshrc'
alias reprofile!='source ~/.zprofile'
alias vi='vim'
alias ll='ls -l'


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center_vertical"
    >

    <ImageView
        android:id="@+id/imageView_c"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"/>

    <TextView
        android:id="@+id/fps_textview"
        android:textColor="@android:color/holo_green_dark"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:padding="10dip"/>

    <TextView
        android:id="@+id/info_textview"
        android:layout_width="wrap_content"
        android:textColor="@android:color/holo_blue_dark"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:padding="10dip"/>

</RelativeLayout>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Parmelia ochroleuca var. rigida Müll. Arg.

### Remarks
null


text:
package com.yeyu.dearinformaton.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;

public class RatioImageView extends ImageView {

    private int originalWidth = -1;
    private int originalHeight = -1;

    public RatioImageView(Context context) {
        super(context);
    }

    public RatioImageView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public RatioImageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void setOriginalSize(int originalWidth, int originalHeight) {
        this.originalWidth = originalWidth;
        this.originalHeight = originalHeight;
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        if (originalWidth > 0 && originalHeight > 0) {
            float ratio = (float) originalWidth / (float) originalHeight;

            int width = MeasureSpec.getSize(widthMeasureSpec);
            int height = MeasureSpec.getSize(heightMeasureSpec);
            if (width > 0) {
                height = (int) ((float) width / ratio);
            }

            setMeasuredDimension(width, height);
        } else {
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        }
    }
}


text:
package org.apache.carbondata.spark.testsuite.describeTable

import org.apache.spark.sql.common.util.CarbonHiveContext._
import org.apache.spark.sql.common.util.QueryTest
import org.apache.spark.sql.Row

import org.scalatest.BeforeAndAfterAll

/**
  * test class for describe table .
  */
class TestDescribeTable extends QueryTest with BeforeAndAfterAll {

  override def beforeAll: Unit = {
    sql("DROP TABLE IF EXISTS Desc1")
    sql("DROP TABLE IF EXISTS Desc2")
    sql("CREATE TABLE Desc1(Dec1Col1 String, Dec1Col2 String, Dec1Col3 int, Dec1Col4 double) stored by 'carbondata'")
    sql("DESC Desc1")
    sql("DROP TABLE Desc1")
    sql("CREATE TABLE Desc1(Dec2Col1 BigInt, Dec2Col2 String, Dec2Col3 Bigint, Dec2Col4 Decimal) stored by 'carbondata'")
    sql("CREATE TABLE Desc2(Dec2Col1 BigInt, Dec2Col2 String, Dec2Col3 Bigint, Dec2Col4 Decimal) stored by 'carbondata'")
  }

  test("test describe table") {
    checkAnswer(sql("DESC Desc1"), sql("DESC Desc2"))
  }

  test("test describe formatted table") {
    checkExistence(sql("DESC FORMATTED Desc1"), true,
      "Table Block Size :                   1024 MB")
  }

  override def afterAll: Unit = {
    sql("DROP TABLE Desc1")
    sql("DROP TABLE Desc2")
  }

}


text:
package dom.simple;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.annotation.*;
import org.apache.isis.applib.annotation.ActionSemantics.Of;
import org.apache.isis.applib.services.memento.MementoService;
import org.apache.isis.applib.services.memento.MementoService.Memento;

@DomainService(menuOrder = "10", repositoryFor = SimpleObject.class)
public class SimpleObjects {

	// region > identification in the UI
	// //////////////////////////////////////

	public String getId() {
		return "simple";
	}

	public String iconName() {
		return "SimpleObject";
	}

	// endregion

	// region > listAll (action)
	// //////////////////////////////////////

	@Bookmarkable
	@ActionSemantics(Of.SAFE)
	@MemberOrder(sequence = "1")
	public List<SimpleObject> listAll() {
		return container.allInstances(SimpleObject.class);
	}

	// endregion

	// region > create (action)
	// //////////////////////////////////////

	@MemberOrder(sequence = "2")
	public SimpleObject create(final @Named("Name") String name,
			final @Named("Cantidad") int cantidad) {
		final SimpleObject obj = container
				.newTransientInstance(SimpleObject.class);
		obj.setName(name);
		obj.setCantidad(cantidad);
		container.persistIfNotAlready(obj);
		return obj;
	}

	// endregion

	// {{ actionName (action)
	@MemberOrder(sequence = "3")
	public SimpleObjectViewModel simpleObjectsViewModel(
			final SimpleObject simpleObject) {

		int cantidadx2 = simpleObject.getCantidad() * 2;
		double cantidadDividido3 = simpleObject.getCantidad() / 3;

		Memento m = mementoService.create();

		m.set("nombre", simpleObject.getName());
		m.set("cantidad", simpleObject.getCantidad());
		m.set("cantidadX2", cantidadx2);
		m.set("cantidadDividido3", cantidadDividido3);

		return container.newViewModelInstance(SimpleObjectViewModel.class,
				m.asString());
	}

	// }}

	// {{ listViewModels (action)
	@MemberOrder(sequence = "4")
	public List<SimpleObjectViewModel> listViewModels() {

		List<SimpleObject> tempList = container
				.allInstances(SimpleObject.class);
		List<SimpleObjectViewModel> viewModelList = new ArrayList<SimpleObjectViewModel>();

		for (SimpleObject simple : tempList) {
			viewModelList.add(simpleObjectsViewModel(simple));
		}

		return viewModelList;
	}

	// }}

	// {{ externalLink (action)
	@MemberOrder(sequence = "5")
	public java.net.URL externalLink(@Named("URL sin 'http://'")final String urlString) {
		URL url = null;

		try {
			url = new URL("http://" + urlString);
		} catch (MalformedURLException e) {

			container.warnUser("Formato de URL incorrecto");
		}
		return url;
	}

	// }}

	// region > injected services
	// //////////////////////////////////////

	@javax.inject.Inject
	DomainObjectContainer container;
	@javax.inject.Inject
	MementoService mementoService;

	// endregion

}


text:
angular.module('Controllers')
.controller('SettingController', function($scope, FS, DB, Stat, H, Config) {
  $scope.IOing = false;
  $scope.algos = ['Random', 'Sequential'];
  $scope.companies = ['Apple', 'Amazon', 'Facebook', 'Google', 'Microsoft'];
  $scope.counts = ['1', '2', '4', '8', '16'];
  $scope.filters = [
    {name: 'All', status: '1', tag: '', company: ''},
    {name: 'UnResolved', status: '0', tag: '', company: ''}
  ];
  $scope.Config = Config;
  $scope.FS = FS;

  $scope.init = function() {
    $scope.filter = Stat.filter;
    $scope.updated = Stat.updated;
    $scope.tags = Stat.tags;
    $scope.tags.forEach(function(tag) {
      $scope.filters.push({name: tag, status: '1', tag: tag, company: ''});
    });
  };

  $scope.setFilter = function(f) {
    _.extendOwn($scope.filter, _.omit(f, 'name'));
  };

  function prettyNumber(n) {
    return '' + n + '';
  }

  $scope.backup = function() {
    $scope.IOing = true;
    H.loading('Preparing questions');

    DB.getQuestions()
      .then(function(questions) {
        if (!questions)
          return H.error('Backup Failed!', 'No questions found?');

        var n = prettyNumber(questions.length);
        H.loading('
Backuping ' + n + ' questions');

        FS.save(questions, function(e, filepath) {
          H.loading();
          if (e) {
            H.error('Backup Failed!', e.message);
          } else {
            H.ok('Backup Succeed!', '
Backuped ' + n + ' questions');
          }
          $scope.IOing = false;
        });
      });
  };

  $scope.restore = function() {
    H.yesOrNo(null, 'Are you sure to restore from last backup?')
      .then(function(yes) {
        if (!yes) return;

        // TODO: add file selection dialog
        $scope.IOing = true;
        H.loading('Preparing questions');

        FS.load(function(e, questions) {
          H.loading();
          if (e) {
            H.error('Resote Failed!', e.message);
            $scope.IOing = false;
            return;
          }

          var n = prettyNumber(questions.length);
          H.loading('
Restoring ' + n + ' questions');

          DB.setQuestions(questions)
            .then(function(e) {
              H.loading();
              if (e) {
                H.error('Resote Failed!', e.message);
              } else {
                H.ok('Restore Succeed!', '
Restored ' + n + ' questions');
                Stat.questions.dirty = true;
              }
              $scope.IOing = false;
            });
        });
      });
  };

  $scope.init();
});


text:
<?php

namespace App\Models;

class FleetConfig extends Base
{
    protected $table = 'fleet_configs';
    protected $fillable = ['fleet_id'];
    protected $casts = [
        'configs' => 'Array',
    ];
}


text:
package fr.ece.tweetstats.core.serviceapi;

import fr.ece.tweetstats.core.domain.Fetch;
import fr.ece.tweetstats.core.exception.FetchNotFoundException;
import java.util.List;

/**
 * Generated interface for the Service FetchService.
 */
public interface FetchService {

	public final static String BEAN_ID = "fetchService";

	public List<Fetch> getFetchesWithBrandAndAdjective(String brand, String adjective);

	public Fetch findById(String id) throws FetchNotFoundException;

	public List<Fetch> findAll();

	public Fetch save(Fetch entity);

	public void delete(Fetch entity);

}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Windows.Input;
using De.Osthus.Ambeth.Ioc;
using De.Osthus.Ambeth.Util;
using De.Osthus.Minerva.Core;
using AmbethIDataObject = De.Osthus.Ambeth.Model.IDataObject;
using De.Osthus.Ambeth.Log;

namespace De.Osthus.Minerva.Command
{
    public class SaveNotPersistedCommand : ControllerServiceCommand
    {
        [LogInstance]
		public new ILogger Log { private get; set; }

        // Persist all Changes:
        // (Note that a call to the Save method also deletes entities with ToBeDeleted flag!)
        public override void Execute(Object parameter)
        {
            base.Execute(parameter);
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using umbraco.interfaces;

namespace Umbraco.Web.Editors
{
    internal interface IEditorValidator : IDiscoverable
    {
        Type ModelType { get; }
        IEnumerable<ValidationResult> Validate(object model);
    }
}


text:
class User < ApplicationRecord
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

  validates :name, :last_name, presence: true
  validates :name, :last_name, length: { in: 2..50 }
  has_many :record_types, dependent: :destroy
  has_many :records, dependent: :destroy

  def full_name
    "#{name} #{last_name}"
  end
end


text:
package cz.metacentrum.perun.core.api.exceptions;

/**
 * This exception is thrown when group is not embedded in VO
 *
 * @author Johana Supíková
 */
public class GroupNotEmbeddedException extends PerunException {
	static final long serialVersionUID = 0;

	/**
	 * Simple constructor with a message
	 * @param message message with details about the cause
	 */
	public GroupNotEmbeddedException(String message) {
		super(message);
	}

	/**
	 * Constructor with a message and Throwable object
	 * @param message message with details about the cause
	 * @param cause Throwable that caused throwing of this exception
	 */
	public GroupNotEmbeddedException(String message, Throwable cause) {
		super(message, cause);
	}

	/**
	 * Constructor with a Throwable object
	 * @param cause Throwable that caused throwing of this exception
	 */
	public GroupNotEmbeddedException(Throwable cause) {
		super(cause);
	}
}


text:
+++
Title = "Habid Manzur"
#Twitter = ""
image = "Habib.png"
type = "speaker"
linktitle = "habid-manzur"
LinkedIn = "https://www.linkedin.com/in/habibmanzur/"

+++

I am a developer by vocation. self-taught, avid reader, I love to learn a little of everything and share it with others


text:
<?php

namespace App\Http\Forms;

use App\Models\ServiceCategory;
use Auth;
use Dimimo\BookletHelper\BookletHelper;
use Kris\LaravelFormBuilder\Form;

class ServiceForm extends Form
{
    public function buildForm()
    {
        $categories = ServiceCategory::all(['id', 'name'])->sortBy('name')->pluck('name', 'id')->toArray();
        $this->add('title', 'text', ['label'          => 'Title or name of the service (required)',
                                     'help_block'     => ['text' => 'fas fa-edit'],
                                     'rules'          => 'required|min:4|max:80',
                                     'error_messages' => ['title.required' => 'Please give a title',
                                                          'title.min'      => 'The title needs to be at least 4 chars long',
                                                          'title.max'      => 'Please shorten your title (max 80 chars)',
                                     ],
        ]);
        $this->add('body', 'textarea', ['label' => 'Detailed information (optional)']);
        $this->add('categories', 'select', array_merge(['choices'  => $categories,
                                                        'selected' => function ()
                                                        {
                                                            return $this->model->categories->pluck('id')->toArray();
                                                        },
                                                       ],
                                                       BookletHelper::buildFormAddWithIcon('Choose the categories of this service', 'categories', '', 'success',
                                                                                '', '', 'vendor.laravel-form-builder.select-icon', false, true)));
        $this->add('category_name', 'text', ['label' => 'or add a category (non-private business related)', 'help_block' => ['text' => 'far fa-plus-square']]);
        $this->add('city_id', 'text', ['label'          => 'Choose the city location (required)',
                                       'help_block'     => ['text' => 'fas fa-street-view'],
                                       'rules'          => 'required',
                                       'error_messages' => ['city_id.required' => 'Please provide a location'],
                                       'attr'           => ['placeholder' => '(Start typing)'],
        ]);
        $this->add('barangay_id', 'select', ['label' => 'Select a Barangay (optional)']);
        $this->add('barangay_name', 'text', ['label' => 'or add a barangay if it\'s not in the select list', 'help_block' => ['text' => 'fas fa-edit']]);
        $this->add('phone_number', 'tel', ['label' => 'Phone number (optional but preferred)', 'help_block' => ['text' => 'fas fa-phone']]);
        $this->add('email', 'email', ['label'          => 'Email address (optional)',
                                      'rules'          => 'sometimes|email',
                                      'help_block'     => ['text' => 'fas fa-at'],
                                      'error_messages' => ['email.email' => 'Please provide a valid email address'],
        ]);
        $this->add('url', 'url', ['label'          => 'If they have a website or a Facebook page, add it here (optional)',
                                  'help_block'     => ['text' => 'fas fa-link'],
                                  'rules'          => 'sometimes:url',
                                  'error_messages' => ['url.url' => 'Please enter a valid URL'],
                                  'attr'           => ['placeholder' => 'http://'],
        ]);
        $this->add('address1', 'text', ['label'          => 'Address line 1 (optional)',
                                        'help_block'     => ['text' => 'fas fa-address-card'],
                                        'rules'          => 'sometimes|min:4|max:100]',
                                        'error_messages' => ['address1.min' => 'Enter a minimum of 4 characters',
                                                             'address1.max' => 'Enter no more than 100 characters, use address line 2 to continue',
                                        ],
        ]);
        $this->add('address2', 'text', ['label'          => 'Address line 2 (optional)',
                                        'help_block'     => ['text' => 'fas fa-address-card'],
                                        'rules'          => 'sometimes|max:100]',
                                        'error_messages' => ['address2.max' => 'Enter no more than 100 characters, use address line 2 to continue'],
        ]);
        // only visible if the user is an admin (it's easy to make mistakes and hard to check for them)
        if (Auth::check() && Auth::user()->isAdmin())
        {

            $this->add('lat', 'text', ['label'          => 'Latitude (use a point, not a comma as the decimal symbol)',
                                       'help_block'     => ['text' => 'fas fa-map-marker'],
                                       'rules'          => 'sometimes|max:13]',
                                       'error_messages' => ['lat.max' => 'Enter no more than 13 characters',
                                       ],
            ]);
            $this->add('lng', 'text', ['label'          => 'Longitude',
                                       'help_block'     => ['text' => 'fas fa-map-marker'],
                                       'rules'          => 'sometimes|max:13',
                                       'error_messages' => ['lng.max' => 'Enter no more than 13 characters',
                                       ],
            ]);
            $this->add('icon', 'text', ['label'          => 'Google Maps Icon',
                                        'help_block'     => ['text' => 'fas fa-street-view'],
                                        'rules'          => 'sometimes|max:80',
                                        'error_messages' => ['lng.max' => 'Enter no more than 80 characters',
                                        ],
            ]);
        }
    }
}


text:
@interface RUDrinkAtViewController : UITableViewController <CLLocationManagerDelegate> {
    NSMutableArray * localBars;
}

- (IBAction)doneTapped:(id)sender;

@end


text:
<?xml version="1.0" encoding="utf-8"?>

<animation-list android:id="@+id/selected" android:oneshot="false" xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/on_going_background0" android:duration="100" />
    <item android:drawable="@drawable/on_going_background1" android:duration="100" />
    <item android:drawable="@drawable/on_going_background2" android:duration="100" />
    <item android:drawable="@drawable/on_going_background3" android:duration="100" />
    <item android:drawable="@drawable/on_going_background4" android:duration="100" />
    <item android:drawable="@drawable/on_going_background5" android:duration="100" />
    <item android:drawable="@drawable/on_going_background6" android:duration="100" />
    <item android:drawable="@drawable/on_going_background7" android:duration="100" />
    <item android:drawable="@drawable/on_going_background8" android:duration="100" />
    <item android:drawable="@drawable/on_going_background9" android:duration="100" />
    <item android:drawable="@drawable/on_going_backgrounda" android:duration="100" />
    <item android:drawable="@drawable/on_going_background9" android:duration="100" />
    <item android:drawable="@drawable/on_going_background8" android:duration="100" />
    <item android:drawable="@drawable/on_going_background7" android:duration="100" />
    <item android:drawable="@drawable/on_going_background6" android:duration="100" />
    <item android:drawable="@drawable/on_going_background5" android:duration="100" />
    <item android:drawable="@drawable/on_going_background4" android:duration="100" />
    <item android:drawable="@drawable/on_going_background3" android:duration="100" />
    <item android:drawable="@drawable/on_going_background2" android:duration="100" />
    <item android:drawable="@drawable/on_going_background1" android:duration="100" />
</animation-list>


text:
//  boost lockfree: copy_payload helper
//
//  Copyright (C) 2011 Tim Blechmann
//
//  Distributed under the Boost Software License, Version 1.0. (See
//  accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED
#define BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED

#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_convertible.hpp>

namespace boost    {
namespace lockfree {
namespace detail   {

struct copy_convertible
{
    template <typename T, typename U>
    static void copy(T & t, U & u)
    {
        u = t;
    }
};

struct copy_constructible_and_copyable
{
    template <typename T, typename U>
    static void copy(T & t, U & u)
    {
        u = U(t);
    }
};

template <typename T, typename U>
void copy_payload(T & t, U & u)
{
    typedef typename boost::mpl::if_<typename boost::is_convertible<T, U>::type,
                                     copy_convertible,
                                     copy_constructible_and_copyable
                                    >::type copy_type;
    copy_type::copy(t, u);
}

template <typename T>
struct consume_via_copy
{
    consume_via_copy(T & out):
        out_(out)
    {}

    template <typename U>
    void operator()(U & element)
    {
        copy_payload(element, out_);
    }

    T & out_;
};

}}}

#endif  /* BOOST_LOCKFREE_DETAIL_COPY_PAYLOAD_HPP_INCLUDED */


text:
module Magnum::Integration
  class Bitbucket < Base
  end
end


text:
using System.Collections.Generic;
using System.Linq;

namespace Azure.IoT.TimeSeriesInsights
{
    /// <summary> Model factory for read-only models. </summary>
    public static partial class TimeSeriesInsightsModelFactory
    {
        /// <summary> Initializes a new instance of TimeSeriesOperationError. </summary>
        /// <param name="code"> Language-independent, human-readable string that defines a service-specific error code. This code serves as a more specific indicator for the HTTP error code specified in the response. Can be used to programmatically handle specific error cases. </param>
        /// <param name="message"> Human-readable, language-independent representation of the error. It is intended as an aid to developers and is not suitable for exposure to end users. </param>
        /// <param name="target"> Target of the particular error (for example, the name of the property in error). May be null. </param>
        /// <param name="innerError"> Contains more specific error that narrows down the cause. May be null. </param>
        /// <param name="details"> Contains additional error information. May be null. </param>
        /// <param name="additionalProperties"> Additional Properties. </param>
        /// <returns> A new <see cref="TimeSeriesInsights.TimeSeriesOperationError"/> instance for mocking. </returns>
        public static TimeSeriesOperationError TimeSeriesOperationError(string code = null, string message = null, string target = null, TimeSeriesOperationError innerError = null, IEnumerable<TimeSeriesOperationErrorDetails> details = null, IReadOnlyDictionary<string, object> additionalProperties = null)
        {
            details ??= new List<TimeSeriesOperationErrorDetails>();
            additionalProperties ??= new Dictionary<string, object>();

            return new TimeSeriesOperationError(code, message, target, innerError, details?.ToList(), additionalProperties);
        }

        /// <summary> Initializes a new instance of TimeSeriesOperationErrorDetails. </summary>
        /// <param name="code"> Language-independent, human-readable string that defines a service-specific error code. This code serves as a more specific indicator for the HTTP error code specified in the response. Can be used to programmatically handle specific error cases. </param>
        /// <param name="message"> Human-readable, language-independent representation of the error. It is intended as an aid to developers and is not suitable for exposure to end users. </param>
        /// <param name="additionalProperties"> Additional Properties. </param>
        /// <returns> A new <see cref="TimeSeriesInsights.TimeSeriesOperationErrorDetails"/> instance for mocking. </returns>
        public static TimeSeriesOperationErrorDetails TimeSeriesOperationErrorDetails(string code = null, string message = null, IReadOnlyDictionary<string, object> additionalProperties = null)
        {
            additionalProperties ??= new Dictionary<string, object>();

            return new TimeSeriesOperationErrorDetails(code, message, additionalProperties);
        }

        /// <summary> Initializes a new instance of TimeSeriesModelSettings. </summary>
        /// <param name="name"> Time series model display name which is shown in the UX. Examples: "Temperature Sensors", "MyDevices". </param>
        /// <param name="timeSeriesIdProperties"> Time series ID properties defined during environment creation. </param>
        /// <param name="defaultTypeId"> Default type ID of the model that new time series instances will automatically belong to. </param>
        /// <returns> A new <see cref="TimeSeriesInsights.TimeSeriesModelSettings"/> instance for mocking. </returns>
        public static TimeSeriesModelSettings TimeSeriesModelSettings(string name = null, IEnumerable<TimeSeriesIdProperty> timeSeriesIdProperties = null, string defaultTypeId = null)
        {
            timeSeriesIdProperties ??= new List<TimeSeriesIdProperty>();

            return new TimeSeriesModelSettings(name, timeSeriesIdProperties?.ToList(), defaultTypeId);
        }

        /// <summary> Initializes a new instance of TimeSeriesIdProperty. </summary>
        /// <param name="name"> The name of the property. </param>
        /// <param name="type"> The type of the property. Currently, only "String" is supported. </param>
        /// <returns> A new <see cref="TimeSeriesInsights.TimeSeriesIdProperty"/> instance for mocking. </returns>
        public static TimeSeriesIdProperty TimeSeriesIdProperty(string name = null, TimeSeriesIdPropertyType? type = null)
        {
            return new TimeSeriesIdProperty(name, type);
        }

        /// <summary> Initializes a new instance of InstancesOperationResult. </summary>
        /// <param name="instance"> Time series instance object - set when the operation is successful (except put operation). </param>
        /// <param name="error"> Error object - set when the operation is unsuccessful. </param>
        /// <returns> A new <see cref="TimeSeriesInsights.InstancesOperationResult"/> instance for mocking. </returns>
        public static InstancesOperationResult InstancesOperationResult(TimeSeriesInstance instance = null, TimeSeriesOperationError error = null)
        {
            return new InstancesOperationResult(instance, error);
        }

        /// <summary> Initializes a new instance of TimeSeriesTypeOperationResult. </summary>
        /// <param name="timeSeriesType"> Time series type object - set when the operation is successful. </param>
        /// <param name="error"> Error object - set when the operation is unsuccessful. </param>
        /// <returns> A new <see cref="TimeSeriesInsights.TimeSeriesTypeOperationResult"/> instance for mocking. </returns>
        public static TimeSeriesTypeOperationResult TimeSeriesTypeOperationResult(TimeSeriesType timeSeriesType = null, TimeSeriesOperationError error = null)
        {
            return new TimeSeriesTypeOperationResult(timeSeriesType, error);
        }

        /// <summary> Initializes a new instance of TimeSeriesHierarchyOperationResult. </summary>
        /// <param name="hierarchy"> Time series hierarchy object - set when the operation is successful. </param>
        /// <param name="error"> Error object - set when the operation is unsuccessful. </param>
        /// <returns> A new <see cref="TimeSeriesInsights.TimeSeriesHierarchyOperationResult"/> instance for mocking. </returns>
        public static TimeSeriesHierarchyOperationResult TimeSeriesHierarchyOperationResult(TimeSeriesHierarchy hierarchy = null, TimeSeriesOperationError error = null)
        {
            return new TimeSeriesHierarchyOperationResult(hierarchy, error);
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:p="http://www.springframework.org/schema/p"
  xmlns:util="http://www.springframework.org/schema/util"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
					  http://www.springframework.org/schema/beans/spring-beans.xsd
					  http://www.springframework.org/schema/context
					  http://www.springframework.org/schema/context/spring-context.xsd
                      http://www.springframework.org/schema/util
                      http://www.springframework.org/schema/util/spring-util.xsd">

	<context:annotation-config/>

	<bean id="root" class="org.restlet.ext.spring.SpringRouter" p:attachments-ref="attachmentsMap" />

    <util:map id="attachmentsMap">
        <entry key="/tickets">
            <bean class="org.restlet.ext.spring.SpringFinder">
                <lookup-method name="create" bean="ticketResource" />
            </bean>
        </entry>
        <entry key="/tickets/{ticketGrantingTicketId}">
            <bean class="org.restlet.ext.spring.SpringFinder">
                <lookup-method name="create" bean="ticketGrantingTicketResource" />
            </bean>
        </entry>
    </util:map>

	<bean id="ticketResource" class="org.jasig.cas.integration.restlet.TicketResource" scope="prototype" />

	<bean id="ticketGrantingTicketResource" class="org.jasig.cas.integration.restlet.TicketGrantingTicketResource" scope="prototype" />

</beans>