text:
package com.madisp.stupid.expr;

import com.madisp.stupid.ExecContext;
import com.madisp.stupid.Expression;

/**
 * Call a method.
 * Usage in stupid: {@code method(arg1, arg2, ..., argN)}, or
 * {@code obj.method(arg1, arg2, ..., argN)}.
 */
public class CallExpression implements Expression {
	private final Expression base;
	private final String identifier;
	private final Expression[] args;

	public CallExpression(Expression base, String identifier, Expression... args) {
		this.base = base;
		this.identifier = identifier;
		this.args = args;
	}

	@Override
	public Object value(ExecContext ctx) {
		Object[] argValues = new Object[args.length];
		for (int i = 0; i < argValues.length; i++) {
			argValues[i] = ctx.dereference(args[i]);
		}
		Object root = base == null ? null : base.value(ctx);
		if (base != null && root == null) {
			return null; // null.something(...) always yields null
		}
		try {
			return ctx.callMethod(root, identifier, argValues);
		} catch (NoSuchMethodException nsme) {
			return null;
		}
	}

	@Override
	public Expression[] children() {
		Expression[] ret = new Expression[args.length + 1];
		ret[0] = base;
		System.arraycopy(args, 0, ret, 1, args.length);
		return ret;
	}
}


text:
{% extends "layouts/public.html" %}

{% block bodyid %}about-page{% endblock %}

{% block body %}

Features

    {% if maintenance %}
    Unfortunately, Done-zo is currently unavailable. Check back soon!
    {% else %}
    Sign in with your Google Account and get started right away.
    {% endif %}

    Powerful Yet Simple

    Sort and filter tasks by project, context or due date

    Complete, Archive, Review

    Archive completed tasks and track what you’ve done — by the day, the week, or however you want

    Syncs with iPhone

    Download our app from iTunes ($3.99) and take Done-zo with you — keep your tasks in sync

    Access From Anywhere

    Done-zo works with IE, Firefox, Safari and Chrome

    More Than To-Dos

    Use Done-zo for groceries, gifts, or anything else

    Inline Editing

    Just double-click to edit your tasks

    Drag-and-Drop

    Reorder tasks the natural way — just drag and drop

    Lightning Fast

    Loads in less than one second, and you don’t have to sign up — try it now

    Work Now, Undo Later

    Delete tasks and lists at ease — Done-zo offers an undo feature that won’t get in the way

{% endblock %}

redpajama_set_name: RedPajamaGithub


text:
<Dictionary>
  <Words>
    <Unrecognized>
      <Word />
    </Unrecognized>
    <Recognized>
      <Word>aspx</Word>
      <Word>Chocolatey</Word>
      <Word>CursorPosition</Word>
      <Word>Fac</Word>
      <Word>GetBufferContents</Word>
      <Word>Gui</Word>
      <Word>msdn</Word>
      <Word>Io</Word>
      <Word>IProvideValueTarget</Word>
      <Word>NotImplementedException</Word>
      <Word>Nupkg</Word>
      <Word>Nuspec</Word>
      <Word>OrderBy</Word>
      <Word>OrderByDescending</Word>
      <Word>PromptForChoice</Word>
      <Word>PromptForCredential</Word>
      <Word>ReadKey</Word>
      <Word>ReadLine</Word>
      <Word>ReadLineAsSecureString</Word>
      <Word>ScrollBufferContents</Word>
      <Word>SetBufferContents</Word>
      <Word>ThenBy</Word>
      <Word>ThenByDescending</Word>
    </Recognized>
    <Deprecated>
      <Term />
    </Deprecated>
    <DiscreteExceptions>
      <Term>OrderBy</Term>
      <Term>ThenBy</Term>
      <Term>ThenByDescending</Term>
    </DiscreteExceptions>
  </Words>
  <Acronyms>
    <CasingExceptions>
      <Acronym>Vm</Acronym>
      <Acronym>Gui</Acronym>
    </CasingExceptions>
  </Acronyms>
</Dictionary>


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.avs.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;

/** a plain text value execution parameter. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonTypeName("Value")
@Fluent
public final class ScriptStringExecutionParameter extends ScriptExecutionParameter {
    /*
     * The value for the passed parameter
     */
    @JsonProperty(value = "value")
    private String value;

    /** Creates an instance of ScriptStringExecutionParameter class. */
    public ScriptStringExecutionParameter() {
    }

    /**
     * Get the value property: The value for the passed parameter.
     *
     * @return the value value.
     */
    public String value() {
        return this.value;
    }

    /**
     * Set the value property: The value for the passed parameter.
     *
     * @param value the value value to set.
     * @return the ScriptStringExecutionParameter object itself.
     */
    public ScriptStringExecutionParameter withValue(String value) {
        this.value = value;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ScriptStringExecutionParameter withName(String name) {
        super.withName(name);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
    }
}


text:
<!DOCTYPE html>

		<title>three.js webaudio - timing</title>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
		<link type="text/css" rel="stylesheet" href="main.css">

			<button id="startButton">Click to Play</button>

Audio playback requires user interaction.

		three.js webaudio - timing

		sound effect by michorvath


text:
package com.amazonaws.services.elasticsearch.model.transform;

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

import com.amazonaws.AmazonClientException;
import com.amazonaws.services.elasticsearch.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.BinaryUtils;
import com.amazonaws.util.StringUtils;
import com.amazonaws.util.IdempotentUtils;
import com.amazonaws.util.StringInputStream;
import com.amazonaws.util.json.*;

/**
 * EBSOptionsMarshaller
 */
public class EBSOptionsJsonMarshaller {

    /**
     * Marshall the given parameter object, and output to a SdkJsonGenerator
     */
    public void marshall(EBSOptions eBSOptions,
            StructuredJsonGenerator jsonGenerator) {

        if (eBSOptions == null) {
            throw new AmazonClientException(
                    "Invalid argument passed to marshall(...)");
        }

        try {
            jsonGenerator.writeStartObject();

            if (eBSOptions.getEBSEnabled() != null) {
                jsonGenerator.writeFieldName("EBSEnabled").writeValue(
                        eBSOptions.getEBSEnabled());
            }
            if (eBSOptions.getVolumeType() != null) {
                jsonGenerator.writeFieldName("VolumeType").writeValue(
                        eBSOptions.getVolumeType());
            }
            if (eBSOptions.getVolumeSize() != null) {
                jsonGenerator.writeFieldName("VolumeSize").writeValue(
                        eBSOptions.getVolumeSize());
            }
            if (eBSOptions.getIops() != null) {
                jsonGenerator.writeFieldName("Iops").writeValue(
                        eBSOptions.getIops());
            }

            jsonGenerator.writeEndObject();
        } catch (Throwable t) {
            throw new AmazonClientException(
                    "Unable to marshall request to JSON: " + t.getMessage(), t);
        }
    }

    private static EBSOptionsJsonMarshaller instance;

    public static EBSOptionsJsonMarshaller getInstance() {
        if (instance == null)
            instance = new EBSOptionsJsonMarshaller();
        return instance;
    }

}


text:
import  java.util.*;

//
//class TernaryIfElse {
//	static int ternary(int i) {
//		return i < 10 ? i * 100 : i * 10;
//	}
//
//	static int standardIfElse(int i) {
//		if (i < 10) {
//			return i * 100;
//		} else {
//			return i * 10;
//		}
//	}
//	public static void main(String[] args) {
//		// TODO Auto-generated method stub
//		print(ternary(9));
//		print(ternary(10));
//		print(standardIfElse(9));
//		print(standardIfElse(10));
//	}
//
//}

class ShowProperties {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.getProperties().list(System.out);
	      System.out.println(System.getProperty("user.name"));
	      System.out.println(
	          System.getProperty("java.library.path"));
	}

}

/** The first Thinking in Java example program.
 * Displays a string and today's date.
 * @author Bruce Eckel
 * @author www.MindView.net
 * @version 4.0
*/
public class HelloDate {
	/** Entry point to class  application.
	 * @param args array of string arguments
	*/
	public static void main(String[] args) {
		// TODO Auto-generated method stub
	     System.out.print("Hello, it's: ");
	     System.out.println(new Date());

	     ShowProperties.main(args);
//	     TernaryIfElse.main(args);
	}
}


text:
#ifndef GAPII_SPY_BASE_H
#define GAPII_SPY_BASE_H

#include "abort_exception.h"
#include "call_observer.h"
#include "pack_encoder.h"
#include "return_handler.h"
#include "slice.h"

#include "core/cc/assert.h"
#include "core/cc/scratch_allocator.h"
#include "core/cc/encoder.h"
#include "core/cc/null_encoder.h"
#include "core/cc/interval_list.h"
#include "core/cc/mutex.h"
#include "core/cc/thread_local.h"
#include "core/cc/vector.h"
#include "core/cc/id.h"

#include "gapis/atom/atom_pb/atom.pb.h"

#if (TARGET_OS == GAPID_OS_LINUX) || (TARGET_OS == GAPID_OS_ANDROID)
#include "core/memory_tracker/cc/memory_tracker.h"
#endif // TARGET_OS

#include <stdint.h>

#include <memory>
#include <string>
#include <unordered_set>

namespace gapii {

class SpyBase {
public:
    SpyBase();

    void init(CallObserver* observer, PackEncoder::SPtr encoder);

    // lock begins the interception of a single command. It must be called
    // before invoking any command on the spy. Blocks if any other thread
    // is has called lock and not yet called unlock.
    void lock(CallObserver* observer, const char* name);

    // unlock must be called after invoking any command.
    // resets the buffers reused between atoms.
    void unlock();

    // Set whether to observe the application pool. If true, the default,
    // then reads and writes to the application pools are observed, but
    // writes do not change the memory contents. If false, then
    // no-observations are made and writes change the application memory.
    inline void setObserveApplicationPool(bool observeApplicationPool);

    // Set the handler to use when handle() is called with an abort
    // exception. This allows different treatment for different
    // aborts without requiring API specific knowledge.
    typedef std::function<void(CallObserver* observer, const AbortException&)> AbortHandler;
    inline void setHandler(AbortHandler handler);

    // Returns true if the spy should compute the expected return value and
    // call setExpectedReturn(v). Default is false.
    inline bool shouldComputeExpectedReturn() const;

    // Set the handler to use when setExpectedReturn(val) is called.
    // By default the return value specified is ignored.
    inline void setReturnHandler(std::shared_ptr<ReturnHandler> handler);

    // Returns the set of resources ids.
    // TODO(qining): To support multithreaded uses, mutex is required to manage
    // the access to this set.
    std::unordered_set<core::Id>& getResources() { return mResources; }

    // Returns the transimission encoder.
    // TODO(qining): To support multithreaded uses, mutex is required to manage
    // the access to this encoder.
    std::shared_ptr<gapii::PackEncoder> getEncoder(uint8_t api) {
        return should_trace(api) ? mEncoder : mNullEncoder;
    }

    // Returns true if we should observe application pool.
    bool shouldObserveApplicationPool() { return mObserveApplicationPool; }

    // Tries to enter this function. If SpyBase has already been entered before
    // by the same thread, this returns false. e.g.  If the driver calls the
    // function recursively.
    bool try_to_enter();

    // Leaves this function. Only valid to call whenever we have succeeded
    // at a call of try_to_enter.
    void exit();

    // Returns true if this spy is suspended, i.e. We should not actually
    // be sending any data across to the server yet.
    bool is_suspended() const { return mIsSuspended; }

    void set_suspended(bool suspended) { mIsSuspended = suspended; }

    bool should_trace(uint8_t api) {
        return !is_suspended() && (mWatchedApis & (1 << api)) != 0;
    }
    void set_valid_apis(uint32_t apis) { mWatchedApis = apis; }

