text:
<  返回列表

        出口订单列表 > 出口订单维护

订单主信息()

            <input type="button" id="exportOrderChange" class="red-btn active-btn" ng-click="toExportDetail()" value="改单">

            <input type="button" class="red-btn" ng-click="toTicketFollow()" value="整票跟踪">
            <input type="button" id="exportExamBtn" class="red-btn active-btn" ng-click="saveOrExamExportInfo(2)" ng-show="isAdmin=='admin'?false:true" value="审核">
            <input type="button" id="exportDetailOrderSave" class="blue-btn active-btn" tabindex="18" ng-click="saveOrExamExportInfo(1)" value="暂存">

                    上传附件

上传附件

                    <input type="button" ng-click="addExportBox()" class="second-table-top-operate" value="新增"/>

                    <input type="button" class="second-table-top-operate" ng-click="delExportBoxes()" value="删除"/>

                    <input type="button" class="second-table-top-operate" data-toggle="modal" ng-click="addExportMultiBoxes()" value="批量新增"/>

                    <input id="eAdminSaveContainer" type="button" class="second-table-top-operate dis-hide" ng-click="saveExportContainer('save')" value="保存"/>
                    <input id="eAdminViewContainer" type="button" class="view-container-btn" style="border-right: none;" value="预览"/>

                                <input id="export-select-all1" onclick="selectOrUnSelect(this)" type="checkbox"/>

                                序号

                                id

                                状态

                                箱主

                                箱号

                                铅封号

                                *
                                尺寸箱型

                                装箱件数

                                提箱点

                                返箱点

                                货重(KG)

                                超重

                                带电机

                                冻柜温度

                                通风口

                                柜检

                                需要柜检单

                                冻代干

                                转关

                                多地装

                                操作

                                <input name="export-box" type="checkbox" class="checkbox">

                                {{$index+1}}

                                <input class="table-input exportContainerId" type="text" value="{{container.containerId}}">

                                {{container.containerStateTypeDesc}}

                                <input class="table-input exportOwnerInfo" type="text" ng-model="container.containerOwner" ownerCode="{{container.containerOwnerCode}}" onclick="getContainerOwnerInfo(this)" onkeyup="getContainerOwnerInfo(this)" onblur="setOwnerListHide(this)">

{{container.containerOwner}}

                                <input class="table-input" type="text" maxlength="11" ng-model="container.containerCaseNo" onblur="chkcntrno(this,0);">

{{container.containerCaseNo}}

                                <input class="table-input" type="text" ng-model="container.containerSealNo">

{{container.containerSealNo}}

                                <input class="table-input" type="text" ng-model="container.containerCartonSize" style="width: 40px;"
                                       ng-blur="sortingGetInputValue($event.target,container,'containerCartonSize')"
                                       onfocus="showTypeItems(this)" onkeydown="selectType(this)" onblur="hideTypeItems(this)">

                                <input class="table-input" type="text" ng-model="container.containerType" style="width: 40px;" onfocus="showTypeItems(this)" onkeydown="selectType(this)" onblur="hideTypeItems(this)">

                                <input class="table-input exportOwnerInfo" type="text" ng-model="container.containerDrayageDepot"
                                       containerAddressCode="{{container.containerDrayageDepotCode}}" onclick="getExportContainerAddress(this)"
                                       ng-blur="sortingGetInputValue($event.target,container,'containerDrayageDepot')"
                                       onkeyup="getExportContainerAddress(this)" onblur="setOwnerListHide(this)">

{{container.containerDrayageDepot}}

                                <input class="table-input exportOwnerInfo" type="text" ng-model="container.containerReturnDepot"
                                       containerAddressCode="{{container.containerReturnDepotCode}}"
                                       ng-blur="sortingGetInputValue($event.target,container,'containerReturnDepot')"
                                       onclick="getExportContainerAddress(this)" onkeyup="getExportContainerAddress(this)" onblur="setOwnerListHide(this)">

{{container.containerReturnDepot}}

                                <input class="table-input" type="text" ng-model="container.containerCount">

                                <input class="table-input" type="text" ng-model="container.containerGrossWeight" onkeyup="clearNoNum(this)">

{{sortingToNumber(container,'containerGrossWeight','sortingGrossWeight')}}

                                <input type="checkbox" ng-model="container.containerIsOverWeight" ng-checked="container.containerIsOverWeight=='是'?true:false">

                                <input type="checkbox" ng-model="container.containerDynamo" ng-checked="container.containerDynamo=='是'?true:false">

                                <input class="table-input" type="text" maxlength="5" onkeyup="checkInputIntFloat(this)" ng-model="container.containerRfTemp">

{{sortingToNumber(container,'containerRfTemp','sortingContainerRfTemp')}}

                                <select ng-model="container.containerTemperUnit">
                                    <option value="0">℃</option>
                                    <option value="1">℉</option>
                                </select>

                                <input class="table-input" type="text" ng-model="container.containerVentilation" onblur="limitLength(this, 10);">

{{container.containerVentilation}}

                                <input type="checkbox" ng-model="container.containerIsCheck" ng-checked="container.containerIsCheck=='是'?true:false">

                                <select class="table-select" ng-model="container.containerIsCheckliest">
                                    <option value="是">是</option>
                                    <option value="否">否</option>
                                </select>

                                <select class="table-select" ng-model="container.containerIsReplace">
                                    <option value="是">是</option>
                                    <option value="否">否</option>
                                </select>

                                <input type="checkbox" ng-model="container.containerIsTurnCustom" ng-checked="container.containerIsTurnCustom=='是'?true:false">

                                <input type="checkbox" ng-model="container.containerIsMoreUnload" ng-checked="container.containerIsMoreUnload=='是'?true:false">

结束

                                <input id="export-select-all3" onclick="selectOrUnSelect(this)" type="checkbox"/>

                                序号

                                id

                                状态

                                箱主

                                箱号

                                铅封号

                                *
                                尺寸箱型

                                装箱件数

                                提箱点

                                返箱点

                                货重(KG)

                                超重

                                带电机

                                冻柜温度

                                通风口

                                柜检

                                需要柜检单

                                冻代干

                                转关

                                多地装

                                操作

                                <input name="export-box" type="checkbox" class="checkbox">

                                {{$index+1}}

                                <input class="table-input exportContainerId" type="text" value="{{container.containerId}}">

                                {{container.containerStateTypeDesc}}

                                {{container.containerOwner}}

                                {{container.containerCaseNo}}

                                {{container.containerSealNo}}

                                {{container.containerCartonSize}}

                                {{container.containerType}}

                                {{container.containerCount}}

                                {{container.containerDrayageDepot}}

                                {{container.containerReturnDepot}}

                                {{container.containerGrossWeight}}

                                <input type="checkbox" ng-model="container.containerIsOverWeight" ng-checked="container.containerIsOverWeight=='是'?true:false" disabled>

                                <input type="checkbox" ng-model="container.containerDynamo" ng-checked="container.containerDynamo=='是'?true:false" disabled>

                                {{container.containerRfTemp}}

                                {{container.containerTemperUnit==1?'℉':'℃'}}

                                {{container.containerVentilation}}

                                <input type="checkbox" ng-model="container.containerIsCheck" ng-checked="container.containerIsCheck=='是'?true:false" disabled>

                                {{container.containerIsCheckliest}}

                                {{container.containerIsReplace}}

                                <input type="checkbox" ng-model="container.containerIsTurnCustom" ng-checked="container.containerIsTurnCustom=='是'?true:false" disabled>

                                <input type="checkbox" ng-model="container.containerIsMoreUnload" ng-checked="container.containerIsMoreUnload=='是'?true:false" disabled>

结束

                            <input type="button" class="second-table-top-operate" ng-click="addExportBoxInfo()" value="新增"/>

                            <input type="button" class="second-table-top-operate" ng-click="delExportBoxInfo()" value="删除"/>

                            <input id="eAdminSaveAddress" type="button" class="second-table-top-operate dis-hide" ng-click="saveExportAddress('save')" value="保存"/>

                            <input type="button" ng-click="copyExportInfoToOther()" class="second-table-top-operate" style="border-right: none;" value="复制到"/>

                                        <input id="export-select-all2" onclick="selectOrUnSelect(this)" type="checkbox" name="export-address-check"/>

                                        序号

                                        id

                                        工厂地址

                                        工厂详细地址

                                        到柜时间

                                        工厂联系人

                                        联系电话

                                        省

                                        市

                                        区

                                        <input name="export-boxInfo" type="checkbox" class="checkbox"/>

                                        <span ng-if="address.addressId.indexOf('ZZ')<0">{{nowContainerIndex+($index+1)}}
                                        <span ng-if="address.addressId.indexOf('ZZ')<-1">

                                        <input class="table-input exportAddressId" type="text" value="{{address.addressId}}">

                                        <input class="table-input" type="text" value="{{address.addressPlace}}">

                                        <input class="table-input" type="text" value="{{address.addressArriveTime}}" onfocus="laydate({istime: true, format: 'YYYY-MM-DD hh:mm'})">

{{address.addressArriveTime}}

                                        <input class="table-input" type="text" value="{{address.addressContacts}}">

{{address.addressContacts}}

                                        <input class="table-input" type="text" value="{{address.addressTel}}" onblur="checkTel(this)">

