text:
#include "tensorflow/contrib/lite/interpreter.h"
#include <cassert>
#include <cstdarg>
#include <cstdint>
#include <cstring>
#include "tensorflow/contrib/lite/arena_planner.h"
#include "tensorflow/contrib/lite/context.h"
#include "tensorflow/contrib/lite/error_reporter.h"
#include "tensorflow/contrib/lite/graph_info.h"
#include "tensorflow/contrib/lite/kernels/gemm_support.h"
#include "tensorflow/contrib/lite/memory_planner.h"
#include "tensorflow/contrib/lite/nnapi_delegate.h"

namespace {

// std::vector preallocation tuning.
constexpr const int kSlotsToReserve = 128;

}  // namespace

namespace tflite {

// A trivial implementation of GraphInfo around the Interpreter.
// NOTE: this interpreter info represents the subset of the
// graph that is executed according to execution plan. Thus,
// the indices are execution plan indices rather than raw node
// indices.
class InterpreterInfo : public GraphInfo {
 public:
  explicit InterpreterInfo(Interpreter* interpreter)
      : interpreter_(interpreter) {}

  size_t num_tensors() const override { return interpreter_->tensors_size(); }
  TfLiteTensor* tensor(size_t index) override {
    return interpreter_->tensor(index);
  }
  size_t num_nodes() const override {
    return interpreter_->execution_plan().size();
  }
  const TfLiteNode& node(size_t index) const override {
    int node_index = interpreter_->execution_plan()[index];
    return interpreter_->node_and_registration(node_index)->first;
  }
  const std::vector<int>& inputs() const override {
    return interpreter_->inputs();
  }
  const std::vector<int>& outputs() const override {
    return interpreter_->outputs();
  }

