text:
<?php

namespace Ovh\Dedicated\Server;

use Ovh\Common\Exception\NotImplementedYetException;
use Ovh\Common\Exception\NotImplementedYetByOvhException;
use Ovh\Common\Ovh;
use Ovh\Dedicated\Server\ServerClient;
use Ovh\Common\Task;

class Server
{
	private $domain = null;
	private static $serverClient = null;

	/**
	 * @param string $domain
	 */
	public function __construct($domain)
	{
		$this->setDomain($domain);
	}

	/**
	 * Return Dedicated Server client
	 *
	 * @return null|serverClient
	 */
	private static function getClient()
	{
		if (!self::$serverClient instanceof ServerClient){
			self::$serverClient=new ServerClient();
		};
		return self::$serverClient;
	}

	/**
	 * Set domain
	 *
	 * @param string $domain
	 */
	public function setDomain($domain)
	{
		$this->domain = $domain;
	}

	/**
	 * Get domain
	 *
	 * @return null | string domain
	 */
	public function getDomain()
	{
		return $this->domain;
	}

	###
	# Mains methods from OVH Rest API
	##

	/**
	 *  Get Dedicated Server properties
	 *
	 *  @return object
	 *
	 */
	public function  getProperties()
	{
		return json_decode(self::getClient()->getProperties($this->getDomain()));
	}

	/**
	 * @return mixed
	 */
	public function getBoot()
	{
		return json_decode(self::getClient()->getBoot($this->getDomain()));
	}

/** BackupFTP - added in 0.1.2 **/

	/*
	* Get backup FTP assigned to server
	*
	* @return mixed
	*/
	public function getbackupFTP()
	{
		return json_decode(self::getClient()->getBackupFTP($this->getDomain()));
	}

	/*
	* Create Backup FTP on server
	*
	* @return mixed
	*/
	public function createBackupFTP()
	{
		return json_decode(self::getClient()->createBackupFTP($this->getDomain()));
	}

	/*
	* Delete backup FTP
	*
	*/
	public function deleteBackupFTP()
	{
		return json_decode(self::getClient()->deleteBackupFTPAccess($this->getDomain()));
	}

	/*
	* Change backup FTP Password
	*
	*/
	public function changeBackupFTPPassword()
	{
		return json_decode(self::getClient()->changeBackupFTPPassword($this->getDomain()));
	}

	/*
	* Get backup FTP ACL list
	*
	* @returns object (array of ACL)
	*/
	public function getBackupFTPAccess()
	{
		return json_decode(self::getClient()->getBackupFTPAccess($this->getDomain()));
	}

	/*
	* Create backup FTP ACL for IPBlock (creates with default ACL)
	*
	* @returns mixed
	*/
	public function createBackupFTPAccess($ipBlock)
	{
		return json_decode(self::getClient()->createBackupFTPAccess($this->getDomain(), $ipBlock));
	}

	/*
	* Get Authorizable IPblocks on this backup FTP space (IPblocks assoc with the server)
	*
	* @returns object (array of IPblocks)
	*/
	public function getBackupFTPAuthorizableBlocks()
	{
		return json_decode(self::getClient()->getBackupFTPAuthorizableBlocks($this->getDomain()));
	}

	/*
	* Get BackupFTPAccessBlock - Get ACL for specific IPBlock
	*
	* @returns object (ACL information)
	*/
	public function getBackupFTPaccessBlock($ipBlock)
	{
		return json_decode(self::getClient()->getBackupFTPaccessBlock($this->getDomain(),$ipBlock));
	}

	/*
	* delete backup FTP ACL for IPBlock
	*
	* @returns object
	*/
	public function deleteBackupFTPaccessBlock($ipBlock)
	{
		return json_decode(self::getClient()->deleteBackupFTPaccessBlock($this->getDomain(),$ipBlock));
	}

	/*
	* Set backup FTP ACL for IPblock
	*
	* returns object (null??)
	*/
	public function setBackupFTPaccessBlock($ipBlock, $ftp, $nfs, $cifs)
	{
		return json_decode(self::getClient()->setBackupFTPaccessBlock($this->getDomain(),$ipBlock, $ftp, $nfs, $cifs));
	}

	/**
	 * @param $bootId
	 */
	public function getBootProperties($bootId)
	{
		return json_decode(self::getClient()->getBootProperties($this->getDomain(), $bootId));
	}

	/**
	 * @param $bootId
	 */
	public function getBootOptions($bootId)
	{
		return json_decode(self::getClient()->getBootOptions($this->getDomain(), $bootId));
	}

	/**
	 * @param $bootId
	 */
	public function getBootOptionsProperties($bootId, $option)
	{
		return json_decode(self::getClient()->getBootOptionsProperties($this->getDomain(), $bootId, $option));
	}

	/**
     * @param $bootDevice
     * @return bool true
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     */
    public function setBootdevice($bootDevice){
		// ugly alert - the OVH API assumes any values not passed as part of the "PUT" are null/blank/0.
		// so when we reset the boot device, we need to capture the current state of =monitoring= , =rootdevice= and =state= from
		// getProperties and pass those along too... easiest way is to call getProperties as part of the setBootDevice call, and
		// update hoping that nothing else is updating in the intervening nanoseconds

        self::getClient()->setBootDevice($this->getDomain(), $this->getProperties(), $bootDevice);
        return true;
    }

    /**
     * @param $enable
     * @return bool true
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     */
    public function setMonitoring($enable){
        self::getClient()->setMonitoring($this->getDomain(),$enable);
        return true;
    }

    /**
     * Set netboot
     *
     * @param $netbootId
     * @return bool true
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     */
    public function setNetBoot($netbootId){
        self::getClient()->setNetboot($this->getDomain(),$netbootId);
        return true;
    }

    /**
     * Get IPS
     *
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     * @return array of strings
     */
    public function getIps()
    {
        return json_decode(self::getClient()->getIps($this->getDomain()));
    }

    /**
     * Get MRTG
     * Ajout by @Thibautg16 le 11/11/2013
     *
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     * @return array of strings
     */
    public function getMrtg($period,$type)
    {
        return json_decode(self::getClient()->getMrtg($this->getDomain(),$period,$type));
    }

    /**
     * Reboot server
     *
     * @return bool true
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     */
    public function reboot()
    {
        self::getClient()->reboot($this->getDomain());
        return true;
    }

    /**
     *  Get secondary DNS
     *
     * @return array
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     */
    public function getSecondaryDnsDomains()
    {
        return json_decode(self::getClient()->getSecondaryDnsDomains($this->getDomain()));
    }

    /**
     * Add domain to secondary DNS
     *
     * @param string $domain2add
     * @param string ipv4 $ip
     * @return bool true
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     */
    public function addSecondaryDnsDomains($domain2add, $ip){
        self::getClient()->addSecondaryDnsDomains($this->getDomain(),$domain2add,$ip);
        return true;
    }

    /**
     * Get info about $domain2getInfo
     *
     * @param $domain2getInfo
     * @return array
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     */
    public function getSecondaryDnsDomainsInfo($domain2getInfo){
        return json_decode(self::getClient()->getSecondaryDnsDomainsInfo($this->getDomain(), $domain2getInfo));
    }

    /**
     * Delete a domain on secondayr DNS server
     *
     * @param $domain2delete
     * @return bool true
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     */
    public function deleteSecondaryDnsDomains($domain2delete){
        json_decode(self::getClient()->deleteSecondaryDnsDomains($this->getDomain(), $domain2delete));
        return true;
    }

    /**
     * Get info about secondary DNS server of $domain2getInfo
     *
     * @param $domain2getInfo
     * @return array
     * @throws Exception\ServerException
     * @throws \Ovh\Common\Exception\BadMethodCallException
     */
    public function getSecondaryDnsServerInfo($domain2getInfo){
        return json_decode(self::getClient()->getSecondaryDnsServerInfo($this->getDomain(), $domain2getInfo));
    }

	/**
	 *  Get Dedicated Server Service Infos
	 *
	 *  @return object
	 *
	 */
	public function  getServiceInfos()
	{
		return json_decode(self::getClient()->getServiceInfos($this->getDomain()));
	}

// Network additions in v.1.0.2
	/*
	* Get Network Configuration details
	*
	* @ returns object containing network params
	*/
	public function  getNetworkSpecifications()
	{
		return json_decode(self::getClient()->getNetworkSpecifications($this->getDomain()));
	}

	/*
	* Get Network Burst setting
	*
	* @return mixed
	 */
	public function getBurst()
	{
		return json_decode(self::getClient()->getBurst($this->getDomain()));
	}

	#Task
	/**
	 * Return tasks associated with this Dedicated Server (current and past)
	 *
	 * @return array of int
	 */
	public function getTasks()
	{
		return json_decode(self::getClient()->getTasks($this->getDomain()));
	}

	/**
	 * @param $taskId
	 * @return Task
	 */
	public function getTaskProperties($taskId)
	{
		return json_decode(self::getClient()->getTaskProperties($this->getDomain(), $taskId));
	}

	/*********** Interventions ***********/
        /**
        * Get Interventions
        * Retourne les interventions associés au serveur dédié (en cours et passé)
        * Ajout par @Thibautg16 le 22/11/2013
        *
        * @throws Exception\ServerException
        * @throws \Ovh\Common\Exception\BadMethodCallException
        * @return array of int
        */
        public function getInterventions(){
                return json_decode(self::getClient()->getInterventions($this->getDomain()));
        }

        /**
        * Get InterventionsProperties
        * Retourne les informations d'une intervention suivant son identifiant
        * Ajout by @Thibautg16 le 22/11/2013
        *
        * @throws Exception\ServerException
        * @throws \Ovh\Common\Exception\BadMethodCallException
        * @return array(date,type,id)
        */
        public function getInterventionProperties($interventionId){
                return json_decode(self::getClient()->getInterventionProperties($this->getDomain(), $interventionId));
        }

    /*********** Statistics (RTM) ***********/
		/**
		* Get Statistics (RTM)
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return object
		*/
		public function getStatistics(){
				return json_decode(self::getClient()->getStatistics($this->getDomain()));
			}

		/**
		* Get Statistics Chart Values
		* Ajout by @Thibautg16 le 11/11/2013
		*
		* @param $period
		* @param $type
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return object
		*/
		public function getStatisticsChart($period,$type){
			return json_decode(self::getClient()->getStatisticsChart($this->getDomain(),$period,$type));
		}

		/**
		* Get Statistics Connection
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return array
		*/
		public function getStatisticsConnection(){
			return json_decode(self::getClient()->getStatisticsConnection($this->getDomain()));
		}

		/**
		* Get Statistics Cpu
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsCpu(){
			return json_decode(self::getClient()->getStatisticsCpu($this->getDomain()));
		}

		/**
		* Get Statistics Disk
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Array
		*/
		public function getStatisticsDisk(){
			return json_decode(self::getClient()->getStatisticsDisk($this->getDomain()));
		}

		/**
		* Get Disk Properties
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @param $disk
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsDiskProperties($disk){
			return json_decode(self::getClient()->getStatisticsDiskProperties($this->getDomain(),$disk));
		}

		/**
		* Get SMART Disk Informations
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @param $disk
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsDiskSmart($disk){
			return json_decode(self::getClient()->getStatisticsDiskSmart($this->getDomain(),$disk));
		}

		/**
		* Get Statistics Load
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsLoad(){
			return json_decode(self::getClient()->getStatisticsLoad($this->getDomain()));
		}

		/**
		* Get Statistics Memory
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Array
		*/
		public function getStatisticsMemory(){
				return json_decode(self::getClient()->getStatisticsMemory($this->getDomain()));
		}