{{address.addressTel}}

                                        <select required="" ng-model="address.addressProvince" ng-options="key as key for (key,value) in division"
                                                ng-change="address.addressCity='';address.addressDistrict='';">
                                            <option value=""></option>
                                        </select>

                                        <select ng-model="address.addressCity" ng-options="key as key for (key,value) in division[address.addressProvince]"
                                                ng-change="address.addressDistrict='';">
                                            <option value=""></option>
                                        </select>

                                        <select ng-model="address.addressDistrict" ng-options="value as value for value in division[address.addressProvince][address.addressCity]">
                                            <option value=""></option>

                                        </select>

                                        <input type="text" value="{{address.addrContId}}">

                                        <input id="export-select-all4" onclick="selectOrUnSelect(this)" type="checkbox" name="export-address-check"/>

                                        序号

                                        id

                                        工厂地址

                                        工厂详细地址

                                        到柜时间

                                        工厂联系人

                                        联系电话

                                        省

                                        市

                                        区

                                        <input name="export-boxInfo" type="checkbox" class="checkbox"/>

                                        {{nowContainerIndex+($index+1)}}

                                        <input class="table-input exportAddressId" type="text" value="{{address.addressId}}">

                                        {{address.addressPlace}}

                                        {{address.addressArriveTime}}

                                        {{address.addressContacts}}

                                        {{address.addressTel}}

                                        {{address.addressProvince}}

                                        {{address.addressCity}}

                                        {{address.addressDistrict}}

                                        <input type="text" value="{{address.addrContId}}">

                    <button type="button" class="close"
                            data-dismiss="modal" aria-hidden="true">
                        ×
                    </button>

                        批量新增

                    <form class="form-horizontal" role="form">

                            箱号:

                                <input id="_eBoxNos" type="text" class="form-control" ng-model="exportMultiContainerNo" style="border: 1px solid #ccc;" onblur="chkcntrno(this,0);">

                            铅封号:

                                <input id="_iSealNums" type="text" class="form-control"
                                       style="border: 1px solid #ccc;" ng-model="exportMultiContainerSealNo">

                            箱型:

                                <select id="_iBoxTypes" class="form-control" ng-model="exportMultiContainerType" style="border: 1px solid #ccc;">
                                    <option ng-repeat="x in containerExportType">{{x.typeCode}}</option>
                                </select>

                            尺寸:

                                <select id="_iBoxSizes" class="form-control" ng-model="exportMultiContainerSize" style="border: 1px solid #ccc;">
                                    <option ng-repeat="x in containerSize" value="{{x.typeCode}}">{{x.typeCode}}</option>
                                </select>

                            提箱点:

                                <input id="_eBoxDrayages" containerAddressCode ="" type="text" class="form-control exportDepot" style="border: 1px solid #ccc;" ng-model="exportMultiContainerDrayage" data-list=".drayage_list" autocomplete="off" onfocus="getAdminMultiOrderDepot(this)" onblur="dropDownListDisplay(this)">

                            返箱点:

                                <input id="_eBoxReturns" containerAddressCode ="" type="text" class="form-control exportDepot" style="border: 1px solid #ccc;" ng-model="importMultiContainerReturn" data-list=".return_list" autocomplete="off" onfocus="getAdminMultiOrderDepot(this)" onblur="dropDownListDisplay(this)">

                            货重(KG):

                                <input id="_iRoughWeight" type="text" class="form-control" ng-model="exportMultiContainerGrossWeight" style="border: 1px solid #ccc;" onkeyup="clearNoNum(this)">

                            是否超重:

                                <select id="_iIsMultis" class="form-control" ng-model="exportMultiContainerIsOverWeight" style="border: 1px solid #ccc;">
                                    <option value="是">是</option>
                                    <option value="否">否</option>
                                </select>

                            是否带电机:

                                <select id="_iIsTakes" class="form-control" ng-model="exportMultiContainerDynamo" style="border: 1px solid #ccc;">
                                    <option value="是">是</option>
                                    <option value="否">否</option>
                                </select>

                            冻柜温度:

                                <input id="_iFreezers" type="text" class="form-control" ng-model="exportMultiContainerRfTemp" maxlength="5" onkeyup="checkInputIntFloat(this)">

                            冻柜温度单位:

                                <select id="_iFreezerUnits" class="form-control" ng-model="exportMultiContainerTemperUnit">
                                    <option value="0">℃</option>
                                    <option value="1">℉</option>
                                </select>

                            通风口:

                                <input id="_eVentilation" type="text" class="form-control" ng-model="exportMultiContainerVentilation" style="border: 1px solid #ccc;" onblur="limitLength(this, 10);">

                            是否柜检:

                                <select id="_iIsCaseChecks" class="form-control" ng-model="exportMultiContainerIsCheck" style="border: 1px solid #ccc;">
                                    <option value="是">是</option>
                                    <option value="否">否</option>
                                </select>

                            是否转关:

                                <select id="_iIsTransform" class="form-control" ng-model="exportMultiTransform" style="border: 1px solid #ccc;">
                                    <option value="是">是</option>
                                    <option value="否">否</option>
                                </select>

                            是否多地装:

                                <select id="_iIsMultiUpload" class="form-control" ng-model="exportMultiUpload" style="border: 1px solid #ccc;">
                                    <option value="是">是</option>
                                    <option value="否">否</option>
                                </select>

                            数量:

                                <input id="_iNumbers" type="text" class="form-control" ng-model="numbers" style="border: 1px solid #ccc;" st-integer/>

                    </form>

                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" ng-click="addExportBoxes()">
                        新增
                    </button>

                    <button type="button" class="close"
                            data-dismiss="modal" aria-hidden="true">
                        ×
                    </button>

                        复制地址信息

                                <input onclick="selectOrUnSelect(this)" type="checkbox" name="copy-check-all"/>

                                序号

                                id

                                箱号

                                尺寸箱型

                                <input name="copy-check" type="checkbox" class="checkbox">

                                {{$index+1}}

                                <input class="table-input exportContainerId" type="text" value="{{container.containerId}}">

                                {{container.containerCaseNo}}

                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" ng-click="copyExportAddressInfo()">
                        复制
                    </button>


text:
package org.n52.javaps.service.handler;

import static java.util.stream.Collectors.toSet;

import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ExecutionException;

import javax.inject.Inject;

import org.n52.iceland.request.handler.GenericOperationHandler;
import org.n52.iceland.request.handler.OperationHandlerKey;
import org.n52.janmayen.http.MediaType;
import org.n52.javaps.engine.Engine;
import org.n52.javaps.engine.EngineException;
import org.n52.javaps.engine.InputDecodingException;
import org.n52.javaps.engine.JobNotFoundException;
import org.n52.javaps.engine.ProcessNotFoundException;
import org.n52.shetland.ogc.ows.OwsAllowedValues;
import org.n52.shetland.ogc.ows.OwsCode;
import org.n52.shetland.ogc.ows.OwsDomain;
import org.n52.shetland.ogc.ows.OwsNoValues;
import org.n52.shetland.ogc.ows.OwsPossibleValues;
import org.n52.shetland.ogc.ows.OwsValue;
import org.n52.shetland.ogc.ows.exception.InvalidParameterValueException;
import org.n52.shetland.ogc.ows.exception.OwsExceptionReport;
import org.n52.shetland.ogc.wps.ExecutionMode;
import org.n52.shetland.ogc.wps.JobId;
import org.n52.shetland.ogc.wps.ResponseMode;
import org.n52.shetland.ogc.wps.Result;
import org.n52.shetland.ogc.wps.StatusInfo;
import org.n52.shetland.ogc.wps.WPSConstants;
import org.n52.shetland.ogc.wps.data.ProcessData;
import org.n52.shetland.ogc.wps.request.ExecuteRequest;
import org.n52.shetland.ogc.wps.response.ExecuteResponse;

/**
 * TODO JavaDoc
 *
 * @author Christian Autermann
 */
public class ExecuteHandler extends AbstractEngineHandler implements GenericOperationHandler<ExecuteRequest,
        ExecuteResponse> {
    private static final String IDENTIFIER = "Identifier";

    private static final OperationHandlerKey KEY = new OperationHandlerKey(WPSConstants.SERVICE,
            WPSConstants.Operations.Execute);

    @Inject
    public ExecuteHandler(Engine engine) {
        super(engine);
    }

    @Override
    public ExecuteResponse handle(ExecuteRequest request) throws OwsExceptionReport {

        String service = request.getService();
        String version = request.getVersion();
        JobId jobId;
        try {
            jobId = getEngine().execute(request.getId(), request.getInputs(), request.getOutputs(), request
                    .getResponseMode());
        } catch (ProcessNotFoundException ex) {
            throw new InvalidParameterValueException(IDENTIFIER, request.getId().getValue());
        } catch (InputDecodingException ex) {
            throw createNoApplicableCodeExceptionWithHttpStatusInternalServerError(ex);
        }

        if (request.getExecutionMode() == ExecutionMode.SYNC) {
            try {
                Result result = getEngine().getResult(jobId).get();
                ExecuteResponse response = new ExecuteResponse(service, version, result);

                if (request.getResponseMode() == ResponseMode.RAW) {
                    ProcessData data = response.getResult().get().getOutputs().iterator().next();
                    if (data.isValue()) {
                        response.setContentType(data.asValue().getFormat().getMimeType().map(MediaType::parse)
                                .orElseGet(MediaType::new));
                    }
                }
                return response;

            } catch (InterruptedException | JobNotFoundException ex) {
                throw createNoApplicableCodeExceptionWithHttpStatusInternalServerError(ex);
            } catch (ExecutionException ex) {
                throw createNoApplicableCodeExceptionWithHttpStatusInternalServerError(ex.getCause());
            } catch (EngineException ex) {
                throw createNoApplicableCodeExceptionWithHttpStatusInternalServerError(ex);
            }
        } else {
            StatusInfo status;
            try {
                status = getEngine().getStatus(jobId);
            } catch (EngineException ex) {
                throw createNoApplicableCodeExceptionWithHttpStatusInternalServerError(ex);
            }
            return new ExecuteResponse(service, version, status);
        }
    }

    @Override
    public String getOperationName() {
        return WPSConstants.Operations.Execute.toString();
    }

    @Override
    public Set<OperationHandlerKey> getKeys() {
        return Collections.singleton(KEY);
    }

    @Override
    protected Set<OwsDomain> getOperationParameters(String service,
            String version) {
        Set<OwsValue> algorithmIdentifiers = getEngine().getProcessIdentifiers().stream().map(OwsCode::getValue).map(
                OwsValue::new).collect(toSet());
        OwsPossibleValues possibleValues;
        if (algorithmIdentifiers.isEmpty()) {
            possibleValues = OwsNoValues.instance();
        } else {
            possibleValues = new OwsAllowedValues(algorithmIdentifiers);
        }
        return Collections.singleton(new OwsDomain(IDENTIFIER, possibleValues));
    }

    @Override
    public boolean isSupported() {
        return true;
    }

}

redpajama_set_name: RedPajamaGithub


