text:
#if !FEATURE_CORE_DLR
using dynamic = System.Object;
#endif

#if FEATURE_REMOTING
using System.Runtime.Remoting;
#else
using MarshalByRefObject = System.Object;
#endif

using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Diagnostics;
using System.Dynamic;
using System.Text;
using System.Threading;
using Microsoft.Scripting.Runtime;
using Microsoft.Scripting.Utils;

namespace Microsoft.Scripting.Hosting {

    /// <summary>
    /// Represents a language in Hosting API.
    /// Hosting API counterpart for <see cref="LanguageContext"/>.
    /// </summary>
    [DebuggerDisplay("{Setup.DisplayName}")]
    public sealed class ScriptEngine : MarshalByRefObject {
        private readonly LanguageContext _language;
        private readonly ScriptRuntime _runtime;
        private LanguageSetup _config;
        private ObjectOperations _operations;

        internal ScriptEngine(ScriptRuntime runtime, LanguageContext context) {
            Debug.Assert(runtime != null);
            Debug.Assert(context != null);

            _runtime = runtime;
            _language = context;
        }

        #region Object Operations

        /// <summary>
        /// Returns a default ObjectOperations for the engine.
        ///
        /// Because an ObjectOperations object caches rules for the types of
        /// objects and operations it processes, using the default ObjectOperations for
        /// many objects could degrade the caching benefits.  Eventually the cache for
        /// some operations could degrade to a point where ObjectOperations stops caching and
        /// does a full search for an implementation of the requested operation for the given objects.
        ///
        /// Another reason to create a new ObjectOperations instance is to have it bound
        /// to the specific view of a ScriptScope.  Languages may attach per-language
        /// behavior to a ScriptScope which would alter how the operations are performed.
        ///
        /// For simple hosting situations, this is sufficient behavior.
        ///
        ///
        /// </summary>
        public ObjectOperations Operations {
            get {
                if (_operations == null) {
                    Interlocked.CompareExchange(ref _operations, CreateOperations(), null);
                }

                return _operations;
            }
        }

        /// <summary>
        /// Returns a new ObjectOperations object.  See the Operations property for why you might want to call this.
        /// </summary>
        public ObjectOperations CreateOperations() {
            return new ObjectOperations(new DynamicOperations(_language), this);
        }

        /// <summary>
        /// Returns a new ObjectOperations object that inherits any semantics particular to the provided ScriptScope.
        ///
        /// See the Operations property for why you might want to call this.
        /// </summary>
        public ObjectOperations CreateOperations(ScriptScope scope) {
            ContractUtils.RequiresNotNull(scope, "scope");

            return new ObjectOperations(_language.Operations, this);
        }

        #endregion

        #region Code Execution (for convenience)

        /// <summary>
        /// Executes an expression. The execution is not bound to any particular scope.
        /// </summary>
        /// <exception cref="NotSupportedException">The engine doesn't support code execution.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="expression"/> is a <c>null</c> reference.</exception>
        public dynamic Execute(string expression) {
            // The host doesn't need the scope so do not create it here.
            // The language can treat the code as not bound to a DLR scope and change global lookup semantics accordingly.
            return CreateScriptSourceFromString(expression).Execute();
        }

        /// <summary>
        /// Executes an expression within the specified scope.
        /// </summary>
        /// <exception cref="NotSupportedException">The engine doesn't support code execution.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="expression"/> is a <c>null</c> reference.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="scope"/> is a <c>null</c> reference.</exception>
        public dynamic Execute(string expression, ScriptScope scope) {
            return CreateScriptSourceFromString(expression).Execute(scope);
        }

        /// <summary>
        /// Executes an expression within a new scope and converts result to the given type.
        /// </summary>
        /// <exception cref="NotSupportedException">The engine doesn't support code execution.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="expression"/> is a <c>null</c> reference.</exception>
        public T Execute<T>(string expression) {
            return Operations.ConvertTo<T>((object)Execute(expression));
        }

        /// <summary>
        /// Executes an expression within the specified scope and converts result to the given type.
        /// </summary>
        /// <exception cref="NotSupportedException">The engine doesn't support code execution.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="expression"/> is a <c>null</c> reference.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="scope"/> is a <c>null</c> reference.</exception>
        public T Execute<T>(string expression, ScriptScope scope) {
            return Operations.ConvertTo<T>((object)Execute(expression, scope));
        }

        /// <summary>
        /// Executes content of the specified file in a new scope and returns that scope.
        /// </summary>
        /// <exception cref="NotSupportedException">The engine doesn't support code execution.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="path"/> is a <c>null</c> reference.</exception>
        public ScriptScope ExecuteFile(string path) {
            return ExecuteFile(path, CreateScope());
        }

        /// <summary>
        /// Executes content of the specified file against the given scope.
        /// </summary>
        /// <returns>The <paramref name="scope"/>.</returns>
        /// <exception cref="NotSupportedException">The engine doesn't support code execution.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="path"/> is a <c>null</c> reference.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="scope"/> is a <c>null</c> reference.</exception>
        public ScriptScope ExecuteFile(string path, ScriptScope scope) {
            CreateScriptSourceFromFile(path).Execute(scope);
            return scope;
        }

#if FEATURE_REMOTING
        /// <summary>
        /// Executes the expression in the specified scope and return a result.
        /// Returns an ObjectHandle wrapping the resulting value of running the code.
        /// </summary>
        public ObjectHandle ExecuteAndWrap(string expression, ScriptScope scope) {
            return new ObjectHandle((object)Execute(expression, scope));
        }

        /// <summary>
        /// Executes the code in an empty scope.
        /// Returns an ObjectHandle wrapping the resulting value of running the code.
        /// </summary>
        public ObjectHandle ExecuteAndWrap(string expression) {
            return new ObjectHandle((object)Execute(expression));
        }

        /// <summary>
        /// Executes the expression in the specified scope and return a result.
        /// Returns an ObjectHandle wrapping the resulting value of running the code.
        ///
        /// If an exception is thrown the exception is caught and an ObjectHandle to
        /// the exception is provided.
        /// </summary>
        /// <remarks>
        /// Use this API in case the exception is not serializable (for example, due to security restrictions) or its serialization
        /// loses information that you need to access.
        /// </remarks>
        [Obsolete("Use ScriptSource.ExecuteAndWrap instead")]
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
        public ObjectHandle ExecuteAndWrap(string expression, ScriptScope scope, out ObjectHandle exception) {
            exception = null;
            try {
                return new ObjectHandle((object)Execute(expression, scope));
            } catch (Exception e) {
                exception = new ObjectHandle(e);
                return null;
            }
        }

        /// <summary>
        /// Executes the code in an empty scope.
        /// Returns an ObjectHandle wrapping the resulting value of running the code.
        ///
        /// If an exception is thrown the exception is caught and an ObjectHandle to
        /// the exception is provided.
        /// </summary>
        /// <remarks>
        /// Use this API in case the exception is not serializable (for example, due to security restrictions) or its serialization
        /// loses information that you need to access.
        /// </remarks>
        [Obsolete("Use ScriptSource.ExecuteAndWrap instead")]
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
        public ObjectHandle ExecuteAndWrap(string expression, out ObjectHandle exception) {
            exception = null;
            try {
                return new ObjectHandle((object)Execute(expression));
            } catch (Exception e) {
                exception = new ObjectHandle(e);
                return null;
            }
        }
#endif

        #endregion

        #region Scopes

        /// <summary>
        /// Creates a new ScriptScope using the default storage container
        /// </summary>
        public ScriptScope CreateScope() {
            return new ScriptScope(this, _language.CreateScope());
        }

        /// <summary>
        /// Creates a new ScriptScope whose storage contains the provided dictionary of objects
        ///
        /// Accesses to the ScriptScope will turn into get,set, and delete members against this dictionary
        /// </summary>
        public ScriptScope CreateScope(IDictionary<string, object> dictionary)
        {
            ContractUtils.RequiresNotNull(dictionary, "dictionary");
            return new ScriptScope(this, _language.CreateScope(dictionary));
        }

        /// <summary>
        /// Creates a new ScriptScope whose storage is an arbitrary object.
        ///
        /// Accesses to the ScriptScope will turn into get, set, and delete members against the object.
        /// </summary>
        public ScriptScope CreateScope(IDynamicMetaObjectProvider storage) {
            ContractUtils.RequiresNotNull(storage, "storage");

            return new ScriptScope(this, _language.CreateScope(storage));
        }

        /// <summary>
        /// This method returns the ScriptScope in which a ScriptSource of given path was executed.
        ///
        /// The ScriptSource.Path property is the key to finding the ScriptScope.  Hosts need
        /// to make sure they create a ScriptSource and set its Path property appropriately.
        ///
        /// GetScope is primarily useful for tools that need to map files to their execution scopes. For example,
        /// an editor and interpreter tool might run a file Foo that imports or requires a file Bar.
        ///
        /// The editor's user might later open the file Bar and want to execute expressions in its context.
        /// The tool would need to find Bar's ScriptScope for setting the appropriate context in its interpreter window.
        /// This method helps with this scenario.
        /// </summary>
        public ScriptScope GetScope(string path) {
            ContractUtils.RequiresNotNull(path, "path");
            Scope scope = _language.GetScope(path);
            return (scope != null) ? new ScriptScope(this, scope) : null;
        }

        #endregion

        #region Source Unit Creation

        /// <summary>
        /// Return a ScriptSource object from string contents with the current engine as the language binding.
        ///
        /// The default SourceCodeKind is AutoDetect.
        ///
        /// The ScriptSource's Path property defaults to <c>null</c>.
        /// </summary>
        public ScriptSource CreateScriptSourceFromString(string expression) {
            ContractUtils.RequiresNotNull(expression, "expression");

            return CreateScriptSource(new SourceStringContentProvider(expression), null, SourceCodeKind.AutoDetect);
        }

