text:
namespace mongocxx {
MONGOCXX_INLINE_NAMESPACE_BEGIN

class collection;

///
/// Class representing a batch of write operations that can be sent to the server as a group.
///
/// If you have a lot of write operations to execute, it can be more efficient to send them as
/// part of a bulk_write in order to avoid unnecessary network-level round trips between the driver
/// and the server.
///
/// Bulk writes affect a single collection only and are executed via the collection::bulk_write()
/// method. Options that you would typically specify for individual write operations (such as write
/// concern) are instead specified for the aggregate operation.
///
/// @see https://docs.mongodb.com/master/core/crud/
/// @see https://docs.mongodb.com/master/core/bulk-write-operations/
///
class MONGOCXX_API bulk_write {
   public:
    ///
    /// Initializes a new bulk operation to be executed against a mongocxx::collection.
    ///
    /// @param ordered
    ///   If @c true all write operations will be executed serially in the order they were appended
    ///   and the entire bulk operation will abort on the first error. If @c false operations will
    ///   be executed in an arbitrary order (possibly in parallel on the server) and any errors will
    ///   be reported after attempting all operations. Unordered bulk writes may be more efficient
    ///   than ordered bulk writes.
    ///
    explicit bulk_write(options::bulk_write options = {});

    ///
    /// Move constructs a bulk write operation.
    ///
    bulk_write(bulk_write&&) noexcept;

    ///
    /// Move assigns a bulk write operation.
    ///
    bulk_write& operator=(bulk_write&&) noexcept;

    ///
    /// Destroys a bulk write operation.
    ///
    ~bulk_write();

    ///
    /// Appends a single write to the bulk write operation. The write operation's contents are
    /// copied into the bulk operation completely, so there is no dependency between the life of an
    /// appended write operation and the bulk operation itself.
    ///
    /// @param operation
    ///   The write operation to append (an instance of model::write)
    ///
    ///   A model::write can be implicitly constructed from any of the following MongoDB models:
    ///
    ///     - model::insert_one
    ///     - model::delete_one
    ///     - model::replace_one
    ///     - model::update_many
    ///     - model::update_one
    ///
    /// @throws mongocxx::logic_error if the given operation is invalid.
    ///
    void append(const model::write& operation);

   private:
    friend class collection;

    class MONGOCXX_PRIVATE impl;
    std::unique_ptr<impl> _impl;
};

MONGOCXX_INLINE_NAMESPACE_END
}  // namespace mongocxx

#include <mongocxx/config/postlude.hpp>


text:
import numpy as np

def calculate_return(order):
    profit = (order.current_price - order.cost)*order.number
    profit_rate = profit / order.cost*order.number

    return (profit, profit_rate)

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OOPRPG.Classes
{
    public abstract class Item
    {
        #region Attributes
        public string Name { get; set; }
        public int StackLimit { get; set; }
        public bool TempBoost { get; set; }  //a poition or something that gives temp boost
        public bool Equipable { get; set; }  // gear a player can equip
        public int Value { get; set; } //cost to player to buy from store
        #endregion
    }
}


text:
import { Component, EventEmitter, Input, Output } from '@angular/core';

@Component({
  selector: 'app-toolbar',
  templateUrl: './toolbar.component.html',
  styleUrls: ['./toolbar.component.scss']
})
export class ToolbarComponent {
  @Input() mobile: boolean;
  @Output() logout = new EventEmitter();
  @Output() toggle = new EventEmitter();

  constructor() { }

  logoutUser() {
    this.logout.emit();
  }

  toggleNavbar() {
    this.toggle.emit();
  }
}


text:
import pytest

class TestMons(object):

    @pytest.mark.no_docker
    def test_ceph_mon_package_is_installed(self, node, host):
        assert host.package("ceph-mon").is_installed

    def test_mon_listens_on_6789(self, node, host):
        assert host.socket("tcp://%s:6789" % node["address"]).is_listening

    def test_mon_service_is_running(self, node, host):
        service_name = "ceph-mon@{hostname}".format(
            hostname=node["vars"]["inventory_hostname"]
        )
        assert host.service(service_name).is_running

    def test_mon_service_is_enabled(self, node, host):
        service_name = "ceph-mon@{hostname}".format(
            hostname=node["vars"]["inventory_hostname"]
        )
        assert host.service(service_name).is_enabled

    @pytest.mark.no_docker
    def test_can_get_cluster_health(self, node, host):
        cmd = "sudo ceph --cluster={} --connect-timeout 5 -s".format(node["cluster_name"])
        output = host.check_output(cmd)
        assert output.strip().startswith("cluster")

    def test_ceph_config_has_inital_members_line(self, node, File):
        assert File(node["conf_path"]).contains("^mon initial members = .*$")

    def test_initial_members_line_has_correct_value(self, node, File):
        mons = ",".join("%s" % host
                        for host in node["vars"]["groups"]["mons"])
        line = "mon initial members = {}".format(mons)
        assert File(node["conf_path"]).contains(line)

class TestOSDs(object):

    @pytest.mark.no_docker
    def test_all_osds_are_up_and_in(self, node, host):
        cmd = "sudo ceph --cluster={} --connect-timeout 5 -s".format(node["cluster_name"])
        output = host.check_output(cmd)
        phrase = "{num_osds} osds: {num_osds} up, {num_osds} in".format(num_osds=node["total_osds"])
        assert phrase in output

    @pytest.mark.docker
    def test_all_docker_osds_are_up_and_in(self, node, host):
        cmd = "sudo docker exec ceph-mon-{} ceph --cluster={} --connect-timeout 5 -s".format(
            node["vars"]["inventory_hostname"],
            node["cluster_name"]
        )
        output = host.check_output(cmd)
        phrase = "{num_osds} osds: {num_osds} up, {num_osds} in".format(num_osds=node["total_osds"])
        assert phrase in output


text:
set -e
apt-get install -y apache2 libapache2-mod-php5 tmux htop vim gearman-job-server libgearman-dev gearman-tools uuid-dev php5-gearman php5-cli php5-dev libjson-c-dev manpages-dev build-essential help2man gperf libtool rrdtool php5-rrd php5-mysqlnd php5-gd  unzip


text:
False
True
None  # 作为默认参数的初始值
NotImplemented
Ellipsis
# 以下不是用于项目的
'''
quit(code=None)
exit(code=None)
copyright
license
credits
'''


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
import { AltairModule } from './modules/altair/altair.module';

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    CommonModule,
    BrowserModule,
    AltairModule.forRoot(),
  ],
  bootstrap: [ AppComponent ],
})
export class AppModule {}


text:
this="${BASH_SOURCE-$0}"
common_bin=$(cd -P -- "$(dirname -- "${this}")" && pwd -P)
script="$(basename -- "${this}")"
this="${common_bin}/${script}"

# convert relative path to absolute path
config_bin=$(dirname "${this}")
script=$(basename "${this}")
config_bin=$(cd "${config_bin}"; pwd)
this="${config_bin}/${script}"

# This will set the default installation for a tarball installation while os distributors can
# set system installation locations.
VERSION=2.6.0-SNAPSHOT
ALLUXIO_HOME=$(dirname $(dirname "${this}"))
ALLUXIO_ASSEMBLY_CLIENT_JAR="${ALLUXIO_HOME}/assembly/client/target/alluxio-assembly-client-${VERSION}-jar-with-dependencies.jar"
ALLUXIO_ASSEMBLY_SERVER_JAR="${ALLUXIO_HOME}/assembly/server/target/alluxio-assembly-server-${VERSION}-jar-with-dependencies.jar"
ALLUXIO_CONF_DIR="${ALLUXIO_CONF_DIR:-${ALLUXIO_HOME}/conf}"
ALLUXIO_LOGS_DIR="${ALLUXIO_LOGS_DIR:-${ALLUXIO_HOME}/logs}"
ALLUXIO_USER_LOGS_DIR="${ALLUXIO_USER_LOGS_DIR:-${ALLUXIO_LOGS_DIR}/user}"

if [[ -e "${ALLUXIO_CONF_DIR}/alluxio-env.sh" ]]; then
  . "${ALLUXIO_CONF_DIR}/alluxio-env.sh"
fi

# Check if java is found
if [[ -z "${JAVA}" ]]; then
  if [[ -n "${JAVA_HOME}" ]] && [[ -x "${JAVA_HOME}/bin/java" ]];  then
    JAVA="${JAVA_HOME}/bin/java"
  elif [[ -n "$(which java 2>/dev/null)" ]]; then
    JAVA=$(which java)
  else
    echo "Error: Cannot find 'java' on path or under \$JAVA_HOME/bin/."
    exit 1
  fi
fi

# Check Java version == 1.8 or == 11
JAVA_VERSION=$(${JAVA} -version 2>&1 | awk -F '"' '/version/ {print $2}')
JAVA_MAJORMINOR=$(echo "${JAVA_VERSION}" | awk -F. '{printf("%03d%03d",$1,$2);}')
JAVA_MAJOR=$(echo "${JAVA_VERSION}" | awk -F. '{printf("%03d",$1);}')
if [[ ${JAVA_MAJORMINOR} != 001008 && ${JAVA_MAJOR} != 011 ]]; then
  echo "Error: Alluxio requires Java 8 or Java 11, currently Java $JAVA_VERSION found."
  exit 1
fi

if [[ -n "${ALLUXIO_HOME}" ]]; then
  ALLUXIO_JAVA_OPTS+=" -Dalluxio.home=${ALLUXIO_HOME}"
fi

ALLUXIO_JAVA_OPTS+=" -Dalluxio.conf.dir=${ALLUXIO_CONF_DIR} -Dalluxio.logs.dir=${ALLUXIO_LOGS_DIR} -Dalluxio.user.logs.dir=${ALLUXIO_USER_LOGS_DIR}"

if [[ -n "${ALLUXIO_RAM_FOLDER}" ]]; then
  ALLUXIO_JAVA_OPTS+=" -Dalluxio.worker.tieredstore.level0.alias=MEM"
  ALLUXIO_JAVA_OPTS+=" -Dalluxio.worker.tieredstore.level0.dirs.path=${ALLUXIO_RAM_FOLDER}"
fi

if [[ -n "${ALLUXIO_MASTER_HOSTNAME}" ]]; then
  ALLUXIO_JAVA_OPTS+=" -Dalluxio.master.hostname=${ALLUXIO_MASTER_HOSTNAME}"
fi

if [[ -n "${ALLUXIO_MASTER_MOUNT_TABLE_ROOT_UFS}" ]]; then
  ALLUXIO_JAVA_OPTS+=" -Dalluxio.master.mount.table.root.ufs=${ALLUXIO_MASTER_MOUNT_TABLE_ROOT_UFS}"
elif [[ -n "${ALLUXIO_UNDERFS_ADDRESS}" ]]; then
  echo "Warning: ALLUXIO_UNDERFS_ADDRESS is deprecated by ALLUXIO_MASTER_MOUNT_TABLE_ROOT_UFS"
  ALLUXIO_MASTER_MOUNT_TABLE_ROOT_UFS="${ALLUXIO_UNDERFS_ADDRESS}"
  ALLUXIO_JAVA_OPTS+=" -Dalluxio.master.mount.table.root.ufs=${ALLUXIO_MASTER_MOUNT_TABLE_ROOT_UFS}"
fi

# ALLUXIO_WORKER_MEMORY_SIZE is deprecated but kept for compatibility
if [[ -n "${ALLUXIO_WORKER_MEMORY_SIZE}" ]]; then
  ALLUXIO_JAVA_OPTS+=" -Dalluxio.worker.ramdisk.size=${ALLUXIO_WORKER_MEMORY_SIZE}"
fi

if [[ -n "${ALLUXIO_WORKER_RAMDISK_SIZE}" ]]; then
  ALLUXIO_JAVA_OPTS+=" -Dalluxio.worker.ramdisk.size=${ALLUXIO_WORKER_RAMDISK_SIZE}"
fi

ALLUXIO_JAVA_OPTS+=" -Dlog4j.configuration=file:${ALLUXIO_CONF_DIR}/log4j.properties"
ALLUXIO_JAVA_OPTS+=" -Dorg.apache.jasper.compiler.disablejsr199=true"
ALLUXIO_JAVA_OPTS+=" -Djava.net.preferIPv4Stack=true"
ALLUXIO_JAVA_OPTS+=" -Dorg.apache.ratis.thirdparty.io.netty.allocator.useCacheForAllThreads=false"

