text:
from dp_tornado.engine.controller import Controller

class SetnxController(Controller):
    def get(self):
        test_key = 'test:setnx:unit-test'
        test_val = 'foo'
        test_ttl = 3600

        self.model.tests.model_test.cache_test.setnx_redis_delete(test_key)

        assert not self.model.tests.model_test.cache_test.setnx_redis_get(test_key)

        ttl_comp = self.model.tests.model_test.cache_test.setnx_redis_ttl(test_key)
        assert not ttl_comp or ttl_comp == -2

        assert self.model.tests.model_test.cache_test.setnx_redis_set(test_key, test_val, None)

        assert self.model.tests.model_test.cache_test.setnx_redis_get(test_key) == test_val

        ttl_comp = self.model.tests.model_test.cache_test.setnx_redis_ttl(test_key)
        assert not ttl_comp or ttl_comp == -1

        assert self.model.tests.model_test.cache_test.setnx_redis_delete(test_key) == 1
        assert self.model.tests.model_test.cache_test.setnx_redis_set(test_key, test_val, test_ttl)

        assert self.model.tests.model_test.cache_test.setnx_redis_get(test_key) == test_val
        assert self.model.tests.model_test.cache_test.setnx_redis_ttl(test_key) > 0

        assert not self.model.tests.model_test.cache_test.setnx_redis_set(test_key, 'change', None)
        assert not self.model.tests.model_test.cache_test.setnx_redis_set(test_key, 'change', test_ttl)

        assert self.model.tests.model_test.cache_test.setnx_redis_get(test_key) == test_val

        self.finish('done')


text:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item >
        <shape android:shape="rectangle">
            <solid android:color="@color/toolbar_bottom_bar"/>
        </shape>
    </item>

    <item android:bottom="0dp">
        <shape android:shape="rectangle">
            <solid android:color="@color/colorPrimary"/>
        </shape>
    </item>
</layer-list>

redpajama_set_name: RedPajamaGithub


text:
import React from 'react';
// import { Map } from 'Immutable';
// import { DefaultDraftInlineStyle } from 'draft-js';
import Icon from '../icons';
import { FontSize } from './font-size';
import { FontFamily } from './font-family';
import { Color } from './color';
import Button from '../button';
import ButtonPopover from '../button-popover';

export const inlineStyles = {

  // 系统默认
  BOLD: {
    label: <Icon type="fontbold" />,
    title: '粗体',
    Element: Button
  },
  ITALIC: {
    title: '斜体',
    label: <Icon type="fontitalics" />,
    Element: Button
  },
  UNDERLINE: {
    title: '下划线',
    label: <Icon type="fontunderline" />,
    Element: Button
  },
  STRIKETHROUGH: {
    title: '删除线',
    label: <Icon type="fontstrikethrough" />,
    Element: Button
  },
  CODE: {
    title: '行内代码块',
    label: 'Monospace',
    Element: Button
  },

  // 自定义
  FONTFAMILY: {
    title: '字体',
    label: <Icon type="font" />,
    Element( props ) {
      return (
        <ButtonPopover {...props}>
          <FontFamily
            select={props.type}
            onChange={props.onToggle} />
        </ButtonPopover>
      );
    }
  },
  FONTSIZE: {
    title: '字体大小',
    label: <Icon type="fontsize" />,
    Element( props ) {
      return (
        <ButtonPopover {...props}>
          <FontSize
            select={props.type}
            onChange={props.onToggle} />
        </ButtonPopover>
      );
    }
  },
  FONTCOLOR: {
    label: <Icon type="fontcolormerge" />,
    title: '字体颜色',
    Element( props ) {
      return (
        <ButtonPopover {...props}>
          <Color
            type="color"
            select={props.type}
            onChange={props.onToggle} />
        </ButtonPopover>
      );
    }
  },
  FONTBACKGROUNTCOLOR: {
    label: <Icon type="fontbackground" />,
    title: '字体高亮',
    Element( props ) {
      return (
        <ButtonPopover {...props}>
          <Color
            type="backgroundcolor"
            select={props.type}
            onChange={props.onToggle} />
        </ButtonPopover>
      );
    }
  }
};


text:
#include "spa_algorithm.hpp"

void spa_star (double p, double q, double r, spa_network_t & network, std::mt19937& engine) {
  bool new_individual;
  std::uniform_real_distribution<double> rand_real(0,1);
  unsigned int quiet_size = 0;
  if (r*(1-p) >= 1) {
    LOGGER_WRITE(Logger::DEBUG,VAR_PRINT(r*(1-p))+" >= 1 : Links are occuring on a faster time-scale.")
    /** In this case, link occur on a fast time scale.
      * One must set epsilon such that dL/dT is smaller than one and interpretable as a probability, i.e.
      *
      *  dL     n
      *  -- =  ---
      *  dT     N
      *
      * with n the effective size of an average cluster, and N the total sizes.
      */
    double epsilon = 1/(r*(1-p));
    /** By definition,  a fraction epsilon \in [0,1] of events lead to SPA steps.
      * Since epsilon can get quite small, we sample from the distribution that the
      * first non-link creation event occurs on the nth event (geometric distribution)
      * instead of throwing a dice for birth/growth event at each time step.
      *
      * The effective size ratio is respected if we allow link creation events to fail
      * when a fully connected node is selected.
      */
    std::geometric_distribution<int> geo_real(epsilon);
    while (network.size_in_nodes()<network.target_size()) {
      // create links due to steps where no cluster related event happen.
      unsigned int number_of_link_creation_steps = geo_real(engine);
      LOGGER_WRITE(Logger::DEBUG, "Geometric distribution result: "+VAR_EVAL(number_of_link_creation_steps)+" additional links must be created.")
      for (unsigned int i = 0; i < number_of_link_creation_steps; ++i) {
        LOGGER_WRITE(Logger::DEBUG, "link_creation_step:")
        auto event_ret = network.link_creation_step(engine);
        LOGGER_WRITE(Logger::DEBUG,"\tSUCCESS ? "+VAR_EVAL(std::get<3>(event_ret))+" || "+VAR_EVAL(std::get<0>(event_ret))+"<->"+VAR_EVAL(std::get<1>(event_ret))+" in cluster "+VAR_EVAL(std::get<2>(event_ret)))
      }

      // test for cluster birth or growth
      if (rand_real(engine) < p) {
        rand_real(engine) < q ?  new_individual = true : new_individual = false;
        LOGGER_WRITE(Logger::DEBUG, "cluster_birth with"+VAR_PRINT(new_individual))
        id_t event_ret = network.cluster_birth(new_individual,engine);
        LOGGER_WRITE(Logger::DEBUG, "\tcluster="+VAR_EVAL(event_ret))
      }
      else {
        rand_real(engine) < q ?  new_individual = true : new_individual = false;
        LOGGER_WRITE(Logger::DEBUG, "cluster_growth with "+VAR_PRINT(new_individual))
        auto event_ret = network.cluster_growth(new_individual,engine);
        LOGGER_WRITE(Logger::DEBUG,"\tnode="+VAR_EVAL(std::get<0>(event_ret))+" cluster="+VAR_EVAL(std::get<1>(event_ret)))
      }
      // normal link creation step
      LOGGER_WRITE(Logger::DEBUG, "link_creation_step:")
      auto event_ret = network.link_creation_step(engine);
      LOGGER_WRITE(Logger::DEBUG,"\tSUCCESS ? "+VAR_EVAL(std::get<3>(event_ret))+" || "+VAR_EVAL(std::get<0>(event_ret))+"<->"+VAR_EVAL(std::get<1>(event_ret))+" in cluster "+VAR_EVAL(std::get<2>(event_ret)))

      LOGGER_WRITE(Logger::DEBUG,"===============================")
      LOGGER_WRITE(Logger::DEBUG, "Current size:"+VAR_PRINT(network.size_in_nodes()))
      #if LOGGER_LEVEL < 3
        if (network.size_in_nodes()%100==0 && quiet_size != network.size_in_nodes()) {
          LOGGER_WRITE(Logger::INFO, VAR_PRINT(network.size_in_nodes()))
          quiet_size = network.size_in_nodes();
        }
      #endif
    }
  }
  else {
    LOGGER_WRITE(Logger::DEBUG,VAR_PRINT(r*(1-p))+" < 1 : SPA-events are occuring on a faster time-scale.")
    /** In this case, link creation occur on a slow time scale and we set epsilon = 1, such that
      *
      *  dL     n
      *  -- =  --- * r * (1-p)
      *  dT     N
      *
      * The effective size ratio is respected if we allow link creation events to fail
      * when a fully connected node is selected.
      */
    while (network.size_in_nodes()<network.target_size()) {
      // test for cluster birth/growth
      if (rand_real(engine) < p) {
        rand_real(engine) < q ?  new_individual = true : new_individual = false;
        LOGGER_WRITE(Logger::DEBUG, "cluster_birth with"+VAR_PRINT(new_individual))
        id_t event_ret = network.cluster_birth(new_individual,engine);
        LOGGER_WRITE(Logger::DEBUG, "\tcluster="+VAR_EVAL(event_ret))
      }
      else {
        rand_real(engine) < q ?  new_individual = true : new_individual = false;
        LOGGER_WRITE(Logger::DEBUG, "cluster_growth with "+VAR_PRINT(new_individual))
        auto event_ret = network.cluster_growth(new_individual,engine);
        LOGGER_WRITE(Logger::DEBUG,"\tnode="+VAR_EVAL(std::get<0>(event_ret))+" cluster="+VAR_EVAL(std::get<1>(event_ret)))
      }
      // test for link creation
      if (rand_real(engine)<r*(1-p)) {
        LOGGER_WRITE(Logger::DEBUG, "link_creation_step:")
        auto event_ret = network.link_creation_step(engine);
        LOGGER_WRITE(Logger::DEBUG,"\tSUCCESS ? "+VAR_EVAL(std::get<3>(event_ret))+" || "+VAR_EVAL(std::get<0>(event_ret))+"<->"+VAR_EVAL(std::get<1>(event_ret))+" in cluster "+VAR_EVAL(std::get<2>(event_ret)))
      }

      LOGGER_WRITE(Logger::DEBUG,"===============================")
      LOGGER_WRITE(Logger::DEBUG, "Current size:"+VAR_PRINT(network.size_in_nodes()))
      #if LOGGER_LEVEL < 3
        if (network.size_in_nodes()%100==0 && quiet_size != network.size_in_nodes()) {
          LOGGER_WRITE(Logger::INFO, VAR_PRINT(network.size_in_nodes()))
          quiet_size = network.size_in_nodes();
        }
      #endif
    }
  }
  return;
}
void spa_basic(double p, double q, spa_network_t & network, std::mt19937& engine) {
  bool new_individual;
  std::uniform_real_distribution<double> rand_real(0,1);
  unsigned int quiet_size = 0;
  // untill the desired size is reached...
  while (network.size_in_nodes()<network.target_size()) {
    // test for cluster birth or growth
    if (rand_real(engine) < p) {
      rand_real(engine) < q ?  new_individual = true : new_individual = false;
      LOGGER_WRITE(Logger::DEBUG, "cluster_birth with"+VAR_PRINT(new_individual))
      id_t event_ret = network.cluster_birth(new_individual,engine);
      LOGGER_WRITE(Logger::DEBUG, "\tcluster="+VAR_EVAL(event_ret))
    }
    else {
      rand_real(engine) < q ?  new_individual = true : new_individual = false;
      LOGGER_WRITE(Logger::DEBUG, "cluster_growth with "+VAR_PRINT(new_individual))
      auto event_ret = network.cluster_growth(new_individual,engine);
      LOGGER_WRITE(Logger::DEBUG,"\tnode="+VAR_EVAL(std::get<0>(event_ret))+" cluster="+VAR_EVAL(std::get<1>(event_ret)))
    }

    LOGGER_WRITE(Logger::DEBUG,"===============================")
    LOGGER_WRITE(Logger::DEBUG, "Current size:"+VAR_PRINT(network.size_in_nodes()))
    #if LOGGER_LEVEL < 3
        if (network.size_in_nodes()%100==0 && quiet_size != network.size_in_nodes()) {
          LOGGER_WRITE(Logger::INFO, VAR_PRINT(network.size_in_nodes()))
          quiet_size = network.size_in_nodes();
        }
    #endif
  }
  return;
}