        /// <summary>
        /// Return a ScriptSource object from string contents with the current engine as the language binding.
        ///
        /// The ScriptSource's Path property defaults to <c>null</c>.
        /// </summary>
        public ScriptSource CreateScriptSourceFromString(string code, SourceCodeKind kind) {
            ContractUtils.RequiresNotNull(code, "code");
            ContractUtils.Requires(kind.IsValid(), "kind");

            return CreateScriptSource(new SourceStringContentProvider(code), null, kind);
        }

        /// <summary>
        /// Return a ScriptSource object from string contents with the current engine as the language binding.
        ///
        /// The default SourceCodeKind is AutoDetect.
        /// </summary>
        public ScriptSource CreateScriptSourceFromString(string expression, string path) {
            ContractUtils.RequiresNotNull(expression, "expression");

            return CreateScriptSource(new SourceStringContentProvider(expression), path, SourceCodeKind.AutoDetect);
        }

        /// <summary>
        /// Return a ScriptSource object from string contents.  These are helpers for creating ScriptSources' with the right language binding.
        /// </summary>
        public ScriptSource CreateScriptSourceFromString(string code, string path, SourceCodeKind kind) {
            ContractUtils.RequiresNotNull(code, "code");
            ContractUtils.Requires(kind.IsValid(), "kind");

            return CreateScriptSource(new SourceStringContentProvider(code), path, kind);
        }

        /// <summary>
        /// Return a ScriptSource object from file contents with the current engine as the language binding.
        ///
        /// The path's extension does NOT have to be in ScriptRuntime.GetRegisteredFileExtensions
        /// or map to this language engine with ScriptRuntime.GetEngineByFileExtension.
        ///
        /// The default SourceCodeKind is File.
        ///
        /// The ScriptSource's Path property will be the path argument.
        ///
        /// The encoding defaults to System.Text.Encoding.Default.
        /// </summary>
        public ScriptSource CreateScriptSourceFromFile(string path) {
            return CreateScriptSourceFromFile(path, StringUtils.DefaultEncoding, SourceCodeKind.File);
        }

        /// <summary>
        /// Return a ScriptSource object from file contents with the current engine as the language binding.
        ///
        /// The path's extension does NOT have to be in ScriptRuntime.GetRegisteredFileExtensions
        /// or map to this language engine with ScriptRuntime.GetEngineByFileExtension.
        ///
        /// The default SourceCodeKind is File.
        ///
        /// The ScriptSource's Path property will be the path argument.
        /// </summary>
        public ScriptSource CreateScriptSourceFromFile(string path, Encoding encoding) {
            return CreateScriptSourceFromFile(path, encoding, SourceCodeKind.File);
        }

        /// <summary>
        /// Return a ScriptSource object from file contents with the current engine as the language binding.
        ///
        /// The path's extension does NOT have to be in ScriptRuntime.GetRegisteredFileExtensions
        /// or map to this language engine with ScriptRuntime.GetEngineByFileExtension.
        ///
        /// The ScriptSource's Path property will be the path argument.
        /// </summary>
        public ScriptSource CreateScriptSourceFromFile(string path, Encoding encoding, SourceCodeKind kind) {
            ContractUtils.RequiresNotNull(path, "path");
            ContractUtils.RequiresNotNull(encoding, "encoding");
            ContractUtils.Requires(kind.IsValid(), "kind");
            if (!_language.CanCreateSourceCode) throw new NotSupportedException("Invariant engine cannot create scripts");

            return new ScriptSource(this, _language.CreateFileUnit(path, encoding, kind));
        }

#if FEATURE_CODEDOM
        /// <summary>
        /// This method returns a ScriptSource object from a System.CodeDom.CodeObject.
        /// This is a factory method for creating a ScriptSources with this language binding.
        ///
        /// The expected CodeDom support is extremely minimal for syntax-independent expression of semantics.
        ///
        /// Languages may do more, but hosts should only expect CodeMemberMethod support,
        /// and only sub nodes consisting of the following:
        ///     CodeSnippetStatement
        ///     CodeSnippetExpression
        ///     CodePrimitiveExpression
        ///     CodeMethodInvokeExpression
        ///     CodeExpressionStatement (for holding MethodInvoke)
        /// </summary>
        public ScriptSource CreateScriptSource(CodeObject content) {
            return CreateScriptSource(content, null, SourceCodeKind.File);
        }

        /// <summary>
        /// This method returns a ScriptSource object from a System.CodeDom.CodeObject.
        /// This is a factory method for creating a ScriptSources with this language binding.
        ///
        /// The expected CodeDom support is extremely minimal for syntax-independent expression of semantics.
        ///
        /// Languages may do more, but hosts should only expect CodeMemberMethod support,
        /// and only sub nodes consisting of the following:
        ///     CodeSnippetStatement
        ///     CodeSnippetExpression
        ///     CodePrimitiveExpression
        ///     CodeMethodInvokeExpression
        ///     CodeExpressionStatement (for holding MethodInvoke)
        /// </summary>
        public ScriptSource CreateScriptSource(CodeObject content, string path) {
            return CreateScriptSource(content, path, SourceCodeKind.File);
        }

        /// <summary>
        /// This method returns a ScriptSource object from a System.CodeDom.CodeObject.
        /// This is a factory method for creating a ScriptSources with this language binding.
        ///
        /// The expected CodeDom support is extremely minimal for syntax-independent expression of semantics.
        ///
        /// Languages may do more, but hosts should only expect CodeMemberMethod support,
        /// and only sub nodes consisting of the following:
        ///     CodeSnippetStatement
        ///     CodeSnippetExpression
        ///     CodePrimitiveExpression
        ///     CodeMethodInvokeExpression
        ///     CodeExpressionStatement (for holding MethodInvoke)
        /// </summary>
        public ScriptSource CreateScriptSource(CodeObject content, SourceCodeKind kind) {
            return CreateScriptSource(content, null, kind);
        }

        /// <summary>
        /// This method returns a ScriptSource object from a System.CodeDom.CodeObject.
        /// This is a factory method for creating a ScriptSources with this language binding.
        ///
        /// The expected CodeDom support is extremely minimal for syntax-independent expression of semantics.
        ///
        /// Languages may do more, but hosts should only expect CodeMemberMethod support,
        /// and only sub nodes consisting of the following:
        ///     CodeSnippetStatement
        ///     CodeSnippetExpression
        ///     CodePrimitiveExpression
        ///     CodeMethodInvokeExpression
        ///     CodeExpressionStatement (for holding MethodInvoke)
        /// </summary>
        public ScriptSource CreateScriptSource(CodeObject content, string path, SourceCodeKind kind) {
            ContractUtils.RequiresNotNull(content, "content");
            if (!_language.CanCreateSourceCode) throw new NotSupportedException("Invariant engine cannot create scripts");

            return new ScriptSource(this, _language.GenerateSourceCode(content, path, kind));
        }
#endif

        /// <summary>
        /// These methods return ScriptSource objects from stream contents with the current engine as the language binding.
        ///
        /// The default SourceCodeKind is File.
        ///
        /// The encoding defaults to Encoding.Default.
        /// </summary>
        public ScriptSource CreateScriptSource(StreamContentProvider content, string path) {
            ContractUtils.RequiresNotNull(content, "content");

            return CreateScriptSource(content, path, StringUtils.DefaultEncoding, SourceCodeKind.File);
        }

        /// <summary>
        /// These methods return ScriptSource objects from stream contents with the current engine as the language binding.
        ///
        /// The default SourceCodeKind is File.
        /// </summary>
        public ScriptSource CreateScriptSource(StreamContentProvider content, string path, Encoding encoding) {
            ContractUtils.RequiresNotNull(content, "content");
            ContractUtils.RequiresNotNull(encoding, "encoding");

            return CreateScriptSource(content, path, encoding, SourceCodeKind.File);
        }

        /// <summary>
        /// These methods return ScriptSource objects from stream contents with the current engine as the language binding.
        ///
        /// The encoding defaults to Encoding.Default.
        /// </summary>
        public ScriptSource CreateScriptSource(StreamContentProvider content, string path, Encoding encoding, SourceCodeKind kind) {
            ContractUtils.RequiresNotNull(content, "content");
            ContractUtils.RequiresNotNull(encoding, "encoding");
            ContractUtils.Requires(kind.IsValid(), "kind");

            return CreateScriptSource(new LanguageBoundTextContentProvider(_language, content, encoding, path), path, kind);
        }

        /// <summary>
        /// This method returns a ScriptSource with the content provider supplied with the current engine as the language binding.
        ///
        /// This helper lets you own the content provider so that you can implement a stream over internal host data structures, such as an editor's text representation.
        /// </summary>
        public ScriptSource CreateScriptSource(TextContentProvider contentProvider, string path, SourceCodeKind kind) {
            ContractUtils.RequiresNotNull(contentProvider, "contentProvider");
            ContractUtils.Requires(kind.IsValid(), "kind");
            if (!_language.CanCreateSourceCode) throw new NotSupportedException("Invariant engine cannot create scripts");

            return new ScriptSource(this, _language.CreateSourceUnit(contentProvider, path, kind));
        }

        #endregion

        #region Additional Services

        /// <summary>
        /// This method returns a language-specific service.
        ///
        /// It provides a point of extensibility for a language implementation
        /// to offer more functionality than the standard engine members discussed here.
        ///
        /// Commonly available services include:
        ///     TokenCategorizer
        ///         Provides standardized tokenization of source code
        ///     ExceptionOperations
        ///         Provides formatting of exception objects.
        ///     DocumentationProvidera
        ///         Provides documentation for live object.
        /// </summary>
        public TService GetService<TService>(params object[] args) where TService : class {
            if (typeof(TService) == typeof(TokenCategorizer)) {
                TokenizerService service = _language.GetService<TokenizerService>(ArrayUtils.Insert((object)_language, args));
                return (service != null) ? (TService)(object)new TokenCategorizer(service) : null;
            } else if (typeof(TService) == typeof(ExceptionOperations)) {
                ExceptionOperations service = _language.GetService<ExceptionOperations>();
                return (service != null) ? (TService)(object)service : (TService)(object)new ExceptionOperations(_language);
            } else if (typeof(TService) == typeof(DocumentationOperations)) {
                DocumentationProvider service = _language.GetService<DocumentationProvider>(args);
                return (service != null) ? (TService)(object)new DocumentationOperations(service) : null;
            }
            return _language.GetService<TService>(args);
        }

