text:
<?php

/*
 * This file is part of the overtrue/wechat.
 *
 * (c) overtrue <i@overtrue.me>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

/**
 * Card.php.
 *
 * @author    overtrue <i@overtrue.me>
 * @copyright 2016 overtrue <i@overtrue.me>
 *
 * @see      https://github.com/overtrue
 * @see      http://overtrue.me
 */

namespace EasyWeChat\Card;

use Doctrine\Common\Cache\Cache;
use Doctrine\Common\Cache\FilesystemCache;
use EasyWeChat\Core\AbstractAPI;
use EasyWeChat\Support\Arr;
use Psr\Http\Message\ResponseInterface;

class Card extends AbstractAPI
{
    /**
     * Cache.
     *
     * @var Cache
     */
    protected $cache;

    /**
     * Ticket cache key.
     *
     * @var string
     */
    protected $ticketCacheKey;

    /**
     * Ticket cache prefix.
     *
     * @var string
     */
    protected $ticketCachePrefix = 'overtrue.wechat.card_api_ticket.';

    const API_GET_COLORS = 'https://api.weixin.qq.com/card/getcolors';
    const API_CREATE_CARD = 'https://api.weixin.qq.com/card/create';
    const API_CREATE_QRCODE = 'https://api.weixin.qq.com/card/qrcode/create';
    const API_SHOW_QRCODE = 'https://mp.weixin.qq.com/cgi-bin/showqrcode';
    const API_GET_CARD_TICKET = 'https://api.weixin.qq.com/cgi-bin/ticket/getticket';
    const API_CREATE_LANDING_PAGE = 'https://api.weixin.qq.com/card/landingpage/create';
    const API_DEPOSIT_CODE = 'https://api.weixin.qq.com/card/code/deposit';
    const API_GET_DEPOSIT_COUNT = 'https://api.weixin.qq.com/card/code/getdepositcount';
    const API_CHECK_CODE = 'https://api.weixin.qq.com/card/code/checkcode';
    const API_GET_HTML = 'https://api.weixin.qq.com/card/mpnews/gethtml';
    const API_SET_TEST_WHITE_LIST = 'https://api.weixin.qq.com/card/testwhitelist/set';
    const API_GET_CODE = 'https://api.weixin.qq.com/card/code/get';
    const API_CONSUME_CARD = 'https://api.weixin.qq.com/card/code/consume';
    const API_DECRYPT_CODE = 'https://api.weixin.qq.com/card/code/decrypt';
    const API_GET_CARD_LIST = 'https://api.weixin.qq.com/card/user/getcardlist';
    const API_GET_CARD = 'https://api.weixin.qq.com/card/get';
    const API_LIST_CARD = 'https://api.weixin.qq.com/card/batchget';
    const API_UPDATE_CARD = 'https://api.weixin.qq.com/card/update';
    const API_SET_PAY_CELL = 'https://api.weixin.qq.com/card/paycell/set';
    const API_MODIFY_STOCK = 'https://api.weixin.qq.com/card/modifystock';
    const API_UPDATE_CODE = 'https://api.weixin.qq.com/card/code/update';
    const API_DELETE_CARD = 'https://api.weixin.qq.com/card/delete';
    const API_DISABLE_CARD = 'https://api.weixin.qq.com/card/code/unavailable';
    const API_ACTIVATE_MEMBER_CARD = 'https://api.weixin.qq.com/card/membercard/activate';
    const API_ACTIVATE_MEMBER_USER_FORM = 'https://api.weixin.qq.com/card/membercard/activateuserform/set';
    const API_GET_MEMBER_USER_INFO = 'https://api.weixin.qq.com/card/membercard/userinfo/get';
    const API_UPDATE_MEMBER_CARD_USER = 'https://api.weixin.qq.com/card/membercard/updateuser';
    const API_CREATE_SUB_MERCHANT = 'https://api.weixin.qq.com/card/submerchant/submit';
    const API_UPDATE_SUB_MERCHANT = 'https://api.weixin.qq.com/card/submerchant/update';
    const API_GET_SUB_MERCHANT = 'https://api.weixin.qq.com/card/submerchant/get';
    const API_LIST_SUB_MERCHANT = 'https://api.weixin.qq.com/card/submerchant/batchget';
    const API_GET_CATEGORIES = 'https://api.weixin.qq.com/card/getapplyprotocol';
    const API_ACTIVATE_GENERAL_CARD = 'https://api.weixin.qq.com/card/generalcard/activate';
    const API_UPDATE_GENERAL_CARD_USER = 'https://api.weixin.qq.com/card/generalcard/updateuser';

    /**
     * 获取卡券颜色.
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function getColors()
    {
        return $this->parseJSON('get', [self::API_GET_COLORS]);
    }

    /**
     * 创建卡券.
     *
     * @param string $cardType
     * @param array  $baseInfo
     * @param array  $especial
     * @param array  $advancedInfo
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function create($cardType = 'member_card', array $baseInfo = [], array $especial = [], array $advancedInfo = [])
    {
        $params = [
            'card' => [
                'card_type' => strtoupper($cardType),
                strtolower($cardType) => array_merge(['base_info' => $baseInfo], $especial, ['advanced_info' => $advancedInfo]),
            ],
        ];

        return $this->parseJSON('json', [self::API_CREATE_CARD, $params]);
    }

    /**
     * 创建二维码.
     *
     * @param array $cards
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function QRCode(array $cards = [])
    {
        return $this->parseJSON('json', [self::API_CREATE_QRCODE, $cards]);
    }

    /**
     * ticket 换取二维码图片.
     *
     * @param string $ticket
     *
     * @return array
     */
    public function showQRCode($ticket = null)
    {
        $params = [
            'ticket' => $ticket,
        ];

        $http = $this->getHttp();

        /** @var ResponseInterface $response */
        $response = $http->get(self::API_SHOW_QRCODE, $params);

        return [
            'status' => $response->getStatusCode(),
            'reason' => $response->getReasonPhrase(),
            'headers' => $response->getHeaders(),
            'body' => strval($response->getBody()),
            'url' => self::API_SHOW_QRCODE.'?'.http_build_query($params),
        ];
    }

    /**
     * 通过ticket换取二维码 链接.
     *
     * @param string $ticket
     *
     * @return string
     */
    public function getQRCodeUrl($ticket)
    {
        return self::API_SHOW_QRCODE.'?ticket='.$ticket;
    }

    /**
     * 获取 卡券 Api_ticket.
     *
     * @param bool $refresh 是否强制刷新
     *
     * @return string $apiTicket
     */
    public function getAPITicket($refresh = false)
    {
        $key = $this->getTicketCacheKey();

        $ticket = $this->getCache()->fetch($key);

        if (!$ticket || $refresh) {
            $result = $this->parseJSON('get', [self::API_GET_CARD_TICKET, ['type' => 'wx_card']]);

            $this->getCache()->save($key, $result['ticket'], $result['expires_in'] - 500);

            return $result['ticket'];
        }

        return $ticket;
    }

    /**
     * 微信卡券:JSAPI 卡券发放.
     *
     * @param array $cards
     *
     * @return string
     */
    public function jsConfigForAssign(array $cards)
    {
        return json_encode(array_map(function ($card) {
            return $this->attachExtension($card['card_id'], $card);
        }, $cards));
    }

    /**
     * 生成 js添加到卡包 需要的 card_list 项.
     *
     * @param string $cardId
     * @param array  $extension
     *
     * @return string
     */
    public function attachExtension($cardId, array $extension = [])
    {
        $timestamp = time();
        $ext = [
            'code' => Arr::get($extension, 'code'),
            'openid' => Arr::get($extension, 'openid', Arr::get($extension, 'open_id')),
            'timestamp' => $timestamp,
            'outer_id' => Arr::get($extension, 'outer_id'),
            'balance' => Arr::get($extension, 'balance'),
            'fixed_begintimestamp' => Arr::get($extension, 'fixed_begintimestamp'),
            'outer_str' => Arr::get($extension, 'outer_str'),
        ];
        $ext['signature'] = $this->getSignature(
            $this->getAPITicket(),
            $timestamp,
            $cardId,
            $ext['code'],
            $ext['openid'],
            $ext['balance']
        );

        return [
            'cardId' => $cardId,
            'cardExt' => json_encode($ext),
        ];
    }

    /**
     * 生成签名.
     *
     * @return string
     */
    public function getSignature()
    {
        $params = func_get_args();
        sort($params, SORT_STRING);

        return sha1(implode($params));
    }