    void set_observing(bool observing) { mIsObserving = observing; }
    bool is_observing() const { return mIsObserving; }
protected:
    static const size_t kMaxExtras = 16; // Per atom

    typedef std::unordered_set<core::Id> IdSet;

    // onThreadSwitched is invoked by enter() whenever the current thread changes.
    virtual void onThreadSwitched(CallObserver* observer, uint64_t threadID) = 0;

    // make constructs and returns a Slice backed by a new pool.
    template<typename T>
    inline Slice<T> make(uint64_t count) const;

    // slice returns a slice wrapping the application-pool pointer src, starting at elements s
    // ending at one element before e.
    template<typename T>
    inline Slice<T> slice(T* src, uint64_t s, uint64_t e) const;

    // slice returns a slice wrapping the application-pool pointer src, starting at s bytes
    // from src and ending at one byte before e.
    inline Slice<uint8_t> slice(void* src, uint64_t s, uint64_t e) const;

    // slice returns a Slice<char>, backed by a new pool, holding a copy of the string src.
    // src is observed as a read operation.
    inline Slice<char> slice(const std::string& src) const;

    // slice returns a sub-slice of src, starting at elements s and ending at one element before e.
    template<typename T>
    inline Slice<T> slice(const Slice<T>& src, uint64_t s, uint64_t e) const;

    // abort signals that the atom should stop execution immediately.
    void abort();

    // onPostDrawCall is after any command annotated with @DrawCall
    inline virtual void onPostDrawCall(uint8_t) {}

    // onPreEndOfFrame is before any command annotated with @EndOfFrame
    inline virtual void onPreEndOfFrame(uint8_t) {}

    // onPostEndOfFrame is after any command annotated with @EndOfFrame
    inline virtual void onPostEndOfFrame(CallObserver* observer) {}

    // onPostFence is called immediately after the driver call.
    inline virtual void onPostFence(CallObserver* observer) {}

    // Returns true if the current thread is currently "in" the spy, where
    // "in" is defined as "the time between a true return of try_to_enter and
    // a matching call to exit".
    bool has_entered() {
      return mReentrantFlag.get() != 0;
    }

    // The output stream encoder.
    PackEncoder::SPtr mEncoder;

    // A counter that is incremented each time a graphics command starts or
    // ends. The first command start gets a value of 0 for its starting command
    // counter value.
    uint64_t mCommandStartEndCounter;

    // The expected counter value for the starting of the next command. This
    // equals the counter value of the last command ending plus one. This value
    // starts at 0 before any atoms have been sent.
    uint64_t mExpectedNextCommandStartCounterValue;

    // Used by the generated code to indicate that the API file compute t as the
    // return for this call. The actual return value comes from the driver.
    template <typename T> void setExpectedReturn(const T& t);

#ifdef COHERENT_TRACKING_ENABLED
    TrackMemory::MemoryTracker mMemoryTracker;
#endif // TARGET_OS
private:
    template <class T> bool shouldObserve(const Slice<T>& slice) const;

    // The stream encoder that does nothing.
    PackEncoder::SPtr mNullEncoder;

    // The list of observations that have already been encoded.
    IdSet mResources;

    // The current thread ID.
    uint64_t mCurrentThread;

    // The mutex that should be locked for the duration of each of the intercepted commands.
    core::Mutex mMutex;
    // True if we should observe the application pool.
    bool mObserveApplicationPool;

    // If non-null this handler is used instead of defaultAbortHandler.
    AbortHandler mAbortHandler;

    // If non-null this is a class which can accept return values of arbitrary
    // types (with a copy constructor and assignment operator).
    std::shared_ptr<ReturnHandler> mReturnHandler;

    // Initially set to zero for all threads. This is set to a non-zero value
    // for every thread that calls try_to_enter with a true return value,
    // and reset for that thread when the matching exit() function is called.
    core::ThreadLocalValue mReentrantFlag;

    // True if we should not be currently tracing, false if we should be tracing.
    bool mIsSuspended;

    // This is the list of all Apis that are considered for tracing. This is a
    // bit set of apis where bit (1 << api) is set if a particular api
    // should be traced.
    uint32_t mWatchedApis;

    // This is true if we may be observing frame-buffers during the trace.
    // For some API's this will require that we modify some of the
    // image creation parameters
    bool mIsObserving;
};

// finds a key in the map and returns the value. If no value is present
// returns the zero for that type.
template<typename Map>
const typename Map::mapped_type& findOrZero(const Map& m, const typename Map::key_type& key) {
  auto it = m.find(key);
  if (it == m.end()) {
    static auto zero = typename Map::mapped_type();
    return zero;
  }
  return it->second;
}

inline bool SpyBase::shouldComputeExpectedReturn() const {
    return !mObserveApplicationPool && mReturnHandler != nullptr;
}

inline void SpyBase::setReturnHandler(std::shared_ptr<ReturnHandler> handler) {
    mReturnHandler = handler;
}

template <typename T>
void SpyBase::setExpectedReturn(const T& t) {
    GAPID_ASSERT(shouldComputeExpectedReturn() /* setExpectedReturn called, but shouldComputeExpectedReturn is false */);
    mReturnHandler->setReturnValue(t);
}

template <class T>
bool SpyBase::shouldObserve(const Slice<T>& slice) const {
    return mObserveApplicationPool && slice.isApplicationPool();
}

inline void SpyBase::setObserveApplicationPool(bool observeApplicationPool) {
    mObserveApplicationPool = observeApplicationPool;
}

inline void SpyBase::setHandler(AbortHandler handler) {
    mAbortHandler = handler;
}

template<typename T>
inline Slice<T> SpyBase::make(uint64_t count) const {
    auto pool = Pool::create(count * sizeof(T));
    return Slice<T>(reinterpret_cast<T*>(pool->base()), count, pool);
}

template<typename T>
inline Slice<T> SpyBase::slice(T* src, uint64_t s, uint64_t e) const {
    // TODO: Find the pool containing src
    return Slice<T>(src+s, e-s, std::shared_ptr<Pool>());
}

inline Slice<uint8_t> SpyBase::slice(void* src, uint64_t s, uint64_t e) const {
    return slice(reinterpret_cast<uint8_t*>(src), s, e);
}

inline Slice<char> SpyBase::slice(const std::string& src) const {
    Slice<char> dst = make<char>(src.length());
    for (uint64_t i = 0; i < src.length(); i++) {
        dst[i] = src[i];
    }
    return dst;
}

template<typename T>
inline Slice<T> SpyBase::slice(const Slice<T>& src, uint64_t s, uint64_t e) const {
    return src(s, e);
}

}  // namespace gapii

#endif // GAPII_SPY_BASE_H


text:
<?php
require_once __DIR__ . '/src/GkSmarty/Module.php';


text:
using System;
using System.Collections.Generic;
using OceanChip.Queue.Protocols;
using OceanChip.Common.Serializing;
using OceanChip.Common.Scheduling;
using System.Collections.Concurrent;
using OceanChip.Common.Logging;
using OceanChip.Common.Components;
using System.Linq;
using OceanChip.Queue.Protocols.Brokers.Requests;
using OceanChip.Queue.Protocols.Brokers;
using OceanChip.Common.Remoting;
using OceanChip.Common.Extensions;
using System.Text;

namespace OceanChip.Queue.Clients.Consumers
{
    internal class RebalanceService
    {
        private readonly string _clientId;
        private readonly Consumer _consumer;
        private readonly ClientService _clientService;
        private readonly IAllocateMessageQueueStrategy _allocateMessageQueue;
        private readonly PullMessageService _pullMessageService;
        private readonly CommitConsumeOffsetService _commitConsumeOffsetService;
        private readonly IBinarySerializer _binarySerializer;
        private readonly ConcurrentDictionary<string, PullRequest> _pullRequestDicts;
        private IScheduleService _scheduleService;
        private readonly ILogger _logger;

        public RebalanceService(Consumer consumer, ClientService clientService, PullMessageService pullMessageService, CommitConsumeOffsetService commitConsumeOffsetService)
        {
            this._consumer = consumer;
            _clientService = clientService;
            _pullMessageService = pullMessageService;
            _clientId = clientService.GetClientId();
            _pullRequestDicts = new ConcurrentDictionary<string, PullRequest>();
            _commitConsumeOffsetService = commitConsumeOffsetService;
            _allocateMessageQueue = ObjectContainer.Resolve<IAllocateMessageQueueStrategy>();
            _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
            _scheduleService = ObjectContainer.Resolve<IScheduleService>();
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
        }
        public void Start()
        {
            _scheduleService.StartTask("RebalanceService", Rebalance, 1000, _consumer.Setting.RebalanceInterval);
            if (_consumer.Setting.AutoPull)
            {
                _scheduleService.StartTask("CommotOffsets", CommitOffsets, 100, _consumer.Setting.CommitConsumerOffsetInterval);
            }
            _logger.InfoFormat("{0} startted.", GetType().Name);
        }

        public void Stop()
        {
            _scheduleService.StopTask("RebalanceService");
            if (_consumer.Setting.AutoPull)
            {
                _scheduleService.StopTask("CommotOffsets");
            }
            _logger.InfoFormat("{0} stopped.", GetType().Name);
        }
        public IEnumerable<MessageQueueEx> GetCurrentQueues()
        {
            return _pullRequestDicts.Values.Select(x =>
            {
                return new MessageQueueEx(x.MessageQueue.BrokerName, x.MessageQueue.Topic, x.MessageQueue.QueueId)
                {
                    ClientCachedMessageCount = x.ProcessQueue.GetMessageCount()
                };
            }).ToList();
        }
        private void Rebalance()
        {
            foreach(var pair in _consumer.SubscriptionTopics)
            {
                var topic = pair.Key;
                try
                {
                    RebalanceClustering(pair);
                }catch(Exception ex)
                {
                    _logger.Error($"RebalanceClustering发生异常,consumerGroup:{_consumer.GroupName},consumerId:{_clientId},topic:{topic}", ex);
                }
            }
        }
        private void RebalanceClustering(KeyValuePair<string,HashSet<string>> pair)
        {
            var topic = pair.Key;
            try
            {
                var consumerIdList = GetConsumerIdsForTopic(topic);
                if(consumerIdList==null || consumerIdList.Count == 0)
                {
                    _logger.Warn("无消费者");
                    UpdatePullRequestDict(pair, new List<MessageQueue>());
                    return;
                }
                var messageQueueList = _clientService.GetTopicMessageQueues(topic);
                if(messageQueueList==null && messageQueueList.Count == 0)
                {
                    _logger.Warn("无消息队列");
                    UpdatePullRequestDict(pair, new List<MessageQueue>());
                    return;
                }
                var allocateMessageQueueList = _allocateMessageQueue.Allocate(_clientId, messageQueueList, consumerIdList).ToList();
                UpdatePullRequestDict(pair, allocateMessageQueueList);
            }catch(Exception ex)
            {
                _logger.Error($"RebalanceClustering发生异常,consumerGroup:{_consumer.GroupName},consumerId:{_clientId},topic:{topic}", ex);
                UpdatePullRequestDict(pair, new List<MessageQueue>());
            }
        }

