text:
<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>

    <copyright>
      <year>1998</year><year>2009</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.

      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.

    </legalnotice>

    <title>wrap_log_reader</title>
    <prepared>Esko Vierumäki</prepared>
    <responsible>Esko Vierumäki</responsible>
    <docno></docno>
    <approved>nobody</approved>
    <checked>no</checked>
    <date>98-09-21</date>
    <rev>A</rev>
    <file>wrap_log_reader.sgml</file>

  <module>wrap_log_reader</module>
  <modulesummary>A function to read internally formatted wrap disk logs</modulesummary>
  <description>

<c>wrap_log_reader</c> is a function to read internally formatted
      wrap disk logs, refer to disk_log(3). <c>wrap_log_reader</c> does not
      interfere with disk_log activities; there is however a known bug in this
      version of the <c>wrap_log_reader</c>, see chapter <c>bugs</c> below.

A wrap disk log file consists of several files, called index files.
      A log file can be opened and closed. It is also possible to open just one index file
      separately. If an non-existent or a non-internally formatted file is opened,
      an error message is returned. If the file is corrupt, no attempt to repair it
      will be done but an error message is returned.

If a log is configured to be distributed, there is a possibility that all items
      are not loggen on all nodes. <c>wrap_log_reader</c> does only read the log on
      the called node, it is entirely up to the user to be sure that all items are read.

  </description>
  <funcs>
    <func>
      <name>chunk(Continuation)</name>
      <name>chunk(Continuation, N) -> {Continuation2, Terms} |  {Continuation2, Terms, Badbytes} | {Continuation2, eof} | {error, Reason}</name>
      <fsummary>Read a chunk of objects written to a wrap log.</fsummary>
      <type>
        <v>Continuation = continuation()</v>
        <v>N = int() > 0 | infinity</v>
        <v>Continuation2 = continuation()</v>
        <v>Terms= [term()]</v>
        <v>Badbytes = integer()</v>
      </type>
      <desc>

This function makes it possible to efficiently read the
          terms which have been appended to a log. It minimises disk
          I/O by reading large 8K chunks from the file.

The first time <c>chunk</c> is called an initial
          continuation returned from the <c>open/1</c>, <c>open/2</c> must be provided.

When <c>chunk/3</c> is called, <c>N</c> controls the
          maximum number of terms that are read from the log in each
          chunk.  Default is <c>infinity</c>, which means that all the
          terms contained in the 8K chunk are read. If less than
          <c>N</c> terms are returned, this does not necessarily mean
          that end of file is reached.

The <c>chunk</c> function returns a tuple
          <c>{Continuation2, Terms}</c>, where <c>Terms</c> is a list
          of terms found in the log. <c>Continuation2</c> is yet
          another continuation which must be passed on into any
          subsequent calls to <c>chunk</c>. With a series of calls to
          <c>chunk</c> it is then possible to extract all terms from a
          log.

The <c>chunk</c> function returns a tuple
          <c>{Continuation2, Terms, Badbytes}</c> if the log is opened
          in read only mode and the read chunk is corrupt. <c>Badbytes</c>
          indicates the number of non-Erlang terms found in the chunk.
          Note also that the log is not repaired.

<c>chunk</c> returns <c>{Continuation2, eof}</c> when the end of the log is
          reached, and <c>{error, Reason}</c> if an error occurs.

The returned continuation may or may not be valid in the next call to
          <c>chunk</c>.  This is because the log may wrap and delete
          the file into which the continuation points. To make sure
          this does not happen, the log can be blocked during the
          search.

      </desc>
    </func>
    <func>
      <name>close(Continuation) -> ok </name>
      <fsummary>Close a log</fsummary>
      <type>
        <v>Continuation = continuation()</v>
      </type>
      <desc>

This function closes a log file properly.

      </desc>
    </func>
    <func>
      <name>open(Filename) -> OpenRet</name>
      <name>open(Filename, N) -> OpenRet</name>
      <fsummary>Open a log file</fsummary>
      <type>
        <v>File = string() | atom()</v>
        <v>N = integer()</v>
        <v>OpenRet = {ok, Continuation} | {error, Reason} </v>
        <v>Continuation = continuation()</v>
      </type>
      <desc>

<c>Filename</c> specifies the name of the file which is to be read.

<c>N</c> specifies the index of the file which is to be read.
          If <c>N</c> is omitted the whole wrap log file will be read; if it
          is specified only the specified index file will be read.

The <c>open</c> function returns <c>{ok, Continuation}</c> if the
          log/index file was successfully opened. The <c>Continuation</c>
          is to be used when chunking or closing the file.

The function returns <c>{error, Reason}</c> for all errors.

      </desc>
    </func>
  </funcs>

    <title>Bugs</title>

This version of the <c>wrap_log_reader</c> does not detect if the <c>disk_log</c>
      wraps to a new index file between a <c>wrap_log_reader:open</c> and the first
      <c>wrap_log_reader:chunk</c>.
      In this case the chuck will actually read the last logged items in the log file,
      because the opened index file was truncated by the <c>disk_log</c>.

    <title>See Also</title>

<seealso marker="disk_log">disk_log(3)</seealso>

</erlref>


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>MonitoringVivaldiClient</title>
    <link rel="stylesheet" href="packages/bootjack/css/bootstrap.min.css">

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
          Toggle navigation

        </button>
        Vivaldi Monitor

        <form class="navbar-form navbar-left" role="search">

            <input type="text" class="form-control" placeholder="Search">

          <button type="submit" class="btn btn-default">Submit</button>
        </form>

Configure

            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Configuration

            <form id="read">
              <input type="file" id="files" name="files[]" />
            </form>
            <output id="list"></output>

            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <button id="configureButtton" type="button" class="btn btn-primary" disabled>Configure</button>

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Locomotive.DomainModel
{
    // ???

    public interface IUnitOfWork : IDisposable
    {
        void Commit();

        void RollbackChanges();
    }
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#region Assembly Microsoft.VisualStudio.Debugger.Engine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// References\Debugger\v2.0\Microsoft.VisualStudio.Debugger.Engine.dll
#endregion

using System.Collections.ObjectModel;
using Microsoft.VisualStudio.Debugger.Clr;
using Microsoft.VisualStudio.Debugger.Evaluation;
using Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation;

namespace Microsoft.VisualStudio.Debugger.ComponentInterfaces
{
    public interface IDkmClrFormatter
    {
        string GetTypeName(DkmInspectionContext inspectionContext, DkmClrType clrType, DkmClrCustomTypeInfo CustomTypeInfo, ReadOnlyCollection<string> formatSpecifiers);
        string GetUnderlyingString(DkmClrValue clrValue, DkmInspectionContext inspectionContext);
        string GetValueString(DkmClrValue clrValue, DkmInspectionContext inspectionContext, ReadOnlyCollection<string> formatSpecifiers);
        bool HasUnderlyingString(DkmClrValue clrValue, DkmInspectionContext inspectionContext);
    }
}


text: export const getResults = state => state.results


text:
module Bollettino
  module Model
    # Address
    #
    # @author Alessandro Desatnis <desa.alessandro@gmail.com>
    class Address < Base
      # !@attribute [rw] street
      #   @return [String] the address street
      attribute :street, String

      # !@attribute [rw] zip
      #   @return [String] the address ZIP
      attribute :zip, String

      # !@attribute [rw] location
      #   @return [String] the address location (city, state etc.)
      attribute :location, String
    end
  end
end


text:
#include "tensorflow/compiler/xla/python/custom_call_sharding.h"

#include <memory>
#include <optional>
#include <string>
#include <tuple>
#include <vector>

#include "pybind11/pybind11.h"
#include "pybind11/stl.h"
#include "tensorflow/compiler/xla/client/xla_computation.h"
#include "tensorflow/compiler/xla/python/status_casters.h"
#include "tensorflow/compiler/xla/service/custom_call_sharding_helper.h"
#include "tensorflow/compiler/xla/service/hlo_casting_utils.h"
#include "tensorflow/compiler/xla/service/hlo_sharding_util.h"
#include "tensorflow/compiler/xla/service/spmd/spmd_partitioner_util.h"

namespace xla {

namespace py = ::pybind11;

std::vector<Shape> GetArgShapes(const HloInstruction* instruction) {
  std::vector<Shape> result;
  result.reserve(instruction->operand_count());
  for (HloInstruction* operand : instruction->operands()) {
    result.push_back(operand->shape());
  }
  return result;
}

std::vector<std::optional<HloSharding>> GetArgShardings(
    const HloInstruction* instruction) {
  std::vector<std::optional<HloSharding>> result;
  result.reserve(instruction->operand_count());
  for (HloInstruction* operand : instruction->operands()) {
    if (operand->has_sharding()) {
      result.push_back(operand->sharding());
    } else {
      result.push_back(std::nullopt);
    }
  }
  return result;
}

HloInstruction* InlineHloComputation(HloInstruction* instruction,
                                     HloComputation* computation,
                                     HloComputation::Builder* builder,
                                     std::vector<HloInstruction*> operands,
                                     const std::string& suffix) {
  HloCloneContext context(instruction->GetModule(), suffix);

  absl::flat_hash_map<HloInstruction*, HloInstruction*> replacements;
  auto resolve = [&](HloInstruction* inst) {
    auto it = replacements.find(inst);
    if (it == replacements.end()) {
      throw py::key_error(
          absl::StrCat("Could not find mapping for: ", inst->ToString()));
    }
    return it->second;
  };

  for (auto* inst : computation->MakeInstructionPostOrder()) {
    if (inst->opcode() == HloOpcode::kParameter) {
      replacements.emplace(inst, operands[inst->parameter_number()]);
    } else {
      std::vector<HloInstruction*> new_operands;
      new_operands.reserve(inst->operand_count());
      for (HloInstruction* operand : inst->mutable_operands()) {
        new_operands.push_back(resolve(operand));
      }
      replacements.emplace(inst,
                           builder->AddInstruction(inst->CloneWithNewOperands(
                               inst->shape(), new_operands, &context)));
    }
  }
  return resolve(computation->root_instruction());
}

class PyCustomCallPartitioner : public CustomCallPartitioner {
 public:
  PyCustomCallPartitioner(py::object prop_user_sharding, py::object partition,
                          py::object infer_sharding_from_operands,
                          bool can_side_effecting_have_replicated_sharding)
      : prop_user_sharding_(prop_user_sharding),
        partition_(partition),
        infer_sharding_from_operands_(infer_sharding_from_operands),
        can_side_effecting_have_replicated_sharding_(
            can_side_effecting_have_replicated_sharding) {}
  xla::Status Partition(spmd::SpmdPartitioningVisitor* partitioner,
                        HloInstruction* instruction) const override {
    py::gil_scoped_acquire gil;
    auto py_result =
        partition_(GetArgShapes(instruction), GetArgShardings(instruction),
                   instruction->shape(), instruction->sharding(),
                   instruction->raw_backend_config_string());

    const XlaComputation* computation = nullptr;  // Kept alive by py_result.
    std::vector<HloSharding> arg_shardings;
    std::optional<HloSharding> result_sharding;
    try {
      std::tie(computation, arg_shardings, result_sharding) =
          py::cast<std::tuple<const XlaComputation*, std::vector<HloSharding>,
                              HloSharding>>(py_result);
    } catch (const py::cast_error& e) {
      return xla::InternalError(
          "Shardings returned from partitioning %s: expected "
          "Tuple[XlaComputation, List[HloSharding], HloSharding] got: %s",
          instruction->ToString(), py::repr(py_result));
    }
    auto hlo_module_config =
        xla::HloModule::CreateModuleConfigFromProto(
            computation->proto(), xla::DefaultDebugOptionsIgnoringFlags())
            .value();
    TF_ASSIGN_OR_RETURN(std::unique_ptr<HloModule> hlo_module,
                        xla::HloModule::CreateFromProto(computation->proto(),
                                                        hlo_module_config));
    std::vector<HloInstruction*> operands;
    operands.reserve(instruction->operand_count());
    if (arg_shardings.size() != instruction->operand_count()) {
      return xla::InternalError(
          "Shardings returned from partitioning %s must match: %d vs %d",
          instruction->ToString(), arg_shardings.size(),
          instruction->operand_count());
    }
    for (size_t i = 0; i < instruction->operand_count(); ++i) {
      operands.push_back(
          partitioner->GetPartitionedHlo(instruction->mutable_operand(i))
              .Reshard(arg_shardings[i])
              .hlo());
    }

    auto* partitioned_hlo = InlineHloComputation(
        instruction, hlo_module->entry_computation(), partitioner->builder(),
        operands, "_custom_call_lowering_rule");
    partitioned_hlo->set_sharding(result_sharding.value());

    spmd::PartitionedHlo result_partitioned =
        spmd::PartitionedHlo(partitioned_hlo, instruction->shape(),
                             partitioner->MakePartitioningState())
            .Reshard(instruction->sharding());

    partitioner->SetPartitionedHlo(instruction, result_partitioned);
    return xla::OkStatus();
  }
  HloSharding PropagateUserSharding(
      const HloInstruction* instruction, const HloInstruction* user,
      const HloSharding& sharding) const override {
    py::gil_scoped_acquire gil;
    // TODO(parkers): expand this API to handle the `user` sharding.
    // The user is used when the custom call returns a Tuple and
    // the user is a get-tuple-element. In this case we must update only
    // part of the sharding spec.
    auto result = py::cast<HloSharding>(
        prop_user_sharding_(sharding, instruction->shape(),
                            instruction->raw_backend_config_string()));
    return result;
  }
  std::optional<HloSharding> InferShardingFromOperands(
      const HloInstruction* instruction) const override {
    std::vector<Shape> arg_shapes = GetArgShapes(instruction);
    auto arg_shardings = GetArgShardings(instruction);

    py::gil_scoped_acquire gil;
    auto py_result = infer_sharding_from_operands_(
        arg_shapes, arg_shardings, instruction->shape(),
        instruction->raw_backend_config_string());
    if (py_result.is_none()) {
      return std::nullopt;
    }
    return py::cast<HloSharding>(py_result);
  }
  bool IsCustomCallShardable(const HloInstruction* instruction) const override {
    return true;
  }
  bool CanSideEffectingHaveReplicatedSharding() const override {
    return can_side_effecting_have_replicated_sharding_;
  }

  py::object prop_user_sharding_;
  py::object partition_;
  py::object infer_sharding_from_operands_;
  bool can_side_effecting_have_replicated_sharding_;
};

void BuildCustomCallShardingPybindAPI(pybind11::module& m) {
  m.def(
      "register_custom_call_partitioner",
      [](std::string name, py::object prop_user_sharding, py::object partition,
         py::object infer_sharding_from_operands,
         bool can_side_effecting_have_replicated_sharding) {
        RegisterCustomCallPartitioner(
            name,
            std::make_unique<PyCustomCallPartitioner>(
                prop_user_sharding, partition, infer_sharding_from_operands,
                can_side_effecting_have_replicated_sharding));
      },
      R"(Registers a partitioner for a custom-call operation.

Args:
  name: custom_call_target to match.
  prop_user_sharding: Custom backwards sharding propagation rule.
     Takes result sharding and returns the instruction sharding.
  partition: Lowering rule. Takes operand and result shardings and returns
     a generated HLO and sharding specs. The spmd lowerer first reshards
     to match the returned sharding specs and then inserts the generated hlo.
  infer_sharding_from_operands: Custom forwards sharding propagation rule.
     Takes operand sharding and returns the instruction sharding.
  can_side_effecting_have_replicated_sharding: Side effecting ops are not
     allowed to have replicated sharding. Pass true to disable this check.
)",
      py::arg("name"), py::arg("prop_user_sharding"), py::arg("partition"),
      py::arg("infer_sharding_from_operands"),
      py::arg("can_side_effecting_have_replicated_sharding") = false);

  py::module hlo_sharding_util_m = m.def_submodule(
      "hlo_sharding_util", "Utilities for manipulating HloSharding.");
  hlo_sharding_util_m.def(
      "PartiallyReplicateTiledShardingOnDims",
      [](const HloSharding& sharding, std::vector<int64_t> dims) {
        return hlo_sharding_util::PartiallyReplicateTiledShardingOnDims(
            sharding, dims);
      });
}

}  // namespace xla


