text:
<?php

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

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

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

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

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

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

    /** 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 = 4;

    /** the column name for the idexpenseitem field */
    const IDEXPENSEITEM = 'expenseitem.idexpenseitem';

    /** the column name for the idexpensecategory field */
    const IDEXPENSECATEGORY = 'expenseitem.idexpensecategory';

    /** the column name for the expenseitem_name field */
    const EXPENSEITEM_NAME = 'expenseitem.expenseitem_name';

    /** the column name for the expenseitem_description field */
    const EXPENSEITEM_DESCRIPTION = 'expenseitem.expenseitem_description';

    /** 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 Expenseitem objects.
     * This must be public so that other peer classes can access this when hydrating from JOIN
     * queries.
     * @var        array Expenseitem[]
     */
    public static $instances = array();

    /**
     * holds an array of fieldnames
     *
     * first dimension keys are the type constants
     * e.g. ExpenseitemPeer::$fieldNames[ExpenseitemPeer::TYPE_PHPNAME][0] = 'Id'
     */
    protected static $fieldNames = array (
        BasePeer::TYPE_PHPNAME => array ('Idexpenseitem', 'Idexpensecategory', 'ExpenseitemName', 'ExpenseitemDescription', ),
        BasePeer::TYPE_STUDLYPHPNAME => array ('idexpenseitem', 'idexpensecategory', 'expenseitemName', 'expenseitemDescription', ),
        BasePeer::TYPE_COLNAME => array (ExpenseitemPeer::IDEXPENSEITEM, ExpenseitemPeer::IDEXPENSECATEGORY, ExpenseitemPeer::EXPENSEITEM_NAME, ExpenseitemPeer::EXPENSEITEM_DESCRIPTION, ),
        BasePeer::TYPE_RAW_COLNAME => array ('IDEXPENSEITEM', 'IDEXPENSECATEGORY', 'EXPENSEITEM_NAME', 'EXPENSEITEM_DESCRIPTION', ),
        BasePeer::TYPE_FIELDNAME => array ('idexpenseitem', 'idexpensecategory', 'expenseitem_name', 'expenseitem_description', ),
        BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
    );

    /**
     * holds an array of keys for quick access to the fieldnames array
     *
     * first dimension keys are the type constants
     * e.g. ExpenseitemPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
     */
    protected static $fieldKeys = array (
        BasePeer::TYPE_PHPNAME => array ('Idexpenseitem' => 0, 'Idexpensecategory' => 1, 'ExpenseitemName' => 2, 'ExpenseitemDescription' => 3, ),
        BasePeer::TYPE_STUDLYPHPNAME => array ('idexpenseitem' => 0, 'idexpensecategory' => 1, 'expenseitemName' => 2, 'expenseitemDescription' => 3, ),
        BasePeer::TYPE_COLNAME => array (ExpenseitemPeer::IDEXPENSEITEM => 0, ExpenseitemPeer::IDEXPENSECATEGORY => 1, ExpenseitemPeer::EXPENSEITEM_NAME => 2, ExpenseitemPeer::EXPENSEITEM_DESCRIPTION => 3, ),
        BasePeer::TYPE_RAW_COLNAME => array ('IDEXPENSEITEM' => 0, 'IDEXPENSECATEGORY' => 1, 'EXPENSEITEM_NAME' => 2, 'EXPENSEITEM_DESCRIPTION' => 3, ),
        BasePeer::TYPE_FIELDNAME => array ('idexpenseitem' => 0, 'idexpensecategory' => 1, 'expenseitem_name' => 2, 'expenseitem_description' => 3, ),
        BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
    );

    /**
     * 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 = ExpenseitemPeer::getFieldNames($toType);
        $key = isset(ExpenseitemPeer::$fieldKeys[$fromType][$name]) ? ExpenseitemPeer::$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(ExpenseitemPeer::$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, ExpenseitemPeer::$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 ExpenseitemPeer::$fieldNames[$type];
    }

    /**
     * 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. ExpenseitemPeer::COLUMN_NAME).
     * @return string
     */
    public static function alias($alias, $column)
    {
        return str_replace(ExpenseitemPeer::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(ExpenseitemPeer::IDEXPENSEITEM);
            $criteria->addSelectColumn(ExpenseitemPeer::IDEXPENSECATEGORY);
            $criteria->addSelectColumn(ExpenseitemPeer::EXPENSEITEM_NAME);
            $criteria->addSelectColumn(ExpenseitemPeer::EXPENSEITEM_DESCRIPTION);
        } else {
            $criteria->addSelectColumn($alias . '.idexpenseitem');
            $criteria->addSelectColumn($alias . '.idexpensecategory');
            $criteria->addSelectColumn($alias . '.expenseitem_name');
            $criteria->addSelectColumn($alias . '.expenseitem_description');
        }
    }

    /**
     * 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(ExpenseitemPeer::TABLE_NAME);

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

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

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

        if ($con === null) {
            $con = Propel::getConnection(ExpenseitemPeer::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 Expenseitem
     * @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 = ExpenseitemPeer::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 ExpenseitemPeer::populateObjects(ExpenseitemPeer::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(ExpenseitemPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }

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

        // Set the correct dbName
        $criteria->setDbName(ExpenseitemPeer::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 Expenseitem $obj A Expenseitem 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->getIdexpenseitem();
            } // if key === null
            ExpenseitemPeer::$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 Expenseitem 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 Expenseitem) {
                $key = (string) $value->getIdexpenseitem();
            } 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 Expenseitem object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
                throw $e;
            }

            unset(ExpenseitemPeer::$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 Expenseitem 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(ExpenseitemPeer::$instances[$key])) {
                return ExpenseitemPeer::$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 (ExpenseitemPeer::$instances as $instance) {
          $instance->clearAllReferences(true);
        }
      }
        ExpenseitemPeer::$instances = array();
    }

    /**
     * Method to invalidate the instance pool of all tables related to expenseitem
     * by a foreign key with ON DELETE CASCADE
     */
    public static function clearRelatedInstancePool()
    {
        // Invalidate objects in ExpenserecurrencyPeer instance pool,
        // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
        ExpenserecurrencyPeer::clearInstancePool();
        // Invalidate objects in ExpensetransactionPeer instance pool,
        // since one or more of them may be deleted by ON DELETE CASCADE/SETNULL rule.
        ExpensetransactionPeer::clearInstancePool();
    }

    /**
     * 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 = ExpenseitemPeer::getOMClass();
        // populate the object(s)
        while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $key = ExpenseitemPeer::getPrimaryKeyHashFromRow($row, 0);
            if (null !== ($obj = ExpenseitemPeer::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;
                ExpenseitemPeer::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 (Expenseitem object, last column rank)
     */
    public static function populateObject($row, $startcol = 0)
    {
        $key = ExpenseitemPeer::getPrimaryKeyHashFromRow($row, $startcol);
        if (null !== ($obj = ExpenseitemPeer::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 + ExpenseitemPeer::NUM_HYDRATE_COLUMNS;
        } else {
            $cls = ExpenseitemPeer::OM_CLASS;
            $obj = new $cls();
            $col = $obj->hydrate($row, $startcol);
            ExpenseitemPeer::addInstanceToPool($obj, $key);
        }

        return array($obj, $col);
    }

    /**
     * Returns the number of rows matching criteria, joining the related Expensecategory 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 doCountJoinExpensecategory(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(ExpenseitemPeer::TABLE_NAME);

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

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

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

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

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

        $criteria->addJoin(ExpenseitemPeer::IDEXPENSECATEGORY, ExpensecategoryPeer::IDEXPENSECATEGORY, $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 Expenseitem objects pre-filled with their Expensecategory 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 Expenseitem objects.
     * @throws PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function doSelectJoinExpensecategory(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(ExpenseitemPeer::DATABASE_NAME);
        }

        ExpenseitemPeer::addSelectColumns($criteria);
        $startcol = ExpenseitemPeer::NUM_HYDRATE_COLUMNS;
        ExpensecategoryPeer::addSelectColumns($criteria);

        $criteria->addJoin(ExpenseitemPeer::IDEXPENSECATEGORY, ExpensecategoryPeer::IDEXPENSECATEGORY, $join_behavior);

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

        while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $key1 = ExpenseitemPeer::getPrimaryKeyHashFromRow($row, 0);
            if (null !== ($obj1 = ExpenseitemPeer::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 = ExpenseitemPeer::getOMClass();

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

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

                    $cls = ExpensecategoryPeer::getOMClass();

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

                // Add the $obj1 (Expenseitem) to $obj2 (Expensecategory)
                $obj2->addExpenseitem($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(ExpenseitemPeer::TABLE_NAME);

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

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

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

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

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

        $criteria->addJoin(ExpenseitemPeer::IDEXPENSECATEGORY, ExpensecategoryPeer::IDEXPENSECATEGORY, $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 Expenseitem 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 Expenseitem 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(ExpenseitemPeer::DATABASE_NAME);
        }

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

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

        $criteria->addJoin(ExpenseitemPeer::IDEXPENSECATEGORY, ExpensecategoryPeer::IDEXPENSECATEGORY, $join_behavior);

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

        while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
            $key1 = ExpenseitemPeer::getPrimaryKeyHashFromRow($row, 0);
            if (null !== ($obj1 = ExpenseitemPeer::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 = ExpenseitemPeer::getOMClass();

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

            // Add objects for joined Expensecategory rows

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

                    $cls = ExpensecategoryPeer::getOMClass();

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

                // Add the $obj1 (Expenseitem) to the collection in $obj2 (Expensecategory)
                $obj2->addExpenseitem($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(ExpenseitemPeer::DATABASE_NAME)->getTable(ExpenseitemPeer::TABLE_NAME);
    }

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

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

    /**
     * Performs an INSERT on the database, given a Expenseitem or Criteria object.
     *
     * @param      mixed $values Criteria or Expenseitem 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(ExpenseitemPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
        }

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

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

        // Set the correct dbName
        $criteria->setDbName(ExpenseitemPeer::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 Expenseitem or Criteria object.
     *
     * @param      mixed $values Criteria or Expenseitem 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(ExpenseitemPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
        }

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

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

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

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

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

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

    /**
     * Deletes all rows from the expenseitem 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(ExpenseitemPeer::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 += ExpenseitemPeer::doOnDeleteCascade(new Criteria(ExpenseitemPeer::DATABASE_NAME), $con);
            $affectedRows += BasePeer::doDeleteAll(ExpenseitemPeer::TABLE_NAME, $con, ExpenseitemPeer::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).
            ExpenseitemPeer::clearInstancePool();
            ExpenseitemPeer::clearRelatedInstancePool();
            $con->commit();

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

    /**
     * Performs a DELETE on the database, given a Expenseitem or Criteria object OR a primary key value.
     *
     * @param      mixed $values Criteria or Expenseitem 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(ExpenseitemPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
        }

        if ($values instanceof Criteria) {
            // rename for clarity
            $criteria = clone $values;
        } elseif ($values instanceof Expenseitem) { // it's a model object
            // create criteria based on pk values
            $criteria = $values->buildPkeyCriteria();
        } else { // it's a primary key, or an array of pks
            $criteria = new Criteria(ExpenseitemPeer::DATABASE_NAME);
            $criteria->add(ExpenseitemPeer::IDEXPENSEITEM, (array) $values, Criteria::IN);
        }

        // Set the correct dbName
        $criteria->setDbName(ExpenseitemPeer::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();

            // cloning the Criteria in case it's modified by doSelect() or doSelectStmt()
            $c = clone $criteria;
            $affectedRows += ExpenseitemPeer::doOnDeleteCascade($c, $con);

            // 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).
            if ($values instanceof Criteria) {
                ExpenseitemPeer::clearInstancePool();
            } elseif ($values instanceof Expenseitem) { // it's a model object
                ExpenseitemPeer::removeInstanceFromPool($values);
            } else { // it's a primary key, or an array of pks
                foreach ((array) $values as $singleval) {
                    ExpenseitemPeer::removeInstanceFromPool($singleval);
                }
            }

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

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

    /**
     * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
     * feature (like MySQL or SQLite).
     *
     * This method is not very speedy because it must perform a query first to get
     * the implicated records and then perform the deletes by calling those Peer classes.
     *
     * This method should be used within a transaction if possible.
     *
     * @param      Criteria $criteria
     * @param      PropelPDO $con
     * @return int The number of affected rows (if supported by underlying database driver).
     */
    protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
    {
        // initialize var to track total num of affected rows
        $affectedRows = 0;

        // first find the objects that are implicated by the $criteria
        $objects = ExpenseitemPeer::doSelect($criteria, $con);
        foreach ($objects as $obj) {

            // delete related Expenserecurrency objects
            $criteria = new Criteria(ExpenserecurrencyPeer::DATABASE_NAME);

            $criteria->add(ExpenserecurrencyPeer::IDEXPENSEITEM, $obj->getIdexpenseitem());
            $affectedRows += ExpenserecurrencyPeer::doDelete($criteria, $con);

            // delete related Expensetransaction objects
            $criteria = new Criteria(ExpensetransactionPeer::DATABASE_NAME);

            $criteria->add(ExpensetransactionPeer::IDEXPENSEITEM, $obj->getIdexpenseitem());
            $affectedRows += ExpensetransactionPeer::doDelete($criteria, $con);
        }

        return $affectedRows;
    }

    /**
     * Validates all modified columns of given Expenseitem 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 Expenseitem $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(ExpenseitemPeer::DATABASE_NAME);
            $tableMap = $dbMap->getTable(ExpenseitemPeer::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(ExpenseitemPeer::DATABASE_NAME, ExpenseitemPeer::TABLE_NAME, $columns);
    }

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

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

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

        $criteria = new Criteria(ExpenseitemPeer::DATABASE_NAME);
        $criteria->add(ExpenseitemPeer::IDEXPENSEITEM, $pk);

        $v = ExpenseitemPeer::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 Expenseitem[]
     * @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(ExpenseitemPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }

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

        return $objs;
    }

} // BaseExpenseitemPeer

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


text:
var tagsearch = angular.module('tagsearch', [])
    .config([
      '$compileProvider',
      function ($compileProvider) {
          //  Default imgSrcSanitizationWhitelist: /^\s*((https?|ftp|file|blob):|data:image\/)/
          $compileProvider.imgSrcSanitizationWhitelist(/^\s*((https?|ftp|file|blob|chrome-extension):|data:image\/)/);
    }
]);

function Tag(name) {
    this.name = name;
    this.isCaching = false;
}

tagsearch.controller('searchController', function ($scope) {
    $scope.adress = "campexplorer.io";
    $scope.port = 80;

    $scope.albums = [];
    $scope.isSearching = false;
    $scope.isCachingTags = false;
    $scope.retryTime = 5;
    $scope.tags = [];
    $scope.latestRequestId = 0;

    $scope.currentVersion = "1.0.0";
    $scope.showVersionChangesQuestion = false;

    $scope.userSearchCount = 0;
    $scope.canShowReviewSuggestion = true;
    $scope.showReviewSuggestionNow = false;
    $scope.reviewSuggestionSearchCount = 50;

    chrome.storage.local.get({
          "lastUsedTags" : [],
          "userSearchCount" : 0,
          "canShowReviewSuggestion" : true
        }, result => {
            $scope.userSearchCount = result.userSearchCount;
            $scope.canShowReviewSuggestion = result.canShowReviewSuggestion;
            $scope.$apply(() => {
                result.lastUsedTags.forEach(x => { $scope.addTag(x); });
        });
    });

    showVersionChangeIfUpgraded();

  	$scope.addInputTag = function() {
        if($scope.tags.length >= 10) {
            return;
        }

  	    var newTag = $scope.newTag.replace(" ", "-");
  	    $scope.addTag(newTag);
  	    $scope.newTag = null;
        $scope.updateUserSearchCount();
   	};

   	$scope.addTag = function(tag) {
  	    if($scope.tags.map(x => x.name).indexOf(tag) == -1) {
    	      $scope.tags.push(new Tag(tag));
    	      $scope.searchTags();
  	    }
  	};

    $scope.updateUserSearchCount = function() {
        $scope.userSearchCount += 1;
        chrome.storage.local.set({ userSearchCount: $scope.userSearchCount });

        if($scope.canShowReviewSuggestion &&
          $scope.userSearchCount % $scope.reviewSuggestionSearchCount == 0)
        {
            $scope.showReviewSuggestionNow = true;
        }
    };

   	$scope.removeTag = function(tag) {
        var i = $scope.tags.indexOf(tag);
        if(i != -1) {
            $scope.tags.splice(i, 1);
        }
        $scope.searchTags();
  	};

    function showVersionChangeIfUpgraded() {
        $scope.currentVersion = chrome.app.getDetails().version;
        var previousVersion = localStorage['version']
        if ($scope.currentVersion != previousVersion) {
            if (typeof previousVersion != 'undefined') {
                $scope.showVersionChangesQuestion = true;
            }
            localStorage['version'] = $scope.currentVersion;
        }
    }

    $scope.neverShowSuggestion = function() {
        $scope.canShowReviewSuggestion = false;
        chrome.storage.local.set({ canShowReviewSuggestion: false });
    };

  	$scope.searchTags = function() {
        $scope.latestRequestId += 1;
        var requestId = $scope.latestRequestId;

        $scope.isSearching = true;
        chrome.storage.local.set({ lastUsedTags: $scope.tags.map(x => x.name) });
    		$scope.makeRequest($scope.tags.map(x => x.name), requestId, function(albums) {
            $scope.$apply(() => {
                $scope.albums = albums;
                $scope.isCachingTags = false;
                $scope.tags.forEach(x => x.isCaching = false);
                $scope.isSearching = false;
            });
		});
  	};

  	$scope.makeRequest = function(tags, requestId, onDone) {
        var retryCall = () => {
            setTimeout(() => {
                $scope.makeRequest(tags, requestId, onDone);
            }, $scope.retryTime*1000);
        };

        var xhr = new XMLHttpRequest();
        xhr.open("POST", "http://" + $scope.adress + ":" + $scope.port + "/v1/albums", true);
        xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
        xhr.onreadystatechange = () => {
            $scope.$apply(() => { $scope.serverUnreachable = false });

            if(xhr.readyState != 4 || requestId != $scope.latestRequestId) {
                return;
            }

            if(xhr.status == 200) {
                onDone(JSON.parse(xhr.responseText));
            }
            else if(xhr.status == 202) {
                var uncachedTags = JSON.parse(xhr.responseText).data;
                $scope.$apply(() => {
                  $scope.albums = [];
                  $scope.markUncachedTags(uncachedTags);
                });

                retryCall();
            }
        }
        xhr.onerror = () => {
            $scope.$apply(() => { $scope.serverUnreachable = true });
            retryCall();
        }

        xhr.send(JSON.stringify(tags));
  	};

    $scope.markUncachedTags = function(uncachedTags) {
        $scope.isCachingTags = true;
        $scope.tags.forEach(tag => { tag.isCaching = false });

        uncachedTags.forEach(tag => {
            var matchingIndex = $scope.tags.map(x => x.name).indexOf(tag);
            if(matchingIndex != -1) {
                $scope.tags[matchingIndex].isCaching = true;
            }
        })
    };
});

redpajama_set_name: RedPajamaGithub


text:
#ifndef TUDAT_FUNCTION_PROXY_H
#define TUDAT_FUNCTION_PROXY_H

#include <map>

#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp>

#include <Eigen/Core>

#include "Tudat/Mathematics/BasicMathematics/basicFunction.h"

namespace tudat
{
namespace basic_mathematics
{

//! Function interface to allow evaluation of a mathematical function.
/*!
 * Adds the ability for an already defined C++ function to be evaluated as a mathematical function.
 *
 * You need to set one C++ binding representing the mathematical function in the constructor.
 * Additional derivative and integral forms can be set using the addBinding function. If no
 * explicit binding is found, numerical techniques are used to solve for derivatives and integrals.
 * \tparam IndependentVariable Mathematical variable for independent input (e.g., x).
 * \tparam DependentVariable Mathematical variable for dependent output (e.g., y=f(x)).
 */
template< typename IndependentVariable = double, typename DependentVariable = double >
class FunctionProxy : public BasicFunction< IndependentVariable, DependentVariable >
{
public:

    // Useful definitions.
    typedef BasicFunction< IndependentVariable, DependentVariable >           Parent;
    typedef boost::function< DependentVariable( IndependentVariable ) >       FunctionSignature;
    typedef boost::shared_ptr< FunctionProxy >                                FunctionProxyPointer;

    //! Create a Function object, using a specified function pointer.
    /*!
     * \param realFunction C++ function that will be used to evaluate this mathematical function.
     */
    FunctionProxy( FunctionSignature realFunction ) : realFunction_( realFunction ) { }

    //! Evaluate the mathematical function.
    /*!
     * Performs simple delegation of the evaluation to the user set function.
     * \param independentVariable Location where to evaluate the function.
     * \see Function::evaluate( IndependentVariable ).
     */
    virtual DependentVariable evaluate( const IndependentVariable independentVariable )
    {
        return realFunction_( independentVariable );
    }

    //! Evaluate the derivative of the function.
    /*!
     * This evaluates the derivative of a given order of this function.
     * \param order                   Order of the derivative to evaluate.
     * \param independentVariable     Location where to evaluate the derivative.
     */
    DependentVariable computeDerivative( const unsigned int order,
                                         const IndependentVariable independentVariable )
    {
        // Find the corresponding function and evaluate it immediately at x.
        return findBinding( -static_cast< int >( order ) )( independentVariable );
    }

    //! Add a binding for an explicit form of a function derivative or integral.
    /*!
     * Using this method, you can bind additional C++ functions to either a specific derivative or
     * an integral of the base function.
     *
     * Don't add 0th order binding: it is bound separately (constructor) so no table lookup is
     * required.
     *
     * \param order Order of integration (negative for a derivative function).
     */
    void addBinding( const int order, FunctionSignature function )
    {
        functionCallTable_[ order ] = function;
    }

    //! Get a function representing the derivative or integral previously set.
    /*!
     * Retrieves a binding that was set using FunctionProxy::addBinding(int, FunctionSignature)
     * \param order Order of integration (negative for a derivative function).
     */
    FunctionSignature findBinding( int order = 0 )
    {
        // If 0th order, return the function itself.
        if ( order == 0 )
        {
            return realFunction_;
        }

        // Otherwise perform table lookup and return corresponding binding.
        return functionCallTable_.find( order )->second;
    }

protected:

private:

    //! Function representing the 0th order of this mathematical function.
    FunctionSignature realFunction_;

    //! Lookup table used to find explicit derivative or integral forms.
    std::map< int, FunctionSignature >  functionCallTable_;
};

// Type definitions for the commonly used double form.
typedef FunctionProxy< double, double >         UnivariateProxy;
typedef UnivariateProxy::FunctionSignature      UnivariateSignature;
typedef UnivariateProxy::FunctionProxyPointer   UnivariateProxyPointer;

//! Factory for creating a UnivariateProxyPointer from a C++ function UnivariateSignature.
/*!
 * \param function C++ function representing the mathematical function.
 */
inline UnivariateProxyPointer univariateProxy( UnivariateSignature function )
{
    // Return shared pointer to univariate function.
    return boost::make_shared< UnivariateProxy >( function );
}

//! Factory for creating a UnivaritateProxyPtr from a C++ function UnivariateSignature, with one
//! additional binding.
/*!
 * \param function  C++ function representing the mathematical function.
 * \param order1    Order of the additional derivative or integral function, i.e. order of
 *                  function1.
 * \param function1 Additional derivative or integral representation to bind.
 */
inline UnivariateProxyPointer univariateProxy( UnivariateSignature function,
                                               const int order1, UnivariateSignature function1 )
{
    // Create shared pointer to univariate function.
    UnivariateProxyPointer functionPointer = boost::make_shared< UnivariateProxy >( function );

    // Add a binding for an explicit form of the function derivative or integral.
    functionPointer->addBinding( order1, function1 );

    // Return function pointer.
    return functionPointer;
}

//! Factory for creating a UnivariateProxyPointer from a C++ function UnivariateSignature, with two
//! additional binding.
/*!
 * \param function  C++ function representing the mathematical function.
 * \param order1    Order of the first additional derivative or integral function, i.e. order of
 *                  function1.
 * \param function1 First additional derivative or integral representation to bind.
 * \param order2    Order of the second additional derivative or integral function, i.e. order of
 *                  function2.
 * \param function2 Second additional derivative or integral representation to bind.
 */
inline UnivariateProxyPointer univariateProxy( UnivariateSignature function,
                                               const int order1, UnivariateSignature function1,
                                               const int order2, UnivariateSignature function2 )
{
    // Create shared pointer to univariate function.
    UnivariateProxyPointer functionPointer = boost::make_shared< UnivariateProxy >( function );

    // Add bindings for the explicit form of the function derivative(s) or integral(s).
    functionPointer->addBinding( order1, function1 );
    functionPointer->addBinding( order2, function2 );

    // Return function pointer.
    return functionPointer;
}

//! Factory for creating a UnivariateProxyPointer from a C++ function UnivariateSignature, with three
//! additional binding.
/*!
 * \param function  C++ function representing the mathematical function.
 * \param order1    Order of the first additional derivative or integral function, i.e. order of
 *                  function1.
 * \param function1 First additional derivative or integral representation to bind.
 * \param order2    Order of the second additional derivative or integral function, i.e. order of
 *                  function2.
 * \param function2 Second additional derivative or integral representation to bind.
 * \param order3    Order of the third additional derivative or integral function, i.e. order of
 *                  function3.
 * \param function3 Third additional derivative or integral representation to bind.
 */
inline UnivariateProxyPointer univariateProxy( UnivariateSignature function,
                                               const int order1, UnivariateSignature function1,
                                               const int order2, UnivariateSignature function2,
                                               const int order3, UnivariateSignature function3 )
{
    // Create shared pointer to univariate function.
    UnivariateProxyPointer functionPointer = boost::make_shared< UnivariateProxy >( function );

    // Add bindings for the explicit form of the function derivative(s) or integral(s).
    functionPointer->addBinding( order1, function1 );
    functionPointer->addBinding( order2, function2 );
    functionPointer->addBinding( order3, function3 );

    // Return function pointer.
    return functionPointer;
}

} // namespace basic_mathematics
} // namespace tudat

