text:
//
//   Copyright 2013 Pixar
//
//   Licensed under the Apache License, Version 2.0 (the "Apache License")
//   with the following modification; you may not use this file except in
//   compliance with the Apache License and the following modification to it:
//   Section 6. Trademarks. is deleted and replaced with:
//
//   6. Trademarks. This License does not grant permission to use the trade
//      names, trademarks, service marks, or product names of the Licensor
//      and its affiliates, except as required to comply with Section 4(c) of
//      the License and to reproduce the content of the NOTICE file.
//
//   You may obtain a copy of the Apache License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the Apache License with the above modification is
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
//   KIND, either express or implied. See the Apache License for the specific
//   language governing permissions and limitations under the Apache License.
//

#ifndef OSDUTIL_MESH_BATCH_H
#define OSDUTIL_MESH_BATCH_H

#include "../version.h"
#include "../far/patchTables.h"
#include "../osd/vertexDescriptor.h"
#include "../osdutil/multiMeshFactory.h"

#include <vector>

namespace OpenSubdiv {
namespace OPENSUBDIV_VERSION {

template <class U> class FarMesh;
class OsdVertex;

// ----------------------------------------------------------------------------
// OsdUtilMeshBatchEntry
//
//
//
struct OsdUtilMeshBatchEntry {
    OsdDrawContext::PatchArrayVector patchArrays;
    int vertexOffset;       // relative offset to first coarse vertex in vbo
    int ptexFaceOffset;     // relative offset to first ptex face ID
};

typedef std::vector<OsdUtilMeshBatchEntry> OsdUtilMeshBatchEntryVector;

// ----------------------------------------------------------------------------
// OsdUtilMeshBatchBase
//
//  base batching class which holds kernel batches and patch arrays.
//
template <typename DRAW_CONTEXT>
class OsdUtilMeshBatchBase {
public:
    typedef DRAW_CONTEXT DrawContext;

    virtual ~OsdUtilMeshBatchBase();

    virtual typename DrawContext::VertexBufferBinding BindVertexBuffer() = 0;
    virtual typename DrawContext::VertexBufferBinding BindVaryingBuffer() = 0;
    virtual DrawContext * GetDrawContext() const = 0;

    // entry accessors
    int GetVertexOffset(int meshIndex) const
        { return _entries[meshIndex].vertexOffset; }
    int GetPtexFaceOffset(int meshIndex) const
        { return _entries[meshIndex].ptexFaceOffset; }
    OsdDrawContext::PatchArrayVector const & GetPatchArrays(int meshIndex) const
        { return _entries[meshIndex].patchArrays; }

    // update APIs
    virtual void UpdateCoarseVertices(int meshIndex, const float *data, int numVertices) = 0;
    virtual void UpdateCoarseVaryings(int meshIndex, const float *data, int numVertices) = 0;
    virtual void FinalizeUpdate() = 0;

    int GetBatchIndex() const { return _batchIndex; }

    int GetNumVertices() const { return _numVertices; }

    int GetNumPtexFaces() const { return _numPtexFaces; }

protected:
    OsdUtilMeshBatchBase() {}

    bool initialize(OsdUtilMeshBatchEntryVector const & entries,
                    int numVertices,
                    int numPtexFaces,
                    int numVertexElements,
                    int batchIndex);

    void setKernelBatches(FarKernelBatchVector const &batches);
    void setMeshDirty(int meshIndex);
    void resetMeshDirty();

    void populateDirtyKernelBatches(FarKernelBatchVector &result);

private:
    // compute batch
    FarKernelBatchVector _allKernelBatches;

    // drawing batch entries
    OsdUtilMeshBatchEntryVector _entries;

    // update flags
    std::vector<bool>          _dirtyFlags;   // same size as _entries

    int _numVertices;
    int _numPtexFaces;
    int _batchIndex;
};

// ----------------------------------------------------------------------------
// OsdUtilMeshBatch
//
//  derived batching class which contains vertexbuffer, computecontext, drawcontext
//
template <typename VERTEX_BUFFER, typename DRAW_CONTEXT, typename COMPUTE_CONTROLLER>
class OsdUtilMeshBatch : public OsdUtilMeshBatchBase<DRAW_CONTEXT> {
public:
    typedef VERTEX_BUFFER VertexBuffer;
    typedef typename COMPUTE_CONTROLLER::ComputeContext ComputeContext;
    typedef DRAW_CONTEXT DrawContext;
    typedef COMPUTE_CONTROLLER ComputeController;
    typedef OsdUtilMeshBatchBase<DRAW_CONTEXT> Base;

    // constructor from far mesh vector
    // XXX: not happy with retaining compute controller..
    static OsdUtilMeshBatch *Create(ComputeController *computeController,
                                    std::vector<FarMesh<OsdVertex> const * > const &meshVector,
                                    int numVertexElements,
                                    int numVaryingElements,
                                    int batchIndex,
                                    bool requireFVarData=false);

    // constructor (for client defined arbitrary patches)
    static OsdUtilMeshBatch *Create(FarPatchTables const *patchTables,
                                    OsdUtilMeshBatchEntryVector const &entries,
                                    int numVertices,
                                    int numPtexFaces,
                                    int numVertexElements,
                                    int numVaryingElements,
                                    int batchIndex,
                                    bool requireFVarData=false);

    virtual ~OsdUtilMeshBatch();

    virtual typename DrawContext::VertexBufferBinding BindVertexBuffer() {
        if (not _vertexBuffer)
            return 0;
        return _vertexBuffer->BindVBO();
    }

    virtual typename DrawContext::VertexBufferBinding BindVaryingBuffer() {
        if (not _varyingBuffer)
            return 0;
        return _varyingBuffer->BindVBO();
    }

    virtual DrawContext * GetDrawContext() const { return _drawContext; }

    // update APIs
    virtual void UpdateCoarseVertices(int meshIndex, const float *data, int numVertices) {

        if (not _vertexBuffer)
            return;

        Base::setMeshDirty(meshIndex);

        _vertexBuffer->UpdateData(data, Base::GetVertexOffset(meshIndex), numVertices);
    }

    virtual void UpdateCoarseVaryings(int meshIndex, const float *data, int numVertices) {

        if (not _varyingBuffer)
            return;

        Base::setMeshDirty(meshIndex);

        _varyingBuffer->UpdateData(data, Base::GetVertexOffset(meshIndex), numVertices);
    }

    virtual void FinalizeUpdate() {
        // create kernel batch for dirty handles

        if (not _computeController)
            return;

        FarKernelBatchVector batches;
        Base::populateDirtyKernelBatches(batches);
        Base::resetMeshDirty();

        _computeController->Refine(_computeContext, batches, _vertexBuffer, _varyingBuffer);
    }

    VertexBuffer *GetVertexBuffer() const { return _vertexBuffer; }

    VertexBuffer *GetVaryingBuffer() const { return _varyingBuffer; }

private:
    OsdUtilMeshBatch();

    bool initialize(ComputeController *computeController,
                    OsdUtilMeshBatchEntryVector const &entries,
                    FarMesh<OsdVertex> const *farMultiMesh,
                    int numVertexElements,
                    int numVaryingElements,
                    int batchIndex,
                    bool requireFVarData);

    bool initialize(FarPatchTables const *patchTables,
                    OsdUtilMeshBatchEntryVector const &entries,
                    int numVertices,
                    int numPtexFaces,
                    int numVertexElements,
                    int numVaryingElements,
                    int batchIndex,
                    bool requireFVarData);

    ComputeController *_computeController;
    ComputeContext *_computeContext;

