text:
cask 'splice' do
  version '3.6.2'
  sha256 '8e7992b1b49057c3f8d31d84383583073dd865cf03fdcdf9dcb6dd4ed51b7f45'

  # splicedesktop.s3.amazonaws.com was verified as official when first introduced to the cask
  url 'https://splicedesktop.s3.amazonaws.com/darwin/stable/Splice.app.zip'
  appcast 'https://api.splice.com/v2/desktop/darwin/stable/latest?v=0.0.0'
  name 'Splice'
  homepage 'https://splice.com/'

  app 'Splice.app'

  uninstall quit: 'com.splice.Splice'

  zap trash: [
               '~/Library/Application Support/*Splice*',
               '~/Library/Caches/com.splice*',
               '~/Library/Preferences/com.splice*',
             ]
end


text:
"""
Converts the class list provided by MSU's Office of the Registrar to a format
that HackerRank can use to invite candidates.
"""
import csv
import argparse

def convert_form_to_student_info(
        form_csv,
        student_info_csv):
    reader = csv.DictReader(open(form_csv, 'r'))
    info_fieldnames = ["github_username", "msu_net_id", "full_name"]
    writer = csv.DictWriter(
        open(student_info_csv, 'w'), info_fieldnames)
    writer.writeheader()
    msu_net_id_to_row = {}
    for input_row in reader:
        msu_net_id = input_row["""MSU Net ID (without the "@msu.edu" part)"""]
        if "@" in msu_net_id:
            msu_net_id = msu_net_id.partition('@')[0]
        full_name = input_row["First name"] + " " + input_row["Last name"]
        github_username = input_row["GitHub Username"]

        row = {"github_username": github_username,
               "msu_net_id": msu_net_id,
               "full_name": full_name}
        msu_net_id_to_row[msu_net_id] = row
    for row in msu_net_id_to_row.values():
        writer.writerow(row)

def main():
    """
    Main function that parses the arguments and calls the convert function.
    """
    parser = argparse.ArgumentParser(description="""
    Converts the csv from Google Forms survey to students_info csv
    """)
    parser.add_argument('form_csv')
    parser.add_argument('student_info_csv')

    args = parser.parse_args()
    convert_form_to_student_info(args.form_csv,
                                 args.student_info_csv)

if __name__ == "__main__":
    main()

redpajama_set_name: RedPajamaGithub


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

#include <memory>
#include <string>
#include <vector>

#include "dragnn/core/compute_session.h"
#include "dragnn/core/compute_session_pool.h"
#include "dragnn/core/ops/compute_session_op.h"
#include "dragnn/core/resource_container.h"
#include "dragnn/protos/data.pb.h"
#include "dragnn/protos/spec.pb.h"
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/resource_mgr.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/tensor_shape.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/lib/core/threadpool.h"
#include "tensorflow/core/lib/io/path.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/mutex.h"

using tensorflow::DEVICE_CPU;
using tensorflow::DT_BOOL;
using tensorflow::DT_FLOAT;
using tensorflow::DT_INT32;
using tensorflow::DT_INT64;
using tensorflow::DT_STRING;
using tensorflow::DataType;
using tensorflow::io::Dirname;
using tensorflow::io::JoinPath;
using tensorflow::OpKernel;
using tensorflow::OpKernelConstruction;
using tensorflow::OpKernelContext;
using tensorflow::ResourceMgr;
using tensorflow::Status;
using tensorflow::Tensor;
using tensorflow::TensorShape;

namespace syntaxnet {
namespace dragnn {

typedef ResourceContainer<ComputeSession> ComputeSessionResource;
typedef ResourceContainer<ComputeSessionPool> ComputeSessionPoolResource;
typedef ResourceContainer<string> StringResource;

namespace {

const char kGlobalContainer[] = "__reserved_global_container";
const char kBasePathTag[] = "__reserved_asset_base_path";
const char kUnmanagedAssetDirectory[] = "assets.extra";

// When restoring a graph from a SavedModel, this op will rewrite the MasterSpec
// to point the DRAGNN components to the new resource locations. It will then
// add a string resource to the resource manager, which will be used to
// rebuild the masterspec before it is acquired in the GetComputeSession op.
class SetAssetDirectory : public OpKernel {
 public:
  explicit SetAssetDirectory(OpKernelConstruction *context)
      : OpKernel(context) {
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {DT_STRING}));
  }

  void Compute(OpKernelContext *context) override {
    ResourceMgr *rmgr = context->resource_manager();
    const string asset_path = context->input(0).scalar<string>()();

    // TODO(googleuser): Get this data in a way that isn't fragile as all hell.
    // "I've done stuff I ain't proud of... and the stuff I am proud of is
    // disgusting." -- Moe
    auto extra_asset_dir =
        JoinPath(Dirname(Dirname(asset_path)), kUnmanagedAssetDirectory);
    LOG(INFO) << "Found extra assets path at:" << extra_asset_dir;

    // Rather than attempt to rewrite the MasterSpec here, we save off a
    // StringResource containing the new asset path. It will be used in
    // the GetSession op, if it exists.
    std::unique_ptr<string> asset_path_ptr(new string(extra_asset_dir));

    OP_REQUIRES_OK(context, rmgr->Create<StringResource>(
                                kGlobalContainer, kBasePathTag,
                                new StringResource(std::move(asset_path_ptr))));

    // This isn't used anywhere - it just allows us to have an output so that
    // it's easier to reason about Tensorflow's graph execution.
    Tensor *output;
    OP_REQUIRES_OK(context,
                   context->allocate_output(0, TensorShape({1}), &output));
    output->vec<string>()(0) = asset_path;
  }

 private:
  TF_DISALLOW_COPY_AND_ASSIGN(SetAssetDirectory);
};

REGISTER_KERNEL_BUILDER(Name("SetAssetDirectory").Device(DEVICE_CPU),
                        SetAssetDirectory);

// Given a MasterSpec proto, outputs a handle to a ComputeSession.
class GetSession : public OpKernel {
 public:
  explicit GetSession(OpKernelConstruction *context) : OpKernel(context) {
    string master_spec_str;
    string grid_point_spec_str;
    OP_REQUIRES_OK(context, context->GetAttr("master_spec", &master_spec_str));
    OP_REQUIRES_OK(context,
                   context->GetAttr("grid_point", &grid_point_spec_str));
    CHECK(master_spec_.ParseFromString(master_spec_str));
    CHECK(grid_point_.ParseFromString(grid_point_spec_str));
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {DT_STRING}));
    has_overwritten_spec_ = false;
  }

  void Compute(OpKernelContext *context) override {
    const string container = context->input(0).scalar<string>()();
    ResourceMgr *rmgr = context->resource_manager();

    // Create the pool for this container, or re-use one that was allocated in a
    // previous call.
    auto create_pool = [this, &rmgr,
                        &container](ComputeSessionPoolResource **resource) {
      if (has_overwritten_spec_) {
        // TODO(googleuser): Figure out a way to test this.
        // If there's already an overwritten spec, use that.
        LOG(INFO) << "Creating new ComputeSessionPool in container handle: "
                  << container << " with previously overwritten master spec.";
      } else {
        // If not, try to find the resource base.
        StringResource *resource_base;
        auto resource_base_lookup = rmgr->Lookup<StringResource>(
            kGlobalContainer, kBasePathTag, &resource_base);
        if (resource_base_lookup.ok()) {
          // If that exists, the spec must be rewritten.
          string resource_base_path = *resource_base->get();
          LOG(INFO) << "Creating new ComputeSessionPool in container handle: "
                    << container << " using resource directory base "
                    << resource_base_path;
          RewriteMasterSpec(resource_base_path);
          resource_base->Unref();
        } else {
          // If not, just use the spec as is.
          LOG(INFO) << "Creating new ComputeSessionPool in container handle: "
                    << container << " without editing master spec.";
        }
      }
      std::unique_ptr<ComputeSessionPool> pool(
          new ComputeSessionPool(master_spec_, grid_point_));
      *resource = new ComputeSessionPoolResource(std::move(pool));
      return Status::OK();
    };

    ComputeSessionPoolResource *pool_resource;

    // Synchronize access to the resource manager when getting or creating the
    // ComputeSessionPool.
    // Scoping for minimal mutex locking.
    {
      mutex_lock lock(lock_);
      OP_REQUIRES_OK(context,
                     rmgr->LookupOrCreate<ComputeSessionPoolResource>(
                         container, "pool", &pool_resource, create_pool));
    }
    ComputeSessionPool *pool = pool_resource->get();
    CHECK(pool != nullptr);

    // Get a new Session for this computation from the pool.
    std::unique_ptr<ComputeSession> session = pool->GetSession();
    const string id = std::to_string(session->Id());

    // Store it in the ResourceManager.
    OP_REQUIRES_OK(
        context,
        rmgr->Create<ComputeSessionResource>(
            container, id, new ComputeSessionResource(std::move(session))));

    Tensor *output;
    OP_REQUIRES_OK(context,
                   context->allocate_output(0, TensorShape({2}), &output));
    output->vec<string>()(0) = container;
    output->vec<string>()(1) = id;

    // Unref the pool so it gets destroyed properly.
    pool_resource->Unref();
    VLOG(1) << "Returning session: " << id;
  }

 private:
  // Rewrites this op's saved MasterSpec, appending the new base directory.
  void RewriteMasterSpec(const string &new_base) {
    for (auto &component_spec : *master_spec_.mutable_component()) {
      for (auto &resource_def : *component_spec.mutable_resource()) {
        for (auto &part_def : *resource_def.mutable_part()) {
          part_def.set_file_pattern(
              JoinPath(new_base, part_def.file_pattern()));
          VLOG(2) << "New path: " << part_def.file_pattern();
        }
      }
    }

    VLOG(3) << "Rewritten spec: " << master_spec_.DebugString();
    has_overwritten_spec_ = true;
  }

  bool has_overwritten_spec_;
  MasterSpec master_spec_;
  GridPoint grid_point_;

  // Mutex that serializes accesses to the resource manager. (These would block
  // in the compute session pool anyways, so there's no regression there, and
  // we need to protect from racy multiple initialization.)
  tensorflow::mutex lock_;

  TF_DISALLOW_COPY_AND_ASSIGN(GetSession);
};