ALLUXIO_LOGSERVER_LOGS_DIR="${ALLUXIO_LOGSERVER_LOGS_DIR:-${ALLUXIO_HOME}/logs}"
if [[ -n "${ALLUXIO_LOGSERVER_HOSTNAME}" ]]; then
    ALLUXIO_JAVA_OPTS+=" -Dalluxio.logserver.hostname=${ALLUXIO_LOGSERVER_HOSTNAME}"
fi
if [[ -n "${ALLUXIO_LOGSERVER_PORT}" ]]; then
    ALLUXIO_JAVA_OPTS+=" -Dalluxio.logserver.port=${ALLUXIO_LOGSERVER_PORT}"
fi

# Job master specific parameters based on ALLUXIO_JAVA_OPTS.
ALLUXIO_JOB_MASTER_JAVA_OPTS+=${ALLUXIO_JAVA_OPTS}
ALLUXIO_JOB_MASTER_JAVA_OPTS+=" -Dalluxio.logger.type=${ALLUXIO_JOB_MASTER_LOGGER:-JOB_MASTER_LOGGER}"
if [[ -n "${ALLUXIO_LOGSERVER_HOSTNAME}" && -n "${ALLUXIO_LOGSERVER_PORT}" ]]; then
    ALLUXIO_JOB_MASTER_JAVA_OPTS+=" -Dalluxio.remote.logger.type=REMOTE_JOB_MASTER_LOGGER"
fi

# Job worker specific parameters based on ALLUXIO_JAVA_OPTS.
ALLUXIO_JOB_WORKER_JAVA_OPTS+=${ALLUXIO_JAVA_OPTS}
ALLUXIO_JOB_WORKER_JAVA_OPTS+=" -Dalluxio.logger.type=${ALLUXIO_JOB_WORKER_LOGGER:-JOB_WORKER_LOGGER}"
if [[ -n "${ALLUXIO_LOGSERVER_HOSTNAME}" && -n "${ALLUXIO_LOGSERVER_PORT}" ]]; then
    ALLUXIO_JOB_WORKER_JAVA_OPTS+=" -Dalluxio.remote.logger.type=REMOTE_JOB_WORKER_LOGGER"
fi

ALLUXIO_CLIENT_CLASSPATH="${ALLUXIO_CONF_DIR}/:${ALLUXIO_CLASSPATH}:${ALLUXIO_ASSEMBLY_CLIENT_JAR}:${ALLUXIO_HOME}/lib/alluxio-integration-tools-validation-${VERSION}.jar"
ALLUXIO_SERVER_CLASSPATH="${ALLUXIO_CONF_DIR}/:${ALLUXIO_CLASSPATH}:${ALLUXIO_ASSEMBLY_SERVER_JAR}"

# Master specific parameters based on ALLUXIO_JAVA_OPTS.
ALLUXIO_MASTER_JAVA_OPTS+=${ALLUXIO_JAVA_OPTS}
ALLUXIO_MASTER_JAVA_OPTS+=" -Dalluxio.logger.type=${ALLUXIO_MASTER_LOGGER:-MASTER_LOGGER}"
ALLUXIO_MASTER_JAVA_OPTS+=" -Dalluxio.master.audit.logger.type=${ALLUXIO_MASTER_AUDIT_LOGGER:-MASTER_AUDIT_LOGGER}"
if [[ -n "${ALLUXIO_LOGSERVER_HOSTNAME}" && -n "${ALLUXIO_LOGSERVER_PORT}" ]]; then
    ALLUXIO_MASTER_JAVA_OPTS+=" -Dalluxio.remote.logger.type=REMOTE_MASTER_LOGGER"
fi

# Secondary master specific parameters based on ALLUXIO_JAVA_OPTS.
ALLUXIO_SECONDARY_MASTER_JAVA_OPTS+=${ALLUXIO_JAVA_OPTS}
ALLUXIO_SECONDARY_MASTER_JAVA_OPTS+=" -Dalluxio.logger.type=${ALLUXIO_SECONDARY_MASTER_LOGGER:-SECONDARY_MASTER_LOGGER}"
if [[ -n "${ALLUXIO_LOGSERVER_HOSTNAME}" && -n "${ALLUXIO_LOGSERVER_PORT}" ]]; then
    ALLUXIO_SECONDARY_MASTER_JAVA_OPTS+=" -Dalluxio.remote.logger.type=REMOTE_SECONDARY_MASTER_LOGGER"
fi

# Proxy specific parameters that will be shared to all workers based on ALLUXIO_JAVA_OPTS.
ALLUXIO_PROXY_JAVA_OPTS+=${ALLUXIO_JAVA_OPTS}
ALLUXIO_PROXY_JAVA_OPTS+=" -Dalluxio.logger.type=${ALLUXIO_PROXY_LOGGER:-PROXY_LOGGER}"
if [[ -n "${ALLUXIO_LOGSERVER_HOSTNAME}" && -n "${ALLUXIO_LOGSERVER_PORT}" ]]; then
    ALLUXIO_PROXY_JAVA_OPTS+=" -Dalluxio.remote.logger.type=REMOTE_PROXY_LOGGER"
fi

# Worker specific parameters that will be shared to all workers based on ALLUXIO_JAVA_OPTS.
ALLUXIO_WORKER_JAVA_OPTS+=${ALLUXIO_JAVA_OPTS}
ALLUXIO_WORKER_JAVA_OPTS+=" -Dalluxio.logger.type=${ALLUXIO_WORKER_LOGGER:-WORKER_LOGGER}"
if [[ -n "${ALLUXIO_LOGSERVER_HOSTNAME}" && -n "${ALLUXIO_LOGSERVER_PORT}" ]]; then
    ALLUXIO_WORKER_JAVA_OPTS+=" -Dalluxio.remote.logger.type=REMOTE_WORKER_LOGGER"
fi

# FUSE specific parameters that will be shared to all workers based on ALLUXIO_JAVA_OPTS.
ALLUXIO_FUSE_JAVA_OPTS_DEFAULT=" -server -Xms1G -Xmx1G -XX:MaxDirectMemorySize=4g"
ALLUXIO_FUSE_JAVA_OPTS_DEFAULT+=" -Djava.library.path=${ALLUXIO_HOME}/lib"
ALLUXIO_FUSE_JAVA_OPTS_DEFAULT+=" -Dalluxio.logger.type=FUSE_LOGGER"
ALLUXIO_FUSE_JAVA_OPTS="${ALLUXIO_FUSE_JAVA_OPTS_DEFAULT} ${ALLUXIO_JAVA_OPTS} ${ALLUXIO_FUSE_JAVA_OPTS}"

# Log server specific parameters that will be passed to alluxio log server
ALLUXIO_LOGSERVER_JAVA_OPTS+=${ALLUXIO_JAVA_OPTS}
ALLUXIO_LOGSERVER_JAVA_OPTS+=" -Dalluxio.logserver.logger.type=LOGSERVER_LOGGER"

# Client specific parameters based on ALLUXIO_JAVA_OPTS.
ALLUXIO_USER_JAVA_OPTS+=${ALLUXIO_JAVA_OPTS}
ALLUXIO_USER_JAVA_OPTS+=" -Dalluxio.logger.type=USER_LOGGER"


text:
  <property-table
    caption="Summary"
    props-bind="appSummary"
    prop-name-class="col-xs-4 bold"
    prop-value-class="col-xs-8 actor-path">
  </property-table>

  <executor-table
    executors-bind="app.executors">
  </executor-table>

  <alerts-table
    alerts-bind="alerts">
  </alerts-table>

  <metrics-charts></metrics-charts>


text:
package hw1;
/**
 * ComS 227 HW1
 * @author Matt McKillip
 *
 */
public class Printer {

	/**
	 *    * Capacity, in ounces, of a new ink cartridge.
	 */
	public static final double INK_CAPACITY = 2.0;

	/**
	 * Amount of ink, in ounces, used per printed page.
	 */
	public static final double INK_USAGE = 0.0023;

	/**
	 * Number of sheets, in sheets, that are currently in the printer.
	 */
	private int currentNumberofSheets;

	/**
	 * Number of sheets, in sheets, that the printer started with.
	 */
	private int startingNumberOfSheets;

	/**
	 * Amount of ink, in ounces, left in the ink cartridge.
	 */
	private double inkLeft;

	/**
	 * Amount of sheets, in sheets, of ink being printed.
	 */
	private int pagesOfInkPrinted;

	/**
	 * Program replicating a printer
	 *
	 * @param givenNumberOfSheets
	 *            number of sheets the printer is given initially.
	 */
	public Printer(int givenNumberOfSheets) {
		startingNumberOfSheets = givenNumberOfSheets;
		currentNumberofSheets = givenNumberOfSheets;
		replaceInk();
	}

	/**
	 * Adds paper to the printer.
	 *
	 * @param additionalSheets
	 *            Additional sheets added to the printer.
	 */
	public void addPaper(int additionalSheets) {
		currentNumberofSheets = currentNumberofSheets + additionalSheets;
	}

	/**
	 * Gets the current amount of paper in the printer.
	 *
	 * @return the amount of paper in the printer.
	 */
	public int getCurrentPaper() {
		return currentNumberofSheets;
	}

	/**
	 * Gets the total amount of paper the printer has used.
	 *
	 * @return the amount of paper the printer has used.
	 */
	public int getTotalPaperUse() {
		return startingNumberOfSheets - currentNumberofSheets;
	}

	/**
	 * Determines if the ink has run out.
	 *
	 * @return if the ink is out.
	 */
	public boolean isInkOut() {
		return inkLeft < 0.0023;
	}

	/**
	 * Replaces the ink to full capacity.
	 */
	public void replaceInk() {
		inkLeft = INK_CAPACITY;
	}

	/**
	 * Prints single sided sheets of paper.
	 *
	 * @param numberOfPages
	 *            Number of pages the user wants to print.
	 */
	public void print(int numberOfPages) {

		// How many pages of ink are left.
		int pagesOfInkLeft = (int) (inkLeft / INK_USAGE);

		// Checks if there is enough paper to print all of the pages.
		int numberOfPagesToPrint = Math.min(numberOfPages,
				currentNumberofSheets);

		// checks to see if the pages of ink is limiting the number of pages to
		// be printed.
		int pagesPrinted = Math.min(numberOfPagesToPrint, pagesOfInkLeft);

		// updating the currentNumberofSheets value.
		currentNumberofSheets = currentNumberofSheets - pagesPrinted;

		// updating the inkLeft value.
		inkLeft = inkLeft - (pagesPrinted * INK_USAGE);
	}

	/**
	 * Prints double sided sheets of paper
	 *
	 * @param numberOfPages
	 *            Number of pages the user wants to print.
	 */
	public void printTwoSided(int numberOfPages) {

		// Checks to see if there is enough ink for the numberOfPages requested.
		int pagesOfInk = Math.min(numberOfPages,
				(int) Math.floor(inkLeft / INK_USAGE));

		// Checks if there is enough paper to print numberOfPages
		int pagesPrinted = Math.min(currentNumberofSheets,
				((numberOfPages / 2) + (numberOfPages % 2)));

		// multiplies the pages printed by two since the ink will go on both
		// sides.
		int twoSidedPrinted = pagesPrinted * 2;

		// Checks if there is enough ink to print on two sided amount of ink.
		pagesOfInkPrinted = Math.min(twoSidedPrinted, pagesOfInk);

		// updating the currentNumberofSheets value.
		currentNumberofSheets -= pagesPrinted;

		// updating the inkLeft value.
		inkLeft = inkLeft - (pagesOfInkPrinted * INK_USAGE);
	}

}


text:
<?php

namespace Pipeline\APIBundle\Entity;

use Pipeline\APIBundle\Entity\APIRepository;

use Pipeline\APIBundle\Entity\User;