text:
/*
 * MinIO Cloud Storage, (C) 2018 MinIO, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package iampolicy

import (
	"encoding/json"
	"fmt"
	"sort"

	"github.com/minio/minio-go/v6/pkg/set"
)

// ActionSet - set of actions.
type ActionSet map[Action]struct{}

// Add - add action to the set.
func (actionSet ActionSet) Add(action Action) {
	actionSet[action] = struct{}{}
}

// Match - matches object name with anyone of action pattern in action set.
func (actionSet ActionSet) Match(action Action) bool {
	for r := range actionSet {
		if r.Match(action) {
			return true
		}
	}

	return false
}

// Intersection - returns actions available in both ActionSet.
func (actionSet ActionSet) Intersection(sset ActionSet) ActionSet {
	nset := NewActionSet()
	for k := range actionSet {
		if _, ok := sset[k]; ok {
			nset.Add(k)
		}
	}

	return nset
}

// MarshalJSON - encodes ActionSet to JSON data.
func (actionSet ActionSet) MarshalJSON() ([]byte, error) {
	if len(actionSet) == 0 {
		return nil, fmt.Errorf("empty action set")
	}

	return json.Marshal(actionSet.ToSlice())
}

func (actionSet ActionSet) String() string {
	actions := []string{}
	for action := range actionSet {
		actions = append(actions, string(action))
	}
	sort.Strings(actions)

	return fmt.Sprintf("%v", actions)
}

// ToSlice - returns slice of actions from the action set.
func (actionSet ActionSet) ToSlice() []Action {
	actions := []Action{}
	for action := range actionSet {
		actions = append(actions, action)
	}

	return actions
}

// UnmarshalJSON - decodes JSON data to ActionSet.
func (actionSet *ActionSet) UnmarshalJSON(data []byte) error {
	var sset set.StringSet
	if err := json.Unmarshal(data, &sset); err != nil {
		return err
	}

	if len(sset) == 0 {
		return fmt.Errorf("empty action set")
	}

	*actionSet = make(ActionSet)
	for _, s := range sset.ToSlice() {
		action, err := parseAction(s)
		if err != nil {
			return err
		}

		actionSet.Add(action)
	}

	return nil
}

// NewActionSet - creates new action set.
func NewActionSet(actions ...Action) ActionSet {
	actionSet := make(ActionSet)
	for _, action := range actions {
		actionSet.Add(action)
	}

	return actionSet
}


text:
const { readFileSync } = require("fs");
const { webpack } = require("webpack-stream");

const babelConfig = JSON.parse(readFileSync(".babelrc", "utf8"));

let outputDir = "debug";

if (process.env.NODE_ENV === "production") {
	outputDir = "lib";
}

const config = {
	entry: {
		app: "./src/client.js",
		vendor: [
			"babel-polyfill",
			"react", "react-dom"
		]
	},
	output: {
		filename: `${ outputDir }/[name].js`
	},
	resolve: {
		extensions: ["", ".jsx", ".js"]
	},
	module: {
		loaders: [
			{
				test: /\.jsx?$/,
				exclude: /node_modules/,
				loader: "babel",
				query: babelConfig
			}
		]
	},
	plugins: [
		new webpack.optimize.CommonsChunkPlugin("vendor", `${ outputDir }/vendor.js`)
	]
};

if (process.env.NODE_ENV === "production") {
	config.plugins.push(new webpack.optimize.UglifyJsPlugin({
		compress: {
			warnings: false
		}
	}));

	config.plugins.push(new webpack.DefinePlugin({
		"process.env": {
			NODE_ENV: `"production"`
		}
	}));
} else {
	config.devtool = "source-map";
}

module.exports = config;


text:
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
% The preceding line is only needed to identify funding in the first footnote. If that is unneeded, please comment it out.
\usepackage{cite}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{float}
\usepackage{graphicx}
\usepackage{textcomp}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}

\title{Sistema de Sinalização para Ciclistas\\
  % {\footnotesize \textsuperscript{*}Note: Sub-titles are not captured in Xplore and should not be used}
}

\author{\IEEEauthorblockN{Karine Valença}
  \IEEEauthorblockA{\textit{Engenharia de Software} \\
    \textit{Universidade de Brasília, FGA}\\
    Gama, Brasil \\
  valenca.karine@gmail.com}
  \and
  \IEEEauthorblockN{Wilton Rodrigues}
  \IEEEauthorblockA{\textit{Engenharia de Software} \\
    \textit{Universidade de Brasília, FGA}\\
    Gama, Brasil \\
  wiltonsr94@gmail.com}
}

\maketitle

\begin{abstract}
  This document is a model and instructions for \LaTeX.
  This and the IEEEtran.cls file define the components of your paper [title, text, heads, etc.]. *CRITICAL: Do Not Use Symbols, Special Characters, Footnotes,
  or Math in Paper Title or Abstract.
\end{abstract}

\begin{IEEEkeywords}
  component, formatting, style, styling, insert
\end{IEEEkeywords}

\section{Introdução}

\subsection{Revisão Bibliográfica}
Notícias sobre acidentes envolvendo bicicletas são comuns no Brasil. Recentemente, em São Paulo, um ciclista morreu logo após ser atropelado e arrastado \cite{b1}. Dados de 2014, mostram que 1.357 ciclistas morreram vítimas de acidentes de trânsito no Brasil, além disso, em 2016, ocorreram 11.741 internações de ciclistas vítimas de acidentes \cite{b2}. De acordo com Departamente Nacional de Infraestrutura de Transportes (DNIT) \cite{b3} só no ano de 2011 foram 1.698 casos de acidentes envolvendo ciclistas. Sendo que 246, equivalente a 14.5\%, acabaram na morte.

O site hg.org apresenta uma lista de dicas para evitar acidentes ao utilizar bicicleta. O site sugere aos ciclistas que eles se façam visíveis aos demais usuários das vias, e que utilizem sinais de mão para mostrar intenção de parar ou de mudar de faixa \cite{b4}.

Existe uma série de sinais que podem ser utilizados pelos ciclistas para indicar suas intenções. O site mapmyrun \cite{b5}, apresenta um lista com 10 sinais que podem ser utilizados a fim de evitar acidentes. Pode-se notar que, de fato, os sinais auxiliam a diminuir os acidentes de trânsito envolvendo ciclistas. Porém, alguns desses sinais não são tão intuitivos e podem não fazer sentido para os motoristas. Além disso, a grande quantidade de sinais pode gerar confusão até mesmo aos ciclistas.

\subsection{Justificativa}
Pode-se notar que a visibilidade e sinalização por parte dos ciclistas é crucial para sua segurança no trânsito. Diante disso, este projeto tem como objetivo a criação de um sistema de sinalização eletrônico visando aumentar a segurança dos ciclistas. Espera-se que os usuários do sistema de sinalização eletrônico sofram menos acidentes causados por falta de visibilidade.

\subsection{Objetivos}
O objetivo do projeto é de desenvolver um sistema de sinalização, utilizando o
MSP430, a fim de aumentar a visibilidade dos ciclistas durante seu trajeto para
aumentar a segurança e confiança dos utilizadores deste meio de transporte.

\subsection{Requisitos}
O sistema deve atender aos requisitos:
\begin{itemize}
  \item Indicar sinal luminoso intermitente que fica ativo sempre que não houver outro sinal
  \item Indicar seta para a direita ou para a esquerda após clique do botão correspondente
  \item Indicar sobre parada quando o ciclista iniciar a freagem
  \item Indicar sobre perigos na pista quando o ciclista apertar o botão adequado
\end{itemize}

O sistema não atende aos requisitos:
\begin{itemize}
  \item Funcionar em dias chuvosos
\end{itemize}

\subsection{Benefícios}
O sistema proporciona um equipamento de sinalização que ajuda os demais condutores
a ter uma melhor visão dos ciclistas. Baseado nisto o principal benefício do sistema
é a diminuição de ocorrências de acidentes envolvendo ciclistas.

\section{Descrição do Hardware}
\subsection{Lista de Materiais}
Os materiais utilizados para a construção do Sistema de Sinalização para Ciclistas, foram:
\begin{itemize}
  \item 1 MSP430 LaunchPad
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.5\linewidth]{MSP430-LaunchPad}
      \caption{MSP430 LaunchPad. Fonte: http://e2e.ti.com/}
      \label{fig:2500}
    \end{figure}

  \item 1 Matriz de LED 8x8
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.5\linewidth]{matriz}
      \caption{Matriz de LED 8x8. Fonte: http://www.huinfinito.com.br}
      \label{fig:matriz}
    \end{figure}

  \item 2 Protoboards
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.5\linewidth]{protoboard}
      \caption{Protoboard. Fonte: www.filipeflop.com/}
      \label{fig:protoboard}
    \end{figure}

  \item Jumpers Macho-Macho e Macho-Fêmea
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.5\linewidth]{jumper}
      \caption{Jumpers. Fonte: http://www.msseletronica.com}
      \label{fig:jumper}
    \end{figure}

  \item 1 chave on-off-on
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.5\linewidth]{switch}
      \caption{Chave on-off-on. Fonte: http://www.12voltplanet.co.uk/}
      \label{fig:switch}
    \end{figure}

  \item 2 chaves push-botton sem trava
    \begin{figure}[H]
      \centering
      \includegraphics[width=0.5\linewidth]{push}
      \caption{Chave push-botton. Fonte: http://www.huinfinito.com.br/}
      \label{fig:push}
    \end{figure}

\end{itemize}

\subsection{Verificação dos componentes}
Com o intuito de verificar se os componentes estavam funcionando conforme o esperado, forem feitos alguns teste simples de funcionamento.
\subsubsection{Verificação da Matriz de Led}
Para verificar se a matriz de led estava funcionando corretamente, foi ligada uma tensão de aproximadamente 3.3 volts no VCC e no DIN, e no GND, uma tensão de 0 volts.

\textbf{Esquemático:}
A figura abaixo mostra o esquemático montado para o teste da matriz de led:
\begin{figure}[H]
  \centering
  \includegraphics[width=0.5\linewidth]{dot}
  \caption{Teste realizado com a matriz de led. Fonte: Autores}
  \label{fig:dem_dot}
\end{figure}

\textbf{Demonstração:}
A figura abaixo mostra o teste realizado com a matriz de led:
\begin{figure}[H]
  \centering
  \includegraphics[width=0.5\linewidth]{dem_matriz}
  \caption{Teste realizado com a matriz de led. Fonte: Autores}
  \label{fig:dem_matriz}
\end{figure}

\subsubsection{Verificação da Chave on-off-on}
Para verificar se a chave on-off-on estava funcionando corretamente, foi ligada uma tensão de aproximadamente 3.3 volts nos pinos 1 e 3 do botão. O pino 2 funcionou como saída e foi ligado em um resistor de 1000 ohm, que estava ligado em série a um Led.

% \textbf{Esquemático:}
% A figura abaixo mostra o esquemático montado para o teste da chave on-off-on:
%
% COLOCAR FIGURA AQUUI
%
\textbf{Demonstração:}
A figura abaixo mostra o teste realizado com a chave on-off-on:
\begin{figure}[H]
  \centering
  \includegraphics[width=0.5\linewidth]{on-off}
  \caption{Teste realizado com a chave on-off-on. Fonte: Autores}
  \label{fig:dem_on_off}
\end{figure}

\subsubsection{Verificação da Chave Push-Botton}
Para verificar se a chave push-botton estava funcionando corretamente, foi ligada uma tensão de aproximadamente 3.3 volts em um resistor de 1000 ohm, que estava ligado em série ao botão. O botão, por sua vez, estava ligado em série a um led. Dessa forma, era esperado que ao pressionar o botão, o led acendesse, e ao soltar o botão, o led apagasse.

\textbf{Esquemático:}
A figura abaixo mostra o esquemático montado para o teste da chave push-button:

\begin{figure}[H]
  \centering
  \includegraphics[width=0.5\linewidth]{esq1}
  \caption{Teste realizado com o Push Button. Fonte: Autores}
  \label{fig:dem_push}
\end{figure}

\textbf{Demonstração:}
A figura abaixo mostra o teste realizado com a chave push-botton:
\begin{figure}[H]
  \centering
  \includegraphics[width=0.5\linewidth]{push-bottom}
  \caption{Teste realizado com a chave push-botton. Fonte: Autores}
  \label{fig:dem_push_botton}
\end{figure}

\begin{thebibliography}{00}
  \bibitem{b1} G1, ``Ciclista morre após ser atropelado e arrastado em SP''. Disponível em: http://g1.globo.com/sao-paulo/noticia/ciclista-morre-apos-ser-atropelado-e-arrastado-em-sp.ghtml.
  \bibitem{b2} G1, ``Brasil tem, em média, 32 ciclistas internados por dia devido a acidentes''. Disponível em: http://g1.globo.com/bom-dia-brasil/noticia/2017/03/brasil-tem-em-media-32-ciclistas-internados-por-dia-devido-acidentes.html.
  \bibitem{b3} DNIT, ``NÚMERO DE VITIMADOS ENVOLVIDOS POR TIPO DE USUÁRIO'', 2011.
  \bibitem{b4} Mesriani Law Group, ``Safety Tips to Avoid Bicycle Accidents''. Disponível em: https://www.hg.org/article.asp?id=7752.
  \bibitem{b5} Marc Lindsay, ``10 Cycling Hand Signals You Need to Know''. Disponível em: http://blog.mapmyrun.com/10-cycling-hand-signals-need-know/.

\end{thebibliography}

\end{document}


text:
package jp.co.yahoo.map.codezine_sample;

import android.content.Context;
import android.opengl.GLSurfaceView;

public class GL20SurfaceView extends GLSurfaceView{
	private GL20MyRenderer mRenderer = null;	//描画処理本体
	private Context mContext;	//Context
	private MapView mMapView = null;	//MapView

	//コンストラクタ
	public GL20SurfaceView(Context context, MapView mapView) {
		super(context.getApplicationContext());
		mContext = context.getApplicationContext();
		mMapView = mapView;
		//OpenGLES2.0の使用を宣言します。
		setEGLContextClientVersion(2);
		//レンダラーを初期化し、ビューにセットします。
		mRenderer = new GL20MyRenderer(mContext,this, mMapView);
		setRenderer(mRenderer);
	}

	public void setMatrix(GMatrix viewmatrix, GMatrix projectionmatrix) {
		this.mRenderer.setMatrix(viewmatrix, projectionmatrix);
	}
}


text:
import time

import pigpio

#
# OH3144E or equivalent Hall effect sensor
#
# Pin 1 - 5V
# Pin 2 - Ground
# Pin 3 - gpio (here P1-8, gpio 14, TXD is used)
#
# The internal gpio pull-up is enabled so that the sensor
# normally reads high.  It reads low when a magnet is close.
#

HALL=14

pi = pigpio.pi() # connect to local Pi

pi.set_mode(HALL, pigpio.INPUT)
pi.set_pull_up_down(HALL, pigpio.PUD_UP)

start = time.time()

while (time.time() - start) < 60:
   print("Hall = {}".format(pi.read(HALL)))
   time.sleep(0.2)

pi.stop()


text:
class TH1F;
class TH2F;
class TH3D;

class AliTriggerAnalysis;
class AliAnalysisFilter;
class AliPIDResponse;

class TFile;
class TTree;
class TList;

class TObjArray;

class AliAnalysisTaskEtaReconstruction : public AliAnalysisTaskSE {
public:
  // two class constructors
  AliAnalysisTaskEtaReconstruction() ;

  AliAnalysisTaskEtaReconstruction(const char* name);
  // class destructor
   virtual ~AliAnalysisTaskEtaReconstruction();
   // called once at beginning or runtime
   virtual void UserCreateOutputObjects();
   // called for each event
   virtual void UserExec(Option_t* option);
   // called at end of analysis
   virtual void Terminate(Option_t* option);

   void SetRun1Analysis(Bool_t answer){ run1analysis = answer; }

   enum Detector {kITS, kTPC, kTOF};
   Bool_t               GetEnablePhysicsSelection() const   {return fSelectPhysics; }
   Int_t                GetTriggerMask() const              {return fTriggerMask; }
   AliAnalysisCuts*     GetEventFilter()                    {return fEventFilter;}

   std::vector<double>  GetPtBins() const                   {return fPtBins;}
   std::vector<double>  GetEtaBins() const                  {return fEtaBins;}
   std::vector<double>  GetPhiBins() const                  {return fPhiBins;}

   // Debug Variable
   void   SetDebug(bool debug) {fdebug = debug;}

   // MC Signal setter
   void   AddSinglePrimaryLegMCSignal(AliDielectronSignalMC signal1)         {fSinglePrimaryLegMCSignal.push_back(signal1);}
   void   AddSingleSecondaryLegMCSignal(AliDielectronSignalMC signal1)       {fSingleSecondaryLegMCSignal.push_back(signal1);}
   void   AddPrimaryPairMCSignal(AliDielectronSignalMC signal1)              {fPrimaryPairMCSignal.push_back(signal1);}
   void   AddSecondaryPairMCSignal(AliDielectronSignalMC signal1)            {fSecondaryPairMCSignal.push_back(signal1);}
   void   AddFourPairMCSignal_PrimSec(AliDielectronSignalMC signal1)                 {fFourPairMCSignal_PrimSec.push_back(signal1);}
   void   AddFourPairMCSignal_SecSec(AliDielectronSignalMC signal1)                  {fFourPairMCSignal_SecSec.push_back(signal1);}
   void   AddMCSignalsWherePrimaryDielectronPairNotFromSameMother(std::vector<bool> vec)   {fPrimaryDielectronPairNotFromSameMother = vec;}
   void   AddMCSignalsWhereSecondaryDielectronPairNotFromSameMother(std::vector<bool> vec) {fSecondaryDielectronPairNotFromSameMother = vec;}

   // PID correction functions
   void   SetCentroidCorrFunction(Detector det, TObject *fun, UInt_t varx, UInt_t vary=0, UInt_t varz=0);
   void   SetWidthCorrFunction   (Detector det, TObject *fun, UInt_t varx, UInt_t vary=0, UInt_t varz=0);

   // Generator
   void   SetGeneratorName         (TString generatorName) { fGeneratorName = generatorName;}
   void   SetGeneratorMCSignalName (TString generatorName) { fGeneratorMCSignalName  = generatorName;}
   void   SetGeneratorULSSignalName(TString generatorName) { fGeneratorULSSignalName = generatorName;}

   // Event setter
   void   SetEnablePhysicsSelection(Bool_t selectPhysics)   {fSelectPhysics = selectPhysics;}
   void   SetTriggerMask(Int_t triggermask)                 {fTriggerMask = triggermask;}
   void   SetEventFilter(AliAnalysisCuts * const filter)    {fEventFilter = filter;}
   void   SetCentrality(double cent_min, double cent_max)             {fMinCentrality = cent_min; fMaxCentrality = cent_max;} //For pp and pPb analysis use SetCentrality(-1, -1)

   void   SetCentralityFile(std::string filename) {fCentralityFilename = filename; }

   // Support Histos
   void   SetSupportHistoMCSignalAndCutsetting(int nMCSignal, int nCutsetting) {fSupportMCSignal = nMCSignal; fSupportCutsetting = nCutsetting;}

   // Resolution setter
   void   SetResolutionFile(std::string filename) {fResoFilename = filename; }
   void   SetResolutionFileFromAlien(std::string filename) {fResoFilenameFromAlien = filename; }
   void   SetResolutionDeltaPtBinsLinear (const double min, const double max, const unsigned int steps){SetBinsLinear("ptDelta_reso", min, max, steps);}
   void   SetResolutionRelPtBinsLinear   (const double min, const double max, const unsigned int steps){SetBinsLinear("ptRel_reso", min, max, steps);}
   void   SetResolutionEtaBinsLinear  (const double min, const double max, const unsigned int steps){SetBinsLinear("eta_reso", min, max, steps);}
   void   SetResolutionPhiBinsLinear  (const double min, const double max, const unsigned int steps){SetBinsLinear("phi_reso", min, max, steps);}
   void   SetResolutionThetaBinsLinear(const double min, const double max, const unsigned int steps){SetBinsLinear("theta_reso", min, max, steps);}

   // single electron binning setter
   void   SetPtBins(std::vector<double> ptBins)             {fPtBins = ptBins;}
   void   SetPtBinsLinear(const double min, const double max, const unsigned int steps) {SetBinsLinear("pt", min, max, steps);}
   void   SetEtaBins(std::vector<double> etaBins)           {fEtaBins = etaBins;}
   void   SetEtaBinsLinear(const double min, const double max, const unsigned int steps){SetBinsLinear("eta", min, max, steps);}
   void   SetPhiBins(std::vector<double> phiBins)           {fEtaBins = phiBins;}
   void   SetPhiBinsLinear(const double min, const double max, const unsigned int steps){SetBinsLinear("phi", min, max, steps);}
   void   SetThetaBinsLinear(const double min, const double max, const unsigned int steps){SetBinsLinear("theta", min, max, steps);}

   // pair binning setter
   void   SetMassBins(std::vector<double> massBins){fMassBins=massBins;}
   void   SetMassBinsLinear(const double min, const double max, const unsigned int steps){SetBinsLinear("mass", min, max, steps);}
   void   SetPairPtBins(std::vector<double> pairptBins){ fPairPtBins = pairptBins;}
   void   SetPairPtBinsLinear(const double min, const double max, const unsigned int steps){SetBinsLinear("pairpt", min, max, steps);}

   // Pair related setter
   void   SetDoPairing(Bool_t doPairing) {fDoPairing = doPairing;}
   void   SetDoFourPairing(Bool_t doFourPairing) {fDoFourPairing = doFourPairing;}
   void   SetUsePreFilter(Bool_t usePreFilter) {fUsePreFilter = usePreFilter;}
   void   SetUseSecPreFilter(Bool_t usePreFilter) {fUseSecPreFilter = usePreFilter;}
   void   SetKinematicCuts(double ptMin, double ptMax, double etaMin, double etaMax) {fPtMin = ptMin; fPtMax = ptMax; fEtaMin = etaMin; fEtaMax = etaMax;}

   // Single leg from Pair related setter
   void   SetWriteLegsFromPair(bool enable){fWriteLegsFromPair = enable;}
   void   SetPtMinLegsFromPair(const double ptMin){fPtMinLegsFromPair = ptMin;}
   void   SetPtMaxLegsFromPair(const double ptMax){fPtMaxLegsFromPair = ptMax;}
   void   SetEtaMinLegsFromPair(const double etaMin){fEtaMinLegsFromPair = etaMin;}
   void   SetEtaMaxLegsFromPair(const double etaMax){fEtaMaxLegsFromPair = etaMax;}
   void   SetPhiMinLegsFromPair(const double phiMin){fPhiMinLegsFromPair = phiMin;}
   void   SetPhiMaxLegsFromPair(const double phiMax){fPhiMaxLegsFromPair = phiMax;}
   void   SetOpAngleMinLegsFromPair(const double opAngleMin){fOpAngleMinLegsFromPair = opAngleMin;}
   void   SetOpAngleMaxLegsFromPair(const double opAngleMax){fOpAngleMaxLegsFromPair = opAngleMax;}
   void   SetPtNBinsLegsFromPair(const int ptNBins){fPtNBinsLegsFromPair = ptNBins;}
   void   SetEtaNBinsLegsFromPair(const int etaNBins){fEtaNBinsLegsFromPair = etaNBins;}
   void   SetPhiNBinsLegsFromPair(const int phiNBins){fPhiNBinsLegsFromPair = phiNBins;}
   void   SetOpAngleNBinsLegsFromPair(const int opAngleNBins){fOpAngleNBinsLegsFromPair = opAngleNBins;}

   // Set Cocktail waiting
   void SetDoCocktailWeighting(bool doCocktailWeight) { fDoCocktailWeighting = doCocktailWeight; }
   void SetCocktailWeighting(std::string cocktailFilename) { fCocktailFilename = cocktailFilename; }
   void SetCocktailWeightingFromAlien(std::string cocktailFilenameFromAlien) { fCocktailFilenameFromAlien = cocktailFilenameFromAlien; }

   // Generator related setter
   void   SetMinPtGen(double ptMin)   {fPtMinGen = ptMin;} // Look only at particles which are above a threshold. (reduces computing time/less tracks when looking at secondaries)
   void   SetMaxPtGen(double ptMax)   {fPtMaxGen = ptMax;}
   void   SetMinEtaGen(double etaMin) {fEtaMinGen = etaMin;} // Look only at particles which are above a threshold. (reduces computing time/less tracks when looking at secondaries)
   void   SetMaxEtaGen(double etaMax) {fEtaMaxGen = etaMax;}

   // Set mass cuts
   void   SetLowerMassCutPrimaries(double massCut) {fLowerMassCutPrimaries = massCut;}
   void   SetUpperMassCutPrimaries(double massCut) {fUpperMassCutPrimaries = massCut;}
   void   SetMassCutSecondaries(double massCut) {fMassCutSecondaries = massCut;}
   void   SetUpperPrimSecPreFilterMass(double prefilterMassCut) {fUpperPrimSecPreFilterMass = prefilterMassCut;}
   void   SetLowerPrimSecPreFilterMass(double prefilterMassCut) {fLowerPrimSecPreFilterMass = prefilterMassCut;}
   void   SetUpperSecSecPreFilterMass(double prefilterMassCut) {fUpperSecSecPreFilterMass = prefilterMassCut;}
   void   SetLowerSecSecPreFilterMass(double prefilterMassCut) {fLowerSecSecPreFilterMass = prefilterMassCut;}
   void   SetPhotonMass(Double_t photonMass) {fPhotonMass = photonMass;}

   // Set Bools for Analysis
   void   SetMassCut(Bool_t DoMassCut) {fDoMassCut = DoMassCut;}
   void   SetV0FinderStatus(Bool_t status) {fV0OnFlyStatus = status;}
   void   SetAnalyseDalitz(Bool_t analyseDalitz) {fAnalyseDalitz = analyseDalitz;}
   void   SetAnalyseGammaGamma(Bool_t analyseGammaGamma) {fAnalyseGammaGamma = analyseGammaGamma;}

   // Track cuts setter
   void   AddTrackCuts_primary_PreFilter   (AliAnalysisFilter* filter) {fTrackCuts_primary_PreFilter.push_back(filter);}
   void   AddTrackCuts_secondary_PreFilter (AliAnalysisFilter* filter) {fTrackCuts_secondary_PreFilter.push_back(filter);}
   void   AddTrackCuts_primary_standard    (AliAnalysisFilter* filter) {fTrackCuts_primary_standard.push_back(filter);}
   void   AddTrackCuts_secondary_standard  (AliAnalysisFilter* filter) {fTrackCuts_secondary_standard.push_back(filter);}

   // Pair cuts setter
   void   AddPairCuts_primary  (AliAnalysisFilter* filter) {fPairCuts_primary.push_back(filter);}
   void   AddPairCuts_secondary_PreFilter(AliAnalysisFilter* filter) {fPairCuts_secondary_PreFilter.push_back(filter);}
   void   AddPairCuts_secondary_standard(AliAnalysisFilter* filter)  {fPairCuts_secondary_standard.push_back(filter);}

  class Particle{
  public:
    Particle() :
      fPt(-99), fEta(-99), fPhi(-99), fCharge(-99), fPt_smeared(0.), fEta_smeared(0.), fPhi_smeared(0.), fTrackID(0), fMotherID(0), fGrandMotherID(0), fMCSignalPair(false), fULSSignalPair(false), isMCSignal_primary(), isMCSignal_secondary(), isReconstructed_primary(), isReconstructed_secondary() {}
    Particle(double pt, double eta, double phi, short charge) :
      fPt(pt), fEta(eta), fPhi(phi), fCharge(charge), fPt_smeared(0.), fEta_smeared(0.), fPhi_smeared(0.), fTrackID(0), fMotherID(0), fGrandMotherID(0), fMCSignalPair(false), fULSSignalPair(false), isMCSignal_primary(), isMCSignal_secondary(), isReconstructed_primary(), isReconstructed_secondary() {}

    void SetTrackID(int id) {fTrackID = id;}
    void SetMotherID(int id) {fMotherID = id;}
    void SetGrandMotherID(int id) {fGrandMotherID = id;}
    void SetMCSignalPair (bool value) {fMCSignalPair = value;}
    void SetULSSignalPair(bool value) {fULSSignalPair = value;}

    int  GetTrackID() {return fTrackID;}
    int  GetMotherID() {return fMotherID;}
    int  GetGrandMotherID() {return fGrandMotherID;}
    bool GetMCSignalPair() {return fMCSignalPair;}
    bool GetULSSignalPair() {return fULSSignalPair;}

    double  fPt;
    double  fEta;
    double  fPhi;
    short   fCharge;
    double  fPt_smeared;
    double  fEta_smeared;
    double  fPhi_smeared;
    int     fTrackID;
    int     fMotherID;
    int     fGrandMotherID;
    bool    fMCSignalPair;
    bool    fULSSignalPair;
    std::vector<Bool_t> isMCSignal_primary;
    std::vector<Bool_t> isMCSignal_secondary;
    std::vector<Bool_t> isReconstructed_primary;
    std::vector<Bool_t> isReconstructed_secondary;
  };

  class TwoPair{
  public:
    TwoPair() :
      fPt(-99), fEta(-99), fPhi(-99), fMass(-99), fCharge(-99), fDaughterTrackID_1(0), fDaughterTrackID_2(0),fV0ID(0), fV0Status(0), fMCTwoSignal_acc_prim(), fMCTwoSignal_acc_sec(), fFirstPartIsReconstructed(), fSecondPartIsReconstructed(), isReconstructed_primary(), isReconstructed_secondary() {}
    TwoPair(double pt, double eta, double phi, double mass, short charge) :
      fPt(pt), fEta(eta), fPhi(phi), fMass(mass), fCharge(charge), fDaughterTrackID_1(0), fDaughterTrackID_2(0),fV0ID(0), fV0Status(0), fMCTwoSignal_acc_prim(), fMCTwoSignal_acc_sec(), fFirstPartIsReconstructed(), fSecondPartIsReconstructed(), isReconstructed_primary(), isReconstructed_secondary(){}

    void SetMCTwoSignal_acc_prim (std::vector<Bool_t> vec) {fMCTwoSignal_acc_prim = vec;}
    void SetMCTwoSignal_acc_sec  (std::vector<Bool_t> vec) {fMCTwoSignal_acc_sec = vec;}
    void SetDaughterTrackID(int label1, int label2) {fDaughterTrackID_1 = label1; fDaughterTrackID_2 = label2;}  // first: neg track, second: pos track
    void SetV0ID(int iV0) {fV0ID=iV0;}
    void SetV0Status(bool V0Status) {fV0Status=V0Status;}
    void SetDauthersAreReconstructed(std::vector<Bool_t> vec1, std::vector<Bool_t> vec2) {fFirstPartIsReconstructed = vec1, fSecondPartIsReconstructed = vec2;}

    std::vector<Bool_t> GetMCTwoSignal_acc_prim () {return fMCTwoSignal_acc_prim;}
    std::vector<Bool_t> GetMCTwoSignal_acc_sec  () {return fMCTwoSignal_acc_sec;}
    int GetFirstDaughter() {return fDaughterTrackID_1;}
    int GetSecondDaughter() {return fDaughterTrackID_2;}
    int GetV0ID() {return fV0ID;}
    int GetV0Status() {return fV0Status;}

    double  fPt;
    double  fEta;
    double  fPhi;
    double  fMass;
    short   fCharge;
    int fDaughterTrackID_1;
    int fDaughterTrackID_2;
    int fV0ID;
    bool fV0Status;
    std::vector<Bool_t> fMCTwoSignal_acc_prim;
    std::vector<Bool_t> fMCTwoSignal_acc_sec;
    std::vector<Bool_t> fFirstPartIsReconstructed;
    std::vector<Bool_t> fSecondPartIsReconstructed;
    std::vector<Bool_t> isReconstructed_primary;
    std::vector<Bool_t> isReconstructed_secondary;

  };

private:
  enum {kAllEvents=0, kPhysicsSelectionEvents, kFilteredEvents , kCentralityEvents, kLastBin};

  void    SetBinsLinear(const std::string variable, const double min, const double max, const unsigned int steps);

  void    SetPIDResponse(AliPIDResponse *fPIDRespIn)        {fPIDResponse = fPIDRespIn;}
  void    CheckSinglePrimaryLegMCsignals(std::vector<Bool_t>& vec, const int track);
  void    CheckSingleSecondaryLegMCsignals(std::vector<Bool_t>& vec, const int track);
  void    CheckPairMCsignals(std::vector<Bool_t>& vec, AliVParticle* part1, AliVParticle* part2);
  bool    CheckGenerator(int trackID, std::vector<unsigned int> vecHashes);
  void    CheckIfFromMotherWithDielectronAsDaughter(Particle& part);
  Bool_t  CheckIfOneIsTrue(std::vector<Bool_t>& vec);
  Bool_t  CheckIfOneIsTrue(std::vector<Bool_t>& vec, std::vector<Bool_t>& vec1);

  Particle    CreateParticle(AliVParticle* part);

  void    CreateSupportHistos();

  // Function to do reconstructed two pairing and filling histogramms
  void   DoGenAndGenSmearTwoPairing(std::vector<Particle>* vec_negParticle, std::vector<Particle>* vec_posParticle, Bool_t PartPrimary, Bool_t SmearedPair, double centralityWeight);
  void   DoRecTwoPairing(std::vector<Particle> fRecNegPart, std::vector<Particle> fRecPosPart, std::vector<AliDielectronSignalMC> fPairMCSignal, Bool_t PartPrimary, double centralityWeight);
  void   DoRecTwoPairingV0(std::vector<AliDielectronSignalMC> fPairMCSignal);
  void   DoFourPairing(std::vector<TwoPair> fPairVec_primary, std::vector<TwoPair> fPairVec_secondary, Bool_t ReconstructedPair, Bool_t SmearedPair, Bool_t PrimSecPairing, double centralityWeight);
  void   DoFourPreFilter(std::vector<TwoPair>* fPairVec_primary, std::vector<TwoPair>* fPairVec_secondary);
  void   ApplyStandardCutsAndFillHists(std::vector<TwoPair>* fPairVec, std::vector<AliAnalysisFilter*> fTrackCuts, Bool_t TrackCuts, Bool_t PairPrimary, double centralityWeight);

  void    FillTrackHistograms_Primary(AliVParticle* track, AliVParticle* mcTrack, int iMCSignal, int iCutList);
  void    FillTrackHistograms_Secondary(AliVParticle* track, AliVParticle* mcTrack, int iMCSignal, int iCutList);
  void    FillPairHistograms_Secondary(AliDielectronPair* pair, int iCutList, int iMCSignal);

  TLorentzVector ApplyResolution(double pt, double eta, double phi, short ch);
  Double_t GetSmearing(TObjArray *arr, Double_t x);

  double GetWeight(Particle part1, Particle part2, double motherpt);

  AliAnalysisCuts*  fEventFilter; // event filter

  bool   fdebug;  // debug variable

  Bool_t run1analysis;

  TFile* fResoFile;
  std::string fResoFilename;
  std::string fResoFilenameFromAlien;
  TObjArray* fArrResoPt;
  TObjArray* fArrResoEta;
  TObjArray* fArrResoPhi_Pos;
  TObjArray* fArrResoPhi_Neg;

  TList* fOutputList;
  TList* fSingleElectronList;
  TList* fGeneratedPrimaryList;
  TList* fGeneratedSecondaryList;
  TList* fGeneratedSmearedPrimaryList;
  TList* fGeneratedSmearedSecondaryList;
  TList* fRecPrimaryList;
  TList* fRecSecondaryList;
  TList* fGeneratedPrimaryPairsList;
  TList* fGeneratedSecondaryPairsList;
  TList* fGeneratedSmearedPrimaryPairsList;
  TList* fGeneratedSmearedSecondaryPairsList;
  TList* fPairList;
  TList* fFourPairList_PrimSec;
  TList* fFourPairList_SecSec;
  TList* fGeneratedFourPairsList_PrimSec;
  TList* fGeneratedFourPairsList_SecSec;
  TList* fGeneratedSmearedFourPairsList_PrimSec;
  TList* fGeneratedSmearedFourPairsList_SecSec;
  TList* fResolutionList;

  TH2D* fPGen_DeltaP;
  TH2D* fPGen_PrecOverPGen;
  TH2D* fPtGen_DeltaPt;
  TH2D* fPtGen_DeltaPtOverPtGen;
  TH2D* fPtGen_PtRecOverPtGen;
  TH2D* fPtGen_DeltaPt_wGenSmeared;
  TH2D* fPtGen_DeltaPtOverPtGen_wGenSmeared;
  TH2D* fPtGen_PtRecOverPtGen_wGenSmeared;
  TH2D* fPGen_DeltaEta;
  TH2D* fPtGen_DeltaEta;
  TH2D* fPGen_DeltaTheta;
  TH2D* fPGen_DeltaPhi_Ele;
  TH2D* fPGen_DeltaPhi_Pos;
  TH2D* fPtGen_DeltaPhi_Ele;
  TH2D* fPtGen_DeltaPhi_Pos;
  TH2D* fThetaGen_DeltaTheta;
  TH2D* fPhiGen_DeltaPhi;

  std::vector<double> fPtBins;
  std::vector<double> fEtaBins;
  std::vector<double> fPhiBins;
  std::vector<double> fThetaBins;
  std::vector<double> fResolutionDeltaPtBins;
  std::vector<double> fResolutionRelPtBins;
  std::vector<double> fResolutionEtaBins;
  std::vector<double> fResolutionPhiBins;
  std::vector<double> fResolutionThetaBins;
  std::vector<double> fMassBins;
  std::vector<double> fPairPtBins;

  double  fPtMin; // Kinematic cut for pairing
  double  fPtMax; // Kinematic cut for pairing
  double  fEtaMin; // Kinematic cut for pairing
  double  fEtaMax; // Kinematic cut for pairing

  double  fPtMinGen;
  double  fPtMaxGen;
  double  fEtaMinGen;
  double  fEtaMaxGen;

  double fLowerMassCutPrimaries; // Mass cut for primary pair
  double fUpperMassCutPrimaries; // Mass cut for primary pair
  double fMassCutSecondaries; // Mass cut for secondary pair
  double fUpperPrimSecPreFilterMass; // Prefilter mass cut for four pair with prim and sec pairs
  double fLowerPrimSecPreFilterMass; // Prefilter mass cut for four pair with prim and sec pairs
  double fUpperSecSecPreFilterMass;  // Prefilter mass cut for four pair with sec and sec pairs
  double fLowerSecSecPreFilterMass;  // Prefilter mass cut for four pair with sec and sec pairs

  bool   fV0OnFlyStatus;

  std::vector<AliDielectronSignalMC> fSinglePrimaryLegMCSignal;
  std::vector<AliDielectronSignalMC> fSingleSecondaryLegMCSignal;
  std::vector<AliDielectronSignalMC> fPrimaryPairMCSignal;
  std::vector<AliDielectronSignalMC> fSecondaryPairMCSignal;
  std::vector<AliDielectronSignalMC> fFourPairMCSignal_PrimSec;
  std::vector<AliDielectronSignalMC> fFourPairMCSignal_SecSec;
  std::vector<bool> fPrimaryDielectronPairNotFromSameMother; // this is used to get electrons from charmed mesons in a environment where GEANT is doing the decay of D mesons, like in LHC18b5a
  std::vector<bool> fSecondaryDielectronPairNotFromSameMother; // this is used to get electrons from charmed mesons in a environment where GEANT is doing the decay of D mesons, like in LHC18b5a

  TString fGeneratorName;
  TString fGeneratorMCSignalName;
  TString fGeneratorULSSignalName;
  std::vector<unsigned int> fGeneratorHashs;
  std::vector<unsigned int> fGeneratorMCSignalHashs;
  std::vector<unsigned int> fGeneratorULSSignalHashs;

  AliPIDResponse* fPIDResponse;
  AliVEvent*      fEvent;
  AliMCEvent*     fMC;
  AliVTrack*      fTrack;
  Bool_t          isAOD;

  Bool_t fSelectPhysics;
  Int_t  fTriggerMask;
  std::vector<AliAnalysisFilter*> fTrackCuts_primary_PreFilter;
  std::vector<AliAnalysisFilter*> fTrackCuts_primary_standard;
  std::vector<AliAnalysisFilter*> fTrackCuts_secondary_PreFilter;
  std::vector<AliAnalysisFilter*> fTrackCuts_secondary_standard;
  std::vector<AliAnalysisFilter*> fPairCuts_primary;
  std::vector<AliAnalysisFilter*> fPairCuts_secondary_PreFilter;
  std::vector<AliAnalysisFilter*> fPairCuts_secondary_standard;
  TBits*  fUsedVars;                // used variables by AliDielectronVarManager

  int fSupportMCSignal; // Setting for which the support histograms are filled
  int fSupportCutsetting; // Setting for which the support histograms are filled

  TH1F* fHistEvents;
  TH1F* fHistEventStat;
  TH1F* fHistCentrality;
  TH1F* fHistVertex;
  TH1F* fHistVertexContibutors;
  TH1F* fHistNTracks;
  Double_t fMinCentrality;
  Double_t fMaxCentrality;

  TFile* fCentralityFile;
  std::string fCentralityFilename;
  TH1F* fHistCentralityCorrection;
  TList* fOutputListSupportHistos;

  std::vector<TList*> fTrackCutListVecPrim;    // Vector filled with each applied track primary cutsetting
  std::vector<TList*> fTrackCutListVecSec;     // Vector filled with each applied track secondary cutsetting
  std::vector<TList*> fPairCutListVecSec;      // Vector filled with each applied pair secondary cutsetting
  std::vector<TList*> fFourPairCutListVec;     // Vector filled with each applied four pair cutsetting

  std::vector<TH3D*> fHistGenPrimaryPosPart;
  std::vector<TH3D*> fHistGenPrimaryNegPart;
  std::vector<TH3D*> fHistGenSecondaryPosPart;
  std::vector<TH3D*> fHistGenSecondaryNegPart;
  std::vector<TH3D*> fHistGenSmearedPrimaryPosPart;
  std::vector<TH3D*> fHistGenSmearedPrimaryNegPart;
  std::vector<TH3D*> fHistGenSmearedSecondaryPosPart;
  std::vector<TH3D*> fHistGenSmearedSecondaryNegPart;
  std::vector<TH3D*> fHistRecPrimaryPosPart;
  std::vector<TH3D*> fHistRecPrimaryNegPart;
  std::vector<TH3D*> fHistRecSecondaryPosPart;
  std::vector<TH3D*> fHistRecSecondaryNegPart;

  std::vector<TH2D*> fHistGenPrimaryPair;
  std::vector<TH2D*> fHistGenSecondaryPair;
  std::vector<TH2D*> fHistGenSmearedPrimaryPair;
  std::vector<TH2D*> fHistGenSmearedSecondaryPair;
  std::vector<TH2D*> fHistRecPrimaryPair;
  std::vector<TH2D*> fHistRecSecondaryPair;
  std::vector<TH2D*> fHistGenFourPair_PrimSec;
  std::vector<TH2D*> fHistGenFourPair_SecSec;
  std::vector<TH2D*> fHistGenSmearedFourPair_PrimSec;
  std::vector<TH2D*> fHistGenSmearedFourPair_SecSec;
  std::vector<TH2D*> fHistRecFourPair_PrimSec;
  std::vector<TH2D*> fHistRecFourPair_SecSec;

  std::vector<TH2D*> fVecHistPrefilters;

  bool fWriteLegsFromPair;
  double fPtMinLegsFromPair;
  double fPtMaxLegsFromPair;
  double fEtaMinLegsFromPair;
  double fEtaMaxLegsFromPair;
  double fPhiMinLegsFromPair;
  double fPhiMaxLegsFromPair;
  double fOpAngleMinLegsFromPair;
  double fOpAngleMaxLegsFromPair;
  int fPtNBinsLegsFromPair;
  int fEtaNBinsLegsFromPair;
  int fPhiNBinsLegsFromPair;
  int fOpAngleNBinsLegsFromPair;
  std::vector<THnSparseF*> fTHnSparseGenSmearedLegsFromPrimaryPair;
  std::vector<THnSparseF*> fTHnSparseGenSmearedLegsFromSecondaryPair;
  // std::vector<THnSparseF*> fTHnSparseRecLegsFromPair;
  std::vector<THnSparseF*> fTHnSparseRecLegsFromPrimaryPair;
  std::vector<THnSparseF*> fTHnSparseRecLegsFromSecondaryPair;

  Bool_t fDoPairing;
  Bool_t fDoFourPairing;
  Bool_t fUsePreFilter;
  Bool_t fUseSecPreFilter;
  Bool_t fDoMassCut;
  Bool_t fPhotonMass;
  Bool_t fAnalyseDalitz;
  Bool_t fAnalyseGammaGamma;
  // Bool_t fDoULSandLS;

  std::vector<Particle> fGenNegPart_primary;
  std::vector<Particle> fGenPosPart_primary;
  std::vector<Particle> fGenNegPart_secondary;
  std::vector<Particle> fGenPosPart_secondary;
  std::vector<Particle> fGenSmearedNegPart_primary;
  std::vector<Particle> fGenSmearedPosPart_primary;
  std::vector<Particle> fGenSmearedNegPart_secondary;
  std::vector<Particle> fGenSmearedPosPart_secondary;
  std::vector<Particle> fRecNegPart_primary;
  std::vector<Particle> fRecPosPart_primary;
  std::vector<Particle> fRecNegPart_secondary;
  std::vector<Particle> fRecPosPart_secondary;

  std::vector<TwoPair>  fGenPairVec_primary;
  std::vector<TwoPair>  fGenPairVec_secondary;
  std::vector<TwoPair>  fGenSmearedPairVec_primary;
  std::vector<TwoPair>  fGenSmearedPairVec_secondary;
  std::vector<TwoPair>  fRecPairVec_primary;
  std::vector<TwoPair>  fRecPairVec_secondary;
  std::vector<TwoPair>  fRecV0Pair;

  std::vector<Int_t> fPreFilter_BadTracksLabel_primary;

  bool fDoCocktailWeighting;
  std::string fCocktailFilename;
  std::string fCocktailFilenameFromAlien;
  TFile* fCocktailFile;
  TH1F* fPtPion;
  TH1F* fPtEta;
  TH1F* fPtEtaPrime;
  TH1F* fPtRho;
  TH1F* fPtOmega;
  TH1F* fPtPhi;
  TH1F* fPtJPsi;

  TH1* fPostPIDCntrdCorrTPC;     // post pid correction object for centroids in TPC
  TH1* fPostPIDWdthCorrTPC;      // post pid correction object for widths in TPC
  TH1* fPostPIDCntrdCorrITS;     // post pid correction object for centroids in ITS
  TH1* fPostPIDWdthCorrITS;      // post pid correction object for widths in ITS
  TH1* fPostPIDCntrdCorrTOF;     // post pid correction object for centroids in TOF
  TH1* fPostPIDWdthCorrTOF;      // post pid correction object for widths in TOF

  AliAnalysisTaskEtaReconstruction(const AliAnalysisTaskEtaReconstruction&); // not implemented
  AliAnalysisTaskEtaReconstruction& operator=(const AliAnalysisTaskEtaReconstruction&); // not implemented

  ClassDef(AliAnalysisTaskEtaReconstruction, 1);
};

# endif


text:
layout: doc-page
title: "Union Types"
nightlyOf: https://docs.scala-lang.org/scala3/reference/new-types/union-types.html
---

A union type `A | B` has as values all values of type `A` and also all values of type `B`.

```scala
case class UserName(name: String)
case class Password(hash: Hash)

def help(id: UserName | Password) =
  val user = id match
    case UserName(name) => lookupName(name)
    case Password(hash) => lookupPassword(hash)
  ...
```

Union types are duals of intersection types. `|` is _commutative_:
`A | B` is the same type as `B | A`.

The compiler will assign a union type to an expression only if such a
type is explicitly given. This can be seen in the following [REPL](https://docs.scala-lang.org/overviews/repl/overview.html) transcript:

```scala
scala> val password = Password(123)
val password: Password = Password(123)

scala> val name = UserName("Eve")
val name: UserName = UserName(Eve)

scala> if true then name else password
val res2: Object = UserName(Eve)

scala> val either: Password | UserName = if true then name else password
val either: Password | UserName = UserName(Eve)
```

The type of `res2` is `Object & Product`, which is a supertype of
`UserName` and `Password`, but not the least supertype `Password |
UserName`.  If we want the least supertype, we have to give it
explicitly, as is done for the type of `either`.

[More details](./union-types-spec.md)


text:
package serviceControl

import (
	"reflect"
	"strings"
	"testing"
	"time"

	"github.com/davecgh/go-spew/spew"
	"github.com/golang/protobuf/proto"
	sc "google.golang.org/api/servicecontrol/v1"

	"istio.io/mixer/adapter/serviceControl/config"
	"istio.io/mixer/pkg/adapter"
	"istio.io/mixer/pkg/adapter/test"
)

const testServiceName = "gcp-service"

var (
	defaultParams = &config.Params{ServiceName: testServiceName}
	fakeService   = new(sc.Service)
)

func fakeCreateClient(logger adapter.Logger) (*sc.Service, error) {
	return fakeService, nil
}

func TestAdapterInvariants(t *testing.T) {
	test.AdapterInvariants(Register, t)
}

func TestBuilder_NewAspect(t *testing.T) {
	e := test.NewEnv(t)
	b := builder{adapter.DefaultBuilder{}, fakeCreateClient}
	a, err := b.newAspect(e, defaultParams)
	if err != nil {
		t.Errorf("NewApplicationLogsAspect(env, %s) => unexpected error: %v", defaultParams, err)
	}
	if x := a.serviceName; x != testServiceName {
		t.Errorf("NewApplicationLogsAspect(env, %s) => service name actual: %s", defaultParams, x)
	}

	if a.service != fakeService {
		t.Errorf("NewApplicationLogsAspect(env, %s) => create service control client fail", defaultParams)
	}

	if x := a.logger; x != e.Logger() {
		t.Errorf("NewApplicationLogsAspect(env, %s) mismatching logger actual: %v", defaultParams, x)
	}
}

func TestAspect_Close(t *testing.T) {
	a := new(aspect)
	if err := a.Close(); err != nil {
		t.Errorf("Close() => unexpected error: %v", err)
	}
}

func TestValidateConfig(t *testing.T) {
	cases := []struct {
		conf      proto.Message
		errString string
	}{
		{&config.Params{}, "serviceName"},
		{&config.Params{ServiceName: testServiceName}, ""},
	}
	for idx, c := range cases {
		b := &builder{}
		errString := ""
		if err := b.ValidateConfig(c.conf); err != nil {
			errString = err.Error()
		}
		if !strings.Contains(errString, c.errString) {
			t.Errorf("[%d] b.ValidateConfig(c.conf) = '%s'; want errString containing '%s'", idx, errString, c.errString)
		}
	}
}

func TestAspect_Log(t *testing.T) {
	a := &aspect{
		testServiceName,
		new(sc.Service),
		test.NewEnv(t).Logger(),
	}

	l := adapter.LogEntry{LogName: "istio_log", TextPayload: "text payload", Timestamp: "2017-Jan-09", Severity: adapter.Info}

	tests := []struct {
		input []adapter.LogEntry
		want  sc.ReportRequest
	}{
		{[]adapter.LogEntry{l},
			sc.ReportRequest{
				Operations: []*sc.Operation{
					{
						OperationId:   "test_operation",
						OperationName: "reportLogs",
						StartTime:     "2017-07-01T10:10:05.000000002Z",
						EndTime:       "2017-07-01T10:10:05.000000002Z",
						LogEntries: []*sc.LogEntry{
							{
								Name:        "istio_log",
								Severity:    "INFO",
								TextPayload: "text payload",
								Timestamp:   "2017-Jan-09",
							},
						},
						Labels: map[string]string{"cloud.googleapis.com/location": "global"},
					},
				},
			},
		},
	}

	for _, c := range tests {
		r := a.log(c.input, time.Date(2017, time.July, 1, 10, 10, 5, 2, time.UTC), "test_operation")
		if !reflect.DeepEqual(*r, c.want) {
			t.Errorf("log(%+v) => %v, want %v", c.input, spew.Sdump(*r), spew.Sdump(c.want))
		}
	}
}

func TestAspect_Record(t *testing.T) {
	a := &aspect{
		testServiceName,
		new(sc.Service),
		test.NewEnv(t).Logger(),
	}

	c := int64(123)
	v := adapter.Value{
		Definition: &adapter.MetricDefinition{
			Name: "request_count",
			Kind: adapter.Counter,
		},
		Labels:      make(map[string]interface{}),
		StartTime:   time.Date(2017, time.June, 30, 18, 10, 5, 2, time.UTC),
		EndTime:     time.Date(2017, time.June, 30, 18, 10, 30, 2, time.UTC),
		MetricValue: c,
	}

	v.Labels["response_code"] = 500

	tests := []struct {
		input []adapter.Value
		want  sc.ReportRequest
	}{
		{[]adapter.Value{v},
			sc.ReportRequest{
				Operations: []*sc.Operation{
					{
						OperationId:   "test_operation",
						OperationName: "reportMetrics",
						StartTime:     "2017-07-01T10:10:05.000000002Z",
						EndTime:       "2017-07-01T10:10:05.000000002Z",
						MetricValueSets: []*sc.MetricValueSet{
							{
								MetricName: "serviceruntime.googleapis.com/api/producer/request_count",
								MetricValues: []*sc.MetricValue{
									{
										Labels: map[string]string{
											"/response_code": "500",
										},
										StartTime:  "2017-06-30T18:10:05.000000002Z",
										EndTime:    "2017-06-30T18:10:30.000000002Z",
										Int64Value: &c,
									},
								},
							},
						},
						Labels: map[string]string{"cloud.googleapis.com/location": "global"},
					},
				},
			},
		},
	}

	for _, c := range tests {
		r := a.record(c.input, time.Date(2017, time.July, 1, 10, 10, 5, 2, time.UTC), "test_operation")
		if !reflect.DeepEqual(*r, c.want) {
			t.Errorf("record(%+v) => %v, want %v", c.input, spew.Sdump(*r), spew.Sdump(c.want))
		}
	}
}


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/html; charset=UTF-8" />
        <link rel="stylesheet" type="text/css" href="js/jquery.sidebar/css/codebrowser/sidebar.css" />
        <link rel="stylesheet" type="text/css" href="css/cruisecontrol.css" />
        <link rel="stylesheet" type="text/css" href="css/global.css" />
        <link rel="stylesheet" type="text/css" href="css/review.css" />
        <link rel="stylesheet" type="text/css" href="css/tree.css" />

        <title>PHP CodeBrowser</title>

                    CodeBrowser

Command (1|0)

HelloWorldCommand.php (1|0)

Controller (16|0)

DemoController.php (7|0)

SecuredController.php (7|0)

WelcomeController.php (2|0)

DependencyInjection (4|0)

AcmeDemoExtension.php (4|0)

EventListener (3|0)

ControllerListener.php (3|0)

Form (4|0)

ContactType.php (4|0)

Resources

public

css

demo.css

Tests (3|0)

Controller (3|0)

DemoControllerTest.php (3|0)

Twig (6|0)

Extension (6|0)

DemoExtension.php (6|0)

AcmeDemoBundle.php (1|0)

                        File
                        Errors
                        Warnings
                        Checkstyle
                        PMD

                        Command/HelloWorldCommand.php
                        1
                        0
                        1

                        Controller/DemoController.php
                        7
                        0
                        6
                        1

                        Controller/SecuredController.php
                        7
                        0
                        7

                        Controller/WelcomeController.php
                        2
                        0
                        2

                        DependencyInjection/AcmeDemoExtension.php
                        4
                        0
                        3
                        1

                        EventListener/ControllerListener.php
                        3
                        0
                        3

                        Form/ContactType.php
                        4
                        0
                        3
                        1

                        Resources/public/css/demo.css
                        0
                        0

                        Tests/Controller/DemoControllerTest.php
                        3
                        0
                        3

                        Twig/Extension/DemoExtension.php
                        6
                        0
                        4
                        2

                        AcmeDemoBundle.php
                        1
                        0
                        1


text:
`multierror` is a simple go package that allows you to combine and present multiple errors as a single error.

# Installation
Run `go get github.com/cloudfoundry/multierror`

# How to use

```go
import "github.com/cloudfoundry/multierror"

errors := multierror.MultiError{}

err1 := FirstFuncThatReturnsError()
err2 := SecondFuncThatReturnsError()

errors.Add(err1)
errors.Add(err2)

//You can also add multierror structs and they will be flattened into one struct
errors2 := multierror.MultiError()
errors2.Add(err1)
errors.Add(errors2)

//Returns the errors as an aggregate of all the error messages
errors.Error()
```


text:
from os import path as ospath

from cvtools import io
from cvtools import spm
from cvtools import conf

train_data_path = '../dataset/training'
test_data_path = '../dataset/testing'

# 导入训练数据和测试数据数据
train_data = tuple(io.get_images_name(train_data_path, recursive=True))
test_data = tuple(io.get_images_name(test_data_path, recursive=True))
train_images = io.load_image2ndarray(train_data)
train_labels = io.get_image_label_in_filename(train_data)

mspm = spm.SpatialPyramidMatch(train_images, train_labels)

fullname = io.save_data(mspm, filename="spm.pkl")
print(fullname)


text:
'use strict';

/*
 * Checks for backend health and set "progress" value accordingly
*/
SwaggerEditor.service('BackendHealthCheck', function BackendHealthCheck($http,
  $interval, defaults, Storage) {
  var isHealthy = true;

  this.startChecking = function () {
    if (!defaults.useBackendForStorage) {
      return;
    }
    $interval(function () {
      $http.get(window.location.href).then(
        function onSuccess() {
          isHealthy = true;
        },
        function onError() {
          isHealthy = false;
          Storage.save('progress', -2);
        }
      );
    }, defaults.backendHealthCheckTimeout);
  };

  this.isHealthy = function () {
    return isHealthy;
  };
});