REGISTER_KERNEL_BUILDER(Name("GetSession").Device(DEVICE_CPU), GetSession);

// Given a handle to a ComputeSession, returns it to the pool. As long as we
// start with "GetSession", DRAGNN graphs are thread-safe and there is no need
// for explicit multi-thread logic. As long as we end with "ReleaseSession",
// then memory usage will be constrained to the maximum number of concurrent
// requests.
class ReleaseSession : public OpKernel {
 public:
  explicit ReleaseSession(OpKernelConstruction *context) : OpKernel(context) {
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {}));
  }

  void Compute(OpKernelContext *context) override {
    auto handle = context->input(0).vec<string>();
    const string &container = handle(0);
    const string &id = handle(1);
    VLOG(1) << "Releasing session: " << id;
    ResourceMgr *rmgr = context->resource_manager();

    // Get the pool for this container.
    ComputeSessionPoolResource *pool_resource;
    TF_CHECK_OK(rmgr->Lookup<ComputeSessionPoolResource>(container, "pool",
                                                         &pool_resource));
    auto *pool = pool_resource->get();
    CHECK(pool != nullptr);

    // Get the compute session.
    ComputeSessionResource *session_resource;
    TF_CHECK_OK(
        rmgr->Lookup<ComputeSessionResource>(container, id, &session_resource));

    // We need to release the ComputeSession from both the ResourceMgr and
    // the ComputeSessionPool. The order of release is critical. If the
    // resource is not first Delete()-ed from the ResourceMgr, then another
    // thread may try to Create() the same resource, resulting in an
    // "Already exists" error.
    //
    // First, delete the ResourceMgr reference so it can be used in the future.
    TF_CHECK_OK(rmgr->Delete<ComputeSessionResource>(container, id));

    // Second, return the ComputeSession to the pool.
    pool->ReturnSession(session_resource->release());

    // Unref the resources so they get destroyed properly.
    session_resource->Unref();
    pool_resource->Unref();
  }

 private:
  TF_DISALLOW_COPY_AND_ASSIGN(ReleaseSession);
};

REGISTER_KERNEL_BUILDER(Name("ReleaseSession").Device(DEVICE_CPU),
                        ReleaseSession);

// Returns statistics about session loads to the graph. This op returns the
// total number of created Session objects and the number of those objects
// that are currently being used in the ComputeSessionPool.
class GetSessionCounts : public OpKernel {
 public:
  explicit GetSessionCounts(OpKernelConstruction *context) : OpKernel(context) {
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {DT_INT64}));
  }

  void Compute(OpKernelContext *context) override {
    const string container = context->input(0).scalar<string>()();
    VLOG(1) << "Getting stats for container: " << container;
    ResourceMgr *rmgr = context->resource_manager();

    // Allocate the output tensors.
    Tensor *output;
    OP_REQUIRES_OK(context,
                   context->allocate_output(0, TensorShape({2}), &output));

    // Get the pool for this container.
    ComputeSessionPoolResource *pool_resource;
    auto result = rmgr->Lookup<ComputeSessionPoolResource>(container, "pool",
                                                           &pool_resource);
    if (!result.ok()) {
      // If there's no ComputeSessionPoolResource, report 0 sessions created
      // and 0 available.
      output->vec<int64>()(0) = 0;
      output->vec<int64>()(1) = 0;
      return;
    }

    auto *pool = pool_resource->get();
    CHECK(pool != nullptr);

    output->vec<int64>()(0) = pool->num_unique_sessions();
    output->vec<int64>()(1) = pool->num_outstanding_sessions();

    pool_resource->Unref();
  }

 private:
  TF_DISALLOW_COPY_AND_ASSIGN(GetSessionCounts);
};

REGISTER_KERNEL_BUILDER(Name("GetSessionCounts").Device(DEVICE_CPU),
                        GetSessionCounts);

/*******************************************************************************
 *                   ComputeSessionOps below here.
 ******************************************************************************/

// Given a handle to a BatchedBeamComponentState, advances based on the next
// oracle (gold) action.
class AdvanceFromOracle : public ComputeSessionOp {
 public:
  explicit AdvanceFromOracle(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {DT_STRING}));
  }

  bool OutputsHandle() const override { return true; }
  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    session->AdvanceFromOracle(component_name());
  }

 private:
  TF_DISALLOW_COPY_AND_ASSIGN(AdvanceFromOracle);
};

REGISTER_KERNEL_BUILDER(Name("AdvanceFromOracle").Device(DEVICE_CPU),
                        AdvanceFromOracle);

// Given a handle to a BatchedBeamComponentState and a tensor of scores,
// advances the state. The tensor of scores has shape batch_size x beam_size
// x num_actions.
class AdvanceFromPrediction : public ComputeSessionOp {
 public:
  explicit AdvanceFromPrediction(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context,
                   context->MatchSignature({DT_STRING, DT_FLOAT}, {DT_STRING}));
  }

  bool OutputsHandle() const override { return true; }
  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    const Tensor &scores = context->input(1);
    const int num_items = scores.shape().dim_size(0);
    const int num_actions = scores.shape().dim_size(1);
    bool success = session->AdvanceFromPrediction(
        component_name(), scores.tensor<float, 2>().data(), num_items,
        num_actions);
    if (success) {
      VLOG(2) << "Score: " << scores.tensor<float, 2>();
    }
    OP_REQUIRES(
        context, success,
        tensorflow::errors::Internal("Unable to advance from prediction."));
  }

 private:
  TF_DISALLOW_COPY_AND_ASSIGN(AdvanceFromPrediction);
};

REGISTER_KERNEL_BUILDER(Name("AdvanceFromPrediction").Device(DEVICE_CPU),
                        AdvanceFromPrediction);

// Given a handle to a ComputeSession and a channel index, outputs fixed
// features.
// Fixed features are returned as 3 vectors of equal length:
//   - ids: specifies which rows should be looked up in the embedding
//   matrix,
//   - weights: specifies a scale for each embedding vector,
//   - indices: sorted vector that assigns the same index to embedding
//   vectors that should be summed together.
//
// For example if we have 3 features, for a given channel, we might have:
//   feature a: (5, 1)
//   feature b: (5, 0.5), (6, 0.5)
//   feature c: (7, 1)
// In this case:
//   indices should look like: [0, 1, 1, 2]
//   ids should be [5, 5, 6, 7]
//   weights should be [1, 0.5, 0.5, 1]
class ExtractFixedFeatures : public ComputeSessionOp {
 public:
  explicit ExtractFixedFeatures(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context, context->GetAttr("channel_id", &channel_id_));
    OP_REQUIRES_OK(context, context->MatchSignature(
                                {DT_STRING}, {DT_INT32, DT_INT64, DT_FLOAT}));
  }

  bool OutputsHandle() const override { return false; }
  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    // Allocates output tensors.
    auto indices_allocator = [context](int num_elements) {
      Tensor *output;
      CHECK(context->allocate_output(0, TensorShape({num_elements}), &output)
                .ok());
      return output->vec<int32>().data();
    };
    auto ids_allocator = [context](int num_elements) {
      Tensor *ids_tensor;
      CHECK(
          context->allocate_output(1, TensorShape({num_elements}), &ids_tensor)
              .ok());
      return ids_tensor->vec<int64>().data();
    };
    auto weights_allocator = [context](int num_elements) {
      Tensor *output;
      CHECK(context->allocate_output(2, TensorShape({num_elements}), &output)
                .ok());
      return output->vec<float>().data();
    };
    int num_features = session->GetInputFeatures(
        component_name(), indices_allocator, ids_allocator, weights_allocator,
        channel_id_);
    VLOG(2) << "Extracted features (" << num_features << "): "
            << " ids="     << context->mutable_output(1)->vec<int64>()
            << " weights=" <<  context->mutable_output(2)->vec<float>()
            << " indices=" << context->mutable_output(0)->vec<int32>();
  }

 private:
  int channel_id_;
  TF_DISALLOW_COPY_AND_ASSIGN(ExtractFixedFeatures);
};

REGISTER_KERNEL_BUILDER(Name("ExtractFixedFeatures").Device(DEVICE_CPU),
                        ExtractFixedFeatures);

// Given a handle to a ComputeSession and a channel index, outputs link
// features. Link features are returned as two vectors of length batch_size *
// beam_size * channel_size:
//   - step_idx: specifies the element to read in a tensor array of activations,
//   - idx: specifies the row within the tensor array element.
class ExtractLinkFeatures : public ComputeSessionOp {
 public:
  explicit ExtractLinkFeatures(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context, context->GetAttr("channel_id", &channel_id_));
    OP_REQUIRES_OK(context,
                   context->MatchSignature({DT_STRING}, {DT_INT32, DT_INT32}));
  }

  bool OutputsHandle() const override { return false; }
  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    auto features =
        session->GetTranslatedLinkFeatures(component_name(), channel_id_);

    // Computes output size.
    const int64 num_indices = features.size();

    // Allocates output tensors.
    Tensor *step_idx_output;
    Tensor *idx_output;
    OP_REQUIRES_OK(context,
                   context->allocate_output(0, TensorShape({num_indices}),
                                            &step_idx_output));
    OP_REQUIRES_OK(context, context->allocate_output(
                                1, TensorShape({num_indices}), &idx_output));

    const int source_beam_size =
        session->SourceComponentBeamSize(component_name(), channel_id_);
    VLOG(2) << "source_beam_size:" << source_beam_size;

    // Clip step_idx for all features. If a feature is empty, set the step
    // index to -1.
    for (int i = 0; i < features.size(); ++i) {
      if (!features[i].has_step_idx() || features[i].step_idx() < -1) {
        features[i].set_step_idx(-1);
      }
    }

    // Fills output tensors.
    for (int i = 0; i < features.size(); ++i) {
      // Sets the element to read from a tensor array of activations.
      step_idx_output->vec<int32>()(i) = features[i].step_idx();

      // Within the tensor array element the id has to account for beam index
      // and batch index for this specific component state.
      idx_output->vec<int32>()(i) =
          features[i].step_idx() >= 0
              ? OutputLinearIndex(features[i], source_beam_size)
              : 0;

      VLOG(2) << "features[" << i << "]: " << features[i].ShortDebugString();
    }
  }

 private:
  // Given the beam index and the batch index in a LinkFeatures proto, returns
  // the corresponding linear index, assuming that the matrix we're indexing
  // into has shape {batch_size * beam_size, activation_size}, reshaped from a
  // tensor of shape {batch_size, beam_size, activation_size}.
  static uint64 OutputLinearIndex(const LinkFeatures &feature,
                                  const int beam_size) {
    VLOG(2) << "OutputLinearIndex batch_idx:" << feature.batch_idx()
            << " beam_size:" << beam_size << " beam_idx:" << feature.beam_idx();
    return feature.batch_idx() * beam_size + feature.beam_idx();
  }

  int channel_id_;
  TF_DISALLOW_COPY_AND_ASSIGN(ExtractLinkFeatures);
};