    /**
     * 创建货架接口.
     *
     * @param string $banner
     * @param string $pageTitle
     * @param bool   $canShare
     * @param string $scene     [SCENE_NEAR_BY 附近,SCENE_MENU 自定义菜单,SCENE_QRCODE 二维码,SCENE_ARTICLE 公众号文章,
     *                          SCENE_H5 h5页面,SCENE_IVR 自动回复,SCENE_CARD_CUSTOM_CELL 卡券自定义cell]
     * @param array  $cardList
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function createLandingPage($banner, $pageTitle, $canShare, $scene, $cardList)
    {
        $params = [
            'banner' => $banner,
            'page_title' => $pageTitle,
            'can_share' => $canShare,
            'scene' => $scene,
            'card_list' => $cardList,
        ];

        return $this->parseJSON('json', [self::API_CREATE_LANDING_PAGE, $params]);
    }

    /**
     * 导入code接口.
     *
     * @param string $cardId
     * @param array  $code
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function deposit($cardId, $code)
    {
        $params = [
            'card_id' => $cardId,
            'code' => $code,
        ];

        return $this->parseJSON('json', [self::API_DEPOSIT_CODE, $params]);
    }

    /**
     * 查询导入code数目.
     *
     * @param string $cardId
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function getDepositedCount($cardId)
    {
        $params = [
            'card_id' => $cardId,
        ];

        return $this->parseJSON('json', [self::API_GET_DEPOSIT_COUNT, $params]);
    }

    /**
     * 核查code接口.
     *
     * @param string $cardId
     * @param array  $code
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function checkCode($cardId, $code)
    {
        $params = [
            'card_id' => $cardId,
            'code' => $code,
        ];

        return $this->parseJSON('json', [self::API_CHECK_CODE, $params]);
    }

    /**
     * 查询Code接口.
     *
     * @param string $code
     * @param bool   $checkConsume
     * @param string $cardId
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function getCode($code, $checkConsume, $cardId)
    {
        $params = [
            'code' => $code,
            'check_consume' => $checkConsume,
            'card_id' => $cardId,
        ];

        return $this->parseJSON('json', [self::API_GET_CODE, $params]);
    }

    /**
     * 核销Code接口.
     *
     * @param string $code
     * @param string $cardId
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function consume($code, $cardId = null)
    {
        if (28 === strlen($code) && $cardId && 28 !== strlen($cardId)) {
            list($code, $cardId) = [$cardId, $code];
        }

        $params = [
            'code' => $code,
        ];

        if ($cardId) {
            $params['card_id'] = $cardId;
        }

        return $this->parseJSON('json', [self::API_CONSUME_CARD, $params]);
    }

    /**
     * Code解码接口.
     *
     * @param string $encryptedCode
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function decryptCode($encryptedCode)
    {
        $params = [
            'encrypt_code' => $encryptedCode,
        ];

        return $this->parseJSON('json', [self::API_DECRYPT_CODE, $params]);
    }

    /**
     * 图文消息群发卡券.
     *
     * @param string $cardId
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function getHtml($cardId)
    {
        $params = [
            'card_id' => $cardId,
        ];

        return $this->parseJSON('json', [self::API_GET_HTML, $params]);
    }

    /**
     * 设置测试白名单.
     *
     * @param array $openids
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function setTestWhitelist($openids)
    {
        $params = [
            'openid' => $openids,
        ];

        return $this->parseJSON('json', [self::API_SET_TEST_WHITE_LIST, $params]);
    }

    /**
     * 设置测试白名单(by username).
     *
     * @param array $usernames
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function setTestWhitelistByUsername($usernames)
    {
        $params = [
            'username' => $usernames,
        ];

        return $this->parseJSON('json', [self::API_SET_TEST_WHITE_LIST, $params]);
    }

    /**
     * 获取用户已领取卡券接口.
     *
     * @param string $openid
     * @param string $cardId
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function getUserCards($openid, $cardId = '')
    {
        $params = [
            'openid' => $openid,
            'card_id' => $cardId,
        ];

        return $this->parseJSON('json', [self::API_GET_CARD_LIST, $params]);
    }

    /**
     * 查看卡券详情.
     *
     * @param string $cardId
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function getCard($cardId)
    {
        $params = [
            'card_id' => $cardId,
        ];

        return $this->parseJSON('json', [self::API_GET_CARD, $params]);
    }

    /**
     * 批量查询卡列表.
     *
     * @param int    $offset
     * @param int    $count
     * @param string $statusList
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function lists($offset = 0, $count = 10, $statusList = 'CARD_STATUS_VERIFY_OK')
    {
        $params = [
            'offset' => $offset,
            'count' => $count,
            'status_list' => $statusList,
        ];

        return $this->parseJSON('json', [self::API_LIST_CARD, $params]);
    }

    /**
     * 更改卡券信息接口 and 设置跟随推荐接口.
     *
     * @param string $cardId
     * @param string $type
     * @param array  $baseInfo
     * @param array  $especial
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function update($cardId, $type, $baseInfo = [], $especial = [])
    {
        $card = [];
        $card['card_id'] = $cardId;
        $card[$type] = [];

        $cardInfo = [];
        if ($baseInfo) {
            $cardInfo['base_info'] = $baseInfo;
        }

        $card[$type] = array_merge($cardInfo, $especial);

        return $this->parseJSON('json', [self::API_UPDATE_CARD, $card]);
    }

    /**
     * 设置微信买单接口.
     * 设置买单的 card_id 必须已经配置了门店,否则会报错.
     *
     * @param string $cardId
     * @param bool   $isOpen
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function setPayCell($cardId, $isOpen = true)
    {
        $params = [
            'card_id' => $cardId,
            'is_open' => $isOpen,
        ];

        return $this->parseJSON('json', [self::API_SET_PAY_CELL, $params]);
    }

    /**
     * 增加库存.
     *
     * @param string $cardId
     * @param int    $amount
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function increaseStock($cardId, $amount)
    {
        return $this->updateStock($cardId, $amount, 'increase');
    }

    /**
     * 减少库存.
     *
     * @param string $cardId
     * @param int    $amount
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function reduceStock($cardId, $amount)
    {
        return $this->updateStock($cardId, $amount, 'reduce');
    }

    /**
     * 修改库存接口.
     *
     * @param string $cardId
     * @param int    $amount
     * @param string $action
     *
     * @return \EasyWeChat\Support\Collection
     */
    protected function updateStock($cardId, $amount, $action = 'increase')
    {
        $key = 'increase' === $action ? 'increase_stock_value' : 'reduce_stock_value';
        $params = [
            'card_id' => $cardId,
            $key => abs($amount),
        ];

        return $this->parseJSON('json', [self::API_MODIFY_STOCK, $params]);
    }

    /**
     * 更改Code接口.
     *
     * @param string $code
     * @param string $newCode
     * @param array  $cardId
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function updateCode($code, $newCode, $cardId = [])
    {
        $params = [
            'code' => $code,
            'new_code' => $newCode,
            'card_id' => $cardId,
        ];

        return $this->parseJSON('json', [self::API_UPDATE_CODE, $params]);
    }

    /**
     * 删除卡券接口.
     *
     * @param string $cardId
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function delete($cardId)
    {
        $params = [
            'card_id' => $cardId,
        ];

        return $this->parseJSON('json', [self::API_DELETE_CARD, $params]);
    }

    /**
     * 设置卡券失效.
     *
     * @param string $code
     * @param string $cardId
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function disable($code, $cardId = '')
    {
        $params = [
            'code' => $code,
            'card_id' => $cardId,
        ];

        return $this->parseJSON('json', [self::API_DISABLE_CARD, $params]);
    }

    /**
     * 会员卡接口激活.
     *
     * @param array $info
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function activate($info = [], $cardType = 'member_card')
    {
        if ('general_card' === $cardType) {
            return $this->parseJSON('json', [self::API_ACTIVATE_GENERAL_CARD, $info]);
        }

        return $this->parseJSON('json', [self::API_ACTIVATE_MEMBER_CARD, $info]);
    }

    /**
     * 设置开卡字段接口.
     *
     * @param string $cardId
     * @param array  $requiredForm
     * @param array  $optionalForm
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function activateUserForm($cardId, array $requiredForm = [], array $optionalForm = [])
    {
        $params = array_merge(['card_id' => $cardId], $requiredForm, $optionalForm);

        return $this->parseJSON('json', [self::API_ACTIVATE_MEMBER_USER_FORM, $params]);
    }

    /**
     * 拉取会员信息接口.
     *
     * @param string $cardId
     * @param string $code
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function getMemberCardUser($cardId, $code)
    {
        $params = [
            'card_id' => $cardId,
            'code' => $code,
        ];

        return $this->parseJSON('json', [self::API_GET_MEMBER_USER_INFO, $params]);
    }

    /**
     * 更新会员信息.
     *
     * @param array $params
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function updateMemberCardUser(array $params = [])
    {
        return $this->parseJSON('json', [self::API_UPDATE_MEMBER_CARD_USER, $params]);
    }

    /**
     * 更新通用员信息.
     *
     * @param array $params
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function updateGeneralCardUser(array $params = [])
    {
        return $this->parseJSON('json', [self::API_UPDATE_GENERAL_CARD_USER, $params]);
    }

    /**
     * 添加子商户.
     *
     * @param array $info
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function createSubMerchant(array $info = [])
    {
        $params = [
            'info' => Arr::only($info, [
                'brand_name',
                'logo_url',
                'protocol',
                'end_time',
                'primary_category_id',
                'secondary_category_id',
                'agreement_media_id',
                'operator_media_id',
                'app_id',
            ]),
        ];

        return $this->parseJSON('json', [self::API_CREATE_SUB_MERCHANT, $params]);
    }

    /**
     * 更新子商户.
     *
     * @param int   $merchantId
     * @param array $info
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function updateSubMerchant($merchantId, array $info = [])
    {
        $params = [
            'info' => array_merge(['merchant_id' => $merchantId],
                Arr::only($info, [
                    'brand_name',
                    'logo_url',
                    'protocol',
                    'end_time',
                    'primary_category_id',
                    'secondary_category_id',
                    'agreement_media_id',
                    'operator_media_id',
                    'app_id',
                ])),
        ];

        return $this->parseJSON('json', [self::API_UPDATE_SUB_MERCHANT, $params]);
    }

    /**
     * 获取子商户信息.
     *
     * @param int $merchantId
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function getSubMerchant($merchantId)
    {
        return $this->parseJSON('json', [self::API_GET_SUB_MERCHANT, ['merchant_id' => $merchantId]]);
    }

    /**
     * 批量获取子商户信息.
     *
     * @param int    $beginId
     * @param int    $limit
     * @param string $status
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function listSubMerchants($beginId = 0, $limit = 50, $status = 'CHECKING')
    {
        $params = [
            'begin_id' => $beginId,
            'limit' => $limit,
            'status' => $status,
        ];

        return $this->parseJSON('json', [self::API_LIST_SUB_MERCHANT, $params]);
    }

    /**
     * 卡券开放类目查询接口.
     *
     * @return \EasyWeChat\Support\Collection
     */
    public function getCategories()
    {
        return $this->parseJSON('get', [self::API_GET_CATEGORIES]);
    }

    /**
     * Set cache manager.
     *
     * @param \Doctrine\Common\Cache\Cache $cache
     *
     * @return $this
     */
    public function setCache(Cache $cache)
    {
        $this->cache = $cache;

        return $this;
    }

    /**
     * Return cache manager.
     *
     * @return \Doctrine\Common\Cache\Cache
     */
    public function getCache()
    {
        return $this->cache ?: $this->cache = new FilesystemCache(sys_get_temp_dir());
    }

    /**
     * Set Api_ticket cache prifix.
     *
     * @param string $prefix
     *
     * @return $this
     */
    public function setTicketCachePrefix($prefix)
    {
        $this->ticketCachePrefix = $prefix;

        return $this;
    }

    /**
     * Set Api_ticket cache key.
     *
     * @param string $cacheKey
     *
     * @return $this
     */
    public function setTicketCacheKey($cacheKey)
    {
        $this->ticketCacheKey = $cacheKey;

        return $this;
    }

    /**
     * Get ApiTicket token cache key.
     *
     * @return string
     */
    public function getTicketCacheKey()
    {
        if (is_null($this->ticketCacheKey)) {
            return $this->ticketCachePrefix.$this->getAccessToken()->getAppId();
        }

        return $this->ticketCacheKey;
    }