text:
package pathtools

import (
	"path/filepath"
	"strings"
)

// PrefixPaths returns a list of paths consisting of prefix joined with each
// element of paths.  The resulting paths are "clean" in the filepath.Clean
// sense.
func PrefixPaths(paths []string, prefix string) []string {
	result := make([]string, len(paths))
	for i, path := range paths {
		result[i] = filepath.Join(prefix, path)
	}
	return result
}

func ReplaceExtensions(paths []string, extension string) []string {
	result := make([]string, len(paths))
	for i, path := range paths {
		result[i] = ReplaceExtension(path, extension)
	}
	return result
}

// ReplaceExtension changes the file extension. If the file does not have an
// extension, the new extension is appended.
func ReplaceExtension(path string, extension string) string {
	oldExt := filepath.Ext(path)
	if oldExt != "" {
		path = strings.TrimSuffix(path, oldExt)
	}
	return path + "." + extension
}


text:
layout: software
title:  Software
excerpt: "A List Of Software I've Made"
comments: false
redirect_to: https://zeigren.com
---


text:
<?php
namespace GuzzleHttp\Tests\Command\Guzzle\ResponseLocation;

use GuzzleHttp\Command\Guzzle\Parameter;
use GuzzleHttp\Command\Guzzle\ResponseLocation\StatusCodeLocation;
use GuzzleHttp\Command\Result;
use GuzzleHttp\Psr7\Response;
use PHPUnit\Framework\TestCase;