        #endregion

        #region Misc. engine information

        /// <summary>
        /// This property returns readon-only LanguageOptions this engine is using.
        /// </summary>
        /// <remarks>
        /// The values are determined during runtime initialization and read-only afterwards.
        /// You can change the settings via a configuration file or explicitly using ScriptRuntimeSetup class.
        /// </remarks>
        public LanguageSetup Setup {
            get {
                if (_config == null) {
                    // The user shouldn't be able to get a hold of the invariant engine
                    Debug.Assert(!(_language is InvariantContext));

                    // Find the matching language configuration
                    LanguageConfiguration config = _runtime.Manager.Configuration.GetLanguageConfig(_language);
                    Debug.Assert(config != null);

                    foreach (var language in _runtime.Setup.LanguageSetups) {
                        if (config.ProviderName == new AssemblyQualifiedTypeName(language.TypeName)) {
                            return _config = language;
                        }
                    }
                }
                return _config;
            }
        }

        /// <summary>
        /// This property returns the ScriptRuntime for the context in which this engine executes.
        /// </summary>
        public ScriptRuntime Runtime {
            get {
                return _runtime;
            }
        }

        /// <summary>
        /// This property returns the engine's version as a string.  The format is language-dependent.
        /// </summary>
        public Version LanguageVersion {
            get {
                return _language.LanguageVersion;
            }
        }

        #endregion

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
        public CompilerOptions GetCompilerOptions() {
            return _language.GetCompilerOptions();
        }

        public CompilerOptions GetCompilerOptions(ScriptScope scope) {
            return _language.GetCompilerOptions(scope.Scope);
        }

        /// <summary>
        /// Sets the search paths used by the engine for loading files when a script wants
        /// to import or require another file of code.
        /// </summary>
        /// <exception cref="NotSupportedException">The language doesn't allow to set search paths.</exception>
        public void SetSearchPaths(ICollection<string> paths) {
            ContractUtils.RequiresNotNull(paths, "paths");
            ContractUtils.RequiresNotNullItems(paths, "paths");

            _language.SetSearchPaths(paths);
        }

        /// <summary>
        /// Gets the search paths used by the engine for loading files when a script wants
        /// to import or require another file of code.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
        public ICollection<string> GetSearchPaths() {
            return _language.GetSearchPaths();
        }

        #region Internal API Surface

        internal LanguageContext LanguageContext {
            get {
                return _language;
            }
        }

        internal TRet Call<T, TRet>(Func<LanguageContext, T, TRet> f, T arg) {
            return f(_language, arg);
        }

        #endregion

        #region Remote API

#if FEATURE_REMOTING
        // TODO: Figure out what is the right lifetime
        public override object InitializeLifetimeService() {
            return null;
        }
#endif

        #endregion
    }
}


text:
from candidate_selection.tensorflow_models.components.abstract_component import AbstractComponent
import tensorflow as tf

class GCN(AbstractComponent):

    propagation_units = []
    update_units = []

    def __init__(self, settings):
        self.propagation_units = []
        self.entity_update_units = []

        self.layer_reuse = settings["layer_reuse"]

    def add_layer(self, propagation_unit, update_unit):
        self.propagation_units.append(propagation_unit)
        self.update_units.append(update_unit)

    def get_regularization_term(self):
        reg = tf.reduce_sum([p.get_regularization_term() for p in self.propagation_units])
        reg += tf.reduce_sum([u.get_regularization_term() for u in self.update_units])

        return reg

    def set_gate_key(self, key):
        for p in self.propagation_units:
            p.set_gate_key(key)

    def get_edge_gates(self):
        return [p.get_edge_gates() for p in self.propagation_units]

    def prepare_tensorflow_variables(self, mode="train"):
        for p in self.propagation_units:
            p.prepare_tensorflow_variables(mode=mode)

        for u in self.update_units:
            u.prepare_tensorflow_variables(mode=mode)

    def propagate(self):
        for propagation, update in zip(self.propagation_units, self.update_units):
            if propagation.in_dimension != propagation.out_dimension:
                reuse = 1
            else:
                reuse = self.layer_reuse

            for i in range(reuse):
                entity_context, event_context = propagation.propagate()
                update.update(entity_context, event_context)

redpajama_set_name: RedPajamaGithub


text:
@interface LAJsonTestObject : LAJsonObject

@property (nonatomic,copy) NSString *aString;

@JsonMap("aMapString")
@property (nonatomic,copy) NSString *mapProperty;

@JsonIgnore
@property (nonatomic,copy) NSString *ignore;

@property (nonatomic,strong) NSDate *aDate;

@JsonFormat("LADate")
@JsonMap("aDate2")
@property (nonatomic,strong) NSDate *aDateTow;

@JsonTypeReference("GithubRepo")
@property (nonatomic,strong) NSArray *repos;

@property (nonatomic,assign) NSInteger aInteger;

@end


text:
sbapp.controller('ServiceAddController', [
  '$scope',
  '$state',
  'ToolService',
  'ProjectService',
  ServiceAddController
]);

function ServiceAddController($scope, $state, ToolService, ProjectService) {
  var vm = this;

  /* CALLABLE MEMBERS */

  vm.addService = addService;
  vm.tools = [];
  vm.back = back;
  vm.next = next;
  vm.selectTool = selectTool;
  vm.service = {
    platform: null,
    token: null
  };

  //Used for page back/next and div displays on addATool.html
  vm.currentPage = 1;
  vm.pageCount = 0;

  vm.submitted = false;

  /* ACTIONS */

  // Populate vm.tools
  ToolService.loadTools().then(function (tools) {
    vm.tools = tools;
  });

  /* FUNCTIONS */

  function back() {
    vm.currentPage--;
  }

  function next() {
    vm.currentPage++;
  }

  function selectTool(tool) {
    vm.service.platform = tool.name;
    next();
  }

  function addService(newService) {
    vm.submitted = true;
    if ($scope.currentUser == null) {
      console.log('addService(): null user. Aborting.');
    } else {
      // console.log(newService);
      ProjectService.service.save(newService,
        //success callback
        function (service) {
          vm.submitted = false;
          console.log('addService() success:', service);
          var currState = $state.current;
          $scope.goBack().then(function () {
            if ($state.current == currState) $state.go('home.services');
          });

        },
        //error callback
        function (err) {
          vm.submitted = false;
          console.log('addService() error:', err);
          //TODO add error handling feedback
        }
      );
    }
  }

}


text:
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ("attribute", "0013_auto_20210609_2245"),
    ]

    operations = [
        migrations.AddField(
            model_name="attributevalue",
            name="date_time",
            field=models.DateTimeField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name="attribute",
            name="input_type",
            field=models.CharField(
                choices=[
                    ("dropdown", "Dropdown"),
                    ("multiselect", "Multi Select"),
                    ("file", "File"),
                    ("reference", "Reference"),
                    ("numeric", "Numeric"),
                    ("rich-text", "Rich Text"),
                    ("boolean", "Boolean"),
                    ("date", "Date"),
                    ("date-time", "Date Time"),
                ],
                default="dropdown",
                max_length=50,
            ),
        ),
    ]


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.03.14 at 10:42:33 PM PDT
//

package org.yeastrc.ms.writer.mzml.jaxb;

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

/**
 * The method of product ion selection and activation in a precursor ion scan
 *
 *
Java class for ProductType complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="ProductType">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="isolationWindow" type="{http://psi.hupo.org/ms/mzml}ParamGroupType" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ProductType", propOrder = {
    "isolationWindow"
})
public class ProductType {

    protected ParamGroupType isolationWindow;

    /**
     * Gets the value of the isolationWindow property.
     *
     * @return
     *     possible object is
     *     {@link ParamGroupType }
     *
     */
    public ParamGroupType getIsolationWindow() {
        return isolationWindow;
    }

    /**
     * Sets the value of the isolationWindow property.
     *
     * @param value
     *     allowed object is
     *     {@link ParamGroupType }
     *
     */
    public void setIsolationWindow(ParamGroupType value) {
        this.isolationWindow = value;
    }

}


text:
Rickshaw
===============

.. raw:: html

    ~ A Stochastic Driver for Cyclus ~

Rickshaw is a Python-powered stochastic driver for Cyclus. Rickshaw will create randomly-generated,
fully-valid Cyclus input files. Rickshaw works by,

* Selecting a random fuel cycle structure by picking niches,
* Selecting random archetypes to represent those niches,
* Configure the archetypes by randomly selecting values for each state variable.

Rickshaw can run on the command line to generate JSON input files or operate in a server mode
that also runs Cyclus on the generated files. Rickshaw can interface with a variety of scheduluers,
including Docker (for a node) and Docker Swarm (for the full cluster).

=========
Contents
=========

.. toctree::
    :titlesonly:
    :maxdepth: 1

    api/index
    gettingstarted

.. .. include:: dependencies.rst

============
Contributing
============
We highly encourage contributions to rickshaw!  If you would like to contribute,
it is as easy as forking the repository on GitHub, making your changes, and
issuing a pull request.

==========
Contact Us
==========
If you have questions or comments, please contact the authors directly or
open an issue on GitHub.

=============
Helpful Links
=============

* `Documentation <http://www.ergs.sc.edu/rickshaw-docs>`_
* `GitHub Repository <https://github.com/ergs/rickshaw>`_
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

.. raw:: html

    Fork me on GitHub


text:
txt-flowchart

swimlanes (horizontal or vertical)
auto layout
js live creation
live viewer
  - display by swimlane (h or v)
  - display optimize based on what's in play
  - scroll or page
