text:
/**
* Author: CZ cz.theng@gmail.com
 */

package object

import (
	"github.com/cz-it/aliyun-oss-golang-sdk/ossapi"
	"path"
	"strconv"
)

// BriefInfo is  Brief Info
type BriefInfo struct {
	ObjectType  string
	Type        string
	LastModifed string
	ETag        string
	Length      uint64
}

// BriefConnInfo is Conndtition info
type BriefConnInfo struct {
	ModifiedSince   string
	UnmodifiedSince string
	MatchEtag       string
	NotMatchEtag    string
}

// QueryMeta  Query object's meta info
// @param objName : name of object
// @param bucketName : name of bucket
// @param locaton : location of bucket
// @param info: conndtion to controll return
// @return briefInfo : breif info of object
// @retun ossapiError : nil on success
func QueryMeta(objName, bucketName, location string, info *BriefConnInfo) (briefInfo *BriefInfo, ossapiError *ossapi.Error) {
	resource := path.Join("/", bucketName, objName)
	host := bucketName + "." + location + ".aliyuncs.com"
	header := make(map[string]string)
	if info != nil {
		if info.ModifiedSince != "" {
			header["If-Modified-Since"] = info.ModifiedSince
		}
		if info.UnmodifiedSince != "" {
			header["If-Unmodified-Since"] = info.UnmodifiedSince
		}
		if info.MatchEtag != "" {
			header["If-Match"] = info.MatchEtag
		}
		if info.NotMatchEtag != "" {
			header["If-None-Match"] = info.NotMatchEtag
		}
	}

	req := &ossapi.Request{
		Host:     host,
		Path:     "/" + objName,
		Method:   "HEAD",
		Resource: resource}

	rsp, err := req.Send()
	if err != nil {
		if _, ok := err.(*ossapi.Error); !ok {
			ossapi.Logger.Error("GetService's Send Error:%s", err.Error())
			ossapiError = ossapi.OSSAPIError
			return
		}
	}
	if rsp.Result != ossapi.ErrSUCC {
		ossapiError = err.(*ossapi.Error)
		return
	}
	length, err := strconv.Atoi(rsp.HTTPRsp.Header["Content-Length"][0])
	if err != nil {
		length = 0
	}

	briefInfo = &BriefInfo{ObjectType: rsp.HTTPRsp.Header["X-Oss-Object-Type"][0],
		Type:        rsp.HTTPRsp.Header["Content-Type"][0],
		LastModifed: rsp.HTTPRsp.Header["Last-Modified"][0],
		ETag:        rsp.HTTPRsp.Header["Etag"][0],
		Length:      uint64(length),
	}
	return
}


text:
package org.ovirt.engine.core.common.vdscommands.gluster;

import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStage;
import org.ovirt.engine.core.common.vdscommands.VdsIdVDSCommandParametersBase;
import org.ovirt.engine.core.compat.Guid;

/**
 * Gluster Hook VDS parameter class with gluster command, hook name, and level as parameters.

 * This will be used by Gluster Hook VDS commands

 */
public class GlusterHookVDSParameters extends VdsIdVDSCommandParametersBase {

    private String glusterCommand;
    private String hookName;
    private GlusterHookStage stage;
    private String content;
    private String checksum;
    private Boolean enabled;

    public GlusterHookVDSParameters(Guid serverId, String glusterCommand, GlusterHookStage stage, String hookName) {
        super(serverId);
        setGlusterCommand(glusterCommand);
        setHookStage(stage);
        setHookName(hookName);
    }

    /**
     * @param glusterCommand - gluster command the hook is intended for
     * @param stage - PRE/POST stage
     * @param hookName - file name
     * @param content - encoded text content
     * @param checksum - checksum of content
     */
    public GlusterHookVDSParameters(Guid serverId, String glusterCommand, GlusterHookStage stage, String hookName,
            String content, String checksum) {
        super(serverId);
        setGlusterCommand(glusterCommand);
        setHookStage(stage);
        setHookName(hookName);
        setHookContent(content);
        setChecksum(checksum);
    }

    /**
     * @param glusterCommand - gluster command the hook is intended for
     * @param stage - PRE/POST stage
     * @param hookName - file name
     * @param content - encoded text content
     * @param checksum - checksum of content
     * @param enabled - if the hook needs to be enabled/not
     */
    public GlusterHookVDSParameters(Guid serverId, String glusterCommand, GlusterHookStage stage, String hookName,
            String content, String checksum, Boolean enabled) {
        this(serverId, glusterCommand, stage, hookName, content, checksum);
        setEnabled(enabled);
    }

    public GlusterHookVDSParameters() {
    }

    public String getHookContent() {
        return content;
    }

    public void setHookContent(String content) {
        this.content = content;
    }

    public String getGlusterCommand() {
        return glusterCommand;
    }

    public void setGlusterCommand(String glusterCommand) {
        this.glusterCommand = glusterCommand;
    }

    public String getHookName() {
        return hookName;
    }

    public void setHookName(String hookName) {
        this.hookName = hookName;
    }

    public GlusterHookStage getHookStage() {
        return stage;
    }

    public void setHookStage(GlusterHookStage stage) {
        this.stage = stage;
    }

    public String getChecksum() {
        return checksum;
    }