/**
 * @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\StatusCodeLocation
 * @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\AbstractLocation
 */
class StatusCodeLocationTest extends TestCase
{
    /**
     * @group ResponseLocation
     */
    public function testVisitsLocation()
    {
        $location = new StatusCodeLocation();
        $parameter = new Parameter(['name' => 'val']);
        $response = new Response(200);
        $result = new Result();
        $result = $location->visit($result, $response, $parameter);
        $this->assertEquals(200, $result['val']);
    }
}


text:
"use strict";

var _ = require('lodash'),
    turfArea = require('turf-area'),
    App = require('../../../app');

/**
 * This module exports a set of objects for calculating outputs of, and auto-
 * estimatates for, a manual entry field for GWLF-E.
 *
 * Each calculator object has two methods: `toOutput` which given a user
 * value converts it to the expected GMS format, and `getAutoValue` that
 * gets a user-friendly value from the GMS dataModel given a field name.
 *
 * Each manual entry field will be configured with one of these calculators.
 */

module.exports = {
    // Takes the userValue and uses it directly in the output
    Direct: {
        toOutput: function(userValue) {
            return userValue;
        },
        getAutoValue: function(fieldName, dataModel) {
            return dataModel[fieldName];
        },
    },

    // Always returns the same static value
    Static: function(staticValue) {
        return {
            toOutput: function() {
                return staticValue;
            },
            getAutoValue: function() {
                return staticValue;
            },
        };
    },

    // Takes the userValue and makes an array with the value repeated 12 times
    Array12: {
        toOutput: function(userValue) {
            return _.fill(new Array(12), userValue);
        },
        getAutoValue: function(fieldName, dataModel) {
            return dataModel[fieldName][0];
        },
    },

    // Takes the userValue and divides into an array of 12 values evenly
    EqualMonths: {
        toOutput: function(userValue) {
            return _.fill(new Array(12), userValue / 12);
        },
        getAutoValue: function(fieldName, dataModel) {
            return _.sum(dataModel[fieldName]);
        },
    },

    // Takes the user value in million gallons per day and converts it to
    // centimeters per month, and applies it to twelve months. Equivalent to
    // point_source_discharge method in mapshed/calcs.py
    PointSourceDischarge: {
        toOutput: function(userValue) {
            var MONTHDAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
                AREA_SQM = turfArea(App.currentProject.get('area_of_interest')),
                M3_PER_MGAL = 3785.41178,
                CM_PER_M = 100.0;

            return MONTHDAYS.map(function(DAYS_PER_MONTH) {
                return userValue *
                    (DAYS_PER_MONTH * M3_PER_MGAL * CM_PER_M / AREA_SQM);
            });
        },
        getAutoValue: function(fieldName, dataModel) {
            var DAYS_PER_YEAR = 365,
                AREA_SQM = turfArea(App.currentProject.get('area_of_interest')),
                M3_PER_MGAL = 3785.41178,
                CM_PER_M = 100.0;

            return _.sum(dataModel[fieldName]) /
                (DAYS_PER_YEAR * M3_PER_MGAL * CM_PER_M / AREA_SQM);
        },
    },

    // Corresponds to a certain index of a given array. The fieldName must be
    // in the format {ArrayName}__{index}
    ArrayIndex: {
        toOutput: function(userValue) {
            return userValue;
        },
        getAutoValue: function(fieldName, dataModel) {
            var arrayIndex = fieldName.split('__'),
                arrayName = arrayIndex[0],
                index = parseInt(arrayIndex[1]);

            return dataModel[arrayName][index];
        },
    }
};