text repr (json? yaml? dsl?)


text:
#include "Internal.hpp"
#include "Core/CoreAudioNode.hpp"
#include <LuminoEngine/Audio/AudioDestinationNode.hpp>

namespace ln {

//==============================================================================
// AudioDestinationNode

AudioDestinationNode::AudioDestinationNode()
{
}

void AudioDestinationNode::init(detail::CoreAudioDestinationNode* core)
{
	AudioNode::init();
	m_coreObject = core;
}

detail::AudioNodeCore* AudioDestinationNode::coreNode()
{
	return m_coreObject;
}

} // namespace ln


text:
import * as openfl from "openfl";
import * as geom from "openfl/geom";
import { Rectangle as Rectangle2 } from "openfl/geom";
import Rectangle from "openfl/geom/Rectangle";
import * as assert from "assert";

describe ("ES6 | Imports", function () {

	it ("test", function () {

		// console.log (openfl);
		// console.log (geom);
		// console.log (Rectangle);

		assert (Rectangle);
		assert.equal (openfl.geom.Rectangle, Rectangle);
		assert.equal (geom.Rectangle, Rectangle);
		assert.equal (Rectangle2, Rectangle);

	});

});


text:
                        <ng-map style="width: 100%; height: 500px" center="[16.0597005, 108.2094652]"></ng-map>

                    <form class="job_filters">

                                Từ khóa
                                <input type="text" name="search_keywords" id="search_keywords"
                                       placeholder="Từ khóa" value=""/>

                                Vị trí
                                <input type="text" name="search_location" id="search_location"
                                       placeholder="Vị trí" value=""/>

                                Category
                                <select name='search_categories[]' id='search_categories'
                                        class='job-manager-category-dropdown '
                                        data-placeholder='Choose a category…'
                                        data-no_results_text='No results match'
                                        data-multiple_text='Select Some Options'>
                                    <option value="">Tất Cả Danh Mục</option>
                                    <option class="level-0" value="7">Cà Phê</option>
                                    <option class="level-0" value="8">Nhà Hàng</option>
                                </select>

                                <input type="submit" name="submit" value="TÌM KIẾM"/>

                            <input type="hidden" name="search_region" class="search_region" value=""/>

<input type="checkbox"
                                                                                name="filter_job_type[]"
                                                                                value="freelance"
                                                                                checked='checked'
                                                                                id="job_type_freelance"/>
                                Freelance

<input type="checkbox"
                                                                                name="filter_job_type[]"
                                                                                value="full-time"
                                                                                checked='checked'
                                                                                id="job_type_full-time"/>
                                Full Time

<input type="checkbox"
                                                                                name="filter_job_type[]"
                                                                                value="internship"
                                                                                checked='checked'
                                                                                id="job_type_internship"/>
                                Internship

<input type="checkbox"
                                                                                name="filter_job_type[]"
                                                                                value="part-time"
                                                                                checked='checked'
                                                                                id="job_type_part-time"/>
                                Part Time

<input type="checkbox"
                                                                                name="filter_job_type[]"
                                                                                value="temporary"
                                                                                checked='checked'
                                                                                id="job_type_temporary"/>
                                Temporary

                        <input type="hidden" name="filter_job_type[]" value=""/>

                    </form>

                    Load more listings

{{job.name}}

                                            {{job.district}}

                                                {{job.type === 'ft'?'Toàn thời gian':'Bán thời gian'}}


text:
function pigIt(str){
    return str.split(' ').map(function(word){
        return word.substring(1,word.length)+word[0]+"ay";
    }).join(' ');
}


text:
package org.hisp.dhis.dataanalysis;

import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.hisp.quick.BatchHandler;
import org.hisp.quick.BatchHandlerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.common.ValueType;
import org.hisp.dhis.commons.filter.Filter;
import org.hisp.dhis.commons.filter.FilterUtils;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.datavalue.DeflatedDataValue;
import org.hisp.dhis.jdbc.batchhandler.MinMaxDataElementBatchHandler;
import org.hisp.dhis.minmax.MinMaxDataElement;
import org.hisp.dhis.minmax.MinMaxDataElementService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.system.filter.DataElementValueTypesFilter;
import org.hisp.dhis.system.util.MathUtils;
import org.joda.time.DateTime;

/**
 * @author Lars Helge Overland
 */
public class MinMaxOutlierAnalysisService
    implements MinMaxDataAnalysisService
{
    private static final Log log = LogFactory.getLog( MinMaxOutlierAnalysisService.class );

    private static final Filter<DataElement> DE_NUMERIC_FILTER = new DataElementValueTypesFilter( ValueType.NUMERIC_TYPES );

    // -------------------------------------------------------------------------
    // Dependencies
    // -------------------------------------------------------------------------

    private DataAnalysisStore dataAnalysisStore;

    public void setDataAnalysisStore( DataAnalysisStore dataAnalysisStore )
    {
        this.dataAnalysisStore = dataAnalysisStore;
    }

    private MinMaxDataElementService minMaxDataElementService;

    public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
    {
        this.minMaxDataElementService = minMaxDataElementService;
    }

    private BatchHandlerFactory batchHandlerFactory;

    public void setBatchHandlerFactory( BatchHandlerFactory batchHandlerFactory )
    {
        this.batchHandlerFactory = batchHandlerFactory;
    }

    // -------------------------------------------------------------------------
    // DataAnalysisService implementation
    // -------------------------------------------------------------------------

    @Override
    public List<DeflatedDataValue> analyse( Collection<OrganisationUnit> parents,
        Collection<DataElement> dataElements, Collection<Period> periods, Double stdDevFactor, Date from )
    {
        Set<DataElement> elements = new HashSet<>( dataElements );

        FilterUtils.filter( elements, DE_NUMERIC_FILTER );

        Set<DataElementCategoryOptionCombo> categoryOptionCombos = new HashSet<>();

        for ( DataElement dataElement : elements )
        {
            categoryOptionCombos.addAll( dataElement.getCategoryOptionCombos() );
        }

        log.debug( "Starting min-max analysis, no of data elements: " + elements.size() + ", no of parent org units: " + parents.size() );

        return dataAnalysisStore.getMinMaxViolations( elements, categoryOptionCombos, periods, parents, MAX_OUTLIERS );
    }

    @Override
    public void generateMinMaxValues( Collection<OrganisationUnit> parents,
        Collection<DataElement> dataElements, Double stdDevFactor )
    {
        log.info( "Starting min-max value generation, no of data elements: " + dataElements.size() + ", no of org units: " + parents.size() );

        //Set<Integer> orgUnitIds = new HashSet<>( IdentifiableObjectUtils.getIdentifiers( organisationUnits ) );

        Date from = new DateTime( 1, 1, 1, 1, 1 ).toDate();

        minMaxDataElementService.removeMinMaxDataElements( dataElements, parents );

        log.debug( "Deleted existing min-max values" );

        BatchHandler<MinMaxDataElement> batchHandler = batchHandlerFactory.createBatchHandler( MinMaxDataElementBatchHandler.class ).init();

        for ( DataElement dataElement : dataElements )
        {
            ValueType valueType = dataElement.getValueType();

            if ( valueType.isNumeric() )
            {
                Collection<DataElementCategoryOptionCombo> categoryOptionCombos = dataElement.getCategoryOptionCombos();

                for ( DataElementCategoryOptionCombo categoryOptionCombo : categoryOptionCombos )
                {
                    Map<Integer, Double> standardDeviations = dataAnalysisStore.getStandardDeviation( dataElement, categoryOptionCombo, parents, from );

                    Map<Integer, Double> averages = dataAnalysisStore.getAverage( dataElement, categoryOptionCombo, parents, from );

                    for ( Integer unit : averages.keySet() )
                    {
                        Double stdDev = standardDeviations.get( unit );
                        Double avg = averages.get( unit );

                        if ( stdDev != null && avg != null )
                        {
                            int min = (int) MathUtils.getLowBound( stdDev, stdDevFactor, avg );
                            int max = (int) MathUtils.getHighBound( stdDev, stdDevFactor, avg );

                            if ( ValueType.INTEGER_POSITIVE == valueType || ValueType.INTEGER_ZERO_OR_POSITIVE == valueType )
                            {
                                min = Math.max( 0, min ); // Cannot be < 0
                            }

                            if ( ValueType.INTEGER_NEGATIVE == valueType )
                            {
                                max = Math.min( 0, max ); // Cannot be > 0
                            }

                            OrganisationUnit source = new OrganisationUnit();
                            source.setId( unit );

                            batchHandler.addObject( new MinMaxDataElement( source, dataElement, categoryOptionCombo, min, max, true ) );
                        }
                    }
                }
            }
        }

        log.info( "Min-max value generation done" );

        batchHandler.flush();
    }
}