 public:
  Interpreter* interpreter_;
};

Interpreter::Interpreter(ErrorReporter* error_reporter)
    : error_reporter_(error_reporter ? error_reporter
                                     : DefaultErrorReporter()) {
  context_.impl_ = static_cast<void*>(this);
  context_.ResizeTensor = ResizeTensor;
  context_.ReportError = ReportError;
  context_.AddTensors = AddTensors;
  context_.tensors = nullptr;
  context_.tensors_size = 0;
  context_.gemm_context = nullptr;
  // Reserve some space for the tensors to avoid excessive resizing.
  tensors_.reserve(kSlotsToReserve);
  nodes_and_registration_.reserve(kSlotsToReserve);
  next_execution_plan_index_to_prepare_ = 0;
  UseNNAPI(false);
}

Interpreter::~Interpreter() {
  for (auto& nodeAndReg : nodes_and_registration_) {
    TfLiteNode& node = nodeAndReg.first;
    TfLiteIntArrayFree(node.inputs);
    TfLiteIntArrayFree(node.outputs);
    TfLiteIntArrayFree(node.temporaries);
    if (node.builtin_data) free(node.builtin_data);
    OpFree(nodeAndReg.second, node.user_data);
    node.builtin_data = nullptr;
  }

  for (int i = 0; i < context_.tensors_size; i++) {
    TfLiteTensorFree(&context_.tensors[i]);
  }
}

TfLiteStatus Interpreter::SetInputs(std::vector<int> inputs) {
  TF_LITE_ENSURE_OK(&context_,
                    CheckTensorIndices("inputs", inputs.data(), inputs.size()));
  inputs_ = std::move(inputs);
  return kTfLiteOk;
}

TfLiteStatus Interpreter::SetOutputs(std::vector<int> outputs) {
  TF_LITE_ENSURE_OK(
      &context_, CheckTensorIndices("outputs", outputs.data(), outputs.size()));
  outputs_ = std::move(outputs);
  return kTfLiteOk;
}

TfLiteStatus Interpreter::CheckTensorIndices(const char* label,
                                             const int* indices, int length) {
  // Making sure kOptionalTensor is not re-defined to something other than -1.
  static_assert(kOptionalTensor == -1, "kOptionalTensor should be defined -1");

  for (int i = 0; i < length; i++) {
    int index = indices[i];
    if (index < kOptionalTensor || index >= context_.tensors_size) {
      ReportError(&context_, "Invalid tensor index %d in %s\n", index, label);
      consistent_ = false;
      return kTfLiteError;
    }
  }
  return kTfLiteOk;
}

TfLiteStatus Interpreter::BytesRequired(TfLiteType type, const int* dims,
                                        int dims_size, size_t* bytes) {
  // TODO(aselle): Check for overflow here using overflow.h in TensorFlow
  // MultiplyWithoutOverflow.
  TF_LITE_ENSURE(&context_, bytes != nullptr);
  size_t count = 1;
  for (int k = 0; k < dims_size; k++) count *= dims[k];
  switch (type) {
    case kTfLiteFloat32:
      *bytes = sizeof(float) * count;
      break;
    case kTfLiteInt32:
      *bytes = sizeof(int32_t) * count;
      break;
    case kTfLiteUInt8:
      *bytes = sizeof(uint8_t) * count;
      break;
    case kTfLiteInt64:
      *bytes = sizeof(int64_t) * count;
      break;
    default:
      ReportError(&context_,
                  "Only float32, int32, int64, uint8 supported currently.");
      return kTfLiteError;
  }
  return kTfLiteOk;
}

namespace {
TfLiteIntArray* convertVectorToTfLiteIntArray(const std::vector<int>& x) {
  TfLiteIntArray* lite = TfLiteIntArrayCreate(x.size());
  for (size_t i = 0; i < x.size(); i++) lite->data[i] = x[i];
  return lite;
}
}  // namespace

TfLiteStatus Interpreter::AllocateTensors() {
  next_execution_plan_index_to_prepare_ = 0;
  if (memory_planner_) {
    TF_LITE_ENSURE_STATUS(memory_planner_->ResetAllocations());
  }

  if (!consistent_) {
    ReportError(&context_, "AllocateTensors() called on inconsistent model.");
    return kTfLiteError;
  }

  TF_LITE_ENSURE_STATUS(PrepareOpsAndTensors());
  invokable_ = true;
  return kTfLiteOk;
}

TfLiteStatus Interpreter::AddNodeWithParameters(
    const std::vector<int>& inputs, const std::vector<int>& outputs,
    const char* init_data, size_t init_data_size, void* builtin_data,
    const TfLiteRegistration* registration, int* node_index) {
  invokable_ = false;

  std::unique_ptr<void, decltype(free)*> builtin_data_deleter(builtin_data,
                                                              free);

  TF_LITE_ENSURE_OK(&context_, CheckTensorIndices("node inputs", inputs.data(),
                                                  inputs.size()));
  TF_LITE_ENSURE_OK(
      &context_,
      CheckTensorIndices("node outputs", outputs.data(), outputs.size()));

  int new_node_index = nodes_and_registration_.size();
  if (node_index) *node_index = new_node_index;
  nodes_and_registration_.resize(nodes_and_registration_.size() + 1);
  auto& node_and_reg = nodes_and_registration_.back();
  TfLiteNode& node = node_and_reg.first;
  if (node.inputs) TfLiteIntArrayFree(node.inputs);
  if (node.outputs) TfLiteIntArrayFree(node.outputs);
  if (node.temporaries) TfLiteIntArrayFree(node.temporaries);

  // NOTE, here we are not using move semantics yet, since our internal
  // representation isn't std::vector, but in the future we would like to avoid
  // copies, so we want the interface to take r-value references now.
  node.inputs = convertVectorToTfLiteIntArray(inputs);
  node.outputs = convertVectorToTfLiteIntArray(outputs);
  node.temporaries = TfLiteIntArrayCreate(0);
  if (init_data) {
    node.user_data = OpInit(*registration, init_data, init_data_size);
  } else {
    node.user_data =
        OpInit(*registration,
               reinterpret_cast<const char*>(builtin_data_deleter.get()), 0);
  }
  node.builtin_data = builtin_data_deleter.release();
  node_and_reg.second = *registration;
  execution_plan_.push_back(new_node_index);
  return kTfLiteOk;
}

TfLiteStatus Interpreter::ResizeInputTensor(int tensor_index,
                                            const std::vector<int>& dims) {
  // TODO(aselle): All bounds checks can be implemented as one-sided bounds
  // checks by casting to unsigned for efficiency. Profile before doing this.

  TF_LITE_ENSURE(&context_,
                 tensor_index < context_.tensors_size && tensor_index >= 0);
  invokable_ = false;
  TfLiteIntArray* dims_lite = convertVectorToTfLiteIntArray(dims);
  return ResizeTensorImpl(&context_.tensors[tensor_index], dims_lite);
}

// Returns true if at least one tensor in the given list is kTfLiteDynamic.
bool HasDynamicTensor(const TfLiteContext& context,
                      const TfLiteIntArray* tensors) {
  for (int i = 0; i < tensors->size; ++i) {
    const TfLiteTensor& tensor = context.tensors[tensors->data[i]];
    if (tensor.allocation_type == kTfLiteDynamic) {
      return true;
    }
  }
  return false;
}

TfLiteStatus Interpreter::PrepareOpsStartingAt(
    int first_execution_plan_index, int* last_execution_plan_index_prepared) {
  for (int execution_plan_index = first_execution_plan_index;
       execution_plan_index < execution_plan_.size(); execution_plan_index++) {
    int node_index = execution_plan_[execution_plan_index];
    TfLiteNode& node = nodes_and_registration_[node_index].first;
    const TfLiteRegistration& registration =
        nodes_and_registration_[node_index].second;
    if (OpPrepare(registration, &node) == kTfLiteError) {
      return kTfLiteError;
    }

    *last_execution_plan_index_prepared = execution_plan_index;

    // Discontinue if the node has dynamic outputs. Note that we don't
    // stop for dynamic temporary tensors since they won't affect the
    // sizes of other tensors in the graph.
    if (HasDynamicTensor(context_, node.outputs)) {
      break;
    }
  }
  return kTfLiteOk;
}

TfLiteStatus Interpreter::PrepareOpsAndTensors() {
  if (!memory_planner_) {
    memory_planner_.reset(new ArenaPlanner(
        &context_, std::unique_ptr<GraphInfo>(new InterpreterInfo(this))));
    memory_planner_->PlanAllocations();
  }

  int last_exec_plan_index_prepared = 0;

  TF_LITE_ENSURE_STATUS(PrepareOpsStartingAt(
      next_execution_plan_index_to_prepare_, &last_exec_plan_index_prepared));
  TF_LITE_ENSURE_STATUS(memory_planner_->ExecuteAllocations(
      next_execution_plan_index_to_prepare_, last_exec_plan_index_prepared));

  next_execution_plan_index_to_prepare_ = last_exec_plan_index_prepared + 1;
  return kTfLiteOk;
}

TfLiteStatus Interpreter::Invoke() {
  if (!consistent_) {
    ReportError(&context_, "Invoke called on model that is not consistent.");
    return kTfLiteError;
  }
  if (!invokable_) {
    ReportError(&context_, "Invoke called on model that is not ready.");
    return kTfLiteError;
  }

  TfLiteStatus status = kTfLiteOk;
  if (nnapi_delegate_) {
    TF_LITE_ENSURE_STATUS(PrepareOpsAndTensors());
    if (next_execution_plan_index_to_prepare_ == execution_plan_.size()) {
      TF_LITE_ENSURE_OK(&context_, nnapi_delegate_->Invoke(this));
      return kTfLiteOk;
    } else {
      // TODO(aselle): In the future, we would like this to be an
      // automatic tflite CPU fallback.
      ReportError(&context_,
                  "NNAPI was requested, but dependent sized tensors "
                  "being used.\n");
      return kTfLiteError;
    }
  }

  // Invocations are always done in node order.
  // Note that calling Invoke repeatedly will cause the original memory plan to
  // be reused, unless either ResizeInputTensor() or AllocateTensors() has been
  // called.
  // TODO(b/71913981): we should force recalculation in the presence of dynamic
  // tensors, because they may have new value which in turn may affect shapes
  // and allocations.
  for (int execution_plan_index = 0;
       execution_plan_index < execution_plan_.size(); execution_plan_index++) {
    if (execution_plan_index == next_execution_plan_index_to_prepare_) {
      TF_LITE_ENSURE_STATUS(PrepareOpsAndTensors());
      TF_LITE_ENSURE(&context_, next_execution_plan_index_to_prepare_ >=
                                    execution_plan_index);
    }
    int node_index = execution_plan_[execution_plan_index];
    TfLiteNode& node = nodes_and_registration_[node_index].first;
    const TfLiteRegistration& registration =
        nodes_and_registration_[node_index].second;
    if (OpInvoke(registration, &node) == kTfLiteError) {
      status = kTfLiteError;
    }
  }
  return status;
}

TfLiteStatus Interpreter::ResizeTensor(TfLiteContext* context,
                                       TfLiteTensor* tensor,
                                       TfLiteIntArray* new_size) {
  // Note here that context->impl_ is recovering the this pointer for an
  // instance of Interpreter to call into the member function ResizeTensorImpl
  // (this function is static).
  return static_cast<Interpreter*>(context->impl_)
      ->ResizeTensorImpl(tensor, new_size);
}

void Interpreter::ReportErrorImpl(const char* format, va_list args) {
  error_reporter_->Report(format, args);
}

void Interpreter::ReportError(TfLiteContext* context, const char* format, ...) {
  va_list args;
  va_start(args, format);
  auto* f = static_cast<Interpreter*>(context->impl_);
  // Note here that context->impl_ is recovering the this pointer for an
  // instance of Interpreter to call into the member function ReportErrorImpl
  // (this function is static).
  f->ReportErrorImpl(format, args);
  va_end(args);
}

TfLiteStatus Interpreter::AddTensors(int tensors_to_add,
                                     int* first_new_tensor_index) {
  int base_index = tensors_.size();
  if (first_new_tensor_index) *first_new_tensor_index = base_index;
  tensors_.resize(tensors_.size() + tensors_to_add);
  for (int i = base_index; i < tensors_.size(); i++) {
    memset(&tensors_[i], 0, sizeof(tensors_[i]));
  }
  context_.tensors = tensors_.data();
  context_.tensors_size = tensors_.size();
  return kTfLiteOk;
}

TfLiteStatus Interpreter::AddTensors(TfLiteContext* context, int tensors_to_add,
                                     int* first_new_tensor_index) {
  // Note here that context->impl_ is recovering the this pointer for an
  // instance of Interpreter to call into the member function AddTensors
  // (this function is static).
  return static_cast<Interpreter*>(context->impl_)
      ->AddTensors(tensors_to_add, first_new_tensor_index);
}

TfLiteStatus Interpreter::SetTensorParametersReadOnly(
    int tensor_index, TfLiteType type, const char* name,
    const std::vector<int>& dims, TfLiteQuantizationParams quantization,
    const char* buffer, size_t bytes, const Allocation* allocation) {
  TF_LITE_ENSURE(&context_,
                 tensor_index < context_.tensors_size && tensor_index >= 0);
  // For most tensors we know exactly how much memory is necessary so we can
  // ensure the buffer is large enough. However, we need to skip string tensors
  // because their sizes change with the contents of the individual strings.
  if (type != kTfLiteString) {
    size_t required_bytes;
    TF_LITE_ENSURE_OK(&context_, BytesRequired(type, dims.data(), dims.size(),
                                               &required_bytes));
    TF_LITE_ENSURE_EQ(&context_, required_bytes, bytes);
  }
  invokable_ = false;
  TfLiteTensorReset(type, name, convertVectorToTfLiteIntArray(dims),
                    quantization, const_cast<char*>(buffer), bytes,
                    kTfLiteMmapRo, allocation, &context_.tensors[tensor_index]);
  return kTfLiteOk;
}

// Set description of inputs/outputs/data/fptrs for node `node_index`.
// This variant assumes an external buffer has been allocated of size
// bytes. The lifetime of buffer must be ensured to be greater or equal
// to Interpreter.
TfLiteStatus Interpreter::SetTensorParametersReadWrite(
    int tensor_index, TfLiteType type, const char* name,
    const std::vector<int>& dims, TfLiteQuantizationParams quantization) {
  invokable_ = false;
  TF_LITE_ENSURE(&context_,
                 tensor_index < context_.tensors_size && tensor_index >= 0);
  size_t required_bytes = 0;
  if (type != kTfLiteString) {
    // These types will be allocated in our arena so we need to record how
    // many bytes we will need based on the dimensions. String tensors are
    // allocated dynamically and we can't know ahead of time how much space
    // they will require.
    TF_LITE_ENSURE_OK(&context_, BytesRequired(type, dims.data(), dims.size(),
                                               &required_bytes));
  }
  TfLiteTensorReset(type, name, convertVectorToTfLiteIntArray(dims),
                    quantization,
                    /*buffer=*/nullptr, required_bytes,
                    type == kTfLiteString ? kTfLiteDynamic : kTfLiteArenaRw,
                    nullptr, &context_.tensors[tensor_index]);
  return kTfLiteOk;
}

TfLiteStatus Interpreter::SetExecutionPlan(const std::vector<int>& new_plan) {
  for (int node_index : new_plan) {
    TF_LITE_ENSURE(&context_, node_index >= 0 && node_index < nodes_size());
  }
  execution_plan_ = new_plan;
  return kTfLiteOk;
}

TfLiteStatus Interpreter::ResizeTensorImpl(TfLiteTensor* tensor,
                                           TfLiteIntArray* new_size) {
  // Note that in theory we could resize kTfLiteArenaRwPersistent tensors too.
  if (tensor->allocation_type == kTfLiteArenaRw ||
      tensor->allocation_type == kTfLiteDynamic) {
    if (tensor->type != kTfLiteString) {
      size_t bytesRequired;
      TfLiteStatus status = BytesRequired(tensor->type, new_size->data,
                                          new_size->size, &bytesRequired);
      if (status != kTfLiteOk) {
        TfLiteIntArrayFree(new_size);
        return kTfLiteError;
      }
      tensor->bytes = bytesRequired;
    }
    if (tensor->dims) TfLiteIntArrayFree(tensor->dims);
    tensor->dims = new_size;

    if (tensor->allocation_type != kTfLiteDynamic) {
      tensor->data.raw = nullptr;
    }
  } else {
    // kTfLiteMmapRo tensors are stored in the flatbuffer and are therefore
    // of fixed size.
    TfLiteIntArrayFree(new_size);
    ReportError(&context_, "Attempting to resize a fixed-size tensor.");
    return kTfLiteError;
  }
  return kTfLiteOk;
}

void Interpreter::UseNNAPI(bool enable) {
  // TODO(aselle): This is a workaround for finding if NNAPI exists.
  // We also need to make sure getLibraryHandle() is renamed to be NNAPI
  // prefixed.
  if (!NNAPIExists()) enable = false;
  if (!enable) {
    nnapi_delegate_.reset();
  } else if (!nnapi_delegate_) {
    nnapi_delegate_.reset(new NNAPIDelegate);
  }
}

void Interpreter::SetNumThreads(int num_threads) {
  // TODO(ahentz): this forces us to link against gemmlowp even when the ops
  // don't use it. We should implement some dynamic mechanism for this sort of
  // library-specific initialization.
  tflite::gemm_support::SetMaxNumThreads(&context_, num_threads);
}

}  // namespace tflite


text:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="vendor/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false">
    <testsuites>
        <testsuite name="Qwatcher Test Suite">
            <directory>./tests/</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist>
            <directory suffix=".php">src/</directory>
        </whitelist>
    </filter>
    <logging>
        <log type="coverage-html" target="build/coverage"/>
        <log type="coverage-clover" target="build/clover.xml"/>
        <log type="coverage-text" target="build/coverage.txt"/>
        <log type="tap" target="build/report.tap"/>
        <log type="junit" target="build/report.junit.xml"/>
    </logging>
</phpunit>

redpajama_set_name: RedPajamaGithub


text:
/*
 @ Author: wysaid
 @ Blog: blog.wysaid.org
 @ Date: 2015-6-3
*/

#include "editorMain.h"

bool enableGLFunction(void* arg)
{
	if(arg)
	{
		((GrafixEditorWindow*)arg)->useCanvasContext();
		return true;
	}
	return false;
}

GrafixEditorWindow::GrafixEditorWindow(QWidget* parent) : m_waitingTimer(this)
{
	m_ui.setupUi(this);
	setMinimumSize(800, 500);
	init();
}

GrafixEditorWindow::~GrafixEditorWindow()
{
	CGE_LOG_INFO("~GrafixEditorWindow...\n");
}