		/**
		* Get Motherboard Informations
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsMotherboard(){
			return json_decode(self::getClient()->getStatisticsMotherboard($this->getDomain()));
		}

		/**
		* Get Os Informations
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsOs(){
			return json_decode(self::getClient()->getStatisticsOs($this->getDomain()));
		}

		/**
		* Get Partitions Informations
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Array
		*/
		public function getStatisticsPartition(){
			return json_decode(self::getClient()->getStatisticsPartition($this->getDomain()));
		}

		/**
		* Get Partition Properties
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @param $partition
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsPartitionProperties($partition){
			return json_decode(self::getClient()->getStatisticsPartitionProperties($this->getDomain(),$partition));
		}

		/**
		* Get Disk Properties
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @param $partition
		* @param $period
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsPartitionChart($partition, $period){
			return json_decode(self::getClient()->getStatisticsPartitionChart($this->getDomain(),$partition, $period));
		}

		/**
		* Get PCI Devices Informations
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsPci(){
			return json_decode(self::getClient()->getStatisticsPci($this->getDomain()));
		}

		/**
		* Get Process
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Array
		*/
		public function getStatisticsProcess(){
			return json_decode(self::getClient()->getStatisticsProcess($this->getDomain()));
		}

		/**
		* Get Server Raid Informations
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Array
		*/
		public function getStatisticsRaid(){
			return json_decode(self::getClient()->getStatisticsRaid($this->getDomain()));
		}

		/**
		* Get Raid Properties
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsRaidProperties($unit){
			return json_decode(self::getClient()->getStatisticsRaidProperties($this->getDomain(),$unit));
		}

		/**
		* Get Raid Volumes
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Array
		*/
		public function getStatisticsRaidVolume($unit){
			return json_decode(self::getClient()->getStatisticsRaidVolume($this->getDomain(),$unit));
		}

		/**
		* Get Raid Volume Properties
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Object
		*/
		public function getStatisticsRaidVolumeProperties($unit,$volume){
			return json_decode(self::getClient()->getStatisticsRaidVolumeProperties($this->getDomain(),$unit,$volume));
		}

		/**
		* Get Raid Volume Ports
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Array
		*/
		public function getStatisticsRaidVolumePort($unit,$volume){
			return json_decode(self::getClient()->getStatisticsRaidVolumePort($this->getDomain(),$unit,$volume));
		}

		/**
		* Get Raid Volume Ports Properties
		* Ajout by @Thibautg16 le 01/06/2014
		*
		* @throws Exception\ServerException
		* @throws \Ovh\Common\Exception\BadMethodCallException
		*
		* @return Array
		*/
		public function getStatisticsRaidVolumePortProperties($unit,$volume,$port){
			return json_decode(self::getClient()->getStatisticsRaidVolumePortProperties($this->getDomain(),$unit,$volume,$port));
		}

	/**
    * Get Hardware Specifications
	* Ajout by @Thibautg16 le 01/06/2014
    *
    * @throws Exception\ServerException
    * @throws \Ovh\Common\Exception\BadMethodCallException
	*
    * @return Object
    */
	public function getSpecificationsHardware(){
        return json_decode(self::getClient()->getSpecificationsHardware($this->getDomain()));
    }

// Orderables -- added in v1.0.2
	/*
	* Get list of orderable FTP Backup sizes for the specific server
	*
	* @return Object (Array of valid sizes)
	*/
	public function getOrderableBackupFTP() {
        return json_decode(self::getClient()->getOrderableBackupFTP($this->getDomain()));
    }

	/*
	* Get list of orderable USB keys for the specific server
	*
	* @return Object (array of valid key sizes)
	*/
	public function getOrderableUSB(){
        return json_decode(self::getClient()->getOrderableUSB($this->getDomain()));
    }

	/*
	* Determins if "professionalUse" is available for order on specific server
	*
	* @returns object (contains boolean value)
	*/
	public function getOrderableProfessionalUse(){
        return json_decode(self::getClient()->getOrderableProfessionalUse($this->getDomain()));
    }

// Installation information -- added in v0.1.2
	/*
	* Get list of installation templates compatible with server
	*
	* @returns object (multi-d-array of templates)
	*/
	public function getCompatibleTemplates() {
		return json_decode(self::getClient()->getCompatibleTemplates($this->getDomain()));
	}

	/*
	* Get list of partition schemes available with specific template
	*
	* @returns object (array of partition schemes)
	*/
	public function getCompatibleTemplatePartitionSchemes($domain) {
		return json_decode(self::getClient()->getCompatibleTemplatePartitionSchemes($this->getDomain()));

	}

// IPs list -- overlaps with /ips/ heirarchy, but this is available in the /dedicated/server heirarchy

	/*
	* Get list of Ips assined to server
	*
	* @returns array of IPs assigned (IPv4 and IPv6)
	*/
	public function getServerIPs() {
		return json_decode(self::getClient()->getServerIPs($this->getDomain()));

	}

// virtual MAC API

	/*
	* Get list of vMac addresses assigned to server
	*
	* @returns array of vMacs assigned
	*/
//	/dedicated/server/{serviceName}/virtualMac
	public function getVmacs() {
		return json_decode(self::getClient()->getVmacs($this->getDomain()));
	}

	/*
	* assign vMac to an IP
	*
	* @returns task (array of mixed) :
	*
	*	{
	*		"taskId": 123456,
	*		"function": "virtualMacAdd",
	*		"lastUpdate": "2014-07-04T19:28:52-04:00",
	*		"comment": "Create a virtual mac for ip a.b.c.d",
	*  		"status": "init",
	*  		"startDate": "2014-07-04T19:28:52-04:00",
	*  		"doneDate": null
	*	}
	*
	*/
// POST	/dedicated/server/{serviceName}/virtualMac
	public function createVmac($ip,$type,$vmname) {
		return json_decode(self::getClient()->assignVmac($this->getDomain(),$ip, $type, $vmname));
	}

	/*
	* Get list of vMac addresses assigned to server
	*
	* @returns array of vMacs assigned
	*/
// GET	/dedicated/server/{serviceName}/virtualMac/{virtualmac}
	public function getVmacProperties($vmac) {
		return json_decode(self::getClient()->getVmacProperties($this->getDomain(),$vmac));
	}

	/*
	* Get list of IPs addresses assigned to vMAC
	*
	* @returns array of vMacs assigned
	*/
//	/dedicated/server/{serviceName}/virtualMac/{virtualmac}/virtualAddress
	public function getVmacIPAddresses($vmac) {
		return json_decode(self::getClient()->getVmacIPAddresses($this->getDomain(),$vmac));
	}

	/*
	* add an IP addresses to vMAC
	*
	* @returns array of vMacs assigned
	*/
//	/dedicated/server/{serviceName}/virtualMac/{virtualmac}/virtualAddress
	public function setVmacIPAddresses($vmac, $ip, $vmname) {
		return json_decode(self::getClient()->getVmacIPAddress($this->getDomain(),$vmac, $ip, $vmname));
	}

	/*
	* add an IP addresses to vMAC
	*
	* @returns array of vMacs assigned
	*/
//	/dedicated/server/{serviceName}/virtualMac/{virtualmac}/virtualAddress
	public function deleteVmacIPAddress($vmac, $ip) {
		return json_decode(self::getClient()->deleteVmacIPAddress($this->getDomain(),$vmac, $ip));
	}

	/*
	* function to lookup a vMac based on an IP address - why dont they include this in the API?
	*
	*@param $ipv4 - IPv4 to lookup
	*
	*@returns vmac or null string if not found
	*/
	public function findVmac($ipv4) {
		$vmacs = json_decode(self::getClient()->getVmacs($this->getDomain()));
		foreach($vmacs as $vmac) {
			$test_ip = json_decode(self::getClient()->getVmacIPAddresses($this->getDomain(),$vmac));
			foreach($test_ip as $ip) {
				if ($ip == $ipv4)
					return $vmac;
			}
		}
		return "";
	}

	/*********** VRACK ***********/
	/**
	* Get Serveur Vrack
	* Ajout by @Thibautg16 le 17/05/2015
	*
	* @return String
	*/
	public function getServerVrack(){
		return json_decode(self::getClient()->getServerVrack($this->getDomain()));
	}
}


text:
module Monopoly
  module Space
    class Utility < Property::Property

      def initialize(monopoly, propertygroup, name)
        super(monopoly, propertygroup, name, 10, 0)
      end

      :protected

      def interest
        (@propertygroup.owns_all(@owner) ? 10 : 4) * @boardgame.settings.dice.value
      end

    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
/*
 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 *
 * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
 */

#ifndef	_SYS_TASKQ_H
#define	_SYS_TASKQ_H

#include <sys/types.h>
#include <sys/thread.h>

#ifdef	__cplusplus
extern "C" {
#endif

#define	TASKQ_NAMELEN	31

typedef struct taskq taskq_t;
typedef uintptr_t taskqid_t;
typedef void (task_func_t)(void *);

struct proc;

/*
 * Public flags for taskq_create(): bit range 0-15
 */
#define	TASKQ_PREPOPULATE	0x0001	/* Prepopulate with threads and data */
#define	TASKQ_CPR_SAFE		0x0002	/* Use CPR safe protocol */
#define	TASKQ_DYNAMIC		0x0004	/* Use dynamic thread scheduling */
#define	TASKQ_THREADS_CPU_PCT	0x0008	/* number of threads as % of ncpu */
#define	TASKQ_DC_BATCH		0x0010	/* Taskq uses SDC in batch mode */

/*
 * Flags for taskq_dispatch. TQ_SLEEP/TQ_NOSLEEP should be same as
 * KM_SLEEP/KM_NOSLEEP.
 */
#define	TQ_SLEEP	0x00	/* Can block for memory */
#define	TQ_NOSLEEP	0x01	/* cannot block for memory; may fail */
#define	TQ_NOQUEUE	0x02	/* Do not enqueue if can't dispatch */
#define	TQ_NOALLOC	0x04	/* cannot allocate memory; may fail */
#define	TQ_FRONT	0x08	/* Put task at the front of the queue */

#if defined(_KERNEL) || defined(_FAKE_KERNEL)

extern taskq_t *system_taskq;

extern void	taskq_init(void);
extern void	taskq_mp_init(void);

extern void     system_taskq_init(void);
extern void     system_taskq_fini(void);

extern taskq_t	*taskq_create(const char *, int, pri_t, int, int, uint_t);
extern taskq_t	*taskq_create_instance(const char *, int, int, pri_t, int,
    int, uint_t);
extern taskq_t	*taskq_create_proc(const char *, int, pri_t, int, int,
    struct proc *, uint_t);
extern taskq_t	*taskq_create_sysdc(const char *, int, int, int,
    struct proc *, uint_t, uint_t);
extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
extern void	nulltask(void *);
extern void	taskq_destroy(taskq_t *);
extern void	taskq_wait(taskq_t *);
extern void	taskq_suspend(taskq_t *);
extern int	taskq_suspended(taskq_t *);
extern void	taskq_resume(taskq_t *);
extern int	taskq_member(taskq_t *, kthread_t *);

#endif	/* _KERNEL */

#ifdef	__cplusplus
}
#endif