#endif // TUDAT_FUNCTION_PROXY_H


text:
using NBitcoin;
using NBXplorer.DerivationStrategy;
using NBXplorer.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace NBXplorer.Backends
{
	public interface IRepository
	{
		int BatchSize { get; set; }
		int MaxPoolSize { get; set; }
		int MinPoolSize { get; set; }
		Money MinUtxoValue { get; set; }
		NBXplorerNetwork Network { get; }
		Serializer Serializer { get; }
		Task Prune(TrackedSource trackedSource, IEnumerable<TrackedTransaction> prunable);
		Task UpdateAddressPool(DerivationSchemeTrackedSource trackedSource, Dictionary<DerivationFeature, int?> highestKeyIndexFound);
		Task CancelReservation(DerivationStrategyBase strategy, KeyPath[] keyPaths);
		TrackedTransaction CreateTrackedTransaction(TrackedSource trackedSource, TrackedTransactionKey transactionKey, IEnumerable<Coin> coins, Dictionary<Script, KeyPath> knownScriptMapping);
		TrackedTransaction CreateTrackedTransaction(TrackedSource trackedSource, TrackedTransactionKey transactionKey, Transaction tx, Dictionary<Script, KeyPath> knownScriptMapping);
		ValueTask<int> DefragmentTables(CancellationToken cancellationToken = default);
		Task<int> GenerateAddresses(DerivationStrategyBase strategy, DerivationFeature derivationFeature, GenerateAddressQuery query = null);
		Task<int> GenerateAddresses(DerivationStrategyBase strategy, DerivationFeature derivationFeature, int maxAddresses);
		Task<IList<NewEventBase>> GetEvents(long lastEventId, int? limit = null);
		Task<BlockLocator> GetIndexProgress();
		Task<MultiValueDictionary<Script, KeyPathInformation>> GetKeyInformations(IList<Script> scripts);
		Task<IList<NewEventBase>> GetLatestEvents(int limit = 10);
		Task<TrackedTransaction[]> GetMatches(Block block, SlimChainedBlock slimBlock, DateTimeOffset now, bool useCache);
		Task<TrackedTransaction[]> GetMatches(IList<Transaction> txs, SlimChainedBlock slimBlock, DateTimeOffset now, bool useCache);
		Task<TrackedTransaction[]> GetMatches(Transaction tx, SlimChainedBlock slimBlock, DateTimeOffset now, bool useCache);
		Task<TMetadata> GetMetadata<TMetadata>(TrackedSource source, string key) where TMetadata : class;
		Task<Dictionary<OutPoint, TxOut>> GetOutPointToTxOut(IList<OutPoint> outPoints);
		Task<SavedTransaction[]> GetSavedTransactions(uint256 txid);
		Task<TrackedTransaction[]> GetTransactions(TrackedSource trackedSource, uint256 txId = null, bool needTx = true, CancellationToken cancellation = default);
		Task<KeyPathInformation> GetUnused(DerivationStrategyBase strategy, DerivationFeature derivationFeature, int n, bool reserve);
		ValueTask<bool> MigrateOutPoints(string directory, CancellationToken cancellationToken = default);
		ValueTask<int> MigrateSavedTransactions(CancellationToken cancellationToken = default);
		Task Ping();
		Task<long> SaveEvent(NewEventBase evt);
		Task SaveKeyInformations(KeyPathInformation[] keyPathInformations);
		Task SaveMatches(TrackedTransaction[] transactions);
		Task SaveMetadata<TMetadata>(TrackedSource source, string key, TMetadata value) where TMetadata : class;
		Task<List<SavedTransaction>> SaveTransactions(DateTimeOffset now, Transaction[] transactions, SlimChainedBlock slimBlock);
		Task SetIndexProgress(BlockLocator locator);
		Task Track(IDestination address);
		ValueTask<int> TrimmingEvents(int maxEvents, CancellationToken cancellationToken = default);
		Task<SlimChainedBlock> GetTip();
		Task SaveBlocks(IList<SlimChainedBlock> slimBlocks);
		Task EnsureWalletCreated(DerivationStrategyBase derivation);
	}
}