void GrafixEditorWindow::init()
{
	m_ui.canvasView->hide();
	m_canvas = new GrafixEditorCanvas(centralWidget());
	CGE::cgeSetGLContextEnableFunction(enableGLFunction, this);
	m_canvas->setGeometry(m_ui.canvasView->geometry());

// 	m_waitingAnim = new QLabel();
// 	m_waitingAnim->setText(GF_STR("图片读取中..."));
// 	auto mov = new QMovie(":grafix/res/waitingGIFs/0.gif");
// 	m_waitingAnim->setMovie(mov);
// 	mov->start();
// 	m_waitingAnim->setFixedSize(300, mov->currentImage().height());
//
// 	m_waitingAnim->setGeometry((m_canvas->width() - m_waitingAnim->width()) / 2, m_canvas->height() / 3, m_waitingAnim->width(), m_waitingAnim->height());
// 	m_waitingAnim->setAttribute(Qt::WidgetAttribute::WA_TranslucentBackground);
// 	m_waitingAnim->setWindowFlags(Qt::FramelessWindowHint);
// 	m_waitingAnim->show();
	//m_waitingAnim->setWindowModality(Qt::WindowModality::WindowModal);

	connect(m_ui.homeBtn, SIGNAL(clicked()), SLOT(backtoHomePage()));
}

void GrafixEditorWindow::backtoHomePage()
{
	CGE_LOG_INFO("GrafixEditorWindow::backtoHomePage...\n");
	deleteLater();
	GlobalStaticVars::showMainWindow();
}

///////////// Events /////////////////////////////////

void GrafixEditorWindow::resizeEvent(QResizeEvent *)
{
	int w = width();
	int h = height();

	m_ui.leftView->setFixedHeight(h - m_ui.leftView->y());
	m_ui.secondMenuView->setFixedHeight(m_ui.leftView->height() - 60);

	m_canvas->setFixedWidth(w - m_canvas->x() - 5);
	m_canvas->setFixedHeight(h - m_canvas->y() - 60);

	{
		auto&& g = m_ui.bottomToolView->geometry();
		m_ui.bottomToolView->setFixedWidth(w - m_ui.bottomToolView->x() - 20);
		m_ui.bottomToolView->setGeometry(g.x(), h - g.height() - 5, w - g.x() - 20, g.height());
	}

}

void GrafixEditorWindow::useCanvasContext()
{
	m_canvas->makeCurrent();
}

void GrafixEditorWindow::enableWaitingStatus(bool status)
{

}


text:
package apimachinery

import (
	"context"
	"fmt"
	"strconv"

	g "github.com/onsi/ginkgo"
	o "github.com/onsi/gomega"

	apierrors "k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/watch"
	"k8s.io/client-go/kubernetes"
	admissionapi "k8s.io/pod-security-admission/api"

	"k8s.io/kubernetes/test/e2e/framework"
)

var _ = SIGDescribe("client-go should negotiate", func() {
	f := framework.NewDefaultFramework("protocol")
	f.SkipNamespaceCreation = true
	f.NamespacePodSecurityEnforceLevel = admissionapi.LevelPrivileged

	for _, s := range []string{
		"application/json",
		"application/vnd.kubernetes.protobuf",
		"application/vnd.kubernetes.protobuf,application/json",
		"application/json,application/vnd.kubernetes.protobuf",
	} {
		accept := s
		g.It(fmt.Sprintf("watch and report errors with accept %q", accept), func() {
			cfg, err := framework.LoadConfig()
			framework.ExpectNoError(err)

			cfg.AcceptContentTypes = accept

			c := kubernetes.NewForConfigOrDie(cfg)
			svcs, err := c.CoreV1().Services("default").Get(context.TODO(), "kubernetes", metav1.GetOptions{})
			framework.ExpectNoError(err)
			rv, err := strconv.Atoi(svcs.ResourceVersion)
			framework.ExpectNoError(err)
			w, err := c.CoreV1().Services("default").Watch(context.TODO(), metav1.ListOptions{ResourceVersion: strconv.Itoa(rv - 1)})
			framework.ExpectNoError(err)
			defer w.Stop()

			evt, ok := <-w.ResultChan()
			o.Expect(ok).To(o.BeTrue())
			switch evt.Type {
			case watch.Added, watch.Modified:
				// this is allowed
			case watch.Error:
				err := apierrors.FromObject(evt.Object)
				// In Kubernetes 1.17 and earlier, the api server returns both apierrors.StatusReasonExpired and
				// apierrors.StatusReasonGone for HTTP 410 (Gone) status code responses. In 1.18 the kube server is more consistent
				// and always returns apierrors.StatusReasonExpired. For backward compatibility we can only remove the apierrs.IsGone
				// check when we fully drop support for Kubernetes 1.17 servers from reflectors.
				if apierrors.IsGone(err) || apierrors.IsResourceExpired(err) {
					// this is allowed, since the kubernetes object could be very old
					break
				}
				if apierrors.IsUnexpectedObjectError(err) {
					g.Fail(fmt.Sprintf("unexpected object, wanted v1.Status: %#v", evt.Object))
				}
				g.Fail(fmt.Sprintf("unexpected error: %#v", evt.Object))
			default:
				g.Fail(fmt.Sprintf("unexpected type %s: %#v", evt.Type, evt.Object))
			}
		})
	}
})


text:
package main

import (
	"fmt"
	"log"
	"sync"
	"time"

	apierrors "k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/apimachinery/pkg/util/runtime"
	"k8s.io/apimachinery/pkg/util/sets"
	"k8s.io/apimachinery/pkg/util/wait"
	informercorev1 "k8s.io/client-go/informers/core/v1"
	"k8s.io/client-go/kubernetes"
	"k8s.io/client-go/kubernetes/scheme"
	corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
	listercorev1 "k8s.io/client-go/listers/core/v1"
	apicorev1 "k8s.io/client-go/pkg/api/v1"
	"k8s.io/client-go/tools/cache"
	"k8s.io/client-go/util/workqueue"
)

const (
	secretSyncAnnotation      = "eightypercent.net/secretsync"
	secretSyncSourceNamespace = "secretsync"
	secretSyncKey             = "do it"
)

var namespaceBlacklist = map[string]bool{
	"kube-public":             true,
	"kube-system":             true,
	secretSyncSourceNamespace: true,
}

type TGIKController struct {
	secretGetter          corev1.SecretsGetter
	secretLister          listercorev1.SecretLister
	secretListerSynced    cache.InformerSynced
	namespaceGetter       corev1.NamespacesGetter
	namespaceLister       listercorev1.NamespaceLister
	namespaceListerSynced cache.InformerSynced

	queue workqueue.RateLimitingInterface
}

func NewTGIKController(client *kubernetes.Clientset,
	secretInformer informercorev1.SecretInformer,
	namespaceInformer informercorev1.NamespaceInformer) *TGIKController {
	c := &TGIKController{
		secretGetter:          client.CoreV1(),
		secretLister:          secretInformer.Lister(),
		secretListerSynced:    secretInformer.Informer().HasSynced,
		namespaceGetter:       client.CoreV1(),
		namespaceLister:       namespaceInformer.Lister(),
		namespaceListerSynced: namespaceInformer.Informer().HasSynced,
		queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "secretsync"),
	}

	// TODO: only schedule sync if it is a secret that has or had our
	// annotation.
	secretInformer.Informer().AddEventHandler(
		cache.ResourceEventHandlerFuncs{
			AddFunc: func(obj interface{}) {
				log.Print("secret added")
				c.ScheduleSecretSync()
			},
			UpdateFunc: func(oldObj, newObj interface{}) {
				log.Print("secret updated")
				c.ScheduleSecretSync()
			},
			DeleteFunc: func(obj interface{}) {
				log.Print("secret deleted")
				c.ScheduleSecretSync()
			},
		},
	)

	// TODO: only schedule sync if it is a namespace that has or had our
	// annotation or the secretsync source namespace.
	namespaceInformer.Informer().AddEventHandler(
		cache.ResourceEventHandlerFuncs{
			AddFunc: func(obj interface{}) {
				log.Print("namespace added")
				c.ScheduleSecretSync()
			},
			UpdateFunc: func(oldObj, newObj interface{}) {
				log.Print("namespace updated")
				c.ScheduleSecretSync()
			},
			DeleteFunc: func(obj interface{}) {
				log.Print("namespace deleted")
				c.ScheduleSecretSync()
			},
		},
	)
	return c
}

func (c *TGIKController) Run(stop <-chan struct{}) {
	var wg sync.WaitGroup

	defer func() {
		// make sure the work queue is shut down which will trigger workers to end
		log.Print("shutting down queue")
		c.queue.ShutDown()

		// wait on the workers
		log.Print("shutting down workers")
		wg.Wait()

		log.Print("workers are all done")
	}()

	log.Print("waiting for cache sync")
	if !cache.WaitForCacheSync(
		stop,
		c.secretListerSynced,
		c.namespaceListerSynced) {
		log.Print("timed out waiting for cache sync")
		return
	}
	log.Print("caches are synced")

	go func() {
		// runWorker will loop until "something bad" happens. wait.Until will
		// then rekick the worker after one second.
		wait.Until(c.runWorker, time.Second, stop)
		// tell the WaitGroup this worker is done
		wg.Done()
	}()

	// wait until we're told to stop
	log.Print("waiting for stop signal")
	<-stop
	log.Print("received stop signal")
}

func (c *TGIKController) runWorker() {
	// hot loop until we're told to stop.  processNextWorkItem will
	// automatically wait until there's work available, so we don't worry
	// about secondary waits
	for c.processNextWorkItem() {
	}
}

// processNextWorkItem deals with one key off the queue.  It returns false
// when it's time to quit.
func (c *TGIKController) processNextWorkItem() bool {
	// pull the next work item from queue.  It should be a key we use to lookup
	// something in a cache
	key, quit := c.queue.Get()
	if quit {
		return false
	}
	// you always have to indicate to the queue that you've completed a piece of
	// work
	defer c.queue.Done(key)

	// do your work on the key.  This method will contains your "do stuff" logic
	err := c.doSync()
	if err == nil {
		// if you had no error, tell the queue to stop tracking history for your
		// key. This will reset things like failure counts for per-item rate
		// limiting
		c.queue.Forget(key)
		return true
	}

	// there was a failure so be sure to report it.  This method allows for
	// pluggable error handling which can be used for things like
	// cluster-monitoring
	runtime.HandleError(fmt.Errorf("doSync failed with: %v", err))

	// since we failed, we should requeue the item to work on later.  This
	// method will add a backoff to avoid hotlooping on particular items
	// (they're probably still not going to work right away) and overall
	// controller protection (everything I've done is broken, this controller
	// needs to calm down or it can starve other useful work) cases.
	c.queue.AddRateLimited(key)

	return true
}