    public void setChecksum(String checksum) {
        this.checksum = checksum;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Google\ApiCore\Transport;

use Exception;
use Google\ApiCore\Call;
use Google\ApiCore\ValidationException;
use Google\Auth\HttpHandler\HttpHandlerFactory;

/**
 * A trait for shared functionality between transports that support only unary RPCs using simple
 * HTTP requests.
 *
 * @internal
 */
trait HttpUnaryTransportTrait
{
    private $httpHandler;
    private $transportName;
    private $clientCertSource;

    /**
     * {@inheritdoc}
     * @return never
     * @throws \BadMethodCallException
     */
    public function startClientStreamingCall(Call $call, array $options)
    {
        $this->throwUnsupportedException();
    }

    /**
     * {@inheritdoc}
     * @return never
     * @throws \BadMethodCallException
     */
    public function startServerStreamingCall(Call $call, array $options)
    {
        $this->throwUnsupportedException();
    }

    /**
     * {@inheritdoc}
     * @return never
     * @throws \BadMethodCallException
     */
    public function startBidiStreamingCall(Call $call, array $options)
    {
        $this->throwUnsupportedException();
    }

    /**
     * {@inheritdoc}
     */
    public function close()
    {
        // Nothing to do.
    }

    /**
     * @param array $options
     * @return array
     */
    private static function buildCommonHeaders(array $options)
    {
        $headers = isset($options['headers'])
            ? $options['headers']
            : [];

        if (!is_array($headers)) {
            throw new \InvalidArgumentException(
                'The "headers" option must be an array'
            );
        }

        // If not already set, add an auth header to the request
        if (!isset($headers['Authorization']) && isset($options['credentialsWrapper'])) {
            $credentialsWrapper = $options['credentialsWrapper'];
            $audience = isset($options['audience'])
                ? $options['audience']
                : null;
            $callback = $credentialsWrapper
                ->getAuthorizationHeaderCallback($audience);
            // Prevent unexpected behavior, as the authorization header callback
            // uses lowercase "authorization"
            unset($headers['authorization']);
            $authHeaders = $callback();
            if (!is_array($authHeaders)) {
                throw new \UnexpectedValueException(
                    'Expected array response from authorization header callback'
                );
            }
            $headers += $authHeaders;
        }

        return $headers;
    }

    /**
     * @return callable
     * @throws ValidationException
     */
    private static function buildHttpHandlerAsync()
    {
        try {
            return [HttpHandlerFactory::build(), 'async'];
        } catch (Exception $ex) {
            throw new ValidationException("Failed to build HttpHandler", $ex->getCode(), $ex);
        }
    }

    /**
     * Set the path to a client certificate.
     *
     * @param callable $clientCertSource
     */
    private function configureMtlsChannel(callable $clientCertSource)
    {
        $this->clientCertSource = $clientCertSource;
    }

    /**
     * @return never
     * @throws \BadMethodCallException
     */
    private function throwUnsupportedException()
    {
        throw new \BadMethodCallException(
            "Streaming calls are not supported while using the {$this->transportName} transport."
        );
    }

    private static function loadClientCertSource(callable $clientCertSource)
    {
        $certFile = tempnam(sys_get_temp_dir(), 'cert');
        $keyFile = tempnam(sys_get_temp_dir(), 'key');
        list($cert, $key) = call_user_func($clientCertSource);
        file_put_contents($certFile, $cert);
        file_put_contents($keyFile, $key);

        // the key and the cert are returned in one temporary file
        return [$certFile, $keyFile];
    }
}


text:
var selfEasyrtcid = "";

function initApp() {
    if( window.localStorage && window.localStorage.easyrtcUserName ) {
        document.getElementById('userName').value = window.localStorage.easyrtcUserName;
    }
}

function disable(domId) {
    document.getElementById(domId).disabled = "disabled";
}

function enable(domId) {
    document.getElementById(domId).disabled = "";
}

var contactedListeners = {};
var nameToIdMap = {};

function connect() {
    easyrtc.enableDebug(false);
    var tempName = document.getElementById('userName').value;
    if(  !easyrtc.isNameValid(tempName)) {
        easyrtc.showError("BAD-USER-NAME", "illegal user name");
        return;
    }
    easyrtc.setUsername(tempName);
    if( window.localStorage && window.localStorage.easyrtcUserName ) {
        window.localStorage.easyrtcUserName = tempName;
    }
    console.log("Initializing with username " + tempName);
    easyrtc.setScreenCapture();
    easyrtc.enableAudio(document.getElementById("shareAudio").checked);
    easyrtc.setRoomOccupantListener(function (roomName, otherPeers){
        var easyrtcid;
        for(easyrtcid in otherPeers ) {
            if( !contactedListeners[easyrtcid]) {
                easyrtc.sendPeerMessage(easyrtcid, "available", {
                    sender:true
                }, function(){}, function(errCode, errorText) {
                    console.log("messaging error" + errorText);
                });
            }
        }
        contactedListeners = otherPeers;
    });

    easyrtc.setPeerListener(function(easyrtcid, msgType, data){});

    easyrtc.connect("easyrtc.videoScreen", loginSuccess, loginFailure);
}

function hangup() {
    easyrtc.hangupAll();
    disable('hangupButton');
}

function loginSuccess(easyrtcid) {
    disable("connectButton");
    disable("shareAudio");
    enable("disconnectButton");
    selfEasyrtcid = easyrtcid;
    document.getElementById("iam").innerHTML = "Connected";
}

function loginFailure(errorCode, message) {
    easyrtc.showError(errorCode, message);
}

function disconnect() {
    document.getElementById("iam").innerHTML = "logged out";
    easyrtc.disconnect();
    enable("shareAudio");
    console.log("disconnecting from server");
    enable("connectButton");
    disable("disconnectButton");
    easyrtc.setVideoObjectSrc(document.getElementById('callerAudio'), "");
}

easyrtc.setStreamAcceptor( function(easyrtcid, stream) {
    var audio = document.getElementById('callerAudio');
    easyrtc.setVideoObjectSrc(audio,stream);
    console.log("got audio from " + easyrtc.idToName(easyrtcid));
    enable("hangupButton");
});

easyrtc.setOnStreamClosed( function (easyrtcid) {
    easyrtc.setVideoObjectSrc(document.getElementById('callerAudio'), "");
    disable("hangupButton");
});

var callerPending = null;

easyrtc.setCallCancelled( function(easyrtcid){
    if( easyrtcid === callerPending) {
        document.getElementById('acceptCallBox').style.display = "none";
        callerPending = false;
    }
});

easyrtc.setAcceptChecker(function(easyrtcid, cb) {
    document.getElementById('acceptCallBox').style.display = "block";
    callerPending = easyrtcid;

   document.getElementById('acceptCallLabel').innerHTML = "Accept incoming call from " + easyrtc.idToName(easyrtcid) + " ?";

    var acceptTheCall = function(wasAccepted) {
        document.getElementById('acceptCallBox').style.display = "none";
        cb(wasAccepted);
        callerPending = null;
    };
    document.getElementById("callAcceptButton").onclick = function() {
        console.log("accepted the call");
        acceptTheCall(true);
    };
    document.getElementById("callRejectButton").onclick =function() {
        console.log("rejected the call");
        acceptTheCall(false);
    };
} );


text:
package com.huawei.streaming.cql.executor.expressioncreater;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.huawei.streaming.api.AnnotationUtils;
import com.huawei.streaming.cql.exception.ExecutorException;
import com.huawei.streaming.cql.semanticanalyzer.analyzecontext.OrderByClauseAnalyzeContext;
import com.huawei.streaming.cql.semanticanalyzer.analyzecontext.expressiondesc.ExpressionDescribe;
import com.huawei.streaming.exception.ErrorCode;
import com.huawei.streaming.expression.IExpression;
import com.huawei.streaming.process.sort.SortCondition;

/**
 * 创建各种表表达式实例
 *
 */
public class ExpressionCreatorFactory
{

    private static final Logger LOG = LoggerFactory.getLogger(ExpressionCreatorFactory.class);

    /**
     * 创建各类表达式实例
     *
     * @param expressDesc 表达式描述
     * @param systemConfig 系统全局参数
     * @return 表达式实例
     * @throws ExecutorException 执行器异常
     */
    public static IExpression createExpression(ExpressionDescribe expressDesc, Map<String, String> systemConfig)
        throws ExecutorException
    {
        Class< ? extends ExpressionCreator> creatorClass =
            AnnotationUtils.getExpressionCreatorAnnoationOverClass(expressDesc.getClass());
        if (creatorClass == null)
        {
            ExecutorException exception = new ExecutorException(ErrorCode.SEMANTICANALYZE_UNKOWN_CLASS);
            LOG.error("Expression class is unkown.", exception);
            throw exception;
        }

        ExpressionCreator creator = createExpressionCreatorInstance(creatorClass);
        return creator.createInstance(expressDesc, systemConfig);
    }

    private static ExpressionCreator createExpressionCreatorInstance(Class< ? extends ExpressionCreator> creator)
        throws ExecutorException
    {
        try
        {
            return creator.newInstance();
        }
        catch (ReflectiveOperationException e)
        {
            ExecutorException exception = new ExecutorException(ErrorCode.SEMANTICANALYZE_UNKOWN_CLASS, creator.getName());
            LOG.error("Failed to create instance.", exception);

            throw exception;
        }
    }

    /**
     * 创建order by表达式
     *
     * @param parseContext order by解析内容
     * @return order by表达式
     * @throws ExecutorException 运行期异常
     */
    public static List<SortCondition> createOrderByExpression(OrderByClauseAnalyzeContext parseContext)
        throws ExecutorException
    {
        LOG.info("start to create order by expression");
        return new OrderByExpressionCreator().createInstance(parseContext);
    }
}


text:
from __future__ import absolute_import
import re

import regrws.payload
import regrws.restful

class DictFromTemplate(object):

    """Class for method object for converting a template to a dict."""

    _regex = re.compile(r'\d\d\.(.*):(.*)')

    def __init__(self, template):
        """Return a DictFromTemplate object that will convert the
        template string to a dict.
        """

        self.template = template
        self.parsed_template = {}

    def run(self):
        """Return dict containing parsed contents of template string.

        All dict item values are lists because template field labels
        (used for dict keys) can be repeated. The returned dict is
        suitable for use with PayloadFromTemplateDict.
        """

        for line in self.template:
            match = self._regex.match(line)
            if match:
                self._process(match)
        return self.parsed_template

    def _process(self, m):
        # Create/modify dict item
        key = m.group(1).strip()
        value = m.group(2).strip()
        if key in self.parsed_template:
            self.parsed_template[key].append(value)
        else:
            self.parsed_template[key] = [value]

class _PayloadFromDict(object):

    """Abstract class for method object for converting a dict to a
    payload.
    """

    # The following class attributes are overridden in subclasses.
    _handler = {}  # map of dict keys to handler method names
    _attr = {}  # map of dict keys to payload's simple list attributes
    _ignore = ()  # dict keys to ignore (not used in payload)

    def __init__(self, source, target):
        """Return a PayloadFromDict object that will convert the
        source dict to a payload of the target class.

        All values of dict items are expected to be lists.
        """

        self._verify_class_dicts()
        self.source = source
        # this relies on payload module names matching payload class names
        self.module = getattr(regrws.payload, target.__module__.split('.')[-1])
        self.payload = target()

    def _verify_class_dicts(self):
        # ensure at least one required class dict is not empty
        if not (self._handler or self._attr):
            msg = '_handler or _attr must be populated in derived classes'
            # not the most appropriate exception
            raise NotImplementedError(msg)

    def run(self):
        """Return payload built from dict."""

        for key, value in self.source.iteritems():
            if key in self._handler:
                # call the corresponding handler
                method = getattr(self, self._handler[key])
                method(value)
            elif key in self._attr:
                self._assign(self._attr[key], value)
            elif key in self._ignore:
                continue
            else:
                raise regrws.restful.RegRwsError('%s has no attribute corresponding to key %s' % (self.payload.__class__, key))
        return self.payload

    def _assign(self, attr, value):
        # assign value to attribute if payload has that attribute
        self._verify_attribute(attr)
        setattr(self.payload, attr, value)

    def _contact_type(self, value):
        self._verify_attribute('contactType')
        if value == ['P']:
            self.payload.contactType = ['PERSON']
        elif value == ['R']:
            self.payload.contactType = ['ROLE']

    def _address(self, value):
        if not self.payload.streetAddress:
            self.payload.streetAddress = [self.module.streetAddress()]
        for count, line in enumerate(value):
            self.payload.streetAddress[0].add_line(self.module.line(count,
                                                                    line))

    def _comment(self, value):
        if not self.payload.comment:
            self.payload.comment = [self.module.comment()]
        for count, line in enumerate(value):
            self.payload.comment[0].add_line(self.module.line(count, line))

    def _country_code(self, value):
        iso3166_1 = self.module.iso3166_1(code2=value)
        self.payload.iso3166_1 = [iso3166_1]

    def _phone_office(self, value):
        self._phone(value, 'O')

    def _phone_mobile(self, value):
        self._phone(value, 'M')

    def _phone_fax(self, value):
        self._phone(value, 'F')

    def _phone(self, value, type_code):
        if not self.payload.phones:
            self.payload.phones = [self.module.phones()]
        type_ = [self.module.type_(code=[type_code])]
        self.payload.phones[0].add_phone(self.module.phone(number=value,
                                                           type_=type_))

    def _poc_admin(self, value):
        self._poc(value, 'AD')

    def _poc_tech(self, value):
        self._poc(value, 'T')

    def _poc_abuse(self, value):
        self._poc(value, 'AB')

    def _poc_noc(self, value):
        self._poc(value, 'N')

    def _poc(self, value, function):
        if not self.payload.pocLinks:
            self.payload.pocLinks = [self.module.pocLinks()]
        self.payload.pocLinks[0].add_pocLinkRef(self.module.pocLinkRef(function,
                                                                       value[0]))

    def _office_extension(self, value):
        for phone in self.payload.phones[0].phone:
            if phone.type_[0].code[0] == 'O':
                phone.extension = value

    def _email_address(self, value):
        if not self.payload.emails:
            self.payload.emails = [self.module.emails()]
        for email in value:
            self.payload.emails[0].add_email(email)

    def _verify_attribute(self, attr):
        # source dict should not contain keys that do not correspond to
        # input target class's data attributes (except for those in
        # the ignore list).
        if getattr(self.payload, attr, None) is None:
            raise regrws.restful.RegRwsError('%s does not have attribute %s' %
                                             (self.payload.__class__, attr))

class PayloadFromTemplateDict(_PayloadFromDict):

    """Method object for converting a template dict to a payload."""

    # map of dict keys to handler method names
    _handler = {'Contact Type (P or R)': '_contact_type',
                'Address': '_address',
                'Country Code': '_country_code',
                'Office Phone Number': '_phone_office',
                'Office Phone Number Extension': '_office_extension',
                'E-mail Address': '_email_address',
                'Mobile': '_phone_mobile',
                'Fax': '_phone_fax',
                'Public Comments': '_comment',
                'Org Address': '_address',
                'Org Country Code': '_country_code',
                'Admin POC Handle': '_poc_admin',
                'Tech POC Handle': '_poc_tech',
                'Abuse POC Handle': '_poc_abuse',
                'NOC POC Handle': '_poc_noc'}
    # map of dict keys to payload's simple list attributes
    _attr = {'Last Name or Role Account': 'lastName',
             'First Name': 'firstName',
             'Middle Name': 'middleName',
             'Company Name': 'companyName',
             'City': 'city',
             'State/Province': 'iso3166_2',
             'Postal Code': 'postalCode',
             "Organization's Legal Name": 'orgName',
             "Organization's D/B/A": 'dbaName',
             'Business Tax ID Number (DO NOT LIST SSN)': 'taxId',
             'Org City': 'city',
             'Org State/Province': 'iso3166_2',
             'Org Postal Code': 'postalCode'}
    # dict keys to ignore (not used in payload)
    _ignore = ('API Key',
               'Registration Action (N,M, or R)',
               'Existing POC Handle',
               'Existing OrgID',
               'Referral Server',
               'Additional Information')


text:
/*
 * @lc app=leetcode id=705 lang=java
 *
 * [705] Design HashSet
 *
 * https://leetcode.com/problems/design-hashset/description/
 *
 * algorithms
 * Easy (64.50%)
 * Total Accepted:    108.2K
 * Total Submissions: 167.7K
 * Testcase Example:  '["MyHashSet","add","add","contains","contains","add","contains","remove","contains"]\n' +
  '[[],[1],[2],[1],[3],[2],[2],[2],[2]]'
 *
 * Design a HashSet without using any built-in hash table libraries.
 *
 * To be specific, your design should include these functions:
 *
 *
 * add(value): Insert a value into the HashSet.
 * contains(value) : Return whether the value exists in the HashSet or not.
 * remove(value): Remove a value in the HashSet. If the value does not exist in
 * the HashSet, do nothing.
 *
 *
 *
 * Example:
 *
 *
 * MyHashSet hashSet = new MyHashSet();
 * hashSet.add(1);
 * hashSet.add(2);
 * hashSet.contains(1);    // returns true
 * hashSet.contains(3);    // returns false (not found)
 * hashSet.add(2);
 * hashSet.contains(2);    // returns true
 * hashSet.remove(2);
 * hashSet.contains(2);    // returns false (already removed)
 *
 *
 *
 * Note:
 *
 *
 * All values will be in the range of [0, 1000000].
 * The number of operations will be in the range of [1, 10000].
 * Please do not use the built-in HashSet library.
 *
 *
 */
class MyHashSet {

    Bucket[] buckets;
    int mapSize;

    /** Initialize your data structure here. */
    public MyHashSet() {
        mapSize = 10003;
        buckets = new Bucket[mapSize];
        for (int i = 0; i < mapSize; i++) {
            buckets[i] = new Bucket();
        }
    }

    public void add(int key) {
        buckets[key%mapSize].add(key);
    }

    public void remove(int key) {
        buckets[key%mapSize].remove(key);
    }

    /** Returns true if this set contains the specified element */
    public boolean contains(int key) {
        return buckets[key%mapSize].contains(key);
    }
}

public class Bucket {
    List<Integer> ls = new LinkedList<>();

    public void add(int key) {
        if (!contains(key))
            ls.add(key);
    }

    public void remove(int key) {
        ls.remove((Integer)key);
    }

    public boolean contains(int key) {
        return ls.contains(key);
    }
}

/**
 * Your MyHashSet object will be instantiated and called as such:
 * MyHashSet obj = new MyHashSet();
 * obj.add(key);
 * obj.remove(key);
 * boolean param_3 = obj.contains(key);
 */


text:
#ifndef __GUMMI_EXTERNAL_H__
#define __GUMMI_EXTERNAL_H__

#include <glib.h>

typedef struct {
  gboolean exists;
  gchar* version;
} External;

typedef enum _ExternalProg {
  EX_TEXLIVE = 0,
  EX_LATEX,
  EX_PDFLATEX,
  EX_XELATEX,
  EX_RUBBER,
  EX_LATEXMK,
  EX_TEXCOUNT
} ExternalProg;

gboolean external_exists(const gchar* program);
gboolean external_hasflag(const gchar* program, const gchar* flag);

gchar* external_version(const gchar* program);
gdouble external_version2(ExternalProg program);

#endif /* __GUMMI_EXTERNAL_H__ */


text:
#import "NSObject-Protocol.h"

@protocol RCWaveformViewDelegate <NSObject>

@optional
- (void)waveformViewControllerDidChangeSelectedTimeRange:(id)arg1;
- (void)waveformViewController:(id)arg1 didScrubToTime:(double)arg2;
@end


text:
rebar3_erlydtl_plugin
=====

A rebar plugin

Build
-----

    $ rebar3 compile

Use
---

Add the plugin to your rebar config:

    {plugins, [
        {rebar3_erlydtl_plugin, ".*", {git, "https://github.com/tsloughter/rebar3_erlydtl_plugin.git", {branch, "master"}}}
    ]}.

Then just call your plugin directly in an existing application:

    $ rebar3 erlydtl compile
    ===> Fetching rebar3_erlydtl_plugin
    ===> Compiling rebar3_erlydtl_plugin

To have it invoked automatically when running `rebar3 compile` add it as a `provider_hooks`:

```
{provider_hooks, [
                 {pre, [{compile, {erlydtl, compile}}]}
                 ]}.
```


text:
module Her
  module Model
    module Associations
      class Association
        # @private
        attr_accessor :params

        # @private
        def initialize(parent, opts = {})
          @parent = parent
          @opts = opts
          @params = {}

          @klass = @parent.class.her_nearby_class(@opts[:class_name])
          @name = @opts[:name]
        end

        # @private
        def self.proxy(parent, opts = {})
          AssociationProxy.new new(parent, opts)
        end

        # @private
        def self.parse_single(association, klass, data)
          data_key = association[:data_key]
          return {} unless data[data_key]

          klass = klass.her_nearby_class(association[:class_name])
          if data[data_key].kind_of?(klass)
            { association[:name] => data[data_key] }
          else
            { association[:name] => klass.new(klass.parse(data[data_key])) }
          end
        end

        # @private
        def assign_single_nested_attributes(attributes)
          if @parent.attributes[@name].blank?
            @parent.attributes[@name] = @klass.new(@klass.parse(attributes))
          else
            @parent.attributes[@name].assign_attributes(attributes)
          end
        end

        # @private
        def fetch(opts = {})
          attribute_value = @parent.attributes[@name]
          return @opts[:default].try(:dup) if @parent.attributes.include?(@name) && (attribute_value.nil? || !attribute_value.nil? && attribute_value.empty?) && @params.empty?

          return @cached_result unless @params.any? || @cached_result.nil?
          return @parent.attributes[@name] unless @params.any? || @parent.attributes[@name].blank?

          if @parent.persisted?
            path = build_association_path lambda { "#{@parent.request_path(@params)}#{@opts[:path]}" }
            @klass.get(path, @params).tap do |result|
              @cached_result = result unless @params.any?
            end
          else
            # Association info is stored in a hash available from the class (associations)
            # The keys of the associations hash are the association types
            # The values of the hash are arrays of hashes
            # Find the key that points to the array containing the association identified by @name
            association_type = @parent.class.associations.detect {|type, list| list.any? {|a| a[:name].to_s == @name.to_s}}.try(:first)

            @cached_result = association_type == :has_many ? [] : nil
          end
        end

        # @private
        def build_association_path(code)
          begin
            instance_exec(&code)
          rescue Her::Errors::PathError
            return nil
          end
        end

        # Add query parameters to the HTTP request performed to fetch the data
        #
        # @example
        #   class User
        #     include Her::Model
        #     has_many :comments
        #   end
        #
        #   user = User.find(1)
        #   user.comments.where(:approved => 1) # Fetched via GET "/users/1/comments?approved=1
        def where(params = {})
          return self if params.blank? && @parent.attributes[@name].blank?
          AssociationProxy.new self.clone.tap { |a| a.params = a.params.merge(params) }
        end
        alias all where

        # Fetches the data specified by id
        #
        # @example
        #   class User
        #     include Her::Model
        #     has_many :comments
        #   end
        #
        #   user = User.find(1)
        #   user.comments.find(3) # Fetched via GET "/users/1/comments/3
        def find(id)
          return nil if id.blank?
          path = build_association_path lambda { "#{@parent.request_path(@params)}#{@opts[:path]}/#{id}" }
          @klass.get_resource(path, @params)
        end

      end
    end
  end
end


text:
package com.spring.controller.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.spring.model.Dish;
import com.spring.model.Order;
import com.spring.service.DishService;
import com.spring.service.OrderService;
import com.spring.util.SessionUtil;

public class AccountService {

	@Autowired
	private OrderService _orderService;

	@Autowired
	private DishService _dishService;

	public List<Order> getOrderedList() {
		String username = SessionUtil.username;
		List<Order> listOrderedResult = new ArrayList<>();
		List<Order> listOrdered = _orderService.getOrderedListByUsername(username);
		for(Order order : listOrdered) {
			int orderId = order.getId();
			List<Dish> listDish = _dishService.getOrderedDishListByOrderId(orderId);
			order.setListDish(listDish);
			listOrderedResult.add(order);
		}

		return listOrderedResult;
	}
}


text:
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
 *
 * LibTomCrypt is a library that provides various cryptographic
 * algorithms in a highly modular and flexible manner.
 *
 * The library is free for all purposes without any express
 * guarantee it works.
 */
#include "tomcrypt_private.h"

#ifdef LTC_MRSA

/**
  Import RSA key from raw numbers

  @param N       RSA's N
  @param Nlen    RSA's N's length
  @param e       RSA's e
  @param elen    RSA's e's length
  @param d       RSA's d  (only private key, NULL for public key)
  @param dlen    RSA's d's length
  @param key     [out] the destination for the imported key
  @return CRYPT_OK if successful
*/
int rsa_set_key(const unsigned char *N,  unsigned long Nlen,
                const unsigned char *e,  unsigned long elen,
                const unsigned char *d,  unsigned long dlen,
                rsa_key *key)
{
   int err;

   LTC_ARGCHK(key         != NULL);
   LTC_ARGCHK(N           != NULL);
   LTC_ARGCHK(e           != NULL);
   LTC_ARGCHK(ltc_mp.name != NULL);

   err = mp_init_multi(&key->e, &key->d, &key->N, &key->dQ, &key->dP, &key->qP, &key->p, &key->q, NULL);
   if (err != CRYPT_OK) return err;

   if ((err = mp_read_unsigned_bin(key->N , (unsigned char *)N , Nlen)) != CRYPT_OK)    { goto LBL_ERR; }
   if ((err = mp_read_unsigned_bin(key->e , (unsigned char *)e , elen)) != CRYPT_OK)    { goto LBL_ERR; }
   if (d && dlen) {
      if ((err = mp_read_unsigned_bin(key->d , (unsigned char *)d , dlen)) != CRYPT_OK) { goto LBL_ERR; }
      key->type = PK_PRIVATE;
   }
   else {
      key->type = PK_PUBLIC;
   }
   return CRYPT_OK;

LBL_ERR:
   rsa_free(key);
   return err;
}

/**
  Import factors of an RSA key from raw numbers

  Only for private keys.

  @param p       RSA's p
  @param plen    RSA's p's length
  @param q       RSA's q
  @param qlen    RSA's q's length
  @param key     [out] the destination for the imported key
  @return CRYPT_OK if successful
*/
int rsa_set_factors(const unsigned char *p,  unsigned long plen,
                    const unsigned char *q,  unsigned long qlen,
                    rsa_key *key)
{
   int err;

   LTC_ARGCHK(key         != NULL);
   LTC_ARGCHK(p           != NULL);
   LTC_ARGCHK(q           != NULL);
   LTC_ARGCHK(ltc_mp.name != NULL);

   if (key->type != PK_PRIVATE) return CRYPT_PK_TYPE_MISMATCH;

   if ((err = mp_read_unsigned_bin(key->p , (unsigned char *)p , plen)) != CRYPT_OK) { goto LBL_ERR; }
   if ((err = mp_read_unsigned_bin(key->q , (unsigned char *)q , qlen)) != CRYPT_OK) { goto LBL_ERR; }
   return CRYPT_OK;

LBL_ERR:
   rsa_free(key);
   return err;
}

/**
  Import CRT parameters of an RSA key from raw numbers

  Only for private keys.

  @param dP      RSA's dP
  @param dPlen   RSA's dP's length
  @param dQ      RSA's dQ
  @param dQlen   RSA's dQ's length
  @param qP      RSA's qP
  @param qPlen   RSA's qP's length
  @param key     [out] the destination for the imported key
  @return CRYPT_OK if successful
*/
int rsa_set_crt_params(const unsigned char *dP, unsigned long dPlen,
                       const unsigned char *dQ, unsigned long dQlen,
                       const unsigned char *qP, unsigned long qPlen,
                       rsa_key *key)
{
   int err;

   LTC_ARGCHK(key         != NULL);
   LTC_ARGCHK(dP          != NULL);
   LTC_ARGCHK(dQ          != NULL);
   LTC_ARGCHK(qP          != NULL);
   LTC_ARGCHK(ltc_mp.name != NULL);

   if (key->type != PK_PRIVATE) return CRYPT_PK_TYPE_MISMATCH;

   if ((err = mp_read_unsigned_bin(key->dP, (unsigned char *)dP, dPlen)) != CRYPT_OK) { goto LBL_ERR; }
   if ((err = mp_read_unsigned_bin(key->dQ, (unsigned char *)dQ, dQlen)) != CRYPT_OK) { goto LBL_ERR; }
   if ((err = mp_read_unsigned_bin(key->qP, (unsigned char *)qP, qPlen)) != CRYPT_OK) { goto LBL_ERR; }
   return CRYPT_OK;

LBL_ERR:
   rsa_free(key);
   return err;
}

#endif /* LTC_MRSA */

/* ref:         HEAD -> develop */
/* git commit:  9c0d7085234bd6baba2ab8fd9eee62254599341c */
/* commit time: 2018-10-15 10:51:17 +0200 */


text:
module ThumborRails
  module Generators
    class InstallGenerator < Rails::Generators::Base
      desc "Copy ThumborRails default configuration files"
      source_root File.expand_path('../templates', __FILE__)

      def copy_config
        template "config/initializers/thumbor_rails.rb"
      end
    end
  end
end


text:
package swevoq.ebread.com.Chat.Presenter.Settings;

import android.content.Context;

import swevoq.ebread.com.Chat.Model.Settings.VoiceSettings;
import swevoq.ebread.com.Libraries.FirebaseLib.FirebaseAccessPoint;

/**
 * Created by Teslaru Nicolae on 21/04/2017.
 */

public class VoiceSettingsPresenter {
    private FirebaseAccessPoint firebase;

    public VoiceSettingsPresenter(){
        firebase = new FirebaseAccessPoint();
    }

    public VoiceSettings getVoiceSettings(Context context) {
        return firebase.getVoiceSettings(context);
    }

    public void updateVoiceSettings(Context context, VoiceSettings updatedVoiceSettings) {
        firebase.updateVoiceSettings(context,updatedVoiceSettings);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="Encoding" native2AsciiForPropertiesFiles="true">
    <file url="PROJECT" charset="UTF-8" />
  </component>
</project>


text:
var ozpIwc = ozpIwc || {};
ozpIwc.util = ozpIwc.util || {};
/**
 * @module ozpIwc
 * @submodule ozpIwc.util
 */

ozpIwc.util.AjaxPersistenceQueue = (function (log, util) {
    /**
     * An AJAX queueing class that limits the amount of AJAX requests via the IWC by using ajax pools.
     *
     * @class AjaxPersistenceQueue
     * @namespace ozpIwc.util
     * @param {Object} config
     * @param {Number} config.poolSize
     * @constructor
     */
    var AjaxPersistenceQueue = function (config) {
        config = config || {};
        this.poolSize = config.poolSize || 1;

        this.syncPool = []; // The tail of the promise chain for each pool

        // populate the slots with resolved promises
        for (var i = 0; i < this.poolSize; ++i) {
            this.syncPool.push(Promise.resolve());
        }

        // a counter that round-robins the requests to persist among the slots
        this.nextSlot = 0;

        // maps the iwcUri to the promise that is saving it
        this.queuedSyncs = {};
    };

    /**
     * Calls the callback when a slot in the ajax sync pool becomes available.
     * Returns a promise that resolve when the slotted operation begins.
     * Rejects if the unique id is already slotted.
     *
     * @method acquireSlot
     * @private
     * @static
     * @param {AjaxPersistenceQueue} queue
     * @param {String|Number} uuid
     * @param {Function} cb
     * @returns {*}
     */
    var acquireSlot = function (queue, uuid, cb) {
        // If the slot requested is filled reject to notify caller.
        if (!queue.queuedSyncs[uuid]) {
            queue.nextSlot = (queue.nextSlot + 1) % queue.poolSize;
            queue.syncPool[queue.nextSlot] = queue.queuedSyncs[uuid] = queue.syncPool[queue.nextSlot].then(function () {
                return cb();
            }).then(function (resp) {
                delete queue.queuedSyncs[uuid];
                return resp;
            }, function (err) {
                delete queue.queuedSyncs[uuid];
                throw err;
            });
            return queue.queuedSyncs[uuid];
        } else {
            return queue.queuedSyncs[uuid];
        }

    };

    /**
     * A Promise wrapped implementation of AJAX PUT for an IWC node.
     *
     * @method syncNode
     * @private
     * @param {ozpIwc.api.base.Node} node
     * @return {Promise} Returns a promise that will resolve after AJAX is complete.
     */
    var syncNode = function (node) {
        var self = node.getSelfUri() || {};
        var uri = self.href;
        var contentType = self.type;

        //If the node cannot provide the needed information for sending to the server
        //continue silently and resolve.
        if (!uri) {
            return Promise.resolve();
        }
        if (node.deleted) {
            return util.ajax({
                href: uri,
                method: 'DELETE'
            });
        } else {
            var entity = node.serialize();
            if (typeof(entity) !== "string") {
                entity = JSON.stringify(entity);
            }
            log.debug("PUT " + uri, entity);
            return util.ajax({
                href: uri,
                method: 'PUT',
                data: entity,
                headers: [{
                    name: "Content-Type",
                    value: contentType
                }]
            }).then(function (result) {
                log.debug("  saving to " + uri, result);
                return result;
            }, function (error) {
                log.error("  FAILED saving to " + uri, error);
            });
        }
    };

    /**
     * FIXME: it's possible to have poolSize updates in flight for a rapidly changing node when the pool is lightly
     * utilized. The duplicate call will occur when all of these conditions are met:
     *     * An ajax request for the node is still active.
     *     * queueNode(n) is called
     *     * the new sync promise reaches the head of its pool queue
     *   Example with poolSize=3 and node "n"
     *     queueNode(n) -> assigns n to pool 1
     *        pool 1 -> starts AJAX call and clears queuedSyncs[n]
     *     queueNode(n) -> n is not queued, so assigns n to pool 2
     *        pool 2 -> starts AJAX call and clears queuedSyncs[n]
     *     queueNode(n) -> n is not queued, so assigns n to pool 3
     *        pool 3 -> starts AJAX call and clears queuedSyncs[n]
     *
     *
     * @method queueNode
     * @param {String} iwcUri
     * @param {ozpIwc.api.base.Node} node
     * @return {*}
     */
    AjaxPersistenceQueue.prototype.queueNode = function (iwcUri, node) {
        var slotCall = function () {
            return syncNode(node).catch(function () {
                log.info("[AJAX] [" + iwcUri + "] Ignoring persist, as one is already queued.");
            });
        };
        return acquireSlot(this, "Node:" + iwcUri, slotCall);
    };

    /**
     * An ajax sync pool wrapped AJAX call. Pools AJAX requests so requests do not get dropped
     * if too many connections are open.
     *
     * @method queueAjax
     * @param {Object} config
     * @param {String} config.href
     * @param {String} config.method
     *
     * @returns {Promise}
     */
    AjaxPersistenceQueue.prototype.queueAjax = function (config) {
        config = config || {};
        if (!config.href) {
            throw "Ajax queue requires href";
        }
        if (!config.method) {
            throw "Ajax queue requires method";
        }

        var resolve, reject;
        var retPromise = new Promise(function (res, rej) {
            resolve = res;
            reject = rej;
        });
        var slotCall = function () {
            return util.ajax(config).then(resolve, reject);
        };

        acquireSlot(this, config.method + ":" + config.href + ":" + Date.now(), slotCall);

        return retPromise;
    };

    return AjaxPersistenceQueue;
}(ozpIwc.log, ozpIwc.util));


text:
/* global rpgtoolkit, rpgcode */

function screenRenderer() {
  this.renderNowCanvas = document.createElement("canvas");
  this.renderNowCanvas.width = Crafty.viewport._width;
  this.renderNowCanvas.height = Crafty.viewport._height;
}

screenRenderer.prototype.render = function (context) {
  var x = -Crafty.viewport._x;
  var y = -Crafty.viewport._y;
  var width = Crafty.viewport._width;
  var height = Crafty.viewport._height;

  // Shorthand reference.
  var player = rpgtoolkit.craftyPlayer.player;
  player.x = rpgtoolkit.craftyPlayer.x;
  player.y = rpgtoolkit.craftyPlayer.y;

  if (rpgtoolkit.craftyBoard.show) {
    this.board = rpgtoolkit.craftyBoard.board;

    // Draw a black background.
    context.fillStyle = "#000000";
    context.fillRect(x, y, width, height);

    if (!this.board.layerCache.length) {
      this.board.generateLayerCache();
    }

    // Loop through layers.
    for (var i = 0; i < this.board.layerCount; i++) {
      /*
       * Render this layer.
       */
      context.drawImage(this.board.layerCache[i], x, y, width, height, x, y, width, height);

      /*
       * Sort sprites for depth.
       */
      var layerSprites = this.sortSprites(i, player);

      /*
       * Render sprites.
       */
      layerSprites.forEach(function (sprite) {
        var asset = Crafty.__paths.images +
                sprite.graphics.active.frames[sprite.graphics.frameIndex];
        var frame = Crafty.assets[asset];
        context.drawImage(
                frame,
                sprite.x - (frame.width / 2),
                sprite.y - frame.height,
                sprite.graphics.active.animationWidth,
                sprite.graphics.active.animationHeight);

        // Draw collision rectangle.
        var boxWidth = sprite.graphics.active.boundingBox.width;
        var boxHeight = sprite.graphics.active.boundingBox.height;
        context.beginPath();
        context.lineWidth = "2";
        context.strokeStyle = "#FFFFFF";
        context.rect(
                sprite.x - (boxWidth / 2),
                sprite.y - boxHeight,
                boxWidth,
                boxHeight);
        context.stroke();
      });
    }

    /*
     * (Optional) Render Vectors.
     */
    this.board.vectors.forEach(function (vector) {
      var haveMoved = false;
      context.strokeStyle = "#FFFFFF";
      context.lineWidth = 2.0;
      context.beginPath();
      vector.points.forEach(function (point) {
        if (!haveMoved) {
          context.moveTo(point.x, point.y);
          haveMoved = true;
        } else {
          context.lineTo(point.x, point.y);
        }
      }, this);
      context.closePath();
      context.stroke();
    }, this);

    /*
     * (Optional) Render Programs.
     */
    this.board.programs.forEach(function (program) {
      var haveMoved = false;
      context.strokeStyle = "#FFFF00";
      context.lineWidth = 2.0;
      context.beginPath();
      program.points.forEach(function (point) {
        if (!haveMoved) {
          context.moveTo(point.x, point.y);
          haveMoved = true;
        } else {
          context.lineTo(point.x, point.y);
        }
      }, this);
      context.closePath();
      context.stroke();
    }, this);
  }

  /*
   * Render rpgcode canvases.
   */
  var canvases = rpgcode.canvases;
  for (var property in canvases) {
    if (canvases.hasOwnProperty(property)) {
      var element = canvases[property];
      if (element.render) {
        context.drawImage(element.canvas, x, y);
      }
    }
  }
};

screenRenderer.prototype.sortSprites = function (layer, player) {
  var layerSprites = [];
  if (player.layer === layer && player.renderReady) {
    layerSprites.push(player);
  }

  this.board.sprites.forEach(function (entity) {
    var sprite = entity.sprite;
    var item = sprite.item;
    if (layer === sprite.layer && item.renderReady) {
      sprite.item.x = entity.x;
      sprite.item.y = entity.y;
      layerSprites.push(sprite.item);
    }
  });

  layerSprites.sort(function (a, b) {
    return a.y - b.y;
  });

  return layerSprites;
};


text:
import { strict as assert } from "assert";
import * as fs from "fs";
import * as path from "path";
import * as vs from "vscode";
import { fsPath } from "../../../shared/utils/fs";
import { activate, deleteDirectoryRecursive, helloWorldFolder } from "../../helpers";

describe("dart tasks", () => {
	beforeEach("activate", () => activate());
	const dartDocOutputPath = path.join(fsPath(helloWorldFolder), "doc");
	beforeEach("clear out sample folder", () => deleteDirectoryRecursive(dartDocOutputPath));

	it("dart.task.dartdoc causes documentation to be generated", async () => {
		assert.ok(!fs.existsSync(dartDocOutputPath));
		await new Promise<void>(async (resolve, reject) => {
			vs.tasks.onDidEndTaskProcess((task) => {
				if (task.execution === taskExecution)
					task.exitCode ? reject(new Error(`Task quit with code ${task.exitCode}`)) : resolve();
			});
			const taskExecution = await vs.commands.executeCommand<vs.TaskExecution>("dart.task.dartdoc");
		});
		assert.ok(fs.existsSync(dartDocOutputPath));
	});
});


text:
.. _whatsnew_0940:

v0.9.4 (TBD)
------------------------

Deprecations
~~~~~~~~~~~~

Enhancements
~~~~~~~~~~~~
* Multiple code style issues fixed that were reported by LGTM analysis. (:issue:`1275`, :pull:`1559`)
* Added a function to calculate one of GHI, DHI, and DNI from values of the other two.
  :py:func:`~pvlib.irradiance.complete_irradiance`
  (:issue:`1565`, :pull:`1567`)
* Add optional ``return_components`` parameter to :py:func:`pvlib.irradiance.haydavies` to return
  individual diffuse irradiance components (:issue:`1553`, :pull:`1568`)

Bug fixes
~~~~~~~~~

* Fixed bug in :py:func:`pvlib.shading.masking_angle` and :py:func:`pvlib.bifacial.infinite_sheds._ground_angle`
  where zero ``gcr`` input caused a ZeroDivisionError (:issue:`1576`, :pull:`1589`)

Testing
~~~~~~~
* Corrected a flawed test for :py:func:`~pvlib.irradiance.get_ground_diffuse` (:issue:`1569`, :pull:`1575`)

Documentation
~~~~~~~~~~~~~

Benchmarking
~~~~~~~~~~~~~
* Removed ``time_tracker_singleaxis`` function from tracking.py (:issue:`1508`, :pull:`1535`)

Requirements
~~~~~~~~~~~~

Contributors
~~~~~~~~~~~~
* Kirsten Perry (:ghuser:`kperrynrel`)
* Christian Orner (:ghuser:`chrisorner`)
* Saurabh Aneja (:ghuser:`spaneja`)
* Marcus Boumans (:ghuser:`bowie2211`)
* Karel De Brabandere (:ghuser:`kdebrab`)
* Naman Priyadarshi (:ghuser:`Naman-Priyadarshi`)


text:
package flux

import "fmt"

// Provides simple printer printers

// succeedMark is the Unicode codepoint for a check mark.
const succeedMark = "\u2713"

// failedMark is the Unicode codepoint for an X mark.
const failedMark = "\u2717"

//Passed returns a msg with a check mark
func Passed(msg string, v ...interface{}) string {
	return render(succeedMark, msg, v...)
}

//Failed returns a msg with a x mark
func Failed(msg string, v ...interface{}) string {
	return render(failedMark, msg, v...)
}

// FatalPrinter provides a hasher,stop after print interface with Fatal function
type FatalPrinter interface {
	Fatal(v ...interface{})
}

//FatalFailed uses the log to print out the failed message
func FatalFailed(fr FatalPrinter, msg string, v ...interface{}) {
	fr.Fatal(Failed(msg, v...))
}

//FatalPassed uses the log to print out the passed message
func FatalPassed(fr FatalPrinter, msg string, v ...interface{}) {
	fr.Fatal(Passed(msg, v...))
}

// LogPrinter provides a simple printer interface with normal log function
type LogPrinter interface {
	Log(v ...interface{})
}

//LogFailed uses the log to print out the failed message
func LogFailed(pr LogPrinter, msg string, v ...interface{}) {
	pr.Log(Failed(msg, v...))
}

//LogPassed uses the log to print out the passed message
func LogPassed(pr LogPrinter, msg string, v ...interface{}) {
	pr.Log(Passed(msg, v...))
}

// SimplePrinter provides a simple printer interface with normal print function
type SimplePrinter interface {
	Print(v ...interface{})
}

//PrintFailed uses the log to print out the failed message
func PrintFailed(pr SimplePrinter, msg string, v ...interface{}) {
	pr.Print(Passed(msg, v...))
}

//PrintPassed uses the log to print out the passed message
func PrintPassed(pr SimplePrinter, msg string, v ...interface{}) {
	pr.Print(Passed(msg, v...))
}

//Render returns a new string with the mark put in place
func render(mark, msg string, v ...interface{}) string {
	rms := fmt.Sprintf("\t%s: %s", msg, mark)
	return fmt.Sprintf(rms, v...)
}


text:
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

#include "butil/macros.h"                           // ARRAY_SIZE
#include "butil/iobuf.h"                            // butil::IOBuf
#include "brpc/controller.h"                  // Controller
#include "brpc/builtin/sorttable_js.h"
#include "brpc/builtin/jquery_min_js.h"
#include "brpc/builtin/flot_min_js.h"
#include "brpc/builtin/viz_min_js.h"
#include "brpc/builtin/get_js_service.h"
#include "brpc/builtin/common.h"

namespace brpc {

static const char* g_last_modified = "Wed, 16 Sep 2015 01:25:30 GMT";

static void SetExpires(HttpHeader* header, time_t seconds) {
    char buf[256];
    time_t now = time(0);
    Time2GMT(now, buf, sizeof(buf));
    header->SetHeader("Date", buf);
    Time2GMT(now + seconds, buf, sizeof(buf));
    header->SetHeader("Expires", buf);
}

void GetJsService::sorttable(
    ::google::protobuf::RpcController* controller,
    const GetJsRequest* /*request*/,
    GetJsResponse* /*response*/,
    ::google::protobuf::Closure* done) {
    ClosureGuard done_guard(done);
    Controller *cntl = (Controller*)controller;
    cntl->http_response().set_content_type("application/javascript");
    SetExpires(&cntl->http_response(), 80000);
    cntl->response_attachment().append(sorttable_js_iobuf());
}

void GetJsService::jquery_min(
    ::google::protobuf::RpcController* controller,
    const GetJsRequest* /*request*/,
    GetJsResponse* /*response*/,
    ::google::protobuf::Closure* done) {
    ClosureGuard done_guard(done);
    Controller *cntl = (Controller*)controller;
    cntl->http_response().set_content_type("application/javascript");
    SetExpires(&cntl->http_response(), 600);

    const std::string* ims =
        cntl->http_request().GetHeader("If-Modified-Since");
    if (ims != NULL && *ims == g_last_modified) {
        cntl->http_response().set_status_code(HTTP_STATUS_NOT_MODIFIED);
        return;
    }
    cntl->http_response().SetHeader("Last-Modified", g_last_modified);

    if (SupportGzip(cntl)) {
        cntl->http_response().SetHeader("Content-Encoding", "gzip");
        cntl->response_attachment().append(jquery_min_js_iobuf_gzip());
    } else {
        cntl->response_attachment().append(jquery_min_js_iobuf());
    }
}

void GetJsService::flot_min(
    ::google::protobuf::RpcController* controller,
    const GetJsRequest* /*request*/,
    GetJsResponse* /*response*/,
    ::google::protobuf::Closure* done) {
    ClosureGuard done_guard(done);
    Controller *cntl = (Controller*)controller;
    cntl->http_response().set_content_type("application/javascript");
    SetExpires(&cntl->http_response(), 80000);

    const std::string* ims =
        cntl->http_request().GetHeader("If-Modified-Since");
    if (ims != NULL && *ims == g_last_modified) {
        cntl->http_response().set_status_code(HTTP_STATUS_NOT_MODIFIED);
        return;
    }
    cntl->http_response().SetHeader("Last-Modified", g_last_modified);

    if (SupportGzip(cntl)) {
        cntl->http_response().SetHeader("Content-Encoding", "gzip");
        cntl->response_attachment().append(flot_min_js_iobuf_gzip());
    } else {
        cntl->response_attachment().append(flot_min_js_iobuf());
    }
}

void GetJsService::viz_min(
    ::google::protobuf::RpcController* controller,
    const GetJsRequest* /*request*/,
    GetJsResponse* /*response*/,
    ::google::protobuf::Closure* done) {
    ClosureGuard done_guard(done);
    Controller *cntl = (Controller*)controller;
    cntl->http_response().set_content_type("application/javascript");
    SetExpires(&cntl->http_response(), 80000);

    const std::string* ims =
        cntl->http_request().GetHeader("If-Modified-Since");
    if (ims != NULL && *ims == g_last_modified) {
        cntl->http_response().set_status_code(HTTP_STATUS_NOT_MODIFIED);
        return;
    }
    cntl->http_response().SetHeader("Last-Modified", g_last_modified);

    if (SupportGzip(cntl)) {
        cntl->http_response().SetHeader("Content-Encoding", "gzip");
        cntl->response_attachment().append(viz_min_js_iobuf_gzip());
    } else {
        cntl->response_attachment().append(viz_min_js_iobuf());
    }
}

} // namespace brpc


text:
/**
 * Enumeration of possible statuses of a declared UBO.
 */
module.exports = {
    /**
     * When declaration of a UBO was created
     */
    Created: 'CREATED',
    /**
     * When declaration of a UBO was validated
     */
    Validated: 'VALIDATED',
    /**
     * When declaration of a UBO was refused
     */
    Refused: 'REFUSED'
};


text:
CPP=g++
LN=g++
AR=ar
CP=cp
SYSLIBS= -ldl -lnsl -lm -lpthread -lrt
DEFINES=
COMMON_CFLAGS= -c -Wall -D__LITTLE_ENDIAN__ -std=c++11

## CHOOSE HERE BETWEEN 32 and 64 bit architecture

##32 BIT ARCH:
#COMMON_CFLAGS+= -m32 -fpic
#LDFLAGS=-m32

#64BIT ARCH:
COMMON_CFLAGS+= -m64 -fpic
LDFLAGS=-m64

CFLAGS = $(COMMON_CFLAGS) -O2

INCLUDES= -I.

LIBS = -lfastcdr -lfastrtps $(shell test -x "$$(which pkg-config)" && pkg-config libssl libcrypto --libs --silence-errors) $(SYSLIBS)

DIRECTORIES= output.dir bin.dir

all: $(DIRECTORIES) UserDefinedTransportExample

USERDEFINEDTRANSPORTEXAMPLE_TARGET= bin/UserDefinedTransportExample

USERDEFINEDTRANSPORTEXAMPLE_SRC_CXXFILES=

USERDEFINEDTRANSPORTEXAMPLE_SRC_CPPFILES= UserDefinedTransportExample/UserDefinedTransportExampleReader.cpp \
						UserDefinedTransportExample/UserDefinedTransportExampleWriter.cpp \
						UserDefinedTransportExample/main.cpp

# Project sources are copied to the current directory
USERDEFINEDTRANSPORTEXAMPLE_SRCS= $(USERDEFINEDTRANSPORTEXAMPLE_SRC_CXXFILES) $(USERDEFINEDTRANSPORTEXAMPLE_SRC_CPPFILES)

# Source directories
USERDEFINEDTRANSPORTEXAMPLE_SOURCES_DIRS_AUX= $(foreach srcdir, $(dir $(USERDEFINEDTRANSPORTEXAMPLE_SRCS)), $(srcdir))
USERDEFINEDTRANSPORTEXAMPLE_SOURCES_DIRS= $(shell echo $(USERDEFINEDTRANSPORTEXAMPLE_SOURCES_DIRS_AUX) | tr " " "\n" | sort | uniq | tr "\n" " ")

USERDEFINEDTRANSPORTEXAMPLE_OBJS = $(foreach obj,$(notdir $(addsuffix .o, $(USERDEFINEDTRANSPORTEXAMPLE_SRCS))), output/$(obj))
USERDEFINEDTRANSPORTEXAMPLE_DEPS = $(foreach dep,$(notdir $(addsuffix .d, $(USERDEFINEDTRANSPORTEXAMPLE_SRCS))), output/$(dep))

OBJS+=  $(USERDEFINEDTRANSPORTEXAMPLE_OBJS)
DEPS+=  $(USERDEFINEDTRANSPORTEXAMPLE_DEPS)

UserDefinedTransportExample: $(USERDEFINEDTRANSPORTEXAMPLE_TARGET)

$(USERDEFINEDTRANSPORTEXAMPLE_TARGET): $(USERDEFINEDTRANSPORTEXAMPLE_OBJS)
	$(LN) $(LDFLAGS) -o $(USERDEFINEDTRANSPORTEXAMPLE_TARGET) $(USERDEFINEDTRANSPORTEXAMPLE_OBJS) $(LIBS)

vpath %.cxx $(USERDEFINEDTRANSPORTEXAMPLE_SOURCES_DIRS)
vpath %.cpp $(USERDEFINEDTRANSPORTEXAMPLE_SOURCES_DIRS)

output/%.cxx.o:%.cxx
	@echo Calculating dependencies $<
	@$(CC) $(CFLAGS) -MM $(CFLAGS) $(INCLUDES) $< | sed "s/^.*:/output\/&/g" > $(@:%.cxx.o=%.cxx.d)
	@echo Compiling $<
	@$(CC) $(CFLAGS) $(INCLUDES) $< -o $@

output/%.cpp.o:%.cpp
	@echo Calculating dependencies $<
	@$(CPP) $(CFLAGS) -MM $(CFLAGS) $(INCLUDES) $< | sed "s/^.*:/output\/&/g" > $(@:%.cpp.o=%.cpp.d)
	@echo Compiling $<
	@$(CPP) $(CFLAGS) $(INCLUDES) $< -o $@

.PHONY: UserDefinedTransportExample

clean:
	@rm -f $(OBJS)
	@rm -f $(DEPS)

ifneq ($(MAKECMDGOALS), clean)
-include $(DEPS)
endif

%.dir :
	@echo "Checking directory $*"
	@if [ ! -d $* ]; then \
		echo "Making directory $*"; \
		mkdir -p $* ; \
	fi;


text:
<?php

namespace Magento\Checkout\Service\V1\Data\Cart;

class CustomerMapperTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Magento\Checkout\Service\V1\Data\Cart\CustomerMapper
     */
    protected $mapper;

    protected function setUp()
    {
        $this->mapper = new \Magento\Checkout\Service\V1\Data\Cart\CustomerMapper();
    }

    public function testMap()
    {
        $methods = ['getCustomerId', 'getCustomerEmail', 'getCustomerGroupId', 'getCustomerTaxClassId',
            'getCustomerPrefix', 'getCustomerFirstname', 'getCustomerMiddlename', 'getCustomerLastname',
            'getCustomerSuffix', 'getCustomerDob', 'getCustomerNote', 'getCustomerNoteNotify',
            'getCustomerIsGuest', 'getCustomerGender', 'getCustomerTaxvat', '__wakeUp', ];
        $quoteMock = $this->getMock('Magento\Sales\Model\Quote', $methods, [], '', false);
        $expected = [
            Customer::ID => 10,
            Customer::EMAIL => 'customer@example.com',
            Customer::GROUP_ID => '4',
            Customer::TAX_CLASS_ID => 10,
            Customer::PREFIX => 'prefix_',
            Customer::FIRST_NAME => 'First Name',
            Customer::MIDDLE_NAME => 'Middle Name',
            Customer::LAST_NAME => 'Last Name',
            Customer::SUFFIX => 'suffix',
            Customer::DOB => '1/1/1989',
            Customer::NOTE => 'customer_note',
            Customer::NOTE_NOTIFY => 'note_notify',
            Customer::IS_GUEST => false,
            Customer::GENDER => 'male',
            Customer::TAXVAT => 'taxvat',
        ];
        $expectedMethods = [
            'getCustomerId' => 10,
            'getCustomerEmail' => 'customer@example.com',
            'getCustomerGroupId' => 4,
            'getCustomerTaxClassId' => 10,
            'getCustomerPrefix' => 'prefix_',
            'getCustomerFirstname' => 'First Name',
            'getCustomerMiddlename' => 'Middle Name',
            'getCustomerLastname' => 'Last Name',
            'getCustomerSuffix' => 'suffix',
            'getCustomerDob' => '1/1/1989',
            'getCustomerNote' => 'customer_note',
            'getCustomerNoteNotify' => 'note_notify',
            'getCustomerIsGuest' => false,
            'getCustomerGender' => 'male',
            'getCustomerTaxvat' => 'taxvat',
        ];
        foreach ($expectedMethods as $method => $value) {
            $quoteMock->expects($this->once())->method($method)->will($this->returnValue($value));
        }
        $this->assertEquals($expected, $this->mapper->map($quoteMock));
    }
}


text:
![SJJSONTable](http://sjrd.co/wp-content/uploads/2017/03/json-e1489330582876.png)

# SJJSONTable
> A UITableView implementation specifically meant for displaying JSON or trees.

[![Build Status](https://travis-ci.org/Sjoerdjanssenen/SJJSONTable.svg?branch=master)](https://travis-ci.org/Sjoerdjanssenen/SJJSONTable)
[![Packagist](https://img.shields.io/packagist/l/doctrine/orm.svg)]()
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/EZSwiftExtensions.svg)](https://img.shields.io/cocoapods/v/LFAlertController.svg)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

SJJSONTable is a subclass of UITableViewCell that provides you with APIs to display JSON in a table.

![An example app](http://i.imgur.com/o4NRI1m.gif)

## Features

- [x] Expanding/collapsing of nodes and their children.
- [x] Support for all UITableView APIs
- [ ] Reordering
- [ ] Search

## Requirements

- iOS 8.0+
- Xcode 7.3

## Installation

#### CocoaPods
You can use [CocoaPods](http://cocoapods.org/) to install `SJJSONTable` by adding it to your `Podfile`:

```ruby
platform :ios, '8.0'
use_frameworks!
pod 'SJJSONTable'
```

Import `SJJSONTable` where you'd like to use it.

``` objective-c
#import <SJJSONTable/SJJSONTable.h>
```

## Getting started

You can start by creating a `SJJSONTable` - just as you do with a `UITableView`.

```objective-c
SJJSONTable *table = [[SJJSONTable alloc] init];
table.presenter = self;
[self.view addSubview:table];
```

After that, you can add the APIs required to make the table work. First, set the amount of children for a given node. If node is nil, it's the root.

```objective-c
- (NSInteger)tableView:(UITableView *)tableView childrenOfEntry:(id)node {
    return (node == nil) ? 5 : 3;
}
```

After adding that method, you can start returning children for a given node.

```objective-c
- (id)tableView:(UITableView *)tableView child:(NSInteger)child ofEntry:(id)node {
    if (node == nil) {
        return [self.data objectAtIndex:child];
    }

    return [node.children objectAtIndex:child];
}
```

Then create the cell for a node.

```objective-c
- (UITableViewCell *)tableView:(UITableView *)tableView cellForEntry:(id)node  {
    ....
    return cell;
}
```

And handle the selection, collapsing and/or expanding of nodes.

```objective-c
- (void)tableView:(UITableView *)tableView didSelectNode:(id)node {
    NSLog(@"Selected node: %@", node);
}

- (void)willExpandNodeAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"Will expand node at indexPath: %@", indexPath);
}

- (void)willCollapseNodeAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"Will collapse node at indexPath: %@", indexPath);
}
```

You're done!

## Contribute

We would love for you to contribute to **SJJSONTable**, check the ``LICENSE`` file for more info.

## Meta

Sjoerd Janssen – [@sjoerdjanssenen](https://twitter.com/sjoerdjanssenen) – sjoerdjanssen@me.com

Distributed under the MIT license. See ``LICENSE`` for more information.

Arrow icon in the example project made by [Dave Gandy](http://www.flaticon.com/authors/dave-gandy) from www.flaticon.com

[https://github.com/sjoerdjanssenen](https://github.com/sjoerdjanssenen/)

[swift-image]:https://img.shields.io/badge/swift-3.0-orange.svg
[swift-url]: https://swift.org/
[license-image]: https://img.shields.io/badge/License-MIT-blue.svg
[license-url]: LICENSE
[travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/dbader/node-datadog-metrics
[codebeat-image]: https://codebeat.co/badges/c19b47ea-2f9d-45df-8458-b2d952fe9dad
[codebeat-url]: https://codebeat.co/projects/github-com-vsouza-awesomeios-com


text:
/**
 *
 */
package com.smartdevicelink.proxy;

import java.util.Hashtable;

public class RPCRequest extends RPCMessage {

	public RPCRequest(String functionName) {
		super(functionName, RPCMessage.KEY_REQUEST);
		messageType = RPCMessage.KEY_REQUEST;
	}

	public RPCRequest(Hashtable<String, Object> hash) {
		super(hash);
	}

	public Integer getCorrelationID() {
		return (Integer)function.get(RPCMessage.KEY_CORRELATION_ID);
	}

	public void setCorrelationID(Integer correlationID) {
		if (correlationID != null) {
            function.put(RPCMessage.KEY_CORRELATION_ID, correlationID );
        } else {
        	function.remove(RPCMessage.KEY_CORRELATION_ID);
        }
	}
}


text:
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.di;

import com.yahoo.config.subscription.ConfigSource;
import com.yahoo.config.subscription.DirSource;
import com.yahoo.config.subscription.FileSource;
import org.junit.jupiter.api.Assertions;

import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Tony Vaagenes
 * @author gjoranv
 * @author ollivir
 */
class DirConfigSource {

    private final Set<String> checked = new HashSet<>();
    private final File tempFolder;
    private boolean doubleChecked;

    DirConfigSource(File tmpDir) {
        this.tempFolder = tmpDir;
    }

    void writeConfig(String name, String contents) {
        try {
            Files.writeString(tempFolder.toPath().resolve(name + ".cfg"), contents);
        }
        catch (IOException e) {
            throw new UncheckedIOException(e);
        }
    }

    String configId() {
        return "dir:" + tempFolder.getPath();
    }

    synchronized void clearCheckedConfigs() {
        checked.clear();
        doubleChecked = false;
    }

    synchronized void awaitConfigChecked(long millis) throws InterruptedException {
         long remaining, doom = System.currentTimeMillis() + millis;
         while ( ! doubleChecked && (remaining = doom - System.currentTimeMillis()) > 0) wait(remaining);
        Assertions.assertTrue(doubleChecked, "no config was checked more than once during " + millis + " millis");
    }

    ConfigSource configSource() {
        return new DirSource(tempFolder) {
            @Override public FileSource getFile(String name) {
                return new FileSource(new File(tempFolder, name)) {
                    @Override public long getLastModified() {
                        synchronized (DirConfigSource.this) {
                            if ( ! checked.add(name)) {
                                doubleChecked = true;
                                DirConfigSource.this.notifyAll();
                            }
                            return super.getLastModified();
                        }
                    }
                };
            }
        };
    }

}


text:
/**
 *  class CocoEngine
 *
 *  Engine for the Coco compiler. You will need `coco` Node
 *  module installed in order to use [[Mincer]] with `*.co` files:
 *
 *      npm install coco
 *
 *
 *  ##### SUBCLASS OF
 *
 *  [[Template]]
 **/

'use strict';

// 3rd-party
var _ = require('lodash');
var coco; // initialized later

// internal
var Template  = require('../template');
var prop      = require('../common').prop;

////////////////////////////////////////////////////////////////////////////////

// Class constructor
var CocoEngine = module.exports = function CocoEngine() {
  Template.apply(this, arguments);
  coco = coco || Template.libs.coco || require('coco');
};

require('util').inherits(CocoEngine, Template);

// Internal (private) options storage
var options = {bare: true};

/**
 *  CocoEngine.configure(opts) -> Void
 *  - opts (Object):
 *
 *  Allows to set Coco compilation options.
 *  Default: `{bare: true}`.
 *
 *  ##### Example
 *
 *      CocoEngine.configure({bare: true});
 **/
CocoEngine.configure = function (opts) {
  options = _.clone(opts);
};

// Render data
CocoEngine.prototype.evaluate = function (/*context, locals*/) {
  return coco.compile(this.data, _.clone(options));
};

// Expose default MimeType of an engine
prop(CocoEngine, 'defaultMimeType', 'application/javascript');


text:
package com.magic.acme.assist.common.model;

/**
 * Created by bert on 17-6-28.
 */
public class User {

    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}