text:
package org.elasticsearch.index.analysis;

import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.core.WhitespaceTokenizer;
import org.elasticsearch.test.ESTokenStreamTestCase;

import java.io.IOException;
import java.io.StringReader;

import static org.elasticsearch.common.settings.Settings.settingsBuilder;

public class ASCIIFoldingTokenFilterFactoryTests extends ESTokenStreamTestCase {
    public void testDefault() throws IOException {
        AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder()
                .put("path.home", createTempDir().toString())
                .put("index.analysis.filter.my_ascii_folding.type", "asciifolding")
                .build());
        TokenFilterFactory tokenFilter = analysisService.tokenFilter("my_ascii_folding");
        String source = "Ansprüche";
        String[] expected = new String[]{"Anspruche"};
        Tokenizer tokenizer = new WhitespaceTokenizer();
        tokenizer.setReader(new StringReader(source));
        assertTokenStreamContents(tokenFilter.create(tokenizer), expected);
    }

    public void testPreserveOriginal() throws IOException {
        AnalysisService analysisService = AnalysisTestsHelper.createAnalysisServiceFromSettings(settingsBuilder()
                .put("path.home", createTempDir().toString())
                .put("index.analysis.filter.my_ascii_folding.type", "asciifolding")
                .put("index.analysis.filter.my_ascii_folding.preserve_original", true)
                .build());
        TokenFilterFactory tokenFilter = analysisService.tokenFilter("my_ascii_folding");
        String source = "Ansprüche";
        String[] expected = new String[]{"Anspruche", "Ansprüche"};
        Tokenizer tokenizer = new WhitespaceTokenizer();
        tokenizer.setReader(new StringReader(source));
        assertTokenStreamContents(tokenFilter.create(tokenizer), expected);
    }
}


text:
require "graphql"
require "graphql/client/document_types"

module GraphQL
  class Client
    # Internal: Insert __typename field selections into query.
    module QueryTypename
      # Internal: Insert __typename field selections into query.
      #
      # Skips known types when schema is provided.
      #
      # document - GraphQL::Language::Nodes::Document to modify
      # schema - Optional Map of GraphQL::Language::Nodes::Node to GraphQL::Type
      #
      # Returns the document with `__typename` added to it
      if GraphQL::Language::Nodes::AbstractNode.method_defined?(:merge)
        # GraphQL 1.9 introduces a new visitor class
        # and doesn't expose writer methods for node attributes.
        # So, use the node mutation API instead.
        class InsertTypenameVisitor < GraphQL::Language::Visitor
          def initialize(document, types:)
            @types = types
            super(document)
          end

          def add_typename(node, parent)
            type = @types[node]
            type = type && type.unwrap

            if (node.selections.any? && (type.nil? || type.kind.interface? || type.kind.union?)) ||
              (node.selections.none? && (type && type.kind.object?))
              names = QueryTypename.node_flatten_selections(node.selections).map { |s| s.respond_to?(:name) ? s.name : nil }
              names = Set.new(names.compact)

              if names.include?("__typename")
                yield(node, parent)
              else
                node_with_typename = node.merge(selections: [GraphQL::Language::Nodes::Field.new(name: "__typename")] + node.selections)
                yield(node_with_typename, parent)
              end
            else
              yield(node, parent)
            end
          end

          def on_operation_definition(node, parent)
            add_typename(node, parent) { |n, p| super(n, p) }
          end

          def on_field(node, parent)
            add_typename(node, parent) { |n, p| super(n, p) }
          end

          def on_fragment_definition(node, parent)
            add_typename(node, parent) { |n, p| super(n, p) }
          end
        end

        def self.insert_typename_fields(document, types: {})
          visitor = InsertTypenameVisitor.new(document, types: types)
          visitor.visit
          visitor.result
        end

      else
        def self.insert_typename_fields(document, types: {})
          on_selections = ->(node, _parent) do
            type = types[node]

            if node.selections.any?
              case type && type.unwrap
              when NilClass, GraphQL::InterfaceType, GraphQL::UnionType
                names = node_flatten_selections(node.selections).map { |s| s.respond_to?(:name) ? s.name : nil }
                names = Set.new(names.compact)

                unless names.include?("__typename")
                  node.selections = [GraphQL::Language::Nodes::Field.new(name: "__typename")] + node.selections
                end
              end
            elsif type && type.unwrap.is_a?(GraphQL::ObjectType)
              node.selections = [GraphQL::Language::Nodes::Field.new(name: "__typename")]
            end
          end

          visitor = GraphQL::Language::Visitor.new(document)
          visitor[GraphQL::Language::Nodes::Field].leave << on_selections
          visitor[GraphQL::Language::Nodes::FragmentDefinition].leave << on_selections
          visitor[GraphQL::Language::Nodes::OperationDefinition].leave << on_selections
          visitor.visit

          document
        end
      end

      def self.node_flatten_selections(selections)
        selections.flat_map do |selection|
          case selection
          when GraphQL::Language::Nodes::Field
            selection
          when GraphQL::Language::Nodes::InlineFragment
            node_flatten_selections(selection.selections)
          else
            []
          end
        end
      end
    end
  end
end


text:
using System;
using System.Collections.Generic;
using System.Reflection;
using ModTools.UI;
using ModTools.Utils;
using UnityEngine;

namespace ModTools.Explorer
{
    internal sealed class Watches : GUIWindow
    {
        private readonly List<ReferenceChain> watches = new List<ReferenceChain>();

        private Vector2 watchesScroll = Vector2.zero;

        public Watches()
            : base("Watches", new Rect(504, 128, 800, 300))
        {
        }

        private static ModConfiguration Config => MainWindow.Instance.Config;

        public void AddWatch(ReferenceChain refChain)
        {
            watches.Add(refChain);
            Visible = true;
        }

        public void RemoveWatch(ReferenceChain refChain)
        {
            if (watches.Contains(refChain))
            {
                watches.Remove(refChain);
            }
        }