text:
:mod:`humfrey.elasticsearch` - ElasticSearch integration
========================================================

.. module :: humfrey.elasticsearch

``humfrey`` is able to update `ElasticSearch <http://www.elasticsearch.org/>`_ indices after updating a store. It
also includes a view for users to search the index, and which supports rudimentary faceting.

This app has a dependency on :mod:`humfrey.sparql`, and an optional dependency on :mod:`humfrey.update`.

Overview
--------

ElasticSearch provides for a hierarchy of multiple indexes, and within those various types. This app pushes data for
each store into an index of the same name, and the types are populated from named SPARQL queries, created using the
Django admin site.

Each SPARQL query is associated with one or more stores to be indexed, and zero or more update definitions after which
it will be run. It's also possible to specify a `mapping <http://www.elasticsearch.org/guide/reference/mapping/>`_ to
be PUT to the ElasticSearch server.

Plumbing in
-----------

Add ``"humfrey.elasticsearch"`` to your :setting:`INSTALLED_APPS` setting.

.. setting :: ELASTICSEARCH_SERVER

Add an ELASTICSEARCH_SERVER variable to your settings::

   ELASTICSEARCH_SERVER = {'host': 'localhost',
                           'port': 9200}         # This is the default port

If you plan to use this app with :mod:`humfrey.update`, add the index updater to :setting:`DEPENDENT_TASKS` so that it
is executed after a store update::

   DEPENDENT_TASKS = {'humfrey.update.update': ('humfrey.elasticsearch.update_indexes_after_dataset_update')}