#endif	/* _SYS_TASKQ_H */


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

<title>Uses of Class org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession (Spring Framework 5.1.18.RELEASE API)</title>
<meta name="date" content="2020-09-15">
<link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Spring Framework

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession

Packages that use AbstractHttpSockJsSession

Package
Description

org.springframework.web.socket.sockjs.transport.handler

TransportHandler
 implementation classes as well as a concrete
 SockJsService.

org.springframework.web.socket.sockjs.transport.session

SockJS specific implementations of
 WebSocketSession.

Uses of AbstractHttpSockJsSession in org.springframework.web.socket.sockjs.transport.handler

Methods in org.springframework.web.socket.sockjs.transport.handler with parameters of type AbstractHttpSockJsSession

Modifier and Type
Method and Description

protected void
AbstractHttpSendingTransportHandler.handleRequestInternal(ServerHttpRequest request,
                     ServerHttpResponse response,
                     AbstractHttpSockJsSession sockJsSession)

void
HtmlFileTransportHandler.handleRequestInternal(ServerHttpRequest request,
                     ServerHttpResponse response,
                     AbstractHttpSockJsSession sockJsSession)

protected void
AbstractHttpReceivingTransportHandler.handleRequestInternal(ServerHttpRequest request,
                     ServerHttpResponse response,
                     WebSocketHandler wsHandler,
                     AbstractHttpSockJsSession sockJsSession)

Uses of AbstractHttpSockJsSession in org.springframework.web.socket.sockjs.transport.session

Subclasses of AbstractHttpSockJsSession in org.springframework.web.socket.sockjs.transport.session

Modifier and Type
Class and Description

class
PollingSockJsSession

A SockJS session for use with polling HTTP transports.

class
StreamingSockJsSession

A SockJS session for use with streaming HTTP transports.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Spring Framework

Prev

Next

Frames

No Frames

All Classes


text:
/**
 * Some custom matchers for Jasmine.
 *
 * @author Bo Gotthardt
 */
define(["util/Promise"],
    function (Promise) {
        "use strict";

        return {
            /**
             * Expect the actual value to be a Promise that has *already* resolved with the specified value.
             *
             * @param {*} expectedValue
             * @return {Boolean}
             */
            toHaveResolvedWith: function (expectedValue) {
                var actualValue;

                if (!Promise.isPromise(this.actual)) {
                    this.message = function () { return "Expected actual value to be a promise object."; };
                    return false;
                }

                if (this.actual.state() !== "resolved") {
                    this.message = function () { return "Expected promise to have resolved."; };
                    return false;
                }

                this.actual.done(function (value) {
                    actualValue = value;
                });

                if (actualValue === undefined) {
                    this.message = function () { return "Expected done() callback to have been called."; };
                    return false;
                }

                this.message = function () { return "Expected " + actualValue + (this.isNot ? " not" : "") + " to equal " + expectedValue; };
                return this.env.equals_(actualValue, expectedValue);
            }
        };
    });


text:
import {
  Environment,
  Network,
  RecordSource,
  Store,
} from 'relay-runtime';

const HOST = process.env.REACT_APP_GRAPHQL_HOST || 'http://localhost:30000/graphql';

function fetchQuery(operation, variables) {
  return fetch(HOST, {
    credentials: 'same-origin',
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      query: operation.text,
      variables,
    }),
  }).then(response => response.json());
}

const network = Network.create(fetchQuery);
const source = new RecordSource();
const store = new Store(source);

export default new Environment({
  network,
  store,
});


text:
<?php
/**
 * Created by PhpStorm.
 * User: Isambard.Wheeler
 * Date: 04/08/2015
 * Time: 12:50
 */

class enquiry {

    protected $firstname;
    protected $email;
    protected $enquiry;

    public function getFirstname()
    {
        return $this->firstname;
    }

    public function setFirstname($firstname)
    {
        $this->firstname=$firstname;
    }

    public function getEmail()
    {
        return $this->email();
    }

    public function setEmail($email)
    {
      $this->email= $email;
    }

    public function getEnquiry()
    {
        return $this->$enquiry;
    }

    public function setEnquiry($enquiry)
    {
        $this->enquiry = $enquiry;
    }
}


text:
// Type definitions for strip-comments 2.0
// Project: https://github.com/jonschlinkert/strip-comments
// Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

import _parse = require('./lib/parse');
/**
 * Strip all code comments from the given `input`, including protected
 * comments that start with `!`, unless disabled by setting `options.keepProtected`
 * to true.
 *
 * ```js
 * const str = strip('const foo = "bar";// this is a comment\n /* me too *\/');
 * console.log(str);
 * // => 'const foo = "bar";'
 * ```
 * @param string - string from which to strip comments
 * @param [options] - passed to [extract-comments][extract-comments]
 */
declare function strip(input: string, options?: strip.Options): string;

declare namespace strip {
    /**
     * Strip only block comments.
     *
     * ```js
     * const strip = require('..');
     * const str = strip.block('const foo = "bar";// this is a comment\n /* me too *\/');
     * console.log(str);
     * // => 'const foo = "bar";// this is a comment'
     * ```
     * @param `input` string from which to strip comments
     * @param  [`options`] pass `opts.keepProtected: true` to keep ignored comments (e.g. `/*!`)
     */

    function block(input: string, options?: Options): string;
    /**
     * Strip only line comments.
     *
     * ```js
     * const str = strip.line('const foo = "bar";// this is a comment\n /* me too *\/');
     * console.log(str);
     * // => 'const foo = "bar";\n/* me too *\/'
     * ```
     * @param  `input` string from which to strip comments
     * @param  [`options`] pass `opts.keepProtected: true` to keep ignored comments (e.g. `//!`)
     */
    function line(input: string, options?: Options): string;

    /**
     * Strip the first comment from the given `input`. Or, if `opts.keepProtected` is true,
     * the first non-protected comment will be stripped.
     *
     * ```js
     * const output = strip.first(input, { keepProtected: true });
     * console.log(output);
     * // => '//! first comment\nfoo; '
     * ```
     * @param  `input` string from which to strip comments
     * @param [`options`] pass `opts.keepProtected: true` to keep comments with `!`
     */
    function first(input: string, options?: Options): string;

    const parse: typeof _parse;

    interface Options {
        /**
         * if `false` strip only block comments
         * @default true
         */
        line?: boolean;
        /**
         * if `false` strip only line comments
         * @default true
         */
        block?: boolean;
        /**
         * Keep ignored comments (e.g. `/*!` and `//!`)
         */
        keepProtected?: boolean;
        /**
         * Preserve newlines after comments are stripped
         */
        preserveNewlines?: boolean;
        /**
         * @default 'javascript'
         */
        language?: string;
    }
}

export = strip;


text:
/** @defgroup comobj Communication Objects
 *  @ingroup userapi
 */

/** @defgroup sdo Service Data Object (SDO)
 *  SDOs provide the access to entries in the CANopen Object Dictionary.
 * 	An SDO is made up of at least two CAN messages with different identifiers.
 * 	SDO s are always confirmed point-to-point communications services.
 *  @ingroup comobj
 */

#ifndef __sdo_h__
#define __sdo_h__

struct struct_s_transfer;

#include "timer.h"

/* Block mode : Data consumer receive step
 * - set to RXSTEP_STARTED when client receive initiate upload response
 * - set to RXSTEP_END when last segment of a block received
 */
typedef enum {RXSTEP_INIT, RXSTEP_STARTED, RXSTEP_END } rxStep_t;

typedef void (*SDOCallback_t)(CO_Data* d, UNS8 nodeId);

/* The Transfer structure
Used to store the different segments of
 - a SDO received before writing in the dictionary
 - the reading of the dictionary to put on a SDO to transmit
WARNING : after a change in this structure check the macro s_transfer_Initializer in data.h
*/

struct struct_s_transfer {
  UNS8           CliServNbr; /**< The index of the SDO client / server in our OD minus 0x1280 / 0x1200 */

  UNS8           whoami;     /**< Takes the values SDO_CLIENT or SDO_SERVER */
  UNS8           state;      /**< state of the transmission : Takes the values SDO_... */
  UNS8           toggle;
  UNS32          abortCode;  /**< Sent or received */
  /**< index and subindex of the dictionary where to store */
  /**< (for a received SDO) or to read (for a transmit SDO) */
  UNS16          index;
  UNS8           subIndex;
  UNS32          count;      /**< Number of data received or to be sent. */
  UNS32          offset;     /**< stack pointer of data[]
                              * Used only to tranfer part of a line to or from a SDO.
                              * offset is always pointing on the next free cell of data[].
                              * WARNING s_transfer.data is subject to ENDIANISATION
                              * (with respect to CANOPEN_BIG_ENDIAN)
                              */
  UNS8           data [SDO_MAX_LENGTH_TRANSFER];
#ifdef SDO_DYNAMIC_BUFFER_ALLOCATION
  UNS8           *dynamicData;
  UNS32          dynamicDataSize;
#endif //SDO_DYNAMIC_BUFFER_ALLOCATION

  UNS8           peerCRCsupport;    /**< True if peer supports CRC */
  UNS8           blksize;           /**< Number of segments per block with 0 < blksize < 128 */
  UNS8           ackseq;            /**< sequence number of last segment that was received successfully */
  UNS32          objsize;           /**< Size in bytes of the object provided by data producer */
  UNS8           lastblockoffset;   /**< Value of offset before last block */
  UNS8           seqno;             /**< Last sequence number received OK or transmitted */
  UNS8           endfield;          /**< nbr of bytes in last segment of last block that do not contain data */
  rxStep_t       rxstep;            /**< data consumer receive step - set to true when last segment of a block received */
  UNS8           tmpData[8];        /**< temporary segment storage */

  UNS8           dataType;   /**< Defined in objdictdef.h Value is visible_string
                              * if it is a string, any other value if it is not a string,
                              * like 0. In fact, it is used only if client.
                              */
  TIMER_HANDLE   timer;      /**< Time counter to implement a timeout in milliseconds.
                              * It is automatically incremented whenever
                              * the line state is in SDO_DOWNLOAD_IN_PROGRESS or
                              * SDO_UPLOAD_IN_PROGRESS, and reseted to 0
                              * when the response SDO have been received.
                              */
  SDOCallback_t Callback;   /**< The user callback func to be called at SDO transaction end */
};
typedef struct struct_s_transfer s_transfer;

#include "data.h"

/**
 * @brief Reset of a SDO exchange on timeout.
 * Send a SDO abort.
 * @param *d Pointer on a CAN object data structure
 * @param id
 */
void SDOTimeoutAlarm(CO_Data* d, UNS32 id);

/**
 * @brief Reset all SDO buffers.
 * @param *d Pointer on a CAN object data structure
 */
void resetSDO (CO_Data* d);

/**
 * @brief Copy the data received from the SDO line transfer to the object dictionary.
 * @param *d Pointer on a CAN object data structure
 * @param line SDO line
 * @return SDO error code if error. Else, returns 0.
 */
UNS32 SDOlineToObjdict (CO_Data* d, UNS8 line);