text:
'use strict';
const fetch = require('node-fetch');

const SERVER = "localhost";
const PORT = "8000";
const URL = `http://${SERVER}:${PORT}`

const user = {
  login: gen_token(4),
  password: gen_token(8),
};

const thread = {
  token: '',
  category: 1,
  title: 'yes!',
  text: gen_token(25),
};

//gen data {{{

function obj_to_param(obj) {
  return Object.keys(obj).map(function(key) {
    return key + '=' + obj[key];
  }).join('&');
}

function gen_num() {
  const min = 1;
  const max = 10000;
  return Math.random() * (max - min) + min;
}

function gen_token(len_token) {
  const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  let text = "";
  for (let i = 0; i < len_token; i++) {
    text += possible.charAt(Math.floor(Math.random() * possible.length));
  };
  return text;
} //}}}

function get_all_threads(category) { //{{{
  fetch(`${URL}/api/get/threads?${obj_to_param(category)}`)
    .then((res) => res.json())
    .then((json) => console.log('threads: ', json.body))
    .catch(error => console.log('threads error: ', error));
} //}}}

function get_all_categories() { //{{{
  fetch(`${URL}/api/get/categories`)
    .then((res) => res.json())
    .then((json) => console.log('categories: ', json.body))
    .catch(error => console.log('threads error: ', error));
} //}}}