    VertexBuffer *_vertexBuffer, *_varyingBuffer;
    DrawContext *_drawContext;
};

// -----------------------------------------------------------------------------
template <typename DRAW_CONTEXT> bool
OsdUtilMeshBatchBase<DRAW_CONTEXT>::initialize(OsdUtilMeshBatchEntryVector const & entries,
                                               int numVertices,
                                               int numPtexFaces,
                                               int numVertexElements,
                                               int batchIndex) {
    _entries = entries;
    _numVertices = numVertices;
    _numPtexFaces = numPtexFaces;
    _batchIndex = batchIndex;

    // update patcharrays in entries
    for (int i = 0; i < (int)_entries.size(); ++i) {
        for (int j = 0; j < (int)_entries[i].patchArrays.size(); ++j) {
            OsdDrawContext::PatchDescriptor desc = _entries[i].patchArrays[j].GetDescriptor();
            desc.SetNumElements(numVertexElements);
            _entries[i].patchArrays[j].SetDescriptor(desc);
        }
    }

    // init dirty flags
    _dirtyFlags.resize(entries.size());
    resetMeshDirty();

    return true;
}

template <typename DRAW_CONTEXT>
OsdUtilMeshBatchBase<DRAW_CONTEXT>::~OsdUtilMeshBatchBase() {
}

template <typename DRAW_CONTEXT> void
OsdUtilMeshBatchBase<DRAW_CONTEXT>::setMeshDirty(int meshIndex) {

    assert(meshIndex < (int)_dirtyFlags.size());
    _dirtyFlags[meshIndex] = true;
}

template <typename DRAW_CONTEXT> void
OsdUtilMeshBatchBase<DRAW_CONTEXT>::resetMeshDirty() {
    std::fill(_dirtyFlags.begin(), _dirtyFlags.end(), false);
}

template <typename DRAW_CONTEXT> void
OsdUtilMeshBatchBase<DRAW_CONTEXT>::setKernelBatches(FarKernelBatchVector const &batches) {
    _allKernelBatches = batches;
}

template <typename DRAW_CONTEXT> void
OsdUtilMeshBatchBase<DRAW_CONTEXT>::populateDirtyKernelBatches(FarKernelBatchVector &result) {

    result.clear();
    for (FarKernelBatchVector::const_iterator it = _allKernelBatches.begin();
         it != _allKernelBatches.end(); ++it) {
        if (_dirtyFlags[it->GetMeshIndex()]) {
            result.push_back(*it);
        }
    }
}

// -----------------------------------------------------------------------------
inline FarMesh<OsdVertex> *
createMultiMesh(std::vector<FarMesh<OsdVertex> const * > const & meshVector,
                std::vector<FarPatchTables::PatchArrayVector> & multiFarPatchArray) {

    // create multimesh
    OsdUtilMultiMeshFactory<OsdVertex> multiMeshFactory;
    FarMesh <OsdVertex> *farMultiMesh = multiMeshFactory.Create(meshVector);

    // return patch arrays
    multiFarPatchArray = multiMeshFactory.GetMultiPatchArrays();

    return farMultiMesh;
}

inline void
createEntries(OsdUtilMeshBatchEntryVector &result,
              std::vector<FarPatchTables::PatchArrayVector> const & multiFarPatchArray,
              int maxValence,
              std::vector<FarMesh<OsdVertex> const * > const & meshVector) {

    // create osd patch array per mesh (note: numVertexElements will be updated later)
    int numEntries = (int)multiFarPatchArray.size();
    result.resize(numEntries);
    for (int i = 0; i < numEntries; ++i) {
        OsdDrawContext::ConvertPatchArrays(multiFarPatchArray[i],
                                           result[i].patchArrays,
                                           maxValence, 0);
    }

    // set entries
    int vertexOffset = 0, ptexFaceOffset = 0;
    for (size_t i = 0; i < meshVector.size(); ++i) {
        int numVertices = meshVector[i]->GetNumVertices();
        int numPtexFaces = meshVector[i]->GetPatchTables()->GetNumPtexFaces();

        result[i].vertexOffset = vertexOffset;
        result[i].ptexFaceOffset = ptexFaceOffset;

        vertexOffset += numVertices;
        ptexFaceOffset += numPtexFaces;
    }
}

template <typename VERTEX_BUFFER, typename DRAW_CONTEXT, typename COMPUTE_CONTROLLER>
OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER>::OsdUtilMeshBatch() :
    _computeController(NULL), _computeContext(NULL), _vertexBuffer(NULL), _varyingBuffer(NULL), _drawContext(NULL) {
}

template <typename VERTEX_BUFFER, typename DRAW_CONTEXT, typename COMPUTE_CONTROLLER> bool
OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER>::initialize(ComputeController *computeController,
                                                                              OsdUtilMeshBatchEntryVector const &entries,
                                                                              FarMesh<OsdVertex> const *farMultiMesh,
                                                                              int numVertexElements,
                                                                              int numVaryingElements,
                                                                              int batchIndex,
                                                                              bool requireFVarData) {

    Base::initialize(entries, farMultiMesh->GetNumVertices(), farMultiMesh->GetPatchTables()->GetNumPtexFaces(),
                     numVertexElements, batchIndex);

    _computeController = computeController;

    // copy batches
    Base::setKernelBatches(farMultiMesh->GetKernelBatches());

    // create compute contexts
    _computeContext = ComputeContext::Create(farMultiMesh->GetSubdivisionTables(), farMultiMesh->GetVertexEditTables());

    if (not _computeContext) return false;

    FarPatchTables const * patchTables = farMultiMesh->GetPatchTables();

    if (numVertexElements) {
        _vertexBuffer = VertexBuffer::Create(numVertexElements, Base::GetNumVertices());
        if (not _vertexBuffer) return false;
    }

    if (numVaryingElements) {
        _varyingBuffer = VertexBuffer::Create(numVaryingElements, Base::GetNumVertices());
        if (not _varyingBuffer) return false;
    }

    _drawContext = DrawContext::Create(patchTables,  numVertexElements, requireFVarData);

    if (not _drawContext) return false;

    if (_vertexBuffer) _drawContext->UpdateVertexTexture(_vertexBuffer);

    return true;
}

// Constructor from patch table
template <typename VERTEX_BUFFER, typename DRAW_CONTEXT, typename COMPUTE_CONTROLLER> bool
OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER>::initialize(FarPatchTables const *patchTables,
                                                                              OsdUtilMeshBatchEntryVector const &entries,
                                                                              int numVertices, int numPtexFaces,
                                                                              int numVertexElements,
                                                                              int numVaryingElements,
                                                                              int batchIndex,
                                                                              bool requireFVarData) {

    Base::initialize(entries, numVertices, numPtexFaces, numVertexElements, batchIndex);

    if (numVertexElements) {
        _vertexBuffer = VertexBuffer::Create(numVertexElements, numVertices);
        if (not _vertexBuffer) return false;
    }

    if (numVaryingElements) {
        _varyingBuffer = VertexBuffer::Create(numVaryingElements, numVertices);
        if (not _varyingBuffer) return false;
    }

    _drawContext = DrawContext::Create(patchTables, numVertexElements, requireFVarData);

    if (not _drawContext) return false;

    if (_vertexBuffer) _drawContext->UpdateVertexTexture(_vertexBuffer);

    return true;
}

template <typename VERTEX_BUFFER, typename DRAW_CONTEXT, typename COMPUTE_CONTROLLER>
OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER>::~OsdUtilMeshBatch() {
    delete _computeContext;
    delete _drawContext;

    delete _vertexBuffer;
    delete _varyingBuffer;
}

template <typename VERTEX_BUFFER, typename DRAW_CONTEXT, typename COMPUTE_CONTROLLER>
OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER> *
OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER>::Create(ComputeController *computeController,
                                                                          const std::vector<FarMesh<OsdVertex> const * > &meshVector,
                                                                          int numVertexElements,
                                                                          int numVaryingElements,
                                                                          int batchIndex,
                                                                          bool requireFVarData)
{
    std::vector<FarPatchTables::PatchArrayVector> multiFarPatchArray;
    FarMesh <OsdVertex> *farMultiMesh = createMultiMesh(meshVector, multiFarPatchArray);

    FarPatchTables const * patchTables = farMultiMesh->GetPatchTables();

    // create entries
    OsdUtilMeshBatchEntryVector entries;
    createEntries(entries, multiFarPatchArray, patchTables->GetMaxValence(), meshVector);

    OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER> *batch =
        new OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER>();

    if (not batch->initialize(computeController, entries, farMultiMesh,
                              numVertexElements, numVaryingElements,
                              batchIndex, requireFVarData)) {
        delete batch;
        batch = NULL;
    }

    delete farMultiMesh;

    return batch;
}

template <typename VERTEX_BUFFER, typename DRAW_CONTEXT, typename COMPUTE_CONTROLLER>
OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER> *
OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER>::Create(FarPatchTables const *patchTables,
                                                                          OsdUtilMeshBatchEntryVector const &entries,
                                                                          int numVertices,
                                                                          int numPtexFaces,
                                                                          int numVertexElements,
                                                                          int numVaryingElements,
                                                                          int batchIndex,
                                                                          bool requireFVarData)
{
    OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER> *batch =
        new OsdUtilMeshBatch<VERTEX_BUFFER, DRAW_CONTEXT, COMPUTE_CONTROLLER>();

    if (not batch->initialize(patchTables, entries, numVertices, numPtexFaces,
                              numVertexElements, numVaryingElements,
                              batchIndex, requireFVarData)) {
        delete batch;
        batch = NULL;
    }

    return batch;
}

}  // end namespace OPENSUBDIV_VERSION
using namespace OPENSUBDIV_VERSION;

}  // end namespace OpenSubdiv

#endif  /* OSDUTIL_MESH_BATCH_H */


text:
const path = require("path");
const fs = require("fs");
const pkg = require(path.resolve(process.cwd(), "package.json"));

const args = process.argv.slice(2);
let verbose = false;
for (let i = 0; i < args.length; i++) {
    switch (args[i]) {
        case "-v":
            verbose = true;
            break;
    }
}

function processDirectory(dir) {
    if (verbose) {
        console.log(`processing ${dir}`);
    }
    for (const item of fs.readdirSync(dir)) {
        const fullPath = path.resolve(dir, item);
        const stats = fs.statSync(fullPath);
        if (stats.isDirectory()) {
            processDirectory(fullPath);
        } else if (stats.isFile()) {
            processFile(fullPath);
        }
    }
}

const SEARCH_STRING = "0.0.0-DEV_BUILD";
function processFile(file) {
    if (file.endsWith(".js") || file.endsWith(".ts")) {
        if (verbose) {
            console.log(`processing ${file}`);
        }
        let content = fs.readFileSync(file);
        content = content.toString().replace(SEARCH_STRING, pkg.version);
        fs.writeFileSync(file, content);
    } else if (verbose) {
        console.log(`skipping ${file}`);
    }
}

processDirectory(path.resolve(process.cwd(), "dist"));

redpajama_set_name: RedPajamaGithub