REGISTER_KERNEL_BUILDER(Name("ExtractLinkFeatures").Device(DEVICE_CPU),
                        ExtractLinkFeatures);

// Given a handle to a BatchedBeamComponentState, emits a vector of gold
// labels.
// The vector of gold labels has size batch_size * beam_size.
class EmitOracleLabels : public ComputeSessionOp {
 public:
  explicit EmitOracleLabels(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {DT_INT32}));
  }
  bool OutputsHandle() const override { return false; }
  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    VLOG(2) << "state->BatchSize: " << session->BatchSize(component_name());
    VLOG(2) << "state->BeamSize: " << session->BeamSize(component_name());
    Tensor *output;
    OP_REQUIRES_OK(context,
                   context->allocate_output(
                       0,
                       TensorShape({session->BatchSize(component_name()) *
                                    session->BeamSize(component_name())}),
                       &output));
    std::vector<std::vector<int>> batched_labels =
        session->EmitOracleLabels(component_name());
    int raw_index = 0;
    for (const auto &batch_vector : batched_labels) {
      for (const auto &label : batch_vector) {
        output->vec<int32>()(raw_index) = label;
        ++raw_index;
      }
    }
  }

 private:
  TF_DISALLOW_COPY_AND_ASSIGN(EmitOracleLabels);
};

REGISTER_KERNEL_BUILDER(Name("EmitOracleLabels").Device(DEVICE_CPU),
                        EmitOracleLabels);

// Given a handle to a ComponentState, emits a single bool indicating
// whether all elements in the batch contain beams containing all final states.
class EmitAllFinal : public ComputeSessionOp {
 public:
  explicit EmitAllFinal(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {DT_BOOL}));
  }

  bool OutputsHandle() const override { return false; }
  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    Tensor *output;
    OP_REQUIRES_OK(context,
                   context->allocate_output(0, TensorShape({1}), &output));
    const bool is_terminal = session->IsTerminal(component_name());
    VLOG(2) << "EmitAllFinal: is_terminal = " << is_terminal;
    output->vec<bool>()(0) = is_terminal;
  }

 private:
  TF_DISALLOW_COPY_AND_ASSIGN(EmitAllFinal);
};

REGISTER_KERNEL_BUILDER(Name("EmitAllFinal").Device(DEVICE_CPU), EmitAllFinal);

// Prepares the given component for computation.
class InitComponentData : public ComputeSessionOp {
 public:
  explicit InitComponentData(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context,
                   context->MatchSignature({DT_STRING, DT_INT32}, {DT_STRING}));
  }

  bool OutputsHandle() const override { return true; }

  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    const int beam_size = context->input(1).scalar<int32>()();
    session->InitializeComponentData(component_name(), beam_size);
  }
};

REGISTER_KERNEL_BUILDER(Name("InitComponentData").Device(DEVICE_CPU),
                        InitComponentData);

// Returns the given component's batch size.
class BatchSize : public ComputeSessionOp {
 public:
  explicit BatchSize(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {DT_INT32}));
  }

  bool OutputsHandle() const override { return false; }
  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    Tensor *output;
    OP_REQUIRES_OK(context,
                   context->allocate_output(0, TensorShape({}), &output));
    output->scalar<int>()() = session->BatchSize(component_name());
  }
};

REGISTER_KERNEL_BUILDER(Name("BatchSize").Device(DEVICE_CPU), BatchSize);

// Attaches a data source to the master.
class AttachDataReader : public ComputeSessionOp {
 public:
  explicit AttachDataReader(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(
        context, context->MatchSignature({DT_STRING, DT_STRING}, {DT_STRING}));
  }

  bool OutputsHandle() const override { return true; }
  bool RequiresComponentName() const override { return false; }

  // Calls SetInputData() on the ComputeSession.
  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    auto input_data(context->input(1).vec<string>());

    std::vector<string> data;
    data.reserve(input_data.size());
    for (int i = 0; i < input_data.size(); ++i) {
      data.push_back(input_data(i));
    }
    session->SetInputData(data);
  }
};

REGISTER_KERNEL_BUILDER(Name("AttachDataReader").Device(DEVICE_CPU),
                        AttachDataReader);

// Sets the tracing flag on the master state, which will enable or disable
// tracing as inference / training is run.
class SetTracing : public ComputeSessionOp {
 public:
  explicit SetTracing(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context,
                   context->MatchSignature({DT_STRING, DT_BOOL}, {DT_STRING}));
  }

  bool OutputsHandle() const override { return true; }
  bool RequiresComponentName() const override { return false; }

  // Calls SetTracing() on the ComputeSession.
  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    auto tracing_on = context->input(1).scalar<bool>()();
    session->SetTracing(tracing_on);
  }
};

REGISTER_KERNEL_BUILDER(Name("SetTracing").Device(DEVICE_CPU), SetTracing);

class WriteAnnotations : public ComputeSessionOp {
 public:
  explicit WriteAnnotations(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {DT_STRING}));
  }

  bool OutputsHandle() const override { return true; }
  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    session->FinalizeData(component_name());
  }
};

REGISTER_KERNEL_BUILDER(Name("WriteAnnotations").Device(DEVICE_CPU),
                        WriteAnnotations);

// Given a handle to a ComponentState, emits a vector of strings
// corresponding to the serialized predictions of the model.
class EmitAnnotations : public ComputeSessionOp {
 public:
  explicit EmitAnnotations(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {DT_STRING}));
  }

  bool OutputsHandle() const override { return false; }
  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    // Get the annotations from the state.
    auto annotations = session->GetSerializedPredictions();

    // Copy annotations to the output.
    Tensor *output;
    const int64 output_size = annotations.size();
    OP_REQUIRES_OK(context, context->allocate_output(
                                0, TensorShape({output_size}), &output));
    auto annotations_output = output->vec<string>();
    for (int i = 0; i < annotations.size(); ++i) {
      annotations_output(i) = annotations[i];
    }
  }

 private:
  TF_DISALLOW_COPY_AND_ASSIGN(EmitAnnotations);
};

REGISTER_KERNEL_BUILDER(Name("EmitAnnotations").Device(DEVICE_CPU),
                        EmitAnnotations);

// Get the component trace.
class GetComponentTrace : public ComputeSessionOp {
 public:
  explicit GetComponentTrace(OpKernelConstruction *context)
      : ComputeSessionOp(context) {
    OP_REQUIRES_OK(context, context->MatchSignature({DT_STRING}, {DT_STRING}));
  }

  bool OutputsHandle() const override { return false; }
  bool RequiresComponentName() const override { return true; }

  void ComputeWithState(OpKernelContext *context,
                        ComputeSession *session) override {
    auto traces = session->GetTraceProtos();

    const int64 size = traces.size();
    Tensor *trace_output_tensor;
    OP_REQUIRES_OK(context, context->allocate_output(0, TensorShape({size}),
                                                     &trace_output_tensor));
    auto trace_output = trace_output_tensor->vec<string>();
    for (int i = 0; i < size; ++i) {
      CHECK(traces[i].SerializeToString(&trace_output(i)));
    }
  }

  TF_DISALLOW_COPY_AND_ASSIGN(GetComponentTrace);
};

REGISTER_KERNEL_BUILDER(Name("GetComponentTrace").Device(DEVICE_CPU),
                        GetComponentTrace);

}  // namespace
}  // namespace dragnn
}  // namespace syntaxnet


text:
#pragma once

#include "AboutBox.g.h"

namespace FingerPaint
{
    [Windows::Foundation::Metadata::WebHostHidden]
    public ref class AboutBox sealed
    {
    public:
        AboutBox();

    private:
        void OnBackButtonClick(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^  args);
    };
}


text:
PACKAGES="sys-apps/busybox"
EMERGE_BIN="emerge-x86_64-pc-linux-uclibc"

#
# this method runs in the bb builder container just before starting the build of the rootfs
#
configure_rootfs_build()
{
    echo "sys-apps/busybox make-symlinks static" > /usr/x86_64-pc-linux-uclibc/etc/portage/package.use/busybox
}

#
# this method runs in the bb builder container just before tar'ing the rootfs
#
finish_rootfs_build()
{
    # log dir, root home dir
    mkdir -p $EMERGE_ROOT/var/log $EMERGE_ROOT/root
    # busybox crond setup
    mkdir -p $EMERGE_ROOT/var/spool/cron/crontabs
    chmod 0600 $EMERGE_ROOT/var/spool/cron/crontabs
}


text:
public var Rb : Rigidbody;

// The target marker (that we "moveTowards")
public var target : Transform;

// Speed of Movement in units per sec
// <-- WAS ORIGINALLY PRIVATE VAR -->
public var speed : float = 4.0;

// For movement
public var pos : Vector3;

// indicate if a keyboard input can move a piece
// this is when the player is attached/ontop of grid
public var canMove : boolean = true;

// indicate if the player (Marty) has switched on the train or not, starts at false
public var trainSwitched : boolean = false;

// used to always check if the player is on the grid (attached/in the same position)
public var gridTile : GameObject;

// variable to hold bullet prefab that will spwawn whenever Marty has ammo and "shoots"
public var theBullet : GameObject;

// used when checking to see if Marty is close enough to enter DeLorean (if not already inside)
public var theDeLorean : GameObject;

// used when checking to see if Marty is close enough to enter the Cement Truck (if not already inside)
public var theCTruck : GameObject;

// used when checking to see if Marty is close enough to enter the Manure Truck (if not already inside)
public var theMTruck : GameObject;

// the distance between Marty and the DeLorean itself (in units)
public var distanceBetweenD : float;
public var distanceBetweenC : float;
public var distanceBetweenM : float;