text:
namespace domain_reliability {

// Attempts to convert a net error and an HTTP response code into the status
// string that should be recorded in a beacon. Returns true if it could.
//
// N.B.: This functions as the whitelist of "safe" errors to report; network-
//       local errors are purposefully not converted to avoid revealing
//       information about the local network to the remote server.
bool GetDomainReliabilityBeaconStatus(
    int net_error,
    int http_response_code,
    std::string* beacon_status_out);

std::string GetDomainReliabilityProtocol(
    net::HttpResponseInfo::ConnectionInfo connection_info,
    bool ssl_info_populated);

// Converts a URLRequestStatus into a network error. Returns the error code for
// FAILED; maps SUCCESS and CANCELED to OK and ERR_ABORTED, respectively; and
// returns ERR_ABORTED for any other status.
int GetNetErrorFromURLRequestStatus(const net::URLRequestStatus& status);

// Based on the network error code, HTTP response code, and Retry-After value,
// fills |status| with the result of a report upload.
void GetUploadResultFromResponseDetails(
    int net_error,
    int http_response_code,
    base::TimeDelta retry_after,
    DomainReliabilityUploader::UploadResult* result);

GURL SanitizeURLForReport(const GURL& beacon_url,
                          const GURL& collector_url,
                          const ScopedVector<std::string>& path_prefixes);

// Mockable wrapper around TimeTicks::Now and Timer. Mock version is in
// test_util.h.
// TODO(ttuttle): Rename to Time{Provider,Source,?}.
class DOMAIN_RELIABILITY_EXPORT MockableTime : public base::Clock,
                                               public base::TickClock {
 public:
  // Mockable wrapper around (a subset of) base::Timer.
  class DOMAIN_RELIABILITY_EXPORT Timer {
   public:
    virtual ~Timer();

    virtual void Start(const tracked_objects::Location& posted_from,
                       base::TimeDelta delay,
                       const base::Closure& user_task) = 0;
    virtual void Stop() = 0;
    virtual bool IsRunning() = 0;

   protected:
    Timer();
  };

  ~MockableTime() override;

  // Clock impl; returns base::Time::Now() or a mocked version thereof.
  base::Time Now() override = 0;
  // TickClock impl; returns base::TimeTicks::Now() or a mocked version thereof.
  base::TimeTicks NowTicks() override = 0;

  // Returns a new Timer, or a mocked version thereof.
  virtual scoped_ptr<MockableTime::Timer> CreateTimer() = 0;

 protected:
  MockableTime();

 private:
  DISALLOW_COPY_AND_ASSIGN(MockableTime);
};

// Implementation of MockableTime that passes through to
// base::Time{,Ticks}::Now() and base::Timer.
class DOMAIN_RELIABILITY_EXPORT ActualTime : public MockableTime {
 public:
  ActualTime();

  ~ActualTime() override;

  // MockableTime implementation:
  base::Time Now() override;
  base::TimeTicks NowTicks() override;
  scoped_ptr<MockableTime::Timer> CreateTimer() override;
};

}  // namespace domain_reliability

#endif  // COMPONENTS_DOMAIN_RELIABILITY_UTIL_H_


text:
``` diff
+namespace Microsoft.AspNetCore.RateLimiting {
+    [AttributeUsageAttribute(68, AllowMultiple=false, Inherited=true)]
+    public sealed class DisableRateLimitingAttribute : Attribute {
+        public DisableRateLimitingAttribute();
+    }
+    [AttributeUsageAttribute(68, AllowMultiple=false, Inherited=true)]
+    public sealed class EnableRateLimitingAttribute : Attribute {
+        public EnableRateLimitingAttribute(string policyName);
+        public string PolicyName { [CompilerGeneratedAttribute] get; }
+    }
+    public interface IRateLimiterPolicy<TPartitionKey> {
+        Func<OnRejectedContext, CancellationToken, ValueTask>? OnRejected { get; }
+        RateLimitPartition<TPartitionKey> GetPartition(HttpContext httpContext);
+    }
+    public sealed class OnRejectedContext {
+        public OnRejectedContext();
+        public required HttpContext HttpContext { [CompilerGeneratedAttribute] get; [CompilerGeneratedAttribute] set; }
+        public required RateLimitLease Lease { [CompilerGeneratedAttribute] get; [CompilerGeneratedAttribute] set; }
+    }
+    public sealed class RateLimiterOptions {
+        public RateLimiterOptions();
+        public PartitionedRateLimiter<HttpContext>? GlobalLimiter { [CompilerGeneratedAttribute] get; [CompilerGeneratedAttribute] set; }
+        public Func<OnRejectedContext, CancellationToken, ValueTask>? OnRejected { [CompilerGeneratedAttribute] get; [CompilerGeneratedAttribute] set; }
+        public int RejectionStatusCode { [CompilerGeneratedAttribute] get; [CompilerGeneratedAttribute] set; }
+        public RateLimiterOptions AddPolicy<TPartitionKey, TPolicy>(string policyName) where TPolicy : IRateLimiterPolicy<TPartitionKey>;
+        public RateLimiterOptions AddPolicy<TPartitionKey>(string policyName, IRateLimiterPolicy<TPartitionKey> policy);
+        public RateLimiterOptions AddPolicy<TPartitionKey>(string policyName, Func<HttpContext, RateLimitPartition<TPartitionKey>> partitioner);
+    }
+    public static class RateLimiterOptionsExtensions {
+        public static RateLimiterOptions AddConcurrencyLimiter(this RateLimiterOptions options, string policyName, Action<ConcurrencyLimiterOptions> configureOptions);
+        public static RateLimiterOptions AddFixedWindowLimiter(this RateLimiterOptions options, string policyName, Action<FixedWindowRateLimiterOptions> configureOptions);
+        public static RateLimiterOptions AddSlidingWindowLimiter(this RateLimiterOptions options, string policyName, Action<SlidingWindowRateLimiterOptions> configureOptions);
+        public static RateLimiterOptions AddTokenBucketLimiter(this RateLimiterOptions options, string policyName, Action<TokenBucketRateLimiterOptions> configureOptions);
+    }
+}
```


text:
package com.intellij.openapi.externalSystem.service.project;

import com.intellij.openapi.externalSystem.project.PackagingModifiableModel;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

@ApiStatus.Experimental
public class PackagingModifiableModelProvider implements ModifiableModelsProviderExtension<PackagingModifiableModel> {

  @NotNull
  @Override
  public Pair<Class<PackagingModifiableModel>, PackagingModifiableModel> create(@NotNull Project project,
                                                                                @NotNull IdeModifiableModelsProvider modelsProvider) {
    return Pair.create(PackagingModifiableModel.class, new PackagingModifiableModelImpl(project, modelsProvider));
  }
}


text:
<?php
/**
 * This source file is proprietary and part of Rebilly.
 *
 * (c) Rebilly SRL
 *     Rebilly Ltd.
 *     Rebilly Inc.
 *
 * @see https://www.rebilly.com
 */

declare(strict_types=1);

namespace Rebilly\OpenAPI\PhpUnit;

use Exception;
use Rebilly\OpenAPI\TestCase;
use Rebilly\OpenAPI\UnexpectedValueException;
use function time;

class HeadersConstraintTest extends TestCase
{
    /** @var HeadersConstraint */
    private $constraint;

    protected function setUp(): void
    {
        parent::setUp();

        $this->constraint = new HeadersConstraint(
            [
                'Content-Type' => [
                    'type' => 'string',
                    'required' => true,
                ],
                'Allow' => [
                    'type' => 'array',
                    'minItems' => 2,
                    'items' => [
                        'type' => 'string',
                    ],
                ],
                'X-Timestamp' => [
                    'type' => 'integer',
                ],
            ]
        );
    }

    /**
     * @test
     */
    public function passUnexpectedValue(): void
    {
        $this->expectExceptionObject(new UnexpectedValueException('Array expected'));
        self::assertThat((object) [], $this->constraint);
    }

    /**
     * @test
     */
    public function assertValidHeaders(): void
    {
        $headers = [
            'Content-Type' => ['application/json'],
            'Allow' => ['OPTIONS', 'HEAD'],
            'X-Timestamp' => [time()],
        ];

        self::assertThat($headers, $this->constraint);
    }

    /**
     * @test
     * @dataProvider provideInvalidHeaders
     */
    public function assertInvalidHeaders(array $headers): void
    {
        $error = $this->getDataSetName();

        try {
            self::assertThat($headers, $this->constraint);
        } catch (Exception $e) {
            self::assertStringContainsString(
                $error,
                $e->getMessage(),
                "Failed asserting that passed invalid URI: {$error}"
            );
        }

        if (!isset($e)) {
            self::fail('Failed asserting that passed invalid URI');
        }
    }

    public function provideInvalidHeaders(): array
    {
        return [
            'Missing required header' => [
                [],
            ],
            '[Allow] There must be a minimum of 2 items in the array' => [
                [
                    'Content-Type' => ['application/json'],
                    'Allow' => ['OPTIONS'],
                ],
            ],
            '[X-Timestamp] String value found, but an integer is required' => [
                [
                    'X-Timestamp' => ['foo'],
                ],
            ],
        ];
    }
}