/**
 * @brief Copy the data from the object dictionary to the SDO line for a network transfer.
 * @param *d Pointer on a CAN object data structure
 * @param line SDO line
 * @return SDO error code if error. Else, returns 0.
 */
UNS32 objdictToSDOline (CO_Data* d, UNS8 line);

/**
 * @brief Copy data from an existant line in the argument "* data"
 * @param d Pointer on a CAN object data structure
 * @param line SDO line
 * @param nbBytes
 * @param *data Pointer on the data
 * @return 0xFF if error. Else, returns 0.
 */
UNS8 lineToSDO (CO_Data* d, UNS8 line, UNS32 nbBytes, UNS8 * data);

/**
 * @brief Add data to an existant line
 * @param d Pointer on a CAN object data structure
 * @param line SDO line
 * @param nbBytes
 * @param *data Pointer on the data
 * @return 0xFF if error. Else, returns 0.
 */
UNS8 SDOtoLine (CO_Data* d, UNS8 line, UNS32 nbBytes, UNS8 * data);

/**
 * @brief Called when an internal SDO abort occurs.
 * Release the line * Only if server *
 * If client, the line must be released manually in the core application.
 * The reason of that is to permit the program to read the transfers structure before its reset,
 * because many informations are stored on it : index, subindex, data received or trasmited, ...
 * In all cases, sends a SDO abort.
 * @param *d Pointer on a CAN object data structure
 * @param CliServNbr
 * @param whoami
 * @param index
 * @param subIndex
 * @param abortCode
 * @return 0
 */
UNS8 failedSDO (CO_Data* d, UNS8 CliServNbr, UNS8 whoami, UNS16 index, UNS8 subIndex, UNS32 abortCode);

/**
 * @brief Reset an unused line.
 * @param *d Pointer on a CAN object data structure
 * @param line SDO line
 */
void resetSDOline (CO_Data* d, UNS8 line);

/**
 * @brief Initialize some fields of the structure.
 * @param *d Pointer on a CAN object data structure
 * @param line
 * @param CliServNbr
 * @param index
 * @param subIndex
 * @param state
 * @return 0
 */
UNS8 initSDOline (CO_Data* d, UNS8 line, UNS8 CliServNbr, UNS16 index, UNS8 subIndex, UNS8 state);

/**
 * @brief Search for an unused line in the transfers array
 * to store a new SDO.
 * ie a line which value of the field "state" is "SDO_RESET"
 * An unused line have the field "state" at the value SDO_RESET
 * @param *d Pointer on a CAN object data structure
 * @param whoami Create the line for a SDO_SERVER or SDO_CLIENT.
 * @param *line Pointer on a SDO line
 * @return 0xFF if all the lines are on use. Else, return 0.
 */
UNS8 getSDOfreeLine (CO_Data* d, UNS8 whoami, UNS8 *line);

/**
 * @brief Search for the line, in the transfers array, which contains the
 * beginning of the reception of a fragmented SDO
 * @param *d Pointer on a CAN object data structure
 * @param CliServNbr Client or Server object involved
 * @param whoami takes 2 values : look for a line opened as SDO_CLIENT or SDO_SERVER
 * @param *line Pointer on a SDO line
 * @return 0xFF if error.  Else, return 0
 */
UNS8 getSDOlineOnUse (CO_Data* d, UNS8 CliServNbr, UNS8 whoami, UNS8 *line);

/**
 * @brief Search for the line, in the transfers array, which contains the
 * beginning of the reception of a fragmented SDO
 *
 * Because getSDOlineOnUse() does not return any line in state \c SDO_ABORTED_INTERNAL,
 * this funtion is used to return them, too.
 *
 * @param *d Pointer on a CAN object data structure
 * @param CliServNbr Client or Server object involved
 * @param whoami takes 2 values : look for a line opened as SDO_CLIENT or SDO_SERVER
 * @param *line Pointer on a SDO line
 * @return 0xFF if error.  Else, return 0
 */
UNS8 getSDOlineToClose (CO_Data* d, UNS8 CliServNbr, UNS8 whoami, UNS8 *line);

/**
 * @brief Close a transmission.
 * @param *d Pointer on a CAN object data structure
 * @param CliServNbr Client or Server object involved
 * @param whoami Line opened as SDO_CLIENT or SDO_SERVER
 */
UNS8 closeSDOtransfer (CO_Data* d, UNS8 CliServNbr, UNS8 whoami);

/**
 * @brief Bytes in the line structure which must be transmited (or received)
 * @param *d Pointer on a CAN object data structure
 * @param line SDO line
 * @param *nbBytes Pointer on nbBytes
 * @return 0.
 */
UNS8 getSDOlineRestBytes (CO_Data* d, UNS8 line, UNS32 * nbBytes);

/**
 * @brief Store in the line structure the nb of bytes which must be transmited (or received)
 * @param *d Pointer on a CAN object data structure
 * @param line SDO line
 * @param nbBytes
 * @return 0 if success, 0xFF if error.
 */
UNS8 setSDOlineRestBytes (CO_Data* d, UNS8 line, UNS32 nbBytes);

/**
 * @brief Transmit a SDO frame on the bus bus_id
 * @param *d Pointer on a CAN object data structure
 * @param whoami Takes 2 values : SDO_CLIENT or SDO_SERVER
 * @param CliServNbr Client or Server object involved
 * @param data Array of the 8 bytes to transmit
 * @return canSend(bus_id,&m) or 0xFF if error.
 */
UNS8 sendSDO (CO_Data* d, UNS8 whoami, UNS8 CliServNbr, UNS8 *pData);

/**
 * @brief Transmit a SDO error to the client. The reasons may be :
 * Read/Write to a undefined object
 * Read/Write to a undefined subindex
 * Read/write a not valid length object
 * Write a read only object
 * @param *d Pointer on a CAN object data structure
 * @param whoami takes 2 values : SDO_CLIENT or SDO_SERVER
 * @param CliServNbr
 * @param index
 * @param subIndex
 * @param abortCode
 * @return 0
 */
UNS8 sendSDOabort (CO_Data* d, UNS8 whoami, UNS8 CliServNbr, UNS16 index, UNS8 subIndex, UNS32 abortCode);

/**
 * @brief Treat a SDO frame reception
 * call the function sendSDO
 * @param *d Pointer on a CAN object data structure
 * @param *m Pointer on a CAN message structure
 * @return code :
 * 		   - 0xFF if error
 *         - 0x80 if transfer aborted by the server
 *         - 0x0  ok
 */
UNS8 proceedSDO (CO_Data* d, Message *m);

/**
 * @ingroup sdo
 * @brief Used to send a SDO request frame to write the data at the index and subIndex indicated
 * @param *d Pointer to a CAN object data structure
 * @param nodeId Node Id of the slave
 * @param index At index indicated
 * @param subIndex At subIndex indicated
 * @param count number of bytes to write in the dictionnary.
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
 * @param *data Pointer to data
 * @return
 * - 0 is returned upon success.
 * - 0xFE is returned when no sdo client to communicate with node.
 * - 0xFF is returned when error occurs.
 */
UNS8 writeNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index,
		       UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, UNS8 useBlockMode);

/**
 * @ingroup sdo
 * @brief Used to send a SDO request frame to write in a distant node dictionnary.
 * @details The function Callback which must be defined in the user code is called at the
 * end of the exchange. (on succes or abort).
 * @param *d Pointer to a CAN object data structure
 * @param nodeId Node Id of the slave
 * @param index At index indicated
 * @param subIndex At subIndex indicated
 * @param count number of bytes to write in the dictionnary.
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
 * @param *data Pointer to data
 * @param Callback Callback function
 * @return
 * - 0 is returned upon success.
 * - 0xFE is returned when no sdo client to communicate with node.
 * - 0xFF is returned when error occurs.
 */
UNS8 writeNetworkDictCallBack (CO_Data* d, UNS8 nodeId, UNS16 index,
		       UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 useBlockMode);

/**
 * @ingroup sdo
 * @brief Used to send a SDO request frame to write in a distant node dictionnary.
 * @details The function Callback which must be defined in the user code is called at the
 * end of the exchange. (on succes or abort). First free SDO client parameter is
 * automatically initialized for specific node if not already defined.
 * @param *d Pointer to a CAN object data structure
 * @param nodeId Node Id of the slave
 * @param index At index indicated
 * @param subIndex At subIndex indicated
 * @param count number of bytes to write in the dictionnary.
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
 * @param *data Pointer to data
 * @param Callback Callback function
 * @param endianize When not 0, data is endianized into network byte order
 *                  when 0, data is not endianized and copied in machine native
 *                  endianness
 * @return
 * - 0 is returned upon success.
 * - 0xFF is returned when error occurs.
 */
UNS8 writeNetworkDictCallBackAI (CO_Data* d, UNS8 nodeId, UNS16 index,
		       UNS8 subIndex, UNS32 count, UNS8 dataType, void *data, SDOCallback_t Callback, UNS8 endianize, UNS8 useBlockMode);

/**
 * @ingroup sdo
 * @brief Used to send a SDO request frame to read.
 * @param *d Pointer to a CAN object data structure
 * @param nodeId Node Id of the slave
 * @param index At index indicated
 * @param subIndex At subIndex indicated
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
 * @return
 * - 0 is returned upon success.
 * - 0xFE is returned when no sdo client to communicate with node.
 * - 0xFF is returned when error occurs.
 */
UNS8 readNetworkDict (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, UNS8 useBlockMode);

/**
 * @ingroup sdo
 * @brief Used to send a SDO request frame to read in a distant node dictionnary.
 * @details The function Callback which must be defined in the user code is called at the
 * end of the exchange. (on succes or abort).
 * @param *d Pointer on a CAN object data structure
 * @param nodeId Node Id of the slave
 * @param index At index indicated
 * @param subIndex At subIndex indicated
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
 * @param Callback Callback function
 * @return
 * - 0 is returned upon success.
 * - 0xFE is returned when no sdo client to communicate with node.
 * - 0xFF is returned when error occurs.
 */
UNS8 readNetworkDictCallback (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback, UNS8 useBlockMode);

/**
 * @ingroup sdo
 * @brief Used to send a SDO request frame to read in a distant node dictionnary.
 * @details The function Callback which must be defined in the user code is called at the
 * end of the exchange. (on succes or abort). First free SDO client parameter is
 * automatically initialized for specific node if not already defined.
 * @param *d Pointer on a CAN object data structure
 * @param nodeId Node Id of the slave
 * @param index At index indicated
 * @param subIndex At subIndex indicated
 * @param dataType (defined in objdictdef.h) : put "visible_string" for strings, 0 for integers or reals or other value.
 * @param Callback Callback function
 * @return
 * - 0 is returned upon success.
 * - 0xFF is returned when error occurs.
 */
UNS8 readNetworkDictCallbackAI (CO_Data* d, UNS8 nodeId, UNS16 index, UNS8 subIndex, UNS8 dataType, SDOCallback_t Callback, UNS8 useBlockMode);