/**
 * TaskRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class TaskRepository extends APIRepository
{
    /**
     * Replace the underlying find function.
     *
     * @access public
     * @param mixed $id
     * @return void
     */
    public function find($id)
    {
        $user = $this->getUser();
        $em = $this->getEntityManager();

        $query = $em->createQuery(
                      'SELECT t
                       FROM APIBundle:Task t
                       WHERE t.id = :id AND t.owner = :user')
                    ->setParameters(array("id" => $id, "user" => $user));

        return $query->getSingleResult();
    }

    /**
     * Temporary task loading function...
     *
     * @access public
     * @param User $user
     * @return void
     */
    public function findTasksFor(User $user)
    {
        $em = $this->getEntityManager();
        $query = $em->createQuery("select t from APIBundle:Task t WHERE t.owner = :user")->setParameter("user", $user);

        return $query->getResult();
    }
}


text:
/**
 * Teensylu 0.7 pin assignments (AT90USB1286)
 * Requires the Teensyduino software with Teensy++ 2.0 selected in Arduino IDE!
 * http://www.pjrc.com/teensy/teensyduino.html
 * See http://reprap.org/wiki/Printrboard for more info
 */

#ifndef __AVR_AT90USB1286__
  #error "Oops!  Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu."
#endif

#if ENABLED(AT90USBxx_TEENSYPP_ASSIGNMENTS)  // use Teensyduino Teensy++2.0 pin assignments instead of Marlin traditional.
  #error "These Teensylu assignments depend on traditional Marlin assignments, not AT90USBxx_TEENSYPP_ASSIGNMENTS in fastio.h"
#endif

#define BOARD_NAME         "Teensylu"

#define USBCON 1286  // Disable MarlinSerial etc.
#define LARGE_FLASH        true

//
// Limit Switches
//
#define X_STOP_PIN         13
#define Y_STOP_PIN         14
#define Z_STOP_PIN         15

//
// Steppers
//
#define X_STEP_PIN          0
#define X_DIR_PIN           1
#define X_ENABLE_PIN       39

#define Y_STEP_PIN          2
#define Y_DIR_PIN           3
#define Y_ENABLE_PIN       38

#define Z_STEP_PIN          4
#define Z_DIR_PIN           5
#define Z_ENABLE_PIN       23

#define E0_STEP_PIN         6
#define E0_DIR_PIN          7
#define E0_ENABLE_PIN      19

//
// Temperature Sensors
//
#define TEMP_0_PIN          7   // Analog Input (Extruder)
#define TEMP_BED_PIN        6   // Analog Input (Bed)

//
// Heaters / Fans
//
#define HEATER_0_PIN       21  // Extruder
#define HEATER_1_PIN       46
#define HEATER_2_PIN       47
#define HEATER_BED_PIN     20

// If soft or fast PWM is off then use Teensyduino pin numbering, Marlin
// fastio pin numbering otherwise
#if ENABLED(FAN_SOFT_PWM) || ENABLED(FAST_PWM_FAN)
  #define FAN_PIN          22
#else
  #define FAN_PIN          16
#endif

//
// Misc. Functions
//
#define SDSS                8

//
// LCD / Controller
//
#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)

  #define BEEPER_PIN       -1

  #if ENABLED(LCD_I2C_PANELOLU2)
    #define BTN_EN1        27  // RX1 - fastio.h pin mapping 27
    #define BTN_EN2        26  // TX1 - fastio.h pin mapping 26
    #define BTN_ENC        43  // A3  - fastio.h pin mapping 43
    #define SDSS           40  // use SD card on Panelolu2 (Teensyduino pin mapping)
  #endif // LCD_I2C_PANELOLU2

  #define SD_DETECT_PIN    -1

#endif // ULTRA_LCD && NEWPANEL


text:
<!DOCTYPE html>

<meta content="text/html;charset=utf-8" http-equiv="content-type"/>

<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<title>pymel.core.rendering.orbit — PyMEL 1.0.7 documentation</title>
<link href="../../../_static/nature.css" rel="stylesheet" type="text/css"/>
<link href="../../../_static/pygments.css" rel="stylesheet" type="text/css"/>

<link href="../../../index-2.html" rel="top" title="PyMEL 1.0.7 documentation"/>
<link href="../../pymel.core.rendering.html" rel="up" title="pymel.core.rendering"/>
<link href="pymel.core.rendering.panZoom.html" rel="next" title="pymel.core.rendering.panZoom"/>
<link href="pymel.core.rendering.ogsRender.html" rel="prev" title="pymel.core.rendering.ogsRender"/>
<link href="../../../../style/adsk.cpm.css" rel="stylesheet" type="text/css"/><meta content="expert" name="experiencelevel"/><meta content="programmer" name="audience"/><meta content="enable" name="user-comments"/><meta content="ENU" name="language"/><meta content="MAYAUL" name="product"/><meta content="2016" name="release"/><meta content="Customization" name="book"/><meta content="Maya-Tech-Docs" name="component"/><meta content="/view/MAYAUL/2016/ENU/" name="helpsystempath"/><meta content="04/03/2015" name="created"/><meta content="04/03/2015" name="modified"/><meta content="Navigation

 index

 modules |

 next |

 previous |
 PyMEL 1.0.7 documentation »
 pymel.core.rendering »

 pymel.core.rendering.orbit ¶

 orbit ( *args , **kwargs ) ¶
 The orbit command revolves the camera(s) horizontally and/or vertically in the perspective window. The rotation axis is
with respect to the camera. To revolve horizontally: the rotation axis is the camera up direction vector. To revolve
vertically: the rotation axis is the camera..." name="description"/><meta content="__PyMel_generated_functions_pymel_core_rendering_pymel_core_rendering_orbit_html" name="topicid"/>

Navigation

index

modules |

next |

previous |

PyMEL 1.0.7 documentation »

pymel.core.rendering »

pymel.core.rendering.orbit¶

<tt class="descname">orbit</tt><big>(</big>*args, **kwargs<big>)</big>¶

The orbit command revolves the camera(s) horizontally and/or vertically in the perspective window. The rotation axis is
with respect to the camera. To revolve horizontally: the rotation axis is the camera up direction vector. To revolve
vertically: the rotation axis is the camera left direction vector. When both the horizontal and the vertical angles are
supplied on the command line, the camera is firstly revolved horizontally, then revolved vertically. This command may be
applied to more than one camera; objects that are not cameras are ignored. When no camera name supplied, this command is
applied to all currently active cameras.

(<function orbit at 0x13ef6c398>, <function addCmdDocsCallback at 0x13ed48848>, ('orbit', ''), {})

Flags:

<colgroup>
<col width="1%"></col>
<col width="61%"></col>
<col width="19%"></col>
<col width="19%"></col>
</colgroup>

Long Name / Short Name
Argument Types
Properties

<tt class="docutils literal">horizontalAngle</tt> / <tt class="docutils literal">ha</tt>
float

Angle to revolve horizontally.

<tt class="docutils literal">pivotPoint</tt> / <tt class="docutils literal">pp</tt>
float, float, float

Used as the pivot point in the world space.                       Flag can have multiple arguments, passed either as a tuple or a list.

<tt class="docutils literal">rotationAngles</tt> / <tt class="docutils literal">ra</tt>
float, float

Angle to revolve horizontally and vertically.

<tt class="docutils literal">verticalAngle</tt> / <tt class="docutils literal">va</tt>
float

Angle to revolve vertically.

Derived from mel command <tt class="xref py py-obj docutils literal">maya.cmds.orbit</tt>

Example:

import pymel.core as pm

pm.camera()
# Result: [nt.Transform(u'camera1'), nt.Camera(u'cameraShape1')] #
pm.orbit( 'cameraShape1', ha=-30 )# Change the horizontal angle by -30 degrees

pm.orbit( 'cameraShape1', va=15 )# Change the vertical angle by 15 degrees

pm.orbit( 'cameraShape1', ra=(-30, 15) )# Change the horizontal angle by -30 degrees and the vertical angle by 15 degrees

Previous topic

pymel.core.rendering.ogsRender

Next topic

pymel.core.rendering.panZoom

Core Modules

<tt class="xref">animation</tt>

<tt class="xref">effects</tt>

<tt class="xref">general</tt>

<tt class="xref">language</tt>

<tt class="xref">modeling</tt>

<tt class="xref">rendering</tt>

<tt class="xref">system</tt>

<tt class="xref">windows</tt>

Type Modules

<tt class="xref">datatypes</tt>

<tt class="xref">nodetypes</tt>

<tt class="xref">uitypes</tt>

Other Modules

<tt class="xref">plugins</tt>

<tt class="xref">mayautils</tt>

<tt class="xref">util</tt>

<tt class="xref">versions</tt>

<tt class="xref">tools</tt>

This Page

Show Source

Quick search

<form action="http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/PyMel/search.html" class="search" method="get"></form>
<input name="q" type="text"/>
<input type="submit" value="Go"/>
<input name="check_keywords" type="hidden" value="yes"/>
<input name="area" type="hidden" value="default"/>

    Enter search terms or a module, class or function name.

Navigation

index

modules |

next |

previous |

PyMEL 1.0.7 documentation »

pymel.core.rendering »

        © Copyright 2009, Chad Dombrova.
      Created using Sphinx 1.2.3.


text:
import {BaseIfc} from "./BaseIfc"
import {IfcPresentationLayerAssignment} from "./IfcPresentationLayerAssignment.g"
import {IfcStyledItem} from "./IfcStyledItem.g"
import {IfcDimensionCount} from "./IfcDimensionCount.g"
import {IfcProfileDef} from "./IfcProfileDef.g"
import {IfcAxis2Placement3D} from "./IfcAxis2Placement3D.g"
import {IfcCurve} from "./IfcCurve.g"
import {IfcParameterValue} from "./IfcParameterValue.g"
import {IfcDirection} from "./IfcDirection.g"
import {IfcSweptAreaSolid} from "./IfcSweptAreaSolid.g"

/**
 * http://www.buildingsmart-tech.org/ifc/IFC4/final/html/link/ifcfixedreferencesweptareasolid.htm
 */
export class IfcFixedReferenceSweptAreaSolid extends IfcSweptAreaSolid {
	Directrix : IfcCurve
	StartParam : IfcParameterValue // optional
	EndParam : IfcParameterValue // optional
	FixedReference : IfcDirection

    constructor(sweptArea : IfcProfileDef, directrix : IfcCurve, fixedReference : IfcDirection) {
        super(sweptArea)
		this.Directrix = directrix
		this.FixedReference = fixedReference

    }
    getStepParameters() : string {
        var parameters = new Array<string>();
		parameters.push(BaseIfc.toStepValue(this.SweptArea))
		parameters.push(BaseIfc.toStepValue(this.Position))
		parameters.push(BaseIfc.toStepValue(this.Directrix))
		parameters.push(BaseIfc.toStepValue(this.StartParam))
		parameters.push(BaseIfc.toStepValue(this.EndParam))
		parameters.push(BaseIfc.toStepValue(this.FixedReference))

        return parameters.join();
    }
}


text:
package org.apache.ignite.internal.processors.cache.distributed.near;

import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.cache.expiry.Duration;
import javax.cache.expiry.TouchedExpiryPolicy;
import com.google.common.collect.ImmutableSet;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.internal.U;

import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.apache.ignite.cache.CacheAtomicityMode.ATOMIC;
import static org.apache.ignite.testframework.GridTestUtils.waitForCondition;

/**
 *
 */