text:
package com.amazonaws.services.glue.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ResetJobBookmarkRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The name of the job in question.
     *

     */
    private String jobName;
    /**
     *

     * The unique run identifier associated with this job run.
     *

     */
    private String runId;

    /**
     *

     * The name of the job in question.
     *

     *
     * @param jobName
     *        The name of the job in question.
     */

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    /**
     *

     * The name of the job in question.
     *

     *
     * @return The name of the job in question.
     */

    public String getJobName() {
        return this.jobName;
    }

    /**
     *

     * The name of the job in question.
     *

     *
     * @param jobName
     *        The name of the job in question.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ResetJobBookmarkRequest withJobName(String jobName) {
        setJobName(jobName);
        return this;
    }

    /**
     *

     * The unique run identifier associated with this job run.
     *

     *
     * @param runId
     *        The unique run identifier associated with this job run.
     */

    public void setRunId(String runId) {
        this.runId = runId;
    }

    /**
     *

     * The unique run identifier associated with this job run.
     *

     *
     * @return The unique run identifier associated with this job run.
     */

    public String getRunId() {
        return this.runId;
    }

    /**
     *

     * The unique run identifier associated with this job run.
     *

     *
     * @param runId
     *        The unique run identifier associated with this job run.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ResetJobBookmarkRequest withRunId(String runId) {
        setRunId(runId);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getJobName() != null)
            sb.append("JobName: ").append(getJobName()).append(",");
        if (getRunId() != null)
            sb.append("RunId: ").append(getRunId());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof ResetJobBookmarkRequest == false)
            return false;
        ResetJobBookmarkRequest other = (ResetJobBookmarkRequest) obj;
        if (other.getJobName() == null ^ this.getJobName() == null)
            return false;
        if (other.getJobName() != null && other.getJobName().equals(this.getJobName()) == false)
            return false;
        if (other.getRunId() == null ^ this.getRunId() == null)
            return false;
        if (other.getRunId() != null && other.getRunId().equals(this.getRunId()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getJobName() == null) ? 0 : getJobName().hashCode());
        hashCode = prime * hashCode + ((getRunId() == null) ? 0 : getRunId().hashCode());
        return hashCode;
    }

    @Override
    public ResetJobBookmarkRequest clone() {
        return (ResetJobBookmarkRequest) super.clone();
    }

}


text:
package authorization

import (
	"log"

	"github.com/kismatic/kubernetes-rbac/api"
)

// RuleValidator determines if the APIAction is allowed by a PolicyRule
type RuleValidator func(api.PolicyRule, APIAction) bool

// IsAuthorized determines whether the policy allows the action requested by the user
func IsAuthorized(ruleGetter PolicyRuleGetter, ar *Request) (bool, error) {

	// Get all the PolicyRules that apply to the user in the given namespace
	rules, err := ruleGetter.GetApplicableRules(ar.User, ar.Groups, ar.Action.Namespace)
	if err != nil {
		return false, err
	}
	log.Printf("Applicable rules for user '%s', groups: '%v' in namespace '%s': %v", ar.User, ar.Groups, ar.Action.Namespace, rules)

	// Depending on the request, we might be validating access to an API resource, or to
	// a "NonResource" URL.
	var validateRule RuleValidator = isResourceActionAllowed
	if ar.Action.NonResourceURL != "" {
		validateRule = isNonResourceAccessAllowed
	}

	// Find a rule that allows the requested action
	for _, r := range rules {
		if validateRule(r, ar.Action) {
			return true, nil
		}
	}

	return false, nil
}

func isResourceActionAllowed(rule api.PolicyRule, action APIAction) bool {
	allowsGroup := contains(rule.APIGroups, api.APIGroupAll) || contains(rule.APIGroups, action.APIGroup)
	allowsVerb := contains(rule.Verbs, api.VerbAll) || contains(rule.Verbs, action.Verb)
	allowsResource := contains(rule.Resources, api.ResourceAll) || contains(rule.Resources, action.Resource)

	// Handle resource names whitelist
	allowsResourceName := false
	if len(rule.ResourceNames) == 0 { // No whitelist defined
		allowsResourceName = true
	} else {
		// Verify resource name is in whitelist
		allowsResourceName = contains(rule.ResourceNames, action.Name)
	}

	return allowsGroup && allowsVerb && allowsResource && allowsResourceName
}

func isNonResourceAccessAllowed(rule api.PolicyRule, action APIAction) bool {
	allowsVerb := contains(rule.Verbs, api.VerbAll) || contains(rule.Verbs, action.Verb)
	allowsNonResource := contains(rule.NonResourceURLs, api.NonResourceAll) || contains(rule.NonResourceURLs, action.NonResourceURL)

	return allowsVerb && allowsNonResource
}

func contains(set []string, value string) bool {
	for _, e := range set {
		if e == value {
			return true
		}
	}
	return false
}


text:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="Kabeuki\EcommerceBundle\Entity\Category" table="category">
    <id name="id" type="integer" column="id">
      <generator strategy="IDENTITY"/>
    </id>
    <field name="name" type="string" column="name" length="255" nullable="false"/>
    <field name="createdAt" type="datetime" column="created_at" nullable="false"/>
    <field name="updatedAt" type="datetime" column="updated_at" nullable="true"/>
  </entity>
</doctrine-mapping>


text:
module Azure::Monitor::Mgmt::V2016_03_01
  module Models
    #
    # How the data that is collected should be combined over time.
    #
    class ManagementEventAggregationCondition

      include MsRestAzure

      # @return [ConditionOperator] the condition operator. Possible values
      # include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan',
      # 'LessThanOrEqual'
      attr_accessor :operator

      # @return [Float] The threshold value that activates the alert.
      attr_accessor :threshold

      # @return [Duration] the period of time (in ISO 8601 duration format)
      # that is used to monitor alert activity based on the threshold. If
      # specified then it must be between 5 minutes and 1 day.
      attr_accessor :window_size

      #
      # Mapper for ManagementEventAggregationCondition class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'ManagementEventAggregationCondition',
          type: {
            name: 'Composite',
            class_name: 'ManagementEventAggregationCondition',
            model_properties: {
              operator: {
                client_side_validation: true,
                required: false,
                serialized_name: 'operator',
                type: {
                  name: 'Enum',
                  module: 'ConditionOperator'
                }
              },
              threshold: {
                client_side_validation: true,
                required: false,
                serialized_name: 'threshold',
                type: {
                  name: 'Double'
                }
              },
              window_size: {
                client_side_validation: true,
                required: false,
                serialized_name: 'windowSize',
                type: {
                  name: 'TimeSpan'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
'use strict';

var express = require('express');
var app = express();
var assert = require('should');
var nock = require('nock');
var should = require('should');
var nconf = require('nconf');
var redis = require('redis');
var client = redis.createClient();
var roller = require('../lib/roller');

var req = {
  session: {
    email: 'test@test.com'
  },
  params: {
    id: 1
  },
  body: {
    author: 'test@test.com',
    message: 'This is a post',
    type: 'text'
  }
}

nconf.argv().env().file({ file: 'test/local-test.json' });

client.select(app.set('roller'), function(err, res) {
  if (err) {
    console.log('TEST database connection failed.');
  }
});

describe('roller', function() {
  after(function() {
    client.flushdb();
  });

  describe('add post', function() {
    it('successfully adds a post', function(done) {
      roller.add(req, client, nconf, function(err, result) {
        if (err) {
          throw new Error('error adding post: ', err);
        } else {
          should.exist(result);
          result.message.should.equal(req.body.message);
        }
        done();
      });
    });
  });

  describe('add post with a link and an image', function() {
    it('successfully adds a post', function(done) {
      req.body.message = 'http://google.com test http://pics.org/cat.jpg';
      roller.add(req, client, nconf, function(err, result) {
        if (err) {
          throw new Error('error adding post: ', err);
        } else {
          var rendered = 'http://google.com ' +
            'test ';
          result.message.should.equal(rendered);
        }
        done();
      });
    });
  });

  describe('like a post', function() {
    it('successfully likes a post', function(done) {
      roller.add(req, client, nconf, function(err, result) {
        if (err) {
          throw new Error('error adding post: ', err);
        } else {
          roller.like(req, client, function(err, resp) {
            if (err) {
              throw new Error('error liking post: ', err);
            } else {
              resp.should.be.true;
            }
            done();
          });
        }
      });
    });
  });

  describe('unlike a post', function() {
    it('successfully unlikes a post', function(done) {
      roller.add(req, client, nconf, function(err, result) {
        if (err) {
          throw new Error('error adding post: ', err);
        } else {
          roller.unlike(req, client, function(err, resp) {
            if (err) {
              throw new Error('error unliking post: ', err);
            } else {
              resp.should.be.true;
            }
            done();
          });
        }
      });
    });
  });

  it('successfully retrieves posts', function(done) {
    roller.add(req, client, nconf, function(err, result) {
      if (err) {
        throw new Error('error adding post: ', err);
      } else {
        roller.recent(req, client, function(err, results) {
          if (err) {
            throw new Error('error retrieving posts: ', err);
          } else {
            should.exist(results);
            results.length.should.equal(1);
          }
          done();
        });
      }
    });
  });

  it('successfully deletes a post', function(done) {
    req.body.id = 1;
    roller.delete(req, client, function(err, resp) {
      if (err) {
        throw new Error('error deleting post');
      } else {
        roller.recent(req, client, function(err, results) {
          if (err) {
            throw new Error('error retrieving posts: ', err);
          } else {
            results.length.should.equal(0);
          }
          done();
        });
      }
    });
  });
});


text:
package storage

import (
	"context"
	"time"

	. "github.com/onsi/ginkgo/v2"
	. "github.com/onsi/gomega"
	corev1 "k8s.io/api/core/v1"
	k8sv1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

	"kubevirt.io/kubevirt/tests/util"

	"kubevirt.io/client-go/kubecli"

	"kubevirt.io/kubevirt/tests"
)

const (
	ioerrorPV  = "ioerror-pv"
	ioerrorPVC = "ioerror-pvc"
	deviceName = "errdev0"
	diskName   = "disk0"
)

var _ = SIGDescribe("[Serial]K8s IO events", Serial, func() {
	var (
		nodeName   string
		virtClient kubecli.KubevirtClient
		pv         *k8sv1.PersistentVolume
		pvc        *k8sv1.PersistentVolumeClaim
	)

	isExpectedIOEvent := func(e corev1.Event, vmiName string) bool {
		if e.Type == "Warning" &&
			e.Reason == "IOerror" &&
			e.Message == "VM Paused due to IO error at the volume: "+diskName &&
			e.InvolvedObject.Kind == "VirtualMachineInstance" &&
			e.InvolvedObject.Name == vmiName {
			return true
		}
		return false
	}

	BeforeEach(func() {
		var err error
		virtClient, err = kubecli.GetKubevirtClient()
		Expect(err).ToNot(HaveOccurred())

		nodeName = tests.NodeNameWithHandler()
		tests.CreateFaultyDisk(nodeName, deviceName)
		pv, pvc, err = tests.CreatePVandPVCwithFaultyDisk(nodeName, "/dev/mapper/"+deviceName, util.NamespaceTestDefault)
		Expect(err).NotTo(HaveOccurred(), "Failed to create PV and PVC for faulty disk")
	})
	AfterEach(func() {
		tests.RemoveFaultyDisk(nodeName, deviceName)

		err := virtClient.CoreV1().PersistentVolumes().Delete(context.Background(), pv.Name, metav1.DeleteOptions{})
		Expect(err).ToNot(HaveOccurred())
	})
	It("[test_id:6225]Should catch the IO error event", func() {
		By("Creating VMI with faulty disk")
		vmi := tests.NewRandomVMIWithPVC(pvc.Name)
		Eventually(func() error {
			var err error
			vmi, err = virtClient.VirtualMachineInstance(util.NamespaceTestDefault).Create(vmi)
			return err
		}, 100*time.Second, time.Second).Should(BeNil(), "Failed to create vmi")

		tests.WaitForSuccessfulVMIStartWithTimeoutIgnoreWarnings(vmi, 240)

		By("Expecting  paused event on VMI ")
		Eventually(func() bool {
			events, err := virtClient.CoreV1().Events(util.NamespaceTestDefault).List(context.Background(), metav1.ListOptions{})
			Expect(err).ToNot(HaveOccurred())
			for _, e := range events.Items {
				if isExpectedIOEvent(e, vmi.Name) {
					return true
				}
			}

			return false
		}, 30*time.Second, 5*time.Second).Should(BeTrue())
		err := virtClient.VirtualMachineInstance(util.NamespaceTestDefault).Delete(vmi.ObjectMeta.Name, &metav1.DeleteOptions{})
		Expect(err).ToNot(HaveOccurred(), "Failed to delete VMI")
		tests.WaitForVirtualMachineToDisappearWithTimeout(vmi, 120)
	})
})


text:
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

async function webGpuInit(canvasWidth, canvasHeight) {
  const adapter = navigator.gpu && await navigator.gpu.requestAdapter();
  if (!adapter) {
    console.warn('navigator.gpu && navigator.gpu.requestAdapter fails!');
    return null;
  }

  const device = await adapter.requestDevice();
  if (!device) {
    console.warn('Webgpu not supported. adapter.requestDevice() fails!');
    return null;
  }

  const container = document.getElementById('container');
  const canvas = container.appendChild(document.createElement('canvas'));
  canvas.width = canvasWidth;
  canvas.height = canvasHeight;

  const context = canvas.getContext('webgpu');
  if (!context) {
    console.warn('Webgpu not supported. canvas.getContext("webgpu") fails!');
    return null;
  }

  return {adapter, device, context, canvas};
}

const wgslShaders = {
  vertex: `
struct VertexOutput {
  [[builtin(position)]] Position : vec4<f32>;
  [[location(0)]] fragUV : vec2<f32>;
};

[[stage(vertex)]] fn main(
  [[location(0)]] position : vec2<f32>,
  [[location(1)]] uv : vec2<f32>
) -> VertexOutput {
  var output : VertexOutput;
  output.Position = vec4<f32>(position, 0.0, 1.0);
  output.fragUV = uv;
  return output;
}
`,

  fragment_external_texture: `
[[binding(0), group(0)]] var mySampler: sampler;
[[binding(1), group(0)]] var myTexture: texture_external;

[[stage(fragment)]]
fn main([[location(0)]] fragUV : vec2<f32>) -> [[location(0)]] vec4<f32> {
  return textureSampleLevel(myTexture, mySampler, fragUV);
}
`,

  fragment: `
[[binding(0), group(0)]] var mySampler: sampler;
[[binding(1), group(0)]] var myTexture: texture_2d<f32>;

[[stage(fragment)]]
fn main([[location(0)]] fragUV : vec2<f32>) -> [[location(0)]] vec4<f32> {
  return textureSample(myTexture, mySampler, fragUV);
}
`,

  vertex_icons: `
[[stage(vertex)]]
fn main([[location(0)]] position : vec2<f32>)
    -> [[builtin(position)]] vec4<f32> {
  return vec4<f32>(position, 0.0, 1.0);
}
`,

  fragment_output_blue: `
[[stage(fragment)]]
fn main() -> [[location(0)]] vec4<f32> {
  return vec4<f32>(0.11328125, 0.4296875, 0.84375, 1.0);
}
`,
  fragment_output_light_blue: `
[[stage(fragment)]]
fn main() -> [[location(0)]] vec4<f32> {
  return vec4<f32>(0.3515625, 0.50390625, 0.75390625, 1.0);
}
`,

  fragment_output_white: `
[[stage(fragment)]]
fn main() -> [[location(0)]] vec4<f32> {
  return vec4<f32>(1.0, 1.0, 1.0, 1.0);
}
`,
};

function createVertexBuffer(device, videos, videoRows, videoColumns) {
  // Each video takes 6 vertices (2 triangles). Each vertice has 4 floats.
  // Therefore, each video needs 24 floats.
  // The small video at the corner is included in the vertex buffer.
  const rectVerts = new Float32Array(videos.length * 24);

  // Width and height of the video.
  const maxColRow = Math.max(videoColumns, videoRows);
  let w = 2.0 / maxColRow;
  let h = 2.0 / maxColRow;
  for (let row = 0; row < videoRows; ++row) {
    for (let column = 0; column < videoColumns; ++column) {
      const array_index = (row * videoColumns + column) * 24;
      // X and y of the video.
      const x = -1.0 + w * column;
      const y = 1.0 - h * row;

      rectVerts.set([
        (x + w), y, 1.0, 0.0,
        (x + w), (y - h), 1.0, 1.0,
        x, (y - h), 0.0, 1.0,
        (x + w), y, 1.0, 0.0,
        x, (y - h), 0.0, 1.0,
        x, y, 0.0, 0.0,
      ], array_index);
    }
  }

  // For the small video at the corner, the last one in |videos|.
  w = w / videos[0].width * videos[videos.length - 1].width;
  h = h / videos[0].height * videos[videos.length - 1].height;
  const x = 1.0 - w;
  const y = 1.0 - (2.0 / maxColRow) + h;
  const array_index = (videos.length - 1) * 24;

  rectVerts.set([
    (x + w), y, 1.0, 0.0,
    (x + w), (y - h), 1.0, 1.0,
    x, (y - h), 0.0, 1.0,
    (x + w), y, 1.0, 0.0,
    x, (y - h), 0.0, 1.0,
    x, y, 0.0, 0.0,
  ], array_index);

  const verticesBuffer = device.createBuffer({
    size: rectVerts.byteLength,
    usage: GPUBufferUsage.VERTEX,
    mappedAtCreation: true,
  });

  new Float32Array(verticesBuffer.getMappedRange()).set(rectVerts);
  verticesBuffer.unmap();

  return verticesBuffer;
}

function createVertexBufferForIcons(device, videos, videoRows, videoColumns) {
  // Each icon takes 6 vertices (2 triangles). Each vertice has 2 floats.
  // Therefore, each video needs 12 floats.
  const rectVerts = new Float32Array(videos.length * 12);

  // Width and height of the video.
  const maxColRow = Math.max(videoColumns, videoRows);
  let w = 2.0 / maxColRow;
  let h = 2.0 / maxColRow;
  // Width and height of the icon.
  let wIcon = w / videos[0].width * videos[0].height / 8.0;
  let hIcon = h / 8.0;

  for (let row = 0; row < videoRows; ++row) {
    for (let column = 0; column < videoColumns; ++column) {
      const array_index = (row * videoColumns + column) * 12;
      // X and y of the video.
      const x = -1.0 + w * column;
      const y = 1.0 - h * row;
      // X and y of the icon.
      const xIcon = x + w - wIcon * 2;
      const yIcon = y - hIcon;

      rectVerts.set([
        (xIcon + wIcon), yIcon,
        (xIcon + wIcon), (yIcon - hIcon),
        xIcon, (yIcon - hIcon),
        (xIcon + wIcon), yIcon,
        xIcon, (yIcon - hIcon),
        xIcon, yIcon,
      ], array_index);
    }
  }

  // For the icon of the small video at the corner, the last one in |videos|.
  // Width and height of the small video.
  w = w / videos[0].width * videos[videos.length - 1].width;
  h = h / videos[0].height * videos[videos.length - 1].height;
  // Width and height of the small icon.
  wIcon = w / videos[0].width * videos[0].height / 8.0;
  hIcon = h / 8.0;

  // X and y of the small video.
  const x = 1.0 - w;
  const y = 1.0 - (2.0 / maxColRow) + h;
  // X and y of the small icon.
  const xIcon = x + w - wIcon * 2;
  const yIcon = y - hIcon;

  array_index = (videos.length - 1) * 12;
  rectVerts.set([
    (xIcon + wIcon), yIcon,
    (xIcon + wIcon), (yIcon - hIcon),
    xIcon, (yIcon - hIcon),
    (xIcon + wIcon), yIcon,
    xIcon, (yIcon - hIcon),
    xIcon, yIcon,
  ], array_index);

  const verticesBuffer = device.createBuffer({
    size: rectVerts.byteLength,
    usage: GPUBufferUsage.VERTEX,
    mappedAtCreation: true,
  });

  new Float32Array(verticesBuffer.getMappedRange()).set(rectVerts);
  verticesBuffer.unmap();

  return verticesBuffer;
}

function createVertexBufferForAnimation(
            device, videos, videoRows, videoColumns) {
  // Create voice bar animation and borders of the last video.
  // (1) Generate 10 differnt lengths of voice bar. Each bar takes 2 triangles,
  // which are 6 vertices.
  // (2) Generate borders, consisting of 4 lines. Each line takes 2 vertices.
  // Each vertice has 2 floats.
  // Total are 10*6*2 + 4*2*2  = 120 + 16 = 136 floats.
  const rectVerts = new Float32Array(136);

  // (1) Voice bars.
  // X, Y, width and height of the first video.
  const maxColRow = Math.max(videoColumns, videoRows);
  const w = 2.0 / maxColRow;
  const h = 2.0 / maxColRow;
  const x = -1.0;
  const y = 1.0;

  // Width and height of the icon.
  const wIcon = w / videos[0].width * videos[0].height / 8.0;
  const hIcon = h / 8.0;

  // X, Y, width and height of the animated bar.
  const wPixel = w / videos[0].width;
  const wBar = wPixel * 5;
  const xBar = x + w - wIcon * 1.5 - (wPixel * 2);
  const delta = (hIcon - (wPixel * 4)) / 10;

  // 10 different length for animation.
  const bar_count = 10;
  for (let i = 0; i < bar_count; ++i) {
    const array_index = i * 12;
    const hBar = (i+1) * delta;
    const yBar = y - hIcon * 2 + hBar;

    rectVerts.set([
      (xBar + wBar), yBar,
      (xBar + wBar), (yBar - hBar),
      xBar, (yBar - hBar),
      (xBar + wBar), yBar,
      xBar, (yBar - hBar),
      xBar, yBar,
    ], array_index);
  }

  // (2) Borders of the first video
  const array_index = 10 * 12;
  rectVerts.set([
    x, y, (x + w), y,
    (x + w), y, (x + w), (y - h),
    (x + w), (y - h), x, (y - h),
    x, (y - h), x, y,
  ], array_index);

  const verticesBuffer = device.createBuffer({
    size: rectVerts.byteLength,
    usage: GPUBufferUsage.VERTEX,
    mappedAtCreation: true,
  });

  new Float32Array(verticesBuffer.getMappedRange()).set(rectVerts);
  verticesBuffer.unmap();

  return verticesBuffer;
}

function webGpuDrawVideoFrames(gpuSetting, videos, videoRows, videoColumns,
                               addUI, useImportTextureApi) {
  const {adapter, device, context, canvas} = gpuSetting;

  const verticesBuffer = createVertexBuffer(device, videos, videoRows,
                         videoColumns);

  const swapChainFormat = context.getPreferredFormat(adapter);

  const swapChain = context.configure({
    device,
    format: swapChainFormat,
    usage: GPUTextureUsage.RENDER_ATTACHMENT,
  });

  let fragmentShaderModeul;
  if (useImportTextureApi) {
    fragmentShaderModule = device.createShaderModule({
      code: wgslShaders.fragment_external_texture,
    });
  } else {
    fragmentShaderModule = device.createShaderModule({
      code: wgslShaders.fragment,
    });
  }

  const pipeline = device.createRenderPipeline({
    vertex: {
      module: device.createShaderModule({
        code: wgslShaders.vertex,
      }),
      entryPoint: 'main',
      buffers: [{
        arrayStride: 16,
        attributes: [
          {
            // position
            shaderLocation: 0,
            offset: 0,
            format: 'float32x2',
          },
          {
            // uv
            shaderLocation: 1,
            offset: 8,
            format: 'float32x2',
          }
        ],
      }],
    },
    fragment: {
      module: fragmentShaderModule,
      entryPoint: 'main',
      targets: [{
        format: swapChainFormat,
      }]
    },
    primitive: {
      topology: 'triangle-list',
    },
  });

  const renderPassDescriptor = {
    colorAttachments: [
      {
        view: undefined, // Assigned later
        loadValue: { r: 1.0, g: 1.0, b: 1.0, a: 1.0 },
        storeOp: 'store',
      },
    ],
  };

  const sampler = device.createSampler({
    magFilter: 'linear',
    minFilter: 'linear',
  });

  const videoTextures = [];
  const bindGroups = [];

  if (!useImportTextureApi) {
    for (let i = 0; i < videos.length; ++i) {
      videoTextures[i] = device.createTexture({
        size: {
          width: videos[i].videoWidth,
          height: videos[i].videoHeight,
          depthOrArrayLayers: 1,
        },
        format: 'rgba8unorm',
        usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.TEXTURE_BINDING |
            GPUTextureUsage.RENDER_ATTACHMENT,
      });

      bindGroups[i] = device.createBindGroup({
        layout: pipeline.getBindGroupLayout(0),
        entries: [
          {
            binding: 0,
            resource: sampler,
          },
          {
            binding: 1,
            resource: videoTextures[i].createView(),
          },
        ],
      });
    }
  }

  const externalTextureDescriptor = [];
  for (let i = 0; i < videos.length; ++i) {
    externalTextureDescriptor[i] = {source: videos[i]};
  }

  // For rendering the icons
  const verticesBufferForIcons =
    createVertexBufferForIcons(device, videos, videoRows, videoColumns);

  const renderPipelineDescriptorForIcon = {
    vertex: {
      module: device.createShaderModule({
        code: wgslShaders.vertex_icons,
      }),
      entryPoint: 'main',
      buffers: [{
        arrayStride: 8,
        attributes: [{
          // position
          shaderLocation: 0,
          offset: 0,
          format: 'float32x2',
        }],
      }],
    },
    fragment: {
      entryPoint: 'main',
      targets: [{
        format: swapChainFormat,
      }]
    },
    primitive: {
      topology: 'triangle-list',
    }
  };

  renderPipelineDescriptorForIcon.fragment.module = device.createShaderModule({
    code: wgslShaders.fragment_output_blue,
  });
  const pipelineForIcons =
      device.createRenderPipeline(renderPipelineDescriptorForIcon);

  // For rendering the voice bar animation
  const vertexBufferForAnimation =
          createVertexBufferForAnimation(
            device, videos, videoRows, videoColumns);

  renderPipelineDescriptorForIcon.fragment.module = device.createShaderModule({
    code: wgslShaders.fragment_output_white,
  });
  const pipelineForAnimation =
      device.createRenderPipeline(renderPipelineDescriptorForIcon);

  // For rendering the borders of the last video
  renderPipelineDescriptorForIcon.fragment.module = device.createShaderModule({
    code: wgslShaders.fragment_output_light_blue,
  });
  renderPipelineDescriptorForIcon.primitive.topology = 'line-list';
  const pipelineForVideoBorders =
      device.createRenderPipeline(renderPipelineDescriptorForIcon);

  // For drawing icons and animated voice bar. Add UI to the command encoder.
  let index_voice_bar = 0;
  function addUICommands(passEncoder) {
    // Icons
    passEncoder.setPipeline(pipelineForIcons);
    passEncoder.setVertexBuffer(0, verticesBufferForIcons);
    passEncoder.draw(videos.length * 6);

    // Animated voice bar on the last video.
    index_voice_bar++;
    if (index_voice_bar >= 10)
      index_voice_bar = 0;

    passEncoder.setPipeline(pipelineForAnimation);
    passEncoder.setVertexBuffer(0, vertexBufferForAnimation);
    passEncoder.draw(
        /*vertexCount=*/ 6, 1, /*firstVertex=*/ index_voice_bar * 6);

    // Borders of the last video
    // Is there a way to set the line width?
    passEncoder.setPipeline(pipelineForVideoBorders);
    passEncoder.setVertexBuffer(0, vertexBufferForAnimation);
    // vertexCount = 4 lines * 2 vertices = 8;
    // firstVertex = the end of the voice bar vetices =
    // 10 steps * 6 vertices = 60;
    passEncoder.draw(/*vertexCount=*/ 8, 1, /*firstVertex=*/ 60);
  }

  // videos #0-#3 : 30 fps.
  // videos #3-#15: 15 fps.
  // videos #16+: 7 fps.
  // Not every video frame is ready in rAF callback. Only draw videos that
  // are ready.
  var videoIsReady = new Array(videos.length);

  function UpdateIsVideoReady(video) {
    videoIsReady[video.id] = true;
    video.requestVideoFrameCallback(function () {
      UpdateIsVideoReady(video);
    });
  }

  for (const video of videos) {
    video.requestVideoFrameCallback(function () {
      UpdateIsVideoReady(video);
    });
  }

  // If rAF is running at 60 fps, skip every other frame so the demo is
  // running at 30 fps.
  // 30 fps is 33 milliseconds/frame. To prevent skipping frames accidentally
  // when rAF is running near 30fps with small delta, use 32 ms instead of 33 ms
  // for comparison.
  const frameTime30Fps = 32;
  let lastTimestamp = performance.now();

  const oneFrame = () => {
    const timestamp = performance.now();
    const elapsed = timestamp - lastTimestamp;
    if (elapsed < frameTime30Fps) {
      window.requestAnimationFrame(oneFrame);
      return;
    }
    lastTimestamp = timestamp;

    const swapChainTexture = context.getCurrentTexture();
    renderPassDescriptor.colorAttachments[0].view = swapChainTexture
      .createView();

    const commandEncoder = device.createCommandEncoder();

    const passEncoder =
      commandEncoder.beginRenderPass(renderPassDescriptor);
    passEncoder.setPipeline(pipeline);
    passEncoder.setVertexBuffer(0, verticesBuffer);

    Promise.all(videos.map(video =>
      (videoIsReady[video.id] ? createImageBitmap(video) : null))).
      then((videoFrames) => {
        for (let i = 0; i < videos.length; ++i) {
          if (videoFrames[i] != undefined) {
            device.queue.copyExternalImageToTexture(
                {source: videoFrames[i], origin: {x: 0, y: 0}},
                {texture: videoTextures[i]},
                {
                  width: videos[i].videoWidth,
                  height: videos[i].videoHeight,
                  depthOrArrayLayers: 1
                },
            );
            videoIsReady[i] = false;
          }
        }

        for (let i = 0; i < videos.length; ++i) {
          const firstVertex = i * 6;
          passEncoder.setBindGroup(0, bindGroups[i]);
          passEncoder.draw(6, 1, firstVertex, 0);
        }

        // Add UI on Top of all videos.
        if (addUI) {
          addUICommands(passEncoder);
        }
        passEncoder.endPass();
        device.queue.submit([commandEncoder.finish()]);

        // TODO(crbug.com/1289482): Workaround for backpressure mechanism
        // not working properly.
        device.queue.onSubmittedWorkDone().then(() => {
          window.requestAnimationFrame(oneFrame);
        });
      });
  };

  const oneFrameWithImportTextureApi = () => {
    // Target frame rate: 30 fps. rAF might run at 60 fps.
    const timestamp = performance.now();
    const elapsed = timestamp - lastTimestamp;
    if (elapsed < frameTime30Fps) {
      window.requestAnimationFrame(oneFrameWithImportTextureApi);
      return;
    }
    lastTimestamp = timestamp;

    // Always import all videos. The video textures are destroyed before the
    // next frame.
    for (let i = 0; i < videos.length; ++i) {
      videoTextures[i] =
          device.importExternalTexture(externalTextureDescriptor[i]);
    }

    const swapChainTexture = context.getCurrentTexture();
    renderPassDescriptor.colorAttachments[0].view = swapChainTexture
      .createView();

    const commandEncoder = device.createCommandEncoder();
    const passEncoder =
      commandEncoder.beginRenderPass(renderPassDescriptor);
    passEncoder.setPipeline(pipeline);
    passEncoder.setVertexBuffer(0, verticesBuffer);

    for (let i = 0; i < videos.length; ++i) {
      bindGroups[i] = device.createBindGroup({
        layout: pipeline.getBindGroupLayout(0),
        entries: [
          {
            binding: 0,
            resource: sampler,
          },
          {
            binding: 1,
            resource: videoTextures[i],
          },
        ],
      });
      const firstVertex = i * 6;
      passEncoder.setBindGroup(0, bindGroups[i]);
      passEncoder.draw(6, 1, firstVertex, 0);
    }

    // Add UI on Top of all videos.
    if (addUI) {
      addUICommands(passEncoder);
    }
    passEncoder.endPass();
    device.queue.submit([commandEncoder.finish()]);

    const functionDuration = performance.now() - timestamp;
    const interval30Fps = 1000.0 / 30;  // 33.3 ms.
    if (functionDuration > interval30Fps) {
      console.warn(
          'rAF callback oneFrameWithImportTextureApi() takes ',
          functionDuration, 'ms,  longer than 33.3 ms (1sec/30fps)');
    }

    // TODO(crbug.com/1289482): Workaround for backpressure mechanism
    // not working properly.
    device.queue.onSubmittedWorkDone().then(() => {
      window.requestAnimationFrame(oneFrameWithImportTextureApi);
    });
  };

  if (useImportTextureApi) {
    window.requestAnimationFrame(oneFrameWithImportTextureApi);
  } else {
    window.requestAnimationFrame(oneFrame);
  }
}