func (c *TGIKController) ScheduleSecretSync() {
	c.queue.Add(secretSyncKey)
}

func (c *TGIKController) getSecretsInNS(ns string) ([]*apicorev1.Secret, error) {
	rawSecrets, err := c.secretLister.Secrets(ns).List(labels.Everything())
	if err != nil {
		return nil, err
	}

	var secrets []*apicorev1.Secret
	for _, secret := range rawSecrets {
		if _, ok := secret.Annotations[secretSyncAnnotation]; ok {
			secrets = append(secrets, secret)
		}
	}
	return secrets, nil
}

func (c *TGIKController) doSync() error {
	log.Printf("Starting doSync")
	srcSecrets, err := c.getSecretsInNS(secretSyncSourceNamespace)
	if err != nil {
		return err
	}

	rawNamespaces, err := c.namespaceLister.List(labels.Everything())
	if err != nil {
		return err
	}
	var targetNamespaces []*apicorev1.Namespace
	for _, ns := range rawNamespaces {
		if _, ok := ns.Annotations[secretSyncAnnotation]; ok {
			targetNamespaces = append(targetNamespaces, ns)
		}
	}

	for _, ns := range targetNamespaces {
		c.SyncNamespace(srcSecrets, ns.Name)
	}

	log.Print("Finishing doSync")
	return err
}

func (c *TGIKController) SyncNamespace(secrets []*apicorev1.Secret, ns string) {
	// 1. Create/Update all of the secrets in this namespace
	for _, secret := range secrets {
		newSecretInf, _ := scheme.Scheme.DeepCopy(secret)
		newSecret := newSecretInf.(*apicorev1.Secret)
		newSecret.Namespace = ns
		newSecret.ResourceVersion = ""
		newSecret.UID = ""

		log.Printf("Creating %v/%v", ns, secret.Name)
		_, err := c.secretGetter.Secrets(ns).Create(newSecret)
		if apierrors.IsAlreadyExists(err) {
			log.Printf("Scratch that, updating %v/%v", ns, secret.Name)
			_, err = c.secretGetter.Secrets(ns).Update(newSecret)
		}
		if err != nil {
			log.Printf("Error adding secret %v/%v: %v", ns, secret.Name, err)
		}
	}

	// 2. Delete secrets that have annotation but are not in our src list
	srcSecrets := sets.String{}
	targetSecrets := sets.String{}

	for _, secret := range secrets {
		srcSecrets.Insert(secret.Name)
	}

	targetSecretList, err := c.getSecretsInNS(ns)
	if err != nil {
		log.Printf("Error listing secrets in %v: %v", ns, err)
	}
	for _, secret := range targetSecretList {
		targetSecrets.Insert(secret.Name)
	}

	deleteSet := targetSecrets.Difference(srcSecrets)
	for secretName, _ := range deleteSet {
		log.Printf("Delete %v/%v", ns, secretName)
		err = c.secretGetter.Secrets(ns).Delete(secretName, nil)
		if err != nil {
			log.Printf("Error deleting %v/%v: %v", ns, secretName, err)
		}
	}
}


text:
#ifndef GUARD_error_reporter_hpp_24171430908223349
#define GUARD_error_reporter_hpp_24171430908223349

#include <boost/filesystem.hpp>
#include <boost/optional.hpp>
#include <stdexcept>

namespace dcm
{
namespace gui
{

/**
 * An instance of this class constitutes a mechanism for reporting errors
 * to the user. Usually you would want to create on ErrorReporter instance
 * for each instance of wxApp. Should only be used to report genuine errors or
 * exceptions that should not occur in the normal course of application
 * usage.
 */
class ErrorReporter
{
public:

    ErrorReporter();
    ErrorReporter(ErrorReporter const& rhs) = delete;
    ErrorReporter(ErrorReporter&& rhs) = delete;
    ErrorReporter& operator=(ErrorReporter const& rhs) = delete;
    ErrorReporter& operator=(ErrorReporter&& rhs) = delete;
    virtual ~ErrorReporter();

    void report(std::exception* p_exception = nullptr) const;

    void set_db_file_location
    (   boost::filesystem::path const& p_log_file_location
    );
    void set_backup_db_file_location
    (   boost::filesystem::path const& p_log_file_location
    );
    void set_log_file_location
    (   boost::filesystem::path const& p_log_file_location
    );

private:
    boost::optional<boost::filesystem::path> m_db_file_location;
    boost::optional<boost::filesystem::path> m_backup_db_file_location;
    boost::optional<boost::filesystem::path> m_log_file_location;

};  // class ErrorReporter

}  // namespace gui
}  // namespace dcm

#endif  // GUARD_error_reporter_hpp_24171430908223349


text:
package cs620.gladieter;

import android.content.Intent;
import android.os.StrictMode;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
    }

    protected void onSignUp(View view)
    {
        Intent intent = new Intent(this,Signup.class);
        startActivity(intent);
    }

    protected void onLogIn(View view)
    {
        EditText user = (EditText)findViewById(R.id.txtUser);
        EditText password = (EditText)findViewById(R.id.txtPassword);
        JSONObject object = new JSONObject();
        try{
            object.put("username",user.getText().toString());
            object.put("password",password.getText().toString());
        }
        catch (JSONException e)
        {

        }
        RestTemplate restTemplate = new RestTemplate();
        restTemplate.getMessageConverters().add(new StringHttpMessageConverter());
        try {
            HttpHeaders header = new HttpHeaders();
            header.setContentType(MediaType.APPLICATION_JSON);
            HttpEntity<String> entity = new HttpEntity<String>(object.toString(),header);
            ResponseEntity registerResponse = restTemplate.exchange("https://gladieter.herokuapp.com/auth/login/", HttpMethod.POST, entity, String.class);
            if(registerResponse.getStatusCode()== HttpStatus.OK)
            {
                JSONObject response = new JSONObject(registerResponse.getBody().toString());
                new AlertDialog.Builder(this).setTitle("Sign Up").setMessage("Login Successfull").create().show();
                String key = response.getString("key");
                Intent intent = new Intent(this,StartMenu.class);
                intent.putExtra("key",key);
                startActivity(intent);
            }
            else
            {
                new AlertDialog.Builder(this).setTitle("Login").setMessage("Could not Log In").create().show();
            }
        }
        catch(HttpClientErrorException e)
        {
            new AlertDialog.Builder(this).setTitle("Login").setMessage("Could not Log In").create().show();
        }
        catch(JSONException e)
        {
            new AlertDialog.Builder(this).setTitle("Sign Up").setMessage("Invalid Response").create().show();
        }
    }
}


text:
var Polyfills = require('./polyfills.js');
var actions = require('./actions.js');
var View = require('./jsx/View.js');
var Fluxxor = require('fluxxor');
var React = require('react');
var app;
var daisywheelDebug = daisywheelDebug || false;

if (window && document) {
    Polyfills.init();
}

//Flux
var SymbolsStore = require('./stores/symbols.js');
var WheelStore = require('./stores/wheel.js');
var InputStore = require('./stores/input.js');
var GamepadStore = require('./stores/gamepad.js');
var ControlsStore = require('./stores/controls.js');

var stores = {
    InputStore: new InputStore(),
    SymbolsStore: new SymbolsStore(),
    WheelStore: new WheelStore(),
    GamepadStore: new GamepadStore(),
    ControlsStore: new ControlsStore()
};

var flux = new Fluxxor.Flux(stores, actions);
window.flux = flux;

flux.on("dispatch", function(type, payload) {
    if (console && console.log && daisywheelDebug) {
        console.log("[Dispatch]", type, payload);
    }
});

app = document.createElement('div');

document.body.appendChild(app);

React.render(React.createElement(View, {flux: window.flux}), app);

module.exports = {
    symbols: flux.actions.setSymbols,
    load: flux.actions.load,
    unload: flux.actions.unload
};


text:
#include <stdio.h>
#include <string.h>
#include "mex.h"

#include "mexfuncs.h"
#include "gdstypes.h"

#define PS_LEN  16
#define ERR_LEN 64

/*-- local function prototypes ------------------------------------*/

static mxArray* get_elflags(element_t *pe);
static mxArray* get_plex(element_t *pe);
static mxArray* get_layer(element_t *pe);
static mxArray* get_dtype(element_t *pe);
static mxArray* get_ptype(element_t *pe);
static mxArray* get_width(element_t *pe);
static mxArray* get_ext(element_t *pe);
static mxArray* get_font(element_t *pe);
static mxArray* get_verj(element_t *pe);
static mxArray* get_horj(element_t *pe);
static mxArray* get_strans(element_t *pe);
static mxArray* get_sname(element_t *pe);
static mxArray* get_adim(element_t *pe);

/* include hash function */
#include "get_prop_hash.h"

/*-----------------------------------------------------------------*/

void
mexFunction(int nlhs, mxArray *plhs[],
	    int nrhs, const mxArray *prhs[])
{
   struct keyword *pk;   /* pointer to keyword structure */
   element_t *pe;        /* pointer to element */
   char pstr[PS_LEN];    /* property name string */
   char errmsg[ERR_LEN];

   if (nrhs != 2)
      mexErrMsgTxt("get_element_data :  must have exactly two arguments.");

   /* get pointer to element */
   pe = (element_t *)mxGetData(prhs[0]);

   /* get property string */
   mxGetString(prhs[1], pstr, PS_LEN);

   /* decode property argument using the hash function in prop_hash.h */
   pk = (struct keyword *)in_word_set(pstr, strlen(pstr));
   if (pk == NULL) {
      sprintf(errmsg, "get_element_data :  unknown element property -> %s", pstr);
      mexErrMsgTxt(errmsg);
   }

   plhs[0] = (*pk->get_prop_func)(pe);
}

/*=================================================================*/

static mxArray*
get_elflags(element_t *pe)
{
   int i;
   char efstr[3];

   if (pe->has & HAS_ELFLAGS) {
      i=0;
      if (pe->elflags & (1<<14)) {
	 efstr[i] = 'E';
	 i++;
      }
      if (pe->elflags & (1<<15)) {
	 efstr[i] = 'T';
	 i++;
      }
      efstr[i] = '\0';
      return mxCreateString(efstr);
   }
   else
      return empty_matrix();
}

/*-----------------------------------------------------------------*/

static mxArray*
get_plex(element_t *pe)
{
   int32_t plex;

   if (pe->has & HAS_PLEX) {
      plex = pe->plex;
      if ( plex & (1<<23) ) {
         plex = plex & ~(1<<23);
	 plex = -plex;
      }
      return mxCreateDoubleScalar((double)plex);
   }
   else
      return empty_matrix();
}