    /**
     * Set current url.
     *
     * @param string $url
     *
     * @return Card
     */
    public function setUrl($url)
    {
        $this->url = $url;

        return $this;
    }
}


text:
layout: page
title: Mullen Tech Aerospace Award Ceremony
date: 2016-05-24
author: Theresa Kidd
tags: weekly links, java
status: published
summary: Vestibulum felis magna, volutpat et.
banner: images/banner/meeting-01.jpg
booking:
  startDate: 05/31/2019
  endDate: 06/01/2019
  ctyhocn: BGMNYHX
  groupCode: MTAAC
published: true
---
Donec non sapien ac risus auctor aliquam ultrices quis purus. Mauris gravida, felis eget tincidunt vehicula, nisi neque vestibulum orci, et dapibus nulla dolor ut arcu. Vivamus dignissim semper nisl, eu volutpat nisi maximus quis. Sed vulputate est sed libero facilisis maximus. In interdum pharetra risus. Quisque sit amet mi a nunc cursus aliquet id et nisi. Vestibulum et lobortis mauris. Sed vel nulla ligula. Nam blandit semper velit ut dictum. Fusce vel neque luctus, mollis justo varius, porta ligula. Sed accumsan rutrum lacus, eu vestibulum diam suscipit ac. Integer eget vulputate felis, id tristique diam.

* Fusce vel libero sodales, luctus metus ut, porttitor tellus
* Maecenas sit amet augue a nunc sollicitudin tempus
* Duis molestie justo vel tempus faucibus.

Cras nec facilisis lorem. Cras id rhoncus arcu. Phasellus eget enim tristique, accumsan nisi sit amet, bibendum leo. Proin ac justo nec nulla sodales tristique id eget nulla. Fusce vitae maximus nulla. Integer venenatis porta condimentum. Nulla non gravida ex. Sed at orci malesuada, blandit arcu nec, dapibus lacus. Ut volutpat tincidunt lorem, molestie pellentesque nibh pulvinar ac. Mauris lorem libero, facilisis et egestas vel, maximus non quam. Nulla in aliquam est.

redpajama_set_name: RedPajamaGithub


text:
clear
export PROJECT_ID=$(gcloud config get-value project)
#export GOOGLE_APPLICATION_CREDENTIALS="/home/username/.config/gcloud/legacy_credentials/username@googlecloud.corp-partner.google.com/adc.json"

export LOG_WRAP_SPOOL=false

#File with name $INFILE_DSN should present in $GCSDSNURI bucket
#export INFILE=$PWD/bq_export.outfile
export INFILE_DSN=OUTFILE
export INFILE_LRECL=80
export INFILE_BLKSIZE=512

export COPYBOOK=$PWD/bq_export.cp

export BUCKET=$PROJECT_ID-test-storage

export GCSDSNURI=gs://$BUCKET/EXPORT
export SRVHOSTNAME=127.0.0.1
export SRVPORT=51771

export SBT_OPTS=" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"

cd ..
sbt "runMain com.google.cloud.bqsh.Bqsh" << EOF
gsutil cp \
  --project_id=$PROJECT_ID \
  --location="US" \
  --replace \
  --remote \
  --timeOutMinutes=1 \
  gs://$BUCKET/test.orc
EOF

bq load --autodetect \
  --source_format=ORC \
  --replace \
  test.something \
  gs://$BUCKET/test.orc/*


text:
require 'sass/tree/node'

module Sass::Tree
  # A dynamic node representing a Sass `@for` loop.
  #
  # @see Sass::Tree
  class ForNode < Node
    # The name of the loop variable.
    # @return [String]
    attr_reader :var

    # The parse tree for the initial expression.
    # @return [Script::Node]
    attr_reader :from

    # The parse tree for the final expression.
    # @return [Script::Node]
    attr_reader :to

    # Whether to include `to` in the loop or stop just before.
    # @return [Boolean]
    attr_reader :exclusive

    # @param var [String] See \{#var}
    # @param from [Script::Node] See \{#from}
    # @param to [Script::Node] See \{#to}
    # @param exclusive [Boolean] See \{#exclusive}
    def initialize(var, from, to, exclusive)
      @var = var
      @from = from
      @to = to
      @exclusive = exclusive
      super()
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingTop="3dp" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:text="@string/label_me" />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="@android:color/holo_blue_light"
        android:gravity="center_vertical" />

    <!-- Self information -->

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="?android:attr/listPreferredItemHeight"
        android:background="?android:attr/activatedBackgroundIndicator"
        android:padding="3dip" >

        <ImageView
            android:id="@+id/icon"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_marginRight="2dp"
            android:contentDescription="@string/empty"
            android:src="@drawable/machine" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/my_name"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:gravity="center_vertical" />

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:gravity="center_vertical"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/my_status"
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:ellipsize="marquee"
                    android:singleLine="true" />

                <TextView
                    android:id="@+id/my_is_group_owner"
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:ellipsize="marquee"
                    android:singleLine="true" />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:text="@string/label_group" />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="@android:color/holo_blue_light"
        android:gravity="center_vertical" />

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="?android:attr/listPreferredItemHeight"
        android:background="?android:attr/activatedBackgroundIndicator"
        android:padding="3dip" >

        <ImageView
            android:id="@+id/my_g_icon"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_marginRight="2dp"
            android:contentDescription="@string/empty"
            android:src="@drawable/machine" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/my_g_name"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:gravity="center_vertical" />

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:gravity="center_vertical"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/my_g_status"
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:ellipsize="marquee"
                    android:singleLine="true" />

                <TextView
                    android:id="@+id/my_g_is_group_owner"
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:ellipsize="marquee"
                    android:singleLine="true" />
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

    <!-- This is where group member MAC <-> IP values are shown -->

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:text="@string/label_macip" />

    <View
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="@android:color/holo_blue_light"
        android:gravity="center_vertical" />

    <ListView
        android:id="@id/android:list"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:drawSelectorOnTop="false" />

</LinearLayout>


text:
.class public final Landroid/bluetooth/le/AdvertiseSettings$Builder;
.super Ljava/lang/Object;
.source "AdvertiseSettings.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/bluetooth/le/AdvertiseSettings;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x19
    name = "Builder"
.end annotation

# instance fields
.field private mConnectable:Z

.field private mMode:I

.field private mTimeoutMillis:I

.field private mTxPowerLevel:I

# direct methods
.method public constructor <init>()V
    .registers 3

    .prologue
    const/4 v1, 0x0

    .line 158
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 159
    iput v1, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mMode:I

    .line 160
    const/4 v0, 0x2

    iput v0, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mTxPowerLevel:I

    .line 161
    iput v1, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mTimeoutMillis:I

    .line 162
    const/4 v0, 0x1

    iput-boolean v0, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mConnectable:Z

    .line 158
    return-void
.end method

# virtual methods
.method public build()Landroid/bluetooth/le/AdvertiseSettings;
    .registers 7

    .prologue
    .line 231
    new-instance v0, Landroid/bluetooth/le/AdvertiseSettings;

    iget v1, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mMode:I

    iget v2, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mTxPowerLevel:I

    iget-boolean v3, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mConnectable:Z

    iget v4, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mTimeoutMillis:I

    const/4 v5, 0x0

    invoke-direct/range {v0 .. v5}, Landroid/bluetooth/le/AdvertiseSettings;-><init>(IIZILandroid/bluetooth/le/AdvertiseSettings;)V

    return-object v0
.end method

.method public setAdvertiseMode(I)Landroid/bluetooth/le/AdvertiseSettings$Builder;
    .registers 5
    .param p1, "advertiseMode"    # I

    .prologue
    .line 174
    if-ltz p1, :cond_5

    .line 175
    const/4 v0, 0x2

    if-le p1, v0, :cond_1f

    .line 176
    :cond_5
    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "unknown mode "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 178
    :cond_1f
    iput p1, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mMode:I

    .line 179
    return-object p0
.end method

.method public setConnectable(Z)Landroid/bluetooth/le/AdvertiseSettings$Builder;
    .registers 2
    .param p1, "connectable"    # Z

    .prologue
    .line 208
    iput-boolean p1, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mConnectable:Z

    .line 209
    return-object p0
.end method

.method public setTimeout(I)Landroid/bluetooth/le/AdvertiseSettings$Builder;
    .registers 4
    .param p1, "timeoutMillis"    # I

    .prologue
    .line 219
    if-ltz p1, :cond_7

    const v0, 0x2bf20

    if-le p1, v0, :cond_10

    .line 220
    :cond_7
    new-instance v0, Ljava/lang/IllegalArgumentException;

    const-string/jumbo v1, "timeoutMillis invalid (must be 0-180000 milliseconds)"

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 223
    :cond_10
    iput p1, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mTimeoutMillis:I

    .line 224
    return-object p0
.end method

.method public setTxPowerLevel(I)Landroid/bluetooth/le/AdvertiseSettings$Builder;
    .registers 5
    .param p1, "txPowerLevel"    # I

    .prologue
    .line 193
    if-ltz p1, :cond_5

    .line 194
    const/4 v0, 0x3

    if-le p1, v0, :cond_1f

    .line 195
    :cond_5
    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "unknown tx power level "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 197
    :cond_1f
    iput p1, p0, Landroid/bluetooth/le/AdvertiseSettings$Builder;->mTxPowerLevel:I

    .line 198
    return-object p0
.end method


text:
'use strict';
const fs = require('fs');
const exec = require('child_process').exec;
const DocumentationToCompletionsParser = require('./DocumentationToCompletionsParser.js');

function readFile(path) {
    return fs.readFileSync(path, {encoding: 'utf-8'}).trim();
}

const documentationUrls = [
    'http://spark.apache.org/docs/latest/api/python/pyspark.html',
    'http://spark.apache.org/docs/latest/api/python/pyspark.sql.html',
];

const documentations = documentationUrls.map(urls => `./documentation/${urls.split('/').pop()}`);

const cleaningDocumentation = new Promise(resolve => {
    for (const documentation of documentations) {
        if (fs.existsSync(documentation)) {
            fs.unlinkSync(documentation);
        }
    }
    const completions = [];
    resolve(completions);
});