text:
package org.nanoframework.concurrent.scheduler.tests;

import org.nanoframework.concurrent.scheduler.BaseScheduler;
import org.nanoframework.concurrent.scheduler.Scheduler;

/**
 *
 * @author yanghe
 * @since 1.3.15
 */
@Scheduler(parallel = 2, interval = 10, lazy = true, daemon = true)
public class Test2Scheduler extends BaseScheduler {

    @Override
    public void before() {

    }

    @Override
    public void execute() {

    }

    @Override
    public void after() {

    }

    @Override
    public void destroy() {

    }

}


text:
// [START videostitcher_create_cdn_key]

using Google.Api.Gax.ResourceNames;
using Google.Cloud.Video.Stitcher.V1;
using Google.Protobuf;

public class CreateCdnKeySample
{
    public CdnKey CreateCdnKey(
        string projectId, string location, string cdnKeyId, string hostname,
        string gcdnKeyName, string gcdnPrivateKey, string akamaiTokenKey)
    {
        // Create the client.
        VideoStitcherServiceClient client = VideoStitcherServiceClient.Create();

        CdnKey cdnKey = new CdnKey
        {
            Hostname = hostname
        };

        if (akamaiTokenKey is null)
        {
            cdnKey.GoogleCdnKey = new GoogleCdnKey
            {
                KeyName = gcdnKeyName,
                PrivateKey = ByteString.CopyFromUtf8(gcdnPrivateKey)
            };
        }
        else
        {
            cdnKey.AkamaiCdnKey = new AkamaiCdnKey
            {
                TokenKey = ByteString.CopyFromUtf8(akamaiTokenKey)
            };
        }

        CreateCdnKeyRequest request = new CreateCdnKeyRequest
        {
            ParentAsLocationName = LocationName.FromProjectLocation(projectId, location),
            CdnKeyId = cdnKeyId,
            CdnKey = cdnKey
        };

        // Call the API.
        CdnKey newCdnKey = client.CreateCdnKey(request);

        // Return the result.
        return newCdnKey;
    }
}
// [END videostitcher_create_cdn_key]