/*-----------------------------------------------------------------*/

static mxArray*
get_layer(element_t *pe)
{
   if (pe->kind == GDS_SREF || pe->kind == GDS_AREF)
      mexErrMsgTxt("get_element_data :  element as no layer property");
   else
      return mxCreateDoubleScalar((double)pe->layer);

   return NULL; /* make compiler happy */
}

/*-----------------------------------------------------------------*/

static mxArray*
get_dtype(element_t *pe)
{
   if (pe->kind == GDS_SREF || pe->kind == GDS_AREF)
      mexErrMsgTxt("get_element_data :  element as no [data|text|box|node] type property");
   else
      return mxCreateDoubleScalar((double)pe->dtype);

   return NULL; /* make compiler happy */
}

/*-----------------------------------------------------------------*/

static mxArray*
get_ptype(element_t *pe)
{
   if (pe->has & HAS_PTYPE)
      return mxCreateDoubleScalar((double)pe->ptype);
   else
      return empty_matrix();
}

/*-----------------------------------------------------------------*/

static mxArray*
get_width(element_t *pe)
{
   if (pe->has & HAS_WIDTH)
      return mxCreateDoubleScalar((double)pe->width);
   else
      return empty_matrix();
}

/*-----------------------------------------------------------------*/

static mxArray*
get_ext(element_t *pe)
{
   mxArray *pext;                            /* pointer to path extensions */
   const char *extfields[] = {"beg", "end"}; /* for path extensions */

   pext = mxCreateStructMatrix(1,1, 2, extfields);
   if ( pe->has & HAS_BGNEXTN )
      mxSetFieldByNumber(pext, 0, 0, mxCreateDoubleScalar((double)pe->bgnextn));
   else
      mxSetFieldByNumber(pext, 0, 0, empty_matrix());
   if ( pe->has & HAS_ENDEXTN )
      mxSetFieldByNumber(pext, 0, 1, mxCreateDoubleScalar((double)pe->endextn));
   else
      mxSetFieldByNumber(pext, 0, 1, empty_matrix());
   return pext;
}

/*-----------------------------------------------------------------*/

static mxArray*
get_font(element_t *pe)
{
   if (pe->has & HAS_PRESTN)
      return mxCreateDoubleScalar((double)((pe->present & (3<<4)) >> 4));
   else
      return empty_matrix();
}

/*-----------------------------------------------------------------*/

static mxArray*
get_verj(element_t *pe)
{
   if (pe->has & HAS_PRESTN)
      return mxCreateDoubleScalar((double)((pe->present & (3<<2)) >> 2));
   else
      return empty_matrix();
}

/*-----------------------------------------------------------------*/

static mxArray*
get_horj(element_t *pe)
{
   if (pe->has & HAS_PRESTN)
      return mxCreateDoubleScalar((double)(pe->present & 3));
   else
      return empty_matrix();
}

/*-----------------------------------------------------------------*/

static mxArray*
get_strans(element_t *pe)
{
   mxArray *str;         /* pointer to strans */
   const char *stfields[] = {"reflect","absmag","absang","mag","angle"};

   if (pe->has & HAS_STRANS ) {
      str = mxCreateStructMatrix(1,1, 5, stfields);
      struct_set_bool(str, 0, pe->strans.flags & (1 << 15));
      struct_set_bool(str, 1, pe->strans.flags & (1 << 2));
      struct_set_bool(str, 2, pe->strans.flags & (1 << 1));
      if ( pe->has & HAS_MAG )
	 struct_set_float(str, 3, pe->strans.mag);
      if ( pe->has & HAS_ANGLE )
	 struct_set_float(str, 4, pe->strans.angle);
   }
   else
      str = empty_matrix();

   return str;
}

/*-----------------------------------------------------------------*/

static mxArray*
get_sname(element_t *pe)
{
   if (pe->kind == GDS_SREF || pe->kind == GDS_AREF)
      return mxCreateString(pe->sname);
   else
      mexErrMsgTxt("get_element_data :  element as no sname property");

   return NULL; /* make compiler happy */
}

/*-----------------------------------------------------------------*/

static mxArray*
get_adim(element_t *pe)
{
   mxArray *padim;                           /* pointer to adim struct array */
   const char *crfields[] = {"row", "col"};  /* for adim */

   padim = mxCreateStructMatrix(1,1, 2, crfields);
   struct_set_word(padim, 0, &pe->nrow, 1);
   struct_set_word(padim, 1, &pe->ncol, 1);

   return padim;
}

/*-----------------------------------------------------------------*/


text:
#pragma once
#include <aws/serverlessrepo/ServerlessApplicationRepository_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/serverlessrepo/model/Status.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace ServerlessApplicationRepository
{
namespace Model
{
  class AWS_SERVERLESSAPPLICATIONREPOSITORY_API CreateCloudFormationTemplateResult
  {
  public:
    CreateCloudFormationTemplateResult();
    CreateCloudFormationTemplateResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    CreateCloudFormationTemplateResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
The application Amazon Resource Name (ARN).

     */
    inline const Aws::String& GetApplicationId() const{ return m_applicationId; }

    /**
     *
The application Amazon Resource Name (ARN).

     */
    inline void SetApplicationId(const Aws::String& value) { m_applicationId = value; }

    /**
     *
The application Amazon Resource Name (ARN).

     */
    inline void SetApplicationId(Aws::String&& value) { m_applicationId = std::move(value); }

    /**
     *
The application Amazon Resource Name (ARN).

     */
    inline void SetApplicationId(const char* value) { m_applicationId.assign(value); }

    /**
     *
The application Amazon Resource Name (ARN).

     */
    inline CreateCloudFormationTemplateResult& WithApplicationId(const Aws::String& value) { SetApplicationId(value); return *this;}

    /**
     *
The application Amazon Resource Name (ARN).

     */
    inline CreateCloudFormationTemplateResult& WithApplicationId(Aws::String&& value) { SetApplicationId(std::move(value)); return *this;}

    /**
     *
The application Amazon Resource Name (ARN).

     */
    inline CreateCloudFormationTemplateResult& WithApplicationId(const char* value) { SetApplicationId(value); return *this;}

    /**
     *
The date and time this resource was created.

     */
    inline const Aws::String& GetCreationTime() const{ return m_creationTime; }

    /**
     *
The date and time this resource was created.

     */
    inline void SetCreationTime(const Aws::String& value) { m_creationTime = value; }

    /**
     *
The date and time this resource was created.

     */
    inline void SetCreationTime(Aws::String&& value) { m_creationTime = std::move(value); }

    /**
     *
The date and time this resource was created.

     */
    inline void SetCreationTime(const char* value) { m_creationTime.assign(value); }

    /**
     *
The date and time this resource was created.

     */
    inline CreateCloudFormationTemplateResult& WithCreationTime(const Aws::String& value) { SetCreationTime(value); return *this;}

    /**
     *
The date and time this resource was created.

     */
    inline CreateCloudFormationTemplateResult& WithCreationTime(Aws::String&& value) { SetCreationTime(std::move(value)); return *this;}

    /**
     *
The date and time this resource was created.

     */
    inline CreateCloudFormationTemplateResult& WithCreationTime(const char* value) { SetCreationTime(value); return *this;}

    /**
     *
The date and time this template expires. Templates
 expire 1 hour after
     * creation.

     */
    inline const Aws::String& GetExpirationTime() const{ return m_expirationTime; }

    /**
     *
The date and time this template expires. Templates
 expire 1 hour after
     * creation.

     */
    inline void SetExpirationTime(const Aws::String& value) { m_expirationTime = value; }

    /**
     *
The date and time this template expires. Templates
 expire 1 hour after
     * creation.

     */
    inline void SetExpirationTime(Aws::String&& value) { m_expirationTime = std::move(value); }

    /**
     *
The date and time this template expires. Templates
 expire 1 hour after
     * creation.

     */
    inline void SetExpirationTime(const char* value) { m_expirationTime.assign(value); }

    /**
     *
The date and time this template expires. Templates
 expire 1 hour after
     * creation.

     */
    inline CreateCloudFormationTemplateResult& WithExpirationTime(const Aws::String& value) { SetExpirationTime(value); return *this;}

    /**
     *
The date and time this template expires. Templates
 expire 1 hour after
     * creation.

     */
    inline CreateCloudFormationTemplateResult& WithExpirationTime(Aws::String&& value) { SetExpirationTime(std::move(value)); return *this;}

    /**
     *
The date and time this template expires. Templates
 expire 1 hour after
     * creation.

     */
    inline CreateCloudFormationTemplateResult& WithExpirationTime(const char* value) { SetExpirationTime(value); return *this;}

    /**
     *
The semantic version of the application:

 https://semver.org/

     */
    inline const Aws::String& GetSemanticVersion() const{ return m_semanticVersion; }

    /**
     *
The semantic version of the application:

 https://semver.org/

     */
    inline void SetSemanticVersion(const Aws::String& value) { m_semanticVersion = value; }

    /**
     *
The semantic version of the application:

 https://semver.org/

     */
    inline void SetSemanticVersion(Aws::String&& value) { m_semanticVersion = std::move(value); }

    /**
     *
The semantic version of the application:

 https://semver.org/

     */
    inline void SetSemanticVersion(const char* value) { m_semanticVersion.assign(value); }

    /**
     *
The semantic version of the application:

 https://semver.org/

     */
    inline CreateCloudFormationTemplateResult& WithSemanticVersion(const Aws::String& value) { SetSemanticVersion(value); return *this;}

    /**
     *
The semantic version of the application:

 https://semver.org/

     */
    inline CreateCloudFormationTemplateResult& WithSemanticVersion(Aws::String&& value) { SetSemanticVersion(std::move(value)); return *this;}

    /**
     *
The semantic version of the application:

 https://semver.org/

     */
    inline CreateCloudFormationTemplateResult& WithSemanticVersion(const char* value) { SetSemanticVersion(value); return *this;}

    /**
     *
Status of the template creation workflow.

Possible values: PREPARING |
     * ACTIVE | EXPIRED

     */
    inline const Status& GetStatus() const{ return m_status; }

    /**
     *
Status of the template creation workflow.

Possible values: PREPARING |
     * ACTIVE | EXPIRED

     */
    inline void SetStatus(const Status& value) { m_status = value; }

    /**
     *
Status of the template creation workflow.

Possible values: PREPARING |
     * ACTIVE | EXPIRED

     */
    inline void SetStatus(Status&& value) { m_status = std::move(value); }

    /**
     *
Status of the template creation workflow.

Possible values: PREPARING |
     * ACTIVE | EXPIRED

     */
    inline CreateCloudFormationTemplateResult& WithStatus(const Status& value) { SetStatus(value); return *this;}

    /**
     *
Status of the template creation workflow.

Possible values: PREPARING |
     * ACTIVE | EXPIRED

     */
    inline CreateCloudFormationTemplateResult& WithStatus(Status&& value) { SetStatus(std::move(value)); return *this;}

    /**
     *
The UUID returned by CreateCloudFormationTemplate.

Pattern:
     * [0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}

     */
    inline const Aws::String& GetTemplateId() const{ return m_templateId; }

    /**
     *
The UUID returned by CreateCloudFormationTemplate.

Pattern:
     * [0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}

     */
    inline void SetTemplateId(const Aws::String& value) { m_templateId = value; }

    /**
     *
The UUID returned by CreateCloudFormationTemplate.

Pattern:
     * [0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}

     */
    inline void SetTemplateId(Aws::String&& value) { m_templateId = std::move(value); }

    /**
     *
The UUID returned by CreateCloudFormationTemplate.

Pattern:
     * [0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}

     */
    inline void SetTemplateId(const char* value) { m_templateId.assign(value); }

    /**
     *
The UUID returned by CreateCloudFormationTemplate.

Pattern:
     * [0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}

     */
    inline CreateCloudFormationTemplateResult& WithTemplateId(const Aws::String& value) { SetTemplateId(value); return *this;}

    /**
     *
The UUID returned by CreateCloudFormationTemplate.

Pattern:
     * [0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}

     */
    inline CreateCloudFormationTemplateResult& WithTemplateId(Aws::String&& value) { SetTemplateId(std::move(value)); return *this;}

    /**
     *
The UUID returned by CreateCloudFormationTemplate.

Pattern:
     * [0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}

     */
    inline CreateCloudFormationTemplateResult& WithTemplateId(const char* value) { SetTemplateId(value); return *this;}

    /**
     *
A link to the template that can be used to deploy the application using
 AWS
     * CloudFormation.

     */
    inline const Aws::String& GetTemplateUrl() const{ return m_templateUrl; }

    /**
     *
A link to the template that can be used to deploy the application using
 AWS
     * CloudFormation.

     */
    inline void SetTemplateUrl(const Aws::String& value) { m_templateUrl = value; }

    /**
     *
A link to the template that can be used to deploy the application using
 AWS
     * CloudFormation.

     */
    inline void SetTemplateUrl(Aws::String&& value) { m_templateUrl = std::move(value); }

    /**
     *
A link to the template that can be used to deploy the application using
 AWS
     * CloudFormation.

     */
    inline void SetTemplateUrl(const char* value) { m_templateUrl.assign(value); }

    /**
     *
A link to the template that can be used to deploy the application using
 AWS
     * CloudFormation.

     */
    inline CreateCloudFormationTemplateResult& WithTemplateUrl(const Aws::String& value) { SetTemplateUrl(value); return *this;}

    /**
     *
A link to the template that can be used to deploy the application using
 AWS
     * CloudFormation.

     */
    inline CreateCloudFormationTemplateResult& WithTemplateUrl(Aws::String&& value) { SetTemplateUrl(std::move(value)); return *this;}

    /**
     *
A link to the template that can be used to deploy the application using
 AWS
     * CloudFormation.

     */
    inline CreateCloudFormationTemplateResult& WithTemplateUrl(const char* value) { SetTemplateUrl(value); return *this;}

  private:

    Aws::String m_applicationId;

    Aws::String m_creationTime;

    Aws::String m_expirationTime;

    Aws::String m_semanticVersion;

    Status m_status;

    Aws::String m_templateId;

    Aws::String m_templateUrl;
  };

} // namespace Model
} // namespace ServerlessApplicationRepository
} // namespace Aws