function create_thread(thread) { //{{{
  console.log('thread will be created: ', thread);
  fetch(`${URL}/api/forum/create`, {
      headers: {
        'Content-Type': 'application/json'
      },
      method: 'POST',
      body: JSON.stringify(thread),
    })
    .then((res) => res.json())
    .then((json) => {
      console.log('thread: ', json)
    })
    .catch(error => console.log('post a post error: ', error));
} //}}}

function registration(user) { //{{{
  return fetch(`${URL}/api/auth/registration`, {
      headers: {
        'Content-Type': 'application/json'
      },
      method: 'POST',
      body: JSON.stringify(user),
    })
    .then((res) => res.json())
    .then((json) => {
      console.log(json.body);
      user.token = json.body.Token;
      return user;
    })
    .catch(error => console.log('get auth error: ', error));
} //}}}

// get_all_categories();
export default function forum () {
  registration(user).then(user => {
    thread.token = user.token;
    create_thread(thread);
    get_all_threads({
      category: 3
    });
    // console.log(user);
  });
}

forum();


text:
=========
Reference
=========

.. toctree::
    :maxdepth: 2

    pages/index
    images/index
    search/index
    snippets
    form_builder
    contrib/index
    management_commands
    hooks
    project_template


text:
server-of-calamari
==================

