text:
using System;

// I'll probably forget all those things I've googled by tomorrow. :(

class SumFiveNumbers
{
    static void Main()
    {
        string sNumbers = Console.ReadLine();
        char[] separator = new char[1];
        separator[0] = ' ';
        string[] arrStrNums = sNumbers.Split(separator, StringSplitOptions.RemoveEmptyEntries);
        double[] iNumbers = Array.ConvertAll(arrStrNums, double.Parse);
        double sum = 0;
        Array.ForEach(iNumbers, delegate(double i) { sum += i; });
        Console.WriteLine(sum);
    }
}

redpajama_set_name: RedPajamaGithub


text:
import React, {Component} from 'react';
import fl from 'styles/fluidable.less';
import StuffGroupsList from 'components/stuff-groups-list/stuff-groups-list.js';
import StuffEmployeesList from 'components/stuff-employees-list/stuff-employees-list.js';
import StuffEmployeeDetail from 'components/stuff-employee-detail/stuff-employee-detail.js';
import style from './Stuff.less';
import {tr} from 'lib/locale.js';

export default class Stuff extends Component {

  componentWillMount(){
    this.props.loadGroups()
  }

  render() {

    const {
      selectGroup,
      selectEmployee,
      lockEmployee,
      unlockEmployee,
      turnOnEditing,
      turnOffEditing,
      editEmployee,
      //
      groups,
      activeGroupId,
      employees,
      activeEmployeeId,
      locked,
      isEditing
    } = this.props;
    const {lastName, firstName, middleName, employeeId, phones} = this.props.employee;
    const onSelectGroup = (id) => {
      selectGroup(id)
    };
    const onSelectEmployee = (id) => {
      selectEmployee(id)
    };

    return (

{tr('STUFF_STUFF')}

              <StuffGroupsList
                onClickHandler={onSelectGroup}
                items={groups}
                title={tr('STUFF_TARIFFS')}
                activeGroupId={activeGroupId}
              />

              <StuffEmployeesList
                onClickHandler={onSelectEmployee}
                title={tr('STUFF_GROUP_MEMBERS')}
                items={employees}
                activeEmployeeId={activeEmployeeId}
              />

              <StuffEmployeeDetail
                title={tr('STUFF_GROUP_INFO')}
                firstName={firstName}
                lastName={lastName}
                middleName={middleName}
                employeeId={employeeId}
                isEditing={isEditing}
                phones={phones}
                locked={locked}
                onLockEmployee={lockEmployee}
                onUnLockEmployee={unlockEmployee}
                onTurnOnEditing={turnOnEditing}
                onTurnOffEditing={turnOffEditing}
                onEditEmployee={editEmployee}
              />

    )
  }
};


text:
Reset a selected system
=======================

## Precondition

- There must be systems/clusters/sectors defined.

## Scenario

- The user wants to reset each clusters and sectors to force them into the initial state.
- UI sends the reset operation to the system controller.
- System controller sends the reset command to each clusters are available.
- Cluster controllers sends the reset command to each sector controllers are available.
- Sector controllers sets the actual value of the device port.

The figure below shows the microservices architecture of this scenario.

![Reset the selected system](Reset_Selected_System.png)

## Messages

### REST payloads