text:
ActiveRecord::Schema.define(version: 2020_02_28_182712) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

  create_table "bookmarks", id: :serial, force: :cascade do |t|
    t.integer "user_id", null: false
    t.string "user_type"
    t.string "document_id"
    t.string "title"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "document_type"
    t.index ["document_type", "document_id"], name: "index_bookmarks_on_document_type_and_document_id"
    t.index ["user_id"], name: "index_bookmarks_on_user_id"
  end

  create_table "friendly_id_slugs", id: :serial, force: :cascade do |t|
    t.string "slug", null: false
    t.integer "sluggable_id", null: false
    t.string "sluggable_type", limit: 50
    t.string "scope"
    t.datetime "created_at"
    t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true
    t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type"
    t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id"
    t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type"
  end

  create_table "searches", id: :serial, force: :cascade do |t|
    t.text "query_params"
    t.integer "user_id"
    t.string "user_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_searches_on_user_id"
  end

  create_table "spotlight_attachments", id: :serial, force: :cascade do |t|
    t.string "name"
    t.string "file"
    t.string "uid"
    t.integer "exhibit_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "spotlight_blacklight_configurations", id: :serial, force: :cascade do |t|
    t.integer "exhibit_id"
    t.text "facet_fields"
    t.text "index_fields"
    t.text "search_fields"
    t.text "sort_fields"
    t.text "default_solr_params"
    t.text "show"
    t.text "index"
    t.integer "default_per_page"
    t.text "per_page"
    t.text "document_index_view_types"
    t.string "thumbnail_size"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "spotlight_contact_emails", id: :serial, force: :cascade do |t|
    t.integer "exhibit_id"
    t.string "email", default: "", null: false
    t.string "confirmation_token"
    t.datetime "confirmed_at"
    t.datetime "confirmation_sent_at"
    t.string "unconfirmed_email"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["confirmation_token"], name: "index_spotlight_contact_emails_on_confirmation_token", unique: true
    t.index ["email", "exhibit_id"], name: "index_spotlight_contact_emails_on_email_and_exhibit_id", unique: true
  end

  create_table "spotlight_contacts", id: :serial, force: :cascade do |t|
    t.string "slug"
    t.string "name"
    t.string "email"
    t.string "title"
    t.string "location"
    t.string "telephone"
    t.boolean "show_in_sidebar"
    t.integer "weight", default: 50
    t.integer "exhibit_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.text "contact_info"
    t.string "avatar"
    t.integer "avatar_crop_x"
    t.integer "avatar_crop_y"
    t.integer "avatar_crop_w"
    t.integer "avatar_crop_h"
    t.integer "avatar_id"
    t.index ["avatar_id"], name: "index_spotlight_contacts_on_avatar_id"
    t.index ["exhibit_id"], name: "index_spotlight_contacts_on_exhibit_id"
  end

  create_table "spotlight_custom_fields", id: :serial, force: :cascade do |t|
    t.integer "exhibit_id"
    t.string "slug"
    t.string "field"
    t.text "configuration"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "field_type"
    t.boolean "readonly_field", default: false
    t.boolean "is_multiple", default: false
    t.index ["field_type"], name: "index_spotlight_custom_fields_on_field_type"
  end

  create_table "spotlight_exhibits", id: :serial, force: :cascade do |t|
    t.string "title", null: false
    t.string "subtitle"
    t.string "slug"
    t.text "description"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "layout"
    t.boolean "published", default: false
    t.datetime "published_at"
    t.string "featured_image"
    t.integer "masthead_id"
    t.integer "thumbnail_id"
    t.integer "weight", default: 50
    t.integer "site_id"
    t.string "theme"
    t.boolean "thumbnails_enabled", default: true
    t.boolean "condensed_viewer", default: false
    t.index ["site_id"], name: "index_spotlight_exhibits_on_site_id"
    t.index ["slug"], name: "index_spotlight_exhibits_on_slug", unique: true
  end

  create_table "spotlight_featured_images", id: :serial, force: :cascade do |t|
    t.string "type"
    t.boolean "display"
    t.string "image"
    t.string "source"
    t.string "document_global_id"
    t.integer "image_crop_x"
    t.integer "image_crop_y"
    t.integer "image_crop_w"
    t.integer "image_crop_h"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "iiif_region"
    t.string "iiif_manifest_url"
    t.string "iiif_canvas_id"
    t.string "iiif_image_id"
    t.string "iiif_tilesource"
  end

  create_table "spotlight_filters", id: :serial, force: :cascade do |t|
    t.string "field"
    t.string "value"
    t.integer "exhibit_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exhibit_id"], name: "index_spotlight_filters_on_exhibit_id"
  end

  create_table "spotlight_languages", id: :serial, force: :cascade do |t|
    t.string "locale", null: false
    t.boolean "public"
    t.string "text"
    t.integer "exhibit_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exhibit_id"], name: "index_spotlight_languages_on_exhibit_id"
  end

  create_table "spotlight_locks", id: :serial, force: :cascade do |t|
    t.string "on_type"
    t.integer "on_id"
    t.string "by_type"
    t.integer "by_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["on_id", "on_type"], name: "index_spotlight_locks_on_on_id_and_on_type", unique: true
  end

  create_table "spotlight_main_navigations", id: :serial, force: :cascade do |t|
    t.string "label"
    t.integer "weight", default: 20
    t.string "nav_type"
    t.integer "exhibit_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean "display", default: true
    t.index ["exhibit_id"], name: "index_spotlight_main_navigations_on_exhibit_id"
  end

  create_table "spotlight_pages", id: :serial, force: :cascade do |t|
    t.string "title"
    t.string "type"
    t.string "slug"
    t.string "scope"
    t.text "content"
    t.integer "weight", default: 1000
    t.boolean "published"
    t.integer "exhibit_id"
    t.integer "created_by_id"
    t.integer "last_edited_by_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer "parent_page_id"
    t.boolean "display_sidebar"
    t.boolean "display_title"
    t.integer "thumbnail_id"
    t.string "locale", default: "en"
    t.integer "default_locale_page_id"
    t.string "content_type"
    t.index ["default_locale_page_id"], name: "index_spotlight_pages_on_default_locale_page_id"
    t.index ["exhibit_id"], name: "index_spotlight_pages_on_exhibit_id"
    t.index ["locale"], name: "index_spotlight_pages_on_locale"
    t.index ["parent_page_id"], name: "index_spotlight_pages_on_parent_page_id"
    t.index ["slug", "scope"], name: "index_spotlight_pages_on_slug_and_scope", unique: true
  end

  create_table "spotlight_reindexing_log_entries", id: :serial, force: :cascade do |t|
    t.integer "items_reindexed_count"
    t.integer "items_reindexed_estimate"
    t.datetime "start_time"
    t.datetime "end_time"
    t.integer "job_status"
    t.integer "exhibit_id"
    t.integer "user_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "spotlight_resources", id: :serial, force: :cascade do |t|
    t.integer "exhibit_id"
    t.string "type"
    t.string "url"
    t.text "data"
    t.datetime "indexed_at"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.binary "metadata"
    t.integer "index_status"
    t.integer "upload_id"
    t.index ["index_status"], name: "index_spotlight_resources_on_index_status"
    t.index ["upload_id"], name: "index_spotlight_resources_on_upload_id"
  end

  create_table "spotlight_roles", id: :serial, force: :cascade do |t|
    t.integer "user_id"
    t.string "role"
    t.integer "resource_id"
    t.string "resource_type"
    t.index ["resource_type", "resource_id", "user_id"], name: "index_spotlight_roles_on_resource_and_user_id", unique: true
  end

  create_table "spotlight_searches", id: :serial, force: :cascade do |t|
    t.string "title"
    t.string "slug"
    t.string "scope"
    t.text "short_description"
    t.text "long_description"
    t.text "query_params"
    t.integer "weight"
    t.boolean "published"
    t.integer "exhibit_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "featured_item_id"
    t.integer "masthead_id"
    t.integer "thumbnail_id"
    t.string "default_index_view_type"
    t.boolean "search_box", default: false
    t.index ["exhibit_id"], name: "index_spotlight_searches_on_exhibit_id"
    t.index ["slug", "scope"], name: "index_spotlight_searches_on_slug_and_scope", unique: true
  end

  create_table "spotlight_sites", id: :serial, force: :cascade do |t|
    t.string "title"
    t.string "subtitle"
    t.integer "masthead_id"
  end

  create_table "spotlight_solr_document_sidecars", id: :serial, force: :cascade do |t|
    t.integer "exhibit_id"
    t.boolean "public", default: true
    t.text "data"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string "document_id"
    t.string "document_type"
    t.integer "resource_id"
    t.string "resource_type"
    t.binary "index_status"
    t.index ["document_type", "document_id"], name: "spotlight_solr_document_sidecars_solr_document"
    t.index ["exhibit_id", "document_type", "document_id"], name: "spotlight_solr_document_sidecars_exhibit_document"
    t.index ["exhibit_id"], name: "index_spotlight_solr_document_sidecars_on_exhibit_id"
    t.index ["resource_type", "resource_id"], name: "spotlight_solr_document_sidecars_resource"
  end

  create_table "taggings", id: :serial, force: :cascade do |t|
    t.integer "tag_id"
    t.integer "taggable_id"
    t.string "taggable_type"
    t.string "tagger_type"
    t.integer "tagger_id"
    t.string "context", limit: 128
    t.datetime "created_at"
    t.index ["context"], name: "index_taggings_on_context"
    t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
    t.index ["tag_id"], name: "index_taggings_on_tag_id"
    t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
    t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy"
    t.index ["taggable_id"], name: "index_taggings_on_taggable_id"
    t.index ["taggable_type"], name: "index_taggings_on_taggable_type"
    t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type"
    t.index ["tagger_id"], name: "index_taggings_on_tagger_id"
  end

  create_table "tags", id: :serial, force: :cascade do |t|
    t.string "name"
    t.integer "taggings_count", default: 0
    t.index ["name"], name: "index_tags_on_name", unique: true
  end

  create_table "translations", id: :serial, force: :cascade do |t|
    t.string "locale"
    t.string "key"
    t.text "value"
    t.text "interpolations"
    t.boolean "is_proc", default: false
    t.integer "exhibit_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exhibit_id", "key", "locale"], name: "index_translations_on_exhibit_id_and_key_and_locale", unique: true
    t.index ["exhibit_id"], name: "index_translations_on_exhibit_id"
  end

  create_table "users", id: :serial, force: :cascade do |t|
    t.string "email", default: "", null: false
    t.string "encrypted_password", default: "", null: false
    t.string "reset_password_token"
    t.datetime "reset_password_sent_at"
    t.datetime "remember_created_at"
    t.integer "sign_in_count", default: 0, null: false
    t.datetime "current_sign_in_at"
    t.datetime "last_sign_in_at"
    t.string "current_sign_in_ip"
    t.string "last_sign_in_ip"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "guest", default: false
    t.string "invitation_token"
    t.datetime "invitation_created_at"
    t.datetime "invitation_sent_at"
    t.datetime "invitation_accepted_at"
    t.integer "invitation_limit"
    t.string "invited_by_type"
    t.integer "invited_by_id"
    t.integer "invitations_count", default: 0
    t.string "provider"
    t.string "uid"
    t.string "username"
    t.index ["email"], name: "index_users_on_email", unique: true
    t.index ["invitation_token"], name: "index_users_on_invitation_token", unique: true
    t.index ["invitations_count"], name: "index_users_on_invitations_count"
    t.index ["invited_by_id"], name: "index_users_on_invited_by_id"
    t.index ["provider"], name: "index_users_on_provider"
    t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
    t.index ["uid"], name: "index_users_on_uid"
    t.index ["username"], name: "index_users_on_username"
  end

  create_table "versions", id: :serial, force: :cascade do |t|
    t.string "item_type", null: false
    t.integer "item_id", null: false
    t.string "event", null: false
    t.string "whodunnit"
    t.text "object"
    t.datetime "created_at"
    t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
  end