public class GridCacheAtomicClientOnlyMultiNodeFullApiSelfTest extends GridCacheNearOnlyMultiNodeFullApiSelfTest {
    /** {@inheritDoc} */
    @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
        CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName);

        cfg.setNearConfiguration(null);

        return cfg;
    }

    /** {@inheritDoc} */
    @Override protected boolean clientHasNearCache() {
        return false;
    }

    /** {@inheritDoc} */
    @Override protected CacheAtomicityMode atomicityMode() {
        return ATOMIC;
    }

    /** {@inheritDoc} */
    @Override protected boolean lockingEnabled() {
        return false;
    }

    /** {@inheritDoc} */
    @Override protected boolean txEnabled() {
        return false;
    }

    /** {@inheritDoc} */
    @Override protected NearCacheConfiguration nearConfiguration() {
        return null;
    }

    /** {@inheritDoc} */
    @Override public void _testReaderTtlNoTx() throws Exception {
        // No-op.
    }

    /** {@inheritDoc} */
    @Override public void _testReaderTtlTx() throws Exception {
        // No-op.
    }

    /** {@inheritDoc} */
    @Override public void testSize() throws Exception {
        IgniteCache<String, Integer> cache = jcache();

        int size = 10;

        Map<String, Integer> map = U.newLinkedHashMap(size);

        for (int i = 0; i < size; i++)
            map.put("key" + i, i);

        cache.putAll(map);

        affinityNodes(); // Just to ack cache configuration to log..

        Set<String> keys = new LinkedHashSet<>(map.keySet());

        checkKeySize(keys);

        checkSize(keys);

        int fullCacheSize = 0;

        for (int i = 0; i < gridCount(); i++)
            fullCacheSize += jcache(i).localSize();

        assertEquals("Invalid cache size", fullCacheSize, cache.size());
    }

    /** {@inheritDoc} */
    @Override public void testClear() throws Exception {
        IgniteCache<String, Integer> nearCache = jcache();
        IgniteCache<String, Integer> primary = fullCache();

        Collection<String> keys = primaryKeysForCache(primary, 3);

        Map<String, Integer> vals = new HashMap<>();

        int i = 0;

        for (String key : keys) {
            nearCache.put(key, i);

            vals.put(key, i);

            i++;
        }

        for (String key : keys)
            assertEquals(null, nearCache.localPeek(key, CachePeekMode.ONHEAP));

        nearCache.clear();

        for (String key : keys)
            assertNull(nearCache.localPeek(key, CachePeekMode.ONHEAP));

        for (Map.Entry<String, Integer> entry : vals.entrySet())
            nearCache.put(entry.getKey(), entry.getValue());

        for (String key : keys)
            assertEquals(null, nearCache.localPeek(key, CachePeekMode.ONHEAP));

    }

    /** {@inheritDoc} */
    @Override public void testLocalClearKeys() throws Exception {
        IgniteCache<String, Integer> nearCache = jcache();
        IgniteCache<String, Integer> primary = fullCache();

        Collection<String> keys = primaryKeysForCache(primary, 3);

        int i = 0;

        for (String key : keys)
            nearCache.put(key, i++);

        String lastKey = F.last(keys);

        Set<String> keysToRmv = new HashSet<>(keys);

        keysToRmv.remove(lastKey);

        assert keysToRmv.size() > 1;

        nearCache.localClearAll(keysToRmv);

        for (String key : keys) {
            if (keysToRmv.contains(key)) {
                assertNull(nearCache.localPeek(key));

                assertNotNull(primary.localPeek(key));
            }
        }
    }

    /** {@inheritDoc} */
    @Override public void testEvictExpired() throws Exception {
        IgniteCache<String, Integer> cache = jcache();

        final String key = primaryKeysForCache(cache, 1).get(0);

        cache.put(key, 1);

        assertEquals((Integer)1, cache.get(key));

        long ttl = 500;

        grid(0).cache(DEFAULT_CACHE_NAME).
            withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);

        boolean wait = waitForCondition(new GridAbsPredicate() {
            @Override public boolean apply() {
                for (int i = 0; i < gridCount(); i++) {
                    if (peek(jcache(i), key) != null)
                        return false;
                }

                return true;
            }
        }, ttl + 1000);

        assertTrue("Failed to wait for entry expiration.", wait);

        // Expired entry should not be swapped.
        cache.localEvict(Collections.singleton(key));

        assertNull(cache.localPeek(key, CachePeekMode.ONHEAP));

        assertTrue(cache.localSize() == 0);

        // Force reload on primary node.
        for (int i = 0; i < gridCount(); i++) {
            if (ignite(i).affinity(DEFAULT_CACHE_NAME).isPrimary(ignite(i).cluster().localNode(), key))
                load(jcache(i), key, true);
        }

        // Will do near get request.
        load(cache, key, true);

        assertEquals(null, cache.localPeek(key, CachePeekMode.ONHEAP));
    }

    /** {@inheritDoc} */
    @Override public void testLocalEvict() throws Exception {
        IgniteCache<String, Integer> cache = jcache();

        List<String> keys = primaryKeysForCache(cache, 3);

        String key1 = keys.get(0);
        String key2 = keys.get(1);
        String key3 = keys.get(2);

        cache.put(key1, 1);
        cache.put(key2, 2);
        cache.put(key3, 3);

        assert cache.localPeek(key1, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key2, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key3, CachePeekMode.ONHEAP) == null;

        cache.localEvict(F.asList(key1, key2));

        assert cache.localPeek(key1, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key2, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key3, CachePeekMode.ONHEAP) == null;

        loadAll(cache, ImmutableSet.of(key1, key2), true);

        assert cache.localPeek(key1, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key2, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key3, CachePeekMode.ONHEAP) == null;

        cache.localEvict(F.asList(key1, key2));

        assert cache.localPeek(key1, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key2, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key3, CachePeekMode.ONHEAP) == null;

        loadAll(cache, ImmutableSet.of(key1, key2), true);

        assert cache.localPeek(key1, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key2, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key3, CachePeekMode.ONHEAP) == null;

        cache.localEvict(new HashSet<>(keys));

        assert cache.localPeek(key1, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key2, CachePeekMode.ONHEAP) == null;
        assert cache.localPeek(key3, CachePeekMode.ONHEAP) == null;
    }

    /** {@inheritDoc} */
    @Override public void testPeekExpired() throws Exception {
        IgniteCache<String, Integer> c = jcache();

        String key = primaryKeysForCache(c, 1).get(0);

        info("Using key: " + key);

        c.put(key, 1);

        assertEquals(null, c.localPeek(key, CachePeekMode.ONHEAP));

        long ttl = 500;

        grid(0).cache(DEFAULT_CACHE_NAME).
            withExpiryPolicy(new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl))).put(key, 1);

        Thread.sleep(ttl + 100);

        assert c.localPeek(key, CachePeekMode.ONHEAP) == null;

        assert c.localSize() == 0 : "Cache is not empty.";
    }
}


text:
=========================
Rule ``indentation_type``
=========================

Code MUST use configured indentation type.

Examples
--------

Example #1
~~~~~~~~~~

.. code-block:: diff

   --- Original
   +++ New
   @@ -1,5 +1,5 @@
    <?php

    if (true) {
   -	echo 'Hello!';
   +    echo 'Hello!';
    }

Rule sets
---------

The rule is part of the following rule sets:

@PSR2
  Using the ``@PSR2`` rule set will enable the ``indentation_type`` rule.

@Symfony
  Using the ``@Symfony`` rule set will enable the ``indentation_type`` rule.

@PhpCsFixer
  Using the ``@PhpCsFixer`` rule set will enable the ``indentation_type`` rule.


text:
package org.jabref.gui.collab;

import javax.swing.JComponent;
import javax.swing.JScrollPane;

import org.jabref.gui.BasePanel;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.UndoableRemoveString;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.entry.BibtexString;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

class StringRemoveChangeViewModel extends ChangeViewModel {
    private static final Log LOGGER = LogFactory.getLog(StringRemoveChangeViewModel.class);
    private final BibtexString string;

    private final BibtexString inMem;
    private final InfoPane tp = new InfoPane();
    private final JScrollPane sp = new JScrollPane(tp);

    public StringRemoveChangeViewModel(BibtexString string, BibtexString inMem) {
        super(Localization.lang("Removed string") + ": '" + string.getName() + '\'');
        this.string = string;
        this.inMem = inMem; // Holds the version in memory. Check if it has been modified...?

        tp.setText("
" + Localization.lang("Removed string") + "

" +
                Localization.lang("Label") + ":
" + string.getName() + "
" +
                Localization.lang("Content") + ":
" + string.getContent() + "");
    }

    @Override
    public boolean makeChange(BasePanel panel, BibDatabase secondary, NamedCompound undoEdit) {

        try {
            panel.getDatabase().removeString(inMem.getId());
            undoEdit.addEdit(new UndoableRemoveString(panel, panel.getDatabase(), string));
        } catch (Exception ex) {
            LOGGER.info("Error: could not add string '" + string.getName() + "': " + ex.getMessage(), ex);
        }

        // Update tmp database:
        secondary.removeString(string.getId());

        return true;
    }

    @Override
    public JComponent description() {
        return sp;
    }

}


text:
import { gg } from '../helpers'

const characteristic = new gg.class.Characteristic({name: 'MyCharacteristic', value: 10})

describe('characteristic', () => {
  test('should initialize with 0 case argument is undefined', () => {
    expect(characteristic.getValue()).toBe(10)
  })
  test('should set and get name', () => {
    characteristic.setName('custom name')
    expect(characteristic.getName()).toBe('custom name')
  })
  test('should only allow number as value', () => {
    expect(() => characteristic.putValue('a')).toThrow(new Error('Value must be a number'))
    expect(() => characteristic.setValue('b')).toThrow(new Error('Value must be a number'))
  })
})


text:
#ifndef FP2_GADGETS_HPP_
#define FP2_GADGETS_HPP_

#include "gadgetlib1/gadget.hpp"
#include <memory>

namespace libsnark {

/**
 * Gadget that represents an Fp2 variable.
 */
template<typename Fp2T>
class Fp2_variable : public gadget<typename Fp2T::my_Fp> {
public:
    typedef typename Fp2T::my_Fp FieldT;

    pb_linear_combination<FieldT> c0;
    pb_linear_combination<FieldT> c1;

    pb_linear_combination_array<FieldT> all_vars;

    Fp2_variable(protoboard<FieldT> &pb,
                 const std::string &annotation_prefix);
    Fp2_variable(protoboard<FieldT> &pb,
                 const Fp2T &el,
                 const std::string &annotation_prefix);
    Fp2_variable(protoboard<FieldT> &pb,
                 const Fp2T &el,
                 const pb_linear_combination<FieldT> &coeff,
                 const std::string &annotation_prefix);
    Fp2_variable(protoboard<FieldT> &pb,
                 const pb_linear_combination<FieldT> &c0,
                 const pb_linear_combination<FieldT> &c1,
                 const std::string &annotation_prefix);

    void generate_r1cs_equals_const_constraints(const Fp2T &el);
    void generate_r1cs_witness(const Fp2T &el);
    Fp2T get_element();

    Fp2_variable<Fp2T> operator*(const FieldT &coeff) const;
    Fp2_variable<Fp2T> operator+(const Fp2_variable<Fp2T> &other) const;
    Fp2_variable<Fp2T> operator+(const Fp2T &other) const;
    Fp2_variable<Fp2T> mul_by_X() const;
    void evaluate() const;
    bool is_constant() const;

    static size_t size_in_bits();
    static size_t num_variables();
};

/**
 * Gadget that creates constraints for Fp2 by Fp2 multiplication.
 */
template<typename Fp2T>
class Fp2_mul_gadget : public gadget<typename Fp2T::my_Fp> {
public:
    typedef typename Fp2T::my_Fp FieldT;

    Fp2_variable<Fp2T> A;
    Fp2_variable<Fp2T> B;
    Fp2_variable<Fp2T> result;

    pb_variable<FieldT> v1;

    Fp2_mul_gadget(protoboard<FieldT> &pb,
                   const Fp2_variable<Fp2T> &A,
                   const Fp2_variable<Fp2T> &B,
                   const Fp2_variable<Fp2T> &result,
                   const std::string &annotation_prefix);
    void generate_r1cs_constraints();
    void generate_r1cs_witness();
};

/**
 * Gadget that creates constraints for Fp2 multiplication by a linear combination.
 */
template<typename Fp2T>
class Fp2_mul_by_lc_gadget : public gadget<typename Fp2T::my_Fp> {
public:
    typedef typename Fp2T::my_Fp FieldT;

    Fp2_variable<Fp2T> A;
    pb_linear_combination<FieldT> lc;
    Fp2_variable<Fp2T> result;

    Fp2_mul_by_lc_gadget(protoboard<FieldT> &pb,
                         const Fp2_variable<Fp2T> &A,
                         const pb_linear_combination<FieldT> &lc,
                         const Fp2_variable<Fp2T> &result,
                         const std::string &annotation_prefix);
    void generate_r1cs_constraints();
    void generate_r1cs_witness();
};

/**
 * Gadget that creates constraints for Fp2 squaring.
 */
template<typename Fp2T>
class Fp2_sqr_gadget : public gadget<typename Fp2T::my_Fp> {
public:
    typedef typename Fp2T::my_Fp FieldT;