- [resetSystemReq](https://github.com/tombenke/giri-rest-api/blob/master/lib/services/systems/system/reset/postOperation-requestBody.json)
- [resetSystemRespOk](https://github.com/tombenke/giri-rest-api/blob/master/lib/services/systems/system/reset/postOperation-responseBody.json)
- [responseErr](https://github.com/tombenke/giri-rest-api/blob/master/lib/services/error-responseBody.json)

### Seneca messages

#### resetSystem

    {
        "role": "giri-system-control",
        "cmd": "resetSystem",
        "systemId": "2a1152ee-4d77-4ff4-a811-598555937625"
    }

#### resetCluster

    {
        "role": "giri-cluster-control",
        "cmd": "resetCluster",
        "clusterId": "79e914da-5103-4651-abb1-70214d2270a7"
    }

#### resetSector

    {
        "role": "giri-sector-control",
        "cmd": "resetCluster",
        "sectorId": 9688588a-2507-4460-855c-72743ff7fe5f"
    }

#### setSectorState

    {
        "role": "giri-sector-control",
        "cmd": "sectorStateUpdate",
        "sectorId": 9688588a-2507-4460-855c-72743ff7fe5f",
        "state": "OFF"
    }

#### setPortState

    {
        "role": "valve",
        "cmd": "setState",
        "port": {
            "deviceId": "53181aca-1dad-4cc0-86b6-eaf59dd01989",
            "portIdx": 0
        },
        "state": "ON"

## See also
- [giri-rest-api](https://github.com/tombenke/giri-rest-api)
- [giri-rest-api/lib/services/systems/system/reset/](https://github.com/tombenke/giri-rest-api/tree/master/lib/services/systems/system/reset)


text:
package com.sabre.oss.conf4j.internal.factory.jdkproxy;

import com.sabre.oss.conf4j.internal.config.PropertyMetadata;
import com.sabre.oss.conf4j.internal.factory.ConfigurationPropertiesAccessor;
import com.sabre.oss.conf4j.internal.factory.SubConfigurationList;
import com.sabre.oss.conf4j.internal.model.ConfigurationModel;
import com.sabre.oss.conf4j.internal.model.PropertyModel;
import com.sabre.oss.conf4j.internal.model.SubConfigurationListPropertyModel;
import com.sabre.oss.conf4j.internal.model.SubConfigurationPropertyModel;

import java.io.Serializable;
import java.lang.invoke.MethodHandles.Lookup;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import static com.sabre.oss.conf4j.internal.Constants.LIST_SUFFIX;
import static com.sabre.oss.conf4j.internal.Constants.METADATA_SUFFIX;
import static com.sabre.oss.conf4j.internal.factory.jdkproxy.DefaultMethodUtils.getLookup;
import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.toSet;

abstract class AbstractJdkProxyConfigurationInvocationHandler implements InvocationHandler, Serializable, ConfigurationPropertiesAccessor {
    private static final long serialVersionUID = 1L;

    /**
     * Holds properties.
     */
    protected final Map<String, Object> properties = new HashMap<>();

    /**
     * Holds property metadata.
     */
    protected final Map<String, PropertyMetadata> propertiesMetadata = new HashMap<>();

    /**
     * Set of sub-configuration properties.
     */
    protected final Set<String> subConfigurationProperties;

    /**
     * Set of sub-configuration list properties.
     */
    protected final Set<String> subConfigurationListProperties;

    protected AbstractJdkProxyConfigurationInvocationHandler(ConfigurationModel configurationModel) {
        requireNonNull(configurationModel, "configurationModel cannot be null");

        subConfigurationProperties = configurationModel.getProperties().stream()
                .filter(p -> p instanceof SubConfigurationPropertyModel)
                .map(PropertyModel::getPropertyName)
                .collect(toSet());

        subConfigurationListProperties = configurationModel.getProperties().stream()
                .filter(p -> p instanceof SubConfigurationListPropertyModel)
                .map(PropertyModel::getPropertyName)
                .collect(toSet());
    }

    protected abstract Object invokeInternal(Object proxy, Method method, Object[] args);

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        if (method.isDefault()) {
            Class<?> declaringClass = method.getDeclaringClass();
            Lookup lookup = getLookup(declaringClass);

            return lookup
                    .unreflectSpecial(method, declaringClass)
                    .bindTo(proxy)
                    .invokeWithArguments(args);
        }

        // Handle Object methods
        switch (method.getName()) {
            case "equals":
                Class<?>[] methodParameterTypes = method.getParameterTypes();
                if (methodParameterTypes.length == 1 && methodParameterTypes[0] == Object.class) {
                    return proxy == args[0];
                }
                break;
            case "hashCode":
                if (method.getParameterTypes().length == 0) {
                    return System.identityHashCode(proxy);
                }
                break;
            case "toString":
                if (method.getParameterTypes().length == 0) {
                    return proxy.getClass().getName();
                }
                break;
            default:
                break;
        }

        return invokeInternal(proxy, method, args);
    }

    @Override
    public PropertyMetadata getPropertyMetadata(String propertyName) {
        return propertiesMetadata.get(propertyName + METADATA_SUFFIX);
    }

    @Override
    public void setPropertyMetadata(String propertyName, PropertyMetadata propertyMetadata) {
        propertiesMetadata.put(propertyName + METADATA_SUFFIX, propertyMetadata);
    }

    @Override
    public Object getValueProperty(String propertyName) {
        return properties.get(propertyName);
    }

    @Override
    public void setValueProperty(String propertyName, Object value) {
        properties.put(propertyName, value);
    }

    @Override
    public Object getSubConfigurationProperty(String propertyName) {
        return properties.get(propertyName);
    }

    @Override
    public void setSubConfigurationProperty(String propertyName, Object subConfiguration) {
        properties.put(propertyName, subConfiguration);
    }

    @Override
    public SubConfigurationList getSubConfigurationListProperty(String propertyName) {
        return (SubConfigurationList) properties.get(propertyName + LIST_SUFFIX);
    }

    @Override
    public void setSubConfigurationListProperty(String propertyName, SubConfigurationList list) {
        properties.put(propertyName + LIST_SUFFIX, list);
    }
}


text:
@font-face {
    font-family: "<%= fontName %>";
    src: url('<%= fontPath %>/<%= fontName %>.eot');
    src: url('<%= fontPath %>/<%= fontName %>.eot?#iefix') format('eot'),
    url('<%= fontPath %>/<%= fontName %>.woff') format('woff'),
    url('<%= fontPath %>/<%= fontName %>.ttf') format('truetype'),
    url('<%= fontPath %>/<%= fontName %>.svg#<%= fontName %>') format('svg');
    font-weight: normal;
    font-style: normal;
}

<%= glyphs.map(function(glyph){ return '.' + className + '-' + glyph.name + ':before' }).join(',\n') %> {
    font-family: "<%= fontName %>";
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    display: inline-block;
    text-decoration: inherit;
}
<% _.each(glyphs, function(glyph) { %>.<%= className %>-<%= glyph.name %>:before { content: "\<%= glyph.codepoint.toString(16).toUpperCase() %>" }
<% }); %>


text:
package multitenant

import (
	"encoding/hex"
	"fmt"
	log "github.com/golang/glog"
	"net"
	"os/exec"
	"strings"
	"syscall"

	"github.com/openshift/openshift-sdn/ovssubnet/api"
	"github.com/openshift/openshift-sdn/pkg/netutils"
)

type FlowController struct {
}

func NewFlowController() *FlowController {
	return &FlowController{}
}

func (c *FlowController) Setup(localSubnet, containerNetwork, servicesNetwork string, mtu uint) error {
	_, ipnet, err := net.ParseCIDR(localSubnet)
	subnetMaskLength, _ := ipnet.Mask.Size()
	gateway := netutils.GenerateDefaultGateway(ipnet).String()
	out, err := exec.Command("openshift-sdn-multitenant-setup.sh", gateway, ipnet.String(), containerNetwork, fmt.Sprint(subnetMaskLength), gateway, servicesNetwork, fmt.Sprint(mtu)).CombinedOutput()
	log.Infof("Output of setup script:\n%s", out)
	if err != nil {
		exitErr, ok := err.(*exec.ExitError)
		if ok {
			status := exitErr.ProcessState.Sys().(syscall.WaitStatus)
			if status.Exited() && status.ExitStatus() == 140 {
				// valid, do nothing, its just a benevolent restart
				return nil
			}
		}
		log.Errorf("Error executing setup script. \n\tOutput: %s\n\tError: %v\n", out, err)
	}
	return err
}

func (c *FlowController) AddOFRules(nodeIP, subnet, localIP string) error {
	if nodeIP == localIP {
		return nil
	}

	cookie := generateCookie(nodeIP)
	iprule := fmt.Sprintf("table=7,cookie=0x%s,priority=100,ip,nw_dst=%s,actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31],set_field:%s->tun_dst,output:1", cookie, subnet, nodeIP)
	arprule := fmt.Sprintf("table=8,cookie=0x%s,priority=100,arp,nw_dst=%s,actions=move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31],set_field:%s->tun_dst,output:1", cookie, subnet, nodeIP)
	o, e := exec.Command("ovs-ofctl", "-O", "OpenFlow13", "add-flow", "br0", iprule).CombinedOutput()
	log.Infof("Output of adding %s: %s (%v)", iprule, o, e)
	o, e = exec.Command("ovs-ofctl", "-O", "OpenFlow13", "add-flow", "br0", arprule).CombinedOutput()
	log.Infof("Output of adding %s: %s (%v)", arprule, o, e)
	return e
}

func (c *FlowController) DelOFRules(node, localIP string) error {
	if node == localIP {
		return nil
	}

	log.Infof("Calling del rules for %s", node)
	cookie := generateCookie(node)
	iprule := fmt.Sprintf("table=7,cookie=0x%s/0xffffffff", cookie)
	arprule := fmt.Sprintf("table=8,cookie=0x%s/0xffffffff", cookie)
	o, e := exec.Command("ovs-ofctl", "-O", "OpenFlow13", "del-flows", "br0", iprule).CombinedOutput()
	log.Infof("Output of deleting local ip rules %s (%v)", o, e)
	o, e = exec.Command("ovs-ofctl", "-O", "OpenFlow13", "del-flows", "br0", arprule).CombinedOutput()
	log.Infof("Output of deleting local arp rules %s (%v)", o, e)
	return e
}

func generateCookie(ip string) string {
	return hex.EncodeToString(net.ParseIP(ip).To4())
}

func (c *FlowController) AddServiceOFRules(netID uint, IP string, protocol api.ServiceProtocol, port uint) error {
	rule := generateServiceRule(netID, IP, protocol, port)
	o, e := exec.Command("ovs-ofctl", "-O", "OpenFlow13", "add-flow", "br0", rule).CombinedOutput()
	log.Infof("Output of adding %s: %s (%v)", rule, o, e)
	return e
}

func (c *FlowController) DelServiceOFRules(netID uint, IP string, protocol api.ServiceProtocol, port uint) error {
	rule := generateServiceRule(netID, IP, protocol, port)
	o, e := exec.Command("ovs-ofctl", "-O", "OpenFlow13", "del-flows", "br0", rule).CombinedOutput()
	log.Infof("Output of deleting %s: %s (%v)", rule, o, e)
	return e
}

func generateServiceRule(netID uint, IP string, protocol api.ServiceProtocol, port uint) string {
	if netID == 0 {
		return fmt.Sprintf("table=4,priority=200,%s,nw_dst=%s,tp_dst=%d,actions=output:2", strings.ToLower(string(protocol)), IP, port)
	} else {
		return fmt.Sprintf("table=4,priority=200,reg0=%d,%s,nw_dst=%s,tp_dst=%d,actions=output:2", netID, strings.ToLower(string(protocol)), IP, port)
	}
}


text:
from flask import Flask, render_template
from flaskext.mysql import MySQL

app = Flask(__name__)

app.config["MYSQL_DATABASE_HOST"] = "localhost"
app.config["MYSQL_DATABASE_PORT"] = 3306
app.config["MYSQL_DATABASE_USER"] = "root"
app.config["MYSQL_DATABASE_PASSWORD"] = "84e5beee-aaf7-11e4-b696-180373e4501b"
app.config["MYSQL_DATABASE_DB"] = 'poppy'
# MYSQL_DATABASE_CHARSET	default is 'utf-8'

mysql = MySQL()
mysql.init_app(app)

@app.route('/')
def home():
    return render_template('home.html')

@app.route('/countries')
def countries():
    cursor = mysql.get_db().cursor()
    cursor.execute("SELECT * FROM countries WHERE userid='1'")
    values = {}
    for userid, USA, India, China, Russia, Germany in cursor:
        return render_template('countries.html', USA=USA, India=India, China=China, Russia=Russia, Germany=Germany)

@app.route('/browsers')
def browsers():
    cursor = mysql.get_db().cursor()
    cursor.execute("SELECT * FROM browsers WHERE userid='1'")
    values = {}
    for userid, Chrome, Firefox, IE, Opera in cursor:
        return render_template('browsers.html', Chrome=Chrome, Firefox=Firefox, IE=IE, Opera=Opera)

@app.route('/days')
def days():
    cursor = mysql.get_db().cursor()
    cursor.execute("SELECT * FROM days WHERE userid='1'")
    values = {}
    for userid, day1, day2, day3, day4 in cursor:
        print day1, day2, day3, day4
        return render_template('days.html', day1=day1, day2=day2, day3=day3, day4=day4)

@app.route('/urls')
def urls():
    return render_template('urls.html')

@app.route('/about')
def about():
    return render_template('about.html')

if __name__ == '__main__':
    app.run(debug=True)


text:
<?php

namespace Intraxia\Jaxion\Axolotl;

use InvalidArgumentException;
use ReflectionClass;

/**
 * Class Type
 *
 * Responsible for validating new items against a type.
 *
 * @package    Intraxia\Jaxion
 * @subpackage Axolotl
 */
class Type {

	/**
	 * Type to validate against.
	 *
	 * @var string
	 */
	private $type;

	/**
	 * Type constructor.
	 *
	 * @param string $type
	 * @param bool   $key_type
	 */
	public function __construct( $type, $key_type = false ) {
		$this->type = $this->determine( $type, $key_type );
	}

	/**
	 * Get validation type.
	 *
	 * @return string
	 */
	public function get_type() {
		return $this->type;
	}

	/**
	 * Returns whether the type is an Axolotl model.
	 *
	 * @return bool
	 */
	public function is_model() {
		if ( ! class_exists( $this->type ) ) {
			return false;
		}

		$reflection = new ReflectionClass( $this->type );
		return $reflection->isSubclassOf( 'Intraxia\Jaxion\Axolotl\Model' );
	}

	/**
	 * Create a new model from the given data.
	 *
	 * @param array $data Data for the model.
	 *
	 * @return Model
	 */
	public function create_model( array $data ) {
		return new $this->type( $data );
	}

	/**
	 * Validates an array of element.
	 *
	 * @param array $elements Elements to be validated.
	 *
	 * @throws InvalidArgumentException
	 */
	public function validate_elements( array $elements ) {
		foreach ( $elements as $element ) {
			$this->validate_element( $element );
		}
	}

	/**
	 * Validate whether the
	 *
	 * @param mixed $element Element to validate.
	 *
	 * @throws InvalidArgumentException
	 */
	public function validate_element( $element ) {
		$type = gettype( $element );
		$callable = $this->type === 'callable';
		$is_object = 'object' === $type;
		$loose_check = $this->type === 'object';

		// callable must be callable
		if ( $callable && ! is_callable( $element ) ) {
			throw new InvalidArgumentException( 'Item must be callable' );
		}

		// target isn't callable, object must be an instance of target
		if ( ! $loose_check && ! $callable && $is_object && ! is_a( $element, $this->type ) ) {
			throw new InvalidArgumentException( "Item is not type or subtype of $this->type" );
		}

		// a non callable, non object type should match the target string
		if ( ! $callable && ! $is_object && $type !== $this->type ) {
			throw new InvalidArgumentException( "Item is not of type: $this->type" );
		}
	}

	/**
	 * Determine the type to validate against.
	 *
	 * @param string $type     Type to determine.
	 * @param bool   $key_type Whether the type is for keys.
	 *
	 * @return string
	 *
	 * @throws InvalidArgumentException
	 */
	private function determine( $type, $key_type = false ) {
		if ( ! $key_type && $this->non_scalar_type_exists( $type ) ) {
			return $type;
		}

		if ( $scalar_type = $this->determine_scalar( $type ) ) {
			if ( $key_type && (in_array( $scalar_type, array( 'double', 'boolean' ) )) ) {
				throw new InvalidArgumentException( 'This type is not supported as a key.' );
			}

			return $scalar_type;
		}

		throw new InvalidArgumentException( 'This type does not exist.' );
	}

	/**
	 * Determines whether the given type exists.
	 *
	 * @param string $type Type to check.
	 *
	 * @return bool
	 */
	private function non_scalar_type_exists( $type ) {
		return class_exists( $type )
				|| interface_exists( $type )
				|| in_array( $type, array( 'array', 'object', 'callable' ) );
	}

	/**
	 * Returns the type if it's scalar, otherwise, returns null.
	 *
	 * @param string $type Type to check.
	 *
	 * @return string|null
	 */
	private function determine_scalar( $type ) {
		$synonyms = array(
			'int' => 'integer',
			'float' => 'double',
			'bool' => 'boolean',
		);

		if ( array_key_exists( $type, $synonyms ) ) {
			$type = $synonyms[ $type ];
		}

		return in_array( $type, array( 'string', 'integer', 'double', 'boolean' ) ) ?
			$type :
			null;
	}
}


text:
#/***********************************************************************
#    filename:   __init__.py
#    created:    25/5/2013
#    author:     Martin Preisler
#
#    purpose:    Stub package file
#*************************************************************************/
#/***************************************************************************
# *   Copyright (C) 2004 - 2013 Paul D Turner & The CEGUI Development Team
#
# *   License: generator is GPL3 (python ogre code generators are also GPL)
# *            generated code is MIT as the rest of CEGUI


text:
set -o errexit
set -o nounset

START=$(date +%s)
ROOTDIR="$(cd "$(dirname "${0}")"; echo $(pwd))"

# install packages with brew
brew install \
    zsh \
    tmux \
    git \
    vim \
    curl \
    sqlite \
    mariadb \
    redis \
    mailhog \
    node \
    node-sass \
    python@3.9 \
    php@7.4 \
    php@8.0 \
    composer \
    gpg2 \
    gnupg \
    pinentry-mac

# install apps with brew
brew install --cask \
    alfred \
    another-redis-desktop-manager \
    boostnote \
    dbeaver-community \
    docker \
    dropbox \
    flux \
    fork \
    google-chrome \
    imageoptim \
    iterm2 \
    keeweb \
    microsoft-teams \
    postman \
    sequel-ace \
    sequel-pro \
    spectacle \
    signal \
    slack \
    spotify \
    sublime-text \
    telegram \
    transmit \
    visual-studio-code \
    vlc \
    webtorrent \
    whatsapp

pushd ${HOME}
    # setup zsh
    rm -f .zshrc
    ln -s ${ROOTDIR}/zshrc .zshrc

    # setup vim
    rm -rf .vim
    rm -f .vimrc
    ln -s ${ROOTDIR}/vim .vim
    ln -s ${ROOTDIR}/vimrc .vimrc

    # setup git
    rm -f .gitconfig
    rm -f .gitignore
    ln -s ${ROOTDIR}/gitconfig .gitconfig
    ln -s ${ROOTDIR}/gitignore .gitignore

    # setup tmux
    rm -f .tmux.conf
    ln -s ${ROOTDIR}/tmux.conf .tmux.conf

    # setup other commandline tools in .bin folder
    python3 -m venv .venv

    source .venv/bin/activate

    pip install --upgrade pip
    pip install Fabric3
    pip install ansible
    pip install Sphinx
    pip install sphinx-rtd-theme

    deactivate

    mkdir -p .bin

    pushd .bin
        composer global require psy/psysh
        composer global require friendsofphp/php-cs-fixer

        mkdir -p repos

        pushd repos
            git clone https://github.com/zsh-users/zsh-autosuggestions.git || true
            git clone https://github.com/zsh-users/zsh-syntax-highlighting.git || true
            git clone https://github.com/so-fancy/diff-so-fancy.git || true
        popd

        ln -sf ${HOME}/.venv/bin/fab
        ln -sf ${HOME}/.venv/bin/ansible-vault
        ln -sf ${HOME}/.venv/bin/sphinx-build
        ln -sf ${HOME}/.venv/bin/sphinx-quickstart
        ln -sf ${HOME}/.composer/vendor/bin/psysh
        ln -sf ${HOME}/.composer/vendor/bin/php-cs-fixer
        ln -sf ${HOME}/.bin/repos/diff-so-fancy/diff-so-fancy diff-so-fancy
    popd
popd

DONE=$(date +%s)
DIFF=$((${DONE} - ${START}))

echo
echo "Done, time established: ${DIFF} seconds"
echo


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

    <title>java.sql (Groovy JDK enhancements)</title>

    <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

    java.sql

Interfaces

ResultSet

ResultSetMetaData

Classes

Date

Timestamp


text:
from .sub_resource import SubResource

class ApplicationGatewayBackendHttpSettings(SubResource):
    """Backend address pool settings of an application gateway.

    :param id: Resource ID.
    :type id: str
    :param port: Port
    :type port: int
    :param protocol: Protocol. Possible values are: 'Http' and 'Https'.
     Possible values include: 'Http', 'Https'
    :type protocol: str or
     ~azure.mgmt.network.v2016_09_01.models.ApplicationGatewayProtocol
    :param cookie_based_affinity: Cookie based affinity. Possible values are:
     'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled'
    :type cookie_based_affinity: str or
     ~azure.mgmt.network.v2016_09_01.models.ApplicationGatewayCookieBasedAffinity
    :param request_timeout: Request timeout in seconds. Application Gateway
     will fail the request if response is not received within RequestTimeout.
     Acceptable values are from 1 second to 86400 seconds.
    :type request_timeout: int
    :param probe: Probe resource of an application gateway.
    :type probe: ~azure.mgmt.network.v2016_09_01.models.SubResource
    :param authentication_certificates: Array of references to application
     gateway authentication certificates.
    :type authentication_certificates:
     list[~azure.mgmt.network.v2016_09_01.models.SubResource]
    :param provisioning_state: Provisioning state of the backend http settings
     resource. Possible values are: 'Updating', 'Deleting', and 'Failed'.
    :type provisioning_state: str
    :param name: Name of the resource that is unique within a resource group.
     This name can be used to access the resource.
    :type name: str
    :param etag: A unique read-only string that changes whenever the resource
     is updated.
    :type etag: str
    """

    _attribute_map = {
        'id': {'key': 'id', 'type': 'str'},
        'port': {'key': 'properties.port', 'type': 'int'},
        'protocol': {'key': 'properties.protocol', 'type': 'str'},
        'cookie_based_affinity': {'key': 'properties.cookieBasedAffinity', 'type': 'str'},
        'request_timeout': {'key': 'properties.requestTimeout', 'type': 'int'},
        'probe': {'key': 'properties.probe', 'type': 'SubResource'},
        'authentication_certificates': {'key': 'properties.authenticationCertificates', 'type': '[SubResource]'},
        'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
        'name': {'key': 'name', 'type': 'str'},
        'etag': {'key': 'etag', 'type': 'str'},
    }

    def __init__(self, **kwargs):
        super(ApplicationGatewayBackendHttpSettings, self).__init__(**kwargs)
        self.port = kwargs.get('port', None)
        self.protocol = kwargs.get('protocol', None)
        self.cookie_based_affinity = kwargs.get('cookie_based_affinity', None)
        self.request_timeout = kwargs.get('request_timeout', None)
        self.probe = kwargs.get('probe', None)
        self.authentication_certificates = kwargs.get('authentication_certificates', None)
        self.provisioning_state = kwargs.get('provisioning_state', None)
        self.name = kwargs.get('name', None)
        self.etag = kwargs.get('etag', None)


text:
require_relative "test_helper"
require "csv"

class RowWriterTest < Minitest::Test
  describe IOStreams::Row::Writer do
    let :csv_file_name do
      File.join(File.dirname(__FILE__), "files", "test.csv")
    end

    let :raw_csv_data do
      File.read(csv_file_name)
    end

    let :csv_rows do
      CSV.read(csv_file_name)
    end

    let :temp_file do
      Tempfile.new("iostreams")
    end

    let :file_name do
      temp_file.path
    end

    after do
      temp_file.delete
    end

    describe ".stream" do
      it "file" do
        IOStreams::Row::Writer.file(file_name) do |io|
          csv_rows.each { |array| io << array }
        end
        result = ::File.read(file_name)
        assert_equal raw_csv_data, result
      end

      it "streams" do
        io_string = StringIO.new
        IOStreams::Line::Writer.stream(io_string) do |io|
          IOStreams::Row::Writer.stream(io) do |stream|
            csv_rows.each { |array| stream << array }
          end
        end
        assert_equal raw_csv_data, io_string.string
      end
    end
  end
end


text:
import os

from setuptools import setup, find_packages

here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()

requires = [
    'PasteScript',
    'WebOb',
    'repoze.debug',
    'repoze.zodbconn',
    'ZODB3',
    ]

setup(name='eye',
      version='1.0.1dev',
      description='A generic web-based browser of ZODB databases.',
      long_description=README + '\n\n' +  CHANGES,
      classifiers=[
        "Development Status :: 3 - Alpha",
        "Environment :: Web Environment",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python",
        "Programming Language :: Python :: 2.6",
        "Framework :: Paste",
        "Framework :: ZODB",
        "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
        ],
      author='David Glick',
      author_email='dglick@gmail.com',
      url='http://github.com/davisagli/eye',
      keywords='zodb pyramid zope inspector',
      packages=find_packages(),
      include_package_data=True,
      zip_safe=False,
      install_requires = requires,
      tests_require= requires,
      test_suite="eye",
      entry_points = """\
      [console_scripts]
      eye = eye:main
      """,
      )


text:
/*	$NetBSD: usb_port.h,v 1.15 1999/11/16 12:04:28 augustss Exp $	*/
/*	$FreeBSD: src/sys/dev/usb/usb_port.h,v 1.25 2000/02/10 18:50:18 n_hibma Exp $	*/

/*
 * Copyright (c) 1998 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Lennart Augustsson (augustss@carlstedt.se) at
 * Carlstedt Research & Technology.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *        This product includes software developed by the NetBSD
 *        Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * Macro's to cope with the differences between operating systems.
 */

#if defined(__NetBSD__)
/*
 * NetBSD
 */

#include "opt_usbverbose.h"

#ifdef USB_DEBUG
#define UHID_DEBUG 1
#define OHCI_DEBUG 1
#define UGEN_DEBUG 1
#define UHCI_DEBUG 1
#define UHUB_DEBUG 1
#define ULPT_DEBUG 1
#define UAUDIO_DEBUG 1
#endif

typedef struct device *device_ptr_t;
#define USBBASEDEVICE struct device
#define USBDEV(bdev) (&(bdev))
#define USBDEVNAME(bdev) ((bdev).dv_xname)
#define USBDEVPTRNAME(bdevptr) ((bdevptr)->dv_xname)
#define USBDEVUNIT(bdev) ((bdev).dv_unit)

#define DECLARE_USB_DMA_T \
	struct usb_dma_block; \
	typedef struct { \
		struct usb_dma_block *block; \
		u_int offs; \
	} usb_dma_t

#define usb_timeout(f, d, t, h) timeout((f), (d), (t))
#define usb_untimeout(f, d, h) untimeout((f), (d))

#define logprintf printf

#define USB_DECLARE_DRIVER(dname)  \
int __CONCAT(dname,_match) __P((struct device *, struct cfdata *, void *)); \
void __CONCAT(dname,_attach) __P((struct device *, struct device *, void *)); \
int __CONCAT(dname,_detach) __P((struct device *, int)); \
int __CONCAT(dname,_activate) __P((struct device *, enum devact)); \
\
extern struct cfdriver __CONCAT(dname,_cd); \
\
struct cfattach __CONCAT(dname,_ca) = { \
	sizeof(struct __CONCAT(dname,_softc)), \
	__CONCAT(dname,_match), \
	__CONCAT(dname,_attach), \
	__CONCAT(dname,_detach), \
	__CONCAT(dname,_activate), \
}

#define USB_MATCH(dname) \
int \
__CONCAT(dname,_match)(parent, match, aux) \
	struct device *parent; \
	struct cfdata *match; \
	void *aux;

#define USB_MATCH_START(dname, uaa) \
	struct usb_attach_arg *uaa = aux

#define USB_ATTACH(dname) \
void \
__CONCAT(dname,_attach)(parent, self, aux) \
	struct device *parent; \
	struct device *self; \
	void *aux;

#define USB_ATTACH_START(dname, sc, uaa) \
	struct __CONCAT(dname,_softc) *sc = \
		(struct __CONCAT(dname,_softc) *)self; \
	struct usb_attach_arg *uaa = aux

/* Returns from attach */
#define USB_ATTACH_ERROR_RETURN	return
#define USB_ATTACH_SUCCESS_RETURN	return

#define USB_ATTACH_SETUP printf("\n")

#define USB_DETACH(dname) \
int \
__CONCAT(dname,_detach)(self, flags) \
	struct device *self; \
	int flags;

#define USB_DETACH_START(dname, sc) \
	struct __CONCAT(dname,_softc) *sc = \
		(struct __CONCAT(dname,_softc) *)self

#define USB_GET_SC_OPEN(dname, unit, sc) \
	if (unit >= __CONCAT(dname,_cd).cd_ndevs) \
		return (ENXIO); \
	sc = __CONCAT(dname,_cd).cd_devs[unit]; \
	if (!sc) \
		return (ENXIO)

#define USB_GET_SC(dname, unit, sc) \
	sc = __CONCAT(dname,_cd).cd_devs[unit]

#define USB_DO_ATTACH(dev, bdev, parent, args, print, sub) \
	(config_found_sm(parent, args, print, sub))

#elif defined(__OpenBSD__)
/*
 * OpenBSD
 */
#ifdef USB_DEBUG
#define UHID_DEBUG 1
#define OHCI_DEBUG 1
#define UGEN_DEBUG 1
#define UHCI_DEBUG 1
#define UHUB_DEBUG 1
#define ULPT_DEBUG 1
#endif

#define	memcpy(d, s, l)		bcopy((s),(d),(l))
#define	memset(d, v, l)		bzero((d),(l))
#define bswap32(x)		swap32(x)
#define kthread_create1		kthread_create
#define kthread_create		kthread_create_deferred

#define	usbpoll			usbselect
#define	uhidpoll		uhidselect
#define	ugenpoll		ugenselect

#define powerhook_establish(fn, sc) 0
#define powerhook_disestablish(hdl)
#define PWR_RESUME 0

typedef struct device device_ptr_t;
#define USBBASEDEVICE struct device
#define USBDEV(bdev) (&(bdev))
#define USBDEVNAME(bdev) ((bdev).dv_xname)
#define USBDEVPTRNAME(bdevptr) ((bdevptr)->dv_xname)
#define USBDEVUNIT(bdev) ((bdev).dv_unit)

#define DECLARE_USB_DMA_T \
	struct usb_dma_block; \
	typedef struct { \
		struct usb_dma_block *block; \
		u_int offs; \
	} usb_dma_t

#define usb_timeout(f, d, t, h) timeout((f), (d), (t))
#define usb_untimeout(f, d, h) untimeout((f), (d))

#define USB_DECLARE_DRIVER(dname)  \
int __CONCAT(dname,_match) __P((struct device *, void *, void *)); \
void __CONCAT(dname,_attach) __P((struct device *, struct device *, void *)); \
int __CONCAT(dname,_detach) __P((struct device *, int)); \
int __CONCAT(dname,_activate) __P((struct device *, enum devact)); \
\
struct cfdriver __CONCAT(dname,_cd) = { \
	NULL, #dname, DV_DULL \
}; \
\
struct cfattach __CONCAT(dname,_ca) = { \
	sizeof(struct __CONCAT(dname,_softc)), \
	__CONCAT(dname,_match), \
	__CONCAT(dname,_attach), \
	__CONCAT(dname,_detach), \
	__CONCAT(dname,_activate), \
}

#define USB_MATCH(dname) \
int \
__CONCAT(dname,_match)(parent, match, aux) \
	struct device *parent; \
	void *match; \
	void *aux;

#define USB_MATCH_START(dname, uaa) \
	struct usb_attach_arg *uaa = aux

#define USB_ATTACH(dname) \
void \
__CONCAT(dname,_attach)(parent, self, aux) \
	struct device *parent; \
	struct device *self; \
	void *aux;

#define USB_ATTACH_START(dname, sc, uaa) \
	struct __CONCAT(dname,_softc) *sc = \
		(struct __CONCAT(dname,_softc) *)self; \
	struct usb_attach_arg *uaa = aux

/* Returns from attach */
#define USB_ATTACH_ERROR_RETURN	return
#define USB_ATTACH_SUCCESS_RETURN	return

#define USB_ATTACH_SETUP printf("\n")

#define USB_DETACH(dname) \
int \
__CONCAT(dname,_detach)(self, flags) \
	struct device *self; \
	int flags;

#define USB_DETACH_START(dname, sc) \
	struct __CONCAT(dname,_softc) *sc = \
		(struct __CONCAT(dname,_softc) *)self

#define USB_GET_SC_OPEN(dname, unit, sc) \
	if (unit >= __CONCAT(dname,_cd).cd_ndevs) \
		return (ENXIO); \
	sc = __CONCAT(dname,_cd).cd_devs[unit]; \
	if (!sc) \
		return (ENXIO)

#define USB_GET_SC(dname, unit, sc) \
	sc = __CONCAT(dname,_cd).cd_devs[unit]

#define USB_DO_ATTACH(dev, bdev, parent, args, print, sub) \
	(config_found_sm(parent, args, print, sub))

#elif defined(__FreeBSD__)
/*
 * FreeBSD
 */

#include "opt_usb.h"

#define USBVERBOSE

#define device_ptr_t device_t
#define USBBASEDEVICE device_t
#define USBDEV(bdev) (bdev)
#define USBDEVNAME(bdev) device_get_nameunit(bdev)
#define USBDEVPTRNAME(bdev) device_get_nameunit(bdev)
#define USBDEVUNIT(bdev) device_get_unit(bdev)

#define DECLARE_USB_DMA_T typedef char * usb_dma_t

/* XXX Change this when FreeBSD has memset */
#define	memcpy(d, s, l)		bcopy((s),(d),(l))
#define	memset(d, v, l)		bzero((d),(l))
#define bswap32(x)		swap32(x)
#define kthread_create1(function, sc, priv, string, name)
#define kthread_create(create_function, sc)
#define kthread_exit(err)

#define usb_timeout(f, d, t, h) ((h) = timeout((f), (d), (t)))
#define usb_untimeout(f, d, h) untimeout((f), (d), (h))

#define clalloc(p, s, x) (clist_alloc_cblocks((p), (s), (s)), 0)
#define clfree(p) clist_free_cblocks((p))

#define powerhook_establish(fn, sc) 0
#define powerhook_disestablish(hdl)
#define PWR_SUSPEND 1
#define PWR_RESUME 0

#define USB_DECLARE_DRIVER_INIT(dname, init...) \
static device_probe_t __CONCAT(dname,_match); \
static device_attach_t __CONCAT(dname,_attach); \
static device_detach_t __CONCAT(dname,_detach); \
\
static devclass_t __CONCAT(dname,_devclass); \
\
static device_method_t __CONCAT(dname,_methods)[] = { \
        DEVMETHOD(device_probe, __CONCAT(dname,_match)), \
        DEVMETHOD(device_attach, __CONCAT(dname,_attach)), \
        DEVMETHOD(device_detach, __CONCAT(dname,_detach)), \
	init, \
        {0,0} \
}; \
\
static driver_t __CONCAT(dname,_driver) = { \
        #dname, \
        __CONCAT(dname,_methods), \
        sizeof(struct __CONCAT(dname,_softc)) \
}
#define METHODS_NONE			{0,0}
#define USB_DECLARE_DRIVER(dname)	USB_DECLARE_DRIVER_INIT(dname, METHODS_NONE)

#define USB_MATCH(dname) \
static int \
__CONCAT(dname,_match)(device_t self)

#define USB_MATCH_START(dname, uaa) \
        struct usb_attach_arg *uaa = device_get_ivars(self)

#define USB_ATTACH(dname) \
static int \
__CONCAT(dname,_attach)(device_t self)

#define USB_ATTACH_START(dname, sc, uaa) \
        struct __CONCAT(dname,_softc) *sc = device_get_softc(self); \
        struct usb_attach_arg *uaa = device_get_ivars(self)

/* Returns from attach */
#define USB_ATTACH_ERROR_RETURN	return ENXIO
#define USB_ATTACH_SUCCESS_RETURN	return 0

#define USB_ATTACH_SETUP \
	sc->sc_dev = self; \
	device_set_desc_copy(self, devinfo)

#define USB_DETACH(dname) \
static int \
__CONCAT(dname,_detach)(device_t self)

#define USB_DETACH_START(dname, sc) \
	struct __CONCAT(dname,_softc) *sc = device_get_softc(self)

#define USB_GET_SC_OPEN(dname, unit, sc) \
	sc = devclass_get_softc(__CONCAT(dname,_devclass), unit); \
	if (!sc) \
		return (ENXIO)

#define USB_GET_SC(dname, unit, sc) \
	sc = devclass_get_softc(__CONCAT(dname,_devclass), unit)

#define USB_DO_ATTACH(dev, bdev, parent, args, print, sub) \
	(device_probe_and_attach((bdev)) == 0 ? (bdev) : 0)

/* conversion from one type of queue to the other */
/* XXX In FreeBSD SIMPLEQ_REMOVE_HEAD only removes the head element.
 */
#define SIMPLEQ_REMOVE_HEAD(h, e, f)	do {				\
		if ( (e) != SIMPLEQ_FIRST((h)) )			\
			panic("Removing other than first element");	\
		STAILQ_REMOVE_HEAD(h, f);				\
} while (0)
#define SIMPLEQ_INSERT_HEAD	STAILQ_INSERT_HEAD
#define SIMPLEQ_INSERT_TAIL	STAILQ_INSERT_TAIL
#define SIMPLEQ_NEXT		STAILQ_NEXT
#define SIMPLEQ_FIRST		STAILQ_FIRST
#define SIMPLEQ_HEAD		STAILQ_HEAD
#define SIMPLEQ_INIT		STAILQ_INIT
#define SIMPLEQ_HEAD_INITIALIZER	STAILQ_HEAD_INITIALIZER
#define SIMPLEQ_ENTRY		STAILQ_ENTRY

#include <sys/syslog.h>
/*
#define logprintf(args...)	log(LOG_DEBUG, args)
*/
#define logprintf		printf

#endif /* __FreeBSD__ */


text:
using System.Collections.Generic;
using System.Text;
using System.Threading;
using GrandTheftMultiplayer.Server.Elements;
using TerraTex_RL_RPG.Lib.User.Management;

namespace TerraTex_RL_RPG.Lib.Threads
{
    public class UpdatePlayerPlayTime
    {
        private bool _interuped = false;

        public void DoWork()
        {
            TTRPG.Api.consoleOutput("Started Update Player PlayTime Thread");

            while (!_interuped)
            {
                List<Client> players = TTRPG.Api.getAllPlayers();

                foreach (Client player in players)
                {
                    if (player.hasSyncedData("loggedin") && (bool) player.getSyncedData("loggedin"))
                    {
                        player.setSyncedData("PlayTime", player.getSyncedData("PlayTime") + 1);

                        UpdatePlayerPlayTimeDisplay(player);
                        // Add one RP for playtime
                        RpLevelManager.AddRpToPlayer(player, 1, false);

                        if (player.getSyncedData("PlayTime") % 60 == 0)
                        {
                            PayDayManager.SendPayDay(player);
                        }
                    }
                }

                Thread.Sleep(60000);
            }
        }

        public static void UpdatePlayerPlayTimeDisplay(Client player)
        {
            int playTime = player.getSyncedData("PlayTime");

            // format PlayTime for ScoreBoard
            StringBuilder sbd = new StringBuilder();

            int hours = playTime / 60;
            sbd.Append(hours);
            sbd.Append(" | ");
            int minutes = playTime - hours * 60;
            sbd.Append(minutes.ToString("D2"));

            TTRPG.Api.exported.scoreboard.setPlayerScoreboardData(player, "PlayTime", sbd.ToString());
        }

        public void StopThread()
        {
            _interuped = true;
        }
    }
}


text:
({
    testTrue: {
        attributes : {thang : "true"},

        test: function(component){
            this.whatItIs(component, "true", true);
        }
    },

    testFalse: {
        attributes : {thang : "false"},

        test: function(component){
            this.whatItIs(component, "false", false);
        }
    },

    testUndefined: {
        test: function(component){
            this.whatItIs(component, "undefined", false);
        }

    },

    testEmptyString: {
        attributes: {thang : ''},

        test:function(component){
            this.whatItIs(component, "Empty string", false);
        }
    },

    testRerender: {
        attributes : {thang : "true"},

        test: function(component){
            this.whatItIs(component, "Testing rerender: true", true);
            component.set("v.thang", false);
            $A.rerender(component);
            this.whatItIs(component, "Testing rerender: false", false);
        }
    },

    whatItIs : function(component, name, value){
        if (value) {
            aura.test.assertNotNull($A.test.getElementByClass("itIsTrue"), name+" didn't evaluate as true");
            aura.test.assertNull($A.test.getElementByClass("itWishesItWasTrue"), name+" evaluated as true");
            aura.test.assertNull($A.test.getElementByClass("itIsNotTrue"), name+" evaluated as not true");
            aura.test.assertNotNull($A.test.getElementByClass("itWishesItWasNotTrue"), name+" didn't evaluate as not true");
        }else{
            aura.test.assertNull($A.test.getElementByClass("itIsTrue"), name+" evaluated as true");
            aura.test.assertNotNull($A.test.getElementByClass("itWishesItWasTrue"), name+" didn't evaluate as true");
            aura.test.assertNotNull($A.test.getElementByClass("itIsNotTrue"), name+" didn't evaluate as not true");
            aura.test.assertNull($A.test.getElementByClass("itWishesItWasNotTrue"), name+" evaluated as not true");
        }
    }
})


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>ViennaCL - The Vienna Computing Library: viennacl/linalg/kernels/scalar_source.h File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

ViennaCL - The Vienna Computing Library
    1.3.1

Main Page

Namespaces

Data Structures

Files

File List

Globals

Namespaces |
Variables

viennacl/linalg/kernels/scalar_source.h File Reference

Go to the source code of this file.

Namespaces

namespace  	viennacl

namespace  	viennacl::linalg

namespace  	viennacl::linalg::kernels

Variables

const char *const 	scalar_align1_cpu_sub = " \n"

const char *const 	scalar_align1_cpu_inplace_mul = " \n"

const char *const 	scalar_align1_inplace_mul = " \n"

const char *const 	scalar_align1_cpu_inplace_sub = "\n"

const char *const 	scalar_align1_cpu_inplace_add = " \n"

const char *const 	scalar_align1_mul = " \n"

const char *const 	scalar_align1_inplace_sub = " \n"

const char *const 	scalar_align1_inplace_add = " \n"

const char *const 	scalar_align1_inplace_div = " \n"

const char *const 	scalar_align1_cpu_inplace_div = " \n"

const char *const 	scalar_align1_divide = " \n"

const char *const 	scalar_align1_cpu_add = " \n"

const char *const 	scalar_align1_add = " \n"

const char *const 	scalar_align1_cpu_mul = " \n"

const char *const 	scalar_align1_sub = " \n"

const char *const 	scalar_align1_cpu_div = " \n"

<address class="footer">
Generated on Thu Aug 9 2012 19:49:11 for ViennaCL - The Vienna Computing Library by

 1.7.6.1
</address>


text:
package com.swroom.constructor.facade;

/**
 * 贷款类(外观类)
 * Created by jingz on 2017/2/1.
 */
public class Mortgage {

    private Bank bank;
    private Credit credit;
    private Loan loan;

    public Mortgage() {
        this.bank = new Bank();
        this.credit = new Credit();
        this.loan = new Loan();
    }

    /**
     * 面向外部调用的判断方法,封装各子系统的判断
     * @return
     */
    public boolean isEligible(Customer c, int amount) {

        boolean eligible = true;

        if (!bank.hasSufficentSavings(c, amount))
            eligible = false;
        else if (!credit.hasGoodCredit(c))
            eligible = false;
        else if (!loan.hasNoBadLoans(c))
            eligible = false;

        return eligible;
    }
}


text:
from collections import deque

class BSTIterator(object):
    def __init__(self, root):
        """
        :type root: TreeNode
        """
        self.stack = deque()
        node = root
        while node:
            self.stack.append(node)
            node = node.left

    def hasNext(self):
        """
        :rtype: bool
        """
        return len(self.stack) is not 0

    def next(self):
        """
        :rtype: int
        """
        top = self.stack.pop()
        node = top.right
        while node:
            self.stack.append(node)
            node = node.left
        return top.val

"""
public List<Integer> inorderTraversal(TreeNode root) {
    List<Integer> list = new ArrayList<Integer>();

    Stack<TreeNode> stack = new Stack<TreeNode>();
    TreeNode cur = root;

    while(cur!=null || !stack.empty()){
        while(cur!=null){
            stack.add(cur);
            cur = cur.left;
        }
        cur = stack.pop();
        list.add(cur.val);
        cur = cur.right;
    }

    return list;
}
"""


text:
package org.kuali.coeus.common.budget.framework.distribution;

import org.kuali.coeus.common.budget.framework.core.Budget;

public interface BudgetDistributionService {

    /**
     * This method initializes both the Cost Sharing and Unrecovered F&A defaults
     * @param budget
     */
    public void initializeCollectionDefaults(Budget budget);

    /**
     * This method initializes the Cost Sharing defaults
     * @param budget
     */
    public void initializeCostSharingCollectionDefaults(Budget budget);

    /**
     * This method initializes the Unrecovered F&A defaults
     * @param budget
     */
    public void initializeUnrecoveredFandACollectionDefaults(Budget budget);

}


text:
var Concession 		= require('mongoose').model('Concession'),
    Transfer 	    = require('mongoose').model('Transfer'),
    Production 	    = require('mongoose').model('Production'),
    Link            = require('mongoose').model('Link'),
    errors 	        = require('./errorList'),
    mongoose 		= require('mongoose'),
    async           = require('async'),
    _               = require("underscore");

// Get All Concessions
exports.getConcessions = function(req, res) {
    var concessionLen, data={}, concessionCounter, transfersQuery=[],
        limit = Number(req.params.limit),
        skip = Number(req.params.skip);
    data.concessions = [];
    data.errorList = [];
    data.count = 0;

    async.waterfall([
        getConcessionCount,
        getConcessionSet,
        getConcessionLinks,
        getTransfersCount,
        getProductionCount
    ], function (err, result) {
            if (err) {
                data.errorList = errors.errorFunction(err,'Concessions');
                return res.send(data);
            } else {
                if (req.query && req.query.callback) {
                    return res.jsonp("" + req.query.callback + "(" + JSON.stringify(result) + ");");
                } else {
                    return res.send(result);
                }
            }
        }
    );
    function getConcessionCount(callback) {
        Concession.find({}).count().exec(function(err, concession_count) {
            if (err) {
                data.errorList = errors.errorFunction(err,'Concessions');
                res.send(data);
            } else if (concession_count == 0) {
                data.errorList.push({type: 'Concessions', message: 'concessions not found'})
                res.send(data);
            } else {
                data.count = concession_count;
                callback(null, data);
            }
        });
    }
    function getConcessionSet(data, callback) {
        Concession.aggregate([
            {$sort: {concession_name: -1}},
            {$unwind: {"path": "$concession_country", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$concession_commodity", "preserveNullAndEmptyArrays": true}},
            {$lookup: {from: "countries", localField: "concession_country.country", foreignField: "_id", as: "concession_country"}},
            {$lookup: {from: "commodities", localField: "concession_commodity.commodity", foreignField: "_id", as: "concession_commodity"}},
            {$unwind: {"path": "$concession_country", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$concession_commodity", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$concession_status", "preserveNullAndEmptyArrays": true}},
            {$project: {_id:1,concession_name:1,concession_country:{_id:'$concession_country._id', iso2:'$concession_country.iso2',
                name:'$concession_country.name'},
                concession_commodity:{_id:'$concession_commodity._id', commodity_type:'$concession_commodity.commodity_type',
                    commodity_id:'$concession_commodity.commodity_id', commodity_name:'$concession_commodity.commodity_name'},
                concession_status:'$concession_status'
            }
            },
            {$group:{
                _id:'$_id',
                concession_name:{$first:'$concession_name'},
                concession_status:{$first:'$concession_status'},
                concession_country:{$addToSet:'$concession_country'},
                concession_commodity:{$addToSet:'$concession_commodity'}
            }},
            {$project:{_id:1,concession_name:1,concession_status:1,concession_country:1,concession_commodity:1,
             project_count:{$literal:0}, site_count:{$literal:0}, field_count:{$literal:0}, transfer_count:{$literal:0}, production_count:{$literal:0}, project_id:[]
            }},
            {$skip: skip},
            {$limit: limit}
        ]).exec(function(err, concessions) {
            if (err) {
                data.errorList = errors.errorFunction(err, 'Concessions');
                res.send(data);
            } else if (concessions && concessions.length>0) {
                data.concessions = concessions;
                callback(null, data);
            } else {
                data.errorList.push({type: 'Concessions links', message: 'concessions not found'})
                res.send(data);
            }
        });
    }
    function getConcessionLinks(data, callback) {
        var concessionsId = _.pluck(data.concessions, '_id');
        Link.aggregate([
            {$match: {$or: [{concession: {$in: concessionsId }}]}},
            {$lookup: {from: "projects",localField: "project",foreignField: "_id",as: "project"}},
            {$lookup: {from: "sites",localField: "site",foreignField: "_id",as: "site"}},
            {$unwind: {"path": "$site", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$project", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$project.proj_commodity", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$site.site_commodity", "preserveNullAndEmptyArrays": true}},
            {$lookup: {from: "commodities",localField: "project.proj_commodity.commodity",foreignField: "_id",as: "proj_commodity"}},
            {$lookup: {from: "commodities",localField: "site.site_commodity.commodity",foreignField: "_id",as: "site_commodity"}},
            {$unwind: {"path": "$proj_commodity", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$site_commodity", "preserveNullAndEmptyArrays": true}},
            {$project:{_id:'$concession',
                commodity:{$cond: { if:  {$not: "$proj_commodity" },
                    then: {$cond: { if:  {$not: "$site_commodity" },then:[] , else:{__id:"$site_commodity._id",commodity_type:"$site_commodity.commodity_type",
                        commodity_id:'$site_commodity.commodity_id', commodity_name:'$site_commodity.commodity_name'}
                    }} ,
                    else:  {_id:"$proj_commodity._id",commodity_type:"$proj_commodity.commodity_type",
                        commodity_id:'$proj_commodity.commodity_id', commodity_name:'$proj_commodity.commodity_name'}}},
                project:1,
                site:['$site'],
                project_id: { $concatArrays: [ ["$site"], ["$project"] ] }
            }
            },
            {$project:{_id:1,
                commodity:1,
                project:1,
                field: {
                    $filter: {
                        input: "$site",
                        as: "site",
                        cond: { $and: [ "$$site.field", true ] }
                    }
                },
                site:{
                    $filter: {
                        input: "$site",
                        as: "item",
                        cond: { $and: [ "$$item.field", false ] }
                    }
                },
                project_id:1
            }
            },
            {$unwind: {"path": "$project_id", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$field", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$site", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$field", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$site", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$commodity", "preserveNullAndEmptyArrays": true}},
            {$group:{
                _id:'$_id',
                commodity:{$addToSet:'$commodity'},
                project:{$addToSet:'$project.proj_id'},
                project_id:{$addToSet:'$project_id._id'},
                site:{$addToSet:'$site._id'},
                field:{$addToSet:'$field._id'}
            }},
            {$project:{
                _id:1,project_count:{$size:'$project'},project_id:1,
                site_count:{$size:'$site'},
                field_count:{$size:'$field'},commodity:1
            }}
        ]).exec(function (err, links) {
                if (err) {
                    data.errorList = errors.errorFunction(err, 'Concession links');
                    callback(null, data);
                }
                else {
                    if (links && links.length > 0) {
                        _.map(data.concessions, function (concession) {
                            var list = _.find(links, function (link) {
                                if(link.project_id) {link.project_id.reduce(function(result, item) {transfersQuery.push(item)}, {})}
                                return link._id.toString() == concession._id.toString();
                            });
                            if (list) {
                                concession.concession_commodity.push(list.commodity[0]);
                                concession.project_id = list.project_id;
                                concession.project_count = list.project_count;
                                concession.site_count = list.site_count;
                                concession.field_count = list.field_count;
                            }
                            return concession;
                        });
                        transfersQuery=_.uniq(transfersQuery)
                        callback(null, data);
                    } else {
                        data.errorList.push({type: 'Concession links', message: 'concession links not found'})
                        callback(null, data);
                    }
                }
            })
    }
    function getTransfersCount(data, callback) {
        concessionLen = data.concessions.length;
        concessionCounter = 0;
        if(concessionLen>0) {
            _.each(data.concessions, function (concession) {
                if(concession.project_id.length>0) {
                    Transfer.find({
                        $or: [
                            {project: {$in: concession.project_id}},
                            {site: {$in: concession.project_id}},
                            {concession: {$in: concession.project_id}}
                        ]
                    })
                        .count()
                        .exec(function (err, transfer_count) {
                            if (err) {
                                data.errorList = errors.errorFunction(err, 'concession transfers');
                                callback(null, data);
                            }
                            else {
                                ++concessionCounter;
                                concession.transfer_count = transfer_count;
                                if (concessionCounter === concessionLen) {
                                    callback(null, data);
                                }
                            }
                        });
                } else{
                    ++concessionCounter;
                    if (concessionCounter === concessionLen) {
                        callback(null, data);
                    }
                }
            });
        }else{
            callback(null, data);
        }
    }
    function getProductionCount(data, callback) {
        concessionLen = data.concessions.length;
        concessionCounter = 0;
        if(concessionLen>0) {
            _.each(data.concessions, function (concession) {
                if(concession.project_id.length>0) {
                    Production.find({
                        $or: [
                            {project: {$in: concession.project_id}},
                            {site: {$in: concession.project_id}},
                            {concession: {$in: concession.project_id}}]
                    })
                        .count()
                        .exec(function (err, production_count) {
                            if (err) {
                                data.errorList = errors.errorFunction(err, 'concession productions');
                                callback(null, data);
                            }
                            else {
                                ++concessionCounter;
                                concession.production_count = production_count;
                                if (concessionCounter === concessionLen) {
                                    callback(null, data);
                                }
                            }
                        });
                } else{
                    ++concessionCounter;
                    if (concessionCounter === concessionLen) {
                        callback(null, data);
                    }
                }
            });
        }else{
            callback(null, data);
        }
    }
};

// Get Concession By ID
exports.getConcessionByID = function(req, res) {
    var id = mongoose.Types.ObjectId(req.params.id);
    var data={};
    data.concession = [];
    data.errorList = [];
    async.waterfall([
        getConcession,
        getConcessionLinks
    ], function (err, result) {
        if (err) {
            data.errorList = errors.errorFunction(err, 'Concession ' + id);
            return res.send(data);
        } else{
            if (req.query && req.query.callback) {
                return res.jsonp("" + req.query.callback + "(" + JSON.stringify(result) + ");");
            } else {
                return res.send(result);
            }
        }
    });

    function getConcession(callback) {
        Concession.aggregate([
            {$match: {_id:id}},
            {$unwind: {"path": "$concession_country", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$concession_aliases", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$concession_commodity", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$concession_company_share", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$concession_status", "preserveNullAndEmptyArrays": true}},
            {$lookup: {from: "countries", localField: "concession_country.country",foreignField: "_id",as: "concession_country.country"}},
            {$lookup: {from: "companies", localField: "concession_company_share.company",foreignField: "_id",as: "concession_company_share.company"}},
            {$lookup: {from: "commodities", localField: "concession_commodity.commodity",foreignField: "_id",as: "concession_commodity.commodity"}},
            {$unwind: {"path": "$concession_country.country", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$concession_commodity.commodity", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$concession_company_share.company", "preserveNullAndEmptyArrays": true}},
            {$project:{
                _id:1, concession_established_source:1, concession_name:1,
                concession_company_share:{
                    _id:'$concession_company_share.company._id',
                    iso2:'$concession_company_share.company.company_name',
                    number:'$concession_company_share.number'
                },
                concession_country:{
                    _id:'$concession_country.country._id',
                    iso2:'$concession_country.country.iso2',
                    name:'$concession_country.country.name'
                },
                concession_commodity:{
                    _id:'$concession_commodity.commodity._id',
                    commodity_name:'$concession_commodity.commodity.commodity_name',
                    commodity_type:'$concession_commodity.commodity.commodity_type',
                    commodity_id:'$concession_commodity.commodity.commodity_id'
                },
                concession_aliases: {_id:'$concession_aliases._id', alias:'$concession_aliases.alias'},
                description:1,concession_status:1,oo_url_api:1,oo_url_wiki:1,oo_details:1
            }},
            {$unwind: {"path": "$concession_commodity", "preserveNullAndEmptyArrays": true}},
            {$group:{
                _id:'$_id',
                concession_name:{$first:'$concession_name'},
                concession_established_source:{$first:'$concession_established_source'},
                concession_company_share:{$addToSet:'$concession_company_share'},
                concession_country:{$addToSet:'$concession_country'},
                concession_aliases:{$addToSet:'$concession_aliases'},
                description:{$first:'$description'},
                concession_status:{$addToSet:'$concession_status'},
                concession_commodity:{$addToSet:'$concession_commodity'},
                oo_url_api:{$first:'$oo_url_api'},
                oo_url_wiki:{$first:'$oo_url_wiki'},
                oo_details:{$first:'$oo_details'}
            }}
        ]).exec(function(err, concession) {
                if (err) {
                    data.errorList = errors.errorFunction(err, 'Concession ' + id);
                    res.send(data);
                } else {
                    if (concession && concession.length > 0) {
                        data.concession = concession[0]
                        callback(null, data);
                    } else {
                        data.errorList.push({type: 'Concession ' + id, message: 'concession '+ id+' not found'})
                        res.send(data);
                    }
                }
            });
    }

    function getConcessionLinks(data, callback) {
        Link.aggregate([
                {$match: {concession:id}},
                {$lookup: {from: "contracts", localField: "contract",foreignField: "_id",as: "contract"}},
                {$lookup: {from: "projects", localField: "project",foreignField: "_id",as: "project"}},
                {$lookup: {from: "sites", localField: "site",foreignField: "_id",as: "site"}},
                {$unwind: {"path": "$contract", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$project", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$site", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$site.site_coordinates", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$project.proj_commodity", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$site.site_commodity", "preserveNullAndEmptyArrays": true}},
                {$lookup: {from: "commodities", localField: "project.proj_commodity.commodity",foreignField: "_id",as: "project.proj_commodity"}},
                {$lookup: {from: "commodities", localField: "site.site_commodity.commodity",foreignField: "_id",as: "site.site_commodity"}},
                {$project: {
                    commodity: {$setUnion: ["$project.proj_commodity", "$site.site_commodity"]},
                    concession: 1,
                    contract: 1,
                    coordinates: {
                        $cond: {
                            if: {$not: "$site"},
                            then: [],
                            else: {
                                $cond: {
                                    if: {$not: "$site.site_coordinates"},
                                    then: [],
                                    else: {
                                        _id: '$site._id',
                                        'lat': {"$arrayElemAt": ["$site.site_coordinates.loc", -2]},
                                        'lng': {"$arrayElemAt": ["$site.site_coordinates.loc", -1]},
                                        'message': "$site.site_name",
                                        'timestamp': "$site.site_coordinates.timestamp",
                                        'type': {$cond: {if: {$gte: ["$site.field", true]}, then: 'field', else: 'site'}}

                                    }
                                }}
                        }
                    }
                }},
                {$unwind: {"path": "$commodity", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$coordinates", "preserveNullAndEmptyArrays": true}},
                {$group:{
                    _id:null,
                    commodity:{$addToSet:'$commodity'},
                    contract:{$addToSet:'$contract'},
                    coordinates:{$addToSet:'$coordinates'}
                }}
            ]).exec(function (err, links) {
            if (err) {
                data.errorList = errors.errorFunction(err, 'Concession ' + id + ' links');
                res.send(data);
            } else {
                if (links && links.length > 0) {
                    data.concession.proj_coordinates = links[0].coordinates;
                    data.concession.contracts = links[0].contract;
                    if(data.concession.concession_commodity.length>0 && !_.isEmpty(data.concession.concession_commodity[0])){
                        data.concession.concession_commodity = _.union(data.concession.concession_commodity, links[0].commodity);
                    } else{
                        data.concession.concession_commodity = links[0].commodity;
                    }
                    callback(null, data);
                } else {
                    data.errorList.push({type: 'Concession ' + id, message: 'concession ' + id + ' links not found'})
                    callback(null, data);
                }
            }
        })
    }
};

//Get Concession tables(company,project,sites and fields, payments, productions). Limit =50
exports.getConcessionData = function(req, res) {
    var id = mongoose.Types.ObjectId(req.params.id);
    var queries = {};
    var data={};
    data.errorList = [];
    data.companies = [];
    data.projects = [];
    data.sites = [];
    data.productions = [];
    data.transfers = [];

    async.waterfall([
        getConcessionCompany,
        getCompanyGroup,
        getLinkedProjects,
        getSiteLinks,
        getTransferAndProductionQuery,
        getTransfers,
        getPayments
    ], function (err, result) {
        if (err) {
            data.errorList = errors.errorFunction(err, 'Concession ' + id);
            return res.send(data);
        } else{
            if (req.query && req.query.callback) {
                return res.jsonp("" + req.query.callback + "(" + JSON.stringify(result) + ");");
            } else {
                return res.send(result);
            }
        }
    });

    function getConcessionCompany(callback) {
        Link.aggregate([
            {$match: {concession: id, entities: "company"}},
            {$lookup: {from: "companies", localField: "company", foreignField: "_id", as: "company"}},
            {$unwind: "$company"},
            {$project:{_id:1, company:{company_name:'$company.company_name', _id:'$company._id',
                company_groups:{$literal:[]}}}},
            {$group:{
                _id: null,
                company:{$addToSet:'$company'}
            }
            },
            {$skip:0},
            {$limit:50}
        ]).exec(function (err, links) {
            if (err) {
                data.errorList = errors.errorFunction(err, 'Concession links');
                callback(null, data);
            } else {
                if (links && links.length > 0) {
                    data.companies = links[0].company;
                    callback(null, data);
                } else {
                    data.errorList.push({type: 'Concession links', message: 'concession links not found'})
                    callback(null, data);
                }
            }
        });
    }

    function getCompanyGroup(data, callback) {
        var companiesId = _.pluck(data.companies, '_id');
        if(companiesId.length>0) {
            Link.aggregate([
                {$match: {$or: [{company: {$in: companiesId}}], entities: 'company_group'}},
                {$lookup: {from: "companies", localField: "company", foreignField: "_id", as: "company"}},
                {
                    $lookup: {
                        from: "companygroups",
                        localField: "company_group",
                        foreignField: "_id",
                        as: "company_group"
                    }
                },
                {$unwind: '$company'},
                {$unwind: '$company_group'},
                {
                    $group: {
                        _id: '$company._id', company_name: {$first: '$company.company_name'},
                        company_groups: {$addToSet: '$company_group'}
                    }
                },
                {
                    $project: {
                        _id: 1, company_name: 1,
                        company_groups: 1
                    }
                }
            ]).exec(function (err, links) {
                if (err) {
                    data.errorList = errors.errorFunction(err, 'Company links');
                    callback(null, data);
                } else {
                    if (links && links.length > 0) {
                        _.map(data.companies, function (company) {
                            var list = _.find(links, function (link) {
                                return company._id.toString() == link._id.toString();
                            });
                            if (list && list.company_groups) {
                                company.company_groups = list.company_groups;
                            }
                            return company;
                        });
                        callback(null, data);
                    } else {
                        data.errorList.push({type: 'Company links', message: 'company links not found'})
                        callback(null, data);
                    }
                }
            });
        } else {
            callback(null, data);
        }
    }

    function getLinkedProjects(data, callback) {
        Link.aggregate([
            {$match: {concession: id, entities:"project"}},
            {$lookup: {from: "projects", localField: "project", foreignField: "_id", as: "project"}},
            {$unwind: {"path": "$project", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$project.proj_commodity", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$project.proj_country", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$project.proj_status", "preserveNullAndEmptyArrays": true}},
            {
                $lookup: {
                    from: "commodities",
                    localField: "project.proj_commodity.commodity",
                    foreignField: "_id",
                    as: "project.proj_commodity"
                }
            },
            {
                $lookup: {
                    from: "countries",
                    localField: "project.proj_country.country",
                    foreignField: "_id",
                    as: "project.proj_country"
                }
            },
            {$unwind: {"path": "$project.proj_country", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$project.proj_commodity", "preserveNullAndEmptyArrays": true}},
            {
                $project: {
                    _id: '$project.proj_id',
                    proj_id: '$project.proj_id',
                    proj_name: '$project.proj_name',
                    proj_commodity: '$project.proj_commodity',
                    proj_country: '$project.proj_country',
                    proj_status: '$project.proj_status'
                }
            },
            {
                $group: {
                    _id: '$_id',
                    proj_id: {$first: '$proj_id'},
                    proj_name: {$first: '$proj_name'},
                    proj_commodity: {$addToSet: '$proj_commodity'},
                    proj_country: {$addToSet: '$proj_country'},
                    proj_status: {$addToSet: '$proj_status'}
                }
            },
            {
                $project: {
                    _id: 1,
                    proj_site: {_id: '$proj_id'},
                    proj_name: 1,
                    proj_id: 1,
                    proj_commodity: 1,
                    proj_country: 1,
                    proj_status: 1,
                    companies_count: {$literal: 0},
                    companies: {$literal: []}
                }
            },
            {$skip: 0},
            {$limit: 50}
        ]).exec(function (err, links) {
                if (err) {
                    data.errorList = errors.errorFunction(err, 'project links');
                    callback(null, data);
                } else {
                    if (links && links.length > 0) {
                        data.projects = links;
                        callback(null, data);
                    } else {
                        data.errorList.push({type: 'project links', message: 'project links not found'})
                        callback(null, data);
                    }
                }
            });
    }
    function getSiteLinks(data, callback) {
        Link.aggregate([
            {$match: {concession:id, entities:"site"}},
            {$lookup: {from: "sites", localField: "site", foreignField: "_id", as: "site"}},
            {$unwind: '$site'},
            {$unwind: {"path": "$site.site_country", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$site.site_commodity", "preserveNullAndEmptyArrays": true}},
            {
                $lookup: {
                    from: "countries",
                    localField: "site.site_country.country",
                    foreignField: "_id",
                    as: "site.site_country"
                }
            },
            {
                $lookup: {
                    from: "commodities",
                    localField: "site.site_commodity.commodity",
                    foreignField: "_id",
                    as: "site.site_commodity"
                }
            },
            {$unwind: {"path": "$site.site_country", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$site.site_status", "preserveNullAndEmptyArrays": true}},
            {$unwind: {"path": "$site.site_commodity", "preserveNullAndEmptyArrays": true}},
            {
                $group: {
                    _id: '$site._id',
                    field: {$first: '$site.field'},
                    site_name: {$first: '$site.site_name'},
                    site_status: {$first: '$site.site_status'},
                    site_commodity: {$addToSet: '$site.site_commodity'},
                    site_country: {$first: '$site.site_country'}
                }
            },
            { $skip : 0},
            { $limit : 50 }
        ]).exec(function (err, links) {
            if (err) {
                data.errorList = errors.errorFunction(err,'Concessions '+  id+ ' site links not found');
                callback(null, data);
            } else {
                if (links && links.length > 0) {
                    data.sites = links
                    callback(null, data);
                } else {
                    data.errorList.push({type: 'Concessions', message: 'Concessions '+  id+ ' site links not found'})
                    callback(null, data);
                }
            }
        })
    }
    function getTransferAndProductionQuery(data, callback){
        Link.aggregate([
            {$match: {concession:id}},
            {
                $group: {
                    _id: null,
                    project: {$addToSet: '$project'},
                    site: {$addToSet: '$site'},
                    concession: {$addToSet: '$concession'},
                    company: {$addToSet: '$company'}
                }
            },
            {$project:{
                _id:0,
                transfers_query: { $setUnion: [ "$project", "$site", "$concession" , "$company" ] }
            }}
        ]).exec(function (err, links) {
            if (err) {
                data.errorList = errors.errorFunction(err, 'concessions links');
                callback(null, data);
            } else {
                if (links && links.length > 0) {
                    queries = links[0].transfers_query
                    callback(null,data);
                } else {
                    data.errorList.push({type: 'Company links', message: 'company links not found'})
                    callback(null, data);
                }
            }
        });
    }
    function getTransfers(data, callback) {
        if (queries.length > 0) {
            Transfer.aggregate([
                {$match: {$or: [{project: {$in: queries}}, {site: {$in: queries}}]}},
                {$lookup: {from: "projects", localField: "project", foreignField: "_id", as: "project"}},
                {$lookup: {from: "companies", localField: "company", foreignField: "_id", as: "company"}},
                {$lookup: {from: "sites", localField: "site", foreignField: "_id", as: "site"}},
                {$lookup: {from: "countries", localField: "country", foreignField: "_id", as: "country"}},
                {$unwind: {"path": "$country", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$project", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$company", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$site", "preserveNullAndEmptyArrays": true}},
                {
                    $project: {
                        _id: 1, transfer_year: 1,
                        country: {name: "$country.name", iso2: "$country.iso2"},
                        company: {
                            $cond: {
                                if: {$not: "$company"},
                                then: '',
                                else: {_id: "$company._id", company_name: "$company.company_name"}
                            }
                        },
                        proj_site: {
                            $cond: {
                                if: {$not: "$site"},
                                then: {
                                    $cond: {
                                        if: {$not: "$project"},
                                        then: [], else: {
                                            _id: "$project.proj_id", name: "$project.proj_name",
                                            type: {$cond: {if: {$not: "$project"}, then: '', else: 'project'}}
                                        }
                                    }
                                },
                                else: {
                                    _id: "$site._id", name: "$site.site_name",
                                    type: {$cond: {if: {$gte: ["$site.field", true]}, then: 'field', else: 'site'}}
                                }
                            }
                        },
                        transfer_level: 1, transfer_label: 1, transfer_type: 1, transfer_unit: 1, transfer_value: 1
                    }
                },
                {
                    $group: {
                        _id: '$_id',
                        transfer_year: {$first: '$transfer_year'},
                        transfer_type: {$first: '$transfer_type'},
                        transfer_label: {$first: '$transfer_label'},
                        transfer_level: {$first: '$transfer_level'},
                        transfer_unit: {$first: '$transfer_unit'},
                        transfer_value: {$first: '$transfer_value'},
                        country: {$first: '$country'},
                        company: {$first: '$company'},
                        proj_site: {$first: '$proj_site'}
                    }
                },
                {$unwind: {"path": "$proj_site", "preserveNullAndEmptyArrays": true}},
                {$project:{_id:1,transfer_year:1,transfer_type:1,transfer_unit:1,transfer_level:1,transfer_value:1,country:1,
                    company:1,
                    proj_site:{$cond: { if: {$not: "$transfer_label"},
                        then: { $cond: {if: {$not: "$proj_site"},
                            then: [],
                            else:
                            {_id:"$proj_site._id",name:"$proj_site.name",
                                type:'$proj_site.type'}}},
                        else: {name:"$transfer_label",
                            type:'$transfer_label'}
                    }}, transfer_label:1
                }},
                {$skip: 0},
                {$limit: 50}
            ]).exec(function (err, transfers) {
                if (err) {
                    data.errorList = errors.errorFunction(err, 'Transfers');
                    callback(null, data);
                } else {
                    if (transfers && transfers.length > 0) {
                        data.transfers = transfers
                        callback(null, data);
                    } else {
                        data.errorList.push({type: 'Transfers', message: 'transfers not found'})
                        callback(null, data);
                    }
                }
            });
        } else {
            res.send(data);
        }
    }
    function getPayments(data, callback) {
        if (queries.length > 0) {
            Production.aggregate([
                {$match: {$or: [{project: {$in: queries}}, {site: {$in: queries}}]}},
                {$lookup: {from: "projects", localField: "project", foreignField: "_id", as: "project"}},
                {
                    $lookup: {
                        from: "commodities",
                        localField: "production_commodity",
                        foreignField: "_id",
                        as: "production_commodity"
                    }
                },
                {$lookup: {from: "sites", localField: "site", foreignField: "_id", as: "site"}},
                {$unwind: {"path": "$production_commodity", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$project", "preserveNullAndEmptyArrays": true}},
                {$unwind: {"path": "$site", "preserveNullAndEmptyArrays": true}},
                {
                    $project: {
                        _id: 1,
                        production_commodity: {
                            _id: "$production_commodity._id", commodity_name: "$production_commodity.commodity_name",
                            commodity_id: "$production_commodity.commodity_id"
                        },
                        company: {
                            $cond: {
                                if: {$not: "$company"},
                                then: '',
                                else: {_id: "$company._id", company_name: "$company.company_name"}
                            }
                        },
                        proj_site: {
                            $cond: {
                                if: {$not: "$site"},
                                then: {
                                    $cond: {
                                        if: {$not: "$project"},
                                        then: [], else: {
                                            _id: "$project.proj_id", name: "$project.proj_name",
                                            type: {$cond: {if: {$not: "$project"}, then: '', else: 'project'}}
                                        }
                                    }
                                },
                                else: {
                                    _id: "$site._id", name: "$site.site_name",
                                    type: {$cond: {if: {$gte: ["$site.field", true]}, then: 'field', else: 'site'}}
                                }
                            }
                        },
                        production_year: 1, production_volume: 1, production_unit: 1, production_price: 1,
                        production_price_unit: 1, production_level: 1
                    }
                },
                {
                    $group: {
                        _id: '$_id',
                        production_year: {$first: '$production_year'},
                        production_volume: {$first: '$production_volume'},
                        production_unit: {$first: '$production_unit'},
                        production_price: {$first: '$production_price'},
                        production_price_unit: {$first: '$production_price_unit'},
                        production_level: {$first: '$production_level'},
                        country: {$first: '$country'},
                        production_commodity: {$first: '$production_commodity'},
                        proj_site: {$first: '$proj_site'}
                    }
                },
                {$skip: 0},
                {$limit: 50}
            ]).exec(function (err, production) {
                if (err) {
                    data.errorList = errors.errorFunction(err, 'Productions');
                    res.send(data);
                } else {
                    if (production && production.length > 0) {
                        data.production = production;
                        callback(null, data);
                    } else {
                        data.errorList.push({type: 'Productions', message: 'productions not found'})
                        res.send(data);
                    }
                }
            })
        } else {
            res.send(data);
        }
    }
};


text:
/*
* Author: Maire Kehoe (mkehoe@ie.ibm.com)
* Date: 9 Nov 2012
* ExtlibRenderBooleanPropertyTest.java
*/
package xsp.extlib.test.render;

import javax.faces.component.UIInput;

import com.ibm.xsp.component.UIDataIterator;
import com.ibm.xsp.component.UIInputEx;
import com.ibm.xsp.component.xp.XspViewPanel;
import com.ibm.xsp.extlib.component.containers.UIWidgetContainer;
import com.ibm.xsp.extlib.component.data.AbstractDataView;
import com.ibm.xsp.extlib.component.data.AbstractPager;
import com.ibm.xsp.extlib.component.data.FormLayout;
import com.ibm.xsp.extlib.component.data.UIDataSourceIterator;
import com.ibm.xsp.extlib.component.data.UIDataView;
import com.ibm.xsp.extlib.component.data.UIPagerAddRows;
import com.ibm.xsp.extlib.component.dojo.form.UIDojoButton;
import com.ibm.xsp.extlib.component.dojo.layout.UIDojoContentPane;
import com.ibm.xsp.extlib.component.dojo.layout.UIDojoTabPane;
import com.ibm.xsp.extlib.component.dynamiccontent.UIDynamicContent;
import com.ibm.xsp.extlib.component.dynamiccontent.UIInPlaceForm;
import com.ibm.xsp.extlib.component.dynamicview.UIDynamicViewPanel;
import com.ibm.xsp.extlib.component.listview.UIListView;
import com.ibm.xsp.extlib.component.misc.UIDumpObject;
import com.ibm.xsp.extlib.component.mobile.UIMobilePage;
import com.ibm.xsp.extlib.component.outline.UIOutlineNavigator;
import com.ibm.xsp.extlib.component.outline.UIOutlineToolbar;
import com.ibm.xsp.extlib.component.tagcloud.UITagCloud;
import com.ibm.xsp.extlib.component.tooltip.UITooltip;
import com.ibm.xsp.test.framework.XspTestUtil;
import com.ibm.xsp.test.framework.render.BaseRenderBooleanPropertyTest;

/**
 *
 * @author Maire Kehoe (mkehoe@ie.ibm.com)
 */
public class ExtlibRenderBooleanPropertyTest extends BaseRenderBooleanPropertyTest {
    private Object[][] neverInHtmlSkips_core = new Object[][]{
            new Object[]{"immediate", UIInput.class},
            new Object[]{"disableClientSideValidation", UIInputEx.class},
            new Object[]{"disableModifiedFlag", UIInputEx.class},
            new Object[]{"multipleTrim", UIInputEx.class},
            new Object[]{"disableValidators", UIInputEx.class},
            new Object[]{"showReadonlyAsDisabled", UIInputEx.class},
            // viewPanel wasn't intended to be subclassed, by dynamicViewPanel does
            new Object[]{"partialRefresh", XspViewPanel.class},
            new Object[]{"partialExecute", XspViewPanel.class},
            new Object[]{"showColumnHeader", XspViewPanel.class},
            new Object[]{"showUnreadMarks", XspViewPanel.class},
    };
    private Object[][] neverInHtmlSkips_extlib = new Object[][]{
            new Object[]{"partialExecute", AbstractPager.class},
            new Object[]{"partialExecute", UIDataSourceIterator.class},
            new Object[]{"partialRefresh", AbstractPager.class},
            new Object[]{"partialRefresh", UIDataSourceIterator.class},
            new Object[]{"partialRefresh", UIDojoContentPane.class},
            new Object[]{"partialEvents", UIDojoTabPane.class},
            new Object[]{"partialEvents", UIDynamicContent.class},
            new Object[]{"partialEvents", UIInPlaceForm.class},
            // TODO these skips should probably be in xsp-config files, not in this test.
            new Object[]{"removeRepeat", UIDataIterator.class},
            new Object[]{"repeatControls", UIDataIterator.class},
            new Object[]{"expandedDetail", UIDataSourceIterator.class},
            new Object[]{"collapsibleDetail", AbstractDataView.class},
            new Object[]{"detailsOnClient", AbstractDataView.class},
            new Object[]{"openDocAsReadonly", AbstractDataView.class},
            new Object[]{"disableHideRow", AbstractDataView.class},
            new Object[]{"showItemsFlat", AbstractDataView.class},
            new Object[]{"showHeaderCheckbox", UIDataView.class},
            new Object[]{"showCheckbox", UIDataView.class},
            new Object[]{"collapsibleRows", UIDataView.class},
            new Object[]{"columnTitles", UIDataView.class},
            new Object[]{"collapsibleCategory", UIDataView.class},
            new Object[]{"useBeanProperties", UIDumpObject.class},
            new Object[]{"dynamicContent", UITooltip.class},
            new Object[]{"showCheckbox", UIDynamicViewPanel.class},
            new Object[]{"showHeaderCheckbox", UIDynamicViewPanel.class},
            new Object[]{"useHash", UIDynamicContent.class},
            new Object[]{"disableErrorSummary", FormLayout.class},
            new Object[]{"disableRowError", FormLayout.class},
            new Object[]{"fieldHelp", FormLayout.class},
            new Object[]{"disableRequiredMarks", FormLayout.class},
            new Object[]{"state", UIPagerAddRows.class},
            new Object[]{"refreshPage", UIPagerAddRows.class},
            new Object[]{"dropDownRendered", UIWidgetContainer.class},
            new Object[]{"titleBar", UIWidgetContainer.class},
            new Object[]{"scrollable", UIWidgetContainer.class},
            new Object[]{"collapsible", UIWidgetContainer.class},
            new Object[]{"disableScrollUp", UIWidgetContainer.class},
            new Object[]{"disableScrollDown", UIWidgetContainer.class},
            new Object[]{"initClosed", UIWidgetContainer.class},
            new Object[]{"sliderVisible", UITagCloud.class},
            new Object[]{"keepState", UIOutlineNavigator.class},
            new Object[]{"autoCreate", UIMobilePage.class},
            new Object[]{"showColumnNameForEmptyTitle", UIListView.class},
            // The attribute in the HTML is hideColumn (singular)
            new Object[]{"hideColumns", UIListView.class},
            // The attribute in the HTML is showLabel
            new Object[]{"showButtonLabels", UIOutlineToolbar.class},
            // When expandable writes out an onclick script
            new Object[]{"expandable", UIOutlineNavigator.class},
            // button cannot be required, nor can it's 2 subclasses ToggleButton & CheckBox
            new Object[]{"required", UIDojoButton.class},
            // toggle button and checkbox cannot be required because they only have 2 states
            // so making them required would mean the value could only be true
            // don't need to explicitly skip since the superclass is skipped.
//            new Object[]{"required", UIDojoToggleButton.class},
//            new Object[]{"required", UIDojoCheckBox.class},
            //
    };
    private String[] skips = new String[]{
            // skipped until SPR#MKEE8ZYKSU is fixed
            "com/ibm/xsp/extlib/config/extlib-form.xsp-config xe:djextListTextBox required  Always absent in HTML when set to true or false.",
            "com/ibm/xsp/extlib/config/extlib-form.xsp-config xe:djextNameTextBox required  Always absent in HTML when set to true or false.",
            "com/ibm/xsp/extlib/config/extlib-form.xsp-config xe:djextLinkSelect required  Always absent in HTML when set to true or false.",
            "com/ibm/xsp/extlib/config/extlib-form.xsp-config xe:djextImageSelect required  Always absent in HTML when set to true or false.",
            "com/ibm/xsp/extlib/config/extlib-dojo-form.xsp-config xe:djTextBox required  Always absent in HTML when set to true or false.",
            "com/ibm/xsp/extlib/config/extlib-dojo-form.xsp-config xe:djTextarea required  Always absent in HTML when set to true or false.",
            "com/ibm/xsp/extlib/config/extlib-dojo-form.xsp-config xe:djSimpleTextarea required  Always absent in HTML when set to true or false.",
            "com/ibm/xsp/extlib/config/extlib-dojo-form.xsp-config xe:djHorizontalSlider required  Always absent in HTML when set to true or false.",
            "com/ibm/xsp/extlib/config/extlib-dojo-form.xsp-config xe:djVerticalSlider required  Always absent in HTML when set to true or false.",
            // Note, this doesn't need to be skipped because the superclass UIDojoButton is skipped above
            // but it may be that it should be possible for a radio button to be required - not sure.
//          "com/ibm/xsp/extlib/config/extlib-dojo-form.xsp-config xe:djRadioButton required  Always absent in HTML when set to true or false.",
            // end MKEE8ZYKSU issues
    };
    @Override
    protected Object[][] getNeverInHtmlSkips() {
        Object[][] allSkips = super.getNeverInHtmlSkips();
        allSkips = XspTestUtil.concat(allSkips, neverInHtmlSkips_core);
        allSkips = XspTestUtil.concat(allSkips, neverInHtmlSkips_extlib);
        return allSkips;
    }
    @Override
    protected String[] getSkips() {
        return skips;
    }

}