// the distance between Marty and a standard vehicle (cement truck/manure truck)
public var distanceBetweenV : float;

// boolean to determine if the player is in a vehicle or not
public var isInVehicle : boolean = false;

// For determining when/where to block and sprite rotation
public var isRight : boolean = false;
public var isLeft : boolean = false;
public var isUp : boolean = false;
public var isDown : boolean = false;

public var enteredBorder : boolean = false;

// used to get the CTruckControllerScript
public var CTruckControllerObj : Transform;

// variable that will hold the reference to the target script (CTruckController)
public var CTruckControllerScript : CTruckController;

// used to get the CTruckControllerScript
public var MTruckControllerObj : Transform;

// variable that will hold the reference to the target script (MTruckController)
public var MTruckControllerScript : MTruckController;

// used to get the DeLoreanControllerScript
public var DControllerObj : Transform;

// variable that will hold the reference to the target script (DeLoreanController)
public var DControllerScript : DeLoreanController;

// use this for pre-initialization
function Awake ()
{

	// get a reference to the target script (DeLoreanController)
	DControllerScript = new DControllerObj.GetComponent (DeLoreanController);

	// get a reference to the target script (CTruckController)
	CTruckControllerScript = new CTruckControllerObj.GetComponent (CTruckController);

	// get a reference to the target script (MTruckController)
	MTruckControllerScript = new MTruckControllerObj.GetComponent (MTruckController);

	// intializes the RigidBody variable that is attached to Marty (player)
	Rb = transform.GetComponent(Rigidbody);

}

// use this for initialization
function Start ()
{

	// Take the initial position
	pos = transform.position;

}

// called once per frame
function Update ()
{

	// The step size is equal to speed times frame time.
	var step = speed * Time.deltaTime;

	// move right if able (canMove == true) and  flux Capacitor has set isRight == true
	if (isRight && canMove)				// "GetKey" is the auto-fire setting
	{

		// Shorthand for writing Vector3(1, 0, 0).
		pos = Vector3.right;

		transform.Translate (pos * step);

	}
	// move left if able (canMove == true) and flux Capacitor has set isLeft == true
	else if (isLeft && canMove)
	{

		// Shorthand for writing Vector3(-1, 0, 0).
		pos = Vector3.left;

		transform.Translate (pos * step);

	}
	// move up if able (canMove == true) and flux Capacitor has set isUp == true
	else if (isUp && canMove)
	{

		Debug.Log("moving up?");

		// Shorthand for writing Vector3(0, 1, 0).
		pos = Vector3.up;

		transform.Translate (pos * step);

	}
	// move down if able (canMove == true) and flux Capacitor has set isDown == true
	else if (isDown && canMove)
	{

		// Shorthand for writing Vector3(0, -1, 0).
		pos = Vector3.down;

		transform.Translate (pos * step);

	}
	//  ENTER VEHICLE/DELOREAN
	else if (Input.GetKeyDown (KeyCode.E) && canMove)
	{

		// call measure Distance function
		MeasureDistance ();

		if (distanceBetweenD <= 2.00)
		{

			Debug.Log ("INSIDE DELOREAN");

			// ENTER THE DELOREAN IF WITHIN RANGE
			DControllerScript.inVehicle = true;

		}
		else if (distanceBetweenC <= 2.00)
		{

			Debug.Log ("INSIDE C-TRUCK");

			// ENTER THE C-TRUCK IF WITHIN RANGE
			CTruckControllerScript.inVehicle = true;

		}
		else if (distanceBetweenM <= 2.00)
		{

			Debug.Log ("INSIDE M-TRUCK");

			// ENTER THE M-TRUCK IF WITHIN RANGE
			MTruckControllerScript.inVehicle = true;

		}

	}
	else if (Input.GetKeyDown (KeyCode.Space) && canMove)
	{

		if (isRight)
		{

			Debug.Log ("Fire a bullet right");

		}
		else if (isLeft)
		{

			Debug.Log ("Fire a bullet left");

		}
		else if (isUp)
		{

			Debug.Log ("Fire a bullet up");

		}
		else if (isDown)
		{

			Debug.Log ("Fire a bullet down");

		}

	}
	else if (Input.GetKeyDown (KeyCode.P) && canMove)
	{

		trainSwitched = true;

		Debug.Log ("trainSwitched= " + trainSwitched);

	}

	// if Marty (the player) is inside the DeLorean (Vehicle)
	if (DControllerScript.inVehicle)
	{

		// make Marty as fast as the car so when he moves along (inside) it, they go same speed
		speed = 7.0;

		// Marty follows the same movements as the Vehicle (following it while inside)
		transform.position = theDeLorean.transform.position;

		// he can no longer move
		canMove = false;

	}
	// if Marty (the player) is inside the Cement Truck (Vehicle)
	else if (CTruckControllerScript.inVehicle)
	{

		// make Marty as fast as the car so when he moves along (inside) it, they go same speed
		speed = 4.5;

		// Marty follows the same movements as the Vehicle (following it while inside)
		transform.position = theCTruck.transform.position;

		// he can no longer move
		canMove = false;

	}
	// if Marty (the player) is inside the Manure Truck (Vehicle)
	else if (MTruckControllerScript.inVehicle)
	{

		// make Marty as fast as the car so when he moves along (inside) it, they go same speed
		speed = 4.5;

		// Marty follows the same movements as the Vehicle (following it while inside)
		transform.position = theMTruck.transform.position;

		// he can no longer move
		canMove = false;

	}

	// if the DeLorean has already traveled back in time (Marty gets kicked out)
	if (DControllerScript.eighty8MphScript.backInTime)
	{

		speed = 4.0;

	}

}

// Used for Graphical User Interface
function OnGUI ()
{

	if (canMove)
	{

	}

}

function OnTriggerEnter (other : Collider)
{

	// If the player is "colliding" (connected) to a 'GridTile' object
	if (other.tag == "GridTile")
	{

	}
	else if (other.tag == "Road")
	{

		//Debug.Log ("sup bro? on the road again?");

	}
	else if (other.tag == "Border")
	{

		enteredBorder = true;

		CheckIfBoundary ();

	}
	else if (other.tag == "Building")
	{

		enteredBorder = true;

		CheckIfBoundary ();

	}

}

function OnTriggerStay (other : Collider)
{

	if (other.tag == "Border")
	{

		CheckIfBoundary ();

	}
	else if (other.tag == "Building")
	{

		CheckIfBoundary ();

	}

}

function OnTriggerExit (other : Collider)
{

	enteredBorder = false;

}

// Awesome function that checks if the object that this script is attached to has hit
// a boundary or not, and if it has, it push it a little the other way (blocking it)
function CheckIfBoundary ()
{

	// If we are moving to the right
	if (isRight)
	{

		// translate the DeLorean so that it is pushed to left (blocked)
		// left = 0.1 to the left
		transform.Translate (Vector3 (-0.1f, 0f, 0f));

	}
	// If we are moving to the right
	else if (isLeft)
	{

		// translate the DeLorean so that it is pushed to right (blocked)
		// right = 0.1 to the right (-0.1)
		transform.Translate (Vector3 (0.1f, 0f, 0f));

	}
	// IF we are moving upwards
	else if (isUp)
	{

		// translate the DeLorean so that it is pushed down (blocked)
		// down = 0.1 downwards (0.1)
		transform.Translate (Vector3 (0f, -0.1f, 0f));

	}
	// If we are moving downwards
	else if (isDown)
	{

		// translate the DeLorean so that it is pushed to up (blocked)
		// up = 0.1 upwards
		transform.Translate (Vector3 (0f, 0.1f, 0f));

	}

}

public function MeasureDistance ()
{

	// Determines the distance by subtracting the position of the DeLorean by position of Marty
	distanceBetweenD = Vector3.Distance (theDeLorean.transform.position, transform.position);
	distanceBetweenC = Vector3.Distance (theCTruck.transform.position, transform.position);
	distanceBetweenM = Vector3.Distance (theMTruck.transform.position, transform.position);

	//Debug.Log ("Distance between DeLorean: " + distanceBetweenD);
	//Debug.Log ("Distance between CTruck: " + distanceBetweenC);
	//Debug.Log ("Distance between MTruck: " + distanceBetweenM);

}


text:
"use strict";
var fx = require("framework");
var Class = fx.import("framework.Class");
var App = fx.import("framework.app.App");
var ImageView = fx.import("framework.ui.view.ImageView");
var PropertyAnimation = fx.import("framework.ui.animation.PropertyAnimation");

Class.define("MyApp", App, {
    onStart: function() {
        for (var i = 0; i < 10; i++) {
            var imageView = new ImageView();
            imageView.src = global.app.rootPath + "/res/ic_launcher.png";
            imageView.left = 10 + i * 20;
            imageView.top = 10 + (i % 5) * 20;
            imageView.originX = 50;
            imageView.originY = 50;
            imageView.width = 100;
            imageView.height = 100;

            this.window.addChild(imageView);

            var animation = new PropertyAnimation(imageView);
            animation.from = {rotationZ: 0 * Math.PI / 180, width: 100, height: 100, opacity: 0};
            animation.to = {rotationZ: 360 * Math.PI / 180, width: 200, height: 200, opacity: 1};
            animation.duration = 1000;
            animation.repeat = "infinite";
            animation.easing = "cubic-bezier(0.42, 0, 0.58, 1.0)";
            animation.start();
        }
    }
}, module);


text:
IMAGE=py3qt5
docker tag $IMAGE tzutalin/$IMAGE
docker push tzutalin/$IMAGE


text:
<?php

declare(strict_types=1);

namespace Railt\TypeSystem\Collection;

use GraphQL\Contracts\TypeSystem\DefinitionInterface;
use GraphQL\Contracts\TypeSystem\Type\NamedTypeInterface;
use Railt\TypeSystem\Exception\TypeUniquenessException;

/**
 * Class TypeMap
 */
class TypeMap implements \IteratorAggregate, \Countable, \ArrayAccess
{
    /**
     * @var string
     */
    private const ERROR_TYPE_UNIQUENESS = 'Type "%s" already exists';

    /**
     * @var array|NamedTypeInterface[]
     */
    protected array $types = [];