/**
 * @ingroup sdo
 * @brief Use this function after calling readNetworkDict to get the result.
 *
 * @param *d Pointer to a CAN object data structure
 * @param nodeId Node Id of the slave
 * @param *data Pointer to the buffer to get the data
 * @param *size Pointer to the size : MUST contain the size of the buffer before calling
 *                                    The function set it to the actual number of written bytes
 * @param *abortCode Pointer to the abortcode. (0 = not available. Else : SDO abort code. (received if return SDO_ABORTED_RCV)
 *
 *
 * @return
 *           - SDO_FINISHED             // datas are available
 *           - SDO_ABORTED_RCV          // Transfer failed (abort SDO received)
 *           - SDO_ABORTED_INTERNAL     // Transfer failed (internal abort)
 *           - SDO_UPLOAD_IN_PROGRESS   // Datas are not yet available
 *           - SDO_DOWNLOAD_IN_PROGRESS // Download is in progress
 *           - SDO_PROVIDED_BUFFER_TOO_SMALL //The value *size is not enough to store the received data
 * \n\n
 * example :
 * @code
 * UNS32 data;
 * UNS8 size;
 * readNetworkDict(0, 0x05, 0x1016, 1, 0) // get the data index 1016 subindex 1 of node 5
 * while (getReadResultNetworkDict (0, 0x05, &data, &size) == SDO_UPLOAD_IN_PROGRESS);
 * @endcode
*/
UNS8 getReadResultNetworkDict (CO_Data* d, UNS8 nodeId, void* data, UNS32 *size, UNS32 * abortCode);

/**
 * @ingroup sdo
 * @brief Use this function after calling writeNetworkDict function to get the result of the write.
 * @details It is mandatory to call this function because it is releasing the line used for the transfer.
 * @param *d Pointer to a CAN object data structure
 * @param nodeId Node Id of the slave
 * @param *abortCode Pointer to the abortcode
 * - 0 = not available.
 * - SDO abort code (received if return SDO_ABORTED_RCV)
 *
 * @return :
 *           - SDO_FINISHED             // datas are available
 *           - SDO_ABORTED_RCV          // Transfer failed (abort SDO received)
 *           - SDO_ABORTED_INTERNAL     // Transfer failed (Internal abort)
 *           - SDO_DOWNLOAD_IN_PROGRESS // Datas are not yet available
 *           - SDO_UPLOAD_IN_PROGRESS   // Upload in progress
 * \n\n
 * example :
 * @code
 * UNS32 data = 0x50;
 * UNS8 size;
 * UNS32 abortCode;
 * writeNetworkDict(0, 0x05, 0x1016, 1, size, &data) // write the data index 1016 subindex 1 of node 5
 * while (getWriteResultNetworkDict (0, 0x05, &abortCode) == SDO_DOWNLOAD_IN_PROGRESS);
 * @endcode
*/
UNS8 getWriteResultNetworkDict (CO_Data* d, UNS8 nodeId, UNS32 * abortCode);

#endif


text:
#import <Foundation/Foundation.h>
#import "Base.h"
#import "CDRSpecFailure.h"

#include <stdexcept>

#pragma mark - private interface
namespace Cedar { namespace Matchers { namespace Private {
    struct BeNilMessageBuilder {
        template<typename U>
        static NSString * string_for_actual_value(const U & value) {
            // ARC bug: http://lists.apple.com/archives/objc-language/2012/Feb/msg00078.html
            // Also blocks aren't considered a pointer type under both ARC and MRC
            if (strcmp(@encode(U), @encode(id)) == 0 || strcmp(@encode(U), @encode(void(^)(void))) == 0) {
                void *ptrOfPtr = (void *)&value;
                void *ptr = *(reinterpret_cast<void **>(ptrOfPtr));
                return ptr ? [NSString stringWithFormat:@"%p", ptr] : @"nil";
            }

            throw std::logic_error("Should never generate a failure message for a nil comparison to non-pointer type.");
        }

        template<typename U>
        static NSString * string_for_actual_value(U * const & value) {
            return value ? [NSString stringWithFormat:@"%p", value] : @"nil";
        }
    };

    class BeNil : public Base<BeNilMessageBuilder> {
    private:
        BeNil & operator=(const BeNil &);

    public:
        inline BeNil() : Base<BeNilMessageBuilder>() {}
        inline ~BeNil() {}
        // Allow default copy ctor.

        inline const BeNil & operator()() const { return *this; }

        template<typename U>
        bool matches(const U &) const;

        template<typename U>
        bool matches(U * const &) const;

    protected:
        inline /*virtual*/ NSString * failure_message_end() const { return @"be nil"; }
    };

    static const BeNil be_nil = BeNil();

#pragma mark Generic
    template<typename U>
    bool BeNil::matches(const U & actualValue) const {
        // ARC bug: http://lists.apple.com/archives/objc-language/2012/Feb/msg00078.html
        // Also blocks aren't considered a pointer type under both ARC and MRC
        if (strcmp(@encode(U), @encode(id)) == 0 || strcmp(@encode(U), @encode(void(^)(void))) == 0) {
            void *ptrOfPtr = (void *)&actualValue;
            void *ptr = *(reinterpret_cast<void **>(ptrOfPtr));
            return !ptr;
        }

        [[CDRSpecFailure specFailureWithReason:@"Attempt to compare non-pointer type to nil"] raise];
        return NO;
    }

    template<typename U>
    bool BeNil::matches(U * const & actualValue) const {
        return !actualValue;
    }
}}}

#pragma mark - public interface
namespace Cedar { namespace Matchers {
    using CedarBeNil = Cedar::Matchers::Private::BeNil;

    static const CedarBeNil be_nil = CedarBeNil();
}}


text:
package core.lsmi;

import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

import common.MidSegment;
import core.io.Bucket;
import core.io.Bucket.BucketID;
import core.lsmt.IMemTable.SSTableMeta;
import core.lsmt.IPostingListIterator;
import core.lsmt.ISSTableWriter.DirEntry;
import core.lsmt.LSMTInvertedIndex;
import core.lsmt.PostingListMeta;
import core.lsmt.WritableComparableKey;
import core.lsmt.WritableComparableKey.WritableComparableKeyFactory;
import core.lsmt.bdbindex.BucketBasedBDBSSTableReader;
import util.Pair;

public class ListDiskBDBSSTableReader extends BucketBasedBDBSSTableReader {

	public static class SegListKey implements WritableComparableKey {
		int top;
		int start;
		long mid;

		public SegListKey() {

		}

		public SegListKey(int top, int start, long mid) {
			this.top = top;
			this.start = start;
			this.mid = mid;
		}

		@Override
		public int compareTo(WritableComparableKey o) {
			SegListKey obj = (SegListKey) o;
			int ret = Integer.compare(top, obj.top);
			if (ret == 0) {
				ret = Integer.compare(start, obj.start);
				if (ret == 0) {
					ret = Long.compare(mid, obj.mid);
				}
			}
			return ret;
		}

		@Override
		public void write(DataOutput output) throws IOException {
			output.writeInt(top);
			output.writeInt(start);
			output.writeLong(mid);
		}

		@Override
		public void read(DataInput input) throws IOException {
			top = input.readInt();
			start = input.readInt();
			mid = input.readLong();
		}
	}

	public static enum SegListKeyFactory implements WritableComparableKeyFactory {
		INSTANCE;
		@Override
		public WritableComparableKey createIndexKey() {
			return new SegListKey();
		}

	}

	public ListDiskBDBSSTableReader(LSMTInvertedIndex index, SSTableMeta meta) {
		super(index, meta, SegListKeyFactory.INSTANCE);
	}

	@Override
	public IPostingListIterator getPostingListScanner(WritableComparableKey key) throws IOException {
		return new ListDiskPostingListIterator(dirMap.get(key), 0, Integer.MAX_VALUE);
	}

	@Override
	public IPostingListIterator getPostingListIter(WritableComparableKey key, int start, int end) throws IOException {
		return new ListDiskPostingListIterator(dirMap.get(key), start, end);
	}

	class ListDiskPostingListIterator implements IPostingListIterator {
		DirEntry dir;

		BucketID nextBuckID;
		int nextBlockID;

		Bucket curBuck = null;
		SubList curList = new SubList(0);
		int curIdx = Integer.MAX_VALUE;

		MidSegment cur = null;
		int start;
		int end;

		public ListDiskPostingListIterator(DirEntry entry, int start, int end) {
			if (entry != null && entry.curKey != null && entry.minTime <= end && entry.maxTime >= start) {
				this.dir = entry;
				this.start = start;
				this.end = end;
				nextBuckID = new BucketID(entry.startBucketID);
			}
		}

		@Override
		public PostingListMeta getMeta() {
			return dir;
		}

		@Override
		public void open() throws IOException {

		}

		private void advance() throws IOException {
			while (cur == null && (curIdx < curList.size() || nextBuckID.compareTo(dir.endBucketID) <= 0)) {
				if (curIdx >= curList.size()) {
					loadSubList();
				}
				cur = curList.get(curIdx++);
				if (cur.getStart() <= end && cur.getEndTime() >= start)
					break;
				else {
					cur = null;
				}
			}
		}

		private void loadSubList() throws IOException {
			if (curBuck == null) {
				curBuck = new Bucket(0);
				nextBlockID = getBucket(nextBuckID, curBuck);
			} else if (nextBuckID.offset >= curBuck.octNum()) {
				nextBuckID.blockID = nextBlockID;
				nextBuckID.offset = 0;
				nextBlockID = getBucket(nextBuckID, curBuck);
			}
			curList.init();
			curIdx = 0;
			curList.read(new DataInputStream(new ByteArrayInputStream(curBuck.getOctree(nextBuckID.offset++))));
		}

		@Override
		public boolean hasNext() throws IOException {
			if (dir == null)
				return false;
			if (cur == null)
				advance();
			return cur != null;
		}

		@Override
		public Pair<Integer, List<MidSegment>> next() throws IOException {
			if (cur == null)
				advance();
			Pair<Integer, List<MidSegment>> ret = new Pair<Integer, List<MidSegment>>(cur.getPoint().getZ(),
					Arrays.asList(cur));
			cur = null;
			return ret;
		}

		@Override
		public void skipTo(WritableComparableKey key) throws IOException {
			// TODO Auto-generated method stub

		}

		@Override
		public void close() throws IOException {
		}

	}
}


text:
#ifndef __DataManager_h
#define __DataManager_h

#include <string>
#include "itkLightObject.h"
#include "selxDataDirectories.h"
#include "itkObjectFactory.h"

class DataManager : public itk::LightObject
{
public:

  typedef DataManager                     Self;
  typedef itk::SmartPointer< Self >       Pointer;
  typedef itk::SmartPointer< const Self > ConstPointer;
  itkNewMacro( Self );
  itkTypeMacro( DataManager, itk::LightObject );

  DataManager()
  {
    this->m_InputDirectory         = SUPERELASTIX_INPUT_DATA_DIR;
    this->m_OutputDirectory        = SUPERELASTIX_OUTPUT_DATA_DIR;
    this->m_BaselineDirectory      = SUPERELASTIX_BASELINE_DATA_DIR;
    this->m_ConfigurationDirectory = SUPERELASTIX_CONFIGURATION_DATA_DIR;
  }

  std::string GetInputDirectory( void ) const { return this->m_InputDirectory; }
  std::string GetOutputDirectory( void ) const { return this->m_OutputDirectory; }
  std::string GetBaselineDirectory( void ) const { return this->m_BaselineDirectory; }
  std::string GetConfigurationDirectory( void ) const { return this->m_ConfigurationDirectory; }