        protected override void DrawWindow()
        {
            watchesScroll = GUILayout.BeginScrollView(watchesScroll);

            foreach (var watch in watches.ToArray())
            {
                if (watch == null)
                {
                    continue;
                }

                GUILayout.BeginHorizontal();
                try
                {
                    var type = GetWatchType(watch);

                    GUI.contentColor = Config.TypeColor;
                    GUILayout.Label(type.ToString());
                    GUI.contentColor = Config.NameColor;
                    GUILayout.Label(watch.ToString());
                    GUI.contentColor = Color.white;
                    GUILayout.Label(" = ");

                    GUI.enabled = false;

                    var value = watch.Evaluate();
                    GUI.contentColor = Config.ValueColor;

                    if (value == null || !TypeUtil.IsSpecialType(type))
                    {
                        GUILayout.Label(value == null ? "null" : value.ToString());
                    }
                    else
                    {
                        try
                        {
                            GUIControls.EditorValueField("watch." + watch, type, value);
                        }
                        catch
                        {
                            GUILayout.Label(value.ToString());
                        }
                    }

                    GUI.contentColor = Color.white;

                    GUI.enabled = true;

                    GUILayout.FlexibleSpace();

                    if (value != null)
                    {
                        var smartType = TypeUtil.OverrideSmartType(TypeUtil.DetectSmartType(watch.LastItemName, value.GetType()), watch.LastItemName, watch.SubChain(watch.Length - 1).Evaluate());
                        GUIButtons.SetupSmartShowButtons(value, smartType); // TODO: get from cache
                    }

                    if (GUILayout.Button("Show watched field"))
                    {
                        var sceneExplorer = FindObjectOfType<SceneExplorer>();
                        sceneExplorer.Show(watch.SubChain(watch.Length - 1));
                    }

                    if (GUILayout.Button("x", GUILayout.Width(24)))
                    {
                        RemoveWatch(watch);
                    }
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }

                GUILayout.EndHorizontal();
            }

            GUILayout.EndScrollView();
        }

        private Type GetWatchType(ReferenceChain watch)
        {
            switch (watch.LastItem)
            {
                case FieldInfo fieldInfo:
                    return fieldInfo.FieldType;
                case PropertyInfo fieldInfo:
                    return fieldInfo.PropertyType;
                case uint _:
                    return GetWatchType(watch.SubChain(watch.Length - 1)).GetElementType();
                default:
                    return watch.LastItem.GetType();
            }
        }
    }
}


text:
require_relative 'runner'
require_relative 'detect'
require_relative 'plugin'

module Puma
  # This class is instantiated by the `Puma::Launcher` and used
  # to boot and serve a Ruby application when no puma "workers" are needed
  # i.e. only using "threaded" mode. For example `$ puma -t 1:5`
  #
  # At the core of this class is running an instance of `Puma::Server` which
  # gets created via the `start_server` method from the `Puma::Runner` class
  # that this inherits from.
  class Single < Runner
    # @!attribute [r] stats
    def stats
      {
        started_at: @started_at.utc.iso8601
      }.merge(@server.stats).merge(super)
    end

    def restart
      @server&.begin_restart
    end

    def stop
      @server&.stop false
    end

    def halt
      @server&.halt
    end

    def stop_blocked
      log "- Gracefully stopping, waiting for requests to finish"
      @control&.stop true
      @server&.stop true
    end

    def run
      output_header "single"

      load_and_bind

      Plugins.fire_background

      @launcher.write_state

      start_control

      @server = server = start_server
      server_thread = server.run

      log "Use Ctrl-C to stop"
      redirect_io

      @events.fire_on_booted!

      begin
        server_thread.join
      rescue Interrupt
        # Swallow it
      end
    end
  end
end


text:
package eu.leads.processor.infinispan;

import eu.leads.processor.common.LeadsListener;
import eu.leads.processor.common.infinispan.InfinispanManager;
import org.vertx.java.core.json.JsonObject;

/**
 * Created by vagvaz on 9/25/15.
 */
public class TopkSecondStageListener implements LeadsListener {
  public TopkSecondStageListener(JsonObject conf) {

  }

  @Override public InfinispanManager getManager() {
    return null;
  }

  @Override public void setManager(InfinispanManager manager) {

  }

  @Override public void initialize(InfinispanManager manager, JsonObject conf) {

  }

  @Override public void initialize(InfinispanManager manager) {

  }

  @Override public String getId() {
    return TopkSecondStageListener.class.toString();
  }

  @Override public void close() {

  }

  @Override public void setConfString(String s) {

  }
}


text:
package com.digitalpetri.opcua.stack.core.types.structured;

import com.digitalpetri.opcua.stack.core.Identifiers;
import com.digitalpetri.opcua.stack.core.serialization.DelegateRegistry;
import com.digitalpetri.opcua.stack.core.serialization.UaDecoder;
import com.digitalpetri.opcua.stack.core.serialization.UaEncoder;
import com.digitalpetri.opcua.stack.core.serialization.UaStructure;
import com.digitalpetri.opcua.stack.core.types.builtin.DataValue;
import com.digitalpetri.opcua.stack.core.types.builtin.NodeId;

public class WriteValue implements UaStructure {

    public static final NodeId TypeId = Identifiers.WriteValue;
    public static final NodeId BinaryEncodingId = Identifiers.WriteValue_Encoding_DefaultBinary;
    public static final NodeId XmlEncodingId = Identifiers.WriteValue_Encoding_DefaultXml;

    protected final NodeId _nodeId;
    protected final Long _attributeId;
    protected final String _indexRange;
    protected final DataValue _value;

    public WriteValue(NodeId _nodeId, Long _attributeId, String _indexRange, DataValue _value) {
        this._nodeId = _nodeId;
        this._attributeId = _attributeId;
        this._indexRange = _indexRange;
        this._value = _value;
    }

    public NodeId getNodeId() { return _nodeId; }

    public Long getAttributeId() { return _attributeId; }

    public String getIndexRange() { return _indexRange; }

    public DataValue getValue() { return _value; }

    @Override
    public NodeId getTypeId() { return TypeId; }

    @Override
    public NodeId getBinaryEncodingId() { return BinaryEncodingId; }

    @Override
    public NodeId getXmlEncodingId() { return XmlEncodingId; }

    public static void encode(WriteValue writeValue, UaEncoder encoder) {
        encoder.encodeNodeId("NodeId", writeValue._nodeId);
        encoder.encodeUInt32("AttributeId", writeValue._attributeId);
        encoder.encodeString("IndexRange", writeValue._indexRange);
        encoder.encodeDataValue("Value", writeValue._value);
    }

    public static WriteValue decode(UaDecoder decoder) {
        NodeId _nodeId = decoder.decodeNodeId("NodeId");
        Long _attributeId = decoder.decodeUInt32("AttributeId");
        String _indexRange = decoder.decodeString("IndexRange");
        DataValue _value = decoder.decodeDataValue("Value");

        return new WriteValue(_nodeId, _attributeId, _indexRange, _value);
    }

    static {
        DelegateRegistry.registerEncoder(WriteValue::encode, WriteValue.class, BinaryEncodingId, XmlEncodingId);
        DelegateRegistry.registerDecoder(WriteValue::decode, WriteValue.class, BinaryEncodingId, XmlEncodingId);
    }

}


text:
/**
 * IChartsTileOverlay.m
 * iCharts
 *
 * Ian Fisk on 11/1/16
 */

#import "IChartsTileOverlay.h"

@implementation IChartsTileOverlay

- (void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *data, NSError *error))result {
	[super loadTileAtPath:path result:result];

#ifdef DEBUG
	NSLog(@"Load tile at path: z: %zd, x: %zd, y: %zd", path.z, path.x, path.y);
#endif
}

@end


text:
/
#endregion

using System;

namespace GSF.IO.Checksums
{
    /// Defines extension functions related to computing checksums.
    [CLSCompliant(false)]
    public static class ChecksumExtensions
    {
        /// Calculates the Adler-32 checksum on specified portion of a buffer.
        /// <param name="data">Data buffer to perform checksum on.</param>
        /// <param name="startIndex">Starts index in data buffer to begin checksum.</param>
        /// <param name="length">Total number of bytes from <paramref name="startIndex">startIndex</paramref> to
        /// perform checksum over.</param>
        /// <returns>Computed Adler-32 checksum over the specified portion of the buffer.</returns>
        public static uint Adler32Checksum(this byte[] data, int startIndex, int length)
        {
            Adler32 checksum = new Adler32();

            checksum.Update(data, startIndex, length);

            return checksum.Value;
        }

        /// Calculates the CRC16 check-sum on specified portion of a buffer.
        /// <param name="data">Data buffer to perform check-sum on.</param>
        /// <param name="startIndex">Starts index in data buffer to begin check-sum.</param>
        /// <param name="length">Total number of bytes from <paramref name="startIndex">startIndex</paramref> to
        /// perform check-sum over.</param>
        /// <returns>Computed CRC16 checksum over the specified portion of the buffer.</returns>
        public static ushort Crc16Checksum(this byte[] data, int startIndex, int length)
        {
            Crc16 checksum = new Crc16();

            checksum.Update(data, startIndex, length);

            return checksum.Value;
        }

        /// Calculates the CRC-CCITT check-sum on specified portion of a buffer.
        /// <param name="data">Data buffer to perform check-sum on.</param>
        /// <param name="startIndex">Starts index in data buffer to begin check-sum.</param>
        /// <param name="length">Total number of bytes from <paramref name="startIndex">startIndex</paramref> to
        /// perform check-sum over.</param>
        /// <returns>Computed CRC-CCITT checksum over the specified portion of the buffer.</returns>
        /// <remarks>
        /// The CRC-CCITT is a table based 16-bit CRC popular for modem protocols defined for use by the
        /// Consultative Committee on International Telegraphy and Telephony (CCITT)
        /// </remarks>
        public static ushort CrcCCITTChecksum(this byte[] data, int startIndex, int length)
        {
            CrcCCITT checksum = new CrcCCITT();

            checksum.Update(data, startIndex, length);

            return checksum.Value;
        }

		/// Calculates the CRC-ModBus check-sum on specified portion of a buffer.
		/// <param name="data">Data buffer to perform check-sum on.</param>
		/// <param name="startIndex">Starts index in data buffer to begin check-sum.</param>
		/// <param name="length">Total number of bytes from <paramref name="startIndex">startIndex</paramref> to
		/// perform check-sum over.</param>
		/// <returns>Computed CRC-ModBus checksum over the specified portion of the buffer.</returns>
		public static ushort ModBusCrcChecksum(this byte[] data, int startIndex, int length)
		{
			Crc16 checksum = new Crc16(ChecksumType.ModBus);

			checksum.Update(data, startIndex, length);

			return checksum.Value;
		}

        /// Calculates the CRC32 check-sum on specified portion of a buffer.
        /// <param name="data">Data buffer to perform check-sum on.</param>
        /// <param name="startIndex">Starts index in data buffer to begin check-sum.</param>
        /// <param name="length">Total number of bytes from <paramref name="startIndex">startIndex</paramref> to
        /// perform check-sum over.</param>
        /// <returns>Computed CRC32 checksum over the specified portion of the buffer.</returns>
        public static uint Crc32Checksum(this byte[] data, int startIndex, int length)
        {
            Crc32 checksum = new Crc32();

            checksum.Update(data, startIndex, length);

            return checksum.Value;
        }

        /// Calculates byte length (8-bit) XOR-based check-sum on specified portion of a buffer.
        /// <param name="data">Data buffer to perform XOR check-sum on.</param>
        /// <param name="startIndex">Starts index in data buffer to begin XOR check-sum.</param>
        /// <param name="length">Total number of bytes from <paramref name="startIndex">startIndex</paramref> to
        /// perform XOR check-sum over.</param>
        /// <returns>Byte length XOR check-sum.</returns>
        public static byte Xor8CheckSum(this byte[] data, int startIndex, int length)
        {
            Xor8 checksum = new Xor8();

            checksum.Update(data, startIndex, length);

            return checksum.Value;
        }

        /// Calculates word length (16-bit) XOR-based check-sum on specified portion of a buffer.
        /// <param name="data">Data buffer to perform XOR check-sum on.</param>
        /// <param name="startIndex">Starts index in data buffer to begin XOR check-sum.</param>
        /// <param name="length">Total number of bytes from <paramref name="startIndex">startIndex</paramref> to
        /// perform XOR check-sum overs</param>
        /// <returns>Word length XOR check-sum.</returns>
        public static ushort Xor16CheckSum(this byte[] data, int startIndex, int length)
        {
            Xor16 checksum = new Xor16();

            checksum.Update(data, startIndex, length);

            return checksum.Value;
        }