    /**
     * Collection constructor.
     *
     * @param iterable|NamedTypeInterface[] $types
     */
    public function __construct(iterable $types = [])
    {
        foreach ($types as $type) {
            $this->offsetSet(null, $type);
        }
    }

    /**
     * {@inheritDoc}
     *
     * @param string $name
     */
    public function offsetExists($name): bool
    {
        \assert(\is_string($name));

        return isset($this->types[$name]);
    }

    /**
     * {@inheritDoc}
     *
     * @param string $name
     * @return DefinitionInterface|null
     */
    public function offsetGet($name): ?DefinitionInterface
    {
        \assert(\is_string($name));

        return $this->types[$name] ?? null;
    }

    /**
     * {@inheritDoc}
     *
     * @param string|null $offset
     * @param DefinitionInterface $type
     * @return void
     */
    public function offsetSet($offset, $type): void
    {
        \assert($type instanceof NamedTypeInterface);

        if (isset($this->types[$type->getName()])) {
            throw new TypeUniquenessException(\sprintf(self::ERROR_TYPE_UNIQUENESS, $type->getName()));
        }

        $this->types[$type->getName()] = $type;
    }

    /**
     * {@inheritDoc}
     *
     * @param string $name
     * @return void
     */
    public function offsetUnset($name): void
    {
        \assert(\is_string($name));

        unset($this->types[$name]);
    }

    /**
     * {@inheritDoc}
     *
     * @return NamedTypeInterface[]
     */
    public function getIterator(): \Traversable
    {
        return new \ArrayIterator($this->types);
    }

    /**
     * {@inheritDoc}
     */
    public function count(): int
    {
        return \count($this->types);
    }

    /**
     * @return void
     */
    public function __clone()
    {
        foreach ($this->types as $name => $type) {
            $this->types[$name] = clone $type;
        }
    }
}


text:
<?php

/*
 * This file is part of Sulu.
 *
 * (c) MASSIVE ART WebServices GmbH
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Sulu\Component\Webspace\Loader\Exception;

/**
 * Represents a wrong error template configuration.
 */
class InvalidErrorTemplateException extends WebspaceException
{
    /**
     * @var string
     */
    private $template;

    /**
     * InvalidErrorTemplateException constructor.
     *
     * @param string $template
     * @param string $webspace
     */
    public function __construct($template, $webspace)
    {
        parent::__construct(
            sprintf(
                'Error template "%s" in webspace "%s" has to be defined as default or with a code.',
                $template,
                $webspace
            )
        );

        $this->template = $template;
        $this->webspace = $webspace;
    }

    /**
     * @return string
     */
    public function getTemplate()
    {
        return $this->template;
    }
}


text:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <winpr/crt.h>
#include <winpr/sspi.h>
#include <winpr/print.h>

#include "schannel_openssl.h"

char* openssl_get_ssl_error_string(int ssl_error)
{
	switch (ssl_error)
	{
		case SSL_ERROR_ZERO_RETURN:
			return "SSL_ERROR_ZERO_RETURN";

		case SSL_ERROR_WANT_READ:
			return "SSL_ERROR_WANT_READ";

		case SSL_ERROR_WANT_WRITE:
			return "SSL_ERROR_WANT_WRITE";

		case SSL_ERROR_SYSCALL:
			return "SSL_ERROR_SYSCALL";

		case SSL_ERROR_SSL:
			ERR_print_errors_fp(stdout);
			return "SSL_ERROR_SSL";
	}

	return "SSL_ERROR_UNKNOWN";
}

int schannel_openssl_client_init(SCHANNEL_OPENSSL* context)
{
	int status;
	long options = 0;

	context->ctx = SSL_CTX_new(TLSv1_client_method());

	if (!context->ctx)
	{
		printf("SSL_CTX_new failed\n");
		return -1;
	}

	/**
	 * SSL_OP_NO_COMPRESSION:
	 *
	 * The Microsoft RDP server does not advertise support
	 * for TLS compression, but alternative servers may support it.
	 * This was observed between early versions of the FreeRDP server
	 * and the FreeRDP client, and caused major performance issues,
	 * which is why we're disabling it.
	 */
#ifdef SSL_OP_NO_COMPRESSION
	options |= SSL_OP_NO_COMPRESSION;
#endif

	/**
	 * SSL_OP_TLS_BLOCK_PADDING_BUG:
	 *
	 * The Microsoft RDP server does *not* support TLS padding.
	 * It absolutely needs to be disabled otherwise it won't work.
	 */
	options |= SSL_OP_TLS_BLOCK_PADDING_BUG;

	/**
	 * SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:
	 *
	 * Just like TLS padding, the Microsoft RDP server does not
	 * support empty fragments. This needs to be disabled.
	 */
	options |= SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;

	SSL_CTX_set_options(context->ctx, options);

	context->ssl = SSL_new(context->ctx);

	if (!context->ssl)
	{
		printf("SSL_new failed\n");
		return -1;
	}

	context->bioRead = BIO_new(BIO_s_mem());

	if (!context->bioRead)
	{
		printf("BIO_new failed\n");
		return -1;
	}

	status = BIO_set_write_buf_size(context->bioRead, SCHANNEL_CB_MAX_TOKEN);

	context->bioWrite = BIO_new(BIO_s_mem());

	if (!context->bioWrite)
	{
		printf("BIO_new failed\n");
		return -1;
	}

	status = BIO_set_write_buf_size(context->bioWrite, SCHANNEL_CB_MAX_TOKEN);

	status = BIO_make_bio_pair(context->bioRead, context->bioWrite);

	SSL_set_bio(context->ssl, context->bioRead, context->bioWrite);

	context->ReadBuffer = (BYTE*) malloc(SCHANNEL_CB_MAX_TOKEN);
	context->WriteBuffer = (BYTE*) malloc(SCHANNEL_CB_MAX_TOKEN);

	return 0;
}

int schannel_openssl_server_init(SCHANNEL_OPENSSL* context)
{
	int status;
	long options = 0;

	context->ctx = SSL_CTX_new(SSLv23_server_method());

	if (!context->ctx)
	{
		printf("SSL_CTX_new failed\n");
		return -1;
	}

	/*
	 * SSL_OP_NO_SSLv2:
	 *
	 * We only want SSLv3 and TLSv1, so disable SSLv2.
	 * SSLv3 is used by, eg. Microsoft RDC for Mac OS X.
	 */
	options |= SSL_OP_NO_SSLv2;

	/**
	 * SSL_OP_NO_COMPRESSION:
	 *
	 * The Microsoft RDP server does not advertise support
	 * for TLS compression, but alternative servers may support it.
	 * This was observed between early versions of the FreeRDP server
	 * and the FreeRDP client, and caused major performance issues,
	 * which is why we're disabling it.
	 */
#ifdef SSL_OP_NO_COMPRESSION
	options |= SSL_OP_NO_COMPRESSION;
#endif

	/**
	 * SSL_OP_TLS_BLOCK_PADDING_BUG:
	 *
	 * The Microsoft RDP server does *not* support TLS padding.
	 * It absolutely needs to be disabled otherwise it won't work.
	 */
	options |= SSL_OP_TLS_BLOCK_PADDING_BUG;

	/**
	 * SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:
	 *
	 * Just like TLS padding, the Microsoft RDP server does not
	 * support empty fragments. This needs to be disabled.
	 */
	options |= SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;

	SSL_CTX_set_options(context->ctx, options);

	context->ssl = SSL_new(context->ctx);

	if (!context->ssl)
	{
		printf("SSL_new failed\n");
		return -1;
	}

	if (SSL_CTX_use_RSAPrivateKey_file(context->ctx, "/tmp/localhost.key", SSL_FILETYPE_PEM) <= 0)
	{
		printf("SSL_CTX_use_RSAPrivateKey_file failed\n");
		return -1;
	}

	if (SSL_use_certificate_file(context->ssl, "/tmp/localhost.crt", SSL_FILETYPE_PEM) <= 0)
	{
		printf("SSL_use_certificate_file failed\n");
		return -1;
	}

	context->bioRead = BIO_new(BIO_s_mem());

	if (!context->bioRead)
	{
		printf("BIO_new failed\n");
		return -1;
	}

	status = BIO_set_write_buf_size(context->bioRead, SCHANNEL_CB_MAX_TOKEN);

	context->bioWrite = BIO_new(BIO_s_mem());

	if (!context->bioWrite)
	{
		printf("BIO_new failed\n");
		return -1;
	}

	status = BIO_set_write_buf_size(context->bioWrite, SCHANNEL_CB_MAX_TOKEN);

	status = BIO_make_bio_pair(context->bioRead, context->bioWrite);

	SSL_set_bio(context->ssl, context->bioRead, context->bioWrite);

	context->ReadBuffer = (BYTE*) malloc(SCHANNEL_CB_MAX_TOKEN);
	context->WriteBuffer = (BYTE*) malloc(SCHANNEL_CB_MAX_TOKEN);

	return 0;
}

SECURITY_STATUS schannel_openssl_client_process_tokens(SCHANNEL_OPENSSL* context, PSecBufferDesc pInput, PSecBufferDesc pOutput)
{
	int status;
	int ssl_error;
	PSecBuffer pBuffer;

	if (!context->connected)
	{
		if (pInput)
		{
			if (pInput->cBuffers < 1)
				return SEC_E_INVALID_TOKEN;

			pBuffer = &pInput->pBuffers[0];

			if (pBuffer->BufferType != SECBUFFER_TOKEN)
				return SEC_E_INVALID_TOKEN;

			status = BIO_write(context->bioRead, pBuffer->pvBuffer, pBuffer->cbBuffer);
		}

		status = SSL_connect(context->ssl);

		if (status < 0)
		{
			ssl_error = SSL_get_error(context->ssl, status);
			printf("SSL_connect error: %s\n", openssl_get_ssl_error_string(ssl_error));
		}

		status = BIO_read(context->bioWrite, context->ReadBuffer, SCHANNEL_CB_MAX_TOKEN);

		if (status >= 0)
		{
			winpr_HexDump(context->ReadBuffer, status);
		}

		if (pOutput->cBuffers < 1)
			return SEC_E_INVALID_TOKEN;

		pBuffer = &pOutput->pBuffers[0];

		if (pBuffer->BufferType != SECBUFFER_TOKEN)
			return SEC_E_INVALID_TOKEN;

		if (pBuffer->cbBuffer < status)
			return SEC_E_INSUFFICIENT_MEMORY;

		CopyMemory(pBuffer->pvBuffer, context->ReadBuffer, status);
		pBuffer->cbBuffer = status;

		return SEC_I_CONTINUE_NEEDED;
	}

	return SEC_E_OK;
}