A Node/Express/Mongo companion to the son-of-calamari client. An ultralight event service.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>com.fasterxml.jackson.core.async (Jackson-core 2.14.0 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

com.fasterxml.jackson.core.async

Interfaces

ByteArrayFeeder

ByteBufferFeeder

NonBlockingInputFeeder


text:
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>Count Property</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />

            dotLua Documentation

LuaStack.Count Property

 Retrieves the amount of items on the stack. <remarks>Since LUA starts counting at 1, the index of the top item and the amount of items on the stack is equal. Thus Count only returns the value of TopIndex.</remarks>

public  Count {get;}

See Also

        LuaStack Class | dotLua Namespace


text:
package org.molecule.packet;

/**
 * Defines a set of methods that a packet uses to communicate with its packet
 * container, for example, to get the MIME type of a file, dispatch requests,
 * or write to a log file.
 *
 * @author jeremy
 */
public interface PacketContext {

}


text:
"""Quantum PLUMgrid Plugin exceptions"""

from quantum.common import exceptions as base_exec

class PLUMgridException(base_exec.QuantumException):
    message = _("An unexpected error occurred in the PLUMgrid Plugin: "
                "%(err_msg)s")

class PLUMgridConnectionFailed(PLUMgridException):
    message = _("Connection failed with PLUMgrid NOS: %(err_msg)s")


text:
def Textentry(question):
    print(question)
    value = int(input())
    #if (value).is_integer() == True:
    #    if value <= 5:
    #        return(value)
    #else:
    #    print('INVALID entry, please use a value between 1 and 5 only')
    #    Textentry()
    return(value)

eggs=0
bacons=0
hashs=0
pancakes=0
value=0
#--------------
def Egg():
    question='How many eggs do you want today?'
    value = Textentry(question)
#    global eggs
#    eggs = eggs+int(value)
    return value

def Bacon():
    question='How many pieces of bacon do you want today?'
    value = Textentry(question)
#    global bacons
#    bacons = bacons+int(value)
    return value

def Hash():
    question='How many hash browns do you want today?'
    value = Textentry(question)
#    global hashs
#    hashs = hashs+int(value)
    return value

def Pancake():
    question='How many pancakes do you want today?'
    value = Textentry(question)
#    global pancakes
#    pancakes = pancakes+int(value)
    return value

def Questions():
    global eggs
    global bacons
    global hashs
    global pancakes
    global eggst
    global baconst
    global hashst
    global pancakest
    if eggs == 0: #script start
        print('Welcome to your local breakfast diner, where we serve only the best breakfast! but you must work your way up to the better meals!')
    print('------')#break code sectional output
##----------------------------------## EGGS
    if eggs < 10:
        eggst = Egg()
    eggs = eggs+eggst

    print('you eat '+str(eggst)+' Eggs today. [[Total:'+str(eggs)+']]')
    #print(str(eggs))####troubleshooting output
##----------------------------------## BACON
    if eggs >= 10: #enough eggs
        if bacons == 0:
            print('You`ve eaten enough eggs to have bacon with breakfast!')
        if bacons < 10 :
            baconst = Bacon()
        bacons = bacons+baconst
        print('you eat '+str(baconst)+' bacon strips today [[Total:'+str(bacons)+']]')
##----------------------------------## HASH BROWNS
    if bacons >= 10: #enough bacon
        if hashs == 0:
            print('You`ve eaten enough bacon strips to have hash browns with breakfast!')
        if hashs < 10:
            hashst = Hash()
        hashs = hashs+hashst
        print('you eat '+str(hashst)+' hash browns today [[Total:'+str(hashs)+']]')
##----------------------------------## PANCAKES
    if hashs >= 10: #enough hash browns
        if pancakes == 0:
            print('You`ve eaten enough hash browns to have pancakes with breakfast!')
        pancakest = Pancake()
        pancakes = pancakes+pancakest
        print('you eat '+str(pancakest)+' pancakes today [[Total:'+str(pancakes)+']]')
##----------------------------------## END
    if pancakes >=10:
        print('I think you`ve eaten enough today.')
        print('You`ve eaten '+str(eggs)+' eggs, '+str(bacons)+' bacon, '+str(hashs)+' Hash browns, and '+str(pancakes)+' pancakes.')
        return
    #Ask again
    Questions()

#Start sequence
Questions()


text:
class ModuleDocFragment(object):

    # Standard cloudstack documentation fragment
    DOCUMENTATION = '''
options:
  api_key:
    description:
      - API key of the CloudStack API.
    required: false
    default: null
  api_secret:
    description:
      - Secret key of the CloudStack API.
    required: false
    default: null
  api_url:
    description:
      - URL of the CloudStack API e.g. https://cloud.example.com/client/api.
    required: false
    default: null
  api_http_method:
    description:
      - HTTP method used.
    required: false
    default: 'get'
    choices: [ 'get', 'post' ]
  api_timeout:
    description:
      - HTTP timeout.
    required: false
    default: 10
  api_region:
    description:
      - Name of the ini section in the C(cloustack.ini) file.
    required: false
    default: cloudstack
requirements:
  - "python >= 2.6"
  - "cs >= 0.6.10"
notes:
  - Ansible uses the C(cs) library's configuration method if credentials are not
    provided by the arguments C(api_url), C(api_key), C(api_secret).
    Configuration is read from several locations, in the following order.
    - The C(CLOUDSTACK_ENDPOINT), C(CLOUDSTACK_KEY), C(CLOUDSTACK_SECRET) and
      C(CLOUDSTACK_METHOD). C(CLOUDSTACK_TIMEOUT) environment variables.
    - A C(CLOUDSTACK_CONFIG) environment variable pointing to an C(.ini) file,
    - A C(cloudstack.ini) file in the current working directory.
    - A C(.cloudstack.ini) file in the users home directory.
    Optionally multiple credentials and endpoints can be specified using ini sections in C(cloudstack.ini).
    Use the argument C(api_region) to select the section name, default section is C(cloudstack).
    See https://github.com/exoscale/cs for more information.
  - A detailed guide about cloudstack modules can be found on http://docs.ansible.com/ansible/guide_cloudstack.html
  - This module supports check mode.
'''


text:
package com.happy.happyproject.model;

/**
 * 空间  的一级模型
 */
public class Space {
    private String id;
    private String name;
    private String thumb;
    private String  favs_count;
    private int comments_count;
    private int position;
    private int shares_count;

    public String  getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getThumb() {
        return thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb;
    }

    public String getFavs_count() {
        return favs_count;
    }

    public void setFavs_count(String favs_count) {
        this.favs_count = favs_count;
    }

    public int getComments_count() {
        return comments_count;
    }

    public void setComments_count(int comments_count) {
        this.comments_count = comments_count;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public int getShares_count() {
        return shares_count;
    }

    public void setShares_count(int shares_count) {
        this.shares_count = shares_count;
    }
}


text: extern int textual5;