    Fp2_variable<Fp2T> A;
    Fp2_variable<Fp2T> result;

    Fp2_sqr_gadget(protoboard<FieldT> &pb,
                   const Fp2_variable<Fp2T> &A,
                   const Fp2_variable<Fp2T> &result,
                   const std::string &annotation_prefix);
    void generate_r1cs_constraints();
    void generate_r1cs_witness();
};

} // libsnark

#include "gadgetlib1/gadgets/fields/fp2_gadgets.tcc"

#endif // FP2_GADGETS_HPP_


text:
from __future__ import absolute_import, print_function

from .ast_tools import token, symbol, ast_to_string, match, atom_list

def slice_ast_to_dict(ast_seq):
    sl_vars = {}
    if isinstance(ast_seq, (list, tuple)):
        for pattern in slice_patterns:
            found,data = match(pattern,ast_seq)
            if found:
                sl_vars = {'begin':'_beg',
                           'end':'_end',
                           'step':'_stp',
                           'single_index':'_index'}
                for key in data:
                    data[key] = ast_to_string(data[key])
                sl_vars.update(data)
                break
    return sl_vars

def build_slice_atom(slice_vars, position):
    # Note: This produces slices that are incorrect for Python
    # evaluation because of slicing being exclusive in Python
    # and inclusive for blitz on the top end of the range.
    # This difference should really be handle in a blitz specific transform,
    # but I've put it here for convenience. This doesn't cause any
    # problems in code, its just a maintenance hassle
    # (I'll forget I did it here) and inelegant.  *FIX ME*.

    ###########################################################################
    #                        Handling negative indices.
    #
    # Range indices that begin with a negative sign, '-', are assumed to be
    # negative.  Blitz++ interprets negative indices differently than
    # Python.  To correct this, we subtract negative indices from the length
    # of the array (at run-time).  If indices do not start with a negative
    # sign, they are assumed to be positive.
    #
    # This scheme doesn't work in the general case.  For example, if you
    # are calculating negative indices from a math expression that doesn't
    # start with the negative sign, then it will be assumed positive and
    # hence generate wrong results (and maybe a seg-fault).
    #
    # I think this case can might be remedied by calculating all ranges on
    # the fly, and then subtracting them from the length of the array in
    # that dimension if they are negative.  This is major code bloat in the
    # funcitons and more work.  Save till later...
    ###########################################################################
    # I don't think the strip is necessary, but it insures
    # that '-' is the first sign for negative indices.
    if slice_vars['single_index'] != '_index':
        expr = '%(single_index)s' % slice_vars
    else:
        begin = slice_vars['begin'].strip()
        if begin[0] == '-':
            slice_vars['begin'] = 'N' + slice_vars['var']+repr(position)+begin

        end = slice_vars['end'].strip()
        if end != '_end' and end[0] != '-':
            #compensate for blitz using inclusive indexing on top end
            #of slice for positive indices.
            slice_vars['end'] = end + '-1'
        if end[0] == '-':
            slice_vars['end'] = 'N%s[%d]%s-1' % (slice_vars['var'],position,end)

        if slice_vars['step'] == '_stp':
            # this if/then isn't strictly necessary, it'll
            # just keep the output code a little cleaner
            expr = 'slice(%(begin)s,%(end)s)' % slice_vars
        else:
            expr = 'slice(%(begin)s,%(end)s,%(step)s)' % slice_vars
    val = atom_list(expr)
    return val

def transform_subscript_list(subscript_dict):
    # this is gonna edit the ast_list...
    subscript_list = subscript_dict['subscript_list']

    var = subscript_dict['var']
    #skip the first entry (the subscript_list symbol)
    slice_position = -1
    for i in range(1,len(subscript_list)):
        #skip commas...
        if subscript_list[i][0] != token.COMMA:
            slice_position += 1
            slice_vars = slice_ast_to_dict(subscript_list[i])

            slice_vars['var'] = var
            # create a slice(b,e,s) atom and insert in
            # place of the x:y:z atom in the tree.
            subscript_list[i] = build_slice_atom(slice_vars, slice_position)

def harvest_subscript_dicts(ast_list):
    """ Needs Tests!
    """
    subscript_lists = []
    if isinstance(ast_list, list):
        found,data = match(indexed_array_pattern,ast_list)
        # data is a dict with 'var' = variable name
        # and 'subscript_list' = to the ast_seq for the subscript list
        if found:
            subscript_lists.append(data)
        for item in ast_list:
            if isinstance(item, list):
                subscript_lists.extend(harvest_subscript_dicts(item))
    return subscript_lists

def transform_slices(ast_list):
    """ Walk through an ast_list converting all x:y:z subscripts
        to slice(x,y,z) subscripts.
    """
    all_dicts = harvest_subscript_dicts(ast_list)
    for subscript_dict in all_dicts:
        transform_subscript_list(subscript_dict)

slice_patterns = []
CLN = (token.COLON,':')
CLN2 = (symbol.sliceop, (token.COLON, ':'))
CLN2_STEP = (symbol.sliceop, (token.COLON, ':'),['step'])
# [begin:end:step]
slice_patterns.append((symbol.subscript, ['begin'],CLN,['end'], CLN2_STEP))
# [:end:step]
slice_patterns.append((symbol.subscript, CLN,['end'], CLN2_STEP))
# [begin::step]
slice_patterns.append((symbol.subscript, ['begin'],CLN, CLN2_STEP))
# [begin:end:]
slice_patterns.append((symbol.subscript, ['begin'],CLN,['end'], CLN2))
# [begin::]
slice_patterns.append((symbol.subscript, ['begin'],CLN, CLN2))
# [:end:]
slice_patterns.append((symbol.subscript, CLN,['end'], CLN2,))
# [::step]
slice_patterns.append((symbol.subscript, CLN, CLN2_STEP))
# [::]
slice_patterns.append((symbol.subscript, CLN, CLN2))

# begin:end variants
slice_patterns.append((symbol.subscript, ['begin'],CLN,['end']))
slice_patterns.append((symbol.subscript, CLN,['end']))
slice_patterns.append((symbol.subscript, ['begin'],CLN))
slice_patterns.append((symbol.subscript, CLN))

# a[0] variant -- can't believe I left this out...
slice_patterns.append((symbol.subscript,['single_index']))

indexed_array_pattern = \
           (symbol.power,
             (symbol.atom,(token.NAME, ['var'])),
             (symbol.trailer,
                (token.LSQB, '['),
                   ['subscript_list'],
                (token.RSQB, ']')
              )
            )


text:
import process, subprocess, fs
from ffmpeg_exception import FFmpegException

FF_PROBE_EXE = 'ffmpeg'

STDOUT_CONSOLE = None
STDOUT_PIPE = subprocess.PIPE

def execute(args, pipe=STDOUT_PIPE):
    check_ffmpeg()
    p = process.PProcess(FF_PROBE_EXE, pipe)
    return p.execute(args)

def fast_exec(path, args):
    path = fs.file_exists(path)
    output = fs.catch_output(path)

    p = execute([
                    '-i', path,
                    '-y'
                ]
                + args
                + [output],
                STDOUT_CONSOLE)

    exit_code = p.wait_for()
    if exit_code != 0:
        ex_string = "ffmpeg exists with code [ %s ] while processing file [ %s ], please check the standard error output" % (
            exit_code, path
        )
        raise FFmpegException(ex_string)