SECURITY_STATUS schannel_openssl_server_process_tokens(SCHANNEL_OPENSSL* context, PSecBufferDesc pInput, PSecBufferDesc pOutput)
{
	int status;
	int ssl_error;
	PSecBuffer pBuffer;

	if (!context->connected)
	{
		if (pInput->cBuffers < 1)
			return SEC_E_INVALID_TOKEN;

		pBuffer = &pInput->pBuffers[0];

		if (pBuffer->BufferType != SECBUFFER_TOKEN)
			return SEC_E_INVALID_TOKEN;

		printf("Server input: %d\n", pBuffer->cbBuffer);
		status = BIO_write(context->bioRead, pBuffer->pvBuffer, pBuffer->cbBuffer);

		status = SSL_accept(context->ssl);

		if (status < 0)
		{
			ssl_error = SSL_get_error(context->ssl, status);
			printf("SSL_accept error: %s\n", openssl_get_ssl_error_string(ssl_error));
		}

		status = BIO_read(context->bioWrite, context->ReadBuffer, SCHANNEL_CB_MAX_TOKEN);

		if (status >= 0)
		{
			winpr_HexDump(context->ReadBuffer, status);
		}

		if (pOutput->cBuffers < 1)
			return SEC_E_INVALID_TOKEN;

		pBuffer = &pOutput->pBuffers[0];

		if (pBuffer->BufferType != SECBUFFER_TOKEN)
			return SEC_E_INVALID_TOKEN;

		if (pBuffer->cbBuffer < status)
			return SEC_E_INSUFFICIENT_MEMORY;

		CopyMemory(pBuffer->pvBuffer, context->ReadBuffer, status);
		pBuffer->cbBuffer = status;

		return SEC_I_CONTINUE_NEEDED;
	}

	return SEC_E_OK;
}

SCHANNEL_OPENSSL* schannel_openssl_new()
{
	SCHANNEL_OPENSSL* context;

	context = (SCHANNEL_OPENSSL*) malloc(sizeof(SCHANNEL_OPENSSL));

	if (context != NULL)
	{
		ZeroMemory(context, sizeof(SCHANNEL_OPENSSL));

		SSL_load_error_strings();
		SSL_library_init();

		context->connected = FALSE;
	}

	return context;
}

void schannel_openssl_free(SCHANNEL_OPENSSL* context)
{
	if (context)
	{
		free(context->ReadBuffer);
		free(context->WriteBuffer);

		free(context);
	}
}


text:
	<title>Fred Sirieix's panel show appearances</title>

	<link rel="stylesheet" media="all" href="../style.css" type="text/css"/>

Fred Sirieix's panel show appearances

Fred Sirieix has appeared in 12 episodes between 2016-2019. Note that these appearances may be for more than one person if multiple people have the same name.

2016

2017

2018

2019

2019-04-07 / 8 Out of 10 Cats

2018-11-15 / Celebrity Juice

2018-04-19 / Celebrity Juice

2018-04-05 / Celebrity Juice

2017-11-16 / Celebrity Juice

2017-04-20 / Celebrity Juice

2016-12-22 / Celebrity Juice

2016-12-15 / Celebrity Juice

2016-12-08 / Celebrity Juice

2016-11-22 / 8 Out of 10 Cats

2016-09-22 / Celebrity Juice

2016-04-14 / Celebrity Juice


text:
import activateListener from './listeners/activate';
import messages from './listeners/messages';
import State from './state';

State.createShadow();

// Initialize state and listeners
chrome.storage.local.get(null, (storage) => {
  State.init(storage);
  activateListener(storage.activate);
  messages();
});


text:
<?php

namespace Base\ForumBundle\Blamer;

use Symfony\Component\Security\Core\Exception\AccessDeniedException;

use Herzult\Bundle\ForumBundle\Blamer\AbstractSecurityBlamer;

class TopicBlamer extends AbstractSecurityBlamer
{
    public function blame($object)
    {
        $user = $this->security->getToken()->getUser();
        if (!is_object($user) || !$user instanceof \Application\Sonata\UserBundle\Entity\User ) {
            throw new AccessDeniedException('This user does not have access to this section.');
        }

        $object->setCreationUserId( $this->security->getToken()->getUser() );
    }
}


text:
/**
 * Spies property usage of a given object.
 *
 * Works in modern browsers only, these that support:
 * - Object.defineProperty
 * - Object.keys
 * - Array.prototype.forEach
 *
 * Be careful with IE8. Even though it supports Object.defineProperty, it's implementation is not valid.
 *
 *
 *
 * # Sample Usage
 *
 *   // Object to be spied:
 *   var user = { name: 'Maciej', surname: 'Smolinski', fullName: 'Maciej Smolinski' };
 *
 *   // Spy it's properties, debug info namespaced with 'user' label:
 *   spyProperties('user', user);
 *
 *   // Access object's properties as usual:
 *   console.log('Full Name is: ' + user.name + ' ' + user.surname);
 *
 *   // Watch debug info in the console:
 *   [Property Usage] user.name
 *   [Property Usage] user.surname
 *
 *
 * @param  {String} debugNamespace  Debugging label (namespace)
 * @param  {Object} objectReference Object which properties you want to spy
 * @return {void}
 */
function spyProperties (debugNamespace, objectReference) {
  // @TODO: Add JSHint rules, use Strict Mode
  // @TODO: Spy unless already spied
  // @TODO: Detect Object.defineProperty, Object.keys and Array.prototype.forEach
  // @TODO: Maybe add an execution time to each debug information so the developer gets an understanding on how long does each part of the code execute

  Object.keys(objectReference).forEach(function (property) {

    var __property = '__' + property;

    try {

      // Store original value as __<propertyName>
      objectReference[__property] = objectReference[property];
      // Reset property to undefined
      objectReference[property]   = undefined;

      // Define spy (will write debug info into console and return original value)
      Object.defineProperty(objectReference, property, {
        get: function () {

          // Write debug info into console
          console.debug('[Property Usage] %debugNamespace.%property'
            .replace('%debugNamespace', debugNamespace)
            .replace('%property', property)
          );

          // Return original value
          return objectReference[__property];

        }
      });

    } catch (error) {
      // The only workaround for Object.defineProperty problems in IE8

      if (objectReference[__property]) {
        // Restore original value
        objectReference[property]   = objectReference[__property];
        // Reset __<property> to undefined
        objectReference[__property] = undefined;
      }

    }
  });

}


text:
package org.jvmmonitor.internal.ui.editors;

import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.ui.part.EditorActionBarContributor;
import org.jvmmonitor.internal.ui.actions.CollapseAllAction;

/**
 * The action bar contributor for CUP dump editor.
 */
public class CpuDumpEditorActionContributor extends EditorActionBarContributor {

    /*
     * @see EditorActionBarContributor#contributeToToolBar(IToolBarManager)
     */
    @Override
    public void contributeToToolBar(IToolBarManager toolBarManager) {
        toolBarManager.add(new ActionContributionItem(new CollapseAllAction()) {
            @Override
            protected boolean isEnabledAllowed() {
                return true;
            }
        });
    }
}


text:
namespace chrono {
namespace vehicle {

/// @addtogroup vehicle_cosim_chrono
/// @{

/// Definition of the MPI granular terrain node (using Chrono::Distributed).
class CH_VEHICLE_API ChVehicleCosimTerrainNodeGranularMPI : public ChVehicleCosimTerrainNodeChrono {
  public:
    /// Create a Chrono::Distributed granular terrain node.
    ChVehicleCosimTerrainNodeGranularMPI(double length, double width);

    /// Create a Chrono::Distributed granular terrain node and set parameters from the provided JSON specfile.
    ChVehicleCosimTerrainNodeGranularMPI(const std::string& specfile);

    ~ChVehicleCosimTerrainNodeGranularMPI();

    virtual ChSystem* GetSystem() override { return m_system; }

    /// Set the number of OpenMP threads for each Chrono::Multicore terrain simulation (default: 1).
    void SetNumThreads(int num_threads);

    /// Set full terrain specification from JSON specfile.
    void SetFromSpecfile(const std::string& specfile);

    /// Set container wall thickness (default: 0.2)
    void SetWallThickness(double thickness);

    /// Set properties of granular material.
    void SetGranularMaterial(double radius,  ///< particle radius (default: 0.01)
                             double density  ///< particle material density (default: 2000)
    );

    /// Set the material properties for terrain.
    /// These parameters characterize the material for the container and the granular material.
    /// Tire contact material is received from the MBS node.
    void SetMaterialSurface(const std::shared_ptr<ChMaterialSurfaceSMC>& mat);

    /// Specify whether contact coefficients are based on material properties (default: true).
    void UseMaterialProperties(bool flag);

    /// Set the normal contact force model (default: Hertz).
    void SetContactForceModel(ChSystemSMC::ContactForceModel model);

    /// Set the tangential contact displacement model (default: OneStep).
    void SetTangentialDisplacementModel(ChSystemSMC::TangentialDisplacementModel model);

    /// Set sampling method for generation of granular material.
    /// The granular material is created in the volume defined by the x-y dimensions of the terrain patch and the
    /// specified initial height, using the specified sampling type, layer by layer or all at once.
    /// Note: for correct HCP, do not initialize in layers!
    void SetSamplingMethod(utils::SamplingType type,   ///< volume sampling type (default POISSON_DISK)
                           double init_height,         ///< height of granular material at initialization (default 0.2)
                           double sep_factor = 1.001,  ///< radius inflation factor for initial separation
                           bool in_layers = false      ///< initialize material in layers
    );

    /// Set sweeping sphere radius for proxy bodies (default 5e-3).
    /// This value is used as a "thickness" for collision meshes (a non-zero value can improve robustness of the
    /// collision detection algorithm).
    void SetProxyContactRadius(double radius) { m_radius_p = radius; }