text:
<?php
namespace oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2;

use un\unece\uncefact\data\specification\UnqualifiedDataTypesSchemaModule\_2;
/**
 * @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2
 * @xmlType CodeType
 * @xmlName LossRiskResponsibilityCodeType
 * @var oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2\LossRiskResponsibilityCodeType
 */
class LossRiskResponsibilityCodeType
	extends _2\CodeType
	{

} // end class LossRiskResponsibilityCodeType


text:
<!DOCTYPE HTML>
<head>
<title>Canvas test: drawSystemFocusRing</title>
<script src="../../resources/js-test.js"></script>
</head>
<body style="padding: 0; margin: 0">
<canvas id="canvas" class="output" width="300" height="350">
    <button id="button1"></button>
    <button id="button2"></button>
</canvas>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

document.getElementById("button1").focus();

var canvas = document.getElementById("canvas").getContext("2d");
canvas.beginPath();
canvas.rect(50, 50, 200, 100);
canvas.fillStyle = "#ccf";
canvas.fill();
canvas.drawSystemFocusRing(document.getElementById("button1"));

canvas.beginPath();
canvas.rect(50, 200, 200, 100);
canvas.fillStyle = "#cfc";
canvas.fill();
canvas.drawSystemFocusRing(document.getElementById("button2"));