    return output

def check_ffmpeg():
    path = fs.which(FF_PROBE_EXE)
    if not path:
        ex_string = "no %s has been found on the system, please install %s" % (FF_PROBE_EXE, FF_PROBE_EXE)
        raise FFmpegException(ex_string)


text:
#include "hpdf_conf.h"
#include "hpdf_utils.h"
#include "hpdf_objects.h"

HPDF_Array
HPDF_Array_New  (HPDF_MMgr  mmgr)
{
    HPDF_Array obj;

    HPDF_PTRACE((" HPDF_Array_New\n"));

    obj = HPDF_GetMem (mmgr, sizeof(HPDF_Array_Rec));
    if (obj) {
        HPDF_MemSet (obj, 0, sizeof(HPDF_Array_Rec));
        obj->header.obj_class = HPDF_OCLASS_ARRAY;
        obj->mmgr = mmgr;
        obj->error = mmgr->error;
        obj->list = HPDF_List_New (mmgr, HPDF_DEF_ITEMS_PER_BLOCK);
        if (!obj->list) {
            HPDF_FreeMem (mmgr, obj);
            obj = NULL;
        }
    }

    return obj;
}

HPDF_Array
HPDF_Box_Array_New  (HPDF_MMgr  mmgr,
                     HPDF_Box   box)
{
    HPDF_Array  obj;
    HPDF_STATUS ret = HPDF_OK;

    HPDF_PTRACE((" HPDF_Box_Array_New\n"));

    obj = HPDF_Array_New (mmgr);
    if (!obj)
        return NULL;

    ret += HPDF_Array_Add (obj, HPDF_Real_New (mmgr, box.left));
    ret += HPDF_Array_Add (obj, HPDF_Real_New (mmgr, box.bottom));
    ret += HPDF_Array_Add (obj, HPDF_Real_New (mmgr, box.right));
    ret += HPDF_Array_Add (obj, HPDF_Real_New (mmgr, box.top));

    if (ret != HPDF_OK) {
        HPDF_Array_Free (obj);
        return NULL;
    }

    return obj;
}

void
HPDF_Array_Free  (HPDF_Array  array)
{
    if (!array)
        return;

    HPDF_PTRACE((" HPDF_Array_Free\n"));

    HPDF_Array_Clear (array);

    HPDF_List_Free (array->list);

    array->header.obj_class = 0;

    HPDF_FreeMem (array->mmgr, array);
}

HPDF_STATUS
HPDF_Array_Write  (HPDF_Array    array,
                   HPDF_Stream   stream,
                   HPDF_Encrypt  e)
{
    HPDF_UINT i;
    HPDF_STATUS ret;

    HPDF_PTRACE((" HPDF_Array_Write\n"));

    ret = HPDF_Stream_WriteStr (stream, "[ ");
    if (ret != HPDF_OK)
        return ret;

    for (i = 0; i < array->list->count; i++) {
        void * element = HPDF_List_ItemAt (array->list, i);

        ret = HPDF_Obj_Write (element, stream, e);
        if (ret != HPDF_OK)
            return ret;

        ret = HPDF_Stream_WriteChar (stream, ' ');
        if (ret != HPDF_OK)
            return ret;
    }

    ret = HPDF_Stream_WriteChar (stream, ']');

    return ret;
}

HPDF_STATUS
HPDF_Array_AddNumber  (HPDF_Array  array,
                       HPDF_INT32  value)
{
    HPDF_Number n = HPDF_Number_New (array->mmgr, value);

    HPDF_PTRACE((" HPDF_Array_AddNumber\n"));

    if (!n)
        return HPDF_Error_GetCode (array->error);
    else
        return HPDF_Array_Add (array, n);
}

HPDF_STATUS
HPDF_Array_AddReal  (HPDF_Array  array,
                     HPDF_REAL   value)
{
    HPDF_Real r = HPDF_Real_New (array->mmgr, value);

    HPDF_PTRACE((" HPDF_Array_AddReal\n"));

    if (!r)
        return HPDF_Error_GetCode (array->error);
    else
        return HPDF_Array_Add (array, r);
}

HPDF_STATUS
HPDF_Array_AddName  (HPDF_Array       array,
                     const char  *value)
{
    HPDF_Name n = HPDF_Name_New (array->mmgr, value);

    HPDF_PTRACE((" HPDF_Array_AddName\n"));

    if (!n)
        return HPDF_Error_GetCode (array->error);
    else
        return HPDF_Array_Add (array, n);
}

HPDF_STATUS
HPDF_Array_Add  (HPDF_Array  array,
                 void        *obj)
{
    HPDF_Obj_Header *header;
    HPDF_STATUS ret;

    HPDF_PTRACE((" HPDF_Array_Add\n"));

    if (!obj) {
        if (HPDF_Error_GetCode (array->error) == HPDF_OK)
            return HPDF_SetError (array->error, HPDF_INVALID_OBJECT, 0);
        else
            return HPDF_INVALID_OBJECT;
    }

    header = (HPDF_Obj_Header *)obj;

    if (header->obj_id & HPDF_OTYPE_DIRECT)
        return HPDF_SetError (array->error, HPDF_INVALID_OBJECT, 0);

    if (array->list->count >= HPDF_LIMIT_MAX_ARRAY) {
        HPDF_PTRACE((" HPDF_Array_Add exceed limitatin of array count(%d)\n",
                    HPDF_LIMIT_MAX_ARRAY));

        HPDF_Obj_Free (array->mmgr, obj);
        return HPDF_SetError (array->error, HPDF_ARRAY_COUNT_ERR, 0);
    }

    if (header->obj_id & HPDF_OTYPE_INDIRECT) {
        HPDF_Proxy proxy = HPDF_Proxy_New (array->mmgr, obj);

        if (!proxy) {
            HPDF_Obj_Free (array->mmgr, obj);
            return HPDF_Error_GetCode (array->error);
        }

        proxy->header.obj_id |= HPDF_OTYPE_DIRECT;
        obj = proxy;
    } else
        header->obj_id |= HPDF_OTYPE_DIRECT;

    ret = HPDF_List_Add (array->list, obj);
    if (ret != HPDF_OK)
        HPDF_Obj_Free (array->mmgr, obj);

    return ret;
}

HPDF_UINT
HPDF_Array_Items  (HPDF_Array array)
{
    return array->list->count;
}

HPDF_STATUS
HPDF_Array_Insert  (HPDF_Array  array,
                    void        *target,
                    void        *obj)
{
    HPDF_Obj_Header *header;
    HPDF_STATUS ret;
    HPDF_UINT i;

    HPDF_PTRACE((" HPDF_Array_Insert\n"));

    if (!obj) {
        if (HPDF_Error_GetCode (array->error) == HPDF_OK)
            return HPDF_SetError (array->error, HPDF_INVALID_OBJECT, 0);
        else
            return HPDF_INVALID_OBJECT;
    }

    header = (HPDF_Obj_Header *)obj;

    if (header->obj_id & HPDF_OTYPE_DIRECT) {
        HPDF_PTRACE((" HPDF_Array_Add this object cannot owned by array "
                "obj=0x%08X\n", (HPDF_UINT)array));

        return HPDF_SetError (array->error, HPDF_INVALID_OBJECT, 0);
    }

    if (array->list->count >= HPDF_LIMIT_MAX_ARRAY) {
        HPDF_PTRACE((" HPDF_Array_Add exceed limitatin of array count(%d)\n",
                    HPDF_LIMIT_MAX_ARRAY));

        HPDF_Obj_Free (array->mmgr, obj);

        return HPDF_SetError (array->error, HPDF_ARRAY_COUNT_ERR, 0);
    }

    if (header->obj_id & HPDF_OTYPE_INDIRECT) {
        HPDF_Proxy proxy = HPDF_Proxy_New (array->mmgr, obj);

        if (!proxy) {
            HPDF_Obj_Free (array->mmgr, obj);
            return HPDF_Error_GetCode (array->error);
        }

        proxy->header.obj_id |= HPDF_OTYPE_DIRECT;
        obj = proxy;
    } else
        header->obj_id |= HPDF_OTYPE_DIRECT;

    /* get the target-object from object-list
     * consider that the pointer contained in list may be proxy-object.
     */
    for (i = 0; i < array->list->count; i++) {
        void *ptr = HPDF_List_ItemAt (array->list, i);
        void *obj_ptr;

        header = (HPDF_Obj_Header *)obj;
        if (header->obj_class == HPDF_OCLASS_PROXY)
            obj_ptr = ((HPDF_Proxy)ptr)->obj;
        else
            obj_ptr = ptr;

        if (obj_ptr == target) {
            ret = HPDF_List_Insert (array->list, ptr, obj);
            if (ret != HPDF_OK)
                HPDF_Obj_Free (array->mmgr, obj);

            return ret;
        }
    }

    HPDF_Obj_Free (array->mmgr, obj);

    return HPDF_ITEM_NOT_FOUND;
}

void*
HPDF_Array_GetItem  (HPDF_Array   array,
                     HPDF_UINT    index,
                     HPDF_UINT16  obj_class)
{
    void *obj;
    HPDF_Obj_Header *header;

    HPDF_PTRACE((" HPDF_Array_GetItem\n"));

    obj = HPDF_List_ItemAt (array->list, index);

    if (!obj) {
        HPDF_SetError (array->error, HPDF_ARRAY_ITEM_NOT_FOUND, 0);
        return NULL;
    }

    header = (HPDF_Obj_Header *)obj;

    if (header->obj_class == HPDF_OCLASS_PROXY) {
        obj = ((HPDF_Proxy)obj)->obj;
        header = (HPDF_Obj_Header *)obj;
    }

    if ((header->obj_class & HPDF_OCLASS_ANY) != obj_class) {
        HPDF_SetError (array->error, HPDF_ARRAY_ITEM_UNEXPECTED_TYPE, 0);

        return NULL;
    }

    return obj;
}

void
HPDF_Array_Clear  (HPDF_Array  array)
{
    HPDF_UINT i;

    HPDF_PTRACE((" HPDF_Array_Clear\n"));

    if (!array)
        return;

    for (i = 0; i < array->list->count; i++) {
        void * obj = HPDF_List_ItemAt (array->list, i);

        if (obj) {
            HPDF_Obj_Free (array->mmgr, obj);
        }
    }

    HPDF_List_Clear (array->list);
}


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

<TITLE>
Uses of Class edu.cmu.cs.stage3.alice.authoringtool.util.ElementPopupUtilities.DeleteRunnable
</TITLE>

<META NAME="date" CONTENT="2011-12-11">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
edu.cmu.cs.stage3.alice.authoringtool.util.ElementPopupUtilities.DeleteRunnable

Packages that use ElementPopupUtilities.DeleteRunnable

edu.cmu.cs.stage3.alice.authoringtool.dialog

Uses of ElementPopupUtilities.DeleteRunnable in edu.cmu.cs.stage3.alice.authoringtool.dialog

Methods in edu.cmu.cs.stage3.alice.authoringtool.dialog with parameters of type ElementPopupUtilities.DeleteRunnable

 void
DeleteContentPane.setDeleteRunnable(ElementPopupUtilities.DeleteRunnable deleteRunnable)

static void
DeleteContentPane.showDeleteDialog(ElementPopupUtilities.DeleteRunnable deleteRunnable,
                 AuthoringTool authoringTool)

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes


text:
DoctrineMongoDBBundle Configuration
===================================

Sample Configuration
--------------------

.. code-block:: yaml

    # app/config/config.yml
    doctrine_mongodb:
        connections:
            default:
                server: mongodb://localhost:27017
                options: {}
        default_database: hello_%kernel.environment%
        document_managers:
            default:
                mappings:
                    AcmeDemoBundle: ~
                filters:
                    filter-name:
                        class: Class\Example\Filter\ODM\ExampleFilter
                        enabled: true
                metadata_cache_driver: array # array, apc, xcache, memcache

If you wish to use memcache to cache your metadata, you need to configure the
``Memcache`` instance; for example, you can do the following:

.. configuration-block::

    .. code-block:: yaml

        # app/config/config.yml
        doctrine_mongodb:
            default_database: hello_%kernel.environment%
            connections:
                default:
                    server: mongodb://localhost:27017
                    options: {}
            document_managers:
                default:
                    mappings:
                        AcmeDemoBundle: ~
                    metadata_cache_driver:
                        type: memcache
                        class: Doctrine\Common\Cache\MemcacheCache
                        host: localhost
                        port: 11211
                        instance_class: Memcache

    .. code-block:: xml

        <?xml version="1.0" ?>

        <container xmlns="http://symfony.com/schema/dic/services"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:doctrine_mongodb="http://symfony.com/schema/dic/doctrine/odm/mongodb"
            xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
                                http://symfony.com/schema/dic/doctrine/odm/mongodb http://symfony.com/schema/dic/doctrine/odm/mongodb/mongodb-1.0.xsd">

            <doctrine_mongodb:config default-database="hello_%kernel.environment%">
                <doctrine_mongodb:document-manager id="default">
                    <doctrine_mongodb:mapping name="AcmeDemoBundle" />
                    <doctrine_mongodb:metadata-cache-driver type="memcache">
                        <doctrine_mongodb:class>Doctrine\Common\Cache\MemcacheCache</doctrine_mongodb:class>
                        <doctrine_mongodb:host>localhost</doctrine_mongodb:host>
                        <doctrine_mongodb:port>11211</doctrine_mongodb:port>
                        <doctrine_mongodb:instance-class>Memcache</doctrine_mongodb:instance-class>
                    </doctrine_mongodb:metadata-cache-driver>
                </doctrine_mongodb:document-manager>
                <doctrine_mongodb:connection id="default" server="mongodb://localhost:27017">
                    <doctrine_mongodb:options>
                    </doctrine_mongodb:options>
                </doctrine_mongodb:connection>
            </doctrine_mongodb:config>
        </container>

Mapping Configuration
~~~~~~~~~~~~~~~~~~~~~

Explicit definition of all the mapped documents is the only necessary
configuration for the ODM and there are several configuration options that you
can control. The following configuration options exist for a mapping:

- ``type`` One of ``annotations``, ``xml``, ``yml``, ``php`` or ``staticphp``.
  This specifies which type of metadata type your mapping uses.

- ``dir`` Path to the mapping or entity files (depending on the driver). If
  this path is relative it is assumed to be relative to the bundle root. This
  only works if the name of your mapping is a bundle name. If you want to use
  this option to specify absolute paths you should prefix the path with the
  kernel parameters that exist in the DIC (for example %kernel.root_dir%).

- ``prefix`` A common namespace prefix that all documents of this mapping
  share. This prefix should never conflict with prefixes of other defined
  mappings otherwise some of your documents cannot be found by Doctrine. This
  option defaults to the bundle namespace + ``Document``, for example for an
  application bundle called ``AcmeHelloBundle``, the prefix would be
  ``Acme\HelloBundle\Document``.

- ``alias`` Doctrine offers a way to alias document namespaces to simpler,
  shorter names to be used in queries or for Repository access.

- ``is_bundle`` This option is a derived value from ``dir`` and by default is
  set to true if dir is relative proved by a ``file_exists()`` check that
  returns false. It is false if the existence check returns true. In this case
  an absolute path was specified and the metadata files are most likely in a
  directory outside of a bundle.

To avoid having to configure lots of information for your mappings you should
follow these conventions:

1. Put all your documents in a directory ``Document/`` inside your bundle. For
   example ``Acme/HelloBundle/Document/``.

2. If you are using xml, yml or php mapping put all your configuration files
   into the ``Resources/config/doctrine/`` directory
   suffixed with mongodb.xml, mongodb.yml or mongodb.php respectively.

3. Annotations is assumed if a ``Document/`` but no
   ``Resources/config/doctrine/`` directory is found.

The following configuration shows a bunch of mapping examples:

.. code-block:: yaml

    doctrine_mongodb:
        document_managers:
            default:
                mappings:
                    MyBundle1: ~
                    MyBundle2: yml
                    MyBundle3: { type: annotation, dir: Documents/ }
                    MyBundle4: { type: xml, dir: Resources/config/doctrine/mapping }
                    MyBundle5:
                        type: yml
                        dir: my-bundle-mappings-dir
                        alias: BundleAlias
                    doctrine_extensions:
                        type: xml
                        dir: %kernel.root_dir%/../src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Documents
                        prefix: DoctrineExtensions\Documents\
                        alias: DExt

Filters
~~~~~~~

You can easily add filters to a document manager by using the
following syntax:

.. code-block:: yaml

    doctrine_mongodb:
        document_managers:
            default:
                filters:
                    filter-one:
                        class: Class\ExampleOne\Filter\ODM\ExampleFilter
                        enabled: true
                    filter-two:
                        class: Class\ExampleTwo\Filter\ODM\ExampleFilter
                        enabled: false

Filters are used to append conditions to the queryBuilder regardless of where the query is generated.

Multiple Connections
~~~~~~~~~~~~~~~~~~~~

If you need multiple connections and document managers you can use the
following syntax:

.. configuration-block