text:
#include "mtbl-private.h"

void
metadata_write(const struct mtbl_metadata *m, uint8_t *buf)
{
	size_t padding;
	uint8_t *p = buf;

	p += mtbl_fixed_encode64(p, m->index_block_offset);
	p += mtbl_fixed_encode64(p, m->data_block_size);
	p += mtbl_fixed_encode64(p, m->compression_algorithm);
	p += mtbl_fixed_encode64(p, m->count_entries);
	p += mtbl_fixed_encode64(p, m->count_data_blocks);
	p += mtbl_fixed_encode64(p, m->bytes_data_blocks);
	p += mtbl_fixed_encode64(p, m->bytes_index_block);
	p += mtbl_fixed_encode64(p, m->bytes_keys);
	p += mtbl_fixed_encode64(p, m->bytes_values);

	padding = MTBL_METADATA_SIZE - (p - buf) - sizeof(uint32_t);
	while (padding-- != 0)
		*(p++) = '\0';
	mtbl_fixed_encode32(buf + MTBL_METADATA_SIZE - sizeof(uint32_t), MTBL_MAGIC);
}

bool
metadata_read(const uint8_t *buf, struct mtbl_metadata *m)
{
	uint32_t magic;
	const uint8_t *p = buf;

	magic = mtbl_fixed_decode32(buf + MTBL_METADATA_SIZE - sizeof(uint32_t));
	if (magic != MTBL_MAGIC)
		return (false);

	m->index_block_offset = mtbl_fixed_decode64(p); p += 8;
	m->data_block_size = mtbl_fixed_decode64(p); p += 8;
	m->compression_algorithm = mtbl_fixed_decode64(p); p += 8;
	m->count_entries = mtbl_fixed_decode64(p); p += 8;
	m->count_data_blocks = mtbl_fixed_decode64(p); p += 8;
	m->bytes_data_blocks = mtbl_fixed_decode64(p); p += 8;
	m->bytes_index_block = mtbl_fixed_decode64(p); p += 8;
	m->bytes_keys = mtbl_fixed_decode64(p); p += 8;
	m->bytes_values = mtbl_fixed_decode64(p); p += 8;

	return (true);

}

uint64_t
mtbl_metadata_index_block_offset(const struct mtbl_metadata *m)
{
	return m->index_block_offset;
}

uint64_t
mtbl_metadata_data_block_size(const struct mtbl_metadata *m)
{
	return m->data_block_size;
}

uint64_t
mtbl_metadata_compression_algorithm(const struct mtbl_metadata *m)
{
	return m->compression_algorithm;
}

uint64_t
mtbl_metadata_count_entries(const struct mtbl_metadata *m)
{
	return m->count_entries;
}

uint64_t
mtbl_metadata_count_data_blocks(const struct mtbl_metadata *m)
{
	return m->count_data_blocks;
}

uint64_t
mtbl_metadata_bytes_data_blocks(const struct mtbl_metadata *m)
{
	return m->bytes_data_blocks;
}

uint64_t
mtbl_metadata_bytes_index_block(const struct mtbl_metadata *m)
{
	return m->bytes_index_block;
}

uint64_t
mtbl_metadata_bytes_keys(const struct mtbl_metadata *m)
{
	return m->bytes_keys;
}

uint64_t
mtbl_metadata_bytes_values(const struct mtbl_metadata *m)
{
	return m->bytes_values;
}


text:
package org.elasticsearch.xpack.watcher.common.http;

import org.elasticsearch.common.xcontent.XContentType;

import java.util.Locale;

import static org.elasticsearch.xpack.core.watcher.support.Exceptions.illegalArgument;

public enum HttpContentType {

    JSON() {
        @Override
        public XContentType contentType() {
            return XContentType.JSON;
        }
    },

    YAML() {
        @Override
        public XContentType contentType() {
            return XContentType.YAML;
        }
    },

    TEXT() {
        @Override
        public XContentType contentType() {
            return null;
        }
    };

    public abstract XContentType contentType();

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

    public String id() {
        return name().toLowerCase(Locale.ROOT);
    }

    public static HttpContentType resolve(String id) {
        switch (id.toLowerCase(Locale.ROOT)) {
            case "json" : return JSON;
            case "yaml":  return YAML;
            case "text":  return TEXT;
            default:
                throw illegalArgument("unknown http content type [{}]", id);
        }
    }
}


text:
/// <reference path="../Scripts/typings/jasmine/jasmine.d.ts" />
/// <reference path="../Scripts/typings/jasmine-jquery/jasmine-jquery.d.ts" />
/// <reference path="../Client/reporter.ts" />
var _this = this;