end


text:
package de.mycrobase.ssim.ed.input;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import java.util.Map;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.jme3.input.KeyInput;
import com.jme3.input.MouseInput;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.input.controls.MouseAxisTrigger;
import com.jme3.input.controls.MouseButtonTrigger;
import com.jme3.input.controls.Trigger;
import com.jme3.system.JmeContext.Type;

import de.mycrobase.ssim.ed.helper.Logging;
import de.mycrobase.ssim.ed.helper.SteppedSSimApplication;
import de.mycrobase.ssim.ed.helper.categories.Fast;
import de.mycrobase.ssim.ed.util.MapLoader;
import de.mycrobase.ssim.ed.util.PropertiesLoader;
import de.mycrobase.ssim.ed.util.XMLLoader;

@Category(Fast.class)
public class MappingsParserTest {

    @BeforeClass
    public static void setUp() {
        Logging.require();
    }

    @Test
    public void testLoad() {
        Helper app = new Helper();
        app.start(Type.Headless);
        app.waitFor();

        MappingSet m = MappingsParser.load(app.getAssetManager(), "input/keys_test.xml");

        assertEquals("test", m.getId());
        // only 3 valid mappings found!
        assertEquals(4, m.getMappings().size());

        assertTrue(containsTrigger(m, new KeyTrigger(KeyInput.KEY_A)));
        assertTrue(containsTrigger(m, new KeyTrigger(KeyInput.KEY_B)));
        assertFalse(containsTrigger(m, new KeyTrigger(KeyInput.KEY_C)));

        assertTrue(containsTrigger(m, new MouseButtonTrigger(MouseInput.BUTTON_LEFT)));
        assertFalse(containsTrigger(m, new MouseButtonTrigger(MouseInput.BUTTON_RIGHT)));

        assertTrue(containsTrigger(m, new MouseAxisTrigger(MouseInput.AXIS_X, false)));
        assertFalse(containsTrigger(m, new MouseAxisTrigger(MouseInput.AXIS_Y, false)));
        assertFalse(containsTrigger(m, new MouseAxisTrigger(MouseInput.AXIS_Y, true)));

        assertEquals("TEST_a", getMapping(m, new KeyTrigger(KeyInput.KEY_A)));
        assertEquals("TEST_b", getMapping(m, new KeyTrigger(KeyInput.KEY_B)));
        assertEquals("TEST_left", getMapping(m, new MouseButtonTrigger(MouseInput.BUTTON_LEFT)));
        assertEquals("TEST_x", getMapping(m, new MouseAxisTrigger(MouseInput.AXIS_X, false)));
    }

    private static boolean containsTrigger(MappingSet m, Trigger trig) {
        for(Map.Entry<Trigger, String> map : m.getMappings().entrySet()) {
            Trigger trigger = map.getKey();
            if(trigger.triggerHashCode() == trig.triggerHashCode()) {
                return true;
            }
        }
        return false;
    }

    private static String getMapping(MappingSet m, Trigger trig) {
        for(Map.Entry<Trigger, String> map : m.getMappings().entrySet()) {
            Trigger trigger = map.getKey();
            if(trigger.triggerHashCode() == trig.triggerHashCode()) {
                return map.getValue();
            }
        }
        return null;
    }

    private static class Helper extends SteppedSSimApplication {

        @Override
        public void simpleInitApp() {
            assetManager.registerLoader(XMLLoader.class, "xml");
            assetManager.registerLoader(MapLoader.class, "map");
            assetManager.registerLoader(PropertiesLoader.class, "properties");
        }
    }
}


text:
package org.apache.jute;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;

/**
 * Front-end interface to deserializers. Also acts as a factory
 * for deserializers.
 */
public class RecordReader {

    private static  HashMap<String, Method> archiveFactory;

    private InputArchive archive;

    static {
        archiveFactory = new HashMap<>();

        try {
            archiveFactory.put(
                    "binary",
                    BinaryInputArchive.class.getDeclaredMethod("getArchive", InputStream.class));
        } catch (SecurityException | NoSuchMethodException ex) {
            ex.printStackTrace();
        }
    }

    private static InputArchive createArchive(InputStream in, String format) {
        Method factory = archiveFactory.get(format);

        if (factory != null) {
            Object[] params = {in};
            try {
                return (InputArchive) factory.invoke(null, params);
            } catch (IllegalArgumentException | InvocationTargetException | IllegalAccessException ex) {
                ex.printStackTrace();
            }
        }

        return null;
    }

    /**
     * Creates a new instance of RecordReader.
     *
     * @param in     Stream from which to deserialize a record
     * @param format Deserialization format ("binary", "xml", or "csv")
     */
    public RecordReader(InputStream in, String format) {
        archive = createArchive(in, format);
    }

    /**
     * Deserialize a record.
     *
     * @param r Record to be deserialized
     */
    public void read(Record r) throws IOException {
        r.deserialize(archive, "");
    }

}