        private void UpdatePullRequestDict(KeyValuePair<string, HashSet<string>> pair, List<MessageQueue> messaggeQueues)
        {
            var topic = pair.Key;
            var toRemovePullRequestKeys = new List<string>();
            foreach(var request in _pullRequestDicts.Values.Where(x => x.MessageQueue.Topic == topic))
            {
                var key = request.MessageQueue.ToString();
                if (!messaggeQueues.Any(x => x.ToString() == key)){
                    toRemovePullRequestKeys.Add(key);
                }
            }
            foreach(var key in toRemovePullRequestKeys)
            {
                PullRequest request;
                if(_pullRequestDicts.TryRemove(key,out request))
                {
                    request.IsDropped = true;
                    _commitConsumeOffsetService.CommitConsumeOffset(request);
                    _logger.InfoFormat("Dropped pull request,consumerGroup:{0},consumerId:{1},queue:{2},tags:{3}",
                        _consumer.GroupName,
                        _clientId,
                        request.MessageQueue,
                        string.Join("|", request.Tags));
                }
            }
            foreach(var mq in messaggeQueues)
            {
                var key = mq.ToString();
                PullRequest exist;
                if(!_pullRequestDicts.TryGetValue(key,out exist))
                {
                    var request = new PullRequest(_clientId, _consumer.GroupName, mq, -1, pair.Value);
                    if (_pullRequestDicts.TryAdd(key, request))
                    {
                        _pullMessageService.SchedulePullRequest(request);
                        _logger.InfoFormat("Added pull request,consumerGroup:{0},consumerid:{1},queue:{2},tags:{3}",
                            _consumer.GroupName,
                            _clientId,
                            request.MessageQueue,
                            string.Join("|", request.Tags));
                    }
                }
            }
        }

        private IList<string> GetConsumerIdsForTopic(string topic)
        {
            var brokerConnection = _clientService.GetFirstBrokerConnection();
            var request = _binarySerializer.Serialize(new GetConsumerIdsForTopRequest(_consumer.GroupName, topic));
            var remotingRequest = new RemotingRequest((int)BrokerRequestCode.GetConsumerIdsForTopic, request);
            var remotingResponse = brokerConnection.AdminRemotingClient.InvokeSync(remotingRequest, 5000);
            if (remotingResponse.ResponseCode != ResponseCode.Success)
            {
                throw new Exception(string.Format("GetConsumerIdsForTopic发生异常,consumeGroup:{0},topic:{1},adminADDress{2},Remoting ResponseCode:{3},errorMessage{4}",
                    _consumer.GroupName,
                    topic,
                    brokerConnection.AdminRemotingClient.ServerEndPoint.ToAddress(),
                    remotingResponse.ResponseCode,
                    Encoding.UTF8.GetString(remotingResponse.ResponseBody)
                    ));
            }
            var consumerIds = Encoding.UTF8.GetString(remotingResponse.ResponseBody);
            var consumerIdList = consumerIds.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
            consumerIdList.Sort();
            return consumerIdList;
        }

        private void CommitOffsets()
        {
            foreach(var request in _pullRequestDicts.Values)
            {
                _commitConsumeOffsetService.CommitConsumeOffset(request);
            }
        }
    }
}


text:
Datasets used for integration - Tomato

	(Datasets used for Pepper see Release Notes here.)

	(Datasets used for Potato see Release Notes here.)

Gene-Protein [Ensembl]

Solanum_lycopersicum.SL2.50.36.gff3.gz

Solanum_lycopersicum.SL2.50.pep.all.fa.gz

Mapping File from Ensembl BioMart

Ensembl-UniprotKB-SP Mapping File from Ensembl BioMart

Protein-Domain [Ensembl]

InterPro Protein Domains from Ensembl BioMart

Protein-Publication [UniprotKB, Ensembl]

Sl UniprotKB-SwissProt

Homology

Tomato-Arabidopsis homologs from Ensembl BioMart

Tomato-Potato homologs from Ensembl BioMart

Sequence alignments to other Plants

Protein@Tomato-Protein@Plants::UniProtKB-SP [Smith-Waterman]

References

Arabidopsis (TAIR) see Release notes for Arabidopsis


text:
package com.ltsllc.miranda.cluster.networkMessages;

import com.ltsllc.miranda.node.networkMessages.WireMessage;

/**
 * Created by Clark on 4/30/2017.
 */
public class DeleteTopicWireMessage extends WireMessage {
    private String name;

    public String getName() {
        return name;
    }

    public DeleteTopicWireMessage(String name) {
        super(WireSubjects.DeleteTopic);

        this.name = name;
    }
}


text:
import os
import tensorflow as tf

from dragnn.python import dragnn_ops

from dragnn.python import sentence_io
from syntaxnet import sentence_pb2
from syntaxnet import test_flags

class ConllSentenceReaderTest(tf.test.TestCase):

  def setUp(self):
    # This dataset contains 54 sentences.
    self.filepath = os.path.join(
        test_flags.source_root(),
        'syntaxnet/testdata/mini-training-set')
    self.batch_size = 20

  def assertParseable(self, reader, expected_num, expected_last):
    sentences, last = reader.read()
    self.assertEqual(expected_num, len(sentences))
    self.assertEqual(expected_last, last)
    for s in sentences:
      pb = sentence_pb2.Sentence()
      pb.ParseFromString(s)
      self.assertGreater(len(pb.token), 0)

  def testReadFirstSentence(self):
    reader = sentence_io.ConllSentenceReader(self.filepath, 1)
    sentences, last = reader.read()
    self.assertEqual(1, len(sentences))
    pb = sentence_pb2.Sentence()
    pb.ParseFromString(sentences[0])
    self.assertFalse(last)
    self.assertEqual(
        u'I knew I could do it properly if given the right kind of support .',
        pb.text)

  def testReadFromTextFile(self):
    reader = sentence_io.ConllSentenceReader(self.filepath, self.batch_size)
    self.assertParseable(reader, self.batch_size, False)
    self.assertParseable(reader, self.batch_size, False)
    self.assertParseable(reader, 14, True)
    self.assertParseable(reader, 0, True)
    self.assertParseable(reader, 0, True)

  def testReadAndProjectivize(self):
    reader = sentence_io.ConllSentenceReader(
        self.filepath, self.batch_size, projectivize=True)
    self.assertParseable(reader, self.batch_size, False)
    self.assertParseable(reader, self.batch_size, False)
    self.assertParseable(reader, 14, True)
    self.assertParseable(reader, 0, True)
    self.assertParseable(reader, 0, True)

if __name__ == '__main__':
  tf.test.main()


text:
namespace Primitive{

class Shader;

class ShaderProgram
{
public:
	ShaderProgram();
	~ShaderProgram();

	void UseProgram();
	uint32_t GetProgram() { return mShaderProgramID; }

	void CompileProgram(bool isCompute = false);

	void AddShader(Shader* const aShader);

private:
	// Just support these shaders for now
	Shader* mVertexShader;
	Shader* mFragmentShader;
	Shader* mGeometryShader;
	Shader* mComputeShader;

	uint32_t mShaderProgramID;

	bool hasCompiled;
};

}


text:
package loadbalance

import (
	"context"

	"github.com/coredns/coredns/plugin"

	"github.com/miekg/dns"
)

// RoundRobin is plugin to rewrite responses for "load balancing".
type RoundRobin struct {
	Next plugin.Handler
}

// ServeDNS implements the plugin.Handler interface.
func (rr RoundRobin) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
	wrr := &RoundRobinResponseWriter{w}
	return plugin.NextOrFailure(rr.Name(), rr.Next, ctx, wrr, r)
}

// Name implements the Handler interface.
func (rr RoundRobin) Name() string { return "loadbalance" }


text:
  #include <derecho/sst/detail/verbs.hpp>
#else
  #include <derecho/sst/detail/lf.hpp>
#endif
#include <derecho/tcp/tcp.hpp>

using std::cin;
using std::cout;
using std::endl;
using std::map;
using std::string;

using namespace sst;
using namespace tcp;

void initialize(int node_rank, const map<uint32_t, std::pair<string, uint16_t>> &ip_addrs_and_ports) {
    // initialize the rdma resources
#ifdef USE_VERBS_API
    verbs_initialize(ip_addrs_and_ports, {}, node_rank);
#else
    lf_initialize(ip_addrs_and_ports, {}, node_rank);
#endif
}

void wait_for_completion(std::thread::id tid) {
    std::optional<std::pair<int32_t, int32_t>> ce;

    unsigned long start_time_msec;
    unsigned long cur_time_msec;
    struct timeval cur_time;

    // wait for completion for a while before giving up of doing it ..
    gettimeofday(&cur_time, NULL);
    start_time_msec = (cur_time.tv_sec * 1000) + (cur_time.tv_usec / 1000);

    while(true) {
        // check if polling result is available
        ce = util::polling_data.get_completion_entry(tid);
        if(ce) {
            break;
        }
        gettimeofday(&cur_time, NULL);
	cur_time_msec = (cur_time.tv_sec * 1000) + (cur_time.tv_usec / 1000);
        if((cur_time_msec - start_time_msec) >= 2000) {
            break;
        }
    }
    // if waiting for a completion entry timed out
    if(!ce) {
        std::cerr << "Failed to get recv completion" << std::endl;
    }
}

int main() {
    srand(time(NULL));
    // input number of nodes and the local node id
    std::cout << "Enter node_rank and num_nodes" << std::endl;
    int node_rank, num_nodes;
    cin >> node_rank;
    cin >> num_nodes;

    uint16_t port = 32567;
    // input the ip addresses
    map<uint32_t, std::pair<std::string, uint16_t>> ip_addrs_and_ports;
    for(int i = 0; i < num_nodes; ++i) {
      std::string ip;
      cin >> ip;
      ip_addrs_and_ports[i] = {ip, port};
    }
    std::cout << "Using the default port value of " << port << std::endl;

    // create all tcp connections and initialize global rdma resources
    initialize(node_rank, ip_addrs_and_ports);

    int a;
    volatile int b;
    a = b = 0;
    // create read and write buffers
    char *write_buf = (char *)&a;
    char *read_buf = (char *)&b;

    int r_index = num_nodes - 1 - node_rank;

    // create the rdma struct for exchanging data
#ifdef USE_VERBS_API
    resources_two_sided *res = new resources_two_sided(r_index, read_buf, write_buf, sizeof(int), sizeof(int));
#else
    resources_two_sided *res = new resources_two_sided(r_index, read_buf, write_buf, sizeof(int), sizeof(int), r_index);
#endif

    const auto tid = std::this_thread::get_id();
    // get id first
    uint32_t id = util::polling_data.get_index(tid);

    util::polling_data.set_waiting(tid);
#ifdef USE_VERBS_API
    struct verbs_sender_ctxt sctxt;
#else
    struct lf_sender_ctxt sctxt;
#endif
    sctxt.set_remote_id(r_index);
    sctxt.set_ce_idx(id);

    if(node_rank == 0) {
        // wait for random time
        volatile long long int wait_time = (long long int)5e5;
        for(long long int i = 0; i < wait_time; ++i) {
        }
        cout << "Wait finished" << endl;

        a = 1;
        res->post_two_sided_send(sizeof(int));
        util::polling_data.set_waiting(tid);
        res->post_two_sided_receive(&sctxt, sizeof(int));

        cout << "Receive buffer posted" << endl;
        wait_for_completion(tid);
        util::polling_data.reset_waiting(tid);
        cout << "Data received" << endl;

        while(b == 0) {
        }
    }

    else {
        util::polling_data.set_waiting(tid);
        res->post_two_sided_receive(&sctxt, sizeof(int));
        cout << "Receive buffer posted" << endl;
        wait_for_completion(tid);
        util::polling_data.reset_waiting(tid);
        cout << "Data received" << endl;
        while(b == 0) {
        }
        a = 1;
        cout << "Sending" << endl;
        res->post_two_sided_send(sizeof(int));
    }

    sync(r_index);
    return 0;
}


text:
<?php

namespace GlobProject\Repositories;

use GlobProject\Presenters\ProjectNotePresenter;
use Prettus\Repository\Eloquent\BaseRepository;
use Prettus\Repository\Criteria\RequestCriteria;
use GlobProject\Entities\ProjectNote;