cleaningDocumentation.then((completions) => {
    exec(`wget --directory-prefix ./documentation ${documentationUrls.join(' ')}`, (error, stdout, stderr) => {
        for (const documentation of documentations) {
            const htmlContent = readFile(documentation);
            const parser = new DocumentationToCompletionsParser(htmlContent);
            completions = completions.concat(parser.getCompletions());
        }
        fs.writeFile('completions.json', JSON.stringify({
            PySpark: completions,
        }), 'utf-8');
    });
});


text:
function monitorRunCollectData
global experiment
global MONITOR_DATA

if ~isfield(MONITOR_DATA, 'rxArray') | size(MONITOR_DATA.rxArray,1)<experiment.nodes(experiment.index) |  ~any(MONITOR_DATA.rxArray(experiment.nodes(experiment.index),:))
	experiment.reportCommand = 0;
else
    tmp = find(MONITOR_DATA.rxArray(experiment.nodes(experiment.index),:)==0);
    experiment.reportCommand = tmp(1);
end

feval('peg', experiment.nodes(experiment.index), 'CalamariMonitorReport', experiment.reportCommand, experiment.reportChoice);

% start a timer
disp('Starting Collect Data timer');
delay = 1; %sec
stop(experiment.t);
set(experiment.t, 'TimerFcn', 'monitorCollectDataTimerEvent', 'StartDelay', delay, 'Period', delay, 'ExecutionMode', 'fixedRate');
start(experiment.t);


text:
package almhirt.corex.spray.service

import scala.language.postfixOps
import almhirt.common._
import spray.routing._
import spray.http._
import spray.routing.directives._
import spray.httpx.marshalling.Marshaller
import spray.httpx.unmarshalling.Unmarshaller
import almhirt.akkax._
import almhirt.httpx.spray.marshalling._

trait HttpEventEndpointFactory extends Directives {
  def publish(payload: AnyRef)

  def createEventEndpoint(publish: AnyRef ⇒ Unit)(implicit eventUnmarshaller: Unmarshaller[Event]): RequestContext ⇒ Unit = {

    val putEventDirective = (post) & entity(as[Event])

    putEventDirective {
      event ⇒
        ctx ⇒ {
          publish(event)
          ctx.complete(StatusCodes.Accepted, event.eventId.value.toString())
        }
    }
  }
}


text:
import urllib

import fixtures
import mox
import testtools

from neutronclient.common import constants
from neutronclient.neutron import v2_0 as neutronV2_0
from neutronclient import shell
from neutronclient.v2_0 import client

API_VERSION = "2.0"
FORMAT = 'json'
TOKEN = 'testtoken'
ENDURL = 'localurl'

class FakeStdout:

    def __init__(self):
        self.content = []

    def write(self, text):
        self.content.append(text)

    def make_string(self):
        result = ''
        for line in self.content:
            result = result + line
        return result

class MyResp(object):
    def __init__(self, status):
        self.status = status

class MyApp(object):
    def __init__(self, _stdout):
        self.stdout = _stdout

def end_url(path, query=None, format=FORMAT):
    _url_str = ENDURL + "/v" + API_VERSION + path + "." + format
    return query and _url_str + "?" + query or _url_str

class MyUrlComparator(mox.Comparator):
    def __init__(self, lhs, client):
        self.lhs = lhs
        self.client = client

    def equals(self, rhs):
        return str(self) == rhs

    def __str__(self):
        if self.client and self.client.format != FORMAT:
            lhs_parts = self.lhs.split("?", 1)
            if len(lhs_parts) == 2:
                lhs = ("%s.%s?%s" % (lhs_parts[0][:-4],
                                     self.client.format,
                                     lhs_parts[1]))
            else:
                lhs = ("%s.%s" % (lhs_parts[0][:-4],
                                  self.client.format))
            return lhs
        return self.lhs

    def __repr__(self):
        return str(self)

class MyComparator(mox.Comparator):
    def __init__(self, lhs, client):
        self.lhs = lhs
        self.client = client

    def _com_dict(self, lhs, rhs):
        if len(lhs) != len(rhs):
            return False
        for key, value in lhs.iteritems():
            if key not in rhs:
                return False
            rhs_value = rhs[key]
            if not self._com(value, rhs_value):
                return False
        return True

    def _com_list(self, lhs, rhs):
        if len(lhs) != len(rhs):
            return False
        for lhs_value in lhs:
            if lhs_value not in rhs:
                return False
        return True

    def _com(self, lhs, rhs):
        if lhs is None:
            return rhs is None
        if isinstance(lhs, dict):
            if not isinstance(rhs, dict):
                return False
            return self._com_dict(lhs, rhs)
        if isinstance(lhs, list):
            if not isinstance(rhs, list):
                return False
            return self._com_list(lhs, rhs)
        if isinstance(lhs, tuple):
            if not isinstance(rhs, tuple):
                return False
            return self._com_list(lhs, rhs)
        return lhs == rhs

    def equals(self, rhs):
        if self.client:
            rhs = self.client.deserialize(rhs, 200)
        return self._com(self.lhs, rhs)

    def __repr__(self):
        if self.client:
            return self.client.serialize(self.lhs)
        return str(self.lhs)