Include the :class:`~humfrey.elasticsearch.views.SearchView` in your urlconf::

   from django.conf.urls.defaults import patterns, url
   from humfrey.elasticsearch import views as elasticsearch_views

   urlpatterns = patterns('',
       url(r'^search/$', elasticsearch_views.SearchView.as_view(), name='search'),
   )

Writing SPARQL queries for the indexes
--------------------------------------

You can add new queries to index using the Django admin interface. Head to *Indexes* under *Elasticsearch*.

The queries you write should result in a resultset (i.e. they are SELECT queries), which are transformed into chunks
of JSON which are then fed to ElasticSearch. How you name your variables is important in the following ways:

* Variable names are split on underscores, which result in nested JSON objects. For example, a variable of
  ``?occupant_label`` will result in ``{"occupant": {"label": "..."}}``.
* Variable names with a final part of ``uri`` (e.g. ``?uri``, ``?occupant_uri``) are treated as the URI for a thing
  and used in links in the output of :class:`~humfrey.elasticsearch.views.SearchView`, and are used to merge results
  to create the final JSON object.
* A variable called ``?description`` will be used
* You can specify that certain keys are repeatable as a whitespace-delimited list in the ``groups`` field of the
  index. For example, if ``occupant`` is repeatable then you'll get ``{"occupant": [{"label": "..."}, ...]}``.