    .. code-block:: yaml

        doctrine_mongodb:
            default_database: hello_%kernel.environment%
            default_connection: conn2
            default_document_manager: dm2
            metadata_cache_driver: apc
            connections:
                conn1:
                    server: mongodb://localhost:27017
                conn2:
                    server: mongodb://localhost:27017
            document_managers:
                dm1:
                    connection: conn1
                    metadata_cache_driver: xcache
                    mappings:
                        AcmeDemoBundle: ~
                dm2:
                    connection: conn2
                    mappings:
                        AcmeHelloBundle: ~

    .. code-block:: xml

        <?xml version="1.0" ?>

        <container xmlns="http://symfony.com/schema/dic/services"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:doctrine_mongodb="http://symfony.com/schema/dic/doctrine/odm/mongodb"
            xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
                                http://symfony.com/schema/dic/doctrine/odm/mongodb http://symfony.com/schema/dic/doctrine/odm/mongodb/mongodb-1.0.xsd">

            <doctrine_mongodb:config
                    default-database="hello_%kernel.environment%"
                    default-document-manager="dm2"
                    default-connection="dm2"
                    proxy-namespace="MongoDBODMProxies"
                    auto-generate-proxy-classes="true">
                <doctrine_mongodb:connection id="conn1" server="mongodb://localhost:27017">
                    <doctrine_mongodb:options>
                    </doctrine_mongodb:options>
                </doctrine_mongodb:connection>
                <doctrine_mongodb:connection id="conn2" server="mongodb://localhost:27017">
                    <doctrine_mongodb:options>
                    </doctrine_mongodb:options>
                </doctrine_mongodb:connection>
                <doctrine_mongodb:document-manager id="dm1" metadata-cache-driver="xcache" connection="conn1">
                    <doctrine_mongodb:mapping name="AcmeDemoBundle" />
                </doctrine_mongodb:document-manager>
                <doctrine_mongodb:document-manager id="dm2" connection="conn2">
                    <doctrine_mongodb:mapping name="AcmeHelloBundle" />
                </doctrine_mongodb:document-manager>
            </doctrine_mongodb:config>
        </container>

Now you can retrieve the configured services connection services::

    $conn1 = $container->get('doctrine_mongodb.odm.conn1_connection');
    $conn2 = $container->get('doctrine_mongodb.odm.conn2_connection');

And you can also retrieve the configured document manager services which utilize the above
connection services::

    $dm1 = $container->get('doctrine_mongodb.odm.dm1_document_manager');
    $dm2 = $container->get('doctrine_mongodb.odm.dm2_document_manager');

Connecting to a pool of mongodb servers on 1 connection
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It is possible to connect to several mongodb servers on one connection if
you are using a replica set by listing all of the servers within the connection
string as a comma separated list.

.. configuration-block::

    .. code-block:: yaml

        doctrine_mongodb:
            # ...
            connections:
                default:
                    server: 'mongodb://mongodb-01:27017,mongodb-02:27017,mongodb-03:27017'

Where mongodb-01, mongodb-02 and mongodb-03 are the machine hostnames. You
can also use IP addresses if you prefer.

Retrying Connections and Queries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Doctrine MongoDB supports automatically retrying connections and queries after
encountering an exception, which is helpful when dealing with situations such as
replica set failovers. This alleviates much of the need to catch exceptions from
the MongoDB PHP driver in your application and manually retry operations.

You may specify the number of times to retry connections and queries via the
`retry_connect` and `retry_query` options in the document manager configuration.
These options default to zero, which means that no operations will be retried.

Full Default Configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~

.. configuration-block::

    .. code-block:: yaml

        doctrine_mongodb:
            document_managers:

                # Prototype
                id:
                    connection:           ~
                    database:             ~
                    logging:              true
                    auto_mapping:         false
                    retry_connect:        0
                    retry_query:          0
                    metadata_cache_driver:
                        type:                 ~
                        class:                ~
                        host:                 ~
                        port:                 ~
                        instance_class:       ~
                    mappings:

                        # Prototype
                        name:
                            mapping:              true
                            type:                 ~
                            dir:                  ~
                            prefix:               ~
                            alias:                ~
                            is_bundle:            ~
            connections:

                # Prototype
                id:
                    server:               ~
                    options:
                        connect:              ~
                        persist:              ~
                        timeout:              ~
                        replicaSet:           ~
                        username:             ~
                        password:             ~
            proxy_namespace:      MongoDBODMProxies
            proxy_dir:            %kernel.cache_dir%/doctrine/odm/mongodb/Proxies
            auto_generate_proxy_classes:  false
            hydrator_namespace:   Hydrators
            hydrator_dir:         %kernel.cache_dir%/doctrine/odm/mongodb/Hydrators
            auto_generate_hydrator_classes:  false
            default_document_manager:  ~
            default_connection:   ~
            default_database:     default


text:
return Def.ActorFrame{

	Def.Quad{
		Name="Horizontal",
		InitCommand = function(self)
			self:x(-4):zoomto(capWideScale(get43size(348),348),52):halign(0)
			self:diffuseramp()
			self:effectperiod(1)
			self:effectcolor1(color("#FFFFFF00"))
			self:effectcolor2(Alpha(getMainColor("highlight"),0.2))
		end,
		SetCommand=function(self)
			if GAMESTATE:GetCurrentSteps(GAMESTATE:GetEnabledPlayers()[1]) then
				self:effectcolor2(Alpha(getDifficultyColor(GAMESTATE:GetHardestStepsDifficulty()),0.2))
			else
				self:effectcolor2(Alpha(getMainColor("highlight"),0.2))
			end
		end,
		CurrentStepsP1ChangedMessageCommand = function(self) self:queuecommand('Set') end
	}

}


text:
package io.feellix.restvideodemo.domain.video;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.core.convert.ConversionService;
import org.springframework.web.multipart.MultipartFile;

import java.util.Collections;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;

public class VideoServiceTest {

    private static final Long TEST_VIDEO_ID = 1L;
    private VideoService objectUnderTest;
    @Mock
    private MultipartFile mockMultipartFile;
    @Mock
    private VideoDTO videoDTOMock;
    @Mock
    private VideoFactory videoFactoryMock;
    @Mock
    private VideoRepository videoRepositoryMock;
    @Mock
    private ConversionService conversionServiceMock;
    @Mock
    private VideoEntity videoEntityMock;

    @Before
    public void setUp() throws Exception {
        MockitoAnnotations.initMocks(this);
        objectUnderTest = new VideoService(videoFactoryMock, videoRepositoryMock, conversionServiceMock);
    }

    @Test
    public void shouldUploadVideo() {
        given(videoFactoryMock.createFrom(mockMultipartFile)).willReturn(videoEntityMock);
        given(videoRepositoryMock.save(videoEntityMock)).willReturn(videoEntityMock);
        given(conversionServiceMock.convert(videoEntityMock, VideoDTO.class)).willReturn(videoDTOMock);

        VideoDTO result = objectUnderTest.createFrom(mockMultipartFile);

        assertThat(result).isEqualTo(videoDTOMock);
    }

    @Test
    public void getVideo() {
        given(videoRepositoryMock.getOne(TEST_VIDEO_ID)).willReturn(videoEntityMock);
        given(conversionServiceMock.convert(videoEntityMock, VideoDTO.class)).willReturn(videoDTOMock);

        VideoDTO result = objectUnderTest.getOne(TEST_VIDEO_ID);

        assertThat(result).isEqualTo(videoDTOMock);
    }

    @Test
    public void getAllVideos() {
        given(videoRepositoryMock.findAll()).willReturn(Collections.singletonList(videoEntityMock));
        given(conversionServiceMock.convert(videoEntityMock, VideoDTO.class)).willReturn(videoDTOMock);

        List<VideoDTO> result = objectUnderTest.getAllVideos();

        assertThat(result).containsExactly(videoDTOMock);
    }

}


text:
declare module "minimatch" {

	function M(target:string, pattern:string, options?:M.IOptions): boolean;

	module M {
		function match(filenames:string[], pattern:string, options?:IOptions):string[];
		function filter(pattern:string, options?:IOptions): (target: string) => boolean;

		var Minimatch:IMinimatchStatic;

		interface IOptions {
			debug?:boolean;
			nobrace?:boolean;
			noglobstar?:boolean;
			dot?:boolean;
			noext?:boolean;
			nocase?:boolean;
			nonull?:boolean;
			matchBase?:boolean;
			nocomment?:boolean;
			nonegate?:boolean;
			flipNegate?:boolean;
		}

		interface IMinimatchStatic {
			new (pattern:string, options?:IOptions):IMinimatch;
		}

		interface IMinimatch {
			debug():void;
			make():void;
			parseNegate():void;
			braceExpand(pattern:string, options:IOptions):void;
			parse(pattern:string, isSub?:boolean):void;
			makeRe():RegExp; // regexp or boolean
			match(file:string):boolean;
			matchOne(files:string[], pattern:string[], partial:any):boolean;
		}
	}

export = M;
}


text:
var httpProxy = require('http-proxy')

var _this = this

function Proxy(url) {
  if (!(this instanceof Proxy)) return new Proxy(url)
  _this.proxyUrl = url
  _this.proxy = httpProxy.createProxyServer({})
}

Proxy.prototype.middleFunc = function livereload(req, res, next) {
  _this.proxy.web(req, res, { target: _this.proxyUrl })
}

module.exports = Proxy


text:
<?php

require_once '../lib/db.php';
require_once '../lib/stdlib.php';

$site = new csite(True);
$site->addHeader(LAYOUT_PATH . "header.php");
$site->addFooter(LAYOUT_PATH . "footer.php");

$page = new cpage(basename(__FILE__));
// Set up the varialbles to pass to the view
$page->userPosition = $_SESSION['user_position'];
$page->reservations = R::getAll("SELECT * FROM reservation where status != 'Out'");
$page->rooms = R::getAll("SELECT * FROM room");
$page->roomInventory = R::getAll("SELECT * FROM room_inventory where status != 'Out'");
// If "view" is passed using the query string, set the view variable to
// trigger the correct modal dialog to be displayed in the view
$page->view = (isset($_GET["view"])) ? $_GET["view"] : Null;
$site->setPage($page);
$site->render($page);
?>


text:
using System.Web;
using System.Web.Mvc;

namespace John.Doyle.Mediocore.Developer
{
    public class FilterConfig
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }
    }
}


text:
package org.tud.inf.st.mbt.scenario.ui;

import java.util.Random;

import org.eclipse.emf.ecore.EObject;
import org.tud.inf.st.mbt.core.AbstractModelElement;
import org.tud.inf.st.mbt.emf.graphicaleditor.EMFModelIndex;

public class ScenarioModelIndex extends EMFModelIndex {
	public ScenarioModelIndex(EObject topContainer) {
		super(topContainer);
	}

	@Override
	public String getIdByObject(EObject obj) {
		if(obj instanceof AbstractModelElement){
			String id = ((AbstractModelElement) obj).getId();
			if(id == null){
				id = "scen-"+ new Random().nextLong();
				((AbstractModelElement) obj).setId(id);
			}
			return id;
		}
		return null;
	}
}


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

  <title>Description of plx_event_ts</title>
  <meta name="keywords" content="plx_event_ts">
  <meta name="description" content="plx_event_ts(filename, channel) Read event timestamps from a .plx file">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html © 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../../m2html.css">

plx_event_ts

PURPOSE

plx_event_ts(filename, channel) Read event timestamps from a .plx file

SYNOPSIS

function [n, ts, sv] = plx_event_ts(filename, ch)

DESCRIPTION

 plx_event_ts(filename, channel) Read event timestamps from a .plx file

 [n, ts, sv] = plx_event_ts(filename, channel)

 INPUT:
   filename - if empty string, will use File Open dialog
   channel - 1-based external channel number
             strobed channel has channel number 257
 OUTPUT:
   n - number of timestamps
   ts - array of timestamps
   sv - array of strobed event values (filled only if channel is 257)

CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

SOURCE CODE

0001 function [n, ts, sv] = plx_event_ts(filename, ch)
0002 % plx_event_ts(filename, channel) Read event timestamps from a .plx file
0003 %
0004 % [n, ts, sv] = plx_event_ts(filename, channel)
0005 %
0006 % INPUT:
0007 %   filename - if empty string, will use File Open dialog
0008 %   channel - 1-based external channel number
0009 %             strobed channel has channel number 257
0010 % OUTPUT:
0011 %   n - number of timestamps
0012 %   ts - array of timestamps
0013 %   sv - array of strobed event values (filled only if channel is 257)
0014
0015 if(nargin ~= 2)
0016    disp('2 input arguments are required')
0017    return
0018 end
0019
0020 n = 0;
0021 ts = 0;
0022 sv = 0;
0023
0024 if(isempty(filename))
0025    [fname, pathname] = uigetfile('*.plx', 'Select a plx file');
0026     filename = strcat(pathname, fname);
0027 end
0028
0029 fid = fopen(filename, 'r');
0030 if(fid == -1)
0031     disp('cannot open file');
0032    return
0033 end
0034
0035 disp(strcat('file = ', filename));
0036
0037 % read file header
0038 header = fread(fid, 64, 'int32');
0039 freq = header(35);  % frequency
0040 ndsp = header(36);  % number of dsp channels
0041 nevents = header(37); % number of external events
0042 nslow = header(38);  % number of slow channels
0043 npw = header(39);  % number of points in wave
0044 npr = header(40);  % number of points before threshold
0045 tscounts = fread(fid, [5, 130], 'int32');
0046 wfcounts = fread(fid, [5, 130], 'int32');
0047 evcounts = fread(fid, [1, 512], 'int32');
0048
0049 % skip variable headers
0050 fseek(fid, 1020*ndsp + 296*nevents + 296*nslow, 'cof');
0051
0052 % read the data
0053 record = 0;
0054 while feof(fid) == 0
0055     type = fread(fid, 1, 'int16');
0056     upperbyte = fread(fid, 1, 'int16');
0057     timestamp = fread(fid, 1, 'int32');
0058     channel = fread(fid, 1, 'int16');
0059     unit = fread(fid, 1, 'int16');
0060     nwf = fread(fid, 1, 'int16');
0061     nwords = fread(fid, 1, 'int16');
0062     toread = nwords;
0063     if toread > 0
0064       wf = fread(fid, toread, 'int16');
0065     end
0066        if type == 4
0067          if channel == ch
0068                  n = n + 1;
0069                  ts(n) = timestamp;
0070                 sv(n) = unit;
0071            end
0072        end
0073
0074    record = record + 1;
0075    if feof(fid) == 1
0076       break
0077    end
0078
0079 end
0080 disp(strcat('number of timestamps = ', num2str(n)));
0081
0082 fclose(fid);

<address>Generated on Fri 12-Aug-2011 11:36:15 by m2html © 2005</address>


text:
package org.elasticsearch.xpack.ccr.rest;

import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestToXContentListener;
import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction;

import java.util.List;

import static org.elasticsearch.rest.RestRequest.Method.GET;

public class RestCcrStatsAction extends BaseRestHandler {

    @Override
    public List<Route> routes() {
        return List.of(new Route(GET, "/_ccr/stats"));
    }

    @Override
    public String getName() {
        return "ccr_stats";
    }

    @Override
    protected RestChannelConsumer prepareRequest(final RestRequest restRequest, final NodeClient client) {
        final CcrStatsAction.Request request = new CcrStatsAction.Request();
        return channel -> client.execute(CcrStatsAction.INSTANCE, request, new RestToXContentListener<>(channel));
    }

}


text:
package channelconfig

import (
	"math"
	"reflect"
	"testing"

	cb "github.com/hyperledger/fabric-protos-go/common"
	"github.com/hyperledger/fabric/bccsp"
	"github.com/hyperledger/fabric/bccsp/sw"
	"github.com/hyperledger/fabric/common/util"
	"github.com/stretchr/testify/require"
)

func TestInterface(t *testing.T) {
	_ = Channel(&ChannelConfig{})
}

func TestChannelConfig(t *testing.T) {
	cryptoProvider, err := sw.NewDefaultSecurityLevelWithKeystore(sw.NewDummyKeyStore())
	require.NoError(t, err)

	cc, err := NewChannelConfig(
		&cb.ConfigGroup{Groups: map[string]*cb.ConfigGroup{"UnknownGroupKey": {}}},
		cryptoProvider,
	)
	require.Error(t, err)
	require.Nil(t, cc)
}

func TestHashingAlgorithm(t *testing.T) {
	cc := &ChannelConfig{protos: &ChannelProtos{HashingAlgorithm: &cb.HashingAlgorithm{}}}
	require.Error(t, cc.validateHashingAlgorithm(), "Must supply hashing algorithm")

	cc = &ChannelConfig{protos: &ChannelProtos{HashingAlgorithm: &cb.HashingAlgorithm{Name: "MD5"}}}
	require.Error(t, cc.validateHashingAlgorithm(), "Bad hashing algorithm supplied")

	cc = &ChannelConfig{protos: &ChannelProtos{HashingAlgorithm: &cb.HashingAlgorithm{Name: bccsp.SHA256}}}
	require.NoError(t, cc.validateHashingAlgorithm(), "Allowed hashing algorithm SHA256 supplied")

	require.Equal(t, reflect.ValueOf(util.ComputeSHA256).Pointer(), reflect.ValueOf(cc.HashingAlgorithm()).Pointer(),
		"Unexpected hashing algorithm returned")

	cc = &ChannelConfig{protos: &ChannelProtos{HashingAlgorithm: &cb.HashingAlgorithm{Name: bccsp.SHA3_256}}}
	require.NoError(t, cc.validateHashingAlgorithm(), "Allowed hashing algorithm SHA3_256 supplied")

	require.Equal(t, reflect.ValueOf(util.ComputeSHA3256).Pointer(), reflect.ValueOf(cc.HashingAlgorithm()).Pointer(),
		"Unexpected hashing algorithm returned")
}

func TestBlockDataHashingStructure(t *testing.T) {
	cc := &ChannelConfig{protos: &ChannelProtos{BlockDataHashingStructure: &cb.BlockDataHashingStructure{}}}
	require.Error(t, cc.validateBlockDataHashingStructure(), "Must supply block data hashing structure")

	cc = &ChannelConfig{protos: &ChannelProtos{BlockDataHashingStructure: &cb.BlockDataHashingStructure{Width: 7}}}
	require.Error(t, cc.validateBlockDataHashingStructure(), "Invalid Merkle tree width supplied")

	var width uint32 = math.MaxUint32
	cc = &ChannelConfig{protos: &ChannelProtos{BlockDataHashingStructure: &cb.BlockDataHashingStructure{Width: width}}}
	require.NoError(t, cc.validateBlockDataHashingStructure(), "Valid Merkle tree width supplied")

	require.Equal(t, width, cc.BlockDataHashingStructureWidth(), "Unexpected width returned")
}

func TestOrdererAddresses(t *testing.T) {
	cc := &ChannelConfig{protos: &ChannelProtos{OrdererAddresses: &cb.OrdererAddresses{}}}
	require.Error(t, cc.validateOrdererAddresses(), "Must supply orderer addresses")

	cc = &ChannelConfig{protos: &ChannelProtos{OrdererAddresses: &cb.OrdererAddresses{Addresses: []string{"127.0.0.1:7050"}}}}
	require.NoError(t, cc.validateOrdererAddresses(), "Invalid orderer address supplied")

	require.Equal(t, "127.0.0.1:7050", cc.OrdererAddresses()[0], "Unexpected orderer address returned")
}

func TestConsortiumName(t *testing.T) {
	cc := &ChannelConfig{protos: &ChannelProtos{Consortium: &cb.Consortium{Name: "TestConsortium"}}}
	require.Equal(t, "TestConsortium", cc.ConsortiumName(), "Unexpected consortium name returned")
}


text:
import styled from 'styled-components';

const LI = styled.li`
  padding: 0;
  list-style-type: none;
  width: 100%;
  position: relative;
  display: block;
`;

export default LI;


text:
#if NETSTANDARD16
using System.IO;
using System.Xml;

namespace BrightstarDB.Utils
{
    public static class WriterExtensions
    {
        public static void Close(this Stream stream)
        {
            stream.Dispose();
        }

        public static void Close(this BinaryWriter writer)
        {
            writer.Dispose();
        }

        public static void Close(this FileStream stream)
        {
            stream.Dispose();
        }

        public static void Close(this StreamWriter writer)
        {
            writer.Dispose();
        }

        public static void Close(this StreamReader reader)
        {
            reader.Dispose();
        }

        public static void Close(this XmlWriter writer)
        {
            writer.Dispose();
        }
    }
}
#endif


text:
@interface Example4ViewController : UIViewController

@end


text:
/*
 *   FILE: FlexNode.h
 * AUTHOR: Michael David Plotz
 *   DATE: Tue May 7 14:25:45 PDT 2013
 */

#ifndef __CCNODEUTIL_FLEXNODE_H__
#define __CCNODEUTIL_FLEXNODE_H__

#include "cocos2d.h"
#include "CCNodeUtil.h"

USING_NS_CC;

NS_CC_UTIL_BEGIN

class FlexNode : public CCNode
{
public:
    static FlexNode *create();

    FlexNode();
    virtual ~FlexNode();

    bool initFlexNode();

    float getWeight() { return m_weight; }
    FlexNode *setWeight(float value)
    {
        if (value > 0)
        {
            m_weight = value;
        }
        return this;
    }

protected:
private:
    FlexNode(const FlexNode& orig);
    FlexNode& operator=(const FlexNode& rhs);

    float m_weight;
};

NS_CC_UTIL_END

#endif /* __CCNODEUTIL_FLEXNODE_H__ */


text:
package guitests;

import org.junit.Test;

import seedu.tache.commons.core.Messages;
import seedu.tache.logic.commands.ViewCommand;

public class ViewCommandTest extends TaskManagerGuiTest {

    public static final String VIEW_DAY = "day";
    public static final String VIEW_WEEK = "week";
    public static final String VIEW_MONTH = "month";

    @Test
    public void view_dayView_success() {
        commandBox.runCommand(ViewCommand.COMMAND_WORD + " day");
        assertResultMessage(String.format(ViewCommand.MESSAGE_SUCCESS, VIEW_DAY));

        commandBox.runCommand(ViewCommand.SHORT_COMMAND_WORD + " day");
        assertResultMessage(String.format(ViewCommand.MESSAGE_SUCCESS, VIEW_DAY));
    }

    @Test
    public void view_weekView_success() {
        commandBox.runCommand(ViewCommand.COMMAND_WORD + " week");
        assertResultMessage(String.format(ViewCommand.MESSAGE_SUCCESS, VIEW_WEEK));

        commandBox.runCommand(ViewCommand.SHORT_COMMAND_WORD + " week");
        assertResultMessage(String.format(ViewCommand.MESSAGE_SUCCESS, VIEW_WEEK));
    }

    @Test
    public void view_monthView_success() {
        commandBox.runCommand(ViewCommand.COMMAND_WORD + " month");
        assertResultMessage(String.format(ViewCommand.MESSAGE_SUCCESS, VIEW_MONTH));

        commandBox.runCommand(ViewCommand.SHORT_COMMAND_WORD + " month");
        assertResultMessage(String.format(ViewCommand.MESSAGE_SUCCESS, VIEW_MONTH));
    }

    @Test
    public void view_invalidCommand_failure() {
        commandBox.runCommand("ve");
        assertResultMessage(Messages.MESSAGE_UNKNOWN_COMMAND);
    }

    @Test
    public void view_invalidParameter_failure() {
        commandBox.runCommand(ViewCommand.COMMAND_WORD + " mont");
        assertResultMessage(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, ViewCommand.MESSAGE_USAGE));
    }

}


text:
/*!
 * Kraken v7.1.1: A lightweight front-end boilerplate
 * (c) 2016 Chris Ferdinandi
 * MIT License
 * http://github.com/cferdinandi/kraken
 */

// Add your scripts here...