        /// Calculates double-word length (32-bit) XOR-based check-sum on specified portion of a buffer.
        /// <param name="data">Data buffer to perform XOR check-sum on.</param>
        /// <param name="startIndex">Starts index in data buffer to begin XOR check-sum.</param>
        /// <param name="length">Total number of bytes from <paramref name="startIndex">startIndex</paramref> to
        /// perform XOR check-sum over.</param>
        /// <returns>Double-word length XOR check-sum.</returns>
        public static uint Xor32CheckSum(this byte[] data, int startIndex, int length)
        {
            Xor32 checksum = new Xor32();

            checksum.Update(data, startIndex, length);

            return checksum.Value;
        }

        /// Calculates quad-word length (64-bit) XOR-based check-sum on specified portion of a buffer.
        /// <param name="data">Data buffer to perform XOR check-sum on.</param>
        /// <param name="startIndex">Starts index in data buffer to begin XOR check-sum.</param>
        /// <param name="length">Total number of bytes from <paramref name="startIndex">startIndex</paramref> to
        /// perform XOR check-sum over.</param>
        /// <returns>Quad-word length XOR check-sum.</returns>
        public static ulong Xor64CheckSum(this byte[] data, int startIndex, int length)
        {
            Xor64 checksum = new Xor64();

            checksum.Update(data, startIndex, length);

            return checksum.Value;
        }
    }
}


text:
var mongoose = require('mongoose'),
    Schema = mongoose.Schema;
var GeoJSON = require('mongoose-geojson-schema');
    Schema = mongoose.Schema;
var HydeFeatureSchema = new Schema({
  id        : { type: "String" },
  'type'    : { type: String, default: "Feature"},
  geometry  : GeoJSON.Geometry,
  properties: {type: "Object"},
  'properties.LAYERNAME': {type: String},
  'properties.X': {type: Number},
  'properties.Y': {type: Number},
  'properties.XY': {type: String}
});
HydeFeatureSchema.index({'properties.LAYERNAME' : 1, 'properties.X' : 1, 'properties.Y' : 1, 'properties.XY': 1}, {unique : true});
HydeFeatureSchema.index({'geometry': '2dsphere'});

mongoose.model('HydeFeature', HydeFeatureSchema);


text:
package cn.aaronyi.amenweather.v2.constant;

/**
 * Created by yihaimen on 17/3/10.
 */

public class UrlConstant {
    public static final String WEATHER_BASE_URL = "https://free-api.heweather.com/v5/";

    public static final String AREA_BASE_URL = "http://guolin.tech/api/china/";

    public static final String WEATHER = "weather";

    public static final String KEY = "07ab299e55334b09aedf2785cd402d4e";

}


text:
FOUNDATION_EXPORT double BrightFuturesVersionNumber;
FOUNDATION_EXPORT const unsigned char BrightFuturesVersionString[];


text:
package org.elasticsearch.rest.action.fieldstats;

import org.elasticsearch.action.fieldstats.FieldStats;
import org.elasticsearch.action.fieldstats.FieldStatsRequest;
import org.elasticsearch.action.fieldstats.FieldStatsResponse;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.rest.*;
import org.elasticsearch.rest.action.support.RestBuilderListener;

import java.util.Map;

import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader;

/**
 */
public class RestFieldStatsAction extends BaseRestHandler {

    @Inject
    public RestFieldStatsAction(Settings settings, RestController controller, Client client) {
        super(settings, controller, client);
        controller.registerHandler(GET, "/_field_stats", this);
        controller.registerHandler(POST, "/_field_stats", this);
        controller.registerHandler(GET, "/{index}/_field_stats", this);
        controller.registerHandler(POST, "/{index}/_field_stats", this);
    }

    @Override
    public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
        final FieldStatsRequest fieldStatsRequest = new FieldStatsRequest();
        fieldStatsRequest.indices(Strings.splitStringByCommaToArray(request.param("index")));
        fieldStatsRequest.indicesOptions(IndicesOptions.fromRequest(request, fieldStatsRequest.indicesOptions()));
        fieldStatsRequest.fields(Strings.splitStringByCommaToArray(request.param("fields")));
        fieldStatsRequest.level(request.param("level", FieldStatsRequest.DEFAULT_LEVEL));

        client.fieldStats(fieldStatsRequest, new RestBuilderListener<FieldStatsResponse>(channel) {
            @Override
            public RestResponse buildResponse(FieldStatsResponse response, XContentBuilder builder) throws Exception {
                builder.startObject();
                buildBroadcastShardsHeader(builder, request, response);

                builder.startObject("indices");
                for (Map.Entry<String, Map<String, FieldStats>> entry1 : response.getIndicesMergedFieldStats().entrySet()) {
                    builder.startObject(entry1.getKey());
                    builder.startObject("fields");
                    for (Map.Entry<String, FieldStats> entry2 : entry1.getValue().entrySet()) {
                        builder.field(entry2.getKey());
                        entry2.getValue().toXContent(builder, request);
                    }
                    builder.endObject();
                    builder.endObject();
                }
                builder.endObject();
                return new BytesRestResponse(RestStatus.OK, builder);
            }
        });
    }
}


text:
package org.springframework.boot.devtools.autoconfigure;

import org.junit.Before;
import org.junit.Test;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

import static org.assertj.core.api.Assertions.assertThat;

/**
 * Tests for {@link OnEnabledDevtoolsCondition}.
 *
 * @author Madhura Bhave
 */
public class OnEnabledDevtoolsConditionTests {

	private AnnotationConfigApplicationContext context;

	@Before
	public void setup() {
		this.context = new AnnotationConfigApplicationContext();
		this.context.register(TestConfiguration.class);
	}

	@Test
	public void outcomeWhenDevtoolsShouldBeEnabledIsTrueShouldMatch() throws Exception {
		Thread thread = new Thread(() -> {
			OnEnabledDevtoolsConditionTests.this.context.refresh();
			assertThat(OnEnabledDevtoolsConditionTests.this.context.containsBean("test"))
					.isTrue();
		});
		thread.start();
		thread.join();
	}

	@Test
	public void outcomeWhenDevtoolsShouldBeEnabledIsFalseShouldNotMatch() {
		OnEnabledDevtoolsConditionTests.this.context.refresh();
		assertThat(OnEnabledDevtoolsConditionTests.this.context.containsBean("test"))
				.isFalse();
	}

	@Configuration(proxyBeanMethods = false)
	static class TestConfiguration {

		@Bean
		@Conditional(OnEnabledDevtoolsCondition.class)
		public String test() {
			return "hello";
		}

	}

}


text:
package com.github.jioong.impl;

import org.glassfish.hk2.api.HK2RuntimeException;
import org.glassfish.hk2.api.ServiceLocator;
import org.glassfish.hk2.api.ServiceLocatorFactory;
import org.junit.Before;
import org.junit.Test;

import javax.inject.Inject;

public class MyServiceImplTest {
    private ServiceLocator serviceLocator;

    @Inject
    private MyServiceImpl serv;
    @Before
    public void setUp() {

        //针对单个类或接口
        serviceLocator = ServiceLocatorFactory.getInstance().create("Test");
        Populator.populator(serviceLocator);
    }

    @Test
    public void testSayHello() {
        MyServiceImpl myService = serviceLocator.getService(MyServiceImpl.class);
        myService.sayHello();
    }

/*    @Test
    public void testAnnotation() {
        System.out.println("-------");
        serv.sayHello();
    }*/

}


text:
C+ cal_init_soln

       subroutine cal_init_soln( m, n, ia, nn, s )
C      -------------------------------------------
C
C Initialise aerial arrays for solution of telescope gains
C
C Given:
C   number of visibilities
       integer     m
C   number of aerials
       integer     n
C Updated:
C   aerial list for each visbility
       integer*2   ia(2,m)
C Returned:
C   number of non-redundant aerials
       integer     nn
C   error status
       integer     s
C
C The aerial matrix array and its transpose are initialised.  The aerial
C matrix (and transpose) are to be considered as matrices based on aerial
C index numbers, where the aerials participating in the solution are
C numbered 1 to number_of_aerials_in_solution.  The number of aerials used
C is returned to the calling program.
*-
       include '/mrao/post/include/global_constants.inc'
       include '/mrao/post/include/cal_common.inc'
       include '/mrao/post/include/cal_ae_matrix.inc'

       integer*2   index_list(max_aes)

C local variables (counters)
       integer   i, j, ii

C check status on entry
       if (s.ne.0) return

C initialise the index array between actual aerials and those to be used
C in the solution
       do j=1,n
         index_list(j) = 0
         ae_list(j) = 0
       end do
C construct index array
       do i=1,m
         index_list(ia(1,i)) = ia(1,i)
         index_list(ia(2,i)) = ia(2,i)
       end do
       nn = 0
       do j = 1,n
         if (index_list(j).gt.0) then
           nn = nn + 1
           index_list(j) = nn
           ae_list(nn) = j
         end if
       end do

C define the aerial matrix
       do i=1,m
         do j = 1,2
           mat(j,i) = index_list(ia(j,i))
         end do
       end do

C construct the transpose matrix, again in terms of index numbers
C .. the matrix is not fully represented but is held in redundant form
C .. (i.e. only non-zero elements are referenced).  TMAT(0,n) is the
C .. number of non-zero entries in row n.  sign(1,TMAT(i,n))
C .. gives the matrix element value of row n column abs(TMAT(i,n)).
       do j=1,nn
         tmat(0,j) = 0
         do i=1,m
           if (mat(1,i).eq.j) then
             tmat(0,j) = tmat(0,j) + 1
             ii = tmat(0,j)
             tmat(ii,j) = i
           end if
           if (mat(2,i).eq.j) then
             tmat(0,j) = tmat(0,j) + 1
             ii = tmat(0,j)
             tmat(ii,j) = -i
           end if
         end do
       end do

C set flag indicating that the aerial matrix has been initialised
       matrix_initialised = .true.

C change cal_refant to an aerial index value
       refant = index_list( cal_refant )

C report any errors
       if (s.ne.0) call cal_wrerr( s, 'in cal_init_soln' )

       end


text:
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;