// The top rect"s focus ring is tied to button1, which is focused.
// It should have an outline in some color other than the background color.
var imageData = canvas.getImageData(49, 50, 1, 1);
var data = imageData.data;
shouldBe("data[0] != 0 || data[1] != 0 || data[2] != 0", "true");

// The bottom rect"s focus ring is tied to button2, which is not focused.
imageData = canvas.getImageData(49, 200, 1, 1);
data = imageData.data;
shouldBe("data[0] == 0 && data[1] == 0 && data[2] == 0", "true");
</script>
</body>


text:
require 'spec_helper'

describe MadeChan do
  it 'has a version number' do
    expect(MadeChan::VERSION).not_to be nil
  end

  madechan = MadeChan.call
  it "Greet should be おはようございます、#{MadeChan::MASTER}様。"  do
    madechan.greet(:wakeup,MadeChan::MASTER) == ('おはようございます、'+MadeChan::MASTER+'様。')
  end
end


text:
package foam.android.core;

import android.os.Bundle;
import android.support.v4.view.LayoutInflaterCompat;
import android.support.v7.app.AppCompatActivity;

import java.util.LinkedList;
import java.util.List;

import foam.android.view.LayoutFactory;
import foam.android.view.ViewBridge;
import foam.core.EmptyX;
import foam.core.HasX;
import foam.core.X;

/**
 *
 */
public abstract class FOAMActionBarActivity extends AppCompatActivity implements HasX {
  protected X x_ = EmptyX.instance();
  public X X() {
    return x_;
  }
  public void X(X x) {
    x_ = x;
  }

  @Override
  public void onCreate(Bundle bundle) {
    X(X().put("propertyViews", new LinkedList<ViewBridge>()));
    LayoutInflaterCompat.setFactory(getLayoutInflater(), new LayoutFactory(getDelegate()));
    super.onCreate(bundle);
  }

  @Override
  public void onDestroy() {
    List<ViewBridge> list = (List<ViewBridge>) x_.get("propertyViews");
    for (ViewBridge v : list) {
      v.destroy();
    }
    super.onDestroy();
  }
}


text:
namespace swift {
  /// A convenience class for declaring a timer that's part of the Swift
  /// compilation timers group.
  class SharedTimer {
    enum class State {
      Initial,
      Skipped,
      Enabled
    };
    static State CompilationTimersEnabled;

    Optional<llvm::NamedRegionTimer> Timer;

  public:
    explicit SharedTimer(StringRef name) {
      if (CompilationTimersEnabled == State::Enabled)
        Timer.emplace(name, name, "swift", "Swift compilation");
      else
        CompilationTimersEnabled = State::Skipped;
    }

    /// Must be called before any SharedTimers have been created.
    static void enableCompilationTimers() {
      assert(CompilationTimersEnabled != State::Skipped &&
             "a timer has already been created");
      CompilationTimersEnabled = State::Enabled;
    }
  };

  /// A SharedTimer for recursive routines.
  /// Declare as a static, and use as below:
  /// void example() {
  ///     static RecursiveSharedTimer timer("lookupDirect");
  ///     auto guard = RecursiveSharedTimer::Guard(timer);
  ///     (void)guard;
  ///   ...
  /// }

  class RecursiveSharedTimer {
  private:
    int recursionCount = 0;
    const StringRef name;
    llvm::Optional<SharedTimer> timer;

    void enterRecursiveFunction() {
      assert(recursionCount >= 0  &&  "too many exits");
      if (recursionCount++ == 0)
        timer.emplace(name);
    }
    void exitRecursiveFunction() {
      assert(recursionCount > 0  &&  "too many exits");
      if (--recursionCount == 0)
        timer.reset();
    }

  public:
    RecursiveSharedTimer(StringRef name) : name(name) {}

    struct Guard {
      RecursiveSharedTimer &recursiveTimer;
      Guard &operator=(Guard &) = delete;
      Guard(RecursiveSharedTimer &rst) : recursiveTimer(rst) {
        recursiveTimer.enterRecursiveFunction();
      }
      ~Guard() { recursiveTimer.exitRecursiveFunction(); }
    };
  };
} // end namespace swift

#endif // SWIFT_BASIC_TIMER_H


text:
package com.delsart.bookdownload.service;

import android.os.Handler;
import android.os.Message;

import com.delsart.bookdownload.MsgType;
import com.delsart.bookdownload.Url;
import com.delsart.bookdownload.bean.DownloadBean;
import com.delsart.bookdownload.bean.NovelBean;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;

public class EpubeeService extends BaseService {
    private final Handler mHandler;
    private int mPage;
    private String mBaseUrl;
    private CountDownLatch latch;
    private ArrayList<NovelBean> list = new ArrayList<>();

    public EpubeeService(Handler handler, String keywords) {
        super(handler, keywords);
        this.mHandler = handler;
        mPage = 1;
        mBaseUrl = Url.AIXIA + keywords + "&page=";
    }

    @Override
    public void get() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    list.clear();
                    Elements select = Jsoup.connect(mBaseUrl + mPage)
                            .timeout(10000)
                            .ignoreContentType(true)
                            .ignoreHttpErrors(true)
                            .userAgent(Url.MOBBILE_AGENT)
                            .get()
                            .select("body > div.list > li > a");
                    latch = new CountDownLatch(select.size());
                    for (Element element : select) {
                        runInSameTime(element);
                    }
                    latch.await();
                    mPage++;
                    Message msg = mHandler.obtainMessage();
                    msg.what = MsgType.SUCCESS;
                    msg.obj = list;
                    mHandler.sendMessage(msg);
                } catch (IOException e) {
                    e.printStackTrace();
                    Message msg = mHandler.obtainMessage();
                    msg.what = MsgType.ERROR;
                    mHandler.sendMessage(msg);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }

    private void runInSameTime(final Element element) throws IOException {
        mExecutorService.submit(new Runnable() {
            @Override
            public void run() {
                String url = element.attr("abs:href");
                try {
                    Document document = Jsoup.connect(url)
                            .ignoreContentType(true)
                            .ignoreHttpErrors(true)
                            .userAgent(Url.MOBBILE_AGENT)
                            .get();
                    String name = document.select("body > div:nth-child(2) > h1").text();
                    String time = document.select("body > div:nth-child(3) > li:nth-child(6)").text();
                    String info = document.select("body > div.intro > li").text();
                    String category = document.select("body > div:nth-child(3) > li:nth-child(2)").text();
                    String status = document.select("body > div:nth-child(3) > li:nth-child(5)").text();
                    String author = document.select("body > div:nth-child(3) > li:nth-child(1)").text();
                    String words = document.select("body > div:nth-child(3) > li:nth-child(3)").text();
                    String pic = "";
                    NovelBean no = new NovelBean(name, time, info, category, status, author, words, pic, url);
                    list.add(no);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                latch.countDown();
            }
        });
    }

    @Override
    public ArrayList<DownloadBean> getDownloadurls(final String url) throws InterruptedException {
        latch = new CountDownLatch(1);
        final ArrayList<DownloadBean> urls = new ArrayList<>();
        mExecutorService.submit(new Runnable() {
            @Override
            public void run() {
                try {
                    Elements elements = Jsoup.connect(url)
                            .timeout(10000)
                            .ignoreContentType(true)
                            .ignoreHttpErrors(true)
                            .userAgent(Url.MOBBILE_AGENT)
                            .get()
                            .select("body > div:nth-child(5)");
                    String u1 = elements.select("li:nth-child(2) > a").attr("abs:href");
                    String u1n = elements.select("li:nth-child(2) > a").text();
                    String u2 = elements.select("li:nth-child(3) > a").attr("abs:href");
                    String u2n = elements.select("li:nth-child(3) > a").text();
                    urls.add(new DownloadBean(u1n, u1));
                    urls.add(new DownloadBean(u2n, u2));
                } catch (IOException e) {
                    e.printStackTrace();
                }
                latch.countDown();
            }
        });
        latch.await();
        return urls;
    }

}


text:
<?php
$ifHelper = Loader::helper('concrete/interface');
?>

<?php echo t('This action cannot be undone. Are you sure?')?>

<form method="post" action="<?php echo $this->action('delete_backup')?>">
<input type="hidden" name="backup_file" value="" />
<?php echo $ifHelper->button_js(t('Cancel'),"$.fn.dialog.close(0)", 'left');?>

<?php echo $ifHelper->submit('Delete Backup','right');?>

</form>

<?php echo t('This action cannot be undone. Are you sure?')?>

<form method="post" action="<?php echo $this->action('restore_backup')?>">
<input type="hidden" name="backup_file" value="" />
<?php echo $ifHelper->button_js(t('Cancel'),"$.fn.dialog.close(0)", 'left');?>

<?php echo $ifHelper->submit('Restore Backup','right');?>
</form>

<?php
$tp = new TaskPermission();
if ($tp->canBackup()) { ?>

<?php echo t('Existing Backups')?>

<?php
if (count($backups) > 0) {
?>

   <?php echo t('Date')?>
   <?php echo t('File')?>

   <?php   foreach ($backups as $arr_bkupInf) { ?>

      <?php echo  date(DATE_APP_GENERIC_MDYT_FULL, strtotime($arr_bkupInf['date'])) ?>
      <?php echo  $arr_bkupInf['file'];?>
      <?php echo $ifHelper->button_js(t('Download'), 'window.location.href=\'' . $this->action('download', $arr_bkupInf['file']) . '\''); ?>

      <?php  print $ifHelper->button_js(t("Restore"),"confirmRestore('" . $arr_bkupInf['file'] . "')"); ?>

	   <?php  print $ifHelper->button_js(t("Delete"),"confirmDelete('" . $arr_bkupInf['file'] . "')"); ?>

   <?php  } ?>

<?php
} else { ?>

<?php echo t('You have no backups available.')?>

<?php  } ?>

<?php
$crypt = Loader::helper('encryption');
?>

<?php echo t('Create New Backup')?>

<form method="post" action="<?php echo $this->action('run_backup')?>">

		<?php echo  $ifHelper->submit(t("Run Backup"))?>

	<?php  if ($crypt->isAvailable()) { ?>
		<input type="checkbox" name="useEncryption" id="useEncryption" value="1" />
		<?php echo t('Use Encryption')?>
	<?php  } else { ?>
		<input type="checkbox" value="0" disabled />
		<?php echo t('Use Encryption')?>
	<?php  } ?>

</form>

<?php echo t('Important Information about Backup & Restore')?>

	<?php echo t('Running a backup will create a database export file and store it on your server. Encryption is only advised if you plan on storing the backup on the server indefinitely. This is not recommended. After running backup, download the file and make sure that the entire database was saved correctly. If any error messages appear during the backup process, do not attempt to restore from that backup.')?>

<?php  } else { ?>

<?php echo t('Backup')?>

<?php echo t('You do not have permission to create or administer backups.')?>

<?php  } ?>