text:
'use strict';
$(function () {

  /* ChartJS
   * -------
   * Here we will create a few charts using ChartJS
   */

  //-----------------------
  //- MONTHLY SALES CHART -
  //-----------------------

  // Get context with jQuery - using jQuery's .get() method.
  var salesChartCanvas = $("#salesChart").get(0).getContext("2d");
  // This will get the first returned node in the jQuery collection.
  var salesChart = new Chart(salesChartCanvas);

  var salesChartData = {
    labels: ["Apirl 23", "Apirl 24", "Apirl 25", "Apirl 26", "Apirl 27", "Apirl 28", "Apirl 29"],
    datasets: [
      {
        label: "Audience",
        fillColor: "transparent",
        strokeColor: "rgb(96,92,168)",
        pointColor: "rgb(96,92,168)",
        pointStrokeColor: "#605ca8",
        pointHighlightFill: "#fff",
        pointHighlightStroke: "rgb(220,220,220)",
        data: [15597, 21700, 22184, 19672, 18583, 20280, 13132]
      }

    ]
  };

  var salesChartOptions = {
    //Boolean - If we should show the scale at all
    showScale: true,
    //Boolean - Whether grid lines are shown across the chart
    scaleShowGridLines: false,
    //String - Colour of the grid lines
    scaleGridLineColor: "rgba(0,0,0,.05)",
    //Number - Width of the grid lines
    scaleGridLineWidth: 5,
    //Boolean - Whether to show horizontal lines (except X axis)
    scaleShowHorizontalLines: true,
    //Boolean - Whether to show vertical lines (except Y axis)
    scaleShowVerticalLines: true,
    //Boolean - Whether the line is curved between points
    bezierCurve: true,
    //Number - Tension of the bezier curve between points
    bezierCurveTension: 0.3,
    //Boolean - Whether to show a dot for each point
    pointDot: true,
    //Number - Radius of each point dot in pixels
    pointDotRadius: 4,
    //Number - Pixel width of point dot stroke
    pointDotStrokeWidth: 1,
    //Number - amount extra to add to the radius to cater for hit detection outside the drawn point
    pointHitDetectionRadius: 20,
    //Boolean - Whether to show a stroke for datasets
    datasetStroke: true,
    //Number - Pixel width of dataset stroke
    datasetStrokeWidth: 2,
    //Boolean - Whether to fill the dataset with a color
    datasetFill: true,
    //String - A legend template
    legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%>
<span style=\"background-color:<%=datasets[i].lineColor%>\"><%=datasets[i].label%>
<%}%>
",
    //Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
    maintainAspectRatio: false,
    //Boolean - whether to make the chart responsive to window resizing
    responsive: true
  };

  //Create the line chart
  salesChart.Line(salesChartData, salesChartOptions);

  //---------------------------
  //- END MONTHLY SALES CHART -
  //---------------------------

  //-----------------------
  //- viewership -
  //-----------------------

  // Get context with jQuery - using jQuery's .get() method.
  var viewershipCanvas = $("#viewership").get(0).getContext("2d");
  // This will get the first returned node in the jQuery collection.
  var viewership = new Chart(viewershipCanvas);

  var viewershipData = {
    labels: ["Apirl 23", "Apirl 24", "Apirl 25", "Apirl 26", "Apirl 27", "Apirl 28", "Apirl 29"],
    datasets: [
      {
        label: "Viewership",
        fillColor: "transparent",
        strokeColor: "rgb(243, 156, 18)",
        pointColor: "rgb(243, 156, 18)",
        pointStrokeColor: "#f39c12",
        pointHighlightFill: "#fff",
        pointHighlightStroke: "rgb(220,220,220)",
        data: [8508385, 9201662, 19713385, 0, 12726150, 9620758, 19060590]
      }

    ]
  };

  var viewershipOptions = {
    //Boolean - If we should show the scale at all
    showScale: true,
    //Boolean - Whether grid lines are shown across the chart
    scaleShowGridLines: false,
    //String - Colour of the grid lines
    scaleGridLineColor: "rgba(0,0,0,.05)",
    //Number - Width of the grid lines
    scaleGridLineWidth: 1,
    //Boolean - Whether to show horizontal lines (except X axis)
    scaleShowHorizontalLines: true,
    //Boolean - Whether to show vertical lines (except Y axis)
    scaleShowVerticalLines: true,
    //Boolean - Whether the line is curved between points
    bezierCurve: true,
    //Number - Tension of the bezier curve between points
    bezierCurveTension: 0.3,
    //Boolean - Whether to show a dot for each point
    pointDot: true,
    //Number - Radius of each point dot in pixels
    pointDotRadius: 4,
    //Number - Pixel width of point dot stroke
    pointDotStrokeWidth: 1,
    //Number - amount extra to add to the radius to cater for hit detection outside the drawn point
    pointHitDetectionRadius: 20,
    //Boolean - Whether to show a stroke for datasets
    datasetStroke: true,
    //Number - Pixel width of dataset stroke
    datasetStrokeWidth: 2,
    //Boolean - Whether to fill the dataset with a color
    datasetFill: true,
    //String - A legend template
    legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%>
<span style=\"background-color:<%=datasets[i].lineColor%>\"><%=datasets[i].label%>
<%}%>
",
    //Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
    maintainAspectRatio: false,
    //Boolean - whether to make the chart responsive to window resizing
    responsive: true
  };

  //Create the line chart
  viewership.Line(viewershipData, viewershipOptions);

  //---------------------------
  //- END MONTHLY SALES CHART -
  //---------------------------
  //-------------
  //- PIE CHART -
  //-------------
  // Get context with jQuery - using jQuery's .get() method.
  var pieChartCanvas = $("#pieChart").get(0).getContext("2d");
  var pieChart = new Chart(pieChartCanvas);
  var PieData = [
    {
      value: 700,
      color: "#CFCFCF",
      highlight: "#CFCFCF",
      label: "no data"
    },
    {
      value: 500,
      color: "#BDBEBF",
      highlight: "#BDBEBF",
      label: "no data"
    },
    {
      value: 400,
      color: "#ABABAB",
      highlight: "#ABABAB",
      label: "no data"
    },
    {
      value: 600,
      color: "#9C9C9C",
      highlight: "#9C9C9C",
      label: "no data"
    },
    {
      value: 300,
      color: "#858585",
      highlight: "#858585",
      label: "no data"
    },

  ];
  var pieOptions = {
    //Boolean - Whether we should show a stroke on each segment
    segmentShowStroke: true,
    //String - The colour of each segment stroke
    segmentStrokeColor: "#fff",
    //Number - The width of each segment stroke
    segmentStrokeWidth: 1,
    //Number - The percentage of the chart that we cut out of the middle
    percentageInnerCutout: 50, // This is 0 for Pie charts
    //Number - Amount of animation steps
    animationSteps: 100,
    //String - Animation easing effect
    animationEasing: "easeOutBounce",
    //Boolean - Whether we animate the rotation of the Doughnut
    animateRotate: true,
    //Boolean - Whether we animate scaling the Doughnut from the centre
    animateScale: false,
    //Boolean - whether to make the chart responsive to window resizing
    responsive: true,
    // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container
    maintainAspectRatio: false,
    //String - A legend template
    legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%>
<span style=\"background-color:<%=segments[i].fillColor%>\"><%if(segments[i].label){%><%=segments[i].label%><%}%>
<%}%>
",
    //String - A tooltip template
    tooltipTemplate: "<%=label%>"
  };
  //Create pie or douhnut chart
  // You can switch between pie and douhnut using the method below.
  pieChart.Doughnut(PieData, pieOptions);
  //-----------------
  //- END PIE CHART -
  //-----------------

  /* jVector Maps
   * ------------
   * Create a world map with markers
   */
  $('#world-map-markers').vectorMap({
    map: 'world_mill_en',
    normalizeFunction: 'polynomial',
    hoverOpacity: 0.7,
    hoverColor: false,
    backgroundColor: 'transparent',
    regionStyle: {
      initial: {
        fill: 'rgba(210, 214, 222, 1)',
        "fill-opacity": 1,
        stroke: 'none',
        "stroke-width": 0,
        "stroke-opacity": 1
      },
      hover: {
        "fill-opacity": 0.7,
        cursor: 'pointer'
      },
      selected: {
        fill: 'yellow'
      },
      selectedHover: {
      }
    },
    markerStyle: {
      initial: {
        fill: '#00a65a',
        stroke: '#111'
      }
    },
    markers: [
      // {latLng: [41.90, 12.45], name: 'Vatican City'},
      // {latLng: [43.73, 7.41], name: 'Monaco'},
      // {latLng: [-0.52, 166.93], name: 'Nauru'},
      // {latLng: [-8.51, 179.21], name: 'Tuvalu'},
      // {latLng: [43.93, 12.46], name: 'San Marino'},
      // {latLng: [47.14, 9.52], name: 'Liechtenstein'},
      // {latLng: [7.11, 171.06], name: 'Marshall Islands'},
      // {latLng: [17.3, -62.73], name: 'Saint Kitts and Nevis'},
      // {latLng: [3.2, 73.22], name: 'Maldives'},
      // {latLng: [35.88, 14.5], name: 'Malta'},
      // {latLng: [12.05, -61.75], name: 'Grenada'},
      // {latLng: [13.16, -61.23], name: 'Saint Vincent and the Grenadines'},
      // {latLng: [13.16, -59.55], name: 'Barbados'},
      // {latLng: [17.11, -61.85], name: 'Antigua and Barbuda'},
      // {latLng: [-4.61, 55.45], name: 'Seychelles'},
      // {latLng: [7.35, 134.46], name: 'Palau'},
      // {latLng: [42.5, 1.51], name: 'Andorra'},
      // {latLng: [14.01, -60.98], name: 'Saint Lucia'},
      // {latLng: [6.91, 158.18], name: 'Federated States of Micronesia'},
      // {latLng: [1.3, 103.8], name: 'Singapore'},
      // {latLng: [1.46, 173.03], name: 'Kiribati'},
      // {latLng: [-21.13, -175.2], name: 'Tonga'},
      // {latLng: [15.3, -61.38], name: 'Dominica'},
      // {latLng: [-20.2, 57.5], name: 'Mauritius'},
      // {latLng: [26.02, 50.55], name: 'Bahrain'},
      // {latLng: [0.33, 6.73], name: 'São Tomé and Príncipe'}
    ]
  });

  /* SPARKLINE CHARTS
   * ----------------
   * Create a inline charts with spark line
   */

  //-----------------
  //- SPARKLINE BAR -
  //-----------------
  $('.sparkbar').each(function () {
    var $this = $(this);
    $this.sparkline('html', {
      type: 'bar',
      height: $this.data('height') ? $this.data('height') : '30',
      barColor: $this.data('color')
    });
  });

  //-----------------
  //- SPARKLINE PIE -
  //-----------------
  $('.sparkpie').each(function () {
    var $this = $(this);
    $this.sparkline('html', {
      type: 'pie',
      height: $this.data('height') ? $this.data('height') : '90',
      sliceColors: $this.data('color')
    });
  });

  //------------------
  //- SPARKLINE LINE -
  //------------------
  $('.sparkline').each(function () {
    var $this = $(this);
    $this.sparkline('html', {
      type: 'line',
      height: $this.data('height') ? $this.data('height') : '90',
      width: '100%',
      lineColor: $this.data('linecolor'),
      fillColor: $this.data('fillcolor'),
      spotColor: $this.data('spotcolor')
    });
  });
});


text:
package jdk.thread;

import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

/**
 * created By vincent
 * Time: 28/08/2017 20:25
 */
public class CountDownLatchDemo {
  static final int SIZE = 100;

  public static void main(String[] args) {
    ExecutorService executorService = Executors.newCachedThreadPool();
    CountDownLatch countDownLatch = new CountDownLatch(SIZE);
    for (int i = 0; i < 10; i++)
      executorService.execute(new WaitingTask(countDownLatch));

    for (int i = 0; i < SIZE; i++) {
      executorService.execute(new TaskPortion(countDownLatch));
    }

    System.out.println("Launched all tasks");
    executorService.shutdown();
  }
}

class TaskPortion implements Runnable {

  private static int counter = 0;

  private final int id = counter++;

  private static Random random = new Random(47);

  private final CountDownLatch countDownLatch;

  public TaskPortion(CountDownLatch countDownLatch) {
    this.countDownLatch = countDownLatch;
  }

  @Override
  public void run() {
    try {
      doWork();
      countDownLatch.countDown();
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }

  public void doWork() throws InterruptedException {
    TimeUnit.MILLISECONDS.sleep(random.nextInt(2000));
    System.out.println(this + "completed");
  }

  @Override
  public String toString() {
    return String.format("%1$-3d ", id);
  }
}

class WaitingTask implements Runnable {

  private static int counter = 0;
  private final int id = counter++;
  private final CountDownLatch countDownLatch;

  public WaitingTask(CountDownLatch countDownLatch) {
    this.countDownLatch = countDownLatch;
  }

  @Override
  public void run() {
    try {
      countDownLatch.await();
      System.out.println("Latch barrier passed for " + this);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }

  @Override
  public String toString() {
    return String.format("WaitingTask %1$-3d", id);
  }
}

//class Coun


text:
package org.apache.solr.client.solrj.response;

import org.apache.solr.client.solrj.SolrResponse;
import org.apache.solr.common.util.NamedList;

/**
 *
 *
 * @since solr 1.3
 */
public class SolrResponseBase extends SolrResponse
{
  private long elapsedTime = -1;
  private NamedList<Object> response = null;
  private String requestUrl = null;

  @Override
  public long getElapsedTime() {
    return elapsedTime;
  }

  public void setElapsedTime(long elapsedTime) {
    this.elapsedTime = elapsedTime;
  }

  @Override
  public NamedList<Object> getResponse() {
    return response;
  }

  @Override
  public void setResponse(NamedList<Object> response) {
    this.response = response;
  }

  @Override
  public String toString() {
    return response.toString();
  }

  public NamedList getResponseHeader() {
    return (NamedList) response.get("responseHeader");
  }

  // these two methods are based on the logic in SolrCore.setResponseHeaderValues(...)
  public int getStatus() {
    NamedList header = getResponseHeader();
    if (header != null) {
        return (Integer) header.get("status");
    }
    else {
        return 0;
    }
  }

  public int getQTime() {
    NamedList header = getResponseHeader();
    if (header != null) {
        return (Integer) header.get("QTime");
    }
    else {
        return 0;
    }
  }

  public String getRequestUrl() {
    return requestUrl;
  }

  public void setRequestUrl(String requestUrl) {
    this.requestUrl = requestUrl;
  }

}


text:
@echo off

call dotnet build -c Release

call dotnet run -c Release --project src\Petabridge.Cmd.QuickStart\Petabridge.Cmd.QuickStart.csproj