text:
package org.axonframework.messaging.annotation;

import org.axonframework.eventhandling.EventHandler;
import org.axonframework.eventhandling.EventMessage;
import org.junit.jupiter.api.*;

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

import static org.junit.jupiter.api.Assertions.*;

/**
 * Tests sorting of handlers using {@link HandlerComparator}. Event types have complex hierarchical inheritance.
 *
 * @author Milan Savic
 */
class HandlerHierarchyTest {

    private interface C {}
    private interface D extends C {}
    private interface H extends D {}
    private interface E extends D {}
    private static abstract class F implements D {}
    private static class I implements H {}
    private static abstract class G implements E {}
    private static class A {}
    private static class B {}

    private static class MyEventHandler {

        @EventHandler public void handle(E event) {}
        @EventHandler public void handle(G event) {}
        @EventHandler public void handle(A event) {}
        @EventHandler public void handle(B event) {}
        @EventHandler public void handle(I event) {}
        @EventHandler public void handle(F event) {}
    }

    @Test
    void hierarchySort() throws NoSuchMethodException {
        MultiParameterResolverFactory multiParameterResolverFactory = MultiParameterResolverFactory.ordered(new DefaultParameterResolverFactory());

        MessageHandlingMember<?> bHandler = new AnnotatedMessageHandlingMember<>(MyEventHandler.class.getMethod("handle", B.class),
                                                                                EventMessage.class,
                                                                                B.class,
                                                                                multiParameterResolverFactory);
        MessageHandlingMember<?> iHandler = new AnnotatedMessageHandlingMember<>(MyEventHandler.class.getMethod("handle", I.class),
                                                                                EventMessage.class,
                                                                                I.class,
                                                                                multiParameterResolverFactory);
        MessageHandlingMember<?> fHandler = new AnnotatedMessageHandlingMember<>(MyEventHandler.class.getMethod("handle", F.class),
                                                                                EventMessage.class,
                                                                                F.class,
                                                                                multiParameterResolverFactory);
        MessageHandlingMember<?> aHandler = new AnnotatedMessageHandlingMember<>(MyEventHandler.class.getMethod("handle", A.class),
                                                                                EventMessage.class,
                                                                                A.class,
                                                                                multiParameterResolverFactory);
        MessageHandlingMember<?> gHandler = new AnnotatedMessageHandlingMember<>(MyEventHandler.class.getMethod("handle", G.class),
                                                                                EventMessage.class,
                                                                                G.class,
                                                                                multiParameterResolverFactory);
        MessageHandlingMember<?> eHandler = new AnnotatedMessageHandlingMember<>(MyEventHandler.class.getMethod("handle", E.class),
                                                                                EventMessage.class,
                                                                                E.class,
                                                                                multiParameterResolverFactory);

        List<MessageHandlingMember<?>> handlers = Arrays.asList(bHandler,
                                                                iHandler,
                                                                fHandler,
                                                                aHandler,
                                                                gHandler,
                                                                eHandler);

        handlers.sort(HandlerComparator.instance());
        assertTrue(handlers.indexOf(gHandler) < handlers.indexOf(eHandler));
    }
}


text:
The Aerospike client can be configured using a JavaScript object.

The following is a configuration example and some guidlines on how to configure a client.

```js
var aerospike = require('aerospike');

var config = {
  hosts: [
    // add three nodes in the cluster.
    { addr: "192.168.0.1", port: 3000 },
    { addr: "192.168.0.2", port: 3000 },
    { addr: "192.168.0.3", port: 3000 }
  ],
  policies = {
    // default timeout for all operations is 100ms
    timeout: 100
  }
  log : {
     log : aerospike.log.INFO,
     file : fd  // fd  opened by the application using fs.open()
  },
  modlua: {
	  systemPath: 'path to system UDF files',
	  userPath: ' 'path to user UDF files'
  }
};

var client = aerospike.client(config);
```

The attributes of the configuration are enumerated below.

## Configuration Attributes

### `hosts` attribute

The `hosts` attribute should contain an Array of hosts with which the client should attempt to connect. On `client.connect()`, the client iterates through the list of hosts until it successfully connects with one.

Each entry in the list is a Object containing the following attributes:

- `addr` - The IP address or domain name of the host.
- `port` - The listening port of the host. If not specified, the default is 3000.

### `policies` attribute

The `policies` attribute should contain an Object that contains global policies for the client. A policy is a set of values which modify the behavior of an operation, like timeouts and how an operation handles data. The policies defined in the configuration are used as global defaults, which can be overridden by individual operations as needed.

The attributes of the `policies` Object:

- `timeout` – The global timeout value, which is used if one is not explicitly defined for an operation.
- `batch` – The global policy for batch operations, defined using a [Batch Policy Object](policies.md#BatchPolicy)
- `info` – The global policy for info operations, defined using an [Info Policy Object](policies.md#InfoPolicy)
- `operate` – The global policy for info operations, defined using an [Operate Policy Object](policies.md#OperatePolicy)
- `query` – The global policy for query operations, defined using a [Query Policy Object](policies.md#QueryPolicy)
- `read` – The global policy for read operations, defined using a [Read Policy Object](policies.md#ReadPolicy)
- `scan` – The global policy for scan operations, defined using a [Scan Policy Object](policies.md#ScanPolicy)
- `write` – The global policy for write operations, defined using a [Write Policy Object](policies.md#WritePolicy)

### `log` attribute

The `log` attribute is an object that contatins configuration for logging from the API. Logging is provided only for the API, not application.

The attributes of `log` object.

- `level` - logging severity, defined using [aerospike.log object](log.md).
- `file`  - file descriptor which is obtained using fs.open().

### `modlua` attribute

The `modlua` object contains configuration values for mod-lua system and user paths.

The attributes of `mod-lua` object.

- `systemPath` - The path to the system UDF files. These UDF files are installed with the aerospike client library. Default location relative to node_modules is : 'node_modules/aerospike/aerospike-client-c/package/opt/aerospike/client/sys/udf/lua/'
- `userPath`   - The path to user's UDF files. Default location relative to node modules is : 'node_modules/aerospike/aerospike-client-c/package/opt/aerospike/client/usr/udf/lua/'


text:
case node['platform_family']
when 'debian'
  include_recipe 'apt'
  codename = node['lsb']['codename']
  case codename
  when 'raring', 'saucy', 'trusty', 'utopic', 'vivid', 'wily', 'xenial', 'wheezy', 'jessie', 'stretch'
    codename = 'precise'
    Chef::Log.warn('Overriding repository distribution to Precise')
  end
  apt_repository 'coopr' do
    uri node['coopr']['repo']['apt_repo_url']
    distribution codename
    components node['coopr']['repo']['apt_components']
    action :add
    arch 'amd64'
    key "#{node['coopr']['repo']['apt_repo_url']}/pubkey.gpg"
  end
when 'rhel', 'amazon' # ~FC024
  include_recipe 'yum'
  yum_repository 'coopr' do
    description 'Coopr YUM repository'
    url node['coopr']['repo']['yum_repo_url']
    gpgkey "#{node['coopr']['repo']['yum_repo_url']}/pubkey.gpg"
    gpgcheck true
    action :add
  end
end


text:
import json
from ServicesMyWallet import app
#from ServicesMyWallet import db
from bson import json_util
from bson.objectid import ObjectId

#Referencia a la coleccion cartera
#abono = db.abono

#Obtencion de todas los cargos
@app.route("/usuarios/<idUsuario>/carteras/<idCartera>/abonos", methods=['GET'])
def obtenerAbonos(idUsuario,idCartera):
  return "obtenerAbonos"

#Guardado de un cargo
@app.route("/usuarios/<idUsuario>/carteras/<idCartera>/abonos", methods=['POST'])
def guardarAbonos(idUsuario,idCartera):
  return "guardarAbonos"

#Obtencion de un cargo por id
@app.route("/usuarios/<idUsuario>/carteras/<idCartera>/abonos/<idAbono>", methods=['GET'])
def obtenerAbonoPorId(idUsuario,idCartera,idAbono):
  return "obtenerAbonoPorId"

#Actualizar un cargo por id
@app.route("/usuarios/<idUsuario>/carteras/<idCartera>/abonos/<idAbono>", methods=['PUT'])
def actualizarAbonoPorId(idUsuario,idCartera,idAbono):
  return "actualizarAbonoPorId"

#Eliminar un cargo por id
@app.route("/usuarios/<idUsuario>/carteras/<idCartera>/abonos/<idAbono>", methods=['DELETE'])
def eliminarAbonoPorId(idUsuario,idCartera,idAbono):
  return "eliminarAbonoPorId"


text:
struct node *sockets = NULL;

static struct orvibo_socket *
find_socket(const unsigned char *data, NODE_DATA_MATCH match);

static bool
is_address_equal(const struct orvibo_socket *socket, const char *ip);

static bool
is_mac_equal(const struct orvibo_socket *socket, const unsigned char mac[static ETHER_ADDR_LEN]);

struct orvibo_socket *
find_socket_with_ip(const char *const ip) {
	return find_socket((const unsigned char *) ip, (NODE_DATA_MATCH) is_address_equal);
}

struct orvibo_socket *
find_socket_with_mac(const unsigned char mac[static const ETHER_ADDR_LEN]) {
	return find_socket(mac, (NODE_DATA_MATCH) is_mac_equal);
}

bool
add_socket(struct orvibo_socket *const socket) {
	struct node *const node = node_create(socket);
	if (node == NULL) {
		return false;
	}
	node_prepend(node, sockets);
	sockets = node;
	return true;
}

void
remove_socket(const struct orvibo_socket *const socket) {
	node_remove(sockets, socket, (NODE_DATA_MATCH) is_address_equal);
}

static struct orvibo_socket *
find_socket(const unsigned char *const data, const NODE_DATA_MATCH match) {
	const struct node *const node = node_find(sockets, data, match);
	return node != NULL ? node->data : NULL;
}

static bool
is_address_equal(const struct orvibo_socket *const socket, const char *const ip) {
	return socket != NULL && socket->ip != NULL && strcmp(socket->ip, ip) == 0;
}

static bool
is_mac_equal(const struct orvibo_socket *const socket, const unsigned char mac[static const ETHER_ADDR_LEN]) {
	return socket != NULL && memcmp(socket->mac_bytes, mac, ETHER_ADDR_LEN) == 0;
}


text:
package com.datatorrent.contrib.rabbitmq;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 */
public class RabbitMQInputOperatorBenchmark extends RabbitMQInputOperatorTest
{
  private static final Logger logger = LoggerFactory.getLogger(RabbitMQInputOperatorBenchmark.class);

  @Test
  public void testDag() throws Exception
  {
    runTest(100000);
    logger.debug("end of test");
  }
}


text:
/* ipm_dummy.c - Fake IPM driver */

/*
 * Copyright (c) 2015 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef _IPM_DUMMY_H_

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/ipm.h>

/* Arbitrary */
#define DUMMY_IPM_DATA_WORDS    4

struct ipm_dummy_regs {
	uint32_t id;
	uint32_t data[DUMMY_IPM_DATA_WORDS];
	uint8_t busy;
	uint8_t enabled;
};

struct ipm_dummy_driver_data {
	ipm_callback_t cb;
	void *cb_context;
	volatile struct ipm_dummy_regs regs;
};

int ipm_dummy_init(const struct device *d);
#endif


text:
@protocol StatisticsModuleViewInput;
@protocol StatisticsModuleInteractorInput;
@protocol StatisticsModuleRouterInput;

@interface StatisticsModulePresenter : NSObject <StatisticsModuleModuleInput, StatisticsModuleViewOutput, StatisticsModuleInteractorOutput>

@property (nonatomic, weak) id<StatisticsModuleViewInput> view;
@property (nonatomic, strong) id<StatisticsModuleInteractorInput> interactor;
@property (nonatomic, strong) id<StatisticsModuleRouterInput> router;

@end


text:
{% extends 'budget/base.html' %}

{% block title %}Add A Category{% endblock title %}

{% block budget_content %}

Add A Category

    <form method="post" action=".">{% csrf_token %}

            {{ form.as_table }}

                    <input class="btn btn-primary" type="submit" name="confirmed" value="Save">
                    or
                    Cancel

    </form>
{% endblock budget_content %}


text:
package dta.pizzeria.ihm;

import java.util.Scanner;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import dta.pizzeria.dao.IDao;
import dta.pizzeria.model.Pizza;

@Component
@Controller
public abstract class Action {
	protected String nom;
	protected IDao<Pizza> dao;
	protected Scanner sc;

	public String getNom() {
		return this.nom;
	}

	public void faire() {
	}

	@Autowired
	@Qualifier("pizzaDao1")
	public void setDao(IDao<Pizza> dao) {
		this.dao = dao;
	}

	@Autowired
	public void setSc(Scanner sc) {
		this.sc = sc;
	}

}


text:
%
%ds = prtDataGenBimodal(5e3);
%
%c = train(prtClusterStudentTOnlineVb,ds);

% Copyright (c) 2013 New Folder Consulting
%
% Permission is hereby granted, free of charge, to any person obtaining a
% copy of this software and associated documentation files (the
% "Software"), to deal in the Software without restriction, including
% without limitation the rights to use, copy, modify, merge, publish,
% distribute, sublicense, and/or sell copies of the Software, and to permit
% persons to whom the Software is furnished to do so, subject to the
% following conditions:
%
% The above copyright notice and this permission notice shall be included
% in all copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
% OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
% MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
% NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
% DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
% OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
% USE OR OTHER DEALINGS IN THE SOFTWARE.

classdef prtClusterStudentTOnlineVb < prtCluster

    properties (SetAccess=private)
        name = 'Student T Online VB Clustering' % GMM Clustering
        nameAbbreviation = 'STOVBCluster' % GMMCluster
    end

    properties
        batchSize = 1000;
        maxIterations = 100;
        learningRateFunction = @(t)(t+5)^(-0.8);

        nClusters = 5;

        meanMean

        means
        covs
        pi
    end

    methods
        function self = prtClusterStudentTOnlineVb(varargin)
            self = prtUtilAssignStringValuePairs(self, varargin{:});
        end
    end

    methods (Access=protected, Hidden = true)
        function self = trainAction(self, ds)

            d = ds.nFeatures;

            cDs = ds.bootstrap(self.batchSize);
            self.means = cDs.X(1:self.nClusters,:);
            self.covs = repmat(diag(var(cDs.X)), [1 1 self.nClusters]);

            self.pi = ones(1,self.nClusters)/self.nClusters;

            prior.mean = zeros(1,self.nClusters);
            prior.meanStrength = self.nFeaturesl

            for iter = 1:self.maxIterations
                cDs = ds.bootstrap(self.batchSize);
                cX = cDs.X;
                keyboard

                studentTGammas = zeros(self.batchSize, self.nClusters);
                logLikes = zeros(self.batchSize, self.nClusters);
                for iComp = 1:self.nClusters
                    cR = chol(self.covs(:,:,iComp));

                    xRinv = bsxfun(@minus,cX,self.means(iComp,:)) / cR;
                    logSqrtDetSigma = sum(log(diag(cR)));

                    studentTGammas(:,iComp) = (d + 1e-6)./(sum(xRinv.^2, 2) + 1e-6);

                    logLikes(:,iComp) = -0.5*sum(xRinv.^2, 2) - logSqrtDetSigma - d*log(2*pi)/2 + d/2*log(studentTGammas(:,iComp)) + 1/2*studentTGammas(:,iComp);
                end

                phi = exp(bsxfun(@minus, logLikes, prtUtilSumExp(logLikes')'));

                for iComp = 1:self.nClusters
                    cWeightedPhi = phi(:,iComp).*studentTGammas(:,iComp);
                    cXSum = sum(bsxfun(@times, cX,  cWeightedPhi),1);
                    cN = sum(cWeightedPhi,1);

                    cMean = cXSum./cN;

                    cXDeMean = bsxfun(@minus,cX,cMean);
                    cCov = bsxfun(@times, cXDeMean, cWeightedPhi)'*cXDeMean./cN;

                    cPostMean =

                end
            end
        end
        function ds = runAction(self, ds)
            keyboard
        end
    end
end


text:
<?php
abstract class HTTP_Status
{	const UNAUTHORIZED=401;
	const UNAUTHORIZED_MSG="Please Login Again!";
	const FORBIDDEN=403;
	const FORBIDDEN_MSG="You don't have sufficient rights!";
	const NOT_FOUND=404;
	const NOT_FOUND_MSG="No Record Found!";
	const INTERNAL_SERVER_ERROR=500;
	const INTERNAL_SERVER_ERROR_MSG="Server is busy right now!";
	const DUPLICATE=23000;
	const DUPLICATE_MSG="Duplicate Entry!";
	const BAD_REQUEST=400;
	const BAD_REQUEST_MSG="The request cannot be fulfilled due to bad syntax.";
	public static function getMessage($status)
	{	$http_status=new ReflectionClass('HTTP_Status');
		$const=$http_status->getConstants();
		$const_name=null;
		foreach($const as $name=>$val)
		{	if($val==$status)
			{	$const_name=$name;
				break;
			}
		}
		if(!empty($const_name))
		{	$const_name.="_MSG";
			return $http_status->getConstant($const_name);
		}
		return "Some Error Occurred!";
	}
}
?>


text:
'use strict';

function express() {
  // [START error_reporting_setup_nodejs_express]
  const express = require('express');

  // Imports the Google Cloud client library
  const {ErrorReporting} = require('@google-cloud/error-reporting');

  // Instantiates a client
  const errors = new ErrorReporting();

  const app = express();

  app.get('/error', (req, res, next) => {
    res.send('Something broke!');
    next(new Error('Custom error message'));
  });

  app.get('/exception', () => {
    JSON.parse('{"malformedJson": true');
  });

  // Note that express error handling middleware should be attached after all
  // the other routes and use() calls. See the Express.js docs.
  app.use(errors.express);

  const PORT = process.env.PORT || 8080;
  app.listen(PORT, () => {
    console.log(`App listening on port ${PORT}`);
    console.log('Press Ctrl+C to quit.');
  });
  // [END error_reporting_setup_nodejs_express]
}
express();


text:
namespace blink {

// Contains members corresponding to BluetoothScanFilter members as
// specified in the IDL.
struct WebBluetoothScanFilter {
    WebBluetoothScanFilter() { }

    WebVector<WebString> services;
    // We don't allow empty services or namePrefix but we do allow
    // an empty name so we can't use name.isEmpty() to know if
    // the filter contains a name or not.
    bool hasName;
    WebString name;
    WebString namePrefix;
};

// Contains members corresponding to RequestDeviceOptions members as
// specified in the IDL.
struct WebRequestDeviceOptions {
    WebRequestDeviceOptions() { }

    WebVector<WebBluetoothScanFilter> filters;
    WebVector<WebString> optionalServices;
};

} // namespace blink

#endif // WebRequestDeviceOptions_h


text:
from flask_restful import Resource
from flask import jsonify

class Index(Resource):
    def get(self):
        return jsonify({'OK': 'Got it'})


text:
Boolean / Function(treeId, treeNode)setting.edit.showRenameBtn

Overview[ depends on jquery.ztree.exedit js ]

Set to show or hide the rename button. It is valid when [setting.edit.enable = true]

When you click the rename button:

1. Click the rename button, you can rename the node.

2. After rename operation (the input DOM blur or press the Enter Key), zTree will trigger the setting.callback.beforeRename callback, and you can decide whether to allow rename.

3. If the 'beforeRename' callback return false, so zTree will keep the edit status. (Press the ESC key, can be restored to the original state.

4. If you don't set the 'beforeRename' or  the 'beforeRename' callback return true, so zTree will trigger the setting.callback.onRename callback after rename the node.

Default: true

Boolean Format

 true means: show the rename button

 false means: hide the rename button

Function Parameter Descriptions

treeIdString

zTree unique identifier: treeId.

treeNodeJSON

JSON data object of the node which show the rename button

Return Boolean

Return value is same as 'Boolean Format'

Examples of setting & function

1. Hide the rename button

var setting = {
	edit: {
		enable: true,
		showRenameBtn: false
	}
};
......

2. Hide the rename button of parent node

function setRenameBtn(treeId, treeNode) {
	return !treeNode.isParent;
}
var setting = {
	edit: {
		enable: true,
		showRenameBtn: setRenameBtn
	}
};
......


text:
package com.qualcomm.ftcrobotcontroller.opmodes.customcode;

public class AutonomousBlue extends ETAutonomousBase {

  @Override
  public void etLoop() throws InterruptedException {

    telemetry.addData("stage", stage);

    switch (stage) {
      case STAGE_MOVE_FIRST:
      {
        counts = getCountsForDistance(MOVE_FIRST_DISTANCE);
        telemetry.addData("stage 20", counts);

        setTarget(MOVE_POWER);
        if(hasArrived(counts))
          stage = STAGE_REVERSE_FIRST;
        break;
      }

      case STAGE_REVERSE_FIRST: {
        // goes -6 dst.
        counts = getCountsForDistance(REVERSE_FIRST_DISTANCE);
        setTarget(MOVE_POWER * -1);
        if(hasArrived(counts)) {
          telemetry.addData("hasArrived Reverse", "true");
          stage = STAGE_TURN_FIRST;
        }
        break;
      }

      case STAGE_TURN_FIRST: {
        // turns right
        turn(-0.25, 0.25);
        stage = STAGE_MOVE_SECOND;
        break;
      }

      case STAGE_MOVE_SECOND : {
        counts = getCountsForDistance(MOVE_SECOND_DISTANCE);
        setTarget(MOVE_POWER);
        if(hasArrived(counts))
          stage = STAGE_STOP;
        break;
      }

      case STAGE_STOP: {
        stopRobot();
        break;
      }
    }
  }
}


text:
package uk.co.webamoeba.mockito.collections.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;

import java.lang.reflect.Field;
import java.util.Collection;

import org.junit.Test;

import uk.co.webamoeba.mockito.collections.exception.MockitoCollectionsException;

/**
 * @author James Kennard
 */
public class FieldValueMutatorTest {

	private final FieldValueMutatorTestSupport support = new FieldValueMutatorTestSupport();

	@Test
	public void shouldSetGivenPublicField() {
		// Given
		Field field = getField("publicString");
		FieldValueMutator mutator = new FieldValueMutator(support, field);
		Object value = "Some New Value";

		// When
		mutator.mutateTo(value);

		// Then
		assertEquals(value, support.publicString);
		assertFalse(field.isAccessible());
	}

	@Test
	public void shouldSetGivenPublicAccesibleField() {
		// Given
		Field field = getField("publicString");
		field.setAccessible(true);
		FieldValueMutator mutator = new FieldValueMutator(support, field);
		Object value = "Some New Value";

		// When
		mutator.mutateTo(value);

		// Then
		assertEquals(value, support.publicString);
		assertTrue(field.isAccessible());
	}

	@Test
	public void shouldSetGivenPrivateField() {
		// Given
		Field field = getField("privateCollection");
		FieldValueMutator mutator = new FieldValueMutator(support, field);
		Object value = mock(Collection.class);

		// When
		mutator.mutateTo(value);

		// Then
		assertEquals(value, support.getPrivateCollection());
		assertFalse(field.isAccessible());
	}

	@Test
	public void shouldFailToSetGivenIncompatibleType() {
		// Given
		FieldValueMutator mutator = new FieldValueMutator(support, getField("privateCollection"));
		Object value = 100L;

		try {
			// When
			mutator.mutateTo(value);

			// Then
			fail();
		} catch (MockitoCollectionsException e) {
			assertTrue(e.getMessage().contains("incompatible type"));
		}
	}

	private Field getField(String fieldName) {
		for (Field field : support.getClass().getDeclaredFields()) {
			if (field.getName().equals(fieldName)) {
				return field;
			}
		}
		return null;
	}
}


text:
'use strict';

// Load modules

const Zlib = require('zlib');
const Accept = require('accept');
const Hoek = require('hoek');

// Declare internals

const internals = {};

exports = module.exports = internals.Compression = function () {

    this.encodings = ['identity', 'gzip', 'deflate'];
    this._encoders = {
        identity: null,
        gzip: (options) => Zlib.createGzip(options),
        deflate: (options) => Zlib.createDeflate(options)
    };

    this._decoders = {
        gzip: (options) => Zlib.createGunzip(options),
        deflate: (options) => Zlib.createInflate(options)
    };
};

internals.Compression.prototype.addEncoder = function (encoding, encoder) {

    Hoek.assert(this._encoders[encoding] === undefined, `Cannot override existing encoder for ${encoding}`);
    Hoek.assert(typeof encoder === 'function', `Invalid encoder function for ${encoding}`);
    this._encoders[encoding] = encoder;
    this.encodings.push(encoding);
};

internals.Compression.prototype.addDecoder = function (encoding, decoder) {

    Hoek.assert(this._decoders[encoding] === undefined, `Cannot override existing decoder for ${encoding}`);
    Hoek.assert(typeof decoder === 'function', `Invalid decoder function for ${encoding}`);
    this._decoders[encoding] = decoder;
};

internals.Compression.prototype.accept = function (request) {

    return Accept.encoding(request.headers['accept-encoding'], this.encodings);
};

internals.Compression.prototype.encoding = function (response) {

    const request = response.request;
    if (!request.connection.settings.compression) {
        return null;
    }

    const mime = request.server.mime.type(response.headers['content-type'] || 'application/octet-stream');
    if (!mime.compressible) {
        return null;
    }

    response.vary('accept-encoding');

    if (response.headers['content-encoding']) {
        return null;
    }

    return (request.info.acceptEncoding === 'identity' ? null : request.info.acceptEncoding);
};

internals.Compression.prototype.encoder = function (request, encoding) {

    const encoder = this._encoders[encoding];
    Hoek.assert(encoder !== undefined, `Unknown encoding ${encoding}`);
    return encoder(request.route.settings.compression[encoding]);
};


text:
var wls = window.localStorage,
    atag,
    anote;

function byId(id)          { return document.getElementById(id); }

function usort(arr)        { return arr.reduce((a, x) => ~a.indexOf(x) ? a : a.concat(x), []).sort(); }
function seq2(j,k)         { return Array.apply(null, Array((k - j) + 1)).map(function(discard, n){ return n + j; }); }
function seq(j)            { return seq2(0, j-1); }

function set_key(key,v)    { return wls.setItem(key, JSON.stringify(v)); }
function get_key(key)      { return JSON.parse(wls.getItem(key)); }
function list_keys()       { return seq(wls.length).map(i => wls.key(i)); }

function note_name(ts)     { return 'note:' + ts.toString(); }
function set_note(ts,t)    { return set_key(note_name(ts), t); }
function get_note(ts)      { return get_key(note_name(ts)); }
function add_note(t)       { var ts = Date.now(); set_note(ts, t); return ts; }
function del_note(t)       { tags_from(get_note(t)).map(n => del_tag(n,t)); wls.removeItem(note_name(t)); redraw(); }
function list_notes()      { return list_keys().filter(k => k.substring(0,5) === "note:").map(k => parseInt(k.substring(5), 10)) }

function tag_name(ts)      { return 'tag:' + ts.toString(); }
function get_tag(tag)      { return get_key(tag_name(tag)) || []; }
function set_tag(tag,a)    { return set_key(tag_name(tag), a); }
function add_tag(tag,n)    { set_tag(tag, get_tag(tag).concat([n])); }
function del_tag(tag,n)    { var newtags = get_tag(tag).filter(t => t != n); newtags.length? set_tag(tag, newtags) : wls.removeItem(tag_name(tag)); }
function list_tags()       { return list_keys().filter(k => k.substring(0,4) === "tag:").map(k => k.substring(4)); }

function sl(ts)            { return make_note_link(ts); }
function slia(t)           { return atag === t? '
'+(get_tag(t).map(ts => sl(ts)).join('')+'
') : ''; }
function make_note_del(t)  { return `<a class="del" onclick="del_note(${t});">⨷</a>`; }
function make_note_b_ln(t) { return `<a class="note" onclick="anote = (anote === ${t})? '' : ${t}; byId('editor').value = '${get_note(t)}'; redraw();">${get_note(t)}</a>`; }
function make_note_link(t) { return `<div class="item">${make_note_del(t)} ${make_note_b_ln(t)}</div>`; }
function make_notelist()   { return list_notes().map(t => make_note_link(t)).join(''); }
function make_tag_link(t)  { return `<div class="item"><a class="tag" onclick="atag = (atag === '${t}')? '' : '${t}'; redraw();">${t}</a></div>${slia(t)}`; }
function make_taglist()    { return list_tags().map(t => make_tag_link(t)).join(''); }

function tags_from(t)      { return usort(t.match(/\#\S+/g) || []); }
function add_from(ts,txt)  { tags_from(txt).map(tag => add_tag(tag, ts)); }

function clear_editor()    { byId('editor').value = ''; }
function redraw_tags()     { byId('taglist_div').innerHTML = make_taglist(); }
function redraw_notes()    { byId('notelist_div').innerHTML = make_notelist(); }
function redraw()          { redraw_tags(); redraw_notes(); }

function store(text)       { add_from(add_note(text), text); redraw(); }

function boot() {
  byId('editorAdd').onclick = function() { store(byId('editor').value); }
  redraw();
}

window.onload = boot;


text: For information about this app, contact @marick at the mailing address in my profile.


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MonstaControl : MonoBehaviour {
	public Transform cam;
	public float moveForce;
	public SphereCollider bodyCollider;
	public GameObject sandPuffEffect;

	public static float moveTimer = 0f;

	[System.NonSerialized]
	new public Rigidbody rigidbody;

	public static MonstaControl instance;

	void Start () {
		rigidbody=GetComponent<Rigidbody>();
		instance=this;
		moveTimer=0f;
	}
	void FixedUpdate() {
		Vector2 inputDir = Vector2.zero;
		bool moving = false;
		if (Input.GetKey(KeyCode.UpArrow)) {
			inputDir.y+=1f;
			moving=true;
		}
		if (Input.GetKey(KeyCode.DownArrow)) {
			inputDir.y-=1f;
			moving=true;
		}
		if (Input.GetKey(KeyCode.LeftArrow)) {
			inputDir.x-=1f;
			moving=true;
		}
		if (Input.GetKey(KeyCode.RightArrow)) {
			inputDir.x+=1f;
			moving=true;
		}

		// Timer, for TitleCard.cs
		if (moving) {
			moveTimer+=Time.deltaTime;
		}

		// Constrain diagonal speed
		if (inputDir.sqrMagnitude>1f) {
			inputDir.Normalize();
		}

		// Movement is relative to the camera
		Vector3 forward = cam.forward;
		forward.y=0f;
		forward.Normalize();

		Vector3 right = cam.right;
		right.y=0f;
		right.Normalize();

		Vector3 moveDir = (forward*inputDir.y+right*inputDir.x);

		// Convert movement direction to torque
		// ("Roll the ball this way")
		rigidbody.AddTorque(Vector3.Cross(Vector3.up,moveDir)*moveForce);
	}
}


text:
/* SPDX-License-Identifier: BSD-2-Clause */
/*******************************************************************************
 * Copyright 2017-2018, Fraunhofer SIT sponsored by Infineon Technologies AG
 * All rights reserved.
 *******************************************************************************/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <stdlib.h>

#include "tss2_esys.h"
#include "tss2_mu.h"

#include "esys_iutil.h"
#include "test-esys.h"
#define LOGMODULE test
#include "util/log.h"
#include "util/aux_util.h"

#define FLUSH true
#define NOT_FLUSH false

/*
 * Function to compare policy digest with expected digest.
 * The digest is computed with Esys_PolicyGetDigest.
 */
bool
cmp_policy_digest(ESYS_CONTEXT * esys_context,
                  ESYS_TR * session,
                  TPM2B_DIGEST * expected_digest,
                  char *comment, bool flush_session)
{

    TSS2_RC r;
    TPM2B_DIGEST *policyDigest;

    r = Esys_PolicyGetDigest(esys_context,
                             *session,
                             ESYS_TR_NONE,
                             ESYS_TR_NONE, ESYS_TR_NONE, &policyDigest);
    goto_if_error(r, "Error: PolicyGetDigest", error);

    LOGBLOB_DEBUG(&policyDigest->buffer[0], policyDigest->size,
                  "POLICY DIGEST");

    if (policyDigest->size != 32
        || memcmp(&policyDigest->buffer[0], &expected_digest->buffer[0],
                  policyDigest->size)) {
        free(policyDigest);
        LOG_ERROR("Error: Policy%s digest did not match expected policy.",
                  comment);
        return false;
    }
    free(policyDigest);
    if (flush_session) {
        r = Esys_FlushContext(esys_context, *session);
        goto_if_error(r, "Error: PolicyGetDigest", error);
        *session = ESYS_TR_NONE;
    }

    return true;

 error:
    return false;
}

/** This test is intended to test the ESYS policy commands, not tested
 *  in other test cases.
 *  When possoble the commands are tested with a
 * trial session and the policy digest is compared with the expected digest.
 *
 * Tested ESYS commands:
 *  - Esys_FlushContext() (M)
 *  - Esys_PolicyTemplate() (F)
 *
 * @param[in,out] esys_context The ESYS_CONTEXT.
 * @retval EXIT_FAILURE
 * @retval EXIT_SKIP
 * @retval EXIT_SUCCESS
 */
int
test_esys_policy_template_opt(ESYS_CONTEXT * esys_context)
{
    TSS2_RC r;
    int failure_return = EXIT_FAILURE;

    /* Dummy parameters for trial sessoin  */
    ESYS_TR sessionTrial = ESYS_TR_NONE;
    TPMT_SYM_DEF symmetricTrial = {.algorithm = TPM2_ALG_AES,
        .keyBits = {.aes = 128},
        .mode = {.aes = TPM2_ALG_CFB}
    };
    TPM2B_NONCE nonceCallerTrial = {
        .size = 20,
        .buffer = {11, 12, 13, 14, 15, 16, 17, 18, 19, 11,
                   21, 22, 23, 24, 25, 26, 27, 28, 29, 30}
    };

    /*
     * Test PolicyTemplate
     */
    r = Esys_StartAuthSession(esys_context, ESYS_TR_NONE, ESYS_TR_NONE,
                              ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE,
                              &nonceCallerTrial,
                              TPM2_SE_TRIAL, &symmetricTrial, TPM2_ALG_SHA256,
                              &sessionTrial);
    goto_if_error(r, "Error: During initialization of policy trial session",
                  error);

    TPM2B_DIGEST templateHash = {
        .size = 32,
        .buffer = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11, 12, 13, 14, 15, 16, 17,
                    18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
    };

    r = Esys_PolicyTemplate(esys_context,
                            sessionTrial,
                            ESYS_TR_NONE,
                            ESYS_TR_NONE, ESYS_TR_NONE, &templateHash);
    if ((r == TPM2_RC_COMMAND_CODE) ||
        (r == (TPM2_RC_COMMAND_CODE | TSS2_RESMGR_RC_LAYER)) ||
        (r == (TPM2_RC_COMMAND_CODE | TSS2_RESMGR_TPM_RC_LAYER))) {
        LOG_WARNING("Command TPM2_PolicyTemplate  not supported by TPM.");
        failure_return = EXIT_SKIP;
        goto error;
    } else {
        goto_if_error(r, "Error: PolicyTemplate", error);

        TPM2B_DIGEST expectedPolicyTemplate = {
            .size = 32,
            .buffer = { 0x70, 0xcb, 0xc9, 0x90, 0x65, 0x3d, 0x8b, 0x40, 0xfb, 0x71,
                        0xe6, 0x77, 0xdf, 0xe5, 0xc8, 0xcb, 0x8b, 0xf5, 0xf4, 0xef,
                        0xfd, 0x3d, 0xed, 0xad, 0x4a, 0x3a, 0xd6, 0xc3, 0x32, 0xc8,
                        0x35, 0x61 }
        };

        if (!cmp_policy_digest
            (esys_context, &sessionTrial, &expectedPolicyTemplate, "Template",
             FLUSH))
            goto error;
    }

    return EXIT_SUCCESS;

 error:

    if (sessionTrial != ESYS_TR_NONE) {
        if (Esys_FlushContext(esys_context, sessionTrial) != TSS2_RC_SUCCESS) {
            LOG_ERROR("Cleanup sessionTrial failed.");
        }
    }
    return failure_return;
}

int
test_invoke_esys(ESYS_CONTEXT * esys_context) {
    return test_esys_policy_template_opt(esys_context);
}


text:
/**
 * Bungie.Net API
 * These endpoints constitute the functionality exposed by Bungie.net, both for more traditional website functionality and for connectivity to Bungie video games and their related functionality.
 *
 * OpenAPI spec version: 2.3.5
 * Contact: support@bungie.com
 *
 * NOTE: This class is auto generated by the bungie-api-ts code generator program.
 * https://github.com/DestinyItemManager/bugie-api-ts
 * Do not edit these files manually.
 */

import {
  GeneralUser
} from '../user/interfaces';
import {
  GroupResponse
} from '../groupv2/interfaces';
import {
  IgnoreResponse,
  TagResponse
} from '../platform';
import {
  PagedQuery
} from '../common';

/**
 * This enum represents a set of flags - use bitwise operators to check which of
 * these match your value.
 */
export const enum ForumTopicsCategoryFiltersEnum {
  None = 0,
  Links = 1,
  Questions = 2,
  AnsweredQuestions = 4,
  Media = 8,
  TextOnly = 16,
  Announcement = 32,
  BungieOfficial = 64,
  Polls = 128
}

export const enum ForumTopicsQuickDateEnum {
  All = 0,
  LastYear = 1,
  LastMonth = 2,
  LastWeek = 3,
  LastDay = 4
}

export const enum ForumTopicsSortEnum {
  Default = 0,
  LastReplied = 1,
  MostReplied = 2,
  Popularity = 3,
  Controversiality = 4,
  Liked = 5,
  HighestRated = 6,
  MostUpvoted = 7
}

export const enum ForumPostSortEnum {
  Default = 0,
  OldestFirst = 1
}

export interface PostSearchResponse {
  readonly relatedPosts: PostResponse[];
  readonly authors: GeneralUser[];
  readonly groups: GroupResponse[];
  readonly searchedTags: TagResponse[];
  readonly polls: PollResponse[];
  readonly recruitmentDetails: ForumRecruitmentDetail[];
  readonly availablePages?: number;
  readonly results: PostResponse[];
  readonly totalResults: number;
  readonly hasMore: boolean;
  readonly query: PagedQuery;
  readonly replacementContinuationToken: string;
  /**
   * If useTotalResults is true, then totalResults represents an accurate count.
   *
   * If False, it does not, and may be estimated/only the size of the current page.
   *
   * Either way, you should probably always only trust hasMore.
   *
   * This is a long-held historical throwback to when we used to do paging with known
   * total results. Those queries toasted our database, and we were left to hastily
   * alter our endpoints and create backward- compatible shims, of which
   * useTotalResults is one.
   */
  readonly useTotalResults: boolean;
}

export interface PostResponse {
  readonly lastReplyTimestamp: string;
  readonly IsPinned: boolean;
  readonly urlMediaType: ForumMediaType;
  readonly thumbnail: string;
  readonly popularity: ForumPostPopularity;
  readonly isActive: boolean;
  readonly isAnnouncement: boolean;
  readonly userRating: number;
  readonly userHasRated: boolean;
  readonly userHasMutedPost: boolean;
  readonly latestReplyPostId: string;
  readonly latestReplyAuthorId: string;
  readonly ignoreStatus: IgnoreResponse;
  readonly locale: string;
}

export const enum ForumMediaType {
  None = 0,
  Image = 1,
  Video = 2,
  Youtube = 3
}

export const enum ForumPostPopularity {
  Empty = 0,
  Default = 1,
  Discussed = 2,
  CoolStory = 3,
  HeatingUp = 4,
  Hot = 5
}

export interface PollResponse {
  readonly topicId: string;
  readonly results: PollResult[];
  readonly totalVotes: number;
}

export interface PollResult {
  readonly answerText: string;
  readonly answerSlot: number;
  readonly lastVoteDate: string;
  readonly votes: number;
  readonly requestingUserVoted: boolean;
}

export interface ForumRecruitmentDetail {
  readonly topicId: string;
  readonly microphoneRequired: boolean;
  readonly intensity: ForumRecruitmentIntensityLabel;
  readonly tone: ForumRecruitmentToneLabel;
  readonly approved: boolean;
  readonly conversationId?: string;
  readonly playerSlotsTotal: number;
  readonly playerSlotsRemaining: number;
  readonly Fireteam: GeneralUser[];
  readonly kickedPlayerIds: string[];
}

export const enum ForumRecruitmentIntensityLabel {
  None = 0,
  Casual = 1,
  Professional = 2
}

export const enum ForumRecruitmentToneLabel {
  None = 0,
  FamilyFriendly = 1,
  Rowdy = 2
}

export const enum CommunityContentSortMode {
  Trending = 0,
  Latest = 1,
  HighestRated = 2
}


text:
var gulp = require('gulp');
var concat = require('gulp-concat');
var cleanCSS = require('gulp-clean-css');
var autoprefixer = require('gulp-autoprefixer');
var stripDebug = require('gulp-strip-debug');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var run = require('gulp-run');
var spawn = require('child_process').spawn;
var watch = require('gulp-watch');

var nodeDir = "node_modules/";

gulp.task('watch', function(){
    gulp.watch('stats/*', ['build']);
});

gulp.task('default', function() {

  // concat all vendor css
  gulp.src([nodeDir + 'bootstrap/dist/css/bootstrap.min.css',
                nodeDir + 'font-awesome/css/font-awesome.min.css',
                //nodeDir + 'drmonty-datatables/css/jquery.dataTables.min.css',
                nodeDir + 'drmonty-datatables/css/dataTables.bootstrap.min.css',
				nodeDir + 'drmonty-datatables-responsive/css/responsive.bootstrap.css',
				nodeDir + 'drmonty-datatables-fixedheader/css/fixedHeader.bootstrap.css',
                nodeDir + 'select2/dist/css/select2.min.css',
				nodeDir + 'tooltipster/dist/css/tooltipster.bundle.css',
				nodeDir + 'tooltipster/dist/css/plugins/tooltipster/sideTip/themes/tooltipster-sideTip-light.min.css'],
            {base: nodeDir})
        //.pipe(cleanCSS())
		.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9'))
		.pipe(concat('vendor.min.css'))
		.pipe(gulp.dest('css'))

    //copy over bootstrap fonts
    gulp.src(nodeDir + 'bootstrap/fonts/*', {base: nodeDir + 'bootstrap/fonts'})
        .pipe(gulp.dest('fonts/'));

    //copy over font-awesome fonts
    gulp.src(nodeDir + 'font-awesome/fonts/*', {base: nodeDir + 'font-awesome/fonts'})
        .pipe(gulp.dest('fonts/'));

	//merge all javascript
	gulp.src([nodeDir + 'jquery/dist/jquery.min.js',
                nodeDir + 'bootstrap/dist/js/bootstrap.min.js',
                nodeDir + 'drmonty-datatables/js/jquery.dataTables.min.js',
                nodeDir + 'drmonty-datatables/js/dataTables.bootstrap.min.js',
				nodeDir + 'drmonty-datatables-fixedheader/js/dataTables.fixedHeader.js',
                nodeDir + 'drmonty-datatables-responsive/js/dataTables.responsive.js',
                nodeDir + 'drmonty-datatables-responsive/js/responsive.bootstrap.js',
                nodeDir + 'select2/dist/js/select2.min.js',
				nodeDir + 'js-cookie/src/js.cookie.js',
				nodeDir + 'tooltipster/dist/js/tooltipster.bundle.min.js',
                nodeDir + 'sticky-table-headers/js/jquery.stickytableheaders.min.js'],
            {base: nodeDir})
    .pipe(concat('vendor.js'))
	.pipe(stripDebug())
    .pipe(gulp.dest('js/'));

});

gulp.task('build', function() {
    var options = {
        cwd: 'stats',
        silent: true
      };
    gulp.src(['stats/dlc_units.php',
        'stats/dlc_structures.php',
        'stats/dlc_technologies.php',
        'stats/dlc_civilizations.php',
        'stats/dlc_gathering.php',
        'stats/aoc_units.php',
        'stats/aoc_structures.php',
        'stats/aoc_technologies.php',
        'stats/aoc_civilizations.php',
        'stats/aoc_gathering.php'])
    .pipe(run('php ', options))
    .pipe(rename(function (path) {
        path.extname = ".json"
    }))
    .pipe(gulp.dest('stats/build/'));
});

var create_tiles = function(version, cb) {
    var dltiles = spawn('./download_tiles.sh', [], {cwd: 'images/techtrees/'+version});

    dltiles.stdout.on('data', function (data) {
        console.log('stdout: ' + data.toString());
    });

    dltiles.stderr.on('data', function (data) {
        console.log('stderr: ' + data.toString());
    });

    dltiles.on('exit', function (code) {
        console.log("Exited " + code);
        cb(null);
    });

};

gulp.task('aoc-tiles', function(cb) {
    create_tiles('aoc', cb);
});

gulp.task('dlc-tiles', ['aoc-tiles'], function(cb){
    create_tiles('dlc', cb);
});

gulp.task('tiles', ['aoc-tiles', 'dlc-tiles']);


text:
package com.clockwork.cinematic;

import com.clockwork.animation.LoopMode;
import com.clockwork.app.Application;
import com.clockwork.app.state.AppState;
import com.clockwork.app.state.AppStateManager;
import com.clockwork.cinematic.events.AbstractCinematicEvent;
import com.clockwork.cinematic.events.CinematicEvent;
import com.clockwork.export.*;
import com.clockwork.renderer.Camera;
import com.clockwork.renderer.RenderManager;
import com.clockwork.scene.CameraNode;
import com.clockwork.scene.Node;
import com.clockwork.scene.control.CameraControl;
import com.clockwork.scene.control.CameraControl.ControlDirection;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * An appstate for composing and playing cut scenes in a game. The cineamtic
 * schedules CinematicEvents over a timeline. Once the Cinematic created it has
 * to be attched to the stateManager.
 *
 * You can add various CinematicEvents to a Cinematic, see package
 * com.clockwork.cinematic.events
 *
 * Two main methods can be used to add an event :
 *
 * see Cinematic#addCinematicEvent(float,
 * com.clockwork.cinematic.events.CinematicEvent) , that adds an event at the given
 * time form the cinematic start.
 *
 * see
 * Cinematic#enqueueCinematicEvent(com.clockwork.cinematic.events.CinematicEvent)
 * that enqueue events one after the other according to their initialDuration
 *
 * a cinematic has convenient mathods to handle the playback :
 * see Cinematic#play()
 * see Cinematic#pause()
 * see Cinematic#stop()
 *
 * A cinematic is itself a CinematicEvent, meaning you can embed several
 * Cinematics Embed cinematics must not be added to the stateManager though.
 *
 * Cinematic has a way to handle several point of view by creating CameraNode
 * over a cam and activating them on schedule.
 * see Cinematic#bindCamera(java.lang.String, com.clockwork.renderer.Camera)
 * see Cinematic#activateCamera(float, java.lang.String)
 * see Cinematic#setActiveCamera(java.lang.String)
 *
 */
public class Cinematic extends AbstractCinematicEvent implements AppState {

    private static final Logger logger = Logger.getLogger(Application.class.getName());
    private Node scene;
    protected TimeLine timeLine = new TimeLine();
    private int lastFetchedKeyFrame = -1;
    private List<CinematicEvent> cinematicEvents = new ArrayList<CinematicEvent>();
    private Map<String, CameraNode> cameras = new HashMap<String, CameraNode>();
    private CameraNode currentCam;
    private boolean initialized = false;
    private Map<String, Map<Object, Object>> eventsData;
    private float nextEnqueue = 0;

    /**
     * Used for serialisation creates a cinematic, don't use this constructor
     * directly
     */
    public Cinematic() {
    }

    /**
     * creates a cinematic
     *
     * @param scene the scene in which the cinematic should take place
     */
    public Cinematic(Node scene) {
        this.scene = scene;
    }

    /**
     * creates a cinematic
     *
     * @param scene the scene in which the cinematic should take place
     * @param initialDuration the duration of the cinematic (without considering
     * the speed)
     */
    public Cinematic(Node scene, float initialDuration) {
        super(initialDuration);
        this.scene = scene;
    }

    /**
     * creates a cinematic
     *
     * @param scene the scene in which the cinematic should take place
     * @param loopMode tells if this cinematic should be looped or not
     */
    public Cinematic(Node scene, LoopMode loopMode) {
        super(loopMode);
        this.scene = scene;
    }

    /**
     * creates a cinematic
     *
     * @param scene the scene in which the cinematic should take place
     * @param initialDuration the duration of the cinematic (without considering
     * the speed)
     * @param loopMode tells if this cinematic should be looped or not
     */
    public Cinematic(Node scene, float initialDuration, LoopMode loopMode) {
        super(initialDuration, loopMode);
        this.scene = scene;
    }

    /**
     * called internally
     */
    @Override
    public void onPlay() {
        if (isInitialized()) {
            if (playState == PlayState.Paused) {
                for (int i = 0; i < cinematicEvents.size(); i++) {
                    CinematicEvent ce = cinematicEvents.get(i);
                    if (ce.getPlayState() == PlayState.Paused) {
                        ce.play();
                    }
                }
            }
        }
    }

    /**
     * called internally
     */
    @Override
    public void onStop() {
        time = 0;
        lastFetchedKeyFrame = -1;
        for (int i = 0; i < cinematicEvents.size(); i++) {
            CinematicEvent ce = cinematicEvents.get(i);
            ce.setTime(0);
            ce.forceStop();
        }
        setEnableCurrentCam(false);
    }

    /**
     * called internally
     */
    @Override
    public void onPause() {
        for (int i = 0; i < cinematicEvents.size(); i++) {
            CinematicEvent ce = cinematicEvents.get(i);
            if (ce.getPlayState() == PlayState.Playing) {
                ce.pause();
            }
        }
    }

    /**
     * used internally for serialisation
     *
     * @param ex
     * @throws IOException
     */
    @Override
    public void write(CWExporter ex) throws IOException {
        super.write(ex);
        OutputCapsule oc = ex.getCapsule(this);

        oc.writeSavableArrayList((ArrayList) cinematicEvents, "cinematicEvents", null);
        oc.writeStringSavableMap(cameras, "cameras", null);
        oc.write(timeLine, "timeLine", null);

    }

    /**
     * used internally for srialization
     *
     * @param im
     * @throws IOException
     */
    @Override
    public void read(CWImporter im) throws IOException {
        super.read(im);
        InputCapsule ic = im.getCapsule(this);

        cinematicEvents = ic.readSavableArrayList("cinematicEvents", null);
        cameras = (Map<String, CameraNode>) ic.readStringSavableMap("cameras", null);
        timeLine = (TimeLine) ic.readSavable("timeLine", null);
    }

    /**
     * sets the speed of the cinematic. Note that it will set the speed of all
     * events in the cinematic. 1 is normal speed. use 0.5f to make the
     * cinematic twice slower, use 2 to make it twice faster
     *
     * @param speed the speed
     */
    @Override
    public void setSpeed(float speed) {
        super.setSpeed(speed);
        for (int i = 0; i < cinematicEvents.size(); i++) {
            CinematicEvent ce = cinematicEvents.get(i);
            ce.setSpeed(speed);
        }

    }

    /**
     * used internally
     *
     * @param stateManager the state manager
     * @param app the application
     */
    public void initialize(AppStateManager stateManager, Application app) {
        initEvent(app, this);
        for (CinematicEvent cinematicEvent : cinematicEvents) {
            cinematicEvent.initEvent(app, this);
        }

        initialized = true;
    }

    /**
     * used internally
     *
     * @return
     */
    public boolean isInitialized() {
        return initialized;
    }

    /**
     * passing true has the same effect as play() you should use play(),
     * pause(), stop() to handle the cinemaic playing state.
     *
     * @param enabled true or false
     */
    public void setEnabled(boolean enabled) {
        if (enabled) {
            play();
        }
    }

    /**
     * return true if the cinematic appstate is enabled (the cinematic is
     * playing)
     *
     * @return true if enabled
     */
    public boolean isEnabled() {
        return playState == PlayState.Playing;
    }

    /**
     * called internally
     *
     * @param stateManager the state manager
     */
    public void stateAttached(AppStateManager stateManager) {
    }

    /**
     * called internally
     *
     * @param stateManager the state manager
     */
    public void stateDetached(AppStateManager stateManager) {
        stop();
    }

    /**
     * called internally don't call it directly.
     *
     * @param tpf
     */
    public void update(float tpf) {
        if (isInitialized()) {
            internalUpdate(tpf);
        }
    }

    /**
     * used internally, don't call this directly.
     *
     * @param tpf
     */
    @Override
    public void onUpdate(float tpf) {
        for (int i = 0; i < cinematicEvents.size(); i++) {
            CinematicEvent ce = cinematicEvents.get(i);
            ce.internalUpdate(tpf);
        }

        int keyFrameIndex = timeLine.getKeyFrameIndexFromTime(time);

        //iterate to make sure every key frame is triggered
        for (int i = lastFetchedKeyFrame + 1; i <= keyFrameIndex; i++) {
            KeyFrame keyFrame = timeLine.get(i);
            if (keyFrame != null) {
                keyFrame.trigger();
            }
        }

        lastFetchedKeyFrame = keyFrameIndex;
    }

    /**
     * This is used internally but can be alled to shuffle through the
     * cinematic.
     *
     * @param time the time to shuffle to.
     */
    @Override
    public void setTime(float time) {

        //stopping all events
        onStop();
        super.setTime(time);

        int keyFrameIndex = timeLine.getKeyFrameIndexFromTime(time);
        //triggering all the event from start to "time"
        //then computing timeOffset for each event
        for (int i = 0; i <= keyFrameIndex; i++) {
            KeyFrame keyFrame = timeLine.get(i);
            if (keyFrame != null) {
                for (CinematicEvent ce : keyFrame.getCinematicEvents()) {
                    float t = this.time - timeLine.getKeyFrameTime(keyFrame);
                    if (t >= 0 && (t <= ce.getInitialDuration() || ce.getLoopMode() != LoopMode.DontLoop)) {
                        ce.play();
                    }
                    ce.setTime(t);
                }
            }
        }
        lastFetchedKeyFrame = keyFrameIndex;
        if (playState != PlayState.Playing) {
            pause();
        }
    }

    /**
     * Adds a cinematic event to this cinematic at the given timestamp. This
     * operation returns a keyFrame
     *
     * @param timeStamp the time when the event will start after the begining of
     * the cinematic
     * @param cinematicEvent the cinematic event
     * @return the keyFrame for that event.
     */
    public KeyFrame addCinematicEvent(float timeStamp, CinematicEvent cinematicEvent) {
        KeyFrame keyFrame = timeLine.getKeyFrameAtTime(timeStamp);
        if (keyFrame == null) {
            keyFrame = new KeyFrame();
            timeLine.addKeyFrameAtTime(timeStamp, keyFrame);
        }
        keyFrame.cinematicEvents.add(cinematicEvent);
        cinematicEvents.add(cinematicEvent);
        if (isInitialized()) {
            cinematicEvent.initEvent(null, this);
        }
        return keyFrame;
    }

    /**
     * enqueue a cinematic event to a cinematic. This is a handy method when you
     * want to chain event of a given duration without knowing their initial
     * duration
     *
     * @param cinematicEvent the cinematic event to enqueue
     * @return the timestamp the evnt was scheduled.
     */
    public float enqueueCinematicEvent(CinematicEvent cinematicEvent) {
        float scheduleTime = nextEnqueue;
        addCinematicEvent(scheduleTime, cinematicEvent);
        nextEnqueue += cinematicEvent.getInitialDuration();
        return scheduleTime;
    }

    /**
     * removes the first occurrence found of the given cinematicEvent.
     *
     * @param cinematicEvent the cinematicEvent to remove
     * @return true if the element has been removed
     */
    public boolean removeCinematicEvent(CinematicEvent cinematicEvent) {
        cinematicEvent.dispose();
        cinematicEvents.remove(cinematicEvent);
        for (KeyFrame keyFrame : timeLine.values()) {
            if (keyFrame.cinematicEvents.remove(cinematicEvent)) {
                return true;
            }
        }
        return false;
    }

    /**
     * removes the first occurrence found of the given cinematicEvent for the
     * given time stamp.
     *
     * @param timeStamp the timestamp when the cinematicEvent has been added
     * @param cinematicEvent the cinematicEvent to remove
     * @return true if the element has been removed
     */
    public boolean removeCinematicEvent(float timeStamp, CinematicEvent cinematicEvent) {
        cinematicEvent.dispose();
        KeyFrame keyFrame = timeLine.getKeyFrameAtTime(timeStamp);
        return removeCinematicEvent(keyFrame, cinematicEvent);
    }

    /**
     * removes the first occurrence found of the given cinematicEvent for the
     * given keyFrame
     *
     * @param keyFrame the keyFrame returned by the addCinematicEvent method.
     * @param cinematicEvent the cinematicEvent to remove
     * @return true if the element has been removed
     */
    public boolean removeCinematicEvent(KeyFrame keyFrame, CinematicEvent cinematicEvent) {
        cinematicEvent.dispose();
        boolean ret = keyFrame.cinematicEvents.remove(cinematicEvent);
        cinematicEvents.remove(cinematicEvent);
        if (keyFrame.isEmpty()) {
            timeLine.removeKeyFrame(keyFrame.getIndex());
        }
        return ret;
    }

    /**
     * called internally
     *
     * see AppState#render()
     */
    public void render(RenderManager rm) {
    }

    /**
     * called internally
     *
     * see AppState#postRender()
     */
    public void postRender() {
    }

    /**
     * called internally
     *
     * see AppState#cleanup()
     */
    public void cleanup() {
    }

    /**
     * fits the duration of the cinamatic to the duration of all its child
     * cinematic events
     */
    public void fitDuration() {
        KeyFrame kf = timeLine.getKeyFrameAtIndex(timeLine.getLastKeyFrameIndex());
        float d = 0;
        for (int i = 0; i < kf.getCinematicEvents().size(); i++) {
            CinematicEvent ce = kf.getCinematicEvents().get(i);
            float dur = timeLine.getKeyFrameTime(kf) + ce.getDuration() * ce.getSpeed();
            if (d < dur) {
                d = dur;
            }
        }

        initialDuration = d;
    }

    /**
     * Binds a camera to this cinematic, tagged by a unique name. This methods
     * creates and returns a CameraNode for the cam and attach it to the scene.
     * The control direction is set to SpatialToCamera. This camera Node can
     * then be used in other events to handle the camera movements during the
     * playback
     *
     * @param cameraName the unique tag the camera should have
     * @param cam the scene camera.
     * @return the created CameraNode.
     */
    public CameraNode bindCamera(String cameraName, Camera cam) {
        if (cameras.containsKey(cameraName)) {
            throw new IllegalArgumentException("Camera " + cameraName + " is already binded to this cinematic");
        }
        CameraNode node = new CameraNode(cameraName, cam);
        node.setControlDir(ControlDirection.SpatialToCamera);
        node.getControl(CameraControl.class).setEnabled(false);
        cameras.put(cameraName, node);
        scene.attachChild(node);
        return node;
    }

    /**
     * returns a cameraNode given its name
     *
     * @param cameraName the camera name (as registerd in
     * Cinematic#bindCamera())
     * @return the cameraNode for this name
     */
    public CameraNode getCamera(String cameraName) {
        return cameras.get(cameraName);
    }

    /**
     * enable/disable the camera control of the cameraNode of the current cam
     *
     * @param enabled
     */
    private void setEnableCurrentCam(boolean enabled) {
        if (currentCam != null) {
            currentCam.getControl(CameraControl.class).setEnabled(enabled);
        }
    }

    /**
     * Sets the active camera instantly (use activateCamera if you want to
     * schedule that event)
     *
     * @param cameraName the camera name (as registerd in
     * Cinematic#bindCamera())
     */
    public void setActiveCamera(String cameraName) {
        setEnableCurrentCam(false);
        currentCam = cameras.get(cameraName);
        if (currentCam == null) {
            logger.log(Level.WARNING, "{0} is not a camera bond to the cinematic, cannot activate", cameraName);
        }
        setEnableCurrentCam(true);
    }

    /**
     * schedule an event that will activate the camera at the given time
     *
     * @param timeStamp the time to activate the cam
     * @param cameraName the camera name (as registerd in
     * Cinematic#bindCamera())
     */
    public void activateCamera(final float timeStamp, final String cameraName) {
        addCinematicEvent(timeStamp, new AbstractCinematicEvent() {
            @Override
            public void play() {
                super.play();
                stop();
            }

            @Override
            public void onPlay() {
                setActiveCamera(cameraName);
            }

            @Override
            public void onUpdate(float tpf) {
            }

            @Override
            public void onStop() {
            }

            @Override
            public void onPause() {
            }

            @Override
            public void forceStop() {
            }

            @Override
            public void setTime(float time) {
                play();
            }
        });
    }

    /**
     * returns the complete eventdata map
     *
     * @return the eventdata map
     */
    private Map<String, Map<Object, Object>> getEventsData() {
        if (eventsData == null) {
            eventsData = new HashMap<String, Map<Object, Object>>();
        }
        return eventsData;
    }

    /**
     * used internally put an eventdata in the cinematic
     *
     * @param type the type of data
     * @param key the key
     * @param object the data
     */
    public void putEventData(String type, Object key, Object object) {
        Map<String, Map<Object, Object>> data = getEventsData();
        Map<Object, Object> row = data.get(type);
        if (row == null) {
            row = new HashMap<Object, Object>();
        }
        row.put(key, object);
        data.put(type, row);
    }

    /**
     * used internally return and event data
     *
     * @param type the type of data
     * @param key the key
     * @return
     */
    public Object getEventData(String type, Object key) {
        if (eventsData != null) {
            Map<Object, Object> row = eventsData.get(type);
            if (row != null) {
                return row.get(key);
            }
        }
        return null;
    }

    /**
     * Used internally remove an eventData
     *
     * @param type the type of data
     * @param key the key of the data
     */
    public void removeEventData(String type, Object key) {
        if (eventsData != null) {
            Map<Object, Object> row = eventsData.get(type);
            if (row != null) {
                row.remove(key);
            }
        }
    }

    /**
     * sets the scene to use for this cinematic it is expected that the scene is
     * added before adding events to the cinematic
     *
     * @param scene the scene where the cinematic should ttake place.
     */
    public void setScene(Node scene) {
        this.scene = scene;
    }

    /**
     * return the scene where the cinematic occur
     *
     * @return the scene
     */
    public Node getScene() {
        return scene;
    }

    /**
     * clear the cinematic of its events.
     */
    public void clear() {
        dispose();
        cinematicEvents.clear();
        timeLine.clear();
        eventsData.clear();
    }

    /**
     * used internally to cleanup the cinematic. Called when the clear() method
     * is called
     */
    @Override
    public void dispose() {
        for (CinematicEvent event : cinematicEvents) {
            event.dispose();
        }
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ie.philb.orderingws.service.impl;

import ie.philb.orderingws.dao.CountryDao;
import ie.philb.orderingws.dao.CurrencyDao;
import ie.philb.orderingws.dao.DaoException;
import ie.philb.orderingws.model.Address;
import ie.philb.orderingws.model.Author;
import ie.philb.orderingws.model.Country;
import ie.philb.orderingws.model.Currency;
import ie.philb.orderingws.model.Party;
import ie.philb.orderingws.service.ServiceException;
import java.util.ArrayList;
import java.util.List;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

@WebService(serviceName = "AuthorService")
public class AuthorService extends DefaultService {

    private final CountryDao countryDao;
    private final CurrencyDao currencyDao;

    public AuthorService() throws ServiceException {
        super();

        countryDao = new CountryDao(ds);
        currencyDao = new CurrencyDao(ds);
        logger.info("Created service");
    }

    @WebMethod(operationName = "hello")
    public String hello(@WebParam(name = "name") String txt) {
        return "Hello " + txt + " !";
    }

    public List<Author> getAuthors() {
        List<Author> authors = new ArrayList<>();
        authors.add(new Author("Fred", "Bloggs", "fred@bloggs.com"));
        authors.add(new Author("Joe", "Soap", "joe@soap.com"));

        return authors;
    }

    public List<Currency> getCurrencies() throws ServiceException {

        try {
            return currencyDao.list();
        } catch (DaoException ex) {
            throw new ServiceException(ex);
        }

    }

    public List<Country> getCountries() throws ServiceException {
//        List<Country> countries = new ArrayList<>();
//        countries.add(new Country(1L, "US", "United States of America", "USA"));
//
//        return countries;

        try {
            return countryDao.list();
        } catch (DaoException ex) {
            throw new ServiceException(ex);
        }

    }

    public List<Party> getParties() {
        List<Party> parties = new ArrayList<>();

        Party p = new Party();
        p.setId(1L);
        p.setName("Fred Inc");
        p.setEmail("info@fred.com");
        p.setWebsite("http://www.fred.com");
        p.setTelephone("+353 1 1234567");

        Address a = new Address();
        a.setStreet1("52");
        a.setStreet2("Main Street");
        a.setCity("Cavan");

        p.getAddresses().add(a);

        parties.add(p);
        return parties;
    }

}


text:
#ifndef __MINUNIT_H
#define __MINUNIT_H
/* file: minunit.h */
#define mu_assert(message, test) do { if (!(test)) return message; } while (0)
#define mu_run_test(test) do { char *message = test(); tests_run++; if (message) return message; } while (0)
extern int tests_run;
#endif


text:
<?php

namespace MusicBrainz\Helper;

use MusicBrainz\Definition\RelationTarget;
use MusicBrainz\Definition\RelationTypeId;
use MusicBrainz\Relation;
use MusicBrainz\Relation\NullType;
use MusicBrainz\Relation\Type;
use MusicBrainz\Value\Direction;
use MusicBrainz\Value\MBID;

/**
 * The relation factory
 */
class RelationFactory
{
    use \MusicBrainz\Value\Property\AreaTrait;

    /**
     * Makes and returns a relation by given information from the webservice.
     *
     * @param array $relation Information about the relation
     *
     * @return Relation
     */
    public static function make(array $relation = []): Relation
    {
        $relationTypeId = ArrayAccess::getString($relation, 'type-id');

        /** @var Type $relationType */
        $relationType = self::getRelationType(new MBID($relationTypeId));

        if ($relationType instanceof NullType) {
            /** @todo Implement fallback for undefined relation */
        }

        $direction = new Direction(ArrayAccess::getString($relation, 'direction'));

        $relatedEntityType = (Direction::FORWARD == $direction)
            ? $relationType::getRelatedEntityType()
            : $relationType::getBaseEntityType();

        $class = RelationTarget::getClassMap()[(string) $relatedEntityType];

        if (is_null($relation[(string) $relatedEntityType])) {
            /** @todo Implement fallback for undefined relation */
            die;
        }

        return new $class(
            $relation[(string) $relatedEntityType],
            $relationType,
            $direction
        );
    }

    /**
     * Returns a relation type by its MusicBrainz Identifier (MBID).
     *
     * @param MBID $relationTypeId The MusicBrainz Identifier (MBID) of the relation type.
     *
     * @return Type
     */
    private static function getRelationType(MBID $relationTypeId): Type
    {
        $classMap = RelationTypeId::getClassMap();

        if (array_key_exists((string) $relationTypeId, $classMap)) {
            $relationType = RelationTypeId::getClassMap()[(string) $relationTypeId];

            return new $relationType();
        }

        return new NullType();
    }
}


text:
export interface IAlertProps {
  /**
   * Message to be rendered in h1.
   */
  message: string;
}


text:
var _elm_lang$core$Main$nonEmptyList = _elm_lang$core$Native_List.fromArray(
	[1, 4, 5]);


text:
package edu.uci.ics.pregelix.core.runtime.touchpoint;

import org.apache.hyracks.api.dataflow.value.INormalizedKeyComputer;
import org.apache.hyracks.api.dataflow.value.INormalizedKeyComputerFactory;

public class RawNormalizedKeyComputerFactory implements INormalizedKeyComputerFactory {
    private static final long serialVersionUID = 1L;
    public static final INormalizedKeyComputerFactory INSTANCE = new RawNormalizedKeyComputerFactory();

    private RawNormalizedKeyComputerFactory() {

    }

    @Override
    public INormalizedKeyComputer createNormalizedKeyComputer() {
        return new INormalizedKeyComputer() {

            @Override
            public int normalize(byte[] bytes, int start, int length) {
                int nk = 0;
                for (int i = 0; i < 4; i++) {
                    nk <<= 8;
                    if (i < length) {
                        nk += (bytes[start + i] & 0xff);
                    }
                }
                return nk;
            }

        };
    }
}


text:
import type { SpanProps } from './Span';
export interface TextProps extends SpanProps {
}
/**
 * Outputs a `span` HTML element with specified props.
 *
 * NOTE: This component has a historic "quirk" where the `font-size` defaults to medium rather
 * than simply inheriting it's size from the parent DOM element (what one might expect of a
 * "normal" inline element.  `line-height` will match the `font-size` (`medium` unless  otherwise specified) as well.
 *
 * @deprecated - Use `Span` component instead for a more predictable behavior
 */
export declare const Text: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("./TextBase").TextBaseProps & SpanProps & TextProps, never>;


text:
int main()
{
	cmn::ILogger::LoggerLib().Write("hello from executable");
	reutrn 0;
}


text:
extern void usDelay(int);

// local function prototypes
SMALLINT owAcquire(int,char *);
void     owRelease(int);

//---------------------------------------------------------------------------
// Attempt to acquire a 1-Wire net
//
// 'portnum'    - number 0 to MAX_PORTNUM-1.  This number is provided to
//                indicate the symbolic port number.
// 'port_zstr'  - zero terminated port name.
//
// Returns: TRUE - success, port opened
//
SMALLINT owAcquire(int portnum, char *port_zstr)
{
   port_zstr = 0;
   portnum = 0;

   OW_PORT = 1; // drive bus high.
   usDelay(500); // give time for line to settle

   // checks to make sure the line is idling high.
   return (OW_PORT==1?TRUE:FALSE);
}

//---------------------------------------------------------------------------
// Attempt to acquire a 1-Wire net using a com port and a DS2480 based
// adapter.
//
// 'port_zstr'  - zero terminated port name.  For this platform
//                use format COMX where X is the port number.
//
// Returns: The portnum or -1 if the port wasn't acquired.
//
int owAcquireEx(char *port_zstr)
{
   int portnum = 0;
   port_zstr = 0;

   OW_PORT = 1; // drive bus high.
   usDelay(500); // give time for line to settle

   if(OW_PORT != 1)
   {
      OWERROR(OWERROR_OPENCOM_FAILED);
      return -1;
   }

   // checks to make sure the line is idling high.
   return portnum;
}

//---------------------------------------------------------------------------
// Release the previously acquired a 1-Wire net.
//
// 'portnum'    - number 0 to MAX_PORTNUM-1.  This number is provided to
//                indicate the symbolic port number.
//
void owRelease(int portnum)
{
   portnum = 0;
}


text:
/**
 * @class Ext.chart.axis.Gauge
 *
 * Gauge Axis is the axis to be used with a Gauge series. The Gauge axis
 * displays numeric data from an interval defined by the `minimum`, `maximum` and
 * `step` configuration properties. The placement of the numeric data can be changed
 * by altering the `margin` option that is set to `10` by default.
 *
 * A possible configuration for this axis would look like:
 *
 *     axes: [{
 *         type: 'gauge',
 *         position: 'gauge',
 *         minimum: 0,
 *         maximum: 100,
 *         steps: 10,
 *         margin: 7
 *     }],
 */
Ext.define('Ext.chart.axis.Gauge', {

    /* Begin Definitions */

    extend: 'Ext.chart.axis.Abstract',

    /* End Definitions */

    /**
     * @cfg {Number} minimum (required)
     * The minimum value of the interval to be displayed in the axis.
     */

    /**
     * @cfg {Number} maximum (required)
     * The maximum value of the interval to be displayed in the axis.
     */

    /**
     * @cfg {Number} steps (required)
     * The number of steps and tick marks to add to the interval.
     */

    /**
     * @cfg {Number} [margin=10]
     * The offset positioning of the tick marks and labels in pixels.
     */

    /**
     * @cfg {String} title
     * The title for the Axis.
     */

    position: 'gauge',

    alias: 'axis.gauge',

    drawAxis: function(init) {
        var chart = this.chart,
            surface = chart.surface,
            bbox = chart.chartBBox,
            centerX = bbox.x + (bbox.width / 2),
            centerY = bbox.y + bbox.height,
            margin = this.margin || 10,
            rho = Math.min(bbox.width, 2 * bbox.height) /2 + margin,
            sprites = [], sprite,
            steps = this.steps,
            i, pi = Math.PI,
            cos = Math.cos,
            sin = Math.sin;

        if (this.sprites && !chart.resizing) {
            this.drawLabel();
            return;
        }

        if (this.margin >= 0) {
            if (!this.sprites) {
                //draw circles
                for (i = 0; i <= steps; i++) {
                    sprite = surface.add({
                        type: 'path',
                        path: ['M', centerX + (rho - margin) * cos(i / steps * pi - pi),
                                    centerY + (rho - margin) * sin(i / steps * pi - pi),
                                    'L', centerX + rho * cos(i / steps * pi - pi),
                                    centerY + rho * sin(i / steps * pi - pi), 'Z'],
                        stroke: '#ccc'
                    });
                    sprite.setAttributes({
                        hidden: false
                    }, true);
                    sprites.push(sprite);
                }
            } else {
                sprites = this.sprites;
                //draw circles
                for (i = 0; i <= steps; i++) {
                    sprites[i].setAttributes({
                        path: ['M', centerX + (rho - margin) * cos(i / steps * pi - pi),
                                    centerY + (rho - margin) * sin(i / steps * pi - pi),
                               'L', centerX + rho * cos(i / steps * pi - pi),
                                    centerY + rho * sin(i / steps * pi - pi), 'Z'],
                        stroke: '#ccc'
                    }, true);
                }
            }
        }
        this.sprites = sprites;
        this.drawLabel();
        if (this.title) {
            this.drawTitle();
        }
    },

    drawTitle: function() {
        var me = this,
            chart = me.chart,
            surface = chart.surface,
            bbox = chart.chartBBox,
            labelSprite = me.titleSprite,
            labelBBox;

        if (!labelSprite) {
            me.titleSprite = labelSprite = surface.add(Ext.apply({
                type: 'text',
                zIndex: 2
            }, me.axisTitleStyle, me.labelTitle));
        }
        labelSprite.setAttributes(Ext.apply({
            text: me.title
        }, me.label || {}), true);
        labelBBox = labelSprite.getBBox();
        labelSprite.setAttributes({
            x: bbox.x + (bbox.width / 2) - (labelBBox.width / 2),
            y: bbox.y + bbox.height - (labelBBox.height / 2) - 4
        }, true);
    },

    /**
     * Updates the {@link #title} of this axis.
     * @param {String} title
     */
    setTitle: function(title) {
        this.title = title;
        this.drawTitle();
    },

    drawLabel: function() {
        var me = this,
            chart = me.chart,
            surface = chart.surface,
            bbox = chart.chartBBox,
            centerX = bbox.x + (bbox.width / 2),
            centerY = bbox.y + bbox.height,
            margin = me.margin || 10,
            rho = Math.min(bbox.width, 2 * bbox.height) /2 + 2 * margin,
            round = Math.round,
            labelArray = [], label,
            maxValue = me.maximum || 0,
            minValue = me.minimum || 0,
            steps = me.steps,
            pi = Math.PI,
            cos = Math.cos,
            sin = Math.sin,
            labelConf = this.label,
            renderer = labelConf.renderer || Ext.identityFn,
            reverse = me.reverse,
            i, adjY, idx;

        if (!this.labelArray) {
            //draw scale
            for (i = 0; i <= steps; i++) {
                // TODO Adjust for height of text / 2 instead
                adjY = (i === 0 || i === steps) ? 7 : 0;
                idx = reverse ? steps - i : i;
                label = surface.add({
                    type: 'text',
                    text: renderer(round(minValue + idx / steps * (maxValue - minValue))),
                    x: centerX + rho * cos(i / steps * pi - pi),
                    y: centerY + rho * sin(i / steps * pi - pi) - adjY,
                    'text-anchor': 'middle',
                    'stroke-width': 0.2,
                    zIndex: 10,
                    stroke: '#333'
                });
                label.setAttributes({
                    hidden: false
                }, true);
                labelArray.push(label);
            }
        }
        else {
            labelArray = this.labelArray;
            //draw values
            for (i = 0; i <= steps; i++) {
                // TODO Adjust for height of text / 2 instead
                adjY = (i === 0 || i === steps) ? 7 : 0;
                idx = reverse ? steps - i : i;
                labelArray[i].setAttributes({
                    text: renderer(round(minValue + idx / steps * (maxValue - minValue))),
                    x: centerX + rho * cos(i / steps * pi - pi),
                    y: centerY + rho * sin(i / steps * pi - pi) - adjY
                }, true);
            }
        }
        this.labelArray = labelArray;
    }
});


text: Connector for JIRA


text:
package com.azure.monitor.opentelemetry.exporter.implementation.utils;

import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.trace.SpanContext;
import io.opentelemetry.api.trace.SpanId;
import io.opentelemetry.api.trace.TraceFlags;
import io.opentelemetry.api.trace.TraceId;
import io.opentelemetry.api.trace.TraceState;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
import io.opentelemetry.sdk.logs.data.Body;
import io.opentelemetry.sdk.logs.data.LogData;
import io.opentelemetry.sdk.logs.data.Severity;
import io.opentelemetry.sdk.resources.Resource;

import java.time.Instant;

public class MockLogData implements LogData {

    @Override
    public Resource getResource() {
        return Resource.create(Attributes.empty());
    }

    @Override
    public InstrumentationScopeInfo getInstrumentationScopeInfo() {
        return InstrumentationScopeInfo.create("Testing Instrumentation", "1", null);
    }

    @Override
    public long getEpochNanos() {
        return Instant.now().getEpochSecond();
    }

    @Override
    public SpanContext getSpanContext() {
        return SpanContext.create(
            TraceId.fromLongs(10L, 2L),
            SpanId.fromLong(1),
            TraceFlags.getDefault(),
            TraceState.builder().build());
    }

    @Override
    public Severity getSeverity() {
        return Severity.DEBUG;
    }

    @Override
    public String getSeverityText() {
        return "DEBUG";
    }

    @Override
    public Body getBody() {
        return Body.string("testing log");
    }

    @Override
    public Attributes getAttributes() {
        return Attributes.builder()
            .put("one", "1")
            .put("two", 2L)
            .put("db.svc", "location")
            .put("operation", "get")
            .put("id", "1234")
            .build();
    }
}


text:
package org.morsi.android.nethack.redux.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

// category of quick stats to display
public class QuickStatCategory {
    // name of the quick stat category
	public String name;

	// list of column names
    public ArrayList<String> column_names;

    // list of column weights, total should equal 1
    public ArrayList<Double> column_weights;

    // list of actual quick stat rows
    public ArrayList<QuickStat> stats;

    public QuickStatCategory(String rname){
    	name = rname;
    	column_names   = new ArrayList<String>();
    	column_weights = new ArrayList<Double>();
    	stats = new ArrayList<QuickStat>();
    }

    private void add_column(String name, Double weight){
    	column_names.add(name);
    	column_weights.add(weight);
    }

    private void add_stats(ArrayList<String> rstats){
    	QuickStat stat = new QuickStat(rstats);
    	stats.add(stat);
    }

    // Variables used for table sorting
    private boolean reverse  = false;

	private int statColumn(String column){
		for(int sort_column = 0; sort_column < column_names.size(); ++sort_column)
			if(column_names.get(sort_column).equals(column))
				return sort_column;
		return -1;
	}

    public void sort_stats(String column){
		final int sort_column = statColumn(column);

	    // actually perform the sort using a custom comparator
	    Collections.sort(stats, new Comparator<QuickStat>() {
	        public int compare(QuickStat s1, QuickStat s2) {
		        String item1 = s1.get_value(sort_column);
		        String item2 = s2.get_value(sort_column);
				// first try to convert numeric columns to floats b4 comparing
		        try{
		          float f1 = Float.parseFloat(item1);
		          float f2 = Float.parseFloat(item2);
		          if (f1 == f2) return 0;
		          if ((reverse && f1 > f2) || (!reverse && f1 < f2)) return 1;
		          return -1;
		        } catch( NumberFormatException e ){}

		        return reverse ? item2.compareTo(item1) :item1.compareTo(item2);
		    }
	      });

		reverse = !reverse;
    }
}


text:
Interlinks
==========

This plugin lets you add frequently-used URLs to your markup using short keywords.
Short URL format is `keyword>rest-of-url` where `keyword` is defined in your Pelican
settings file. This is subsequently replaced with the actual URL in the generated
HTML output.

Requirements
------------

This plugin requires BeautifulSoup:

	pip install beautifulsoup4

Installation
------------

Put the plugin into your plugins folder, then add Interlinks in your settings file:

	PLUGINS = ["interlinks"]

Usage
-----

Interlinks are specified in your settings file. Here is an example:

	INTERLINKS = {
	    'wikipedia_en': 'http://en.wikipedia.org/wiki/',
	    'wikipedia_es': 'http://es.wikipedia.org/wiki/',
	    'ddg': 'https://duckduckgo.com/?q='
	}

There's also a default key, `this`, that is mapped to the `SITEURL` variable.

Then, in your content, you just create a normal link but add the `keyword>` syntax as the URL scheme, followed by the rest of the URL.

Example (Markdown syntax)
-------------------------

	[Normal boring link](http://www.example.com). But this is a [cool link](this>) that links to this site.

	Search in [Wikipedia](wikipedia_en>python), ([here](wikipedia_es>python) in Spanish). You can also [search](ddg>python) it.

All the above will be rendered as:

Normal boring link. But this is a cool link that links to this site.

Search in Wikipedia, (here in Spanish). You can also search it.


text:
/**
 * @author Anton Avtamonov
 */
package javax.swing;

public interface SwingConstants {
    static final int CENTER = 0;
    static final int TOP = 1;
    static final int LEFT = 2;
    static final int BOTTOM = 3;
    static final int RIGHT = 4;
    static final int NORTH = 1;
    static final int NORTH_EAST = 2;
    static final int EAST = 3;
    static final int SOUTH_EAST = 4;
    static final int SOUTH = 5;
    static final int SOUTH_WEST = 6;
    static final int WEST = 7;
    static final int NORTH_WEST = 8;
    static final int HORIZONTAL = 0;
    static final int VERTICAL = 1;
    static final int LEADING = 10;
    static final int TRAILING = 11;
    static final int NEXT = 12;
    static final int PREVIOUS = 13;
}