namespace BooksAPI.Core
{
    public class BookUserManager : UserManager<IdentityUser>
    {
        public BookUserManager() : base(new BookUserStore())
        {
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>{{tag.tagName}}</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="{{siteDescription}}" />
    <link rel="shortcut icon" href="static/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="../static/css/libs/bootstrap.css" media="screen,handheld,print" />
    <link rel="stylesheet" href="../static/css/typography.css" media="screen,handheld,print" />
    <link rel="stylesheet" href="../static/css/basic.css" media="screen,handheld,print" />
    <link rel="stylesheet" href="../static/css/mobile.css" media="only screen and (min-width: 320px) and (max-width:719px)" />
    <link rel="stylesheet" href="../static/css/desktop.css" media="only screen and (min-width: 720px)" />

{{tag.tagName}}

            {{#tagEntries}}

{{title}}

Posted

<time>{{displayDate}}</time>

By

{{#authors}}{{.}}{{/authors}}

Tags

                        {{#tags}}
                            {{tagName}}
                        {{/tags}}

{{description}}

            {{/tagEntries}}


text:
FIND_PATH( GLEE_INCLUDE_DIRS GLee.h /usr/include /usr/local/include /usr/include/GL $ENV{INCLUDE} )
FIND_LIBRARY( GLEE_LIBRARIES NAMES GLee glee PATHS /usr/lib /usr/local/lib )

IF(GLEE_INCLUDE_DIRS)
	MESSAGE(STATUS "Found GLEE include dir: ${GLEE_INCLUDE_DIRS}")
ELSE(GLEE_INCLUDE_DIRS)
	MESSAGE(STATUS "Could NOT find GLEE headers.")
ENDIF(GLEE_INCLUDE_DIRS)

IF(GLEE_LIBRARIES)
	MESSAGE(STATUS "Found GLEE library: ${GLEE_LIBRARIES}")
ELSE(GLEE_LIBRARIES)
	MESSAGE(STATUS "Could NOT find GLEE library.")
ENDIF(GLEE_LIBRARIES)

IF(GLEE_INCLUDE_DIRS AND GLEE_LIBRARIES)
	SET(GLEE_FOUND "YES")
ELSE(GLEE_INCLUDE_DIRS AND GLEE_LIBRARIES)
	SET(GLEE_FOUND "NO")
	IF(GLEE_FIND_REQUIRED)
		MESSAGE(FATAL_ERROR "Could not find GLEE. Please install GLEE")
	ENDIF(GLEE_FIND_REQUIRED)
ENDIF(GLEE_INCLUDE_DIRS AND GLEE_LIBRARIES)


text:
const locale = {
  placeholder: 'Velg tid',
};

export default locale;


text:
name: Bug Report
about: Report errors and problems
title: ''
labels: Bug
assignees: ''

---

**Package version**: x.y.z

**Description**

<!--
A clear and concise description of what the bug is and why you believe it's a bug.
-->

**To Reproduce**

<!--
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
-->

**Additional Context**

<!-- Optional: Any other context to help understanding the problem: log messages, screenshots, etc. -->


text:
#include "Tweeno/Tween.h"
#include "Tweeno/Repeat.h"
#include "Tweeno/Easing/Linear.h"
#include "Tweeno/Easing/Type.h"

#include <iostream>

/**
 * @namespace Tweeno
 * @brief The tweeno namespace
 */
namespace Tweeno {

/**
 * @brief Create a new tween object
 *
 * @param from Initial value of the tween
 * @param to End value of the tween
 */
Tween::Tween(float from, float to): _start_value(from), _current_value(from), _end_value(to), _duration(0), _timescale(1.f), _f_target(nullptr), _i_target(nullptr), _easing(Easing::Linear::easeNone), _repeat(Repeat::NONE) {
	start();
}

/**
 * @brief Create a tween without values
 * @details Create a new tween with empty values that may be set later
 */
Tween::Tween(): Tween(0, 0) { }

/**
 * @brief Set the tween to it initial values
 * @details Restarts the tween
 */
void Tween::start() {
	_paused = false;
	_current_time = 0.f;
	_current_value = _start_value;
	_repeat_delay_elapsed = 0;
}

/**
 * @brief Invert values of the tween
 * @details Invert values of the tween, used when Tween::repeat() is set as Repeat::YOYO
 */
void Tween::invert() {
	_current_time = _duration-_current_time;

	std::swap(_start_value, _end_value);

	if (_easing_back) {
		std::swap(_easing_back, _easing);
	}
}

/**
 * @brief Update the tween
 * @details Update the tween using delta time
 *
 * @param delta The delta time to update in seconds
 */
void Tween::update(float delta) {
	// Do not update if tween is paused or already finished
	if (is_paused() || is_finished()) {
		return;
	}
	// see Tween::set_timescale()
	_current_time = _current_time+delta*_timescale;

	// If current tween just finished
	if (is_finished()) {
		// and _repeat is set to YOYO or LOOP
        if (_repeat != Repeat::NONE) {
    		// wait the delay to repeat
    		if (_repeat_delay_elapsed < _repeat_delay) {
    			_repeat_delay_elapsed += delta*_timescale;
    		}
    		// when delay time is reached
    		else {
    			// Invert values and restart in case of YOYO repeat type
    			if (_repeat == Repeat::YOYO) {
    				invert();
    				start();
    			}
    			// Only restart, in case of Repeat::LOOP
    			else {
    				start();
    			}
    		}
    	}
	}

	// Update the tween value using the specified easing function
	_current_value = _easing(_current_time, _start_value, _end_value-_start_value, _duration);

	// if is set a target (either int or float)
	// update it with the current value
	if (_f_target != nullptr) {
		*_f_target = _current_value;
	}
	if (_i_target != nullptr) {
		*_i_target = _current_value;
	}

	// if is set a function to call in each update
	if (_on_update_callback) {
		// call it
		_on_update_callback(_current_value);
	}
	// check again if is finished so it is called once
	// and if is set a function to call when the tween ends
	if (is_finished() && _on_complete_callback) {
		// call it
		_on_complete_callback();
	}
}

/**
 * @brief Set the initial value of the tween
 *
 * @param from Initial value
 * @return The tween object, for method chaining
 */
Tween* Tween::from(float from) {
	_start_value = from;
	_current_value = _start_value;

	return this;
}

/**
 * @brief Set the end value of the tween
 *
 * @param to End value
 * @return The tween object, for method chaining
 */
Tween* Tween::to(float to) {
	_end_value = to;

	return this;
}

/**
 * @brief Set the easing function
 * @details Set the easing function to use
 *
 * @code
 * using namespace Tweeno;
 * Tween* t1 = new Tween(0, 150); // from 0 to 150 (float)
 *
 * // default easings included
 * t1->easing(Easing::Linear::easeNone);
 * t1->easing(Easing::Bounce::easeOut);
 *
 * // or you can create your own
 * t1->easing([](float t,float b , float c, float d) {
 * 		//stuff
 * });
 * @endcode
 *
 * @param easing Easing function, can be one of the included ones of created manually using std::function<float (float, float, float, float)>
 * @return The tween object, for method chaining
 */
Tween* Tween::easing(easing_function easing) {
	_easing = easing;

	return this;
}

/**
 * @brief Set the easing function when the tween is going back
 * @details Set the easing function when the tween is going back, used only when repeat is set to Repeat::YOYO
 *
 * @param easing_back Easing function, can be one of the included ones of created manually using std::function<float (float, float, float, float)>
 * @return The tween object, for method chaining
 */
Tween* Tween::easing_back(easing_function easing_back) {
	_easing_back = easing_back;

	return this;
}

/**
 * @brief Set the repeat type
 *
 * @param r The repeat type
 * - Tweeno::Repeat::NONE to not repeat
 * - Tweeno::Repeat::LOOP to repeat
 * - Tweeno::Repeat::YOYO to repeat back and forward
 *
 * @return The tween object, for method chaining
 */
Tween* Tween::repeat(Repeat r) {
	_repeat = r;

	return this;
}

/**
 * @brief Set delay time to wait until the tween repeats
 *
 * @param seconds Time to wait, in seconds
 * @return The tween object, for method chaining
 */
Tween* Tween::repeat_delay(float seconds) {
	_repeat_delay = seconds;

	return this;
}

/**
 * @brief Set the duration of the tween
 *
 * @param seconds The duration, in seconds
 * @return The tween object, for method chaining
 */
Tween* Tween::set_duration(float seconds) {
	_duration = seconds;

	return this;
}

/**
 * @brief Get the _duration of the tween
 *
 * @return The _duration
 */
float Tween::get_duration() {
	return _duration;
}

/**
 * @brief Set the current time of the tween
 *
 * @param seconds The current time to be set
 * @return The tween object, for method chaining
 */
Tween* Tween::seek(float seconds) {
	_current_time = seconds;
	update(0);
	return this;
}

/**
 * @brief Get the current time of the tween
 *
 * @return The current time (float), in seconds
 */
float Tween::current_time() {
	return _current_time;
}

/**
 * @brief Check if the tween is already finished
 *
 * @return True if already finished, false otherwise
 */
bool Tween::is_finished() {
	return _current_time > _duration;
}

/**
 * @brief Alias to Tween::is_finished()
 */
bool Tween::is_completed() {
	return is_finished();
}

/**
 * @brief Check if tween is still running
 *
 * @return True if tween is running, false otherwise
 */
bool Tween::is_running() {
	return ! is_finished();
}

/**
 * @brief Set the target float variable to update
 *
 * @code
 * using namespace Tweeno;
 * Tween* t1 = new Tween(100, 150);
 *
 * float x; // the variable we want to update
 *
 * t1->target(&x); // now on every update the variable x will change
 * @endcode
 *
 * @param target Pointer to the float variable
 * @return The tween object, for method chaining
 */
Tween* Tween::target(float* target) {
	_f_target = target;

	return this;
}

/**
 * @brief Set the target int variable to update
 *
 * @param target Pointer to the int variable
 * @return The tween object, for method chaining
 */
Tween* Tween::target(int* target) {
	_i_target = target;

	return this;
}

/**
 * @brief Get the current value of the twee
 *
 * @return The current value
 */
float Tween::value() {
	return _current_value;
}

/**
 * @brief Pauses the tween
 */
void Tween::pause() {
	_paused = true;
}

/**
 * @brief Resumes the tween
 */
void Tween::resume() {
	_paused = false;
}

/**
 * @brief Checks if the tween is _paused
 *
 * @return True if is _paused, false otherwise
 */
bool Tween::is_paused() {
	return _paused;
}

/**
 * @brief Get current progress of tween
 *
 * @return The current progress, going from 0.f to 1.f
 */
float Tween::get_progress() {
	return _current_time / _duration;
}

/**
 * @brief Set the progress of the tween
 *
 * @param progress The progress, going from 0.f to 1.f
 * @return The tween object, for method chaining
 */
Tween* Tween::set_progress(float progress) {
	_current_time = _duration*progress;
	update(0);
	return this;
}

/**
 * @brief Get the time scale
 *
 * @return The time scale set
 */
float Tween::get_timescale() {
	return _timescale;
}

/**
 * @brief Set the time scale of the tween (default 1)
 * @details The time scale modifies the delta time passed to Tween::update(dt), making dt = dt*_timescale
 *
 * @param t The time scale to be set
 * @return The tween object, for method chaining
 */
Tween* Tween::set_timescale(float t) {
	_timescale = t;
	return this;
}

/**
 * @brief Set the function to be called in each update
 *
 * @code
 * using namespace Tweeno;
 * Tween* t1 = new Tween();
 *
 * t1->on_update([](float value) {
 * 		// this will be called on each update
 * 		// you can log the value or manually update a variable using the new value
 * });
 * @endcode
 *
 * @param callback The callback
 */
void Tween::on_update(std::function<void (float)> callback) {
	_on_update_callback = callback;
}

/**
 * @brief Set the callback to be called when the tween finishes
 *
 * @code
 * using namespace Tweeno;
 * Tween* t1 = new Tween();
 *
 * t1->on_complete([](){
 * 		// will be called when the tweening ends
 * });
 *
 * @endcode
 *
 * @param callback The callback
 */
void Tween::on_complete(std::function<void ()> callback) {
	_on_complete_callback = callback;
}

}


text:
package org.darkstorm.darkbot.minecraftbot.event.protocol.server;

public class ObjectEntitySpawnEvent extends RotatedEntitySpawnEvent {
	private final ObjectSpawnData spawnData;

	public ObjectEntitySpawnEvent(int entityId, RotatedSpawnLocation location, ObjectSpawnData spawnData) {
		super(entityId, location);

		this.spawnData = spawnData;
	}

	public ObjectSpawnData getSpawnData() {
		return spawnData;
	}

	public static class ObjectSpawnData {
		private final int type;

		public ObjectSpawnData(int type) {
			this.type = type;
		}

		public int getType() {
			return type;
		}
	}

	public static class ThrownObjectSpawnData extends ObjectSpawnData {
		private final int throwerId;
		private final double speedX, speedY, speedZ;

		public ThrownObjectSpawnData(int type, int throwerId, double speedX, double speedY, double speedZ) {
			super(type);

			this.throwerId = throwerId;
			this.speedX = speedX;
			this.speedY = speedY;
			this.speedZ = speedZ;
		}

		public int getThrowerId() {
			return throwerId;
		}

		public double getSpeedX() {
			return speedX;
		}

		public double getSpeedY() {
			return speedY;
		}

		public double getSpeedZ() {
			return speedZ;
		}
	}
}


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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <Button
        android:id="@+id/button"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="嵌套 Fragment Demo"
        android:onClick="fragmentDemo"/>

    <Button
        android:id="@+id/button2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:text="ViewPager demo"
        android:onClick="viewPageDemo"/>
</LinearLayout>


text:
package priceHistory;

public class ListedStockTO {

	private final String ticker;
	private final String fullName;
	private boolean isWatchlisted;

	public ListedStockTO( String p_ticker, String p_fullName, boolean p_isWatchlisted ) {
		ticker = p_ticker;
		fullName = p_fullName;
		isWatchlisted = p_isWatchlisted;
	}

	public ListedStockTO( String p_ticker, String p_fullName ) {
		this( p_ticker, p_fullName, false );
	}

	@Override
	public String toString() {
		return ticker;
	}

	public String getTicker() {
		return ticker;
	}

	public String getFullname() {
		return fullName;
	}

	public boolean isWatchlisted() {
		return isWatchlisted;
	}
	public void setIsWatchListed( boolean p_isWatchlisted ) {
		isWatchlisted = p_isWatchlisted;
	}

}


text:
define({
  "selectLayer": "Pasirinkti suvestinės sluoksnį",
  "filterField": "Suvestinės sluoksnio filtro laukas",
  "count": "KIEKIS",
  "sum": "SUMA",
  "min": "MIN.",
  "max": "MAKS.",
  "avg": "VID.",
  "addField": "Pridėti suvestinės lauką",
  "label": "Žymė",
  "type": "Tipas",
  "field": "Laukas",
  "actions": "Veiksmai",
  "displayCluster": "Rodyti suvestinės grupes",
  "showFeatureCount": "Rodyti elementų skaičių",
  "featureCountLabel": "Elementų skaičiaus žymė",
  "missingLayerInWebMap": "Įtraukti suvestinės sluoksnius į internetinį žemėlapį."
});


text: Simulations of mate choice with information filtering.


text:
module Hours
  def self.helpful_url
    ENV["HELPFUL_URL"]
  end

  def self.helpful_account
    ENV["HELPFUL_ACCOUNT"]
  end

  def self.helpful_enabled?
    if Hours.helpful_url.try(:empty) || Hours.helpful_account.try(:empty?)
      fail <<-MSG
      Helpful account not onfigured,
      to disable helpful support remove
      the HELPFUL_URL and HELPFUL_ACCOUNT env variables and restart your server.
      If you do wish to enable support, please configure these.
      MSG
    elsif !Hours.helpful_url && !Hours.helpful_account
      false
    else
      true
    end
  end

  def self.single_tenant_mode?
    ENV["SINGLE_TENANT_MODE"] == "true" ? true : false
  end

  def self.cache_id
    @@cache_id ||= Time.current.to_s
  end
end


text:
<footer class="site-footer">
  <p>© 2015, Daniel McBrayer</p>
</footer>


text:
#include "stdhdr.h"
#include "helo.h"
#include "missile.h"
#include "misslist.h"
#include "bomb.h"
#include "bombfunc.h"
#include "PilotInputs.h"
#include "fsound.h"
#include "soundfx.h"
#include "simsound.h"
#include "falcmesg.h"
#include "sms.h"
#include "fcc.h"
#include "guns.h"
#include "MsgInc\WeaponFireMsg.h"
#include "campbase.h"
#include "Simdrive.h"
#include "Graphics\Include\drawsgmt.h"
#include "otwdrive.h"
#include "sfx.h"
#include "falcsess.h"
#include "fakerand.h"
#include "camp2sim.h"
#include "object.h"
#include "Graphics/Include/drawparticlesys.h"

extern int tgtId;

void HelicopterClass::DoWeapons (void)
{
int fireFlag;
// MissileClass* theMissile;
Tpoint pos, vec;

   // Guns
   fireFlag = fireGun;
   if (Guns)
   {
      Guns->Exec(&fireFlag, gunDmx, &platformAngles, targetPtr, FALSE);

      if (fireFlag)
      {
#ifdef MLR_NEWSNDCODE
		  SoundPos.Sfx( SFX_MCGUN );
#else
		 F4SoundFXSetPos( SFX_MCGUN, 0, XPos(), YPos(), ZPos(), 1.0f , 0 , XDelta(),YDelta(),ZDelta());
#endif

		pos.x = XPos();
		pos.y = YPos();
		// RV - Biker - Adjust gun smoke position
		//pos.z = ZPos() - 5.0f;
		pos.z = ZPos() + 1.0f + offsetZ;

		vec.x = PRANDFloat() * 30.0f;
		vec.y = PRANDFloat() * 30.0f;
		vec.z = -PRANDFloatPos() * 30.0f;

		//RV - I-Hawk - changing all LIGHT_CLOUD weapons effects calls
		// to more appropriate GUN_SMOKE effect here
		/*
		OTWDriver.AddSfxRequest(
			new SfxClass ( SFX_GUN_SMOKE,		// type
			SFX_MOVES,
			&pos,					// world pos
			&vec,					// vel vector
			2.3f,					// time to live
			2.0f ) );				// scale
			*/
		DrawableParticleSys::PS_AddParticleEx((SFX_GUN_SMOKE + 1),
												&pos,
												&vec);

         if (!IsFiring())
         {
            // KCK: This has been moved to GunClass::Exec, since that's where we generate
            // new bullets
//            SendFireMessage ((SimWeaponClass*)Guns, FalconWeaponsFire::GUN, TRUE, targetPtr);

			#ifdef _DEBUG
			SimVehicleClass *theObject;
			if ( targetPtr )
			{
				theObject = (SimVehicleClass *)targetPtr->BaseData();
/*				if ( theObject->IsAirplane() )
					MonoPrint( "HELO BRAIN Firing Guns at Air Unit\n" );
				else if ( theObject->IsHelicopter() )
					MonoPrint( "HELO BRAIN Firing Guns at Helo Unit\n" );
				else if ( theObject->IsGroundVehicle() )
					MonoPrint( "HELO BRAIN Firing Guns at Ground Unit\n" );
*/			}
			#endif
         }
         SetFiring(TRUE);
      }
      else
      {
         if (IsFiring())
         {
            SendFireMessage ((SimWeaponClass*)Guns, FalconWeaponsFire::GUN, FALSE, targetPtr);
         }
         SetFiring(FALSE);
      }
   }

   /*
   ** edg: no more FCC stuff here.  All done in hdigi now
   if ( FCC->releaseConsent && Sms->curWeapon )
   {
	   if (FCC->GetMasterMode() == FireControlComputer::Missile ||
		   FCC->GetMasterMode() == FireControlComputer::Dogfight ||
		   FCC->GetMasterMode() == FireControlComputer::MissileOverride)
	   {
			 theMissile = (MissileClass *)Sms->curWeapon;
			 if (Sms->LaunchMissile())
			 {
				SendFireMessage ((SimWeaponClass*)theMissile, FalconWeaponsFire::SRM, TRUE, targetPtr);

			   	fireMissile = FALSE;
			   	F4SoundFXSetPos( SFX_MISSILE1, 0, XPos(), YPos(), ZPos(), 1.0f );
			 }

	   }
	   else if (FCC->GetMasterMode() == FireControlComputer::AirGroundMissile)
	   {
			 theMissile = (MissileClass *)Sms->curWeapon;
			 if (Sms->LaunchMissile())
			 {
				SendFireMessage ((SimWeaponClass*)theMissile, FalconWeaponsFire::AGM, TRUE, targetPtr);

				fireMissile = FALSE;
				F4SoundFXSetPos( SFX_MISSILE2, 0, XPos(), YPos(), ZPos(), 1.0f );
			 }

	   }
      else if (FCC->GetMasterMode() == FireControlComputer::AirGroundBomb &&
         FCC->GetSubMode() == FireControlComputer::RCKT)
      {
         if (FCC->bombPickle && Sms->curWeapon && !OnGround())
         {
            // Play the sound
            F4SoundFXSetPos( SFX_RCKTLOOP, TRUE, XPos(), YPos(), ZPos(), 1.0f );

			theMissile = (MissileClass *)Sms->curWeapon;

            if (Sms->LaunchRocket())
            {

               // Stop firing
               FCC->bombPickle = FALSE;
               FCC->postDrop = TRUE;

               // Play the sound
               F4SoundFXSetPos( SFX_MISSILE3, TRUE, XPos(), YPos(), ZPos(), 1.0f );

               // Drop a message
               SendFireMessage (theMissile, FalconWeaponsFire::Rocket, TRUE, targetPtr);
            }
         }
      }
   }
   */

   /*
   else if (FCC->GetMasterMode() == FireControlComputer::AirGroundBomb)
   {
      curWeapon = Sms->curWeapon;
      if (FCC->bombPickle)
      {
         SendFireMessage ((SimWeaponClass*)curWeapon, FalconWeaponsFire::BMB, TRUE, targetPtr);
         if (Sms->DropBomb())
         {
            FCC->bombPickle = FALSE;
            FCC->postDrop = TRUE;
         }
      }
   }
   */

   // Handle missiles launched but still on the rail
	Sms->Exec();
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <name>Yar RPC client</name>
    <description>A simple Java client for Yar RPC framework</description>

    <groupId>com.starlight36</groupId>
    <artifactId>yar-client</artifactId>
    <version>0.1.4</version>

    <packaging>jar</packaging>
    <url>https://github.com/starlight36/yar-client-java/</url>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:https://github.com/starlight36/yar-client-java.git</connection>
        <developerConnection>scm:git:git@github.com:starlight36/yar-client-java.git</developerConnection>
        <url>scm:git:https://github.com/starlight36/yar-client-java.git</url>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/starlight36/yar-client-java/issues</url>
    </issueManagement>

    <developers>
        <developer>
            <id>starlight36</id>
            <name>Max Liu</name>
            <email>me@starlight36.com</email>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <id>ailis-releases</id>
            <name>Ailis Maven Releases</name>
            <url>http://nexus.ailis.de/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.3.6</version>
        </dependency>

        <dependency>
            <groupId>de.ailis.pherialize</groupId>
            <artifactId>pherialize</artifactId>
            <version>1.2.1</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.4.4</version>
        </dependency>

        <dependency>
            <groupId>org.msgpack</groupId>
            <artifactId>msgpack</artifactId>
            <version>0.6.12</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.eluder.coveralls</groupId>
                <artifactId>coveralls-maven-plugin</artifactId>
                <version>3.1.0</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <format>xml</format>
                    <maxmem>256m</maxmem>
                    <!-- aggregated reports for multi-module projects -->
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>


text:
package rtp

type StreamConfiguration struct {
	Command SessionControlCommand `tlv8:"1"`
	Video   VideoParameters       `tlv8:"2"`
	Audio   AudioParameters       `tlv8:"3"`
}

const (
	SessionControlCommandTypeEnd         byte = 0
	SessionControlCommandTypeStart            = 1
	SessionControlCommandTypeSuspend          = 2
	SessionControlCommandTypeResume           = 3
	SessionControlCommandTypeReconfigure      = 4
)

type SessionControlCommand struct {
	Identifier []byte `tlv8:"1"` // docu says 16 bytes but overall size of SessionControlCommand is also 16 bytes?
	Type       byte   `tlv8:"2"`
}

type VideoParameters struct {
	CodecType   byte                 `tlv8:"1"`
	CodecParams VideoCodecParameters `tlv8:"2"`
	Attributes  VideoCodecAttributes `tlv8:"3"`
	RTP         RTPParams            `tlv8:"4"`
}

type AudioParameters struct {
	CodecType    byte                 `tlv8:"1"`
	CodecParams  AudioCodecParameters `tlv8:"2"`
	RTP          RTPParams            `tlv8:"3"`
	ComfortNoise bool                 `tlv8:"4"`
}

type RTPParams struct {
	PayloadType             uint8   `tlv8:"1"`
	Ssrc                    int32   `tlv8:"2"`
	Bitrate                 uint16  `tlv8:"3"`
	Interval                float32 `tlv8:"4"` // MinimumRTCP interval
	ComfortNoisePayloadType uint8   `tlv8:"5"` // only for audio
	MTU                     uint16  `tlv8:"6"` // only for video
}


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tt195361.Casl2Simulator;
using Tt195361.Casl2Simulator.Utils;

namespace Tt195361.Casl2SimulatorTest.Utils
{
    /// <summary>
    /// <see cref="ArgChecker"/> クラスの単体テストです。
    /// </summary>
    [TestClass]
    public class ArgCheckerTest
    {
        /// <summary>
        /// <see cref="ArgChecker.CheckRange"/> メソッドの単体テストです。
        /// </summary>
        [TestMethod]
        public void CheckRange()
        {
            CheckCheckRange(-1, 0, 32767, false, "値が最小より小さい => 失敗");
            CheckCheckRange(0, 0, 32767, true, "値が最小と等しい => 成功");
            CheckCheckRange(32767, 0, 32767, true, "値が最大と等しい => 成功");
            CheckCheckRange(32768, 0, 32767, false, "値が最大より大きい => 失敗");
        }

        private void CheckCheckRange(Int32 value, Int32 min, Int32 max, Boolean success, String message)
        {
            Check(
                () => ArgChecker.CheckRange(value, min, max, nameof(value)),
                success, message);
        }

        /// <summary>
        /// <see cref="ArgChecker.CheckGreaterEqual メソッドの単体テストです。
        /// </summary>
        [TestMethod]
        public void CheckGreaterEqual()
        {
            CheckCheckGreaterEqual(7, 6, true, "7 > 6 => 成功");
            CheckCheckGreaterEqual(6, 6, true, "6 == 6 => 成功");
            CheckCheckGreaterEqual(5, 6, false, "5 < 6 => 失敗");
        }

        private void CheckCheckGreaterEqual(
            Int32 greaterValue, Int32 lesserValue, Boolean success, String message)
        {
            Check(
                () => ArgChecker.CheckGreaterEqual(
                        greaterValue, lesserValue, nameof(greaterValue), nameof(lesserValue)),
                success, message);
        }

        /// <summary>
        /// <see cref="ArgChecker.CheckNotNull メソッドの単体テストです。
        /// </summary>
        [TestMethod]
        public void CheckNotNull()
        {
            Object noneNullObj = new Object();

            CheckCheckNotNull(noneNullObj, true, "null でないオブジェクト => OK");
            CheckCheckNotNull(null, false, "null => 例外");
        }

        private void CheckCheckNotNull(Object obj, Boolean success, String message)
        {
            Check(
                () => ArgChecker.CheckNotNull(obj, nameof(obj)),
                success, message);
        }

        private void Check(Action checkAction, Boolean success, String message)
        {
            try
            {
                checkAction();
                Assert.IsTrue(success, message);
            }
            catch (Casl2SimulatorException)
            {
                Assert.IsFalse(success, message);
            }
        }
    }
}


text:
**Example of SignalR with F-Sharp (and Silverlight 5 or Javascript):**

- SignalR is a library (for web-based Publish/Subscribe -pattern) on top
  of WebSockets, which is HTML5 API that enables bi-directional communication
  between the browser and server. SignalR will fallback to other techniques and
  technologies when WebSockets are not available.
  [http://signalr.net/][1]

- F-Sharp (F#) is multiparadigm (functional-first) programming language
  mainly for .NET environment.
  [http://fsharp.org/][2]

- This sample uses Reactive Extensions 2.1 to communicate with SignalR,
  on both client and server side. Reactive Extensions is a library to
  compose asynchronous and event-based programs using observable
  collections and LINQ-style query operators.
  [http://msdn.microsoft.com/en-us/data/gg577609.aspx][3]

- For server side:
  This could work purely from F# as Owin ([http://owin.org/][4]) console application
  but now F#-server-side is called from an empty ASP.NET C# Web Application.
  (You can start OWin from F# Interactive...)

- For client side:
  Silverlight 5.0 application using F#-library
  and Silverlight 5.0 XAML/C# application to show the user interface.
  [http://www.silverlight.net][5]
  There is also jQuery/JavaScript test page, if you don't want to use Silverlight.

- This proof of concept/sample/tutorial/demo is developed with
  Visual Studio 2012. References are resolved via NuGet.
  F# compiler won't auto-restore packages on compile.
  **So go first to Tools -> Library Package Manager -> NuGet
  and press "Restore" to restore all the references, and then rebuild.**

- SignalR supports two kinds of connections: Hub and PersistentConnection
  Both are working with Silverlight and JavaScript.

  [1]: http://signalr.net/
  [2]: http://fsharp.org/
  [3]: http://msdn.microsoft.com/en-us/data/gg577609.aspx
  [4]: http://owin.org/
  [5]: http://www.silverlight.net


text:
module WriteFiles where

import Control.Monad.RWS.Strict
import AI.UASI.Utils.StringTools
import Data.List
import Types
import Logging

l = "tundra.writefiles"

saveExtractedFs :: [TExtracted] -> Tundra [TExtracted]
saveExtractedFs xs = do
    info l "Saving extracted features to files"
    mapM_ saveExtracted xs
    info l "Done."
    return xs

saveExtracted :: TExtracted -> Tundra ()
saveExtracted TExtracted{..} = do
    Conf{..} <- ask
    let formatter (KoealaData{..},fs) = plotToString (fromIntegral $ koealaid ala, fs)
        content = unlines . map formatter $ samples
        fn      = targetPath++"extracted_"++extractionBranch++".txt"
    info l $ "Writing featureset to " ++ fn
    liftIO $ writeFile fn content

saveDataSets :: [TDataSet] -> Tundra [TDataSet]
saveDataSets xs = do
    info l "Saving processed datasets to files"
    mapM_ saveDataSet xs
    info l "Done."
    return xs

saveDataSet :: TDataSet -> Tundra ()
saveDataSet TDataSet{..} = do
    Conf{..} <- ask
    let formatter = plotToString
        content = unlines . map formatter
        fn t  = targetPath++"dataset_"++dataSetBranch++"_"++t++".txt"
    info l $ "Writing featuresets to " ++ fn "[train/test]" ++ ".txt"
    liftIO $ writeFile (fn "train") (content train)
    liftIO $ writeFile (fn "test") (content test)
    debug l $ concat ["Dataset; "
                     ,dataSetBranch
                     ,", train/test: "
                     ,show (length train)
                     ,"/"
                     ,show (length test)]


text:
package com.omnia.module.user.query.repository.impl;

import com.omnia.module.user.command.domain.User;
import com.omnia.module.user.query.repository.UserQueryRepository;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by khaerothe on 2015/4/29.
 */
@Repository
public class UserQueryRepositoryImpl implements UserQueryRepository {

    public static Map<String, User> inMemoryUser = new HashMap<>();
//
//    static{
//        inMemoryUser.put("bcf5e485-a81f-4b4b-ae12-3fd7c7c7ef73", new User("bcf5e485-a81f-4b4b-ae12-3fd7c7c7ef73", "zhangsan", "$2a$10$XjxLbHCP59ZImtMzZcGIbuER1Gtirnh90DqEKT5ZzlyKeg9FdGgGe"));
//    }
    public User getUserByName(String name){
        for(Map.Entry<String, User> entry : inMemoryUser.entrySet()){
            User user = entry.getValue();
            if(user.getUserName().equals(name)){
                return user;
            }
        }
        return null;
    }

    public User getUserById(String identifier){
        for(Map.Entry<String, User> entry : inMemoryUser.entrySet()){
            User user = entry.getValue();
            if(user.getIdentifier().equals(identifier)){
                return user;
            }
        }
        return null;
    }

//    public Map<String, User> getAllUsers(){
//        userRepository.
//    }

}


text:
require "reform"
require "reform/form/lotus"
require "minitest/autorun"

Reform::Contract.class_eval do
  include Reform::Contract::Validate
  include Reform::Form::Lotus
end

class LotusTest < Minitest::Spec
  Album = Struct.new(:title, :songs, :artist)

  class AlbumForm < Reform::Form

    property :title
    validates :title, presence: true

    property :songs do
      property :name
    end
  end

  it do
    form = AlbumForm.new(Album.new("Show Completo"))

    form.validate(title: "").must_equal false

    form.errors.to_s.must_equal ""
  end
end


text:
import { createStore } from 'redux';
import { combineReducers } from 'redux';

import categories from './reducers/categories';
import session from './reducers/session';
import itemReducer from './reducers/items';
import itemDetails from './reducers/itemDetails'
import geometry from './reducers/geometry';
import cart from './reducers/cart';

const reducers = combineReducers({
  categories,
  session,
  itemReducer,
  itemDetails,
  geometry,
  cart
});

window.store = null;

if (process.env.NODE_ENV !== 'production') {
    // Allow Redux devtools
    // https://github.com/zalmoxisus/redux-devtools-extension#usage
    window.store = createStore(
        reducers,
        window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__({
            actionsBlacklist: []
        }) // eslint-disable-line  no-underscore-dangle
    );
} else {
    window.store = createStore(reducers);
}

export default window.store;


text:
from datetime import datetime
from time import strftime
from time import localtime
from flask import Flask, render_template, session, redirect, url_for, flash
from flask.ext.script import Manager
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
from flask.ext.wtf import Form
from wtforms import SelectField, SubmitField
from wtforms.validators import Required

from utils import get_weather_json

app = Flask(__name__)
app.config['SECRET_KEY'] = 'hard to guess string'

manager = Manager(app)
bootstrap = Bootstrap(app)
moment = Moment(app)

class CityForm(Form):
    city = SelectField("City", choices=[(None, ""), ("newyork,us", "New York"),("naugatuck,us", "Naugatuck"),("sanfrancisco,us", "San Francisco")])
    submit = SubmitField('Submit')

@app.errorhandler(404)
def page_not_found(e):
    return render_template('404.html'), 404

@app.errorhandler(500)
def internal_server_error(e):
    return render_template('500.html'), 500

@app.route('/', methods=['GET', 'POST'])
def index():
    if app.test_request_context(method='POST'):
        form = CityForm(default=session.get('city'))
    else:
        form = CityForm()

    if form.validate_on_submit():
        old_city = session.get('city')
        session['city'] = form.city.data
        return redirect(url_for('index'))
    return render_template('index.html',
                           current_time=datetime.utcnow(),
                           weather_json=get_weather_json(session.get('city')),
                           strftime=strftime,
                           localtime=localtime,
                           form=form)

@app.route('/user/<name>')
def user(name):
    return render_template('user.html', name=name)

if __name__ == '__main__':
    manager.run()


text:
from file_system import FileSystem, FileNotFoundError, StatInfo
from future import Future

class TestFileSystem(FileSystem):
  '''A FileSystem backed by an object. Create with an object representing file
  paths such that {'a': {'b': 'hello'}} will resolve Read('a/b') as 'hello',
  Read('a/') as ['b'], and Stat determined by a value incremented via
  IncrementStat.
  '''

  # TODO(kalman): this method would be unnecessary if we injected paths properly
  # in ServerInstance.
  @staticmethod
  def MoveTo(base, obj):
    '''Returns an object as |obj| moved to |prefix|. That is,
    MoveTo('foo/bar', {'a': 'b'}) -> {'foo': {'bar': {'a': 'b'}}}
    '''
    result = {}
    leaf = result
    for k in base.split('/'):
      leaf[k] = {}
      leaf = leaf[k]
    leaf.update(obj)
    return result

  def __init__(self, obj):
    assert obj is not None
    self._obj = obj
    self._path_stats = {}
    self._global_stat = 0

  #
  # FileSystem implementation.
  #

  def Read(self, paths, binary=False):
    test_fs = self
    class Delegate(object):
      def Get(self):
        return dict((path, test_fs._ResolvePath(path)) for path in paths)
    return Future(delegate=Delegate())

  def _ResolvePath(self, path):
    def Resolve(parts):
      '''Resolves |parts| of a path info |self._obj|.
      '''
      result = self._obj.get(parts[0])
      for part in parts[1:]:
        if not isinstance(result, dict):
          raise FileNotFoundError(
              '%s at %s did not resolve to a dict, instead %s' %
              (path, part, result))
        result = result.get(part)
      return result

    def GetPaths(obj):
      '''Lists the paths within |obj|; this is basially keys() but with
      directory paths (i.e. dicts) with a trailing /.
      '''
      def ToPath(k, v):
        if isinstance(v, basestring):
          return k
        if isinstance(v, dict):
          return '%s/' % k
        raise ValueError('Cannot convert type %s to path', type(v))
      return [ToPath(k, v) for k, v in obj.items()]

    path = path.lstrip('/')

    if path == '':
      return GetPaths(self._obj)

    parts = path.split('/')
    if parts[-1] != '':
      file_contents = Resolve(parts)
      if not isinstance(file_contents, basestring):
        raise FileNotFoundError(
            '%s (%s) did not resolve to a string, instead %s' %
            (path, parts, file_contents))
      return file_contents

    dir_contents = Resolve(parts[:-1])
    if not isinstance(dir_contents, dict):
      raise FileNotFoundError(
          '%s (%s) did not resolve to a dict, instead %s' %
          (path, parts, dir_contents))

    return GetPaths(dir_contents)

  def Stat(self, path):
    read_result = self.Read([path]).Get().get(path)
    stat_result = StatInfo(self._SinglePathStat(path))
    if isinstance(read_result, list):
      stat_result.child_versions = dict(
          (file_result, self._SinglePathStat('%s%s' % (path, file_result)))
          for file_result in read_result)
    return stat_result

  def _SinglePathStat(self, path):
    return str(self._global_stat + self._path_stats.get(path, 0))

  #
  # Testing methods.
  #

  def IncrementStat(self, path=None):
    if path is not None:
      self._path_stats[path] = self._path_stats.get(path, 0) + 1
    else:
      self._global_stat += 1

  def GetIdentity(self):
    return self.__class__.__name__


text:
<?php declare(strict_types = 1);

namespace SlevomatCodingStandard\Sniffs\Classes;

use SlevomatCodingStandard\Sniffs\TestCase;

class ConstantSpacingSniffTest extends TestCase
{

	public function testNoErrors(): void
	{
		$report = self::checkFile(__DIR__ . '/data/constantSpacingNoErrors.php');
		self::assertNoSniffErrorInFile($report);
	}

	public function testErrors(): void
	{
		$report = self::checkFile(__DIR__ . '/data/constantSpacingErrors.php');

		self::assertSame(7, $report->getErrorCount());

		self::assertSniffError($report, 5, ConstantSpacingSniff::CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_CONSTANT);
		self::assertSniffError($report, 22, ConstantSpacingSniff::CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_CONSTANT);
		self::assertSniffError($report, 26, ConstantSpacingSniff::CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_CONSTANT);
		self::assertSniffError($report, 30, ConstantSpacingSniff::CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_CONSTANT);
		self::assertSniffError($report, 33, ConstantSpacingSniff::CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_CONSTANT);
		self::assertSniffError($report, 36, ConstantSpacingSniff::CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_CONSTANT);
		self::assertSniffError($report, 57, ConstantSpacingSniff::CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_CONSTANT);

		self::assertAllFixedInFile($report);
	}

	public function testErrorsWithModifiedLinesCount(): void
	{
		$report = self::checkFile(__DIR__ . '/data/constantSpacingErrors.php', [
			'minLinesCountBeforeWithComment' => 2,
			'maxLinesCountBeforeWithComment' => 2,
			'maxLinesCountBeforeWithoutComment' => 2,
		]);

		self::assertSame(2, $report->getErrorCount());

		self::assertSniffError($report, 5, ConstantSpacingSniff::CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_CONSTANT);
		self::assertSniffError($report, 26, ConstantSpacingSniff::CODE_INCORRECT_COUNT_OF_BLANK_LINES_AFTER_CONSTANT);
	}

	public function testInGlobalNamespaceNoErrors(): void
	{
		$report = self::checkFile(__DIR__ . '/data/constantSpacingInGlobalNamespaceNoErrors.php');
		self::assertNoSniffErrorInFile($report);
	}

}


text:
package me.anchore.io.nio;

import me.anchore.io.DoubleIo;

/**
 * @author anchore
 * @date 2018/7/21
 */
public class DoubleNio extends BaseAtomNio<Double> implements DoubleIo {
    public DoubleNio(NioConf conf) {
        super(conf);
    }

    @Override
    int getStep() {
        return 3;
    }

    @Override
    public Double get(long pos) {
        return getDouble(pos);
    }

    @Override
    public void put(long pos, Double val) {
        putDouble(pos, val);
    }

    @Override
    public double getDouble(long pos) {
        initBuf(getPage(pos));
        return buf.getDouble(getOffset(pos));
    }

    @Override
    public void putDouble(long pos, double val) {
        initBuf(getPage(pos));
        int offset = getOffset(pos);
        buf.putDouble(offset, val);

        setBufPosition(offset);
    }
}


text:
package sample.web;

import java.security.Principal;

import jakarta.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ModelAttribute;

/**
 * {@link ControllerAdvice} to expose user related attributes.
 *
 * @author Rob Winch
 */
@ControllerAdvice
public class SecurityControllerAdvise {

	@ModelAttribute("currentUserName")
	String currentUser(Principal principal) {
		return (principal != null) ? principal.getName() : null;
	}

	@ModelAttribute("httpSession")
	HttpSession httpSession(HttpSession httpSession) {
		return httpSession;
	}

}


text:
bower

## Build

    bower install
    npm install
    npm run build-css
    npm start

Open browser at http://localhost:7999/#/


text:
using FurryRun.Core.Enums;
using FurryRun.Core.FileTypes;
using FurryRun.Effects;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace FurryRun.Core
{
    public class MenuItem
    {
        private ContentManager _content;
        public ImageFile Image { get; private set; }
        public FadeImageEffect FadeEffect { get; private set; }
        public Action ExecuteAction { private set; get; }
        public LinkType LinkType { private set; get; }
        public bool IsVisible
        {
            get { return Image.IsVisible; }
            set { Image.IsVisible = value; }
        }
        public delegate void Action();

        public MenuItem(string text, LinkType linkType, Action executeAction)
        {
            LinkType = linkType;
            ExecuteAction = executeAction;
            FadeEffect = new FadeImageEffect{FadeSpeed = 1.0f};
            Image = new ImageFile{Text = text};
            Image.ActivateEffect(FadeEffect);
        }

        public virtual void LoadContent(ContentManager content)
        {
            _content = new ContentManager(content.ServiceProvider, "Content");
            Image.LoadContent(_content);
        }

        public virtual void UnloadContent()
        {
            Image.UnloadContent();
            _content.Dispose();
        }

        public virtual void Draw(SpriteBatch spriteBatch)
        {
            Image.Draw(spriteBatch);
        }

        public virtual void Update(GameTime gameTime)
        {
            Image.Update(gameTime);
        }
    }
}


text:
Rails.application.routes.draw do
  resources :patients do
    resources :diagnoses
  end
  resources :diagnoses, only: [] do
    resources :stages
  end
  root "patients#index"
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end


text:
import {ValidationService} from "../../../../both/service/ValidationService"

class ActivityAccessPassesComponent extends BlazeComponent {

  constructor() {
    super();
  }

  template() {
    return "activityAccessPasses"
  }

  events() {
    return [
      {
        "click .autoform-remove-item": this.manuallyRemoveAccessPass //because AutoForm doesn't do it
      }
    ]
  }

  activityDoc() {
    return this.data().parentInstance.data();
  }

  isUpdateAllowed() {
    return ValidationService.isUpdateAllowed(this.data().parentInstance.data().accessPassValidation.currentState);
  }

  autoFormType() {
    if (this.isReadOnly())
      return "readonly"
    return "update"
  }

  isReadOnly() {
    return !this.isUpdateAllowed();
  }

  accessPasses() {
    return this.data().parentInstance.data().accessPasses;
  }

  isAccessPointNotGranted(accessPoints, indexString) {
    var granted = false;
    for (i = 0; i < accessPoints.length; i++) {
      if (AccessPoints.findOne(accessPoints[i]).name == indexString) {
        granted = true;
      }
    }
    return !granted;
  }

  manuallyRemoveAccessPass(event) {
    var target = $(event.target);
    var accessPassIndex = parseInt($($($(target[0]).parents(".autoform-array-item")[0]).find("[data-schema-key]")[0]).data("schema-key").split(".")[1])
    console.log("accessPassIndex", accessPassIndex);

    Activities.update(this.parentComponent().data()._id,
      {$unset: {[`accessPasses.${accessPassIndex}`]: 1}}
    );
    Activities.update(this.parentComponent().data()._id,
      {$pull: {accessPasses: null}}
    );
  }
}

ActivityAccessPassesComponent.register("ActivityAccessPassesComponent");


text:
package org.springframework.cloud.dataflow.server.controller.assembler;

import org.springframework.cloud.dataflow.rest.resource.TaskDefinitionResource;
import org.springframework.cloud.dataflow.server.service.TaskExecutionService;

/**
 * Default REST resource assembler that returns the {@link TaskDefinitionResource} type.
 * @author Ilayaperumal Gopinathan
 */
public class DefaultTaskDefinitionAssemblerProvider implements TaskDefinitionAssemblerProvider<TaskDefinitionResource> {

	private final TaskExecutionService taskExecutionService;

	public DefaultTaskDefinitionAssemblerProvider(TaskExecutionService taskExecutionService) {
		this.taskExecutionService = taskExecutionService;
	}

	@Override
	public DefaultTaskDefinitionAssembler getTaskDefinitionAssembler(boolean enableManifest) {
		return new DefaultTaskDefinitionAssembler(taskExecutionService, enableManifest,
				TaskDefinitionResource.class);
	}
}