Generally an indexing query will focus on one type of thing in your store (e.g. spatial things, organisations, vending
machines):

.. code-block :: sparql

   SELECT * WHERE {
       ?type_uri rdfs:subClassOf* org:Organization .
       OPTIONAL { ?type_uri rdfs:label ?type_label } .
       ?uri a ?type_uri .
       ...
   }

This will specify a resultset like:

+------------------------+---------------------+---------------------------------+
| ?type_uri              | ?type_label         | ?uri                            |
+========================+=====================+=================================+
| org:Organization       | organization        | http://example.org/id/something |
+------------------------+---------------------+---------------------------------+
| org:FormalOrganization | formal organization | http://example.org/id/acme-corp |
+------------------------+---------------------+---------------------------------+

Which in turn will result in the following two JSON objects being indexed:

.. code-block :: javascript

   {"uri": "http://example.org/id/something",
    "type": {"uri": "org:Organization",
             "label": "organization"}}

   {"uri": "http://example.org/id/something",
    "type": {"uri": "org:Organization",
             "label": "organization"}}

Mappings
--------

API reference
-------------

.. class :: humfrey.elasticsearch.views.SearchView

   .. attribute :: index_name

      Defaults to


text:
import React from 'react';
import { styledMount as mount } from 'spec/helpers/theming';
import thunk from 'redux-thunk';
import configureStore from 'redux-mock-store';
import fetchMock from 'fetch-mock';
import { act } from 'react-dom/test-utils';

import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint';
import DashboardTable from 'src/views/CRUD/welcome/DashboardTable';
import DashboardCard from 'src/views/CRUD/dashboard/DashboardCard';

// store needed for withToasts(DashboardTable)
const mockStore = configureStore([thunk]);
const store = mockStore({});

const dashboardsEndpoint = 'glob:*/api/v1/dashboard/?*';
const dashboardInfoEndpoint = 'glob:*/api/v1/dashboard/_info*';
const dashboardFavEndpoint = 'glob:*/api/v1/dashboard/favorite_status?*';
const mockDashboards = [
  {
    id: 1,
    url: 'url',
    dashboard_title: 'title',
    changed_on_utc: '24 Feb 2014 10:13:14',
  },
];

fetchMock.get(dashboardsEndpoint, { result: mockDashboards });
fetchMock.get(dashboardInfoEndpoint, {
  permissions: ['can_list', 'can_edit', 'can_delete'],
});
fetchMock.get(dashboardFavEndpoint, {
  result: [],
});

describe('DashboardTable', () => {
  const dashboardProps = {
    dashboardFilter: 'Favorite',
    user: {
      userId: '2',
    },
    mine: mockDashboards,
  };
  let wrapper = mount(<DashboardTable store={store} {...dashboardProps} />);

  beforeAll(async () => {
    await waitForComponentToPaint(wrapper);
  });

  it('renders', () => {
    expect(wrapper.find(DashboardTable)).toExist();
  });

  it('render a submenu with clickable tabs and buttons', async () => {
    expect(wrapper.find('SubMenu')).toExist();
    expect(wrapper.find('li.no-router')).toHaveLength(2);
    expect(wrapper.find('Button')).toHaveLength(6);
    act(() => {
      const handler = wrapper.find('li.no-router a').at(0).prop('onClick');
      if (handler) {
        handler({} as any);
      }
    });
    await waitForComponentToPaint(wrapper);
    expect(fetchMock.calls(/dashboard\/\?q/)).toHaveLength(1);
  });

  it('render DashboardCard', () => {
    expect(wrapper.find(DashboardCard)).toExist();
  });

  it('display EmptyState if there is no data', async () => {
    await act(async () => {
      wrapper = mount(
        <DashboardTable
          dashboardFilter="Mine"
          user={{ userId: '2' }}
          mine={[]}
          store={store}
        />,
      );
    });

    expect(wrapper.find('EmptyState')).toExist();
  });
});


text:
name: combinerawtransaction
btcversion: 23.0.0
btcgroup: rawtransactions
permalink: en/doc/23.0.0/rpc/rawtransactions/combinerawtransaction/
---

combinerawtransaction ["hexstring",...]

Combine multiple partially signed transactions into one transaction.
The combined transaction may be another partially signed transaction or a
fully signed transaction.

Arguments:
1. txs                 (json array, required) The hex strings of partially signed transactions
     [
       "hexstring",    (string) A hex-encoded raw transaction
       ...
     ]

Result:
"str"    (string) The hex-encoded raw transaction with signature(s)

Examples:
> bitcoin-cli combinerawtransaction '["myhex1", "myhex2", "myhex3"]'


text:
CREATE TABLE remotes (
    id VARCHAR(16) NOT NULL PRIMARY KEY,
    org_id VARCHAR(16) NOT NULL,
    name TEXT NOT NULL,
    description TEXT,
    remote_url TEXT NOT NULL,
    remote_api_token TEXT NOT NULL,
    remote_org_id VARCHAR(16) NOT NULL,
    allow_insecure_tls BOOLEAN NOT NULL,
    created_at TIMESTAMP NOT NULL,
    updated_at TIMESTAMP NOT NULL,

    CONSTRAINT remotes_uniq_orgid_name UNIQUE (org_id, name)
);

-- Create indexes on lookup patterns we expect to be common
CREATE INDEX idx_remote_url_per_org ON remotes (org_id, remote_url);


text:
'use strict';

angular.module('core').controller('DeadlinesController', ['$scope', '$stateParams','$location', 'Deadlines',function($scope, $stateParams, $location, Deadlines) {
  $scope.find = function() {
    $scope.deadlines = Deadlines.query();
  };
	}
]);


text:
package ca.corefacility.bioinformatics.irida.ria.web.projects.settings.dto;

import java.util.Date;

import ca.corefacility.bioinformatics.irida.model.project.Project;

/**
 * Representation of an Associated Project for the project associated projects page.
 */
public class AssociatedProject {
	private String label;
	private Long id;
	private String organism;
	private Date createdDate;
	private boolean isAssociated;

	public AssociatedProject(Project project, boolean isAssociated) {
		this.label = project.getLabel();
		this.id = project.getId();
		this.organism = project.getOrganism();
		this.createdDate = project.getCreatedDate();
		this.isAssociated = isAssociated;
	}

	public String getLabel() {
		return label;
	}

	public Long getId() {
		return id;
	}

	public String getOrganism() {
		return organism;
	}

	public Date getCreatedDate() {
		return createdDate;
	}

	public boolean isAssociated() {
		return isAssociated;
	}
}