/**
 * Class ProjectNoteRepositoryEloquent
 * @package namespace GlobProject\Repositories;
 */
class ProjectNoteRepositoryEloquent extends BaseRepository implements ProjectNoteRepository
{
    /**
     * Specify Model class name
     *
     * @return string
     */
    public function model()
    {
        return ProjectNote::class;
    }

    /**
     * Boot up the repository, pushing criteria
     */
    public function boot()
    {
        $this->pushCriteria(app(RequestCriteria::class));
    }

    /**
     * @return mixed
     */
    public function presenter()
    {
        return ProjectNotePresenter::class;
    }
}


text:
var png = ".png"
var jpg = ".jpg"
var HtmlFormat = ".html"

//  WORK

var db = new loki('workDB.json');
var workCol = db.addCollection('workCol');

var workNames = ["x50", "glmg", "ring", "iwatch", "moto", "edge", "shave", "house"];
var workWebglFolder = "public/webgl/case/";
var workHtmlFolder = "public/pages/work/";
var workImgFolder = "public/assets/img/workImg/";

var workImgkUrls = [];
var workHtmlUrls = [];
var workTitles = [];
var workSummary = [];

$.each(workNames, function(index, title) {

    var workWebglUrl = workWebglFolder + title;
    var workHtmlUrl = workHtmlFolder + title + HtmlFormat;
    var workimgkUrl = workImgFolder + title + png;

    var workOBJ = {};
    workOBJ.id = index;
    workOBJ.useClass = title;
    workOBJ.title = title;
    workOBJ.link3d = workWebglUrl;
    workOBJ.link = workHtmlUrl;
    workOBJ.image = workimgkUrl;

    workCol.insert(workOBJ);

    var useClass = "." + title;
    workHtmlUrls.push(workHtmlUrl);
    workImgkUrls.push(workimgkUrl);

    $.ajax({
        url: workHtmlUrl,
        async: false,
        success: function(data) {
            title = $(data).filter('title').text();
            summary = $(data).filter(useClass).text();

            workOBJ.title = title;
            workOBJ.summary = summary;
        }
    });

})

//  BLOG

var db = new loki('blogDB.json');
var blogCol = db.addCollection('blogCol');

var blogNames = ["waveLoader", "playcanvas-introduce","playcanvas-pbr", "modoSoft", "lokiJS", "nodemongo" ];
var blogHtmlFolder = "public/pages/blog/";
var blogImgFolder = "public/assets/img/blogImg/";

$.each(blogNames, function(index, title) {

    var blogHtmlUrl = blogHtmlFolder + title + HtmlFormat;
    var blogimgkUrl = blogImgFolder + title + jpg;

    var blogOBJ = {};
    blogOBJ.id = index;
    blogOBJ.useClass = title;
    blogOBJ.link = blogHtmlUrl;
    blogOBJ.image = blogimgkUrl;

    $.ajax({
        url: blogHtmlUrl,
        async: false,
        success: function(data) {
            blogOBJ.title           = $(data).filter('title').text();
            blogOBJ.date            = $(data).find('.date').text();
            blogOBJ.author          = $(data).find('.author').text();
            blogOBJ.tags          = $(data).find('.tags').text();
            blogOBJ.category        = $(data).find('.category').text();
            blogOBJ.summary         = $(data).find('.summary').text().substring(0,200) + "...";
        }
    });

    blogCol.insert(blogOBJ);
})

// db.saveDatabase(function () {
//     console.log("save db")
// });

var workdv = workCol.addDynamicView('workCol_view');
workdv.applyWhere(function customFilter(obj){
    return obj.id  > -1;
});

workdv.applySimpleSort('id')

var blogdv = blogCol.addDynamicView('blogCol_view');

blogdv.applyWhere(function customFilter(obj){

    return obj.id  > -1;

});

blogdv.applySimpleSort('id')

var lookVue = new Vue({
    el: '.pages',
    data: {

        work: workdv.data(),
        blog: blogdv.data()
    },

    computed: {
    },
    created: function() {
    },
    ready: function() {
    },
    destroyed: function() {
    },
    methods: {

      showDetail:function (index) {
        console.log(index)
      }

    }
});

console.log(lookVue.work[0].title)

var notFound = Vue.extend({
   template: '
Not Found
' +
   '<router-view></router-view>'
})

var workComponent = Vue.extend({

})

var blogComponent = Vue.extend({

})

var aboutComponent = Vue.extend({

})

var contactComponent = Vue.extend({

})

var detail = Vue.extend({

})

Vue.config.debug = true;

Vue.use(VueRouter)

var router = new VueRouter({
   history: false,
   hashbang:true,
   // saveScrollPosition:true,
   root: '/'
})

Vue.component('newtemp', {
    template: '#workVUE',
     route: {
       data: function(transition) {
            transition.next({
                // saving the id which is passed in url to $data
                itemName: transition.to.params.itemName
            });
        }
     },
    data: function() {
        return {
            itemName:itemName,
          }
       },
})

// router.alias({
//     '/': '/work'
// })

router.map({
   // '*': {
   //    component: notFound
   // },

   '/work': {
      component: workComponent,
   },

   '/blog': {
      component: blogComponent,
   },

   '/about': {
      component: aboutComponent,
   },

   '/contact': {
      component: contactComponent
   },

  '/detail/:itemName': {
    name: 'detail', // 给这条路径加上一个名字
    component: Vue.component('newtemp')
  },

});

var App = Vue.extend()

router.start(App, 'body')


text:
Rails.application.routes.draw do

  devise_for :users
  resources :institutions

  resources :users
  resources :capacity

  match '/capacity/get' => 'capacity#get', via: :post
  match '/capacity/get/ids' => 'capacity#getByID', via: :post
  match '/capacity/update' => 'capacity#update', via: :post

  match '/institution/email' => 'institutions#email', via: :post

  match '/sms/info' => 'sms#info', via: :post
  match '/sms/notify' => 'sms#notify', via: :post
  match '/sms/reply' => 'sms#reply', via: :post
  match '/sms/subscribe' => 'sms#subscribe', via: :post

  get '/about' => 'about#index'

  get '/account' => 'account#index', as: 'account'

  get '/amenity/:id' => 'institutions#amenity', as: 'amenity'

  get '/institution/:id' => 'institutions#show'
  get '/institution/:id/print' => 'institutions#print', as: 'institution_print'

  get '/sms' => 'sms#index', as: 'mass_text'

  root "home#index"
  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
  # root 'welcome#index'

  # Example of regular route:
  #   get 'products/:id' => 'catalog#view'

  # Example of named route that can be invoked with purchase_url(id: product.id)
  #   get 'products/:id/purchase' => 'catalog#purchase', as: :purchase

  # Example resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Example resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Example resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Example resource route with more complex sub-resources:
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', on: :collection
  #     end
  #   end

  # Example resource route with concerns:
  #   concern :toggleable do
  #     post 'toggle'
  #   end
  #   resources :posts, concerns: :toggleable
  #   resources :photos, concerns: :toggleable

  # Example resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
end


text:
package com.camunda.demo;

import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;

@SpringBootApplication
@EnableWebSecurity
@EnableProcessApplication("springboot-security-sso")
public class CamundaApplication {

  @Autowired
  RuntimeService runtimeService;

  public static void main(String... args) {
    SpringApplication.run(CamundaApplication.class, args);
  }

  // This is only used for testing purposes
  @Bean
  public CommandLineRunner createDemoProcessInstance(){

    return (String[] args) -> runtimeService.startProcessInstanceByKey("springboot-security-sso");

  }
}


text:
<?php

namespace WireMock\Serde\Type;

use WireMock\Serde\SerializationException;

class SerdeTypeTypedArray extends SerdeTypeArray
{
    /** @var SerdeType */
    private $type;

    /**
     * @param SerdeType $type
     */
    public function __construct(SerdeType $type)
    {
        $this->type = $type;
    }

    static function setInnerType(SerdeTypeTypedArray $serdeType, SerdeType $type)
    {
        $serdeType->type = $type;
    }

    public function displayName(): string
    {
        return $this->type->displayName() . '[]';
    }

    /**
     * @throws SerializationException
     */
    function denormalizeFromArray(array &$data, array $path): array
    {
        $result = [];
        foreach ($data as $index => $element) {
            $newPath = $path;
            $newPath[] = "[$index]";
            $result[$index] = $this->type->denormalize($element, $newPath);
        }
        return $result;
    }
}


text:
order: 3
title:
  zh-CN: 自定义面板
  en-US: Custom Panel
---

## zh-CN

自定义各个面板的背景色、圆角和边距。

## en-US

Customize the background, border and margin styles for each panel.

````jsx
import { Collapse } from 'igroot';

const Panel = Collapse.Panel;

const text = `
  A dog is a type of domesticated animal.
  Known for its loyalty and faithfulness,
  it can be found as a welcome guest in many households across the world.
`;

const customPanelStyle = {
  background: '#f7f7f7',
  borderRadius: 4,
  marginBottom: 24,
  border: 0,
  overflow: 'hidden',
};

ReactDOM.render(
  <Collapse bordered={false} defaultActiveKey={['1']}>
    <Panel header="This is panel header 1" key="1" style={customPanelStyle}>
      <p>{text}</p>
    </Panel>
    <Panel header="This is panel header 2" key="2" style={customPanelStyle}>
      <p>{text}</p>
    </Panel>
    <Panel header="This is panel header 3" key="3" style={customPanelStyle}>
      <p>{text}</p>
    </Panel>
  </Collapse>,
  mountNode);
````


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Docums Mycol. 15(no. 59): 42 (1985)

#### Original name
Hygrophorus roseodiscoideus Bon & Chevassut

### Remarks
null


text:
'use strict';

var widgetsModule = angular.module('motech-widgets', []).directive('toolTip', function () {
    return function (scope, element, attrs) {
        //$(element).tooltip();
    };
});


text:
require 'hiera_puppet'