  const std::string GetInputFile( const std::string filename ) const;

  const std::string GetOutputFile( const std::string filename ) const;

  const std::string GetBaselineFile( const std::string filename ) const;

  const std::string GetConfigurationFile( const std::string filename ) const;

  std::string GetFolderSeparator() const
  {
#ifdef _WIN32
    return "\\";
#else
    return "/";
#endif
  }

  std::string GetPathSeparator() const
  {
#ifdef _WIN32
    return ";";
#else
    return ":";
#endif
  }

private:

  std::string m_InputDirectory;
  std::string m_BaselineDirectory;
  std::string m_OutputDirectory;
  std::string m_ConfigurationDirectory;
};

#endif // __DataManager_h


text:
@implementation JHShakingView

- (void)removeFromSuperview {
    [super removeFromSuperview];
}

- (void)dealloc {
    self.onShaking = nil;
#if !__has_feature(objc_arc)
    [super dealloc];
#endif
}

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
    if ([super respondsToSelector:@selector(motionEnded:withEvent:)]) {
        [super motionEnded:motion withEvent:event];
    }
    if (event.subtype == UIEventSubtypeMotionShake) {
        if(self.onShaking) {
            self.onShaking();
        }
    }
}

- (BOOL)canBecomeFirstResponder {
    return YES;
}

@end


text:
        Debe iniciar sesión

        <button id="accbtn" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
            arrow_drop_down
            Accounts
        </button>

Perfil

Cerrar sesión

    homePrincipal

    flagEstructuras
    peopleDirectorio

    help_outlineHelp


text:
use super::archive::Archive;
use super::errors::Result;
use super::types::{LightLevel, SectorId, VertexId, WadNode, WadSector};
use super::types::{WadCoord, WadLinedef, WadSeg, WadSidedef, WadSubsector, WadThing, WadVertex};
use super::util::from_wad_coords;
use log::{error, info};
use math::Pnt2f;
use std::cmp;
use std::mem;
use std::slice::Iter as SliceIter;
use std::vec::Vec;

const THINGS_OFFSET: usize = 1;
const LINEDEFS_OFFSET: usize = 2;
const SIDEDEFS_OFFSET: usize = 3;
const VERTICES_OFFSET: usize = 4;
const SEGS_OFFSET: usize = 5;
const SSECTORS_OFFSET: usize = 6;
const NODES_OFFSET: usize = 7;
const SECTORS_OFFSET: usize = 8;

pub struct Level {
    pub things: Vec<WadThing>,
    pub linedefs: Vec<WadLinedef>,
    pub sidedefs: Vec<WadSidedef>,
    pub vertices: Vec<WadVertex>,
    pub segs: Vec<WadSeg>,
    pub subsectors: Vec<WadSubsector>,
    pub nodes: Vec<WadNode>,
    pub sectors: Vec<WadSector>,
}

impl Level {
    pub fn from_archive(wad: &Archive, index: usize) -> Result<Level> {
        let lump = wad.level_lump(index)?;
        info!("Reading level data for '{}'...", lump.name());
        let start_index = lump.index();
        let things = wad
            .lump_by_index(start_index + THINGS_OFFSET)?
            .decode_vec()?;
        let linedefs = wad
            .lump_by_index(start_index + LINEDEFS_OFFSET)?
            .decode_vec()?;
        let vertices = wad
            .lump_by_index(start_index + VERTICES_OFFSET)?
            .decode_vec()?;
        let segs = wad.lump_by_index(start_index + SEGS_OFFSET)?.decode_vec()?;
        let subsectors = wad
            .lump_by_index(start_index + SSECTORS_OFFSET)?
            .decode_vec()?;
        let nodes = wad
            .lump_by_index(start_index + NODES_OFFSET)?
            .decode_vec()?;
        let sidedefs = wad
            .lump_by_index(start_index + SIDEDEFS_OFFSET)?
            .decode_vec()?;
        let sectors = wad
            .lump_by_index(start_index + SECTORS_OFFSET)?
            .decode_vec()?;

        info!("Loaded level '{}':", lump.name());
        info!("    {:4} things", things.len());
        info!("    {:4} linedefs", linedefs.len());
        info!("    {:4} sidedefs", sidedefs.len());
        info!("    {:4} vertices", vertices.len());
        info!("    {:4} segs", segs.len());
        info!("    {:4} subsectors", subsectors.len());
        info!("    {:4} nodes", nodes.len());
        info!("    {:4} sectors", sectors.len());

        Ok(Level {
            things,
            linedefs,
            sidedefs,
            vertices,
            segs,
            subsectors,
            nodes,
            sectors,
        })
    }

    pub fn vertex(&self, id: VertexId) -> Option<Pnt2f> {
        self.vertices
            .get(id as usize)
            .map(|v| from_wad_coords(v.x, v.y))
    }

    pub fn seg_linedef(&self, seg: &WadSeg) -> Option<&WadLinedef> {
        self.linedefs.get(seg.linedef as usize)
    }

    pub fn seg_vertices(&self, seg: &WadSeg) -> Option<(Pnt2f, Pnt2f)> {
        if let (Some(v1), Some(v2)) = (self.vertex(seg.start_vertex), self.vertex(seg.end_vertex)) {
            Some((v1, v2))
        } else {
            None
        }
    }

    pub fn seg_sidedef(&self, seg: &WadSeg) -> Option<&WadSidedef> {
        self.seg_linedef(seg).and_then(|line| {
            if seg.direction == 0 {
                self.right_sidedef(line)
            } else {
                self.left_sidedef(line)
            }
        })
    }

    pub fn seg_back_sidedef(&self, seg: &WadSeg) -> Option<&WadSidedef> {
        self.seg_linedef(seg).and_then(|line| {
            if seg.direction == 1 {
                self.right_sidedef(line)
            } else {
                self.left_sidedef(line)
            }
        })
    }

    pub fn seg_sector(&self, seg: &WadSeg) -> Option<&WadSector> {
        self.seg_sidedef(seg)
            .and_then(|side| self.sidedef_sector(side))
    }

    pub fn seg_back_sector(&self, seg: &WadSeg) -> Option<&WadSector> {
        self.seg_back_sidedef(seg)
            .and_then(|side| self.sidedef_sector(side))
    }

    pub fn left_sidedef(&self, linedef: &WadLinedef) -> Option<&WadSidedef> {
        match linedef.left_side {
            -1 => None,
            index => self.sidedefs.get(index as usize),
        }
    }

    pub fn right_sidedef(&self, linedef: &WadLinedef) -> Option<&WadSidedef> {
        match linedef.right_side {
            -1 => None,
            index => self.sidedefs.get(index as usize),
        }
    }

    pub fn sidedef_sector(&self, sidedef: &WadSidedef) -> Option<&WadSector> {
        self.sectors.get(sidedef.sector as usize)
    }

    pub fn ssector(&self, index: usize) -> Option<WadSubsector> {
        self.subsectors.get(index).cloned()
    }

    pub fn ssector_segs(&self, ssector: WadSubsector) -> Option<&[WadSeg]> {
        let start = ssector.first_seg as usize;
        let end = start + ssector.num_segs as usize;
        if end <= self.segs.len() {
            Some(&self.segs[start..end])
        } else {
            None
        }
    }

    pub fn sector_id(&self, sector: &WadSector) -> SectorId {
        let sector_id = (sector as *const _ as usize - self.sectors.as_ptr() as usize)
            / mem::size_of::<WadSector>();
        assert!(sector_id < self.sectors.len());
        sector_id as SectorId
    }

    pub fn adjacent_sectors(&self, sector: &WadSector) -> AdjacentSectorsIter {
        AdjacentSectorsIter {
            level: self,
            sector_id: self.sector_id(sector),
            linedefs: self.linedefs.iter(),
        }
    }

    pub fn sector_min_light(&self, of: &WadSector) -> LightLevel {
        self.adjacent_sectors(of)
            .map(|sector| sector.light)
            .fold(of.light, cmp::min)
    }

    pub fn neighbour_heights(&self, of: &WadSector) -> Option<NeighbourHeights> {
        let of_floor = of.floor_height;
        self.adjacent_sectors(of).fold(None, |heights, sector| {
            let (floor, ceiling) = (sector.floor_height, sector.ceiling_height);
            Some(match heights {
                Some(heights) => NeighbourHeights {
                    lowest_floor: heights.lowest_floor.min(floor),
                    highest_floor: heights.highest_floor.max(floor),
                    lowest_ceiling: heights.lowest_ceiling.min(ceiling),
                    highest_ceiling: heights.highest_ceiling.max(ceiling),

                    next_floor: if floor <= of_floor {
                        heights.next_floor
                    } else if let Some(next_floor) = heights.next_floor {
                        Some(next_floor.min(floor))
                    } else {
                        Some(floor)
                    },
                },
                None => NeighbourHeights {
                    lowest_floor: floor,
                    highest_floor: floor,
                    lowest_ceiling: ceiling,
                    highest_ceiling: ceiling,
                    next_floor: if floor > of_floor { Some(floor) } else { None },
                },
            })
        })
    }
}

#[derive(Copy, Clone, Debug)]
pub struct NeighbourHeights {
    pub lowest_floor: WadCoord,
    pub next_floor: Option<WadCoord>,
    pub highest_floor: WadCoord,
    pub lowest_ceiling: WadCoord,
    pub highest_ceiling: WadCoord,
}

pub struct AdjacentSectorsIter<'a> {
    level: &'a Level,
    sector_id: SectorId,
    linedefs: SliceIter<'a, WadLinedef>,
}

impl<'a> Iterator for AdjacentSectorsIter<'a> {
    type Item = &'a WadSector;

    fn next(&mut self) -> Option<Self::Item> {
        // TODO(cristicbz): Precompute an adjacency matrix for sectors.
        for line in &mut self.linedefs {
            let left = match self.level.left_sidedef(line) {
                Some(l) => l.sector,
                None => continue,
            };
            let right = match self.level.right_sidedef(line) {
                Some(r) => r.sector,
                None => continue,
            };
            let adjacent = if left == self.sector_id {
                self.level.sectors.get(right as usize)
            } else if right == self.sector_id {
                self.level.sectors.get(left as usize)
            } else {
                continue;
            };
            if adjacent.is_some() {
                return adjacent;
            } else {
                error!("Bad WAD: Cannot access all adjacent sectors to find minimum light.");
            }
        }
        None
    }
}


text:
package edu.gvsu.tveye.util;

import java.net.URL;
import java.util.HashMap;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;

public class ImageDownloadTask extends AsyncTask<String, Void, HashMap<String, Bitmap>>{

	private ImageCallback callback;

	public ImageDownloadTask(ImageCallback callback) {
		this.callback = callback;
	}

	@Override
	protected HashMap<String, Bitmap> doInBackground(String... params) {
		HashMap<String, Bitmap> map = new HashMap<String, Bitmap>();
		for(String param : params) {
			try {
				map.put(param, BitmapFactory.decodeStream(new URL(param).openStream()));
			} catch (Exception e) {
				e.printStackTrace();
				map.put(param, null);
			}
		}
		return map;
	}

	@Override
	public void onPostExecute(HashMap<String, Bitmap> map) {
		for(String key : map.keySet()) {
			Bitmap value = map.get(key);
			if(value == null)
				callback.imageFailed(key);
			else
				callback.imageDownloaded(key, value);
		}
	}