    /// Write checkpoint to the specified file (which will be created in the output directory).
    virtual void WriteCheckpoint(const std::string& filename) const override;

    /// Estimate packing density (eta) of granular material in current configuration.
    /// Note that porosity is phi=1-eta and void ratio is e=(1-eta)/eta=phi/(1-phi).
    /// The function also returns the current depth of granular material.
    double CalculatePackingDensity(double& depth);

  private:
    /// Additional data for tire proxy bodies
    struct TireData {
        std::vector<uint> m_gids;              ///< global indices of proxy bodies
        std::unordered_map<uint, uint> m_map;  ///< map from global ID to triangle index
        unsigned int m_start_tri;              ///< start triangle index for proxy body identifiers
    };

    ChSystemDistributed* m_system;  ///< containing system
    bool m_constructed;             ///< system construction completed?
    bool m_proxies_constructed;     ///< proxy bodies created?

    int m_sub_rank;  ///< MPI rank within the terrain MPI intracommunicator

    double m_hthick;                    ///< container wall half-thickness
    double m_radius_p;                  ///< radius for a proxy body
    std::vector<TireData> m_tire_data;  ///< data for the vehicle tire proxies

    utils::SamplingType m_sampling_type;  ///< sampling method for generation of particles
    double m_init_depth;                  ///< height of granular maerial initialization volume
    double m_separation_factor;           ///< radius inflation factor for initial particle separation
    bool m_in_layers;                     ///< initialize material layer-by-layer (true) or all at once (false)

    unsigned int m_num_particles;  ///< number of granular material bodies
    double m_radius_g;             ///< radius of one particle of granular material
    double m_rho_g;                ///< particle material density

    virtual bool SupportsMeshInterface() const override { return true; }

    virtual void Construct() override;

    /// Return current total number of contacts.
    virtual int GetNumContacts() const override { return m_system->GetNcontacts(); }

    virtual void CreateMeshProxies(unsigned int i) override;
    virtual void UpdateMeshProxies(unsigned int i, MeshState& mesh_state) override;
    virtual void GetForcesMeshProxies(unsigned int i, MeshContact& mesh_contact) override;

    virtual void CreateWheelProxy(unsigned int i) override;
    virtual void UpdateWheelProxy(unsigned int i, BodyState& spindle_state) override;
    virtual void GetForceWheelProxy(unsigned int i, TerrainForce& wheel_contact) override;

    virtual void OnAdvance(double step_size) override;
    virtual void OnOutputData(int frame) override;
    virtual void Render(double time) override;

    /// Create the Chrono::Distributed system.
    void CreateSystem();

    /// Distribute tire mesh information from main terrain node to intra-communicator.
    void ScatterInitData(unsigned int i);

    /// Create the tire mesh proxy bodies.
    void CreateMeshProxiesInternal(unsigned int i);
    void CreateWheelProxyInternal(unsigned int i);

    /// Calculate current height of granular terrain.
    double CalcCurrentHeight();

    /// Calculate total kinetic energy of granular material.
    double CalcTotalKineticEnergy();

    static ChVector<> CalcBarycentricCoords(const ChVector<>& v1,
                                            const ChVector<>& v2,
                                            const ChVector<>& v3,
                                            const ChVector<>& vP);
};

/// @} vehicle_cosim_chrono

}  // end namespace vehicle
}  // end namespace chrono

#endif


text:
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module    : QStyleOptionSpinBox.hs
    Copyright : (c) David Harley 2010
    Project   : qtHaskell
    Version   : 1.1.4
    Modified  : 2010-09-02 17:02:28

    Warning   : this file is machine generated - do not modify.
--}
-----------------------------------------------------------------------------

module Qtc.Gui.QStyleOptionSpinBox (
  QqStyleOptionSpinBox(..)
  ,QqStyleOptionSpinBox_nf(..)
  ,setStepEnabled
  ,qStyleOptionSpinBox_delete
  )
  where

import Qth.ClassTypes.Core
import Qtc.Enums.Base
import Qtc.Enums.Gui.QAbstractSpinBox

import Qtc.Classes.Base
import Qtc.Classes.Qccs
import Qtc.Classes.Core
import Qtc.ClassTypes.Core
import Qth.ClassTypes.Core
import Qtc.Classes.Gui
import Qtc.ClassTypes.Gui

class QqStyleOptionSpinBox x1 where
  qStyleOptionSpinBox :: x1 -> IO (QStyleOptionSpinBox ())

instance QqStyleOptionSpinBox (()) where
 qStyleOptionSpinBox ()
  = withQStyleOptionSpinBoxResult $
    qtc_QStyleOptionSpinBox

foreign import ccall "qtc_QStyleOptionSpinBox" qtc_QStyleOptionSpinBox :: IO (Ptr (TQStyleOptionSpinBox ()))

instance QqStyleOptionSpinBox ((QStyleOptionSpinBox t1)) where
 qStyleOptionSpinBox (x1)
  = withQStyleOptionSpinBoxResult $
    withObjectPtr x1 $ \cobj_x1 ->
    qtc_QStyleOptionSpinBox1 cobj_x1

foreign import ccall "qtc_QStyleOptionSpinBox1" qtc_QStyleOptionSpinBox1 :: Ptr (TQStyleOptionSpinBox t1) -> IO (Ptr (TQStyleOptionSpinBox ()))

class QqStyleOptionSpinBox_nf x1 where
  qStyleOptionSpinBox_nf :: x1 -> IO (QStyleOptionSpinBox ())

instance QqStyleOptionSpinBox_nf (()) where
 qStyleOptionSpinBox_nf ()
  = withObjectRefResult $
    qtc_QStyleOptionSpinBox

instance QqStyleOptionSpinBox_nf ((QStyleOptionSpinBox t1)) where
 qStyleOptionSpinBox_nf (x1)
  = withObjectRefResult $
    withObjectPtr x1 $ \cobj_x1 ->
    qtc_QStyleOptionSpinBox1 cobj_x1

instance QbuttonSymbols (QStyleOptionSpinBox a) (()) where
 buttonSymbols x0 ()
  = withQEnumResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QStyleOptionSpinBox_buttonSymbols cobj_x0

foreign import ccall "qtc_QStyleOptionSpinBox_buttonSymbols" qtc_QStyleOptionSpinBox_buttonSymbols :: Ptr (TQStyleOptionSpinBox a) -> IO CLong

instance Qframe (QStyleOptionSpinBox a) (()) where
 frame x0 ()
  = withBoolResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QStyleOptionSpinBox_frame cobj_x0

foreign import ccall "qtc_QStyleOptionSpinBox_frame" qtc_QStyleOptionSpinBox_frame :: Ptr (TQStyleOptionSpinBox a) -> IO CBool

instance QsetButtonSymbols (QStyleOptionSpinBox a) ((ButtonSymbols)) where
 setButtonSymbols x0 (x1)
  = withObjectPtr x0 $ \cobj_x0 ->
    qtc_QStyleOptionSpinBox_setButtonSymbols cobj_x0 (toCLong $ qEnum_toInt x1)

foreign import ccall "qtc_QStyleOptionSpinBox_setButtonSymbols" qtc_QStyleOptionSpinBox_setButtonSymbols :: Ptr (TQStyleOptionSpinBox a) -> CLong -> IO ()

instance QsetFrame (QStyleOptionSpinBox a) ((Bool)) where
 setFrame x0 (x1)
  = withObjectPtr x0 $ \cobj_x0 ->
    qtc_QStyleOptionSpinBox_setFrame cobj_x0 (toCBool x1)

foreign import ccall "qtc_QStyleOptionSpinBox_setFrame" qtc_QStyleOptionSpinBox_setFrame :: Ptr (TQStyleOptionSpinBox a) -> CBool -> IO ()

setStepEnabled :: QStyleOptionSpinBox a -> ((StepEnabled)) -> IO ()
setStepEnabled x0 (x1)
  = withObjectPtr x0 $ \cobj_x0 ->
    qtc_QStyleOptionSpinBox_setStepEnabled cobj_x0 (toCLong $ qFlags_toInt x1)

foreign import ccall "qtc_QStyleOptionSpinBox_setStepEnabled" qtc_QStyleOptionSpinBox_setStepEnabled :: Ptr (TQStyleOptionSpinBox a) -> CLong -> IO ()

instance QstepEnabled (QStyleOptionSpinBox a) (()) where
 stepEnabled x0 ()
  = withQFlagsResult $
    withObjectPtr x0 $ \cobj_x0 ->
    qtc_QStyleOptionSpinBox_stepEnabled cobj_x0

foreign import ccall "qtc_QStyleOptionSpinBox_stepEnabled" qtc_QStyleOptionSpinBox_stepEnabled :: Ptr (TQStyleOptionSpinBox a) -> IO CLong

qStyleOptionSpinBox_delete :: QStyleOptionSpinBox a -> IO ()
qStyleOptionSpinBox_delete x0
  = withObjectPtr x0 $ \cobj_x0 ->
    qtc_QStyleOptionSpinBox_delete cobj_x0

foreign import ccall "qtc_QStyleOptionSpinBox_delete" qtc_QStyleOptionSpinBox_delete :: Ptr (TQStyleOptionSpinBox a) -> IO ()


text:
AboutDialog::AboutDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AboutDialog)
{
    ui->setupUi(this);
}

AboutDialog::~AboutDialog()
{
    delete ui;
}

void AboutDialog::on_pushButton_clicked()
{
    close();
}


text:
/**
 * @author Alexander Langer
 */
#ifndef SEQUOIA_FACADE_H
#define	SEQUOIA_FACADE_H

#include "exceptions.h"

#include <vector>
#include <set>

namespace sequoia {

namespace internal {
struct SequoiaSolverFacadeData;
}

class SequoiaSolverFacade {
public:
    typedef int vertex_t;
    /**
     * Create a new facade object with an empty graph.
     */
    SequoiaSolverFacade();
    virtual ~SequoiaSolverFacade();

    /**
     * Add a vertex to the facade object
     * @param f facade object
     * @return the newly created error.
     */
    vertex_t add_vertex();

    /**
     * Add an edge between the two specified vertices u, v.  This is a directed
     * graph, so make sure you add back edges for undirected graphs.
     * @param u vertex
     * @param v vertex
     */
    void add_edge(vertex_t u, vertex_t v) throw (sequoia_exception);