module Puppet::Parser::Functions
  newfunction(:hiera_array, :type => :rvalue, :arity => -2,:doc => "Returns all
  matches throughout the hierarchy --- not just the first match --- as a flattened array of unique values.
  If any of the matched values are arrays, they're flattened and included in the results.

  In addition to the required `key` argument, `hiera_array` accepts two additional
  arguments:

  - a `default` argument in the second position, providing a string or array to be returned
    in the absence of  matches to the `key` argument
  - an `override` argument in the third position, providing a data source to consult for
    matching values, even if it would not ordinarily be part of the matched hierarchy.
    If Hiera doesn't find a matching key in the named override data source, it will
    continue to search through the rest of the hierarchy.

  If any matched value is a hash, puppet will raise a type mismatch error.

  More thorough examples of `hiera` are available at:
  <http://docs.puppetlabs.com/hiera/1/puppet.html#hiera-lookup-functions>
  ") do |*args|
    key, default, override = HieraPuppet.parse_args(args)
    HieraPuppet.lookup(key, default, self, override, :array)
  end
end


text:
namespace Envoy {

struct HttpProtocolTestParams {
  Network::Address::IpVersion version;
  Http::CodecClient::Type downstream_protocol;
  FakeHttpConnection::Type upstream_protocol;
};

// Allows easy testing of Envoy code for HTTP/HTTP2 upstream/downstream.
//
// Usage:
//
// typedef HttpProtocolIntegrationTest MyTest
//
// INSTANTIATE_TEST_CASE_P(Protocols, BufferIntegrationTest,
//                         testing::ValuesIn(HttpProtocolIntegrationTest::getProtocolTestParams()),
//                         HttpProtocolIntegrationTest::protocolTestParamsToString);
//
//
// TEST_P(MyTest, TestInstance) {
// ....
// }
class HttpProtocolIntegrationTest : public HttpIntegrationTest,
                                    public testing::TestWithParam<HttpProtocolTestParams> {
public:
  // By default returns 8 combinations of
  // [HTTP  upstream / HTTP  downstream] x [Ipv4, IPv6]
  // [HTTP  upstream / HTTP2 downstream] x [Ipv4, IPv6]
  // [HTTP2 upstream / HTTP2 downstream] x [IPv4, Ipv6]
  // [HTTP upstream  / HTTP2 downstream] x [IPv4, Ipv6]
  //
  // Upstream and downstream protocols may be changed via the input vectors.
  // Address combinations are propogated from TestEnvironment::getIpVersionsForTest()
  static std::vector<HttpProtocolTestParams>
  getProtocolTestParams(const std::vector<Http::CodecClient::Type>& downstream_protocols =
                            {Http::CodecClient::Type::HTTP1, Http::CodecClient::Type::HTTP2},
                        const std::vector<FakeHttpConnection::Type>& upstream_protocols = {
                            FakeHttpConnection::Type::HTTP1, FakeHttpConnection::Type::HTTP2});

  // Allows pretty printed test names of the form
  // FooTestCase.BarInstance/IPv4_Http2Downstream_HttpUpstream
  static std::string
  protocolTestParamsToString(const testing::TestParamInfo<HttpProtocolTestParams>& p);

  HttpProtocolIntegrationTest()
      : HttpIntegrationTest(GetParam().downstream_protocol, GetParam().version) {}

  void SetUp() override {
    setDownstreamProtocol(GetParam().downstream_protocol);
    setUpstreamProtocol(GetParam().upstream_protocol);
  }
};

} // namespace Envoy


text:
pub extern crate libc;

#[macro_use]
extern crate lazy_static;

#[macro_use]
extern crate bitflags;
pub extern crate sdl2_sys as sys;

#[cfg(feature = "gfx")]
extern crate c_vec;

pub use crate::sdl::*;

pub mod clipboard;
pub mod cpuinfo;
#[macro_use]
mod macros;
pub mod audio;
pub mod controller;
pub mod event;
pub mod filesystem;
pub mod haptic;
pub mod hint;
pub mod joystick;
pub mod keyboard;
pub mod log;
pub mod messagebox;
pub mod mouse;
pub mod pixels;
pub mod rect;
pub mod render;
pub mod rwops;
mod sdl;
pub mod surface;
pub mod timer;
pub mod touch;
pub mod version;
pub mod video;

// modules
#[cfg(feature = "gfx")]
pub mod gfx;
#[cfg(feature = "image")]
pub mod image;
#[cfg(feature = "mixer")]
pub mod mixer;
#[cfg(feature = "ttf")]
pub mod ttf;

mod common;
// Export return types and such from the common module.
pub use crate::common::IntegerOrSdlError;

#[cfg(feature = "raw-window-handle")]
pub mod raw_window_handle;


text:
#include "tensorflow/tools/graph_transforms/file_utils.h"

#include "tensorflow/core/public/session.h"

namespace tensorflow {
namespace graph_transforms {

Status LoadTextOrBinaryGraphFile(const string& file_name, GraphDef* graph_def) {
  string file_data;
  Status load_file_status =
      ReadFileToString(Env::Default(), file_name, &file_data);
  if (!load_file_status.ok()) {
    errors::AppendToMessage(&load_file_status, " (for file ", file_name, ")");
    return load_file_status;
  }
  // Try to load in binary format first, and then try ascii if that fails.
  Status load_status = ReadBinaryProto(Env::Default(), file_name, graph_def);
  if (!load_status.ok()) {
    if (protobuf::TextFormat::ParseFromString(file_data, graph_def)) {
      load_status = Status::OK();
    } else {
      errors::AppendToMessage(&load_status,
                              " (both text and binary parsing failed for file ",
                              file_name, ")");
    }
  }
  return load_status;
}

}  // namespace graph_transforms
}  // namespace tensorflow


text:
<?php

namespace Enhavo\Bundle\UserBundle\Twig;

use Enhavo\Bundle\UserBundle\Configuration\ConfigurationProvider;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

class TwigExtension extends AbstractExtension
{
    /** @var CsrfTokenManagerInterface */
    private $tokenManager;

    /** @var ConfigurationProvider */
    private $configurationProvider;

    /** @var RouterInterface */
    private $router;

    /**
     * TwigExtension constructor.
     * @param CsrfTokenManagerInterface $tokenManager
     * @param ConfigurationProvider $configurationProvider
     * @param RouterInterface $router
     */
    public function __construct(CsrfTokenManagerInterface $tokenManager, ConfigurationProvider $configurationProvider, RouterInterface $router)
    {
        $this->tokenManager = $tokenManager;
        $this->configurationProvider = $configurationProvider;
        $this->router = $router;
    }

    public function getFunctions()
    {
        return [
            new TwigFunction('user_verify_path', [$this, 'getVerifyPath']),
        ];
    }

    public function getVerifyPath($key = 'theme')
    {
        $token = $this->tokenManager->getToken('user-verification');
        $route = $this->configurationProvider->getVerificationRequestConfiguration($key)->getRoute();

        return $this->router->generate($route, [
            'csrfToken' => $token
        ]);
    }
}


text:
package org.springframework.cloud.dataflow.rest.client;

import org.springframework.cloud.dataflow.rest.resource.JobExecutionResource;
import org.springframework.cloud.dataflow.rest.resource.JobInstanceResource;
import org.springframework.cloud.dataflow.rest.resource.StepExecutionProgressInfoResource;
import org.springframework.cloud.dataflow.rest.resource.StepExecutionResource;
import org.springframework.hateoas.PagedResources;

/**
 * Interface defining operations available for jobs.
 *
 * @author Glenn Renfro
 */
public interface JobOperations {

	/**
	 * @return the list job executions known to the system.
	 */
	PagedResources<JobExecutionResource> executionList();

	/**
	 * @param jobName the name of the job
	 * @return the list job instances for the specified jobName.
	 */
	PagedResources<JobInstanceResource> instanceList(String jobName);

	/**
	 * List job executions known to the system filtered by job name.
	 *
	 * @param jobName of the executions.
	 * @return the list of job executions
	 */
	PagedResources<JobExecutionResource> executionListByJobName(String jobName);

	/**
	 * Return the {@link JobExecutionResource} for the id specified.
	 *
	 * @param id identifier of the job execution
	 * @return {@link JobExecutionResource}
	 */
	JobExecutionResource jobExecution(long id);

	/**
	 * Return the {@link JobInstanceResource} for the id specified.
	 *
	 * @param id identifier of the job instasnce
	 * @return {@link JobInstanceResource}
	 */
	JobInstanceResource jobInstance(long id);

	/**
	 * List step executions known for a specific job execution id.
	 *
	 * @param jobExecutionId the id of the job execution.
	 * @return the paged list of step executions
	 */
	PagedResources<StepExecutionResource> stepExecutionList(long jobExecutionId);

	/**
	 * Return StepExecutionProgressInfoResource for a specific job execution id and step
	 * execution Id.
	 *
	 * @param jobExecutionId the id of the job execution for the step to be returned.
	 * @param stepExecutionId the id step execution to be returned.
	 * @return the step execution progress info
	 */
	StepExecutionProgressInfoResource stepExecutionProgress(long jobExecutionId, long stepExecutionId);

}


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DateTimeComponent = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _set = function set(object, property, value, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent !== null) { set(parent, property, value, receiver); } } else if ("value" in desc && desc.writable) { desc.value = value; } else { var setter = desc.set; if (setter !== undefined) { setter.call(receiver, value); } } return value; };

var _get2 = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _Base = require('../base/Base');

var _flatpickr = require('flatpickr');

var _flatpickr2 = _interopRequireDefault(_flatpickr);

var _get3 = require('lodash/get');

var _get4 = _interopRequireDefault(_get3);

var _each2 = require('lodash/each');

