text:
This chapter gives an overview of how to build Cargo, make a change, and
submit a Pull Request.

1. [Check out the Cargo source.](#checkout-out-the-source)
2. [Building Cargo.](#building-cargo)
3. [Making a change.](#making-a-change)
4. [Writing and running tests.](../tests/index.md)
5. [Submitting a Pull Request.](#submitting-a-pull-request)
6. [The merging process.](#the-merging-process)

## Checkout out the source

We use the "fork and pull" model [described here][development-models], where
contributors push changes to their personal fork and [create pull requests] to
bring those changes into the source repository. Cargo uses [git] and [GitHub]
for all development.

1. Fork the [`rust-lang/cargo`] repository on GitHub to your personal account
   (see [GitHub docs][how-to-fork]).
2. Clone your fork to your local machine using `git clone` (see [GitHub
   docs][how-to-clone])
3. It is recommended to start a new branch for the change you want to make.
   All Pull Requests are made against the master branch.

## Building Cargo

Cargo is built by...running `cargo`! There are a few prerequisites that you
need to have installed:

* `rustc` and `cargo` need to be installed. Cargo is expected to build and
  test with the current stable, beta, and nightly releases. It is your choice
  which to use. Nightly is recommended, since some nightly-specific tests are
  disabled when using the stable release. But using stable is fine if you
  aren't working on those.
* A C compiler (typically gcc, clang, or MSVC).
* [git]
* Unix:
    * pkg-config
    * OpenSSL (`libssl-dev` on Ubuntu, `openssl-devel` on Fedora)
* macOS:
    * OpenSSL ([homebrew] is recommended to install the `openssl` package)

If you can successfully run `cargo build`, you should be good to go!

[homebrew]: https://brew.sh/

## Running Cargo

You can use `cargo run` to run cargo itself, or you can use the path directly
to the cargo binary, such as `target/debug/cargo`.

If you are using [`rustup`], beware that running the binary directly can cause
issues with rustup overrides. Usually, when `cargo` is executed as part of
rustup, the toolchain becomes sticky (via an environment variable), and all
calls to `rustc` will use the same toolchain. But when `cargo` is not run via
rustup, the toolchain may change based on the directory. Since Cargo changes
the directory for each compilation, this can cause different calls to `rustc`
to use different versions. There are a few workarounds:

* Don't use rustup overrides.
* Use `rustup run target/debug/cargo` to execute `cargo`.
* Set the `RUSTC` environment variable to a specific `rustc` executable (not
  the rustup wrapper).
* Create a [custom toolchain]. This is a bit of a hack, but you can create a
  directory in the rustup `toolchains` directory, and create symlinks for all
  the files and directories in there to your toolchain of choice (such as
  nightly), except for the `cargo` binary, which you can symlink to your
  `target/debug/cargo` binary in your project directory.

*Normally*, all development is done by running Cargo's test suite, so running
it directly usually isn't required. But it can be useful for testing Cargo on
more complex projects.

[`rustup`]: https://rust-lang.github.io/rustup/
[custom toolchain]: https://rust-lang.github.io/rustup/concepts/toolchains.html#custom-toolchains

## Making a change

Some guidelines on working on a change:

* All code changes are expected to comply with the formatting suggested by
  `rustfmt`. You can use `rustup component add rustfmt` to install `rustfmt`
  and use `cargo fmt` to automatically format your code.
* [Commit as you go][githelp].
* Include tests that cover all non-trivial code. See the [Testing chapter] for
  more about writing and running tests.
* All code should be warning-free. This is checked during tests.

## Submitting a Pull Request

After you have committed your work, and pushed it to GitHub, you can
open a Pull Request

* Push your commits to GitHub and create a pull request against Cargo's
  `master` branch.
* Include a clear description of what the change is and why it is being made.
* Use [GitHub's keywords] in the description to automatically link to an issue
  if the PR resolves the issue. For example `Closes #1234` will link issue
  #1234 to the PR. When the PR is merged, GitHub will automatically close the
  issue.

The [rust-highfive] bot will automatically assign a reviewer for the PR. It
may take at least a few days for someone to respond. If you don't get a
response in over a week, feel free to ping the assigned reviewer.

When your PR is submitted, GitHub automatically runs all tests. The GitHub
interface will show a green checkmark if it passes, or a red X if it fails.
There are links to the logs on the PR page to diagnose any issues. The tests
typically finish in under 30 minutes.

The reviewer might point out changes deemed necessary. Large or tricky changes
may require several passes of review and changes.

## The merging process

After a reviewer has approved your PR, they will issue a command to the [bors]
bot (also known as "Homu", the software that powers [`@bors`]). Bors will
create a temporary branch with your PR, and run all tests. Only if all tests
pass will it merge the PR to master. If it fails, the bot will leave a comment
on the PR. This system ensures that the master branch is always in a good
state, and that merges are processed one at a time. The [Homu queue
dashboard][homu-cargo] shows the current merge queue. Cargo's queue is rarely
busy, but a busy project like the [rust repo][homu-rust] is constantly full.

Assuming everything works, congratulations! It may take at least a week for
the changes to arrive on the nightly channel. See the [release chapter] for
more information on how Cargo releases are made.

[development-models]: https://help.github.com/articles/about-collaborative-development-models/
[create pull requests]: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request
[how-to-fork]: https://docs.github.com/en/github/getting-started-with-github/fork-a-repo
[`rust-lang/cargo`]: https://github.com/rust-lang/cargo/
[git]: https://git-scm.com/
[GitHub]: https://github.com/
[how-to-clone]: https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository
[githelp]: https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html
[Testing chapter]: ../tests/index.md
[GitHub's keywords]: https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue
[rust-highfive]: https://github.com/rust-highfive
[bors]: https://buildbot2.rust-lang.org/homu/
[`@bors`]: https://github.com/bors
[homu-cargo]: https://buildbot2.rust-lang.org/homu/queue/cargo
[homu-rust]: https://buildbot2.rust-lang.org/homu/queue/rust
[release chapter]: release.md


text:
The script utilizes python's pefile module to parse TimeDateStamp data points in a file header. TDSAnomalPE (TimeDateStamp plus a bad pun) compares identified data points to the compile time stored in the PE header. If there are discrepancies  between them, it identifies them as possible evidence of compile time manipulation. TDSAnomalPE also compares the checksum in the header to a calculated checksum to see if they match, since mismatched checksums could indicate header manipulation.

For more information on the methodology behind this script, visit [missmalware.com](http://missmalware.com/).

## Documentation and Use
Download the script and run it using Python.

To run the script from the command line and print the results: ``` python TDSAnomalPE.py [file path] ```

To run the script from a basic GUI: ``` python TDSAnomalPE.py ```

redpajama_set_name: RedPajamaGithub


text:
from tempest import config
from tempest.lib.common.utils import data_utils

from sahara.tests.tempest.scenario.data_processing.client_tests import base

TEMPEST_CONF = config.CONF

class ClusterTemplateTest(base.BaseDataProcessingTest):
    def _check_create_cluster_template(self):
        ng_template_name = data_utils.rand_name('sahara-ng-template')
        ng_template = self.create_node_group_template(ng_template_name,
                                                      **self.worker_template)

        full_cluster_template = self.cluster_template.copy()
        full_cluster_template['node_groups'] = [
            {
                'name': 'master-node',
                'flavor_id': TEMPEST_CONF.compute.flavor_ref,
                'node_processes': ['namenode'],
                'count': 1
            },
            {
                'name': 'worker-node',
                'node_group_template_id': ng_template.id,
                'count': 3
            }
        ]

        template_name = data_utils.rand_name('sahara-cluster-template')

        # create cluster template
        resp_body = self.create_cluster_template(template_name,
                                                 **full_cluster_template)

        # check that template created successfully
        self.assertEqual(template_name, resp_body.name)
        self.assertDictContainsSubset(self.cluster_template,
                                      resp_body.__dict__)

        return resp_body.id, template_name

    def _check_cluster_template_list(self, template_id, template_name):
        # check for cluster template in list
        template_list = self.client.cluster_templates.list()
        templates_info = [(template.id, template.name)
                          for template in template_list]
        self.assertIn((template_id, template_name), templates_info)

    def _check_cluster_template_get(self, template_id, template_name):
        # check cluster template fetch by id
        template = self.client.cluster_templates.get(
            template_id)
        self.assertEqual(template_name, template.name)
        self.assertDictContainsSubset(self.cluster_template, template.__dict__)

    def _check_cluster_template_update(self, template_id):
        values = {
            'name': data_utils.rand_name('updated-sahara-ct'),
            'description': 'description',
        }

        # check updating of cluster template
        template = self.client.cluster_templates.update(
            template_id, **values)
        self.assertDictContainsSubset(values, template.__dict__)

    def _check_cluster_template_delete(self, template_id):
        # delete cluster template by id
        self.client.cluster_templates.delete(
            template_id)

        # check that cluster template really deleted
        templates = self.client.cluster_templates.list()
        self.assertNotIn(template_id, [template.id for template in templates])

    def test_cluster_templates(self):
        template_id, template_name = self._check_create_cluster_template()
        self._check_cluster_template_list(template_id, template_name)
        self._check_cluster_template_get(template_id, template_name)
        self._check_cluster_template_update(template_id)
        self._check_cluster_template_delete(template_id)


text:
package sun.io;

import sun.nio.cs.ext.*;

public class ByteToCharCp937 extends ByteToCharDBCS_EBCDIC {

    // Return the character set id
    public String getCharacterEncoding() {
        return "Cp937";
    }

    public ByteToCharCp937() {
        super((DoubleByte.Decoder)new IBM937().newDecoder());
    }
}


text:
<?php

namespace Parfumix\FormBuilder\Elements;

class Image extends Input {

    protected $attributes = array(
        'type' => 'image',
    );

    /**
     * Render link
     *
     * @return string
     */
    public function render() {
        $result = $this->before;
        $result .= '<image ';
        $result .= $this->renderAttributes();
        $result .= '>';

        $result .= $this->after;

        return $result;
    }
}


text:
#ifndef TENSORFLOW_COMPILER_XLA_HLO_EVALUATOR_HLO_EVALUATOR_H_
#define TENSORFLOW_COMPILER_XLA_HLO_EVALUATOR_HLO_EVALUATOR_H_

#define _USE_MATH_DEFINES

#include <functional>
#include <memory>
#include <optional>

#include "absl/container/flat_hash_map.h"
#include "absl/container/node_hash_map.h"
#include "absl/types/span.h"
#include "tensorflow/compiler/xla/array2d.h"
#include "tensorflow/compiler/xla/literal.h"
#include "tensorflow/compiler/xla/literal_util.h"
#include "tensorflow/compiler/xla/service/dfs_hlo_visitor_with_default.h"
#include "tensorflow/compiler/xla/service/dynamic_dimension_inference.h"
#include "tensorflow/compiler/xla/service/hlo_computation.h"
#include "tensorflow/compiler/xla/service/hlo_instruction.h"
#include "tensorflow/compiler/xla/service/hlo_module.h"
#include "tensorflow/compiler/xla/service/shape_inference.h"
#include "tensorflow/compiler/xla/shape_util.h"
#include "tensorflow/compiler/xla/statusor.h"
#include "tensorflow/compiler/xla/util.h"
#include "tensorflow/compiler/xla/xla_data.pb.h"

namespace xla {

// Represents a parsed static while loop. We normalize the loop representation
// so that it starts from the induction_var_init_value and increments by
// step_size until it exceeds or goes below loop_bound.
struct ParsedStaticWhileLoop {
  // The number of iterations to be executed.
  int64_t trip_count = -1;
  // The tuple index of the induction variable in the while argument tuple.
  int64_t induction_var_index = -1;
  // The induction variable's initial value.
  int64_t induction_var_init_value = -1;
  // The induction variable is incremented by this number (could be negative)
  // in each iteration.
  int64_t step_size = -1;
  int64_t loop_bound = -1;
};

// Indicates whether a parsed while loop is static or dynamic. If the loop is
// static, it contains a value for StaticLoopInfo; otherwise the loop is
// dynamic. We consider a loop dynamic if its induction variable's initial
// value or the loop bound's value depends on the while's parent computation's
// parameter.
struct ParsedWhileLoop {
  std::optional<ParsedStaticWhileLoop> static_while_loop;
  bool is_dynamic() const { return !static_while_loop.has_value(); }
};
constexpr ParsedWhileLoop kParsedDynamicWhileLoop = ParsedWhileLoop();

// Tries to parse a while loop using a set of predefined patterns.
// Returns the parsing result.
std::optional<ParsedWhileLoop> PatternMatchParseWhileLoop(
    HloInstruction* while_op);

// Responsible for evaluating HLO and obtain literal as the evaluation results.
//
// This class is not thread-safe.
class HloEvaluator : public DfsHloVisitorWithDefault {
 public:
  // Only evaluate up to max_loop_iterations per while-loop execution if
  // specified.
  explicit HloEvaluator(int64_t max_loop_iterations = -1);

  // Called by the evaluator to create an embedded evaluator to execute a
  // sub-region of control flow. Subclasses should override this to return an
  // instance of the subclass instead.
  virtual std::unique_ptr<HloEvaluator> CreateEmbedded(
      int64_t max_loop_iterations) {
    return std::make_unique<HloEvaluator>(max_loop_iterations);
  }

  // Evaluates an HLO module and an array of pointers to literals.  Returns the
  // evaluated result as a literal if successful.
  //
  // Precondition: The indices of arg_literals correspond to the parameter
  // numbers of the HLO parameters in the computation. See comment below for an
  // example.
  //
  // (Dummy template arg is to reduce the overloading priority of one overload
  // so that Evaluate(module, {}) resolves unambiguously.)
  StatusOr<Literal> Evaluate(const HloModule& module,
                             absl::Span<const Literal* const> arg_literals) {
    return Evaluate(*module.entry_computation(), arg_literals);
  }
  template <typename Dummy = void>
  StatusOr<Literal> Evaluate(const HloModule& module,
                             absl::Span<const Literal> arg_literals) {
    return Evaluate(*module.entry_computation(), arg_literals);
  }

  // Evaluates an HLO computation and an array of pointers to literals.
  // Returns the evaluated result as a literal if successful.
  // Precondition: The indices of arg_literals correspond to the parameter
  // numbers of the HLO parameters in the computation. For e.g., consider the
  // following graph:
  //
  //                *
  //            /       \
  //            +     Parameter1
  //        /      \
  //       /        \
  //    Parameter0  Constant
  //
  // where Parameter0 has parameter_number 0 and Parameter1 has parameter_number
  // 1 in this computation. The input literals array will then have its first
  // literal map to Parameter0 and the second map to Parameter1.
  //
  // (Dummy template arg is to reduce the overloading priority of one overload
  // so that Evaluate(module, {}) resolves unambiguously.)
  StatusOr<Literal> Evaluate(const HloComputation& computation,
                             absl::Span<const Literal* const> arg_literals);
  template <typename Dummy = void>
  StatusOr<Literal> Evaluate(const HloComputation& computation,
                             absl::Span<const Literal> arg_literals) {
    std::vector<const Literal*> arg_literal_ptrs;
    for (const auto& l : arg_literals) {
      arg_literal_ptrs.push_back(&l);
    }
    return Evaluate(computation, arg_literal_ptrs);
  }

  // Gets the value of running a single HLO instruction.
  //
  // This function may recursively evaluate the dependency of this instruction
  // within its parent computation until it encounters something that cannot be
  // evaluated, such as an Infeed or a Parameter instruction.
  // It makes best effort to partially evaluate a dependency if possible.
  StatusOr<Literal> Evaluate(
      HloInstruction* instruction,
      bool recursively_evaluate_nonconstant_operands = false);

  // Same as Evaluate, except returning false on error and accepts an output
  // pointer.
  bool TryEvaluate(HloInstruction* instruction, Literal* result,
                   bool recursively_evaluate_nonconstant_operands = false);

  // Evaluates a single HLO instruction, substituting the given literals for
  // some of the instruction's operands.
  //
  // For example, given instruction = op(A, B, C) and the map
  // {A = x, C = y}, this evaluates op(x, B, y).
  StatusOr<Literal> EvaluateWithSubstitutions(
      const HloInstruction* instruction,
      const absl::flat_hash_map<const HloInstruction*, const Literal*>&
          substitutions);

  StatusOr<Literal> EvaluateElementwiseBinaryOp(HloOpcode opcode,
                                                const Literal& lhs,
                                                const Literal& rhs);

  StatusOr<Literal> EvaluateElementwiseUnaryOp(HloOpcode opcode,
                                               const Literal& operand);

  StatusOr<Literal> EvaluateElementwiseTernaryOp(HloOpcode opcode,
                                                 const Literal& lhs,
                                                 const Literal& rhs,
                                                 const Literal& ehs);

  StatusOr<Literal> EvaluateElementwiseCompareOp(ComparisonDirection direction,
                                                 const Literal& lhs,
                                                 const Literal& rhs);

  StatusOr<Literal> EvaluateDotOp(const DotDimensionNumbers& dim_numbers,
                                  const PrecisionConfig& precision_config,
                                  const Literal& lhs, const Literal& rhs);

  void set_dynamic_dimension_inference(
      DynamicDimensionInference* dynamic_dimension_inference) {
    dynamic_dimension_inference_ = dynamic_dimension_inference;
  }

  DynamicDimensionInference* dynamic_dimension_inference() {
    return dynamic_dimension_inference_;
  }

  // Enable the fast path for certain operations like dot or convolution.
  void set_use_fast_path(bool value) { use_fast_path_ = value; }

  // Handles evaluation of a custom-call op.
  // Operand literals are provided in |operands| and implementations must
  // populate |output| before returning.
  using CustomCallHandler = std::function<StatusOr<Literal>(
      HloInstruction* custom_call, absl::Span<const Literal*> operands)>;

  // Sets a handler that is called during evaluation for custom-call ops.
  // If no handler is defined the default error behavior will occur. The handler
  // will be provided evaluated literals for all operands and is expected to
  // return an output literal of the appropriate shape.
  void set_custom_call_handler(
      std::function<StatusOr<Literal>(HloInstruction* custom_call,
                                      absl::Span<const Literal*> operands)>
          handler) {
    custom_call_handler_ = std::move(handler);
  }

  // Returns the result of a matrix multiply `lhs x rhs`.
  static std::unique_ptr<Array2D<Eigen::half>> MatmulArray2D(
      const Array2D<Eigen::half>& lhs, const Array2D<Eigen::half>& rhs);
  static std::unique_ptr<Array2D<float>> MatmulArray2D(
      const Array2D<float>& lhs, const Array2D<float>& rhs);
  static std::unique_ptr<Array2D<double>> MatmulArray2D(
      const Array2D<double>& lhs, const Array2D<double>& rhs);
  static std::unique_ptr<Array2D<std::complex<float>>> MatmulArray2D(
      const Array2D<std::complex<float>>& lhs,
      const Array2D<std::complex<float>>& rhs);
  static std::unique_ptr<Array2D<std::complex<double>>> MatmulArray2D(
      const Array2D<std::complex<double>>& lhs,
      const Array2D<std::complex<double>>& rhs);
  static std::unique_ptr<Array2D<int32_t>> MatmulArray2D(
      const Array2D<int32_t>& lhs, const Array2D<int32_t>& rhs);

 protected:
  // Evaluates the given instruction, and stores the evaluation result in the
  // evaluated_ map.
  // When a non-empty shape_index is given, the instruction may be partially
  // evaluated at the given shape_index and the rest of the result could be
  // marked as undetermined unless it has been previously evaluated using
  // EvaluateInternal. Such partial evaluation reduces the computation and
  // memory overhead in cases where we need only one tuple element by avoiding
  // the evaluation of a full tuple.
  Status EvaluateInternal(
      HloInstruction* instruction, const ShapeIndex& shape_index = {},
      bool recursively_evaluate_nonconstant_operands = false);
  // Make HloEvaluatorTypedVisitor a friend because it is logically part of this
  // class.
  //
  // A straightforward implementation would be to make it a nested class
  // declared and defined in hlo_evaluator.cc.  Instead HloEvaluatorTypedVisitor
  // lives as a separate class with its own header because its template gets
  // instantiated many times and we want to use extern templates to shard out
  // the compilation of those instantiations across multiple cc files.
  template <typename ReturnT, typename ElementwiseT>
  friend class HloEvaluatorTypedVisitor;

  // Wraps around instruction handling to infer types before dispatching to
  // the corresponding typed Visitor.
  Status DefaultAction(HloInstruction* hlo) override {
    return hlo->Visit(typed_visitors_[hlo->shape().element_type()].get());
  }

  Status Preprocess(HloInstruction* hlo) override;

  Status Postprocess(HloInstruction* hlo) override;

  // Operations that are type-agnostic or always return a specific type, such as
  // HandleIsFinite where boolean is always returned.
  //
  Status HandleBitcast(HloInstruction* bitcast) override;

  Status HandleGetDimensionSize(HloInstruction* get_dimension_size) override;

  Status HandleSetDimensionSize(HloInstruction* set_dimension_size) override;

  Status HandleParameter(HloInstruction* parameter) override;

  Status HandleInfeed(HloInstruction* infeed) override;

  Status HandleConstant(HloInstruction* constant) override;

  Status HandleConcatenate(HloInstruction* concatenate) override;

  Status HandleReshape(HloInstruction* reshape) override;

  Status HandleTranspose(HloInstruction* transpose) override;

  Status HandleIsFinite(HloInstruction* is_finite) override;

  Status HandleCompare(HloInstruction* compare) override;

  Status HandleTuple(HloInstruction* tuple) override;

  Status HandleFft(HloInstruction* fft) override;

  Status HandleGather(HloInstruction* gather) override;

  Status HandleScatter(HloInstruction* hlo) override;

  Status HandleGetTupleElement(HloInstruction* get_tuple_element) override;

  Status HandleAsyncStart(HloInstruction* async_start) override;

  Status HandleAsyncUpdate(HloInstruction* async_update) override;

  Status HandleAsyncDone(HloInstruction* async_done) override;

  Status HandleCopy(HloInstruction* copy) override;

  Status HandleCopyStart(HloInstruction* copy_start) override;

  Status HandleCopyDone(HloInstruction* copy_done) override;

  Status HandleConditional(HloInstruction* conditional) override;

  Status HandleCall(HloInstruction* call) override;

  Status HandleFusion(HloInstruction* fusion) override;

  Status HandleWhile(HloInstruction* while_hlo) override;

  Status HandleSelect(HloInstruction* select) override;

  Status HandleBroadcast(HloInstruction* broadcast) override;

  Status HandleAfterAll(HloInstruction* after_all) override;

  Status HandleAddDependency(HloInstruction* add_dependency) override;

  Status HandleSort(HloInstruction* sort) override;

  Status HandleReal(HloInstruction* real) override;

  Status HandleImag(HloInstruction* imag) override;

  Status HandleComplex(HloInstruction* complex) override;

  Status HandleReduce(HloInstruction* reduce) override;

  Status HandleReduceWindow(HloInstruction* hlo) override;

  Status HandleCustomCall(HloInstruction* custom_call) override;

  // Unsupported HLOs, note some of them (such as BatchNorm*) are typically
  // expanded in a semantic-preserving way into other HLOs by adding expansion
  // HLO pass to the HLO optimization pass during compilation, which can then be
  // handled by the evaluator.
  Status HandleBatchNormGrad(HloInstruction* batch_norm_grad) override {
    return Unimplemented("BatchNormGrad HLO is unsupported by the evaluator.");
  }
  Status HandleBatchNormInference(
      HloInstruction* batch_norm_inference) override {
    return Unimplemented(
        "BatchNormInference HLO is unsupported by the evaluator.");
  }
  Status HandleBatchNormTraining(HloInstruction* batch_norm_training) override {
    return Unimplemented(
        "BatchNormTraining HLO is unsupported by the evaluator.");
  }
  Status HandleOutfeed(HloInstruction* outfeed) override {
    return Unimplemented("Outfeed HLO is unsupported by the evaluator.");
  }

  // Returns the already-evaluated literal result for the instruction.
  //
  // A Constant instruction is considered evaluated and its literal will be
  // returned directly without looking up the cache.
  //
  // Similarly, a Parameter instruction is considered evaluated and its literal
  // is looked up in arg_literals.
  //
  // Crash with log if the given instruction has not been evaluated previously.
  const Literal& GetEvaluatedLiteralFor(const HloInstruction* hlo) {
    if (hlo->IsConstant()) {
      return hlo->literal();
    }
    if (hlo->opcode() == HloOpcode::kParameter && !arg_literals_.empty()) {
      return *arg_literals_.at(hlo->parameter_number());
    }

    auto it = evaluated_.find(hlo);
    CHECK(it != evaluated_.end())
        << "could not find evaluated value for: " << hlo->ToString();
    return it->second;
  }

  // Returns true if the given hlo has been evaluated and cached.
  bool IsAlreadyEvaluated(const HloInstruction* hlo,
                          const ShapeIndex& shape_index = {}) {
    if (hlo->IsConstant()) {
      return true;
    }
    if (hlo->opcode() == HloOpcode::kParameter && !arg_literals_.empty()) {
      return true;
    }
    auto it = evaluated_.find(hlo);
    if (it == evaluated_.end()) {
      return false;
    }
    // We may evaluate some elements of a tuple-shaped instruction and mark
    // the other elements as undetermined. This way we avoid the computation
    // and memory overhead of evaluating a large tuple when only some elements
    // are needed. By marking the other elements undetermined, we allow the
    // evaluator to update the cached tuple literal when more elements are
    // evaluated.
    return it->second.IsDetermined(shape_index);
  }

  // Tracks the HLO instruction and its evaluated literal result.
  //
  // Parameters and constants aren't stored here, see implementation of
  // GetEvaluatedLiteralFor.
  //
  // TODO(b/35950897): have better memory management here to free instructions
  // that are no longer a parent for any other subsequent instruction in
  // post-ordering.
  //
  // Must be cleared for each evaluation.
  //
  // Storing Literal in place requires the container to have pointer stability
  // so we cannot use flat_hash_map any more.
  absl::node_hash_map<const HloInstruction*, Literal> evaluated_;
  // Set by EvaluateInternal and opportunitiscally used by the HandleXXX
  // functions. When non-empty, the HandleXXX function may evaluate the
  // instruction at only the given shape index.
  ShapeIndex visitor_shape_index_;
  bool enable_partial_evaluation_ = false;

  // Use fast path that uses eigen in the evaluator.
  bool use_fast_path_ = false;

 private:
  template <typename ReturnT, typename NativeT>
  static StatusOr<Literal> ElementWiseUnaryOpImpl(
      HloInstruction* instruction,
      const std::function<ReturnT(NativeT)>& unary_op,
      const Literal& operand_literal) {
    const auto shape = instruction->shape();
    const auto* operand = instruction->operand(0);
    TF_RET_CHECK(ShapeUtil::SameDimensions(shape, operand->shape()));

    Literal result(shape);
    TF_RETURN_IF_ERROR(
        result.Populate<ReturnT>([&](absl::Span<const int64_t> multi_index) {
          return unary_op(operand_literal.Get<NativeT>(multi_index));
        }));
    return std::move(result);
  }

  // Map from a primitive type to its associated (templated) DfsHloVisitor.
  std::unique_ptr<DfsHloVisitor> typed_visitors_[PrimitiveType_ARRAYSIZE];

  // Caches pointers to input literals, assuming they are in post-order.
  // Literals are not owned by this class, and they must outlive the lifetime of
  // each invocation to the Evaluate* method.
  // Must be cleared for each evaluation.
  std::vector<const Literal*> arg_literals_;

  // Max loop iterations to execute with no maximum if negative.
  int64_t max_loop_iterations_ = 0;

  // Module-level seed handle.
  uint64_t seed_ = 0;
  // RNG engine.
  std::minstd_rand0 engine_;

  // DynamicDimensionInference is used to evaluate GetDimensionSize, which
  // returns the dynamic dimension size of its operand.
  DynamicDimensionInference* dynamic_dimension_inference_ = nullptr;

  // Optional handler for custom_call ops.
  std::function<StatusOr<Literal>(HloInstruction* custom_call,
                                  absl::Span<const Literal*> operands)>
      custom_call_handler_;

  HloEvaluator(const HloEvaluator&) = delete;
  HloEvaluator& operator=(const HloEvaluator&) = delete;
};

std::unique_ptr<Array2D<float>> MatmulArray2D(const Array2D<float>& lhs,
                                              const Array2D<float>& rhs);
}  // namespace xla

#endif  // TENSORFLOW_COMPILER_XLA_HLO_EVALUATOR_HLO_EVALUATOR_H_


text:
package org.ovirt.engine.ui.webadmin.section.main.presenter.popup.gluster;

import org.ovirt.engine.ui.common.presenter.AbstractModelBoundPopupPresenterWidget;
import org.ovirt.engine.ui.uicommonweb.models.gluster.DetachGlusterHostsModel;
import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;

public class DetachGlusterHostsPopupPresenterWidget extends AbstractModelBoundPopupPresenterWidget<DetachGlusterHostsModel, DetachGlusterHostsPopupPresenterWidget.ViewDef> {

    public interface ViewDef extends AbstractModelBoundPopupPresenterWidget.ViewDef<DetachGlusterHostsModel> {
    }

    @Inject
    public DetachGlusterHostsPopupPresenterWidget(EventBus eventBus, ViewDef view) {
        super(eventBus, view);
    }

}


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

namespace NetworkTables.Tables
{
    public interface ITableProvider
    {
        ITable GetTable(string name);
    }
}


text:
class WechatsController < ApplicationController
  include MediasHelper
  protect_from_forgery except: :create
  wechat_responder
  alias :index :create

  on :text do |request, content|
    # user = wechat.user(request[:FromUserName])
    # user['nickname']
    # store_text("#{request[:FromUserName]}: #{content}")
    reply = receive_text(content, request[:FromUserName])
    request.reply.text reply unless reply.nil?
  end

  on :image do |request|
    uri = URI(request[:PicUrl])
    dest_file_name = "#{Digest::SHA256.hexdigest(uri.to_s)}.jpg"
    logger.info("Saving file from #{uri.to_s} to #{dest_file_name}")
    request.reply.text download_image(uri, dest_file_name)
  end

  on :event, with: 'subscribe' do |request|
    request.reply.text Settings.welcome_message
  end
end


text: <!DOCTYPE html>


text:
from unittest import TestCase
from PyProxy import PyProxy
from proxyproviders.UsProxy import UsProxy

class TestPyProxy(TestCase):
    def setUp(self):
        self.test_class = PyProxy(UsProxy(), timeout=10, debug=True)

    def test_debug(self):
        self.assertTrue(self.test_class.debug)
        self.test_class.debug = 0
        self.assertFalse(self.test_class.debug)

    def test_request_proxy(self):
        self.test_class.timeout = 2
        self.test_class.threads = 100
        request_proxy = self.test_class.request_proxy()
        self.assertIsInstance(request_proxy, list)

    def test_check_proxy(self):
        self.test_class.timeout = 0.1
        self.assertFalse(self.test_class.check_proxy("1.1.1.1"))

    def test_get_random_proxy(self):
        self.test_class.proxy_list = ["1.1.1.1:1111", "2.2.2.2:2222"]
        self.assertRegex(self.test_class.get_random_proxy(), "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{2,5}")


text:
package gobblin.configuration;

import java.io.DataInput;
import java.io.IOException;
import java.util.Properties;

import gobblin.source.extractor.Watermark;

/**
 * An immutable version of {@link WorkUnitState}.
 *
 * @author Yinan Li
 */
public class ImmutableWorkUnitState extends WorkUnitState {

  public ImmutableWorkUnitState(WorkUnitState workUnitState) {
    super(workUnitState.getWorkunit(), workUnitState.getJobState());
    super.addAll(workUnitState.getProperties());
  }

  @Override
  public void setWorkingState(WorkingState state) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setActualHighWatermark(Watermark watermark) {
    throw new UnsupportedOperationException();
  }

  @Deprecated
  @Override
  public void setHighWaterMark(long value) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setProp(String key, Object value) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void addAll(Properties properties) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void addAllIfNotExist(Properties properties) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void overrideWith(Properties properties) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void setId(String id) {
    throw new UnsupportedOperationException();
  }

  @Override
  public void readFields(DataInput in) throws IOException {
    throw new UnsupportedOperationException();
  }

  @Override
  public void backoffActualHighWatermark() {
    throw new UnsupportedOperationException();
  }

  @Override
  public synchronized void appendToListProp(String key, String value) {
    throw new UnsupportedOperationException();
  }
}


text:
/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- */

#ifndef _LEGIT_MODALITIES_COLOR
#define _LEGIT_MODALITIES_COLOR

#include "modalities.h"

using namespace cv;
using namespace std;
using namespace legit::common;

namespace legit {

    namespace tracker {

        class ModalityColor3DHistogram : public Modality {

        public:
            ModalityColor3DHistogram(string configbase);
            ~ModalityColor3DHistogram();

            virtual void flush();

            virtual void update(Image& image, PatchSet* patches, cv::Rect bounds);

            virtual bool usable();

            virtual void probability(Image& image, Mat& p);

        private:
            int colorspace;
            int channels[3];
            int histSize[3];
            float ranges1[2];
            float ranges2[2];
            float ranges3[2];
            const float* ranges[3];
            bool has_data;
            float foreground_presistence;
            float background_presistence;
            int background_margin, background_size;
            float foreground_size;
            Mat tmp_p;
            MatND foreground;
            MatND background;
            MatND model;
        };

    }

}

#endif


text:
/**
 * @private
 */
Ext.define('Ext.util.FilterCollection', {
    extend: 'Ext.util.Collection',

    requires: [
        'Ext.util.Filter'
    ],

    isFilterCollection: true,

    /**
     * @property {Ext.util.Collection} $filterable
     * The owning filterable instance. The filterable's configuration governs this
     * collection.
     * @private
     * @readonly
     */
    $filterable: null,

    /**
     * @property filterFn
     * This is the cached filter function.
     * @readonly
     */
    filterFn: null,

    constructor: function (config) {
        var me = this;

        // Because this closure operates on the collection, we are able to use it for as
        // long as we have the Collection instance.
        me.filterFn = Ext.util.Filter.createFilterFn(me);

        me.callParent([config]);
        me.setDecoder(me.decodeFilter);
    },

    /**
     * This method will filter an array based on the currently configured `filters`.
     * @param {Array} data The array you want to have filtered.
     * @return {Array} The array you passed after it is filtered.
     */
    filterData: function (data) {
        return this.filtered ? Ext.Array.filter(data, this.filterFn) : data;
    },

    /**
     * Returns the filter function.
     * @return {Function} The filter function.
     */
    getFilterFn: function () {
        return this.filterFn;
    },

    isItemFiltered: function (item) {
        return !this.filterFn(item);
    },

    //-------------------------------------------------------------------------
    // Private

    decodeFilter: function (filter) {
        var options = this.getOptions(),
            filterRoot = options.getRootProperty(),
            filterConfig;

        if (filter.isFilter) {
            if (!filter.getRoot()) {
                filter.setRoot(filterRoot);
            }
        } else {
            filterConfig = {
                root: filterRoot
            };

            if (Ext.isFunction(filter)) {
                filterConfig.filterFn = filter;
            }
            // If we are dealing with an object, we assume its a Filter configuration. In
            // this case we create an instance of Ext.util.Filter passing the config.
            else {
                // Finally we get to the point where it has to be invalid
                // <debug>
                if (!Ext.isObject(filter))  {
                    Ext.raise('Invalid filter specified: ' + filter);
                }
                // </debug>

                filterConfig = Ext.apply(filterConfig, filter);

                if (filterConfig.fn) {
                    filterConfig.filterFn = filterConfig.fn;
                    delete filterConfig.fn;
                }

                if (Ext.util.Filter.isInvalid(filterConfig)) {
                    return false;
                }
            }

            filter = new Ext.util.Filter(filterConfig);
        }

        return filter;
    },

    decodeRemoveItems: function (args, index) {
        var me = this,
            ret = (index === undefined) ? args : args[index];

        if (!ret.$cloned) {
            if (args.length > index + 1 || !Ext.isIterable(ret)) {
                ret = Ext.Array.slice(args, index);
            }

            var currentFilters = me.items,
                ln = ret.length,
                remove = [],
                filter, i, isFunction, isProp, isString, item, match, n, type;

            for (i = 0; i < ln; i++) {
                filter = ret[i];

                if (filter && filter.isFilter) {
                    remove.push(filter);
                } else {
                    type = typeof filter;

                    isFunction = type === 'function';
                    isProp = filter.property !== undefined && filter.value !== undefined;
                    isString = type === 'string';

                    //<debug>
                    if (!isFunction && !isProp && !isString) {
                        Ext.raise('Invalid filter specification: ' + filter);
                    }
                    //</debug>

                    for (n = currentFilters.length; n-- > 0; ) {
                        item = currentFilters[n];
                        match = false;

                        if (isString) {
                            match = item.getProperty() === filter;
                        }
                        else if (isFunction) {
                            match = item.getFilterFn() === filter;
                        }
                        else if (isProp) {
                            match = item.getProperty() === filter.property &&
                                    item.getValue() === filter.value;
                        }

                        if (match) {
                            remove.push(item);
                        }
                    }
                }
            }

            ret = remove;
            ret.$cloned = true;
        }

        return ret;
    },

    getOptions: function () {
        // Odd thing this. We need a Filterable to know how to manage our collection, but
        // we may not have one. Of course as a Collection, we *are* one as well... just
        // that is not really useful to filter the filters themselves, but we do have the
        // default options for Filterable baked in, so we'll do.
        return this.$filterable || this;
    }
});


text:
package com.adeptj.modules.commons.cache.internal;

import org.osgi.service.component.annotations.Component;
import org.osgi.service.metatype.annotations.Designate;

import static com.adeptj.modules.commons.cache.internal.CaffeineCacheConfigFactory.PID;
import static org.osgi.service.component.annotations.ConfigurationPolicy.REQUIRE;

/**
 * Factory for creating CaffeineCache configurations.
 *
 * @author Rakesh.Kumar, AdeptJ
 */
@Designate(ocd = CaffeineCacheConfig.class, factory = true)
@Component(service = CaffeineCacheConfigFactory.class, name = PID, configurationPolicy = REQUIRE)
public class CaffeineCacheConfigFactory {
    static final String PID = "com.adeptj.modules.cache.caffeine.CaffeineCacheConfig.factory";
}


text:
VARIABLE_STATIC_LENGTH = 5

TYPE_STRING = 1
TYPE_INT = 2


text:
var df = new Intl.DateTimeFormat();

assertThrows("df.format(Infinity)", RangeError);
assertThrows("df.formatToParts(Infinity)", RangeError);
assertThrows("df.format(-Infinity)", RangeError);
assertThrows("df.formatToParts(-Infinity)", RangeError);
assertThrows("df.format(NaN)", RangeError);
assertThrows("df.formatToParts(NaN)", RangeError);

// https://crbug.com/774833
var df2 = new Intl.DateTimeFormat('en', {'hour': 'numeric'});
Date.prototype.valueOf = "ponies";
assertEquals(df.format(Date.now()), df.format());
assertEquals(df2.format(Date.now()), df2.format());
assertEquals(df.formatToParts(Date.now()), df.formatToParts());
assertEquals(df2.formatToParts(Date.now()), df2.formatToParts());


text: Add Player


text:
<?php

/**
 * Skeleton subclass for representing a row from the 'sf_blog_post_version' table.
 *
 *
 *
 * This class was autogenerated by Propel 1.5.3-dev on:
 *
 * Fri 14 Jan 2011 07:01:53 PM WIT
 *
 * You should add additional methods to this class to meet the
 * application requirements.  This class will only be generated as
 * long as it does not already exist in the output directory.
 *
 * @package    propel.generator.plugins.sfSimpleBlog15Plugin.lib.model
 */
class sfSimpleBlogPostVersion extends PluginsfSimpleBlogPostVersion {

} // sfSimpleBlogPostVersion


text:
using System;
using System.Globalization;
using Xunit;

namespace System.Globalization.CalendarsTests
{
    // System.Globalization.ThaiBuddhistCalendar.IsLeapYear(Int32,Int32)
    public class ThaiBuddhistCalendarIsLeapYear
    {
        #region Positive Tests
        // PosTest1: Verify the year  is a random year
        [Fact]
        public void PosTest1()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand = new Random(-55);
            int year = rand.Next(tbc.MinSupportedDateTime.Year + 543, tbc.MaxSupportedDateTime.Year + 543);
            int era;
            bool isLeap = isLeapYear(year);
            for (int i = 0; i < tbc.Eras.Length; i++)
            {
                era = tbc.Eras[i];
                Assert.False(tbc.IsLeapYear(year, era) ^ isLeap);
            }
        }

        // PosTest2: Verify year  is leap year
        [Fact]
        public void PosTest2()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand = new Random(-55);
            int year = 2000 + 543;
            int era;
            for (int i = 0; i < tbc.Eras.Length; i++)
            {
                era = tbc.Eras[i];
                Assert.True(tbc.IsLeapYear(year, era));
            }
        }

        // PosTest3: Verify the year is ThaiBuddhistCalendar MinSupportedDateTime.Year
        [Fact]
        public void PosTest3()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand = new Random(-55);
            int year = tbc.MinSupportedDateTime.Year + 543;
            int era;
            for (int i = 0; i < tbc.Eras.Length; i++)
            {
                era = tbc.Eras[i];
                Assert.False(tbc.IsLeapYear(year, era));
            }
        }

        // PosTest4: Verify the year is ThaiBuddhistCalendar MaxSupportedDateTime.Year
        [Fact]
        public void PosTest4()
        {
            System.Globalization.Calendar tbc = new ThaiBuddhistCalendar();
            Random rand = new Random(-55);
            int year = tbc.MaxSupportedDateTime.Year + 543;
            int era;
            for (int i = 0; i < tbc.Eras.Length; i++)
            {
                era = tbc.Eras[i];
                Assert.False(tbc.IsLeapYear(year, era));
            }
        }
        #endregion

        #region Helper Methods
        private bool isLeapYear(int year)
        {
            year -= 543;
            return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
        }
        #endregion
    }
}


text:
package ru.noties.parcelable.obj;

import android.os.Bundle;

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

import ru.noties.parcelable.BundleUtils;
import ru.noties.parcelable.ParcelGen;

/**
 * Created by Dimitry Ivanov on 17.10.2015.
 */
@ParcelGen
public class SomeParcelableSibling extends SomeAnnotatedParcelable {

    private List<SomeParcelable> typedList;
    private ArrayList<SomeParcelable> typedArrayList;
    private Bundle bundle;
    private CharSequence charSequence;
    private CharSequence[] charSequenceArray;

    public SomeParcelableSibling setTypedList(List<SomeParcelable> typedList) {
        this.typedList = typedList;
        return this;
    }

    public SomeParcelableSibling setBundle(Bundle bundle) {
        this.bundle = bundle;
        return this;
    }

    public SomeParcelableSibling setCharSequence(CharSequence charSequence) {
        this.charSequence = charSequence;
        return this;
    }

    public SomeParcelableSibling setCharSequenceArray(CharSequence[] charSequenceArray) {
        this.charSequenceArray = charSequenceArray;
        return this;
    }

    public SomeParcelableSibling setTypedArrayList(ArrayList<SomeParcelable> typedArrayList) {
        this.typedArrayList = typedArrayList;
        return this;
    }

    @Override
    public String toString() {
        return "SomeParcelableSibling{" +
                "typedList=" + typedList +
                ", typedArrayList=" + typedArrayList +
                ", bundle=" + BundleUtils.dump(bundle) +
                ", charSequence=" + charSequence +
                ", charSequenceArray=" + Arrays.toString(charSequenceArray) +
                '}';
    }

    // the only difference is BundleUtils call to `equals`

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        SomeParcelableSibling sibling = (SomeParcelableSibling) o;

        if (typedList != null ? !typedList.equals(sibling.typedList) : sibling.typedList != null)
            return false;
        if (typedArrayList != null ? !typedArrayList.equals(sibling.typedArrayList) : sibling.typedArrayList != null)
            return false;
        if (bundle != null ? !BundleUtils.equals(bundle, sibling.bundle) : sibling.bundle != null) return false;
        if (charSequence != null ? !charSequence.equals(sibling.charSequence) : sibling.charSequence != null)
            return false;
        // Probably incorrect - comparing Object[] arrays with Arrays.equals
        if (!Arrays.equals(charSequenceArray, sibling.charSequenceArray)) return false;
        return true;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + (typedList != null ? typedList.hashCode() : 0);
        result = 31 * result + (typedArrayList != null ? typedArrayList.hashCode() : 0);
        result = 31 * result + (bundle != null ? bundle.hashCode() : 0);
        result = 31 * result + (charSequence != null ? charSequence.hashCode() : 0);
        result = 31 * result + (charSequenceArray != null ? Arrays.hashCode(charSequenceArray) : 0);
        return result;
    }
}


text:
#ifndef _INCLUDE_ADD_FUNC_H_
#define _INCLUDE_ADD_FUNC_H_

#include "user_config.h"
#include "ets_sys.h"
#include "mem_manager.h"
#include "sdk/ets_run_new.h"

struct s_info {
	uint32 ap_ip;	//+00
	uint32 ap_mask;	//+04
	uint32 ap_gw;	//+08
	uint32 st_ip;	//+0C
	uint32 st_mask;	//+10
	uint32 st_gw;	//+14
	uint8 ap_mac[6];	//+18
	uint8 st_mac[6];	//+1E
}  __attribute__((packed, aligned(4)));

extern struct s_info info;

extern uint8 * hostname; // wifi_station_get_hostname(), wlan_lwip_if.h
extern bool default_hostname; // eagle_lwip_if.c

#if DEF_SDK_VERSION > 999 // SDK > 0.9.6 b1
//uint32 system_adc_read(void); // user_interface.h
//void system_deep_sleep(uint32 time_in_us); // user_interface.h
//bool system_deep_sleep_set_option(uint8 option); // user_interface.h
//uint32 system_get_boot_mode(void); // user_interface.h
//uint32 system_get_boot_version(void); // user_interface.h
uint32 system_get_checksum(uint8 *ptr, uint32 len);
//uint32 system_get_chip_id(void); // user_interface.h
//uint32 system_get_cpu_freq(void); // user_interface.h // ets_get_cpu_frequency
//uint32 system_get_free_heap_size(void); // user_interface.h
bool system_get_os_print(void); // return os_print_enable
uint32 system_get_rtc_time(void); // return (uint32)(*((uint32*)0x6000071C))
//const uint8 *system_get_sdk_version(void); // user_interface.h
uint32 system_get_test_result(void);
//uint32 system_get_time(void); // x1 us, return WdevTimOffSet + (uint32)(*((uint32*)0x3FF20C00)) // user_interface.h
uint32 phy_get_mactime(void); // x1 us, return (uint32)(*((uint32*)0x3FF20C00))
uint32 system_get_userbin_addr(void);
//uint32 system_get_vdd33(void); // user_interface.h
//void system_init_done_cb(init_done_cb_t cb); typedef void (* init_done_cb_t)(void); // user_interface.h
//uint64 system_mktime(uint32 year, uint32 mon, uint32 day, uint32 hour, uint32 min, uint32 sec); // user_interface.h
//bool system_os_post(uint8 prio, os_signal_t sig, os_param_t par); // user_interface.h
//bool system_os_task(os_task_t task, uint8 prio, os_event_t *queue, uint8 qlen); // user_interface.h
bool system_overclock(void); // if(system_get_cpu_freq()==80) { cpu_overclock = 1, system_update_cpu_freq(160) }
//?system_param_error();
uint32 system_phy_temperature_alert(void);   // phy_get_check_flag(0);
//?system_pp_recycle_rx_pkt(); // ppRecycleRxPkt()-> lldesc_num2link() wDev_AppendRxBlocks() esf_buf_recycle()
//void system_print_meminfo(void); // user_interface.h
uint32 system_relative_time(uint32 x); // (*((uint32*)0x3FF20C00))- x
//void system_restart(void); // user_interface.h
//void system_restart_enhance(uint32 *bin); // system_get_boot_version() "failed: need boot >= 1.3\n" system_get_userbin_addr(), "restart to use user bin", wifi_param_save_protect(), system_restart()
//void system_restore(void); // user_interface.h
bool system_restoreclock(void); // if(cpu_overclock) system_update_cpu_freq(80) else return 0
//uint32 system_rtc_clock_cali_proc(void); // user_interface.h
//bool system_rtc_mem_read(uint8 src_addr, void *des_addr, uint16 load_size); // user_interface.h
//bool system_rtc_mem_write(uint8 des_addr, const void *src_addr, uint16 save_size); // user_interface.h
//void system_set_os_print(uint8 onoff); // user_interface.h
//?system_station_got_ip_set(a,b,c); // print"ip:%d.%d.%d.%d,mask:%d.%d.%d.%d,gw:%d.%", ets_timer_disarm(sta_con_timer)
//void system_timer_reinit(void); // user_interface.h // устанавливает делитель таймера на :16 вместо :256 и т.д.
//void system_uart_swap(void); // user_interface.h
//bool system_update_cpu_freq(uint32 cpu_freq); // ets_update_cpu_frequency + bit0 0x3FF00014 // user_interface.h
//uint8 system_upgrade_flag_check(); // user_interface.h
//void system_upgrade_flag_set(uint8 flag); // user_interface.h
//void system_upgrade_reboot(void); // user_interface.h
//uint8 system_upgrade_userbin_check(void); // user_interface.h
bool system_upgrade_userbin_set(uint32 flag); // system_get_boot_version(), store flags
#endif

int atoi(const char *str) ICACHE_FLASH_ATTR;

int os_printf_plus(const char *format, ...) ICACHE_FLASH_ATTR;
int ets_sprintf(char *str, const char *format, ...) ICACHE_FLASH_ATTR;

void wifi_softap_set_default_ssid(void) ICACHE_FLASH_ATTR;
void wDev_Set_Beacon_Int(uint32_t) ICACHE_FLASH_ATTR;
extern void wDev_ProcessFiq(void) ICACHE_FLASH_ATTR;
void ets_timer_arm_new(ETSTimer *ptimer, uint32_t milliseconds, int repeat_flag, int isMstimer);
void sleep_reset_analog_rtcreg_8266(void) ICACHE_FLASH_ATTR;
void wifi_softap_cacl_mac(uint8 *mac_out, uint8 *mac_in) ICACHE_FLASH_ATTR;
void user_init(void);
int wifi_mode_set(int mode) ICACHE_FLASH_ATTR;
int wifi_station_start(void) ICACHE_FLASH_ATTR;

#if DEF_SDK_VERSION >= 1200
int wifi_softap_start(int) ICACHE_FLASH_ATTR;
#else
int wifi_softap_start(void) ICACHE_FLASH_ATTR;
#endif
int register_chipv6_phy(uint8 * esp_init_data) ICACHE_FLASH_ATTR; // esp_init_data_default[128]
void ieee80211_phy_init(int phy_mode) ICACHE_FLASH_ATTR; // ieee80211_setup_ratetable()
void lmacInit(void) ICACHE_FLASH_ATTR;
void wDev_Initialize(uint8 * mac) ICACHE_FLASH_ATTR;
void pp_attach(void) ICACHE_FLASH_ATTR;
void ieee80211_ifattach(void *_g_ic) ICACHE_FLASH_ATTR; // g_ic in main\Include\libmain.h
void pm_attach(void) ICACHE_FLASH_ATTR;
int fpm_attach(void) ICACHE_FLASH_ATTR; // all return  1
void cnx_attach(void *_g_ic) ICACHE_FLASH_ATTR; // g_ic in main\Include\libmain.h
void wDevEnableRx(void) ICACHE_FLASH_ATTR; // io(0x3FF20004) |= 0x80000000;

/* in mem_manager.h
void *pvPortMalloc(size_t xWantedSize) ICACHE_FLASH_ATTR;
void *pvPortRealloc(void * rmem, size_t newsize);
void vPortFree(void *pv) ICACHE_FLASH_ATTR;
size_t xPortGetFreeHeapSize(void) ICACHE_FLASH_ATTR;
void vPortInitialiseBlocks(void) ICACHE_FLASH_ATTR;
void *pvPortZalloc(size_t size) ICACHE_FLASH_ATTR;
*/
uint32 readvdd33(void) ICACHE_FLASH_ATTR;
int get_noisefloor_sat(void) ICACHE_FLASH_ATTR;
int read_hw_noisefloor(void) ICACHE_FLASH_ATTR;
int ram_get_fm_sar_dout(int) ICACHE_FLASH_ATTR;
// noise_init(), rom_get_noisefloor(), ram_set_noise_floor(), noise_check_loop(), ram_start_noisefloor()
// void sys_check_timeouts(void *timer_arg) ICACHE_FLASH_ATTR; // lwip
uint32 system_get_checksum(uint8 *ptr, uint32 len) ICACHE_FLASH_ATTR;
void read_macaddr_from_otp(uint8 *mac);

void wifi_station_set_default_hostname(uint8 * mac);

void user_init(void);

#ifdef USE_TIMER0
void timer0_start(uint32 us, bool repeat_flg);
void timer0_stop(void);

#ifdef TIMER0_USE_NMI_VECTOR
void timer0_init(void *func, uint32 par, bool nmi_flg);
#else
void timer0_init(void *func, void *par);
#endif
#endif

//void wifi_param_save_protect_with_check(uint16 startsector, int sectorsize, void *pdata, uint16 len);
void wifi_param_save_protect_with_check(int startsector, int sectorsize, void *pdata, int len);

#endif //_INCLUDE_ADD_FUNC_H_


text:
inline math::rectf bounds(const std::unique_ptr<entity>& entity) {
	return entity->bounding_rect();
}

inline math::rectf bounds(const std::shared_ptr<entity>& entity) {
	return entity->bounding_rect();
}

inline math::rectf bounds(const entity& entity) {
	return entity.bounding_rect();
}

//inline math::rectf bounds(const std::shared_ptr<gl::point_light>& light) {
//	auto center = light->get_center();
//	auto radius = light->get_radius();
//	return math::rectf(center.x - radius, center.y - radius, radius*2, radius*2);
//}

//inline math::rectf bounds(const std::unique_ptr<gl::point_light>& light) {
//	auto center = light->get_center();
//	auto radius = light->get_radius();
//	return math::rectf(center.x - radius, center.y - radius, radius*2, radius*2);
//}

//inline math::rectf bounds(const gl::point_light& light) {
//	auto center = light.get_center();
//	auto radius = light.get_radius();
//	return math::rectf(center.x - radius, center.y - radius, radius*2, radius*2);
//}

//inline math::rectf bounds(const std::shared_ptr<gl::emissive_light>& light) {
//	auto center = light->get_center();
//	auto half_dimensions = light->get_dimensions() / 2.0f;
//	return math::rectf(center.x - half_dimensions.x, center.y - half_dimensions.y, half_dimensions.x*2, half_dimensions.y*2);
//}

//inline math::rectf bounds(const std::unique_ptr<gl::emissive_light>& light) {
//	auto center = light->get_center();
//	auto half_dimensions = light->get_dimensions() / 2.0f;
//	return math::rectf(center.x - half_dimensions.x, center.y - half_dimensions.y, half_dimensions.x*2, half_dimensions.y*2);
//}

//inline math::rectf bounds(const gl::emissive_light& light) {
//	auto center = light.get_center();
//	auto half_dimensions = light.get_dimensions() / 2.0f;
//	return math::rectf(center.x - half_dimensions.x, center.y - half_dimensions.y, half_dimensions.x*2, half_dimensions.y*2);
//}

inline math::rectf bounds(const math::rectf& rect) {
	return rect;
}

inline math::recti bounds(const math::recti& rect) {
	return rect;
}

inline math::rectu bounds(const math::rectu& rect) {
	return rect;
}


text:
'use strict';

define(['angular', 'moment'], function(angular, moment) {
  return angular.module('portal.messages.filters', [])
    .filter('addToHome', function() {
      return function(messages, MISC_URLS, PortalAddToHomeService) {
        angular.forEach(messages, function(message) {
        if (message.actionButton) {
          var url = message.actionButton.url;
          var addToHome = 'addToHome';

            if (url.indexOf(addToHome) !== -1) {
              var slash = url.lastIndexOf('/') + 1;
              var fName = url.substr(slash);
              PortalAddToHomeService.inHome(fName).then(function(result, text) {
                if (result) {
                  message.actionButton.label = 'On your home';
                  message.actionButton.disabled = true;
                  return true;
                } else {
                  message.actionButton.label = 'Add to home';
                  message.actionButton.disabled = null;
                  return false;
                }
              })
              .catch(function() {
                message.actionButton.label = 'Add to home';
                message.actionButton.disabled = null;
                return false;
              });
            }
          }
        });
      };
    })
    .filter('filterByDate', ['$log', function($log) {
      // messages pass through filterByDate UNLESS
      // they have a goLiveDate that has not yet arrived OR
      // they have an expireDate that has past.
      return function(messages) {
          return messages.filter(function(message) {
            // if there is a goLiveDate and we're not sure it's in the future,
            // omit the message.
            if (message && message.goLiveDate) {
              var goDate = moment(message.goLiveDate);
              if (!goDate.isValid()) {
                $log.warn('Message ' + message.id +
                  ' supressed because goLiveDate invalid.');
                return;
              }
              if (goDate.isAfter()) {
                // message has not yet gone live
                return;
              }
            }
            // if there is an expireDate and we're not sure it's in the past,
            // omit the message.
            if (message && message.expireDate) {
              var expireDate = moment(message.expireDate);
              if (!expireDate.isValid()) {
                $log.warn('Message ' + message.id +
                ' supressed because expireDate invalid.');
                return;
              }
              if (expireDate.isBefore()) {
                // message has expired
                return;
              }
            }
            // the message was not filtered out as premature or expired,
            // so pass it through
            return message;
          });
        };
      }])
    .filter('filterSeenAndUnseen', function() {
      return function(messages, seenMessageIds) {
        var separatedMessages = {
          seen: [],
          unseen: [],
        };
        // Split messages in separate arrays
        // based on whether the id matches a seen id
        angular.forEach(messages, function(message) {
          if (seenMessageIds.indexOf(message.id) != -1) {
            separatedMessages.seen.push(message);
          } else {
            separatedMessages.unseen.push(message);
          }
        });
        return separatedMessages;
      };
    })
    .filter('filterOutMessageWithId', function() {
      return function(messages, idToFilterOut) {
        angular.forEach(messages, function(value, key) {
          if (value.id === idToFilterOut) {
            messages.splice(key, 1);
          }
        });
        return messages;
      };
    })
    .filter('filterForCommonElements', function() {
      return function(array1, array2) {
        return array1.filter(function(element) {
          return array2.indexOf(element) != -1;
        });
      };
    })
    .filter('trim', function() {
      return function(input) {
        return input.trim();
      };
    });
});


text:
#ifndef SkTileImageFilter_DEFINED
#  define SkTileImageFilter_DEFINED
#  include "include/core/SkImageFilter.h"
// DEPRECATED: Use include/effects/SkImageFilters::Tile
class SK_API SkTileImageFilter
{
public:
    /** Create a tile image filter
        @param src  Defines the pixels to tile
        @param dst  Defines the pixels where tiles are drawn
        @param input    Input from which the subregion defined by srcRect will be tiled
    */
  static sk_sp<SkImageFilter> Make(const SkRect& src, const SkRect& dst, sk_sp<SkImageFilter> input);
  static void RegisterFlattenables();
private:
  SkTileImageFilter() = delete;
};
#endif


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="associate">

        <roleset framnet="" id="associate.01" name="include in some group" vncls="22.2">
            <roles>
                <role descr="agent, entity causing some grouping, making an   association" f="" n="0">

                    <vnrole vncls="22.2-2" vntheta="agent"/>
                </role>

                <role descr="theme, thing being included in some group" f="" n="1">

                    <vnrole vncls="22.2-2" vntheta="patient1"/>
                </role>

                <role descr="group, associated-with" f="" n="2">

                    <vnrole vncls="22.2-2" vntheta="patient2"/>
                </role>

                <note/>
            </roles>

            <example name="typical, semi-prepositional usage" src="" type="">
                <text>Dan E. Nelms, Valley Federal's president and chief executive
                    officer, said the one-time charge substantially eliminates [future
                    losses]-1 associated *trace*-1 with the unit .
                </text>
                <rel f="">associated</rel>
                <arg f="" n="1">*trace*-1</arg>
                <arg f="" n="2">with the unit</arg>
                <note/>
            </example>

            <example name="made-up agentive" src="" type="">
                <text>John associates the smell of roofing tar with his mother's cooking.</text>
                <arg f="" n="0">John</arg>
                <rel f="">associates</rel>
                <arg f="" n="1">the smell of roofing tar</arg>
                <arg f="" n="2">with his mother's cooking</arg>
                <note/>
            </example>

            <note>Verbnet entry amalgamate-22.2-2; other framed
                members include incorporate.  Comparison with 'include'
            </note>
        </roleset>
        <note>Frames file for 'associate' based on sentences in financial
            subcorpus.
        </note>
    </predicate>
    <note/>
</frameset>


text:
import 'jasmine'

describe('Component: game', () => {
    let check: boolean

    beforeEach(() => {
        check = true
    })

    it('check test', () => {
        expect(check).toBe(true)
    })
})


text:
import tornado.ioloop
import tornado.web
import logging
import os
import json
import db
class SmsModel:
    def __init__(self):
        pass
    def fetch(self):
        item, count = db.fetch_sms_task()
        if item:
            sms_id = item[0]
            number = item[1]
            message = item[2]
            item = {'type': 'sendsms', 'id': sms_id, 'number': number, 'message': message}
        return item
    def enqueue(self, user_id, cmd_str):
        cmd = json.loads(cmd_str)
        cmd_type = cmd['type']
        number = cmd['number']
        msg = cmd['message']
        # TODO user_id
        result = db.add_new_sms(user_id, number, msg)
        return result
    def set_sms_sent_to_worker(self, worker_info, sms_id):
        db.set_sms_sent_to_worker(worker_info, sms_id)
    def dump(self):
        pass
    def auth(self, username, password):
        return db.auth(username, password)
workers = []
model = SmsModel()
def try_send_one_message():
    if len(workers) > 0:
        handler = workers[0]
        msg = model.fetch()
        model.dump()
        if msg is not None:
            send(handler, msg)
def send(handler, msg):
    handler.write(json.dumps(msg))
    handler.finish()
    workers.remove(handler)
    print "workers after send:", workers
    worker_info = str(vars(handler.request))
    model.set_sms_sent_to_worker(worker_info, msg['id'])
    print "set_sms_sent_to_worker complete!"
class MainHandler(tornado.web.RequestHandler):
    def get(self):
        # self.write("mainpage")
        self.render('index.html')
class SendHandler(tornado.web.RequestHandler):
    def post(self):
        # self.write("get /test")
        print "get /send"
        number = self.get_argument('number', '', True)
        message = self.get_argument('message', '', True)
        user = self.get_argument('user', '')
        password = self.get_argument('password', '')
        if not number or not user or not password:
            self.write('invalid params')
            self.set_status(400)
            return
        ok, bundle = model.auth(user, password)
        if not ok:
            bundle['result'] = ok
            self.write(json.dumps(bundle))
            return
        user_id = bundle['user_id']
        sms = {'type': 'sendsms', 'number': number, 'message': message}
        sms_json = json.dumps(sms)
        ok, bundle = model.enqueue(user_id, sms_json)
        model.dump()
        try_send_one_message()
        bundle['result'] = ok
        self.write(json.dumps(bundle))
class CometHandler(tornado.web.RequestHandler):
    @tornado.web.asynchronous
    def get(self):
        print "get /comet"
        workers.append(self)
        print "workers after append:", workers
        try_send_one_message()
    def on_connection_close(self):
        print "get /comet closed"
        workers.remove(self)
        print "workers after on_connection_close:", workers
application = tornado.web.Application(
    handlers = [
        (r"/", MainHandler),
        (r"/comet", CometHandler),
        (r"/send", SendHandler),
    ], template_path=os.path.join(os.path.dirname(__file__), "templates")
)

if __name__ == "__main__":
    port = 8080
    application.listen(port)
    print "listening on port:", port
    tornado.ioloop.IOLoop.instance().start()


text:
<!DOCTYPE html>

    <link rel="icon" type="image/png" href="imgs/sharks-favicon.png">
    <link rel="stylesheet" type="text/css" href="stylesheet.css">
    <link href='https://fonts.googleapis.com/css?family=Droid+Sans|Oswald' rel='stylesheet' type='text/css'>
    <title> The Puck Times </title>
    <meta name="keywords" content="San Jose Sharks, sharks news, sharks sharks news brief, nhl news, sharks newsfeed, puck times, pucktimes, san jose sharks daily news, san jose sharks news, sharks game tonight, sharks starting lineup, sharks hockey, sharks, hockey, nhl, San Jose, nhl sharks, sharks fan club, San Jose nhl, roster, sharks schedule">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="twitter:image:src" content="../imgs/sharks-logo.png">
    <meta name="twitter:description" content="A curated and concise summary of San Jose Sharks news and highlights.">
    <meta name="twitter:title" content="Sharks Game-Day Newsbrief">
    <meta name="twitter:card" content="summary_large_image">
    <meta property="og:type" content="article">
    <meta property="og:description" content="A curated and concise summary of San Jose Sharks news and highlights.">
    <meta property="og:image" content="../imgs/sharks-logo.png">
    <meta property="og:title" content="Sharks Game-Day Newsbrief">
    <meta property="og:url" content="http://pucktimes.com/index.html">

  Today's Issue

  Subscribe

  Archives

  About Us

The Puck Times has RELOCATED to  www.pucktimes.com.  If you are looking for recent issues, please click the link and remember in the future to the "www." in your URL.

 All archives from October 2015 will eventually be found on the new domain, but for now will remain on this site until that has been done.

 The Puck Times is game-day newsbrief for San Jose Sharks fans. We know life is busy and time is scarce, so we scan the news and synthesize it for you, highlighting everything you need to know before the puck drops.

        <form action="http://unbouncepages.com/pucktimes-signup/" >
              <input type="submit" class="button" id="subscribe" value="Subscribe">
        </form>

Preview: Sharks vs. Nashville Predators, 7:30pm

 October 28th, 2015 - Saturday night in San Jose featured a three act performance by new fan favorite Joel Ward. The first-year Sharks scored two first period goals to stake the Sharks to an early two-goal lead and then he finished off the hat trick with an empty netter in the third period. The Sharks finally have some positive news on the injury report...

            <form action="../issues/today.html">
              <input type="submit" class="button" value="Read More">
            </form>

 About Us

 Andrew is the lead writer for The Puck Times. He earned his degree in Broadcast Journalism from SFSU and has covered the Sharks professionally since 2010. Brian is the editor and website developer. He recentely left a 5+ year career in digital marketing and began a coding bootcamp in September 2015. Both Andy and Brian have been avid sharks fans for 24 and 28 years respectively...

            <form action="issues/about-us.html" id="cta2">
              <input type="submit" class="button" value="Read More">
            </form>

  Connect on LinkedIn

  Friend us on Facebook

  Follow us on Twitter

 ©2015 THE PUCK TIMES, LLC -- ALL RIGHTS RESERVED


text:
<?php

use \Kondrat\DesignPatterns\Strategy\QuackBehavior\MuteQuack;

class MuteQuackTest extends PHPUnit_Framework_TestCase {

    public function testQuak()
    {
        $mq = new MuteQuack();
        $this->assertEquals("I'm mute: silence...", $mq->quak());
    }

}


text:
/***************************************************/
/*! \class Bowed
    \brief STK bowed string instrument class.

    This class implements a bowed string model, a
    la Smith (1986), after McIntyre, Schumacher,
    Woodhouse (1983).

    This is a digital waveguide model, making its
    use possibly subject to patents held by
    Stanford University, Yamaha, and others.

    Control Change Numbers:
       - Bow Pressure = 2
       - Bow Position = 4
       - Vibrato Frequency = 11
       - Vibrato Gain = 1
       - Volume = 128

    by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
*/
/***************************************************/

#include "Bowed.h"
#include "SKINI.msg"

namespace stk {

Bowed :: Bowed( StkFloat lowestFrequency )
{
  unsigned long length;
  length = (long) ( Stk::sampleRate() / lowestFrequency + 1 );
  neckDelay_.setMaximumDelay( length );
  neckDelay_.setDelay( 100.0 );

  length >>= 1;
  bridgeDelay_.setMaximumDelay( length );
  bridgeDelay_.setDelay( 29.0 );

  bowTable_.setSlope(3.0 );

  vibrato_.setFrequency( 6.12723 );
  vibratoGain_ = 0.0;

  stringFilter_.setPole( 0.6 - (0.1 * 22050.0 / Stk::sampleRate()) );
  stringFilter_.setGain( 0.95 );

  bodyFilter_.setResonance( 500.0, 0.85, true );
  bodyFilter_.setGain( 0.2 );

  adsr_.setAllTimes( 0.02, 0.005, 0.9, 0.01 );

  betaRatio_ = 0.127236;

  // Necessary to initialize internal variables.
  this->setFrequency( 220.0 );
}

Bowed :: ~Bowed( void )
{
}

void Bowed :: clear( void )
{
  neckDelay_.clear();
  bridgeDelay_.clear();
}

void Bowed :: setFrequency( StkFloat frequency )
{
  StkFloat freakency = frequency;
  if ( frequency <= 0.0 ) {
    errorString_ << "Bowed::setFrequency: parameter is less than or equal to zero!";
    handleError( StkError::WARNING );
    freakency = 220.0;
  }

  // Delay = length - approximate filter delay.
  baseDelay_ = Stk::sampleRate() / freakency - 4.0;
  if ( baseDelay_ <= 0.0 ) baseDelay_ = 0.3;
  bridgeDelay_.setDelay( baseDelay_ * betaRatio_ ); 	     // bow to bridge length
  neckDelay_.setDelay( baseDelay_ * (1.0 - betaRatio_) );  // bow to nut (finger) length
}

void Bowed :: startBowing( StkFloat amplitude, StkFloat rate )
{
  adsr_.setAttackRate( rate );
  adsr_.keyOn();
  maxVelocity_ = 0.03 + ( 0.2 * amplitude );
}

void Bowed :: stopBowing( StkFloat rate )
{
  adsr_.setReleaseRate( rate );
  adsr_.keyOff();
}

void Bowed :: noteOn( StkFloat frequency, StkFloat amplitude )
{
  this->startBowing( amplitude, amplitude * 0.001 );
  this->setFrequency( frequency );

#if defined(_STK_DEBUG_)
  errorString_ << "Bowed::NoteOn: frequency = " << frequency << ", amplitude = " << amplitude << ".";
  handleError( StkError::DEBUG_WARNING );
#endif
}

void Bowed :: noteOff( StkFloat amplitude )
{
  this->stopBowing( (1.0 - amplitude) * 0.005 );

#if defined(_STK_DEBUG_)
  errorString_ << "Bowed::NoteOff: amplitude = " << amplitude << ".";
  handleError( StkError::DEBUG_WARNING );
#endif
}

void Bowed :: setVibrato( StkFloat gain )
{
  vibratoGain_ = gain;
}

void Bowed :: controlChange( int number, StkFloat value )
{
  StkFloat norm = value * ONE_OVER_128;
  if ( norm < 0 ) {
    norm = 0.0;
    errorString_ << "Bowed::controlChange: control value less than zero ... setting to zero!";
    handleError( StkError::WARNING );
  }
  else if ( norm > 1.0 ) {
    norm = 1.0;
    errorString_ << "Bowed::controlChange: control value greater than 128.0 ... setting to 128.0!";
    handleError( StkError::WARNING );
  }

  if (number == __SK_BowPressure_) // 2
		bowTable_.setSlope( 5.0 - (4.0 * norm) );
  else if (number == __SK_BowPosition_) { // 4
		betaRatio_ = 0.027236 + (0.2 * norm);
    bridgeDelay_.setDelay( baseDelay_ * betaRatio_ );
    neckDelay_.setDelay( baseDelay_ * (1.0 - betaRatio_) );
  }
  else if (number == __SK_ModFrequency_) // 11
    vibrato_.setFrequency( norm * 12.0 );
  else if (number == __SK_ModWheel_) // 1
    vibratoGain_ = ( norm * 0.4 );
  else if (number == __SK_AfterTouch_Cont_) // 128
    adsr_.setTarget(norm);
  else {
    errorString_ << "Bowed::controlChange: undefined control number (" << number << ")!";
    handleError( StkError::WARNING );
  }

#if defined(_STK_DEBUG_)
    errorString_ << "Bowed::controlChange: number = " << number << ", value = " << value << ".";
    handleError( StkError::DEBUG_WARNING );
#endif
}

} // stk namespace


text:
package org.kuali.rice.ksb.messaging.exceptionhandling;

import java.sql.Timestamp;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.kuali.rice.core.api.config.property.ConfigContext;
import org.kuali.rice.ksb.api.bus.ServiceConfiguration;
import org.kuali.rice.ksb.messaging.PersistedMessageBO;
import org.kuali.rice.ksb.service.KSBServiceLocator;
import org.kuali.rice.ksb.util.KSBConstants;

/**
 * Default implementation of the {@link MessageExceptionHandler} which handles exceptions thrown from message processing.
 *
 * @author Kuali Rice Team (rice.collab@kuali.org)
 */
public class DefaultMessageExceptionHandler implements MessageExceptionHandler {

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

    private static final long DEFAULT_TIME_INCREMENT = 60 * 60 * 1000;

    private static final int DEFAULT_MAX_RETRIES = 7;

    public void handleException(Throwable throwable, PersistedMessageBO message, Object service) throws Exception {
        if (isInException(message)) {
            placeInException(throwable, message);
        } else {
            requeue(throwable, message);
        }
    }

    public void handleExceptionLastDitchEffort(Throwable throwable, PersistedMessageBO message, Object service) throws Exception {
		LOG.error("Complete failure when attempting to put message into exception routing!  Message was: " + message, throwable);
	}

	public boolean isInException(PersistedMessageBO message) {
        ServiceConfiguration serviceConfiguration = message.getMethodCall().getServiceConfiguration();

        if (getImmediateExceptionRouting()) {
            return true;
        }

        Integer globalMaxRetryAttempts = getGlobalMaxRetryAttempts();
        if (globalMaxRetryAttempts != null) {
            LOG.info("Global Max Retry has been set, so is overriding other max retry attempts.");
            LOG.info("Global Max Retry count = " + globalMaxRetryAttempts + ".");
            return (message.getRetryCount().intValue() >= globalMaxRetryAttempts.intValue());
        }

        if (serviceConfiguration.getRetryAttempts() > 0) {
            LOG.info("Message set for retry exception handling.  Message retry count = " + message.getRetryCount());
            if (message.getRetryCount() >= serviceConfiguration.getRetryAttempts()) {
                return true;
            }
        } else if (serviceConfiguration.getMillisToLive() > 0) {
            LOG.info("Message set for time to live exception handling.  Message expiration date = " + message.getExpirationDate().getTime());
            if (System.currentTimeMillis() > message.getExpirationDate().getTime()) {
                return true;
            }
        } else if (message.getRetryCount() >= this.getMaxRetryAttempts()) {
            LOG.info("Message set for default exception handling.  Comparing retry count = " + message.getRetryCount() + " against default max count.");
            return true;
        }
        return false;
    }

    protected void requeue(Throwable throwable, PersistedMessageBO message) throws Exception {
        Integer retryCount = message.getRetryCount();
        message.setQueueStatus(KSBConstants.ROUTE_QUEUE_QUEUED);
        long addMilliseconds = Math.round(getTimeIncrement() * Math.pow(2, retryCount));
        Timestamp currentTime = message.getQueueDate();
        Timestamp newTime = new Timestamp(currentTime.getTime() + addMilliseconds);
        message.setQueueStatus(KSBConstants.ROUTE_QUEUE_QUEUED);
        message.setRetryCount(new Integer(retryCount + 1));
        message.setQueueDate(newTime);
        scheduleExecution(throwable, message);
    }

    protected void placeInException(Throwable throwable, PersistedMessageBO message) throws Exception {
        message.setQueueStatus(KSBConstants.ROUTE_QUEUE_EXCEPTION);
        message.setQueueDate(new Timestamp(System.currentTimeMillis()));
        message = KSBServiceLocator.getMessageQueueService().save(message);
    }

    protected void scheduleExecution(Throwable throwable, PersistedMessageBO message) throws Exception {
        KSBServiceLocator.getExceptionRoutingService().scheduleExecution(throwable, message, null);
    }

    public Integer getMaxRetryAttempts() {
        try {
            return new Integer(ConfigContext.getCurrentContextConfig().getProperty(KSBConstants.Config.ROUTE_QUEUE_MAX_RETRY_ATTEMPTS_KEY));
        } catch (NumberFormatException e) {
            LOG.error("Constant '" + KSBConstants.Config.ROUTE_QUEUE_MAX_RETRY_ATTEMPTS_KEY + "' is not a number and is being " + "used as a default for exception messages.  " + DEFAULT_MAX_RETRIES + " will be used as a retry limit until this number is fixed");
            return DEFAULT_MAX_RETRIES;
        }
    }

    public Integer getGlobalMaxRetryAttempts() {
        String globalMax = ConfigContext.getCurrentContextConfig().getProperty(KSBConstants.Config.ROUTE_QUEUE_MAX_RETRY_ATTEMPTS_OVERRIDE_KEY);
        if (StringUtils.isBlank(globalMax)) {
            return null;
        }
        try {
            Integer globalMaxRetries = new Integer(globalMax);
            if (globalMaxRetries >= 0) {
                return globalMaxRetries;
            }
        } catch (NumberFormatException e) {
            LOG.error("Constant '" + KSBConstants.Config.ROUTE_QUEUE_MAX_RETRY_ATTEMPTS_OVERRIDE_KEY + "' is not a number and is being " + "used as a default for exception messages.  " + DEFAULT_MAX_RETRIES + " will be used as a retry limit until this number is fixed");
        }
        return null;
    }

    public Long getTimeIncrement() {
        try {
            return new Long(ConfigContext.getCurrentContextConfig().getProperty(KSBConstants.Config.ROUTE_QUEUE_TIME_INCREMENT_KEY));
        } catch (NumberFormatException e) {
            LOG.error("Constant '" + KSBConstants.Config.ROUTE_QUEUE_TIME_INCREMENT_KEY + "' is not a number and will not be used " + "as the default time increment for exception routing.  Default of " + DEFAULT_TIME_INCREMENT + " will be used.");
            return DEFAULT_TIME_INCREMENT;
        }
    }

    public Boolean getImmediateExceptionRouting() {
        return new Boolean(ConfigContext.getCurrentContextConfig().getProperty(KSBConstants.Config.IMMEDIATE_EXCEPTION_ROUTING));
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Bolides</title>
    <meta name="author" content="Nicholas Costa, Erik Boesen">
    <meta name="description" content="An HTML5 recreation of the arcade game Asteroids.">
    <link rel="icon" href="favicon.ico">
    <link href="style.css" rel="stylesheet">

Bolides

            <button id="playButton">Play</button>
            <button id="instructionsButton">Instructions</button>
            <button id="creditsButton">Credits</button>

Instructions

Press space to fire, WASD or arrow keys to move. Asteroids are worth 100 pts, Bolides are worth 500 pts.

Gain points equal to the current level times 100 to advance to the next level and increase the difficulty.

If you touch an asteroid, you will lose a life. Lose all your lives, and the game ends.

            <button class="backButton" id="instruBack">Back to Main Menu</button>

Game Engine: Nicholas Costa

Art & Sound: Erik Boesen

            <button id="creditBack">Back to Main Menu</button>

    <canvas id="canvas">Upgrade to Chrome or Firefox to use the Canvas API.</canvas>


text:
Projects

3D IP Lookup Web service

					Map single IP addresses or traceroute outputs on Google Earth.

					Keywords: KML, Google Earth, GIS, IP, Networking.

Shared Battery Data Archive

					Repository of battery stats for Macintosh laptops.

					Keywords: Apple, Mac, power, battery, laptop, web2.0.


text:
var lowerFirst = function(string) {
  var resultString = string.charAt(0).toLowerCase().concat(string.slice(1));
  return resultString;
};

module.exports = lowerFirst;


text:
// Modifying this comment will cause the next execution of LBJ2 to overwrite this file.
// F1B880000000000000005715D4F4380401DFB23D6263092013E1DD2626AE5C4C872D87E516ADE095779CEE6DAAD0FFDD95825821DB09CCB73FE367829C5161D3E1732593C40CBDD363750F66C69F2FD53E3AED81BF12D391D150C0E0CF9816592C1184B70210D1C097B4520A4A3F7A1400B81222E1FA5001CA278B185C2AB5995E0A7FA49085E292667B39EAD498BD923D8F5E50433179B384B5793465B5CF423B773875A96BE5781C868DA3B3906E9511224C5EA680C4AF24FE6C8249A14A25B6953979A8E70B4E5F072A420CF04B52FE6C8C3B1DF48ED3ADE1DEF40C7AAAAB70450B2E4A075DC41AEDAFD54178B1451227215B8C16DB396561C68919B7DAB64BB69E03A39EB062FED7455CCE034D998AA54FF15C8AE2BA66369578FF5AB60C1A67803F26E0B4EFF17B39AD2A7EBC11FD57B3355F88A1A440FE6E71AA26A74119200000

package LBJ2.nlp;

import LBJ2.classify.*;
import LBJ2.infer.*;
import LBJ2.jni.*;
import LBJ2.learn.*;
import LBJ2.parse.*;

/**
  * This class implements a classifier that takes a {@link Word} as input and
  * generates Boolean features representing interesting information about the
  * forms of the words in a [-2, +2] window around the input word.  The
  * generated features include one that indicates if the entire input word
  * consists only of capital letters, one that indicates if the entire input
  * word consists only of digits, and one that indicates if the entire input
  * word consists only of non-letters.  The same features are also produced
  * for the two words before and after the input word.  If any of those words
  * do not exist, the corresponding features aren't generated.
  *
  * <p> This class's implementation was automatically generated by the LBJ
  * compiler.
  *
  * @author Nick Rizzolo
 **/
public class WordTypeInformation extends Classifier
{
  public WordTypeInformation()
  {
    containingPackage = "LBJ2.nlp";
    name = "WordTypeInformation";
  }

  public String getInputType() { return "LBJ2.nlp.Word"; }
  public String getOutputType() { return "discrete%"; }

  private static String[] __allowableValues = DiscreteFeature.BooleanValues;
  public static String[] getAllowableValues() { return __allowableValues; }
  public String[] allowableValues() { return __allowableValues; }

  public FeatureVector classify(Object __example)
  {
    if (!(__example instanceof Word))
    {
      String type = __example == null ? "null" : __example.getClass().getName();
      System.err.println("Classifier 'WordTypeInformation(Word)' defined on line 71 of CommonFeatures.lbj received '" + type + "' as input.");
      new Exception().printStackTrace();
      System.exit(1);
    }

    Word word = (Word) __example;

    FeatureVector __result;
    __result = new FeatureVector();
    String __id;
    String __value;

    int i;
    Word w = word, last = word;
    for (i = 0; i <= 2 && last != null; ++i)
    {
      last = (Word) last.next;
    }
    for (i = 0; i > -2 && w.previous != null; --i)
    {
      w = (Word) w.previous;
    }
    for (; w != last; w = (Word) w.next, ++i)
    {
      boolean allCapitalized = true, allDigits = true, allNonLetters = true;
      for (int j = 0; j < w.form.length(); ++j)
      {
        allCapitalized &= Character.isUpperCase(w.form.charAt(j));
        allDigits &= Character.isDigit(w.form.charAt(j));
        allNonLetters &= !Character.isLetter(w.form.charAt(j));
      }
      __id = "" + ("c" + i);
      __value = "" + (allCapitalized);
      __result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 2));
      __id = "" + ("d" + i);
      __value = "" + (allDigits);
      __result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 2));
      __id = "" + ("p" + i);
      __value = "" + (allNonLetters);
      __result.addFeature(new DiscretePrimitiveStringFeature(this.containingPackage, this.name, __id, __value, valueIndexOf(__value), (short) 2));
    }
    return __result;
  }

  public FeatureVector[] classify(Object[] examples)
  {
    if (!(examples instanceof Word[]))
    {
      String type = examples == null ? "null" : examples.getClass().getName();
      System.err.println("Classifier 'WordTypeInformation(Word)' defined on line 71 of CommonFeatures.lbj received '" + type + "' as input.");
      new Exception().printStackTrace();
      System.exit(1);
    }

    return super.classify(examples);
  }

  public int hashCode() { return "WordTypeInformation".hashCode(); }
  public boolean equals(Object o) { return o instanceof WordTypeInformation; }
}


text:
#define BSD     211 /* 2.11 * 100, as cpp doesn't do floats */

#ifndef offsetof
#define offsetof(type, member)  ((size_t)(&((type *)0)->member))
#endif

/*
 * Machine type dependent parameters.
 */
#include <machine/machparam.h>

/*
 * Machine-independent constants
 */
#ifndef NMOUNT
#define NMOUNT      2       /* number of mountable file systems */
#endif

#define MAXUPRC     20      /* max processes per user */
#define NOFILE      30      /* max open files per process */
#define NCARGS      5120    /* # characters in exec arglist */
#define NGROUPS     16      /* max number groups */

#define NOGROUP     65535   /* marker for empty group set member */

/*
 * Priorities
 */
#define PSWP        0
#define PINOD       10
#define PRIBIO      20
#define PRIUBA      24
#define PZERO       25
#define PPIPE       26
#define PSOCK       26
#define PWAIT       30
#define PLOCK       35
#define PPAUSE      40
#define PUSER       50

#define NZERO       0

#define PRIMASK     0xff
#define PCATCH      0x100

/*
 * Signals
 */
#include <sys/signal.h>

#define NBPW        sizeof(int) /* number of bytes in an integer */

#ifndef NULL
#define NULL        0
#endif
#define CMASK       026     /* default mask for file creation */
#define NODEV       (dev_t)(-1)

/* CBLOCK is the size of a clist block, must be power of 2 */
#define CBLOCK      32
#define CBSIZE      (CBLOCK - sizeof(struct cblock *))  /* data chars/clist */
#define CROUND      (CBLOCK - 1)                        /* clist rounding */

#include <sys/types.h>

/*
 * File system parameters and macros.
 *
 * The file system is made out of blocks of most MAXBSIZE units.
 */
#define MAXBSIZE    1024

/*
 * MAXPATHLEN defines the longest permissable path length
 * after expanding symbolic links. It is used to allocate
 * a temporary buffer from the buffer pool in which to do the
 * name expansion, hence should be a power of two, and must
 * be less than or equal to MAXBSIZE.
 * MAXSYMLINKS defines the maximum number of symbolic links
 * that may be expanded in a path name. It should be set high
 * enough to allow all legitimate uses, but halt infinite loops
 * reasonably quickly.
 */
#define MAXPATHLEN  256
#define MAXSYMLINKS 8

/*
 * Macros for fast min/max.
 */
#define MIN(a,b)    (((a)<(b))?(a):(b))
#ifndef MAX
#define MAX(a,b)    (((a)>(b))?(a):(b))
#endif

/*
 * Macros for counting and rounding.
 */
#ifndef howmany
#   define howmany(x,y) (((x)+((y)-1))/(y))
#endif
#define roundup(x,y)    ((((x)+((y)-1))/(y))*(y))

/*
 * Maximum size of hostname recognized and stored in the kernel.
 */
#define MAXHOSTNAMELEN  64

#if defined(KERNEL) && defined(INET)
#   include <machine/net_mac.h>
#endif

/*
 * MAXMEM is the maximum core per process is allowed.  First number is Kb.
*/
#define MAXMEM      (96*1024)

/*
 * Max length of a user login name.
 */
#define MAXLOGNAME  16


text:
/* ** GENEREATED FILE - DO NOT MODIFY ** */
package com.wilutions.mslib.uccollaborationlib;
import com.wilutions.com.*;

/**
 * RoomJoinStateChangedEventData.
 * RoomJoinStateChangedEventData Class
 */
@CoClass(guid="{CDFC37E9-BD76-420F-881F-4A6AAB4E51BF}")
public class RoomJoinStateChangedEventData extends Dispatch {
  static boolean __typelib__loaded = __TypeLib.load();
  public RoomJoinStateChangedEventData() throws ComException {
    super("{CDFC37E9-BD76-420F-881F-4A6AAB4E51BF}");
  }
  protected RoomJoinStateChangedEventData(long ndisp) {
    super(ndisp);
  }
  public String toString() {
    return "[RoomJoinStateChangedEventData" + super.toString() + "]";
  }
}


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

namespace Ip\MeatUp\Tests\Twig;

use Ip\MeatUp\Twig\ManyToOneChoiceLabelsExtension;
use LogicException;
use PHPUnit\Framework\TestCase;
use Twig_SimpleFilter;

final class ManyToOneChoiceLabelsExtensionTest extends TestCase
{
    /**
     * @var ManyToOneChoiceLabelsExtension
     */
    private $twigExtension;

    protected function setUp()
    {
        $this->twigExtension = new ManyToOneChoiceLabelsExtension();
    }

    public function testCorrectFilterName()
    {
        /**
         * @var Twig_SimpleFilter[] $filters
         */
        $filters = $this->twigExtension->getFilters();

        $this->assertEquals(
            1,
            count($filters),
            'ManyToOneChoiceLabelsExtension should return exactly one filter'
        );

        $this->assertEquals(
            'manyToOneChoiceLabels',
            $filters[0]->getName(),
            'The filter of ManyToOneChoiceLabelsExtension has to be named manyToOneChoiceLabels'
        );
    }

    public function testEmptyParameter()
    {
        $this->expectException(LogicException::class);
        $this->twigExtension->manyToOneChoiceLabelsFilter([]);
    }

    public function testWithOneParameter()
    {
        $this->assertEquals(
            '\'name\'',
            $this->twigExtension->manyToOneChoiceLabelsFilter(['name']),
            'manyToOneChoiceLabelsFilter returned the wrong expression with one parameter'
        );
    }

    public function testWithTwoParameter()
    {
        $this->assertEquals(
            'function ($item) {' . PHP_EOL .
                        '                    return $item->getName() . \' \' . $item->getName2();' . PHP_EOL .
                    '                }',
            $this->twigExtension->manyToOneChoiceLabelsFilter(['name', 'name2']),
            'manyToOneChoiceLabelsFilter returned the wrong expression with one parameter'
        );
    }
}


text:
module Rebase.GHC.IO.Exception
(
  module GHC.IO.Exception
)
where

import GHC.IO.Exception


text:
<?php

namespace Ddeboer\DataImport\Tests\Writer;

use Ddeboer\DataImport\Writer\DoctrineWriter;
use Ddeboer\DataImport\Tests\Fixtures\TestEntity;

class DoctrineWriterTest extends \PHPUnit_Framework_TestCase
{
    public function testWriteItem()
    {
        $em = $this->getEntityManager();

        $em->expects($this->once())
                ->method('persist');

        $writer = new DoctrineWriter($em, 'DdeboerDataImport:TestEntity');

        $item = array(
            'firstProperty' => 'some value',
            'secondProperty'=> 'some other value'
        );
        $writer->writeItem($item);
    }

    public function testBatches()
    {
        $em = $this->getEntityManager();
        $em->expects($this->exactly(11))
            ->method('persist');

        $em->expects($this->exactly(4))
            ->method('flush');

        $writer = new DoctrineWriter($em, 'DdeboerDataImport:TestEntity');
        $writer->prepare();

        $writer->setBatchSize(3);
        $this->assertEquals(3, $writer->getBatchSize());

        $item = array(
            'firstProperty' => 'some value',
            'secondProperty'=> 'some other value'
        );

        for ($i = 0; $i < 11; $i++) {
            $writer->writeItem($item);
        }

        $writer->finish();
    }

    protected function getEntityManager()
    {
        $em = $this->getMockBuilder('Doctrine\ORM\EntityManager')
            ->setMethods(array('getRepository', 'getClassMetadata', 'persist', 'flush', 'clear', 'getConnection'))
            ->disableOriginalConstructor()
            ->getMock();

        $repo = $this->getMockBuilder('Doctrine\ORM\EntityRepository')
            ->disableOriginalConstructor()
            ->getMock();

        $metadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')
            ->setMethods(array('getName', 'getFieldNames', 'setFieldValue'))
            ->disableOriginalConstructor()
            ->getMock();

        $metadata->expects($this->any())
            ->method('getName')
            ->will($this->returnValue('Ddeboer\DataImport\Tests\Fixtures\TestEntity'));

        $metadata->expects($this->any())
            ->method('getFieldNames')
            ->will($this->returnValue(array('firstProperty', 'secondProperty')));

        $configuration = $this->getMockBuilder('Doctrine\DBAL\Configuration')
            ->setMethods(array('getConnection'))
            ->disableOriginalConstructor()
            ->getMock();

        $connection = $this->getMockBuilder('Doctrine\DBAL\Connection')
            ->setMethods(array('getConfiguration', 'getDatabasePlatform', 'getTruncateTableSQL', 'executeQuery'))
            ->disableOriginalConstructor()
            ->getMock();

        $connection->expects($this->any())
            ->method('getConfiguration')
            ->will($this->returnValue($configuration));

        $connection->expects($this->any())
            ->method('getDatabasePlatform')
            ->will($this->returnSelf());

        $connection->expects($this->any())
            ->method('getTruncateTableSQL')
            ->will($this->returnValue('TRUNCATE SQL'));

        $connection->expects($this->any())
            ->method('executeQuery')
            ->with('TRUNCATE SQL');

        $em->expects($this->once())
            ->method('getRepository')
            ->will($this->returnValue($repo));

        $em->expects($this->once())
            ->method('getClassMetadata')
            ->will($this->returnValue($metadata));

        $em->expects($this->any())
            ->method('getConnection')
            ->will($this->returnValue($connection));

        return $em;
    }
}