	public static interface ImageCallback {

		public void imageDownloaded(String url, Bitmap bitmap);
		public void imageFailed(String url);

	}

}


text:
package org.lwjgl.opencl;

/**
 * Native bindings to the intel_mem_channel_property extension.
 *
 *
On some accelerators, manual partitioning of buffers across different regions of memory may result in higher performance by spreading high-demand
 * memory across different interfaces or ports of a memory.

 *
 *
This extension allows programmers to request that a buffer allocation be implemented in a particular region of memory.

 *
 *
Requires {@link INTELCreateBufferWithProperties intel_create_buffer_with_properties}.

 */
public final class INTELMemChannelProperty {

    /** Accepted property for the {@code properties} parameter to {@link INTELCreateBufferWithProperties#clCreateBufferWithPropertiesINTEL CreateBufferWithPropertiesINTEL} to specify the requested channel for the buffer. */
    public static final int CL_MEM_CHANNEL_INTEL = 0x4213;

    private INTELMemChannelProperty() {}

}


text:
<?php

return array(
    'driver' => 'bitbucket',
    'oauth_consumer_key'      => getenv('BITBUCKET_OAUTH_CONSUMER_KEY'),
    'oauth_consumer_secret'   => getenv('BITBUCKET_OAUTH_CONSUMER_SECRET')
);


text:
import React, { Component, PropTypes } from 'react';
import cx from 'classnames';
import s from './style/circle.scss';

export default class Circle extends Component {
  static propTypes = {
    prefixClass: PropTypes.string,
    percent: PropTypes.number,
    className: PropTypes.className,
    strokeWidth: PropTypes.number,
    strokeColor: PropTypes.string,
    trailColor: PropTypes.string,
    style: PropTypes.object
  }

  getPathStyles() {
    const { prefixClass, percent, strokeWidth, gapDegree = 0, gapPosition } = this.props;
    const radius = 50 - (strokeWidth / 2);
    const beginPositionX = 0;
    const beginPositionY = -radius;
    const endPositionX = 0;
    const endPositionY = -2 * radius;
    const pathString = `M 50,50 m ${beginPositionX},${beginPositionY}
     a ${radius},${radius} 0 1 1 ${endPositionX},${-endPositionY}
     a ${radius},${radius} 0 1 1 ${-endPositionX},${endPositionY}`;
    const len = Math.PI * 2 * radius;
    const trailPathStyle = {
      strokeDasharray: `${len - gapDegree}px ${len}px`,
      strokeDashoffset: `-${gapDegree / 2}px`,
      transition: 'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s',
    };
    const strokePathStyle = {
      strokeDasharray: `${(percent / 100) * (len - gapDegree)}px ${len}px`,
      strokeDashoffset: `-${gapDegree / 2}px`,
      transition: 'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s',
    };
    return { pathString, trailPathStyle, strokePathStyle };
  }

  render() {
    const {
      prefixClass, strokeWidth, strokeColor, trailColor, style, className, ...restProps
    } = this.props;
    const classes = cx(s[`${prefixClass}-circle`], className);
    const { pathString, trailPathStyle, strokePathStyle } = this.getPathStyles();
    delete restProps.percent;
    delete restProps.gapDegree;
    delete restProps.gapPosition;
    return (
      <svg
        className={classes}
        viewBox="0 0 100 100"
        style={style}
        {...restProps}
      >
        <path
          d={pathString}
          stroke={trailColor}
          strokeWidth={strokeWidth}
          fillOpacity="0"
          style={trailPathStyle}
        />
        <path
          d={pathString}
          stroke={strokeColor}
          strokeWidth={strokeWidth}
          fillOpacity="0"
          ref={(path) => { this.path = path; }}
          style={strokePathStyle}
        />
      </svg>
    );
  }
}


text:
sudo python install/install_system.py

# Python requirements
sudo pip install -r requirements.txt


text:
require 'test_helper'

class Api::V1::BarcodesHelperTest < ActionView::TestCase
end


text:
package com.amazonaws.services.forecast.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.forecast.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * TestWindowSummaryMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class TestWindowSummaryMarshaller {

    private static final MarshallingInfo<java.util.Date> TESTWINDOWSTART_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("TestWindowStart").timestampFormat("unixTimestamp").build();
    private static final MarshallingInfo<java.util.Date> TESTWINDOWEND_BINDING = MarshallingInfo.builder(MarshallingType.DATE)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("TestWindowEnd").timestampFormat("unixTimestamp").build();
    private static final MarshallingInfo<String> STATUS_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("Status").build();
    private static final MarshallingInfo<String> MESSAGE_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("Message").build();

    private static final TestWindowSummaryMarshaller instance = new TestWindowSummaryMarshaller();

    public static TestWindowSummaryMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(TestWindowSummary testWindowSummary, ProtocolMarshaller protocolMarshaller) {

        if (testWindowSummary == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(testWindowSummary.getTestWindowStart(), TESTWINDOWSTART_BINDING);
            protocolMarshaller.marshall(testWindowSummary.getTestWindowEnd(), TESTWINDOWEND_BINDING);
            protocolMarshaller.marshall(testWindowSummary.getStatus(), STATUS_BINDING);
            protocolMarshaller.marshall(testWindowSummary.getMessage(), MESSAGE_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
export_library_dependencies
---------------------------

Disallowed.  See CMake Policy :policy:`CMP0033`.

Use :command:`install(EXPORT)` or :command:`export` command.

This command generates an old-style library dependencies file.
Projects requiring CMake 2.6 or later should not use the command.  Use
instead the install(EXPORT) command to help export targets from an
installation tree and the export() command to export targets from a
build tree.

The old-style library dependencies file does not take into account
per-configuration names of libraries or the LINK_INTERFACE_LIBRARIES
target property.

::

  export_library_dependencies(<file> [APPEND])

Create a file named <file> that can be included into a CMake listfile
with the INCLUDE command.  The file will contain a number of SET
commands that will set all the variables needed for library dependency
information.  This should be the last command in the top level
CMakeLists.txt file of the project.  If the APPEND option is
specified, the SET commands will be appended to the given file instead
of replacing it.


text:
package tests.security.acl;

import dalvik.annotation.TestTargets;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestTargetClass;

import junit.framework.TestCase;

import java.security.acl.AclNotFoundException;

@TestTargetClass(AclNotFoundException.class)
public class AclNotFoundException2Test extends TestCase {

    /**
     * @tests java.security.acl.AclNotFoundException#AclNotFoundException()
     */
    @TestTargetNew(
        level = TestLevel.COMPLETE,
        notes = "",
        method = "AclNotFoundException",
        args = {}
    )
    public void test_Constructor() {
        // Test for method java.security.acl.AclNotFoundException()
        try {
            if (true) {
                throw new AclNotFoundException();
            }
            fail("Should have thrown AclNotFoundException");
        } catch (AclNotFoundException e) {
            assertEquals("AclNotFoundException.toString() should have been "
                    + "'java.security.acl.AclNotFoundException' but was "
                    + e.toString(),
                    "java.security.acl.AclNotFoundException",
                    e.toString());
        }
    }
}


text:
<html>
<body>
This intention convert a top level method call with parentheses to the equivalent call without parentheses.
</body>
</html>


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/actionAdd"
        android:title="Feed new Entry">
    </item>
    <item
        android:id="@+id/actionClear"
        android:title="Clear Values">
    </item>
    <item
        android:id="@+id/actionFeedMultiple"
        android:title="Fast feed multiple">
    </item>
</menu>


text:
layout: ion_page
title: Surgical Taster Day 2018
permalink: /taster18/
thumb-img:
feature-img: /taster2018/poster.jpg
categories: event, news
excerpt:

---

Surgical Taster Day 2018 is now open for application!

Surgical Taster Day is a two-day programme specifically designed for secondary school students with an interest in studying medicine or even choosing surgery as a career. Under the theme of surgery, participants will be spending a whole day at each one of Hong Kong's medical schools, focusing on the surgical side of medicine. Be ready for a wide spectrum of activities, from suturing workshops to surgical skill centre experiences!

A certificate of participation will be awarded upon completion of the whole event. Come join us for an unforgettable taste of medicine and surgery!

Details of Surgical Taster Day 2018:

Date: 10th - 11th Aug 2018 (Fri-Sat)

Time: 9:00 a.m. to 6:00 p.m.

Location: Medical faculties of CUHK (10th) and HKU (11th)

Fee: $400 (Subsidised Fee available for students with proven financial need)

Eligibility: HKDSE Form 4 and above / International schools Year 10 and above (or equivalent)

Quota: 140 participants

Application deadline: 30th June 2018 (Sat) 23:59

Information Packet:

https://goo.gl/DPD8Rb

Application Form:

https://goo.gl/h5Xq8N

Interested students please read the Information Packet, complete the Application Form and send the Form to surgicaltasterday2018@gmail.com


text:
                    home

                    Products

 0}">
                    <svg class="icon-shopping-cart fill-white"
                    ng-class="{'fill-tallow' : header.list.length}"
                    ng-click="header.openDropDownCard()">
                        <use xlink:href="#icon-shopping-cart"></use>
                    </svg>

                                    €

                            Total: €


text:
import rollbar from 'rollbar';

export default rollbar.init({
  accessToken: __ROLLBAR_ACCESS_TOKEN__,
  captureUncaught: true,
  payload: {
    environment: process.env.NODE_ENV,
    client: {
      javascript: {
        source_map_enabled: true,
        code_version: __GIT_REVISION__,
        // Optionally have Rollbar guess which frames the error was thrown from
        // when the browser does not provide line and column numbers.
        guess_uncaught_frames: true
      }
    }
  }
});


text:
package com.autodesk.spark.sdk.models.Request;

/**
 * Created by ronnyremsnik on 5/17/15.
 */
public class CreateJobRequest {

    public String printerID;
    public String printableURL;

    public CreateJobRequest(String printerID, String printableURL) {
        this.printerID = printerID;
        this.printableURL = printableURL;
    }

}


text:
(function(){

  var app = angular.module('CartesCadeaux', ['ngMaterial']);

}());


text:
'use strict';

var _ = require('../../');

var _2 = require('../');

var _helpers = require('../../helpers');

describe('Given the Logger middleware', function () {
  beforeEach(function () {
    _.Machine.flush();
    sinon.stub(console, 'log');
    _.Machine.addMiddleware(_2.Logger);
  });
  afterEach(function () {
    console.log.restore();
  });
  describe('when using Logger with function and string as a handler', function () {
    it('should log to the console', function () {
      var machine = _.Machine.create({ name: 'idle' }, {
        idle: {
          run: function run() {
            return 'running';
          }
        },
        running: {
          stop: 'idle'
        }
      });

      machine.run({}, 42, 'hello world');
      machine.stop();

      expect(console.log.callCount).to.be.equal(4);
      [machine.name + ': "run" dispatched with payload [object Object],42,hello world', machine.name + ': state changed to "running"', machine.name + ': "stop" dispatched', machine.name + ': state changed to "idle"'].forEach(function (logStr, i) {
        expect(console.log.getCall(i)).to.be.calledWith(logStr);
      });
    });
  });
  describe('when using the Logger with a generator function', function () {
    it('should log every step of the generator', function () {
      var myFunc = function myFunc() {
        return { name: 'running' };
      };
      var machine = _.Machine.create({ name: 'idle' }, {
        idle: {
          run: /*#__PURE__*/regeneratorRuntime.mark(function run() {
            return regeneratorRuntime.wrap(function run$(_context) {
              while (1) {
                switch (_context.prev = _context.next) {
                  case 0:
                    _context.next = 2;
                    return 'running';

                  case 2:
                    _context.next = 4;
                    return { name: 'running' };

                  case 4:
                    _context.next = 6;
                    return (0, _helpers.call)(myFunc, 42);

                  case 6:
                    return _context.abrupt('return', 'running');

                  case 7:
                  case 'end':
                    return _context.stop();
                }
              }
            }, run, this);
          })
        },
        running: {
          stop: 'idle'
        }
      });

      machine.run({ foo: 'bar' }, 42, 'hello world');
      machine.stop();

      expect(console.log.callCount).to.be.equal(9);
      [machine.name + ': "run" dispatched with payload [object Object],42,hello world', machine.name + ': generator step -> running', machine.name + ': state changed to "running"', machine.name + ': generator step -> [object Object]', machine.name + ': state changed to "running"', machine.name + ': generator step -> [object Object]', machine.name + ': state changed to "running"', machine.name + ': "stop" dispatched', machine.name + ': state changed to "idle"'].forEach(function (logStr, i) {
        expect(console.log.getCall(i)).to.be.calledWith(logStr);
      });
    });
  });
});


text:
package com.github.kzwang.osem.utils;

import com.github.kzwang.osem.annotations.IndexableId;
import com.github.kzwang.osem.exception.ElasticSearchOsemException;
import org.elasticsearch.common.Preconditions;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.Loggers;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.util.Collection;
import java.util.Set;

import static org.reflections.ReflectionUtils.*;

/**
 * Reflection Util class
 */
public class OsemReflectionUtils {

    private static final ESLogger logger = Loggers.getLogger(OsemReflectionUtils.class);

    public static Field getField(Class clazz, String fieldName) {
        Set<Field> fields = getAllFields(clazz, withName(fieldName));
        Preconditions.checkArgument(fields.size() == 1, "Unable to find field {} for class {}", fieldName, clazz.getSimpleName());
        Field field = fields.iterator().next();
        field.setAccessible(true);
        return field;
    }

    public static Object getFieldValue(Object object, String fieldName) {
        Field field = getField(object.getClass(), fieldName);
        return getFieldValue(object, field);
    }

    public static Object getFieldValue(Object object, Field field) {
        try {
            field.setAccessible(true);
            return field.get(object);
        } catch (IllegalAccessException e) {
            logger.error("Failed to get value from field", e);
            throw new ElasticSearchOsemException(e);
        }
    }

    public static Field getIdField(Class clazz) {
        Set<Field> fields = getAllFields(clazz, withAnnotation(IndexableId.class));
        Preconditions.checkArgument(fields.size() == 1, "Unable to find id field for class {}", clazz.getSimpleName());
        return fields.iterator().next();
    }

    public static Class getGenericType(Field field) {
        if (!Collection.class.isAssignableFrom(field.getType())) {
            return field.getType();
        }
        ParameterizedType type = (ParameterizedType) field.getGenericType();
        return (Class) type.getActualTypeArguments()[0];
    }

    public static Class getGenericType(Method method) {
        if (!Collection.class.isAssignableFrom(method.getReturnType())) {
            return method.getReturnType();
        }
        ParameterizedType type = (ParameterizedType) method.getGenericReturnType();
        return (Class) type.getActualTypeArguments()[0];
    }

}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2009.02.12 at 04:54:55 PM CST
//

package org.jasig.services.persondir.support.xml.om;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

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

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element ref="{}value" maxOccurs="unbounded" minOccurs="0"/>
 *       </sequence>
 *       <attribute name="key" use="required" type="{http://www.w3.org/2001/XMLSchema}NCName" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "value"
})
@XmlRootElement(name = "attribute")
public class Attribute {

    protected List<String> value;
    @XmlAttribute(required = true)
    @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
    @XmlSchemaType(name = "NCName")
    protected String key;

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

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

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

     *    getValue().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link String }
     *
     *
     */
    public List<String> getValue() {
        if (value == null) {
            value = new ArrayList<String>();
        }
        return this.value;
    }

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

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

}