var _each3 = _interopRequireDefault(_each2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var DateTimeComponent = exports.DateTimeComponent = function (_BaseComponent) {
  _inherits(DateTimeComponent, _BaseComponent);

  function DateTimeComponent(component, options, data) {
    _classCallCheck(this, DateTimeComponent);

    var _this = _possibleConstructorReturn(this, (DateTimeComponent.__proto__ || Object.getPrototypeOf(DateTimeComponent)).call(this, component, options, data));

    _this.validators.push('date');
    return _this;
  }

  _createClass(DateTimeComponent, [{
    key: 'elementInfo',
    value: function elementInfo() {
      var info = _get2(DateTimeComponent.prototype.__proto__ || Object.getPrototypeOf(DateTimeComponent.prototype), 'elementInfo', this).call(this);
      info.type = 'input';
      info.attr.type = 'text';
      info.changeEvent = 'input';
      this.component.suffix = true;
      return info;
    }

    // This select component can handle multiple items on its own.

  }, {
    key: 'createWrapper',
    value: function createWrapper() {
      return false;
    }
  }, {
    key: 'convertFormat',
    value: function convertFormat(format) {
      // Year conversion.
      format = format.replace(/y/g, 'Y');
      format = format.replace('YYYY', 'Y');
      format = format.replace('YY', 'y');

      // Month conversion.
      format = format.replace('MMMM', 'F');
      format = format.replace(/M/g, 'n');
      format = format.replace('nnn', 'M');
      format = format.replace('nn', 'm');

      // Day in month.
      format = format.replace(/d/g, 'j');
      format = format.replace('jj', 'd');

      // Day in week.
      format = format.replace('EEEE', 'l');
      format = format.replace('EEE', 'D');

      // Hours, minutes, seconds
      format = format.replace('HH', 'H');
      format = format.replace('hh', 'h');
      format = format.replace('mm', 'i');
      format = format.replace('ss', 'S');
      format = format.replace(/a/g, 'K');
      return format;
    }
  }, {
    key: 'addSuffix',
    value: function addSuffix(input, inputGroup) {
      var suffix = this.ce('suffix', 'span', {
        class: 'input-group-addon'
      });
      suffix.appendChild(this.getIcon(this.component.enableDate ? 'calendar' : 'time'));
      inputGroup.appendChild(suffix);
      return suffix;
    }
  }, {
    key: 'addInput',
    value: function addInput(input, container, name) {
      _get2(DateTimeComponent.prototype.__proto__ || Object.getPrototypeOf(DateTimeComponent.prototype), 'addInput', this).call(this, input, container, name);
      input.calendar = new _flatpickr2.default(input, this.config);
    }
  }, {
    key: 'getDate',
    value: function getDate(value) {
      var timestamp = parseInt(value, 10);
      if (!timestamp) {
        // Just default to today.
        return new Date();
      }
      return new Date(timestamp * 1000);
    }
  }, {
    key: 'getRawValue',
    value: function getRawValue() {
      var values = [];
      for (var i in this.inputs) {
        if (!this.component.multiple) {
          return this.getDate(this.inputs[i].value);
        }
        values.push(this.getDate(this.inputs[i].value));
      }
      return values;
    }
  }, {
    key: 'getValueAt',
    value: function getValueAt(index) {
      return this.getDate(this.inputs[index].value).toISOString();
    }
  }, {
    key: 'setValueAt',
    value: function setValueAt(index, value) {
      if (this.inputs[index].calendar) {
        var date = value ? new Date(value) : new Date();
        this.inputs[index].calendar.setDate(date);
      }
    }
  }, {
    key: 'config',
    get: function get() {
      var _this2 = this;

      return {
        altInput: true,
        clickOpens: true,
        enableDate: true,
        mode: this.component.multiple ? 'multiple' : 'single',
        enableTime: (0, _get4.default)(this.component, 'enableTime', true),
        noCalendar: !(0, _get4.default)(this.component, 'enableDate', true),
        altFormat: this.convertFormat((0, _get4.default)(this.component, 'format', '')),
        dateFormat: 'U',
        defaultDate: (0, _get4.default)(this.component, 'defaultDate', ''),
        hourIncrement: (0, _get4.default)(this.component, 'timePicker.hourStep', 1),
        minuteIncrement: (0, _get4.default)(this.component, 'timePicker.minuteStep', 5),
        onChange: function onChange() {
          return _this2.onChange();
        }
      };
    }
  }, {
    key: 'disabled',
    set: function set(disabled) {
      _set(DateTimeComponent.prototype.__proto__ || Object.getPrototypeOf(DateTimeComponent.prototype), 'disabled', disabled, this);
      (0, _each3.default)(this.inputs, function (input) {
        if (input.calendar) {
          input.calendar.redraw();
        }
      });
    }
  }]);

  return DateTimeComponent;
}(_Base.BaseComponent);


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<title>jQuery plugin: Tablesorter 2.0 - jQuery UITheme Widget (jQuery UI)</title>

	<link rel="stylesheet" href="css/jq.css">
	<link href="css/prettify.css" rel="stylesheet">

	<link id="ui-theme" rel="stylesheet" href="css/jquery-ui.min.css">
	<link href="../css/theme.jui.css" rel="stylesheet">
	<link href="../css/theme.grey.css" rel="stylesheet">

tablesorter

jQuery UITheme Widget (jQuery UI)

Flexible client-side table sorting

	Back to documentation

		NOTE!

In v2.19.0, this widget allows dynamic changing of themes; including switching from jQuery UI or Bootstrap to any other theme. To change a theme, do the following:

var $table = $('table');
$table[0].config.theme = 'grey';
$table.trigger('applyWidgets');

				To see this work, check out the scroller widget demo.

As of tablesorter version 2.9+, this widget can no longer be applied to versions of tablesorter prior to version 2.8.

You will need to modify the headerTemplate option to include the bootstrap icon! See the example in the code (v2.7).

The original "widgetUitheme" option has been replaced by "widgetOptions.uitheme". See the javascript block below for more details (v2.1).

In tablesorter v2.4, the uitheme option has changed to indicate the theme instead of an array of icons to use:

All theme class names are now contained within $.tablesorter.themes with the jQuery UI theme saved to $.tablesorter.themes.jui

The themes variable allows you to modify the class names for the table, header, sort icons, active state, hover state, filter inputs and zebra striping. See the code below on how to extend these variables.

Set the uitheme widget option to "jui" to set the widget to use the jQuery UI theme. See the bootstrap demo for another example.

Earlier widget versions required jQuery 1.4+. The UITheme widget for tablesorter 2.4+ requires jQuery 1.2.6+.

Demo

	jQuery UI Theme:

Some interesting caption

			First Name
			Last Name
			Age
			Total
			Discount
			Date

			First Name
			Last Name
			Age
			Total
			Discount
			Date

			Peter
			Parker
			28
			$9.99
			20%
			Jul 6, 2006 8:14 AM

			John
			Hood
			33
			$19.99
			25%
			Dec 10, 2002 5:14 AM

			Clark
			Kent
			18
			$15.89
			44%
			Jan 12, 2003 11:14 AM

			Bruce
			Almighty
			45
			$153.19
			44%
			Jan 18, 2001 9:12 AM

			Bruce
			Evans
			22
			$13.19
			11%
			Jan 18, 2007 9:12 AM

Page Header

<!-- ui theme stylesheet - contents shown below -->
<link rel="stylesheet" href="../css/theme.jui.css">
<!-- jQuery UI theme (cupertino example here) -->
<link rel="stylesheet" href="css/jquery-ui.min.css">

<!-- tablesorter plugin -->
<script src="../js/jquery.tablesorter.js"></script>
<!-- tablesorter widget file - loaded after the plugin -->
<script src="../js/jquery.tablesorter.widgets.js"></script>

Javascript

HTML

	Next up: UITheme widget - Bootstrap theme ››

	Second time around: Modifying the Header during rendering ››


text:
#pragma once

#include "envoy/http/filter.h"

#include "source/common/common/logger.h"
#include "source/extensions/filters/http/common/pass_through_filter.h"

#include "library/common/extensions/filters/http/socket_tag/filter.pb.h"
#include "library/common/types/c_types.h"

namespace Envoy {
namespace Extensions {
namespace HttpFilters {
namespace SocketTag {

/**
 * Filter to set upstream socket tags based on a request header.
 * See: https://source.android.com/devices/tech/datausage/tags-explained
 */
class SocketTagFilter final : public Http::PassThroughFilter,
                              public Logger::Loggable<Logger::Id::filter> {
public:
  // Http::PassThroughDecoderFilter
  Http::FilterHeadersStatus decodeHeaders(Http::RequestHeaderMap& request_headers, bool) override;
};

} // namespace SocketTag
} // namespace HttpFilters
} // namespace Extensions
} // namespace Envoy


text:
package org.wso2.carbon.integration.test.template.manager;

import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.automation.engine.context.TestUserMode;
import org.wso2.carbon.event.template.manager.admin.dto.configuration.xsd.AttributeMappingDTO;
import org.wso2.carbon.event.template.manager.admin.dto.configuration.xsd.ConfigurationParameterDTO;
import org.wso2.carbon.event.template.manager.admin.dto.configuration.xsd.ScenarioConfigurationDTO;
import org.wso2.carbon.event.template.manager.admin.dto.configuration.xsd.StreamMappingDTO;
import org.wso2.carbon.event.template.manager.admin.dto.domain.xsd.DomainInfoDTO;
import org.wso2.carbon.event.template.manager.admin.dto.domain.xsd.DomainParameterDTO;
import org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager;
import org.wso2.carbon.integration.test.processflow.DeployArtifactsBasicTestCase;
import org.wso2.cep.integration.common.utils.CEPIntegrationTest;

import java.io.File;
import java.rmi.RemoteException;

public class TemplateManagerTestCase extends CEPIntegrationTest {
    private static final Log log = LogFactory.getLog(DeployArtifactsBasicTestCase.class);
    private static final String DEVICE_STREAM_ID = "DeviceStream:1.0.0";
    private static final String TO_STREAM_ID = "org.wso2.event.sensor.stream:1.0.0";
    private static final int TO_STREAM_ATTRIBUTE_COUNT = 2;

    private int eventStreamCount;
    private int executionPlanCount;
    private int configurationCount;
    private ServerConfigurationManager serverManager;

    @BeforeClass(alwaysRun = true)
    public void init() throws Exception {
        super.init(TestUserMode.SUPER_TENANT_ADMIN);
        serverManager = new ServerConfigurationManager(cepServer);

        File newFile = new File(getClass().getResource(File.separator + "artifacts" + File.separator + "CEP"
                + File.separator + "template" + File.separator + "manager" + File.separator
                + "TestDomain.xml").toURI());
        FileUtils.copyFileToDirectory(newFile, new File(ServerConfigurationManager.getCarbonHome() + File.separator
                + "repository" + File.separator + "conf" + File.separator + "template-manager" + File.separator
                + "domain-template" + File.separator));
        serverManager.restartForcefully();

        String loggedInSessionCookie = getSessionCookie();
        eventProcessorAdminServiceClient = configurationUtil
                .getEventProcessorAdminServiceClient(backendURL, loggedInSessionCookie);
        eventStreamManagerAdminServiceClient = configurationUtil
                .getEventStreamManagerAdminServiceClient(backendURL, loggedInSessionCookie);
        templateManagerAdminServiceClient = configurationUtil
                .getTemplateManagerAdminServiceClient(backendURL, loggedInSessionCookie);

        //~~Adding fromStream (user's stream) definition~~
        //It is a pre-requisite to have this stream defined.
        //It should be in 'deployed' state when we add the scenario configuration in following tests.
        eventStreamCount = eventStreamManagerAdminServiceClient.getEventStreamCount();
        String deviceStreamDefinition = getJSONArtifactConfiguration("template" + File.separator + "manager", "DeviceStream_1.0.0.json");
        eventStreamManagerAdminServiceClient.addEventStreamAsString(deviceStreamDefinition);
        Assert.assertEquals(eventStreamManagerAdminServiceClient.getEventStreamCount(), ++eventStreamCount);
    }

    @Test(groups = {"wso2.cep"}, description = "Testing the adding a configuration for a domain template")
    public void addTemplateConfigurationTestScenario1() throws Exception {
        String configName = "TestConfig";

        DomainInfoDTO domainInfo = templateManagerAdminServiceClient
                .getDomainInfo("TestDomain");

        if (domainInfo == null) {
            Assert.fail("Domain is not loaded");
        } else {

            log.info("==================Testing the adding a configuration for a domain template==================== ");
            eventStreamCount = eventStreamManagerAdminServiceClient.getEventStreamCount();
            executionPlanCount = eventProcessorAdminServiceClient.getExecutionPlanConfigurationCount();

            log.info("=======================Adding a configuration====================");
            ScenarioConfigurationDTO configuration = new ScenarioConfigurationDTO();

            configuration.setName(configName);
            configuration.setDomain(domainInfo.getName());
            configuration.setType(domainInfo.getScenarioInfoDTOs()[0].getType());
            configuration.setDescription("This is a test description");

            for (DomainParameterDTO domainParameterDTO : domainInfo.getScenarioInfoDTOs()[0].getDomainParameterDTOs()) {
                ConfigurationParameterDTO configParameterDTO = new ConfigurationParameterDTO();
                configParameterDTO.setName(domainParameterDTO.getName());
                configParameterDTO.setValue(domainParameterDTO.getDefaultValue());
                configuration.addConfigurationParameterDTOs(configParameterDTO);
            }

            String[] streamIDsToBeMapped = templateManagerAdminServiceClient.saveConfiguration(configuration);
            Assert.assertEquals(TO_STREAM_ID, streamIDsToBeMapped[0]);
            executionPlanCount++;

            waitForExecutionPlanDeployment(executionPlanCount, 300, 20000);
            //After saveConfiguration() is called, the execution plan in the TestDomain.xml template should have being deployed,
            //hence count should have gotten incremented by one.
            Assert.assertEquals(eventProcessorAdminServiceClient.getExecutionPlanConfigurationCount(),
                                executionPlanCount);
            eventStreamCount += 2;
            Assert.assertEquals(eventStreamManagerAdminServiceClient.getEventStreamCount(), eventStreamCount);
            //Number of configurations should be incremented by one
            Assert.assertEquals(templateManagerAdminServiceClient.getConfigurationsCount(domainInfo.getName()),
                                ++configurationCount);

            StreamMappingDTO streamMappingDTO = new StreamMappingDTO();
            streamMappingDTO.setFromStream(DEVICE_STREAM_ID);
            streamMappingDTO.setToStream(TO_STREAM_ID);

            AttributeMappingDTO[] attributeMappingDTOs = new AttributeMappingDTO[TO_STREAM_ATTRIBUTE_COUNT];

            AttributeMappingDTO idAttributeMappingDTO = new AttributeMappingDTO();
            idAttributeMappingDTO.setFromAttribute("id");
            idAttributeMappingDTO.setToAttribute("sensor_id");
            idAttributeMappingDTO.setAttributeType("string");

            AttributeMappingDTO valueAttributeMappingDTO = new AttributeMappingDTO();
            valueAttributeMappingDTO.setFromAttribute("reading");
            valueAttributeMappingDTO.setToAttribute("sensor_value");
            valueAttributeMappingDTO.setAttributeType("double");

            attributeMappingDTOs[0] = idAttributeMappingDTO;
            attributeMappingDTOs[1] = valueAttributeMappingDTO;

            streamMappingDTO.setAttributeMappingDTOs(attributeMappingDTOs);

            StreamMappingDTO[] streamMappingDTOs = {streamMappingDTO};

            boolean streamMappingSaved = templateManagerAdminServiceClient.saveStreamMapping(streamMappingDTOs, configName, domainInfo.getName());
            Assert.assertEquals(streamMappingSaved, true);
            executionPlanCount++;

            waitForExecutionPlanDeployment(executionPlanCount, 300, 20000);

            //After saveStreamMapping() is called, the streamMapping execution plan should have being deployed.
            Assert.assertEquals(eventProcessorAdminServiceClient.getExecutionPlanConfigurationCount(),
                    executionPlanCount);

            log.info("=======================Edit a configuration====================");
            configuration.setDescription("Description edited");
            templateManagerAdminServiceClient.editConfiguration(configuration);
            Thread.sleep(6000);
            //When existing configuration is been updated, the execution plan will be un-deployed and redeployed
            Assert.assertEquals(eventProcessorAdminServiceClient.getExecutionPlanConfigurationCount(),
                    executionPlanCount);
            Assert.assertEquals(eventStreamManagerAdminServiceClient.getEventStreamCount(), eventStreamCount);
            Assert.assertEquals(templateManagerAdminServiceClient.getConfigurationsCount(domainInfo.getName()),
                                configurationCount);

            log.info("=======================Delete a configuration====================");
            templateManagerAdminServiceClient.deleteConfiguration(configuration.getDomain(), configuration.getName());
            //When configuration is deleted two execution plans will get un-deployed. 1. the one in the template 2. the stream mapping execution plan.
            executionPlanCount -= 2;
            waitForExecutionPlanDeployment(executionPlanCount, 300, 20000);

            Assert.assertEquals(eventProcessorAdminServiceClient.getExecutionPlanConfigurationCount(),
                    executionPlanCount);
            eventStreamCount -= 2;
            Assert.assertEquals(eventStreamManagerAdminServiceClient.getEventStreamCount(), eventStreamCount);
            //When configuration is deleted the configuration count should be decremented by one
            Assert.assertEquals(templateManagerAdminServiceClient.getConfigurationsCount(domainInfo.getName()),
                                --configurationCount);
        }
    }

    @AfterClass(alwaysRun = true)
    public void destroy() throws Exception {
        super.cleanup();
    }

    private void waitForExecutionPlanDeployment(int expectedCount, long sleepTime, long timeout)
            throws InterruptedException, RemoteException {
        long currentWaitTime = 0;
        long startTime = System.currentTimeMillis();
        int currentCount = eventProcessorAdminServiceClient.getExecutionPlanConfigurationCount();
        while ((expectedCount != currentCount) && (currentWaitTime <= timeout)) {
            Thread.sleep(sleepTime);
            currentCount = eventProcessorAdminServiceClient.getExecutionPlanConfigurationCount();
            currentWaitTime = System.currentTimeMillis() - startTime;
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>../src/helpers/animation.js</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">

            API Docs for:

APIs

Classes

Modules

            <input type="search" id="api-filter" placeholder="Type to filter APIs">

LS.Animation

LS.Animation.Track

LS.ComponentContainer

LS.Components.Camera

LS.Components.CameraController

LS.Components.CameraFX

LS.Components.FollowNode

LS.Components.FXGraphComponent

LS.Components.GeometricPrimitive

LS.Components.GraphComponent

LS.Components.Knob

LS.Components.Light

LS.Components.LightFX

LS.Components.NodeManipulator

LS.Components.PlayAnimation

LS.Components.Poser

LS.Components.RealtimeReflector

LS.Components.Spherize

LS.Components.Target

LS.Components.Transform

LS.CompositePattern

LS.Context

LS.LS

LS.LScript

LS.Material

LS.Physics

LS.PhysicsInstance

LS.Picking

LS.Prefab

LS.Renderer

LS.RenderInstance

LS.RenderOptions

LS.ResourcesManager

LS.SceneNode

LS.SceneTree

LS.StandardMaterial

LS.WBin

Rotator

VRCameraController

        Show:

            <input type="checkbox" id="api-show-inherited" checked>
            Inherited

            <input type="checkbox" id="api-show-protected">
            Protected

            <input type="checkbox" id="api-show-private">
            Private

            <input type="checkbox" id="api-show-deprecated">
            Deprecated

File: ../src/helpers/animation.js

//Interpolation methods
LS.NONE = 0;
LS.LINEAR = 1;
LS.TRIGONOMETRIC = 2;
LS.BEZIER = 3;
LS.SPLINE = 4;

/**
* An Animation is a resource that contains samples of properties over time, similar to animation curves
* Values could be associated to an specific node.
* Data is contained in tracks
*
* @class Animation
* @namespace LS
* @constructor
*/

function Animation(o)
{
	this.name = "";
	this.takes = {}; //packs of tracks
	if(o)
		this.configure(o);
}

Animation.prototype.createTake = function( name, duration )
{
	var take = new Animation.Take();
	take.name = name;
	take.duration = duration || 0;
	this.addTake( take );
	return take;
}

Animation.prototype.addTake = function(take)
{
	this.takes[ take.name ] = take;
	return take;
}

Animation.prototype.getTake = function( name )
{
	return this.takes[ name ];
}

Animation.prototype.addTrackToTake = function(takename, track)
{
	var take = this.takes[ takename ];
	if(!take)
		take = this.createTake( takename );
	take.addTrack( track );
}

Animation.prototype.configure = function(data)
{
	if(data.takes)
	{
		for(var i in data.takes)
		{
			var take = new LS.Animation.Take( data.takes[i] );
			this.addTake( take );
		}
	}
}

Animation.fromBinary = function( data )
{
	if(data.constructor == ArrayBuffer)
		data = WBin.load(data, true);

	var o = data["@json"];
	for(var i in o.takes)
	{
		var take = o.takes[i];
		for(var j in take.tracks)
		{
			var track = take.tracks[j];
			var name = "@take_" + i + "_track_" + j;
			if( data[name] )
				track.data = data[name];
		}
	}

	return new LS.Animation( o );
}

Animation.prototype.toBinary = function()
{
	var o = {};
	var tracks_data = [];

	//we need to remove the bin data to generate the JSON
	for(var i in this.takes)
	{
		var take = this.takes[i];
		for(var j in take.tracks)
		{
			var track = take.tracks[j];
			track.packData(); //reduce storage space and speed ups load

			if(track.packed_data)
			{
				var bindata = track.data;
				var name = "@take_" + i + "_track_" + j;
				o[name] = bindata;
				track.data = null;
				tracks_data.push( bindata );
			}
		}
	}

	//create the binary
	o["@json"] = LS.cloneObject(this, null, true);
	var bin = WBin.create(o, "Animation");

	//restore the bin data state in this instance
	for(var i in this.takes)
	{
		var take = this.takes[i];
		for(var j in take.tracks)
		{
			var track = take.tracks[j];
			var name = "@take_" + i + "_track_" + j;
			if(o[name])
				track.data = o[name];
		}
	}

	return bin;
}

LS.Animation = Animation;

/** Represents a set of animations **/
function Take(o)
{
	this.name = null;
	this.tracks = [];
	this.duration = 10;

	if(!o)
		return;

	if( o.name ) this.name = o.name;
	if( o.tracks )
	{
		for(var i in o.tracks)
		{
			var track = new LS.Animation.Track( o.tracks[i] );
			this.addTrack( track );
		}
	}
	if( o.duration ) this.duration = o.duration;
}

Take.prototype.createTrack = function( data )
{
	if(!data)
		throw("Data missing when creating track");

	var track = this.getTrack( data.property );
	if( track )
		return track;

	var track = new LS.Animation.Track( data );
	this.addTrack( track );
	return track;
}

Take.prototype.applyTracks = function( current_time, last_time )
{
	for(var i = 0; i < this.tracks.length; ++i)
	{
		var track = this.tracks[i];
		if( track.enabled === false || !track.data )
			continue;

		if( track.type == "events" )
		{
			var keyframe = track.getKeyframeByTime( current_time );
			if( !keyframe || keyframe[0] < last_time || keyframe[0] > current_time )
				return;

			var info = LS.GlobalScene.getPropertyInfoFromPath( track._property_path );
			if(!info)
				return;

			if(info.node && info.target && info.target[ keyframe[1][0] ] )
				info.target[ keyframe[1][0] ].call( info.target, keyframe[1][1] );
		}
		else
		{
			var sample = track.getSample( current_time, true );
			if( sample !== undefined )
				LS.GlobalScene.setPropertyValueFromPath( track._property_path, sample );
		}
	}
}

Take.prototype.addTrack = function( track )
{
	this.tracks.push( track );
}

Take.prototype.getTrack = function( property )
{
	for(var i = 0; i < this.tracks.length; ++i)
		if(this.tracks[i].property == property)
			return this.tracks[i];
	return null;
}

Take.prototype.removeTrack = function( track )
{
	for(var i = 0; i < this.tracks.length; ++i)
		if(this.tracks[i] == track)
		{
			this.tracks.splice( i, 1 );
			return;
		}
}

Take.prototype.getPropertiesSample = function(time, result)
{
	result = result || [];
	for(var i = 0; i < this.tracks.length; ++i)
	{
		var track = this.tracks[i];
		var value = track.getSample( time );
		result.push([track.property, value]);
	}
	return result;
}

Take.prototype.actionPerSample = function(time, callback, options)
{
	for(var i in this.tracks)
	{
		var track = this.tracks[i];
		var value = track.getSample(time, true);
		if( options.disabled_tracks && options.disabled_tracks[ track.property ] )
			continue;
		callback(track.property, value, options);
	}
}

Animation.Take = Take;

/**
* Represents one track with data over time about one property
* Data could be stored in two forms, or an array containing arrays of [time,data] or in a single typed array, depends on the attribute typed_mode
*
* @class Animation.Track
* @namespace LS
* @constructor
*/

function Track(o)
{
	this.enabled = true;
	this.name = ""; //title
	this.type = null; //type of data (number, vec2, color, texture, etc)
	this.interpolation = LS.NONE;
	this.looped = false; //interpolate last keyframe with first

	//data
	this.packed_data = false; //this means the data is stored in one continuous datatype, faster to load but not editable
	this.value_size = 0; //how many numbers contains every sample of this property, 0 means basic type (string, boolean)
	this.data = null; //array or typed array where you have the time value followed by this.value_size bytes of data
	this.data_table = null; //used to index data when storing it

	//to speed up sampling
	Object.defineProperty( this, '_property', {
		value: "",
		enumerable: false,
		writable: true
	});

	Object.defineProperty( this, '_property_path', {
		value: [],
		enumerable: false,
		writable: true
	});

	if(o)
		this.configure(o);
}

Track.FRAMERATE = 30;

//string identifying the property being animated in a locator form ( node/component_uid/property )
Object.defineProperty( Track.prototype, 'property', {
	set: function( property )
	{
		this._property = property.trim();
		this._property_path = this._property.split("/");
	},
	get: function(){
		return this._property;
	},
	enumerable: true
});

Track.prototype.configure = function( o )
{
	if(!o.property)
		console.warn("Track with property name");

	if(o.enabled !== undefined) this.enabled = o.enabled;
	if(o.name) this.name = o.name;
	if(o.property) this.property = o.property;
	if(o.type) this.type = o.type;
	if(o.looped) this.looped = o.looped;
	if(o.interpolation !== undefined)
		this.interpolation = o.interpolation;
	else
		this.interpolation = LS.LINEAR;

	if(o.data_table) this.data_table = o.data_table;

	//data
	if(o.data)
	{
		this.value_size = o.value_size;
		this.data = o.data;
		this.packed_data = !!o.packed_data;

		if( o.data.constructor == Array )
		{
			if( this.packed_data )
				this.data = new Float32Array( o.data );
		}
		else
			this.unpackData();
	}

	if(o.interpolation && !this.value_size)
		o.interpolation = LS.NONE;
}

Track.prototype.serialize = function()
{
	var o = {
		enabled: this.enabled,
		name: this.name,
		property: this.property,
		type: this.type,
		interpolation: this.interpolation,
		looped: this.looped,
		value_size: this.value_size,
		packed_data: false,
		data_table: this.data_table
	}

	if(this.value_size <= 1)
		o.data = this.data.concat(); //regular array, clone it
	else //pack data
	{
		this.packData();
		o.data = new Float32Array( this.data ); //clone it
		o.packed_data = this.packed_data;
	}

	return o;
}

Track.prototype.toJSON = Track.prototype.serialize;

Track.prototype.addKeyframe = function( time, value, skip_replace )
{
	if(this.value_size > 1)
		value = new Float32Array( value ); //clone

	if(this.packed_data)
	{
		//TODO!!!!!
		console.warn("TODO: add keyframe in packed data");
		return -1;
	}

	if(!this.data)
		this.data = [];

	for(var i = 0; i < this.data.length; ++i)
	{
		if(this.data[i][0] < time )
			continue;
		if(this.data[i][0] == time && !skip_replace )
			this.data[i][1] = value;
		else
			this.data.splice(i,0, [time,value]);
		return i;
	}

	this.data.push( [time,value] );
	return this.data.length - 1;
}

Track.prototype.getKeyframe = function( index )
{
	if(this.packed_data)
	{
		var pos = index * (1 + this.value_size );
		if(pos > (this.data.length - this.value_size) )
			return null;
		return [ this.data[pos], this.data.subarray(pos+1, pos+this.value_size) ];
	}

	return this.data[ index ];
}

Track.prototype.getKeyframeByTime = function( time )
{
	var index = this.findTimeIndex( time );
	if(index == -1)
		return;
	return this.getKeyframe( index );
}

Track.prototype.moveKeyframe = function(index, new_time)
{
	if(this.packed_data)
	{
		//TODO
		console.warn("Cannot move keyframes if packed");
		return -1;
	}

	if(index >= this.data.length)
	{
		console.warn("keyframe index out of bounds");
		return -1;
	}

	var new_index = this.findTimeIndex( new_time );
	var keyframe = this.data[ index ];
	var old_time = keyframe[0];
	if(old_time == new_time)
		return index;
	keyframe[0] = new_time; //set time
	if(old_time > new_time)
		new_index += 1;
	if(index == new_index)
	{
		//console.warn("same index");
		return index;
	}

	//extract
	this.data.splice(index, 1);
	//reinsert
	index = this.addKeyframe( keyframe[0], keyframe[1], true );

	this.sortKeyframes();
	return index;
}

//solve bugs
Track.prototype.sortKeyframes = function()
{
	if(this.packed_data)
	{
		//TODO!!!!!
		console.warn("TODO: sortKeyframes in packed data");
		return -1;
	}
	this.data.sort( function(a,b){ return a[0] - b[0];  });
}

Track.prototype.removeKeyframe = function(index)
{
	if(this.packed_data)
	{
		//TODO
		console.warn("Cannot move keyframes if packed");
		return;
	}

	if(index >= this.data.length)
	{
		console.warn("keyframe index out of bounds");
		return;
	}

	this.data.splice(index, 1);
}

Track.prototype.getNumberOfKeyframes = function()
{
	if(!this.data || this.data.length == 0)
		return 0;

	if(this.packed_data)
		return this.data.length / (1 + this.value_size );
	return this.data.length;
}

//check for the last sample time
Track.prototype.computeDuration = function()
{
	if(!this.data || this.data.length == 0)
		return 0;

	if(this.packed_data)
	{
		var time = this.data[ this.data.length - 2 - this.value_size ];
		this.duration = time;
		return time;
	}

	//not typed
	var last = this.data[ this.data.length - 1 ];
	if(last)
		return last[0];
	return 0;
}

//better for reading
Track.prototype.packData = function()
{
	if(!this.data || this.data.length == 0)
		return 0;

	if(this.packed_data)
		return;

	if(this.value_size == 0)
		return; //cannot be packed (bools and strings cannot be packed)

	var offset = this.value_size + 1;
	var data = this.data;
	var typed_data = new Float32Array( data.length * offset );

	for(var i = 0; i < data.length; ++i)
	{
		typed_data[i*offset] = data[i][0];
		if( this.value_size == 1 )
			typed_data[i*offset+1] = data[i][1];
		else
			typed_data.set( data[i][1], i*offset+1 );
	}

	this.data = typed_data;
	this.packed_data = true;
}

//better for writing
Track.prototype.unpackData = function()
{
	if(!this.data || this.data.length == 0)
		return 0;

	if(!this.packed_data)
		return;

	var offset = this.value_size + 1;
	var typed_data = this.data;
	var data = Array( typed_data.length / offset );

	for(var i = 0; i < typed_data.length; i += offset )
		data[i/offset] = [ typed_data[i], typed_data.subarray( i+1, i+offset ) ];

	this.data = data;
	this.packed_data = false;
}

/* not tested
Track.prototype.findSampleIndex = function(time)
{
	var data = this.data;
	var offset = this.value_size + 1;
	var l = data.length;
	var n = l / offset;
	var imin = 0;
	var imax = n;
	var imid = 0;

	//dichotimic search
	// continue searching while [imin,imax] is not empty
	while (imax >= imin)
	{
		// calculate the midpoint for roughly equal partition
		imid = (((imax - imin)*0.5)|0) + imin;
		var v = data[ imid * offset ];
		if( v == time )
			return imid * offset;
			// determine which subarray to search
		else if (v < key)
			// change min index to search upper subarray
			imin = imid + 1;
		else
			// change max index to search lower subarray
			imax = imid - 1;
	}

	return imid * offset;
}
*/

//TODO: IMPROVE WITH DICOTOMIC SEARCH
//Returns the index of the last sample with a time less or equal to time
Track.prototype.findTimeIndex = function( time )
{
	if(!this.data || this.data.length == 0)
		return -1;

	var data = this.data;
	var l = this.data.length;
	if(!l)
		return -1;
	var i = 0;
	if(this.packed_data)
	{
		var offset = this.value_size + 1;
		for(i = 0; i < l; i += offset)
		{
			var current_time = data[i];
			if(current_time < time)
				continue;
			return i-1; //prev sample
		}
	}
	else //unpacked data
	{
		for(i = 0; i < l; ++i )
		{
			if(time > data[i][0])
				continue;
			if(time == data[i][0])
				return i;
			if(i == 0)
				return 0;
			return i-1; //prev sample
		}
	}

	return l-1; //last sample
}

Track.prototype.getSample = function( time, interpolate, result )
{
	time = Math.clamp( time, 0, this.duration );

	var index = this.findTimeIndex( time );
	if(index == -1)
		return null;

	var index_a = index;
	var index_b = index + 1;
	var data = this.data;

	if(!interpolate || !this.interpolation || data.length == 1 || this.value_size == 0 || index_b == data.length || (index_a == 0 && this.data[0][0] > time)) //(index_b == this.data.length && !this.looped)
		return this.data[ index ][1];

	/*
	if(this.looped)
	{
		if(index_a == 0 && time < data[0][0])
			index_a = data.length - 1; //last
		if(index_b == data.length && time < data[0][0])
			index_b = 0; //last
	}
	*/

	var a = data[ index_a ];
	var b = data[ index_b ];

	var t = (b[0] - time) / (b[0] - a[0]);

	if(this.interpolation === LS.LINEAR)
	{
		if(this.value_size == 1)
			return a[1] * t + b[1] * (1-t);

		result = result || this._result;

		if(!result || result.length != this.value_size)
			result = this._result = new Float32Array( this.value_size );

		for(var i = 0; i < this.value_size; i++)
			result[i] = a[1][i] * t + b[1][i] * (1-t);

		if(this.type == "quat")
			quat.normalize(result, result);

		return result;
	}
	else if(this.interpolation === LS.BEZIER)
	{
		var pre_a = index > 0 ? data[ index - 1 ] : a;
		var post_b = index < data.length - 2 ? data[ index + 2 ] : b;

		if(this.value_size === 1)
			return Animation.EvaluateHermiteSpline(a[1],b[1],pre_a[1],post_b[1], 1 - t );

		result = result || this._result;

		//multiple data
		if(!result || result.length != this.value_size)
			result = this._result = new Float32Array( this.value_size );

		result = result || this._result;
		result = Animation.EvaluateHermiteSplineVector(a[1],b[1], pre_a[1], post_b[1], 1 - t, result );

		if(this.type == "quat")
			quat.normalize(result, result);

		return result;
	}

	return null;
}

Track.prototype.getPropertyInfo = function()
{
	return LS.GlobalScene.getPropertyInfo( this.property );
}

Track.prototype.getSampledData = function( start_time, end_time, num_samples )
{
	var delta = (end_time - start_time) / num_samples;
	if(delta <= 0)
		return null;

	var samples = [];
	for(var i = 0; i < num_samples; ++i)
	{
		var t = i * delta + start_time;
		var sample = this.getSample( t, true );
		if(this.value_size > 1)
			sample = new sample.constructor( sample );
		samples.push(sample);
	}

	return samples;
}

Animation.Track = Track;

/*
vec3f EvaluateHermiteSpline(const vec3f& p0, const vec3f& p1, const vec3f& t0, const vec3f& t1, float s)
{
	float s2 = s * s;
	float s3 = s2 * s;
	float h1 =  2*s3 - 3*s2 + 1;          // calculate basis function 1
	float h2 = -2*s3 + 3*s2;              // calculate basis function 2
	float h3 =   s3 - 2*s2 + s;         // calculate basis function 3
	float h4 =   s3 -  s2;              // calculate basis function 4
	vec3f p = h1*p0+                    // multiply and sum all funtions
						 h2*p1 +                    // together to build the interpolated
						 h3*t0 +                    // point along the curve.
						 h4*t1;
	return p;
}
*/

Animation.EvaluateHermiteSpline = function( p0, p1, pre_p0, post_p1, s )
{
	var s2 = s * s;
	var s3 = s2 * s;
	var h1 =  2*s3 - 3*s2 + 1;          // calculate basis function 1
	var h2 = -2*s3 + 3*s2;              // calculate basis function 2
	var h3 =   s3 - 2*s2 + s;         // calculate basis function 3
	var h4 =   s3 -  s2;              // calculate basis function 4

	var t0 = p1 - pre_p0;
	var t1 = post_p1 - p0;

	return h1 * p0 + h2 * p1 + h3 * t0 + h4 * t1;
}

Animation.EvaluateHermiteSplineVector = function( p0, p1, pre_p0, post_p1, s, result )
{
	result = result || new Float32Array( result.length );

	var s2 = s * s;
	var s3 = s2 * s;
	var h1 =  2*s3 - 3*s2 + 1;          // calculate basis function 1
	var h2 = -2*s3 + 3*s2;              // calculate basis function 2
	var h3 =   s3 - 2*s2 + s;         // calculate basis function 3
	var h4 =   s3 -  s2;              // calculate basis function 4

	for(var i = 0; i < result.length; ++i)
	{
		var t0 = p1[i] - pre_p0[i];
		var t1 = post_p1[i] - p0[i];
		result[i] = h1 * p0[i] + h2 * p1[i] + h3 * t0 + h4 * t1;
	}

	return result;
}