text: <log-in base-url="baseUrl"></log-in>


text:
module VReverse where

import CLaSH.Prelude

topEntity :: Vec 4 Int -> Vec 4 Int
topEntity = reverse

testInput :: Signal (Vec 4 Int )
testInput = signal (iterateI (+1) 1)

expectedOutput :: Signal (Vec 4 Int) -> Signal Bool
expectedOutput = outputVerifier ((4:>3:>2:>1:>Nil):>Nil)


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

#ifndef NAMEOPERATIONS_H
#define NAMEOPERATIONS_H

#include <map>
#include <mutex>
#include <string>

#include "../../data/constructs/IterInfo.h"
#include "../../data/constructs/KeyValue.h"
#include "../../data/constructs/client/Instance.h"
#include "../../data/constructs/security/AuthInfo.h"
#include "../../data/constructs/security/Authorizations.h"
#include "../../scanner/Source.h"
#include "../../scanner/constructs/Results.h"
#include "../RootInterface.h"
#include "../transport/AccumuloCoordinatorTransporter.h"

namespace interconnect {
class NamespaceOperations {
 public:
  /**
   * Namespaces constructor. Does not focus the namespace operations on a given
   *instance.
   * @param creds credentials
   * @param instance instance provided by connector
   * @param interface connector interface
   * @param distributedConnector distributed interface for tablet servers
   **/
  explicit NamespaceOperations(
      cclient::data::security::AuthInfo *creds,
      std::shared_ptr<cclient::data::Instance> instance,
      RootInterface<interconnect::AccumuloCoordinatorTransporter,
                    cclient::data::KeyValue,
                    scanners::ResultBlock<cclient::data::KeyValue>> *interface,
      TransportPool<interconnect::AccumuloCoordinatorTransporter>
          *distributedConnector)
      : NamespaceOperations(creds, "", instance, interface,
                            distributedConnector) {
    // simply calls the other constructor
  }

  /**
   * Namespaces constructor. Does not focus the namespace operations on a given
   *instance.
   * @param creds credentials
   * @param myNamespace namespace
   * @param instance instance provided by connector
   * @param interface connector interface
   * @param distributedConnector distributed interface for tablet servers
   **/
  explicit NamespaceOperations(
      cclient::data::security::AuthInfo *creds, std::string myNamespace,
      std::shared_ptr<cclient::data::Instance> instance,
      RootInterface<interconnect::AccumuloCoordinatorTransporter,
                    cclient::data::KeyValue,
                    scanners::ResultBlock<cclient::data::KeyValue>> *interface,
      TransportPool<interconnect::AccumuloCoordinatorTransporter>
          *distributedConnector)
      : myNamespace(myNamespace),
        credentials(creds),
        myInstance(instance),
        clientInterface(interface) {
    refTransportPool = distributedConnector;

    loadNamespaces();
  }

  /**
   * Provides a list of namespaces
   * @return namespaces
   **/
  std::vector<std::string> list();

  /**
   * Namespaces destructor
   **/
  virtual ~NamespaceOperations();

  /**
   * Returns a list of system namespaces
   * @return system namespaces
   **/
  std::string systemNamespace();

  /**
   * Returns the default namesapce
   * @return returns ""
   **/
  std::string defaultNamespace() { return ""; }

  /**
   * Removes a namespace if specified, otherwise myNamespace is removed
   * @param name namespace to remove (optional )
   * @return status of operation.
   **/
  bool remove(std::string name = "");

  /**
   * Determines if namespace exists
   * @param name namespace to test (optional )
   * @return true if namespace exists, false otherwise
   **/
  bool exists(std::string name = "");

  /**
   * Creates a namespace
   * @param name namespace to create (optional, otherwise myNamespace )
   **/
  void create(std::string name = "");

  /**
   * Renames a namespace
   * @param newName new namespace name
   * @param oldName previous name. if not specified myNamespace will be renamed
   **/
  void rename(std::string newName, std::string oldName = "");

  /**
   * Sets a namespace property
   * @param property property names
   * @param value property value
   */
  virtual void setProperty(std::string property, std::string value,
                           std::string nm = "");

  /**
   * Removes a property on this namespace.
   * @param property property name to remove
   */
  virtual void removeProperty(std::string property, std::string nm = "");

  /**
   * Returns all namespace properties.
   * @return namespace properties
   */
  virtual std::map<std::string, std::string> getProperties(std::string nm = "");

  /**
   * attaches an iterator to the namesapce scope
   * @param setting iterator settings
   * @param scope scope on which this will run
   * @param nm namespace. if not specified the object default is used
   **/
  virtual void attachIterator(cclient::data::IterInfo setting,
                              cclient::data::ITERATOR_TYPES scope,
                              std::string nm = "");

  /**
   * removes the iterator from the given scope
   * @param name iterator name
   * @param scope scope on which this will run
   * @param nm namespace. if not specified the object default is used
   **/
  virtual void removeIterator(std::string name,
                              cclient::data::ITERATOR_TYPES scope,
                              std::string nm = "");

 protected:
  /**
   * Loads the namespaces
   * @param force forces the load if necessary
   **/
  void loadNamespaces(bool force = false);

  // client interface
  RootInterface<
      interconnect::AccumuloCoordinatorTransporter, cclient::data::KeyValue,
      scanners::ResultBlock<cclient::data::KeyValue>> *clientInterface;
  // distributed connector to tservers
  TransportPool<interconnect::AccumuloCoordinatorTransporter> *refTransportPool;
  // instance ptr
  std::shared_ptr<cclient::data::Instance> myInstance;
  // credentials
  cclient::data::security::AuthInfo *credentials;
  // provided namespace
  std::string myNamespace;
  // namespace mutex
  std::recursive_mutex namesOpMutex;

  // loaded namespaces
  std::map<std::string, std::string> namespaces;
  std::vector<std::string> namespaceNames;
};
}  // namespace interconnect
#endif  // USEROPERATIONS_H


text:
namespace app {
namespace Uno {
namespace Compiler {
namespace ShaderGenerator {

::uEnumType* ShaderStage__typeof();

}}}}

#endif


text:
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: Apache License, Version 2.0
 * See the LICENSE file in the root directory or visit http://www.apache.org/licenses/LICENSE-2.0
 */
package org.hibernate.sqm.test.hql;

import org.hibernate.query.sqm.domain.SqmPluralAttributeIndex.IndexClassification;
import org.hibernate.query.sqm.domain.SqmPluralAttribute;
import org.hibernate.query.sqm.tree.SqmSelectStatement;
import org.hibernate.query.sqm.tree.expression.CollectionSizeSqmExpression;
import org.hibernate.query.sqm.tree.expression.LiteralIntegerSqmExpression;
import org.hibernate.query.sqm.tree.expression.domain.SqmCollectionIndexReference;
import org.hibernate.query.sqm.tree.expression.domain.SqmPluralAttributeReference;
import org.hibernate.query.sqm.tree.predicate.NullnessSqmPredicate;
import org.hibernate.query.sqm.tree.predicate.RelationalPredicateOperator;
import org.hibernate.query.sqm.tree.predicate.RelationalSqmPredicate;
import org.hibernate.query.sqm.tree.predicate.SqmPredicate;
import org.hibernate.sqm.test.domain.StandardModelTest;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

/**
 * Tests for elements of WHERE clauses.
 *
 * @author Gunnar Morling
 */
public class WhereClauseTests extends StandardModelTest {

	@Test
	public void testIsNotNullPredicate() {
		SqmSelectStatement statement = interpretSelect( "select l from Person l where l.nickName is not null" );
		assertThat( statement.getQuerySpec().getWhereClause().getPredicate(), instanceOf( NullnessSqmPredicate.class ) );
		NullnessSqmPredicate predicate = (NullnessSqmPredicate) statement.getQuerySpec().getWhereClause().getPredicate();
		assertThat( predicate.isNegated(), is(true) );
	}

	@Test
	public void testNotIsNullPredicate() {
		SqmSelectStatement statement = interpretSelect( "select l from Person l where not l.nickName is null" );
		assertThat( statement.getQuerySpec().getWhereClause().getPredicate(), instanceOf( NullnessSqmPredicate.class ) );
		NullnessSqmPredicate predicate = (NullnessSqmPredicate) statement.getQuerySpec().getWhereClause().getPredicate();
		assertThat( predicate.isNegated(), is(true) );
	}

	@Test
	public void testNotIsNotNullPredicate() {
		SqmSelectStatement statement = interpretSelect( "select l from Person l where not l.nickName is not null" );
		assertThat( statement.getQuerySpec().getWhereClause().getPredicate(), instanceOf( NullnessSqmPredicate.class ) );
		NullnessSqmPredicate predicate = (NullnessSqmPredicate) statement.getQuerySpec().getWhereClause().getPredicate();
		assertThat( predicate.isNegated(), is(false) );
	}

	@Test
	public void testCollectionSizeFunction() {
		SqmSelectStatement statement = interpretSelect( "SELECT t FROM EntityOfSets t WHERE SIZE( t.setOfBasics ) = 311" );

		SqmPredicate predicate = statement.getQuerySpec().getWhereClause().getPredicate();
		assertThat( predicate, instanceOf( RelationalSqmPredicate.class ) );
		RelationalSqmPredicate relationalPredicate = ( (RelationalSqmPredicate) predicate );

		assertThat( relationalPredicate.getOperator(), is( RelationalPredicateOperator.EQUAL ) );

		assertThat( relationalPredicate.getRightHandExpression(), instanceOf( LiteralIntegerSqmExpression.class ) );
		assertThat( ( (LiteralIntegerSqmExpression) relationalPredicate.getRightHandExpression() ).getLiteralValue(), is( 311 ) );

		assertThat(
				relationalPredicate.getLeftHandExpression(),
				instanceOf( CollectionSizeSqmExpression.class )
		);
		final CollectionSizeSqmExpression func = (CollectionSizeSqmExpression) relationalPredicate.getLeftHandExpression();
		assertThat(
				func.getPluralAttributeBinding().getSourceReference().getExportedFromElement().getIdentificationVariable(),
				is( "t" )
		);
		assertThat(
				func.getPluralAttributeBinding().getReferencedNavigable().getAttributeName(),
				is( "setOfBasics" )
		);
	}