text:
body.comment div.page-container {
	height: 100%;

	display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;

    -webkit-box-direction: normal;
    -moz-box-direction: normal;
    -webkit-box-orient: vertical;
    -moz-box-orient: vertical;
    -webkit-flex-direction: column;
    -ms-flex-direction: column;
	flex-direction: column;
}

body.comment div.content-container {
	flex-grow: 1;
}

body.comment div.row {
	margin-right: 0;
	margin-left: 0;
}

body.comment h1.pagetitle {
	background-color: #28adad;
}

/*body.comment form.comment-form,*/
body.comment div.comments{
	margin-bottom: 20px;
}

body.comment div.comments-list {
	overflow-x: hidden;
	overflow-y: auto;
	margin-bottom: 10px;
}

body.comment div.comment{
	background: white;
	padding: 10px;
	border: 2px solid #558aa9;
	margin-bottom: 10px;
	border-radius: 5px;
}

body.comment div.comment.even{
	text-align: right;
}

body.comment div.comment.even p.commentdate {
	text-align: left;
}

body.comment div.comment.odd p.commentdate {
	text-align: right;
}

body.comment .submit-comment{
	background-color: #28adad;
	color: black;
	padding: 5px;
}

body.comment .submitting-comment{
	padding: 5px;
}

body.comment .form-group {
	margin-left: 0px;
	margin-right: 0px;
}

@media (min-width: 768px) {
	body.comment .submit-comment{
		padding: 10px;
	}

	body.comment .submitting-comment{
		padding: 10px;
	}
}


text:
"""Tests for grading record logic."""

import unittest

from soc.modules.gsoc.logic import grading_record as grading_record_logic
from soc.modules.gsoc.models import grading_project_survey_record \
  as grading_project_survey_record_model
from soc.modules.gsoc.models import grading_record as grading_record_model
from soc.modules.gsoc.models import grading_survey_group \
    as grading_survey_group_model
from soc.modules.gsoc.models import project as project_model
from soc.modules.gsoc.models import project_survey_record \
    as project_survey_record_model
from soc.modules.seeder.logic.seeder import logic as seeder_logic

from tests import program_utils
from tests import survey_utils

class GetFieldsForGradingRecordTest(unittest.TestCase):
  """Unit tests for getFieldsForGradingRecord function."""

  def setUp(self):
    # seed a program
    self.program = program_utils.seedGSoCProgram()

    survey_helper = survey_utils.SurveyHelper(self.program, False)

    # seed evaluations
    self.student_evaluation = survey_helper.createStudentEvaluation()
    self.mentor_evaluation = survey_helper.createMentorEvaluation()

    # seed grading survey group
    properties = {
        'program': self.program,
        'grading_survey': self.mentor_evaluation,
        'student_survey': self.student_evaluation,
        }
    self.survey_group = seeder_logic.seed(
        grading_survey_group_model.GSoCGradingSurveyGroup,
        properties=properties)

    # seed project
    self.project = seeder_logic.seed(project_model.GSoCProject)

  def testNoSurveyRecords(self):
    """Tests when no survey records has been filed for the project."""
    fields = grading_record_logic.getFieldsForGradingRecord(
        self.project, self.survey_group)

    # check that correct survey group is in fields
    self.assertEqual(
        fields['grading_survey_group'].key(), self.survey_group.key())

    # check that no mentor or students records are returned
    self.assertIsNone(fields['mentor_record'])
    self.assertIsNone(fields['student_record'])

    # check that grade decision is 'undecided'
    self.assertEquals(fields['grade_decision'],
        grading_record_model.GRADE_UNDECIDED)

  def testNoStudentRecord(self):
    """Tests when no student survey record has been filed for the project."""
    # seed mentor record with a passing grade
    properties = {
        'project': self.project,
        'grade': True,
        'survey': self.mentor_evaluation
        }
    mentor_record = seeder_logic.seed(
        grading_project_survey_record_model.GSoCGradingProjectSurveyRecord,
        properties=properties)

    fields = grading_record_logic.getFieldsForGradingRecord(
        self.project, self.survey_group)

    # check that no student record is returned
    self.assertIsNone(fields['student_record'])

    # check that mentor record is returned
    self.assertEqual(fields['mentor_record'].key(), mentor_record.key())

    # check that grade decision is 'fail'
    self.assertEqual(fields['grade_decision'], grading_record_model.GRADE_FAIL)

  def testNoMentorRecord(self):
    """Tests when no mentor survey record has been filed for the project."""
    # seed sudent record
    properties = {
        'project': self.project,
        'survey': self.student_evaluation,
        }
    student_record = seeder_logic.seed(
        project_survey_record_model.GSoCProjectSurveyRecord,
        properties=properties)

    fields = grading_record_logic.getFieldsForGradingRecord(
        self.project, self.survey_group)

    # check that no mentor record is returned
    self.assertIsNone(fields['mentor_record'])

    # check that student record is returned
    self.assertEqual(fields['student_record'].key(), student_record.key())

    # check that grade decision is 'undecided'
    self.assertEqual(fields['grade_decision'],
        grading_record_model.GRADE_UNDECIDED)

  def testMentorFailingRecord(self):
    """Tests when mentor record fails the project."""
    # seed sudent record
    properties = {
        'project': self.project,
        'survey': self.student_evaluation,
        }
    student_record = seeder_logic.seed(
        project_survey_record_model.GSoCProjectSurveyRecord,
        properties=properties)

    # seed mentor record with a failing grade
    properties = {
        'project': self.project,
        'grade': False,
        'survey': self.mentor_evaluation
        }
    mentor_record = seeder_logic.seed(
        grading_project_survey_record_model.GSoCGradingProjectSurveyRecord,
        properties=properties)

    fields = grading_record_logic.getFieldsForGradingRecord(
        self.project, self.survey_group)

    # check that both records are returned
    self.assertEqual(fields['student_record'].key(), student_record.key())
    self.assertEqual(fields['mentor_record'].key(), mentor_record.key())

    # check that grade decision is 'fail'
    self.assertEqual(fields['grade_decision'], grading_record_model.GRADE_FAIL)

  def testMentorPassingRecord(self):
    """Tests when mentor record passes the project."""
    # seed sudent record
    properties = {
        'project': self.project,
        'survey': self.student_evaluation,
        }
    student_record = seeder_logic.seed(
        project_survey_record_model.GSoCProjectSurveyRecord,
        properties=properties)

    # seed mentor record with a passing grade
    properties = {
        'project': self.project,
        'grade': True,
        'survey': self.mentor_evaluation
        }
    mentor_record = seeder_logic.seed(
        grading_project_survey_record_model.GSoCGradingProjectSurveyRecord,
        properties=properties)

    fields = grading_record_logic.getFieldsForGradingRecord(
        self.project, self.survey_group)

    # check that both records are returned
    self.assertEqual(fields['student_record'].key(), student_record.key())
    self.assertEqual(fields['mentor_record'].key(), mentor_record.key())

    # check that grade decision is 'fail'
    self.assertEqual(fields['grade_decision'], grading_record_model.GRADE_PASS)