class CLITestV20Base(testtools.TestCase):

    format = 'json'
    test_id = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
    id_field = 'id'

    def _find_resourceid(self, client, resource, name_or_id):
        return name_or_id

    def _get_attr_metadata(self):
        return self.metadata
        client.Client.EXTED_PLURALS.update(constants.PLURALS)
        client.Client.EXTED_PLURALS.update({'tags': 'tag'})
        return {'plurals': client.Client.EXTED_PLURALS,
                'xmlns': constants.XML_NS_V20,
                constants.EXT_NS: {'prefix': 'http://xxxx.yy.com'}}

    def setUp(self, plurals={}):
        """Prepare the test environment."""
        super(CLITestV20Base, self).setUp()
        client.Client.EXTED_PLURALS.update(constants.PLURALS)
        client.Client.EXTED_PLURALS.update(plurals)
        self.metadata = {'plurals': client.Client.EXTED_PLURALS,
                         'xmlns': constants.XML_NS_V20,
                         constants.EXT_NS: {'prefix':
                                            'http://xxxx.yy.com'}}
        self.mox = mox.Mox()
        self.endurl = ENDURL
        self.fake_stdout = FakeStdout()
        self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.fake_stdout))
        self.useFixture(fixtures.MonkeyPatch(
            'neutronclient.neutron.v2_0.find_resourceid_by_name_or_id',
            self._find_resourceid))
        self.useFixture(fixtures.MonkeyPatch(
            'neutronclient.v2_0.client.Client.get_attr_metadata',
            self._get_attr_metadata))
        self.client = client.Client(token=TOKEN, endpoint_url=self.endurl)

    def _test_create_resource(self, resource, cmd,
                              name, myid, args,
                              position_names, position_values, tenant_id=None,
                              tags=None, admin_state_up=True, shared=False,
                              extra_body=None, **kwargs):
        self.mox.StubOutWithMock(cmd, "get_client")
        self.mox.StubOutWithMock(self.client.httpclient, "request")
        cmd.get_client().MultipleTimes().AndReturn(self.client)
        non_admin_status_resources = ['subnet', 'floatingip', 'security_group',
                                      'security_group_rule', 'qos_queue',
                                      'network_gateway', 'credential',
                                      'network_profile', 'policy_profile',
                                      'ikepolicy', 'ipsecpolicy',
                                      'metering_label', 'metering_label_rule']
        if (resource in non_admin_status_resources):
            body = {resource: {}, }
        else:
            body = {resource: {'admin_state_up': admin_state_up, }, }
        if tenant_id:
            body[resource].update({'tenant_id': tenant_id})
        if tags:
            body[resource].update({'tags': tags})
        if shared:
            body[resource].update({'shared': shared})
        if extra_body:
            body[resource].update(extra_body)
        body[resource].update(kwargs)

        for i in xrange(len(position_names)):
            body[resource].update({position_names[i]: position_values[i]})
        ress = {resource:
                {self.id_field: myid}, }
        if name:
            ress[resource].update({'name': name})
        self.client.format = self.format
        resstr = self.client.serialize(ress)
        # url method body
        resource_plural = neutronV2_0._get_resource_plural(resource,
                                                           self.client)
        path = getattr(self.client, resource_plural + "_path")
        # Work around for LP #1217791. XML deserializer called from
        # MyComparator does not decodes XML string correctly.
        if self.format == 'json':
            mox_body = MyComparator(body, self.client)
        else:
            mox_body = self.client.serialize(body)
        self.client.httpclient.request(
            end_url(path, format=self.format), 'POST',
            body=mox_body,
            headers=mox.ContainsKeyValue(
                'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr))
        args.extend(['--request-format', self.format])
        self.mox.ReplayAll()
        cmd_parser = cmd.get_parser('create_' + resource)
        shell.run_command(cmd, cmd_parser, args)
        self.mox.VerifyAll()
        self.mox.UnsetStubs()
        _str = self.fake_stdout.make_string()
        self.assertTrue(myid in _str)
        if name:
            self.assertTrue(name in _str)

    def _test_list_columns(self, cmd, resources_collection,
                           resources_out, args=['-f', 'json']):
        self.mox.StubOutWithMock(cmd, "get_client")
        self.mox.StubOutWithMock(self.client.httpclient, "request")
        cmd.get_client().MultipleTimes().AndReturn(self.client)
        self.client.format = self.format
        resstr = self.client.serialize(resources_out)

        path = getattr(self.client, resources_collection + "_path")
        self.client.httpclient.request(
            end_url(path, format=self.format), 'GET',
            body=None,
            headers=mox.ContainsKeyValue(
                'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr))
        args.extend(['--request-format', self.format])
        self.mox.ReplayAll()
        cmd_parser = cmd.get_parser("list_" + resources_collection)
        shell.run_command(cmd, cmd_parser, args)
        self.mox.VerifyAll()
        self.mox.UnsetStubs()

    def _test_list_resources(self, resources, cmd, detail=False, tags=[],
                             fields_1=[], fields_2=[], page_size=None,
                             sort_key=[], sort_dir=[], response_contents=None,
                             base_args=None, path=None):
        self.mox.StubOutWithMock(cmd, "get_client")
        self.mox.StubOutWithMock(self.client.httpclient, "request")
        cmd.get_client().MultipleTimes().AndReturn(self.client)
        if response_contents is None:
            contents = [{self.id_field: 'myid1', },
                        {self.id_field: 'myid2', }, ]
        else:
            contents = response_contents
        reses = {resources: contents}
        self.client.format = self.format
        resstr = self.client.serialize(reses)
        # url method body
        query = ""
        args = base_args if base_args is not None else []
        if detail:
            args.append('-D')
        args.extend(['--request-format', self.format])
        if fields_1:
            for field in fields_1:
                args.append('--fields')
                args.append(field)

        if tags:
            args.append('--')
            args.append("--tag")
        for tag in tags:
            args.append(tag)
            if isinstance(tag, unicode):
                tag = urllib.quote(tag.encode('utf-8'))
            if query:
                query += "&tag=" + tag
            else:
                query = "tag=" + tag
        if (not tags) and fields_2:
            args.append('--')
        if fields_2:
            args.append("--fields")
            for field in fields_2:
                args.append(field)
        if detail:
            query = query and query + '&verbose=True' or 'verbose=True'
        fields_1.extend(fields_2)
        for field in fields_1:
            if query:
                query += "&fields=" + field
            else:
                query = "fields=" + field
        if page_size:
            args.append("--page-size")
            args.append(str(page_size))
            if query:
                query += "&limit=%s" % page_size
            else:
                query = "limit=%s" % page_size
        if sort_key:
            for key in sort_key:
                args.append('--sort-key')
                args.append(key)
                if query:
                    query += '&'
                query += 'sort_key=%s' % key
        if sort_dir:
            len_diff = len(sort_key) - len(sort_dir)
            if len_diff > 0:
                sort_dir += ['asc'] * len_diff
            elif len_diff < 0:
                sort_dir = sort_dir[:len(sort_key)]
            for dir in sort_dir:
                args.append('--sort-dir')
                args.append(dir)
                if query:
                    query += '&'
                query += 'sort_dir=%s' % dir
        if path is None:
            path = getattr(self.client, resources + "_path")
        self.client.httpclient.request(
            MyUrlComparator(end_url(path, query, format=self.format),
                            self.client),
            'GET',
            body=None,
            headers=mox.ContainsKeyValue(
                'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr))
        self.mox.ReplayAll()
        cmd_parser = cmd.get_parser("list_" + resources)
        shell.run_command(cmd, cmd_parser, args)
        self.mox.VerifyAll()
        self.mox.UnsetStubs()
        _str = self.fake_stdout.make_string()
        if response_contents is None:
            self.assertTrue('myid1' in _str)
        return _str

    def _test_list_resources_with_pagination(self, resources, cmd):
        self.mox.StubOutWithMock(cmd, "get_client")
        self.mox.StubOutWithMock(self.client.httpclient, "request")
        cmd.get_client().MultipleTimes().AndReturn(self.client)
        path = getattr(self.client, resources + "_path")
        fake_query = "marker=myid2&limit=2"
        reses1 = {resources: [{'id': 'myid1', },
                              {'id': 'myid2', }],
                  '%s_links' % resources: [{'href': end_url(path, fake_query),
                                            'rel': 'next'}]}
        reses2 = {resources: [{'id': 'myid3', },
                              {'id': 'myid4', }]}
        self.client.format = self.format
        resstr1 = self.client.serialize(reses1)
        resstr2 = self.client.serialize(reses2)
        self.client.httpclient.request(
            end_url(path, "", format=self.format), 'GET',
            body=None,
            headers=mox.ContainsKeyValue(
                'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr1))
        self.client.httpclient.request(
            end_url(path, fake_query, format=self.format), 'GET',
            body=None,
            headers=mox.ContainsKeyValue(
                'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr2))
        self.mox.ReplayAll()
        cmd_parser = cmd.get_parser("list_" + resources)
        args = ['--request-format', self.format]
        shell.run_command(cmd, cmd_parser, args)
        self.mox.VerifyAll()
        self.mox.UnsetStubs()

    def _test_update_resource(self, resource, cmd, myid, args, extrafields):
        self.mox.StubOutWithMock(cmd, "get_client")
        self.mox.StubOutWithMock(self.client.httpclient, "request")
        cmd.get_client().MultipleTimes().AndReturn(self.client)
        body = {resource: extrafields}
        path = getattr(self.client, resource + "_path")
        self.client.format = self.format
        # Work around for LP #1217791. XML deserializer called from
        # MyComparator does not decodes XML string correctly.
        if self.format == 'json':
            mox_body = MyComparator(body, self.client)
        else:
            mox_body = self.client.serialize(body)
        self.client.httpclient.request(
            MyUrlComparator(end_url(path % myid, format=self.format),
                            self.client),
            'PUT',
            body=mox_body,
            headers=mox.ContainsKeyValue(
                'X-Auth-Token', TOKEN)).AndReturn((MyResp(204), None))
        args.extend(['--request-format', self.format])
        self.mox.ReplayAll()
        cmd_parser = cmd.get_parser("update_" + resource)
        shell.run_command(cmd, cmd_parser, args)
        self.mox.VerifyAll()
        self.mox.UnsetStubs()
        _str = self.fake_stdout.make_string()
        self.assertTrue(myid in _str)

    def _test_show_resource(self, resource, cmd, myid, args, fields=[]):
        self.mox.StubOutWithMock(cmd, "get_client")
        self.mox.StubOutWithMock(self.client.httpclient, "request")
        cmd.get_client().MultipleTimes().AndReturn(self.client)
        query = "&".join(["fields=%s" % field for field in fields])
        expected_res = {resource:
                        {self.id_field: myid,
                         'name': 'myname', }, }
        self.client.format = self.format
        resstr = self.client.serialize(expected_res)
        path = getattr(self.client, resource + "_path")
        self.client.httpclient.request(
            end_url(path % myid, query, format=self.format), 'GET',
            body=None,
            headers=mox.ContainsKeyValue(
                'X-Auth-Token', TOKEN)).AndReturn((MyResp(200), resstr))
        args.extend(['--request-format', self.format])
        self.mox.ReplayAll()
        cmd_parser = cmd.get_parser("show_" + resource)
        shell.run_command(cmd, cmd_parser, args)
        self.mox.VerifyAll()
        self.mox.UnsetStubs()
        _str = self.fake_stdout.make_string()
        self.assertTrue(myid in _str)
        self.assertTrue('myname' in _str)

    def _test_delete_resource(self, resource, cmd, myid, args):
        self.mox.StubOutWithMock(cmd, "get_client")
        self.mox.StubOutWithMock(self.client.httpclient, "request")
        cmd.get_client().MultipleTimes().AndReturn(self.client)
        path = getattr(self.client, resource + "_path")
        self.client.httpclient.request(
            end_url(path % myid, format=self.format), 'DELETE',
            body=None,
            headers=mox.ContainsKeyValue(
                'X-Auth-Token', TOKEN)).AndReturn((MyResp(204), None))
        args.extend(['--request-format', self.format])
        self.mox.ReplayAll()
        cmd_parser = cmd.get_parser("delete_" + resource)
        shell.run_command(cmd, cmd_parser, args)
        self.mox.VerifyAll()
        self.mox.UnsetStubs()
        _str = self.fake_stdout.make_string()
        self.assertTrue(myid in _str)

    def _test_update_resource_action(self, resource, cmd, myid, action, args,
                                     body, retval=None):
        self.mox.StubOutWithMock(cmd, "get_client")
        self.mox.StubOutWithMock(self.client.httpclient, "request")
        cmd.get_client().MultipleTimes().AndReturn(self.client)
        path = getattr(self.client, resource + "_path")
        path_action = '%s/%s' % (myid, action)
        self.client.httpclient.request(
            end_url(path % path_action, format=self.format), 'PUT',
            body=MyComparator(body, self.client),
            headers=mox.ContainsKeyValue(
                'X-Auth-Token', TOKEN)).AndReturn((MyResp(204), retval))
        args.extend(['--request-format', self.format])
        self.mox.ReplayAll()
        cmd_parser = cmd.get_parser("delete_" + resource)
        shell.run_command(cmd, cmd_parser, args)
        self.mox.VerifyAll()
        self.mox.UnsetStubs()
        _str = self.fake_stdout.make_string()
        self.assertTrue(myid in _str)

class ClientV2UnicodeTestJson(CLITestV20Base):
    def test_do_request(self):
        self.client.format = self.format
        self.mox.StubOutWithMock(self.client.httpclient, "request")
        unicode_text = u'\u7f51\u7edc'
        # url with unicode
        action = u'/test'
        expected_action = action.encode('utf-8')
        # query string with unicode
        params = {'test': unicode_text}
        expect_query = urllib.urlencode({'test':
                                         unicode_text.encode('utf-8')})
        # request body with unicode
        body = params
        expect_body = self.client.serialize(body)
        # headers with unicode
        self.client.httpclient.auth_token = unicode_text
        expected_auth_token = unicode_text.encode('utf-8')

        self.client.httpclient.request(
            end_url(expected_action, query=expect_query, format=self.format),
            'PUT', body=expect_body,
            headers=mox.ContainsKeyValue(
                'X-Auth-Token',
                expected_auth_token)).AndReturn((MyResp(200), expect_body))

        self.mox.ReplayAll()
        res_body = self.client.do_request('PUT', action, body=body,
                                          params=params)
        self.mox.VerifyAll()
        self.mox.UnsetStubs()

        # test response with unicode
        self.assertEqual(res_body, body)

class ClientV2UnicodeTestXML(ClientV2UnicodeTestJson):
    format = 'xml'


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

<TITLE>
Uses of Class org.hibernate.envers.entities.EntityInstantiator (Hibernate JavaDocs)
</TITLE>

<META NAME="date" CONTENT="2013-10-23">

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

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Uses of Class
org.hibernate.envers.entities.EntityInstantiator

Packages that use EntityInstantiator

org.hibernate.envers.entities.mapper.relation.component

org.hibernate.envers.entities.mapper.relation.lazy.initializor

org.hibernate.envers.query.impl

Uses of EntityInstantiator in org.hibernate.envers.entities.mapper.relation.component

Methods in org.hibernate.envers.entities.mapper.relation.component with parameters of type EntityInstantiator

 Object
MiddleStraightComponentMapper.mapToObjectFromFullMap(EntityInstantiator entityInstantiator,
                       Map<String,Object> data,
                       Object dataObject,
                       Number revision)

 Object
MiddleRelatedComponentMapper.mapToObjectFromFullMap(EntityInstantiator entityInstantiator,
                       Map<String,Object> data,
                       Object dataObject,
                       Number revision)

 Object
MiddleSimpleComponentMapper.mapToObjectFromFullMap(EntityInstantiator entityInstantiator,
                       Map<String,Object> data,
                       Object dataObject,
                       Number revision)

 Object
MiddleMapKeyIdComponentMapper.mapToObjectFromFullMap(EntityInstantiator entityInstantiator,
                       Map<String,Object> data,
                       Object dataObject,
                       Number revision)

 Object
MiddleComponentMapper.mapToObjectFromFullMap(EntityInstantiator entityInstantiator,
                       Map<String,Object> data,
                       Object dataObject,
                       Number revision)

          Maps from full object data, contained in the given map (or object representation of the map, if
 available), to an object.

 Object
MiddleDummyComponentMapper.mapToObjectFromFullMap(EntityInstantiator entityInstantiator,
                       Map<String,Object> data,
                       Object dataObject,
                       Number revision)

 Object
MiddleMapKeyPropertyComponentMapper.mapToObjectFromFullMap(EntityInstantiator entityInstantiator,
                       Map<String,Object> data,
                       Object dataObject,
                       Number revision)

 Object
MiddleEmbeddableComponentMapper.mapToObjectFromFullMap(EntityInstantiator entityInstantiator,
                       Map<String,Object> data,
                       Object dataObject,
                       Number revision)

Uses of EntityInstantiator in org.hibernate.envers.entities.mapper.relation.lazy.initializor

Fields in org.hibernate.envers.entities.mapper.relation.lazy.initializor declared as EntityInstantiator

protected  EntityInstantiator
AbstractCollectionInitializor.entityInstantiator

Uses of EntityInstantiator in org.hibernate.envers.query.impl

Fields in org.hibernate.envers.query.impl declared as EntityInstantiator

protected  EntityInstantiator
AbstractAuditQuery.entityInstantiator

      Overview
      Package
      Class
    Use
      Tree
      Deprecated
      Index
      Help

 PREV
 NEXT

  FRAMES
 NO FRAMES

  All Classes

Copyright © 2001-2013 Red Hat, Inc.  All Rights Reserved.


text:
package org.springframework.ejb.support;

import org.springframework.beans.BeansException;
import org.springframework.beans.FatalBeanException;

/**
 * Convenient superclass for stateful session beans.
 * SFSBs should extend this class, leaving them to implement the
 * ejbActivate() and ejbPassivate() lifecycle
 * methods to comply with the requirements of the EJB specification.
 *
 *
Note: Subclasses should invoke the loadBeanFactory()
 * method in their custom ejbCreate() and ejbActivate()
 * methods, and should invoke the unloadBeanFactory() method in
 * their ejbPassivate method.
 *
 *
Note: The default BeanFactoryLocator used by this class's superclass
 * (ContextJndiBeanFactoryLocator) is not serializable. Therefore,
 * when using the default BeanFactoryLocator, or another variant which is
 * not serializable, subclasses must call setBeanFactoryLocator(null)
 * in ejbPassivate(), with a corresponding call to
 * setBeanFactoryLocator(xxx) in ejbActivate()
 * unless relying on the default locator.
 *
 * @author Rod Johnson
 * @author Colin Sampaleanu
 * @see org.springframework.context.access.ContextJndiBeanFactoryLocator
 */
public abstract class AbstractStatefulSessionBean extends AbstractSessionBean {

	/**
	 * Load a Spring BeanFactory namespace. Exposed for subclasses
	 * to load a BeanFactory in their ejbCreate() methods.
	 * Those callers would normally want to catch BeansException and
	 * rethrow it as {@link javax.ejb.CreateException}. Unless the
	 * BeanFactory is known to be serializable, this method must also
	 * be called from ejbActivate(), to reload a context
	 * removed via a call to unloadBeanFactory() from
	 * the ejbPassivate() implementation.
	 */
	protected void loadBeanFactory() throws BeansException {
		super.loadBeanFactory();
	}

	/**
	 * Unload the Spring BeanFactory instance. The default ejbRemove
	 * method invokes this method, but subclasses which override
	 * ejbRemove must invoke this method themselves.
	 *
Unless the BeanFactory is known to be serializable, this method
	 * must also be called from ejbPassivate(), with a corresponding
	 * call to loadBeanFactory() from ejbActivate().
	 */
	protected void unloadBeanFactory() throws FatalBeanException {
		super.unloadBeanFactory();
	}

}


text:
## Description

This API can be used to query the Office of Personnel Management's federal executive branch organizational structure. Includes publicly available number of employees as of 2015.

## Example

### Route: GET /agency/list

+ Sample call: http://agency-api-demo.sambressi.com/agency/list
+ Sample call: http://agency-api-demo.sambressi.com/agency/list?type=cab
+ Sample call: http://agency-api-demo.sambressi.com/agency/list?type=ind&size=m

#### Optional Query String Parameters

| Parameter | Values | Description |
| --------- | ------- | ----------- |
| type      | cab     | Cabinet-level agencies |
|           | ind     | Independent agencies |
| size      | s       | Small (less than 100 employees); only allowed with type=ind |
|           | m       | Medium (100 to 999 employees); only allowed with type=ind |
|           | l       | Large (1,000 or more employees); only allowed with type=ind |

Sample response:
```javascript
{
    "statusCode": "200",
    "statusMessage": "OK",
    "data": [
        {
            "agency_code": "AF",
            "agency_name": "DEPARTMENT OF THE AIR FORCE",
            "agency_type": {
                "agency_type": "Cabinet Level Agencies"
            },
            "agency_subelements": [
                {
                    "subelement_code": "AF02",
                    "subelement_name": "AIR FORCE INSPECTION AND SAFETY CENTER",
                    "employment": 34
                },
                {
                    "subelement_code": "AF03",
                    "subelement_name": "AIR FORCE OPERATIONAL TEST AND EVALUATION CENTER",
                    "employment": 153
                },
                {
                    "subelement_code": "AF07",
                    "subelement_name": "AIR FORCE OFFICE OF SPECIAL INVESTIGATIONS",
                    "employment": 605
                }
                // ... TRUNCATED ... //
            ]
        },
        {
            "agency_code": "DJ",
            "agency_name": "DEPARTMENT OF JUSTICE",
            "agency_type": {
                "agency_type": "Cabinet Level Agencies"
            },
            "agency_subelements": [
                {
                    "subelement_code": "DJ01",
                    "subelement_name": "OFFICES, BOARDS AND DIVISIONS",
                    "employment": 7357
                },
                {
                    "subelement_code": "DJ02",
                    "subelement_name": "FEDERAL BUREAU OF INVESTIGATION",
                    "employment": 33486
                },
                {
                    "subelement_code": "DJ06",
                    "subelement_name": "DRUG ENFORCEMENT ADMINISTRATION",
                    "employment": 9623
                }
                // ... TRUNCATED ... //
            ]
        }
        // ... TRUNCATED ... //
    ]
}
```

### Route: GET /agency/list/[code]

+ Sample call: http://agency-api-demo.sambressi.com/agency/list/HS

Sample response:
```javascript
{
    "statusCode": "200",
    "statusMessage": "OK",
    "data": [
        {
            "agency_code": "HS",
            "agency_name": "DEPARTMENT OF HOMELAND SECURITY",
            "agency_type": {
                "agency_type": "Cabinet Level Agencies"
            },
            "agency_subelements": [
                {
                    "subelement_code": "HSAA",
                    "subelement_name": "DHS HEADQUARTERS",
                    "employment": 2428
                },
                {
                    "subelement_code": "HSAB",
                    "subelement_name": "BUREAU OF CITIZENSHIP AND IMMIGRATION SERVICES",
                    "employment": 10560
                },
                {
                    "subelement_code": "HSAC",
                    "subelement_name": "U.S. COAST GUARD",
                    "employment": 8146
                },
                {
                    "subelement_code": "HSAD",
                    "subelement_name": "U.S. SECRET SERVICE",
                    "employment": 6802
                }
                // ... TRUNCATED ... //
            ]
        }
    ]
}
```


text:
using namespace clang;
using namespace sema;

DelayedDiagnostic
DelayedDiagnostic::makeAvailability(Sema::AvailabilityDiagnostic AD,
                                    SourceLocation Loc,
                                    const NamedDecl *D,
                                    const ObjCInterfaceDecl *UnknownObjCClass,
                                    const ObjCPropertyDecl  *ObjCProperty,
                                    StringRef Msg,
                                    bool ObjCPropertyAccess) {
  DelayedDiagnostic DD;
  switch (AD) {
    case Sema::AD_Deprecation:
      DD.Kind = Deprecation;
      break;
    case Sema::AD_Unavailable:
      DD.Kind = Unavailable;
      break;
    case Sema::AD_Partial:
      llvm_unreachable("AD_Partial diags should not be delayed");
  }
  DD.Triggered = false;
  DD.Loc = Loc;
  DD.DeprecationData.Decl = D;
  DD.DeprecationData.UnknownObjCClass = UnknownObjCClass;
  DD.DeprecationData.ObjCProperty = ObjCProperty;
  char *MessageData = nullptr;
  if (Msg.size()) {
    MessageData = new char [Msg.size()];
    memcpy(MessageData, Msg.data(), Msg.size());
  }

  DD.DeprecationData.Message = MessageData;
  DD.DeprecationData.MessageLen = Msg.size();
  DD.DeprecationData.ObjCPropertyAccess = ObjCPropertyAccess;
  return DD;
}

void DelayedDiagnostic::Destroy() {
  switch (static_cast<DDKind>(Kind)) {
  case Access:
    getAccessData().~AccessedEntity();
    break;

  case Deprecation:
  case Unavailable:
    delete [] DeprecationData.Message;
    break;

  case ForbiddenType:
    break;
  }
}


text:
from fakturo.core.openstack.common import version as common_version

version_info = common_version.VersionInfo('fakturo.core')


text:
> Canvas-based color picker for modern browsers

## Install

```sh
$ npm install --save colordisc
```

## Usage

```html
<canvas id="Rainbow"></canvas>
```

```js
var colordisc = require('colordisc');

colordisc('Rainbow');

// or, use querySelector however you'd like:

colordisc('canvas#Rainbow');
```

## License

MIT © [Josh Street](http://josh.st)

[npm-image]: https://badge.fury.io/js/colordisc.svg
[npm-url]: https://npmjs.org/package/colordisc
[travis-image]: https://travis-ci.org/joahua/colordisc.svg?branch=master
[travis-url]: https://travis-ci.org/joahua/colordisc
[daviddm-image]: https://david-dm.org/joahua/colordisc.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/joahua/colordisc
[coveralls-image]: https://coveralls.io/repos/joahua/colordisc/badge.svg
[coveralls-url]: https://coveralls.io/r/joahua/colordisc


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

	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content = "width = 420, user-scalable = no" />
	<title>WebIOPi | GPIO List</title>


text:
/**
 * @file FixedwingLandDetector.h
 * Land detector implementation for fixedwing.
 *
 * @author Johan Jansen <jnsn.johan@gmail.com>
 * @author Morten Lysgaard <morten@lysgaard.no>
 * @author Julian Oes <julian@oes.ch>
 */

#pragma once

#include <uORB/topics/airspeed.h>
#include <uORB/topics/sensor_bias.h>
#include <uORB/topics/vehicle_local_position.h>

#include "LandDetector.h"

namespace land_detector
{

class FixedwingLandDetector final : public LandDetector
{
public:
	FixedwingLandDetector();

protected:
	void _initialize_topics() override;
	void _update_params() override;
	void _update_topics() override;

	bool _get_landed_state() override;
	float _get_max_altitude() override;

private:

	/** Time in us that landing conditions have to hold before triggering a land. */
	static constexpr uint64_t LANDED_TRIGGER_TIME_US = 2000000;
	static constexpr uint64_t FLYING_TRIGGER_TIME_US = 0;

	struct {
		param_t maxVelocity;
		param_t maxClimbRate;
		param_t maxAirSpeed;
		param_t maxIntVelocity;
	} _paramHandle{};

	struct {
		float maxVelocity;
		float maxClimbRate;
		float maxAirSpeed;
		float maxIntVelocity;
	} _params{};

	int _airspeedSub{-1};
	int _sensor_bias_sub{-1};
	int _local_pos_sub{-1};

	airspeed_s _airspeed{};
	sensor_bias_s _sensors{};
	vehicle_local_position_s _local_pos{};

	float _velocity_xy_filtered{0.0f};
	float _velocity_z_filtered{0.0f};
	float _airspeed_filtered{0.0f};
	float _accel_horz_lp{0.0f};
};

} // namespace land_detector


text:
<form class="calculator "  name='myForm' ng-submit='search()'>

		综收计算器

债券简称

				<input type="text"
					class="form-control wid15"
					placeholder="请输入代码或简称"
					ng-model="searchCont.queryQuote"
					uib-typeahead="list as list.bondNm for list in  queryQuote($viewValue)"
					typeahead-template-url="heald_calulator_item.html"
					typeahead-on-select='selected()' />

期限

			{{searchCont.trmText}}

手续费(每100元)

				<input type="text" class="form-control"  name='retFee' ng-model='searchCont.retFee' ng-focus='flag = "retFee"'  ng-blur='search()' validation-tooltip="validdationAccount($value)">

元

认购价格

				<input type="text" class="form-control" ng-model='searchCont.sbsrbPrc' ng-focus='flag = "sbsrbPrc"' ng-blur='search()' >
				  元

申购利率

				<input type="text" class="form-control" ng-change='checkedValue(vcc)' ng-model='searchCont.sbrbIntrt' ng-focus='flag = "sbrbIntrt"'  ng-blur='search()' >

%

综收利率

				<input type="text" class="form-control" ng-model='searchCont.cprsvPftIntrt'  ng-focus='flag = "cprsvPftIntrt"'  ng-blur='search()' >
				  %

认购数量

				<input type="text" class="form-control" ng-model='searchCont.sbsrbNum'   ng-focus='flag = "sbsrbNum"' ng-blur='search()' >

万

缴款金额

{{searchCont.pyAmt |addTwoLine}}

万

收益金额

{{searchCont.pftAmt |addTwoLine}}

万

	<input type="submit"  style="display: none">
</form>


text:
#include <aws/eventbridge/model/DeleteEndpointRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::EventBridge::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

DeleteEndpointRequest::DeleteEndpointRequest() :
    m_nameHasBeenSet(false)
{
}

Aws::String DeleteEndpointRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_nameHasBeenSet)
  {
   payload.WithString("Name", m_name);

  }

  return payload.View().WriteReadable();
}

Aws::Http::HeaderValueCollection DeleteEndpointRequest::GetRequestSpecificHeaders() const
{
  Aws::Http::HeaderValueCollection headers;
  headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "AWSEvents.DeleteEndpoint"));
  return headers;

}


text:
#pragma once

#ifndef GEODE_FWKLIB_FWKBBCLIENT_H_
#define GEODE_FWKLIB_FWKBBCLIENT_H_

/**
  * @file    FwkBBClient.hpp
  * @since   1.0
  * @version 1.0
  * @see
  */

#include "FwkBB.hpp"
#include "UDPIpc.hpp"

#include <ace/OS.h>

// ----------------------------------------------------------------------------
//  Some widely used BBs and counters

static std::string CLIENTBB("CLIENTBB");
static std::string CLIENTCOUNT("ClientCount");

// ----------------------------------------------------------------------------

#define CLIENT_WAIT_TIME_FOR_REPLY 5  // seconds

// ----------------------------------------------------------------------------

namespace apache {
namespace geode {
namespace client {
namespace testframework {
/** @class FwkBBClient
  * @brief Framework BB client
  */
class FwkBBClient {
 public:
  FwkBBClient(std::string serverAddr) : m_client(serverAddr), m_messageId(0) {}

  ~FwkBBClient() {}

  /** @brief dump all data
    * @retval result of dump
    */
  std::string dump();

  /** @brief dump BB data
    * @param BBName name of BB
    * @retval result of dump
    */
  std::string dump(const std::string& BBName);

  /** @brief clear BB data
    * @param BBName name of BB
    */
  void clear(const std::string& BBName);

  /** @brief get BB key value
    * @param BBName name of BB
    * @param Key name of Key
    * @retval value
    */
  std::string getString(const std::string& BBName, const std::string& Key);

  /** @brief get BB counter value
    * @param BBName name of BB
    * @param Key name of counter
    * @retval value of counter
    */
  int64_t get(const std::string& BBName, const std::string& Key);

  /** @brief set BB key value
    * @param BBName name of BB
    * @param Key name of key
    * @param Value value to set
    */
  void set(const std::string& BBName, const std::string& Key,
           const std::string& Value);

  /** @brief set BB counter value
    * @param BBName name of BB
    * @param Key name of counter
    * @param Value value to add to counter
    * @retval value of counter
    */
  void set(const std::string& BBName, const std::string& Key,
           const int64_t Value);

  /** @brief add BB counter value
    * @param BBName name of BB
    * @param Key name of counter
    * @param Value value to add to counter
    * @retval value after add
    */
  int64_t add(const std::string& BBName, const std::string& Key,
              const int64_t Value);

  /** @brief subtract BB counter value
    * @param BBName name of BB
    * @param Key name of counter
    * @param Value value to subtract from counter
    * @retval value after subtract
    */
  int64_t subtract(const std::string& BBName, const std::string& Key,
                   const int64_t Value);

  /** @brief increment BB counter value by 1
    * @param BBName name of BB
    * @param Key name of counter
    * @retval value after increment
    */
  int64_t increment(const std::string& BBName, const std::string& Key);

  /** @brief decrement BB counter value by 1
    * @param BBName name of BB
    * @param Key name of counter
    * @retval value after decrement
    */
  int64_t decrement(const std::string& BBName, const std::string& Key);

  /** @brief zero BB counter value to 0
    * @param BBName name of BB
    * @param Key name of counter
    */
  void zero(const std::string& BBName, const std::string& Key);

  /** @brief setIfGreater BB counter value is greater
    * @param BBName name of BB
    * @param Key name of counter
    * @param Value value to set
    * @param piResult
    * @retval value after setIfGreater
    */
  int64_t setIfGreater(const std::string& BBName, const std::string& Key,
                       const int64_t Value);

  /** @brief setIfLess BB counter value is less
    * @param BBName name of BB
    * @param Key name of counter
    * @param Value value to set
    * @retval value after setIfLess
    */
  int64_t setIfLess(const std::string& BBName, const std::string& Key,
                    const int64_t Value);

 private:
  /** @brief get new message id
     */
  uint32_t getNewMessageId() { return ++m_messageId; };

  /** @brief get current message id
    */
  uint32_t getCurrentMessageId() { return m_messageId; };

  /** @brief send a message to server
    * @param message message to send
    * @retval true = Success, false = Failed
    */
  void sendToServer(FwkBBMessage& message);

 private:
  UDPMessageClient m_client;
  std::string m_result;
  uint32_t m_messageId;
};

// ----------------------------------------------------------------------------

}  // namespace  testframework
}  // namespace client
}  // namespace geode
}  // namespace apache

#endif  // GEODE_FWKLIB_FWKBBCLIENT_H_


text:
using System;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using TrueCraft.Core.Logic;
using TrueCraft.API.Logic;
using System.Linq;

namespace TrueCraft.Client.Rendering
{
    public class BlockRenderer
    {
        private static BlockRenderer DefaultRenderer = new BlockRenderer();
        private static BlockRenderer[] Renderers = new BlockRenderer[0x100];

        public static void RegisterRenderer(byte id, BlockRenderer renderer)
        {
            Renderers[id] = renderer;
        }

        public static VertexPositionNormalColorTexture[] RenderBlock(IBlockProvider provider, BlockDescriptor descriptor,
            VisibleFaces faces, Vector3 offset, int indiciesOffset, out int[] indicies)
        {
            var textureMap = provider.GetTextureMap(descriptor.Metadata);
            if (textureMap == null)
                textureMap = new Tuple<int, int>(0, 0); // TODO: handle this better
            return Renderers[descriptor.ID].Render(descriptor, offset, faces, textureMap, indiciesOffset, out indicies);
        }

        public virtual VertexPositionNormalColorTexture[] Render(BlockDescriptor descriptor, Vector3 offset,
            VisibleFaces faces, Tuple<int, int> textureMap, int indiciesOffset, out int[] indicies)
        {
            var texCoords = new Vector2(textureMap.Item1, textureMap.Item2);
            var texture = new[]
            {
                texCoords + Vector2.UnitX + Vector2.UnitY,
                texCoords + Vector2.UnitY,
                texCoords,
                texCoords + Vector2.UnitX
            };
            for (int i = 0; i < texture.Length; i++)
                texture[i] *= new Vector2(16f / 256f);
            return CreateUniformCube(offset, texture, faces, indiciesOffset, out indicies, Color.White);
        }

        public static VertexPositionNormalColorTexture[] CreateUniformCube(Vector3 offset, Vector2[] texture,
            VisibleFaces faces, int indiciesOffset, out int[] indicies, Color color)
        {
            faces = VisibleFaces.All; // Temporary

            int totalFaces = 0;
            uint f = (uint)faces;
            while (f != 0)
            {
                if ((f & 1) == 1)
                    totalFaces++;
                f >>= 1;
            }

            indicies = new int[6 * totalFaces];
            var verticies = new VertexPositionNormalColorTexture[4 * totalFaces];
            int[] _indicies;
            int textureIndex = 0;
            int sidesSoFar = 0;
            for (int _side = 0; _side < 6; _side++)
            {
                if ((faces & VisibleForCubeFace[_side]) == 0)
                {
                    textureIndex += 4;
                    continue;
                }
                var side = (CubeFace)_side;
                var quad = CreateQuad(side, offset, texture, textureIndex % texture.Length, indiciesOffset,
                    out _indicies, color);
                Array.Copy(quad, 0, verticies, sidesSoFar * 4, 4);
                Array.Copy(_indicies, 0, indicies, sidesSoFar * 6, 6);
                textureIndex += 4;
                sidesSoFar++;
            }
            return verticies;
        }

        protected static VertexPositionNormalColorTexture[] CreateQuad(CubeFace face, Vector3 offset,
            Vector2[] texture, int textureOffset, int indiciesOffset, out int[] indicies, Color color)
        {
            indicies = new[] { 0, 1, 3, 1, 2, 3 };
            for (int i = 0; i < indicies.Length; i++)
                indicies[i] += ((int)face * 4) + indiciesOffset;
            var quad = new VertexPositionNormalColorTexture[4];
            var unit = CubeMesh[(int)face];
            var normal = CubeNormals[(int)face];
            for (int i = 0; i < 4; i++)
            {
                quad[i] = new VertexPositionNormalColorTexture(offset + unit[i], normal, color, texture[textureOffset + i]);
            }
            return quad;
        }

        protected enum CubeFace
        {
            PositiveZ = 0,
            NegativeZ = 1,
            PositiveX = 2,
            NegativeX = 3,
            PositiveY = 4,
            NegativeY = 5
        }

        protected static readonly VisibleFaces[] VisibleForCubeFace =
        {
            VisibleFaces.South,
            VisibleFaces.North,
            VisibleFaces.East,
            VisibleFaces.West,
            VisibleFaces.Top,
            VisibleFaces.Bottom
        };

        protected static readonly Vector3[][] CubeMesh;

        protected static readonly Vector3[] CubeNormals =
        {
            new Vector3(0, 0, 1),
            new Vector3(0, 0, -1),
            new Vector3(1, 0, 0),
            new Vector3(-1, 0, 0),
            new Vector3(0, 1, 0),
            new Vector3(0, -1, 0)
        };

        static BlockRenderer()
        {
            for (int i = 0; i < Renderers.Length; i++)
            {
                Renderers[i] = DefaultRenderer;
            }

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                foreach (var type in assembly.GetTypes().Where(t =>
                    typeof(BlockRenderer).IsAssignableFrom(t) && !t.IsAbstract && t != typeof(BlockRenderer)))
                {
                    Activator.CreateInstance(type); // This is just to call the static initializers
                }
            }

            CubeMesh = new Vector3[6][];

            CubeMesh[0] = new[] // Positive Z face
            {
                new Vector3(0.5f, -0.5f, 0.5f),
                new Vector3(-0.5f, -0.5f, 0.5f),
                new Vector3(-0.5f, 0.5f, 0.5f),
                new Vector3(0.5f, 0.5f, 0.5f)
            };

            CubeMesh[1] = new[] // Negative Z face
            {
                new Vector3(-0.5f, -0.5f, -0.5f),
                new Vector3(0.5f, -0.5f, -0.5f),
                new Vector3(0.5f, 0.5f, -0.5f),
                new Vector3(-0.5f, 0.5f, -0.5f)
            };

            CubeMesh[2] = new[] // Positive X face
            {
                new Vector3(0.5f, -0.5f, -0.5f),
                new Vector3(0.5f, -0.5f, 0.5f),
                new Vector3(0.5f, 0.5f, 0.5f),
                new Vector3(0.5f, 0.5f, -0.5f)
            };

            CubeMesh[3] = new[] // Negative X face
            {
                new Vector3(-0.5f, -0.5f, 0.5f),
                new Vector3(-0.5f, -0.5f, -0.5f),
                new Vector3(-0.5f, 0.5f, -0.5f),
                new Vector3(-0.5f, 0.5f, 0.5f)
            };

            CubeMesh[4] = new[] // Positive Y face
            {
                new Vector3(0.5f, 0.5f, 0.5f),
                new Vector3(-0.5f, 0.5f, 0.5f),
                new Vector3(-0.5f, 0.5f, -0.5f),
                new Vector3(0.5f, 0.5f, -0.5f)
            };

            CubeMesh[5] = new[] // Negative Y face
            {
                new Vector3(0.5f, -0.5f, -0.5f),
                new Vector3(-0.5f, -0.5f, -0.5f),
                new Vector3(-0.5f, -0.5f, 0.5f),
                new Vector3(0.5f, -0.5f, 0.5f)
            };

            // TEMP
            return;
            for (int i = 0; i < CubeMesh.Length; i++)
                for (int j = 0; j < CubeMesh[0].Length; j++)
                    CubeMesh[i][j] *= new Vector3(0.5f);
        }
    }
}


text:
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'

include RspecPuppetFacts

require 'simplecov'
require 'simplecov-console'

SimpleCov.start do
  add_filter '/spec'
  add_filter '/vendor'
  add_filter '/.bundle'
  formatter SimpleCov::Formatter::MultiFormatter[
    SimpleCov::Formatter::HTMLFormatter,
    SimpleCov::Formatter::Console
  ]
end

def default_test_facts
  {
    :hostinator_home => "/test/hostinator",
    :hostinator_user => "testuser"
  }
end


text:
declare namespace makuappu {
    class ContainerConfig extends ComponentConfig {
        layout: {
            "xs": ContainerLayout;
            "sm": ContainerLayout;
            "md": ContainerLayout;
            "lg": ContainerLayout;
            "xl": ContainerLayout;
        };
        modifiers: ContainerConfig[];
    }
}
declare namespace makuappu {
    class ContainerCss extends ComponentCss {
        getComponentType(): string;
        getBaseCssObject(): any;
        getImplCssObject(layout: any, skin: any): any;
        private layoutContainer(main, width, minWidth, maxWidth, align, padding);
    }
}
declare namespace makuappu {
    class ContainerForm extends ComponentForm {
        constructor();
    }
}
declare namespace makuappu {
    class ContainerHtml extends ComponentHtml {
        getSample(styleclass: string): string;
    }
}
declare namespace makuappu {
    class ContainerLayout {
        width: string;
        minWidth: string;
        maxWidth: string;
        align: "left" | "center" | "right";
        padding: string;
    }
}


text:
<component name="libraryTable">
  <library name="recyclerview-animators-1.3.0">
    <CLASSES>
      <root url="jar://$PROJECT_DIR$/app/build/intermediates/exploded-aar/jp.wasabeef/recyclerview-animators/1.3.0/jars/classes.jar!/" />
      <root url="file://$PROJECT_DIR$/app/build/intermediates/exploded-aar/jp.wasabeef/recyclerview-animators/1.3.0/res" />
    </CLASSES>
    <JAVADOC />
    <SOURCES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/jp.wasabeef/recyclerview-animators/1.3.0/83b69253ff7a6ed2a8c37254dafed315d2e2413a/recyclerview-animators-1.3.0-sources.jar!/" />
    </SOURCES>
  </library>
</component>


text:
% MatrixUser, a multi-dimensional matrix analysis software package
% https://sourceforge.net/projects/matrixuser/
%
% The MatrixUser is a matrix analysis software package developed under Matlab
% Graphical User Interface Developing Environment (GUIDE). It features
% functions that are designed and optimized for working with multi-dimensional
% matrix under Matlab. These functions typically includes functions for
% multi-dimensional matrix display, matrix (image stack) analysis and matrix
% processing.
%
% Author:
%   Fang Liu <leoliuf@gmail.com>
%   University of Wisconsin-Madison
%   Aug-30-2014

function MU_funcAngleROI(Temp,Event,handles)
handles = guidata(handles.MU_matrix_display);

MU_enable('off',[],handles);
ROI_h=impoly;
MU_enable('on',[],handles);

p=getPosition(ROI_h);
if max(p(:,1))>handles.V.Column | max(p(:,2))>handles.V.Row | min(p(:,1))<1 | min(p(:,2))<1
    delete(ROI_h);
    errordlg('Out of range subscript.');
    return;
end

ROI_Stat_h=zeros(1,length(p(:,1)));

p2=circshift(p,[1,0]);
p3=circshift(p,[-1,0]);
dp=p-p2;
dp2=p-p3;
for i=1:length(p(:,1))
    theta = acos(dot(dp(i,:),dp2(i,:))./(norm(dp(i,:)).*norm(dp2(i,:))))*180/pi;
    ROI_Stat_h(i)=text(p(i,1),p(i,2),{['Angle: ' num2str(theta)]},'FontSize',10,'Color','g');
end

handles.V.ROI=struct(...
                     'ROI_flag', 7,...
                     'ROI_mov',[],...  % ROI movement track
                     'ROI_Stat_h', ROI_Stat_h,...
                     'ROI_h', ROI_h ...
                     );

guidata(handles.MU_matrix_display, handles);
addNewPositionCallback(ROI_h,@(p) MU_ROI_stat(p,ROI_h,[],handles));
fcn=makeConstrainToRectFcn('impoly',[0.5 handles.V.Column+0.4],[0.5 handles.V.Row+0.4]);
setPositionConstraintFcn(ROI_h,fcn);

end


text:
package br.com.caelum.ws.jaxws;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlRootElement(name = "traduzResponse", namespace = "http://ws.caelum.com.br/")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "traduzResponse", namespace = "http://ws.caelum.com.br/")
public class TraduzResponse {

    @XmlElement(name = "traducao", namespace = "")
    private String traducao;

    /**
     *
     * @return
     *     returns String
     */
    public String getTraducao() {
        return this.traducao;
    }

    /**
     *
     * @param traducao
     *     the value for the traducao property
     */
    public void setTraducao(String traducao) {
        this.traducao = traducao;
    }

}