    /**
     * Solve the problem specified by the formula on the graph.
     * @param formula	    the MSO formula
     * @param evaluation    the evaluation to use.  Refer to the documentation
     *			    for possible values.
     * @return		    true iff a solution was found
     */
    bool solve(const std::string &formula,
               const std::string &evaluation)
    throw (sequoia_exception);

    /**
     * Return the solution if there is one.
     * Prerequisite:  solve() returned true
     */
    std::vector<std::set<vertex_t> > solution()
    throw (sequoia_exception);

private:
    internal::SequoiaSolverFacadeData *_data;
};

} // namespace

#endif	/* SEQUOIA_FACADE_H */


text:
/*************************************************************************

    Gradius 3

*************************************************************************/

class gradius3_state : public driver_device
{
public:
	gradius3_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag) { }

	/* memory pointers */
	UINT16 *    m_gfxram;
//  UINT16 *    m_paletteram;    // currently this uses generic palette handling

	/* video-related */
	int         m_layer_colorbase[3];
	int         m_sprite_colorbase;

	/* misc */
	int         m_priority;
	int         m_irqAen;
	int         m_irqBmask;

	/* devices */
	device_t *m_maincpu;
	device_t *m_audiocpu;
	device_t *m_subcpu;
	device_t *m_k007232;
	device_t *m_k052109;
	device_t *m_k051960;
};

/*----------- defined in video/gradius3.c -----------*/

extern void gradius3_sprite_callback(running_machine &machine, int *code,int *color,int *priority_mask,int *shadow);
extern void gradius3_tile_callback(running_machine &machine, int layer,int bank,int *code,int *color,int *flags,int *priority);

READ16_HANDLER( gradius3_gfxrom_r );
WRITE16_HANDLER( gradius3_gfxram_w );

VIDEO_START( gradius3 );
SCREEN_UPDATE( gradius3 );


text:
// Accord Math Library
// The Accord.NET Framework
// http://accord-framework.net
//
// Copyright © César Souza, 2009-2014
// cesarsouza at gmail.com
//
//    This library is free software; you can redistribute it and/or
//    modify it under the terms of the GNU Lesser General Public
//    License as published by the Free Software Foundation; either
//    version 2.1 of the License, or (at your option) any later version.
//
//    This library is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//    Lesser General Public License for more details.
//
//    You should have received a copy of the GNU Lesser General Public
//    License along with this library; if not, write to the Free Software
//    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
//

namespace Accord.Math
{
    using System;

    /// <summary>
    ///   Relative convergence criteria.
    /// </summary>
    ///
    /// <remarks>
    ///   This class can be used to track progress and convergence
    ///   of methods which rely on the relative change of a value.
    /// </remarks>
    ///
    /// <example>
    /// <code>
    ///   // Create a new convergence criteria with unlimited iterations
    ///   var criteria = new RelativeConvergence(iterations: 0, tolerance: 0.1);
    ///
    ///   int progress = 1;
    ///
    ///   do
    ///   {
    ///       // Do some processing...
    ///
    ///
    ///       // Update current iteration information:
    ///       criteria.NewValue = 12345.6 / progress++;
    ///
    ///   } while (!criteria.HasConverged);
    ///
    ///
    ///   // The method will converge after reaching the
    ///   // maximum of 11 iterations with a final value
    ///   // of 1234.56:
    ///
    ///   int iterations = criteria.CurrentIteration; // 11
    ///   double value = criteria.OldValue; // 1234.56
    /// </code>
    /// </example>
    ///
    public class RelativeConvergence : ISingleValueConvergence
    {

        private double tolerance = 0;
        private int maxIterations = 100;
        private double newValue;

        private int checks;
        private int maxChecks = 1;

        /// <summary>
        ///   Gets or sets the maximum relative change in the watched value
        ///   after an iteration of the algorithm used to detect convergence.
        /// </summary>
        ///
        public double Tolerance
        {
            get { return tolerance; }
            set
            {
                if (value < 0)
                    throw new ArgumentOutOfRangeException("value", "Tolerance should be positive.");

                tolerance = value;
            }
        }

        /// <summary>
        ///   Gets or sets the maximum number of iterations
        ///   performed by the iterative algorithm.
        /// </summary>
        ///
        public int Iterations
        {
            get { return maxIterations; }
            set
            {
                if (value < 0)
                    throw new ArgumentOutOfRangeException("value",
                        "The maximum number of iterations should be positive.");

                maxIterations = value;
            }
        }

        /// <summary>
        ///   Initializes a new instance of the <see cref="RelativeConvergence"/> class.
        /// </summary>
        ///
        public RelativeConvergence()
        {
        }

        /// <summary>
        ///   Initializes a new instance of the <see cref="RelativeConvergence"/> class.
        /// </summary>
        ///
        /// <param name="iterations">The maximum number of iterations which should be
        ///   performed by the iterative algorithm. Setting to zero indicates there
        ///   is no maximum number of iterations. Default is 0.</param>
        /// <param name="tolerance">The maximum relative change in the watched value
        ///   after an iteration of the algorithm used to detect convergence.
        ///   Default is 0.</param>
        ///
        public RelativeConvergence(int iterations, double tolerance)
        {
            this.Iterations = iterations;
            this.tolerance = tolerance;
        }

        /// <summary>
        ///   Initializes a new instance of the <see cref="RelativeConvergence"/> class.
        /// </summary>
        ///
        /// <param name="iterations">The maximum number of iterations which should be
        ///   performed by the iterative algorithm. Setting to zero indicates there
        ///   is no maximum number of iterations. Default is 0.</param>
        /// <param name="tolerance">The maximum relative change in the watched value
        ///   after an iteration of the algorithm used to detect convergence.
        ///   Default is 0.</param>
        /// <param name="checks">The minimum number of convergence checks that the
        ///   iterative algorithm should pass before convergence can be declared
        ///   reached.</param>
        ///
        public RelativeConvergence(int iterations, double tolerance, int checks)
        {
            this.Iterations = iterations;
            this.tolerance = tolerance;
            this.maxChecks = checks;
        }

        /// <summary>
        ///   Gets or sets the watched value before the iteration.
        /// </summary>
        ///
        public double OldValue { get; private set; }

        /// <summary>
        ///   Gets or sets the watched value after the iteration.
        /// </summary>
        ///
        public double NewValue
        {
            get { return newValue; }
            set
            {
                OldValue = newValue;
                newValue = value;
                CurrentIteration++;
            }
        }

        /// <summary>
        ///   Gets or sets the current iteration number.
        /// </summary>
        ///
        public int CurrentIteration { get; private set; }

        /// <summary>
        ///   Gets whether the algorithm has converged.
        /// </summary>
        ///
        public bool HasConverged
        {
            get
            {
                bool converged = checkConvergence();

                checks = converged ? checks + 1 : 0;

                return checks >= maxChecks;
            }
        }

        private bool checkConvergence()
        {
            // Update and verify stop criteria
            if (tolerance > 0)
            {
                // Stopping criteria is likelihood convergence
                double delta = Math.Abs(OldValue - NewValue);

                if (delta <= tolerance * Math.Abs(OldValue))
                    return true;

                if (maxIterations > 0)
                {
                    // Maximum iterations should also be respected
                    if (CurrentIteration >= maxIterations)
                        return true;
                }
            }
            else
            {
                // Stopping criteria is number of iterations
                if (CurrentIteration >= maxIterations)
                    return true;
            }

            // Check if we have reached an invalid or perfectly separable answer
            if (Double.IsNaN(NewValue) || Double.IsInfinity(NewValue))
            {
                return true;
            }

            return false;
        }

        /// <summary>
        ///   Resets this instance, reverting all iteration statistics
        ///   statistics (number of iterations, last error) back to zero.
        /// </summary>
        ///
        public void Clear()
        {
            CurrentIteration = 0;
            NewValue = 0;
            OldValue = 0;
            checks = 0;
        }
    }
}


text:
/*
 * Search.h
 *
 *  Created on: 16 Nov 2015
 *      Author: hieu
 */

#pragma once
#include <boost/pool/pool_alloc.hpp>
#include "../Search.h"
#include "Misc.h"
#include "Stack.h"
#include "../../legacy/Range.h"

namespace Moses2
{

class Bitmap;
class Hypothesis;
class InputPath;
class TargetPhrases;

namespace NSCubePruningBitmapStack
{

class Search : public Moses2::Search
{
public:
  Search(Manager &mgr);
  virtual ~Search();

  virtual void Decode();
  const Hypothesis *GetBestHypo() const;

protected:
  Stack m_stack;

  CubeEdge::Queue m_queue;
  CubeEdge::SeenPositions m_seenPositions;

  // CUBE PRUNING VARIABLES
  // setup
  typedef std::vector<CubeEdge*> CubeEdges;
  std::vector<CubeEdges*> m_cubeEdges;

  std::deque<QueueItem*> m_queueItemRecycler;

  // CUBE PRUNING
  // decoding
  void Decode(size_t stackInd);
  void PostDecode(size_t stackInd);
};

}

}


text:
// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

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

using Microsoft.TeamFoundation.Migration.Toolkit;

namespace ChangeGroupLabelAnalysisAddin
{
    public class ChangeGroupLabelItem : ILabelItem
    {
        private string m_itemPath;

        public ChangeGroupLabelItem(IMigrationAction action)
        {
            if (string.IsNullOrEmpty(action.Path))
            {
                throw new ArgumentException();
            }
            m_itemPath = action.Path;
        }

        public ChangeGroupLabelItem(string itemCanonicalPath)
        {
            if (string.IsNullOrEmpty(itemCanonicalPath))
            {
                throw new ArgumentException();
            }
            m_itemPath = itemCanonicalPath;
        }

        // Summary:
        //     The path of the item to be label in canonical form (as defined by the interface
        //     IServerPathTranslationService)
        public string ItemCanonicalPath
        {
            get
            {
                return m_itemPath;
            }
        }

        //
        // Summary:
        //     The string representation of the version of the Item to be labeled
        public string ItemVersion
        {
            get { return null; }
        }

        //
        // Summary:
        //     Whether or not to recursive include all items under the item specified by
        //     the ItemId in the label
        public bool Recurse
        {
            get { return false; }
        }
    }
}