	@Test
	public void testListIndexFunction() {
		SqmSelectStatement statement = interpretSelect( "select l from EntityOfLists t join t.listOfBasics l where index(l) > 2" );

		SqmPredicate predicate = statement.getQuerySpec().getWhereClause().getPredicate();
		assertThat( predicate, instanceOf( RelationalSqmPredicate.class ) );
		RelationalSqmPredicate relationalPredicate = ( (RelationalSqmPredicate) predicate );

		assertThat( relationalPredicate.getOperator(), is( RelationalPredicateOperator.GREATER_THAN ) );

		assertThat( relationalPredicate.getRightHandExpression(), instanceOf( LiteralIntegerSqmExpression.class ) );
		assertThat( ( (LiteralIntegerSqmExpression) relationalPredicate.getRightHandExpression() ).getLiteralValue(), is( 2 ) );

		assertThat( relationalPredicate.getLeftHandExpression(), instanceOf( SqmCollectionIndexReference.class ) );
		final SqmPluralAttributeReference collectionBinding = ( (SqmCollectionIndexReference) relationalPredicate.getLeftHandExpression() ).getSourceReference();
		assertThat( collectionBinding.getExportedFromElement().getIdentificationVariable(), is( "l" ) );
	}

	@Test
	public void testMapKeyFunction() {
		SqmSelectStatement statement = interpretSelect( "select e from EntityOfMaps e join e.basicToBasicMap m where key(m) = 'foo'" );

		SqmPredicate predicate = statement.getQuerySpec().getWhereClause().getPredicate();
		assertThat( predicate, instanceOf( RelationalSqmPredicate.class ) );
		RelationalSqmPredicate relationalPredicate = ( (RelationalSqmPredicate) predicate );

		final SqmCollectionIndexReference collectionIndexBinding = (SqmCollectionIndexReference) relationalPredicate.getLeftHandExpression();
		final SqmPluralAttributeReference collectionBinding = collectionIndexBinding.getSourceReference();
		final SqmPluralAttribute attributeReference = collectionBinding.getReferencedNavigable();

		assertThat( collectionIndexBinding.getExpressionType(), is( attributeReference.getIndexDescriptor() ) );

		assertThat( attributeReference.getIndexDescriptor().getClassification(), is( IndexClassification.BASIC ) );
		assertEquals( String.class, attributeReference.getIndexDescriptor().getExportedDomainType().getJavaType() );

		assertThat( collectionBinding.getExportedFromElement().getIdentificationVariable(), is( "m" ) );
	}
}


text:
package org.opennars.interfaces;

/**
 * Implementations can be reseted - that is to flush all content and restore the state to some default state
 *
 * @author Robert Wünsche
 */
public interface Resettable {
    /**
     * reset
     */
    void reset();
}


text:
using System.Collections.Generic;
using Newtonsoft.Json;

namespace SFA.DAS.ReferenceData.Domain.Models.Company
{
    public class CompanySearchResults
    {
        [JsonProperty("items")]
        public IEnumerable<CompanySearchResultsItem> Companies { get; set; }
    }
}


text:
-- see http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:728625409049

Rem
Rem $Id$
Rem
Rem  Copyright (c) 1991, 1996, 1997 by Oracle Corporation
Rem    NAME
Rem      owasylk.sql - Dump to Spreadsheet with formatting
Rem   DESCRIPTION
Rem     This package provides an API to generate a file in the
Rem     SYLK file format.  This allow for formatting in a
Rem     spreadsheet with only a ascii text file.  This version
Rem     of owa_sylk is specific to Oracle8.
Rem   NOTES
Rem
Rem   MODIFIED     (MM/DD/YY)
Rem     clbeck      04/08/98  - Created.
Rem     tkyte       09/10/00  - Made it use UTL_FILE.
Rem
Rem

/*
  This package allows you to send the results of any query to
  a spreadsheet using UTL_FILE

  parameters:
    p_query        - a text string of the query.  The query
                     can be parameterized
                     using the :VARAIBLE syntax.  See example
                     below.

    p_parm_names   - an owaSylkArray of the paramter names
                     used as bind variables in p_query

    p_parm_values  - an owaSylkArray of the values of the
                     bind variable names.  The values
                     muse reside in the same index as the
                     name it corresponds to.

    p_cursor       - an open cursor that has had the query
                     parsed already.

    p_sum_column   - a owaSylkArray of 'Y's and 'N's
                     corresponding to the location
                     of the columns selected in p_query.
                     A value of NYNYY will result
                     in the 2nd, 4th and 5th columns being
                     summed in the resulting
                     spreadsheet.

    p_max_rows     - the maxium number of row to return.

    p_show_null_as - how to display nulls in the spreadsheet

    p_show_grid    - show/hide the grid in the spreadsheet.

    p_show_col_headers - show/hide the row/column headers
                         in the spreadsheet.

    p_font_name    - the name of the font

    p_widths       - a owaSylkArray of column widths.  This
                     will override the default column widths.

    p_headings     - a owaSylkArray of column titles.
                     This will override the default column
                     titles.

    p_strip_html   - this will remove the HTML tags from the
                     results before
                     displaying them in the spreadsheet cells.
                     Useful when the
                     query selects an anchor tag. Only the
                     text between <a href>
                     and </a> tags will be sent to the
                     spreadsheet.

*/

--  examples:

--    This example will create a spreadsheet of all the MANAGERS
--    in the scott.emp table and will sum up the salaries
--    and commissions for them.  No grid will be in the
--    spreadsheet.

declare
    output utl_file.file_type;
begin
    output := utl_file.fopen( 'DEVTEST_TEMP_DIR', 'emp1.slk', 'w', 32000 );

    sylk_util_pkg.show(
        p_file => output,
        p_query => 'select empno id, ename employee, sal Salary, comm commission from emp where job = :JOB and sal > :SAL',
        p_parm_names => sylk_util_pkg.owaSylkArray( 'JOB', 'SAL'),
        p_parm_values => sylk_util_pkg.owaSylkArray( 'MANAGER', '2000' ),
       p_sum_column => sylk_util_pkg.owaSylkArray( 'N', 'N', 'Y', 'Y'),
        p_show_grid => 'NO' );

    utl_file.fflush ( output );
    utl_file.fclose ( output );
end;

--    This example will create the same spreadsheet but will
--    send in a pre-parsed cursor instead

declare
    l_cursor number := dbms_sql.open_cursor;
    output utl_file.file_type;
begin
    output := utl_file.fopen( 'DEVTEST_TEMP_DIR', 'emp2.slk', 'w',32000 );

    dbms_sql.parse( l_cursor, 'select empno id, ename employee, sal Salary, comm commission from emp where job = ''MANAGER'' and sal > 2000', dbms_sql.native );

    sylk_util_pkg.show(
        p_file => output ,
        p_cursor => l_cursor,
        p_sum_column => sylk_util_pkg.owaSylkArray( 'N', 'N', 'Y', 'Y' ),
        p_show_grid => 'NO' );

    dbms_sql.close_cursor( l_cursor );
    utl_file.fflush ( output );
    utl_file.fclose ( output );

end;


text:
/**
 * Common classes for SeLion PageYAML needs
 */
package com.paypal.selion.platform.web;


text:
package org.fgf.animal.count.location.model;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.collin.core.model.IMorphoCode;
import org.collin.core.model.IWaterAnimal;
import org.collin.core.model.IWaterTypes;
import org.collin.core.model.IWaterTypes.TypeOfWater;
import org.condast.commons.persistence.def.IUpdateable;

@Entity
public class WaterAnimal implements IWaterAnimal, IUpdateable {

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private long id;

	private MorphoLogicalCode morphologicalCode;

	private double length;

	private boolean compositeLegs;

	private boolean wormLike;

	private boolean snail;

	private boolean surface;

	private int legs;

	private int tailExtensions;

	private boolean macroFauna;

	private int typicalWaterFlow;

	private int qualityIndicator;

	@Basic(optional = false)
	@Column( nullable=false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date createDate;

	@Basic(optional = false)
	@Column( nullable=false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date updateDate;

	public WaterAnimal() {
		super();
		this.macroFauna = false;
	}

	public WaterAnimal( IMorphoCode mc ) {
		this();
		this.morphologicalCode = (MorphoLogicalCode) mc;
	}

	/* (non-Javadoc)
	 * @see org.fgf.animal.count.location.model.ITemp#getId()
	 */
	@Override
	public long getId() {
		return id;
	}

	@Override
	public void update() {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see org.fgf.animal.count.location.model.ITemp#getMorphologicalCode()
	 */
	@Override
	public IMorphoCode getMorphologicalCode() {
		return morphologicalCode;
	}

	/* (non-Javadoc)
	 * @see org.fgf.animal.count.location.model.ITemp#setMorphologicalCode(long)
	 */
	@Override
	public void setMorphologicalCode( IMorphoCode morphologicalCode) {
		this.morphologicalCode = (MorphoLogicalCode) morphologicalCode;
	}

	/* (non-Javadoc)
	 * @see org.fgf.animal.count.location.model.ITemp#getLength()
	 */
	@Override
	public double getLength() {
		return length;
	}

	/* (non-Javadoc)
	 * @see org.fgf.animal.count.location.model.ITemp#setLength(double)
	 */
	@Override
	public void setLength(double length) {
		this.length = length;
	}

	@Override
	public boolean isCompositeLegs() {
		return compositeLegs;
	}

	@Override
	public void setCompositeLegs(boolean compositeLegs) {
		this.compositeLegs = compositeLegs;
	}

	@Override
	public boolean isWormLike() {
		return wormLike;
	}

	@Override
	public void setWormLike(boolean wormLike) {
		this.wormLike = wormLike;
	}

	@Override
	public boolean isSnail() {
		return snail;
	}

	@Override
	public void setSnail(boolean snail) {
		this.snail = snail;
	}

	@Override
	public boolean isSurface() {
		return surface;
	}

	@Override
	public void setSurface(boolean surface) {
		this.surface = surface;
	}

	@Override
	public int getLegs() {
		return legs;
	}

	@Override
	public void setLegs(int legs) {
		this.legs = legs;
	}

	@Override
	public int getTailExtensions() {
		return tailExtensions;
	}

	@Override
	public void setTailExtensions(int tailExtensions) {
		this.tailExtensions = tailExtensions;
	}

	@Override
	public boolean isMacroFauna() {
		return macroFauna;
	}

	@Override
	public void setMacroFauna(boolean macroFauna) {
		this.macroFauna = macroFauna;
	}

	@Override
	public TypeOfWater getTypicalTypeOfWater() {
		return TypeOfWater.getTypeOfWater( this.typicalWaterFlow);
	}

	@Override
	public IWaterTypes.WaterFlow  getTypicalWaterFlow() {
		return IWaterTypes.WaterFlow.getWaterFlow( this.typicalWaterFlow);
	}

	@Override
	public int getQualityIndicator() {
		return qualityIndicator;
	}

	@Override
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date create) {
		this.createDate = create;
	}

	@Override
	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date update) {
		this.updateDate = update;
	}

	@Override
	public int compareTo(IWaterAnimal arg0) {
		return this.morphologicalCode.compareTo( arg0.getMorphologicalCode());
	}
}