describe("AllGreen.RunnerReporter", function () {
    beforeEach(function () {
        jasmine.getEnv().currentSpec.addMatchers({
            toBeSpecElement: function (specName, statusClass) {
                var actual = this.actual;

                expect(actual).toHaveLength(1);
                expect(actual).toBe('div');
                expect(actual).toHaveClass('spec');
                expect(actual).toHaveClass(statusClass);

                var specNameElement = actual.children('.spec-name');
                expect(specNameElement).toHaveLength(1);
                expect(specNameElement).toBe('a');
                expect(specNameElement).toHaveText(specName);
                expect(specNameElement).toHaveAttr('href', '#');

                var spyEvent = spyOnEvent(specNameElement, 'click');
                specNameElement.click();
                expect(spyEvent).toHaveBeenTriggered();

                return true;
            },
            toBeSuiteElement: function (suiteName, statusClass) {
                var actual = this.actual;

                expect(actual).toHaveLength(1);
                expect(actual).toBe('div');
                expect(actual).toHaveClass('suite');
                expect(actual).toHaveClass(statusClass);

                var suiteNameElement = actual.children('.suite-name');
                expect(suiteNameElement).toHaveLength(1);
                expect(suiteNameElement).toBe('a');
                expect(suiteNameElement).toHaveText(suiteName);
                expect(suiteNameElement).toHaveAttr('href', '#');

                var spyEvent = spyOnEvent(suiteNameElement, 'click');
                suiteNameElement.click();
                expect(spyEvent).toHaveBeenTriggered();

                var suiteContentElement = actual.children('.suite-content');
                expect(suiteContentElement).toHaveLength(1);
                expect(suiteContentElement).toBe('div');

                return true;
            }
        });

        jasmine.getFixtures().fixturesPath = '';
        var clientHtml = readFixtures('Client/client.html');
        expect(clientHtml).not.toBe('');
        clientHtml = clientHtml.replace(/~internal~\//g, '');
        clientHtml = clientHtml.replace(/<script[^>]*><\/script>/g, '');
        clientHtml = clientHtml.replace(/<script[^>]*>[^<]*new AllGreen\.App()[^<]*<\/script>/g, '');
        setFixtures(clientHtml);

        _this.serverReporter = new AllGreen.ServerReporter();
        _this.runnerReporter = new AllGreen.RunnerReporter();

        _this.suite1 = { id: 444, name: 'suite 1', parentSuite: null };
    });

    afterEach(function () {
        _this.serverReporter = null;
        _this.runnerReporter = null;
    });

    it("Is Default", function () {
        expect($('#server-status')).toHaveHtml('Connecting...');
        expect($('#runner-status')).toHaveHtml('Waiting...');
        expect($('#spec-results')).toBeEmpty();
    });

    it("Should be read", function () {
        expect(_this.runnerReporter.isReady()).toBeTruthy();
    });

    it("Can be reset", function () {
        _this.runnerReporter.started();
        _this.runnerReporter.specUpdated({ id: 123, name: 'test 1', suite: _this.suite1, status: 2 /* Passed */ });
        _this.runnerReporter.reset();
        expect($('#runner-status')).toHaveHtml('Waiting...');
        expect($('#spec-results')).toBeEmpty();
    });

    it("Updates server status", function () {
        _this.serverReporter.setServerStatus('NEW SERVER STATUS');
        expect($('#server-status')).toHaveHtml('NEW SERVER STATUS');
    });

    it("Updates runner status", function () {
        _this.runnerReporter.started(20);
        expect($('#runner-status')).toHaveHtml('Running 20 tests...');
    });

    it("Displays spec status", function () {
        _this.runnerReporter.specUpdated({ id: 123, name: 'test 1', suite: _this.suite1, status: 2 /* Passed */ });
        expect(_this.suite1.status).toBe(2 /* Passed */);
        expect($('#spec-results > #suite-444 > .suite-content > #spec-123')).toBeSpecElement('test 1', 'passed');
        expect($('#spec-results > #suite-444')).toBeSuiteElement('suite 1', 'passed');
        expect($('#spec-results')).toHaveClass('passed');
    });

    it("Displays failed spec steps", function () {
        var steps = [
            { message: 'log message' },
            { message: 'expected something and succeded', status: 2 /* Passed */ },
            { message: 'expected something and failed', status: 3 /* Failed */, trace: 'trace 1\ntrace 2' }
        ];
        _this.runnerReporter.specUpdated({ id: 123, name: 'test 1', suite: _this.suite1, status: 3 /* Failed */, steps: steps });
        expect($('#spec-results > #suite-444 > .suite-content > #spec-123')).toBeSpecElement('test 1', 'failed');
        expect($('#spec-results > #suite-444 > .suite-content > #spec-123 > .spec-steps > .spec-step')).toHaveLength(3);
        expect($('#spec-results > #suite-444 > .suite-content > #spec-123 > .spec-steps > .spec-step.log')).toHaveLength(1);
        expect($('#spec-results > #suite-444 > .suite-content > #spec-123 > .spec-steps > .spec-step.passed')).toHaveLength(1);
        expect($('#spec-results > #suite-444 > .suite-content > #spec-123 > .spec-steps > .spec-step.failed')).toHaveLength(1);
        expect($('#spec-results > #suite-444 > .suite-content > #spec-123 > .spec-steps > .spec-step.failed > .spec-step-trace')).toHaveHtml('trace 1<br/>trace 2');
    });

    it("Updates spec status", function () {
        _this.runnerReporter.specUpdated({ id: 123, name: 'test 1', suite: _this.suite1, status: 2 /* Passed */ });
        _this.runnerReporter.specUpdated({ id: 123, name: 'test 1', suite: _this.suite1, status: 3 /* Failed */ });
        expect(_this.suite1.status).toBe(3 /* Failed */);
        expect($('#spec-results > #suite-444 > .suite-content > #spec-123')).toBeSpecElement('test 1', 'failed');
        expect($('#spec-results > #suite-444')).toBeSuiteElement('suite 1', 'failed');
        expect($('#spec-results')).toHaveClass('failed');
    });

    it("Updates suite status", function () {
        _this.runnerReporter.specUpdated({ id: 123, name: 'test 1', suite: _this.suite1, status: 2 /* Passed */ });
        _this.runnerReporter.specUpdated({ id: 323, name: 'test 2', suite: _this.suite1, status: 3 /* Failed */ });
        expect(_this.suite1.status).toBe(3 /* Failed */);
        expect($('#spec-results > #suite-444 > .suite-content > #spec-123')).toBeSpecElement('test 1', 'passed');
        expect($('#spec-results > #suite-444 > .suite-content > #spec-323')).toBeSpecElement('test 2', 'failed');
        expect($('#spec-results > #suite-444')).toBeSuiteElement('suite 1', 'failed');
        expect($('#spec-results')).toHaveClass('failed');
    });

    it("Supports nested suites", function () {
        var suite2 = {
            id: 744, name: 'suite 2', parentSuite: _this.suite1, status: 0 /* Undefined */
        };
        _this.runnerReporter.specUpdated({ id: 123, name: 'test 1', suite: suite2, status: 2 /* Passed */ });
        _this.runnerReporter.specUpdated({ id: 323, name: 'test 2', suite: suite2, status: 3 /* Failed */ });
        expect(_this.suite1.status).toBe(3 /* Failed */);
        expect(suite2.status).toBe(3 /* Failed */);
        expect($('#spec-results > #suite-444 > .suite-content > #suite-744 > .suite-content > #spec-123')).toBeSpecElement('test 1', 'passed');
        expect($('#spec-results > #suite-444 > .suite-content > #suite-744 > .suite-content > #spec-323')).toBeSpecElement('test 2', 'failed');
        expect($('#spec-results > #suite-444 > .suite-content > #suite-744')).toBeSuiteElement('suite 2', 'failed');
        expect($('#spec-results > #suite-444')).toBeSuiteElement('suite 1', 'failed');
        expect($('#spec-results')).toHaveClass('failed');
    });

    it("Shows final suite status", function () {
        _this.runnerReporter.specUpdated({ id: 123, name: 'test 1', suite: _this.suite1, status: 1 /* Running */ });
        _this.runnerReporter.specUpdated({ id: 223, name: 'test 2', suite: _this.suite1, status: 1 /* Running */ });
        expect(_this.suite1.status).toBe(1 /* Running */);
        expect($('#spec-results > #suite-444')).toBeSuiteElement('suite 1', 'running');
        expect($('#spec-results')).toHaveClass('running');
        _this.runnerReporter.specUpdated({ id: 123, name: 'test 1', suite: _this.suite1, status: 2 /* Passed */ });
        expect(_this.suite1.status).toBe(1 /* Running */);
        expect($('#spec-results > #suite-444')).toBeSuiteElement('suite 1', 'running');
        expect($('#spec-results')).toHaveClass('running');
        _this.runnerReporter.specUpdated({ id: 223, name: 'test 2', suite: _this.suite1, status: 3 /* Failed */ });
        expect(_this.suite1.status).toBe(3 /* Failed */);
        expect($('#spec-results > #suite-444')).toBeSuiteElement('suite 1', 'failed');
        expect($('#spec-results')).toHaveClass('failed');
    });
});
//# sourceMappingURL=AllGreenReporterSpecs.js.map


text:
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-styles/color.html">
<link rel="import" href="../bower_components/app-layout/app-scroll-effects/app-scroll-effects.html">
<link rel="import" href="../bower_components/app-layout/app-header/app-header.html">
<link rel="import" href="../bower_components/app-layout/app-header-layout/app-header-layout.html">
<link rel="import" href="../bower_components/app-layout/app-toolbar/app-toolbar.html">
<link rel="import" href="../bower_components/neon-animation/animations/fade-out-animation.html">
<link rel="import" href="../bower_components/neon-animation/animations/scale-up-animation.html">
<link rel="import" href="../bower_components/neon-animation/animations/scale-down-animation.html">
<link rel="import" href="../bower_components/paper-toast/paper-toast.html">
<link rel="import" href="../bower_components/timeu-wizard/timeu-wizard.html">
<link rel="import" href="../bower_components/neon-animation/neon-animated-pages.html">
<link rel="import" href="../bower_components/paper-checkbox/paper-checkbox.html">
<link rel="import" href="../bower_components/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="polymer-redux-store.html">
<link rel="import" href="thg-start.html">
<link rel="import" href="thg-view404.html">
<link rel="import" href="thg-router.html">
<link rel="import" href="thg-genotype.html">
<link rel="import" href="thg-imputation.html">
<link rel="import" href="thg-ancestry.html">
<link rel="import" href="thg-predictions.html">
<link rel="import" href="shared-styles.html">

<dom-module id="thg-app">
  <template>

    <thg-router></thg-router>
    <app-header-layout fullbleed>
      <app-header condenses reveals effects="waterfall">
        <app-toolbar >

TheHonestGene (BETA)

        </app-toolbar>
      </app-header>

            <timeu-wizard steps='["Genetic data","Imputation","Ancestry","Predictions"]' step="{{_currentWizardStep(page)}}"></timeu-wizard>

          <neon-animated-pages attr-for-selected="data-route" id="pages" selected="{{page}}" on-display-toast="onDisplayToastMessage" fallbackSelection="view404">
            <thg-start id="startPage" on-open-consent-dialog="_onOpenConsentDialog" on-open-delete-dialog="_onOpenDeleteDialog" data-route="start"></thg-start>
            <thg-genotype-page data-route="genotype"></thg-genotype-page>
            <thg-imputation data-route="imputation"></thg-imputation>
            <thg-ancestry data-route="ancestry"></thg-ancestry>
            <thg-predictions data-route="predictions"></thg-predictions>
            <thg-view404 data-route="view404"></thg-view404>
            <thg-view500 data-route="view500"></thg-view500>
          </neon-animated-pages>

    </app-header-layout>
    <paper-dialog id="consentDialog" style="max-width:1000px;" on-iron-overlay-closed="_closeConsentDialog" entry-animation="scale-up-animation" exit-animation="fade-out-animation" with-backdrop>

Terms and Consent

        <paper-dialog-scrollable >

Before you can use TheHonestGene, you have to provide agreement to the consent terms by checking the box and clicking "I AGREE" at the bottom of this page.

Introduction

You have a file with your genetic data and want to run a genetic risk prediction with TheHonestGene? Great! Before you start, though, we would like to tell you a few things about TheHonestGene and make sure that you understand the kind of research that we carry out, what it entails, as well as its benefits and potential risks. Remember: If you do decide to participate, you are free to revoke your consent and to discontinue participation at any time - no questions asked. Your participation is entirely voluntary!

Purpose

TheHonestGene is an open data platform for an alternative analysis of genetic data produced by personal genomics and biotechnology companies like 23andme, ancestryDNA and FamilyTreeDNA. This is a not-for-profit and open-source service provided by the Bioinformatics Research Centre (Aarhus, Denmark) and the Gregor Mendel Institute for Molecular Plant Biology (Vienna, Austria). The primary goal of TheHonestGene is to help you learn more about your DNA ancestry and allow you to run risk predictions for various traits, including health-related ones. As a secondary goal, we provide the possibility of anonymously donating your genetic data for scientific research.

How to use?

Risk prediction is entirely anonymous. We will not store any data of the user after the analyses are finished. After you provide consent, you can upload the genetic data you obtained from one of the various third-party personal genomics and biotechnology companies. The analysis consists of three parts:

Parsing your genetic data & Imputation

Ancestry analysis

Risk prediction

                There are no costs for using the service and you will not be compensated for participating either. At the end of the analysis the user has the chance to donate their genetic data annonymously for the benefit of future research.

Confidentiality & Privacy

We highly value privacy and confidentiality, thereby the user can use TheHonestGene entirely anonymously. In fact, we do not require any registration or personal information. Your genetic data will only be stored temporarily for the course of the analyses and will be automatically deleted afterwards. No data will be saved. Furthermore the genetic data will be encrypted separately during its temporary storage on our servers in order to provide additional security. If you decide to use the CLOUD-Upload functionality by granting access to your account at a third-party personal genomics and biotechnology company, we will access your profile information but only for the purpose of retrieving your genetic data. You are welcome to use the alternative FILE-Upload functionality if you do not feel comfortable using the CLOUD-Upload feature.

Benefits

By using TheHonestGene, you will learn more about your genome for free. By optionally donating your genetic data, you can make a big contribution to science and help drive scientific research forward.

Potential Risks

There are no physical risks in using this service but there may be information risks. We are going to provide you with information about your genetic ancestry and with risk assessments related to various traits. As a result, you might find unexpected things about you. These can include a certain ethnic heritage or a predisposition for a disease. For some, such information is empowering; to others, these findings may cause anxiety or discomfort. As stated above, we will do our best to protect the information you provide to us. Despite our efforts (encrypting and not storing the data), we cannot guarantee that your data will never become leaked with significant implications in some scenarios. Please note that, even though we estimate that the risk for such a confidentiality breach is very low, it is not zero.

Contact

If you have questions, please email us at suggestions@thehonestgene.org
                Address

Consent

I have read about this service. All my questions about the service and my role in it have been answered. I understand that my participation is voluntary and I freely consent to using this service.

I expressly authorize the processing and use of my data as indicated in the Confidentiality & Privacy section.

I understand that the research in this service may lead to new products, research tools or inventions that have financial value. By accepting the terms of this consent, I understand that I will not be able to share in the profits from future commercialization of products developed from this service.

I understand that the information served by TheHonestGene is only for educational and research purposes and it is experimental by nature. It is not intended to diagnose, treat, cure or prevent any disease.

I understand that TheHonestGene has the right to change the terms of this consent in the future.

By accepting the terms of this consent form, I have not given up any of my legal rights. I am free to withdraw my consent at any time and free of charge without providing a reason.

<paper-checkbox checked="{{consentChecked}}"></paper-checkbox> By checking this box, you indicate that you have read and understood the above information and that you have decided to use the service based on the information provided.

        </paper-dialog-scrollable>

            <paper-button dialog-dismiss>Decline</paper-button>
            <paper-button dialog-confirm autofocus disabled$="{{!consentChecked}}">I Agree</paper-button>

    </paper-dialog>
    <paper-dialog id="deleteDialog" on-iron-overlay-closed="_closeDeleteDialog" entry-animation="scale-up-animation" exit-animation="fade-out-animation" with-backdrop>

Delete analysis?

            Do you really want to delete the analysis?

            <paper-button dialog-dismiss autofocus>Cancel</paper-button>
            <paper-button dialog-confirm raised>Delete</paper-button>

    </paper-dialog>
    <paper-toast id="toast">
        Ok
      </paper-toast>
  </template>

</dom-module>


text:
package com.chenpan.commoner.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.chenpan.commoner.R;
import com.chenpan.commoner.bean.JOnlineMusic;
import com.chenpan.commoner.utils.FileUtils;
import com.chenpan.commoner.utils.ImageUtils;
import com.chenpan.commoner.utils.OnMoreClickListener;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 在线音乐列表适配器
 * Created by wcy on 2015/12/22.
 */
public class OnlineMusicAdapter extends BaseAdapter {
    private List<JOnlineMusic> mData;
    private OnMoreClickListener mListener;

    public OnlineMusicAdapter(List<JOnlineMusic> data) {
        this.mData = data;
    }

    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int position) {
        return mData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_holder_music, parent, false);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        JOnlineMusic jOnlineMusic = mData.get(position);
        ImageLoader.getInstance().displayImage(jOnlineMusic.getPic_small(), holder.ivCover, ImageUtils.getCoverDisplayOptions());
        holder.tvTitle.setText(jOnlineMusic.getTitle());
        String artist = FileUtils.getArtistAndAlbum(jOnlineMusic.getArtist_name(), jOnlineMusic.getAlbum_title());
        holder.tvArtist.setText(artist);
        holder.ivMore.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mListener.onMoreClick(position);
            }
        });
        holder.vDivider.setVisibility(isShowDivider(position) ? View.VISIBLE : View.GONE);
        return convertView;
    }

    private boolean isShowDivider(int position) {
        return position != mData.size() - 1;
    }

    public void setOnMoreClickListener(OnMoreClickListener listener) {
        mListener = listener;
    }

    class ViewHolder {
        @Bind(R.id.iv_cover)
        ImageView ivCover;
        @Bind(R.id.tv_title)
        TextView tvTitle;
        @Bind(R.id.tv_artist)
        TextView tvArtist;
        @Bind(R.id.iv_more)
        ImageView ivMore;
        @Bind(R.id.v_divider)
        View vDivider;

        public ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<backgrounds>
	<background id="0">
		<name>level 1-5</name>
		<path>src/engine/resources/graphics/backgrounds/Background_Lvl1-5.png</path>
	</background>
	<background id="1">
		<name>level 6-10</name>
		<path>src/engine/resources/graphics/backgrounds/Background_Lvl6-10.png</path>
	</background>
	<background id="2">
		<name>level 11-15</name>
		<path>src/engine/resources/graphics/backgrounds/Background_Lvl11-15.png</path>
	</background>
	<background id="3">
		<name>level 16-20</name>
		<path>src/engine/resources/graphics/backgrounds/Background_Lvl16-20.png</path>
	</background>
</backgrounds>


text:
div.document {
    overflow-x: scroll;
}


text:
package com.github.neunkasulle.chronocommand.view;

import com.vaadin.data.Item;
import com.vaadin.data.util.PropertyValueGenerator;

import java.time.LocalDateTime;

/**
 * Created by Ming-Samsung on 2016/1/31.
 */
public class LocalDateTimeToLocalTimeStringConverter extends  PropertyValueGenerator<String> {

    private final Object propertyId;

    public LocalDateTimeToLocalTimeStringConverter(final Object propertyId) {
        this.propertyId = propertyId;
    }

    @Override
    public String getValue(final Item item, final Object itemId,
                           final Object propertyId) {
        final LocalDateTime time = (LocalDateTime)
                item.getItemProperty(this.propertyId).getValue();
        if (time == null) {
            return "-";
        }
        return time.toLocalTime().toString();
    }

    @Override
    public Class<String> getType() {
        return String.class;
    }
}


text:
namespace sentencepiece {
namespace filesystem {

class PosixReadableFile : public ReadableFile {
 public:
  PosixReadableFile(absl::string_view filename, bool is_binary = false)
      : is_(filename.empty()
                ? &std::cin
                : new std::ifstream(WPATH(filename.data()),
                                    is_binary ? std::ios::binary | std::ios::in
                                              : std::ios::in)) {
    if (!*is_)
      status_ = util::StatusBuilder(util::StatusCode::kNotFound, GTL_LOC)
                << "\"" << filename.data() << "\": " << util::StrError(errno);
  }

  ~PosixReadableFile() {
    if (is_ != &std::cin) delete is_;
  }

  util::Status status() const { return status_; }

  bool ReadLine(std::string *line) {
    return static_cast<bool>(std::getline(*is_, *line));
  }

  bool ReadAll(std::string *line) {
    if (is_ == &std::cin) {
      LOG(ERROR) << "ReadAll is not supported for stdin.";
      return false;
    }
    line->assign(std::istreambuf_iterator<char>(*is_),
                 std::istreambuf_iterator<char>());
    return true;
  }

 private:
  util::Status status_;
  std::istream *is_;
};

class PosixWritableFile : public WritableFile {
 public:
  PosixWritableFile(absl::string_view filename, bool is_binary = false)
      : os_(filename.empty()
                ? &std::cout
                : new std::ofstream(WPATH(filename.data()),
                                    is_binary ? std::ios::binary | std::ios::out
                                              : std::ios::out)) {
    if (!*os_)
      status_ =
          util::StatusBuilder(util::StatusCode::kPermissionDenied, GTL_LOC)
          << "\"" << filename.data() << "\": " << util::StrError(errno);
  }

  ~PosixWritableFile() {
    if (os_ != &std::cout) delete os_;
  }

  util::Status status() const { return status_; }

  bool Write(absl::string_view text) {
    os_->write(text.data(), text.size());
    return os_->good();
  }

  bool WriteLine(absl::string_view text) { return Write(text) && Write("\n"); }

 private:
  util::Status status_;
  std::ostream *os_;
};

using DefaultReadableFile = PosixReadableFile;
using DefaultWritableFile = PosixWritableFile;

std::unique_ptr<ReadableFile> NewReadableFile(absl::string_view filename,
                                              bool is_binary) {
  return absl::make_unique<DefaultReadableFile>(filename, is_binary);
}

std::unique_ptr<WritableFile> NewWritableFile(absl::string_view filename,
                                              bool is_binary) {
  return absl::make_unique<DefaultWritableFile>(filename, is_binary);
}

}  // namespace filesystem
}  // namespace sentencepiece